xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/doc/invoke.texi (revision d909946ca08dceb44d7d0f22ec9488679695d976)
1@c Copyright (C) 1988-2015 Free Software Foundation, Inc.
2@c This is part of the GCC manual.
3@c For copying conditions, see the file gcc.texi.
4
5@ignore
6@c man begin INCLUDE
7@include gcc-vers.texi
8@c man end
9
10@c man begin COPYRIGHT
11Copyright @copyright{} 1988-2015 Free Software Foundation, Inc.
12
13Permission is granted to copy, distribute and/or modify this document
14under the terms of the GNU Free Documentation License, Version 1.3 or
15any later version published by the Free Software Foundation; with the
16Invariant Sections being ``GNU General Public License'' and ``Funding
17Free Software'', the Front-Cover texts being (a) (see below), and with
18the Back-Cover Texts being (b) (see below).  A copy of the license is
19included in the gfdl(7) man page.
20
21(a) The FSF's Front-Cover Text is:
22
23     A GNU Manual
24
25(b) The FSF's Back-Cover Text is:
26
27     You have freedom to copy and modify this GNU Manual, like GNU
28     software.  Copies published by the Free Software Foundation raise
29     funds for GNU development.
30@c man end
31@c Set file name and title for the man page.
32@setfilename gcc
33@settitle GNU project C and C++ compiler
34@c man begin SYNOPSIS
35gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36    [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37    [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38    [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39    [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40    [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41    [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43Only the most useful options are listed here; see below for the
44remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
45@c man end
46@c man begin SEEALSO
47gpl(7), gfdl(7), fsf-funding(7),
48cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
49and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50@file{ld}, @file{binutils} and @file{gdb}.
51@c man end
52@c man begin BUGS
53For instructions on reporting bugs, see
54@w{@value{BUGURL}}.
55@c man end
56@c man begin AUTHOR
57See the Info entry for @command{gcc}, or
58@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59for contributors to GCC@.
60@c man end
61@end ignore
62
63@node Invoking GCC
64@chapter GCC Command Options
65@cindex GCC command options
66@cindex command options
67@cindex options, GCC command
68
69@c man begin DESCRIPTION
70When you invoke GCC, it normally does preprocessing, compilation,
71assembly and linking.  The ``overall options'' allow you to stop this
72process at an intermediate stage.  For example, the @option{-c} option
73says not to run the linker.  Then the output consists of object files
74output by the assembler.
75
76Other options are passed on to one stage of processing.  Some options
77control the preprocessor and others the compiler itself.  Yet other
78options control the assembler and linker; most of these are not
79documented here, since you rarely need to use any of them.
80
81@cindex C compilation options
82Most of the command-line options that you can use with GCC are useful
83for C programs; when an option is only useful with another language
84(usually C++), the explanation says so explicitly.  If the description
85for a particular option does not mention a source language, you can use
86that option with all supported languages.
87
88@cindex C++ compilation options
89@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
90options for compiling C++ programs.
91
92@cindex grouping options
93@cindex options, grouping
94The @command{gcc} program accepts options and file names as operands.  Many
95options have multi-letter names; therefore multiple single-letter options
96may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
97-v}}.
98
99@cindex order of options
100@cindex options, order
101You can mix options and other arguments.  For the most part, the order
102you use doesn't matter.  Order does matter when you use several
103options of the same kind; for example, if you specify @option{-L} more
104than once, the directories are searched in the order specified.  Also,
105the placement of the @option{-l} option is significant.
106
107Many options have long names starting with @samp{-f} or with
108@samp{-W}---for example,
109@option{-fmove-loop-invariants}, @option{-Wformat} and so on.  Most of
110these have both positive and negative forms; the negative form of
111@option{-ffoo} is @option{-fno-foo}.  This manual documents
112only one of these two forms, whichever one is not the default.
113
114@c man end
115
116@xref{Option Index}, for an index to GCC's options.
117
118@menu
119* Option Summary::      Brief list of all options, without explanations.
120* Overall Options::     Controlling the kind of output:
121                        an executable, object files, assembler files,
122                        or preprocessed source.
123* Invoking G++::        Compiling C++ programs.
124* C Dialect Options::   Controlling the variant of C language compiled.
125* C++ Dialect Options:: Variations on C++.
126* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
127                        and Objective-C++.
128* Language Independent Options:: Controlling how diagnostics should be
129                        formatted.
130* Warning Options::     How picky should the compiler be?
131* Debugging Options::   Symbol tables, measurements, and debugging dumps.
132* Optimize Options::    How much optimization?
133* Preprocessor Options:: Controlling header files and macro definitions.
134                         Also, getting dependency information for Make.
135* Assembler Options::   Passing options to the assembler.
136* Link Options::        Specifying libraries and so on.
137* Directory Options::   Where to find header files and libraries.
138                        Where to find the compiler executable files.
139* Spec Files::          How to pass switches to sub-processes.
140* Target Options::      Running a cross-compiler, or an old version of GCC.
141* Submodel Options::    Specifying minor hardware or convention variations,
142                        such as 68010 vs 68020.
143* Code Gen Options::    Specifying conventions for function calls, data layout
144                        and register usage.
145* Environment Variables:: Env vars that affect GCC.
146* Precompiled Headers:: Compiling a header once, and using it many times.
147@end menu
148
149@c man begin OPTIONS
150
151@node Option Summary
152@section Option Summary
153
154Here is a summary of all the options, grouped by type.  Explanations are
155in the following sections.
156
157@table @emph
158@item Overall Options
159@xref{Overall Options,,Options Controlling the Kind of Output}.
160@gccoptlist{-c  -S  -E  -o @var{file}  -no-canonical-prefixes  @gol
161-pipe  -pass-exit-codes  @gol
162-x @var{language}  -v  -###  --help@r{[}=@var{class}@r{[},@dots{}@r{]]}  --target-help  @gol
163--version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg}  @gol
164-fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
165
166@item C Language Options
167@xref{C Dialect Options,,Options Controlling C Dialect}.
168@gccoptlist{-ansi  -std=@var{standard}  -fgnu89-inline @gol
169-aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
170-fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
171-fhosted  -ffreestanding -fopenmp -fms-extensions -fplan9-extensions @gol
172-trigraphs  -traditional  -traditional-cpp @gol
173-fallow-single-precision  -fcond-mismatch -flax-vector-conversions @gol
174-fsigned-bitfields  -fsigned-char @gol
175-funsigned-bitfields  -funsigned-char}
176
177@item C++ Language Options
178@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
179@gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
180-fconstexpr-depth=@var{n}  -ffriend-injection @gol
181-fno-elide-constructors @gol
182-fno-enforce-eh-specs @gol
183-ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
184-fno-implicit-templates @gol
185-fno-implicit-inline-templates @gol
186-fno-implement-inlines  -fms-extensions @gol
187-fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names @gol
188-fno-optional-diags  -fpermissive @gol
189-fno-pretty-templates @gol
190-frepo  -fno-rtti  -fstats  -ftemplate-backtrace-limit=@var{n} @gol
191-ftemplate-depth=@var{n} @gol
192-fno-threadsafe-statics -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
193-fno-default-inline  -fvisibility-inlines-hidden @gol
194-fvisibility-ms-compat @gol
195-fext-numeric-literals @gol
196-Wabi  -Wconversion-null  -Wctor-dtor-privacy @gol
197-Wdelete-non-virtual-dtor -Wliteral-suffix -Wnarrowing @gol
198-Wnoexcept -Wnon-virtual-dtor  -Wreorder @gol
199-Weffc++  -Wstrict-null-sentinel @gol
200-Wno-non-template-friend  -Wold-style-cast @gol
201-Woverloaded-virtual  -Wno-pmf-conversions @gol
202-Wsign-promo}
203
204@item Objective-C and Objective-C++ Language Options
205@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
206Objective-C and Objective-C++ Dialects}.
207@gccoptlist{-fconstant-string-class=@var{class-name} @gol
208-fgnu-runtime  -fnext-runtime @gol
209-fno-nil-receivers @gol
210-fobjc-abi-version=@var{n} @gol
211-fobjc-call-cxx-cdtors @gol
212-fobjc-direct-dispatch @gol
213-fobjc-exceptions @gol
214-fobjc-gc @gol
215-fobjc-nilcheck @gol
216-fobjc-std=objc1 @gol
217-freplace-objc-classes @gol
218-fzero-link @gol
219-gen-decls @gol
220-Wassign-intercept @gol
221-Wno-protocol  -Wselector @gol
222-Wstrict-selector-match @gol
223-Wundeclared-selector}
224
225@item Language Independent Options
226@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
227@gccoptlist{-fmessage-length=@var{n}  @gol
228-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
229-fno-diagnostics-show-option -fno-diagnostics-show-caret}
230
231@item Warning Options
232@xref{Warning Options,,Options to Request or Suppress Warnings}.
233@gccoptlist{-fsyntax-only  -fmax-errors=@var{n}  -Wpedantic @gol
234-pedantic-errors @gol
235-w  -Wextra  -Wall  -Waddress  -Waggregate-return  @gol
236-Waggressive-loop-optimizations -Warray-bounds @gol
237-Wno-attributes -Wno-builtin-macro-redefined @gol
238-Wc++-compat -Wc++11-compat -Wcast-align  -Wcast-qual  @gol
239-Wchar-subscripts -Wclobbered  -Wcomment @gol
240-Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wno-deprecated  @gol
241-Wno-deprecated-declarations -Wdisabled-optimization  @gol
242-Wno-div-by-zero -Wdouble-promotion -Wempty-body  -Wenum-compare @gol
243-Wno-endif-labels -Werror  -Werror=* @gol
244-Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
245-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
246-Wformat-security  -Wformat-y2k @gol
247-Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
248-Wignored-qualifiers @gol
249-Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
250-Winit-self  -Winline -Wmaybe-uninitialized @gol
251-Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
252-Winvalid-pch -Wlarger-than=@var{len}  -Wunsafe-loop-optimizations @gol
253-Wlogical-op -Wlong-long @gol
254-Wmain -Wmaybe-uninitialized -Wmissing-braces  -Wmissing-field-initializers @gol
255-Wmissing-include-dirs @gol
256-Wno-mudflap @gol
257-Wno-multichar  -Wnonnull  -Wno-overflow @gol
258-Woverlength-strings  -Wpacked  -Wpacked-bitfield-compat  -Wpadded @gol
259-Wparentheses  -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
260-Wpointer-arith  -Wno-pointer-to-int-cast @gol
261-Wredundant-decls  -Wno-return-local-addr @gol
262-Wreturn-type  -Wsequence-point  -Wshadow @gol
263-Wsign-compare  -Wsign-conversion  -Wsizeof-pointer-memaccess @gol
264-Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
265-Wstrict-aliasing=n @gol -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
266-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
267-Wmissing-format-attribute @gol
268-Wswitch  -Wswitch-default  -Wswitch-enum -Wsync-nand @gol
269-Wsystem-headers  -Wtrampolines  -Wtrigraphs  -Wtype-limits  -Wundef @gol
270-Wuninitialized  -Wunknown-pragmas  -Wno-pragmas @gol
271-Wunsuffixed-float-constants  -Wunused  -Wunused-function @gol
272-Wunused-label  -Wunused-local-typedefs -Wunused-parameter @gol
273-Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
274-Wunused-but-set-parameter -Wunused-but-set-variable @gol
275-Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
276-Wvla -Wvolatile-register-var  -Wwrite-strings -Wzero-as-null-pointer-constant}
277
278@item C and Objective-C-only Warning Options
279@gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
280-Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs @gol
281-Wold-style-declaration  -Wold-style-definition @gol
282-Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion @gol
283-Wdeclaration-after-statement -Wpointer-sign}
284
285@item Debugging Options
286@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
287@gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
288-fsanitize=@var{style} @gol
289-fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
290-fdisable-ipa-@var{pass_name} @gol
291-fdisable-rtl-@var{pass_name} @gol
292-fdisable-rtl-@var{pass-name}=@var{range-list} @gol
293-fdisable-tree-@var{pass_name} @gol
294-fdisable-tree-@var{pass-name}=@var{range-list} @gol
295-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
296-fdump-translation-unit@r{[}-@var{n}@r{]} @gol
297-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
298-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
299-fdump-passes @gol
300-fdump-statistics @gol
301-fdump-tree-all @gol
302-fdump-tree-original@r{[}-@var{n}@r{]}  @gol
303-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
304-fdump-tree-cfg -fdump-tree-alias @gol
305-fdump-tree-ch @gol
306-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
307-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
308-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
309-fdump-tree-dom@r{[}-@var{n}@r{]} @gol
310-fdump-tree-dse@r{[}-@var{n}@r{]} @gol
311-fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
312-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
313-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
314-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
315-fdump-tree-nrv -fdump-tree-vect @gol
316-fdump-tree-sink @gol
317-fdump-tree-sra@r{[}-@var{n}@r{]} @gol
318-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
319-fdump-tree-fre@r{[}-@var{n}@r{]} @gol
320-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
321-ftree-vectorizer-verbose=@var{n} @gol
322-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
323-fdump-final-insns=@var{file} @gol
324-fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second @gol
325-feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
326-feliminate-unused-debug-symbols -femit-class-debug-always @gol
327-fenable-@var{kind}-@var{pass} @gol
328-fenable-@var{kind}-@var{pass}=@var{range-list} @gol
329-fdebug-types-section -fmem-report-wpa @gol
330-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
331-fopt-info @gol
332-fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
333-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
334-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
335-fstack-usage  -ftest-coverage  -ftime-report -fvar-tracking @gol
336-fvar-tracking-assignments  -fvar-tracking-assignments-toggle @gol
337-g  -g@var{level}  -gtoggle  -gcoff  -gdwarf-@var{version} @gol
338-ggdb  -grecord-gcc-switches  -gno-record-gcc-switches @gol
339-gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
340-gvms  -gxcoff  -gxcoff+ @gol
341-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
342-fdebug-prefix-map=@var{old}=@var{new} @gol
343-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
344-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
345-p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
346-print-multi-directory  -print-multi-lib  -print-multi-os-directory @gol
347-print-prog-name=@var{program}  -print-search-dirs  -Q @gol
348-print-sysroot -print-sysroot-headers-suffix @gol
349-save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
350
351@item Optimization Options
352@xref{Optimize Options,,Options that Control Optimization}.
353@gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
354-falign-jumps[=@var{n}] @gol
355-falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
356-fassociative-math -fauto-inc-dec -fbranch-probabilities @gol
357-fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
358-fbtr-bb-exclusive -fcaller-saves @gol
359-fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
360-fcompare-elim -fcprop-registers -fcrossjumping @gol
361-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
362-fcx-limited-range @gol
363-fdata-sections -fdce -fdelayed-branch @gol
364-fdelete-null-pointer-checks -fdevirtualize -fdse @gol
365-fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
366-ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
367-fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
368-fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
369-fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
370-fif-conversion2 -findirect-inlining @gol
371-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
372-finline-small-functions -fipa-cp -fipa-cp-clone @gol
373-fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol
374-fira-algorithm=@var{algorithm} @gol
375-fira-region=@var{region} -fira-hoist-pressure @gol
376-fira-loop-pressure -fno-ira-share-save-slots @gol
377-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
378-fivopts -fkeep-inline-functions -fkeep-static-consts @gol
379-floop-block -floop-interchange -floop-strip-mine -floop-nest-optimize @gol
380-floop-parallelize-all -flto -flto-compression-level @gol
381-flto-partition=@var{alg} -flto-report -fmerge-all-constants @gol
382-fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
383-fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg @gol
384-fno-default-inline @gol
385-fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
386-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
387-fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
388-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
389-fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
390-fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
391-fprefetch-loop-arrays -fprofile-report @gol
392-fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
393-fprofile-generate=@var{path} @gol
394-fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
395-freciprocal-math -free -fregmove -frename-registers -freorder-blocks @gol
396-freorder-blocks-and-partition -freorder-functions @gol
397-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
398-frounding-math -fsched2-use-superblocks -fsched-pressure @gol
399-fsched-spec-load -fsched-spec-load-dangerous @gol
400-fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
401-fsched-group-heuristic -fsched-critical-path-heuristic @gol
402-fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
403-fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
404-fschedule-insns -fschedule-insns2 -fsection-anchors @gol
405-fselective-scheduling -fselective-scheduling2 @gol
406-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
407-fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol
408-fsplit-ivs-in-unroller -fsplit-wide-types -fstack-protector @gol
409-fstack-protector-all -fstrict-aliasing -fstrict-overflow @gol
410-fthread-jumps -ftracer -ftree-bit-ccp @gol
411-ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
412-ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol
413-ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
414-ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
415-ftree-loop-if-convert-stores -ftree-loop-im @gol
416-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
417-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
418-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
419-ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
420-ftree-switch-conversion -ftree-tail-merge @gol
421-ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
422-funit-at-a-time -funroll-all-loops -funroll-loops @gol
423-funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
424-fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
425-fwhole-program -fwpa -fuse-ld=@var{linker} -fuse-linker-plugin @gol
426--param @var{name}=@var{value}
427-O  -O0  -O1  -O2  -O3  -Os -Ofast -Og}
428
429@item Preprocessor Options
430@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
431@gccoptlist{-A@var{question}=@var{answer} @gol
432-A-@var{question}@r{[}=@var{answer}@r{]} @gol
433-C  -dD  -dI  -dM  -dN @gol
434-D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
435-idirafter @var{dir} @gol
436-include @var{file}  -imacros @var{file} @gol
437-iprefix @var{file}  -iwithprefix @var{dir} @gol
438-iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
439-cxx-isystem @var{dir} @gol
440-imultilib @var{dir} -isysroot @var{dir} @gol
441-M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
442-P  -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
443-remap -trigraphs  -undef  -U@var{macro}  @gol
444-Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
445
446@item Assembler Option
447@xref{Assembler Options,,Passing Options to the Assembler}.
448@gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
449
450@item Linker Options
451@xref{Link Options,,Options for Linking}.
452@gccoptlist{@var{object-file-name}  -l@var{library} @gol
453-nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
454-s  -static -static-libgcc -static-libstdc++ @gol
455-static-libasan -static-libtsan @gol
456-shared -shared-libgcc  -symbolic @gol
457-T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
458-u @var{symbol}}
459
460@item Directory Options
461@xref{Directory Options,,Options for Directory Search}.
462@gccoptlist{-B@var{prefix}  -I@var{dir}  -iquote@var{dir}
463-iremap@var{src}:@var{dst}  -L@var{dir}
464-specs=@var{file}  -I- --sysroot=@var{dir}}
465
466@item Target Options
467@c I wrote this xref this way to avoid overfull hbox. -- rms
468@xref{Target Options}.
469@gccoptlist{-V @var{version}  -b @var{machine}}
470@gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
471-iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
472--sysroot=@var{dir} --no-sysroot-suffix}
473
474@item Machine Dependent Options
475@xref{Submodel Options,,Hardware Models and Configurations}.
476@c This list is ordered alphanumerically by subsection name.
477@c Try and put the significant identifier (CPU or system) first,
478@c so users have a clue at guessing where the ones they want will be.
479
480@emph{AArch64 Options}
481@gccoptlist{-mbig-endian  -mlittle-endian @gol
482-mgeneral-regs-only @gol
483-mcmodel=tiny  -mcmodel=small  -mcmodel=large @gol
484-mstrict-align @gol
485-momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
486-mtls-dialect=desc  -mtls-dialect=traditional @gol
487-mfix-cortex-a53-835769  -mno-fix-cortex-a53-835769 @gol
488-march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}}
489
490@emph{Adapteva Epiphany Options}
491@gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
492-mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
493-msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
494-mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
495-mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
496-msplit-vecmove-early -m1reg-@var{reg}}
497
498@emph{ARM Options}
499@gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
500-mabi=@var{name} @gol
501-mapcs-stack-check  -mno-apcs-stack-check @gol
502-mapcs-float  -mno-apcs-float @gol
503-mapcs-reentrant  -mno-apcs-reentrant @gol
504-msched-prolog  -mno-sched-prolog @gol
505-mlittle-endian  -mbig-endian  -mwords-little-endian @gol
506-mfloat-abi=@var{name} @gol
507-mfp16-format=@var{name}
508-mthumb-interwork  -mno-thumb-interwork @gol
509-mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
510-mstructure-size-boundary=@var{n} @gol
511-mabort-on-noreturn @gol
512-mlong-calls  -mno-long-calls @gol
513-msingle-pic-base  -mno-single-pic-base @gol
514-mpic-register=@var{reg} @gol
515-mnop-fun-dllimport @gol
516-mpoke-function-name @gol
517-mthumb  -marm @gol
518-mtpcs-frame  -mtpcs-leaf-frame @gol
519-mcaller-super-interworking  -mcallee-super-interworking @gol
520-mtp=@var{name} -mtls-dialect=@var{dialect} @gol
521-mword-relocations @gol
522-mfix-cortex-m3-ldrd @gol
523-munaligned-access}
524
525@emph{AVR Options}
526@gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
527-mcall-prologues -mint8 -mno-interrupts -mrelax @gol
528-mstrict-X -mtiny-stack -Waddr-space-convert}
529
530@emph{Blackfin Options}
531@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
532-msim -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
533-mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly @gol
534-mlow-64k -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
535-mno-id-shared-library  -mshared-library-id=@var{n} @gol
536-mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
537-msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls @gol
538-mfast-fp -minline-plt -mmulticore  -mcorea  -mcoreb  -msdram @gol
539-micplb}
540
541@emph{C6X Options}
542@gccoptlist{-mbig-endian  -mlittle-endian -march=@var{cpu} @gol
543-msim -msdata=@var{sdata-type}}
544
545@emph{CRIS Options}
546@gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
547-mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
548-metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
549-mstack-align  -mdata-align  -mconst-align @gol
550-m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
551-melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
552-mmul-bug-workaround  -mno-mul-bug-workaround}
553
554@emph{CR16 Options}
555@gccoptlist{-mmac @gol
556-mcr16cplus -mcr16c @gol
557-msim -mint32 -mbit-ops
558-mdata-model=@var{model}}
559
560@emph{Darwin Options}
561@gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
562-arch_only  -bind_at_load  -bundle  -bundle_loader @gol
563-client_name  -compatibility_version  -current_version @gol
564-dead_strip @gol
565-dependency-file  -dylib_file  -dylinker_install_name @gol
566-dynamic  -dynamiclib  -exported_symbols_list @gol
567-filelist  -flat_namespace  -force_cpusubtype_ALL @gol
568-force_flat_namespace  -headerpad_max_install_names @gol
569-iframework @gol
570-image_base  -init  -install_name  -keep_private_externs @gol
571-multi_module  -multiply_defined  -multiply_defined_unused @gol
572-noall_load   -no_dead_strip_inits_and_terms @gol
573-nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
574-pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
575-private_bundle  -read_only_relocs  -sectalign @gol
576-sectobjectsymbols  -whyload  -seg1addr @gol
577-sectcreate  -sectobjectsymbols  -sectorder @gol
578-segaddr -segs_read_only_addr -segs_read_write_addr @gol
579-seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
580-segprot  -segs_read_only_addr  -segs_read_write_addr @gol
581-single_module  -static  -sub_library  -sub_umbrella @gol
582-twolevel_namespace  -umbrella  -undefined @gol
583-unexported_symbols_list  -weak_reference_mismatches @gol
584-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
585-mkernel -mone-byte-bool}
586
587@emph{DEC Alpha Options}
588@gccoptlist{-mno-fp-regs  -msoft-float @gol
589-mieee  -mieee-with-inexact  -mieee-conformant @gol
590-mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
591-mtrap-precision=@var{mode}  -mbuild-constants @gol
592-mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
593-mbwx  -mmax  -mfix  -mcix @gol
594-mfloat-vax  -mfloat-ieee @gol
595-mexplicit-relocs  -msmall-data  -mlarge-data @gol
596-msmall-text  -mlarge-text @gol
597-mmemory-latency=@var{time}}
598
599@emph{FR30 Options}
600@gccoptlist{-msmall-model -mno-lsim}
601
602@emph{FRV Options}
603@gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
604-mhard-float  -msoft-float @gol
605-malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
606-mdouble  -mno-double @gol
607-mmedia  -mno-media  -mmuladd  -mno-muladd @gol
608-mfdpic  -minline-plt -mgprel-ro  -multilib-library-pic @gol
609-mlinked-fp  -mlong-calls  -malign-labels @gol
610-mlibrary-pic  -macc-4  -macc-8 @gol
611-mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
612-moptimize-membar -mno-optimize-membar @gol
613-mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
614-mvliw-branch  -mno-vliw-branch @gol
615-mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
616-mno-nested-cond-exec  -mtomcat-stats @gol
617-mTLS -mtls @gol
618-mcpu=@var{cpu}}
619
620@emph{GNU/Linux Options}
621@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
622-tno-android-cc -tno-android-ld}
623
624@emph{H8/300 Options}
625@gccoptlist{-mrelax  -mh  -ms  -mn  -mexr -mno-exr  -mint32  -malign-300}
626
627@emph{HPPA Options}
628@gccoptlist{-march=@var{architecture-type} @gol
629-mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
630-mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
631-mfixed-range=@var{register-range} @gol
632-mjump-in-delay -mlinker-opt -mlong-calls @gol
633-mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
634-mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
635-mno-jump-in-delay  -mno-long-load-store @gol
636-mno-portable-runtime  -mno-soft-float @gol
637-mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
638-mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
639-mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
640-munix=@var{unix-std}  -nolibdld  -static  -threads}
641
642@emph{i386 and x86-64 Options}
643@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
644-mfpmath=@var{unit} @gol
645-masm=@var{dialect}  -mno-fancy-math-387 @gol
646-mno-fp-ret-in-387  -msoft-float @gol
647-mno-wide-multiply  -mrtd  -malign-double @gol
648-mpreferred-stack-boundary=@var{num} @gol
649-mincoming-stack-boundary=@var{num} @gol
650-mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
651-mrecip -mrecip=@var{opt} @gol
652-mvzeroupper -mprefer-avx128 @gol
653-mmmx  -msse  -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
654-mavx2 -maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
655-msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
656-mbmi2 -mrtm -mlwp -mthreads @gol
657-mno-align-stringops  -minline-all-stringops @gol
658-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
659-mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
660-m96bit-long-double -mlong-double-64 -mlong-double-80 @gol
661-mregparm=@var{num}  -msseregparm @gol
662-mveclibabi=@var{type} -mvect8-ret-in-mem @gol
663-mpc32 -mpc64 -mpc80 -mstackrealign @gol
664-momit-leaf-frame-pointer  -mno-red-zone -mno-tls-direct-seg-refs @gol
665-mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
666-m32 -m64 -mx32 -mlarge-data-threshold=@var{num} @gol
667-msse2avx -mfentry -m8bit-idiv @gol
668-mavx256-split-unaligned-load -mavx256-split-unaligned-store}
669
670@emph{i386 and x86-64 Windows Options}
671@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
672-mnop-fun-dllimport -mthread @gol
673-municode -mwin32 -mwindows -fno-set-stack-executable}
674
675@emph{IA-64 Options}
676@gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
677-mvolatile-asm-stop  -mregister-names  -msdata -mno-sdata @gol
678-mconstant-gp  -mauto-pic  -mfused-madd @gol
679-minline-float-divide-min-latency @gol
680-minline-float-divide-max-throughput @gol
681-mno-inline-float-divide @gol
682-minline-int-divide-min-latency @gol
683-minline-int-divide-max-throughput  @gol
684-mno-inline-int-divide @gol
685-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
686-mno-inline-sqrt @gol
687-mdwarf2-asm -mearly-stop-bits @gol
688-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
689-mtune=@var{cpu-type} -milp32 -mlp64 @gol
690-msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
691-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
692-msched-spec-ldc -msched-spec-control-ldc @gol
693-msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
694-msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
695-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
696-msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
697
698@emph{LM32 Options}
699@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
700-msign-extend-enabled -muser-enabled}
701
702@emph{M32R/D Options}
703@gccoptlist{-m32r2 -m32rx -m32r @gol
704-mdebug @gol
705-malign-loops -mno-align-loops @gol
706-missue-rate=@var{number} @gol
707-mbranch-cost=@var{number} @gol
708-mmodel=@var{code-size-model-type} @gol
709-msdata=@var{sdata-type} @gol
710-mno-flush-func -mflush-func=@var{name} @gol
711-mno-flush-trap -mflush-trap=@var{number} @gol
712-G @var{num}}
713
714@emph{M32C Options}
715@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
716
717@emph{M680x0 Options}
718@gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune}
719-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
720-m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
721-mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
722-mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
723-mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
724-malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
725-mshared-library-id=n  -mid-shared-library  -mno-id-shared-library @gol
726-mxgot -mno-xgot}
727
728@emph{MCore Options}
729@gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
730-mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
731-m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
732-mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
733-mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
734
735@emph{MeP Options}
736@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
737-mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
738-mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
739-mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
740-mtiny=@var{n}}
741
742@emph{MicroBlaze Options}
743@gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
744-mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
745-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
746-mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
747-mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
748
749@emph{MIPS Options}
750@gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
751-mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2 @gol
752-mips64  -mips64r2 @gol
753-mips16  -mno-mips16  -mflip-mips16 @gol
754-minterlink-mips16  -mno-interlink-mips16 @gol
755-mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
756-mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
757-mgp32  -mgp64  -mfp32  -mfp64  -mhard-float  -msoft-float @gol
758-mno-float -msingle-float  -mdouble-float  @gol
759-mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
760-mmcu -mmno-mcu @gol
761-mfpu=@var{fpu-type} @gol
762-msmartmips  -mno-smartmips @gol
763-mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx @gol
764-mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc @gol
765-mlong64  -mlong32  -msym32  -mno-sym32 @gol
766-G@var{num}  -mlocal-sdata  -mno-local-sdata @gol
767-mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt @gol
768-membedded-data  -mno-embedded-data @gol
769-muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
770-mcode-readable=@var{setting} @gol
771-msplit-addresses  -mno-split-addresses @gol
772-mexplicit-relocs  -mno-explicit-relocs @gol
773-mcheck-zero-division  -mno-check-zero-division @gol
774-mdivide-traps  -mdivide-breaks @gol
775-mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
776-mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
777-mfix-24k -mno-fix-24k @gol
778-mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
779-mfix-r10000 -mno-fix-r10000  -mfix-vr4120  -mno-fix-vr4120 @gol
780-mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1 @gol
781-mflush-func=@var{func}  -mno-flush-func @gol
782-mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely @gol
783-mfp-exceptions -mno-fp-exceptions @gol
784-mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
785-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
786
787@emph{MMIX Options}
788@gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
789-mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
790-melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
791-mno-base-addresses  -msingle-exit  -mno-single-exit}
792
793@emph{MN10300 Options}
794@gccoptlist{-mmult-bug  -mno-mult-bug @gol
795-mno-am33 -mam33 -mam33-2 -mam34 @gol
796-mtune=@var{cpu-type} @gol
797-mreturn-pointer-on-d0 @gol
798-mno-crt0  -mrelax -mliw -msetlb}
799
800@emph{Moxie Options}
801@gccoptlist{-meb -mel -mno-crt0}
802
803@emph{PDP-11 Options}
804@gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
805-mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
806-mint16  -mno-int32  -mfloat32  -mno-float64 @gol
807-mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
808-mbranch-expensive  -mbranch-cheap @gol
809-munix-asm  -mdec-asm}
810
811@emph{picoChip Options}
812@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
813-msymbol-as-address -mno-inefficient-warnings}
814
815@emph{PowerPC Options}
816See RS/6000 and PowerPC Options.
817
818@emph{RL78 Options}
819@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78}
820
821@emph{RS/6000 and PowerPC Options}
822@gccoptlist{-mcpu=@var{cpu-type} @gol
823-mtune=@var{cpu-type} @gol
824-mcmodel=@var{code-model} @gol
825-mpowerpc64 @gol
826-maltivec  -mno-altivec @gol
827-mpowerpc-gpopt  -mno-powerpc-gpopt @gol
828-mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
829-mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb -mpopcntd -mno-popcntd @gol
830-mfprnd  -mno-fprnd @gol
831-mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
832-mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
833-m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
834-malign-power  -malign-natural @gol
835-msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
836-msingle-float -mdouble-float -msimple-fpu @gol
837-mstring  -mno-string  -mupdate  -mno-update @gol
838-mavoid-indexed-addresses  -mno-avoid-indexed-addresses @gol
839-mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
840-mstrict-align  -mno-strict-align  -mrelocatable @gol
841-mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
842-mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
843-mdynamic-no-pic  -maltivec -mswdiv  -msingle-pic-base @gol
844-mprioritize-restricted-insns=@var{priority} @gol
845-msched-costly-dep=@var{dependence_type} @gol
846-minsert-sched-nops=@var{scheme} @gol
847-mcall-sysv  -mcall-netbsd @gol
848-maix-struct-return  -msvr4-struct-return @gol
849-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
850-mblock-move-inline-limit=@var{num} @gol
851-misel -mno-isel @gol
852-misel=yes  -misel=no @gol
853-mspe -mno-spe @gol
854-mspe=yes  -mspe=no @gol
855-mpaired @gol
856-mgen-cell-microcode -mwarn-cell-microcode @gol
857-mvrsave -mno-vrsave @gol
858-mmulhw -mno-mulhw @gol
859-mdlmzb -mno-dlmzb @gol
860-mfloat-gprs=yes  -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
861-mprototype  -mno-prototype @gol
862-msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
863-msdata=@var{opt}  -mvxworks  -G @var{num}  -pthread @gol
864-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
865-mno-recip-precision @gol
866-mveclibabi=@var{type} -mfriz -mno-friz @gol
867-mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
868-msave-toc-indirect -mno-save-toc-indirect @gol
869-mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
870-mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol
871-mquad-memory -mno-quad-memory @gol
872-mquad-memory-atomic -mno-quad-memory-atomic @gol
873-mcompat-align-parm -mno-compat-align-parm}
874
875@emph{RX Options}
876@gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu@gol
877-mcpu=@gol
878-mbig-endian-data -mlittle-endian-data @gol
879-msmall-data @gol
880-msim  -mno-sim@gol
881-mas100-syntax -mno-as100-syntax@gol
882-mrelax@gol
883-mmax-constant-size=@gol
884-mint-register=@gol
885-mpid@gol
886-mno-warn-multiple-fast-interrupts@gol
887-msave-acc-in-interrupts}
888
889@emph{S/390 and zSeries Options}
890@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
891-mhard-float  -msoft-float  -mhard-dfp -mno-hard-dfp @gol
892-mlong-double-64 -mlong-double-128 @gol
893-mbackchain  -mno-backchain -mpacked-stack  -mno-packed-stack @gol
894-msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
895-m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
896-mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
897-mwarn-framesize  -mwarn-dynamicstack  -mstack-size -mstack-guard @gol
898-mhotpatch=@var{halfwords},@var{halfwords}}
899
900@emph{Score Options}
901@gccoptlist{-meb -mel @gol
902-mnhwloop @gol
903-muls @gol
904-mmac @gol
905-mscore5 -mscore5u -mscore7 -mscore7d}
906
907@emph{SH Options}
908@gccoptlist{-m1  -m2  -m2e @gol
909-m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
910-m3  -m3e @gol
911-m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
912-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
913-m5-64media  -m5-64media-nofpu @gol
914-m5-32media  -m5-32media-nofpu @gol
915-m5-compact  -m5-compact-nofpu @gol
916-mb  -ml  -mdalign  -mrelax @gol
917-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
918-mieee -mno-ieee -mbitops  -misize  -minline-ic_invalidate -mpadstruct @gol
919-mspace -mprefergot  -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
920-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
921-mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
922-maccumulate-outgoing-args -minvalid-symbols @gol
923-matomic-model=@var{atomic-model} @gol
924-mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch -mcbranchdi -mcmpeqdi @gol
925-mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
926-mpretend-cmove -mtas}
927
928@emph{Solaris 2 Options}
929@gccoptlist{-mimpure-text  -mno-impure-text @gol
930-pthreads -pthread}
931
932@emph{SPARC Options}
933@gccoptlist{-mcpu=@var{cpu-type} @gol
934-mtune=@var{cpu-type} @gol
935-mcmodel=@var{code-model} @gol
936-mmemory-model=@var{mem-model} @gol
937-m32  -m64  -mapp-regs  -mno-app-regs @gol
938-mfaster-structs  -mno-faster-structs  -mflat  -mno-flat @gol
939-mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
940-mhard-quad-float  -msoft-quad-float @gol
941-mstack-bias  -mno-stack-bias @gol
942-munaligned-doubles  -mno-unaligned-doubles @gol
943-muser-mode  -mno-user-mode @gol
944-mv8plus  -mno-v8plus  -mvis  -mno-vis @gol
945-mvis2  -mno-vis2  -mvis3  -mno-vis3 @gol
946-mcbcond -mno-cbcond @gol
947-mfmaf  -mno-fmaf  -mpopc  -mno-popc @gol
948-mfix-at697f -mfix-ut699}
949
950@emph{SPU Options}
951@gccoptlist{-mwarn-reloc -merror-reloc @gol
952-msafe-dma -munsafe-dma @gol
953-mbranch-hints @gol
954-msmall-mem -mlarge-mem -mstdmain @gol
955-mfixed-range=@var{register-range} @gol
956-mea32 -mea64 @gol
957-maddress-space-conversion -mno-address-space-conversion @gol
958-mcache-size=@var{cache-size} @gol
959-matomic-updates -mno-atomic-updates}
960
961@emph{System V Options}
962@gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
963
964@emph{TILE-Gx Options}
965@gccoptlist{-mcpu=@var{cpu} -m32 -m64 -mcmodel=@var{code-model}}
966
967@emph{TILEPro Options}
968@gccoptlist{-mcpu=@var{cpu} -m32}
969
970@emph{V850 Options}
971@gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
972-mprolog-function  -mno-prolog-function  -mspace @gol
973-mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
974-mapp-regs  -mno-app-regs @gol
975-mdisable-callt  -mno-disable-callt @gol
976-mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
977-mv850e -mv850 -mv850e3v5 @gol
978-mloop @gol
979-mrelax @gol
980-mlong-jumps @gol
981-msoft-float @gol
982-mhard-float @gol
983-mgcc-abi @gol
984-mrh850-abi @gol
985-mbig-switch}
986
987@emph{VAX Options}
988@gccoptlist{-mg  -mgnu  -munix}
989
990@emph{VMS Options}
991@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
992-mpointer-size=@var{size}}
993
994@emph{VxWorks Options}
995@gccoptlist{-mrtp  -non-static  -Bstatic  -Bdynamic @gol
996-Xbind-lazy  -Xbind-now}
997
998@emph{x86-64 Options}
999See i386 and x86-64 Options.
1000
1001@emph{Xstormy16 Options}
1002@gccoptlist{-msim}
1003
1004@emph{Xtensa Options}
1005@gccoptlist{-mconst16 -mno-const16 @gol
1006-mfused-madd  -mno-fused-madd @gol
1007-mforce-no-pic @gol
1008-mserialize-volatile  -mno-serialize-volatile @gol
1009-mtext-section-literals  -mno-text-section-literals @gol
1010-mtarget-align  -mno-target-align @gol
1011-mlongcalls  -mno-longcalls}
1012
1013@emph{zSeries Options}
1014See S/390 and zSeries Options.
1015
1016@item Code Generation Options
1017@xref{Code Gen Options,,Options for Code Generation Conventions}.
1018@gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
1019-ffixed-@var{reg}  -fexceptions @gol
1020-fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables @gol
1021-fasynchronous-unwind-tables @gol
1022-fno-gnu-unique @gol
1023-finhibit-size-directive  -finstrument-functions @gol
1024-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
1025-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
1026-fno-common  -fno-ident @gol
1027-fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
1028-fno-jump-tables @gol
1029-frecord-gcc-switches @gol
1030-freg-struct-return  -fshort-enums @gol
1031-fshort-double  -fshort-wchar @gol
1032-fverbose-asm  -fpack-struct[=@var{n}]  -fstack-check @gol
1033-fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
1034-fno-stack-limit -fsplit-stack @gol
1035-fleading-underscore  -ftls-model=@var{model} @gol
1036-fstack-reuse=@var{reuse_level} @gol
1037-ftrapv  -fwrapv  -fbounds-check @gol
1038-fvisibility -fstrict-volatile-bitfields -fsync-libcalls}
1039@end table
1040
1041@menu
1042* Overall Options::     Controlling the kind of output:
1043                        an executable, object files, assembler files,
1044                        or preprocessed source.
1045* C Dialect Options::   Controlling the variant of C language compiled.
1046* C++ Dialect Options:: Variations on C++.
1047* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
1048                        and Objective-C++.
1049* Language Independent Options:: Controlling how diagnostics should be
1050                        formatted.
1051* Warning Options::     How picky should the compiler be?
1052* Debugging Options::   Symbol tables, measurements, and debugging dumps.
1053* Optimize Options::    How much optimization?
1054* Preprocessor Options:: Controlling header files and macro definitions.
1055                         Also, getting dependency information for Make.
1056* Assembler Options::   Passing options to the assembler.
1057* Link Options::        Specifying libraries and so on.
1058* Directory Options::   Where to find header files and libraries.
1059                        Where to find the compiler executable files.
1060* Spec Files::          How to pass switches to sub-processes.
1061* Target Options::      Running a cross-compiler, or an old version of GCC.
1062@end menu
1063
1064@node Overall Options
1065@section Options Controlling the Kind of Output
1066
1067Compilation can involve up to four stages: preprocessing, compilation
1068proper, assembly and linking, always in that order.  GCC is capable of
1069preprocessing and compiling several files either into several
1070assembler input files, or into one assembler input file; then each
1071assembler input file produces an object file, and linking combines all
1072the object files (those newly compiled, and those specified as input)
1073into an executable file.
1074
1075@cindex file name suffix
1076For any given input file, the file name suffix determines what kind of
1077compilation is done:
1078
1079@table @gcctabopt
1080@item @var{file}.c
1081C source code that must be preprocessed.
1082
1083@item @var{file}.i
1084C source code that should not be preprocessed.
1085
1086@item @var{file}.ii
1087C++ source code that should not be preprocessed.
1088
1089@item @var{file}.m
1090Objective-C source code.  Note that you must link with the @file{libobjc}
1091library to make an Objective-C program work.
1092
1093@item @var{file}.mi
1094Objective-C source code that should not be preprocessed.
1095
1096@item @var{file}.mm
1097@itemx @var{file}.M
1098Objective-C++ source code.  Note that you must link with the @file{libobjc}
1099library to make an Objective-C++ program work.  Note that @samp{.M} refers
1100to a literal capital M@.
1101
1102@item @var{file}.mii
1103Objective-C++ source code that should not be preprocessed.
1104
1105@item @var{file}.h
1106C, C++, Objective-C or Objective-C++ header file to be turned into a
1107precompiled header (default), or C, C++ header file to be turned into an
1108Ada spec (via the @option{-fdump-ada-spec} switch).
1109
1110@item @var{file}.cc
1111@itemx @var{file}.cp
1112@itemx @var{file}.cxx
1113@itemx @var{file}.cpp
1114@itemx @var{file}.CPP
1115@itemx @var{file}.c++
1116@itemx @var{file}.C
1117C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1118the last two letters must both be literally @samp{x}.  Likewise,
1119@samp{.C} refers to a literal capital C@.
1120
1121@item @var{file}.mm
1122@itemx @var{file}.M
1123Objective-C++ source code that must be preprocessed.
1124
1125@item @var{file}.mii
1126Objective-C++ source code that should not be preprocessed.
1127
1128@item @var{file}.hh
1129@itemx @var{file}.H
1130@itemx @var{file}.hp
1131@itemx @var{file}.hxx
1132@itemx @var{file}.hpp
1133@itemx @var{file}.HPP
1134@itemx @var{file}.h++
1135@itemx @var{file}.tcc
1136C++ header file to be turned into a precompiled header or Ada spec.
1137
1138@item @var{file}.f
1139@itemx @var{file}.for
1140@itemx @var{file}.ftn
1141Fixed form Fortran source code that should not be preprocessed.
1142
1143@item @var{file}.F
1144@itemx @var{file}.FOR
1145@itemx @var{file}.fpp
1146@itemx @var{file}.FPP
1147@itemx @var{file}.FTN
1148Fixed form Fortran source code that must be preprocessed (with the traditional
1149preprocessor).
1150
1151@item @var{file}.f90
1152@itemx @var{file}.f95
1153@itemx @var{file}.f03
1154@itemx @var{file}.f08
1155Free form Fortran source code that should not be preprocessed.
1156
1157@item @var{file}.F90
1158@itemx @var{file}.F95
1159@itemx @var{file}.F03
1160@itemx @var{file}.F08
1161Free form Fortran source code that must be preprocessed (with the
1162traditional preprocessor).
1163
1164@item @var{file}.go
1165Go source code.
1166
1167@c FIXME: Descriptions of Java file types.
1168@c @var{file}.java
1169@c @var{file}.class
1170@c @var{file}.zip
1171@c @var{file}.jar
1172
1173@item @var{file}.ads
1174Ada source code file that contains a library unit declaration (a
1175declaration of a package, subprogram, or generic, or a generic
1176instantiation), or a library unit renaming declaration (a package,
1177generic, or subprogram renaming declaration).  Such files are also
1178called @dfn{specs}.
1179
1180@item @var{file}.adb
1181Ada source code file containing a library unit body (a subprogram or
1182package body).  Such files are also called @dfn{bodies}.
1183
1184@c GCC also knows about some suffixes for languages not yet included:
1185@c Pascal:
1186@c @var{file}.p
1187@c @var{file}.pas
1188@c Ratfor:
1189@c @var{file}.r
1190
1191@item @var{file}.s
1192Assembler code.
1193
1194@item @var{file}.S
1195@itemx @var{file}.sx
1196Assembler code that must be preprocessed.
1197
1198@item @var{other}
1199An object file to be fed straight into linking.
1200Any file name with no recognized suffix is treated this way.
1201@end table
1202
1203@opindex x
1204You can specify the input language explicitly with the @option{-x} option:
1205
1206@table @gcctabopt
1207@item -x @var{language}
1208Specify explicitly the @var{language} for the following input files
1209(rather than letting the compiler choose a default based on the file
1210name suffix).  This option applies to all following input files until
1211the next @option{-x} option.  Possible values for @var{language} are:
1212@smallexample
1213c  c-header  cpp-output
1214c++  c++-header  c++-cpp-output
1215objective-c  objective-c-header  objective-c-cpp-output
1216objective-c++ objective-c++-header objective-c++-cpp-output
1217assembler  assembler-with-cpp
1218ada
1219f77  f77-cpp-input f95  f95-cpp-input
1220go
1221java
1222@end smallexample
1223
1224@item -x none
1225Turn off any specification of a language, so that subsequent files are
1226handled according to their file name suffixes (as they are if @option{-x}
1227has not been used at all).
1228
1229@item -pass-exit-codes
1230@opindex pass-exit-codes
1231Normally the @command{gcc} program exits with the code of 1 if any
1232phase of the compiler returns a non-success return code.  If you specify
1233@option{-pass-exit-codes}, the @command{gcc} program instead returns with
1234the numerically highest error produced by any phase returning an error
1235indication.  The C, C++, and Fortran front ends return 4 if an internal
1236compiler error is encountered.
1237@end table
1238
1239If you only want some of the stages of compilation, you can use
1240@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1241one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1242@command{gcc} is to stop.  Note that some combinations (for example,
1243@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1244
1245@table @gcctabopt
1246@item -c
1247@opindex c
1248Compile or assemble the source files, but do not link.  The linking
1249stage simply is not done.  The ultimate output is in the form of an
1250object file for each source file.
1251
1252By default, the object file name for a source file is made by replacing
1253the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1254
1255Unrecognized input files, not requiring compilation or assembly, are
1256ignored.
1257
1258@item -S
1259@opindex S
1260Stop after the stage of compilation proper; do not assemble.  The output
1261is in the form of an assembler code file for each non-assembler input
1262file specified.
1263
1264By default, the assembler file name for a source file is made by
1265replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1266
1267Input files that don't require compilation are ignored.
1268
1269@item -E
1270@opindex E
1271Stop after the preprocessing stage; do not run the compiler proper.  The
1272output is in the form of preprocessed source code, which is sent to the
1273standard output.
1274
1275Input files that don't require preprocessing are ignored.
1276
1277@cindex output file option
1278@item -o @var{file}
1279@opindex o
1280Place output in file @var{file}.  This applies to whatever
1281sort of output is being produced, whether it be an executable file,
1282an object file, an assembler file or preprocessed C code.
1283
1284If @option{-o} is not specified, the default is to put an executable
1285file in @file{a.out}, the object file for
1286@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1287assembler file in @file{@var{source}.s}, a precompiled header file in
1288@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1289standard output.
1290
1291@item -v
1292@opindex v
1293Print (on standard error output) the commands executed to run the stages
1294of compilation.  Also print the version number of the compiler driver
1295program and of the preprocessor and the compiler proper.
1296
1297@item -###
1298@opindex ###
1299Like @option{-v} except the commands are not executed and arguments
1300are quoted unless they contain only alphanumeric characters or @code{./-_}.
1301This is useful for shell scripts to capture the driver-generated command lines.
1302
1303@item -pipe
1304@opindex pipe
1305Use pipes rather than temporary files for communication between the
1306various stages of compilation.  This fails to work on some systems where
1307the assembler is unable to read from a pipe; but the GNU assembler has
1308no trouble.
1309
1310@item --help
1311@opindex help
1312Print (on the standard output) a description of the command-line options
1313understood by @command{gcc}.  If the @option{-v} option is also specified
1314then @option{--help} is also passed on to the various processes
1315invoked by @command{gcc}, so that they can display the command-line options
1316they accept.  If the @option{-Wextra} option has also been specified
1317(prior to the @option{--help} option), then command-line options that
1318have no documentation associated with them are also displayed.
1319
1320@item --target-help
1321@opindex target-help
1322Print (on the standard output) a description of target-specific command-line
1323options for each tool.  For some targets extra target-specific
1324information may also be printed.
1325
1326@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1327Print (on the standard output) a description of the command-line
1328options understood by the compiler that fit into all specified classes
1329and qualifiers.  These are the supported classes:
1330
1331@table @asis
1332@item @samp{optimizers}
1333Display all of the optimization options supported by the
1334compiler.
1335
1336@item @samp{warnings}
1337Display all of the options controlling warning messages
1338produced by the compiler.
1339
1340@item @samp{target}
1341Display target-specific options.  Unlike the
1342@option{--target-help} option however, target-specific options of the
1343linker and assembler are not displayed.  This is because those
1344tools do not currently support the extended @option{--help=} syntax.
1345
1346@item @samp{params}
1347Display the values recognized by the @option{--param}
1348option.
1349
1350@item @var{language}
1351Display the options supported for @var{language}, where
1352@var{language} is the name of one of the languages supported in this
1353version of GCC@.
1354
1355@item @samp{common}
1356Display the options that are common to all languages.
1357@end table
1358
1359These are the supported qualifiers:
1360
1361@table @asis
1362@item @samp{undocumented}
1363Display only those options that are undocumented.
1364
1365@item @samp{joined}
1366Display options taking an argument that appears after an equal
1367sign in the same continuous piece of text, such as:
1368@samp{--help=target}.
1369
1370@item @samp{separate}
1371Display options taking an argument that appears as a separate word
1372following the original option, such as: @samp{-o output-file}.
1373@end table
1374
1375Thus for example to display all the undocumented target-specific
1376switches supported by the compiler, use:
1377
1378@smallexample
1379--help=target,undocumented
1380@end smallexample
1381
1382The sense of a qualifier can be inverted by prefixing it with the
1383@samp{^} character, so for example to display all binary warning
1384options (i.e., ones that are either on or off and that do not take an
1385argument) that have a description, use:
1386
1387@smallexample
1388--help=warnings,^joined,^undocumented
1389@end smallexample
1390
1391The argument to @option{--help=} should not consist solely of inverted
1392qualifiers.
1393
1394Combining several classes is possible, although this usually
1395restricts the output so much that there is nothing to display.  One
1396case where it does work, however, is when one of the classes is
1397@var{target}.  For example, to display all the target-specific
1398optimization options, use:
1399
1400@smallexample
1401--help=target,optimizers
1402@end smallexample
1403
1404The @option{--help=} option can be repeated on the command line.  Each
1405successive use displays its requested class of options, skipping
1406those that have already been displayed.
1407
1408If the @option{-Q} option appears on the command line before the
1409@option{--help=} option, then the descriptive text displayed by
1410@option{--help=} is changed.  Instead of describing the displayed
1411options, an indication is given as to whether the option is enabled,
1412disabled or set to a specific value (assuming that the compiler
1413knows this at the point where the @option{--help=} option is used).
1414
1415Here is a truncated example from the ARM port of @command{gcc}:
1416
1417@smallexample
1418  % gcc -Q -mabi=2 --help=target -c
1419  The following options are target specific:
1420  -mabi=                                2
1421  -mabort-on-noreturn                   [disabled]
1422  -mapcs                                [disabled]
1423@end smallexample
1424
1425The output is sensitive to the effects of previous command-line
1426options, so for example it is possible to find out which optimizations
1427are enabled at @option{-O2} by using:
1428
1429@smallexample
1430-Q -O2 --help=optimizers
1431@end smallexample
1432
1433Alternatively you can discover which binary optimizations are enabled
1434by @option{-O3} by using:
1435
1436@smallexample
1437gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1438gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1439diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1440@end smallexample
1441
1442@item -no-canonical-prefixes
1443@opindex no-canonical-prefixes
1444Do not expand any symbolic links, resolve references to @samp{/../}
1445or @samp{/./}, or make the path absolute when generating a relative
1446prefix.
1447
1448@item --version
1449@opindex version
1450Display the version number and copyrights of the invoked GCC@.
1451
1452@item -wrapper
1453@opindex wrapper
1454Invoke all subcommands under a wrapper program.  The name of the
1455wrapper program and its parameters are passed as a comma separated
1456list.
1457
1458@smallexample
1459gcc -c t.c -wrapper gdb,--args
1460@end smallexample
1461
1462@noindent
1463This invokes all subprograms of @command{gcc} under
1464@samp{gdb --args}, thus the invocation of @command{cc1} is
1465@samp{gdb --args cc1 @dots{}}.
1466
1467@item -fplugin=@var{name}.so
1468Load the plugin code in file @var{name}.so, assumed to be a
1469shared object to be dlopen'd by the compiler.  The base name of
1470the shared object file is used to identify the plugin for the
1471purposes of argument parsing (See
1472@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1473Each plugin should define the callback functions specified in the
1474Plugins API.
1475
1476@item -fplugin-arg-@var{name}-@var{key}=@var{value}
1477Define an argument called @var{key} with a value of @var{value}
1478for the plugin called @var{name}.
1479
1480@item -fdump-ada-spec@r{[}-slim@r{]}
1481@opindex fdump-ada-spec
1482For C and C++ source and include files, generate corresponding Ada specs.
1483@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1484GNAT User's Guide}, which provides detailed documentation on this feature.
1485
1486@item -fada-spec-parent=@var{unit}
1487@opindex fada-spec-parent
1488In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1489Ada specs as child units of parent @var{unit}.
1490
1491@item -fdump-go-spec=@var{file}
1492@opindex fdump-go-spec
1493For input files in any language, generate corresponding Go
1494declarations in @var{file}.  This generates Go @code{const},
1495@code{type}, @code{var}, and @code{func} declarations which may be a
1496useful way to start writing a Go interface to code written in some
1497other language.
1498
1499@include @value{srcdir}/../libiberty/at-file.texi
1500@end table
1501
1502@node Invoking G++
1503@section Compiling C++ Programs
1504
1505@cindex suffixes for C++ source
1506@cindex C++ source file suffixes
1507C++ source files conventionally use one of the suffixes @samp{.C},
1508@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1509@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1510@samp{.H}, or (for shared template code) @samp{.tcc}; and
1511preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1512files with these names and compiles them as C++ programs even if you
1513call the compiler the same way as for compiling C programs (usually
1514with the name @command{gcc}).
1515
1516@findex g++
1517@findex c++
1518However, the use of @command{gcc} does not add the C++ library.
1519@command{g++} is a program that calls GCC and automatically specifies linking
1520against the C++ library.  It treats @samp{.c},
1521@samp{.h} and @samp{.i} files as C++ source files instead of C source
1522files unless @option{-x} is used.  This program is also useful when
1523precompiling a C header file with a @samp{.h} extension for use in C++
1524compilations.  On many systems, @command{g++} is also installed with
1525the name @command{c++}.
1526
1527@cindex invoking @command{g++}
1528When you compile C++ programs, you may specify many of the same
1529command-line options that you use for compiling programs in any
1530language; or command-line options meaningful for C and related
1531languages; or options that are meaningful only for C++ programs.
1532@xref{C Dialect Options,,Options Controlling C Dialect}, for
1533explanations of options for languages related to C@.
1534@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1535explanations of options that are meaningful only for C++ programs.
1536
1537@node C Dialect Options
1538@section Options Controlling C Dialect
1539@cindex dialect options
1540@cindex language dialect options
1541@cindex options, dialect
1542
1543The following options control the dialect of C (or languages derived
1544from C, such as C++, Objective-C and Objective-C++) that the compiler
1545accepts:
1546
1547@table @gcctabopt
1548@cindex ANSI support
1549@cindex ISO support
1550@item -ansi
1551@opindex ansi
1552In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1553equivalent to @option{-std=c++98}.
1554
1555This turns off certain features of GCC that are incompatible with ISO
1556C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1557such as the @code{asm} and @code{typeof} keywords, and
1558predefined macros such as @code{unix} and @code{vax} that identify the
1559type of system you are using.  It also enables the undesirable and
1560rarely used ISO trigraph feature.  For the C compiler,
1561it disables recognition of C++ style @samp{//} comments as well as
1562the @code{inline} keyword.
1563
1564The alternate keywords @code{__asm__}, @code{__extension__},
1565@code{__inline__} and @code{__typeof__} continue to work despite
1566@option{-ansi}.  You would not want to use them in an ISO C program, of
1567course, but it is useful to put them in header files that might be included
1568in compilations done with @option{-ansi}.  Alternate predefined macros
1569such as @code{__unix__} and @code{__vax__} are also available, with or
1570without @option{-ansi}.
1571
1572The @option{-ansi} option does not cause non-ISO programs to be
1573rejected gratuitously.  For that, @option{-Wpedantic} is required in
1574addition to @option{-ansi}.  @xref{Warning Options}.
1575
1576The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1577option is used.  Some header files may notice this macro and refrain
1578from declaring certain functions or defining certain macros that the
1579ISO standard doesn't call for; this is to avoid interfering with any
1580programs that might use these names for other things.
1581
1582Functions that are normally built in but do not have semantics
1583defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1584functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
1585built-in functions provided by GCC}, for details of the functions
1586affected.
1587
1588@item -std=
1589@opindex std
1590Determine the language standard. @xref{Standards,,Language Standards
1591Supported by GCC}, for details of these standard versions.  This option
1592is currently only supported when compiling C or C++.
1593
1594The compiler can accept several base standards, such as @samp{c90} or
1595@samp{c++98}, and GNU dialects of those standards, such as
1596@samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
1597compiler accepts all programs following that standard plus those
1598using GNU extensions that do not contradict it.  For example,
1599@option{-std=c90} turns off certain features of GCC that are
1600incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1601keywords, but not other GNU extensions that do not have a meaning in
1602ISO C90, such as omitting the middle term of a @code{?:}
1603expression. On the other hand, when a GNU dialect of a standard is
1604specified, all features supported by the compiler are enabled, even when
1605those features change the meaning of the base standard.  As a result, some
1606strict-conforming programs may be rejected.  The particular standard
1607is used by @option{-Wpedantic} to identify which features are GNU
1608extensions given that version of the standard. For example
1609@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1610comments, while @option{-std=gnu99 -Wpedantic} does not.
1611
1612A value for this option must be provided; possible values are
1613
1614@table @samp
1615@item c90
1616@itemx c89
1617@itemx iso9899:1990
1618Support all ISO C90 programs (certain GNU extensions that conflict
1619with ISO C90 are disabled). Same as @option{-ansi} for C code.
1620
1621@item iso9899:199409
1622ISO C90 as modified in amendment 1.
1623
1624@item c99
1625@itemx c9x
1626@itemx iso9899:1999
1627@itemx iso9899:199x
1628ISO C99.  Note that this standard is not yet fully supported; see
1629@w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1630names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1631
1632@item c11
1633@itemx c1x
1634@itemx iso9899:2011
1635ISO C11, the 2011 revision of the ISO C standard.
1636Support is incomplete and experimental.  The name @samp{c1x} is
1637deprecated.
1638
1639@item gnu90
1640@itemx gnu89
1641GNU dialect of ISO C90 (including some C99 features). This
1642is the default for C code.
1643
1644@item gnu99
1645@itemx gnu9x
1646GNU dialect of ISO C99.  When ISO C99 is fully implemented in GCC,
1647this will become the default.  The name @samp{gnu9x} is deprecated.
1648
1649@item gnu11
1650@itemx gnu1x
1651GNU dialect of ISO C11.  Support is incomplete and experimental.  The
1652name @samp{gnu1x} is deprecated.
1653
1654@item c++98
1655@itemx c++03
1656The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1657additional defect reports. Same as @option{-ansi} for C++ code.
1658
1659@item gnu++98
1660@itemx gnu++03
1661GNU dialect of @option{-std=c++98}.  This is the default for
1662C++ code.
1663
1664@item c++11
1665@itemx c++0x
1666The 2011 ISO C++ standard plus amendments.  Support for C++11 is still
1667experimental, and may change in incompatible ways in future releases.
1668The name @samp{c++0x} is deprecated.
1669
1670@item gnu++11
1671@itemx gnu++0x
1672GNU dialect of @option{-std=c++11}. Support for C++11 is still
1673experimental, and may change in incompatible ways in future releases.
1674The name @samp{gnu++0x} is deprecated.
1675
1676@item c++1y
1677The next revision of the ISO C++ standard, tentatively planned for
16782017.  Support is highly experimental, and will almost certainly
1679change in incompatible ways in future releases.
1680
1681@item gnu++1y
1682GNU dialect of @option{-std=c++1y}.  Support is highly experimental,
1683and will almost certainly change in incompatible ways in future
1684releases.
1685@end table
1686
1687@item -fgnu89-inline
1688@opindex fgnu89-inline
1689The option @option{-fgnu89-inline} tells GCC to use the traditional
1690GNU semantics for @code{inline} functions when in C99 mode.
1691@xref{Inline,,An Inline Function is As Fast As a Macro}.  This option
1692is accepted and ignored by GCC versions 4.1.3 up to but not including
16934.3.  In GCC versions 4.3 and later it changes the behavior of GCC in
1694C99 mode.  Using this option is roughly equivalent to adding the
1695@code{gnu_inline} function attribute to all inline functions
1696(@pxref{Function Attributes}).
1697
1698The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1699C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1700specifies the default behavior).  This option was first supported in
1701GCC 4.3.  This option is not supported in @option{-std=c90} or
1702@option{-std=gnu90} mode.
1703
1704The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1705@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1706in effect for @code{inline} functions.  @xref{Common Predefined
1707Macros,,,cpp,The C Preprocessor}.
1708
1709@item -aux-info @var{filename}
1710@opindex aux-info
1711Output to the given filename prototyped declarations for all functions
1712declared and/or defined in a translation unit, including those in header
1713files.  This option is silently ignored in any language other than C@.
1714
1715Besides declarations, the file indicates, in comments, the origin of
1716each declaration (source file and line), whether the declaration was
1717implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1718@samp{O} for old, respectively, in the first character after the line
1719number and the colon), and whether it came from a declaration or a
1720definition (@samp{C} or @samp{F}, respectively, in the following
1721character).  In the case of function definitions, a K&R-style list of
1722arguments followed by their declarations is also provided, inside
1723comments, after the declaration.
1724
1725@item -fallow-parameterless-variadic-functions
1726Accept variadic functions without named parameters.
1727
1728Although it is possible to define such a function, this is not very
1729useful as it is not possible to read the arguments.  This is only
1730supported for C as this construct is allowed by C++.
1731
1732@item -fno-asm
1733@opindex fno-asm
1734Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1735keyword, so that code can use these words as identifiers.  You can use
1736the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1737instead.  @option{-ansi} implies @option{-fno-asm}.
1738
1739In C++, this switch only affects the @code{typeof} keyword, since
1740@code{asm} and @code{inline} are standard keywords.  You may want to
1741use the @option{-fno-gnu-keywords} flag instead, which has the same
1742effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1743switch only affects the @code{asm} and @code{typeof} keywords, since
1744@code{inline} is a standard keyword in ISO C99.
1745
1746@item -fno-builtin
1747@itemx -fno-builtin-@var{function}
1748@opindex fno-builtin
1749@cindex built-in functions
1750Don't recognize built-in functions that do not begin with
1751@samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1752functions provided by GCC}, for details of the functions affected,
1753including those which are not built-in functions when @option{-ansi} or
1754@option{-std} options for strict ISO C conformance are used because they
1755do not have an ISO standard meaning.
1756
1757GCC normally generates special code to handle certain built-in functions
1758more efficiently; for instance, calls to @code{alloca} may become single
1759instructions which adjust the stack directly, and calls to @code{memcpy}
1760may become inline copy loops.  The resulting code is often both smaller
1761and faster, but since the function calls no longer appear as such, you
1762cannot set a breakpoint on those calls, nor can you change the behavior
1763of the functions by linking with a different library.  In addition,
1764when a function is recognized as a built-in function, GCC may use
1765information about that function to warn about problems with calls to
1766that function, or to generate more efficient code, even if the
1767resulting code still contains calls to that function.  For example,
1768warnings are given with @option{-Wformat} for bad calls to
1769@code{printf} when @code{printf} is built in and @code{strlen} is
1770known not to modify global memory.
1771
1772With the @option{-fno-builtin-@var{function}} option
1773only the built-in function @var{function} is
1774disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1775function is named that is not built-in in this version of GCC, this
1776option is ignored.  There is no corresponding
1777@option{-fbuiltin-@var{function}} option; if you wish to enable
1778built-in functions selectively when using @option{-fno-builtin} or
1779@option{-ffreestanding}, you may define macros such as:
1780
1781@smallexample
1782#define abs(n)          __builtin_abs ((n))
1783#define strcpy(d, s)    __builtin_strcpy ((d), (s))
1784@end smallexample
1785
1786@item -fhosted
1787@opindex fhosted
1788@cindex hosted environment
1789
1790Assert that compilation targets a hosted environment.  This implies
1791@option{-fbuiltin}.  A hosted environment is one in which the
1792entire standard library is available, and in which @code{main} has a return
1793type of @code{int}.  Examples are nearly everything except a kernel.
1794This is equivalent to @option{-fno-freestanding}.
1795
1796@item -ffreestanding
1797@opindex ffreestanding
1798@cindex hosted environment
1799
1800Assert that compilation targets a freestanding environment.  This
1801implies @option{-fno-builtin}.  A freestanding environment
1802is one in which the standard library may not exist, and program startup may
1803not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1804This is equivalent to @option{-fno-hosted}.
1805
1806@xref{Standards,,Language Standards Supported by GCC}, for details of
1807freestanding and hosted environments.
1808
1809@item -fopenmp
1810@opindex fopenmp
1811@cindex OpenMP parallel
1812Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1813@code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
1814compiler generates parallel code according to the OpenMP Application
1815Program Interface v3.0 @w{@uref{http://www.openmp.org/}}.  This option
1816implies @option{-pthread}, and thus is only supported on targets that
1817have support for @option{-pthread}.
1818
1819@item -fgnu-tm
1820@opindex fgnu-tm
1821When the option @option{-fgnu-tm} is specified, the compiler
1822generates code for the Linux variant of Intel's current Transactional
1823Memory ABI specification document (Revision 1.1, May 6 2009).  This is
1824an experimental feature whose interface may change in future versions
1825of GCC, as the official specification changes.  Please note that not
1826all architectures are supported for this feature.
1827
1828For more information on GCC's support for transactional memory,
1829@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
1830Transactional Memory Library}.
1831
1832Note that the transactional memory feature is not supported with
1833non-call exceptions (@option{-fnon-call-exceptions}).
1834
1835@item -fms-extensions
1836@opindex fms-extensions
1837Accept some non-standard constructs used in Microsoft header files.
1838
1839In C++ code, this allows member names in structures to be similar
1840to previous types declarations.
1841
1842@smallexample
1843typedef int UOW;
1844struct ABC @{
1845  UOW UOW;
1846@};
1847@end smallexample
1848
1849Some cases of unnamed fields in structures and unions are only
1850accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
1851fields within structs/unions}, for details.
1852
1853@item -fplan9-extensions
1854Accept some non-standard constructs used in Plan 9 code.
1855
1856This enables @option{-fms-extensions}, permits passing pointers to
1857structures with anonymous fields to functions that expect pointers to
1858elements of the type of the field, and permits referring to anonymous
1859fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
1860struct/union fields within structs/unions}, for details.  This is only
1861supported for C, not C++.
1862
1863@item -trigraphs
1864@opindex trigraphs
1865Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1866options for strict ISO C conformance) implies @option{-trigraphs}.
1867
1868@cindex traditional C language
1869@cindex C language, traditional
1870@item -traditional
1871@itemx -traditional-cpp
1872@opindex traditional-cpp
1873@opindex traditional
1874Formerly, these options caused GCC to attempt to emulate a pre-standard
1875C compiler.  They are now only supported with the @option{-E} switch.
1876The preprocessor continues to support a pre-standard mode.  See the GNU
1877CPP manual for details.
1878
1879@item -fcond-mismatch
1880@opindex fcond-mismatch
1881Allow conditional expressions with mismatched types in the second and
1882third arguments.  The value of such an expression is void.  This option
1883is not supported for C++.
1884
1885@item -flax-vector-conversions
1886@opindex flax-vector-conversions
1887Allow implicit conversions between vectors with differing numbers of
1888elements and/or incompatible element types.  This option should not be
1889used for new code.
1890
1891@item -funsigned-char
1892@opindex funsigned-char
1893Let the type @code{char} be unsigned, like @code{unsigned char}.
1894
1895Each kind of machine has a default for what @code{char} should
1896be.  It is either like @code{unsigned char} by default or like
1897@code{signed char} by default.
1898
1899Ideally, a portable program should always use @code{signed char} or
1900@code{unsigned char} when it depends on the signedness of an object.
1901But many programs have been written to use plain @code{char} and
1902expect it to be signed, or expect it to be unsigned, depending on the
1903machines they were written for.  This option, and its inverse, let you
1904make such a program work with the opposite default.
1905
1906The type @code{char} is always a distinct type from each of
1907@code{signed char} or @code{unsigned char}, even though its behavior
1908is always just like one of those two.
1909
1910@item -fsigned-char
1911@opindex fsigned-char
1912Let the type @code{char} be signed, like @code{signed char}.
1913
1914Note that this is equivalent to @option{-fno-unsigned-char}, which is
1915the negative form of @option{-funsigned-char}.  Likewise, the option
1916@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1917
1918@item -fsigned-bitfields
1919@itemx -funsigned-bitfields
1920@itemx -fno-signed-bitfields
1921@itemx -fno-unsigned-bitfields
1922@opindex fsigned-bitfields
1923@opindex funsigned-bitfields
1924@opindex fno-signed-bitfields
1925@opindex fno-unsigned-bitfields
1926These options control whether a bit-field is signed or unsigned, when the
1927declaration does not use either @code{signed} or @code{unsigned}.  By
1928default, such a bit-field is signed, because this is consistent: the
1929basic integer types such as @code{int} are signed types.
1930@end table
1931
1932@node C++ Dialect Options
1933@section Options Controlling C++ Dialect
1934
1935@cindex compiler options, C++
1936@cindex C++ options, command-line
1937@cindex options, C++
1938This section describes the command-line options that are only meaningful
1939for C++ programs.  You can also use most of the GNU compiler options
1940regardless of what language your program is in.  For example, you
1941might compile a file @code{firstClass.C} like this:
1942
1943@smallexample
1944g++ -g -frepo -O -c firstClass.C
1945@end smallexample
1946
1947@noindent
1948In this example, only @option{-frepo} is an option meant
1949only for C++ programs; you can use the other options with any
1950language supported by GCC@.
1951
1952Here is a list of options that are @emph{only} for compiling C++ programs:
1953
1954@table @gcctabopt
1955
1956@item -fabi-version=@var{n}
1957@opindex fabi-version
1958Use version @var{n} of the C++ ABI@.  The default is version 2.
1959
1960Version 0 refers to the version conforming most closely to
1961the C++ ABI specification.  Therefore, the ABI obtained using version 0
1962will change in different versions of G++ as ABI bugs are fixed.
1963
1964Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
1965
1966Version 2 is the version of the C++ ABI that first appeared in G++ 3.4.
1967
1968Version 3 corrects an error in mangling a constant address as a
1969template argument.
1970
1971Version 4, which first appeared in G++ 4.5, implements a standard
1972mangling for vector types.
1973
1974Version 5, which first appeared in G++ 4.6, corrects the mangling of
1975attribute const/volatile on function pointer types, decltype of a
1976plain decl, and use of a function parameter in the declaration of
1977another parameter.
1978
1979Version 6, which first appeared in G++ 4.7, corrects the promotion
1980behavior of C++11 scoped enums and the mangling of template argument
1981packs, const/static_cast, prefix ++ and --, and a class scope function
1982used as a template argument.
1983
1984See also @option{-Wabi}.
1985
1986@item -fno-access-control
1987@opindex fno-access-control
1988Turn off all access checking.  This switch is mainly useful for working
1989around bugs in the access control code.
1990
1991@item -fcheck-new
1992@opindex fcheck-new
1993Check that the pointer returned by @code{operator new} is non-null
1994before attempting to modify the storage allocated.  This check is
1995normally unnecessary because the C++ standard specifies that
1996@code{operator new} only returns @code{0} if it is declared
1997@samp{throw()}, in which case the compiler always checks the
1998return value even without this option.  In all other cases, when
1999@code{operator new} has a non-empty exception specification, memory
2000exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
2001@samp{new (nothrow)}.
2002
2003@item -fconstexpr-depth=@var{n}
2004@opindex fconstexpr-depth
2005Set the maximum nested evaluation depth for C++11 constexpr functions
2006to @var{n}.  A limit is needed to detect endless recursion during
2007constant expression evaluation.  The minimum specified by the standard
2008is 512.
2009
2010@item -fdeduce-init-list
2011@opindex fdeduce-init-list
2012Enable deduction of a template type parameter as
2013@code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2014
2015@smallexample
2016template <class T> auto forward(T t) -> decltype (realfn (t))
2017@{
2018  return realfn (t);
2019@}
2020
2021void f()
2022@{
2023  forward(@{1,2@}); // call forward<std::initializer_list<int>>
2024@}
2025@end smallexample
2026
2027This deduction was implemented as a possible extension to the
2028originally proposed semantics for the C++11 standard, but was not part
2029of the final standard, so it is disabled by default.  This option is
2030deprecated, and may be removed in a future version of G++.
2031
2032@item -ffriend-injection
2033@opindex ffriend-injection
2034Inject friend functions into the enclosing namespace, so that they are
2035visible outside the scope of the class in which they are declared.
2036Friend functions were documented to work this way in the old Annotated
2037C++ Reference Manual, and versions of G++ before 4.1 always worked
2038that way.  However, in ISO C++ a friend function that is not declared
2039in an enclosing scope can only be found using argument dependent
2040lookup.  This option causes friends to be injected as they were in
2041earlier releases.
2042
2043This option is for compatibility, and may be removed in a future
2044release of G++.
2045
2046@item -fno-elide-constructors
2047@opindex fno-elide-constructors
2048The C++ standard allows an implementation to omit creating a temporary
2049that is only used to initialize another object of the same type.
2050Specifying this option disables that optimization, and forces G++ to
2051call the copy constructor in all cases.
2052
2053@item -fno-enforce-eh-specs
2054@opindex fno-enforce-eh-specs
2055Don't generate code to check for violation of exception specifications
2056at run time.  This option violates the C++ standard, but may be useful
2057for reducing code size in production builds, much like defining
2058@samp{NDEBUG}.  This does not give user code permission to throw
2059exceptions in violation of the exception specifications; the compiler
2060still optimizes based on the specifications, so throwing an
2061unexpected exception results in undefined behavior at run time.
2062
2063@item -fextern-tls-init
2064@itemx -fno-extern-tls-init
2065@opindex fextern-tls-init
2066@opindex fno-extern-tls-init
2067The C++11 and OpenMP standards allow @samp{thread_local} and
2068@samp{threadprivate} variables to have dynamic (runtime)
2069initialization.  To support this, any use of such a variable goes
2070through a wrapper function that performs any necessary initialization.
2071When the use and definition of the variable are in the same
2072translation unit, this overhead can be optimized away, but when the
2073use is in a different translation unit there is significant overhead
2074even if the variable doesn't actually need dynamic initialization.  If
2075the programmer can be sure that no use of the variable in a
2076non-defining TU needs to trigger dynamic initialization (either
2077because the variable is statically initialized, or a use of the
2078variable in the defining TU will be executed before any uses in
2079another TU), they can avoid this overhead with the
2080@option{-fno-extern-tls-init} option.
2081
2082On targets that support symbol aliases, the default is
2083@option{-fextern-tls-init}.  On targets that do not support symbol
2084aliases, the default is @option{-fno-extern-tls-init}.
2085
2086@item -ffor-scope
2087@itemx -fno-for-scope
2088@opindex ffor-scope
2089@opindex fno-for-scope
2090If @option{-ffor-scope} is specified, the scope of variables declared in
2091a @i{for-init-statement} is limited to the @samp{for} loop itself,
2092as specified by the C++ standard.
2093If @option{-fno-for-scope} is specified, the scope of variables declared in
2094a @i{for-init-statement} extends to the end of the enclosing scope,
2095as was the case in old versions of G++, and other (traditional)
2096implementations of C++.
2097
2098If neither flag is given, the default is to follow the standard,
2099but to allow and give a warning for old-style code that would
2100otherwise be invalid, or have different behavior.
2101
2102@item -fno-gnu-keywords
2103@opindex fno-gnu-keywords
2104Do not recognize @code{typeof} as a keyword, so that code can use this
2105word as an identifier.  You can use the keyword @code{__typeof__} instead.
2106@option{-ansi} implies @option{-fno-gnu-keywords}.
2107
2108@item -fno-implicit-templates
2109@opindex fno-implicit-templates
2110Never emit code for non-inline templates that are instantiated
2111implicitly (i.e.@: by use); only emit code for explicit instantiations.
2112@xref{Template Instantiation}, for more information.
2113
2114@item -fno-implicit-inline-templates
2115@opindex fno-implicit-inline-templates
2116Don't emit code for implicit instantiations of inline templates, either.
2117The default is to handle inlines differently so that compiles with and
2118without optimization need the same set of explicit instantiations.
2119
2120@item -fno-implement-inlines
2121@opindex fno-implement-inlines
2122To save space, do not emit out-of-line copies of inline functions
2123controlled by @samp{#pragma implementation}.  This causes linker
2124errors if these functions are not inlined everywhere they are called.
2125
2126@item -fms-extensions
2127@opindex fms-extensions
2128Disable Wpedantic warnings about constructs used in MFC, such as implicit
2129int and getting a pointer to member function via non-standard syntax.
2130
2131@item -fno-nonansi-builtins
2132@opindex fno-nonansi-builtins
2133Disable built-in declarations of functions that are not mandated by
2134ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
2135@code{index}, @code{bzero}, @code{conjf}, and other related functions.
2136
2137@item -fnothrow-opt
2138@opindex fnothrow-opt
2139Treat a @code{throw()} exception specification as if it were a
2140@code{noexcept} specification to reduce or eliminate the text size
2141overhead relative to a function with no exception specification.  If
2142the function has local variables of types with non-trivial
2143destructors, the exception specification actually makes the
2144function smaller because the EH cleanups for those variables can be
2145optimized away.  The semantic effect is that an exception thrown out of
2146a function with such an exception specification results in a call
2147to @code{terminate} rather than @code{unexpected}.
2148
2149@item -fno-operator-names
2150@opindex fno-operator-names
2151Do not treat the operator name keywords @code{and}, @code{bitand},
2152@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2153synonyms as keywords.
2154
2155@item -fno-optional-diags
2156@opindex fno-optional-diags
2157Disable diagnostics that the standard says a compiler does not need to
2158issue.  Currently, the only such diagnostic issued by G++ is the one for
2159a name having multiple meanings within a class.
2160
2161@item -fpermissive
2162@opindex fpermissive
2163Downgrade some diagnostics about nonconformant code from errors to
2164warnings.  Thus, using @option{-fpermissive} allows some
2165nonconforming code to compile.
2166
2167@item -fno-pretty-templates
2168@opindex fno-pretty-templates
2169When an error message refers to a specialization of a function
2170template, the compiler normally prints the signature of the
2171template followed by the template arguments and any typedefs or
2172typenames in the signature (e.g. @code{void f(T) [with T = int]}
2173rather than @code{void f(int)}) so that it's clear which template is
2174involved.  When an error message refers to a specialization of a class
2175template, the compiler omits any template arguments that match
2176the default template arguments for that template.  If either of these
2177behaviors make it harder to understand the error message rather than
2178easier, you can use @option{-fno-pretty-templates} to disable them.
2179
2180@item -frepo
2181@opindex frepo
2182Enable automatic template instantiation at link time.  This option also
2183implies @option{-fno-implicit-templates}.  @xref{Template
2184Instantiation}, for more information.
2185
2186@item -fno-rtti
2187@opindex fno-rtti
2188Disable generation of information about every class with virtual
2189functions for use by the C++ run-time type identification features
2190(@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
2191of the language, you can save some space by using this flag.  Note that
2192exception handling uses the same information, but G++ generates it as
2193needed. The @samp{dynamic_cast} operator can still be used for casts that
2194do not require run-time type information, i.e.@: casts to @code{void *} or to
2195unambiguous base classes.
2196
2197@item -fstats
2198@opindex fstats
2199Emit statistics about front-end processing at the end of the compilation.
2200This information is generally only useful to the G++ development team.
2201
2202@item -fstrict-enums
2203@opindex fstrict-enums
2204Allow the compiler to optimize using the assumption that a value of
2205enumerated type can only be one of the values of the enumeration (as
2206defined in the C++ standard; basically, a value that can be
2207represented in the minimum number of bits needed to represent all the
2208enumerators).  This assumption may not be valid if the program uses a
2209cast to convert an arbitrary integer value to the enumerated type.
2210
2211@item -ftemplate-backtrace-limit=@var{n}
2212@opindex ftemplate-backtrace-limit
2213Set the maximum number of template instantiation notes for a single
2214warning or error to @var{n}.  The default value is 10.
2215
2216@item -ftemplate-depth=@var{n}
2217@opindex ftemplate-depth
2218Set the maximum instantiation depth for template classes to @var{n}.
2219A limit on the template instantiation depth is needed to detect
2220endless recursions during template class instantiation.  ANSI/ISO C++
2221conforming programs must not rely on a maximum depth greater than 17
2222(changed to 1024 in C++11).  The default value is 900, as the compiler
2223can run out of stack space before hitting 1024 in some situations.
2224
2225@item -fno-threadsafe-statics
2226@opindex fno-threadsafe-statics
2227Do not emit the extra code to use the routines specified in the C++
2228ABI for thread-safe initialization of local statics.  You can use this
2229option to reduce code size slightly in code that doesn't need to be
2230thread-safe.
2231
2232@item -fuse-cxa-atexit
2233@opindex fuse-cxa-atexit
2234Register destructors for objects with static storage duration with the
2235@code{__cxa_atexit} function rather than the @code{atexit} function.
2236This option is required for fully standards-compliant handling of static
2237destructors, but only works if your C library supports
2238@code{__cxa_atexit}.
2239
2240@item -fno-use-cxa-get-exception-ptr
2241@opindex fno-use-cxa-get-exception-ptr
2242Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
2243causes @code{std::uncaught_exception} to be incorrect, but is necessary
2244if the runtime routine is not available.
2245
2246@item -fvisibility-inlines-hidden
2247@opindex fvisibility-inlines-hidden
2248This switch declares that the user does not attempt to compare
2249pointers to inline functions or methods where the addresses of the two functions
2250are taken in different shared objects.
2251
2252The effect of this is that GCC may, effectively, mark inline methods with
2253@code{__attribute__ ((visibility ("hidden")))} so that they do not
2254appear in the export table of a DSO and do not require a PLT indirection
2255when used within the DSO@.  Enabling this option can have a dramatic effect
2256on load and link times of a DSO as it massively reduces the size of the
2257dynamic export table when the library makes heavy use of templates.
2258
2259The behavior of this switch is not quite the same as marking the
2260methods as hidden directly, because it does not affect static variables
2261local to the function or cause the compiler to deduce that
2262the function is defined in only one shared object.
2263
2264You may mark a method as having a visibility explicitly to negate the
2265effect of the switch for that method.  For example, if you do want to
2266compare pointers to a particular inline method, you might mark it as
2267having default visibility.  Marking the enclosing class with explicit
2268visibility has no effect.
2269
2270Explicitly instantiated inline methods are unaffected by this option
2271as their linkage might otherwise cross a shared library boundary.
2272@xref{Template Instantiation}.
2273
2274@item -fvisibility-ms-compat
2275@opindex fvisibility-ms-compat
2276This flag attempts to use visibility settings to make GCC's C++
2277linkage model compatible with that of Microsoft Visual Studio.
2278
2279The flag makes these changes to GCC's linkage model:
2280
2281@enumerate
2282@item
2283It sets the default visibility to @code{hidden}, like
2284@option{-fvisibility=hidden}.
2285
2286@item
2287Types, but not their members, are not hidden by default.
2288
2289@item
2290The One Definition Rule is relaxed for types without explicit
2291visibility specifications that are defined in more than one
2292shared object: those declarations are permitted if they are
2293permitted when this option is not used.
2294@end enumerate
2295
2296In new code it is better to use @option{-fvisibility=hidden} and
2297export those classes that are intended to be externally visible.
2298Unfortunately it is possible for code to rely, perhaps accidentally,
2299on the Visual Studio behavior.
2300
2301Among the consequences of these changes are that static data members
2302of the same type with the same name but defined in different shared
2303objects are different, so changing one does not change the other;
2304and that pointers to function members defined in different shared
2305objects may not compare equal.  When this flag is given, it is a
2306violation of the ODR to define types with the same name differently.
2307
2308@item -fno-weak
2309@opindex fno-weak
2310Do not use weak symbol support, even if it is provided by the linker.
2311By default, G++ uses weak symbols if they are available.  This
2312option exists only for testing, and should not be used by end-users;
2313it results in inferior code and has no benefits.  This option may
2314be removed in a future release of G++.
2315
2316@item -nostdinc++
2317@opindex nostdinc++
2318Do not search for header files in the standard directories specific to
2319C++, but do still search the other standard directories.  (This option
2320is used when building the C++ library.)
2321@end table
2322
2323In addition, these optimization, warning, and code generation options
2324have meanings only for C++ programs:
2325
2326@table @gcctabopt
2327@item -fno-default-inline
2328@opindex fno-default-inline
2329Do not assume @samp{inline} for functions defined inside a class scope.
2330@xref{Optimize Options,,Options That Control Optimization}.  Note that these
2331functions have linkage like inline functions; they just aren't
2332inlined by default.
2333
2334@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2335@opindex Wabi
2336@opindex Wno-abi
2337Warn when G++ generates code that is probably not compatible with the
2338vendor-neutral C++ ABI@.  Although an effort has been made to warn about
2339all such cases, there are probably some cases that are not warned about,
2340even though G++ is generating incompatible code.  There may also be
2341cases where warnings are emitted even though the code that is generated
2342is compatible.
2343
2344You should rewrite your code to avoid these warnings if you are
2345concerned about the fact that code generated by G++ may not be binary
2346compatible with code generated by other compilers.
2347
2348The known incompatibilities in @option{-fabi-version=2} (the default) include:
2349
2350@itemize @bullet
2351
2352@item
2353A template with a non-type template parameter of reference type is
2354mangled incorrectly:
2355@smallexample
2356extern int N;
2357template <int &> struct S @{@};
2358void n (S<N>) @{2@}
2359@end smallexample
2360
2361This is fixed in @option{-fabi-version=3}.
2362
2363@item
2364SIMD vector types declared using @code{__attribute ((vector_size))} are
2365mangled in a non-standard way that does not allow for overloading of
2366functions taking vectors of different sizes.
2367
2368The mangling is changed in @option{-fabi-version=4}.
2369@end itemize
2370
2371The known incompatibilities in @option{-fabi-version=1} include:
2372
2373@itemize @bullet
2374
2375@item
2376Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
2377pack data into the same byte as a base class.  For example:
2378
2379@smallexample
2380struct A @{ virtual void f(); int f1 : 1; @};
2381struct B : public A @{ int f2 : 1; @};
2382@end smallexample
2383
2384@noindent
2385In this case, G++ places @code{B::f2} into the same byte
2386as @code{A::f1}; other compilers do not.  You can avoid this problem
2387by explicitly padding @code{A} so that its size is a multiple of the
2388byte size on your platform; that causes G++ and other compilers to
2389lay out @code{B} identically.
2390
2391@item
2392Incorrect handling of tail-padding for virtual bases.  G++ does not use
2393tail padding when laying out virtual bases.  For example:
2394
2395@smallexample
2396struct A @{ virtual void f(); char c1; @};
2397struct B @{ B(); char c2; @};
2398struct C : public A, public virtual B @{@};
2399@end smallexample
2400
2401@noindent
2402In this case, G++ does not place @code{B} into the tail-padding for
2403@code{A}; other compilers do.  You can avoid this problem by
2404explicitly padding @code{A} so that its size is a multiple of its
2405alignment (ignoring virtual base classes); that causes G++ and other
2406compilers to lay out @code{C} identically.
2407
2408@item
2409Incorrect handling of bit-fields with declared widths greater than that
2410of their underlying types, when the bit-fields appear in a union.  For
2411example:
2412
2413@smallexample
2414union U @{ int i : 4096; @};
2415@end smallexample
2416
2417@noindent
2418Assuming that an @code{int} does not have 4096 bits, G++ makes the
2419union too small by the number of bits in an @code{int}.
2420
2421@item
2422Empty classes can be placed at incorrect offsets.  For example:
2423
2424@smallexample
2425struct A @{@};
2426
2427struct B @{
2428  A a;
2429  virtual void f ();
2430@};
2431
2432struct C : public B, public A @{@};
2433@end smallexample
2434
2435@noindent
2436G++ places the @code{A} base class of @code{C} at a nonzero offset;
2437it should be placed at offset zero.  G++ mistakenly believes that the
2438@code{A} data member of @code{B} is already at offset zero.
2439
2440@item
2441Names of template functions whose types involve @code{typename} or
2442template template parameters can be mangled incorrectly.
2443
2444@smallexample
2445template <typename Q>
2446void f(typename Q::X) @{@}
2447
2448template <template <typename> class Q>
2449void f(typename Q<int>::X) @{@}
2450@end smallexample
2451
2452@noindent
2453Instantiations of these templates may be mangled incorrectly.
2454
2455@end itemize
2456
2457It also warns about psABI-related changes.  The known psABI changes at this
2458point include:
2459
2460@itemize @bullet
2461
2462@item
2463For SysV/x86-64, unions with @code{long double} members are
2464passed in memory as specified in psABI.  For example:
2465
2466@smallexample
2467union U @{
2468  long double ld;
2469  int i;
2470@};
2471@end smallexample
2472
2473@noindent
2474@code{union U} is always passed in memory.
2475
2476@end itemize
2477
2478@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2479@opindex Wctor-dtor-privacy
2480@opindex Wno-ctor-dtor-privacy
2481Warn when a class seems unusable because all the constructors or
2482destructors in that class are private, and it has neither friends nor
2483public static member functions.  Also warn if there are no non-private
2484methods, and there's at least one private member function that isn't
2485a constructor or destructor.
2486
2487@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2488@opindex Wdelete-non-virtual-dtor
2489@opindex Wno-delete-non-virtual-dtor
2490Warn when @samp{delete} is used to destroy an instance of a class that
2491has virtual functions and non-virtual destructor. It is unsafe to delete
2492an instance of a derived class through a pointer to a base class if the
2493base class does not have a virtual destructor.  This warning is enabled
2494by @option{-Wall}.
2495
2496@item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2497@opindex Wliteral-suffix
2498@opindex Wno-literal-suffix
2499Warn when a string or character literal is followed by a ud-suffix which does
2500not begin with an underscore.  As a conforming extension, GCC treats such
2501suffixes as separate preprocessing tokens in order to maintain backwards
2502compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2503For example:
2504
2505@smallexample
2506#define __STDC_FORMAT_MACROS
2507#include <inttypes.h>
2508#include <stdio.h>
2509
2510int main() @{
2511  int64_t i64 = 123;
2512  printf("My int64: %"PRId64"\n", i64);
2513@}
2514@end smallexample
2515
2516In this case, @code{PRId64} is treated as a separate preprocessing token.
2517
2518This warning is enabled by default.
2519
2520@item -Wnarrowing @r{(C++ and Objective-C++ only)}
2521@opindex Wnarrowing
2522@opindex Wno-narrowing
2523Warn when a narrowing conversion prohibited by C++11 occurs within
2524@samp{@{ @}}, e.g.
2525
2526@smallexample
2527int i = @{ 2.2 @}; // error: narrowing from double to int
2528@end smallexample
2529
2530This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2531
2532With @option{-std=c++11}, @option{-Wno-narrowing} suppresses the diagnostic
2533required by the standard.  Note that this does not affect the meaning
2534of well-formed code; narrowing conversions are still considered
2535ill-formed in SFINAE context.
2536
2537@item -Wnoexcept @r{(C++ and Objective-C++ only)}
2538@opindex Wnoexcept
2539@opindex Wno-noexcept
2540Warn when a noexcept-expression evaluates to false because of a call
2541to a function that does not have a non-throwing exception
2542specification (i.e. @samp{throw()} or @samp{noexcept}) but is known by
2543the compiler to never throw an exception.
2544
2545@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2546@opindex Wnon-virtual-dtor
2547@opindex Wno-non-virtual-dtor
2548Warn when a class has virtual functions and an accessible non-virtual
2549destructor, in which case it is possible but unsafe to delete
2550an instance of a derived class through a pointer to the base class.
2551This warning is also enabled if @option{-Weffc++} is specified.
2552
2553@item -Wreorder @r{(C++ and Objective-C++ only)}
2554@opindex Wreorder
2555@opindex Wno-reorder
2556@cindex reordering, warning
2557@cindex warning for reordering of member initializers
2558Warn when the order of member initializers given in the code does not
2559match the order in which they must be executed.  For instance:
2560
2561@smallexample
2562struct A @{
2563  int i;
2564  int j;
2565  A(): j (0), i (1) @{ @}
2566@};
2567@end smallexample
2568
2569@noindent
2570The compiler rearranges the member initializers for @samp{i}
2571and @samp{j} to match the declaration order of the members, emitting
2572a warning to that effect.  This warning is enabled by @option{-Wall}.
2573
2574@item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2575@opindex fext-numeric-literals
2576@opindex fno-ext-numeric-literals
2577Accept imaginary, fixed-point, or machine-defined
2578literal number suffixes as GNU extensions.
2579When this option is turned off these suffixes are treated
2580as C++11 user-defined literal numeric suffixes.
2581This is on by default for all pre-C++11 dialects and all GNU dialects:
2582@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2583@option{-std=gnu++1y}.
2584This option is off by default
2585for ISO C++11 onwards (@option{-std=c++11}, ...).
2586@end table
2587
2588The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2589
2590@table @gcctabopt
2591@item -Weffc++ @r{(C++ and Objective-C++ only)}
2592@opindex Weffc++
2593@opindex Wno-effc++
2594Warn about violations of the following style guidelines from Scott Meyers'
2595@cite{Effective C++, Second Edition} book:
2596
2597@itemize @bullet
2598@item
2599Item 11:  Define a copy constructor and an assignment operator for classes
2600with dynamically-allocated memory.
2601
2602@item
2603Item 12:  Prefer initialization to assignment in constructors.
2604
2605@item
2606Item 14:  Make destructors virtual in base classes.
2607
2608@item
2609Item 15:  Have @code{operator=} return a reference to @code{*this}.
2610
2611@item
2612Item 23:  Don't try to return a reference when you must return an object.
2613
2614@end itemize
2615
2616Also warn about violations of the following style guidelines from
2617Scott Meyers' @cite{More Effective C++} book:
2618
2619@itemize @bullet
2620@item
2621Item 6:  Distinguish between prefix and postfix forms of increment and
2622decrement operators.
2623
2624@item
2625Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
2626
2627@end itemize
2628
2629When selecting this option, be aware that the standard library
2630headers do not obey all of these guidelines; use @samp{grep -v}
2631to filter out those warnings.
2632
2633@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2634@opindex Wstrict-null-sentinel
2635@opindex Wno-strict-null-sentinel
2636Warn about the use of an uncasted @code{NULL} as sentinel.  When
2637compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2638to @code{__null}.  Although it is a null pointer constant rather than a
2639null pointer, it is guaranteed to be of the same size as a pointer.
2640But this use is not portable across different compilers.
2641
2642@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2643@opindex Wno-non-template-friend
2644@opindex Wnon-template-friend
2645Disable warnings when non-templatized friend functions are declared
2646within a template.  Since the advent of explicit template specification
2647support in G++, if the name of the friend is an unqualified-id (i.e.,
2648@samp{friend foo(int)}), the C++ language specification demands that the
2649friend declare or define an ordinary, nontemplate function.  (Section
265014.5.3).  Before G++ implemented explicit specification, unqualified-ids
2651could be interpreted as a particular specialization of a templatized
2652function.  Because this non-conforming behavior is no longer the default
2653behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2654check existing code for potential trouble spots and is on by default.
2655This new compiler behavior can be turned off with
2656@option{-Wno-non-template-friend}, which keeps the conformant compiler code
2657but disables the helpful warning.
2658
2659@item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2660@opindex Wold-style-cast
2661@opindex Wno-old-style-cast
2662Warn if an old-style (C-style) cast to a non-void type is used within
2663a C++ program.  The new-style casts (@samp{dynamic_cast},
2664@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2665less vulnerable to unintended effects and much easier to search for.
2666
2667@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2668@opindex Woverloaded-virtual
2669@opindex Wno-overloaded-virtual
2670@cindex overloaded virtual function, warning
2671@cindex warning for overloaded virtual function
2672Warn when a function declaration hides virtual functions from a
2673base class.  For example, in:
2674
2675@smallexample
2676struct A @{
2677  virtual void f();
2678@};
2679
2680struct B: public A @{
2681  void f(int);
2682@};
2683@end smallexample
2684
2685the @code{A} class version of @code{f} is hidden in @code{B}, and code
2686like:
2687
2688@smallexample
2689B* b;
2690b->f();
2691@end smallexample
2692
2693@noindent
2694fails to compile.
2695
2696@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2697@opindex Wno-pmf-conversions
2698@opindex Wpmf-conversions
2699Disable the diagnostic for converting a bound pointer to member function
2700to a plain pointer.
2701
2702@item -Wsign-promo @r{(C++ and Objective-C++ only)}
2703@opindex Wsign-promo
2704@opindex Wno-sign-promo
2705Warn when overload resolution chooses a promotion from unsigned or
2706enumerated type to a signed type, over a conversion to an unsigned type of
2707the same size.  Previous versions of G++ tried to preserve
2708unsignedness, but the standard mandates the current behavior.
2709@end table
2710
2711@node Objective-C and Objective-C++ Dialect Options
2712@section Options Controlling Objective-C and Objective-C++ Dialects
2713
2714@cindex compiler options, Objective-C and Objective-C++
2715@cindex Objective-C and Objective-C++ options, command-line
2716@cindex options, Objective-C and Objective-C++
2717(NOTE: This manual does not describe the Objective-C and Objective-C++
2718languages themselves.  @xref{Standards,,Language Standards
2719Supported by GCC}, for references.)
2720
2721This section describes the command-line options that are only meaningful
2722for Objective-C and Objective-C++ programs.  You can also use most of
2723the language-independent GNU compiler options.
2724For example, you might compile a file @code{some_class.m} like this:
2725
2726@smallexample
2727gcc -g -fgnu-runtime -O -c some_class.m
2728@end smallexample
2729
2730@noindent
2731In this example, @option{-fgnu-runtime} is an option meant only for
2732Objective-C and Objective-C++ programs; you can use the other options with
2733any language supported by GCC@.
2734
2735Note that since Objective-C is an extension of the C language, Objective-C
2736compilations may also use options specific to the C front-end (e.g.,
2737@option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
2738C++-specific options (e.g., @option{-Wabi}).
2739
2740Here is a list of options that are @emph{only} for compiling Objective-C
2741and Objective-C++ programs:
2742
2743@table @gcctabopt
2744@item -fconstant-string-class=@var{class-name}
2745@opindex fconstant-string-class
2746Use @var{class-name} as the name of the class to instantiate for each
2747literal string specified with the syntax @code{@@"@dots{}"}.  The default
2748class name is @code{NXConstantString} if the GNU runtime is being used, and
2749@code{NSConstantString} if the NeXT runtime is being used (see below).  The
2750@option{-fconstant-cfstrings} option, if also present, overrides the
2751@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2752to be laid out as constant CoreFoundation strings.
2753
2754@item -fgnu-runtime
2755@opindex fgnu-runtime
2756Generate object code compatible with the standard GNU Objective-C
2757runtime.  This is the default for most types of systems.
2758
2759@item -fnext-runtime
2760@opindex fnext-runtime
2761Generate output compatible with the NeXT runtime.  This is the default
2762for NeXT-based systems, including Darwin and Mac OS X@.  The macro
2763@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2764used.
2765
2766@item -fno-nil-receivers
2767@opindex fno-nil-receivers
2768Assume that all Objective-C message dispatches (@code{[receiver
2769message:arg]}) in this translation unit ensure that the receiver is
2770not @code{nil}.  This allows for more efficient entry points in the
2771runtime to be used.  This option is only available in conjunction with
2772the NeXT runtime and ABI version 0 or 1.
2773
2774@item -fobjc-abi-version=@var{n}
2775@opindex fobjc-abi-version
2776Use version @var{n} of the Objective-C ABI for the selected runtime.
2777This option is currently supported only for the NeXT runtime.  In that
2778case, Version 0 is the traditional (32-bit) ABI without support for
2779properties and other Objective-C 2.0 additions.  Version 1 is the
2780traditional (32-bit) ABI with support for properties and other
2781Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
2782nothing is specified, the default is Version 0 on 32-bit target
2783machines, and Version 2 on 64-bit target machines.
2784
2785@item -fobjc-call-cxx-cdtors
2786@opindex fobjc-call-cxx-cdtors
2787For each Objective-C class, check if any of its instance variables is a
2788C++ object with a non-trivial default constructor.  If so, synthesize a
2789special @code{- (id) .cxx_construct} instance method which runs
2790non-trivial default constructors on any such instance variables, in order,
2791and then return @code{self}.  Similarly, check if any instance variable
2792is a C++ object with a non-trivial destructor, and if so, synthesize a
2793special @code{- (void) .cxx_destruct} method which runs
2794all such default destructors, in reverse order.
2795
2796The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
2797methods thusly generated only operate on instance variables
2798declared in the current Objective-C class, and not those inherited
2799from superclasses.  It is the responsibility of the Objective-C
2800runtime to invoke all such methods in an object's inheritance
2801hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
2802by the runtime immediately after a new object instance is allocated;
2803the @code{- (void) .cxx_destruct} methods are invoked immediately
2804before the runtime deallocates an object instance.
2805
2806As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2807support for invoking the @code{- (id) .cxx_construct} and
2808@code{- (void) .cxx_destruct} methods.
2809
2810@item -fobjc-direct-dispatch
2811@opindex fobjc-direct-dispatch
2812Allow fast jumps to the message dispatcher.  On Darwin this is
2813accomplished via the comm page.
2814
2815@item -fobjc-exceptions
2816@opindex fobjc-exceptions
2817Enable syntactic support for structured exception handling in
2818Objective-C, similar to what is offered by C++ and Java.  This option
2819is required to use the Objective-C keywords @code{@@try},
2820@code{@@throw}, @code{@@catch}, @code{@@finally} and
2821@code{@@synchronized}.  This option is available with both the GNU
2822runtime and the NeXT runtime (but not available in conjunction with
2823the NeXT runtime on Mac OS X 10.2 and earlier).
2824
2825@item -fobjc-gc
2826@opindex fobjc-gc
2827Enable garbage collection (GC) in Objective-C and Objective-C++
2828programs.  This option is only available with the NeXT runtime; the
2829GNU runtime has a different garbage collection implementation that
2830does not require special compiler flags.
2831
2832@item -fobjc-nilcheck
2833@opindex fobjc-nilcheck
2834For the NeXT runtime with version 2 of the ABI, check for a nil
2835receiver in method invocations before doing the actual method call.
2836This is the default and can be disabled using
2837@option{-fno-objc-nilcheck}.  Class methods and super calls are never
2838checked for nil in this way no matter what this flag is set to.
2839Currently this flag does nothing when the GNU runtime, or an older
2840version of the NeXT runtime ABI, is used.
2841
2842@item -fobjc-std=objc1
2843@opindex fobjc-std
2844Conform to the language syntax of Objective-C 1.0, the language
2845recognized by GCC 4.0.  This only affects the Objective-C additions to
2846the C/C++ language; it does not affect conformance to C/C++ standards,
2847which is controlled by the separate C/C++ dialect option flags.  When
2848this option is used with the Objective-C or Objective-C++ compiler,
2849any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
2850This is useful if you need to make sure that your Objective-C code can
2851be compiled with older versions of GCC@.
2852
2853@item -freplace-objc-classes
2854@opindex freplace-objc-classes
2855Emit a special marker instructing @command{ld(1)} not to statically link in
2856the resulting object file, and allow @command{dyld(1)} to load it in at
2857run time instead.  This is used in conjunction with the Fix-and-Continue
2858debugging mode, where the object file in question may be recompiled and
2859dynamically reloaded in the course of program execution, without the need
2860to restart the program itself.  Currently, Fix-and-Continue functionality
2861is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2862and later.
2863
2864@item -fzero-link
2865@opindex fzero-link
2866When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2867to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2868compile time) with static class references that get initialized at load time,
2869which improves run-time performance.  Specifying the @option{-fzero-link} flag
2870suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2871to be retained.  This is useful in Zero-Link debugging mode, since it allows
2872for individual class implementations to be modified during program execution.
2873The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
2874regardless of command-line options.
2875
2876@item -gen-decls
2877@opindex gen-decls
2878Dump interface declarations for all classes seen in the source file to a
2879file named @file{@var{sourcename}.decl}.
2880
2881@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
2882@opindex Wassign-intercept
2883@opindex Wno-assign-intercept
2884Warn whenever an Objective-C assignment is being intercepted by the
2885garbage collector.
2886
2887@item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
2888@opindex Wno-protocol
2889@opindex Wprotocol
2890If a class is declared to implement a protocol, a warning is issued for
2891every method in the protocol that is not implemented by the class.  The
2892default behavior is to issue a warning for every method not explicitly
2893implemented in the class, even if a method implementation is inherited
2894from the superclass.  If you use the @option{-Wno-protocol} option, then
2895methods inherited from the superclass are considered to be implemented,
2896and no warning is issued for them.
2897
2898@item -Wselector @r{(Objective-C and Objective-C++ only)}
2899@opindex Wselector
2900@opindex Wno-selector
2901Warn if multiple methods of different types for the same selector are
2902found during compilation.  The check is performed on the list of methods
2903in the final stage of compilation.  Additionally, a check is performed
2904for each selector appearing in a @code{@@selector(@dots{})}
2905expression, and a corresponding method for that selector has been found
2906during compilation.  Because these checks scan the method table only at
2907the end of compilation, these warnings are not produced if the final
2908stage of compilation is not reached, for example because an error is
2909found during compilation, or because the @option{-fsyntax-only} option is
2910being used.
2911
2912@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
2913@opindex Wstrict-selector-match
2914@opindex Wno-strict-selector-match
2915Warn if multiple methods with differing argument and/or return types are
2916found for a given selector when attempting to send a message using this
2917selector to a receiver of type @code{id} or @code{Class}.  When this flag
2918is off (which is the default behavior), the compiler omits such warnings
2919if any differences found are confined to types that share the same size
2920and alignment.
2921
2922@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
2923@opindex Wundeclared-selector
2924@opindex Wno-undeclared-selector
2925Warn if a @code{@@selector(@dots{})} expression referring to an
2926undeclared selector is found.  A selector is considered undeclared if no
2927method with that name has been declared before the
2928@code{@@selector(@dots{})} expression, either explicitly in an
2929@code{@@interface} or @code{@@protocol} declaration, or implicitly in
2930an @code{@@implementation} section.  This option always performs its
2931checks as soon as a @code{@@selector(@dots{})} expression is found,
2932while @option{-Wselector} only performs its checks in the final stage of
2933compilation.  This also enforces the coding style convention
2934that methods and selectors must be declared before being used.
2935
2936@item -print-objc-runtime-info
2937@opindex print-objc-runtime-info
2938Generate C header describing the largest structure that is passed by
2939value, if any.
2940
2941@end table
2942
2943@node Language Independent Options
2944@section Options to Control Diagnostic Messages Formatting
2945@cindex options to control diagnostics formatting
2946@cindex diagnostic messages
2947@cindex message formatting
2948
2949Traditionally, diagnostic messages have been formatted irrespective of
2950the output device's aspect (e.g.@: its width, @dots{}).  You can use the
2951options described below
2952to control the formatting algorithm for diagnostic messages,
2953e.g.@: how many characters per line, how often source location
2954information should be reported.  Note that some language front ends may not
2955honor these options.
2956
2957@table @gcctabopt
2958@item -fmessage-length=@var{n}
2959@opindex fmessage-length
2960Try to format error messages so that they fit on lines of about @var{n}
2961characters.  The default is 72 characters for @command{g++} and 0 for the rest of
2962the front ends supported by GCC@.  If @var{n} is zero, then no
2963line-wrapping is done; each error message appears on a single
2964line.
2965
2966@item -fdiagnostics-show-location=once
2967@opindex fdiagnostics-show-location
2968Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
2969reporter to emit source location information @emph{once}; that is, in
2970case the message is too long to fit on a single physical line and has to
2971be wrapped, the source location won't be emitted (as prefix) again,
2972over and over, in subsequent continuation lines.  This is the default
2973behavior.
2974
2975@item -fdiagnostics-show-location=every-line
2976Only meaningful in line-wrapping mode.  Instructs the diagnostic
2977messages reporter to emit the same source location information (as
2978prefix) for physical lines that result from the process of breaking
2979a message which is too long to fit on a single line.
2980
2981@item -fno-diagnostics-show-option
2982@opindex fno-diagnostics-show-option
2983@opindex fdiagnostics-show-option
2984By default, each diagnostic emitted includes text indicating the
2985command-line option that directly controls the diagnostic (if such an
2986option is known to the diagnostic machinery).  Specifying the
2987@option{-fno-diagnostics-show-option} flag suppresses that behavior.
2988
2989@item -fno-diagnostics-show-caret
2990@opindex fno-diagnostics-show-caret
2991@opindex fdiagnostics-show-caret
2992By default, each diagnostic emitted includes the original source line
2993and a caret '^' indicating the column.  This option suppresses this
2994information.
2995
2996@end table
2997
2998@node Warning Options
2999@section Options to Request or Suppress Warnings
3000@cindex options to control warnings
3001@cindex warning messages
3002@cindex messages, warning
3003@cindex suppressing warnings
3004
3005Warnings are diagnostic messages that report constructions that
3006are not inherently erroneous but that are risky or suggest there
3007may have been an error.
3008
3009The following language-independent options do not enable specific
3010warnings but control the kinds of diagnostics produced by GCC@.
3011
3012@table @gcctabopt
3013@cindex syntax checking
3014@item -fsyntax-only
3015@opindex fsyntax-only
3016Check the code for syntax errors, but don't do anything beyond that.
3017
3018@item -fmax-errors=@var{n}
3019@opindex fmax-errors
3020Limits the maximum number of error messages to @var{n}, at which point
3021GCC bails out rather than attempting to continue processing the source
3022code.  If @var{n} is 0 (the default), there is no limit on the number
3023of error messages produced.  If @option{-Wfatal-errors} is also
3024specified, then @option{-Wfatal-errors} takes precedence over this
3025option.
3026
3027@item -w
3028@opindex w
3029Inhibit all warning messages.
3030
3031@item -Werror
3032@opindex Werror
3033@opindex Wno-error
3034Make all warnings into errors.
3035
3036@item -Werror=
3037@opindex Werror=
3038@opindex Wno-error=
3039Make the specified warning into an error.  The specifier for a warning
3040is appended; for example @option{-Werror=switch} turns the warnings
3041controlled by @option{-Wswitch} into errors.  This switch takes a
3042negative form, to be used to negate @option{-Werror} for specific
3043warnings; for example @option{-Wno-error=switch} makes
3044@option{-Wswitch} warnings not be errors, even when @option{-Werror}
3045is in effect.
3046
3047The warning message for each controllable warning includes the
3048option that controls the warning.  That option can then be used with
3049@option{-Werror=} and @option{-Wno-error=} as described above.
3050(Printing of the option in the warning message can be disabled using the
3051@option{-fno-diagnostics-show-option} flag.)
3052
3053Note that specifying @option{-Werror=}@var{foo} automatically implies
3054@option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
3055imply anything.
3056
3057@item -Wfatal-errors
3058@opindex Wfatal-errors
3059@opindex Wno-fatal-errors
3060This option causes the compiler to abort compilation on the first error
3061occurred rather than trying to keep going and printing further error
3062messages.
3063
3064@end table
3065
3066You can request many specific warnings with options beginning with
3067@samp{-W}, for example @option{-Wimplicit} to request warnings on
3068implicit declarations.  Each of these specific warning options also
3069has a negative form beginning @samp{-Wno-} to turn off warnings; for
3070example, @option{-Wno-implicit}.  This manual lists only one of the
3071two forms, whichever is not the default.  For further
3072language-specific options also refer to @ref{C++ Dialect Options} and
3073@ref{Objective-C and Objective-C++ Dialect Options}.
3074
3075When an unrecognized warning option is requested (e.g.,
3076@option{-Wunknown-warning}), GCC emits a diagnostic stating
3077that the option is not recognized.  However, if the @option{-Wno-} form
3078is used, the behavior is slightly different: no diagnostic is
3079produced for @option{-Wno-unknown-warning} unless other diagnostics
3080are being produced.  This allows the use of new @option{-Wno-} options
3081with old compilers, but if something goes wrong, the compiler
3082warns that an unrecognized option is present.
3083
3084@table @gcctabopt
3085@item -Wpedantic
3086@itemx -pedantic
3087@opindex pedantic
3088@opindex Wpedantic
3089Issue all the warnings demanded by strict ISO C and ISO C++;
3090reject all programs that use forbidden extensions, and some other
3091programs that do not follow ISO C and ISO C++.  For ISO C, follows the
3092version of the ISO C standard specified by any @option{-std} option used.
3093
3094Valid ISO C and ISO C++ programs should compile properly with or without
3095this option (though a rare few require @option{-ansi} or a
3096@option{-std} option specifying the required version of ISO C)@.  However,
3097without this option, certain GNU extensions and traditional C and C++
3098features are supported as well.  With this option, they are rejected.
3099
3100@option{-Wpedantic} does not cause warning messages for use of the
3101alternate keywords whose names begin and end with @samp{__}.  Pedantic
3102warnings are also disabled in the expression that follows
3103@code{__extension__}.  However, only system header files should use
3104these escape routes; application programs should avoid them.
3105@xref{Alternate Keywords}.
3106
3107Some users try to use @option{-Wpedantic} to check programs for strict ISO
3108C conformance.  They soon find that it does not do quite what they want:
3109it finds some non-ISO practices, but not all---only those for which
3110ISO C @emph{requires} a diagnostic, and some others for which
3111diagnostics have been added.
3112
3113A feature to report any failure to conform to ISO C might be useful in
3114some instances, but would require considerable additional work and would
3115be quite different from @option{-Wpedantic}.  We don't have plans to
3116support such a feature in the near future.
3117
3118Where the standard specified with @option{-std} represents a GNU
3119extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3120corresponding @dfn{base standard}, the version of ISO C on which the GNU
3121extended dialect is based.  Warnings from @option{-Wpedantic} are given
3122where they are required by the base standard.  (It does not make sense
3123for such warnings to be given only for features not in the specified GNU
3124C dialect, since by definition the GNU dialects of C include all
3125features the compiler supports with the given option, and there would be
3126nothing to warn about.)
3127
3128@item -pedantic-errors
3129@opindex pedantic-errors
3130Like @option{-Wpedantic}, except that errors are produced rather than
3131warnings.
3132
3133@item -Wall
3134@opindex Wall
3135@opindex Wno-all
3136This enables all the warnings about constructions that some users
3137consider questionable, and that are easy to avoid (or modify to
3138prevent the warning), even in conjunction with macros.  This also
3139enables some language-specific warnings described in @ref{C++ Dialect
3140Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3141
3142@option{-Wall} turns on the following warning flags:
3143
3144@gccoptlist{-Waddress   @gol
3145-Warray-bounds @r{(only with} @option{-O2}@r{)}  @gol
3146-Wc++11-compat  @gol
3147-Wchar-subscripts  @gol
3148-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3149-Wimplicit-int @r{(C and Objective-C only)} @gol
3150-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3151-Wcomment  @gol
3152-Wformat   @gol
3153-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}  @gol
3154-Wmaybe-uninitialized @gol
3155-Wmissing-braces @r{(only for C/ObjC)} @gol
3156-Wnonnull  @gol
3157-Wparentheses  @gol
3158-Wpointer-sign  @gol
3159-Wreorder   @gol
3160-Wreturn-type  @gol
3161-Wsequence-point  @gol
3162-Wsign-compare @r{(only in C++)}  @gol
3163-Wstrict-aliasing  @gol
3164-Wstrict-overflow=1  @gol
3165-Wswitch  @gol
3166-Wtrigraphs  @gol
3167-Wuninitialized  @gol
3168-Wunknown-pragmas  @gol
3169-Wunused-function  @gol
3170-Wunused-label     @gol
3171-Wunused-value     @gol
3172-Wunused-variable  @gol
3173-Wvolatile-register-var @gol
3174}
3175
3176Note that some warning flags are not implied by @option{-Wall}.  Some of
3177them warn about constructions that users generally do not consider
3178questionable, but which occasionally you might wish to check for;
3179others warn about constructions that are necessary or hard to avoid in
3180some cases, and there is no simple way to modify the code to suppress
3181the warning. Some of them are enabled by @option{-Wextra} but many of
3182them must be enabled individually.
3183
3184@item -Wextra
3185@opindex W
3186@opindex Wextra
3187@opindex Wno-extra
3188This enables some extra warning flags that are not enabled by
3189@option{-Wall}. (This option used to be called @option{-W}.  The older
3190name is still supported, but the newer name is more descriptive.)
3191
3192@gccoptlist{-Wclobbered  @gol
3193-Wempty-body  @gol
3194-Wignored-qualifiers @gol
3195-Wmissing-field-initializers  @gol
3196-Wmissing-parameter-type @r{(C only)}  @gol
3197-Wold-style-declaration @r{(C only)}  @gol
3198-Woverride-init  @gol
3199-Wsign-compare  @gol
3200-Wtype-limits  @gol
3201-Wuninitialized  @gol
3202-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3203-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}  @gol
3204}
3205
3206The option @option{-Wextra} also prints warning messages for the
3207following cases:
3208
3209@itemize @bullet
3210
3211@item
3212A pointer is compared against integer zero with @samp{<}, @samp{<=},
3213@samp{>}, or @samp{>=}.
3214
3215@item
3216(C++ only) An enumerator and a non-enumerator both appear in a
3217conditional expression.
3218
3219@item
3220(C++ only) Ambiguous virtual bases.
3221
3222@item
3223(C++ only) Subscripting an array that has been declared @samp{register}.
3224
3225@item
3226(C++ only) Taking the address of a variable that has been declared
3227@samp{register}.
3228
3229@item
3230(C++ only) A base class is not initialized in a derived class's copy
3231constructor.
3232
3233@end itemize
3234
3235@item -Wchar-subscripts
3236@opindex Wchar-subscripts
3237@opindex Wno-char-subscripts
3238Warn if an array subscript has type @code{char}.  This is a common cause
3239of error, as programmers often forget that this type is signed on some
3240machines.
3241This warning is enabled by @option{-Wall}.
3242
3243@item -Wcomment
3244@opindex Wcomment
3245@opindex Wno-comment
3246Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3247comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3248This warning is enabled by @option{-Wall}.
3249
3250@item -Wno-coverage-mismatch
3251@opindex Wno-coverage-mismatch
3252Warn if feedback profiles do not match when using the
3253@option{-fprofile-use} option.
3254If a source file is changed between compiling with @option{-fprofile-gen} and
3255with @option{-fprofile-use}, the files with the profile feedback can fail
3256to match the source file and GCC cannot use the profile feedback
3257information.  By default, this warning is enabled and is treated as an
3258error.  @option{-Wno-coverage-mismatch} can be used to disable the
3259warning or @option{-Wno-error=coverage-mismatch} can be used to
3260disable the error.  Disabling the error for this warning can result in
3261poorly optimized code and is useful only in the
3262case of very minor changes such as bug fixes to an existing code-base.
3263Completely disabling the warning is not recommended.
3264
3265@item -Wno-cpp
3266@r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3267
3268Suppress warning messages emitted by @code{#warning} directives.
3269
3270@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3271@opindex Wdouble-promotion
3272@opindex Wno-double-promotion
3273Give a warning when a value of type @code{float} is implicitly
3274promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
3275floating-point unit implement @code{float} in hardware, but emulate
3276@code{double} in software.  On such a machine, doing computations
3277using @code{double} values is much more expensive because of the
3278overhead required for software emulation.
3279
3280It is easy to accidentally do computations with @code{double} because
3281floating-point literals are implicitly of type @code{double}.  For
3282example, in:
3283@smallexample
3284@group
3285float area(float radius)
3286@{
3287   return 3.14159 * radius * radius;
3288@}
3289@end group
3290@end smallexample
3291the compiler performs the entire computation with @code{double}
3292because the floating-point literal is a @code{double}.
3293
3294@item -Wformat
3295@itemx -Wformat=@var{n}
3296@opindex Wformat
3297@opindex Wno-format
3298@opindex ffreestanding
3299@opindex fno-builtin
3300@opindex Wformat=
3301Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3302the arguments supplied have types appropriate to the format string
3303specified, and that the conversions specified in the format string make
3304sense.  This includes standard functions, and others specified by format
3305attributes (@pxref{Function Attributes}), in the @code{printf},
3306@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3307not in the C standard) families (or other target-specific families).
3308Which functions are checked without format attributes having been
3309specified depends on the standard version selected, and such checks of
3310functions without the attribute specified are disabled by
3311@option{-ffreestanding} or @option{-fno-builtin}.
3312
3313The formats are checked against the format features supported by GNU
3314libc version 2.2.  These include all ISO C90 and C99 features, as well
3315as features from the Single Unix Specification and some BSD and GNU
3316extensions.  Other library implementations may not support all these
3317features; GCC does not support warning about features that go beyond a
3318particular library's limitations.  However, if @option{-Wpedantic} is used
3319with @option{-Wformat}, warnings are given about format features not
3320in the selected standard version (but not for @code{strfmon} formats,
3321since those are not in any version of the C standard).  @xref{C Dialect
3322Options,,Options Controlling C Dialect}.
3323
3324@table @gcctabopt
3325@item -Wformat=1
3326@itemx -Wformat
3327Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3328@option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
3329@option{-Wformat} also checks for null format arguments for several
3330functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
3331aspects of this level of format checking can be disabled by the
3332options: @option{-Wno-format-contains-nul},
3333@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3334@option{-Wformat} is enabled by @option{-Wall}.
3335
3336@item -Wno-format-contains-nul
3337@opindex Wno-format-contains-nul
3338@opindex Wformat-contains-nul
3339If @option{-Wformat} is specified, do not warn about format strings that
3340contain NUL bytes.
3341
3342@item -Wno-format-extra-args
3343@opindex Wno-format-extra-args
3344@opindex Wformat-extra-args
3345If @option{-Wformat} is specified, do not warn about excess arguments to a
3346@code{printf} or @code{scanf} format function.  The C standard specifies
3347that such arguments are ignored.
3348
3349Where the unused arguments lie between used arguments that are
3350specified with @samp{$} operand number specifications, normally
3351warnings are still given, since the implementation could not know what
3352type to pass to @code{va_arg} to skip the unused arguments.  However,
3353in the case of @code{scanf} formats, this option suppresses the
3354warning if the unused arguments are all pointers, since the Single
3355Unix Specification says that such unused arguments are allowed.
3356
3357@item -Wno-format-zero-length
3358@opindex Wno-format-zero-length
3359@opindex Wformat-zero-length
3360If @option{-Wformat} is specified, do not warn about zero-length formats.
3361The C standard specifies that zero-length formats are allowed.
3362
3363
3364@item -Wformat=2
3365Enable @option{-Wformat} plus additional format checks.  Currently
3366equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3367-Wformat-y2k}.
3368
3369@item -Wformat-nonliteral
3370@opindex Wformat-nonliteral
3371@opindex Wno-format-nonliteral
3372If @option{-Wformat} is specified, also warn if the format string is not a
3373string literal and so cannot be checked, unless the format function
3374takes its format arguments as a @code{va_list}.
3375
3376@item -Wformat-security
3377@opindex Wformat-security
3378@opindex Wno-format-security
3379If @option{-Wformat} is specified, also warn about uses of format
3380functions that represent possible security problems.  At present, this
3381warns about calls to @code{printf} and @code{scanf} functions where the
3382format string is not a string literal and there are no format arguments,
3383as in @code{printf (foo);}.  This may be a security hole if the format
3384string came from untrusted input and contains @samp{%n}.  (This is
3385currently a subset of what @option{-Wformat-nonliteral} warns about, but
3386in future warnings may be added to @option{-Wformat-security} that are not
3387included in @option{-Wformat-nonliteral}.)
3388
3389@item -Wformat-y2k
3390@opindex Wformat-y2k
3391@opindex Wno-format-y2k
3392If @option{-Wformat} is specified, also warn about @code{strftime}
3393formats that may yield only a two-digit year.
3394@end table
3395
3396@item -Wnonnull
3397@opindex Wnonnull
3398@opindex Wno-nonnull
3399Warn about passing a null pointer for arguments marked as
3400requiring a non-null value by the @code{nonnull} function attribute.
3401
3402@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
3403can be disabled with the @option{-Wno-nonnull} option.
3404
3405@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3406@opindex Winit-self
3407@opindex Wno-init-self
3408Warn about uninitialized variables that are initialized with themselves.
3409Note this option can only be used with the @option{-Wuninitialized} option.
3410
3411For example, GCC warns about @code{i} being uninitialized in the
3412following snippet only when @option{-Winit-self} has been specified:
3413@smallexample
3414@group
3415int f()
3416@{
3417  int i = i;
3418  return i;
3419@}
3420@end group
3421@end smallexample
3422
3423This warning is enabled by @option{-Wall} in C++.
3424
3425@item -Wimplicit-int @r{(C and Objective-C only)}
3426@opindex Wimplicit-int
3427@opindex Wno-implicit-int
3428Warn when a declaration does not specify a type.
3429This warning is enabled by @option{-Wall}.
3430
3431@item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3432@opindex Wimplicit-function-declaration
3433@opindex Wno-implicit-function-declaration
3434Give a warning whenever a function is used before being declared. In
3435C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3436enabled by default and it is made into an error by
3437@option{-pedantic-errors}. This warning is also enabled by
3438@option{-Wall}.
3439
3440@item -Wimplicit @r{(C and Objective-C only)}
3441@opindex Wimplicit
3442@opindex Wno-implicit
3443Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3444This warning is enabled by @option{-Wall}.
3445
3446@item -Wignored-qualifiers @r{(C and C++ only)}
3447@opindex Wignored-qualifiers
3448@opindex Wno-ignored-qualifiers
3449Warn if the return type of a function has a type qualifier
3450such as @code{const}.  For ISO C such a type qualifier has no effect,
3451since the value returned by a function is not an lvalue.
3452For C++, the warning is only emitted for scalar types or @code{void}.
3453ISO C prohibits qualified @code{void} return types on function
3454definitions, so such return types always receive a warning
3455even without this option.
3456
3457This warning is also enabled by @option{-Wextra}.
3458
3459@item -Wmain
3460@opindex Wmain
3461@opindex Wno-main
3462Warn if the type of @samp{main} is suspicious.  @samp{main} should be
3463a function with external linkage, returning int, taking either zero
3464arguments, two, or three arguments of appropriate types.  This warning
3465is enabled by default in C++ and is enabled by either @option{-Wall}
3466or @option{-Wpedantic}.
3467
3468@item -Wmissing-braces
3469@opindex Wmissing-braces
3470@opindex Wno-missing-braces
3471Warn if an aggregate or union initializer is not fully bracketed.  In
3472the following example, the initializer for @samp{a} is not fully
3473bracketed, but that for @samp{b} is fully bracketed.  This warning is
3474enabled by @option{-Wall} in C.
3475
3476@smallexample
3477int a[2][2] = @{ 0, 1, 2, 3 @};
3478int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3479@end smallexample
3480
3481This warning is enabled by @option{-Wall}.
3482
3483@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3484@opindex Wmissing-include-dirs
3485@opindex Wno-missing-include-dirs
3486Warn if a user-supplied include directory does not exist.
3487
3488@item -Wparentheses
3489@opindex Wparentheses
3490@opindex Wno-parentheses
3491Warn if parentheses are omitted in certain contexts, such
3492as when there is an assignment in a context where a truth value
3493is expected, or when operators are nested whose precedence people
3494often get confused about.
3495
3496Also warn if a comparison like @samp{x<=y<=z} appears; this is
3497equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3498interpretation from that of ordinary mathematical notation.
3499
3500Also warn about constructions where there may be confusion to which
3501@code{if} statement an @code{else} branch belongs.  Here is an example of
3502such a case:
3503
3504@smallexample
3505@group
3506@{
3507  if (a)
3508    if (b)
3509      foo ();
3510  else
3511    bar ();
3512@}
3513@end group
3514@end smallexample
3515
3516In C/C++, every @code{else} branch belongs to the innermost possible
3517@code{if} statement, which in this example is @code{if (b)}.  This is
3518often not what the programmer expected, as illustrated in the above
3519example by indentation the programmer chose.  When there is the
3520potential for this confusion, GCC issues a warning when this flag
3521is specified.  To eliminate the warning, add explicit braces around
3522the innermost @code{if} statement so there is no way the @code{else}
3523can belong to the enclosing @code{if}.  The resulting code
3524looks like this:
3525
3526@smallexample
3527@group
3528@{
3529  if (a)
3530    @{
3531      if (b)
3532        foo ();
3533      else
3534        bar ();
3535    @}
3536@}
3537@end group
3538@end smallexample
3539
3540Also warn for dangerous uses of the GNU extension to
3541@code{?:} with omitted middle operand. When the condition
3542in the @code{?}: operator is a boolean expression, the omitted value is
3543always 1.  Often programmers expect it to be a value computed
3544inside the conditional expression instead.
3545
3546This warning is enabled by @option{-Wall}.
3547
3548@item -Wsequence-point
3549@opindex Wsequence-point
3550@opindex Wno-sequence-point
3551Warn about code that may have undefined semantics because of violations
3552of sequence point rules in the C and C++ standards.
3553
3554The C and C++ standards define the order in which expressions in a C/C++
3555program are evaluated in terms of @dfn{sequence points}, which represent
3556a partial ordering between the execution of parts of the program: those
3557executed before the sequence point, and those executed after it.  These
3558occur after the evaluation of a full expression (one which is not part
3559of a larger expression), after the evaluation of the first operand of a
3560@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3561function is called (but after the evaluation of its arguments and the
3562expression denoting the called function), and in certain other places.
3563Other than as expressed by the sequence point rules, the order of
3564evaluation of subexpressions of an expression is not specified.  All
3565these rules describe only a partial order rather than a total order,
3566since, for example, if two functions are called within one expression
3567with no sequence point between them, the order in which the functions
3568are called is not specified.  However, the standards committee have
3569ruled that function calls do not overlap.
3570
3571It is not specified when between sequence points modifications to the
3572values of objects take effect.  Programs whose behavior depends on this
3573have undefined behavior; the C and C++ standards specify that ``Between
3574the previous and next sequence point an object shall have its stored
3575value modified at most once by the evaluation of an expression.
3576Furthermore, the prior value shall be read only to determine the value
3577to be stored.''.  If a program breaks these rules, the results on any
3578particular implementation are entirely unpredictable.
3579
3580Examples of code with undefined behavior are @code{a = a++;},
3581@code{a[n] = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases
3582are not diagnosed by this option, and it may give an occasional false
3583positive result, but in general it has been found fairly effective at
3584detecting this sort of problem in programs.
3585
3586The standard is worded confusingly, therefore there is some debate
3587over the precise meaning of the sequence point rules in subtle cases.
3588Links to discussions of the problem, including proposed formal
3589definitions, may be found on the GCC readings page, at
3590@uref{http://gcc.gnu.org/@/readings.html}.
3591
3592This warning is enabled by @option{-Wall} for C and C++.
3593
3594@item -Wno-return-local-addr
3595@opindex Wno-return-local-addr
3596@opindex Wreturn-local-addr
3597Do not warn about returning a pointer (or in C++, a reference) to a
3598variable that goes out of scope after the function returns.
3599
3600@item -Wreturn-type
3601@opindex Wreturn-type
3602@opindex Wno-return-type
3603Warn whenever a function is defined with a return type that defaults
3604to @code{int}.  Also warn about any @code{return} statement with no
3605return value in a function whose return type is not @code{void}
3606(falling off the end of the function body is considered returning
3607without a value), and about a @code{return} statement with an
3608expression in a function whose return type is @code{void}.
3609
3610For C++, a function without return type always produces a diagnostic
3611message, even when @option{-Wno-return-type} is specified.  The only
3612exceptions are @samp{main} and functions defined in system headers.
3613
3614This warning is enabled by @option{-Wall}.
3615
3616@item -Wswitch
3617@opindex Wswitch
3618@opindex Wno-switch
3619Warn whenever a @code{switch} statement has an index of enumerated type
3620and lacks a @code{case} for one or more of the named codes of that
3621enumeration.  (The presence of a @code{default} label prevents this
3622warning.)  @code{case} labels outside the enumeration range also
3623provoke warnings when this option is used (even if there is a
3624@code{default} label).
3625This warning is enabled by @option{-Wall}.
3626
3627@item -Wswitch-default
3628@opindex Wswitch-default
3629@opindex Wno-switch-default
3630Warn whenever a @code{switch} statement does not have a @code{default}
3631case.
3632
3633@item -Wswitch-enum
3634@opindex Wswitch-enum
3635@opindex Wno-switch-enum
3636Warn whenever a @code{switch} statement has an index of enumerated type
3637and lacks a @code{case} for one or more of the named codes of that
3638enumeration.  @code{case} labels outside the enumeration range also
3639provoke warnings when this option is used.  The only difference
3640between @option{-Wswitch} and this option is that this option gives a
3641warning about an omitted enumeration code even if there is a
3642@code{default} label.
3643
3644@item -Wsync-nand @r{(C and C++ only)}
3645@opindex Wsync-nand
3646@opindex Wno-sync-nand
3647Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3648built-in functions are used.  These functions changed semantics in GCC 4.4.
3649
3650@item -Wtrigraphs
3651@opindex Wtrigraphs
3652@opindex Wno-trigraphs
3653Warn if any trigraphs are encountered that might change the meaning of
3654the program (trigraphs within comments are not warned about).
3655This warning is enabled by @option{-Wall}.
3656
3657@item -Wunused-but-set-parameter
3658@opindex Wunused-but-set-parameter
3659@opindex Wno-unused-but-set-parameter
3660Warn whenever a function parameter is assigned to, but otherwise unused
3661(aside from its declaration).
3662
3663To suppress this warning use the @samp{unused} attribute
3664(@pxref{Variable Attributes}).
3665
3666This warning is also enabled by @option{-Wunused} together with
3667@option{-Wextra}.
3668
3669@item -Wunused-but-set-variable
3670@opindex Wunused-but-set-variable
3671@opindex Wno-unused-but-set-variable
3672Warn whenever a local variable is assigned to, but otherwise unused
3673(aside from its declaration).
3674This warning is enabled by @option{-Wall}.
3675
3676To suppress this warning use the @samp{unused} attribute
3677(@pxref{Variable Attributes}).
3678
3679This warning is also enabled by @option{-Wunused}, which is enabled
3680by @option{-Wall}.
3681
3682@item -Wunused-function
3683@opindex Wunused-function
3684@opindex Wno-unused-function
3685Warn whenever a static function is declared but not defined or a
3686non-inline static function is unused.
3687This warning is enabled by @option{-Wall}.
3688
3689@item -Wunused-label
3690@opindex Wunused-label
3691@opindex Wno-unused-label
3692Warn whenever a label is declared but not used.
3693This warning is enabled by @option{-Wall}.
3694
3695To suppress this warning use the @samp{unused} attribute
3696(@pxref{Variable Attributes}).
3697
3698@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
3699@opindex Wunused-local-typedefs
3700Warn when a typedef locally defined in a function is not used.
3701This warning is enabled by @option{-Wall}.
3702
3703@item -Wunused-parameter
3704@opindex Wunused-parameter
3705@opindex Wno-unused-parameter
3706Warn whenever a function parameter is unused aside from its declaration.
3707
3708To suppress this warning use the @samp{unused} attribute
3709(@pxref{Variable Attributes}).
3710
3711@item -Wno-unused-result
3712@opindex Wunused-result
3713@opindex Wno-unused-result
3714Do not warn if a caller of a function marked with attribute
3715@code{warn_unused_result} (@pxref{Function Attributes}) does not use
3716its return value. The default is @option{-Wunused-result}.
3717
3718@item -Wunused-variable
3719@opindex Wunused-variable
3720@opindex Wno-unused-variable
3721Warn whenever a local variable or non-constant static variable is unused
3722aside from its declaration.
3723This warning is enabled by @option{-Wall}.
3724
3725To suppress this warning use the @samp{unused} attribute
3726(@pxref{Variable Attributes}).
3727
3728@item -Wunused-value
3729@opindex Wunused-value
3730@opindex Wno-unused-value
3731Warn whenever a statement computes a result that is explicitly not
3732used. To suppress this warning cast the unused expression to
3733@samp{void}. This includes an expression-statement or the left-hand
3734side of a comma expression that contains no side effects. For example,
3735an expression such as @samp{x[i,j]} causes a warning, while
3736@samp{x[(void)i,j]} does not.
3737
3738This warning is enabled by @option{-Wall}.
3739
3740@item -Wunused
3741@opindex Wunused
3742@opindex Wno-unused
3743All the above @option{-Wunused} options combined.
3744
3745In order to get a warning about an unused function parameter, you must
3746either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
3747@option{-Wunused}), or separately specify @option{-Wunused-parameter}.
3748
3749@item -Wuninitialized
3750@opindex Wuninitialized
3751@opindex Wno-uninitialized
3752Warn if an automatic variable is used without first being initialized
3753or if a variable may be clobbered by a @code{setjmp} call. In C++,
3754warn if a non-static reference or non-static @samp{const} member
3755appears in a class without constructors.
3756
3757If you want to warn about code that uses the uninitialized value of the
3758variable in its own initializer, use the @option{-Winit-self} option.
3759
3760These warnings occur for individual uninitialized or clobbered
3761elements of structure, union or array variables as well as for
3762variables that are uninitialized or clobbered as a whole.  They do
3763not occur for variables or elements declared @code{volatile}.  Because
3764these warnings depend on optimization, the exact variables or elements
3765for which there are warnings depends on the precise optimization
3766options and version of GCC used.
3767
3768Note that there may be no warning about a variable that is used only
3769to compute a value that itself is never used, because such
3770computations may be deleted by data flow analysis before the warnings
3771are printed.
3772
3773@item -Wmaybe-uninitialized
3774@opindex Wmaybe-uninitialized
3775@opindex Wno-maybe-uninitialized
3776For an automatic variable, if there exists a path from the function
3777entry to a use of the variable that is initialized, but there exist
3778some other paths for which the variable is not initialized, the compiler
3779emits a warning if it cannot prove the uninitialized paths are not
3780executed at run time. These warnings are made optional because GCC is
3781not smart enough to see all the reasons why the code might be correct
3782in spite of appearing to have an error.  Here is one example of how
3783this can happen:
3784
3785@smallexample
3786@group
3787@{
3788  int x;
3789  switch (y)
3790    @{
3791    case 1: x = 1;
3792      break;
3793    case 2: x = 4;
3794      break;
3795    case 3: x = 5;
3796    @}
3797  foo (x);
3798@}
3799@end group
3800@end smallexample
3801
3802@noindent
3803If the value of @code{y} is always 1, 2 or 3, then @code{x} is
3804always initialized, but GCC doesn't know this. To suppress the
3805warning, you need to provide a default case with assert(0) or
3806similar code.
3807
3808@cindex @code{longjmp} warnings
3809This option also warns when a non-volatile automatic variable might be
3810changed by a call to @code{longjmp}.  These warnings as well are possible
3811only in optimizing compilation.
3812
3813The compiler sees only the calls to @code{setjmp}.  It cannot know
3814where @code{longjmp} will be called; in fact, a signal handler could
3815call it at any point in the code.  As a result, you may get a warning
3816even when there is in fact no problem because @code{longjmp} cannot
3817in fact be called at the place that would cause a problem.
3818
3819Some spurious warnings can be avoided if you declare all the functions
3820you use that never return as @code{noreturn}.  @xref{Function
3821Attributes}.
3822
3823This warning is enabled by @option{-Wall} or @option{-Wextra}.
3824
3825@item -Wunknown-pragmas
3826@opindex Wunknown-pragmas
3827@opindex Wno-unknown-pragmas
3828@cindex warning for unknown pragmas
3829@cindex unknown pragmas, warning
3830@cindex pragmas, warning of unknown
3831Warn when a @code{#pragma} directive is encountered that is not understood by
3832GCC@.  If this command-line option is used, warnings are even issued
3833for unknown pragmas in system header files.  This is not the case if
3834the warnings are only enabled by the @option{-Wall} command-line option.
3835
3836@item -Wno-pragmas
3837@opindex Wno-pragmas
3838@opindex Wpragmas
3839Do not warn about misuses of pragmas, such as incorrect parameters,
3840invalid syntax, or conflicts between pragmas.  See also
3841@option{-Wunknown-pragmas}.
3842
3843@item -Wstrict-aliasing
3844@opindex Wstrict-aliasing
3845@opindex Wno-strict-aliasing
3846This option is only active when @option{-fstrict-aliasing} is active.
3847It warns about code that might break the strict aliasing rules that the
3848compiler is using for optimization.  The warning does not catch all
3849cases, but does attempt to catch the more common pitfalls.  It is
3850included in @option{-Wall}.
3851It is equivalent to @option{-Wstrict-aliasing=3}
3852
3853@item -Wstrict-aliasing=n
3854@opindex Wstrict-aliasing=n
3855This option is only active when @option{-fstrict-aliasing} is active.
3856It warns about code that might break the strict aliasing rules that the
3857compiler is using for optimization.
3858Higher levels correspond to higher accuracy (fewer false positives).
3859Higher levels also correspond to more effort, similar to the way @option{-O}
3860works.
3861@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
3862
3863Level 1: Most aggressive, quick, least accurate.
3864Possibly useful when higher levels
3865do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
3866false negatives.  However, it has many false positives.
3867Warns for all pointer conversions between possibly incompatible types,
3868even if never dereferenced.  Runs in the front end only.
3869
3870Level 2: Aggressive, quick, not too precise.
3871May still have many false positives (not as many as level 1 though),
3872and few false negatives (but possibly more than level 1).
3873Unlike level 1, it only warns when an address is taken.  Warns about
3874incomplete types.  Runs in the front end only.
3875
3876Level 3 (default for @option{-Wstrict-aliasing}):
3877Should have very few false positives and few false
3878negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
3879Takes care of the common pun+dereference pattern in the front end:
3880@code{*(int*)&some_float}.
3881If optimization is enabled, it also runs in the back end, where it deals
3882with multiple statement cases using flow-sensitive points-to information.
3883Only warns when the converted pointer is dereferenced.
3884Does not warn about incomplete types.
3885
3886@item -Wstrict-overflow
3887@itemx -Wstrict-overflow=@var{n}
3888@opindex Wstrict-overflow
3889@opindex Wno-strict-overflow
3890This option is only active when @option{-fstrict-overflow} is active.
3891It warns about cases where the compiler optimizes based on the
3892assumption that signed overflow does not occur.  Note that it does not
3893warn about all cases where the code might overflow: it only warns
3894about cases where the compiler implements some optimization.  Thus
3895this warning depends on the optimization level.
3896
3897An optimization that assumes that signed overflow does not occur is
3898perfectly safe if the values of the variables involved are such that
3899overflow never does, in fact, occur.  Therefore this warning can
3900easily give a false positive: a warning about code that is not
3901actually a problem.  To help focus on important issues, several
3902warning levels are defined.  No warnings are issued for the use of
3903undefined signed overflow when estimating how many iterations a loop
3904requires, in particular when determining whether a loop will be
3905executed at all.
3906
3907@table @gcctabopt
3908@item -Wstrict-overflow=1
3909Warn about cases that are both questionable and easy to avoid.  For
3910example,  with @option{-fstrict-overflow}, the compiler simplifies
3911@code{x + 1 > x} to @code{1}.  This level of
3912@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3913are not, and must be explicitly requested.
3914
3915@item -Wstrict-overflow=2
3916Also warn about other cases where a comparison is simplified to a
3917constant.  For example: @code{abs (x) >= 0}.  This can only be
3918simplified when @option{-fstrict-overflow} is in effect, because
3919@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
3920zero.  @option{-Wstrict-overflow} (with no level) is the same as
3921@option{-Wstrict-overflow=2}.
3922
3923@item -Wstrict-overflow=3
3924Also warn about other cases where a comparison is simplified.  For
3925example: @code{x + 1 > 1} is simplified to @code{x > 0}.
3926
3927@item -Wstrict-overflow=4
3928Also warn about other simplifications not covered by the above cases.
3929For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
3930
3931@item -Wstrict-overflow=5
3932Also warn about cases where the compiler reduces the magnitude of a
3933constant involved in a comparison.  For example: @code{x + 2 > y} is
3934simplified to @code{x + 1 >= y}.  This is reported only at the
3935highest warning level because this simplification applies to many
3936comparisons, so this warning level gives a very large number of
3937false positives.
3938@end table
3939
3940@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
3941@opindex Wsuggest-attribute=
3942@opindex Wno-suggest-attribute=
3943Warn for cases where adding an attribute may be beneficial. The
3944attributes currently supported are listed below.
3945
3946@table @gcctabopt
3947@item -Wsuggest-attribute=pure
3948@itemx -Wsuggest-attribute=const
3949@itemx -Wsuggest-attribute=noreturn
3950@opindex Wsuggest-attribute=pure
3951@opindex Wno-suggest-attribute=pure
3952@opindex Wsuggest-attribute=const
3953@opindex Wno-suggest-attribute=const
3954@opindex Wsuggest-attribute=noreturn
3955@opindex Wno-suggest-attribute=noreturn
3956
3957Warn about functions that might be candidates for attributes
3958@code{pure}, @code{const} or @code{noreturn}.  The compiler only warns for
3959functions visible in other compilation units or (in the case of @code{pure} and
3960@code{const}) if it cannot prove that the function returns normally. A function
3961returns normally if it doesn't contain an infinite loop or return abnormally
3962by throwing, calling @code{abort()} or trapping.  This analysis requires option
3963@option{-fipa-pure-const}, which is enabled by default at @option{-O} and
3964higher.  Higher optimization levels improve the accuracy of the analysis.
3965
3966@item -Wsuggest-attribute=format
3967@itemx -Wmissing-format-attribute
3968@opindex Wsuggest-attribute=format
3969@opindex Wmissing-format-attribute
3970@opindex Wno-suggest-attribute=format
3971@opindex Wno-missing-format-attribute
3972@opindex Wformat
3973@opindex Wno-format
3974
3975Warn about function pointers that might be candidates for @code{format}
3976attributes.  Note these are only possible candidates, not absolute ones.
3977GCC guesses that function pointers with @code{format} attributes that
3978are used in assignment, initialization, parameter passing or return
3979statements should have a corresponding @code{format} attribute in the
3980resulting type.  I.e.@: the left-hand side of the assignment or
3981initialization, the type of the parameter variable, or the return type
3982of the containing function respectively should also have a @code{format}
3983attribute to avoid the warning.
3984
3985GCC also warns about function definitions that might be
3986candidates for @code{format} attributes.  Again, these are only
3987possible candidates.  GCC guesses that @code{format} attributes
3988might be appropriate for any function that calls a function like
3989@code{vprintf} or @code{vscanf}, but this might not always be the
3990case, and some functions for which @code{format} attributes are
3991appropriate may not be detected.
3992@end table
3993
3994@item -Warray-bounds
3995@opindex Wno-array-bounds
3996@opindex Warray-bounds
3997This option is only active when @option{-ftree-vrp} is active
3998(default for @option{-O2} and above). It warns about subscripts to arrays
3999that are always out of bounds. This warning is enabled by @option{-Wall}.
4000
4001@item -Wno-div-by-zero
4002@opindex Wno-div-by-zero
4003@opindex Wdiv-by-zero
4004Do not warn about compile-time integer division by zero.  Floating-point
4005division by zero is not warned about, as it can be a legitimate way of
4006obtaining infinities and NaNs.
4007
4008@item -Wsystem-headers
4009@opindex Wsystem-headers
4010@opindex Wno-system-headers
4011@cindex warnings from system headers
4012@cindex system headers, warnings from
4013Print warning messages for constructs found in system header files.
4014Warnings from system headers are normally suppressed, on the assumption
4015that they usually do not indicate real problems and would only make the
4016compiler output harder to read.  Using this command-line option tells
4017GCC to emit warnings from system headers as if they occurred in user
4018code.  However, note that using @option{-Wall} in conjunction with this
4019option does @emph{not} warn about unknown pragmas in system
4020headers---for that, @option{-Wunknown-pragmas} must also be used.
4021
4022@item -Wtrampolines
4023@opindex Wtrampolines
4024@opindex Wno-trampolines
4025 Warn about trampolines generated for pointers to nested functions.
4026
4027 A trampoline is a small piece of data or code that is created at run
4028 time on the stack when the address of a nested function is taken, and
4029 is used to call the nested function indirectly.  For some targets, it
4030 is made up of data only and thus requires no special treatment.  But,
4031 for most targets, it is made up of code and thus requires the stack
4032 to be made executable in order for the program to work properly.
4033
4034@item -Wfloat-equal
4035@opindex Wfloat-equal
4036@opindex Wno-float-equal
4037Warn if floating-point values are used in equality comparisons.
4038
4039The idea behind this is that sometimes it is convenient (for the
4040programmer) to consider floating-point values as approximations to
4041infinitely precise real numbers.  If you are doing this, then you need
4042to compute (by analyzing the code, or in some other way) the maximum or
4043likely maximum error that the computation introduces, and allow for it
4044when performing comparisons (and when producing output, but that's a
4045different problem).  In particular, instead of testing for equality, you
4046should check to see whether the two values have ranges that overlap; and
4047this is done with the relational operators, so equality comparisons are
4048probably mistaken.
4049
4050@item -Wtraditional @r{(C and Objective-C only)}
4051@opindex Wtraditional
4052@opindex Wno-traditional
4053Warn about certain constructs that behave differently in traditional and
4054ISO C@.  Also warn about ISO C constructs that have no traditional C
4055equivalent, and/or problematic constructs that should be avoided.
4056
4057@itemize @bullet
4058@item
4059Macro parameters that appear within string literals in the macro body.
4060In traditional C macro replacement takes place within string literals,
4061but in ISO C it does not.
4062
4063@item
4064In traditional C, some preprocessor directives did not exist.
4065Traditional preprocessors only considered a line to be a directive
4066if the @samp{#} appeared in column 1 on the line.  Therefore
4067@option{-Wtraditional} warns about directives that traditional C
4068understands but ignores because the @samp{#} does not appear as the
4069first character on the line.  It also suggests you hide directives like
4070@samp{#pragma} not understood by traditional C by indenting them.  Some
4071traditional implementations do not recognize @samp{#elif}, so this option
4072suggests avoiding it altogether.
4073
4074@item
4075A function-like macro that appears without arguments.
4076
4077@item
4078The unary plus operator.
4079
4080@item
4081The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4082constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
4083constants.)  Note, these suffixes appear in macros defined in the system
4084headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4085Use of these macros in user code might normally lead to spurious
4086warnings, however GCC's integrated preprocessor has enough context to
4087avoid warning in these cases.
4088
4089@item
4090A function declared external in one block and then used after the end of
4091the block.
4092
4093@item
4094A @code{switch} statement has an operand of type @code{long}.
4095
4096@item
4097A non-@code{static} function declaration follows a @code{static} one.
4098This construct is not accepted by some traditional C compilers.
4099
4100@item
4101The ISO type of an integer constant has a different width or
4102signedness from its traditional type.  This warning is only issued if
4103the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
4104typically represent bit patterns, are not warned about.
4105
4106@item
4107Usage of ISO string concatenation is detected.
4108
4109@item
4110Initialization of automatic aggregates.
4111
4112@item
4113Identifier conflicts with labels.  Traditional C lacks a separate
4114namespace for labels.
4115
4116@item
4117Initialization of unions.  If the initializer is zero, the warning is
4118omitted.  This is done under the assumption that the zero initializer in
4119user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4120initializer warnings and relies on default initialization to zero in the
4121traditional C case.
4122
4123@item
4124Conversions by prototypes between fixed/floating-point values and vice
4125versa.  The absence of these prototypes when compiling with traditional
4126C causes serious problems.  This is a subset of the possible
4127conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4128
4129@item
4130Use of ISO C style function definitions.  This warning intentionally is
4131@emph{not} issued for prototype declarations or variadic functions
4132because these ISO C features appear in your code when using
4133libiberty's traditional C compatibility macros, @code{PARAMS} and
4134@code{VPARAMS}.  This warning is also bypassed for nested functions
4135because that feature is already a GCC extension and thus not relevant to
4136traditional C compatibility.
4137@end itemize
4138
4139@item -Wtraditional-conversion @r{(C and Objective-C only)}
4140@opindex Wtraditional-conversion
4141@opindex Wno-traditional-conversion
4142Warn if a prototype causes a type conversion that is different from what
4143would happen to the same argument in the absence of a prototype.  This
4144includes conversions of fixed point to floating and vice versa, and
4145conversions changing the width or signedness of a fixed-point argument
4146except when the same as the default promotion.
4147
4148@item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4149@opindex Wdeclaration-after-statement
4150@opindex Wno-declaration-after-statement
4151Warn when a declaration is found after a statement in a block.  This
4152construct, known from C++, was introduced with ISO C99 and is by default
4153allowed in GCC@.  It is not supported by ISO C90 and was not supported by
4154GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
4155
4156@item -Wundef
4157@opindex Wundef
4158@opindex Wno-undef
4159Warn if an undefined identifier is evaluated in an @samp{#if} directive.
4160
4161@item -Wno-endif-labels
4162@opindex Wno-endif-labels
4163@opindex Wendif-labels
4164Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
4165
4166@item -Wshadow
4167@opindex Wshadow
4168@opindex Wno-shadow
4169Warn whenever a local variable or type declaration shadows another variable,
4170parameter, type, or class member (in C++), or whenever a built-in function
4171is shadowed. Note that in C++, the compiler warns if a local variable
4172shadows an explicit typedef, but not if it shadows a struct/class/enum.
4173
4174@item -Wlarger-than=@var{len}
4175@opindex Wlarger-than=@var{len}
4176@opindex Wlarger-than-@var{len}
4177Warn whenever an object of larger than @var{len} bytes is defined.
4178
4179@item -Wframe-larger-than=@var{len}
4180@opindex Wframe-larger-than
4181Warn if the size of a function frame is larger than @var{len} bytes.
4182The computation done to determine the stack frame size is approximate
4183and not conservative.
4184The actual requirements may be somewhat greater than @var{len}
4185even if you do not get a warning.  In addition, any space allocated
4186via @code{alloca}, variable-length arrays, or related constructs
4187is not included by the compiler when determining
4188whether or not to issue a warning.
4189
4190@item -Wno-free-nonheap-object
4191@opindex Wno-free-nonheap-object
4192@opindex Wfree-nonheap-object
4193Do not warn when attempting to free an object that was not allocated
4194on the heap.
4195
4196@item -Wstack-usage=@var{len}
4197@opindex Wstack-usage
4198Warn if the stack usage of a function might be larger than @var{len} bytes.
4199The computation done to determine the stack usage is conservative.
4200Any space allocated via @code{alloca}, variable-length arrays, or related
4201constructs is included by the compiler when determining whether or not to
4202issue a warning.
4203
4204The message is in keeping with the output of @option{-fstack-usage}.
4205
4206@itemize
4207@item
4208If the stack usage is fully static but exceeds the specified amount, it's:
4209
4210@smallexample
4211  warning: stack usage is 1120 bytes
4212@end smallexample
4213@item
4214If the stack usage is (partly) dynamic but bounded, it's:
4215
4216@smallexample
4217  warning: stack usage might be 1648 bytes
4218@end smallexample
4219@item
4220If the stack usage is (partly) dynamic and not bounded, it's:
4221
4222@smallexample
4223  warning: stack usage might be unbounded
4224@end smallexample
4225@end itemize
4226
4227@item -Wunsafe-loop-optimizations
4228@opindex Wunsafe-loop-optimizations
4229@opindex Wno-unsafe-loop-optimizations
4230Warn if the loop cannot be optimized because the compiler cannot
4231assume anything on the bounds of the loop indices.  With
4232@option{-funsafe-loop-optimizations} warn if the compiler makes
4233such assumptions.
4234
4235@item -Wno-pedantic-ms-format @r{(MinGW targets only)}
4236@opindex Wno-pedantic-ms-format
4237@opindex Wpedantic-ms-format
4238When used in combination with @option{-Wformat}
4239and @option{-pedantic} without GNU extensions, this option
4240disables the warnings about non-ISO @code{printf} / @code{scanf} format
4241width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
4242which depend on the MS runtime.
4243
4244@item -Wpointer-arith
4245@opindex Wpointer-arith
4246@opindex Wno-pointer-arith
4247Warn about anything that depends on the ``size of'' a function type or
4248of @code{void}.  GNU C assigns these types a size of 1, for
4249convenience in calculations with @code{void *} pointers and pointers
4250to functions.  In C++, warn also when an arithmetic operation involves
4251@code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
4252
4253@item -Wtype-limits
4254@opindex Wtype-limits
4255@opindex Wno-type-limits
4256Warn if a comparison is always true or always false due to the limited
4257range of the data type, but do not warn for constant expressions.  For
4258example, warn if an unsigned variable is compared against zero with
4259@samp{<} or @samp{>=}.  This warning is also enabled by
4260@option{-Wextra}.
4261
4262@item -Wbad-function-cast @r{(C and Objective-C only)}
4263@opindex Wbad-function-cast
4264@opindex Wno-bad-function-cast
4265Warn whenever a function call is cast to a non-matching type.
4266For example, warn if @code{int malloc()} is cast to @code{anything *}.
4267
4268@item -Wc++-compat @r{(C and Objective-C only)}
4269Warn about ISO C constructs that are outside of the common subset of
4270ISO C and ISO C++, e.g.@: request for implicit conversion from
4271@code{void *} to a pointer to non-@code{void} type.
4272
4273@item -Wc++11-compat @r{(C++ and Objective-C++ only)}
4274Warn about C++ constructs whose meaning differs between ISO C++ 1998
4275and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
4276in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
4277enabled by @option{-Wall}.
4278
4279@item -Wcast-qual
4280@opindex Wcast-qual
4281@opindex Wno-cast-qual
4282Warn whenever a pointer is cast so as to remove a type qualifier from
4283the target type.  For example, warn if a @code{const char *} is cast
4284to an ordinary @code{char *}.
4285
4286Also warn when making a cast that introduces a type qualifier in an
4287unsafe way.  For example, casting @code{char **} to @code{const char **}
4288is unsafe, as in this example:
4289
4290@smallexample
4291  /* p is char ** value.  */
4292  const char **q = (const char **) p;
4293  /* Assignment of readonly string to const char * is OK.  */
4294  *q = "string";
4295  /* Now char** pointer points to read-only memory.  */
4296  **p = 'b';
4297@end smallexample
4298
4299@item -Wcast-align
4300@opindex Wcast-align
4301@opindex Wno-cast-align
4302Warn whenever a pointer is cast such that the required alignment of the
4303target is increased.  For example, warn if a @code{char *} is cast to
4304an @code{int *} on machines where integers can only be accessed at
4305two- or four-byte boundaries.
4306
4307@item -Wwrite-strings
4308@opindex Wwrite-strings
4309@opindex Wno-write-strings
4310When compiling C, give string constants the type @code{const
4311char[@var{length}]} so that copying the address of one into a
4312non-@code{const} @code{char *} pointer produces a warning.  These
4313warnings help you find at compile time code that can try to write
4314into a string constant, but only if you have been very careful about
4315using @code{const} in declarations and prototypes.  Otherwise, it is
4316just a nuisance. This is why we did not make @option{-Wall} request
4317these warnings.
4318
4319When compiling C++, warn about the deprecated conversion from string
4320literals to @code{char *}.  This warning is enabled by default for C++
4321programs.
4322
4323@item -Wclobbered
4324@opindex Wclobbered
4325@opindex Wno-clobbered
4326Warn for variables that might be changed by @samp{longjmp} or
4327@samp{vfork}.  This warning is also enabled by @option{-Wextra}.
4328
4329@item -Wconversion
4330@opindex Wconversion
4331@opindex Wno-conversion
4332Warn for implicit conversions that may alter a value. This includes
4333conversions between real and integer, like @code{abs (x)} when
4334@code{x} is @code{double}; conversions between signed and unsigned,
4335like @code{unsigned ui = -1}; and conversions to smaller types, like
4336@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
4337((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
4338changed by the conversion like in @code{abs (2.0)}.  Warnings about
4339conversions between signed and unsigned integers can be disabled by
4340using @option{-Wno-sign-conversion}.
4341
4342For C++, also warn for confusing overload resolution for user-defined
4343conversions; and conversions that never use a type conversion
4344operator: conversions to @code{void}, the same type, a base class or a
4345reference to them. Warnings about conversions between signed and
4346unsigned integers are disabled by default in C++ unless
4347@option{-Wsign-conversion} is explicitly enabled.
4348
4349@item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4350@opindex Wconversion-null
4351@opindex Wno-conversion-null
4352Do not warn for conversions between @code{NULL} and non-pointer
4353types. @option{-Wconversion-null} is enabled by default.
4354
4355@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4356@opindex Wzero-as-null-pointer-constant
4357@opindex Wno-zero-as-null-pointer-constant
4358Warn when a literal '0' is used as null pointer constant.  This can
4359be useful to facilitate the conversion to @code{nullptr} in C++11.
4360
4361@item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4362@opindex Wuseless-cast
4363@opindex Wno-useless-cast
4364Warn when an expression is casted to its own type.
4365
4366@item -Wempty-body
4367@opindex Wempty-body
4368@opindex Wno-empty-body
4369Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
4370while} statement.  This warning is also enabled by @option{-Wextra}.
4371
4372@item -Wenum-compare
4373@opindex Wenum-compare
4374@opindex Wno-enum-compare
4375Warn about a comparison between values of different enumerated types.
4376In C++ enumeral mismatches in conditional expressions are also
4377diagnosed and the warning is enabled by default.  In C this warning is
4378enabled by @option{-Wall}.
4379
4380@item -Wjump-misses-init @r{(C, Objective-C only)}
4381@opindex Wjump-misses-init
4382@opindex Wno-jump-misses-init
4383Warn if a @code{goto} statement or a @code{switch} statement jumps
4384forward across the initialization of a variable, or jumps backward to a
4385label after the variable has been initialized.  This only warns about
4386variables that are initialized when they are declared.  This warning is
4387only supported for C and Objective-C; in C++ this sort of branch is an
4388error in any case.
4389
4390@option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
4391can be disabled with the @option{-Wno-jump-misses-init} option.
4392
4393@item -Wsign-compare
4394@opindex Wsign-compare
4395@opindex Wno-sign-compare
4396@cindex warning for comparison of signed and unsigned values
4397@cindex comparison of signed and unsigned values, warning
4398@cindex signed and unsigned values, comparison warning
4399Warn when a comparison between signed and unsigned values could produce
4400an incorrect result when the signed value is converted to unsigned.
4401This warning is also enabled by @option{-Wextra}; to get the other warnings
4402of @option{-Wextra} without this warning, use @option{-Wextra -Wno-sign-compare}.
4403
4404@item -Wsign-conversion
4405@opindex Wsign-conversion
4406@opindex Wno-sign-conversion
4407Warn for implicit conversions that may change the sign of an integer
4408value, like assigning a signed integer expression to an unsigned
4409integer variable. An explicit cast silences the warning. In C, this
4410option is enabled also by @option{-Wconversion}.
4411
4412@item -Wsizeof-pointer-memaccess
4413@opindex Wsizeof-pointer-memaccess
4414@opindex Wno-sizeof-pointer-memaccess
4415Warn for suspicious length parameters to certain string and memory built-in
4416functions if the argument uses @code{sizeof}.  This warning warns e.g.@:
4417about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
4418but a pointer, and suggests a possible fix, or about
4419@code{memcpy (&foo, ptr, sizeof (&foo));}.  This warning is enabled by
4420@option{-Wall}.
4421
4422@item -Waddress
4423@opindex Waddress
4424@opindex Wno-address
4425Warn about suspicious uses of memory addresses. These include using
4426the address of a function in a conditional expression, such as
4427@code{void func(void); if (func)}, and comparisons against the memory
4428address of a string literal, such as @code{if (x == "abc")}.  Such
4429uses typically indicate a programmer error: the address of a function
4430always evaluates to true, so their use in a conditional usually
4431indicate that the programmer forgot the parentheses in a function
4432call; and comparisons against string literals result in unspecified
4433behavior and are not portable in C, so they usually indicate that the
4434programmer intended to use @code{strcmp}.  This warning is enabled by
4435@option{-Wall}.
4436
4437@item -Wlogical-op
4438@opindex Wlogical-op
4439@opindex Wno-logical-op
4440Warn about suspicious uses of logical operators in expressions.
4441This includes using logical operators in contexts where a
4442bit-wise operator is likely to be expected.
4443
4444@item -Waggregate-return
4445@opindex Waggregate-return
4446@opindex Wno-aggregate-return
4447Warn if any functions that return structures or unions are defined or
4448called.  (In languages where you can return an array, this also elicits
4449a warning.)
4450
4451@item -Wno-aggressive-loop-optimizations
4452@opindex Wno-aggressive-loop-optimizations
4453@opindex Waggressive-loop-optimizations
4454Warn if in a loop with constant number of iterations the compiler detects
4455undefined behavior in some statement during one or more of the iterations.
4456
4457@item -Wno-attributes
4458@opindex Wno-attributes
4459@opindex Wattributes
4460Do not warn if an unexpected @code{__attribute__} is used, such as
4461unrecognized attributes, function attributes applied to variables,
4462etc.  This does not stop errors for incorrect use of supported
4463attributes.
4464
4465@item -Wno-builtin-macro-redefined
4466@opindex Wno-builtin-macro-redefined
4467@opindex Wbuiltin-macro-redefined
4468Do not warn if certain built-in macros are redefined.  This suppresses
4469warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
4470@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
4471
4472@item -Wstrict-prototypes @r{(C and Objective-C only)}
4473@opindex Wstrict-prototypes
4474@opindex Wno-strict-prototypes
4475Warn if a function is declared or defined without specifying the
4476argument types.  (An old-style function definition is permitted without
4477a warning if preceded by a declaration that specifies the argument
4478types.)
4479
4480@item -Wold-style-declaration @r{(C and Objective-C only)}
4481@opindex Wold-style-declaration
4482@opindex Wno-old-style-declaration
4483Warn for obsolescent usages, according to the C Standard, in a
4484declaration. For example, warn if storage-class specifiers like
4485@code{static} are not the first things in a declaration.  This warning
4486is also enabled by @option{-Wextra}.
4487
4488@item -Wold-style-definition @r{(C and Objective-C only)}
4489@opindex Wold-style-definition
4490@opindex Wno-old-style-definition
4491Warn if an old-style function definition is used.  A warning is given
4492even if there is a previous prototype.
4493
4494@item -Wmissing-parameter-type @r{(C and Objective-C only)}
4495@opindex Wmissing-parameter-type
4496@opindex Wno-missing-parameter-type
4497A function parameter is declared without a type specifier in K&R-style
4498functions:
4499
4500@smallexample
4501void foo(bar) @{ @}
4502@end smallexample
4503
4504This warning is also enabled by @option{-Wextra}.
4505
4506@item -Wmissing-prototypes @r{(C and Objective-C only)}
4507@opindex Wmissing-prototypes
4508@opindex Wno-missing-prototypes
4509Warn if a global function is defined without a previous prototype
4510declaration.  This warning is issued even if the definition itself
4511provides a prototype.  Use this option to detect global functions
4512that do not have a matching prototype declaration in a header file.
4513This option is not valid for C++ because all function declarations
4514provide prototypes and a non-matching declaration will declare an
4515overload rather than conflict with an earlier declaration.
4516Use @option{-Wmissing-declarations} to detect missing declarations in C++.
4517
4518@item -Wmissing-declarations
4519@opindex Wmissing-declarations
4520@opindex Wno-missing-declarations
4521Warn if a global function is defined without a previous declaration.
4522Do so even if the definition itself provides a prototype.
4523Use this option to detect global functions that are not declared in
4524header files.  In C, no warnings are issued for functions with previous
4525non-prototype declarations; use @option{-Wmissing-prototype} to detect
4526missing prototypes.  In C++, no warnings are issued for function templates,
4527or for inline functions, or for functions in anonymous namespaces.
4528
4529@item -Wmissing-field-initializers
4530@opindex Wmissing-field-initializers
4531@opindex Wno-missing-field-initializers
4532@opindex W
4533@opindex Wextra
4534@opindex Wno-extra
4535Warn if a structure's initializer has some fields missing.  For
4536example, the following code causes such a warning, because
4537@code{x.h} is implicitly zero:
4538
4539@smallexample
4540struct s @{ int f, g, h; @};
4541struct s x = @{ 3, 4 @};
4542@end smallexample
4543
4544This option does not warn about designated initializers, so the following
4545modification does not trigger a warning:
4546
4547@smallexample
4548struct s @{ int f, g, h; @};
4549struct s x = @{ .f = 3, .g = 4 @};
4550@end smallexample
4551
4552This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
4553warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
4554
4555@item -Wno-multichar
4556@opindex Wno-multichar
4557@opindex Wmultichar
4558Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
4559Usually they indicate a typo in the user's code, as they have
4560implementation-defined values, and should not be used in portable code.
4561
4562@item -Wnormalized=<none|id|nfc|nfkc>
4563@opindex Wnormalized=
4564@cindex NFC
4565@cindex NFKC
4566@cindex character set, input normalization
4567In ISO C and ISO C++, two identifiers are different if they are
4568different sequences of characters.  However, sometimes when characters
4569outside the basic ASCII character set are used, you can have two
4570different character sequences that look the same.  To avoid confusion,
4571the ISO 10646 standard sets out some @dfn{normalization rules} which
4572when applied ensure that two sequences that look the same are turned into
4573the same sequence.  GCC can warn you if you are using identifiers that
4574have not been normalized; this option controls that warning.
4575
4576There are four levels of warning supported by GCC@.  The default is
4577@option{-Wnormalized=nfc}, which warns about any identifier that is
4578not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
4579recommended form for most uses.
4580
4581Unfortunately, there are some characters allowed in identifiers by
4582ISO C and ISO C++ that, when turned into NFC, are not allowed in
4583identifiers.  That is, there's no way to use these symbols in portable
4584ISO C or C++ and have all your identifiers in NFC@.
4585@option{-Wnormalized=id} suppresses the warning for these characters.
4586It is hoped that future versions of the standards involved will correct
4587this, which is why this option is not the default.
4588
4589You can switch the warning off for all characters by writing
4590@option{-Wnormalized=none}.  You should only do this if you
4591are using some other normalization scheme (like ``D''), because
4592otherwise you can easily create bugs that are literally impossible to see.
4593
4594Some characters in ISO 10646 have distinct meanings but look identical
4595in some fonts or display methodologies, especially once formatting has
4596been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
4597LETTER N'', displays just like a regular @code{n} that has been
4598placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
4599normalization scheme to convert all these into a standard form as
4600well, and GCC warns if your code is not in NFKC if you use
4601@option{-Wnormalized=nfkc}.  This warning is comparable to warning
4602about every identifier that contains the letter O because it might be
4603confused with the digit 0, and so is not the default, but may be
4604useful as a local coding convention if the programming environment
4605cannot be fixed to display these characters distinctly.
4606
4607@item -Wno-deprecated
4608@opindex Wno-deprecated
4609@opindex Wdeprecated
4610Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
4611
4612@item -Wno-deprecated-declarations
4613@opindex Wno-deprecated-declarations
4614@opindex Wdeprecated-declarations
4615Do not warn about uses of functions (@pxref{Function Attributes}),
4616variables (@pxref{Variable Attributes}), and types (@pxref{Type
4617Attributes}) marked as deprecated by using the @code{deprecated}
4618attribute.
4619
4620@item -Wno-overflow
4621@opindex Wno-overflow
4622@opindex Woverflow
4623Do not warn about compile-time overflow in constant expressions.
4624
4625@item -Woverride-init @r{(C and Objective-C only)}
4626@opindex Woverride-init
4627@opindex Wno-override-init
4628@opindex W
4629@opindex Wextra
4630@opindex Wno-extra
4631Warn if an initialized field without side effects is overridden when
4632using designated initializers (@pxref{Designated Inits, , Designated
4633Initializers}).
4634
4635This warning is included in @option{-Wextra}.  To get other
4636@option{-Wextra} warnings without this one, use @option{-Wextra
4637-Wno-override-init}.
4638
4639@item -Wpacked
4640@opindex Wpacked
4641@opindex Wno-packed
4642Warn if a structure is given the packed attribute, but the packed
4643attribute has no effect on the layout or size of the structure.
4644Such structures may be mis-aligned for little benefit.  For
4645instance, in this code, the variable @code{f.x} in @code{struct bar}
4646is misaligned even though @code{struct bar} does not itself
4647have the packed attribute:
4648
4649@smallexample
4650@group
4651struct foo @{
4652  int x;
4653  char a, b, c, d;
4654@} __attribute__((packed));
4655struct bar @{
4656  char z;
4657  struct foo f;
4658@};
4659@end group
4660@end smallexample
4661
4662@item -Wpacked-bitfield-compat
4663@opindex Wpacked-bitfield-compat
4664@opindex Wno-packed-bitfield-compat
4665The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
4666on bit-fields of type @code{char}.  This has been fixed in GCC 4.4 but
4667the change can lead to differences in the structure layout.  GCC
4668informs you when the offset of such a field has changed in GCC 4.4.
4669For example there is no longer a 4-bit padding between field @code{a}
4670and @code{b} in this structure:
4671
4672@smallexample
4673struct foo
4674@{
4675  char a:4;
4676  char b:8;
4677@} __attribute__ ((packed));
4678@end smallexample
4679
4680This warning is enabled by default.  Use
4681@option{-Wno-packed-bitfield-compat} to disable this warning.
4682
4683@item -Wpadded
4684@opindex Wpadded
4685@opindex Wno-padded
4686Warn if padding is included in a structure, either to align an element
4687of the structure or to align the whole structure.  Sometimes when this
4688happens it is possible to rearrange the fields of the structure to
4689reduce the padding and so make the structure smaller.
4690
4691@item -Wredundant-decls
4692@opindex Wredundant-decls
4693@opindex Wno-redundant-decls
4694Warn if anything is declared more than once in the same scope, even in
4695cases where multiple declaration is valid and changes nothing.
4696
4697@item -Wnested-externs @r{(C and Objective-C only)}
4698@opindex Wnested-externs
4699@opindex Wno-nested-externs
4700Warn if an @code{extern} declaration is encountered within a function.
4701
4702@item -Wno-inherited-variadic-ctor
4703@opindex Winherited-variadic-ctor
4704@opindex Wno-inherited-variadic-ctor
4705Suppress warnings about use of C++11 inheriting constructors when the
4706base class inherited from has a C variadic constructor; the warning is
4707on by default because the ellipsis is not inherited.
4708
4709@item -Winline
4710@opindex Winline
4711@opindex Wno-inline
4712Warn if a function that is declared as inline cannot be inlined.
4713Even with this option, the compiler does not warn about failures to
4714inline functions declared in system headers.
4715
4716The compiler uses a variety of heuristics to determine whether or not
4717to inline a function.  For example, the compiler takes into account
4718the size of the function being inlined and the amount of inlining
4719that has already been done in the current function.  Therefore,
4720seemingly insignificant changes in the source program can cause the
4721warnings produced by @option{-Winline} to appear or disappear.
4722
4723@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4724@opindex Wno-invalid-offsetof
4725@opindex Winvalid-offsetof
4726Suppress warnings from applying the @samp{offsetof} macro to a non-POD
4727type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
4728to a non-POD type is undefined.  In existing C++ implementations,
4729however, @samp{offsetof} typically gives meaningful results even when
4730applied to certain kinds of non-POD types (such as a simple
4731@samp{struct} that fails to be a POD type only by virtue of having a
4732constructor).  This flag is for users who are aware that they are
4733writing nonportable code and who have deliberately chosen to ignore the
4734warning about it.
4735
4736The restrictions on @samp{offsetof} may be relaxed in a future version
4737of the C++ standard.
4738
4739@item -Wno-int-to-pointer-cast
4740@opindex Wno-int-to-pointer-cast
4741@opindex Wint-to-pointer-cast
4742Suppress warnings from casts to pointer type of an integer of a
4743different size. In C++, casting to a pointer type of smaller size is
4744an error. @option{Wint-to-pointer-cast} is enabled by default.
4745
4746
4747@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
4748@opindex Wno-pointer-to-int-cast
4749@opindex Wpointer-to-int-cast
4750Suppress warnings from casts from a pointer to an integer type of a
4751different size.
4752
4753@item -Winvalid-pch
4754@opindex Winvalid-pch
4755@opindex Wno-invalid-pch
4756Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
4757the search path but can't be used.
4758
4759@item -Wlong-long
4760@opindex Wlong-long
4761@opindex Wno-long-long
4762Warn if @samp{long long} type is used.  This is enabled by either
4763@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
4764modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
4765
4766@item -Wvariadic-macros
4767@opindex Wvariadic-macros
4768@opindex Wno-variadic-macros
4769Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
4770alternate syntax when in pedantic ISO C99 mode.  This is default.
4771To inhibit the warning messages, use @option{-Wno-variadic-macros}.
4772
4773@item -Wvarargs
4774@opindex Wvarargs
4775@opindex Wno-varargs
4776Warn upon questionable usage of the macros used to handle variable
4777arguments like @samp{va_start}.  This is default.  To inhibit the
4778warning messages, use @option{-Wno-varargs}.
4779
4780@item -Wvector-operation-performance
4781@opindex Wvector-operation-performance
4782@opindex Wno-vector-operation-performance
4783Warn if vector operation is not implemented via SIMD capabilities of the
4784architecture.  Mainly useful for the performance tuning.
4785Vector operation can be implemented @code{piecewise}, which means that the
4786scalar operation is performed on every vector element;
4787@code{in parallel}, which means that the vector operation is implemented
4788using scalars of wider type, which normally is more performance efficient;
4789and @code{as a single scalar}, which means that vector fits into a
4790scalar type.
4791
4792@item -Wno-virtual-move-assign
4793@opindex Wvirtual-move-assign
4794@opindex Wno-virtual-move-assign
4795Suppress warnings about inheriting from a virtual base with a
4796non-trivial C++11 move assignment operator.  This is dangerous because
4797if the virtual base is reachable along more than one path, it will be
4798moved multiple times, which can mean both objects end up in the
4799moved-from state.  If the move assignment operator is written to avoid
4800moving from a moved-from object, this warning can be disabled.
4801
4802@item -Wvla
4803@opindex Wvla
4804@opindex Wno-vla
4805Warn if variable length array is used in the code.
4806@option{-Wno-vla} prevents the @option{-Wpedantic} warning of
4807the variable length array.
4808
4809@item -Wvolatile-register-var
4810@opindex Wvolatile-register-var
4811@opindex Wno-volatile-register-var
4812Warn if a register variable is declared volatile.  The volatile
4813modifier does not inhibit all optimizations that may eliminate reads
4814and/or writes to register variables.  This warning is enabled by
4815@option{-Wall}.
4816
4817@item -Wdisabled-optimization
4818@opindex Wdisabled-optimization
4819@opindex Wno-disabled-optimization
4820Warn if a requested optimization pass is disabled.  This warning does
4821not generally indicate that there is anything wrong with your code; it
4822merely indicates that GCC's optimizers are unable to handle the code
4823effectively.  Often, the problem is that your code is too big or too
4824complex; GCC refuses to optimize programs when the optimization
4825itself is likely to take inordinate amounts of time.
4826
4827@item -Wpointer-sign @r{(C and Objective-C only)}
4828@opindex Wpointer-sign
4829@opindex Wno-pointer-sign
4830Warn for pointer argument passing or assignment with different signedness.
4831This option is only supported for C and Objective-C@.  It is implied by
4832@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
4833@option{-Wno-pointer-sign}.
4834
4835@item -Wstack-protector
4836@opindex Wstack-protector
4837@opindex Wno-stack-protector
4838This option is only active when @option{-fstack-protector} is active.  It
4839warns about functions that are not protected against stack smashing.
4840
4841@item -Wno-mudflap
4842@opindex Wno-mudflap
4843Suppress warnings about constructs that cannot be instrumented by
4844@option{-fmudflap}.
4845
4846@item -Woverlength-strings
4847@opindex Woverlength-strings
4848@opindex Wno-overlength-strings
4849Warn about string constants that are longer than the ``minimum
4850maximum'' length specified in the C standard.  Modern compilers
4851generally allow string constants that are much longer than the
4852standard's minimum limit, but very portable programs should avoid
4853using longer strings.
4854
4855The limit applies @emph{after} string constant concatenation, and does
4856not count the trailing NUL@.  In C90, the limit was 509 characters; in
4857C99, it was raised to 4095.  C++98 does not specify a normative
4858minimum maximum, so we do not diagnose overlength strings in C++@.
4859
4860This option is implied by @option{-Wpedantic}, and can be disabled with
4861@option{-Wno-overlength-strings}.
4862
4863@item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
4864@opindex Wunsuffixed-float-constants
4865
4866Issue a warning for any floating constant that does not have
4867a suffix.  When used together with @option{-Wsystem-headers} it
4868warns about such constants in system header files.  This can be useful
4869when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
4870from the decimal floating-point extension to C99.
4871@end table
4872
4873@node Debugging Options
4874@section Options for Debugging Your Program or GCC
4875@cindex options, debugging
4876@cindex debugging information options
4877
4878GCC has various special options that are used for debugging
4879either your program or GCC:
4880
4881@table @gcctabopt
4882@item -g
4883@opindex g
4884Produce debugging information in the operating system's native format
4885(stabs, COFF, XCOFF, or DWARF 2)@.  GDB can work with this debugging
4886information.
4887
4888On most systems that use stabs format, @option{-g} enables use of extra
4889debugging information that only GDB can use; this extra information
4890makes debugging work better in GDB but probably makes other debuggers
4891crash or
4892refuse to read the program.  If you want to control for certain whether
4893to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
4894@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
4895
4896GCC allows you to use @option{-g} with
4897@option{-O}.  The shortcuts taken by optimized code may occasionally
4898produce surprising results: some variables you declared may not exist
4899at all; flow of control may briefly move where you did not expect it;
4900some statements may not be executed because they compute constant
4901results or their values are already at hand; some statements may
4902execute in different places because they have been moved out of loops.
4903
4904Nevertheless it proves possible to debug optimized output.  This makes
4905it reasonable to use the optimizer for programs that might have bugs.
4906
4907The following options are useful when GCC is generated with the
4908capability for more than one debugging format.
4909
4910@item -gsplit-dwarf
4911@opindex gsplit-dwarf
4912Separate as much dwarf debugging information as possible into a
4913separate output file with the extension .dwo.  This option allows
4914the build system to avoid linking files with debug information.  To
4915be useful, this option requires a debugger capable of reading .dwo
4916files.
4917
4918@item -ggdb
4919@opindex ggdb
4920Produce debugging information for use by GDB@.  This means to use the
4921most expressive format available (DWARF 2, stabs, or the native format
4922if neither of those are supported), including GDB extensions if at all
4923possible.
4924
4925@item -gpubnames
4926@opindex gpubnames
4927Generate dwarf .debug_pubnames and .debug_pubtypes sections.
4928
4929@item -gstabs
4930@opindex gstabs
4931Produce debugging information in stabs format (if that is supported),
4932without GDB extensions.  This is the format used by DBX on most BSD
4933systems.  On MIPS, Alpha and System V Release 4 systems this option
4934produces stabs debugging output that is not understood by DBX or SDB@.
4935On System V Release 4 systems this option requires the GNU assembler.
4936
4937@item -feliminate-unused-debug-symbols
4938@opindex feliminate-unused-debug-symbols
4939Produce debugging information in stabs format (if that is supported),
4940for only symbols that are actually used.
4941
4942@item -femit-class-debug-always
4943Instead of emitting debugging information for a C++ class in only one
4944object file, emit it in all object files using the class.  This option
4945should be used only with debuggers that are unable to handle the way GCC
4946normally emits debugging information for classes because using this
4947option increases the size of debugging information by as much as a
4948factor of two.
4949
4950@item -fdebug-types-section
4951@opindex fdebug-types-section
4952@opindex fno-debug-types-section
4953When using DWARF Version 4 or higher, type DIEs can be put into
4954their own @code{.debug_types} section instead of making them part of the
4955@code{.debug_info} section.  It is more efficient to put them in a separate
4956comdat sections since the linker can then remove duplicates.
4957But not all DWARF consumers support @code{.debug_types} sections yet
4958and on some objects @code{.debug_types} produces larger instead of smaller
4959debugging information.
4960
4961@item -gstabs+
4962@opindex gstabs+
4963Produce debugging information in stabs format (if that is supported),
4964using GNU extensions understood only by the GNU debugger (GDB)@.  The
4965use of these extensions is likely to make other debuggers crash or
4966refuse to read the program.
4967
4968@item -gcoff
4969@opindex gcoff
4970Produce debugging information in COFF format (if that is supported).
4971This is the format used by SDB on most System V systems prior to
4972System V Release 4.
4973
4974@item -gxcoff
4975@opindex gxcoff
4976Produce debugging information in XCOFF format (if that is supported).
4977This is the format used by the DBX debugger on IBM RS/6000 systems.
4978
4979@item -gxcoff+
4980@opindex gxcoff+
4981Produce debugging information in XCOFF format (if that is supported),
4982using GNU extensions understood only by the GNU debugger (GDB)@.  The
4983use of these extensions is likely to make other debuggers crash or
4984refuse to read the program, and may cause assemblers other than the GNU
4985assembler (GAS) to fail with an error.
4986
4987@item -gdwarf-@var{version}
4988@opindex gdwarf-@var{version}
4989Produce debugging information in DWARF format (if that is supported).
4990The value of @var{version} may be either 2, 3 or 4; the default version
4991for most targets is 4.
4992
4993Note that with DWARF Version 2, some ports require and always
4994use some non-conflicting DWARF 3 extensions in the unwind tables.
4995
4996Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
4997for maximum benefit.
4998
4999@item -grecord-gcc-switches
5000@opindex grecord-gcc-switches
5001This switch causes the command-line options used to invoke the
5002compiler that may affect code generation to be appended to the
5003DW_AT_producer attribute in DWARF debugging information.  The options
5004are concatenated with spaces separating them from each other and from
5005the compiler version.  See also @option{-frecord-gcc-switches} for another
5006way of storing compiler options into the object file.  This is the default.
5007
5008@item -gno-record-gcc-switches
5009@opindex gno-record-gcc-switches
5010Disallow appending command-line options to the DW_AT_producer attribute
5011in DWARF debugging information.
5012
5013@item -gstrict-dwarf
5014@opindex gstrict-dwarf
5015Disallow using extensions of later DWARF standard version than selected
5016with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
5017DWARF extensions from later standard versions is allowed.
5018
5019@item -gno-strict-dwarf
5020@opindex gno-strict-dwarf
5021Allow using extensions of later DWARF standard version than selected with
5022@option{-gdwarf-@var{version}}.
5023
5024@item -gvms
5025@opindex gvms
5026Produce debugging information in Alpha/VMS debug format (if that is
5027supported).  This is the format used by DEBUG on Alpha/VMS systems.
5028
5029@item -g@var{level}
5030@itemx -ggdb@var{level}
5031@itemx -gstabs@var{level}
5032@itemx -gcoff@var{level}
5033@itemx -gxcoff@var{level}
5034@itemx -gvms@var{level}
5035Request debugging information and also use @var{level} to specify how
5036much information.  The default level is 2.
5037
5038Level 0 produces no debug information at all.  Thus, @option{-g0} negates
5039@option{-g}.
5040
5041Level 1 produces minimal information, enough for making backtraces in
5042parts of the program that you don't plan to debug.  This includes
5043descriptions of functions and external variables, but no information
5044about local variables and no line numbers.
5045
5046Level 3 includes extra information, such as all the macro definitions
5047present in the program.  Some debuggers support macro expansion when
5048you use @option{-g3}.
5049
5050@option{-gdwarf-2} does not accept a concatenated debug level, because
5051GCC used to support an option @option{-gdwarf} that meant to generate
5052debug information in version 1 of the DWARF format (which is very
5053different from version 2), and it would have been too confusing.  That
5054debug format is long obsolete, but the option cannot be changed now.
5055Instead use an additional @option{-g@var{level}} option to change the
5056debug level for DWARF.
5057
5058@item -gtoggle
5059@opindex gtoggle
5060Turn off generation of debug info, if leaving out this option
5061generates it, or turn it on at level 2 otherwise.  The position of this
5062argument in the command line does not matter; it takes effect after all
5063other options are processed, and it does so only once, no matter how
5064many times it is given.  This is mainly intended to be used with
5065@option{-fcompare-debug}.
5066
5067@item -fsanitize=address
5068Enable AddressSanitizer, a fast memory error detector.
5069Memory access instructions will be instrumented to detect
5070out-of-bounds and use-after-free bugs.
5071See @uref{http://code.google.com/p/address-sanitizer/} for more details.
5072
5073@item -fsanitize=thread
5074Enable ThreadSanitizer, a fast data race detector.
5075Memory access instructions will be instrumented to detect
5076data race bugs.
5077See @uref{http://code.google.com/p/data-race-test/wiki/ThreadSanitizer} for more details.
5078
5079@item -fdump-final-insns@r{[}=@var{file}@r{]}
5080@opindex fdump-final-insns
5081Dump the final internal representation (RTL) to @var{file}.  If the
5082optional argument is omitted (or if @var{file} is @code{.}), the name
5083of the dump file is determined by appending @code{.gkd} to the
5084compilation output file name.
5085
5086@item -fcompare-debug@r{[}=@var{opts}@r{]}
5087@opindex fcompare-debug
5088@opindex fno-compare-debug
5089If no error occurs during compilation, run the compiler a second time,
5090adding @var{opts} and @option{-fcompare-debug-second} to the arguments
5091passed to the second compilation.  Dump the final internal
5092representation in both compilations, and print an error if they differ.
5093
5094If the equal sign is omitted, the default @option{-gtoggle} is used.
5095
5096The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
5097and nonzero, implicitly enables @option{-fcompare-debug}.  If
5098@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
5099then it is used for @var{opts}, otherwise the default @option{-gtoggle}
5100is used.
5101
5102@option{-fcompare-debug=}, with the equal sign but without @var{opts},
5103is equivalent to @option{-fno-compare-debug}, which disables the dumping
5104of the final representation and the second compilation, preventing even
5105@env{GCC_COMPARE_DEBUG} from taking effect.
5106
5107To verify full coverage during @option{-fcompare-debug} testing, set
5108@env{GCC_COMPARE_DEBUG} to say @samp{-fcompare-debug-not-overridden},
5109which GCC rejects as an invalid option in any actual compilation
5110(rather than preprocessing, assembly or linking).  To get just a
5111warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
5112not overridden} will do.
5113
5114@item -fcompare-debug-second
5115@opindex fcompare-debug-second
5116This option is implicitly passed to the compiler for the second
5117compilation requested by @option{-fcompare-debug}, along with options to
5118silence warnings, and omitting other options that would cause
5119side-effect compiler outputs to files or to the standard output.  Dump
5120files and preserved temporary files are renamed so as to contain the
5121@code{.gk} additional extension during the second compilation, to avoid
5122overwriting those generated by the first.
5123
5124When this option is passed to the compiler driver, it causes the
5125@emph{first} compilation to be skipped, which makes it useful for little
5126other than debugging the compiler proper.
5127
5128@item -feliminate-dwarf2-dups
5129@opindex feliminate-dwarf2-dups
5130Compress DWARF 2 debugging information by eliminating duplicated
5131information about each symbol.  This option only makes sense when
5132generating DWARF 2 debugging information with @option{-gdwarf-2}.
5133
5134@item -femit-struct-debug-baseonly
5135Emit debug information for struct-like types
5136only when the base name of the compilation source file
5137matches the base name of file in which the struct is defined.
5138
5139This option substantially reduces the size of debugging information,
5140but at significant potential loss in type information to the debugger.
5141See @option{-femit-struct-debug-reduced} for a less aggressive option.
5142See @option{-femit-struct-debug-detailed} for more detailed control.
5143
5144This option works only with DWARF 2.
5145
5146@item -femit-struct-debug-reduced
5147Emit debug information for struct-like types
5148only when the base name of the compilation source file
5149matches the base name of file in which the type is defined,
5150unless the struct is a template or defined in a system header.
5151
5152This option significantly reduces the size of debugging information,
5153with some potential loss in type information to the debugger.
5154See @option{-femit-struct-debug-baseonly} for a more aggressive option.
5155See @option{-femit-struct-debug-detailed} for more detailed control.
5156
5157This option works only with DWARF 2.
5158
5159@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
5160Specify the struct-like types
5161for which the compiler generates debug information.
5162The intent is to reduce duplicate struct debug information
5163between different object files within the same program.
5164
5165This option is a detailed version of
5166@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
5167which serves for most needs.
5168
5169A specification has the syntax@*
5170[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
5171
5172The optional first word limits the specification to
5173structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
5174A struct type is used directly when it is the type of a variable, member.
5175Indirect uses arise through pointers to structs.
5176That is, when use of an incomplete struct is valid, the use is indirect.
5177An example is
5178@samp{struct one direct; struct two * indirect;}.
5179
5180The optional second word limits the specification to
5181ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
5182Generic structs are a bit complicated to explain.
5183For C++, these are non-explicit specializations of template classes,
5184or non-template classes within the above.
5185Other programming languages have generics,
5186but @option{-femit-struct-debug-detailed} does not yet implement them.
5187
5188The third word specifies the source files for those
5189structs for which the compiler should emit debug information.
5190The values @samp{none} and @samp{any} have the normal meaning.
5191The value @samp{base} means that
5192the base of name of the file in which the type declaration appears
5193must match the base of the name of the main compilation file.
5194In practice, this means that when compiling @file{foo.c}, debug information
5195is generated for types declared in that file and @file{foo.h},
5196but not other header files.
5197The value @samp{sys} means those types satisfying @samp{base}
5198or declared in system or compiler headers.
5199
5200You may need to experiment to determine the best settings for your application.
5201
5202The default is @option{-femit-struct-debug-detailed=all}.
5203
5204This option works only with DWARF 2.
5205
5206@item -fno-merge-debug-strings
5207@opindex fmerge-debug-strings
5208@opindex fno-merge-debug-strings
5209Direct the linker to not merge together strings in the debugging
5210information that are identical in different object files.  Merging is
5211not supported by all assemblers or linkers.  Merging decreases the size
5212of the debug information in the output file at the cost of increasing
5213link processing time.  Merging is enabled by default.
5214
5215@item -fdebug-prefix-map=@var{old}=@var{new}
5216@opindex fdebug-prefix-map
5217When compiling files in directory @file{@var{old}}, record debugging
5218information describing them as in @file{@var{new}} instead.
5219
5220@item -fno-dwarf2-cfi-asm
5221@opindex fdwarf2-cfi-asm
5222@opindex fno-dwarf2-cfi-asm
5223Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
5224instead of using GAS @code{.cfi_*} directives.
5225
5226@cindex @command{prof}
5227@item -p
5228@opindex p
5229Generate extra code to write profile information suitable for the
5230analysis program @command{prof}.  You must use this option when compiling
5231the source files you want data about, and you must also use it when
5232linking.
5233
5234@cindex @command{gprof}
5235@item -pg
5236@opindex pg
5237Generate extra code to write profile information suitable for the
5238analysis program @command{gprof}.  You must use this option when compiling
5239the source files you want data about, and you must also use it when
5240linking.
5241
5242@item -Q
5243@opindex Q
5244Makes the compiler print out each function name as it is compiled, and
5245print some statistics about each pass when it finishes.
5246
5247@item -ftime-report
5248@opindex ftime-report
5249Makes the compiler print some statistics about the time consumed by each
5250pass when it finishes.
5251
5252@item -fmem-report
5253@opindex fmem-report
5254Makes the compiler print some statistics about permanent memory
5255allocation when it finishes.
5256
5257@item -fmem-report-wpa
5258@opindex fmem-report-wpa
5259Makes the compiler print some statistics about permanent memory
5260allocation for the WPA phase only.
5261
5262@item -fpre-ipa-mem-report
5263@opindex fpre-ipa-mem-report
5264@item -fpost-ipa-mem-report
5265@opindex fpost-ipa-mem-report
5266Makes the compiler print some statistics about permanent memory
5267allocation before or after interprocedural optimization.
5268
5269@item -fprofile-report
5270@opindex fprofile-report
5271Makes the compiler print some statistics about consistency of the
5272(estimated) profile and effect of individual passes.
5273
5274@item -fstack-usage
5275@opindex fstack-usage
5276Makes the compiler output stack usage information for the program, on a
5277per-function basis.  The filename for the dump is made by appending
5278@file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
5279the output file, if explicitly specified and it is not an executable,
5280otherwise it is the basename of the source file.  An entry is made up
5281of three fields:
5282
5283@itemize
5284@item
5285The name of the function.
5286@item
5287A number of bytes.
5288@item
5289One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
5290@end itemize
5291
5292The qualifier @code{static} means that the function manipulates the stack
5293statically: a fixed number of bytes are allocated for the frame on function
5294entry and released on function exit; no stack adjustments are otherwise made
5295in the function.  The second field is this fixed number of bytes.
5296
5297The qualifier @code{dynamic} means that the function manipulates the stack
5298dynamically: in addition to the static allocation described above, stack
5299adjustments are made in the body of the function, for example to push/pop
5300arguments around function calls.  If the qualifier @code{bounded} is also
5301present, the amount of these adjustments is bounded at compile time and
5302the second field is an upper bound of the total amount of stack used by
5303the function.  If it is not present, the amount of these adjustments is
5304not bounded at compile time and the second field only represents the
5305bounded part.
5306
5307@item -fprofile-arcs
5308@opindex fprofile-arcs
5309Add code so that program flow @dfn{arcs} are instrumented.  During
5310execution the program records how many times each branch and call is
5311executed and how many times it is taken or returns.  When the compiled
5312program exits it saves this data to a file called
5313@file{@var{auxname}.gcda} for each source file.  The data may be used for
5314profile-directed optimizations (@option{-fbranch-probabilities}), or for
5315test coverage analysis (@option{-ftest-coverage}).  Each object file's
5316@var{auxname} is generated from the name of the output file, if
5317explicitly specified and it is not the final executable, otherwise it is
5318the basename of the source file.  In both cases any suffix is removed
5319(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
5320@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
5321@xref{Cross-profiling}.
5322
5323@cindex @command{gcov}
5324@item --coverage
5325@opindex coverage
5326
5327This option is used to compile and link code instrumented for coverage
5328analysis.  The option is a synonym for @option{-fprofile-arcs}
5329@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
5330linking).  See the documentation for those options for more details.
5331
5332@itemize
5333
5334@item
5335Compile the source files with @option{-fprofile-arcs} plus optimization
5336and code generation options.  For test coverage analysis, use the
5337additional @option{-ftest-coverage} option.  You do not need to profile
5338every source file in a program.
5339
5340@item
5341Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
5342(the latter implies the former).
5343
5344@item
5345Run the program on a representative workload to generate the arc profile
5346information.  This may be repeated any number of times.  You can run
5347concurrent instances of your program, and provided that the file system
5348supports locking, the data files will be correctly updated.  Also
5349@code{fork} calls are detected and correctly handled (double counting
5350will not happen).
5351
5352@item
5353For profile-directed optimizations, compile the source files again with
5354the same optimization and code generation options plus
5355@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
5356Control Optimization}).
5357
5358@item
5359For test coverage analysis, use @command{gcov} to produce human readable
5360information from the @file{.gcno} and @file{.gcda} files.  Refer to the
5361@command{gcov} documentation for further information.
5362
5363@end itemize
5364
5365With @option{-fprofile-arcs}, for each function of your program GCC
5366creates a program flow graph, then finds a spanning tree for the graph.
5367Only arcs that are not on the spanning tree have to be instrumented: the
5368compiler adds code to count the number of times that these arcs are
5369executed.  When an arc is the only exit or only entrance to a block, the
5370instrumentation code can be added to the block; otherwise, a new basic
5371block must be created to hold the instrumentation code.
5372
5373@need 2000
5374@item -ftest-coverage
5375@opindex ftest-coverage
5376Produce a notes file that the @command{gcov} code-coverage utility
5377(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
5378show program coverage.  Each source file's note file is called
5379@file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
5380above for a description of @var{auxname} and instructions on how to
5381generate test coverage data.  Coverage data matches the source files
5382more closely if you do not optimize.
5383
5384@item -fdbg-cnt-list
5385@opindex fdbg-cnt-list
5386Print the name and the counter upper bound for all debug counters.
5387
5388
5389@item -fdbg-cnt=@var{counter-value-list}
5390@opindex fdbg-cnt
5391Set the internal debug counter upper bound.  @var{counter-value-list}
5392is a comma-separated list of @var{name}:@var{value} pairs
5393which sets the upper bound of each debug counter @var{name} to @var{value}.
5394All debug counters have the initial upper bound of @code{UINT_MAX};
5395thus @code{dbg_cnt()} returns true always unless the upper bound
5396is set by this option.
5397For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
5398@code{dbg_cnt(dce)} returns true only for first 10 invocations.
5399
5400@item -fenable-@var{kind}-@var{pass}
5401@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
5402@opindex fdisable-
5403@opindex fenable-
5404
5405This is a set of options that are used to explicitly disable/enable
5406optimization passes.  These options are intended for use for debugging GCC.
5407Compiler users should use regular options for enabling/disabling
5408passes instead.
5409
5410@table @gcctabopt
5411
5412@item -fdisable-ipa-@var{pass}
5413Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
5414statically invoked in the compiler multiple times, the pass name should be
5415appended with a sequential number starting from 1.
5416
5417@item -fdisable-rtl-@var{pass}
5418@itemx -fdisable-rtl-@var{pass}=@var{range-list}
5419Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
5420statically invoked in the compiler multiple times, the pass name should be
5421appended with a sequential number starting from 1.  @var{range-list} is a
5422comma-separated list of function ranges or assembler names.  Each range is a number
5423pair separated by a colon.  The range is inclusive in both ends.  If the range
5424is trivial, the number pair can be simplified as a single number.  If the
5425function's call graph node's @var{uid} falls within one of the specified ranges,
5426the @var{pass} is disabled for that function.  The @var{uid} is shown in the
5427function header of a dump file, and the pass names can be dumped by using
5428option @option{-fdump-passes}.
5429
5430@item -fdisable-tree-@var{pass}
5431@itemx -fdisable-tree-@var{pass}=@var{range-list}
5432Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
5433option arguments.
5434
5435@item -fenable-ipa-@var{pass}
5436Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
5437statically invoked in the compiler multiple times, the pass name should be
5438appended with a sequential number starting from 1.
5439
5440@item -fenable-rtl-@var{pass}
5441@itemx -fenable-rtl-@var{pass}=@var{range-list}
5442Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
5443description and examples.
5444
5445@item -fenable-tree-@var{pass}
5446@itemx -fenable-tree-@var{pass}=@var{range-list}
5447Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
5448of option arguments.
5449
5450@end table
5451
5452Here are some examples showing uses of these options.
5453
5454@smallexample
5455
5456# disable ccp1 for all functions
5457   -fdisable-tree-ccp1
5458# disable complete unroll for function whose cgraph node uid is 1
5459   -fenable-tree-cunroll=1
5460# disable gcse2 for functions at the following ranges [1,1],
5461# [300,400], and [400,1000]
5462# disable gcse2 for functions foo and foo2
5463   -fdisable-rtl-gcse2=foo,foo2
5464# disable early inlining
5465   -fdisable-tree-einline
5466# disable ipa inlining
5467   -fdisable-ipa-inline
5468# enable tree full unroll
5469   -fenable-tree-unroll
5470
5471@end smallexample
5472
5473@item -d@var{letters}
5474@itemx -fdump-rtl-@var{pass}
5475@itemx -fdump-rtl-@var{pass}=@var{filename}
5476@opindex d
5477Says to make debugging dumps during compilation at times specified by
5478@var{letters}.  This is used for debugging the RTL-based passes of the
5479compiler.  The file names for most of the dumps are made by appending
5480a pass number and a word to the @var{dumpname}, and the files are
5481created in the directory of the output file. In case of
5482@option{=@var{filename}} option, the dump is output on the given file
5483instead of the pass numbered dump files. Note that the pass number is
5484computed statically as passes get registered into the pass manager.
5485Thus the numbering is not related to the dynamic order of execution of
5486passes.  In particular, a pass installed by a plugin could have a
5487number over 200 even if it executed quite early.  @var{dumpname} is
5488generated from the name of the output file, if explicitly specified
5489and it is not an executable, otherwise it is the basename of the
5490source file. These switches may have different effects when
5491@option{-E} is used for preprocessing.
5492
5493Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
5494@option{-d} option @var{letters}.  Here are the possible
5495letters for use in @var{pass} and @var{letters}, and their meanings:
5496
5497@table @gcctabopt
5498
5499@item -fdump-rtl-alignments
5500@opindex fdump-rtl-alignments
5501Dump after branch alignments have been computed.
5502
5503@item -fdump-rtl-asmcons
5504@opindex fdump-rtl-asmcons
5505Dump after fixing rtl statements that have unsatisfied in/out constraints.
5506
5507@item -fdump-rtl-auto_inc_dec
5508@opindex fdump-rtl-auto_inc_dec
5509Dump after auto-inc-dec discovery.  This pass is only run on
5510architectures that have auto inc or auto dec instructions.
5511
5512@item -fdump-rtl-barriers
5513@opindex fdump-rtl-barriers
5514Dump after cleaning up the barrier instructions.
5515
5516@item -fdump-rtl-bbpart
5517@opindex fdump-rtl-bbpart
5518Dump after partitioning hot and cold basic blocks.
5519
5520@item -fdump-rtl-bbro
5521@opindex fdump-rtl-bbro
5522Dump after block reordering.
5523
5524@item -fdump-rtl-btl1
5525@itemx -fdump-rtl-btl2
5526@opindex fdump-rtl-btl2
5527@opindex fdump-rtl-btl2
5528@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
5529after the two branch
5530target load optimization passes.
5531
5532@item -fdump-rtl-bypass
5533@opindex fdump-rtl-bypass
5534Dump after jump bypassing and control flow optimizations.
5535
5536@item -fdump-rtl-combine
5537@opindex fdump-rtl-combine
5538Dump after the RTL instruction combination pass.
5539
5540@item -fdump-rtl-compgotos
5541@opindex fdump-rtl-compgotos
5542Dump after duplicating the computed gotos.
5543
5544@item -fdump-rtl-ce1
5545@itemx -fdump-rtl-ce2
5546@itemx -fdump-rtl-ce3
5547@opindex fdump-rtl-ce1
5548@opindex fdump-rtl-ce2
5549@opindex fdump-rtl-ce3
5550@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
5551@option{-fdump-rtl-ce3} enable dumping after the three
5552if conversion passes.
5553
5554@item -fdump-rtl-cprop_hardreg
5555@opindex fdump-rtl-cprop_hardreg
5556Dump after hard register copy propagation.
5557
5558@item -fdump-rtl-csa
5559@opindex fdump-rtl-csa
5560Dump after combining stack adjustments.
5561
5562@item -fdump-rtl-cse1
5563@itemx -fdump-rtl-cse2
5564@opindex fdump-rtl-cse1
5565@opindex fdump-rtl-cse2
5566@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
5567the two common subexpression elimination passes.
5568
5569@item -fdump-rtl-dce
5570@opindex fdump-rtl-dce
5571Dump after the standalone dead code elimination passes.
5572
5573@item -fdump-rtl-dbr
5574@opindex fdump-rtl-dbr
5575Dump after delayed branch scheduling.
5576
5577@item -fdump-rtl-dce1
5578@itemx -fdump-rtl-dce2
5579@opindex fdump-rtl-dce1
5580@opindex fdump-rtl-dce2
5581@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
5582the two dead store elimination passes.
5583
5584@item -fdump-rtl-eh
5585@opindex fdump-rtl-eh
5586Dump after finalization of EH handling code.
5587
5588@item -fdump-rtl-eh_ranges
5589@opindex fdump-rtl-eh_ranges
5590Dump after conversion of EH handling range regions.
5591
5592@item -fdump-rtl-expand
5593@opindex fdump-rtl-expand
5594Dump after RTL generation.
5595
5596@item -fdump-rtl-fwprop1
5597@itemx -fdump-rtl-fwprop2
5598@opindex fdump-rtl-fwprop1
5599@opindex fdump-rtl-fwprop2
5600@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
5601dumping after the two forward propagation passes.
5602
5603@item -fdump-rtl-gcse1
5604@itemx -fdump-rtl-gcse2
5605@opindex fdump-rtl-gcse1
5606@opindex fdump-rtl-gcse2
5607@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
5608after global common subexpression elimination.
5609
5610@item -fdump-rtl-init-regs
5611@opindex fdump-rtl-init-regs
5612Dump after the initialization of the registers.
5613
5614@item -fdump-rtl-initvals
5615@opindex fdump-rtl-initvals
5616Dump after the computation of the initial value sets.
5617
5618@item -fdump-rtl-into_cfglayout
5619@opindex fdump-rtl-into_cfglayout
5620Dump after converting to cfglayout mode.
5621
5622@item -fdump-rtl-ira
5623@opindex fdump-rtl-ira
5624Dump after iterated register allocation.
5625
5626@item -fdump-rtl-jump
5627@opindex fdump-rtl-jump
5628Dump after the second jump optimization.
5629
5630@item -fdump-rtl-loop2
5631@opindex fdump-rtl-loop2
5632@option{-fdump-rtl-loop2} enables dumping after the rtl
5633loop optimization passes.
5634
5635@item -fdump-rtl-mach
5636@opindex fdump-rtl-mach
5637Dump after performing the machine dependent reorganization pass, if that
5638pass exists.
5639
5640@item -fdump-rtl-mode_sw
5641@opindex fdump-rtl-mode_sw
5642Dump after removing redundant mode switches.
5643
5644@item -fdump-rtl-rnreg
5645@opindex fdump-rtl-rnreg
5646Dump after register renumbering.
5647
5648@item -fdump-rtl-outof_cfglayout
5649@opindex fdump-rtl-outof_cfglayout
5650Dump after converting from cfglayout mode.
5651
5652@item -fdump-rtl-peephole2
5653@opindex fdump-rtl-peephole2
5654Dump after the peephole pass.
5655
5656@item -fdump-rtl-postreload
5657@opindex fdump-rtl-postreload
5658Dump after post-reload optimizations.
5659
5660@item -fdump-rtl-pro_and_epilogue
5661@opindex fdump-rtl-pro_and_epilogue
5662Dump after generating the function prologues and epilogues.
5663
5664@item -fdump-rtl-regmove
5665@opindex fdump-rtl-regmove
5666Dump after the register move pass.
5667
5668@item -fdump-rtl-sched1
5669@itemx -fdump-rtl-sched2
5670@opindex fdump-rtl-sched1
5671@opindex fdump-rtl-sched2
5672@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
5673after the basic block scheduling passes.
5674
5675@item -fdump-rtl-see
5676@opindex fdump-rtl-see
5677Dump after sign extension elimination.
5678
5679@item -fdump-rtl-seqabstr
5680@opindex fdump-rtl-seqabstr
5681Dump after common sequence discovery.
5682
5683@item -fdump-rtl-shorten
5684@opindex fdump-rtl-shorten
5685Dump after shortening branches.
5686
5687@item -fdump-rtl-sibling
5688@opindex fdump-rtl-sibling
5689Dump after sibling call optimizations.
5690
5691@item -fdump-rtl-split1
5692@itemx -fdump-rtl-split2
5693@itemx -fdump-rtl-split3
5694@itemx -fdump-rtl-split4
5695@itemx -fdump-rtl-split5
5696@opindex fdump-rtl-split1
5697@opindex fdump-rtl-split2
5698@opindex fdump-rtl-split3
5699@opindex fdump-rtl-split4
5700@opindex fdump-rtl-split5
5701@option{-fdump-rtl-split1}, @option{-fdump-rtl-split2},
5702@option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and
5703@option{-fdump-rtl-split5} enable dumping after five rounds of
5704instruction splitting.
5705
5706@item -fdump-rtl-sms
5707@opindex fdump-rtl-sms
5708Dump after modulo scheduling.  This pass is only run on some
5709architectures.
5710
5711@item -fdump-rtl-stack
5712@opindex fdump-rtl-stack
5713Dump after conversion from GCC's ``flat register file'' registers to the
5714x87's stack-like registers.  This pass is only run on x86 variants.
5715
5716@item -fdump-rtl-subreg1
5717@itemx -fdump-rtl-subreg2
5718@opindex fdump-rtl-subreg1
5719@opindex fdump-rtl-subreg2
5720@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
5721the two subreg expansion passes.
5722
5723@item -fdump-rtl-unshare
5724@opindex fdump-rtl-unshare
5725Dump after all rtl has been unshared.
5726
5727@item -fdump-rtl-vartrack
5728@opindex fdump-rtl-vartrack
5729Dump after variable tracking.
5730
5731@item -fdump-rtl-vregs
5732@opindex fdump-rtl-vregs
5733Dump after converting virtual registers to hard registers.
5734
5735@item -fdump-rtl-web
5736@opindex fdump-rtl-web
5737Dump after live range splitting.
5738
5739@item -fdump-rtl-regclass
5740@itemx -fdump-rtl-subregs_of_mode_init
5741@itemx -fdump-rtl-subregs_of_mode_finish
5742@itemx -fdump-rtl-dfinit
5743@itemx -fdump-rtl-dfinish
5744@opindex fdump-rtl-regclass
5745@opindex fdump-rtl-subregs_of_mode_init
5746@opindex fdump-rtl-subregs_of_mode_finish
5747@opindex fdump-rtl-dfinit
5748@opindex fdump-rtl-dfinish
5749These dumps are defined but always produce empty files.
5750
5751@item -da
5752@itemx -fdump-rtl-all
5753@opindex da
5754@opindex fdump-rtl-all
5755Produce all the dumps listed above.
5756
5757@item -dA
5758@opindex dA
5759Annotate the assembler output with miscellaneous debugging information.
5760
5761@item -dD
5762@opindex dD
5763Dump all macro definitions, at the end of preprocessing, in addition to
5764normal output.
5765
5766@item -dH
5767@opindex dH
5768Produce a core dump whenever an error occurs.
5769
5770@item -dp
5771@opindex dp
5772Annotate the assembler output with a comment indicating which
5773pattern and alternative is used.  The length of each instruction is
5774also printed.
5775
5776@item -dP
5777@opindex dP
5778Dump the RTL in the assembler output as a comment before each instruction.
5779Also turns on @option{-dp} annotation.
5780
5781@item -dx
5782@opindex dx
5783Just generate RTL for a function instead of compiling it.  Usually used
5784with @option{-fdump-rtl-expand}.
5785@end table
5786
5787@item -fdump-noaddr
5788@opindex fdump-noaddr
5789When doing debugging dumps, suppress address output.  This makes it more
5790feasible to use diff on debugging dumps for compiler invocations with
5791different compiler binaries and/or different
5792text / bss / data / heap / stack / dso start locations.
5793
5794@item -fdump-unnumbered
5795@opindex fdump-unnumbered
5796When doing debugging dumps, suppress instruction numbers and address output.
5797This makes it more feasible to use diff on debugging dumps for compiler
5798invocations with different options, in particular with and without
5799@option{-g}.
5800
5801@item -fdump-unnumbered-links
5802@opindex fdump-unnumbered-links
5803When doing debugging dumps (see @option{-d} option above), suppress
5804instruction numbers for the links to the previous and next instructions
5805in a sequence.
5806
5807@item -fdump-translation-unit @r{(C++ only)}
5808@itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
5809@opindex fdump-translation-unit
5810Dump a representation of the tree structure for the entire translation
5811unit to a file.  The file name is made by appending @file{.tu} to the
5812source file name, and the file is created in the same directory as the
5813output file.  If the @samp{-@var{options}} form is used, @var{options}
5814controls the details of the dump as described for the
5815@option{-fdump-tree} options.
5816
5817@item -fdump-class-hierarchy @r{(C++ only)}
5818@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
5819@opindex fdump-class-hierarchy
5820Dump a representation of each class's hierarchy and virtual function
5821table layout to a file.  The file name is made by appending
5822@file{.class} to the source file name, and the file is created in the
5823same directory as the output file.  If the @samp{-@var{options}} form
5824is used, @var{options} controls the details of the dump as described
5825for the @option{-fdump-tree} options.
5826
5827@item -fdump-ipa-@var{switch}
5828@opindex fdump-ipa
5829Control the dumping at various stages of inter-procedural analysis
5830language tree to a file.  The file name is generated by appending a
5831switch specific suffix to the source file name, and the file is created
5832in the same directory as the output file.  The following dumps are
5833possible:
5834
5835@table @samp
5836@item all
5837Enables all inter-procedural analysis dumps.
5838
5839@item cgraph
5840Dumps information about call-graph optimization, unused function removal,
5841and inlining decisions.
5842
5843@item inline
5844Dump after function inlining.
5845
5846@end table
5847
5848@item -fdump-passes
5849@opindex fdump-passes
5850Dump the list of optimization passes that are turned on and off by
5851the current command-line options.
5852
5853@item -fdump-statistics-@var{option}
5854@opindex fdump-statistics
5855Enable and control dumping of pass statistics in a separate file.  The
5856file name is generated by appending a suffix ending in
5857@samp{.statistics} to the source file name, and the file is created in
5858the same directory as the output file.  If the @samp{-@var{option}}
5859form is used, @samp{-stats} causes counters to be summed over the
5860whole compilation unit while @samp{-details} dumps every event as
5861the passes generate them.  The default with no option is to sum
5862counters for each function compiled.
5863
5864@item -fdump-tree-@var{switch}
5865@itemx -fdump-tree-@var{switch}-@var{options}
5866@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
5867@opindex fdump-tree
5868Control the dumping at various stages of processing the intermediate
5869language tree to a file.  The file name is generated by appending a
5870switch-specific suffix to the source file name, and the file is
5871created in the same directory as the output file. In case of
5872@option{=@var{filename}} option, the dump is output on the given file
5873instead of the auto named dump files.  If the @samp{-@var{options}}
5874form is used, @var{options} is a list of @samp{-} separated options
5875which control the details of the dump.  Not all options are applicable
5876to all dumps; those that are not meaningful are ignored.  The
5877following options are available
5878
5879@table @samp
5880@item address
5881Print the address of each node.  Usually this is not meaningful as it
5882changes according to the environment and source file.  Its primary use
5883is for tying up a dump file with a debug environment.
5884@item asmname
5885If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
5886in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
5887use working backward from mangled names in the assembly file.
5888@item slim
5889When dumping front-end intermediate representations, inhibit dumping
5890of members of a scope or body of a function merely because that scope
5891has been reached.  Only dump such items when they are directly reachable
5892by some other path.
5893
5894When dumping pretty-printed trees, this option inhibits dumping the
5895bodies of control structures.
5896
5897When dumping RTL, print the RTL in slim (condensed) form instead of
5898the default LISP-like representation.
5899@item raw
5900Print a raw representation of the tree.  By default, trees are
5901pretty-printed into a C-like representation.
5902@item details
5903Enable more detailed dumps (not honored by every dump option). Also
5904include information from the optimization passes.
5905@item stats
5906Enable dumping various statistics about the pass (not honored by every dump
5907option).
5908@item blocks
5909Enable showing basic block boundaries (disabled in raw dumps).
5910@item graph
5911For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
5912dump a representation of the control flow graph suitable for viewing with
5913GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
5914the file is pretty-printed as a subgraph, so that GraphViz can render them
5915all in a single plot.
5916
5917This option currently only works for RTL dumps, and the RTL is always
5918dumped in slim form.
5919@item vops
5920Enable showing virtual operands for every statement.
5921@item lineno
5922Enable showing line numbers for statements.
5923@item uid
5924Enable showing the unique ID (@code{DECL_UID}) for each variable.
5925@item verbose
5926Enable showing the tree dump for each statement.
5927@item eh
5928Enable showing the EH region number holding each statement.
5929@item scev
5930Enable showing scalar evolution analysis details.
5931@item optimized
5932Enable showing optimization information (only available in certain
5933passes).
5934@item missed
5935Enable showing missed optimization information (only available in certain
5936passes).
5937@item notes
5938Enable other detailed optimization information (only available in
5939certain passes).
5940@item =@var{filename}
5941Instead of an auto named dump file, output into the given file
5942name. The file names @file{stdout} and @file{stderr} are treated
5943specially and are considered already open standard streams. For
5944example,
5945
5946@smallexample
5947gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
5948     -fdump-tree-pre=stderr file.c
5949@end smallexample
5950
5951outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
5952output on to @file{stderr}. If two conflicting dump filenames are
5953given for the same pass, then the latter option overrides the earlier
5954one.
5955
5956@item all
5957Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
5958and @option{lineno}.
5959
5960@item optall
5961Turn on all optimization options, i.e., @option{optimized},
5962@option{missed}, and @option{note}.
5963@end table
5964
5965The following tree dumps are possible:
5966@table @samp
5967
5968@item original
5969@opindex fdump-tree-original
5970Dump before any tree based optimization, to @file{@var{file}.original}.
5971
5972@item optimized
5973@opindex fdump-tree-optimized
5974Dump after all tree based optimization, to @file{@var{file}.optimized}.
5975
5976@item gimple
5977@opindex fdump-tree-gimple
5978Dump each function before and after the gimplification pass to a file.  The
5979file name is made by appending @file{.gimple} to the source file name.
5980
5981@item cfg
5982@opindex fdump-tree-cfg
5983Dump the control flow graph of each function to a file.  The file name is
5984made by appending @file{.cfg} to the source file name.
5985
5986@item ch
5987@opindex fdump-tree-ch
5988Dump each function after copying loop headers.  The file name is made by
5989appending @file{.ch} to the source file name.
5990
5991@item ssa
5992@opindex fdump-tree-ssa
5993Dump SSA related information to a file.  The file name is made by appending
5994@file{.ssa} to the source file name.
5995
5996@item alias
5997@opindex fdump-tree-alias
5998Dump aliasing information for each function.  The file name is made by
5999appending @file{.alias} to the source file name.
6000
6001@item ccp
6002@opindex fdump-tree-ccp
6003Dump each function after CCP@.  The file name is made by appending
6004@file{.ccp} to the source file name.
6005
6006@item storeccp
6007@opindex fdump-tree-storeccp
6008Dump each function after STORE-CCP@.  The file name is made by appending
6009@file{.storeccp} to the source file name.
6010
6011@item pre
6012@opindex fdump-tree-pre
6013Dump trees after partial redundancy elimination.  The file name is made
6014by appending @file{.pre} to the source file name.
6015
6016@item fre
6017@opindex fdump-tree-fre
6018Dump trees after full redundancy elimination.  The file name is made
6019by appending @file{.fre} to the source file name.
6020
6021@item copyprop
6022@opindex fdump-tree-copyprop
6023Dump trees after copy propagation.  The file name is made
6024by appending @file{.copyprop} to the source file name.
6025
6026@item store_copyprop
6027@opindex fdump-tree-store_copyprop
6028Dump trees after store copy-propagation.  The file name is made
6029by appending @file{.store_copyprop} to the source file name.
6030
6031@item dce
6032@opindex fdump-tree-dce
6033Dump each function after dead code elimination.  The file name is made by
6034appending @file{.dce} to the source file name.
6035
6036@item mudflap
6037@opindex fdump-tree-mudflap
6038Dump each function after adding mudflap instrumentation.  The file name is
6039made by appending @file{.mudflap} to the source file name.
6040
6041@item sra
6042@opindex fdump-tree-sra
6043Dump each function after performing scalar replacement of aggregates.  The
6044file name is made by appending @file{.sra} to the source file name.
6045
6046@item sink
6047@opindex fdump-tree-sink
6048Dump each function after performing code sinking.  The file name is made
6049by appending @file{.sink} to the source file name.
6050
6051@item dom
6052@opindex fdump-tree-dom
6053Dump each function after applying dominator tree optimizations.  The file
6054name is made by appending @file{.dom} to the source file name.
6055
6056@item dse
6057@opindex fdump-tree-dse
6058Dump each function after applying dead store elimination.  The file
6059name is made by appending @file{.dse} to the source file name.
6060
6061@item phiopt
6062@opindex fdump-tree-phiopt
6063Dump each function after optimizing PHI nodes into straightline code.  The file
6064name is made by appending @file{.phiopt} to the source file name.
6065
6066@item forwprop
6067@opindex fdump-tree-forwprop
6068Dump each function after forward propagating single use variables.  The file
6069name is made by appending @file{.forwprop} to the source file name.
6070
6071@item copyrename
6072@opindex fdump-tree-copyrename
6073Dump each function after applying the copy rename optimization.  The file
6074name is made by appending @file{.copyrename} to the source file name.
6075
6076@item nrv
6077@opindex fdump-tree-nrv
6078Dump each function after applying the named return value optimization on
6079generic trees.  The file name is made by appending @file{.nrv} to the source
6080file name.
6081
6082@item vect
6083@opindex fdump-tree-vect
6084Dump each function after applying vectorization of loops.  The file name is
6085made by appending @file{.vect} to the source file name.
6086
6087@item slp
6088@opindex fdump-tree-slp
6089Dump each function after applying vectorization of basic blocks.  The file name
6090is made by appending @file{.slp} to the source file name.
6091
6092@item vrp
6093@opindex fdump-tree-vrp
6094Dump each function after Value Range Propagation (VRP).  The file name
6095is made by appending @file{.vrp} to the source file name.
6096
6097@item all
6098@opindex fdump-tree-all
6099Enable all the available tree dumps with the flags provided in this option.
6100@end table
6101
6102@item -fopt-info
6103@itemx -fopt-info-@var{options}
6104@itemx -fopt-info-@var{options}=@var{filename}
6105@opindex fopt-info
6106Controls optimization dumps from various optimization passes. If the
6107@samp{-@var{options}} form is used, @var{options} is a list of
6108@samp{-} separated options to select the dump details and
6109optimizations.  If @var{options} is not specified, it defaults to
6110@option{all} for details and @option{optall} for optimization
6111groups. If the @var{filename} is not specified, it defaults to
6112@file{stderr}. Note that the output @var{filename} will be overwritten
6113in case of multiple translation units. If a combined output from
6114multiple translation units is desired, @file{stderr} should be used
6115instead.
6116
6117The options can be divided into two groups, 1) options describing the
6118verbosity of the dump, and 2) options describing which optimizations
6119should be included. The options from both the groups can be freely
6120mixed as they are non-overlapping. However, in case of any conflicts,
6121the latter options override the earlier options on the command
6122line. Though multiple -fopt-info options are accepted, only one of
6123them can have @option{=filename}. If other filenames are provided then
6124all but the first one are ignored.
6125
6126The dump verbosity has the following options
6127
6128@table @samp
6129@item optimized
6130Print information when an optimization is successfully applied. It is
6131up to a pass to decide which information is relevant. For example, the
6132vectorizer passes print the source location of loops which got
6133successfully vectorized.
6134@item missed
6135Print information about missed optimizations. Individual passes
6136control which information to include in the output. For example,
6137
6138@smallexample
6139gcc -O2 -ftree-vectorize -fopt-info-vec-missed
6140@end smallexample
6141
6142will print information about missed optimization opportunities from
6143vectorization passes on stderr.
6144@item note
6145Print verbose information about optimizations, such as certain
6146transformations, more detailed messages about decisions etc.
6147@item all
6148Print detailed optimization information. This includes
6149@var{optimized}, @var{missed}, and @var{note}.
6150@end table
6151
6152The second set of options describes a group of optimizations and may
6153include one or more of the following.
6154
6155@table @samp
6156@item ipa
6157Enable dumps from all interprocedural optimizations.
6158@item loop
6159Enable dumps from all loop optimizations.
6160@item inline
6161Enable dumps from all inlining optimizations.
6162@item vec
6163Enable dumps from all vectorization optimizations.
6164@end table
6165
6166For example,
6167@smallexample
6168gcc -O3 -fopt-info-missed=missed.all
6169@end smallexample
6170
6171outputs missed optimization report from all the passes into
6172@file{missed.all}.
6173
6174As another example,
6175@smallexample
6176gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
6177@end smallexample
6178
6179will output information about missed optimizations as well as
6180optimized locations from all the inlining passes into
6181@file{inline.txt}.
6182
6183If the @var{filename} is provided, then the dumps from all the
6184applicable optimizations are concatenated into the @file{filename}.
6185Otherwise the dump is output onto @file{stderr}. If @var{options} is
6186omitted, it defaults to @option{all-optall}, which means dump all
6187available optimization info from all the passes. In the following
6188example, all optimization info is output on to @file{stderr}.
6189
6190@smallexample
6191gcc -O3 -fopt-info
6192@end smallexample
6193
6194Note that @option{-fopt-info-vec-missed} behaves the same as
6195@option{-fopt-info-missed-vec}.
6196
6197As another example, consider
6198
6199@smallexample
6200gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
6201@end smallexample
6202
6203Here the two output filenames @file{vec.miss} and @file{loop.opt} are
6204in conflict since only one output file is allowed. In this case, only
6205the first option takes effect and the subsequent options are
6206ignored. Thus only the @file{vec.miss} is produced which cotaints
6207dumps from the vectorizer about missed opportunities.
6208
6209@item -ftree-vectorizer-verbose=@var{n}
6210@opindex ftree-vectorizer-verbose
6211This option is deprecated and is implemented in terms of
6212@option{-fopt-info}. Please use @option{-fopt-info-@var{kind}} form
6213instead, where @var{kind} is one of the valid opt-info options. It
6214prints additional optimization information.  For @var{n}=0 no
6215diagnostic information is reported.  If @var{n}=1 the vectorizer
6216reports each loop that got vectorized, and the total number of loops
6217that got vectorized.  If @var{n}=2 the vectorizer reports locations
6218which could not be vectorized and the reasons for those. For any
6219higher verbosity levels all the analysis and transformation
6220information from the vectorizer is reported.
6221
6222Note that the information output by @option{-ftree-vectorizer-verbose}
6223option is sent to @file{stderr}. If the equivalent form
6224@option{-fopt-info-@var{options}=@var{filename}} is used then the
6225output is sent into @var{filename} instead.
6226
6227@item -frandom-seed=@var{string}
6228@opindex frandom-seed
6229This option provides a seed that GCC uses in place of
6230random numbers in generating certain symbol names
6231that have to be different in every compiled file.  It is also used to
6232place unique stamps in coverage data files and the object files that
6233produce them.  You can use the @option{-frandom-seed} option to produce
6234reproducibly identical object files.
6235
6236The @var{string} should be different for every file you compile.
6237
6238@item -fsched-verbose=@var{n}
6239@opindex fsched-verbose
6240On targets that use instruction scheduling, this option controls the
6241amount of debugging output the scheduler prints.  This information is
6242written to standard error, unless @option{-fdump-rtl-sched1} or
6243@option{-fdump-rtl-sched2} is specified, in which case it is output
6244to the usual dump listing file, @file{.sched1} or @file{.sched2}
6245respectively.  However for @var{n} greater than nine, the output is
6246always printed to standard error.
6247
6248For @var{n} greater than zero, @option{-fsched-verbose} outputs the
6249same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
6250For @var{n} greater than one, it also output basic block probabilities,
6251detailed ready list information and unit/insn info.  For @var{n} greater
6252than two, it includes RTL at abort point, control-flow and regions info.
6253And for @var{n} over four, @option{-fsched-verbose} also includes
6254dependence info.
6255
6256@item -save-temps
6257@itemx -save-temps=cwd
6258@opindex save-temps
6259Store the usual ``temporary'' intermediate files permanently; place them
6260in the current directory and name them based on the source file.  Thus,
6261compiling @file{foo.c} with @option{-c -save-temps} produces files
6262@file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
6263preprocessed @file{foo.i} output file even though the compiler now
6264normally uses an integrated preprocessor.
6265
6266When used in combination with the @option{-x} command-line option,
6267@option{-save-temps} is sensible enough to avoid over writing an
6268input source file with the same extension as an intermediate file.
6269The corresponding intermediate file may be obtained by renaming the
6270source file before using @option{-save-temps}.
6271
6272If you invoke GCC in parallel, compiling several different source
6273files that share a common base name in different subdirectories or the
6274same source file compiled for multiple output destinations, it is
6275likely that the different parallel compilers will interfere with each
6276other, and overwrite the temporary files.  For instance:
6277
6278@smallexample
6279gcc -save-temps -o outdir1/foo.o indir1/foo.c&
6280gcc -save-temps -o outdir2/foo.o indir2/foo.c&
6281@end smallexample
6282
6283may result in @file{foo.i} and @file{foo.o} being written to
6284simultaneously by both compilers.
6285
6286@item -save-temps=obj
6287@opindex save-temps=obj
6288Store the usual ``temporary'' intermediate files permanently.  If the
6289@option{-o} option is used, the temporary files are based on the
6290object file.  If the @option{-o} option is not used, the
6291@option{-save-temps=obj} switch behaves like @option{-save-temps}.
6292
6293For example:
6294
6295@smallexample
6296gcc -save-temps=obj -c foo.c
6297gcc -save-temps=obj -c bar.c -o dir/xbar.o
6298gcc -save-temps=obj foobar.c -o dir2/yfoobar
6299@end smallexample
6300
6301@noindent
6302creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
6303@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
6304@file{dir2/yfoobar.o}.
6305
6306@item -time@r{[}=@var{file}@r{]}
6307@opindex time
6308Report the CPU time taken by each subprocess in the compilation
6309sequence.  For C source files, this is the compiler proper and assembler
6310(plus the linker if linking is done).
6311
6312Without the specification of an output file, the output looks like this:
6313
6314@smallexample
6315# cc1 0.12 0.01
6316# as 0.00 0.01
6317@end smallexample
6318
6319The first number on each line is the ``user time'', that is time spent
6320executing the program itself.  The second number is ``system time'',
6321time spent executing operating system routines on behalf of the program.
6322Both numbers are in seconds.
6323
6324With the specification of an output file, the output is appended to the
6325named file, and it looks like this:
6326
6327@smallexample
63280.12 0.01 cc1 @var{options}
63290.00 0.01 as @var{options}
6330@end smallexample
6331
6332The ``user time'' and the ``system time'' are moved before the program
6333name, and the options passed to the program are displayed, so that one
6334can later tell what file was being compiled, and with which options.
6335
6336@item -fvar-tracking
6337@opindex fvar-tracking
6338Run variable tracking pass.  It computes where variables are stored at each
6339position in code.  Better debugging information is then generated
6340(if the debugging information format supports this information).
6341
6342It is enabled by default when compiling with optimization (@option{-Os},
6343@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6344the debug info format supports it.
6345
6346@item -fvar-tracking-assignments
6347@opindex fvar-tracking-assignments
6348@opindex fno-var-tracking-assignments
6349Annotate assignments to user variables early in the compilation and
6350attempt to carry the annotations over throughout the compilation all the
6351way to the end, in an attempt to improve debug information while
6352optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
6353
6354It can be enabled even if var-tracking is disabled, in which case
6355annotations are created and maintained, but discarded at the end.
6356
6357@item -fvar-tracking-assignments-toggle
6358@opindex fvar-tracking-assignments-toggle
6359@opindex fno-var-tracking-assignments-toggle
6360Toggle @option{-fvar-tracking-assignments}, in the same way that
6361@option{-gtoggle} toggles @option{-g}.
6362
6363@item -print-file-name=@var{library}
6364@opindex print-file-name
6365Print the full absolute name of the library file @var{library} that
6366would be used when linking---and don't do anything else.  With this
6367option, GCC does not compile or link anything; it just prints the
6368file name.
6369
6370@item -print-multi-directory
6371@opindex print-multi-directory
6372Print the directory name corresponding to the multilib selected by any
6373other switches present in the command line.  This directory is supposed
6374to exist in @env{GCC_EXEC_PREFIX}.
6375
6376@item -print-multi-lib
6377@opindex print-multi-lib
6378Print the mapping from multilib directory names to compiler switches
6379that enable them.  The directory name is separated from the switches by
6380@samp{;}, and each switch starts with an @samp{@@} instead of the
6381@samp{-}, without spaces between multiple switches.  This is supposed to
6382ease shell processing.
6383
6384@item -print-multi-os-directory
6385@opindex print-multi-os-directory
6386Print the path to OS libraries for the selected
6387multilib, relative to some @file{lib} subdirectory.  If OS libraries are
6388present in the @file{lib} subdirectory and no multilibs are used, this is
6389usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
6390sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
6391@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
6392subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
6393
6394@item -print-multiarch
6395@opindex print-multiarch
6396Print the path to OS libraries for the selected multiarch,
6397relative to some @file{lib} subdirectory.
6398
6399@item -print-prog-name=@var{program}
6400@opindex print-prog-name
6401Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
6402
6403@item -print-libgcc-file-name
6404@opindex print-libgcc-file-name
6405Same as @option{-print-file-name=libgcc.a}.
6406
6407This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
6408but you do want to link with @file{libgcc.a}.  You can do:
6409
6410@smallexample
6411gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
6412@end smallexample
6413
6414@item -print-search-dirs
6415@opindex print-search-dirs
6416Print the name of the configured installation directory and a list of
6417program and library directories @command{gcc} searches---and don't do anything else.
6418
6419This is useful when @command{gcc} prints the error message
6420@samp{installation problem, cannot exec cpp0: No such file or directory}.
6421To resolve this you either need to put @file{cpp0} and the other compiler
6422components where @command{gcc} expects to find them, or you can set the environment
6423variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
6424Don't forget the trailing @samp{/}.
6425@xref{Environment Variables}.
6426
6427@item -print-sysroot
6428@opindex print-sysroot
6429Print the target sysroot directory that is used during
6430compilation.  This is the target sysroot specified either at configure
6431time or using the @option{--sysroot} option, possibly with an extra
6432suffix that depends on compilation options.  If no target sysroot is
6433specified, the option prints nothing.
6434
6435@item -print-sysroot-headers-suffix
6436@opindex print-sysroot-headers-suffix
6437Print the suffix added to the target sysroot when searching for
6438headers, or give an error if the compiler is not configured with such
6439a suffix---and don't do anything else.
6440
6441@item -dumpmachine
6442@opindex dumpmachine
6443Print the compiler's target machine (for example,
6444@samp{i686-pc-linux-gnu})---and don't do anything else.
6445
6446@item -dumpversion
6447@opindex dumpversion
6448Print the compiler version (for example, @samp{3.0})---and don't do
6449anything else.
6450
6451@item -dumpspecs
6452@opindex dumpspecs
6453Print the compiler's built-in specs---and don't do anything else.  (This
6454is used when GCC itself is being built.)  @xref{Spec Files}.
6455
6456@item -fno-eliminate-unused-debug-types
6457@opindex feliminate-unused-debug-types
6458@opindex fno-eliminate-unused-debug-types
6459Normally, when producing DWARF 2 output, GCC avoids producing debug symbol
6460output for types that are nowhere used in the source file being compiled.
6461Sometimes it is useful to have GCC emit debugging
6462information for all types declared in a compilation
6463unit, regardless of whether or not they are actually used
6464in that compilation unit, for example
6465if, in the debugger, you want to cast a value to a type that is
6466not actually used in your program (but is declared).  More often,
6467however, this results in a significant amount of wasted space.
6468@end table
6469
6470@node Optimize Options
6471@section Options That Control Optimization
6472@cindex optimize options
6473@cindex options, optimization
6474
6475These options control various sorts of optimizations.
6476
6477Without any optimization option, the compiler's goal is to reduce the
6478cost of compilation and to make debugging produce the expected
6479results.  Statements are independent: if you stop the program with a
6480breakpoint between statements, you can then assign a new value to any
6481variable or change the program counter to any other statement in the
6482function and get exactly the results you expect from the source
6483code.
6484
6485Turning on optimization flags makes the compiler attempt to improve
6486the performance and/or code size at the expense of compilation time
6487and possibly the ability to debug the program.
6488
6489The compiler performs optimization based on the knowledge it has of the
6490program.  Compiling multiple files at once to a single output file mode allows
6491the compiler to use information gained from all of the files when compiling
6492each of them.
6493
6494Not all optimizations are controlled directly by a flag.  Only
6495optimizations that have a flag are listed in this section.
6496
6497Most optimizations are only enabled if an @option{-O} level is set on
6498the command line.  Otherwise they are disabled, even if individual
6499optimization flags are specified.
6500
6501Depending on the target and how GCC was configured, a slightly different
6502set of optimizations may be enabled at each @option{-O} level than
6503those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
6504to find out the exact set of optimizations that are enabled at each level.
6505@xref{Overall Options}, for examples.
6506
6507@table @gcctabopt
6508@item -O
6509@itemx -O1
6510@opindex O
6511@opindex O1
6512Optimize.  Optimizing compilation takes somewhat more time, and a lot
6513more memory for a large function.
6514
6515With @option{-O}, the compiler tries to reduce code size and execution
6516time, without performing any optimizations that take a great deal of
6517compilation time.
6518
6519@option{-O} turns on the following optimization flags:
6520@gccoptlist{
6521-fauto-inc-dec @gol
6522-fcompare-elim @gol
6523-fcprop-registers @gol
6524-fdce @gol
6525-fdefer-pop @gol
6526-fdelayed-branch @gol
6527-fdse @gol
6528-fguess-branch-probability @gol
6529-fif-conversion2 @gol
6530-fif-conversion @gol
6531-fipa-pure-const @gol
6532-fipa-profile @gol
6533-fipa-reference @gol
6534-fmerge-constants
6535-fsplit-wide-types @gol
6536-ftree-bit-ccp @gol
6537-ftree-builtin-call-dce @gol
6538-ftree-ccp @gol
6539-ftree-ch @gol
6540-ftree-copyrename @gol
6541-ftree-dce @gol
6542-ftree-dominator-opts @gol
6543-ftree-dse @gol
6544-ftree-forwprop @gol
6545-ftree-fre @gol
6546-ftree-phiprop @gol
6547-ftree-slsr @gol
6548-ftree-sra @gol
6549-ftree-pta @gol
6550-ftree-ter @gol
6551-funit-at-a-time}
6552
6553@option{-O} also turns on @option{-fomit-frame-pointer} on machines
6554where doing so does not interfere with debugging.
6555
6556@item -O2
6557@opindex O2
6558Optimize even more.  GCC performs nearly all supported optimizations
6559that do not involve a space-speed tradeoff.
6560As compared to @option{-O}, this option increases both compilation time
6561and the performance of the generated code.
6562
6563@option{-O2} turns on all optimization flags specified by @option{-O}.  It
6564also turns on the following optimization flags:
6565@gccoptlist{-fthread-jumps @gol
6566-falign-functions  -falign-jumps @gol
6567-falign-loops  -falign-labels @gol
6568-fcaller-saves @gol
6569-fcrossjumping @gol
6570-fcse-follow-jumps  -fcse-skip-blocks @gol
6571-fdelete-null-pointer-checks @gol
6572-fdevirtualize @gol
6573-fexpensive-optimizations @gol
6574-fgcse  -fgcse-lm  @gol
6575-fhoist-adjacent-loads @gol
6576-finline-small-functions @gol
6577-findirect-inlining @gol
6578-fipa-sra @gol
6579-foptimize-sibling-calls @gol
6580-fpartial-inlining @gol
6581-fpeephole2 @gol
6582-fregmove @gol
6583-freorder-blocks  -freorder-functions @gol
6584-frerun-cse-after-loop  @gol
6585-fsched-interblock  -fsched-spec @gol
6586-fschedule-insns  -fschedule-insns2 @gol
6587-fstrict-aliasing -fstrict-overflow @gol
6588-ftree-switch-conversion -ftree-tail-merge @gol
6589-ftree-pre @gol
6590-ftree-vrp}
6591
6592Please note the warning under @option{-fgcse} about
6593invoking @option{-O2} on programs that use computed gotos.
6594
6595@item -O3
6596@opindex O3
6597Optimize yet more.  @option{-O3} turns on all optimizations specified
6598by @option{-O2} and also turns on the @option{-finline-functions},
6599@option{-funswitch-loops}, @option{-fpredictive-commoning},
6600@option{-fgcse-after-reload}, @option{-ftree-vectorize},
6601@option{-fvect-cost-model},
6602@option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
6603
6604@item -O0
6605@opindex O0
6606Reduce compilation time and make debugging produce the expected
6607results.  This is the default.
6608
6609@item -Os
6610@opindex Os
6611Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
6612do not typically increase code size.  It also performs further
6613optimizations designed to reduce code size.
6614
6615@option{-Os} disables the following optimization flags:
6616@gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
6617-falign-labels  -freorder-blocks  -freorder-blocks-and-partition @gol
6618-fprefetch-loop-arrays  -ftree-vect-loop-version}
6619
6620@item -Ofast
6621@opindex Ofast
6622Disregard strict standards compliance.  @option{-Ofast} enables all
6623@option{-O3} optimizations.  It also enables optimizations that are not
6624valid for all standard-compliant programs.
6625It turns on @option{-ffast-math} and the Fortran-specific
6626@option{-fno-protect-parens} and @option{-fstack-arrays}.
6627
6628@item -Og
6629@opindex Og
6630Optimize debugging experience.  @option{-Og} enables optimizations
6631that do not interfere with debugging. It should be the optimization
6632level of choice for the standard edit-compile-debug cycle, offering
6633a reasonable level of optimization while maintaining fast compilation
6634and a good debugging experience.
6635
6636If you use multiple @option{-O} options, with or without level numbers,
6637the last such option is the one that is effective.
6638@end table
6639
6640Options of the form @option{-f@var{flag}} specify machine-independent
6641flags.  Most flags have both positive and negative forms; the negative
6642form of @option{-ffoo} is @option{-fno-foo}.  In the table
6643below, only one of the forms is listed---the one you typically
6644use.  You can figure out the other form by either removing @samp{no-}
6645or adding it.
6646
6647The following options control specific optimizations.  They are either
6648activated by @option{-O} options or are related to ones that are.  You
6649can use the following flags in the rare cases when ``fine-tuning'' of
6650optimizations to be performed is desired.
6651
6652@table @gcctabopt
6653@item -fno-default-inline
6654@opindex fno-default-inline
6655Do not make member functions inline by default merely because they are
6656defined inside the class scope (C++ only).  Otherwise, when you specify
6657@w{@option{-O}}, member functions defined inside class scope are compiled
6658inline by default; i.e., you don't need to add @samp{inline} in front of
6659the member function name.
6660
6661@item -fno-defer-pop
6662@opindex fno-defer-pop
6663Always pop the arguments to each function call as soon as that function
6664returns.  For machines that must pop arguments after a function call,
6665the compiler normally lets arguments accumulate on the stack for several
6666function calls and pops them all at once.
6667
6668Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6669
6670@item -fforward-propagate
6671@opindex fforward-propagate
6672Perform a forward propagation pass on RTL@.  The pass tries to combine two
6673instructions and checks if the result can be simplified.  If loop unrolling
6674is active, two passes are performed and the second is scheduled after
6675loop unrolling.
6676
6677This option is enabled by default at optimization levels @option{-O},
6678@option{-O2}, @option{-O3}, @option{-Os}.
6679
6680@item -ffp-contract=@var{style}
6681@opindex ffp-contract
6682@option{-ffp-contract=off} disables floating-point expression contraction.
6683@option{-ffp-contract=fast} enables floating-point expression contraction
6684such as forming of fused multiply-add operations if the target has
6685native support for them.
6686@option{-ffp-contract=on} enables floating-point expression contraction
6687if allowed by the language standard.  This is currently not implemented
6688and treated equal to @option{-ffp-contract=off}.
6689
6690The default is @option{-ffp-contract=fast}.
6691
6692@item -fomit-frame-pointer
6693@opindex fomit-frame-pointer
6694Don't keep the frame pointer in a register for functions that
6695don't need one.  This avoids the instructions to save, set up and
6696restore frame pointers; it also makes an extra register available
6697in many functions.  @strong{It also makes debugging impossible on
6698some machines.}
6699
6700On some machines, such as the VAX, this flag has no effect, because
6701the standard calling sequence automatically handles the frame pointer
6702and nothing is saved by pretending it doesn't exist.  The
6703machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6704whether a target machine supports this flag.  @xref{Registers,,Register
6705Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6706
6707Starting with GCC version 4.6, the default setting (when not optimizing for
6708size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets has been changed to
6709@option{-fomit-frame-pointer}.  The default can be reverted to
6710@option{-fno-omit-frame-pointer} by configuring GCC with the
6711@option{--enable-frame-pointer} configure option.
6712
6713Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6714
6715@item -foptimize-sibling-calls
6716@opindex foptimize-sibling-calls
6717Optimize sibling and tail recursive calls.
6718
6719Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6720
6721@item -fno-inline
6722@opindex fno-inline
6723Do not expand any functions inline apart from those marked with
6724the @code{always_inline} attribute.  This is the default when not
6725optimizing.
6726
6727Single functions can be exempted from inlining by marking them
6728with the @code{noinline} attribute.
6729
6730@item -finline-small-functions
6731@opindex finline-small-functions
6732Integrate functions into their callers when their body is smaller than expected
6733function call code (so overall size of program gets smaller).  The compiler
6734heuristically decides which functions are simple enough to be worth integrating
6735in this way.  This inlining applies to all functions, even those not declared
6736inline.
6737
6738Enabled at level @option{-O2}.
6739
6740@item -findirect-inlining
6741@opindex findirect-inlining
6742Inline also indirect calls that are discovered to be known at compile
6743time thanks to previous inlining.  This option has any effect only
6744when inlining itself is turned on by the @option{-finline-functions}
6745or @option{-finline-small-functions} options.
6746
6747Enabled at level @option{-O2}.
6748
6749@item -finline-functions
6750@opindex finline-functions
6751Consider all functions for inlining, even if they are not declared inline.
6752The compiler heuristically decides which functions are worth integrating
6753in this way.
6754
6755If all calls to a given function are integrated, and the function is
6756declared @code{static}, then the function is normally not output as
6757assembler code in its own right.
6758
6759Enabled at level @option{-O3}.
6760
6761@item -finline-functions-called-once
6762@opindex finline-functions-called-once
6763Consider all @code{static} functions called once for inlining into their
6764caller even if they are not marked @code{inline}.  If a call to a given
6765function is integrated, then the function is not output as assembler code
6766in its own right.
6767
6768Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6769
6770@item -fearly-inlining
6771@opindex fearly-inlining
6772Inline functions marked by @code{always_inline} and functions whose body seems
6773smaller than the function call overhead early before doing
6774@option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
6775makes profiling significantly cheaper and usually inlining faster on programs
6776having large chains of nested wrapper functions.
6777
6778Enabled by default.
6779
6780@item -fipa-sra
6781@opindex fipa-sra
6782Perform interprocedural scalar replacement of aggregates, removal of
6783unused parameters and replacement of parameters passed by reference
6784by parameters passed by value.
6785
6786Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6787
6788@item -finline-limit=@var{n}
6789@opindex finline-limit
6790By default, GCC limits the size of functions that can be inlined.  This flag
6791allows coarse control of this limit.  @var{n} is the size of functions that
6792can be inlined in number of pseudo instructions.
6793
6794Inlining is actually controlled by a number of parameters, which may be
6795specified individually by using @option{--param @var{name}=@var{value}}.
6796The @option{-finline-limit=@var{n}} option sets some of these parameters
6797as follows:
6798
6799@table @gcctabopt
6800@item max-inline-insns-single
6801is set to @var{n}/2.
6802@item max-inline-insns-auto
6803is set to @var{n}/2.
6804@end table
6805
6806See below for a documentation of the individual
6807parameters controlling inlining and for the defaults of these parameters.
6808
6809@emph{Note:} there may be no value to @option{-finline-limit} that results
6810in default behavior.
6811
6812@emph{Note:} pseudo instruction represents, in this particular context, an
6813abstract measurement of function's size.  In no way does it represent a count
6814of assembly instructions and as such its exact meaning might change from one
6815release to an another.
6816
6817@item -fno-keep-inline-dllexport
6818@opindex -fno-keep-inline-dllexport
6819This is a more fine-grained version of @option{-fkeep-inline-functions},
6820which applies only to functions that are declared using the @code{dllexport}
6821attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6822Functions}.)
6823
6824@item -fkeep-inline-functions
6825@opindex fkeep-inline-functions
6826In C, emit @code{static} functions that are declared @code{inline}
6827into the object file, even if the function has been inlined into all
6828of its callers.  This switch does not affect functions using the
6829@code{extern inline} extension in GNU C90@.  In C++, emit any and all
6830inline functions into the object file.
6831
6832@item -fkeep-static-consts
6833@opindex fkeep-static-consts
6834Emit variables declared @code{static const} when optimization isn't turned
6835on, even if the variables aren't referenced.
6836
6837GCC enables this option by default.  If you want to force the compiler to
6838check if a variable is referenced, regardless of whether or not
6839optimization is turned on, use the @option{-fno-keep-static-consts} option.
6840
6841@item -fmerge-constants
6842@opindex fmerge-constants
6843Attempt to merge identical constants (string constants and floating-point
6844constants) across compilation units.
6845
6846This option is the default for optimized compilation if the assembler and
6847linker support it.  Use @option{-fno-merge-constants} to inhibit this
6848behavior.
6849
6850Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6851
6852@item -fmerge-all-constants
6853@opindex fmerge-all-constants
6854Attempt to merge identical constants and identical variables.
6855
6856This option implies @option{-fmerge-constants}.  In addition to
6857@option{-fmerge-constants} this considers e.g.@: even constant initialized
6858arrays or initialized constant variables with integral or floating-point
6859types.  Languages like C or C++ require each variable, including multiple
6860instances of the same variable in recursive calls, to have distinct locations,
6861so using this option results in non-conforming
6862behavior.
6863
6864@item -fmodulo-sched
6865@opindex fmodulo-sched
6866Perform swing modulo scheduling immediately before the first scheduling
6867pass.  This pass looks at innermost loops and reorders their
6868instructions by overlapping different iterations.
6869
6870@item -fmodulo-sched-allow-regmoves
6871@opindex fmodulo-sched-allow-regmoves
6872Perform more aggressive SMS-based modulo scheduling with register moves
6873allowed.  By setting this flag certain anti-dependences edges are
6874deleted, which triggers the generation of reg-moves based on the
6875life-range analysis.  This option is effective only with
6876@option{-fmodulo-sched} enabled.
6877
6878@item -fno-branch-count-reg
6879@opindex fno-branch-count-reg
6880Do not use ``decrement and branch'' instructions on a count register,
6881but instead generate a sequence of instructions that decrement a
6882register, compare it against zero, then branch based upon the result.
6883This option is only meaningful on architectures that support such
6884instructions, which include x86, PowerPC, IA-64 and S/390.
6885
6886The default is @option{-fbranch-count-reg}.
6887
6888@item -fno-function-cse
6889@opindex fno-function-cse
6890Do not put function addresses in registers; make each instruction that
6891calls a constant function contain the function's address explicitly.
6892
6893This option results in less efficient code, but some strange hacks
6894that alter the assembler output may be confused by the optimizations
6895performed when this option is not used.
6896
6897The default is @option{-ffunction-cse}
6898
6899@item -fno-zero-initialized-in-bss
6900@opindex fno-zero-initialized-in-bss
6901If the target supports a BSS section, GCC by default puts variables that
6902are initialized to zero into BSS@.  This can save space in the resulting
6903code.
6904
6905This option turns off this behavior because some programs explicitly
6906rely on variables going to the data section---e.g., so that the
6907resulting executable can find the beginning of that section and/or make
6908assumptions based on that.
6909
6910The default is @option{-fzero-initialized-in-bss}.
6911
6912@item -fmudflap -fmudflapth -fmudflapir
6913@opindex fmudflap
6914@opindex fmudflapth
6915@opindex fmudflapir
6916@cindex bounds checking
6917@cindex mudflap
6918For front-ends that support it (C and C++), instrument all risky
6919pointer/array dereferencing operations, some standard library
6920string/heap functions, and some other associated constructs with
6921range/validity tests.  Modules so instrumented should be immune to
6922buffer overflows, invalid heap use, and some other classes of C/C++
6923programming errors.  The instrumentation relies on a separate runtime
6924library (@file{libmudflap}), which is linked into a program if
6925@option{-fmudflap} is given at link time.  Run-time behavior of the
6926instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
6927environment variable.  See @code{env MUDFLAP_OPTIONS=-help a.out}
6928for its options.
6929
6930Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
6931link if your program is multi-threaded.  Use @option{-fmudflapir}, in
6932addition to @option{-fmudflap} or @option{-fmudflapth}, if
6933instrumentation should ignore pointer reads.  This produces less
6934instrumentation (and therefore faster execution) and still provides
6935some protection against outright memory corrupting writes, but allows
6936erroneously read data to propagate within a program.
6937
6938@item -fthread-jumps
6939@opindex fthread-jumps
6940Perform optimizations that check to see if a jump branches to a
6941location where another comparison subsumed by the first is found.  If
6942so, the first branch is redirected to either the destination of the
6943second branch or a point immediately following it, depending on whether
6944the condition is known to be true or false.
6945
6946Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6947
6948@item -fsplit-wide-types
6949@opindex fsplit-wide-types
6950When using a type that occupies multiple registers, such as @code{long
6951long} on a 32-bit system, split the registers apart and allocate them
6952independently.  This normally generates better code for those types,
6953but may make debugging more difficult.
6954
6955Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6956@option{-Os}.
6957
6958@item -fcse-follow-jumps
6959@opindex fcse-follow-jumps
6960In common subexpression elimination (CSE), scan through jump instructions
6961when the target of the jump is not reached by any other path.  For
6962example, when CSE encounters an @code{if} statement with an
6963@code{else} clause, CSE follows the jump when the condition
6964tested is false.
6965
6966Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6967
6968@item -fcse-skip-blocks
6969@opindex fcse-skip-blocks
6970This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6971follow jumps that conditionally skip over blocks.  When CSE
6972encounters a simple @code{if} statement with no else clause,
6973@option{-fcse-skip-blocks} causes CSE to follow the jump around the
6974body of the @code{if}.
6975
6976Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6977
6978@item -frerun-cse-after-loop
6979@opindex frerun-cse-after-loop
6980Re-run common subexpression elimination after loop optimizations are
6981performed.
6982
6983Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6984
6985@item -fgcse
6986@opindex fgcse
6987Perform a global common subexpression elimination pass.
6988This pass also performs global constant and copy propagation.
6989
6990@emph{Note:} When compiling a program using computed gotos, a GCC
6991extension, you may get better run-time performance if you disable
6992the global common subexpression elimination pass by adding
6993@option{-fno-gcse} to the command line.
6994
6995Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6996
6997@item -fgcse-lm
6998@opindex fgcse-lm
6999When @option{-fgcse-lm} is enabled, global common subexpression elimination
7000attempts to move loads that are only killed by stores into themselves.  This
7001allows a loop containing a load/store sequence to be changed to a load outside
7002the loop, and a copy/store within the loop.
7003
7004Enabled by default when @option{-fgcse} is enabled.
7005
7006@item -fgcse-sm
7007@opindex fgcse-sm
7008When @option{-fgcse-sm} is enabled, a store motion pass is run after
7009global common subexpression elimination.  This pass attempts to move
7010stores out of loops.  When used in conjunction with @option{-fgcse-lm},
7011loops containing a load/store sequence can be changed to a load before
7012the loop and a store after the loop.
7013
7014Not enabled at any optimization level.
7015
7016@item -fgcse-las
7017@opindex fgcse-las
7018When @option{-fgcse-las} is enabled, the global common subexpression
7019elimination pass eliminates redundant loads that come after stores to the
7020same memory location (both partial and full redundancies).
7021
7022Not enabled at any optimization level.
7023
7024@item -fgcse-after-reload
7025@opindex fgcse-after-reload
7026When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7027pass is performed after reload.  The purpose of this pass is to clean up
7028redundant spilling.
7029
7030@item -faggressive-loop-optimizations
7031@opindex faggressive-loop-optimizations
7032This option tells the loop optimizer to use language constraints to
7033derive bounds for the number of iterations of a loop.  This assumes that
7034loop code does not invoke undefined behavior by for example causing signed
7035integer overflows or out-of-bound array accesses.  The bounds for the
7036number of iterations of a loop are used to guide loop unrolling and peeling
7037and loop exit test optimizations.
7038This option is enabled by default.
7039
7040@item -funsafe-loop-optimizations
7041@opindex funsafe-loop-optimizations
7042This option tells the loop optimizer to assume that loop indices do not
7043overflow, and that loops with nontrivial exit condition are not
7044infinite.  This enables a wider range of loop optimizations even if
7045the loop optimizer itself cannot prove that these assumptions are valid.
7046If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you
7047if it finds this kind of loop.
7048
7049@item -fcrossjumping
7050@opindex fcrossjumping
7051Perform cross-jumping transformation.
7052This transformation unifies equivalent code and saves code size.  The
7053resulting code may or may not perform better than without cross-jumping.
7054
7055Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7056
7057@item -fauto-inc-dec
7058@opindex fauto-inc-dec
7059Combine increments or decrements of addresses with memory accesses.
7060This pass is always skipped on architectures that do not have
7061instructions to support this.  Enabled by default at @option{-O} and
7062higher on architectures that support this.
7063
7064@item -fdce
7065@opindex fdce
7066Perform dead code elimination (DCE) on RTL@.
7067Enabled by default at @option{-O} and higher.
7068
7069@item -fdse
7070@opindex fdse
7071Perform dead store elimination (DSE) on RTL@.
7072Enabled by default at @option{-O} and higher.
7073
7074@item -fif-conversion
7075@opindex fif-conversion
7076Attempt to transform conditional jumps into branch-less equivalents.  This
7077includes use of conditional moves, min, max, set flags and abs instructions, and
7078some tricks doable by standard arithmetics.  The use of conditional execution
7079on chips where it is available is controlled by @code{if-conversion2}.
7080
7081Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7082
7083@item -fif-conversion2
7084@opindex fif-conversion2
7085Use conditional execution (where available) to transform conditional jumps into
7086branch-less equivalents.
7087
7088Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7089
7090@item -fdelete-null-pointer-checks
7091@opindex fdelete-null-pointer-checks
7092Assume that programs cannot safely dereference null pointers, and that
7093no code or data element resides there.  This enables simple constant
7094folding optimizations at all optimization levels.  In addition, other
7095optimization passes in GCC use this flag to control global dataflow
7096analyses that eliminate useless checks for null pointers; these assume
7097that if a pointer is checked after it has already been dereferenced,
7098it cannot be null.
7099
7100Note however that in some environments this assumption is not true.
7101Use @option{-fno-delete-null-pointer-checks} to disable this optimization
7102for programs that depend on that behavior.
7103
7104Some targets, especially embedded ones, disable this option at all levels.
7105Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
7106@option{-O2}, @option{-O3}, @option{-Os}.  Passes that use the information
7107are enabled independently at different optimization levels.
7108
7109@item -fdevirtualize
7110@opindex fdevirtualize
7111Attempt to convert calls to virtual functions to direct calls.  This
7112is done both within a procedure and interprocedurally as part of
7113indirect inlining (@code{-findirect-inlining}) and interprocedural constant
7114propagation (@option{-fipa-cp}).
7115Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7116
7117@item -fexpensive-optimizations
7118@opindex fexpensive-optimizations
7119Perform a number of minor optimizations that are relatively expensive.
7120
7121Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7122
7123@item -free
7124@opindex free
7125Attempt to remove redundant extension instructions.  This is especially
7126helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
7127registers after writing to their lower 32-bit half.
7128
7129Enabled for x86 at levels @option{-O2}, @option{-O3}.
7130
7131@item -foptimize-register-move
7132@itemx -fregmove
7133@opindex foptimize-register-move
7134@opindex fregmove
7135Attempt to reassign register numbers in move instructions and as
7136operands of other simple instructions in order to maximize the amount of
7137register tying.  This is especially helpful on machines with two-operand
7138instructions.
7139
7140Note @option{-fregmove} and @option{-foptimize-register-move} are the same
7141optimization.
7142
7143Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7144
7145@item -fira-algorithm=@var{algorithm}
7146Use the specified coloring algorithm for the integrated register
7147allocator.  The @var{algorithm} argument can be @samp{priority}, which
7148specifies Chow's priority coloring, or @samp{CB}, which specifies
7149Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
7150for all architectures, but for those targets that do support it, it is
7151the default because it generates better code.
7152
7153@item -fira-region=@var{region}
7154Use specified regions for the integrated register allocator.  The
7155@var{region} argument should be one of the following:
7156
7157@table @samp
7158
7159@item all
7160Use all loops as register allocation regions.
7161This can give the best results for machines with a small and/or
7162irregular register set.
7163
7164@item mixed
7165Use all loops except for loops with small register pressure
7166as the regions.  This value usually gives
7167the best results in most cases and for most architectures,
7168and is enabled by default when compiling with optimization for speed
7169(@option{-O}, @option{-O2}, @dots{}).
7170
7171@item one
7172Use all functions as a single region.
7173This typically results in the smallest code size, and is enabled by default for
7174@option{-Os} or @option{-O0}.
7175
7176@end table
7177
7178@item -fira-hoist-pressure
7179@opindex fira-hoist-pressure
7180Use IRA to evaluate register pressure in the code hoisting pass for
7181decisions to hoist expressions.  This option usually results in smaller
7182code, but it can slow the compiler down.
7183
7184This option is enabled at level @option{-Os} for all targets.
7185
7186@item -fira-loop-pressure
7187@opindex fira-loop-pressure
7188Use IRA to evaluate register pressure in loops for decisions to move
7189loop invariants.  This option usually results in generation
7190of faster and smaller code on machines with large register files (>= 32
7191registers), but it can slow the compiler down.
7192
7193This option is enabled at level @option{-O3} for some targets.
7194
7195@item -fno-ira-share-save-slots
7196@opindex fno-ira-share-save-slots
7197Disable sharing of stack slots used for saving call-used hard
7198registers living through a call.  Each hard register gets a
7199separate stack slot, and as a result function stack frames are
7200larger.
7201
7202@item -fno-ira-share-spill-slots
7203@opindex fno-ira-share-spill-slots
7204Disable sharing of stack slots allocated for pseudo-registers.  Each
7205pseudo-register that does not get a hard register gets a separate
7206stack slot, and as a result function stack frames are larger.
7207
7208@item -fira-verbose=@var{n}
7209@opindex fira-verbose
7210Control the verbosity of the dump file for the integrated register allocator.
7211The default value is 5.  If the value @var{n} is greater or equal to 10,
7212the dump output is sent to stderr using the same format as @var{n} minus 10.
7213
7214@item -fdelayed-branch
7215@opindex fdelayed-branch
7216If supported for the target machine, attempt to reorder instructions
7217to exploit instruction slots available after delayed branch
7218instructions.
7219
7220Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7221
7222@item -fschedule-insns
7223@opindex fschedule-insns
7224If supported for the target machine, attempt to reorder instructions to
7225eliminate execution stalls due to required data being unavailable.  This
7226helps machines that have slow floating point or memory load instructions
7227by allowing other instructions to be issued until the result of the load
7228or floating-point instruction is required.
7229
7230Enabled at levels @option{-O2}, @option{-O3}.
7231
7232@item -fschedule-insns2
7233@opindex fschedule-insns2
7234Similar to @option{-fschedule-insns}, but requests an additional pass of
7235instruction scheduling after register allocation has been done.  This is
7236especially useful on machines with a relatively small number of
7237registers and where memory load instructions take more than one cycle.
7238
7239Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7240
7241@item -fno-sched-interblock
7242@opindex fno-sched-interblock
7243Don't schedule instructions across basic blocks.  This is normally
7244enabled by default when scheduling before register allocation, i.e.@:
7245with @option{-fschedule-insns} or at @option{-O2} or higher.
7246
7247@item -fno-sched-spec
7248@opindex fno-sched-spec
7249Don't allow speculative motion of non-load instructions.  This is normally
7250enabled by default when scheduling before register allocation, i.e.@:
7251with @option{-fschedule-insns} or at @option{-O2} or higher.
7252
7253@item -fsched-pressure
7254@opindex fsched-pressure
7255Enable register pressure sensitive insn scheduling before register
7256allocation.  This only makes sense when scheduling before register
7257allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7258@option{-O2} or higher.  Usage of this option can improve the
7259generated code and decrease its size by preventing register pressure
7260increase above the number of available hard registers and subsequent
7261spills in register allocation.
7262
7263@item -fsched-spec-load
7264@opindex fsched-spec-load
7265Allow speculative motion of some load instructions.  This only makes
7266sense when scheduling before register allocation, i.e.@: with
7267@option{-fschedule-insns} or at @option{-O2} or higher.
7268
7269@item -fsched-spec-load-dangerous
7270@opindex fsched-spec-load-dangerous
7271Allow speculative motion of more load instructions.  This only makes
7272sense when scheduling before register allocation, i.e.@: with
7273@option{-fschedule-insns} or at @option{-O2} or higher.
7274
7275@item -fsched-stalled-insns
7276@itemx -fsched-stalled-insns=@var{n}
7277@opindex fsched-stalled-insns
7278Define how many insns (if any) can be moved prematurely from the queue
7279of stalled insns into the ready list during the second scheduling pass.
7280@option{-fno-sched-stalled-insns} means that no insns are moved
7281prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7282on how many queued insns can be moved prematurely.
7283@option{-fsched-stalled-insns} without a value is equivalent to
7284@option{-fsched-stalled-insns=1}.
7285
7286@item -fsched-stalled-insns-dep
7287@itemx -fsched-stalled-insns-dep=@var{n}
7288@opindex fsched-stalled-insns-dep
7289Define how many insn groups (cycles) are examined for a dependency
7290on a stalled insn that is a candidate for premature removal from the queue
7291of stalled insns.  This has an effect only during the second scheduling pass,
7292and only if @option{-fsched-stalled-insns} is used.
7293@option{-fno-sched-stalled-insns-dep} is equivalent to
7294@option{-fsched-stalled-insns-dep=0}.
7295@option{-fsched-stalled-insns-dep} without a value is equivalent to
7296@option{-fsched-stalled-insns-dep=1}.
7297
7298@item -fsched2-use-superblocks
7299@opindex fsched2-use-superblocks
7300When scheduling after register allocation, use superblock scheduling.
7301This allows motion across basic block boundaries,
7302resulting in faster schedules.  This option is experimental, as not all machine
7303descriptions used by GCC model the CPU closely enough to avoid unreliable
7304results from the algorithm.
7305
7306This only makes sense when scheduling after register allocation, i.e.@: with
7307@option{-fschedule-insns2} or at @option{-O2} or higher.
7308
7309@item -fsched-group-heuristic
7310@opindex fsched-group-heuristic
7311Enable the group heuristic in the scheduler.  This heuristic favors
7312the instruction that belongs to a schedule group.  This is enabled
7313by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7314or @option{-fschedule-insns2} or at @option{-O2} or higher.
7315
7316@item -fsched-critical-path-heuristic
7317@opindex fsched-critical-path-heuristic
7318Enable the critical-path heuristic in the scheduler.  This heuristic favors
7319instructions on the critical path.  This is enabled by default when
7320scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7321or @option{-fschedule-insns2} or at @option{-O2} or higher.
7322
7323@item -fsched-spec-insn-heuristic
7324@opindex fsched-spec-insn-heuristic
7325Enable the speculative instruction heuristic in the scheduler.  This
7326heuristic favors speculative instructions with greater dependency weakness.
7327This is enabled by default when scheduling is enabled, i.e.@:
7328with @option{-fschedule-insns} or @option{-fschedule-insns2}
7329or at @option{-O2} or higher.
7330
7331@item -fsched-rank-heuristic
7332@opindex fsched-rank-heuristic
7333Enable the rank heuristic in the scheduler.  This heuristic favors
7334the instruction belonging to a basic block with greater size or frequency.
7335This is enabled by default when scheduling is enabled, i.e.@:
7336with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7337at @option{-O2} or higher.
7338
7339@item -fsched-last-insn-heuristic
7340@opindex fsched-last-insn-heuristic
7341Enable the last-instruction heuristic in the scheduler.  This heuristic
7342favors the instruction that is less dependent on the last instruction
7343scheduled.  This is enabled by default when scheduling is enabled,
7344i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7345at @option{-O2} or higher.
7346
7347@item -fsched-dep-count-heuristic
7348@opindex fsched-dep-count-heuristic
7349Enable the dependent-count heuristic in the scheduler.  This heuristic
7350favors the instruction that has more instructions depending on it.
7351This is enabled by default when scheduling is enabled, i.e.@:
7352with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7353at @option{-O2} or higher.
7354
7355@item -freschedule-modulo-scheduled-loops
7356@opindex freschedule-modulo-scheduled-loops
7357Modulo scheduling is performed before traditional scheduling.  If a loop
7358is modulo scheduled, later scheduling passes may change its schedule.
7359Use this option to control that behavior.
7360
7361@item -fselective-scheduling
7362@opindex fselective-scheduling
7363Schedule instructions using selective scheduling algorithm.  Selective
7364scheduling runs instead of the first scheduler pass.
7365
7366@item -fselective-scheduling2
7367@opindex fselective-scheduling2
7368Schedule instructions using selective scheduling algorithm.  Selective
7369scheduling runs instead of the second scheduler pass.
7370
7371@item -fsel-sched-pipelining
7372@opindex fsel-sched-pipelining
7373Enable software pipelining of innermost loops during selective scheduling.
7374This option has no effect unless one of @option{-fselective-scheduling} or
7375@option{-fselective-scheduling2} is turned on.
7376
7377@item -fsel-sched-pipelining-outer-loops
7378@opindex fsel-sched-pipelining-outer-loops
7379When pipelining loops during selective scheduling, also pipeline outer loops.
7380This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7381
7382@item -fshrink-wrap
7383@opindex fshrink-wrap
7384Emit function prologues only before parts of the function that need it,
7385rather than at the top of the function.  This flag is enabled by default at
7386@option{-O} and higher.
7387
7388@item -fcaller-saves
7389@opindex fcaller-saves
7390Enable allocation of values to registers that are clobbered by
7391function calls, by emitting extra instructions to save and restore the
7392registers around such calls.  Such allocation is done only when it
7393seems to result in better code.
7394
7395This option is always enabled by default on certain machines, usually
7396those which have no call-preserved registers to use instead.
7397
7398Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7399
7400@item -fcombine-stack-adjustments
7401@opindex fcombine-stack-adjustments
7402Tracks stack adjustments (pushes and pops) and stack memory references
7403and then tries to find ways to combine them.
7404
7405Enabled by default at @option{-O1} and higher.
7406
7407@item -fconserve-stack
7408@opindex fconserve-stack
7409Attempt to minimize stack usage.  The compiler attempts to use less
7410stack space, even if that makes the program slower.  This option
7411implies setting the @option{large-stack-frame} parameter to 100
7412and the @option{large-stack-frame-growth} parameter to 400.
7413
7414@item -ftree-reassoc
7415@opindex ftree-reassoc
7416Perform reassociation on trees.  This flag is enabled by default
7417at @option{-O} and higher.
7418
7419@item -ftree-pre
7420@opindex ftree-pre
7421Perform partial redundancy elimination (PRE) on trees.  This flag is
7422enabled by default at @option{-O2} and @option{-O3}.
7423
7424@item -ftree-partial-pre
7425@opindex ftree-partial-pre
7426Make partial redundancy elimination (PRE) more aggressive.  This flag is
7427enabled by default at @option{-O3}.
7428
7429@item -ftree-forwprop
7430@opindex ftree-forwprop
7431Perform forward propagation on trees.  This flag is enabled by default
7432at @option{-O} and higher.
7433
7434@item -ftree-fre
7435@opindex ftree-fre
7436Perform full redundancy elimination (FRE) on trees.  The difference
7437between FRE and PRE is that FRE only considers expressions
7438that are computed on all paths leading to the redundant computation.
7439This analysis is faster than PRE, though it exposes fewer redundancies.
7440This flag is enabled by default at @option{-O} and higher.
7441
7442@item -ftree-phiprop
7443@opindex ftree-phiprop
7444Perform hoisting of loads from conditional pointers on trees.  This
7445pass is enabled by default at @option{-O} and higher.
7446
7447@item -fhoist-adjacent-loads
7448@opindex hoist-adjacent-loads
7449Speculatively hoist loads from both branches of an if-then-else if the
7450loads are from adjacent locations in the same structure and the target
7451architecture has a conditional move instruction.  This flag is enabled
7452by default at @option{-O2} and higher.
7453
7454@item -ftree-copy-prop
7455@opindex ftree-copy-prop
7456Perform copy propagation on trees.  This pass eliminates unnecessary
7457copy operations.  This flag is enabled by default at @option{-O} and
7458higher.
7459
7460@item -fipa-pure-const
7461@opindex fipa-pure-const
7462Discover which functions are pure or constant.
7463Enabled by default at @option{-O} and higher.
7464
7465@item -fipa-reference
7466@opindex fipa-reference
7467Discover which static variables do not escape the
7468compilation unit.
7469Enabled by default at @option{-O} and higher.
7470
7471@item -fipa-pta
7472@opindex fipa-pta
7473Perform interprocedural pointer analysis and interprocedural modification
7474and reference analysis.  This option can cause excessive memory and
7475compile-time usage on large compilation units.  It is not enabled by
7476default at any optimization level.
7477
7478@item -fipa-profile
7479@opindex fipa-profile
7480Perform interprocedural profile propagation.  The functions called only from
7481cold functions are marked as cold. Also functions executed once (such as
7482@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7483functions and loop less parts of functions executed once are then optimized for
7484size.
7485Enabled by default at @option{-O} and higher.
7486
7487@item -fipa-cp
7488@opindex fipa-cp
7489Perform interprocedural constant propagation.
7490This optimization analyzes the program to determine when values passed
7491to functions are constants and then optimizes accordingly.
7492This optimization can substantially increase performance
7493if the application has constants passed to functions.
7494This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7495
7496@item -fipa-cp-clone
7497@opindex fipa-cp-clone
7498Perform function cloning to make interprocedural constant propagation stronger.
7499When enabled, interprocedural constant propagation performs function cloning
7500when externally visible function can be called with constant arguments.
7501Because this optimization can create multiple copies of functions,
7502it may significantly increase code size
7503(see @option{--param ipcp-unit-growth=@var{value}}).
7504This flag is enabled by default at @option{-O3}.
7505
7506@item -ftree-sink
7507@opindex ftree-sink
7508Perform forward store motion  on trees.  This flag is
7509enabled by default at @option{-O} and higher.
7510
7511@item -ftree-bit-ccp
7512@opindex ftree-bit-ccp
7513Perform sparse conditional bit constant propagation on trees and propagate
7514pointer alignment information.
7515This pass only operates on local scalar variables and is enabled by default
7516at @option{-O} and higher.  It requires that @option{-ftree-ccp} is enabled.
7517
7518@item -ftree-ccp
7519@opindex ftree-ccp
7520Perform sparse conditional constant propagation (CCP) on trees.  This
7521pass only operates on local scalar variables and is enabled by default
7522at @option{-O} and higher.
7523
7524@item -ftree-switch-conversion
7525Perform conversion of simple initializations in a switch to
7526initializations from a scalar array.  This flag is enabled by default
7527at @option{-O2} and higher.
7528
7529@item -ftree-tail-merge
7530Look for identical code sequences.  When found, replace one with a jump to the
7531other.  This optimization is known as tail merging or cross jumping.  This flag
7532is enabled by default at @option{-O2} and higher.  The compilation time
7533in this pass can
7534be limited using @option{max-tail-merge-comparisons} parameter and
7535@option{max-tail-merge-iterations} parameter.
7536
7537@item -ftree-dce
7538@opindex ftree-dce
7539Perform dead code elimination (DCE) on trees.  This flag is enabled by
7540default at @option{-O} and higher.
7541
7542@item -ftree-builtin-call-dce
7543@opindex ftree-builtin-call-dce
7544Perform conditional dead code elimination (DCE) for calls to built-in functions
7545that may set @code{errno} but are otherwise side-effect free.  This flag is
7546enabled by default at @option{-O2} and higher if @option{-Os} is not also
7547specified.
7548
7549@item -ftree-dominator-opts
7550@opindex ftree-dominator-opts
7551Perform a variety of simple scalar cleanups (constant/copy
7552propagation, redundancy elimination, range propagation and expression
7553simplification) based on a dominator tree traversal.  This also
7554performs jump threading (to reduce jumps to jumps). This flag is
7555enabled by default at @option{-O} and higher.
7556
7557@item -ftree-dse
7558@opindex ftree-dse
7559Perform dead store elimination (DSE) on trees.  A dead store is a store into
7560a memory location that is later overwritten by another store without
7561any intervening loads.  In this case the earlier store can be deleted.  This
7562flag is enabled by default at @option{-O} and higher.
7563
7564@item -ftree-ch
7565@opindex ftree-ch
7566Perform loop header copying on trees.  This is beneficial since it increases
7567effectiveness of code motion optimizations.  It also saves one jump.  This flag
7568is enabled by default at @option{-O} and higher.  It is not enabled
7569for @option{-Os}, since it usually increases code size.
7570
7571@item -ftree-loop-optimize
7572@opindex ftree-loop-optimize
7573Perform loop optimizations on trees.  This flag is enabled by default
7574at @option{-O} and higher.
7575
7576@item -ftree-loop-linear
7577@opindex ftree-loop-linear
7578Perform loop interchange transformations on tree.  Same as
7579@option{-floop-interchange}.  To use this code transformation, GCC has
7580to be configured with @option{--with-ppl} and @option{--with-cloog} to
7581enable the Graphite loop transformation infrastructure.
7582
7583@item -floop-interchange
7584@opindex floop-interchange
7585Perform loop interchange transformations on loops.  Interchanging two
7586nested loops switches the inner and outer loops.  For example, given a
7587loop like:
7588@smallexample
7589DO J = 1, M
7590  DO I = 1, N
7591    A(J, I) = A(J, I) * C
7592  ENDDO
7593ENDDO
7594@end smallexample
7595loop interchange transforms the loop as if it were written:
7596@smallexample
7597DO I = 1, N
7598  DO J = 1, M
7599    A(J, I) = A(J, I) * C
7600  ENDDO
7601ENDDO
7602@end smallexample
7603which can be beneficial when @code{N} is larger than the caches,
7604because in Fortran, the elements of an array are stored in memory
7605contiguously by column, and the original loop iterates over rows,
7606potentially creating at each access a cache miss.  This optimization
7607applies to all the languages supported by GCC and is not limited to
7608Fortran.  To use this code transformation, GCC has to be configured
7609with @option{--with-ppl} and @option{--with-cloog} to enable the
7610Graphite loop transformation infrastructure.
7611
7612@item -floop-strip-mine
7613@opindex floop-strip-mine
7614Perform loop strip mining transformations on loops.  Strip mining
7615splits a loop into two nested loops.  The outer loop has strides
7616equal to the strip size and the inner loop has strides of the
7617original loop within a strip.  The strip length can be changed
7618using the @option{loop-block-tile-size} parameter.  For example,
7619given a loop like:
7620@smallexample
7621DO I = 1, N
7622  A(I) = A(I) + C
7623ENDDO
7624@end smallexample
7625loop strip mining transforms the loop as if it were written:
7626@smallexample
7627DO II = 1, N, 51
7628  DO I = II, min (II + 50, N)
7629    A(I) = A(I) + C
7630  ENDDO
7631ENDDO
7632@end smallexample
7633This optimization applies to all the languages supported by GCC and is
7634not limited to Fortran.  To use this code transformation, GCC has to
7635be configured with @option{--with-ppl} and @option{--with-cloog} to
7636enable the Graphite loop transformation infrastructure.
7637
7638@item -floop-block
7639@opindex floop-block
7640Perform loop blocking transformations on loops.  Blocking strip mines
7641each loop in the loop nest such that the memory accesses of the
7642element loops fit inside caches.  The strip length can be changed
7643using the @option{loop-block-tile-size} parameter.  For example, given
7644a loop like:
7645@smallexample
7646DO I = 1, N
7647  DO J = 1, M
7648    A(J, I) = B(I) + C(J)
7649  ENDDO
7650ENDDO
7651@end smallexample
7652loop blocking transforms the loop as if it were written:
7653@smallexample
7654DO II = 1, N, 51
7655  DO JJ = 1, M, 51
7656    DO I = II, min (II + 50, N)
7657      DO J = JJ, min (JJ + 50, M)
7658        A(J, I) = B(I) + C(J)
7659      ENDDO
7660    ENDDO
7661  ENDDO
7662ENDDO
7663@end smallexample
7664which can be beneficial when @code{M} is larger than the caches,
7665because the innermost loop iterates over a smaller amount of data
7666which can be kept in the caches.  This optimization applies to all the
7667languages supported by GCC and is not limited to Fortran.  To use this
7668code transformation, GCC has to be configured with @option{--with-ppl}
7669and @option{--with-cloog} to enable the Graphite loop transformation
7670infrastructure.
7671
7672@item -fgraphite-identity
7673@opindex fgraphite-identity
7674Enable the identity transformation for graphite.  For every SCoP we generate
7675the polyhedral representation and transform it back to gimple.  Using
7676@option{-fgraphite-identity} we can check the costs or benefits of the
7677GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
7678are also performed by the code generator CLooG, like index splitting and
7679dead code elimination in loops.
7680
7681@item -floop-nest-optimize
7682@opindex floop-nest-optimize
7683Enable the ISL based loop nest optimizer.  This is a generic loop nest
7684optimizer based on the Pluto optimization algorithms.  It calculates a loop
7685structure optimized for data-locality and parallelism.  This option
7686is experimental.
7687
7688@item -floop-parallelize-all
7689@opindex floop-parallelize-all
7690Use the Graphite data dependence analysis to identify loops that can
7691be parallelized.  Parallelize all the loops that can be analyzed to
7692not contain loop carried dependences without checking that it is
7693profitable to parallelize the loops.
7694
7695@item -fcheck-data-deps
7696@opindex fcheck-data-deps
7697Compare the results of several data dependence analyzers.  This option
7698is used for debugging the data dependence analyzers.
7699
7700@item -ftree-loop-if-convert
7701Attempt to transform conditional jumps in the innermost loops to
7702branch-less equivalents.  The intent is to remove control-flow from
7703the innermost loops in order to improve the ability of the
7704vectorization pass to handle these loops.  This is enabled by default
7705if vectorization is enabled.
7706
7707@item -ftree-loop-if-convert-stores
7708Attempt to also if-convert conditional jumps containing memory writes.
7709This transformation can be unsafe for multi-threaded programs as it
7710transforms conditional memory writes into unconditional memory writes.
7711For example,
7712@smallexample
7713for (i = 0; i < N; i++)
7714  if (cond)
7715    A[i] = expr;
7716@end smallexample
7717is transformed to
7718@smallexample
7719for (i = 0; i < N; i++)
7720  A[i] = cond ? expr : A[i];
7721@end smallexample
7722potentially producing data races.
7723
7724@item -ftree-loop-distribution
7725Perform loop distribution.  This flag can improve cache performance on
7726big loop bodies and allow further loop optimizations, like
7727parallelization or vectorization, to take place.  For example, the loop
7728@smallexample
7729DO I = 1, N
7730  A(I) = B(I) + C
7731  D(I) = E(I) * F
7732ENDDO
7733@end smallexample
7734is transformed to
7735@smallexample
7736DO I = 1, N
7737   A(I) = B(I) + C
7738ENDDO
7739DO I = 1, N
7740   D(I) = E(I) * F
7741ENDDO
7742@end smallexample
7743
7744@item -ftree-loop-distribute-patterns
7745Perform loop distribution of patterns that can be code generated with
7746calls to a library.  This flag is enabled by default at @option{-O3}.
7747
7748This pass distributes the initialization loops and generates a call to
7749memset zero.  For example, the loop
7750@smallexample
7751DO I = 1, N
7752  A(I) = 0
7753  B(I) = A(I) + I
7754ENDDO
7755@end smallexample
7756is transformed to
7757@smallexample
7758DO I = 1, N
7759   A(I) = 0
7760ENDDO
7761DO I = 1, N
7762   B(I) = A(I) + I
7763ENDDO
7764@end smallexample
7765and the initialization loop is transformed into a call to memset zero.
7766
7767@item -ftree-loop-im
7768@opindex ftree-loop-im
7769Perform loop invariant motion on trees.  This pass moves only invariants that
7770are hard to handle at RTL level (function calls, operations that expand to
7771nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
7772operands of conditions that are invariant out of the loop, so that we can use
7773just trivial invariantness analysis in loop unswitching.  The pass also includes
7774store motion.
7775
7776@item -ftree-loop-ivcanon
7777@opindex ftree-loop-ivcanon
7778Create a canonical counter for number of iterations in loops for which
7779determining number of iterations requires complicated analysis.  Later
7780optimizations then may determine the number easily.  Useful especially
7781in connection with unrolling.
7782
7783@item -fivopts
7784@opindex fivopts
7785Perform induction variable optimizations (strength reduction, induction
7786variable merging and induction variable elimination) on trees.
7787
7788@item -ftree-parallelize-loops=n
7789@opindex ftree-parallelize-loops
7790Parallelize loops, i.e., split their iteration space to run in n threads.
7791This is only possible for loops whose iterations are independent
7792and can be arbitrarily reordered.  The optimization is only
7793profitable on multiprocessor machines, for loops that are CPU-intensive,
7794rather than constrained e.g.@: by memory bandwidth.  This option
7795implies @option{-pthread}, and thus is only supported on targets
7796that have support for @option{-pthread}.
7797
7798@item -ftree-pta
7799@opindex ftree-pta
7800Perform function-local points-to analysis on trees.  This flag is
7801enabled by default at @option{-O} and higher.
7802
7803@item -ftree-sra
7804@opindex ftree-sra
7805Perform scalar replacement of aggregates.  This pass replaces structure
7806references with scalars to prevent committing structures to memory too
7807early.  This flag is enabled by default at @option{-O} and higher.
7808
7809@item -ftree-copyrename
7810@opindex ftree-copyrename
7811Perform copy renaming on trees.  This pass attempts to rename compiler
7812temporaries to other variables at copy locations, usually resulting in
7813variable names which more closely resemble the original variables.  This flag
7814is enabled by default at @option{-O} and higher.
7815
7816@item -ftree-coalesce-inlined-vars
7817Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to
7818combine small user-defined variables too, but only if they were inlined
7819from other functions.  It is a more limited form of
7820@option{-ftree-coalesce-vars}.  This may harm debug information of such
7821inlined variables, but it will keep variables of the inlined-into
7822function apart from each other, such that they are more likely to
7823contain the expected values in a debugging session.  This was the
7824default in GCC versions older than 4.7.
7825
7826@item -ftree-coalesce-vars
7827Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to
7828combine small user-defined variables too, instead of just compiler
7829temporaries.  This may severely limit the ability to debug an optimized
7830program compiled with @option{-fno-var-tracking-assignments}.  In the
7831negated form, this flag prevents SSA coalescing of user variables,
7832including inlined ones.  This option is enabled by default.
7833
7834@item -ftree-ter
7835@opindex ftree-ter
7836Perform temporary expression replacement during the SSA->normal phase.  Single
7837use/single def temporaries are replaced at their use location with their
7838defining expression.  This results in non-GIMPLE code, but gives the expanders
7839much more complex trees to work on resulting in better RTL generation.  This is
7840enabled by default at @option{-O} and higher.
7841
7842@item -ftree-slsr
7843@opindex ftree-slsr
7844Perform straight-line strength reduction on trees.  This recognizes related
7845expressions involving multiplications and replaces them by less expensive
7846calculations when possible.  This is enabled by default at @option{-O} and
7847higher.
7848
7849@item -ftree-vectorize
7850@opindex ftree-vectorize
7851Perform loop vectorization on trees. This flag is enabled by default at
7852@option{-O3}.
7853
7854@item -ftree-slp-vectorize
7855@opindex ftree-slp-vectorize
7856Perform basic block vectorization on trees. This flag is enabled by default at
7857@option{-O3} and when @option{-ftree-vectorize} is enabled.
7858
7859@item -ftree-vect-loop-version
7860@opindex ftree-vect-loop-version
7861Perform loop versioning when doing loop vectorization on trees.  When a loop
7862appears to be vectorizable except that data alignment or data dependence cannot
7863be determined at compile time, then vectorized and non-vectorized versions of
7864the loop are generated along with run-time checks for alignment or dependence
7865to control which version is executed.  This option is enabled by default
7866except at level @option{-Os} where it is disabled.
7867
7868@item -fvect-cost-model
7869@opindex fvect-cost-model
7870Enable cost model for vectorization.  This option is enabled by default at
7871@option{-O3}.
7872
7873@item -ftree-vrp
7874@opindex ftree-vrp
7875Perform Value Range Propagation on trees.  This is similar to the
7876constant propagation pass, but instead of values, ranges of values are
7877propagated.  This allows the optimizers to remove unnecessary range
7878checks like array bound checks and null pointer checks.  This is
7879enabled by default at @option{-O2} and higher.  Null pointer check
7880elimination is only done if @option{-fdelete-null-pointer-checks} is
7881enabled.
7882
7883@item -ftracer
7884@opindex ftracer
7885Perform tail duplication to enlarge superblock size.  This transformation
7886simplifies the control flow of the function allowing other optimizations to do
7887a better job.
7888
7889@item -funroll-loops
7890@opindex funroll-loops
7891Unroll loops whose number of iterations can be determined at compile
7892time or upon entry to the loop.  @option{-funroll-loops} implies
7893@option{-frerun-cse-after-loop}.  This option makes code larger,
7894and may or may not make it run faster.
7895
7896@item -funroll-all-loops
7897@opindex funroll-all-loops
7898Unroll all loops, even if their number of iterations is uncertain when
7899the loop is entered.  This usually makes programs run more slowly.
7900@option{-funroll-all-loops} implies the same options as
7901@option{-funroll-loops},
7902
7903@item -fsplit-ivs-in-unroller
7904@opindex fsplit-ivs-in-unroller
7905Enables expression of values of induction variables in later iterations
7906of the unrolled loop using the value in the first iteration.  This breaks
7907long dependency chains, thus improving efficiency of the scheduling passes.
7908
7909A combination of @option{-fweb} and CSE is often sufficient to obtain the
7910same effect.  However, that is not reliable in cases where the loop body
7911is more complicated than a single basic block.  It also does not work at all
7912on some architectures due to restrictions in the CSE pass.
7913
7914This optimization is enabled by default.
7915
7916@item -fvariable-expansion-in-unroller
7917@opindex fvariable-expansion-in-unroller
7918With this option, the compiler creates multiple copies of some
7919local variables when unrolling a loop, which can result in superior code.
7920
7921@item -fpartial-inlining
7922@opindex fpartial-inlining
7923Inline parts of functions.  This option has any effect only
7924when inlining itself is turned on by the @option{-finline-functions}
7925or @option{-finline-small-functions} options.
7926
7927Enabled at level @option{-O2}.
7928
7929@item -fpredictive-commoning
7930@opindex fpredictive-commoning
7931Perform predictive commoning optimization, i.e., reusing computations
7932(especially memory loads and stores) performed in previous
7933iterations of loops.
7934
7935This option is enabled at level @option{-O3}.
7936
7937@item -fprefetch-loop-arrays
7938@opindex fprefetch-loop-arrays
7939If supported by the target machine, generate instructions to prefetch
7940memory to improve the performance of loops that access large arrays.
7941
7942This option may generate better or worse code; results are highly
7943dependent on the structure of loops within the source code.
7944
7945Disabled at level @option{-Os}.
7946
7947@item -fno-peephole
7948@itemx -fno-peephole2
7949@opindex fno-peephole
7950@opindex fno-peephole2
7951Disable any machine-specific peephole optimizations.  The difference
7952between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
7953are implemented in the compiler; some targets use one, some use the
7954other, a few use both.
7955
7956@option{-fpeephole} is enabled by default.
7957@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7958
7959@item -fno-guess-branch-probability
7960@opindex fno-guess-branch-probability
7961Do not guess branch probabilities using heuristics.
7962
7963GCC uses heuristics to guess branch probabilities if they are
7964not provided by profiling feedback (@option{-fprofile-arcs}).  These
7965heuristics are based on the control flow graph.  If some branch probabilities
7966are specified by @samp{__builtin_expect}, then the heuristics are
7967used to guess branch probabilities for the rest of the control flow graph,
7968taking the @samp{__builtin_expect} info into account.  The interactions
7969between the heuristics and @samp{__builtin_expect} can be complex, and in
7970some cases, it may be useful to disable the heuristics so that the effects
7971of @samp{__builtin_expect} are easier to understand.
7972
7973The default is @option{-fguess-branch-probability} at levels
7974@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7975
7976@item -freorder-blocks
7977@opindex freorder-blocks
7978Reorder basic blocks in the compiled function in order to reduce number of
7979taken branches and improve code locality.
7980
7981Enabled at levels @option{-O2}, @option{-O3}.
7982
7983@item -freorder-blocks-and-partition
7984@opindex freorder-blocks-and-partition
7985In addition to reordering basic blocks in the compiled function, in order
7986to reduce number of taken branches, partitions hot and cold basic blocks
7987into separate sections of the assembly and .o files, to improve
7988paging and cache locality performance.
7989
7990This optimization is automatically turned off in the presence of
7991exception handling, for linkonce sections, for functions with a user-defined
7992section attribute and on any architecture that does not support named
7993sections.
7994
7995@item -freorder-functions
7996@opindex freorder-functions
7997Reorder functions in the object file in order to
7998improve code locality.  This is implemented by using special
7999subsections @code{.text.hot} for most frequently executed functions and
8000@code{.text.unlikely} for unlikely executed functions.  Reordering is done by
8001the linker so object file format must support named sections and linker must
8002place them in a reasonable way.
8003
8004Also profile feedback must be available to make this option effective.  See
8005@option{-fprofile-arcs} for details.
8006
8007Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8008
8009@item -fstrict-aliasing
8010@opindex fstrict-aliasing
8011Allow the compiler to assume the strictest aliasing rules applicable to
8012the language being compiled.  For C (and C++), this activates
8013optimizations based on the type of expressions.  In particular, an
8014object of one type is assumed never to reside at the same address as an
8015object of a different type, unless the types are almost the same.  For
8016example, an @code{unsigned int} can alias an @code{int}, but not a
8017@code{void*} or a @code{double}.  A character type may alias any other
8018type.
8019
8020@anchor{Type-punning}Pay special attention to code like this:
8021@smallexample
8022union a_union @{
8023  int i;
8024  double d;
8025@};
8026
8027int f() @{
8028  union a_union t;
8029  t.d = 3.0;
8030  return t.i;
8031@}
8032@end smallexample
8033The practice of reading from a different union member than the one most
8034recently written to (called ``type-punning'') is common.  Even with
8035@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
8036is accessed through the union type.  So, the code above works as
8037expected.  @xref{Structures unions enumerations and bit-fields
8038implementation}.  However, this code might not:
8039@smallexample
8040int f() @{
8041  union a_union t;
8042  int* ip;
8043  t.d = 3.0;
8044  ip = &t.i;
8045  return *ip;
8046@}
8047@end smallexample
8048
8049Similarly, access by taking the address, casting the resulting pointer
8050and dereferencing the result has undefined behavior, even if the cast
8051uses a union type, e.g.:
8052@smallexample
8053int f() @{
8054  double d = 3.0;
8055  return ((union a_union *) &d)->i;
8056@}
8057@end smallexample
8058
8059The @option{-fstrict-aliasing} option is enabled at levels
8060@option{-O2}, @option{-O3}, @option{-Os}.
8061
8062@item -fstrict-overflow
8063@opindex fstrict-overflow
8064Allow the compiler to assume strict signed overflow rules, depending
8065on the language being compiled.  For C (and C++) this means that
8066overflow when doing arithmetic with signed numbers is undefined, which
8067means that the compiler may assume that it does not happen.  This
8068permits various optimizations.  For example, the compiler assumes
8069that an expression like @code{i + 10 > i} is always true for
8070signed @code{i}.  This assumption is only valid if signed overflow is
8071undefined, as the expression is false if @code{i + 10} overflows when
8072using twos complement arithmetic.  When this option is in effect any
8073attempt to determine whether an operation on signed numbers
8074overflows must be written carefully to not actually involve overflow.
8075
8076This option also allows the compiler to assume strict pointer
8077semantics: given a pointer to an object, if adding an offset to that
8078pointer does not produce a pointer to the same object, the addition is
8079undefined.  This permits the compiler to conclude that @code{p + u >
8080p} is always true for a pointer @code{p} and unsigned integer
8081@code{u}.  This assumption is only valid because pointer wraparound is
8082undefined, as the expression is false if @code{p + u} overflows using
8083twos complement arithmetic.
8084
8085See also the @option{-fwrapv} option.  Using @option{-fwrapv} means
8086that integer signed overflow is fully defined: it wraps.  When
8087@option{-fwrapv} is used, there is no difference between
8088@option{-fstrict-overflow} and @option{-fno-strict-overflow} for
8089integers.  With @option{-fwrapv} certain types of overflow are
8090permitted.  For example, if the compiler gets an overflow when doing
8091arithmetic on constants, the overflowed value can still be used with
8092@option{-fwrapv}, but not otherwise.
8093
8094The @option{-fstrict-overflow} option is enabled at levels
8095@option{-O2}, @option{-O3}, @option{-Os}.
8096
8097@item -falign-functions
8098@itemx -falign-functions=@var{n}
8099@opindex falign-functions
8100Align the start of functions to the next power-of-two greater than
8101@var{n}, skipping up to @var{n} bytes.  For instance,
8102@option{-falign-functions=32} aligns functions to the next 32-byte
8103boundary, but @option{-falign-functions=24} aligns to the next
810432-byte boundary only if this can be done by skipping 23 bytes or less.
8105
8106@option{-fno-align-functions} and @option{-falign-functions=1} are
8107equivalent and mean that functions are not aligned.
8108
8109Some assemblers only support this flag when @var{n} is a power of two;
8110in that case, it is rounded up.
8111
8112If @var{n} is not specified or is zero, use a machine-dependent default.
8113
8114Enabled at levels @option{-O2}, @option{-O3}.
8115
8116@item -falign-labels
8117@itemx -falign-labels=@var{n}
8118@opindex falign-labels
8119Align all branch targets to a power-of-two boundary, skipping up to
8120@var{n} bytes like @option{-falign-functions}.  This option can easily
8121make code slower, because it must insert dummy operations for when the
8122branch target is reached in the usual flow of the code.
8123
8124@option{-fno-align-labels} and @option{-falign-labels=1} are
8125equivalent and mean that labels are not aligned.
8126
8127If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8128are greater than this value, then their values are used instead.
8129
8130If @var{n} is not specified or is zero, use a machine-dependent default
8131which is very likely to be @samp{1}, meaning no alignment.
8132
8133Enabled at levels @option{-O2}, @option{-O3}.
8134
8135@item -falign-loops
8136@itemx -falign-loops=@var{n}
8137@opindex falign-loops
8138Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8139like @option{-falign-functions}.  If the loops are
8140executed many times, this makes up for any execution of the dummy
8141operations.
8142
8143@option{-fno-align-loops} and @option{-falign-loops=1} are
8144equivalent and mean that loops are not aligned.
8145
8146If @var{n} is not specified or is zero, use a machine-dependent default.
8147
8148Enabled at levels @option{-O2}, @option{-O3}.
8149
8150@item -falign-jumps
8151@itemx -falign-jumps=@var{n}
8152@opindex falign-jumps
8153Align branch targets to a power-of-two boundary, for branch targets
8154where the targets can only be reached by jumping, skipping up to @var{n}
8155bytes like @option{-falign-functions}.  In this case, no dummy operations
8156need be executed.
8157
8158@option{-fno-align-jumps} and @option{-falign-jumps=1} are
8159equivalent and mean that loops are not aligned.
8160
8161If @var{n} is not specified or is zero, use a machine-dependent default.
8162
8163Enabled at levels @option{-O2}, @option{-O3}.
8164
8165@item -funit-at-a-time
8166@opindex funit-at-a-time
8167This option is left for compatibility reasons. @option{-funit-at-a-time}
8168has no effect, while @option{-fno-unit-at-a-time} implies
8169@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8170
8171Enabled by default.
8172
8173@item -fno-toplevel-reorder
8174@opindex fno-toplevel-reorder
8175Do not reorder top-level functions, variables, and @code{asm}
8176statements.  Output them in the same order that they appear in the
8177input file.  When this option is used, unreferenced static variables
8178are not removed.  This option is intended to support existing code
8179that relies on a particular ordering.  For new code, it is better to
8180use attributes.
8181
8182Enabled at level @option{-O0}.  When disabled explicitly, it also implies
8183@option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8184targets.
8185
8186@item -fweb
8187@opindex fweb
8188Constructs webs as commonly used for register allocation purposes and assign
8189each web individual pseudo register.  This allows the register allocation pass
8190to operate on pseudos directly, but also strengthens several other optimization
8191passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
8192however, make debugging impossible, since variables no longer stay in a
8193``home register''.
8194
8195Enabled by default with @option{-funroll-loops}.
8196
8197@item -fwhole-program
8198@opindex fwhole-program
8199Assume that the current compilation unit represents the whole program being
8200compiled.  All public functions and variables with the exception of @code{main}
8201and those merged by attribute @code{externally_visible} become static functions
8202and in effect are optimized more aggressively by interprocedural optimizers.
8203
8204This option should not be used in combination with @code{-flto}.
8205Instead relying on a linker plugin should provide safer and more precise
8206information.
8207
8208@item -flto[=@var{n}]
8209@opindex flto
8210This option runs the standard link-time optimizer.  When invoked
8211with source code, it generates GIMPLE (one of GCC's internal
8212representations) and writes it to special ELF sections in the object
8213file.  When the object files are linked together, all the function
8214bodies are read from these ELF sections and instantiated as if they
8215had been part of the same translation unit.
8216
8217To use the link-time optimizer, @option{-flto} needs to be specified at
8218compile time and during the final link.  For example:
8219
8220@smallexample
8221gcc -c -O2 -flto foo.c
8222gcc -c -O2 -flto bar.c
8223gcc -o myprog -flto -O2 foo.o bar.o
8224@end smallexample
8225
8226The first two invocations to GCC save a bytecode representation
8227of GIMPLE into special ELF sections inside @file{foo.o} and
8228@file{bar.o}.  The final invocation reads the GIMPLE bytecode from
8229@file{foo.o} and @file{bar.o}, merges the two files into a single
8230internal image, and compiles the result as usual.  Since both
8231@file{foo.o} and @file{bar.o} are merged into a single image, this
8232causes all the interprocedural analyses and optimizations in GCC to
8233work across the two files as if they were a single one.  This means,
8234for example, that the inliner is able to inline functions in
8235@file{bar.o} into functions in @file{foo.o} and vice-versa.
8236
8237Another (simpler) way to enable link-time optimization is:
8238
8239@smallexample
8240gcc -o myprog -flto -O2 foo.c bar.c
8241@end smallexample
8242
8243The above generates bytecode for @file{foo.c} and @file{bar.c},
8244merges them together into a single GIMPLE representation and optimizes
8245them as usual to produce @file{myprog}.
8246
8247The only important thing to keep in mind is that to enable link-time
8248optimizations the @option{-flto} flag needs to be passed to both the
8249compile and the link commands.
8250
8251To make whole program optimization effective, it is necessary to make
8252certain whole program assumptions.  The compiler needs to know
8253what functions and variables can be accessed by libraries and runtime
8254outside of the link-time optimized unit.  When supported by the linker,
8255the linker plugin (see @option{-fuse-linker-plugin}) passes information
8256to the compiler about used and externally visible symbols.  When
8257the linker plugin is not available, @option{-fwhole-program} should be
8258used to allow the compiler to make these assumptions, which leads
8259to more aggressive optimization decisions.
8260
8261Note that when a file is compiled with @option{-flto}, the generated
8262object file is larger than a regular object file because it
8263contains GIMPLE bytecodes and the usual final code.  This means that
8264object files with LTO information can be linked as normal object
8265files; if @option{-flto} is not passed to the linker, no
8266interprocedural optimizations are applied.
8267
8268Additionally, the optimization flags used to compile individual files
8269are not necessarily related to those used at link time.  For instance,
8270
8271@smallexample
8272gcc -c -O0 -flto foo.c
8273gcc -c -O0 -flto bar.c
8274gcc -o myprog -flto -O3 foo.o bar.o
8275@end smallexample
8276
8277This produces individual object files with unoptimized assembler
8278code, but the resulting binary @file{myprog} is optimized at
8279@option{-O3}.  If, instead, the final binary is generated without
8280@option{-flto}, then @file{myprog} is not optimized.
8281
8282When producing the final binary with @option{-flto}, GCC only
8283applies link-time optimizations to those files that contain bytecode.
8284Therefore, you can mix and match object files and libraries with
8285GIMPLE bytecodes and final object code.  GCC automatically selects
8286which files to optimize in LTO mode and which files to link without
8287further processing.
8288
8289There are some code generation flags preserved by GCC when
8290generating bytecodes, as they need to be used during the final link
8291stage.  Currently, the following options are saved into the GIMPLE
8292bytecode files: @option{-fPIC}, @option{-fcommon} and all the
8293@option{-m} target flags.
8294
8295At link time, these options are read in and reapplied.  Note that the
8296current implementation makes no attempt to recognize conflicting
8297values for these options.  If different files have conflicting option
8298values (e.g., one file is compiled with @option{-fPIC} and another
8299isn't), the compiler simply uses the last value read from the
8300bytecode files.  It is recommended, then, that you compile all the files
8301participating in the same link with the same options.
8302
8303If LTO encounters objects with C linkage declared with incompatible
8304types in separate translation units to be linked together (undefined
8305behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8306issued.  The behavior is still undefined at run time.
8307
8308Another feature of LTO is that it is possible to apply interprocedural
8309optimizations on files written in different languages.  This requires
8310support in the language front end.  Currently, the C, C++ and
8311Fortran front ends are capable of emitting GIMPLE bytecodes, so
8312something like this should work:
8313
8314@smallexample
8315gcc -c -flto foo.c
8316g++ -c -flto bar.cc
8317gfortran -c -flto baz.f90
8318g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8319@end smallexample
8320
8321Notice that the final link is done with @command{g++} to get the C++
8322runtime libraries and @option{-lgfortran} is added to get the Fortran
8323runtime libraries.  In general, when mixing languages in LTO mode, you
8324should use the same link command options as when mixing languages in a
8325regular (non-LTO) compilation; all you need to add is @option{-flto} to
8326all the compile and link commands.
8327
8328If object files containing GIMPLE bytecode are stored in a library archive, say
8329@file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8330are using a linker with plugin support.  To enable this feature, use
8331the flag @option{-fuse-linker-plugin} at link time:
8332
8333@smallexample
8334gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8335@end smallexample
8336
8337With the linker plugin enabled, the linker extracts the needed
8338GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8339to make them part of the aggregated GIMPLE image to be optimized.
8340
8341If you are not using a linker with plugin support and/or do not
8342enable the linker plugin, then the objects inside @file{libfoo.a}
8343are extracted and linked as usual, but they do not participate
8344in the LTO optimization process.
8345
8346Link-time optimizations do not require the presence of the whole program to
8347operate.  If the program does not require any symbols to be exported, it is
8348possible to combine @option{-flto} and @option{-fwhole-program} to allow
8349the interprocedural optimizers to use more aggressive assumptions which may
8350lead to improved optimization opportunities.
8351Use of @option{-fwhole-program} is not needed when linker plugin is
8352active (see @option{-fuse-linker-plugin}).
8353
8354The current implementation of LTO makes no
8355attempt to generate bytecode that is portable between different
8356types of hosts.  The bytecode files are versioned and there is a
8357strict version check, so bytecode files generated in one version of
8358GCC will not work with an older/newer version of GCC@.
8359
8360Link-time optimization does not work well with generation of debugging
8361information.  Combining @option{-flto} with
8362@option{-g} is currently experimental and expected to produce wrong
8363results.
8364
8365If you specify the optional @var{n}, the optimization and code
8366generation done at link time is executed in parallel using @var{n}
8367parallel jobs by utilizing an installed @command{make} program.  The
8368environment variable @env{MAKE} may be used to override the program
8369used.  The default value for @var{n} is 1.
8370
8371You can also specify @option{-flto=jobserver} to use GNU make's
8372job server mode to determine the number of parallel jobs. This
8373is useful when the Makefile calling GCC is already executing in parallel.
8374You must prepend a @samp{+} to the command recipe in the parent Makefile
8375for this to work.  This option likely only works if @env{MAKE} is
8376GNU make.
8377
8378This option is disabled by default.
8379
8380@item -flto-partition=@var{alg}
8381@opindex flto-partition
8382Specify the partitioning algorithm used by the link-time optimizer.
8383The value is either @code{1to1} to specify a partitioning mirroring
8384the original source files or @code{balanced} to specify partitioning
8385into equally sized chunks (whenever possible) or @code{max} to create
8386new partition for every symbol where possible.  Specifying @code{none}
8387as an algorithm disables partitioning and streaming completely.
8388The default value is @code{balanced}. While @code{1to1} can be used
8389as an workaround for various code ordering issues, the @code{max}
8390partitioning is intended for internal testing only.
8391
8392@item -flto-compression-level=@var{n}
8393This option specifies the level of compression used for intermediate
8394language written to LTO object files, and is only meaningful in
8395conjunction with LTO mode (@option{-flto}).  Valid
8396values are 0 (no compression) to 9 (maximum compression).  Values
8397outside this range are clamped to either 0 or 9.  If the option is not
8398given, a default balanced compression setting is used.
8399
8400@item -flto-report
8401Prints a report with internal details on the workings of the link-time
8402optimizer.  The contents of this report vary from version to version.
8403It is meant to be useful to GCC developers when processing object
8404files in LTO mode (via @option{-flto}).
8405
8406Disabled by default.
8407
8408@item -fuse-linker-plugin
8409Enables the use of a linker plugin during link-time optimization.  This
8410option relies on plugin support in the linker, which is available in gold
8411or in GNU ld 2.21 or newer.
8412
8413This option enables the extraction of object files with GIMPLE bytecode out
8414of library archives. This improves the quality of optimization by exposing
8415more code to the link-time optimizer.  This information specifies what
8416symbols can be accessed externally (by non-LTO object or during dynamic
8417linking).  Resulting code quality improvements on binaries (and shared
8418libraries that use hidden visibility) are similar to @code{-fwhole-program}.
8419See @option{-flto} for a description of the effect of this flag and how to
8420use it.
8421
8422This option is enabled by default when LTO support in GCC is enabled
8423and GCC was configured for use with
8424a linker supporting plugins (GNU ld 2.21 or newer or gold).
8425
8426@item -ffat-lto-objects
8427@opindex ffat-lto-objects
8428Fat LTO objects are object files that contain both the intermediate language
8429and the object code. This makes them usable for both LTO linking and normal
8430linking. This option is effective only when compiling with @option{-flto}
8431and is ignored at link time.
8432
8433@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8434requires the complete toolchain to be aware of LTO. It requires a linker with
8435linker plugin support for basic functionality.  Additionally,
8436@command{nm}, @command{ar} and @command{ranlib}
8437need to support linker plugins to allow a full-featured build environment
8438(capable of building static libraries etc).  GCC provides the @command{gcc-ar},
8439@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8440to these tools. With non fat LTO makefiles need to be modified to use them.
8441
8442The default is @option{-ffat-lto-objects} but this default is intended to
8443change in future releases when linker plugin enabled environments become more
8444common.
8445
8446@item -fcompare-elim
8447@opindex fcompare-elim
8448After register allocation and post-register allocation instruction splitting,
8449identify arithmetic instructions that compute processor flags similar to a
8450comparison operation based on that arithmetic.  If possible, eliminate the
8451explicit comparison operation.
8452
8453This pass only applies to certain targets that cannot explicitly represent
8454the comparison operation before register allocation is complete.
8455
8456Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8457
8458@item -fuse-ld=bfd
8459Use the @command{bfd} linker instead of the default linker.
8460
8461@item -fuse-ld=gold
8462Use the @command{gold} linker instead of the default linker.
8463
8464@item -fcprop-registers
8465@opindex fcprop-registers
8466After register allocation and post-register allocation instruction splitting,
8467perform a copy-propagation pass to try to reduce scheduling dependencies
8468and occasionally eliminate the copy.
8469
8470Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8471
8472@item -fprofile-correction
8473@opindex fprofile-correction
8474Profiles collected using an instrumented binary for multi-threaded programs may
8475be inconsistent due to missed counter updates. When this option is specified,
8476GCC uses heuristics to correct or smooth out such inconsistencies. By
8477default, GCC emits an error message when an inconsistent profile is detected.
8478
8479@item -fprofile-dir=@var{path}
8480@opindex fprofile-dir
8481
8482Set the directory to search for the profile data files in to @var{path}.
8483This option affects only the profile data generated by
8484@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
8485and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
8486and its related options.  Both absolute and relative paths can be used.
8487By default, GCC uses the current directory as @var{path}, thus the
8488profile data file appears in the same directory as the object file.
8489
8490@item -fprofile-generate
8491@itemx -fprofile-generate=@var{path}
8492@opindex fprofile-generate
8493
8494Enable options usually used for instrumenting application to produce
8495profile useful for later recompilation with profile feedback based
8496optimization.  You must use @option{-fprofile-generate} both when
8497compiling and when linking your program.
8498
8499The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
8500
8501If @var{path} is specified, GCC looks at the @var{path} to find
8502the profile feedback data files. See @option{-fprofile-dir}.
8503
8504@item -fprofile-use
8505@itemx -fprofile-use=@var{path}
8506@opindex fprofile-use
8507Enable profile feedback directed optimizations, and optimizations
8508generally profitable only with profile feedback available.
8509
8510The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
8511@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}, @code{-ftree-vectorize},
8512@code{ftree-loop-distribute-patterns}
8513
8514By default, GCC emits an error message if the feedback profiles do not
8515match the source code.  This error can be turned into a warning by using
8516@option{-Wcoverage-mismatch}.  Note this may result in poorly optimized
8517code.
8518
8519If @var{path} is specified, GCC looks at the @var{path} to find
8520the profile feedback data files. See @option{-fprofile-dir}.
8521@end table
8522
8523The following options control compiler behavior regarding floating-point
8524arithmetic.  These options trade off between speed and
8525correctness.  All must be specifically enabled.
8526
8527@table @gcctabopt
8528@item -ffloat-store
8529@opindex ffloat-store
8530Do not store floating-point variables in registers, and inhibit other
8531options that might change whether a floating-point value is taken from a
8532register or memory.
8533
8534@cindex floating-point precision
8535This option prevents undesirable excess precision on machines such as
8536the 68000 where the floating registers (of the 68881) keep more
8537precision than a @code{double} is supposed to have.  Similarly for the
8538x86 architecture.  For most programs, the excess precision does only
8539good, but a few programs rely on the precise definition of IEEE floating
8540point.  Use @option{-ffloat-store} for such programs, after modifying
8541them to store all pertinent intermediate computations into variables.
8542
8543@item -fexcess-precision=@var{style}
8544@opindex fexcess-precision
8545This option allows further control over excess precision on machines
8546where floating-point registers have more precision than the IEEE
8547@code{float} and @code{double} types and the processor does not
8548support operations rounding to those types.  By default,
8549@option{-fexcess-precision=fast} is in effect; this means that
8550operations are carried out in the precision of the registers and that
8551it is unpredictable when rounding to the types specified in the source
8552code takes place.  When compiling C, if
8553@option{-fexcess-precision=standard} is specified then excess
8554precision follows the rules specified in ISO C99; in particular,
8555both casts and assignments cause values to be rounded to their
8556semantic types (whereas @option{-ffloat-store} only affects
8557assignments).  This option is enabled by default for C if a strict
8558conformance option such as @option{-std=c99} is used.
8559
8560@opindex mfpmath
8561@option{-fexcess-precision=standard} is not implemented for languages
8562other than C, and has no effect if
8563@option{-funsafe-math-optimizations} or @option{-ffast-math} is
8564specified.  On the x86, it also has no effect if @option{-mfpmath=sse}
8565or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8566semantics apply without excess precision, and in the latter, rounding
8567is unpredictable.
8568
8569@item -ffast-math
8570@opindex ffast-math
8571Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8572@option{-ffinite-math-only}, @option{-fno-rounding-math},
8573@option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8574
8575This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8576
8577This option is not turned on by any @option{-O} option besides
8578@option{-Ofast} since it can result in incorrect output for programs
8579that depend on an exact implementation of IEEE or ISO rules/specifications
8580for math functions. It may, however, yield faster code for programs
8581that do not require the guarantees of these specifications.
8582
8583@item -fno-math-errno
8584@opindex fno-math-errno
8585Do not set @code{errno} after calling math functions that are executed
8586with a single instruction, e.g., @code{sqrt}.  A program that relies on
8587IEEE exceptions for math error handling may want to use this flag
8588for speed while maintaining IEEE arithmetic compatibility.
8589
8590This option is not turned on by any @option{-O} option since
8591it can result in incorrect output for programs that depend on
8592an exact implementation of IEEE or ISO rules/specifications for
8593math functions. It may, however, yield faster code for programs
8594that do not require the guarantees of these specifications.
8595
8596The default is @option{-fmath-errno}.
8597
8598On Darwin systems, the math library never sets @code{errno}.  There is
8599therefore no reason for the compiler to consider the possibility that
8600it might, and @option{-fno-math-errno} is the default.
8601
8602@item -funsafe-math-optimizations
8603@opindex funsafe-math-optimizations
8604
8605Allow optimizations for floating-point arithmetic that (a) assume
8606that arguments and results are valid and (b) may violate IEEE or
8607ANSI standards.  When used at link-time, it may include libraries
8608or startup files that change the default FPU control word or other
8609similar optimizations.
8610
8611This option is not turned on by any @option{-O} option since
8612it can result in incorrect output for programs that depend on
8613an exact implementation of IEEE or ISO rules/specifications for
8614math functions. It may, however, yield faster code for programs
8615that do not require the guarantees of these specifications.
8616Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
8617@option{-fassociative-math} and @option{-freciprocal-math}.
8618
8619The default is @option{-fno-unsafe-math-optimizations}.
8620
8621@item -fassociative-math
8622@opindex fassociative-math
8623
8624Allow re-association of operands in series of floating-point operations.
8625This violates the ISO C and C++ language standard by possibly changing
8626computation result.  NOTE: re-ordering may change the sign of zero as
8627well as ignore NaNs and inhibit or create underflow or overflow (and
8628thus cannot be used on code that relies on rounding behavior like
8629@code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
8630and thus may not be used when ordered comparisons are required.
8631This option requires that both @option{-fno-signed-zeros} and
8632@option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
8633much sense with @option{-frounding-math}. For Fortran the option
8634is automatically enabled when both @option{-fno-signed-zeros} and
8635@option{-fno-trapping-math} are in effect.
8636
8637The default is @option{-fno-associative-math}.
8638
8639@item -freciprocal-math
8640@opindex freciprocal-math
8641
8642Allow the reciprocal of a value to be used instead of dividing by
8643the value if this enables optimizations.  For example @code{x / y}
8644can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
8645is subject to common subexpression elimination.  Note that this loses
8646precision and increases the number of flops operating on the value.
8647
8648The default is @option{-fno-reciprocal-math}.
8649
8650@item -ffinite-math-only
8651@opindex ffinite-math-only
8652Allow optimizations for floating-point arithmetic that assume
8653that arguments and results are not NaNs or +-Infs.
8654
8655This option is not turned on by any @option{-O} option since
8656it can result in incorrect output for programs that depend on
8657an exact implementation of IEEE or ISO rules/specifications for
8658math functions. It may, however, yield faster code for programs
8659that do not require the guarantees of these specifications.
8660
8661The default is @option{-fno-finite-math-only}.
8662
8663@item -fno-signed-zeros
8664@opindex fno-signed-zeros
8665Allow optimizations for floating-point arithmetic that ignore the
8666signedness of zero.  IEEE arithmetic specifies the behavior of
8667distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
8668of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
8669This option implies that the sign of a zero result isn't significant.
8670
8671The default is @option{-fsigned-zeros}.
8672
8673@item -fno-trapping-math
8674@opindex fno-trapping-math
8675Compile code assuming that floating-point operations cannot generate
8676user-visible traps.  These traps include division by zero, overflow,
8677underflow, inexact result and invalid operation.  This option requires
8678that @option{-fno-signaling-nans} be in effect.  Setting this option may
8679allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
8680
8681This option should never be turned on by any @option{-O} option since
8682it can result in incorrect output for programs that depend on
8683an exact implementation of IEEE or ISO rules/specifications for
8684math functions.
8685
8686The default is @option{-ftrapping-math}.
8687
8688@item -frounding-math
8689@opindex frounding-math
8690Disable transformations and optimizations that assume default floating-point
8691rounding behavior.  This is round-to-zero for all floating point
8692to integer conversions, and round-to-nearest for all other arithmetic
8693truncations.  This option should be specified for programs that change
8694the FP rounding mode dynamically, or that may be executed with a
8695non-default rounding mode.  This option disables constant folding of
8696floating-point expressions at compile time (which may be affected by
8697rounding mode) and arithmetic transformations that are unsafe in the
8698presence of sign-dependent rounding modes.
8699
8700The default is @option{-fno-rounding-math}.
8701
8702This option is experimental and does not currently guarantee to
8703disable all GCC optimizations that are affected by rounding mode.
8704Future versions of GCC may provide finer control of this setting
8705using C99's @code{FENV_ACCESS} pragma.  This command-line option
8706will be used to specify the default state for @code{FENV_ACCESS}.
8707
8708@item -fsignaling-nans
8709@opindex fsignaling-nans
8710Compile code assuming that IEEE signaling NaNs may generate user-visible
8711traps during floating-point operations.  Setting this option disables
8712optimizations that may change the number of exceptions visible with
8713signaling NaNs.  This option implies @option{-ftrapping-math}.
8714
8715This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
8716be defined.
8717
8718The default is @option{-fno-signaling-nans}.
8719
8720This option is experimental and does not currently guarantee to
8721disable all GCC optimizations that affect signaling NaN behavior.
8722
8723@item -fsingle-precision-constant
8724@opindex fsingle-precision-constant
8725Treat floating-point constants as single precision instead of
8726implicitly converting them to double-precision constants.
8727
8728@item -fcx-limited-range
8729@opindex fcx-limited-range
8730When enabled, this option states that a range reduction step is not
8731needed when performing complex division.  Also, there is no checking
8732whether the result of a complex multiplication or division is @code{NaN
8733+ I*NaN}, with an attempt to rescue the situation in that case.  The
8734default is @option{-fno-cx-limited-range}, but is enabled by
8735@option{-ffast-math}.
8736
8737This option controls the default setting of the ISO C99
8738@code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
8739all languages.
8740
8741@item -fcx-fortran-rules
8742@opindex fcx-fortran-rules
8743Complex multiplication and division follow Fortran rules.  Range
8744reduction is done as part of complex division, but there is no checking
8745whether the result of a complex multiplication or division is @code{NaN
8746+ I*NaN}, with an attempt to rescue the situation in that case.
8747
8748The default is @option{-fno-cx-fortran-rules}.
8749
8750@end table
8751
8752The following options control optimizations that may improve
8753performance, but are not enabled by any @option{-O} options.  This
8754section includes experimental options that may produce broken code.
8755
8756@table @gcctabopt
8757@item -fbranch-probabilities
8758@opindex fbranch-probabilities
8759After running a program compiled with @option{-fprofile-arcs}
8760(@pxref{Debugging Options,, Options for Debugging Your Program or
8761@command{gcc}}), you can compile it a second time using
8762@option{-fbranch-probabilities}, to improve optimizations based on
8763the number of times each branch was taken.  When a program
8764compiled with @option{-fprofile-arcs} exits, it saves arc execution
8765counts to a file called @file{@var{sourcename}.gcda} for each source
8766file.  The information in this data file is very dependent on the
8767structure of the generated code, so you must use the same source code
8768and the same optimization options for both compilations.
8769
8770With @option{-fbranch-probabilities}, GCC puts a
8771@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8772These can be used to improve optimization.  Currently, they are only
8773used in one place: in @file{reorg.c}, instead of guessing which path a
8774branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8775exactly determine which path is taken more often.
8776
8777@item -fprofile-values
8778@opindex fprofile-values
8779If combined with @option{-fprofile-arcs}, it adds code so that some
8780data about values of expressions in the program is gathered.
8781
8782With @option{-fbranch-probabilities}, it reads back the data gathered
8783from profiling values of expressions for usage in optimizations.
8784
8785Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8786
8787@item -fvpt
8788@opindex fvpt
8789If combined with @option{-fprofile-arcs}, this option instructs the compiler
8790to add code to gather information about values of expressions.
8791
8792With @option{-fbranch-probabilities}, it reads back the data gathered
8793and actually performs the optimizations based on them.
8794Currently the optimizations include specialization of division operations
8795using the knowledge about the value of the denominator.
8796
8797@item -frename-registers
8798@opindex frename-registers
8799Attempt to avoid false dependencies in scheduled code by making use
8800of registers left over after register allocation.  This optimization
8801most benefits processors with lots of registers.  Depending on the
8802debug information format adopted by the target, however, it can
8803make debugging impossible, since variables no longer stay in
8804a ``home register''.
8805
8806Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
8807
8808@item -ftracer
8809@opindex ftracer
8810Perform tail duplication to enlarge superblock size.  This transformation
8811simplifies the control flow of the function allowing other optimizations to do
8812a better job.
8813
8814Enabled with @option{-fprofile-use}.
8815
8816@item -funroll-loops
8817@opindex funroll-loops
8818Unroll loops whose number of iterations can be determined at compile time or
8819upon entry to the loop.  @option{-funroll-loops} implies
8820@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
8821It also turns on complete loop peeling (i.e.@: complete removal of loops with
8822a small constant number of iterations).  This option makes code larger, and may
8823or may not make it run faster.
8824
8825Enabled with @option{-fprofile-use}.
8826
8827@item -funroll-all-loops
8828@opindex funroll-all-loops
8829Unroll all loops, even if their number of iterations is uncertain when
8830the loop is entered.  This usually makes programs run more slowly.
8831@option{-funroll-all-loops} implies the same options as
8832@option{-funroll-loops}.
8833
8834@item -fpeel-loops
8835@opindex fpeel-loops
8836Peels loops for which there is enough information that they do not
8837roll much (from profile feedback).  It also turns on complete loop peeling
8838(i.e.@: complete removal of loops with small constant number of iterations).
8839
8840Enabled with @option{-fprofile-use}.
8841
8842@item -fmove-loop-invariants
8843@opindex fmove-loop-invariants
8844Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
8845at level @option{-O1}
8846
8847@item -funswitch-loops
8848@opindex funswitch-loops
8849Move branches with loop invariant conditions out of the loop, with duplicates
8850of the loop on both branches (modified according to result of the condition).
8851
8852@item -ffunction-sections
8853@itemx -fdata-sections
8854@opindex ffunction-sections
8855@opindex fdata-sections
8856Place each function or data item into its own section in the output
8857file if the target supports arbitrary sections.  The name of the
8858function or the name of the data item determines the section's name
8859in the output file.
8860
8861Use these options on systems where the linker can perform optimizations
8862to improve locality of reference in the instruction space.  Most systems
8863using the ELF object format and SPARC processors running Solaris 2 have
8864linkers with such optimizations.  AIX may have these optimizations in
8865the future.
8866
8867Only use these options when there are significant benefits from doing
8868so.  When you specify these options, the assembler and linker
8869create larger object and executable files and are also slower.
8870You cannot use @code{gprof} on all systems if you
8871specify this option, and you may have problems with debugging if
8872you specify both this option and @option{-g}.
8873
8874@item -fbranch-target-load-optimize
8875@opindex fbranch-target-load-optimize
8876Perform branch target register load optimization before prologue / epilogue
8877threading.
8878The use of target registers can typically be exposed only during reload,
8879thus hoisting loads out of loops and doing inter-block scheduling needs
8880a separate optimization pass.
8881
8882@item -fbranch-target-load-optimize2
8883@opindex fbranch-target-load-optimize2
8884Perform branch target register load optimization after prologue / epilogue
8885threading.
8886
8887@item -fbtr-bb-exclusive
8888@opindex fbtr-bb-exclusive
8889When performing branch target register load optimization, don't reuse
8890branch target registers within any basic block.
8891
8892@item -fstack-protector
8893@opindex fstack-protector
8894Emit extra code to check for buffer overflows, such as stack smashing
8895attacks.  This is done by adding a guard variable to functions with
8896vulnerable objects.  This includes functions that call @code{alloca}, and
8897functions with buffers larger than 8 bytes.  The guards are initialized
8898when a function is entered and then checked when the function exits.
8899If a guard check fails, an error message is printed and the program exits.
8900
8901@item -fstack-protector-all
8902@opindex fstack-protector-all
8903Like @option{-fstack-protector} except that all functions are protected.
8904
8905@item -fsection-anchors
8906@opindex fsection-anchors
8907Try to reduce the number of symbolic address calculations by using
8908shared ``anchor'' symbols to address nearby objects.  This transformation
8909can help to reduce the number of GOT entries and GOT accesses on some
8910targets.
8911
8912For example, the implementation of the following function @code{foo}:
8913
8914@smallexample
8915static int a, b, c;
8916int foo (void) @{ return a + b + c; @}
8917@end smallexample
8918
8919@noindent
8920usually calculates the addresses of all three variables, but if you
8921compile it with @option{-fsection-anchors}, it accesses the variables
8922from a common anchor point instead.  The effect is similar to the
8923following pseudocode (which isn't valid C):
8924
8925@smallexample
8926int foo (void)
8927@{
8928  register int *xr = &x;
8929  return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8930@}
8931@end smallexample
8932
8933Not all targets support this option.
8934
8935@item --param @var{name}=@var{value}
8936@opindex param
8937In some places, GCC uses various constants to control the amount of
8938optimization that is done.  For example, GCC does not inline functions
8939that contain more than a certain number of instructions.  You can
8940control some of these constants on the command line using the
8941@option{--param} option.
8942
8943The names of specific parameters, and the meaning of the values, are
8944tied to the internals of the compiler, and are subject to change
8945without notice in future releases.
8946
8947In each case, the @var{value} is an integer.  The allowable choices for
8948@var{name} are:
8949
8950@table @gcctabopt
8951@item predictable-branch-outcome
8952When branch is predicted to be taken with probability lower than this threshold
8953(in percent), then it is considered well predictable. The default is 10.
8954
8955@item max-crossjump-edges
8956The maximum number of incoming edges to consider for cross-jumping.
8957The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
8958the number of edges incoming to each block.  Increasing values mean
8959more aggressive optimization, making the compilation time increase with
8960probably small improvement in executable size.
8961
8962@item min-crossjump-insns
8963The minimum number of instructions that must be matched at the end
8964of two blocks before cross-jumping is performed on them.  This
8965value is ignored in the case where all instructions in the block being
8966cross-jumped from are matched.  The default value is 5.
8967
8968@item max-grow-copy-bb-insns
8969The maximum code size expansion factor when copying basic blocks
8970instead of jumping.  The expansion is relative to a jump instruction.
8971The default value is 8.
8972
8973@item max-goto-duplication-insns
8974The maximum number of instructions to duplicate to a block that jumps
8975to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
8976passes, GCC factors computed gotos early in the compilation process,
8977and unfactors them as late as possible.  Only computed jumps at the
8978end of a basic blocks with no more than max-goto-duplication-insns are
8979unfactored.  The default value is 8.
8980
8981@item max-delay-slot-insn-search
8982The maximum number of instructions to consider when looking for an
8983instruction to fill a delay slot.  If more than this arbitrary number of
8984instructions are searched, the time savings from filling the delay slot
8985are minimal, so stop searching.  Increasing values mean more
8986aggressive optimization, making the compilation time increase with probably
8987small improvement in execution time.
8988
8989@item max-delay-slot-live-search
8990When trying to fill delay slots, the maximum number of instructions to
8991consider when searching for a block with valid live register
8992information.  Increasing this arbitrarily chosen value means more
8993aggressive optimization, increasing the compilation time.  This parameter
8994should be removed when the delay slot code is rewritten to maintain the
8995control-flow graph.
8996
8997@item max-gcse-memory
8998The approximate maximum amount of memory that can be allocated in
8999order to perform the global common subexpression elimination
9000optimization.  If more memory than specified is required, the
9001optimization is not done.
9002
9003@item max-gcse-insertion-ratio
9004If the ratio of expression insertions to deletions is larger than this value
9005for any expression, then RTL PRE inserts or removes the expression and thus
9006leaves partially redundant computations in the instruction stream.  The default value is 20.
9007
9008@item max-pending-list-length
9009The maximum number of pending dependencies scheduling allows
9010before flushing the current state and starting over.  Large functions
9011with few branches or calls can create excessively large lists which
9012needlessly consume memory and resources.
9013
9014@item max-modulo-backtrack-attempts
9015The maximum number of backtrack attempts the scheduler should make
9016when modulo scheduling a loop.  Larger values can exponentially increase
9017compilation time.
9018
9019@item max-inline-insns-single
9020Several parameters control the tree inliner used in GCC@.
9021This number sets the maximum number of instructions (counted in GCC's
9022internal representation) in a single function that the tree inliner
9023considers for inlining.  This only affects functions declared
9024inline and methods implemented in a class declaration (C++).
9025The default value is 400.
9026
9027@item max-inline-insns-auto
9028When you use @option{-finline-functions} (included in @option{-O3}),
9029a lot of functions that would otherwise not be considered for inlining
9030by the compiler are investigated.  To those functions, a different
9031(more restrictive) limit compared to functions declared inline can
9032be applied.
9033The default value is 40.
9034
9035@item inline-min-speedup
9036When estimated performance improvement of caller + callee runtime exceeds this
9037threshold (in precent), the function can be inlined regardless the limit on
9038@option{--param max-inline-insns-single} and @option{--param
9039max-inline-insns-auto}.
9040
9041@item large-function-insns
9042The limit specifying really large functions.  For functions larger than this
9043limit after inlining, inlining is constrained by
9044@option{--param large-function-growth}.  This parameter is useful primarily
9045to avoid extreme compilation time caused by non-linear algorithms used by the
9046back end.
9047The default value is 2700.
9048
9049@item large-function-growth
9050Specifies maximal growth of large function caused by inlining in percents.
9051The default value is 100 which limits large function growth to 2.0 times
9052the original size.
9053
9054@item large-unit-insns
9055The limit specifying large translation unit.  Growth caused by inlining of
9056units larger than this limit is limited by @option{--param inline-unit-growth}.
9057For small units this might be too tight.
9058For example, consider a unit consisting of function A
9059that is inline and B that just calls A three times.  If B is small relative to
9060A, the growth of unit is 300\% and yet such inlining is very sane.  For very
9061large units consisting of small inlineable functions, however, the overall unit
9062growth limit is needed to avoid exponential explosion of code size.  Thus for
9063smaller units, the size is increased to @option{--param large-unit-insns}
9064before applying @option{--param inline-unit-growth}.  The default is 10000.
9065
9066@item inline-unit-growth
9067Specifies maximal overall growth of the compilation unit caused by inlining.
9068The default value is 30 which limits unit growth to 1.3 times the original
9069size.
9070
9071@item ipcp-unit-growth
9072Specifies maximal overall growth of the compilation unit caused by
9073interprocedural constant propagation.  The default value is 10 which limits
9074unit growth to 1.1 times the original size.
9075
9076@item large-stack-frame
9077The limit specifying large stack frames.  While inlining the algorithm is trying
9078to not grow past this limit too much.  The default value is 256 bytes.
9079
9080@item large-stack-frame-growth
9081Specifies maximal growth of large stack frames caused by inlining in percents.
9082The default value is 1000 which limits large stack frame growth to 11 times
9083the original size.
9084
9085@item max-inline-insns-recursive
9086@itemx max-inline-insns-recursive-auto
9087Specifies the maximum number of instructions an out-of-line copy of a
9088self-recursive inline
9089function can grow into by performing recursive inlining.
9090
9091For functions declared inline, @option{--param max-inline-insns-recursive} is
9092taken into account.  For functions not declared inline, recursive inlining
9093happens only when @option{-finline-functions} (included in @option{-O3}) is
9094enabled and @option{--param max-inline-insns-recursive-auto} is used.  The
9095default value is 450.
9096
9097@item max-inline-recursive-depth
9098@itemx max-inline-recursive-depth-auto
9099Specifies the maximum recursion depth used for recursive inlining.
9100
9101For functions declared inline, @option{--param max-inline-recursive-depth} is
9102taken into account.  For functions not declared inline, recursive inlining
9103happens only when @option{-finline-functions} (included in @option{-O3}) is
9104enabled and @option{--param max-inline-recursive-depth-auto} is used.  The
9105default value is 8.
9106
9107@item min-inline-recursive-probability
9108Recursive inlining is profitable only for function having deep recursion
9109in average and can hurt for function having little recursion depth by
9110increasing the prologue size or complexity of function body to other
9111optimizers.
9112
9113When profile feedback is available (see @option{-fprofile-generate}) the actual
9114recursion depth can be guessed from probability that function recurses via a
9115given call expression.  This parameter limits inlining only to call expressions
9116whose probability exceeds the given threshold (in percents).
9117The default value is 10.
9118
9119@item early-inlining-insns
9120Specify growth that the early inliner can make.  In effect it increases
9121the amount of inlining for code having a large abstraction penalty.
9122The default value is 10.
9123
9124@item max-early-inliner-iterations
9125@itemx max-early-inliner-iterations
9126Limit of iterations of the early inliner.  This basically bounds
9127the number of nested indirect calls the early inliner can resolve.
9128Deeper chains are still handled by late inlining.
9129
9130@item comdat-sharing-probability
9131@itemx comdat-sharing-probability
9132Probability (in percent) that C++ inline function with comdat visibility
9133are shared across multiple compilation units.  The default value is 20.
9134
9135@item min-vect-loop-bound
9136The minimum number of iterations under which loops are not vectorized
9137when @option{-ftree-vectorize} is used.  The number of iterations after
9138vectorization needs to be greater than the value specified by this option
9139to allow vectorization.  The default value is 0.
9140
9141@item gcse-cost-distance-ratio
9142Scaling factor in calculation of maximum distance an expression
9143can be moved by GCSE optimizations.  This is currently supported only in the
9144code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
9145is with simple expressions, i.e., the expressions that have cost
9146less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
9147hoisting of simple expressions.  The default value is 10.
9148
9149@item gcse-unrestricted-cost
9150Cost, roughly measured as the cost of a single typical machine
9151instruction, at which GCSE optimizations do not constrain
9152the distance an expression can travel.  This is currently
9153supported only in the code hoisting pass.  The lesser the cost,
9154the more aggressive code hoisting is.  Specifying 0
9155allows all expressions to travel unrestricted distances.
9156The default value is 3.
9157
9158@item max-hoist-depth
9159The depth of search in the dominator tree for expressions to hoist.
9160This is used to avoid quadratic behavior in hoisting algorithm.
9161The value of 0 does not limit on the search, but may slow down compilation
9162of huge functions.  The default value is 30.
9163
9164@item max-tail-merge-comparisons
9165The maximum amount of similar bbs to compare a bb with.  This is used to
9166avoid quadratic behavior in tree tail merging.  The default value is 10.
9167
9168@item max-tail-merge-iterations
9169The maximum amount of iterations of the pass over the function.  This is used to
9170limit compilation time in tree tail merging.  The default value is 2.
9171
9172@item max-unrolled-insns
9173The maximum number of instructions that a loop may have to be unrolled.
9174If a loop is unrolled, this parameter also determines how many times
9175the loop code is unrolled.
9176
9177@item max-average-unrolled-insns
9178The maximum number of instructions biased by probabilities of their execution
9179that a loop may have to be unrolled.  If a loop is unrolled,
9180this parameter also determines how many times the loop code is unrolled.
9181
9182@item max-unroll-times
9183The maximum number of unrollings of a single loop.
9184
9185@item max-peeled-insns
9186The maximum number of instructions that a loop may have to be peeled.
9187If a loop is peeled, this parameter also determines how many times
9188the loop code is peeled.
9189
9190@item max-peel-times
9191The maximum number of peelings of a single loop.
9192
9193@item max-peel-branches
9194The maximum number of branches on the hot path through the peeled sequence.
9195
9196@item max-completely-peeled-insns
9197The maximum number of insns of a completely peeled loop.
9198
9199@item max-completely-peel-times
9200The maximum number of iterations of a loop to be suitable for complete peeling.
9201
9202@item max-completely-peel-loop-nest-depth
9203The maximum depth of a loop nest suitable for complete peeling.
9204
9205@item max-unswitch-insns
9206The maximum number of insns of an unswitched loop.
9207
9208@item max-unswitch-level
9209The maximum number of branches unswitched in a single loop.
9210
9211@item lim-expensive
9212The minimum cost of an expensive expression in the loop invariant motion.
9213
9214@item iv-consider-all-candidates-bound
9215Bound on number of candidates for induction variables, below which
9216all candidates are considered for each use in induction variable
9217optimizations.  If there are more candidates than this,
9218only the most relevant ones are considered to avoid quadratic time complexity.
9219
9220@item iv-max-considered-uses
9221The induction variable optimizations give up on loops that contain more
9222induction variable uses.
9223
9224@item iv-always-prune-cand-set-bound
9225If the number of candidates in the set is smaller than this value,
9226always try to remove unnecessary ivs from the set
9227when adding a new one.
9228
9229@item scev-max-expr-size
9230Bound on size of expressions used in the scalar evolutions analyzer.
9231Large expressions slow the analyzer.
9232
9233@item scev-max-expr-complexity
9234Bound on the complexity of the expressions in the scalar evolutions analyzer.
9235Complex expressions slow the analyzer.
9236
9237@item omega-max-vars
9238The maximum number of variables in an Omega constraint system.
9239The default value is 128.
9240
9241@item omega-max-geqs
9242The maximum number of inequalities in an Omega constraint system.
9243The default value is 256.
9244
9245@item omega-max-eqs
9246The maximum number of equalities in an Omega constraint system.
9247The default value is 128.
9248
9249@item omega-max-wild-cards
9250The maximum number of wildcard variables that the Omega solver is
9251able to insert.  The default value is 18.
9252
9253@item omega-hash-table-size
9254The size of the hash table in the Omega solver.  The default value is
9255550.
9256
9257@item omega-max-keys
9258The maximal number of keys used by the Omega solver.  The default
9259value is 500.
9260
9261@item omega-eliminate-redundant-constraints
9262When set to 1, use expensive methods to eliminate all redundant
9263constraints.  The default value is 0.
9264
9265@item vect-max-version-for-alignment-checks
9266The maximum number of run-time checks that can be performed when
9267doing loop versioning for alignment in the vectorizer.  See option
9268@option{-ftree-vect-loop-version} for more information.
9269
9270@item vect-max-version-for-alias-checks
9271The maximum number of run-time checks that can be performed when
9272doing loop versioning for alias in the vectorizer.  See option
9273@option{-ftree-vect-loop-version} for more information.
9274
9275@item max-iterations-to-track
9276The maximum number of iterations of a loop the brute-force algorithm
9277for analysis of the number of iterations of the loop tries to evaluate.
9278
9279@item hot-bb-count-ws-permille
9280A basic block profile count is considered hot if it contributes to
9281the given permillage (i.e. 0...1000) of the entire profiled execution.
9282
9283@item hot-bb-frequency-fraction
9284Select fraction of the entry block frequency of executions of basic block in
9285function given basic block needs to have to be considered hot.
9286
9287@item max-predicted-iterations
9288The maximum number of loop iterations we predict statically.  This is useful
9289in cases where a function contains a single loop with known bound and
9290another loop with unknown bound.
9291The known number of iterations is predicted correctly, while
9292the unknown number of iterations average to roughly 10.  This means that the
9293loop without bounds appears artificially cold relative to the other one.
9294
9295@item align-threshold
9296
9297Select fraction of the maximal frequency of executions of a basic block in
9298a function to align the basic block.
9299
9300@item align-loop-iterations
9301
9302A loop expected to iterate at least the selected number of iterations is
9303aligned.
9304
9305@item tracer-dynamic-coverage
9306@itemx tracer-dynamic-coverage-feedback
9307
9308This value is used to limit superblock formation once the given percentage of
9309executed instructions is covered.  This limits unnecessary code size
9310expansion.
9311
9312The @option{tracer-dynamic-coverage-feedback} is used only when profile
9313feedback is available.  The real profiles (as opposed to statically estimated
9314ones) are much less balanced allowing the threshold to be larger value.
9315
9316@item tracer-max-code-growth
9317Stop tail duplication once code growth has reached given percentage.  This is
9318a rather artificial limit, as most of the duplicates are eliminated later in
9319cross jumping, so it may be set to much higher values than is the desired code
9320growth.
9321
9322@item tracer-min-branch-ratio
9323
9324Stop reverse growth when the reverse probability of best edge is less than this
9325threshold (in percent).
9326
9327@item tracer-min-branch-ratio
9328@itemx tracer-min-branch-ratio-feedback
9329
9330Stop forward growth if the best edge has probability lower than this
9331threshold.
9332
9333Similarly to @option{tracer-dynamic-coverage} two values are present, one for
9334compilation for profile feedback and one for compilation without.  The value
9335for compilation with profile feedback needs to be more conservative (higher) in
9336order to make tracer effective.
9337
9338@item max-cse-path-length
9339
9340The maximum number of basic blocks on path that CSE considers.
9341The default is 10.
9342
9343@item max-cse-insns
9344The maximum number of instructions CSE processes before flushing.
9345The default is 1000.
9346
9347@item ggc-min-expand
9348
9349GCC uses a garbage collector to manage its own memory allocation.  This
9350parameter specifies the minimum percentage by which the garbage
9351collector's heap should be allowed to expand between collections.
9352Tuning this may improve compilation speed; it has no effect on code
9353generation.
9354
9355The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9356RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
9357the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
9358GCC is not able to calculate RAM on a particular platform, the lower
9359bound of 30% is used.  Setting this parameter and
9360@option{ggc-min-heapsize} to zero causes a full collection to occur at
9361every opportunity.  This is extremely slow, but can be useful for
9362debugging.
9363
9364@item ggc-min-heapsize
9365
9366Minimum size of the garbage collector's heap before it begins bothering
9367to collect garbage.  The first collection occurs after the heap expands
9368by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
9369tuning this may improve compilation speed, and has no effect on code
9370generation.
9371
9372The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9373tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9374with a lower bound of 4096 (four megabytes) and an upper bound of
9375131072 (128 megabytes).  If GCC is not able to calculate RAM on a
9376particular platform, the lower bound is used.  Setting this parameter
9377very large effectively disables garbage collection.  Setting this
9378parameter and @option{ggc-min-expand} to zero causes a full collection
9379to occur at every opportunity.
9380
9381@item max-reload-search-insns
9382The maximum number of instruction reload should look backward for equivalent
9383register.  Increasing values mean more aggressive optimization, making the
9384compilation time increase with probably slightly better performance.
9385The default value is 100.
9386
9387@item max-cselib-memory-locations
9388The maximum number of memory locations cselib should take into account.
9389Increasing values mean more aggressive optimization, making the compilation time
9390increase with probably slightly better performance.  The default value is 500.
9391
9392@item reorder-blocks-duplicate
9393@itemx reorder-blocks-duplicate-feedback
9394
9395Used by the basic block reordering pass to decide whether to use unconditional
9396branch or duplicate the code on its destination.  Code is duplicated when its
9397estimated size is smaller than this value multiplied by the estimated size of
9398unconditional jump in the hot spots of the program.
9399
9400The @option{reorder-block-duplicate-feedback} is used only when profile
9401feedback is available.  It may be set to higher values than
9402@option{reorder-block-duplicate} since information about the hot spots is more
9403accurate.
9404
9405@item max-sched-ready-insns
9406The maximum number of instructions ready to be issued the scheduler should
9407consider at any given time during the first scheduling pass.  Increasing
9408values mean more thorough searches, making the compilation time increase
9409with probably little benefit.  The default value is 100.
9410
9411@item max-sched-region-blocks
9412The maximum number of blocks in a region to be considered for
9413interblock scheduling.  The default value is 10.
9414
9415@item max-pipeline-region-blocks
9416The maximum number of blocks in a region to be considered for
9417pipelining in the selective scheduler.  The default value is 15.
9418
9419@item max-sched-region-insns
9420The maximum number of insns in a region to be considered for
9421interblock scheduling.  The default value is 100.
9422
9423@item max-pipeline-region-insns
9424The maximum number of insns in a region to be considered for
9425pipelining in the selective scheduler.  The default value is 200.
9426
9427@item min-spec-prob
9428The minimum probability (in percents) of reaching a source block
9429for interblock speculative scheduling.  The default value is 40.
9430
9431@item max-sched-extend-regions-iters
9432The maximum number of iterations through CFG to extend regions.
9433A value of 0 (the default) disables region extensions.
9434
9435@item max-sched-insn-conflict-delay
9436The maximum conflict delay for an insn to be considered for speculative motion.
9437The default value is 3.
9438
9439@item sched-spec-prob-cutoff
9440The minimal probability of speculation success (in percents), so that
9441speculative insns are scheduled.
9442The default value is 40.
9443
9444@item sched-spec-state-edge-prob-cutoff
9445The minimum probability an edge must have for the scheduler to save its
9446state across it.
9447The default value is 10.
9448
9449@item sched-mem-true-dep-cost
9450Minimal distance (in CPU cycles) between store and load targeting same
9451memory locations.  The default value is 1.
9452
9453@item selsched-max-lookahead
9454The maximum size of the lookahead window of selective scheduling.  It is a
9455depth of search for available instructions.
9456The default value is 50.
9457
9458@item selsched-max-sched-times
9459The maximum number of times that an instruction is scheduled during
9460selective scheduling.  This is the limit on the number of iterations
9461through which the instruction may be pipelined.  The default value is 2.
9462
9463@item selsched-max-insns-to-rename
9464The maximum number of best instructions in the ready list that are considered
9465for renaming in the selective scheduler.  The default value is 2.
9466
9467@item sms-min-sc
9468The minimum value of stage count that swing modulo scheduler
9469generates.  The default value is 2.
9470
9471@item max-last-value-rtl
9472The maximum size measured as number of RTLs that can be recorded in an expression
9473in combiner for a pseudo register as last known value of that register.  The default
9474is 10000.
9475
9476@item integer-share-limit
9477Small integer constants can use a shared data structure, reducing the
9478compiler's memory usage and increasing its speed.  This sets the maximum
9479value of a shared integer constant.  The default value is 256.
9480
9481@item ssp-buffer-size
9482The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9483protection when @option{-fstack-protection} is used.
9484
9485@item max-jump-thread-duplication-stmts
9486Maximum number of statements allowed in a block that needs to be
9487duplicated when threading jumps.
9488
9489@item max-fields-for-field-sensitive
9490Maximum number of fields in a structure treated in
9491a field sensitive manner during pointer analysis.  The default is zero
9492for @option{-O0} and @option{-O1},
9493and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9494
9495@item prefetch-latency
9496Estimate on average number of instructions that are executed before
9497prefetch finishes.  The distance prefetched ahead is proportional
9498to this constant.  Increasing this number may also lead to less
9499streams being prefetched (see @option{simultaneous-prefetches}).
9500
9501@item simultaneous-prefetches
9502Maximum number of prefetches that can run at the same time.
9503
9504@item l1-cache-line-size
9505The size of cache line in L1 cache, in bytes.
9506
9507@item l1-cache-size
9508The size of L1 cache, in kilobytes.
9509
9510@item l2-cache-size
9511The size of L2 cache, in kilobytes.
9512
9513@item min-insn-to-prefetch-ratio
9514The minimum ratio between the number of instructions and the
9515number of prefetches to enable prefetching in a loop.
9516
9517@item prefetch-min-insn-to-mem-ratio
9518The minimum ratio between the number of instructions and the
9519number of memory references to enable prefetching in a loop.
9520
9521@item use-canonical-types
9522Whether the compiler should use the ``canonical'' type system.  By
9523default, this should always be 1, which uses a more efficient internal
9524mechanism for comparing types in C++ and Objective-C++.  However, if
9525bugs in the canonical type system are causing compilation failures,
9526set this value to 0 to disable canonical types.
9527
9528@item switch-conversion-max-branch-ratio
9529Switch initialization conversion refuses to create arrays that are
9530bigger than @option{switch-conversion-max-branch-ratio} times the number of
9531branches in the switch.
9532
9533@item max-partial-antic-length
9534Maximum length of the partial antic set computed during the tree
9535partial redundancy elimination optimization (@option{-ftree-pre}) when
9536optimizing at @option{-O3} and above.  For some sorts of source code
9537the enhanced partial redundancy elimination optimization can run away,
9538consuming all of the memory available on the host machine.  This
9539parameter sets a limit on the length of the sets that are computed,
9540which prevents the runaway behavior.  Setting a value of 0 for
9541this parameter allows an unlimited set length.
9542
9543@item sccvn-max-scc-size
9544Maximum size of a strongly connected component (SCC) during SCCVN
9545processing.  If this limit is hit, SCCVN processing for the whole
9546function is not done and optimizations depending on it are
9547disabled.  The default maximum SCC size is 10000.
9548
9549@item sccvn-max-alias-queries-per-access
9550Maximum number of alias-oracle queries we perform when looking for
9551redundancies for loads and stores.  If this limit is hit the search
9552is aborted and the load or store is not considered redundant.  The
9553number of queries is algorithmically limited to the number of
9554stores on all paths from the load to the function entry.
9555The default maxmimum number of queries is 1000.
9556
9557@item ira-max-loops-num
9558IRA uses regional register allocation by default.  If a function
9559contains more loops than the number given by this parameter, only at most
9560the given number of the most frequently-executed loops form regions
9561for regional register allocation.  The default value of the
9562parameter is 100.
9563
9564@item ira-max-conflict-table-size
9565Although IRA uses a sophisticated algorithm to compress the conflict
9566table, the table can still require excessive amounts of memory for
9567huge functions.  If the conflict table for a function could be more
9568than the size in MB given by this parameter, the register allocator
9569instead uses a faster, simpler, and lower-quality
9570algorithm that does not require building a pseudo-register conflict table.
9571The default value of the parameter is 2000.
9572
9573@item ira-loop-reserved-regs
9574IRA can be used to evaluate more accurate register pressure in loops
9575for decisions to move loop invariants (see @option{-O3}).  The number
9576of available registers reserved for some other purposes is given
9577by this parameter.  The default value of the parameter is 2, which is
9578the minimal number of registers needed by typical instructions.
9579This value is the best found from numerous experiments.
9580
9581@item loop-invariant-max-bbs-in-loop
9582Loop invariant motion can be very expensive, both in compilation time and
9583in amount of needed compile-time memory, with very large loops.  Loops
9584with more basic blocks than this parameter won't have loop invariant
9585motion optimization performed on them.  The default value of the
9586parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
9587
9588@item loop-max-datarefs-for-datadeps
9589Building data dapendencies is expensive for very large loops.  This
9590parameter limits the number of data references in loops that are
9591considered for data dependence analysis.  These large loops are no
9592handled by the optimizations using loop data dependencies.
9593The default value is 1000.
9594
9595@item max-vartrack-size
9596Sets a maximum number of hash table slots to use during variable
9597tracking dataflow analysis of any function.  If this limit is exceeded
9598with variable tracking at assignments enabled, analysis for that
9599function is retried without it, after removing all debug insns from
9600the function.  If the limit is exceeded even without debug insns, var
9601tracking analysis is completely disabled for the function.  Setting
9602the parameter to zero makes it unlimited.
9603
9604@item max-vartrack-expr-depth
9605Sets a maximum number of recursion levels when attempting to map
9606variable names or debug temporaries to value expressions.  This trades
9607compilation time for more complete debug information.  If this is set too
9608low, value expressions that are available and could be represented in
9609debug information may end up not being used; setting this higher may
9610enable the compiler to find more complex debug expressions, but compile
9611time and memory use may grow.  The default is 12.
9612
9613@item min-nondebug-insn-uid
9614Use uids starting at this parameter for nondebug insns.  The range below
9615the parameter is reserved exclusively for debug insns created by
9616@option{-fvar-tracking-assignments}, but debug insns may get
9617(non-overlapping) uids above it if the reserved range is exhausted.
9618
9619@item ipa-sra-ptr-growth-factor
9620IPA-SRA replaces a pointer to an aggregate with one or more new
9621parameters only when their cumulative size is less or equal to
9622@option{ipa-sra-ptr-growth-factor} times the size of the original
9623pointer parameter.
9624
9625@item tm-max-aggregate-size
9626When making copies of thread-local variables in a transaction, this
9627parameter specifies the size in bytes after which variables are
9628saved with the logging functions as opposed to save/restore code
9629sequence pairs.  This option only applies when using
9630@option{-fgnu-tm}.
9631
9632@item graphite-max-nb-scop-params
9633To avoid exponential effects in the Graphite loop transforms, the
9634number of parameters in a Static Control Part (SCoP) is bounded.  The
9635default value is 10 parameters.  A variable whose value is unknown at
9636compilation time and defined outside a SCoP is a parameter of the SCoP.
9637
9638@item graphite-max-bbs-per-function
9639To avoid exponential effects in the detection of SCoPs, the size of
9640the functions analyzed by Graphite is bounded.  The default value is
9641100 basic blocks.
9642
9643@item loop-block-tile-size
9644Loop blocking or strip mining transforms, enabled with
9645@option{-floop-block} or @option{-floop-strip-mine}, strip mine each
9646loop in the loop nest by a given number of iterations.  The strip
9647length can be changed using the @option{loop-block-tile-size}
9648parameter.  The default value is 51 iterations.
9649
9650@item ipa-cp-value-list-size
9651IPA-CP attempts to track all possible values and types passed to a function's
9652parameter in order to propagate them and perform devirtualization.
9653@option{ipa-cp-value-list-size} is the maximum number of values and types it
9654stores per one formal parameter of a function.
9655
9656@item lto-partitions
9657Specify desired number of partitions produced during WHOPR compilation.
9658The number of partitions should exceed the number of CPUs used for compilation.
9659The default value is 32.
9660
9661@item lto-minpartition
9662Size of minimal partition for WHOPR (in estimated instructions).
9663This prevents expenses of splitting very small programs into too many
9664partitions.
9665
9666@item cxx-max-namespaces-for-diagnostic-help
9667The maximum number of namespaces to consult for suggestions when C++
9668name lookup fails for an identifier.  The default is 1000.
9669
9670@item sink-frequency-threshold
9671The maximum relative execution frequency (in percents) of the target block
9672relative to a statement's original block to allow statement sinking of a
9673statement.  Larger numbers result in more aggressive statement sinking.
9674The default value is 75.  A small positive adjustment is applied for
9675statements with memory operands as those are even more profitable so sink.
9676
9677@item max-stores-to-sink
9678The maximum number of conditional stores paires that can be sunk.  Set to 0
9679if either vectorization (@option{-ftree-vectorize}) or if-conversion
9680(@option{-ftree-loop-if-convert}) is disabled.  The default is 2.
9681
9682@item allow-load-data-races
9683Allow optimizers to introduce new data races on loads.
9684Set to 1 to allow, otherwise to 0.  This option is enabled by default
9685unless implicitly set by the @option{-fmemory-model=} option.
9686
9687@item allow-store-data-races
9688Allow optimizers to introduce new data races on stores.
9689Set to 1 to allow, otherwise to 0.  This option is enabled by default
9690unless implicitly set by the @option{-fmemory-model=} option.
9691
9692@item allow-packed-load-data-races
9693Allow optimizers to introduce new data races on packed data loads.
9694Set to 1 to allow, otherwise to 0.  This option is enabled by default
9695unless implicitly set by the @option{-fmemory-model=} option.
9696
9697@item allow-packed-store-data-races
9698Allow optimizers to introduce new data races on packed data stores.
9699Set to 1 to allow, otherwise to 0.  This option is enabled by default
9700unless implicitly set by the @option{-fmemory-model=} option.
9701
9702@item case-values-threshold
9703The smallest number of different values for which it is best to use a
9704jump-table instead of a tree of conditional branches.  If the value is
97050, use the default for the machine.  The default is 0.
9706
9707@item tree-reassoc-width
9708Set the maximum number of instructions executed in parallel in
9709reassociated tree. This parameter overrides target dependent
9710heuristics used by default if has non zero value.
9711
9712@item sched-pressure-algorithm
9713Choose between the two available implementations of
9714@option{-fsched-pressure}.  Algorithm 1 is the original implementation
9715and is the more likely to prevent instructions from being reordered.
9716Algorithm 2 was designed to be a compromise between the relatively
9717conservative approach taken by algorithm 1 and the rather aggressive
9718approach taken by the default scheduler.  It relies more heavily on
9719having a regular register file and accurate register pressure classes.
9720See @file{haifa-sched.c} in the GCC sources for more details.
9721
9722The default choice depends on the target.
9723
9724@item max-slsr-cand-scan
9725Set the maximum number of existing candidates that will be considered when
9726seeking a basis for a new straight-line strength reduction candidate.
9727
9728@end table
9729@end table
9730
9731@node Preprocessor Options
9732@section Options Controlling the Preprocessor
9733@cindex preprocessor options
9734@cindex options, preprocessor
9735
9736These options control the C preprocessor, which is run on each C source
9737file before actual compilation.
9738
9739If you use the @option{-E} option, nothing is done except preprocessing.
9740Some of these options make sense only together with @option{-E} because
9741they cause the preprocessor output to be unsuitable for actual
9742compilation.
9743
9744@table @gcctabopt
9745@item -Wp,@var{option}
9746@opindex Wp
9747You can use @option{-Wp,@var{option}} to bypass the compiler driver
9748and pass @var{option} directly through to the preprocessor.  If
9749@var{option} contains commas, it is split into multiple options at the
9750commas.  However, many options are modified, translated or interpreted
9751by the compiler driver before being passed to the preprocessor, and
9752@option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
9753interface is undocumented and subject to change, so whenever possible
9754you should avoid using @option{-Wp} and let the driver handle the
9755options instead.
9756
9757@item -Xpreprocessor @var{option}
9758@opindex Xpreprocessor
9759Pass @var{option} as an option to the preprocessor.  You can use this to
9760supply system-specific preprocessor options that GCC does not
9761recognize.
9762
9763If you want to pass an option that takes an argument, you must use
9764@option{-Xpreprocessor} twice, once for the option and once for the argument.
9765
9766@item -no-integrated-cpp
9767@opindex no-integrated-cpp
9768Perform preprocessing as a separate pass before compilation.
9769By default, GCC performs preprocessing as an integrated part of
9770input tokenization and parsing.
9771If this option is provided, the appropriate language front end
9772(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
9773and Objective-C, respectively) is instead invoked twice,
9774once for preprocessing only and once for actual compilation
9775of the preprocessed input.
9776This option may be useful in conjunction with the @option{-B} or
9777@option{-wrapper} options to specify an alternate preprocessor or
9778perform additional processing of the program source between
9779normal preprocessing and compilation.
9780@end table
9781
9782@include cppopts.texi
9783
9784@node Assembler Options
9785@section Passing Options to the Assembler
9786
9787@c prevent bad page break with this line
9788You can pass options to the assembler.
9789
9790@table @gcctabopt
9791@item -Wa,@var{option}
9792@opindex Wa
9793Pass @var{option} as an option to the assembler.  If @var{option}
9794contains commas, it is split into multiple options at the commas.
9795
9796@item -Xassembler @var{option}
9797@opindex Xassembler
9798Pass @var{option} as an option to the assembler.  You can use this to
9799supply system-specific assembler options that GCC does not
9800recognize.
9801
9802If you want to pass an option that takes an argument, you must use
9803@option{-Xassembler} twice, once for the option and once for the argument.
9804
9805@end table
9806
9807@node Link Options
9808@section Options for Linking
9809@cindex link options
9810@cindex options, linking
9811
9812These options come into play when the compiler links object files into
9813an executable output file.  They are meaningless if the compiler is
9814not doing a link step.
9815
9816@table @gcctabopt
9817@cindex file names
9818@item @var{object-file-name}
9819A file name that does not end in a special recognized suffix is
9820considered to name an object file or library.  (Object files are
9821distinguished from libraries by the linker according to the file
9822contents.)  If linking is done, these object files are used as input
9823to the linker.
9824
9825@item -c
9826@itemx -S
9827@itemx -E
9828@opindex c
9829@opindex S
9830@opindex E
9831If any of these options is used, then the linker is not run, and
9832object file names should not be used as arguments.  @xref{Overall
9833Options}.
9834
9835@cindex Libraries
9836@item -l@var{library}
9837@itemx -l @var{library}
9838@opindex l
9839Search the library named @var{library} when linking.  (The second
9840alternative with the library as a separate argument is only for
9841POSIX compliance and is not recommended.)
9842
9843It makes a difference where in the command you write this option; the
9844linker searches and processes libraries and object files in the order they
9845are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
9846after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
9847to functions in @samp{z}, those functions may not be loaded.
9848
9849The linker searches a standard list of directories for the library,
9850which is actually a file named @file{lib@var{library}.a}.  The linker
9851then uses this file as if it had been specified precisely by name.
9852
9853The directories searched include several standard system directories
9854plus any that you specify with @option{-L}.
9855
9856Normally the files found this way are library files---archive files
9857whose members are object files.  The linker handles an archive file by
9858scanning through it for members which define symbols that have so far
9859been referenced but not defined.  But if the file that is found is an
9860ordinary object file, it is linked in the usual fashion.  The only
9861difference between using an @option{-l} option and specifying a file name
9862is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
9863and searches several directories.
9864
9865@item -lobjc
9866@opindex lobjc
9867You need this special case of the @option{-l} option in order to
9868link an Objective-C or Objective-C++ program.
9869
9870@item -nostartfiles
9871@opindex nostartfiles
9872Do not use the standard system startup files when linking.
9873The standard system libraries are used normally, unless @option{-nostdlib}
9874or @option{-nodefaultlibs} is used.
9875
9876@item -nodefaultlibs
9877@opindex nodefaultlibs
9878Do not use the standard system libraries when linking.
9879Only the libraries you specify are passed to the linker, and options
9880specifying linkage of the system libraries, such as @code{-static-libgcc}
9881or @code{-shared-libgcc}, are ignored.
9882The standard startup files are used normally, unless @option{-nostartfiles}
9883is used.
9884
9885The compiler may generate calls to @code{memcmp},
9886@code{memset}, @code{memcpy} and @code{memmove}.
9887These entries are usually resolved by entries in
9888libc.  These entry points should be supplied through some other
9889mechanism when this option is specified.
9890
9891@item -nostdlib
9892@opindex nostdlib
9893Do not use the standard system startup files or libraries when linking.
9894No startup files and only the libraries you specify are passed to
9895the linker, and options specifying linkage of the system libraries, such as
9896@code{-static-libgcc} or @code{-shared-libgcc}, are ignored.
9897
9898The compiler may generate calls to @code{memcmp}, @code{memset},
9899@code{memcpy} and @code{memmove}.
9900These entries are usually resolved by entries in
9901libc.  These entry points should be supplied through some other
9902mechanism when this option is specified.
9903
9904@cindex @option{-lgcc}, use with @option{-nostdlib}
9905@cindex @option{-nostdlib} and unresolved references
9906@cindex unresolved references and @option{-nostdlib}
9907@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
9908@cindex @option{-nodefaultlibs} and unresolved references
9909@cindex unresolved references and @option{-nodefaultlibs}
9910One of the standard libraries bypassed by @option{-nostdlib} and
9911@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
9912which GCC uses to overcome shortcomings of particular machines, or special
9913needs for some languages.
9914(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
9915Collection (GCC) Internals},
9916for more discussion of @file{libgcc.a}.)
9917In most cases, you need @file{libgcc.a} even when you want to avoid
9918other standard libraries.  In other words, when you specify @option{-nostdlib}
9919or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
9920This ensures that you have no unresolved references to internal GCC
9921library subroutines.
9922(An example of such an internal subroutine is @samp{__main}, used to ensure C++
9923constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
9924GNU Compiler Collection (GCC) Internals}.)
9925
9926@item -pie
9927@opindex pie
9928Produce a position independent executable on targets that support it.
9929For predictable results, you must also specify the same set of options
9930used for compilation (@option{-fpie}, @option{-fPIE},
9931or model suboptions) when you specify this linker option.
9932
9933@item -rdynamic
9934@opindex rdynamic
9935Pass the flag @option{-export-dynamic} to the ELF linker, on targets
9936that support it. This instructs the linker to add all symbols, not
9937only used ones, to the dynamic symbol table. This option is needed
9938for some uses of @code{dlopen} or to allow obtaining backtraces
9939from within a program.
9940
9941@item -s
9942@opindex s
9943Remove all symbol table and relocation information from the executable.
9944
9945@item -static
9946@opindex static
9947On systems that support dynamic linking, this prevents linking with the shared
9948libraries.  On other systems, this option has no effect.
9949
9950@item -shared
9951@opindex shared
9952Produce a shared object which can then be linked with other objects to
9953form an executable.  Not all systems support this option.  For predictable
9954results, you must also specify the same set of options used for compilation
9955(@option{-fpic}, @option{-fPIC}, or model suboptions) when
9956you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
9957needs to build supplementary stub code for constructors to work.  On
9958multi-libbed systems, @samp{gcc -shared} must select the correct support
9959libraries to link against.  Failing to supply the correct flags may lead
9960to subtle defects.  Supplying them in cases where they are not necessary
9961is innocuous.}
9962
9963@item -shared-libgcc
9964@itemx -static-libgcc
9965@opindex shared-libgcc
9966@opindex static-libgcc
9967On systems that provide @file{libgcc} as a shared library, these options
9968force the use of either the shared or static version, respectively.
9969If no shared version of @file{libgcc} was built when the compiler was
9970configured, these options have no effect.
9971
9972There are several situations in which an application should use the
9973shared @file{libgcc} instead of the static version.  The most common
9974of these is when the application wishes to throw and catch exceptions
9975across different shared libraries.  In that case, each of the libraries
9976as well as the application itself should use the shared @file{libgcc}.
9977
9978Therefore, the G++ and GCJ drivers automatically add
9979@option{-shared-libgcc} whenever you build a shared library or a main
9980executable, because C++ and Java programs typically use exceptions, so
9981this is the right thing to do.
9982
9983If, instead, you use the GCC driver to create shared libraries, you may
9984find that they are not always linked with the shared @file{libgcc}.
9985If GCC finds, at its configuration time, that you have a non-GNU linker
9986or a GNU linker that does not support option @option{--eh-frame-hdr},
9987it links the shared version of @file{libgcc} into shared libraries
9988by default.  Otherwise, it takes advantage of the linker and optimizes
9989away the linking with the shared version of @file{libgcc}, linking with
9990the static version of libgcc by default.  This allows exceptions to
9991propagate through such shared libraries, without incurring relocation
9992costs at library load time.
9993
9994However, if a library or main executable is supposed to throw or catch
9995exceptions, you must link it using the G++ or GCJ driver, as appropriate
9996for the languages used in the program, or using the option
9997@option{-shared-libgcc}, such that it is linked with the shared
9998@file{libgcc}.
9999
10000@item -static-libasan
10001When the @option{-fsanitize=address} option is used to link a program,
10002the GCC driver automatically links against @option{libasan}.  If
10003@file{libasan} is available as a shared library, and the @option{-static}
10004option is not used, then this links against the shared version of
10005@file{libasan}.  The @option{-static-libasan} option directs the GCC
10006driver to link @file{libasan} statically, without necessarily linking
10007other libraries statically.
10008
10009@item -static-libtsan
10010When the @option{-fsanitize=thread} option is used to link a program,
10011the GCC driver automatically links against @option{libtsan}.  If
10012@file{libtsan} is available as a shared library, and the @option{-static}
10013option is not used, then this links against the shared version of
10014@file{libtsan}.  The @option{-static-libtsan} option directs the GCC
10015driver to link @file{libtsan} statically, without necessarily linking
10016other libraries statically.
10017
10018@item -static-libstdc++
10019When the @command{g++} program is used to link a C++ program, it
10020normally automatically links against @option{libstdc++}.  If
10021@file{libstdc++} is available as a shared library, and the
10022@option{-static} option is not used, then this links against the
10023shared version of @file{libstdc++}.  That is normally fine.  However, it
10024is sometimes useful to freeze the version of @file{libstdc++} used by
10025the program without going all the way to a fully static link.  The
10026@option{-static-libstdc++} option directs the @command{g++} driver to
10027link @file{libstdc++} statically, without necessarily linking other
10028libraries statically.
10029
10030@item -symbolic
10031@opindex symbolic
10032Bind references to global symbols when building a shared object.  Warn
10033about any unresolved references (unless overridden by the link editor
10034option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
10035this option.
10036
10037@item -T @var{script}
10038@opindex T
10039@cindex linker script
10040Use @var{script} as the linker script.  This option is supported by most
10041systems using the GNU linker.  On some targets, such as bare-board
10042targets without an operating system, the @option{-T} option may be required
10043when linking to avoid references to undefined symbols.
10044
10045@item -Xlinker @var{option}
10046@opindex Xlinker
10047Pass @var{option} as an option to the linker.  You can use this to
10048supply system-specific linker options that GCC does not recognize.
10049
10050If you want to pass an option that takes a separate argument, you must use
10051@option{-Xlinker} twice, once for the option and once for the argument.
10052For example, to pass @option{-assert definitions}, you must write
10053@option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
10054@option{-Xlinker "-assert definitions"}, because this passes the entire
10055string as a single argument, which is not what the linker expects.
10056
10057When using the GNU linker, it is usually more convenient to pass
10058arguments to linker options using the @option{@var{option}=@var{value}}
10059syntax than as separate arguments.  For example, you can specify
10060@option{-Xlinker -Map=output.map} rather than
10061@option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
10062this syntax for command-line options.
10063
10064@item -Wl,@var{option}
10065@opindex Wl
10066Pass @var{option} as an option to the linker.  If @var{option} contains
10067commas, it is split into multiple options at the commas.  You can use this
10068syntax to pass an argument to the option.
10069For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
10070linker.  When using the GNU linker, you can also get the same effect with
10071@option{-Wl,-Map=output.map}.
10072
10073@item -u @var{symbol}
10074@opindex u
10075Pretend the symbol @var{symbol} is undefined, to force linking of
10076library modules to define it.  You can use @option{-u} multiple times with
10077different symbols to force loading of additional library modules.
10078@end table
10079
10080@node Directory Options
10081@section Options for Directory Search
10082@cindex directory options
10083@cindex options, directory search
10084@cindex search path
10085
10086These options specify directories to search for header files, for
10087libraries and for parts of the compiler:
10088
10089@table @gcctabopt
10090@item -I@var{dir}
10091@opindex I
10092Add the directory @var{dir} to the head of the list of directories to be
10093searched for header files.  This can be used to override a system header
10094file, substituting your own version, since these directories are
10095searched before the system header file directories.  However, you should
10096not use this option to add directories that contain vendor-supplied
10097system header files (use @option{-isystem} for that).  If you use more than
10098one @option{-I} option, the directories are scanned in left-to-right
10099order; the standard system directories come after.
10100
10101If a standard system include directory, or a directory specified with
10102@option{-isystem}, is also specified with @option{-I}, the @option{-I}
10103option is ignored.  The directory is still searched but as a
10104system directory at its normal position in the system include chain.
10105This is to ensure that GCC's procedure to fix buggy system headers and
10106the ordering for the @code{include_next} directive are not inadvertently changed.
10107If you really need to change the search order for system directories,
10108use the @option{-nostdinc} and/or @option{-isystem} options.
10109
10110@item -iplugindir=@var{dir}
10111Set the directory to search for plugins that are passed
10112by @option{-fplugin=@var{name}} instead of
10113@option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
10114to be used by the user, but only passed by the driver.
10115
10116@item -iquote@var{dir}
10117@opindex iquote
10118Add the directory @var{dir} to the head of the list of directories to
10119be searched for header files only for the case of @samp{#include
10120"@var{file}"}; they are not searched for @samp{#include <@var{file}>},
10121otherwise just like @option{-I}.
10122
10123@item -iremap @var{src}:@var{dst}
10124@opindex iremap
10125Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time.
10126This option can be specified more than once.  Processing stops at the first
10127match.
10128
10129@item -L@var{dir}
10130@opindex L
10131Add directory @var{dir} to the list of directories to be searched
10132for @option{-l}.
10133
10134@item -B@var{prefix}
10135@opindex B
10136This option specifies where to find the executables, libraries,
10137include files, and data files of the compiler itself.
10138
10139The compiler driver program runs one or more of the subprograms
10140@command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
10141@var{prefix} as a prefix for each program it tries to run, both with and
10142without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
10143
10144For each subprogram to be run, the compiler driver first tries the
10145@option{-B} prefix, if any.  If that name is not found, or if @option{-B}
10146is not specified, the driver tries two standard prefixes,
10147@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
10148those results in a file name that is found, the unmodified program
10149name is searched for using the directories specified in your
10150@env{PATH} environment variable.
10151
10152The compiler checks to see if the path provided by the @option{-B}
10153refers to a directory, and if necessary it adds a directory
10154separator character at the end of the path.
10155
10156@option{-B} prefixes that effectively specify directory names also apply
10157to libraries in the linker, because the compiler translates these
10158options into @option{-L} options for the linker.  They also apply to
10159includes files in the preprocessor, because the compiler translates these
10160options into @option{-isystem} options for the preprocessor.  In this case,
10161the compiler appends @samp{include} to the prefix.
10162
10163The runtime support file @file{libgcc.a} can also be searched for using
10164the @option{-B} prefix, if needed.  If it is not found there, the two
10165standard prefixes above are tried, and that is all.  The file is left
10166out of the link if it is not found by those means.
10167
10168Another way to specify a prefix much like the @option{-B} prefix is to use
10169the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
10170Variables}.
10171
10172As a special kludge, if the path provided by @option{-B} is
10173@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
101749, then it is replaced by @file{[dir/]include}.  This is to help
10175with boot-strapping the compiler.
10176
10177@item -specs=@var{file}
10178@opindex specs
10179Process @var{file} after the compiler reads in the standard @file{specs}
10180file, in order to override the defaults which the @command{gcc} driver
10181program uses when determining what switches to pass to @command{cc1},
10182@command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
10183@option{-specs=@var{file}} can be specified on the command line, and they
10184are processed in order, from left to right.
10185
10186@item --sysroot=@var{dir}
10187@opindex sysroot
10188Use @var{dir} as the logical root directory for headers and libraries.
10189For example, if the compiler normally searches for headers in
10190@file{/usr/include} and libraries in @file{/usr/lib}, it instead
10191searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
10192
10193If you use both this option and the @option{-isysroot} option, then
10194the @option{--sysroot} option applies to libraries, but the
10195@option{-isysroot} option applies to header files.
10196
10197The GNU linker (beginning with version 2.16) has the necessary support
10198for this option.  If your linker does not support this option, the
10199header file aspect of @option{--sysroot} still works, but the
10200library aspect does not.
10201
10202@item --no-sysroot-suffix
10203@opindex no-sysroot-suffix
10204For some targets, a suffix is added to the root directory specified
10205with @option{--sysroot}, depending on the other options used, so that
10206headers may for example be found in
10207@file{@var{dir}/@var{suffix}/usr/include} instead of
10208@file{@var{dir}/usr/include}.  This option disables the addition of
10209such a suffix.
10210
10211@item -I-
10212@opindex I-
10213This option has been deprecated.  Please use @option{-iquote} instead for
10214@option{-I} directories before the @option{-I-} and remove the @option{-I-}.
10215Any directories you specify with @option{-I} options before the @option{-I-}
10216option are searched only for the case of @samp{#include "@var{file}"};
10217they are not searched for @samp{#include <@var{file}>}.
10218
10219If additional directories are specified with @option{-I} options after
10220the @option{-I-}, these directories are searched for all @samp{#include}
10221directives.  (Ordinarily @emph{all} @option{-I} directories are used
10222this way.)
10223
10224In addition, the @option{-I-} option inhibits the use of the current
10225directory (where the current input file came from) as the first search
10226directory for @samp{#include "@var{file}"}.  There is no way to
10227override this effect of @option{-I-}.  With @option{-I.} you can specify
10228searching the directory that is current when the compiler is
10229invoked.  That is not exactly the same as what the preprocessor does
10230by default, but it is often satisfactory.
10231
10232@option{-I-} does not inhibit the use of the standard system directories
10233for header files.  Thus, @option{-I-} and @option{-nostdinc} are
10234independent.
10235@end table
10236
10237@c man end
10238
10239@node Spec Files
10240@section Specifying subprocesses and the switches to pass to them
10241@cindex Spec Files
10242
10243@command{gcc} is a driver program.  It performs its job by invoking a
10244sequence of other programs to do the work of compiling, assembling and
10245linking.  GCC interprets its command-line parameters and uses these to
10246deduce which programs it should invoke, and which command-line options
10247it ought to place on their command lines.  This behavior is controlled
10248by @dfn{spec strings}.  In most cases there is one spec string for each
10249program that GCC can invoke, but a few programs have multiple spec
10250strings to control their behavior.  The spec strings built into GCC can
10251be overridden by using the @option{-specs=} command-line switch to specify
10252a spec file.
10253
10254@dfn{Spec files} are plaintext files that are used to construct spec
10255strings.  They consist of a sequence of directives separated by blank
10256lines.  The type of directive is determined by the first non-whitespace
10257character on the line, which can be one of the following:
10258
10259@table @code
10260@item %@var{command}
10261Issues a @var{command} to the spec file processor.  The commands that can
10262appear here are:
10263
10264@table @code
10265@item %include <@var{file}>
10266@cindex @code{%include}
10267Search for @var{file} and insert its text at the current point in the
10268specs file.
10269
10270@item %include_noerr <@var{file}>
10271@cindex @code{%include_noerr}
10272Just like @samp{%include}, but do not generate an error message if the include
10273file cannot be found.
10274
10275@item %rename @var{old_name} @var{new_name}
10276@cindex @code{%rename}
10277Rename the spec string @var{old_name} to @var{new_name}.
10278
10279@end table
10280
10281@item *[@var{spec_name}]:
10282This tells the compiler to create, override or delete the named spec
10283string.  All lines after this directive up to the next directive or
10284blank line are considered to be the text for the spec string.  If this
10285results in an empty string then the spec is deleted.  (Or, if the
10286spec did not exist, then nothing happens.)  Otherwise, if the spec
10287does not currently exist a new spec is created.  If the spec does
10288exist then its contents are overridden by the text of this
10289directive, unless the first character of that text is the @samp{+}
10290character, in which case the text is appended to the spec.
10291
10292@item [@var{suffix}]:
10293Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
10294and up to the next directive or blank line are considered to make up the
10295spec string for the indicated suffix.  When the compiler encounters an
10296input file with the named suffix, it processes the spec string in
10297order to work out how to compile that file.  For example:
10298
10299@smallexample
10300.ZZ:
10301z-compile -input %i
10302@end smallexample
10303
10304This says that any input file whose name ends in @samp{.ZZ} should be
10305passed to the program @samp{z-compile}, which should be invoked with the
10306command-line switch @option{-input} and with the result of performing the
10307@samp{%i} substitution.  (See below.)
10308
10309As an alternative to providing a spec string, the text following a
10310suffix directive can be one of the following:
10311
10312@table @code
10313@item @@@var{language}
10314This says that the suffix is an alias for a known @var{language}.  This is
10315similar to using the @option{-x} command-line switch to GCC to specify a
10316language explicitly.  For example:
10317
10318@smallexample
10319.ZZ:
10320@@c++
10321@end smallexample
10322
10323Says that .ZZ files are, in fact, C++ source files.
10324
10325@item #@var{name}
10326This causes an error messages saying:
10327
10328@smallexample
10329@var{name} compiler not installed on this system.
10330@end smallexample
10331@end table
10332
10333GCC already has an extensive list of suffixes built into it.
10334This directive adds an entry to the end of the list of suffixes, but
10335since the list is searched from the end backwards, it is effectively
10336possible to override earlier entries using this technique.
10337
10338@end table
10339
10340GCC has the following spec strings built into it.  Spec files can
10341override these strings or create their own.  Note that individual
10342targets can also add their own spec strings to this list.
10343
10344@smallexample
10345asm          Options to pass to the assembler
10346asm_final    Options to pass to the assembler post-processor
10347cpp          Options to pass to the C preprocessor
10348cc1          Options to pass to the C compiler
10349cc1plus      Options to pass to the C++ compiler
10350endfile      Object files to include at the end of the link
10351link         Options to pass to the linker
10352lib          Libraries to include on the command line to the linker
10353libgcc       Decides which GCC support library to pass to the linker
10354linker       Sets the name of the linker
10355predefines   Defines to be passed to the C preprocessor
10356signed_char  Defines to pass to CPP to say whether @code{char} is signed
10357             by default
10358startfile    Object files to include at the start of the link
10359@end smallexample
10360
10361Here is a small example of a spec file:
10362
10363@smallexample
10364%rename lib                 old_lib
10365
10366*lib:
10367--start-group -lgcc -lc -leval1 --end-group %(old_lib)
10368@end smallexample
10369
10370This example renames the spec called @samp{lib} to @samp{old_lib} and
10371then overrides the previous definition of @samp{lib} with a new one.
10372The new definition adds in some extra command-line options before
10373including the text of the old definition.
10374
10375@dfn{Spec strings} are a list of command-line options to be passed to their
10376corresponding program.  In addition, the spec strings can contain
10377@samp{%}-prefixed sequences to substitute variable text or to
10378conditionally insert text into the command line.  Using these constructs
10379it is possible to generate quite complex command lines.
10380
10381Here is a table of all defined @samp{%}-sequences for spec
10382strings.  Note that spaces are not generated automatically around the
10383results of expanding these sequences.  Therefore you can concatenate them
10384together or combine them with constant text in a single argument.
10385
10386@table @code
10387@item %%
10388Substitute one @samp{%} into the program name or argument.
10389
10390@item %i
10391Substitute the name of the input file being processed.
10392
10393@item %b
10394Substitute the basename of the input file being processed.
10395This is the substring up to (and not including) the last period
10396and not including the directory.
10397
10398@item %B
10399This is the same as @samp{%b}, but include the file suffix (text after
10400the last period).
10401
10402@item %d
10403Marks the argument containing or following the @samp{%d} as a
10404temporary file name, so that that file is deleted if GCC exits
10405successfully.  Unlike @samp{%g}, this contributes no text to the
10406argument.
10407
10408@item %g@var{suffix}
10409Substitute a file name that has suffix @var{suffix} and is chosen
10410once per compilation, and mark the argument in the same way as
10411@samp{%d}.  To reduce exposure to denial-of-service attacks, the file
10412name is now chosen in a way that is hard to predict even when previously
10413chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
10414might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
10415the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
10416treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
10417was simply substituted with a file name chosen once per compilation,
10418without regard to any appended suffix (which was therefore treated
10419just like ordinary text), making such attacks more likely to succeed.
10420
10421@item %u@var{suffix}
10422Like @samp{%g}, but generates a new temporary file name
10423each time it appears instead of once per compilation.
10424
10425@item %U@var{suffix}
10426Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
10427new one if there is no such last file name.  In the absence of any
10428@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
10429the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
10430involves the generation of two distinct file names, one
10431for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
10432simply substituted with a file name chosen for the previous @samp{%u},
10433without regard to any appended suffix.
10434
10435@item %j@var{suffix}
10436Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
10437writable, and if @option{-save-temps} is not used;
10438otherwise, substitute the name
10439of a temporary file, just like @samp{%u}.  This temporary file is not
10440meant for communication between processes, but rather as a junk
10441disposal mechanism.
10442
10443@item %|@var{suffix}
10444@itemx %m@var{suffix}
10445Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
10446@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
10447all.  These are the two most common ways to instruct a program that it
10448should read from standard input or write to standard output.  If you
10449need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
10450construct: see for example @file{f/lang-specs.h}.
10451
10452@item %.@var{SUFFIX}
10453Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
10454when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
10455terminated by the next space or %.
10456
10457@item %w
10458Marks the argument containing or following the @samp{%w} as the
10459designated output file of this compilation.  This puts the argument
10460into the sequence of arguments that @samp{%o} substitutes.
10461
10462@item %o
10463Substitutes the names of all the output files, with spaces
10464automatically placed around them.  You should write spaces
10465around the @samp{%o} as well or the results are undefined.
10466@samp{%o} is for use in the specs for running the linker.
10467Input files whose names have no recognized suffix are not compiled
10468at all, but they are included among the output files, so they are
10469linked.
10470
10471@item %O
10472Substitutes the suffix for object files.  Note that this is
10473handled specially when it immediately follows @samp{%g, %u, or %U},
10474because of the need for those to form complete file names.  The
10475handling is such that @samp{%O} is treated exactly as if it had already
10476been substituted, except that @samp{%g, %u, and %U} do not currently
10477support additional @var{suffix} characters following @samp{%O} as they do
10478following, for example, @samp{.o}.
10479
10480@item %p
10481Substitutes the standard macro predefinitions for the
10482current target machine.  Use this when running @code{cpp}.
10483
10484@item %P
10485Like @samp{%p}, but puts @samp{__} before and after the name of each
10486predefined macro, except for macros that start with @samp{__} or with
10487@samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
10488C@.
10489
10490@item %I
10491Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
10492@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
10493@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
10494and @option{-imultilib} as necessary.
10495
10496@item %s
10497Current argument is the name of a library or startup file of some sort.
10498Search for that file in a standard list of directories and substitute
10499the full name found.  The current working directory is included in the
10500list of directories scanned.
10501
10502@item %T
10503Current argument is the name of a linker script.  Search for that file
10504in the current list of directories to scan for libraries. If the file
10505is located insert a @option{--script} option into the command line
10506followed by the full path name found.  If the file is not found then
10507generate an error message.  Note: the current working directory is not
10508searched.
10509
10510@item %e@var{str}
10511Print @var{str} as an error message.  @var{str} is terminated by a newline.
10512Use this when inconsistent options are detected.
10513
10514@item %(@var{name})
10515Substitute the contents of spec string @var{name} at this point.
10516
10517@item %x@{@var{option}@}
10518Accumulate an option for @samp{%X}.
10519
10520@item %X
10521Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
10522spec string.
10523
10524@item %Y
10525Output the accumulated assembler options specified by @option{-Wa}.
10526
10527@item %Z
10528Output the accumulated preprocessor options specified by @option{-Wp}.
10529
10530@item %a
10531Process the @code{asm} spec.  This is used to compute the
10532switches to be passed to the assembler.
10533
10534@item %A
10535Process the @code{asm_final} spec.  This is a spec string for
10536passing switches to an assembler post-processor, if such a program is
10537needed.
10538
10539@item %l
10540Process the @code{link} spec.  This is the spec for computing the
10541command line passed to the linker.  Typically it makes use of the
10542@samp{%L %G %S %D and %E} sequences.
10543
10544@item %D
10545Dump out a @option{-L} option for each directory that GCC believes might
10546contain startup files.  If the target supports multilibs then the
10547current multilib directory is prepended to each of these paths.
10548
10549@item %L
10550Process the @code{lib} spec.  This is a spec string for deciding which
10551libraries are included on the command line to the linker.
10552
10553@item %G
10554Process the @code{libgcc} spec.  This is a spec string for deciding
10555which GCC support library is included on the command line to the linker.
10556
10557@item %S
10558Process the @code{startfile} spec.  This is a spec for deciding which
10559object files are the first ones passed to the linker.  Typically
10560this might be a file named @file{crt0.o}.
10561
10562@item %E
10563Process the @code{endfile} spec.  This is a spec string that specifies
10564the last object files that are passed to the linker.
10565
10566@item %C
10567Process the @code{cpp} spec.  This is used to construct the arguments
10568to be passed to the C preprocessor.
10569
10570@item %1
10571Process the @code{cc1} spec.  This is used to construct the options to be
10572passed to the actual C compiler (@samp{cc1}).
10573
10574@item %2
10575Process the @code{cc1plus} spec.  This is used to construct the options to be
10576passed to the actual C++ compiler (@samp{cc1plus}).
10577
10578@item %*
10579Substitute the variable part of a matched option.  See below.
10580Note that each comma in the substituted string is replaced by
10581a single space.
10582
10583@item %<@code{S}
10584Remove all occurrences of @code{-S} from the command line.  Note---this
10585command is position dependent.  @samp{%} commands in the spec string
10586before this one see @code{-S}, @samp{%} commands in the spec string
10587after this one do not.
10588
10589@item %:@var{function}(@var{args})
10590Call the named function @var{function}, passing it @var{args}.
10591@var{args} is first processed as a nested spec string, then split
10592into an argument vector in the usual fashion.  The function returns
10593a string which is processed as if it had appeared literally as part
10594of the current spec.
10595
10596The following built-in spec functions are provided:
10597
10598@table @code
10599@item @code{getenv}
10600The @code{getenv} spec function takes two arguments: an environment
10601variable name and a string.  If the environment variable is not
10602defined, a fatal error is issued.  Otherwise, the return value is the
10603value of the environment variable concatenated with the string.  For
10604example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
10605
10606@smallexample
10607%:getenv(TOPDIR /include)
10608@end smallexample
10609
10610expands to @file{/path/to/top/include}.
10611
10612@item @code{if-exists}
10613The @code{if-exists} spec function takes one argument, an absolute
10614pathname to a file.  If the file exists, @code{if-exists} returns the
10615pathname.  Here is a small example of its usage:
10616
10617@smallexample
10618*startfile:
10619crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
10620@end smallexample
10621
10622@item @code{if-exists-else}
10623The @code{if-exists-else} spec function is similar to the @code{if-exists}
10624spec function, except that it takes two arguments.  The first argument is
10625an absolute pathname to a file.  If the file exists, @code{if-exists-else}
10626returns the pathname.  If it does not exist, it returns the second argument.
10627This way, @code{if-exists-else} can be used to select one file or another,
10628based on the existence of the first.  Here is a small example of its usage:
10629
10630@smallexample
10631*startfile:
10632crt0%O%s %:if-exists(crti%O%s) \
10633%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
10634@end smallexample
10635
10636@item @code{replace-outfile}
10637The @code{replace-outfile} spec function takes two arguments.  It looks for the
10638first argument in the outfiles array and replaces it with the second argument.  Here
10639is a small example of its usage:
10640
10641@smallexample
10642%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
10643@end smallexample
10644
10645@item @code{remove-outfile}
10646The @code{remove-outfile} spec function takes one argument.  It looks for the
10647first argument in the outfiles array and removes it.  Here is a small example
10648its usage:
10649
10650@smallexample
10651%:remove-outfile(-lm)
10652@end smallexample
10653
10654@item @code{pass-through-libs}
10655The @code{pass-through-libs} spec function takes any number of arguments.  It
10656finds any @option{-l} options and any non-options ending in @file{.a} (which it
10657assumes are the names of linker input library archive files) and returns a
10658result containing all the found arguments each prepended by
10659@option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
10660intended to be passed to the LTO linker plugin.
10661
10662@smallexample
10663%:pass-through-libs(%G %L %G)
10664@end smallexample
10665
10666@item @code{print-asm-header}
10667The @code{print-asm-header} function takes no arguments and simply
10668prints a banner like:
10669
10670@smallexample
10671Assembler options
10672=================
10673
10674Use "-Wa,OPTION" to pass "OPTION" to the assembler.
10675@end smallexample
10676
10677It is used to separate compiler options from assembler options
10678in the @option{--target-help} output.
10679@end table
10680
10681@item %@{@code{S}@}
10682Substitutes the @code{-S} switch, if that switch is given to GCC@.
10683If that switch is not specified, this substitutes nothing.  Note that
10684the leading dash is omitted when specifying this option, and it is
10685automatically inserted if the substitution is performed.  Thus the spec
10686string @samp{%@{foo@}} matches the command-line option @option{-foo}
10687and outputs the command-line option @option{-foo}.
10688
10689@item %W@{@code{S}@}
10690Like %@{@code{S}@} but mark last argument supplied within as a file to be
10691deleted on failure.
10692
10693@item %@{@code{S}*@}
10694Substitutes all the switches specified to GCC whose names start
10695with @code{-S}, but which also take an argument.  This is used for
10696switches like @option{-o}, @option{-D}, @option{-I}, etc.
10697GCC considers @option{-o foo} as being
10698one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
10699text, including the space.  Thus two arguments are generated.
10700
10701@item %@{@code{S}*&@code{T}*@}
10702Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
10703(the order of @code{S} and @code{T} in the spec is not significant).
10704There can be any number of ampersand-separated variables; for each the
10705wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
10706
10707@item %@{@code{S}:@code{X}@}
10708Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
10709
10710@item %@{!@code{S}:@code{X}@}
10711Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
10712
10713@item %@{@code{S}*:@code{X}@}
10714Substitutes @code{X} if one or more switches whose names start with
10715@code{-S} are specified to GCC@.  Normally @code{X} is substituted only
10716once, no matter how many such switches appeared.  However, if @code{%*}
10717appears somewhere in @code{X}, then @code{X} is substituted once
10718for each matching switch, with the @code{%*} replaced by the part of
10719that switch matching the @code{*}.
10720
10721@item %@{.@code{S}:@code{X}@}
10722Substitutes @code{X}, if processing a file with suffix @code{S}.
10723
10724@item %@{!.@code{S}:@code{X}@}
10725Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
10726
10727@item %@{,@code{S}:@code{X}@}
10728Substitutes @code{X}, if processing a file for language @code{S}.
10729
10730@item %@{!,@code{S}:@code{X}@}
10731Substitutes @code{X}, if not processing a file for language @code{S}.
10732
10733@item %@{@code{S}|@code{P}:@code{X}@}
10734Substitutes @code{X} if either @code{-S} or @code{-P} is given to
10735GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
10736@code{*} sequences as well, although they have a stronger binding than
10737the @samp{|}.  If @code{%*} appears in @code{X}, all of the
10738alternatives must be starred, and only the first matching alternative
10739is substituted.
10740
10741For example, a spec string like this:
10742
10743@smallexample
10744%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
10745@end smallexample
10746
10747@noindent
10748outputs the following command-line options from the following input
10749command-line options:
10750
10751@smallexample
10752fred.c        -foo -baz
10753jim.d         -bar -boggle
10754-d fred.c     -foo -baz -boggle
10755-d jim.d      -bar -baz -boggle
10756@end smallexample
10757
10758@item %@{S:X; T:Y; :D@}
10759
10760If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
10761given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
10762be as many clauses as you need.  This may be combined with @code{.},
10763@code{,}, @code{!}, @code{|}, and @code{*} as needed.
10764
10765
10766@end table
10767
10768The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
10769construct may contain other nested @samp{%} constructs or spaces, or
10770even newlines.  They are processed as usual, as described above.
10771Trailing white space in @code{X} is ignored.  White space may also
10772appear anywhere on the left side of the colon in these constructs,
10773except between @code{.} or @code{*} and the corresponding word.
10774
10775The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
10776handled specifically in these constructs.  If another value of
10777@option{-O} or the negated form of a @option{-f}, @option{-m}, or
10778@option{-W} switch is found later in the command line, the earlier
10779switch value is ignored, except with @{@code{S}*@} where @code{S} is
10780just one letter, which passes all matching options.
10781
10782The character @samp{|} at the beginning of the predicate text is used to
10783indicate that a command should be piped to the following command, but
10784only if @option{-pipe} is specified.
10785
10786It is built into GCC which switches take arguments and which do not.
10787(You might think it would be useful to generalize this to allow each
10788compiler's spec to say which switches take arguments.  But this cannot
10789be done in a consistent fashion.  GCC cannot even decide which input
10790files have been specified without knowing which switches take arguments,
10791and it must know which input files to compile in order to tell which
10792compilers to run).
10793
10794GCC also knows implicitly that arguments starting in @option{-l} are to be
10795treated as compiler output files, and passed to the linker in their
10796proper position among the other output files.
10797
10798@c man begin OPTIONS
10799
10800@node Target Options
10801@section Specifying Target Machine and Compiler Version
10802@cindex target options
10803@cindex cross compiling
10804@cindex specifying machine version
10805@cindex specifying compiler version and target machine
10806@cindex compiler version, specifying
10807@cindex target machine, specifying
10808
10809The usual way to run GCC is to run the executable called @command{gcc}, or
10810@command{@var{machine}-gcc} when cross-compiling, or
10811@command{@var{machine}-gcc-@var{version}} to run a version other than the
10812one that was installed last.
10813
10814@node Submodel Options
10815@section Hardware Models and Configurations
10816@cindex submodel options
10817@cindex specifying hardware config
10818@cindex hardware models and configurations, specifying
10819@cindex machine dependent options
10820
10821Each target machine types can have its own
10822special options, starting with @samp{-m}, to choose among various
10823hardware models or configurations---for example, 68010 vs 68020,
10824floating coprocessor or none.  A single installed version of the
10825compiler can compile for any model or configuration, according to the
10826options specified.
10827
10828Some configurations of the compiler also support additional special
10829options, usually for compatibility with other compilers on the same
10830platform.
10831
10832@c This list is ordered alphanumerically by subsection name.
10833@c It should be the same order and spelling as these options are listed
10834@c in Machine Dependent Options
10835
10836@menu
10837* AArch64 Options::
10838* Adapteva Epiphany Options::
10839* ARM Options::
10840* AVR Options::
10841* Blackfin Options::
10842* C6X Options::
10843* CRIS Options::
10844* CR16 Options::
10845* Darwin Options::
10846* DEC Alpha Options::
10847* FR30 Options::
10848* FRV Options::
10849* GNU/Linux Options::
10850* H8/300 Options::
10851* HPPA Options::
10852* i386 and x86-64 Options::
10853* i386 and x86-64 Windows Options::
10854* IA-64 Options::
10855* LM32 Options::
10856* M32C Options::
10857* M32R/D Options::
10858* M680x0 Options::
10859* MCore Options::
10860* MeP Options::
10861* MicroBlaze Options::
10862* MIPS Options::
10863* MMIX Options::
10864* MN10300 Options::
10865* Moxie Options::
10866* PDP-11 Options::
10867* picoChip Options::
10868* PowerPC Options::
10869* RL78 Options::
10870* RS/6000 and PowerPC Options::
10871* RX Options::
10872* S/390 and zSeries Options::
10873* Score Options::
10874* SH Options::
10875* Solaris 2 Options::
10876* SPARC Options::
10877* SPU Options::
10878* System V Options::
10879* TILE-Gx Options::
10880* TILEPro Options::
10881* V850 Options::
10882* VAX Options::
10883* VMS Options::
10884* VxWorks Options::
10885* x86-64 Options::
10886* Xstormy16 Options::
10887* Xtensa Options::
10888* zSeries Options::
10889@end menu
10890
10891@node AArch64 Options
10892@subsection AArch64 Options
10893@cindex AArch64 Options
10894
10895These options are defined for AArch64 implementations:
10896
10897@table @gcctabopt
10898
10899@item -mbig-endian
10900@opindex mbig-endian
10901Generate big-endian code.  This is the default when GCC is configured for an
10902@samp{aarch64_be-*-*} target.
10903
10904@item -mgeneral-regs-only
10905@opindex mgeneral-regs-only
10906Generate code which uses only the general registers.
10907
10908@item -mlittle-endian
10909@opindex mlittle-endian
10910Generate little-endian code.  This is the default when GCC is configured for an
10911@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
10912
10913@item -mcmodel=tiny
10914@opindex mcmodel=tiny
10915Generate code for the tiny code model.  The program and its statically defined
10916symbols must be within 1GB of each other.  Pointers are 64 bits.  Programs can
10917be statically or dynamically linked.  This model is not fully implemented and
10918mostly treated as @samp{small}.
10919
10920@item -mcmodel=small
10921@opindex mcmodel=small
10922Generate code for the small code model.  The program and its statically defined
10923symbols must be within 4GB of each other.  Pointers are 64 bits.  Programs can
10924be statically or dynamically linked.  This is the default code model.
10925
10926@item -mcmodel=large
10927@opindex mcmodel=large
10928Generate code for the large code model.  This makes no assumptions about
10929addresses and sizes of sections.  Pointers are 64 bits.  Programs can be
10930statically linked only.
10931
10932@item -mstrict-align
10933@opindex mstrict-align
10934Do not assume that unaligned memory references will be handled by the system.
10935
10936@item -momit-leaf-frame-pointer
10937@itemx -mno-omit-leaf-frame-pointer
10938@opindex momit-leaf-frame-pointer
10939@opindex mno-omit-leaf-frame-pointer
10940Omit or keep the frame pointer in leaf functions.  The former behaviour is the
10941default.
10942
10943@item -mtls-dialect=desc
10944@opindex mtls-dialect=desc
10945Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
10946of TLS variables.  This is the default.
10947
10948@item -mtls-dialect=traditional
10949@opindex mtls-dialect=traditional
10950Use traditional TLS as the thread-local storage mechanism for dynamic accesses
10951of TLS variables.
10952
10953@item -mfix-cortex-a53-835769
10954@itemx -mno-fix-cortex-a53-835769
10955@opindex -mfix-cortex-a53-835769
10956@opindex -mno-fix-cortex-a53-835769
10957Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
10958This will involve inserting a NOP instruction between memory instructions and
1095964-bit integer multiply-accumulate instructions.
10960
10961@item -march=@var{name}
10962@opindex march
10963Specify the name of the target architecture, optionally suffixed by one or
10964more feature modifiers.  This option has the form
10965@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the
10966only value for @var{arch} is @samp{armv8-a}.  The possible values for
10967@var{feature} are documented in the sub-section below.
10968
10969Where conflicting feature modifiers are specified, the right-most feature is
10970used.
10971
10972GCC uses this name to determine what kind of instructions it can emit when
10973generating assembly code.  This option can be used in conjunction with or
10974instead of the @option{-mcpu=} option.
10975
10976@item -mcpu=@var{name}
10977@opindex mcpu
10978Specify the name of the target processor, optionally suffixed by one or more
10979feature modifiers.  This option has the form
10980@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the
10981possible values for @var{cpu} are @samp{generic}, @samp{large}.  The
10982possible values for @var{feature} are documented in the sub-section
10983below.
10984
10985Where conflicting feature modifiers are specified, the right-most feature is
10986used.
10987
10988GCC uses this name to determine what kind of instructions it can emit when
10989generating assembly code.
10990
10991@item -mtune=@var{name}
10992@opindex mtune
10993Specify the name of the processor to tune the performance for.  The code will
10994be tuned as if the target processor were of the type specified in this option,
10995but still using instructions compatible with the target processor specified
10996by a @option{-mcpu=} option.  This option cannot be suffixed by feature
10997modifiers.
10998
10999@end table
11000
11001@subsubsection @option{-march} and @option{-mcpu} feature modifiers
11002@cindex @option{-march} feature modifiers
11003@cindex @option{-mcpu} feature modifiers
11004Feature modifiers used with @option{-march} and @option{-mcpu} can be one
11005the following:
11006
11007@table @samp
11008@item crypto
11009Enable Crypto extension.  This implies Advanced SIMD is enabled.
11010@item fp
11011Enable floating-point instructions.
11012@item simd
11013Enable Advanced SIMD instructions.  This implies floating-point instructions
11014are enabled.  This is the default for all current possible values for options
11015@option{-march} and @option{-mcpu=}.
11016@end table
11017
11018@node Adapteva Epiphany Options
11019@subsection Adapteva Epiphany Options
11020
11021These @samp{-m} options are defined for Adapteva Epiphany:
11022
11023@table @gcctabopt
11024@item -mhalf-reg-file
11025@opindex mhalf-reg-file
11026Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
11027That allows code to run on hardware variants that lack these registers.
11028
11029@item -mprefer-short-insn-regs
11030@opindex mprefer-short-insn-regs
11031Preferrentially allocate registers that allow short instruction generation.
11032This can result in increased instruction count, so this may either reduce or
11033increase overall code size.
11034
11035@item -mbranch-cost=@var{num}
11036@opindex mbranch-cost
11037Set the cost of branches to roughly @var{num} ``simple'' instructions.
11038This cost is only a heuristic and is not guaranteed to produce
11039consistent results across releases.
11040
11041@item -mcmove
11042@opindex mcmove
11043Enable the generation of conditional moves.
11044
11045@item -mnops=@var{num}
11046@opindex mnops
11047Emit @var{num} NOPs before every other generated instruction.
11048
11049@item -mno-soft-cmpsf
11050@opindex mno-soft-cmpsf
11051For single-precision floating-point comparisons, emit an @code{fsub} instruction
11052and test the flags.  This is faster than a software comparison, but can
11053get incorrect results in the presence of NaNs, or when two different small
11054numbers are compared such that their difference is calculated as zero.
11055The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
11056software comparisons.
11057
11058@item -mstack-offset=@var{num}
11059@opindex mstack-offset
11060Set the offset between the top of the stack and the stack pointer.
11061E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
11062can be used by leaf functions without stack allocation.
11063Values other than @samp{8} or @samp{16} are untested and unlikely to work.
11064Note also that this option changes the ABI; compiling a program with a
11065different stack offset than the libraries have been compiled with
11066generally does not work.
11067This option can be useful if you want to evaluate if a different stack
11068offset would give you better code, but to actually use a different stack
11069offset to build working programs, it is recommended to configure the
11070toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
11071
11072@item -mno-round-nearest
11073@opindex mno-round-nearest
11074Make the scheduler assume that the rounding mode has been set to
11075truncating.  The default is @option{-mround-nearest}.
11076
11077@item -mlong-calls
11078@opindex mlong-calls
11079If not otherwise specified by an attribute, assume all calls might be beyond
11080the offset range of the @code{b} / @code{bl} instructions, and therefore load the
11081function address into a register before performing a (otherwise direct) call.
11082This is the default.
11083
11084@item -mshort-calls
11085@opindex short-calls
11086If not otherwise specified by an attribute, assume all direct calls are
11087in the range of the @code{b} / @code{bl} instructions, so use these instructions
11088for direct calls.  The default is @option{-mlong-calls}.
11089
11090@item -msmall16
11091@opindex msmall16
11092Assume addresses can be loaded as 16-bit unsigned values.  This does not
11093apply to function addresses for which @option{-mlong-calls} semantics
11094are in effect.
11095
11096@item -mfp-mode=@var{mode}
11097@opindex mfp-mode
11098Set the prevailing mode of the floating-point unit.
11099This determines the floating-point mode that is provided and expected
11100at function call and return time.  Making this mode match the mode you
11101predominantly need at function start can make your programs smaller and
11102faster by avoiding unnecessary mode switches.
11103
11104@var{mode} can be set to one the following values:
11105
11106@table @samp
11107@item caller
11108Any mode at function entry is valid, and retained or restored when
11109the function returns, and when it calls other functions.
11110This mode is useful for compiling libraries or other compilation units
11111you might want to incorporate into different programs with different
11112prevailing FPU modes, and the convenience of being able to use a single
11113object file outweighs the size and speed overhead for any extra
11114mode switching that might be needed, compared with what would be needed
11115with a more specific choice of prevailing FPU mode.
11116
11117@item truncate
11118This is the mode used for floating-point calculations with
11119truncating (i.e.@: round towards zero) rounding mode.  That includes
11120conversion from floating point to integer.
11121
11122@item round-nearest
11123This is the mode used for floating-point calculations with
11124round-to-nearest-or-even rounding mode.
11125
11126@item int
11127This is the mode used to perform integer calculations in the FPU, e.g.@:
11128integer multiply, or integer multiply-and-accumulate.
11129@end table
11130
11131The default is @option{-mfp-mode=caller}
11132
11133@item -mnosplit-lohi
11134@itemx -mno-postinc
11135@itemx -mno-postmodify
11136@opindex mnosplit-lohi
11137@opindex mno-postinc
11138@opindex mno-postmodify
11139Code generation tweaks that disable, respectively, splitting of 32-bit
11140loads, generation of post-increment addresses, and generation of
11141post-modify addresses.  The defaults are @option{msplit-lohi},
11142@option{-mpost-inc}, and @option{-mpost-modify}.
11143
11144@item -mnovect-double
11145@opindex mno-vect-double
11146Change the preferred SIMD mode to SImode.  The default is
11147@option{-mvect-double}, which uses DImode as preferred SIMD mode.
11148
11149@item -max-vect-align=@var{num}
11150@opindex max-vect-align
11151The maximum alignment for SIMD vector mode types.
11152@var{num} may be 4 or 8.  The default is 8.
11153Note that this is an ABI change, even though many library function
11154interfaces are unaffected if they don't use SIMD vector modes
11155in places that affect size and/or alignment of relevant types.
11156
11157@item -msplit-vecmove-early
11158@opindex msplit-vecmove-early
11159Split vector moves into single word moves before reload.  In theory this
11160can give better register allocation, but so far the reverse seems to be
11161generally the case.
11162
11163@item -m1reg-@var{reg}
11164@opindex m1reg-
11165Specify a register to hold the constant @minus{}1, which makes loading small negative
11166constants and certain bitmasks faster.
11167Allowable values for @var{reg} are @samp{r43} and @samp{r63},
11168which specify use of that register as a fixed register,
11169and @samp{none}, which means that no register is used for this
11170purpose.  The default is @option{-m1reg-none}.
11171
11172@end table
11173
11174@node ARM Options
11175@subsection ARM Options
11176@cindex ARM options
11177
11178These @samp{-m} options are defined for Advanced RISC Machines (ARM)
11179architectures:
11180
11181@table @gcctabopt
11182@item -mabi=@var{name}
11183@opindex mabi
11184Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
11185@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
11186
11187@item -mapcs-frame
11188@opindex mapcs-frame
11189Generate a stack frame that is compliant with the ARM Procedure Call
11190Standard for all functions, even if this is not strictly necessary for
11191correct execution of the code.  Specifying @option{-fomit-frame-pointer}
11192with this option causes the stack frames not to be generated for
11193leaf functions.  The default is @option{-mno-apcs-frame}.
11194
11195@item -mapcs
11196@opindex mapcs
11197This is a synonym for @option{-mapcs-frame}.
11198
11199@ignore
11200@c not currently implemented
11201@item -mapcs-stack-check
11202@opindex mapcs-stack-check
11203Generate code to check the amount of stack space available upon entry to
11204every function (that actually uses some stack space).  If there is
11205insufficient space available then either the function
11206@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} is
11207called, depending upon the amount of stack space required.  The runtime
11208system is required to provide these functions.  The default is
11209@option{-mno-apcs-stack-check}, since this produces smaller code.
11210
11211@c not currently implemented
11212@item -mapcs-float
11213@opindex mapcs-float
11214Pass floating-point arguments using the floating-point registers.  This is
11215one of the variants of the APCS@.  This option is recommended if the
11216target hardware has a floating-point unit or if a lot of floating-point
11217arithmetic is going to be performed by the code.  The default is
11218@option{-mno-apcs-float}, since the size of integer-only code is
11219slightly increased if @option{-mapcs-float} is used.
11220
11221@c not currently implemented
11222@item -mapcs-reentrant
11223@opindex mapcs-reentrant
11224Generate reentrant, position-independent code.  The default is
11225@option{-mno-apcs-reentrant}.
11226@end ignore
11227
11228@item -mthumb-interwork
11229@opindex mthumb-interwork
11230Generate code that supports calling between the ARM and Thumb
11231instruction sets.  Without this option, on pre-v5 architectures, the
11232two instruction sets cannot be reliably used inside one program.  The
11233default is @option{-mno-thumb-interwork}, since slightly larger code
11234is generated when @option{-mthumb-interwork} is specified.  In AAPCS
11235configurations this option is meaningless.
11236
11237@item -mno-sched-prolog
11238@opindex mno-sched-prolog
11239Prevent the reordering of instructions in the function prologue, or the
11240merging of those instruction with the instructions in the function's
11241body.  This means that all functions start with a recognizable set
11242of instructions (or in fact one of a choice from a small set of
11243different function prologues), and this information can be used to
11244locate the start of functions inside an executable piece of code.  The
11245default is @option{-msched-prolog}.
11246
11247@item -mfloat-abi=@var{name}
11248@opindex mfloat-abi
11249Specifies which floating-point ABI to use.  Permissible values
11250are: @samp{soft}, @samp{softfp} and @samp{hard}.
11251
11252Specifying @samp{soft} causes GCC to generate output containing
11253library calls for floating-point operations.
11254@samp{softfp} allows the generation of code using hardware floating-point
11255instructions, but still uses the soft-float calling conventions.
11256@samp{hard} allows generation of floating-point instructions
11257and uses FPU-specific calling conventions.
11258
11259The default depends on the specific target configuration.  Note that
11260the hard-float and soft-float ABIs are not link-compatible; you must
11261compile your entire program with the same ABI, and link with a
11262compatible set of libraries.
11263
11264@item -mlittle-endian
11265@opindex mlittle-endian
11266Generate code for a processor running in little-endian mode.  This is
11267the default for all standard configurations.
11268
11269@item -mbig-endian
11270@opindex mbig-endian
11271Generate code for a processor running in big-endian mode; the default is
11272to compile code for a little-endian processor.
11273
11274@item -mwords-little-endian
11275@opindex mwords-little-endian
11276This option only applies when generating code for big-endian processors.
11277Generate code for a little-endian word order but a big-endian byte
11278order.  That is, a byte order of the form @samp{32107654}.  Note: this
11279option should only be used if you require compatibility with code for
11280big-endian ARM processors generated by versions of the compiler prior to
112812.8.  This option is now deprecated.
11282
11283@item -march=@var{name}
11284@opindex march
11285This specifies the name of the target ARM architecture.  GCC uses this
11286name to determine what kind of instructions it can emit when generating
11287assembly code.  This option can be used in conjunction with or instead
11288of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
11289@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
11290@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
11291@samp{armv6}, @samp{armv6j},
11292@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
11293@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m}
11294@samp{armv8-a},
11295@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
11296
11297@option{-march=native} causes the compiler to auto-detect the architecture
11298of the build computer.  At present, this feature is only supported on
11299GNU/Linux, and not all architectures are recognized.  If the auto-detect
11300is unsuccessful the option has no effect.
11301
11302@item -mtune=@var{name}
11303@opindex mtune
11304This option specifies the name of the target ARM processor for
11305which GCC should tune the performance of the code.
11306For some ARM implementations better performance can be obtained by using
11307this option.
11308Permissible names are: @samp{arm2}, @samp{arm250},
11309@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
11310@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
11311@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
11312@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
11313@samp{arm720},
11314@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
11315@samp{arm710t}, @samp{arm720t}, @samp{arm740t},
11316@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
11317@samp{strongarm1110},
11318@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
11319@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
11320@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
11321@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
11322@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
11323@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
11324@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
11325@samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9},
11326@samp{cortex-a15}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
11327@samp{cortex-m4}, @samp{cortex-m3},
11328@samp{cortex-m1},
11329@samp{cortex-m0},
11330@samp{cortex-m0plus},
11331@samp{marvell-pj4},
11332@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
11333@samp{fa526}, @samp{fa626},
11334@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}.
11335
11336@option{-mtune=generic-@var{arch}} specifies that GCC should tune the
11337performance for a blend of processors within architecture @var{arch}.
11338The aim is to generate code that run well on the current most popular
11339processors, balancing between optimizations that benefit some CPUs in the
11340range, and avoiding performance pitfalls of other CPUs.  The effects of
11341this option may change in future GCC versions as CPU models come and go.
11342
11343@option{-mtune=native} causes the compiler to auto-detect the CPU
11344of the build computer.  At present, this feature is only supported on
11345GNU/Linux, and not all architectures are recognized.  If the auto-detect is
11346unsuccessful the option has no effect.
11347
11348@item -mcpu=@var{name}
11349@opindex mcpu
11350This specifies the name of the target ARM processor.  GCC uses this name
11351to derive the name of the target ARM architecture (as if specified
11352by @option{-march}) and the ARM processor type for which to tune for
11353performance (as if specified by @option{-mtune}).  Where this option
11354is used in conjunction with @option{-march} or @option{-mtune},
11355those options take precedence over the appropriate part of this option.
11356
11357Permissible names for this option are the same as those for
11358@option{-mtune}.
11359
11360@option{-mcpu=generic-@var{arch}} is also permissible, and is
11361equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
11362See @option{-mtune} for more information.
11363
11364@option{-mcpu=native} causes the compiler to auto-detect the CPU
11365of the build computer.  At present, this feature is only supported on
11366GNU/Linux, and not all architectures are recognized.  If the auto-detect
11367is unsuccessful the option has no effect.
11368
11369@item -mfpu=@var{name}
11370@opindex mfpu
11371This specifies what floating-point hardware (or hardware emulation) is
11372available on the target.  Permissible names are: @samp{vfp}, @samp{vfpv3},
11373@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
11374@samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
11375@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
11376@samp{fp-armv8}, @samp{neon-fp-armv8}, and @samp{crypto-neon-fp-armv8}.
11377
11378If @option{-msoft-float} is specified this specifies the format of
11379floating-point values.
11380
11381If the selected floating-point hardware includes the NEON extension
11382(e.g. @option{-mfpu}=@samp{neon}), note that floating-point
11383operations are not generated by GCC's auto-vectorization pass unless
11384@option{-funsafe-math-optimizations} is also specified.  This is
11385because NEON hardware does not fully implement the IEEE 754 standard for
11386floating-point arithmetic (in particular denormal values are treated as
11387zero), so the use of NEON instructions may lead to a loss of precision.
11388
11389@item -mfp16-format=@var{name}
11390@opindex mfp16-format
11391Specify the format of the @code{__fp16} half-precision floating-point type.
11392Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
11393the default is @samp{none}, in which case the @code{__fp16} type is not
11394defined.  @xref{Half-Precision}, for more information.
11395
11396@item -mstructure-size-boundary=@var{n}
11397@opindex mstructure-size-boundary
11398The sizes of all structures and unions are rounded up to a multiple
11399of the number of bits set by this option.  Permissible values are 8, 32
11400and 64.  The default value varies for different toolchains.  For the COFF
11401targeted toolchain the default value is 8.  A value of 64 is only allowed
11402if the underlying ABI supports it.
11403
11404Specifying a larger number can produce faster, more efficient code, but
11405can also increase the size of the program.  Different values are potentially
11406incompatible.  Code compiled with one value cannot necessarily expect to
11407work with code or libraries compiled with another value, if they exchange
11408information using structures or unions.
11409
11410@item -mabort-on-noreturn
11411@opindex mabort-on-noreturn
11412Generate a call to the function @code{abort} at the end of a
11413@code{noreturn} function.  It is executed if the function tries to
11414return.
11415
11416@item -mlong-calls
11417@itemx -mno-long-calls
11418@opindex mlong-calls
11419@opindex mno-long-calls
11420Tells the compiler to perform function calls by first loading the
11421address of the function into a register and then performing a subroutine
11422call on this register.  This switch is needed if the target function
11423lies outside of the 64-megabyte addressing range of the offset-based
11424version of subroutine call instruction.
11425
11426Even if this switch is enabled, not all function calls are turned
11427into long calls.  The heuristic is that static functions, functions
11428that have the @samp{short-call} attribute, functions that are inside
11429the scope of a @samp{#pragma no_long_calls} directive, and functions whose
11430definitions have already been compiled within the current compilation
11431unit are not turned into long calls.  The exceptions to this rule are
11432that weak function definitions, functions with the @samp{long-call}
11433attribute or the @samp{section} attribute, and functions that are within
11434the scope of a @samp{#pragma long_calls} directive are always
11435turned into long calls.
11436
11437This feature is not enabled by default.  Specifying
11438@option{-mno-long-calls} restores the default behavior, as does
11439placing the function calls within the scope of a @samp{#pragma
11440long_calls_off} directive.  Note these switches have no effect on how
11441the compiler generates code to handle function calls via function
11442pointers.
11443
11444@item -msingle-pic-base
11445@opindex msingle-pic-base
11446Treat the register used for PIC addressing as read-only, rather than
11447loading it in the prologue for each function.  The runtime system is
11448responsible for initializing this register with an appropriate value
11449before execution begins.
11450
11451@item -mpic-register=@var{reg}
11452@opindex mpic-register
11453Specify the register to be used for PIC addressing.
11454For standard PIC base case, the default will be any suitable register
11455determined by compiler.  For single PIC base case, the default is
11456@samp{R9} if target is EABI based or stack-checking is enabled,
11457otherwise the default is @samp{R10}.
11458
11459@item -mpoke-function-name
11460@opindex mpoke-function-name
11461Write the name of each function into the text section, directly
11462preceding the function prologue.  The generated code is similar to this:
11463
11464@smallexample
11465     t0
11466         .ascii "arm_poke_function_name", 0
11467         .align
11468     t1
11469         .word 0xff000000 + (t1 - t0)
11470     arm_poke_function_name
11471         mov     ip, sp
11472         stmfd   sp!, @{fp, ip, lr, pc@}
11473         sub     fp, ip, #4
11474@end smallexample
11475
11476When performing a stack backtrace, code can inspect the value of
11477@code{pc} stored at @code{fp + 0}.  If the trace function then looks at
11478location @code{pc - 12} and the top 8 bits are set, then we know that
11479there is a function name embedded immediately preceding this location
11480and has length @code{((pc[-3]) & 0xff000000)}.
11481
11482@item -mthumb
11483@itemx -marm
11484@opindex marm
11485@opindex mthumb
11486
11487Select between generating code that executes in ARM and Thumb
11488states.  The default for most configurations is to generate code
11489that executes in ARM state, but the default can be changed by
11490configuring GCC with the @option{--with-mode=}@var{state}
11491configure option.
11492
11493@item -mtpcs-frame
11494@opindex mtpcs-frame
11495Generate a stack frame that is compliant with the Thumb Procedure Call
11496Standard for all non-leaf functions.  (A leaf function is one that does
11497not call any other functions.)  The default is @option{-mno-tpcs-frame}.
11498
11499@item -mtpcs-leaf-frame
11500@opindex mtpcs-leaf-frame
11501Generate a stack frame that is compliant with the Thumb Procedure Call
11502Standard for all leaf functions.  (A leaf function is one that does
11503not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
11504
11505@item -mcallee-super-interworking
11506@opindex mcallee-super-interworking
11507Gives all externally visible functions in the file being compiled an ARM
11508instruction set header which switches to Thumb mode before executing the
11509rest of the function.  This allows these functions to be called from
11510non-interworking code.  This option is not valid in AAPCS configurations
11511because interworking is enabled by default.
11512
11513@item -mcaller-super-interworking
11514@opindex mcaller-super-interworking
11515Allows calls via function pointers (including virtual functions) to
11516execute correctly regardless of whether the target code has been
11517compiled for interworking or not.  There is a small overhead in the cost
11518of executing a function pointer if this option is enabled.  This option
11519is not valid in AAPCS configurations because interworking is enabled
11520by default.
11521
11522@item -mtp=@var{name}
11523@opindex mtp
11524Specify the access model for the thread local storage pointer.  The valid
11525models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
11526@option{cp15}, which fetches the thread pointer from @code{cp15} directly
11527(supported in the arm6k architecture), and @option{auto}, which uses the
11528best available method for the selected processor.  The default setting is
11529@option{auto}.
11530
11531@item -mtls-dialect=@var{dialect}
11532@opindex mtls-dialect
11533Specify the dialect to use for accessing thread local storage.  Two
11534@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
11535@samp{gnu} dialect selects the original GNU scheme for supporting
11536local and global dynamic TLS models.  The @samp{gnu2} dialect
11537selects the GNU descriptor scheme, which provides better performance
11538for shared libraries.  The GNU descriptor scheme is compatible with
11539the original scheme, but does require new assembler, linker and
11540library support.  Initial and local exec TLS models are unaffected by
11541this option and always use the original scheme.
11542
11543@item -mword-relocations
11544@opindex mword-relocations
11545Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
11546This is enabled by default on targets (uClinux, SymbianOS) where the runtime
11547loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
11548is specified.
11549
11550@item -mfix-cortex-m3-ldrd
11551@opindex mfix-cortex-m3-ldrd
11552Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
11553with overlapping destination and base registers are used.  This option avoids
11554generating these instructions.  This option is enabled by default when
11555@option{-mcpu=cortex-m3} is specified.
11556
11557@item -munaligned-access
11558@itemx -mno-unaligned-access
11559@opindex munaligned-access
11560@opindex mno-unaligned-access
11561Enables (or disables) reading and writing of 16- and 32- bit values
11562from addresses that are not 16- or 32- bit aligned.  By default
11563unaligned access is disabled for all pre-ARMv6 and all ARMv6-M
11564architectures, and enabled for all other architectures.  If unaligned
11565access is not enabled then words in packed data structures will be
11566accessed a byte at a time.
11567
11568The ARM attribute @code{Tag_CPU_unaligned_access} will be set in the
11569generated object file to either true or false, depending upon the
11570setting of this option.  If unaligned access is enabled then the
11571preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} will also be
11572defined.
11573
11574@end table
11575
11576@node AVR Options
11577@subsection AVR Options
11578@cindex AVR Options
11579
11580These options are defined for AVR implementations:
11581
11582@table @gcctabopt
11583@item -mmcu=@var{mcu}
11584@opindex mmcu
11585Specify Atmel AVR instruction set architectures (ISA) or MCU type.
11586
11587The default for this option is@tie{}@code{avr2}.
11588
11589GCC supports the following AVR devices and ISAs:
11590
11591@include avr-mmcu.texi
11592
11593@item -maccumulate-args
11594@opindex maccumulate-args
11595Accumulate outgoing function arguments and acquire/release the needed
11596stack space for outgoing function arguments once in function
11597prologue/epilogue.  Without this option, outgoing arguments are pushed
11598before calling a function and popped afterwards.
11599
11600Popping the arguments after the function call can be expensive on
11601AVR so that accumulating the stack space might lead to smaller
11602executables because arguments need not to be removed from the
11603stack after such a function call.
11604
11605This option can lead to reduced code size for functions that perform
11606several calls to functions that get their arguments on the stack like
11607calls to printf-like functions.
11608
11609@item -mbranch-cost=@var{cost}
11610@opindex mbranch-cost
11611Set the branch costs for conditional branch instructions to
11612@var{cost}.  Reasonable values for @var{cost} are small, non-negative
11613integers. The default branch cost is 0.
11614
11615@item -mcall-prologues
11616@opindex mcall-prologues
11617Functions prologues/epilogues are expanded as calls to appropriate
11618subroutines.  Code size is smaller.
11619
11620@item -mint8
11621@opindex mint8
11622Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
11623@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
11624and @code{long long} is 4 bytes.  Please note that this option does not
11625conform to the C standards, but it results in smaller code
11626size.
11627
11628@item -mno-interrupts
11629@opindex mno-interrupts
11630Generated code is not compatible with hardware interrupts.
11631Code size is smaller.
11632
11633@item -mrelax
11634@opindex mrelax
11635Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
11636@code{RCALL} resp.@: @code{RJMP} instruction if applicable.
11637Setting @code{-mrelax} just adds the @code{--relax} option to the
11638linker command line when the linker is called.
11639
11640Jump relaxing is performed by the linker because jump offsets are not
11641known before code is located. Therefore, the assembler code generated by the
11642compiler is the same, but the instructions in the executable may
11643differ from instructions in the assembler code.
11644
11645Relaxing must be turned on if linker stubs are needed, see the
11646section on @code{EIND} and linker stubs below.
11647
11648@item -msp8
11649@opindex msp8
11650Treat the stack pointer register as an 8-bit register,
11651i.e.@: assume the high byte of the stack pointer is zero.
11652In general, you don't need to set this option by hand.
11653
11654This option is used internally by the compiler to select and
11655build multilibs for architectures @code{avr2} and @code{avr25}.
11656These architectures mix devices with and without @code{SPH}.
11657For any setting other than @code{-mmcu=avr2} or @code{-mmcu=avr25}
11658the compiler driver will add or remove this option from the compiler
11659proper's command line, because the compiler then knows if the device
11660or architecture has an 8-bit stack pointer and thus no @code{SPH}
11661register or not.
11662
11663@item -mstrict-X
11664@opindex mstrict-X
11665Use address register @code{X} in a way proposed by the hardware.  This means
11666that @code{X} is only used in indirect, post-increment or
11667pre-decrement addressing.
11668
11669Without this option, the @code{X} register may be used in the same way
11670as @code{Y} or @code{Z} which then is emulated by additional
11671instructions.
11672For example, loading a value with @code{X+const} addressing with a
11673small non-negative @code{const < 64} to a register @var{Rn} is
11674performed as
11675
11676@example
11677adiw r26, const   ; X += const
11678ld   @var{Rn}, X        ; @var{Rn} = *X
11679sbiw r26, const   ; X -= const
11680@end example
11681
11682@item -mtiny-stack
11683@opindex mtiny-stack
11684Only change the lower 8@tie{}bits of the stack pointer.
11685
11686@item -Waddr-space-convert
11687@opindex Waddr-space-convert
11688Warn about conversions between address spaces in the case where the
11689resulting address space is not contained in the incoming address space.
11690@end table
11691
11692@subsubsection @code{EIND} and Devices with more than 128 Ki Bytes of Flash
11693@cindex @code{EIND}
11694Pointers in the implementation are 16@tie{}bits wide.
11695The address of a function or label is represented as word address so
11696that indirect jumps and calls can target any code address in the
11697range of 64@tie{}Ki words.
11698
11699In order to facilitate indirect jump on devices with more than 128@tie{}Ki
11700bytes of program memory space, there is a special function register called
11701@code{EIND} that serves as most significant part of the target address
11702when @code{EICALL} or @code{EIJMP} instructions are used.
11703
11704Indirect jumps and calls on these devices are handled as follows by
11705the compiler and are subject to some limitations:
11706
11707@itemize @bullet
11708
11709@item
11710The compiler never sets @code{EIND}.
11711
11712@item
11713The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP}
11714instructions or might read @code{EIND} directly in order to emulate an
11715indirect call/jump by means of a @code{RET} instruction.
11716
11717@item
11718The compiler assumes that @code{EIND} never changes during the startup
11719code or during the application. In particular, @code{EIND} is not
11720saved/restored in function or interrupt service routine
11721prologue/epilogue.
11722
11723@item
11724For indirect calls to functions and computed goto, the linker
11725generates @emph{stubs}. Stubs are jump pads sometimes also called
11726@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
11727The stub contains a direct jump to the desired address.
11728
11729@item
11730Linker relaxation must be turned on so that the linker will generate
11731the stubs correctly an all situaltion. See the compiler option
11732@code{-mrelax} and the linler option @code{--relax}.
11733There are corner cases where the linker is supposed to generate stubs
11734but aborts without relaxation and without a helpful error message.
11735
11736@item
11737The default linker script is arranged for code with @code{EIND = 0}.
11738If code is supposed to work for a setup with @code{EIND != 0}, a custom
11739linker script has to be used in order to place the sections whose
11740name start with @code{.trampolines} into the segment where @code{EIND}
11741points to.
11742
11743@item
11744The startup code from libgcc never sets @code{EIND}.
11745Notice that startup code is a blend of code from libgcc and AVR-LibC.
11746For the impact of AVR-LibC on @code{EIND}, see the
11747@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
11748
11749@item
11750It is legitimate for user-specific startup code to set up @code{EIND}
11751early, for example by means of initialization code located in
11752section @code{.init3}. Such code runs prior to general startup code
11753that initializes RAM and calls constructors, but after the bit
11754of startup code from AVR-LibC that sets @code{EIND} to the segment
11755where the vector table is located.
11756@example
11757#include <avr/io.h>
11758
11759static void
11760__attribute__((section(".init3"),naked,used,no_instrument_function))
11761init3_set_eind (void)
11762@{
11763  __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
11764                  "out %i0,r24" :: "n" (&EIND) : "r24","memory");
11765@}
11766@end example
11767
11768@noindent
11769The @code{__trampolines_start} symbol is defined in the linker script.
11770
11771@item
11772Stubs are generated automatically by the linker if
11773the following two conditions are met:
11774@itemize @minus
11775
11776@item The address of a label is taken by means of the @code{gs} modifier
11777(short for @emph{generate stubs}) like so:
11778@example
11779LDI r24, lo8(gs(@var{func}))
11780LDI r25, hi8(gs(@var{func}))
11781@end example
11782@item The final location of that label is in a code segment
11783@emph{outside} the segment where the stubs are located.
11784@end itemize
11785
11786@item
11787The compiler emits such @code{gs} modifiers for code labels in the
11788following situations:
11789@itemize @minus
11790@item Taking address of a function or code label.
11791@item Computed goto.
11792@item If prologue-save function is used, see @option{-mcall-prologues}
11793command-line option.
11794@item Switch/case dispatch tables. If you do not want such dispatch
11795tables you can specify the @option{-fno-jump-tables} command-line option.
11796@item C and C++ constructors/destructors called during startup/shutdown.
11797@item If the tools hit a @code{gs()} modifier explained above.
11798@end itemize
11799
11800@item
11801Jumping to non-symbolic addresses like so is @emph{not} supported:
11802
11803@example
11804int main (void)
11805@{
11806    /* Call function at word address 0x2 */
11807    return ((int(*)(void)) 0x2)();
11808@}
11809@end example
11810
11811Instead, a stub has to be set up, i.e.@: the function has to be called
11812through a symbol (@code{func_4} in the example):
11813
11814@example
11815int main (void)
11816@{
11817    extern int func_4 (void);
11818
11819    /* Call function at byte address 0x4 */
11820    return func_4();
11821@}
11822@end example
11823
11824and the application be linked with @code{-Wl,--defsym,func_4=0x4}.
11825Alternatively, @code{func_4} can be defined in the linker script.
11826@end itemize
11827
11828@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
11829@cindex @code{RAMPD}
11830@cindex @code{RAMPX}
11831@cindex @code{RAMPY}
11832@cindex @code{RAMPZ}
11833Some AVR devices support memories larger than the 64@tie{}KiB range
11834that can be accessed with 16-bit pointers.  To access memory locations
11835outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
11836register is used as high part of the address:
11837The @code{X}, @code{Y}, @code{Z} address register is concatenated
11838with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
11839register, respectively, to get a wide address. Similarly,
11840@code{RAMPD} is used together with direct addressing.
11841
11842@itemize
11843@item
11844The startup code initializes the @code{RAMP} special function
11845registers with zero.
11846
11847@item
11848If a @ref{AVR Named Address Spaces,named address space} other than
11849generic or @code{__flash} is used, then @code{RAMPZ} is set
11850as needed before the operation.
11851
11852@item
11853If the device supports RAM larger than 64@tie{KiB} and the compiler
11854needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
11855is reset to zero after the operation.
11856
11857@item
11858If the device comes with a specific @code{RAMP} register, the ISR
11859prologue/epilogue saves/restores that SFR and initializes it with
11860zero in case the ISR code might (implicitly) use it.
11861
11862@item
11863RAM larger than 64@tie{KiB} is not supported by GCC for AVR targets.
11864If you use inline assembler to read from locations outside the
1186516-bit address range and change one of the @code{RAMP} registers,
11866you must reset it to zero after the access.
11867
11868@end itemize
11869
11870@subsubsection AVR Built-in Macros
11871
11872GCC defines several built-in macros so that the user code can test
11873for the presence or absence of features.  Almost any of the following
11874built-in macros are deduced from device capabilities and thus
11875triggered by the @code{-mmcu=} command-line option.
11876
11877For even more AVR-specific built-in macros see
11878@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
11879
11880@table @code
11881
11882@item __AVR_ARCH__
11883Build-in macro that resolves to a decimal number that identifies the
11884architecture and depends on the @code{-mmcu=@var{mcu}} option.
11885Possible values are:
11886
11887@code{2}, @code{25}, @code{3}, @code{31}, @code{35},
11888@code{4}, @code{5}, @code{51}, @code{6}, @code{102}, @code{104},
11889@code{105}, @code{106}, @code{107}
11890
11891for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3},
11892@code{avr31}, @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51},
11893@code{avr6}, @code{avrxmega2}, @code{avrxmega4}, @code{avrxmega5},
11894@code{avrxmega6}, @code{avrxmega7}, respectively.
11895If @var{mcu} specifies a device, this built-in macro is set
11896accordingly. For example, with @code{-mmcu=atmega8} the macro will be
11897defined to @code{4}.
11898
11899@item __AVR_@var{Device}__
11900Setting @code{-mmcu=@var{device}} defines this built-in macro which reflects
11901the device's name. For example, @code{-mmcu=atmega8} defines the
11902built-in macro @code{__AVR_ATmega8__}, @code{-mmcu=attiny261a} defines
11903@code{__AVR_ATtiny261A__}, etc.
11904
11905The built-in macros' names follow
11906the scheme @code{__AVR_@var{Device}__} where @var{Device} is
11907the device name as from the AVR user manual. The difference between
11908@var{Device} in the built-in macro and @var{device} in
11909@code{-mmcu=@var{device}} is that the latter is always lowercase.
11910
11911If @var{device} is not a device but only a core architecture like
11912@code{avr51}, this macro will not be defined.
11913
11914@item __AVR_XMEGA__
11915The device / architecture belongs to the XMEGA family of devices.
11916
11917@item __AVR_HAVE_ELPM__
11918The device has the the @code{ELPM} instruction.
11919
11920@item __AVR_HAVE_ELPMX__
11921The device has the @code{ELPM R@var{n},Z} and @code{ELPM
11922R@var{n},Z+} instructions.
11923
11924@item __AVR_HAVE_MOVW__
11925The device has the @code{MOVW} instruction to perform 16-bit
11926register-register moves.
11927
11928@item __AVR_HAVE_LPMX__
11929The device has the @code{LPM R@var{n},Z} and
11930@code{LPM R@var{n},Z+} instructions.
11931
11932@item __AVR_HAVE_MUL__
11933The device has a hardware multiplier.
11934
11935@item __AVR_HAVE_JMP_CALL__
11936The device has the @code{JMP} and @code{CALL} instructions.
11937This is the case for devices with at least 16@tie{}KiB of program
11938memory.
11939
11940@item __AVR_HAVE_EIJMP_EICALL__
11941@itemx __AVR_3_BYTE_PC__
11942The device has the @code{EIJMP} and @code{EICALL} instructions.
11943This is the case for devices with more than 128@tie{}KiB of program memory.
11944This also means that the program counter
11945(PC) is 3@tie{}bytes wide.
11946
11947@item __AVR_2_BYTE_PC__
11948The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
11949with up to 128@tie{}KiB of program memory.
11950
11951@item __AVR_HAVE_8BIT_SP__
11952@itemx __AVR_HAVE_16BIT_SP__
11953The stack pointer (SP) register is treated as 8-bit respectively
1195416-bit register by the compiler.
11955The definition of these macros is affected by @code{-mtiny-stack}.
11956
11957@item __AVR_HAVE_SPH__
11958@itemx __AVR_SP8__
11959The device has the SPH (high part of stack pointer) special function
11960register or has an 8-bit stack pointer, respectively.
11961The definition of these macros is affected by @code{-mmcu=} and
11962in the cases of @code{-mmcu=avr2} and @code{-mmcu=avr25} also
11963by @code{-msp8}.
11964
11965@item __AVR_HAVE_RAMPD__
11966@itemx __AVR_HAVE_RAMPX__
11967@itemx __AVR_HAVE_RAMPY__
11968@itemx __AVR_HAVE_RAMPZ__
11969The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
11970@code{RAMPZ} special function register, respectively.
11971
11972@item __NO_INTERRUPTS__
11973This macro reflects the @code{-mno-interrupts} command line option.
11974
11975@item __AVR_ERRATA_SKIP__
11976@itemx __AVR_ERRATA_SKIP_JMP_CALL__
11977Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
11978instructions because of a hardware erratum.  Skip instructions are
11979@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
11980The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
11981set.
11982
11983@item __AVR_SFR_OFFSET__=@var{offset}
11984Instructions that can address I/O special function registers directly
11985like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
11986address as if addressed by an instruction to access RAM like @code{LD}
11987or @code{STS}. This offset depends on the device architecture and has
11988to be subtracted from the RAM address in order to get the
11989respective I/O@tie{}address.
11990
11991@item __WITH_AVRLIBC__
11992The compiler is configured to be used together with AVR-Libc.
11993See the @code{--with-avrlibc} configure option.
11994
11995@end table
11996
11997@node Blackfin Options
11998@subsection Blackfin Options
11999@cindex Blackfin Options
12000
12001@table @gcctabopt
12002@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
12003@opindex mcpu=
12004Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
12005can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
12006@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
12007@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
12008@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
12009@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
12010@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
12011@samp{bf561}, @samp{bf592}.
12012
12013The optional @var{sirevision} specifies the silicon revision of the target
12014Blackfin processor.  Any workarounds available for the targeted silicon revision
12015are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
12016If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
12017are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
12018hexadecimal digits representing the major and minor numbers in the silicon
12019revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
12020is not defined.  If @var{sirevision} is @samp{any}, the
12021@code{__SILICON_REVISION__} is defined to be @code{0xffff}.
12022If this optional @var{sirevision} is not used, GCC assumes the latest known
12023silicon revision of the targeted Blackfin processor.
12024
12025GCC defines a preprocessor macro for the specified @var{cpu}.
12026For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
12027provided by libgloss to be linked in if @option{-msim} is not given.
12028
12029Without this option, @samp{bf532} is used as the processor by default.
12030
12031Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
12032only the preprocessor macro is defined.
12033
12034@item -msim
12035@opindex msim
12036Specifies that the program will be run on the simulator.  This causes
12037the simulator BSP provided by libgloss to be linked in.  This option
12038has effect only for @samp{bfin-elf} toolchain.
12039Certain other options, such as @option{-mid-shared-library} and
12040@option{-mfdpic}, imply @option{-msim}.
12041
12042@item -momit-leaf-frame-pointer
12043@opindex momit-leaf-frame-pointer
12044Don't keep the frame pointer in a register for leaf functions.  This
12045avoids the instructions to save, set up and restore frame pointers and
12046makes an extra register available in leaf functions.  The option
12047@option{-fomit-frame-pointer} removes the frame pointer for all functions,
12048which might make debugging harder.
12049
12050@item -mspecld-anomaly
12051@opindex mspecld-anomaly
12052When enabled, the compiler ensures that the generated code does not
12053contain speculative loads after jump instructions. If this option is used,
12054@code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
12055
12056@item -mno-specld-anomaly
12057@opindex mno-specld-anomaly
12058Don't generate extra code to prevent speculative loads from occurring.
12059
12060@item -mcsync-anomaly
12061@opindex mcsync-anomaly
12062When enabled, the compiler ensures that the generated code does not
12063contain CSYNC or SSYNC instructions too soon after conditional branches.
12064If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
12065
12066@item -mno-csync-anomaly
12067@opindex mno-csync-anomaly
12068Don't generate extra code to prevent CSYNC or SSYNC instructions from
12069occurring too soon after a conditional branch.
12070
12071@item -mlow-64k
12072@opindex mlow-64k
12073When enabled, the compiler is free to take advantage of the knowledge that
12074the entire program fits into the low 64k of memory.
12075
12076@item -mno-low-64k
12077@opindex mno-low-64k
12078Assume that the program is arbitrarily large.  This is the default.
12079
12080@item -mstack-check-l1
12081@opindex mstack-check-l1
12082Do stack checking using information placed into L1 scratchpad memory by the
12083uClinux kernel.
12084
12085@item -mid-shared-library
12086@opindex mid-shared-library
12087Generate code that supports shared libraries via the library ID method.
12088This allows for execute in place and shared libraries in an environment
12089without virtual memory management.  This option implies @option{-fPIC}.
12090With a @samp{bfin-elf} target, this option implies @option{-msim}.
12091
12092@item -mno-id-shared-library
12093@opindex mno-id-shared-library
12094Generate code that doesn't assume ID-based shared libraries are being used.
12095This is the default.
12096
12097@item -mleaf-id-shared-library
12098@opindex mleaf-id-shared-library
12099Generate code that supports shared libraries via the library ID method,
12100but assumes that this library or executable won't link against any other
12101ID shared libraries.  That allows the compiler to use faster code for jumps
12102and calls.
12103
12104@item -mno-leaf-id-shared-library
12105@opindex mno-leaf-id-shared-library
12106Do not assume that the code being compiled won't link against any ID shared
12107libraries.  Slower code is generated for jump and call insns.
12108
12109@item -mshared-library-id=n
12110@opindex mshared-library-id
12111Specifies the identification number of the ID-based shared library being
12112compiled.  Specifying a value of 0 generates more compact code; specifying
12113other values forces the allocation of that number to the current
12114library but is no more space- or time-efficient than omitting this option.
12115
12116@item -msep-data
12117@opindex msep-data
12118Generate code that allows the data segment to be located in a different
12119area of memory from the text segment.  This allows for execute in place in
12120an environment without virtual memory management by eliminating relocations
12121against the text section.
12122
12123@item -mno-sep-data
12124@opindex mno-sep-data
12125Generate code that assumes that the data segment follows the text segment.
12126This is the default.
12127
12128@item -mlong-calls
12129@itemx -mno-long-calls
12130@opindex mlong-calls
12131@opindex mno-long-calls
12132Tells the compiler to perform function calls by first loading the
12133address of the function into a register and then performing a subroutine
12134call on this register.  This switch is needed if the target function
12135lies outside of the 24-bit addressing range of the offset-based
12136version of subroutine call instruction.
12137
12138This feature is not enabled by default.  Specifying
12139@option{-mno-long-calls} restores the default behavior.  Note these
12140switches have no effect on how the compiler generates code to handle
12141function calls via function pointers.
12142
12143@item -mfast-fp
12144@opindex mfast-fp
12145Link with the fast floating-point library. This library relaxes some of
12146the IEEE floating-point standard's rules for checking inputs against
12147Not-a-Number (NAN), in the interest of performance.
12148
12149@item -minline-plt
12150@opindex minline-plt
12151Enable inlining of PLT entries in function calls to functions that are
12152not known to bind locally.  It has no effect without @option{-mfdpic}.
12153
12154@item -mmulticore
12155@opindex mmulticore
12156Build a standalone application for multicore Blackfin processors.
12157This option causes proper start files and link scripts supporting
12158multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
12159It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
12160
12161This option can be used with @option{-mcorea} or @option{-mcoreb}, which
12162selects the one-application-per-core programming model.  Without
12163@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
12164programming model is used. In this model, the main function of Core B
12165should be named as @code{coreb_main}.
12166
12167If this option is not used, the single-core application programming
12168model is used.
12169
12170@item -mcorea
12171@opindex mcorea
12172Build a standalone application for Core A of BF561 when using
12173the one-application-per-core programming model. Proper start files
12174and link scripts are used to support Core A, and the macro
12175@code{__BFIN_COREA} is defined.
12176This option can only be used in conjunction with @option{-mmulticore}.
12177
12178@item -mcoreb
12179@opindex mcoreb
12180Build a standalone application for Core B of BF561 when using
12181the one-application-per-core programming model. Proper start files
12182and link scripts are used to support Core B, and the macro
12183@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
12184should be used instead of @code{main}.
12185This option can only be used in conjunction with @option{-mmulticore}.
12186
12187@item -msdram
12188@opindex msdram
12189Build a standalone application for SDRAM. Proper start files and
12190link scripts are used to put the application into SDRAM, and the macro
12191@code{__BFIN_SDRAM} is defined.
12192The loader should initialize SDRAM before loading the application.
12193
12194@item -micplb
12195@opindex micplb
12196Assume that ICPLBs are enabled at run time.  This has an effect on certain
12197anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
12198are enabled; for standalone applications the default is off.
12199@end table
12200
12201@node C6X Options
12202@subsection C6X Options
12203@cindex C6X Options
12204
12205@table @gcctabopt
12206@item -march=@var{name}
12207@opindex march
12208This specifies the name of the target architecture.  GCC uses this
12209name to determine what kind of instructions it can emit when generating
12210assembly code.  Permissible names are: @samp{c62x},
12211@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
12212
12213@item -mbig-endian
12214@opindex mbig-endian
12215Generate code for a big-endian target.
12216
12217@item -mlittle-endian
12218@opindex mlittle-endian
12219Generate code for a little-endian target.  This is the default.
12220
12221@item -msim
12222@opindex msim
12223Choose startup files and linker script suitable for the simulator.
12224
12225@item -msdata=default
12226@opindex msdata=default
12227Put small global and static data in the @samp{.neardata} section,
12228which is pointed to by register @code{B14}.  Put small uninitialized
12229global and static data in the @samp{.bss} section, which is adjacent
12230to the @samp{.neardata} section.  Put small read-only data into the
12231@samp{.rodata} section.  The corresponding sections used for large
12232pieces of data are @samp{.fardata}, @samp{.far} and @samp{.const}.
12233
12234@item -msdata=all
12235@opindex msdata=all
12236Put all data, not just small objects, into the sections reserved for
12237small data, and use addressing relative to the @code{B14} register to
12238access them.
12239
12240@item -msdata=none
12241@opindex msdata=none
12242Make no use of the sections reserved for small data, and use absolute
12243addresses to access all data.  Put all initialized global and static
12244data in the @samp{.fardata} section, and all uninitialized data in the
12245@samp{.far} section.  Put all constant data into the @samp{.const}
12246section.
12247@end table
12248
12249@node CRIS Options
12250@subsection CRIS Options
12251@cindex CRIS Options
12252
12253These options are defined specifically for the CRIS ports.
12254
12255@table @gcctabopt
12256@item -march=@var{architecture-type}
12257@itemx -mcpu=@var{architecture-type}
12258@opindex march
12259@opindex mcpu
12260Generate code for the specified architecture.  The choices for
12261@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
12262respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
12263Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
12264@samp{v10}.
12265
12266@item -mtune=@var{architecture-type}
12267@opindex mtune
12268Tune to @var{architecture-type} everything applicable about the generated
12269code, except for the ABI and the set of available instructions.  The
12270choices for @var{architecture-type} are the same as for
12271@option{-march=@var{architecture-type}}.
12272
12273@item -mmax-stack-frame=@var{n}
12274@opindex mmax-stack-frame
12275Warn when the stack frame of a function exceeds @var{n} bytes.
12276
12277@item -metrax4
12278@itemx -metrax100
12279@opindex metrax4
12280@opindex metrax100
12281The options @option{-metrax4} and @option{-metrax100} are synonyms for
12282@option{-march=v3} and @option{-march=v8} respectively.
12283
12284@item -mmul-bug-workaround
12285@itemx -mno-mul-bug-workaround
12286@opindex mmul-bug-workaround
12287@opindex mno-mul-bug-workaround
12288Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
12289models where it applies.  This option is active by default.
12290
12291@item -mpdebug
12292@opindex mpdebug
12293Enable CRIS-specific verbose debug-related information in the assembly
12294code.  This option also has the effect of turning off the @samp{#NO_APP}
12295formatted-code indicator to the assembler at the beginning of the
12296assembly file.
12297
12298@item -mcc-init
12299@opindex mcc-init
12300Do not use condition-code results from previous instruction; always emit
12301compare and test instructions before use of condition codes.
12302
12303@item -mno-side-effects
12304@opindex mno-side-effects
12305Do not emit instructions with side effects in addressing modes other than
12306post-increment.
12307
12308@item -mstack-align
12309@itemx -mno-stack-align
12310@itemx -mdata-align
12311@itemx -mno-data-align
12312@itemx -mconst-align
12313@itemx -mno-const-align
12314@opindex mstack-align
12315@opindex mno-stack-align
12316@opindex mdata-align
12317@opindex mno-data-align
12318@opindex mconst-align
12319@opindex mno-const-align
12320These options (@samp{no-} options) arrange (eliminate arrangements) for the
12321stack frame, individual data and constants to be aligned for the maximum
12322single data access size for the chosen CPU model.  The default is to
12323arrange for 32-bit alignment.  ABI details such as structure layout are
12324not affected by these options.
12325
12326@item -m32-bit
12327@itemx -m16-bit
12328@itemx -m8-bit
12329@opindex m32-bit
12330@opindex m16-bit
12331@opindex m8-bit
12332Similar to the stack- data- and const-align options above, these options
12333arrange for stack frame, writable data and constants to all be 32-bit,
1233416-bit or 8-bit aligned.  The default is 32-bit alignment.
12335
12336@item -mno-prologue-epilogue
12337@itemx -mprologue-epilogue
12338@opindex mno-prologue-epilogue
12339@opindex mprologue-epilogue
12340With @option{-mno-prologue-epilogue}, the normal function prologue and
12341epilogue which set up the stack frame are omitted and no return
12342instructions or return sequences are generated in the code.  Use this
12343option only together with visual inspection of the compiled code: no
12344warnings or errors are generated when call-saved registers must be saved,
12345or storage for local variables needs to be allocated.
12346
12347@item -mno-gotplt
12348@itemx -mgotplt
12349@opindex mno-gotplt
12350@opindex mgotplt
12351With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
12352instruction sequences that load addresses for functions from the PLT part
12353of the GOT rather than (traditional on other architectures) calls to the
12354PLT@.  The default is @option{-mgotplt}.
12355
12356@item -melf
12357@opindex melf
12358Legacy no-op option only recognized with the cris-axis-elf and
12359cris-axis-linux-gnu targets.
12360
12361@item -mlinux
12362@opindex mlinux
12363Legacy no-op option only recognized with the cris-axis-linux-gnu target.
12364
12365@item -sim
12366@opindex sim
12367This option, recognized for the cris-axis-elf, arranges
12368to link with input-output functions from a simulator library.  Code,
12369initialized data and zero-initialized data are allocated consecutively.
12370
12371@item -sim2
12372@opindex sim2
12373Like @option{-sim}, but pass linker options to locate initialized data at
123740x40000000 and zero-initialized data at 0x80000000.
12375@end table
12376
12377@node CR16 Options
12378@subsection CR16 Options
12379@cindex CR16 Options
12380
12381These options are defined specifically for the CR16 ports.
12382
12383@table @gcctabopt
12384
12385@item -mmac
12386@opindex mmac
12387Enable the use of multiply-accumulate instructions. Disabled by default.
12388
12389@item -mcr16cplus
12390@itemx -mcr16c
12391@opindex mcr16cplus
12392@opindex mcr16c
12393Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
12394is default.
12395
12396@item -msim
12397@opindex msim
12398Links the library libsim.a which is in compatible with simulator. Applicable
12399to ELF compiler only.
12400
12401@item -mint32
12402@opindex mint32
12403Choose integer type as 32-bit wide.
12404
12405@item -mbit-ops
12406@opindex mbit-ops
12407Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
12408
12409@item -mdata-model=@var{model}
12410@opindex mdata-model
12411Choose a data model. The choices for @var{model} are @samp{near},
12412@samp{far} or @samp{medium}. @samp{medium} is default.
12413However, @samp{far} is not valid with @option{-mcr16c}, as the
12414CR16C architecture does not support the far data model.
12415@end table
12416
12417@node Darwin Options
12418@subsection Darwin Options
12419@cindex Darwin options
12420
12421These options are defined for all architectures running the Darwin operating
12422system.
12423
12424FSF GCC on Darwin does not create ``fat'' object files; it creates
12425an object file for the single architecture that GCC was built to
12426target.  Apple's GCC on Darwin does create ``fat'' files if multiple
12427@option{-arch} options are used; it does so by running the compiler or
12428linker multiple times and joining the results together with
12429@file{lipo}.
12430
12431The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
12432@samp{i686}) is determined by the flags that specify the ISA
12433that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
12434@option{-force_cpusubtype_ALL} option can be used to override this.
12435
12436The Darwin tools vary in their behavior when presented with an ISA
12437mismatch.  The assembler, @file{as}, only permits instructions to
12438be used that are valid for the subtype of the file it is generating,
12439so you cannot put 64-bit instructions in a @samp{ppc750} object file.
12440The linker for shared libraries, @file{/usr/bin/libtool}, fails
12441and prints an error if asked to create a shared library with a less
12442restrictive subtype than its input files (for instance, trying to put
12443a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
12444for executables, @command{ld}, quietly gives the executable the most
12445restrictive subtype of any of its input files.
12446
12447@table @gcctabopt
12448@item -F@var{dir}
12449@opindex F
12450Add the framework directory @var{dir} to the head of the list of
12451directories to be searched for header files.  These directories are
12452interleaved with those specified by @option{-I} options and are
12453scanned in a left-to-right order.
12454
12455A framework directory is a directory with frameworks in it.  A
12456framework is a directory with a @file{Headers} and/or
12457@file{PrivateHeaders} directory contained directly in it that ends
12458in @file{.framework}.  The name of a framework is the name of this
12459directory excluding the @file{.framework}.  Headers associated with
12460the framework are found in one of those two directories, with
12461@file{Headers} being searched first.  A subframework is a framework
12462directory that is in a framework's @file{Frameworks} directory.
12463Includes of subframework headers can only appear in a header of a
12464framework that contains the subframework, or in a sibling subframework
12465header.  Two subframeworks are siblings if they occur in the same
12466framework.  A subframework should not have the same name as a
12467framework; a warning is issued if this is violated.  Currently a
12468subframework cannot have subframeworks; in the future, the mechanism
12469may be extended to support this.  The standard frameworks can be found
12470in @file{/System/Library/Frameworks} and
12471@file{/Library/Frameworks}.  An example include looks like
12472@code{#include <Framework/header.h>}, where @file{Framework} denotes
12473the name of the framework and @file{header.h} is found in the
12474@file{PrivateHeaders} or @file{Headers} directory.
12475
12476@item -iframework@var{dir}
12477@opindex iframework
12478Like @option{-F} except the directory is a treated as a system
12479directory.  The main difference between this @option{-iframework} and
12480@option{-F} is that with @option{-iframework} the compiler does not
12481warn about constructs contained within header files found via
12482@var{dir}.  This option is valid only for the C family of languages.
12483
12484@item -gused
12485@opindex gused
12486Emit debugging information for symbols that are used.  For stabs
12487debugging format, this enables @option{-feliminate-unused-debug-symbols}.
12488This is by default ON@.
12489
12490@item -gfull
12491@opindex gfull
12492Emit debugging information for all symbols and types.
12493
12494@item -mmacosx-version-min=@var{version}
12495The earliest version of MacOS X that this executable will run on
12496is @var{version}.  Typical values of @var{version} include @code{10.1},
12497@code{10.2}, and @code{10.3.9}.
12498
12499If the compiler was built to use the system's headers by default,
12500then the default for this option is the system version on which the
12501compiler is running, otherwise the default is to make choices that
12502are compatible with as many systems and code bases as possible.
12503
12504@item -mkernel
12505@opindex mkernel
12506Enable kernel development mode.  The @option{-mkernel} option sets
12507@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
12508@option{-fno-exceptions}, @option{-fno-non-call-exceptions},
12509@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
12510applicable.  This mode also sets @option{-mno-altivec},
12511@option{-msoft-float}, @option{-fno-builtin} and
12512@option{-mlong-branch} for PowerPC targets.
12513
12514@item -mone-byte-bool
12515@opindex mone-byte-bool
12516Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
12517By default @samp{sizeof(bool)} is @samp{4} when compiling for
12518Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
12519option has no effect on x86.
12520
12521@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
12522to generate code that is not binary compatible with code generated
12523without that switch.  Using this switch may require recompiling all
12524other modules in a program, including system libraries.  Use this
12525switch to conform to a non-default data model.
12526
12527@item -mfix-and-continue
12528@itemx -ffix-and-continue
12529@itemx -findirect-data
12530@opindex mfix-and-continue
12531@opindex ffix-and-continue
12532@opindex findirect-data
12533Generate code suitable for fast turnaround development, such as to
12534allow GDB to dynamically load @code{.o} files into already-running
12535programs.  @option{-findirect-data} and @option{-ffix-and-continue}
12536are provided for backwards compatibility.
12537
12538@item -all_load
12539@opindex all_load
12540Loads all members of static archive libraries.
12541See man ld(1) for more information.
12542
12543@item -arch_errors_fatal
12544@opindex arch_errors_fatal
12545Cause the errors having to do with files that have the wrong architecture
12546to be fatal.
12547
12548@item -bind_at_load
12549@opindex bind_at_load
12550Causes the output file to be marked such that the dynamic linker will
12551bind all undefined references when the file is loaded or launched.
12552
12553@item -bundle
12554@opindex bundle
12555Produce a Mach-o bundle format file.
12556See man ld(1) for more information.
12557
12558@item -bundle_loader @var{executable}
12559@opindex bundle_loader
12560This option specifies the @var{executable} that will load the build
12561output file being linked.  See man ld(1) for more information.
12562
12563@item -dynamiclib
12564@opindex dynamiclib
12565When passed this option, GCC produces a dynamic library instead of
12566an executable when linking, using the Darwin @file{libtool} command.
12567
12568@item -force_cpusubtype_ALL
12569@opindex force_cpusubtype_ALL
12570This causes GCC's output file to have the @var{ALL} subtype, instead of
12571one controlled by the @option{-mcpu} or @option{-march} option.
12572
12573@item -allowable_client  @var{client_name}
12574@itemx -client_name
12575@itemx -compatibility_version
12576@itemx -current_version
12577@itemx -dead_strip
12578@itemx -dependency-file
12579@itemx -dylib_file
12580@itemx -dylinker_install_name
12581@itemx -dynamic
12582@itemx -exported_symbols_list
12583@itemx -filelist
12584@need 800
12585@itemx -flat_namespace
12586@itemx -force_flat_namespace
12587@itemx -headerpad_max_install_names
12588@itemx -image_base
12589@itemx -init
12590@itemx -install_name
12591@itemx -keep_private_externs
12592@itemx -multi_module
12593@itemx -multiply_defined
12594@itemx -multiply_defined_unused
12595@need 800
12596@itemx -noall_load
12597@itemx -no_dead_strip_inits_and_terms
12598@itemx -nofixprebinding
12599@itemx -nomultidefs
12600@itemx -noprebind
12601@itemx -noseglinkedit
12602@itemx -pagezero_size
12603@itemx -prebind
12604@itemx -prebind_all_twolevel_modules
12605@itemx -private_bundle
12606@need 800
12607@itemx -read_only_relocs
12608@itemx -sectalign
12609@itemx -sectobjectsymbols
12610@itemx -whyload
12611@itemx -seg1addr
12612@itemx -sectcreate
12613@itemx -sectobjectsymbols
12614@itemx -sectorder
12615@itemx -segaddr
12616@itemx -segs_read_only_addr
12617@need 800
12618@itemx -segs_read_write_addr
12619@itemx -seg_addr_table
12620@itemx -seg_addr_table_filename
12621@itemx -seglinkedit
12622@itemx -segprot
12623@itemx -segs_read_only_addr
12624@itemx -segs_read_write_addr
12625@itemx -single_module
12626@itemx -static
12627@itemx -sub_library
12628@need 800
12629@itemx -sub_umbrella
12630@itemx -twolevel_namespace
12631@itemx -umbrella
12632@itemx -undefined
12633@itemx -unexported_symbols_list
12634@itemx -weak_reference_mismatches
12635@itemx -whatsloaded
12636@opindex allowable_client
12637@opindex client_name
12638@opindex compatibility_version
12639@opindex current_version
12640@opindex dead_strip
12641@opindex dependency-file
12642@opindex dylib_file
12643@opindex dylinker_install_name
12644@opindex dynamic
12645@opindex exported_symbols_list
12646@opindex filelist
12647@opindex flat_namespace
12648@opindex force_flat_namespace
12649@opindex headerpad_max_install_names
12650@opindex image_base
12651@opindex init
12652@opindex install_name
12653@opindex keep_private_externs
12654@opindex multi_module
12655@opindex multiply_defined
12656@opindex multiply_defined_unused
12657@opindex noall_load
12658@opindex no_dead_strip_inits_and_terms
12659@opindex nofixprebinding
12660@opindex nomultidefs
12661@opindex noprebind
12662@opindex noseglinkedit
12663@opindex pagezero_size
12664@opindex prebind
12665@opindex prebind_all_twolevel_modules
12666@opindex private_bundle
12667@opindex read_only_relocs
12668@opindex sectalign
12669@opindex sectobjectsymbols
12670@opindex whyload
12671@opindex seg1addr
12672@opindex sectcreate
12673@opindex sectobjectsymbols
12674@opindex sectorder
12675@opindex segaddr
12676@opindex segs_read_only_addr
12677@opindex segs_read_write_addr
12678@opindex seg_addr_table
12679@opindex seg_addr_table_filename
12680@opindex seglinkedit
12681@opindex segprot
12682@opindex segs_read_only_addr
12683@opindex segs_read_write_addr
12684@opindex single_module
12685@opindex static
12686@opindex sub_library
12687@opindex sub_umbrella
12688@opindex twolevel_namespace
12689@opindex umbrella
12690@opindex undefined
12691@opindex unexported_symbols_list
12692@opindex weak_reference_mismatches
12693@opindex whatsloaded
12694These options are passed to the Darwin linker.  The Darwin linker man page
12695describes them in detail.
12696@end table
12697
12698@node DEC Alpha Options
12699@subsection DEC Alpha Options
12700
12701These @samp{-m} options are defined for the DEC Alpha implementations:
12702
12703@table @gcctabopt
12704@item -mno-soft-float
12705@itemx -msoft-float
12706@opindex mno-soft-float
12707@opindex msoft-float
12708Use (do not use) the hardware floating-point instructions for
12709floating-point operations.  When @option{-msoft-float} is specified,
12710functions in @file{libgcc.a} are used to perform floating-point
12711operations.  Unless they are replaced by routines that emulate the
12712floating-point operations, or compiled in such a way as to call such
12713emulations routines, these routines issue floating-point
12714operations.   If you are compiling for an Alpha without floating-point
12715operations, you must ensure that the library is built so as not to call
12716them.
12717
12718Note that Alpha implementations without floating-point operations are
12719required to have floating-point registers.
12720
12721@item -mfp-reg
12722@itemx -mno-fp-regs
12723@opindex mfp-reg
12724@opindex mno-fp-regs
12725Generate code that uses (does not use) the floating-point register set.
12726@option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
12727register set is not used, floating-point operands are passed in integer
12728registers as if they were integers and floating-point results are passed
12729in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
12730so any function with a floating-point argument or return value called by code
12731compiled with @option{-mno-fp-regs} must also be compiled with that
12732option.
12733
12734A typical use of this option is building a kernel that does not use,
12735and hence need not save and restore, any floating-point registers.
12736
12737@item -mieee
12738@opindex mieee
12739The Alpha architecture implements floating-point hardware optimized for
12740maximum performance.  It is mostly compliant with the IEEE floating-point
12741standard.  However, for full compliance, software assistance is
12742required.  This option generates code fully IEEE-compliant code
12743@emph{except} that the @var{inexact-flag} is not maintained (see below).
12744If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
12745defined during compilation.  The resulting code is less efficient but is
12746able to correctly support denormalized numbers and exceptional IEEE
12747values such as not-a-number and plus/minus infinity.  Other Alpha
12748compilers call this option @option{-ieee_with_no_inexact}.
12749
12750@item -mieee-with-inexact
12751@opindex mieee-with-inexact
12752This is like @option{-mieee} except the generated code also maintains
12753the IEEE @var{inexact-flag}.  Turning on this option causes the
12754generated code to implement fully-compliant IEEE math.  In addition to
12755@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
12756macro.  On some Alpha implementations the resulting code may execute
12757significantly slower than the code generated by default.  Since there is
12758very little code that depends on the @var{inexact-flag}, you should
12759normally not specify this option.  Other Alpha compilers call this
12760option @option{-ieee_with_inexact}.
12761
12762@item -mfp-trap-mode=@var{trap-mode}
12763@opindex mfp-trap-mode
12764This option controls what floating-point related traps are enabled.
12765Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
12766The trap mode can be set to one of four values:
12767
12768@table @samp
12769@item n
12770This is the default (normal) setting.  The only traps that are enabled
12771are the ones that cannot be disabled in software (e.g., division by zero
12772trap).
12773
12774@item u
12775In addition to the traps enabled by @samp{n}, underflow traps are enabled
12776as well.
12777
12778@item su
12779Like @samp{u}, but the instructions are marked to be safe for software
12780completion (see Alpha architecture manual for details).
12781
12782@item sui
12783Like @samp{su}, but inexact traps are enabled as well.
12784@end table
12785
12786@item -mfp-rounding-mode=@var{rounding-mode}
12787@opindex mfp-rounding-mode
12788Selects the IEEE rounding mode.  Other Alpha compilers call this option
12789@option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
12790of:
12791
12792@table @samp
12793@item n
12794Normal IEEE rounding mode.  Floating-point numbers are rounded towards
12795the nearest machine number or towards the even machine number in case
12796of a tie.
12797
12798@item m
12799Round towards minus infinity.
12800
12801@item c
12802Chopped rounding mode.  Floating-point numbers are rounded towards zero.
12803
12804@item d
12805Dynamic rounding mode.  A field in the floating-point control register
12806(@var{fpcr}, see Alpha architecture reference manual) controls the
12807rounding mode in effect.  The C library initializes this register for
12808rounding towards plus infinity.  Thus, unless your program modifies the
12809@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
12810@end table
12811
12812@item -mtrap-precision=@var{trap-precision}
12813@opindex mtrap-precision
12814In the Alpha architecture, floating-point traps are imprecise.  This
12815means without software assistance it is impossible to recover from a
12816floating trap and program execution normally needs to be terminated.
12817GCC can generate code that can assist operating system trap handlers
12818in determining the exact location that caused a floating-point trap.
12819Depending on the requirements of an application, different levels of
12820precisions can be selected:
12821
12822@table @samp
12823@item p
12824Program precision.  This option is the default and means a trap handler
12825can only identify which program caused a floating-point exception.
12826
12827@item f
12828Function precision.  The trap handler can determine the function that
12829caused a floating-point exception.
12830
12831@item i
12832Instruction precision.  The trap handler can determine the exact
12833instruction that caused a floating-point exception.
12834@end table
12835
12836Other Alpha compilers provide the equivalent options called
12837@option{-scope_safe} and @option{-resumption_safe}.
12838
12839@item -mieee-conformant
12840@opindex mieee-conformant
12841This option marks the generated code as IEEE conformant.  You must not
12842use this option unless you also specify @option{-mtrap-precision=i} and either
12843@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
12844is to emit the line @samp{.eflag 48} in the function prologue of the
12845generated assembly file.
12846
12847@item -mbuild-constants
12848@opindex mbuild-constants
12849Normally GCC examines a 32- or 64-bit integer constant to
12850see if it can construct it from smaller constants in two or three
12851instructions.  If it cannot, it outputs the constant as a literal and
12852generates code to load it from the data segment at run time.
12853
12854Use this option to require GCC to construct @emph{all} integer constants
12855using code, even if it takes more instructions (the maximum is six).
12856
12857You typically use this option to build a shared library dynamic
12858loader.  Itself a shared library, it must relocate itself in memory
12859before it can find the variables and constants in its own data segment.
12860
12861@item -mbwx
12862@itemx -mno-bwx
12863@itemx -mcix
12864@itemx -mno-cix
12865@itemx -mfix
12866@itemx -mno-fix
12867@itemx -mmax
12868@itemx -mno-max
12869@opindex mbwx
12870@opindex mno-bwx
12871@opindex mcix
12872@opindex mno-cix
12873@opindex mfix
12874@opindex mno-fix
12875@opindex mmax
12876@opindex mno-max
12877Indicate whether GCC should generate code to use the optional BWX,
12878CIX, FIX and MAX instruction sets.  The default is to use the instruction
12879sets supported by the CPU type specified via @option{-mcpu=} option or that
12880of the CPU on which GCC was built if none is specified.
12881
12882@item -mfloat-vax
12883@itemx -mfloat-ieee
12884@opindex mfloat-vax
12885@opindex mfloat-ieee
12886Generate code that uses (does not use) VAX F and G floating-point
12887arithmetic instead of IEEE single and double precision.
12888
12889@item -mexplicit-relocs
12890@itemx -mno-explicit-relocs
12891@opindex mexplicit-relocs
12892@opindex mno-explicit-relocs
12893Older Alpha assemblers provided no way to generate symbol relocations
12894except via assembler macros.  Use of these macros does not allow
12895optimal instruction scheduling.  GNU binutils as of version 2.12
12896supports a new syntax that allows the compiler to explicitly mark
12897which relocations should apply to which instructions.  This option
12898is mostly useful for debugging, as GCC detects the capabilities of
12899the assembler when it is built and sets the default accordingly.
12900
12901@item -msmall-data
12902@itemx -mlarge-data
12903@opindex msmall-data
12904@opindex mlarge-data
12905When @option{-mexplicit-relocs} is in effect, static data is
12906accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
12907is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
12908(the @code{.sdata} and @code{.sbss} sections) and are accessed via
1290916-bit relocations off of the @code{$gp} register.  This limits the
12910size of the small data area to 64KB, but allows the variables to be
12911directly accessed via a single instruction.
12912
12913The default is @option{-mlarge-data}.  With this option the data area
12914is limited to just below 2GB@.  Programs that require more than 2GB of
12915data must use @code{malloc} or @code{mmap} to allocate the data in the
12916heap instead of in the program's data segment.
12917
12918When generating code for shared libraries, @option{-fpic} implies
12919@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
12920
12921@item -msmall-text
12922@itemx -mlarge-text
12923@opindex msmall-text
12924@opindex mlarge-text
12925When @option{-msmall-text} is used, the compiler assumes that the
12926code of the entire program (or shared library) fits in 4MB, and is
12927thus reachable with a branch instruction.  When @option{-msmall-data}
12928is used, the compiler can assume that all local symbols share the
12929same @code{$gp} value, and thus reduce the number of instructions
12930required for a function call from 4 to 1.
12931
12932The default is @option{-mlarge-text}.
12933
12934@item -mcpu=@var{cpu_type}
12935@opindex mcpu
12936Set the instruction set and instruction scheduling parameters for
12937machine type @var{cpu_type}.  You can specify either the @samp{EV}
12938style name or the corresponding chip number.  GCC supports scheduling
12939parameters for the EV4, EV5 and EV6 family of processors and
12940chooses the default values for the instruction set from the processor
12941you specify.  If you do not specify a processor type, GCC defaults
12942to the processor on which the compiler was built.
12943
12944Supported values for @var{cpu_type} are
12945
12946@table @samp
12947@item ev4
12948@itemx ev45
12949@itemx 21064
12950Schedules as an EV4 and has no instruction set extensions.
12951
12952@item ev5
12953@itemx 21164
12954Schedules as an EV5 and has no instruction set extensions.
12955
12956@item ev56
12957@itemx 21164a
12958Schedules as an EV5 and supports the BWX extension.
12959
12960@item pca56
12961@itemx 21164pc
12962@itemx 21164PC
12963Schedules as an EV5 and supports the BWX and MAX extensions.
12964
12965@item ev6
12966@itemx 21264
12967Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
12968
12969@item ev67
12970@itemx 21264a
12971Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
12972@end table
12973
12974Native toolchains also support the value @samp{native},
12975which selects the best architecture option for the host processor.
12976@option{-mcpu=native} has no effect if GCC does not recognize
12977the processor.
12978
12979@item -mtune=@var{cpu_type}
12980@opindex mtune
12981Set only the instruction scheduling parameters for machine type
12982@var{cpu_type}.  The instruction set is not changed.
12983
12984Native toolchains also support the value @samp{native},
12985which selects the best architecture option for the host processor.
12986@option{-mtune=native} has no effect if GCC does not recognize
12987the processor.
12988
12989@item -mmemory-latency=@var{time}
12990@opindex mmemory-latency
12991Sets the latency the scheduler should assume for typical memory
12992references as seen by the application.  This number is highly
12993dependent on the memory access patterns used by the application
12994and the size of the external cache on the machine.
12995
12996Valid options for @var{time} are
12997
12998@table @samp
12999@item @var{number}
13000A decimal number representing clock cycles.
13001
13002@item L1
13003@itemx L2
13004@itemx L3
13005@itemx main
13006The compiler contains estimates of the number of clock cycles for
13007``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
13008(also called Dcache, Scache, and Bcache), as well as to main memory.
13009Note that L3 is only valid for EV5.
13010
13011@end table
13012@end table
13013
13014@node FR30 Options
13015@subsection FR30 Options
13016@cindex FR30 Options
13017
13018These options are defined specifically for the FR30 port.
13019
13020@table @gcctabopt
13021
13022@item -msmall-model
13023@opindex msmall-model
13024Use the small address space model.  This can produce smaller code, but
13025it does assume that all symbolic values and addresses fit into a
1302620-bit range.
13027
13028@item -mno-lsim
13029@opindex mno-lsim
13030Assume that runtime support has been provided and so there is no need
13031to include the simulator library (@file{libsim.a}) on the linker
13032command line.
13033
13034@end table
13035
13036@node FRV Options
13037@subsection FRV Options
13038@cindex FRV Options
13039
13040@table @gcctabopt
13041@item -mgpr-32
13042@opindex mgpr-32
13043
13044Only use the first 32 general-purpose registers.
13045
13046@item -mgpr-64
13047@opindex mgpr-64
13048
13049Use all 64 general-purpose registers.
13050
13051@item -mfpr-32
13052@opindex mfpr-32
13053
13054Use only the first 32 floating-point registers.
13055
13056@item -mfpr-64
13057@opindex mfpr-64
13058
13059Use all 64 floating-point registers.
13060
13061@item -mhard-float
13062@opindex mhard-float
13063
13064Use hardware instructions for floating-point operations.
13065
13066@item -msoft-float
13067@opindex msoft-float
13068
13069Use library routines for floating-point operations.
13070
13071@item -malloc-cc
13072@opindex malloc-cc
13073
13074Dynamically allocate condition code registers.
13075
13076@item -mfixed-cc
13077@opindex mfixed-cc
13078
13079Do not try to dynamically allocate condition code registers, only
13080use @code{icc0} and @code{fcc0}.
13081
13082@item -mdword
13083@opindex mdword
13084
13085Change ABI to use double word insns.
13086
13087@item -mno-dword
13088@opindex mno-dword
13089
13090Do not use double word instructions.
13091
13092@item -mdouble
13093@opindex mdouble
13094
13095Use floating-point double instructions.
13096
13097@item -mno-double
13098@opindex mno-double
13099
13100Do not use floating-point double instructions.
13101
13102@item -mmedia
13103@opindex mmedia
13104
13105Use media instructions.
13106
13107@item -mno-media
13108@opindex mno-media
13109
13110Do not use media instructions.
13111
13112@item -mmuladd
13113@opindex mmuladd
13114
13115Use multiply and add/subtract instructions.
13116
13117@item -mno-muladd
13118@opindex mno-muladd
13119
13120Do not use multiply and add/subtract instructions.
13121
13122@item -mfdpic
13123@opindex mfdpic
13124
13125Select the FDPIC ABI, which uses function descriptors to represent
13126pointers to functions.  Without any PIC/PIE-related options, it
13127implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
13128assumes GOT entries and small data are within a 12-bit range from the
13129GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
13130are computed with 32 bits.
13131With a @samp{bfin-elf} target, this option implies @option{-msim}.
13132
13133@item -minline-plt
13134@opindex minline-plt
13135
13136Enable inlining of PLT entries in function calls to functions that are
13137not known to bind locally.  It has no effect without @option{-mfdpic}.
13138It's enabled by default if optimizing for speed and compiling for
13139shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
13140optimization option such as @option{-O3} or above is present in the
13141command line.
13142
13143@item -mTLS
13144@opindex mTLS
13145
13146Assume a large TLS segment when generating thread-local code.
13147
13148@item -mtls
13149@opindex mtls
13150
13151Do not assume a large TLS segment when generating thread-local code.
13152
13153@item -mgprel-ro
13154@opindex mgprel-ro
13155
13156Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
13157that is known to be in read-only sections.  It's enabled by default,
13158except for @option{-fpic} or @option{-fpie}: even though it may help
13159make the global offset table smaller, it trades 1 instruction for 4.
13160With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
13161one of which may be shared by multiple symbols, and it avoids the need
13162for a GOT entry for the referenced symbol, so it's more likely to be a
13163win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
13164
13165@item -multilib-library-pic
13166@opindex multilib-library-pic
13167
13168Link with the (library, not FD) pic libraries.  It's implied by
13169@option{-mlibrary-pic}, as well as by @option{-fPIC} and
13170@option{-fpic} without @option{-mfdpic}.  You should never have to use
13171it explicitly.
13172
13173@item -mlinked-fp
13174@opindex mlinked-fp
13175
13176Follow the EABI requirement of always creating a frame pointer whenever
13177a stack frame is allocated.  This option is enabled by default and can
13178be disabled with @option{-mno-linked-fp}.
13179
13180@item -mlong-calls
13181@opindex mlong-calls
13182
13183Use indirect addressing to call functions outside the current
13184compilation unit.  This allows the functions to be placed anywhere
13185within the 32-bit address space.
13186
13187@item -malign-labels
13188@opindex malign-labels
13189
13190Try to align labels to an 8-byte boundary by inserting NOPs into the
13191previous packet.  This option only has an effect when VLIW packing
13192is enabled.  It doesn't create new packets; it merely adds NOPs to
13193existing ones.
13194
13195@item -mlibrary-pic
13196@opindex mlibrary-pic
13197
13198Generate position-independent EABI code.
13199
13200@item -macc-4
13201@opindex macc-4
13202
13203Use only the first four media accumulator registers.
13204
13205@item -macc-8
13206@opindex macc-8
13207
13208Use all eight media accumulator registers.
13209
13210@item -mpack
13211@opindex mpack
13212
13213Pack VLIW instructions.
13214
13215@item -mno-pack
13216@opindex mno-pack
13217
13218Do not pack VLIW instructions.
13219
13220@item -mno-eflags
13221@opindex mno-eflags
13222
13223Do not mark ABI switches in e_flags.
13224
13225@item -mcond-move
13226@opindex mcond-move
13227
13228Enable the use of conditional-move instructions (default).
13229
13230This switch is mainly for debugging the compiler and will likely be removed
13231in a future version.
13232
13233@item -mno-cond-move
13234@opindex mno-cond-move
13235
13236Disable the use of conditional-move instructions.
13237
13238This switch is mainly for debugging the compiler and will likely be removed
13239in a future version.
13240
13241@item -mscc
13242@opindex mscc
13243
13244Enable the use of conditional set instructions (default).
13245
13246This switch is mainly for debugging the compiler and will likely be removed
13247in a future version.
13248
13249@item -mno-scc
13250@opindex mno-scc
13251
13252Disable the use of conditional set instructions.
13253
13254This switch is mainly for debugging the compiler and will likely be removed
13255in a future version.
13256
13257@item -mcond-exec
13258@opindex mcond-exec
13259
13260Enable the use of conditional execution (default).
13261
13262This switch is mainly for debugging the compiler and will likely be removed
13263in a future version.
13264
13265@item -mno-cond-exec
13266@opindex mno-cond-exec
13267
13268Disable the use of conditional execution.
13269
13270This switch is mainly for debugging the compiler and will likely be removed
13271in a future version.
13272
13273@item -mvliw-branch
13274@opindex mvliw-branch
13275
13276Run a pass to pack branches into VLIW instructions (default).
13277
13278This switch is mainly for debugging the compiler and will likely be removed
13279in a future version.
13280
13281@item -mno-vliw-branch
13282@opindex mno-vliw-branch
13283
13284Do not run a pass to pack branches into VLIW instructions.
13285
13286This switch is mainly for debugging the compiler and will likely be removed
13287in a future version.
13288
13289@item -mmulti-cond-exec
13290@opindex mmulti-cond-exec
13291
13292Enable optimization of @code{&&} and @code{||} in conditional execution
13293(default).
13294
13295This switch is mainly for debugging the compiler and will likely be removed
13296in a future version.
13297
13298@item -mno-multi-cond-exec
13299@opindex mno-multi-cond-exec
13300
13301Disable optimization of @code{&&} and @code{||} in conditional execution.
13302
13303This switch is mainly for debugging the compiler and will likely be removed
13304in a future version.
13305
13306@item -mnested-cond-exec
13307@opindex mnested-cond-exec
13308
13309Enable nested conditional execution optimizations (default).
13310
13311This switch is mainly for debugging the compiler and will likely be removed
13312in a future version.
13313
13314@item -mno-nested-cond-exec
13315@opindex mno-nested-cond-exec
13316
13317Disable nested conditional execution optimizations.
13318
13319This switch is mainly for debugging the compiler and will likely be removed
13320in a future version.
13321
13322@item -moptimize-membar
13323@opindex moptimize-membar
13324
13325This switch removes redundant @code{membar} instructions from the
13326compiler-generated code.  It is enabled by default.
13327
13328@item -mno-optimize-membar
13329@opindex mno-optimize-membar
13330
13331This switch disables the automatic removal of redundant @code{membar}
13332instructions from the generated code.
13333
13334@item -mtomcat-stats
13335@opindex mtomcat-stats
13336
13337Cause gas to print out tomcat statistics.
13338
13339@item -mcpu=@var{cpu}
13340@opindex mcpu
13341
13342Select the processor type for which to generate code.  Possible values are
13343@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
13344@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
13345
13346@end table
13347
13348@node GNU/Linux Options
13349@subsection GNU/Linux Options
13350
13351These @samp{-m} options are defined for GNU/Linux targets:
13352
13353@table @gcctabopt
13354@item -mglibc
13355@opindex mglibc
13356Use the GNU C library.  This is the default except
13357on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
13358
13359@item -muclibc
13360@opindex muclibc
13361Use uClibc C library.  This is the default on
13362@samp{*-*-linux-*uclibc*} targets.
13363
13364@item -mbionic
13365@opindex mbionic
13366Use Bionic C library.  This is the default on
13367@samp{*-*-linux-*android*} targets.
13368
13369@item -mandroid
13370@opindex mandroid
13371Compile code compatible with Android platform.  This is the default on
13372@samp{*-*-linux-*android*} targets.
13373
13374When compiling, this option enables @option{-mbionic}, @option{-fPIC},
13375@option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
13376this option makes the GCC driver pass Android-specific options to the linker.
13377Finally, this option causes the preprocessor macro @code{__ANDROID__}
13378to be defined.
13379
13380@item -tno-android-cc
13381@opindex tno-android-cc
13382Disable compilation effects of @option{-mandroid}, i.e., do not enable
13383@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
13384@option{-fno-rtti} by default.
13385
13386@item -tno-android-ld
13387@opindex tno-android-ld
13388Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
13389linking options to the linker.
13390
13391@end table
13392
13393@node H8/300 Options
13394@subsection H8/300 Options
13395
13396These @samp{-m} options are defined for the H8/300 implementations:
13397
13398@table @gcctabopt
13399@item -mrelax
13400@opindex mrelax
13401Shorten some address references at link time, when possible; uses the
13402linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
13403ld, Using ld}, for a fuller description.
13404
13405@item -mh
13406@opindex mh
13407Generate code for the H8/300H@.
13408
13409@item -ms
13410@opindex ms
13411Generate code for the H8S@.
13412
13413@item -mn
13414@opindex mn
13415Generate code for the H8S and H8/300H in the normal mode.  This switch
13416must be used either with @option{-mh} or @option{-ms}.
13417
13418@item -ms2600
13419@opindex ms2600
13420Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
13421
13422@item -mexr
13423@opindex mexr
13424Extended registers are stored on stack before execution of function
13425with monitor attribute. Default option is @option{-mexr}.
13426This option is valid only for H8S targets.
13427
13428@item -mno-exr
13429@opindex mno-exr
13430Extended registers are not stored on stack before execution of function
13431with monitor attribute. Default option is @option{-mno-exr}.
13432This option is valid only for H8S targets.
13433
13434@item -mint32
13435@opindex mint32
13436Make @code{int} data 32 bits by default.
13437
13438@item -malign-300
13439@opindex malign-300
13440On the H8/300H and H8S, use the same alignment rules as for the H8/300.
13441The default for the H8/300H and H8S is to align longs and floats on
134424-byte boundaries.
13443@option{-malign-300} causes them to be aligned on 2-byte boundaries.
13444This option has no effect on the H8/300.
13445@end table
13446
13447@node HPPA Options
13448@subsection HPPA Options
13449@cindex HPPA Options
13450
13451These @samp{-m} options are defined for the HPPA family of computers:
13452
13453@table @gcctabopt
13454@item -march=@var{architecture-type}
13455@opindex march
13456Generate code for the specified architecture.  The choices for
13457@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
134581.1, and @samp{2.0} for PA 2.0 processors.  Refer to
13459@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
13460architecture option for your machine.  Code compiled for lower numbered
13461architectures runs on higher numbered architectures, but not the
13462other way around.
13463
13464@item -mpa-risc-1-0
13465@itemx -mpa-risc-1-1
13466@itemx -mpa-risc-2-0
13467@opindex mpa-risc-1-0
13468@opindex mpa-risc-1-1
13469@opindex mpa-risc-2-0
13470Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
13471
13472@item -mbig-switch
13473@opindex mbig-switch
13474Generate code suitable for big switch tables.  Use this option only if
13475the assembler/linker complain about out-of-range branches within a switch
13476table.
13477
13478@item -mjump-in-delay
13479@opindex mjump-in-delay
13480Fill delay slots of function calls with unconditional jump instructions
13481by modifying the return pointer for the function call to be the target
13482of the conditional jump.
13483
13484@item -mdisable-fpregs
13485@opindex mdisable-fpregs
13486Prevent floating-point registers from being used in any manner.  This is
13487necessary for compiling kernels that perform lazy context switching of
13488floating-point registers.  If you use this option and attempt to perform
13489floating-point operations, the compiler aborts.
13490
13491@item -mdisable-indexing
13492@opindex mdisable-indexing
13493Prevent the compiler from using indexing address modes.  This avoids some
13494rather obscure problems when compiling MIG generated code under MACH@.
13495
13496@item -mno-space-regs
13497@opindex mno-space-regs
13498Generate code that assumes the target has no space registers.  This allows
13499GCC to generate faster indirect calls and use unscaled index address modes.
13500
13501Such code is suitable for level 0 PA systems and kernels.
13502
13503@item -mfast-indirect-calls
13504@opindex mfast-indirect-calls
13505Generate code that assumes calls never cross space boundaries.  This
13506allows GCC to emit code that performs faster indirect calls.
13507
13508This option does not work in the presence of shared libraries or nested
13509functions.
13510
13511@item -mfixed-range=@var{register-range}
13512@opindex mfixed-range
13513Generate code treating the given register range as fixed registers.
13514A fixed register is one that the register allocator cannot use.  This is
13515useful when compiling kernel code.  A register range is specified as
13516two registers separated by a dash.  Multiple register ranges can be
13517specified separated by a comma.
13518
13519@item -mlong-load-store
13520@opindex mlong-load-store
13521Generate 3-instruction load and store sequences as sometimes required by
13522the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
13523the HP compilers.
13524
13525@item -mportable-runtime
13526@opindex mportable-runtime
13527Use the portable calling conventions proposed by HP for ELF systems.
13528
13529@item -mgas
13530@opindex mgas
13531Enable the use of assembler directives only GAS understands.
13532
13533@item -mschedule=@var{cpu-type}
13534@opindex mschedule
13535Schedule code according to the constraints for the machine type
13536@var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
13537@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
13538to @file{/usr/lib/sched.models} on an HP-UX system to determine the
13539proper scheduling option for your machine.  The default scheduling is
13540@samp{8000}.
13541
13542@item -mlinker-opt
13543@opindex mlinker-opt
13544Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
13545debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
13546linkers in which they give bogus error messages when linking some programs.
13547
13548@item -msoft-float
13549@opindex msoft-float
13550Generate output containing library calls for floating point.
13551@strong{Warning:} the requisite libraries are not available for all HPPA
13552targets.  Normally the facilities of the machine's usual C compiler are
13553used, but this cannot be done directly in cross-compilation.  You must make
13554your own arrangements to provide suitable library functions for
13555cross-compilation.
13556
13557@option{-msoft-float} changes the calling convention in the output file;
13558therefore, it is only useful if you compile @emph{all} of a program with
13559this option.  In particular, you need to compile @file{libgcc.a}, the
13560library that comes with GCC, with @option{-msoft-float} in order for
13561this to work.
13562
13563@item -msio
13564@opindex msio
13565Generate the predefine, @code{_SIO}, for server IO@.  The default is
13566@option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
13567@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
13568options are available under HP-UX and HI-UX@.
13569
13570@item -mgnu-ld
13571@opindex mgnu-ld
13572Use options specific to GNU @command{ld}.
13573This passes @option{-shared} to @command{ld} when
13574building a shared library.  It is the default when GCC is configured,
13575explicitly or implicitly, with the GNU linker.  This option does not
13576affect which @command{ld} is called; it only changes what parameters
13577are passed to that @command{ld}.
13578The @command{ld} that is called is determined by the
13579@option{--with-ld} configure option, GCC's program search path, and
13580finally by the user's @env{PATH}.  The linker used by GCC can be printed
13581using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
13582on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
13583
13584@item -mhp-ld
13585@opindex mhp-ld
13586Use options specific to HP @command{ld}.
13587This passes @option{-b} to @command{ld} when building
13588a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
13589links.  It is the default when GCC is configured, explicitly or
13590implicitly, with the HP linker.  This option does not affect
13591which @command{ld} is called; it only changes what parameters are passed to that
13592@command{ld}.
13593The @command{ld} that is called is determined by the @option{--with-ld}
13594configure option, GCC's program search path, and finally by the user's
13595@env{PATH}.  The linker used by GCC can be printed using @samp{which
13596`gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
13597HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
13598
13599@item -mlong-calls
13600@opindex mno-long-calls
13601Generate code that uses long call sequences.  This ensures that a call
13602is always able to reach linker generated stubs.  The default is to generate
13603long calls only when the distance from the call site to the beginning
13604of the function or translation unit, as the case may be, exceeds a
13605predefined limit set by the branch type being used.  The limits for
13606normal calls are 7,600,000 and 240,000 bytes, respectively for the
13607PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
13608240,000 bytes.
13609
13610Distances are measured from the beginning of functions when using the
13611@option{-ffunction-sections} option, or when using the @option{-mgas}
13612and @option{-mno-portable-runtime} options together under HP-UX with
13613the SOM linker.
13614
13615It is normally not desirable to use this option as it degrades
13616performance.  However, it may be useful in large applications,
13617particularly when partial linking is used to build the application.
13618
13619The types of long calls used depends on the capabilities of the
13620assembler and linker, and the type of code being generated.  The
13621impact on systems that support long absolute calls, and long pic
13622symbol-difference or pc-relative calls should be relatively small.
13623However, an indirect call is used on 32-bit ELF systems in pic code
13624and it is quite long.
13625
13626@item -munix=@var{unix-std}
13627@opindex march
13628Generate compiler predefines and select a startfile for the specified
13629UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
13630and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
13631is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
1363211.11 and later.  The default values are @samp{93} for HP-UX 10.00,
13633@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
13634and later.
13635
13636@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
13637@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
13638and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
13639@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
13640@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
13641@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
13642
13643It is @emph{important} to note that this option changes the interfaces
13644for various library routines.  It also affects the operational behavior
13645of the C library.  Thus, @emph{extreme} care is needed in using this
13646option.
13647
13648Library code that is intended to operate with more than one UNIX
13649standard must test, set and restore the variable @var{__xpg4_extended_mask}
13650as appropriate.  Most GNU software doesn't provide this capability.
13651
13652@item -nolibdld
13653@opindex nolibdld
13654Suppress the generation of link options to search libdld.sl when the
13655@option{-static} option is specified on HP-UX 10 and later.
13656
13657@item -static
13658@opindex static
13659The HP-UX implementation of setlocale in libc has a dependency on
13660libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
13661when the @option{-static} option is specified, special link options
13662are needed to resolve this dependency.
13663
13664On HP-UX 10 and later, the GCC driver adds the necessary options to
13665link with libdld.sl when the @option{-static} option is specified.
13666This causes the resulting binary to be dynamic.  On the 64-bit port,
13667the linkers generate dynamic binaries by default in any case.  The
13668@option{-nolibdld} option can be used to prevent the GCC driver from
13669adding these link options.
13670
13671@item -threads
13672@opindex threads
13673Add support for multithreading with the @dfn{dce thread} library
13674under HP-UX@.  This option sets flags for both the preprocessor and
13675linker.
13676@end table
13677
13678@node i386 and x86-64 Options
13679@subsection Intel 386 and AMD x86-64 Options
13680@cindex i386 Options
13681@cindex x86-64 Options
13682@cindex Intel 386 Options
13683@cindex AMD x86-64 Options
13684
13685These @samp{-m} options are defined for the i386 and x86-64 family of
13686computers:
13687
13688@table @gcctabopt
13689
13690@item -march=@var{cpu-type}
13691@opindex march
13692Generate instructions for the machine type @var{cpu-type}.  In contrast to
13693@option{-mtune=@var{cpu-type}}, which merely tunes the generated code
13694for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
13695to generate code that may not run at all on processors other than the one
13696indicated.  Specifying @option{-march=@var{cpu-type}} implies
13697@option{-mtune=@var{cpu-type}}.
13698
13699The choices for @var{cpu-type} are:
13700
13701@table @samp
13702@item native
13703This selects the CPU to generate code for at compilation time by determining
13704the processor type of the compiling machine.  Using @option{-march=native}
13705enables all instruction subsets supported by the local machine (hence
13706the result might not run on different machines).  Using @option{-mtune=native}
13707produces code optimized for the local machine under the constraints
13708of the selected instruction set.
13709
13710@item i386
13711Original Intel i386 CPU@.
13712
13713@item i486
13714Intel i486 CPU@.  (No scheduling is implemented for this chip.)
13715
13716@item i586
13717@itemx pentium
13718Intel Pentium CPU with no MMX support.
13719
13720@item pentium-mmx
13721Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
13722
13723@item pentiumpro
13724Intel Pentium Pro CPU@.
13725
13726@item i686
13727When used with @option{-march}, the Pentium Pro
13728instruction set is used, so the code runs on all i686 family chips.
13729When used with @option{-mtune}, it has the same meaning as @samp{generic}.
13730
13731@item pentium2
13732Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
13733support.
13734
13735@item pentium3
13736@itemx pentium3m
13737Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
13738set support.
13739
13740@item pentium-m
13741Intel Pentium M; low-power version of Intel Pentium III CPU
13742with MMX, SSE and SSE2 instruction set support.  Used by Centrino notebooks.
13743
13744@item pentium4
13745@itemx pentium4m
13746Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
13747
13748@item prescott
13749Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
13750set support.
13751
13752@item nocona
13753Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
13754SSE2 and SSE3 instruction set support.
13755
13756@item core2
13757Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
13758instruction set support.
13759
13760@item corei7
13761Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1
13762and SSE4.2 instruction set support.
13763
13764@item corei7-avx
13765Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
13766SSE4.1, SSE4.2, AVX, AES and PCLMUL instruction set support.
13767
13768@item core-avx-i
13769Intel Core CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
13770SSE4.1, SSE4.2, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C instruction
13771set support.
13772
13773@item core-avx2
13774Intel Core CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
13775SSE4.1, SSE4.2, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2
13776and F16C instruction set support.
13777
13778@item atom
13779Intel Atom CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
13780instruction set support.
13781
13782@item k6
13783AMD K6 CPU with MMX instruction set support.
13784
13785@item k6-2
13786@itemx k6-3
13787Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
13788
13789@item athlon
13790@itemx athlon-tbird
13791AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
13792support.
13793
13794@item athlon-4
13795@itemx athlon-xp
13796@itemx athlon-mp
13797Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
13798instruction set support.
13799
13800@item k8
13801@itemx opteron
13802@itemx athlon64
13803@itemx athlon-fx
13804Processors based on the AMD K8 core with x86-64 instruction set support,
13805including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
13806(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
13807instruction set extensions.)
13808
13809@item k8-sse3
13810@itemx opteron-sse3
13811@itemx athlon64-sse3
13812Improved versions of AMD K8 cores with SSE3 instruction set support.
13813
13814@item amdfam10
13815@itemx barcelona
13816CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
13817supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
13818instruction set extensions.)
13819
13820@item bdver1
13821CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
13822supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
13823SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
13824@item bdver2
13825AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
13826supersets BMI, TBM, F16C, FMA, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE,
13827SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
13828extensions.)
13829@item bdver3
13830AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
13831supersets BMI, TBM, F16C, FMA, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE,
13832SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
13833extensions.
13834
13835@item btver1
13836CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
13837supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
13838instruction set extensions.)
13839
13840@item btver2
13841CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
13842includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
13843SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
13844
13845@item winchip-c6
13846IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
13847set support.
13848
13849@item winchip2
13850IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
13851instruction set support.
13852
13853@item c3
13854VIA C3 CPU with MMX and 3DNow!@: instruction set support.  (No scheduling is
13855implemented for this chip.)
13856
13857@item c3-2
13858VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
13859(No scheduling is
13860implemented for this chip.)
13861
13862@item geode
13863AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
13864@end table
13865
13866@item -mtune=@var{cpu-type}
13867@opindex mtune
13868Tune to @var{cpu-type} everything applicable about the generated code, except
13869for the ABI and the set of available instructions.
13870While picking a specific @var{cpu-type} schedules things appropriately
13871for that particular chip, the compiler does not generate any code that
13872cannot run on the default machine type unless you use a
13873@option{-march=@var{cpu-type}} option.
13874For example, if GCC is configured for i686-pc-linux-gnu
13875then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
13876but still runs on i686 machines.
13877
13878The choices for @var{cpu-type} are the same as for @option{-march}.
13879In addition, @option{-mtune} supports an extra choice for @var{cpu-type}:
13880
13881@table @samp
13882@item generic
13883Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
13884If you know the CPU on which your code will run, then you should use
13885the corresponding @option{-mtune} or @option{-march} option instead of
13886@option{-mtune=generic}.  But, if you do not know exactly what CPU users
13887of your application will have, then you should use this option.
13888
13889As new processors are deployed in the marketplace, the behavior of this
13890option will change.  Therefore, if you upgrade to a newer version of
13891GCC, code generation controlled by this option will change to reflect
13892the processors
13893that are most common at the time that version of GCC is released.
13894
13895There is no @option{-march=generic} option because @option{-march}
13896indicates the instruction set the compiler can use, and there is no
13897generic instruction set applicable to all processors.  In contrast,
13898@option{-mtune} indicates the processor (or, in this case, collection of
13899processors) for which the code is optimized.
13900@end table
13901
13902@item -mcpu=@var{cpu-type}
13903@opindex mcpu
13904A deprecated synonym for @option{-mtune}.
13905
13906@item -mfpmath=@var{unit}
13907@opindex mfpmath
13908Generate floating-point arithmetic for selected unit @var{unit}.  The choices
13909for @var{unit} are:
13910
13911@table @samp
13912@item 387
13913Use the standard 387 floating-point coprocessor present on the majority of chips and
13914emulated otherwise.  Code compiled with this option runs almost everywhere.
13915The temporary results are computed in 80-bit precision instead of the precision
13916specified by the type, resulting in slightly different results compared to most
13917of other chips.  See @option{-ffloat-store} for more detailed description.
13918
13919This is the default choice for i386 compiler.
13920
13921@item sse
13922Use scalar floating-point instructions present in the SSE instruction set.
13923This instruction set is supported by Pentium III and newer chips,
13924and in the AMD line
13925by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
13926instruction set supports only single-precision arithmetic, thus the double and
13927extended-precision arithmetic are still done using 387.  A later version, present
13928only in Pentium 4 and AMD x86-64 chips, supports double-precision
13929arithmetic too.
13930
13931For the i386 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
13932or @option{-msse2} switches to enable SSE extensions and make this option
13933effective.  For the x86-64 compiler, these extensions are enabled by default.
13934
13935The resulting code should be considerably faster in the majority of cases and avoid
13936the numerical instability problems of 387 code, but may break some existing
13937code that expects temporaries to be 80 bits.
13938
13939This is the default choice for the x86-64 compiler.
13940
13941@item sse,387
13942@itemx sse+387
13943@itemx both
13944Attempt to utilize both instruction sets at once.  This effectively doubles the
13945amount of available registers, and on chips with separate execution units for
13946387 and SSE the execution resources too.  Use this option with care, as it is
13947still experimental, because the GCC register allocator does not model separate
13948functional units well, resulting in unstable performance.
13949@end table
13950
13951@item -masm=@var{dialect}
13952@opindex masm=@var{dialect}
13953Output assembly instructions using selected @var{dialect}.  Supported
13954choices are @samp{intel} or @samp{att} (the default).  Darwin does
13955not support @samp{intel}.
13956
13957@item -mieee-fp
13958@itemx -mno-ieee-fp
13959@opindex mieee-fp
13960@opindex mno-ieee-fp
13961Control whether or not the compiler uses IEEE floating-point
13962comparisons.  These correctly handle the case where the result of a
13963comparison is unordered.
13964
13965@item -msoft-float
13966@opindex msoft-float
13967Generate output containing library calls for floating point.
13968
13969@strong{Warning:} the requisite libraries are not part of GCC@.
13970Normally the facilities of the machine's usual C compiler are used, but
13971this can't be done directly in cross-compilation.  You must make your
13972own arrangements to provide suitable library functions for
13973cross-compilation.
13974
13975On machines where a function returns floating-point results in the 80387
13976register stack, some floating-point opcodes may be emitted even if
13977@option{-msoft-float} is used.
13978
13979@item -mno-fp-ret-in-387
13980@opindex mno-fp-ret-in-387
13981Do not use the FPU registers for return values of functions.
13982
13983The usual calling convention has functions return values of types
13984@code{float} and @code{double} in an FPU register, even if there
13985is no FPU@.  The idea is that the operating system should emulate
13986an FPU@.
13987
13988The option @option{-mno-fp-ret-in-387} causes such values to be returned
13989in ordinary CPU registers instead.
13990
13991@item -mno-fancy-math-387
13992@opindex mno-fancy-math-387
13993Some 387 emulators do not support the @code{sin}, @code{cos} and
13994@code{sqrt} instructions for the 387.  Specify this option to avoid
13995generating those instructions.  This option is the default on FreeBSD,
13996OpenBSD and NetBSD@.  This option is overridden when @option{-march}
13997indicates that the target CPU always has an FPU and so the
13998instruction does not need emulation.  These
13999instructions are not generated unless you also use the
14000@option{-funsafe-math-optimizations} switch.
14001
14002@item -malign-double
14003@itemx -mno-align-double
14004@opindex malign-double
14005@opindex mno-align-double
14006Control whether GCC aligns @code{double}, @code{long double}, and
14007@code{long long} variables on a two-word boundary or a one-word
14008boundary.  Aligning @code{double} variables on a two-word boundary
14009produces code that runs somewhat faster on a Pentium at the
14010expense of more memory.
14011
14012On x86-64, @option{-malign-double} is enabled by default.
14013
14014@strong{Warning:} if you use the @option{-malign-double} switch,
14015structures containing the above types are aligned differently than
14016the published application binary interface specifications for the 386
14017and are not binary compatible with structures in code compiled
14018without that switch.
14019
14020@item -m96bit-long-double
14021@itemx -m128bit-long-double
14022@opindex m96bit-long-double
14023@opindex m128bit-long-double
14024These switches control the size of @code{long double} type.  The i386
14025application binary interface specifies the size to be 96 bits,
14026so @option{-m96bit-long-double} is the default in 32-bit mode.
14027
14028Modern architectures (Pentium and newer) prefer @code{long double}
14029to be aligned to an 8- or 16-byte boundary.  In arrays or structures
14030conforming to the ABI, this is not possible.  So specifying
14031@option{-m128bit-long-double} aligns @code{long double}
14032to a 16-byte boundary by padding the @code{long double} with an additional
1403332-bit zero.
14034
14035In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
14036its ABI specifies that @code{long double} is aligned on 16-byte boundary.
14037
14038Notice that neither of these options enable any extra precision over the x87
14039standard of 80 bits for a @code{long double}.
14040
14041@strong{Warning:} if you override the default value for your target ABI, this
14042changes the size of
14043structures and arrays containing @code{long double} variables,
14044as well as modifying the function calling convention for functions taking
14045@code{long double}.  Hence they are not binary-compatible
14046with code compiled without that switch.
14047
14048@item -mlong-double-64
14049@itemx -mlong-double-80
14050@opindex mlong-double-64
14051@opindex mlong-double-80
14052These switches control the size of @code{long double} type. A size
14053of 64 bits makes the @code{long double} type equivalent to the @code{double}
14054type. This is the default for Bionic C library.
14055
14056@strong{Warning:} if you override the default value for your target ABI, this
14057changes the size of
14058structures and arrays containing @code{long double} variables,
14059as well as modifying the function calling convention for functions taking
14060@code{long double}.  Hence they are not binary-compatible
14061with code compiled without that switch.
14062
14063@item -mlarge-data-threshold=@var{threshold}
14064@opindex mlarge-data-threshold
14065When @option{-mcmodel=medium} is specified, data objects larger than
14066@var{threshold} are placed in the large data section.  This value must be the
14067same across all objects linked into the binary, and defaults to 65535.
14068
14069@item -mrtd
14070@opindex mrtd
14071Use a different function-calling convention, in which functions that
14072take a fixed number of arguments return with the @code{ret @var{num}}
14073instruction, which pops their arguments while returning.  This saves one
14074instruction in the caller since there is no need to pop the arguments
14075there.
14076
14077You can specify that an individual function is called with this calling
14078sequence with the function attribute @samp{stdcall}.  You can also
14079override the @option{-mrtd} option by using the function attribute
14080@samp{cdecl}.  @xref{Function Attributes}.
14081
14082@strong{Warning:} this calling convention is incompatible with the one
14083normally used on Unix, so you cannot use it if you need to call
14084libraries compiled with the Unix compiler.
14085
14086Also, you must provide function prototypes for all functions that
14087take variable numbers of arguments (including @code{printf});
14088otherwise incorrect code is generated for calls to those
14089functions.
14090
14091In addition, seriously incorrect code results if you call a
14092function with too many arguments.  (Normally, extra arguments are
14093harmlessly ignored.)
14094
14095@item -mregparm=@var{num}
14096@opindex mregparm
14097Control how many registers are used to pass integer arguments.  By
14098default, no registers are used to pass arguments, and at most 3
14099registers can be used.  You can control this behavior for a specific
14100function by using the function attribute @samp{regparm}.
14101@xref{Function Attributes}.
14102
14103@strong{Warning:} if you use this switch, and
14104@var{num} is nonzero, then you must build all modules with the same
14105value, including any libraries.  This includes the system libraries and
14106startup modules.
14107
14108@item -msseregparm
14109@opindex msseregparm
14110Use SSE register passing conventions for float and double arguments
14111and return values.  You can control this behavior for a specific
14112function by using the function attribute @samp{sseregparm}.
14113@xref{Function Attributes}.
14114
14115@strong{Warning:} if you use this switch then you must build all
14116modules with the same value, including any libraries.  This includes
14117the system libraries and startup modules.
14118
14119@item -mvect8-ret-in-mem
14120@opindex mvect8-ret-in-mem
14121Return 8-byte vectors in memory instead of MMX registers.  This is the
14122default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
14123Studio compilers until version 12.  Later compiler versions (starting
14124with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
14125is the default on Solaris@tie{}10 and later.  @emph{Only} use this option if
14126you need to remain compatible with existing code produced by those
14127previous compiler versions or older versions of GCC@.
14128
14129@item -mpc32
14130@itemx -mpc64
14131@itemx -mpc80
14132@opindex mpc32
14133@opindex mpc64
14134@opindex mpc80
14135
14136Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
14137is specified, the significands of results of floating-point operations are
14138rounded to 24 bits (single precision); @option{-mpc64} rounds the
14139significands of results of floating-point operations to 53 bits (double
14140precision) and @option{-mpc80} rounds the significands of results of
14141floating-point operations to 64 bits (extended double precision), which is
14142the default.  When this option is used, floating-point operations in higher
14143precisions are not available to the programmer without setting the FPU
14144control word explicitly.
14145
14146Setting the rounding of floating-point operations to less than the default
1414780 bits can speed some programs by 2% or more.  Note that some mathematical
14148libraries assume that extended-precision (80-bit) floating-point operations
14149are enabled by default; routines in such libraries could suffer significant
14150loss of accuracy, typically through so-called ``catastrophic cancellation'',
14151when this option is used to set the precision to less than extended precision.
14152
14153@item -mstackrealign
14154@opindex mstackrealign
14155Realign the stack at entry.  On the Intel x86, the @option{-mstackrealign}
14156option generates an alternate prologue and epilogue that realigns the
14157run-time stack if necessary.  This supports mixing legacy codes that keep
141584-byte stack alignment with modern codes that keep 16-byte stack alignment for
14159SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
14160applicable to individual functions.
14161
14162@item -mpreferred-stack-boundary=@var{num}
14163@opindex mpreferred-stack-boundary
14164Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
14165byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
14166the default is 4 (16 bytes or 128 bits).
14167
14168@strong{Warning:} When generating code for the x86-64 architecture with
14169SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
14170used to keep the stack boundary aligned to 8 byte boundary.  Since
14171x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
14172intended to be used in controlled environment where stack space is
14173important limitation.  This option will lead to wrong code when functions
14174compiled with 16 byte stack alignment (such as functions from a standard
14175library) are called with misaligned stack.  In this case, SSE
14176instructions may lead to misaligned memory access traps.  In addition,
14177variable arguments will be handled incorrectly for 16 byte aligned
14178objects (including x87 long double and __int128), leading to wrong
14179results.  You must build all modules with
14180@option{-mpreferred-stack-boundary=3}, including any libraries.  This
14181includes the system libraries and startup modules.
14182
14183@item -mincoming-stack-boundary=@var{num}
14184@opindex mincoming-stack-boundary
14185Assume the incoming stack is aligned to a 2 raised to @var{num} byte
14186boundary.  If @option{-mincoming-stack-boundary} is not specified,
14187the one specified by @option{-mpreferred-stack-boundary} is used.
14188
14189On Pentium and Pentium Pro, @code{double} and @code{long double} values
14190should be aligned to an 8-byte boundary (see @option{-malign-double}) or
14191suffer significant run time performance penalties.  On Pentium III, the
14192Streaming SIMD Extension (SSE) data type @code{__m128} may not work
14193properly if it is not 16-byte aligned.
14194
14195To ensure proper alignment of these values on the stack, the stack boundary
14196must be as aligned as that required by any value stored on the stack.
14197Further, every function must be generated such that it keeps the stack
14198aligned.  Thus calling a function compiled with a higher preferred
14199stack boundary from a function compiled with a lower preferred stack
14200boundary most likely misaligns the stack.  It is recommended that
14201libraries that use callbacks always use the default setting.
14202
14203This extra alignment does consume extra stack space, and generally
14204increases code size.  Code that is sensitive to stack space usage, such
14205as embedded systems and operating system kernels, may want to reduce the
14206preferred alignment to @option{-mpreferred-stack-boundary=2}.
14207
14208@item -mmmx
14209@itemx -mno-mmx
14210@itemx -msse
14211@itemx -mno-sse
14212@itemx -msse2
14213@itemx -mno-sse2
14214@itemx -msse3
14215@itemx -mno-sse3
14216@itemx -mssse3
14217@itemx -mno-ssse3
14218@itemx -msse4.1
14219@need 800
14220@itemx -mno-sse4.1
14221@itemx -msse4.2
14222@itemx -mno-sse4.2
14223@itemx -msse4
14224@itemx -mno-sse4
14225@itemx -mavx
14226@itemx -mno-avx
14227@itemx -mavx2
14228@itemx -mno-avx2
14229@itemx -maes
14230@itemx -mno-aes
14231@itemx -mpclmul
14232@need 800
14233@itemx -mno-pclmul
14234@itemx -mfsgsbase
14235@itemx -mno-fsgsbase
14236@itemx -mrdrnd
14237@itemx -mno-rdrnd
14238@itemx -mf16c
14239@itemx -mno-f16c
14240@itemx -mfma
14241@itemx -mno-fma
14242@itemx -msse4a
14243@itemx -mno-sse4a
14244@itemx -mfma4
14245@need 800
14246@itemx -mno-fma4
14247@itemx -mxop
14248@itemx -mno-xop
14249@itemx -mlwp
14250@itemx -mno-lwp
14251@itemx -m3dnow
14252@itemx -mno-3dnow
14253@itemx -mpopcnt
14254@itemx -mno-popcnt
14255@itemx -mabm
14256@itemx -mno-abm
14257@itemx -mbmi
14258@itemx -mbmi2
14259@itemx -mno-bmi
14260@itemx -mno-bmi2
14261@itemx -mlzcnt
14262@itemx -mno-lzcnt
14263@itemx -mrtm
14264@itemx -mtbm
14265@itemx -mno-tbm
14266@opindex mmmx
14267@opindex mno-mmx
14268@opindex msse
14269@opindex mno-sse
14270@opindex m3dnow
14271@opindex mno-3dnow
14272These switches enable or disable the use of instructions in the MMX, SSE,
14273SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, F16C,
14274FMA, SSE4A, FMA4, XOP, LWP, ABM, BMI, BMI2, LZCNT, RTM or 3DNow!@:
14275extended instruction sets.
14276These extensions are also available as built-in functions: see
14277@ref{X86 Built-in Functions}, for details of the functions enabled and
14278disabled by these switches.
14279
14280To generate SSE/SSE2 instructions automatically from floating-point
14281code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
14282
14283GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
14284generates new AVX instructions or AVX equivalence for all SSEx instructions
14285when needed.
14286
14287These options enable GCC to use these extended instructions in
14288generated code, even without @option{-mfpmath=sse}.  Applications that
14289perform run-time CPU detection must compile separate files for each
14290supported architecture, using the appropriate flags.  In particular,
14291the file containing the CPU detection code should be compiled without
14292these options.
14293
14294@item -mcld
14295@opindex mcld
14296This option instructs GCC to emit a @code{cld} instruction in the prologue
14297of functions that use string instructions.  String instructions depend on
14298the DF flag to select between autoincrement or autodecrement mode.  While the
14299ABI specifies the DF flag to be cleared on function entry, some operating
14300systems violate this specification by not clearing the DF flag in their
14301exception dispatchers.  The exception handler can be invoked with the DF flag
14302set, which leads to wrong direction mode when string instructions are used.
14303This option can be enabled by default on 32-bit x86 targets by configuring
14304GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
14305instructions can be suppressed with the @option{-mno-cld} compiler option
14306in this case.
14307
14308@item -mvzeroupper
14309@opindex mvzeroupper
14310This option instructs GCC to emit a @code{vzeroupper} instruction
14311before a transfer of control flow out of the function to minimize
14312the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
14313intrinsics.
14314
14315@item -mprefer-avx128
14316@opindex mprefer-avx128
14317This option instructs GCC to use 128-bit AVX instructions instead of
14318256-bit AVX instructions in the auto-vectorizer.
14319
14320@item -mcx16
14321@opindex mcx16
14322This option enables GCC to generate @code{CMPXCHG16B} instructions.
14323@code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
14324(or oword) data types.
14325This is useful for high-resolution counters that can be updated
14326by multiple processors (or cores).  This instruction is generated as part of
14327atomic built-in functions: see @ref{__sync Builtins} or
14328@ref{__atomic Builtins} for details.
14329
14330@item -msahf
14331@opindex msahf
14332This option enables generation of @code{SAHF} instructions in 64-bit code.
14333Early Intel Pentium 4 CPUs with Intel 64 support,
14334prior to the introduction of Pentium 4 G1 step in December 2005,
14335lacked the @code{LAHF} and @code{SAHF} instructions
14336which were supported by AMD64.
14337These are load and store instructions, respectively, for certain status flags.
14338In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
14339@code{drem}, and @code{remainder} built-in functions;
14340see @ref{Other Builtins} for details.
14341
14342@item -mmovbe
14343@opindex mmovbe
14344This option enables use of the @code{movbe} instruction to implement
14345@code{__builtin_bswap32} and @code{__builtin_bswap64}.
14346
14347@item -mcrc32
14348@opindex mcrc32
14349This option enables built-in functions @code{__builtin_ia32_crc32qi},
14350@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
14351@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
14352
14353@item -mrecip
14354@opindex mrecip
14355This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
14356(and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
14357with an additional Newton-Raphson step
14358to increase precision instead of @code{DIVSS} and @code{SQRTSS}
14359(and their vectorized
14360variants) for single-precision floating-point arguments.  These instructions
14361are generated only when @option{-funsafe-math-optimizations} is enabled
14362together with @option{-finite-math-only} and @option{-fno-trapping-math}.
14363Note that while the throughput of the sequence is higher than the throughput
14364of the non-reciprocal instruction, the precision of the sequence can be
14365decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
14366
14367Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
14368(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
14369combination), and doesn't need @option{-mrecip}.
14370
14371Also note that GCC emits the above sequence with additional Newton-Raphson step
14372for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
14373already with @option{-ffast-math} (or the above option combination), and
14374doesn't need @option{-mrecip}.
14375
14376@item -mrecip=@var{opt}
14377@opindex mrecip=opt
14378This option controls which reciprocal estimate instructions
14379may be used.  @var{opt} is a comma-separated list of options, which may
14380be preceded by a @samp{!} to invert the option:
14381
14382@table @samp
14383@item all
14384Enable all estimate instructions.
14385
14386@item default
14387Enable the default instructions, equivalent to @option{-mrecip}.
14388
14389@item none
14390Disable all estimate instructions, equivalent to @option{-mno-recip}.
14391
14392@item div
14393Enable the approximation for scalar division.
14394
14395@item vec-div
14396Enable the approximation for vectorized division.
14397
14398@item sqrt
14399Enable the approximation for scalar square root.
14400
14401@item vec-sqrt
14402Enable the approximation for vectorized square root.
14403@end table
14404
14405So, for example, @option{-mrecip=all,!sqrt} enables
14406all of the reciprocal approximations, except for square root.
14407
14408@item -mveclibabi=@var{type}
14409@opindex mveclibabi
14410Specifies the ABI type to use for vectorizing intrinsics using an
14411external library.  Supported values for @var{type} are @samp{svml}
14412for the Intel short
14413vector math library and @samp{acml} for the AMD math core library.
14414To use this option, both @option{-ftree-vectorize} and
14415@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
14416ABI-compatible library must be specified at link time.
14417
14418GCC currently emits calls to @code{vmldExp2},
14419@code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
14420@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
14421@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
14422@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
14423@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
14424@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
14425@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
14426@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
14427@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
14428function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
14429@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
14430@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
14431@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
14432@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
14433when @option{-mveclibabi=acml} is used.
14434
14435@item -mabi=@var{name}
14436@opindex mabi
14437Generate code for the specified calling convention.  Permissible values
14438are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
14439@samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
14440ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
14441You can control this behavior for a specific function by
14442using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
14443@xref{Function Attributes}.
14444
14445@item -mtls-dialect=@var{type}
14446@opindex mtls-dialect
14447Generate code to access thread-local storage using the @samp{gnu} or
14448@samp{gnu2} conventions.  @samp{gnu} is the conservative default;
14449@samp{gnu2} is more efficient, but it may add compile- and run-time
14450requirements that cannot be satisfied on all systems.
14451
14452@item -mpush-args
14453@itemx -mno-push-args
14454@opindex mpush-args
14455@opindex mno-push-args
14456Use PUSH operations to store outgoing parameters.  This method is shorter
14457and usually equally fast as method using SUB/MOV operations and is enabled
14458by default.  In some cases disabling it may improve performance because of
14459improved scheduling and reduced dependencies.
14460
14461@item -maccumulate-outgoing-args
14462@opindex maccumulate-outgoing-args
14463If enabled, the maximum amount of space required for outgoing arguments is
14464computed in the function prologue.  This is faster on most modern CPUs
14465because of reduced dependencies, improved scheduling and reduced stack usage
14466when the preferred stack boundary is not equal to 2.  The drawback is a notable
14467increase in code size.  This switch implies @option{-mno-push-args}.
14468
14469@item -mthreads
14470@opindex mthreads
14471Support thread-safe exception handling on MinGW.  Programs that rely
14472on thread-safe exception handling must compile and link all code with the
14473@option{-mthreads} option.  When compiling, @option{-mthreads} defines
14474@code{-D_MT}; when linking, it links in a special thread helper library
14475@option{-lmingwthrd} which cleans up per-thread exception-handling data.
14476
14477@item -mno-align-stringops
14478@opindex mno-align-stringops
14479Do not align the destination of inlined string operations.  This switch reduces
14480code size and improves performance in case the destination is already aligned,
14481but GCC doesn't know about it.
14482
14483@item -minline-all-stringops
14484@opindex minline-all-stringops
14485By default GCC inlines string operations only when the destination is
14486known to be aligned to least a 4-byte boundary.
14487This enables more inlining and increases code
14488size, but may improve performance of code that depends on fast
14489@code{memcpy}, @code{strlen},
14490and @code{memset} for short lengths.
14491
14492@item -minline-stringops-dynamically
14493@opindex minline-stringops-dynamically
14494For string operations of unknown size, use run-time checks with
14495inline code for small blocks and a library call for large blocks.
14496
14497@item -mstringop-strategy=@var{alg}
14498@opindex mstringop-strategy=@var{alg}
14499Override the internal decision heuristic for the particular algorithm to use
14500for inlining string operations.  The allowed values for @var{alg} are:
14501
14502@table @samp
14503@item rep_byte
14504@itemx rep_4byte
14505@itemx rep_8byte
14506Expand using i386 @code{rep} prefix of the specified size.
14507
14508@item byte_loop
14509@itemx loop
14510@itemx unrolled_loop
14511Expand into an inline loop.
14512
14513@item libcall
14514Always use a library call.
14515@end table
14516
14517@item -momit-leaf-frame-pointer
14518@opindex momit-leaf-frame-pointer
14519Don't keep the frame pointer in a register for leaf functions.  This
14520avoids the instructions to save, set up, and restore frame pointers and
14521makes an extra register available in leaf functions.  The option
14522@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
14523which might make debugging harder.
14524
14525@item -mtls-direct-seg-refs
14526@itemx -mno-tls-direct-seg-refs
14527@opindex mtls-direct-seg-refs
14528Controls whether TLS variables may be accessed with offsets from the
14529TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
14530or whether the thread base pointer must be added.  Whether or not this
14531is valid depends on the operating system, and whether it maps the
14532segment to cover the entire TLS area.
14533
14534For systems that use the GNU C Library, the default is on.
14535
14536@item -msse2avx
14537@itemx -mno-sse2avx
14538@opindex msse2avx
14539Specify that the assembler should encode SSE instructions with VEX
14540prefix.  The option @option{-mavx} turns this on by default.
14541
14542@item -mfentry
14543@itemx -mno-fentry
14544@opindex mfentry
14545If profiling is active (@option{-pg}), put the profiling
14546counter call before the prologue.
14547Note: On x86 architectures the attribute @code{ms_hook_prologue}
14548isn't possible at the moment for @option{-mfentry} and @option{-pg}.
14549
14550@item -m8bit-idiv
14551@itemx -mno-8bit-idiv
14552@opindex 8bit-idiv
14553On some processors, like Intel Atom, 8-bit unsigned integer divide is
14554much faster than 32-bit/64-bit integer divide.  This option generates a
14555run-time check.  If both dividend and divisor are within range of 0
14556to 255, 8-bit unsigned integer divide is used instead of
1455732-bit/64-bit integer divide.
14558
14559@item -mavx256-split-unaligned-load
14560@itemx -mavx256-split-unaligned-store
14561@opindex avx256-split-unaligned-load
14562@opindex avx256-split-unaligned-store
14563Split 32-byte AVX unaligned load and store.
14564
14565@end table
14566
14567These @samp{-m} switches are supported in addition to the above
14568on x86-64 processors in 64-bit environments.
14569
14570@table @gcctabopt
14571@item -m32
14572@itemx -m64
14573@itemx -mx32
14574@opindex m32
14575@opindex m64
14576@opindex mx32
14577Generate code for a 32-bit or 64-bit environment.
14578The @option{-m32} option sets @code{int}, @code{long}, and pointer types
14579to 32 bits, and
14580generates code that runs on any i386 system.
14581
14582The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
14583types to 64 bits, and generates code for the x86-64 architecture.
14584For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
14585and @option{-mdynamic-no-pic} options.
14586
14587The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
14588to 32 bits, and
14589generates code for the x86-64 architecture.
14590
14591@item -mno-red-zone
14592@opindex mno-red-zone
14593Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
14594by the x86-64 ABI; it is a 128-byte area beyond the location of the
14595stack pointer that is not modified by signal or interrupt handlers
14596and therefore can be used for temporary data without adjusting the stack
14597pointer.  The flag @option{-mno-red-zone} disables this red zone.
14598
14599@item -mcmodel=small
14600@opindex mcmodel=small
14601Generate code for the small code model: the program and its symbols must
14602be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
14603Programs can be statically or dynamically linked.  This is the default
14604code model.
14605
14606@item -mcmodel=kernel
14607@opindex mcmodel=kernel
14608Generate code for the kernel code model.  The kernel runs in the
14609negative 2 GB of the address space.
14610This model has to be used for Linux kernel code.
14611
14612@item -mcmodel=medium
14613@opindex mcmodel=medium
14614Generate code for the medium model: the program is linked in the lower 2
14615GB of the address space.  Small symbols are also placed there.  Symbols
14616with sizes larger than @option{-mlarge-data-threshold} are put into
14617large data or BSS sections and can be located above 2GB.  Programs can
14618be statically or dynamically linked.
14619
14620@item -mcmodel=large
14621@opindex mcmodel=large
14622Generate code for the large model.  This model makes no assumptions
14623about addresses and sizes of sections.
14624
14625@item -maddress-mode=long
14626@opindex maddress-mode=long
14627Generate code for long address mode.  This is only supported for 64-bit
14628and x32 environments.  It is the default address mode for 64-bit
14629environments.
14630
14631@item -maddress-mode=short
14632@opindex maddress-mode=short
14633Generate code for short address mode.  This is only supported for 32-bit
14634and x32 environments.  It is the default address mode for 32-bit and
14635x32 environments.
14636@end table
14637
14638@node i386 and x86-64 Windows Options
14639@subsection i386 and x86-64 Windows Options
14640@cindex i386 and x86-64 Windows Options
14641
14642These additional options are available for Microsoft Windows targets:
14643
14644@table @gcctabopt
14645@item -mconsole
14646@opindex mconsole
14647This option
14648specifies that a console application is to be generated, by
14649instructing the linker to set the PE header subsystem type
14650required for console applications.
14651This option is available for Cygwin and MinGW targets and is
14652enabled by default on those targets.
14653
14654@item -mdll
14655@opindex mdll
14656This option is available for Cygwin and MinGW targets.  It
14657specifies that a DLL---a dynamic link library---is to be
14658generated, enabling the selection of the required runtime
14659startup object and entry point.
14660
14661@item -mnop-fun-dllimport
14662@opindex mnop-fun-dllimport
14663This option is available for Cygwin and MinGW targets.  It
14664specifies that the @code{dllimport} attribute should be ignored.
14665
14666@item -mthread
14667@opindex mthread
14668This option is available for MinGW targets. It specifies
14669that MinGW-specific thread support is to be used.
14670
14671@item -municode
14672@opindex municode
14673This option is available for MinGW-w64 targets.  It causes
14674the @code{UNICODE} preprocessor macro to be predefined, and
14675chooses Unicode-capable runtime startup code.
14676
14677@item -mwin32
14678@opindex mwin32
14679This option is available for Cygwin and MinGW targets.  It
14680specifies that the typical Microsoft Windows predefined macros are to
14681be set in the pre-processor, but does not influence the choice
14682of runtime library/startup code.
14683
14684@item -mwindows
14685@opindex mwindows
14686This option is available for Cygwin and MinGW targets.  It
14687specifies that a GUI application is to be generated by
14688instructing the linker to set the PE header subsystem type
14689appropriately.
14690
14691@item -fno-set-stack-executable
14692@opindex fno-set-stack-executable
14693This option is available for MinGW targets. It specifies that
14694the executable flag for the stack used by nested functions isn't
14695set. This is necessary for binaries running in kernel mode of
14696Microsoft Windows, as there the User32 API, which is used to set executable
14697privileges, isn't available.
14698
14699@item -fwritable-relocated-rdata
14700@opindex fno-writable-relocated-rdata
14701This option is available for MinGW and Cygwin targets.  It specifies
14702that relocated-data in read-only section is put into .data
14703section.  This is a necessary for older runtimes not supporting
14704modification of .rdata sections for pseudo-relocation.
14705
14706@item -mpe-aligned-commons
14707@opindex mpe-aligned-commons
14708This option is available for Cygwin and MinGW targets.  It
14709specifies that the GNU extension to the PE file format that
14710permits the correct alignment of COMMON variables should be
14711used when generating code.  It is enabled by default if
14712GCC detects that the target assembler found during configuration
14713supports the feature.
14714@end table
14715
14716See also under @ref{i386 and x86-64 Options} for standard options.
14717
14718@node IA-64 Options
14719@subsection IA-64 Options
14720@cindex IA-64 Options
14721
14722These are the @samp{-m} options defined for the Intel IA-64 architecture.
14723
14724@table @gcctabopt
14725@item -mbig-endian
14726@opindex mbig-endian
14727Generate code for a big-endian target.  This is the default for HP-UX@.
14728
14729@item -mlittle-endian
14730@opindex mlittle-endian
14731Generate code for a little-endian target.  This is the default for AIX5
14732and GNU/Linux.
14733
14734@item -mgnu-as
14735@itemx -mno-gnu-as
14736@opindex mgnu-as
14737@opindex mno-gnu-as
14738Generate (or don't) code for the GNU assembler.  This is the default.
14739@c Also, this is the default if the configure option @option{--with-gnu-as}
14740@c is used.
14741
14742@item -mgnu-ld
14743@itemx -mno-gnu-ld
14744@opindex mgnu-ld
14745@opindex mno-gnu-ld
14746Generate (or don't) code for the GNU linker.  This is the default.
14747@c Also, this is the default if the configure option @option{--with-gnu-ld}
14748@c is used.
14749
14750@item -mno-pic
14751@opindex mno-pic
14752Generate code that does not use a global pointer register.  The result
14753is not position independent code, and violates the IA-64 ABI@.
14754
14755@item -mvolatile-asm-stop
14756@itemx -mno-volatile-asm-stop
14757@opindex mvolatile-asm-stop
14758@opindex mno-volatile-asm-stop
14759Generate (or don't) a stop bit immediately before and after volatile asm
14760statements.
14761
14762@item -mregister-names
14763@itemx -mno-register-names
14764@opindex mregister-names
14765@opindex mno-register-names
14766Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
14767the stacked registers.  This may make assembler output more readable.
14768
14769@item -mno-sdata
14770@itemx -msdata
14771@opindex mno-sdata
14772@opindex msdata
14773Disable (or enable) optimizations that use the small data section.  This may
14774be useful for working around optimizer bugs.
14775
14776@item -mconstant-gp
14777@opindex mconstant-gp
14778Generate code that uses a single constant global pointer value.  This is
14779useful when compiling kernel code.
14780
14781@item -mauto-pic
14782@opindex mauto-pic
14783Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
14784This is useful when compiling firmware code.
14785
14786@item -minline-float-divide-min-latency
14787@opindex minline-float-divide-min-latency
14788Generate code for inline divides of floating-point values
14789using the minimum latency algorithm.
14790
14791@item -minline-float-divide-max-throughput
14792@opindex minline-float-divide-max-throughput
14793Generate code for inline divides of floating-point values
14794using the maximum throughput algorithm.
14795
14796@item -mno-inline-float-divide
14797@opindex mno-inline-float-divide
14798Do not generate inline code for divides of floating-point values.
14799
14800@item -minline-int-divide-min-latency
14801@opindex minline-int-divide-min-latency
14802Generate code for inline divides of integer values
14803using the minimum latency algorithm.
14804
14805@item -minline-int-divide-max-throughput
14806@opindex minline-int-divide-max-throughput
14807Generate code for inline divides of integer values
14808using the maximum throughput algorithm.
14809
14810@item -mno-inline-int-divide
14811@opindex mno-inline-int-divide
14812Do not generate inline code for divides of integer values.
14813
14814@item -minline-sqrt-min-latency
14815@opindex minline-sqrt-min-latency
14816Generate code for inline square roots
14817using the minimum latency algorithm.
14818
14819@item -minline-sqrt-max-throughput
14820@opindex minline-sqrt-max-throughput
14821Generate code for inline square roots
14822using the maximum throughput algorithm.
14823
14824@item -mno-inline-sqrt
14825@opindex mno-inline-sqrt
14826Do not generate inline code for @code{sqrt}.
14827
14828@item -mfused-madd
14829@itemx -mno-fused-madd
14830@opindex mfused-madd
14831@opindex mno-fused-madd
14832Do (don't) generate code that uses the fused multiply/add or multiply/subtract
14833instructions.  The default is to use these instructions.
14834
14835@item -mno-dwarf2-asm
14836@itemx -mdwarf2-asm
14837@opindex mno-dwarf2-asm
14838@opindex mdwarf2-asm
14839Don't (or do) generate assembler code for the DWARF 2 line number debugging
14840info.  This may be useful when not using the GNU assembler.
14841
14842@item -mearly-stop-bits
14843@itemx -mno-early-stop-bits
14844@opindex mearly-stop-bits
14845@opindex mno-early-stop-bits
14846Allow stop bits to be placed earlier than immediately preceding the
14847instruction that triggered the stop bit.  This can improve instruction
14848scheduling, but does not always do so.
14849
14850@item -mfixed-range=@var{register-range}
14851@opindex mfixed-range
14852Generate code treating the given register range as fixed registers.
14853A fixed register is one that the register allocator cannot use.  This is
14854useful when compiling kernel code.  A register range is specified as
14855two registers separated by a dash.  Multiple register ranges can be
14856specified separated by a comma.
14857
14858@item -mtls-size=@var{tls-size}
14859@opindex mtls-size
14860Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
1486164.
14862
14863@item -mtune=@var{cpu-type}
14864@opindex mtune
14865Tune the instruction scheduling for a particular CPU, Valid values are
14866@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
14867and @samp{mckinley}.
14868
14869@item -milp32
14870@itemx -mlp64
14871@opindex milp32
14872@opindex mlp64
14873Generate code for a 32-bit or 64-bit environment.
14874The 32-bit environment sets int, long and pointer to 32 bits.
14875The 64-bit environment sets int to 32 bits and long and pointer
14876to 64 bits.  These are HP-UX specific flags.
14877
14878@item -mno-sched-br-data-spec
14879@itemx -msched-br-data-spec
14880@opindex mno-sched-br-data-spec
14881@opindex msched-br-data-spec
14882(Dis/En)able data speculative scheduling before reload.
14883This results in generation of @code{ld.a} instructions and
14884the corresponding check instructions (@code{ld.c} / @code{chk.a}).
14885The default is 'disable'.
14886
14887@item -msched-ar-data-spec
14888@itemx -mno-sched-ar-data-spec
14889@opindex msched-ar-data-spec
14890@opindex mno-sched-ar-data-spec
14891(En/Dis)able data speculative scheduling after reload.
14892This results in generation of @code{ld.a} instructions and
14893the corresponding check instructions (@code{ld.c} / @code{chk.a}).
14894The default is 'enable'.
14895
14896@item -mno-sched-control-spec
14897@itemx -msched-control-spec
14898@opindex mno-sched-control-spec
14899@opindex msched-control-spec
14900(Dis/En)able control speculative scheduling.  This feature is
14901available only during region scheduling (i.e.@: before reload).
14902This results in generation of the @code{ld.s} instructions and
14903the corresponding check instructions @code{chk.s}.
14904The default is 'disable'.
14905
14906@item -msched-br-in-data-spec
14907@itemx -mno-sched-br-in-data-spec
14908@opindex msched-br-in-data-spec
14909@opindex mno-sched-br-in-data-spec
14910(En/Dis)able speculative scheduling of the instructions that
14911are dependent on the data speculative loads before reload.
14912This is effective only with @option{-msched-br-data-spec} enabled.
14913The default is 'enable'.
14914
14915@item -msched-ar-in-data-spec
14916@itemx -mno-sched-ar-in-data-spec
14917@opindex msched-ar-in-data-spec
14918@opindex mno-sched-ar-in-data-spec
14919(En/Dis)able speculative scheduling of the instructions that
14920are dependent on the data speculative loads after reload.
14921This is effective only with @option{-msched-ar-data-spec} enabled.
14922The default is 'enable'.
14923
14924@item -msched-in-control-spec
14925@itemx -mno-sched-in-control-spec
14926@opindex msched-in-control-spec
14927@opindex mno-sched-in-control-spec
14928(En/Dis)able speculative scheduling of the instructions that
14929are dependent on the control speculative loads.
14930This is effective only with @option{-msched-control-spec} enabled.
14931The default is 'enable'.
14932
14933@item -mno-sched-prefer-non-data-spec-insns
14934@itemx -msched-prefer-non-data-spec-insns
14935@opindex mno-sched-prefer-non-data-spec-insns
14936@opindex msched-prefer-non-data-spec-insns
14937If enabled, data-speculative instructions are chosen for schedule
14938only if there are no other choices at the moment.  This makes
14939the use of the data speculation much more conservative.
14940The default is 'disable'.
14941
14942@item -mno-sched-prefer-non-control-spec-insns
14943@itemx -msched-prefer-non-control-spec-insns
14944@opindex mno-sched-prefer-non-control-spec-insns
14945@opindex msched-prefer-non-control-spec-insns
14946If enabled, control-speculative instructions are chosen for schedule
14947only if there are no other choices at the moment.  This makes
14948the use of the control speculation much more conservative.
14949The default is 'disable'.
14950
14951@item -mno-sched-count-spec-in-critical-path
14952@itemx -msched-count-spec-in-critical-path
14953@opindex mno-sched-count-spec-in-critical-path
14954@opindex msched-count-spec-in-critical-path
14955If enabled, speculative dependencies are considered during
14956computation of the instructions priorities.  This makes the use of the
14957speculation a bit more conservative.
14958The default is 'disable'.
14959
14960@item -msched-spec-ldc
14961@opindex msched-spec-ldc
14962Use a simple data speculation check.  This option is on by default.
14963
14964@item -msched-control-spec-ldc
14965@opindex msched-spec-ldc
14966Use a simple check for control speculation.  This option is on by default.
14967
14968@item -msched-stop-bits-after-every-cycle
14969@opindex msched-stop-bits-after-every-cycle
14970Place a stop bit after every cycle when scheduling.  This option is on
14971by default.
14972
14973@item -msched-fp-mem-deps-zero-cost
14974@opindex msched-fp-mem-deps-zero-cost
14975Assume that floating-point stores and loads are not likely to cause a conflict
14976when placed into the same instruction group.  This option is disabled by
14977default.
14978
14979@item -msel-sched-dont-check-control-spec
14980@opindex msel-sched-dont-check-control-spec
14981Generate checks for control speculation in selective scheduling.
14982This flag is disabled by default.
14983
14984@item -msched-max-memory-insns=@var{max-insns}
14985@opindex msched-max-memory-insns
14986Limit on the number of memory insns per instruction group, giving lower
14987priority to subsequent memory insns attempting to schedule in the same
14988instruction group. Frequently useful to prevent cache bank conflicts.
14989The default value is 1.
14990
14991@item -msched-max-memory-insns-hard-limit
14992@opindex msched-max-memory-insns-hard-limit
14993Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
14994disallowing more than that number in an instruction group.
14995Otherwise, the limit is ``soft'', meaning that non-memory operations
14996are preferred when the limit is reached, but memory operations may still
14997be scheduled.
14998
14999@end table
15000
15001@node LM32 Options
15002@subsection LM32 Options
15003@cindex LM32 options
15004
15005These @option{-m} options are defined for the LatticeMico32 architecture:
15006
15007@table @gcctabopt
15008@item -mbarrel-shift-enabled
15009@opindex mbarrel-shift-enabled
15010Enable barrel-shift instructions.
15011
15012@item -mdivide-enabled
15013@opindex mdivide-enabled
15014Enable divide and modulus instructions.
15015
15016@item -mmultiply-enabled
15017@opindex multiply-enabled
15018Enable multiply instructions.
15019
15020@item -msign-extend-enabled
15021@opindex msign-extend-enabled
15022Enable sign extend instructions.
15023
15024@item -muser-enabled
15025@opindex muser-enabled
15026Enable user-defined instructions.
15027
15028@end table
15029
15030@node M32C Options
15031@subsection M32C Options
15032@cindex M32C options
15033
15034@table @gcctabopt
15035@item -mcpu=@var{name}
15036@opindex mcpu=
15037Select the CPU for which code is generated.  @var{name} may be one of
15038@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
15039/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
15040the M32C/80 series.
15041
15042@item -msim
15043@opindex msim
15044Specifies that the program will be run on the simulator.  This causes
15045an alternate runtime library to be linked in which supports, for
15046example, file I/O@.  You must not use this option when generating
15047programs that will run on real hardware; you must provide your own
15048runtime library for whatever I/O functions are needed.
15049
15050@item -memregs=@var{number}
15051@opindex memregs=
15052Specifies the number of memory-based pseudo-registers GCC uses
15053during code generation.  These pseudo-registers are used like real
15054registers, so there is a tradeoff between GCC's ability to fit the
15055code into available registers, and the performance penalty of using
15056memory instead of registers.  Note that all modules in a program must
15057be compiled with the same value for this option.  Because of that, you
15058must not use this option with GCC's default runtime libraries.
15059
15060@end table
15061
15062@node M32R/D Options
15063@subsection M32R/D Options
15064@cindex M32R/D options
15065
15066These @option{-m} options are defined for Renesas M32R/D architectures:
15067
15068@table @gcctabopt
15069@item -m32r2
15070@opindex m32r2
15071Generate code for the M32R/2@.
15072
15073@item -m32rx
15074@opindex m32rx
15075Generate code for the M32R/X@.
15076
15077@item -m32r
15078@opindex m32r
15079Generate code for the M32R@.  This is the default.
15080
15081@item -mmodel=small
15082@opindex mmodel=small
15083Assume all objects live in the lower 16MB of memory (so that their addresses
15084can be loaded with the @code{ld24} instruction), and assume all subroutines
15085are reachable with the @code{bl} instruction.
15086This is the default.
15087
15088The addressability of a particular object can be set with the
15089@code{model} attribute.
15090
15091@item -mmodel=medium
15092@opindex mmodel=medium
15093Assume objects may be anywhere in the 32-bit address space (the compiler
15094generates @code{seth/add3} instructions to load their addresses), and
15095assume all subroutines are reachable with the @code{bl} instruction.
15096
15097@item -mmodel=large
15098@opindex mmodel=large
15099Assume objects may be anywhere in the 32-bit address space (the compiler
15100generates @code{seth/add3} instructions to load their addresses), and
15101assume subroutines may not be reachable with the @code{bl} instruction
15102(the compiler generates the much slower @code{seth/add3/jl}
15103instruction sequence).
15104
15105@item -msdata=none
15106@opindex msdata=none
15107Disable use of the small data area.  Variables are put into
15108one of @samp{.data}, @samp{.bss}, or @samp{.rodata} (unless the
15109@code{section} attribute has been specified).
15110This is the default.
15111
15112The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
15113Objects may be explicitly put in the small data area with the
15114@code{section} attribute using one of these sections.
15115
15116@item -msdata=sdata
15117@opindex msdata=sdata
15118Put small global and static data in the small data area, but do not
15119generate special code to reference them.
15120
15121@item -msdata=use
15122@opindex msdata=use
15123Put small global and static data in the small data area, and generate
15124special instructions to reference them.
15125
15126@item -G @var{num}
15127@opindex G
15128@cindex smaller data references
15129Put global and static objects less than or equal to @var{num} bytes
15130into the small data or BSS sections instead of the normal data or BSS
15131sections.  The default value of @var{num} is 8.
15132The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
15133for this option to have any effect.
15134
15135All modules should be compiled with the same @option{-G @var{num}} value.
15136Compiling with different values of @var{num} may or may not work; if it
15137doesn't the linker gives an error message---incorrect code is not
15138generated.
15139
15140@item -mdebug
15141@opindex mdebug
15142Makes the M32R-specific code in the compiler display some statistics
15143that might help in debugging programs.
15144
15145@item -malign-loops
15146@opindex malign-loops
15147Align all loops to a 32-byte boundary.
15148
15149@item -mno-align-loops
15150@opindex mno-align-loops
15151Do not enforce a 32-byte alignment for loops.  This is the default.
15152
15153@item -missue-rate=@var{number}
15154@opindex missue-rate=@var{number}
15155Issue @var{number} instructions per cycle.  @var{number} can only be 1
15156or 2.
15157
15158@item -mbranch-cost=@var{number}
15159@opindex mbranch-cost=@var{number}
15160@var{number} can only be 1 or 2.  If it is 1 then branches are
15161preferred over conditional code, if it is 2, then the opposite applies.
15162
15163@item -mflush-trap=@var{number}
15164@opindex mflush-trap=@var{number}
15165Specifies the trap number to use to flush the cache.  The default is
1516612.  Valid numbers are between 0 and 15 inclusive.
15167
15168@item -mno-flush-trap
15169@opindex mno-flush-trap
15170Specifies that the cache cannot be flushed by using a trap.
15171
15172@item -mflush-func=@var{name}
15173@opindex mflush-func=@var{name}
15174Specifies the name of the operating system function to call to flush
15175the cache.  The default is @emph{_flush_cache}, but a function call
15176is only used if a trap is not available.
15177
15178@item -mno-flush-func
15179@opindex mno-flush-func
15180Indicates that there is no OS function for flushing the cache.
15181
15182@end table
15183
15184@node M680x0 Options
15185@subsection M680x0 Options
15186@cindex M680x0 options
15187
15188These are the @samp{-m} options defined for M680x0 and ColdFire processors.
15189The default settings depend on which architecture was selected when
15190the compiler was configured; the defaults for the most common choices
15191are given below.
15192
15193@table @gcctabopt
15194@item -march=@var{arch}
15195@opindex march
15196Generate code for a specific M680x0 or ColdFire instruction set
15197architecture.  Permissible values of @var{arch} for M680x0
15198architectures are: @samp{68000}, @samp{68010}, @samp{68020},
15199@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
15200architectures are selected according to Freescale's ISA classification
15201and the permissible values are: @samp{isaa}, @samp{isaaplus},
15202@samp{isab} and @samp{isac}.
15203
15204GCC defines a macro @samp{__mcf@var{arch}__} whenever it is generating
15205code for a ColdFire target.  The @var{arch} in this macro is one of the
15206@option{-march} arguments given above.
15207
15208When used together, @option{-march} and @option{-mtune} select code
15209that runs on a family of similar processors but that is optimized
15210for a particular microarchitecture.
15211
15212@item -mcpu=@var{cpu}
15213@opindex mcpu
15214Generate code for a specific M680x0 or ColdFire processor.
15215The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
15216@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
15217and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
15218below, which also classifies the CPUs into families:
15219
15220@multitable @columnfractions 0.20 0.80
15221@item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
15222@item @samp{51} @tab @samp{51} @samp{51ac} @samp{51ag} @samp{51cn} @samp{51em} @samp{51je} @samp{51jf} @samp{51jg} @samp{51jm} @samp{51mm} @samp{51qe} @samp{51qm}
15223@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
15224@item @samp{5206e} @tab @samp{5206e}
15225@item @samp{5208} @tab @samp{5207} @samp{5208}
15226@item @samp{5211a} @tab @samp{5210a} @samp{5211a}
15227@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
15228@item @samp{5216} @tab @samp{5214} @samp{5216}
15229@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
15230@item @samp{5225} @tab @samp{5224} @samp{5225}
15231@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
15232@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
15233@item @samp{5249} @tab @samp{5249}
15234@item @samp{5250} @tab @samp{5250}
15235@item @samp{5271} @tab @samp{5270} @samp{5271}
15236@item @samp{5272} @tab @samp{5272}
15237@item @samp{5275} @tab @samp{5274} @samp{5275}
15238@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
15239@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
15240@item @samp{5307} @tab @samp{5307}
15241@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
15242@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
15243@item @samp{5407} @tab @samp{5407}
15244@item @samp{5475} @tab @samp{5470} @samp{5471} @samp{5472} @samp{5473} @samp{5474} @samp{5475} @samp{547x} @samp{5480} @samp{5481} @samp{5482} @samp{5483} @samp{5484} @samp{5485}
15245@end multitable
15246
15247@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
15248@var{arch} is compatible with @var{cpu}.  Other combinations of
15249@option{-mcpu} and @option{-march} are rejected.
15250
15251GCC defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
15252@var{cpu} is selected.  It also defines @samp{__mcf_family_@var{family}},
15253where the value of @var{family} is given by the table above.
15254
15255@item -mtune=@var{tune}
15256@opindex mtune
15257Tune the code for a particular microarchitecture within the
15258constraints set by @option{-march} and @option{-mcpu}.
15259The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
15260@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
15261and @samp{cpu32}.  The ColdFire microarchitectures
15262are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
15263
15264You can also use @option{-mtune=68020-40} for code that needs
15265to run relatively well on 68020, 68030 and 68040 targets.
15266@option{-mtune=68020-60} is similar but includes 68060 targets
15267as well.  These two options select the same tuning decisions as
15268@option{-m68020-40} and @option{-m68020-60} respectively.
15269
15270GCC defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
15271when tuning for 680x0 architecture @var{arch}.  It also defines
15272@samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
15273option is used.  If GCC is tuning for a range of architectures,
15274as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
15275it defines the macros for every architecture in the range.
15276
15277GCC also defines the macro @samp{__m@var{uarch}__} when tuning for
15278ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
15279of the arguments given above.
15280
15281@item -m68000
15282@itemx -mc68000
15283@opindex m68000
15284@opindex mc68000
15285Generate output for a 68000.  This is the default
15286when the compiler is configured for 68000-based systems.
15287It is equivalent to @option{-march=68000}.
15288
15289Use this option for microcontrollers with a 68000 or EC000 core,
15290including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
15291
15292@item -m68010
15293@opindex m68010
15294Generate output for a 68010.  This is the default
15295when the compiler is configured for 68010-based systems.
15296It is equivalent to @option{-march=68010}.
15297
15298@item -m68020
15299@itemx -mc68020
15300@opindex m68020
15301@opindex mc68020
15302Generate output for a 68020.  This is the default
15303when the compiler is configured for 68020-based systems.
15304It is equivalent to @option{-march=68020}.
15305
15306@item -m68030
15307@opindex m68030
15308Generate output for a 68030.  This is the default when the compiler is
15309configured for 68030-based systems.  It is equivalent to
15310@option{-march=68030}.
15311
15312@item -m68040
15313@opindex m68040
15314Generate output for a 68040.  This is the default when the compiler is
15315configured for 68040-based systems.  It is equivalent to
15316@option{-march=68040}.
15317
15318This option inhibits the use of 68881/68882 instructions that have to be
15319emulated by software on the 68040.  Use this option if your 68040 does not
15320have code to emulate those instructions.
15321
15322@item -m68060
15323@opindex m68060
15324Generate output for a 68060.  This is the default when the compiler is
15325configured for 68060-based systems.  It is equivalent to
15326@option{-march=68060}.
15327
15328This option inhibits the use of 68020 and 68881/68882 instructions that
15329have to be emulated by software on the 68060.  Use this option if your 68060
15330does not have code to emulate those instructions.
15331
15332@item -mcpu32
15333@opindex mcpu32
15334Generate output for a CPU32.  This is the default
15335when the compiler is configured for CPU32-based systems.
15336It is equivalent to @option{-march=cpu32}.
15337
15338Use this option for microcontrollers with a
15339CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
1534068336, 68340, 68341, 68349 and 68360.
15341
15342@item -m5200
15343@opindex m5200
15344Generate output for a 520X ColdFire CPU@.  This is the default
15345when the compiler is configured for 520X-based systems.
15346It is equivalent to @option{-mcpu=5206}, and is now deprecated
15347in favor of that option.
15348
15349Use this option for microcontroller with a 5200 core, including
15350the MCF5202, MCF5203, MCF5204 and MCF5206.
15351
15352@item -m5206e
15353@opindex m5206e
15354Generate output for a 5206e ColdFire CPU@.  The option is now
15355deprecated in favor of the equivalent @option{-mcpu=5206e}.
15356
15357@item -m528x
15358@opindex m528x
15359Generate output for a member of the ColdFire 528X family.
15360The option is now deprecated in favor of the equivalent
15361@option{-mcpu=528x}.
15362
15363@item -m5307
15364@opindex m5307
15365Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
15366in favor of the equivalent @option{-mcpu=5307}.
15367
15368@item -m5407
15369@opindex m5407
15370Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
15371in favor of the equivalent @option{-mcpu=5407}.
15372
15373@item -mcfv4e
15374@opindex mcfv4e
15375Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
15376This includes use of hardware floating-point instructions.
15377The option is equivalent to @option{-mcpu=547x}, and is now
15378deprecated in favor of that option.
15379
15380@item -m68020-40
15381@opindex m68020-40
15382Generate output for a 68040, without using any of the new instructions.
15383This results in code that can run relatively efficiently on either a
1538468020/68881 or a 68030 or a 68040.  The generated code does use the
1538568881 instructions that are emulated on the 68040.
15386
15387The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
15388
15389@item -m68020-60
15390@opindex m68020-60
15391Generate output for a 68060, without using any of the new instructions.
15392This results in code that can run relatively efficiently on either a
1539368020/68881 or a 68030 or a 68040.  The generated code does use the
1539468881 instructions that are emulated on the 68060.
15395
15396The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
15397
15398@item -mhard-float
15399@itemx -m68881
15400@opindex mhard-float
15401@opindex m68881
15402Generate floating-point instructions.  This is the default for 68020
15403and above, and for ColdFire devices that have an FPU@.  It defines the
15404macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
15405on ColdFire targets.
15406
15407@item -msoft-float
15408@opindex msoft-float
15409Do not generate floating-point instructions; use library calls instead.
15410This is the default for 68000, 68010, and 68832 targets.  It is also
15411the default for ColdFire devices that have no FPU.
15412
15413@item -mdiv
15414@itemx -mno-div
15415@opindex mdiv
15416@opindex mno-div
15417Generate (do not generate) ColdFire hardware divide and remainder
15418instructions.  If @option{-march} is used without @option{-mcpu},
15419the default is ``on'' for ColdFire architectures and ``off'' for M680x0
15420architectures.  Otherwise, the default is taken from the target CPU
15421(either the default CPU, or the one specified by @option{-mcpu}).  For
15422example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
15423@option{-mcpu=5206e}.
15424
15425GCC defines the macro @samp{__mcfhwdiv__} when this option is enabled.
15426
15427@item -mshort
15428@opindex mshort
15429Consider type @code{int} to be 16 bits wide, like @code{short int}.
15430Additionally, parameters passed on the stack are also aligned to a
1543116-bit boundary even on targets whose API mandates promotion to 32-bit.
15432
15433@item -mno-short
15434@opindex mno-short
15435Do not consider type @code{int} to be 16 bits wide.  This is the default.
15436
15437@item -mnobitfield
15438@itemx -mno-bitfield
15439@opindex mnobitfield
15440@opindex mno-bitfield
15441Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
15442and @option{-m5200} options imply @w{@option{-mnobitfield}}.
15443
15444@item -mbitfield
15445@opindex mbitfield
15446Do use the bit-field instructions.  The @option{-m68020} option implies
15447@option{-mbitfield}.  This is the default if you use a configuration
15448designed for a 68020.
15449
15450@item -mrtd
15451@opindex mrtd
15452Use a different function-calling convention, in which functions
15453that take a fixed number of arguments return with the @code{rtd}
15454instruction, which pops their arguments while returning.  This
15455saves one instruction in the caller since there is no need to pop
15456the arguments there.
15457
15458This calling convention is incompatible with the one normally
15459used on Unix, so you cannot use it if you need to call libraries
15460compiled with the Unix compiler.
15461
15462Also, you must provide function prototypes for all functions that
15463take variable numbers of arguments (including @code{printf});
15464otherwise incorrect code is generated for calls to those
15465functions.
15466
15467In addition, seriously incorrect code results if you call a
15468function with too many arguments.  (Normally, extra arguments are
15469harmlessly ignored.)
15470
15471The @code{rtd} instruction is supported by the 68010, 68020, 68030,
1547268040, 68060 and CPU32 processors, but not by the 68000 or 5200.
15473
15474@item -mno-rtd
15475@opindex mno-rtd
15476Do not use the calling conventions selected by @option{-mrtd}.
15477This is the default.
15478
15479@item -malign-int
15480@itemx -mno-align-int
15481@opindex malign-int
15482@opindex mno-align-int
15483Control whether GCC aligns @code{int}, @code{long}, @code{long long},
15484@code{float}, @code{double}, and @code{long double} variables on a 32-bit
15485boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
15486Aligning variables on 32-bit boundaries produces code that runs somewhat
15487faster on processors with 32-bit busses at the expense of more memory.
15488
15489@strong{Warning:} if you use the @option{-malign-int} switch, GCC
15490aligns structures containing the above types differently than
15491most published application binary interface specifications for the m68k.
15492
15493@item -mpcrel
15494@opindex mpcrel
15495Use the pc-relative addressing mode of the 68000 directly, instead of
15496using a global offset table.  At present, this option implies @option{-fpic},
15497allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
15498not presently supported with @option{-mpcrel}, though this could be supported for
1549968020 and higher processors.
15500
15501@item -mno-strict-align
15502@itemx -mstrict-align
15503@opindex mno-strict-align
15504@opindex mstrict-align
15505Do not (do) assume that unaligned memory references are handled by
15506the system.
15507
15508@item -msep-data
15509Generate code that allows the data segment to be located in a different
15510area of memory from the text segment.  This allows for execute-in-place in
15511an environment without virtual memory management.  This option implies
15512@option{-fPIC}.
15513
15514@item -mno-sep-data
15515Generate code that assumes that the data segment follows the text segment.
15516This is the default.
15517
15518@item -mid-shared-library
15519Generate code that supports shared libraries via the library ID method.
15520This allows for execute-in-place and shared libraries in an environment
15521without virtual memory management.  This option implies @option{-fPIC}.
15522
15523@item -mno-id-shared-library
15524Generate code that doesn't assume ID-based shared libraries are being used.
15525This is the default.
15526
15527@item -mshared-library-id=n
15528Specifies the identification number of the ID-based shared library being
15529compiled.  Specifying a value of 0 generates more compact code; specifying
15530other values forces the allocation of that number to the current
15531library, but is no more space- or time-efficient than omitting this option.
15532
15533@item -mxgot
15534@itemx -mno-xgot
15535@opindex mxgot
15536@opindex mno-xgot
15537When generating position-independent code for ColdFire, generate code
15538that works if the GOT has more than 8192 entries.  This code is
15539larger and slower than code generated without this option.  On M680x0
15540processors, this option is not needed; @option{-fPIC} suffices.
15541
15542GCC normally uses a single instruction to load values from the GOT@.
15543While this is relatively efficient, it only works if the GOT
15544is smaller than about 64k.  Anything larger causes the linker
15545to report an error such as:
15546
15547@cindex relocation truncated to fit (ColdFire)
15548@smallexample
15549relocation truncated to fit: R_68K_GOT16O foobar
15550@end smallexample
15551
15552If this happens, you should recompile your code with @option{-mxgot}.
15553It should then work with very large GOTs.  However, code generated with
15554@option{-mxgot} is less efficient, since it takes 4 instructions to fetch
15555the value of a global symbol.
15556
15557Note that some linkers, including newer versions of the GNU linker,
15558can create multiple GOTs and sort GOT entries.  If you have such a linker,
15559you should only need to use @option{-mxgot} when compiling a single
15560object file that accesses more than 8192 GOT entries.  Very few do.
15561
15562These options have no effect unless GCC is generating
15563position-independent code.
15564
15565@end table
15566
15567@node MCore Options
15568@subsection MCore Options
15569@cindex MCore options
15570
15571These are the @samp{-m} options defined for the Motorola M*Core
15572processors.
15573
15574@table @gcctabopt
15575
15576@item -mhardlit
15577@itemx -mno-hardlit
15578@opindex mhardlit
15579@opindex mno-hardlit
15580Inline constants into the code stream if it can be done in two
15581instructions or less.
15582
15583@item -mdiv
15584@itemx -mno-div
15585@opindex mdiv
15586@opindex mno-div
15587Use the divide instruction.  (Enabled by default).
15588
15589@item -mrelax-immediate
15590@itemx -mno-relax-immediate
15591@opindex mrelax-immediate
15592@opindex mno-relax-immediate
15593Allow arbitrary-sized immediates in bit operations.
15594
15595@item -mwide-bitfields
15596@itemx -mno-wide-bitfields
15597@opindex mwide-bitfields
15598@opindex mno-wide-bitfields
15599Always treat bit-fields as @code{int}-sized.
15600
15601@item -m4byte-functions
15602@itemx -mno-4byte-functions
15603@opindex m4byte-functions
15604@opindex mno-4byte-functions
15605Force all functions to be aligned to a 4-byte boundary.
15606
15607@item -mcallgraph-data
15608@itemx -mno-callgraph-data
15609@opindex mcallgraph-data
15610@opindex mno-callgraph-data
15611Emit callgraph information.
15612
15613@item -mslow-bytes
15614@itemx -mno-slow-bytes
15615@opindex mslow-bytes
15616@opindex mno-slow-bytes
15617Prefer word access when reading byte quantities.
15618
15619@item -mlittle-endian
15620@itemx -mbig-endian
15621@opindex mlittle-endian
15622@opindex mbig-endian
15623Generate code for a little-endian target.
15624
15625@item -m210
15626@itemx -m340
15627@opindex m210
15628@opindex m340
15629Generate code for the 210 processor.
15630
15631@item -mno-lsim
15632@opindex mno-lsim
15633Assume that runtime support has been provided and so omit the
15634simulator library (@file{libsim.a)} from the linker command line.
15635
15636@item -mstack-increment=@var{size}
15637@opindex mstack-increment
15638Set the maximum amount for a single stack increment operation.  Large
15639values can increase the speed of programs that contain functions
15640that need a large amount of stack space, but they can also trigger a
15641segmentation fault if the stack is extended too much.  The default
15642value is 0x1000.
15643
15644@end table
15645
15646@node MeP Options
15647@subsection MeP Options
15648@cindex MeP options
15649
15650@table @gcctabopt
15651
15652@item -mabsdiff
15653@opindex mabsdiff
15654Enables the @code{abs} instruction, which is the absolute difference
15655between two registers.
15656
15657@item -mall-opts
15658@opindex mall-opts
15659Enables all the optional instructions---average, multiply, divide, bit
15660operations, leading zero, absolute difference, min/max, clip, and
15661saturation.
15662
15663
15664@item -maverage
15665@opindex maverage
15666Enables the @code{ave} instruction, which computes the average of two
15667registers.
15668
15669@item -mbased=@var{n}
15670@opindex mbased=
15671Variables of size @var{n} bytes or smaller are placed in the
15672@code{.based} section by default.  Based variables use the @code{$tp}
15673register as a base register, and there is a 128-byte limit to the
15674@code{.based} section.
15675
15676@item -mbitops
15677@opindex mbitops
15678Enables the bit operation instructions---bit test (@code{btstm}), set
15679(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
15680test-and-set (@code{tas}).
15681
15682@item -mc=@var{name}
15683@opindex mc=
15684Selects which section constant data is placed in.  @var{name} may
15685be @code{tiny}, @code{near}, or @code{far}.
15686
15687@item -mclip
15688@opindex mclip
15689Enables the @code{clip} instruction.  Note that @code{-mclip} is not
15690useful unless you also provide @code{-mminmax}.
15691
15692@item -mconfig=@var{name}
15693@opindex mconfig=
15694Selects one of the built-in core configurations.  Each MeP chip has
15695one or more modules in it; each module has a core CPU and a variety of
15696coprocessors, optional instructions, and peripherals.  The
15697@code{MeP-Integrator} tool, not part of GCC, provides these
15698configurations through this option; using this option is the same as
15699using all the corresponding command-line options.  The default
15700configuration is @code{default}.
15701
15702@item -mcop
15703@opindex mcop
15704Enables the coprocessor instructions.  By default, this is a 32-bit
15705coprocessor.  Note that the coprocessor is normally enabled via the
15706@code{-mconfig=} option.
15707
15708@item -mcop32
15709@opindex mcop32
15710Enables the 32-bit coprocessor's instructions.
15711
15712@item -mcop64
15713@opindex mcop64
15714Enables the 64-bit coprocessor's instructions.
15715
15716@item -mivc2
15717@opindex mivc2
15718Enables IVC2 scheduling.  IVC2 is a 64-bit VLIW coprocessor.
15719
15720@item -mdc
15721@opindex mdc
15722Causes constant variables to be placed in the @code{.near} section.
15723
15724@item -mdiv
15725@opindex mdiv
15726Enables the @code{div} and @code{divu} instructions.
15727
15728@item -meb
15729@opindex meb
15730Generate big-endian code.
15731
15732@item -mel
15733@opindex mel
15734Generate little-endian code.
15735
15736@item -mio-volatile
15737@opindex mio-volatile
15738Tells the compiler that any variable marked with the @code{io}
15739attribute is to be considered volatile.
15740
15741@item -ml
15742@opindex ml
15743Causes variables to be assigned to the @code{.far} section by default.
15744
15745@item -mleadz
15746@opindex mleadz
15747Enables the @code{leadz} (leading zero) instruction.
15748
15749@item -mm
15750@opindex mm
15751Causes variables to be assigned to the @code{.near} section by default.
15752
15753@item -mminmax
15754@opindex mminmax
15755Enables the @code{min} and @code{max} instructions.
15756
15757@item -mmult
15758@opindex mmult
15759Enables the multiplication and multiply-accumulate instructions.
15760
15761@item -mno-opts
15762@opindex mno-opts
15763Disables all the optional instructions enabled by @code{-mall-opts}.
15764
15765@item -mrepeat
15766@opindex mrepeat
15767Enables the @code{repeat} and @code{erepeat} instructions, used for
15768low-overhead looping.
15769
15770@item -ms
15771@opindex ms
15772Causes all variables to default to the @code{.tiny} section.  Note
15773that there is a 65536-byte limit to this section.  Accesses to these
15774variables use the @code{%gp} base register.
15775
15776@item -msatur
15777@opindex msatur
15778Enables the saturation instructions.  Note that the compiler does not
15779currently generate these itself, but this option is included for
15780compatibility with other tools, like @code{as}.
15781
15782@item -msdram
15783@opindex msdram
15784Link the SDRAM-based runtime instead of the default ROM-based runtime.
15785
15786@item -msim
15787@opindex msim
15788Link the simulator runtime libraries.
15789
15790@item -msimnovec
15791@opindex msimnovec
15792Link the simulator runtime libraries, excluding built-in support
15793for reset and exception vectors and tables.
15794
15795@item -mtf
15796@opindex mtf
15797Causes all functions to default to the @code{.far} section.  Without
15798this option, functions default to the @code{.near} section.
15799
15800@item -mtiny=@var{n}
15801@opindex mtiny=
15802Variables that are @var{n} bytes or smaller are allocated to the
15803@code{.tiny} section.  These variables use the @code{$gp} base
15804register.  The default for this option is 4, but note that there's a
1580565536-byte limit to the @code{.tiny} section.
15806
15807@end table
15808
15809@node MicroBlaze Options
15810@subsection MicroBlaze Options
15811@cindex MicroBlaze Options
15812
15813@table @gcctabopt
15814
15815@item -msoft-float
15816@opindex msoft-float
15817Use software emulation for floating point (default).
15818
15819@item -mhard-float
15820@opindex mhard-float
15821Use hardware floating-point instructions.
15822
15823@item -mmemcpy
15824@opindex mmemcpy
15825Do not optimize block moves, use @code{memcpy}.
15826
15827@item -mno-clearbss
15828@opindex mno-clearbss
15829This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
15830
15831@item -mcpu=@var{cpu-type}
15832@opindex mcpu=
15833Use features of, and schedule code for, the given CPU.
15834Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
15835where @var{X} is a major version, @var{YY} is the minor version, and
15836@var{Z} is compatibility code.  Example values are @samp{v3.00.a},
15837@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
15838
15839@item -mxl-soft-mul
15840@opindex mxl-soft-mul
15841Use software multiply emulation (default).
15842
15843@item -mxl-soft-div
15844@opindex mxl-soft-div
15845Use software emulation for divides (default).
15846
15847@item -mxl-barrel-shift
15848@opindex mxl-barrel-shift
15849Use the hardware barrel shifter.
15850
15851@item -mxl-pattern-compare
15852@opindex mxl-pattern-compare
15853Use pattern compare instructions.
15854
15855@item -msmall-divides
15856@opindex msmall-divides
15857Use table lookup optimization for small signed integer divisions.
15858
15859@item -mxl-stack-check
15860@opindex mxl-stack-check
15861This option is deprecated.  Use @option{-fstack-check} instead.
15862
15863@item -mxl-gp-opt
15864@opindex mxl-gp-opt
15865Use GP-relative @code{.sdata}/@code{.sbss} sections.
15866
15867@item -mxl-multiply-high
15868@opindex mxl-multiply-high
15869Use multiply high instructions for high part of 32x32 multiply.
15870
15871@item -mxl-float-convert
15872@opindex mxl-float-convert
15873Use hardware floating-point conversion instructions.
15874
15875@item -mxl-float-sqrt
15876@opindex mxl-float-sqrt
15877Use hardware floating-point square root instruction.
15878
15879@item -mbig-endian
15880@opindex mbig-endian
15881Generate code for a big-endian target.
15882
15883@item -mlittle-endian
15884@opindex mlittle-endian
15885Generate code for a little-endian target.
15886
15887@item -mxl-reorder
15888@opindex mxl-reorder
15889Use reorder instructions (swap and byte reversed load/store).
15890
15891@item -mxl-mode-@var{app-model}
15892Select application model @var{app-model}.  Valid models are
15893@table @samp
15894@item executable
15895normal executable (default), uses startup code @file{crt0.o}.
15896
15897@item xmdstub
15898for use with Xilinx Microprocessor Debugger (XMD) based
15899software intrusive debug agent called xmdstub. This uses startup file
15900@file{crt1.o} and sets the start address of the program to 0x800.
15901
15902@item bootstrap
15903for applications that are loaded using a bootloader.
15904This model uses startup file @file{crt2.o} which does not contain a processor
15905reset vector handler. This is suitable for transferring control on a
15906processor reset to the bootloader rather than the application.
15907
15908@item novectors
15909for applications that do not require any of the
15910MicroBlaze vectors. This option may be useful for applications running
15911within a monitoring application. This model uses @file{crt3.o} as a startup file.
15912@end table
15913
15914Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
15915@option{-mxl-mode-@var{app-model}}.
15916
15917@end table
15918
15919@node MIPS Options
15920@subsection MIPS Options
15921@cindex MIPS options
15922
15923@table @gcctabopt
15924
15925@item -EB
15926@opindex EB
15927Generate big-endian code.
15928
15929@item -EL
15930@opindex EL
15931Generate little-endian code.  This is the default for @samp{mips*el-*-*}
15932configurations.
15933
15934@item -march=@var{arch}
15935@opindex march
15936Generate code that runs on @var{arch}, which can be the name of a
15937generic MIPS ISA, or the name of a particular processor.
15938The ISA names are:
15939@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
15940@samp{mips32}, @samp{mips32r2}, @samp{mips64} and @samp{mips64r2}.
15941The processor names are:
15942@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
15943@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
15944@samp{5kc}, @samp{5kf},
15945@samp{20kc},
15946@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
15947@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
15948@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
15949@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
15950@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
15951@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
15952@samp{m4k},
15953@samp{octeon}, @samp{octeon+}, @samp{octeon2},
15954@samp{orion},
15955@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
15956@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
15957@samp{rm7000}, @samp{rm9000},
15958@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
15959@samp{sb1},
15960@samp{sr71000},
15961@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
15962@samp{vr5000}, @samp{vr5400}, @samp{vr5500},
15963@samp{xlr} and @samp{xlp}.
15964The special value @samp{from-abi} selects the
15965most compatible architecture for the selected ABI (that is,
15966@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
15967
15968The native Linux/GNU toolchain also supports the value @samp{native},
15969which selects the best architecture option for the host processor.
15970@option{-march=native} has no effect if GCC does not recognize
15971the processor.
15972
15973In processor names, a final @samp{000} can be abbreviated as @samp{k}
15974(for example, @option{-march=r2k}).  Prefixes are optional, and
15975@samp{vr} may be written @samp{r}.
15976
15977Names of the form @samp{@var{n}f2_1} refer to processors with
15978FPUs clocked at half the rate of the core, names of the form
15979@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
15980rate as the core, and names of the form @samp{@var{n}f3_2} refer to
15981processors with FPUs clocked a ratio of 3:2 with respect to the core.
15982For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
15983for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
15984accepted as synonyms for @samp{@var{n}f1_1}.
15985
15986GCC defines two macros based on the value of this option.  The first
15987is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
15988a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
15989where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
15990For example, @option{-march=r2000} sets @samp{_MIPS_ARCH}
15991to @samp{"r2000"} and defines the macro @samp{_MIPS_ARCH_R2000}.
15992
15993Note that the @samp{_MIPS_ARCH} macro uses the processor names given
15994above.  In other words, it has the full prefix and does not
15995abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
15996the macro names the resolved architecture (either @samp{"mips1"} or
15997@samp{"mips3"}).  It names the default architecture when no
15998@option{-march} option is given.
15999
16000@item -mtune=@var{arch}
16001@opindex mtune
16002Optimize for @var{arch}.  Among other things, this option controls
16003the way instructions are scheduled, and the perceived cost of arithmetic
16004operations.  The list of @var{arch} values is the same as for
16005@option{-march}.
16006
16007When this option is not used, GCC optimizes for the processor
16008specified by @option{-march}.  By using @option{-march} and
16009@option{-mtune} together, it is possible to generate code that
16010runs on a family of processors, but optimize the code for one
16011particular member of that family.
16012
16013@option{-mtune} defines the macros @samp{_MIPS_TUNE} and
16014@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
16015@option{-march} ones described above.
16016
16017@item -mips1
16018@opindex mips1
16019Equivalent to @option{-march=mips1}.
16020
16021@item -mips2
16022@opindex mips2
16023Equivalent to @option{-march=mips2}.
16024
16025@item -mips3
16026@opindex mips3
16027Equivalent to @option{-march=mips3}.
16028
16029@item -mips4
16030@opindex mips4
16031Equivalent to @option{-march=mips4}.
16032
16033@item -mips32
16034@opindex mips32
16035Equivalent to @option{-march=mips32}.
16036
16037@item -mips32r2
16038@opindex mips32r2
16039Equivalent to @option{-march=mips32r2}.
16040
16041@item -mips64
16042@opindex mips64
16043Equivalent to @option{-march=mips64}.
16044
16045@item -mips64r2
16046@opindex mips64r2
16047Equivalent to @option{-march=mips64r2}.
16048
16049@item -mips16
16050@itemx -mno-mips16
16051@opindex mips16
16052@opindex mno-mips16
16053Generate (do not generate) MIPS16 code.  If GCC is targeting a
16054MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
16055
16056MIPS16 code generation can also be controlled on a per-function basis
16057by means of @code{mips16} and @code{nomips16} attributes.
16058@xref{Function Attributes}, for more information.
16059
16060@item -mflip-mips16
16061@opindex mflip-mips16
16062Generate MIPS16 code on alternating functions.  This option is provided
16063for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
16064not intended for ordinary use in compiling user code.
16065
16066@item -minterlink-mips16
16067@itemx -mno-interlink-mips16
16068@opindex minterlink-mips16
16069@opindex mno-interlink-mips16
16070Require (do not require) that non-MIPS16 code be link-compatible with
16071MIPS16 code.
16072
16073For example, non-MIPS16 code cannot jump directly to MIPS16 code;
16074it must either use a call or an indirect jump.  @option{-minterlink-mips16}
16075therefore disables direct jumps unless GCC knows that the target of the
16076jump is not MIPS16.
16077
16078@item -mabi=32
16079@itemx -mabi=o64
16080@itemx -mabi=n32
16081@itemx -mabi=64
16082@itemx -mabi=eabi
16083@opindex mabi=32
16084@opindex mabi=o64
16085@opindex mabi=n32
16086@opindex mabi=64
16087@opindex mabi=eabi
16088Generate code for the given ABI@.
16089
16090Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
16091generates 64-bit code when you select a 64-bit architecture, but you
16092can use @option{-mgp32} to get 32-bit code instead.
16093
16094For information about the O64 ABI, see
16095@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
16096
16097GCC supports a variant of the o32 ABI in which floating-point registers
16098are 64 rather than 32 bits wide.  You can select this combination with
16099@option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
16100and @code{mfhc1} instructions and is therefore only supported for
16101MIPS32R2 processors.
16102
16103The register assignments for arguments and return values remain the
16104same, but each scalar value is passed in a single 64-bit register
16105rather than a pair of 32-bit registers.  For example, scalar
16106floating-point values are returned in @samp{$f0} only, not a
16107@samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
16108remains the same, but all 64 bits are saved.
16109
16110@item -mabicalls
16111@itemx -mno-abicalls
16112@opindex mabicalls
16113@opindex mno-abicalls
16114Generate (do not generate) code that is suitable for SVR4-style
16115dynamic objects.  @option{-mabicalls} is the default for SVR4-based
16116systems.
16117
16118@item -mshared
16119@itemx -mno-shared
16120Generate (do not generate) code that is fully position-independent,
16121and that can therefore be linked into shared libraries.  This option
16122only affects @option{-mabicalls}.
16123
16124All @option{-mabicalls} code has traditionally been position-independent,
16125regardless of options like @option{-fPIC} and @option{-fpic}.  However,
16126as an extension, the GNU toolchain allows executables to use absolute
16127accesses for locally-binding symbols.  It can also use shorter GP
16128initialization sequences and generate direct calls to locally-defined
16129functions.  This mode is selected by @option{-mno-shared}.
16130
16131@option{-mno-shared} depends on binutils 2.16 or higher and generates
16132objects that can only be linked by the GNU linker.  However, the option
16133does not affect the ABI of the final executable; it only affects the ABI
16134of relocatable objects.  Using @option{-mno-shared} generally makes
16135executables both smaller and quicker.
16136
16137@option{-mshared} is the default.
16138
16139@item -mplt
16140@itemx -mno-plt
16141@opindex mplt
16142@opindex mno-plt
16143Assume (do not assume) that the static and dynamic linkers
16144support PLTs and copy relocations.  This option only affects
16145@option{-mno-shared -mabicalls}.  For the n64 ABI, this option
16146has no effect without @option{-msym32}.
16147
16148You can make @option{-mplt} the default by configuring
16149GCC with @option{--with-mips-plt}.  The default is
16150@option{-mno-plt} otherwise.
16151
16152@item -mxgot
16153@itemx -mno-xgot
16154@opindex mxgot
16155@opindex mno-xgot
16156Lift (do not lift) the usual restrictions on the size of the global
16157offset table.
16158
16159GCC normally uses a single instruction to load values from the GOT@.
16160While this is relatively efficient, it only works if the GOT
16161is smaller than about 64k.  Anything larger causes the linker
16162to report an error such as:
16163
16164@cindex relocation truncated to fit (MIPS)
16165@smallexample
16166relocation truncated to fit: R_MIPS_GOT16 foobar
16167@end smallexample
16168
16169If this happens, you should recompile your code with @option{-mxgot}.
16170This works with very large GOTs, although the code is also
16171less efficient, since it takes three instructions to fetch the
16172value of a global symbol.
16173
16174Note that some linkers can create multiple GOTs.  If you have such a
16175linker, you should only need to use @option{-mxgot} when a single object
16176file accesses more than 64k's worth of GOT entries.  Very few do.
16177
16178These options have no effect unless GCC is generating position
16179independent code.
16180
16181@item -mgp32
16182@opindex mgp32
16183Assume that general-purpose registers are 32 bits wide.
16184
16185@item -mgp64
16186@opindex mgp64
16187Assume that general-purpose registers are 64 bits wide.
16188
16189@item -mfp32
16190@opindex mfp32
16191Assume that floating-point registers are 32 bits wide.
16192
16193@item -mfp64
16194@opindex mfp64
16195Assume that floating-point registers are 64 bits wide.
16196
16197@item -mhard-float
16198@opindex mhard-float
16199Use floating-point coprocessor instructions.
16200
16201@item -msoft-float
16202@opindex msoft-float
16203Do not use floating-point coprocessor instructions.  Implement
16204floating-point calculations using library calls instead.
16205
16206@item -mno-float
16207@opindex mno-float
16208Equivalent to @option{-msoft-float}, but additionally asserts that the
16209program being compiled does not perform any floating-point operations.
16210This option is presently supported only by some bare-metal MIPS
16211configurations, where it may select a special set of libraries
16212that lack all floating-point support (including, for example, the
16213floating-point @code{printf} formats).
16214If code compiled with @code{-mno-float} accidentally contains
16215floating-point operations, it is likely to suffer a link-time
16216or run-time failure.
16217
16218@item -msingle-float
16219@opindex msingle-float
16220Assume that the floating-point coprocessor only supports single-precision
16221operations.
16222
16223@item -mdouble-float
16224@opindex mdouble-float
16225Assume that the floating-point coprocessor supports double-precision
16226operations.  This is the default.
16227
16228@item -mllsc
16229@itemx -mno-llsc
16230@opindex mllsc
16231@opindex mno-llsc
16232Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
16233implement atomic memory built-in functions.  When neither option is
16234specified, GCC uses the instructions if the target architecture
16235supports them.
16236
16237@option{-mllsc} is useful if the runtime environment can emulate the
16238instructions and @option{-mno-llsc} can be useful when compiling for
16239nonstandard ISAs.  You can make either option the default by
16240configuring GCC with @option{--with-llsc} and @option{--without-llsc}
16241respectively.  @option{--with-llsc} is the default for some
16242configurations; see the installation documentation for details.
16243
16244@item -mdsp
16245@itemx -mno-dsp
16246@opindex mdsp
16247@opindex mno-dsp
16248Use (do not use) revision 1 of the MIPS DSP ASE@.
16249@xref{MIPS DSP Built-in Functions}.  This option defines the
16250preprocessor macro @samp{__mips_dsp}.  It also defines
16251@samp{__mips_dsp_rev} to 1.
16252
16253@item -mdspr2
16254@itemx -mno-dspr2
16255@opindex mdspr2
16256@opindex mno-dspr2
16257Use (do not use) revision 2 of the MIPS DSP ASE@.
16258@xref{MIPS DSP Built-in Functions}.  This option defines the
16259preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
16260It also defines @samp{__mips_dsp_rev} to 2.
16261
16262@item -msmartmips
16263@itemx -mno-smartmips
16264@opindex msmartmips
16265@opindex mno-smartmips
16266Use (do not use) the MIPS SmartMIPS ASE.
16267
16268@item -mpaired-single
16269@itemx -mno-paired-single
16270@opindex mpaired-single
16271@opindex mno-paired-single
16272Use (do not use) paired-single floating-point instructions.
16273@xref{MIPS Paired-Single Support}.  This option requires
16274hardware floating-point support to be enabled.
16275
16276@item -mdmx
16277@itemx -mno-mdmx
16278@opindex mdmx
16279@opindex mno-mdmx
16280Use (do not use) MIPS Digital Media Extension instructions.
16281This option can only be used when generating 64-bit code and requires
16282hardware floating-point support to be enabled.
16283
16284@item -mips3d
16285@itemx -mno-mips3d
16286@opindex mips3d
16287@opindex mno-mips3d
16288Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
16289The option @option{-mips3d} implies @option{-mpaired-single}.
16290
16291@item -mmt
16292@itemx -mno-mt
16293@opindex mmt
16294@opindex mno-mt
16295Use (do not use) MT Multithreading instructions.
16296
16297@item -mmcu
16298@itemx -mno-mcu
16299@opindex mmcu
16300@opindex mno-mcu
16301Use (do not use) the MIPS MCU ASE instructions.
16302
16303@item -mlong64
16304@opindex mlong64
16305Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
16306an explanation of the default and the way that the pointer size is
16307determined.
16308
16309@item -mlong32
16310@opindex mlong32
16311Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
16312
16313The default size of @code{int}s, @code{long}s and pointers depends on
16314the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
16315uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
1631632-bit @code{long}s.  Pointers are the same size as @code{long}s,
16317or the same size as integer registers, whichever is smaller.
16318
16319@item -msym32
16320@itemx -mno-sym32
16321@opindex msym32
16322@opindex mno-sym32
16323Assume (do not assume) that all symbols have 32-bit values, regardless
16324of the selected ABI@.  This option is useful in combination with
16325@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
16326to generate shorter and faster references to symbolic addresses.
16327
16328@item -G @var{num}
16329@opindex G
16330Put definitions of externally-visible data in a small data section
16331if that data is no bigger than @var{num} bytes.  GCC can then generate
16332more efficient accesses to the data; see @option{-mgpopt} for details.
16333
16334The default @option{-G} option depends on the configuration.
16335
16336@item -mlocal-sdata
16337@itemx -mno-local-sdata
16338@opindex mlocal-sdata
16339@opindex mno-local-sdata
16340Extend (do not extend) the @option{-G} behavior to local data too,
16341such as to static variables in C@.  @option{-mlocal-sdata} is the
16342default for all configurations.
16343
16344If the linker complains that an application is using too much small data,
16345you might want to try rebuilding the less performance-critical parts with
16346@option{-mno-local-sdata}.  You might also want to build large
16347libraries with @option{-mno-local-sdata}, so that the libraries leave
16348more room for the main program.
16349
16350@item -mextern-sdata
16351@itemx -mno-extern-sdata
16352@opindex mextern-sdata
16353@opindex mno-extern-sdata
16354Assume (do not assume) that externally-defined data is in
16355a small data section if the size of that data is within the @option{-G} limit.
16356@option{-mextern-sdata} is the default for all configurations.
16357
16358If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
16359@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
16360that is no bigger than @var{num} bytes, you must make sure that @var{Var}
16361is placed in a small data section.  If @var{Var} is defined by another
16362module, you must either compile that module with a high-enough
16363@option{-G} setting or attach a @code{section} attribute to @var{Var}'s
16364definition.  If @var{Var} is common, you must link the application
16365with a high-enough @option{-G} setting.
16366
16367The easiest way of satisfying these restrictions is to compile
16368and link every module with the same @option{-G} option.  However,
16369you may wish to build a library that supports several different
16370small data limits.  You can do this by compiling the library with
16371the highest supported @option{-G} setting and additionally using
16372@option{-mno-extern-sdata} to stop the library from making assumptions
16373about externally-defined data.
16374
16375@item -mgpopt
16376@itemx -mno-gpopt
16377@opindex mgpopt
16378@opindex mno-gpopt
16379Use (do not use) GP-relative accesses for symbols that are known to be
16380in a small data section; see @option{-G}, @option{-mlocal-sdata} and
16381@option{-mextern-sdata}.  @option{-mgpopt} is the default for all
16382configurations.
16383
16384@option{-mno-gpopt} is useful for cases where the @code{$gp} register
16385might not hold the value of @code{_gp}.  For example, if the code is
16386part of a library that might be used in a boot monitor, programs that
16387call boot monitor routines pass an unknown value in @code{$gp}.
16388(In such situations, the boot monitor itself is usually compiled
16389with @option{-G0}.)
16390
16391@option{-mno-gpopt} implies @option{-mno-local-sdata} and
16392@option{-mno-extern-sdata}.
16393
16394@item -membedded-data
16395@itemx -mno-embedded-data
16396@opindex membedded-data
16397@opindex mno-embedded-data
16398Allocate variables to the read-only data section first if possible, then
16399next in the small data section if possible, otherwise in data.  This gives
16400slightly slower code than the default, but reduces the amount of RAM required
16401when executing, and thus may be preferred for some embedded systems.
16402
16403@item -muninit-const-in-rodata
16404@itemx -mno-uninit-const-in-rodata
16405@opindex muninit-const-in-rodata
16406@opindex mno-uninit-const-in-rodata
16407Put uninitialized @code{const} variables in the read-only data section.
16408This option is only meaningful in conjunction with @option{-membedded-data}.
16409
16410@item -mcode-readable=@var{setting}
16411@opindex mcode-readable
16412Specify whether GCC may generate code that reads from executable sections.
16413There are three possible settings:
16414
16415@table @gcctabopt
16416@item -mcode-readable=yes
16417Instructions may freely access executable sections.  This is the
16418default setting.
16419
16420@item -mcode-readable=pcrel
16421MIPS16 PC-relative load instructions can access executable sections,
16422but other instructions must not do so.  This option is useful on 4KSc
16423and 4KSd processors when the code TLBs have the Read Inhibit bit set.
16424It is also useful on processors that can be configured to have a dual
16425instruction/data SRAM interface and that, like the M4K, automatically
16426redirect PC-relative loads to the instruction RAM.
16427
16428@item -mcode-readable=no
16429Instructions must not access executable sections.  This option can be
16430useful on targets that are configured to have a dual instruction/data
16431SRAM interface but that (unlike the M4K) do not automatically redirect
16432PC-relative loads to the instruction RAM.
16433@end table
16434
16435@item -msplit-addresses
16436@itemx -mno-split-addresses
16437@opindex msplit-addresses
16438@opindex mno-split-addresses
16439Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
16440relocation operators.  This option has been superseded by
16441@option{-mexplicit-relocs} but is retained for backwards compatibility.
16442
16443@item -mexplicit-relocs
16444@itemx -mno-explicit-relocs
16445@opindex mexplicit-relocs
16446@opindex mno-explicit-relocs
16447Use (do not use) assembler relocation operators when dealing with symbolic
16448addresses.  The alternative, selected by @option{-mno-explicit-relocs},
16449is to use assembler macros instead.
16450
16451@option{-mexplicit-relocs} is the default if GCC was configured
16452to use an assembler that supports relocation operators.
16453
16454@item -mcheck-zero-division
16455@itemx -mno-check-zero-division
16456@opindex mcheck-zero-division
16457@opindex mno-check-zero-division
16458Trap (do not trap) on integer division by zero.
16459
16460The default is @option{-mcheck-zero-division}.
16461
16462@item -mdivide-traps
16463@itemx -mdivide-breaks
16464@opindex mdivide-traps
16465@opindex mdivide-breaks
16466MIPS systems check for division by zero by generating either a
16467conditional trap or a break instruction.  Using traps results in
16468smaller code, but is only supported on MIPS II and later.  Also, some
16469versions of the Linux kernel have a bug that prevents trap from
16470generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
16471allow conditional traps on architectures that support them and
16472@option{-mdivide-breaks} to force the use of breaks.
16473
16474The default is usually @option{-mdivide-traps}, but this can be
16475overridden at configure time using @option{--with-divide=breaks}.
16476Divide-by-zero checks can be completely disabled using
16477@option{-mno-check-zero-division}.
16478
16479@item -mmemcpy
16480@itemx -mno-memcpy
16481@opindex mmemcpy
16482@opindex mno-memcpy
16483Force (do not force) the use of @code{memcpy()} for non-trivial block
16484moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
16485most constant-sized copies.
16486
16487@item -mlong-calls
16488@itemx -mno-long-calls
16489@opindex mlong-calls
16490@opindex mno-long-calls
16491Disable (do not disable) use of the @code{jal} instruction.  Calling
16492functions using @code{jal} is more efficient but requires the caller
16493and callee to be in the same 256 megabyte segment.
16494
16495This option has no effect on abicalls code.  The default is
16496@option{-mno-long-calls}.
16497
16498@item -mmad
16499@itemx -mno-mad
16500@opindex mmad
16501@opindex mno-mad
16502Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
16503instructions, as provided by the R4650 ISA@.
16504
16505@item -mfused-madd
16506@itemx -mno-fused-madd
16507@opindex mfused-madd
16508@opindex mno-fused-madd
16509Enable (disable) use of the floating-point multiply-accumulate
16510instructions, when they are available.  The default is
16511@option{-mfused-madd}.
16512
16513On the R8000 CPU when multiply-accumulate instructions are used,
16514the intermediate product is calculated to infinite precision
16515and is not subject to the FCSR Flush to Zero bit.  This may be
16516undesirable in some circumstances.  On other processors the result
16517is numerically identical to the equivalent computation using
16518separate multiply, add, subtract and negate instructions.
16519
16520@item -nocpp
16521@opindex nocpp
16522Tell the MIPS assembler to not run its preprocessor over user
16523assembler files (with a @samp{.s} suffix) when assembling them.
16524
16525@item -mfix-24k
16526@item -mno-fix-24k
16527@opindex mfix-24k
16528@opindex mno-fix-24k
16529Work around the 24K E48 (lost data on stores during refill) errata.
16530The workarounds are implemented by the assembler rather than by GCC@.
16531
16532@item -mfix-r4000
16533@itemx -mno-fix-r4000
16534@opindex mfix-r4000
16535@opindex mno-fix-r4000
16536Work around certain R4000 CPU errata:
16537@itemize @minus
16538@item
16539A double-word or a variable shift may give an incorrect result if executed
16540immediately after starting an integer division.
16541@item
16542A double-word or a variable shift may give an incorrect result if executed
16543while an integer multiplication is in progress.
16544@item
16545An integer division may give an incorrect result if started in a delay slot
16546of a taken branch or a jump.
16547@end itemize
16548
16549@item -mfix-r4400
16550@itemx -mno-fix-r4400
16551@opindex mfix-r4400
16552@opindex mno-fix-r4400
16553Work around certain R4400 CPU errata:
16554@itemize @minus
16555@item
16556A double-word or a variable shift may give an incorrect result if executed
16557immediately after starting an integer division.
16558@end itemize
16559
16560@item -mfix-r10000
16561@itemx -mno-fix-r10000
16562@opindex mfix-r10000
16563@opindex mno-fix-r10000
16564Work around certain R10000 errata:
16565@itemize @minus
16566@item
16567@code{ll}/@code{sc} sequences may not behave atomically on revisions
16568prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
16569@end itemize
16570
16571This option can only be used if the target architecture supports
16572branch-likely instructions.  @option{-mfix-r10000} is the default when
16573@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
16574otherwise.
16575
16576@item -mfix-vr4120
16577@itemx -mno-fix-vr4120
16578@opindex mfix-vr4120
16579Work around certain VR4120 errata:
16580@itemize @minus
16581@item
16582@code{dmultu} does not always produce the correct result.
16583@item
16584@code{div} and @code{ddiv} do not always produce the correct result if one
16585of the operands is negative.
16586@end itemize
16587The workarounds for the division errata rely on special functions in
16588@file{libgcc.a}.  At present, these functions are only provided by
16589the @code{mips64vr*-elf} configurations.
16590
16591Other VR4120 errata require a NOP to be inserted between certain pairs of
16592instructions.  These errata are handled by the assembler, not by GCC itself.
16593
16594@item -mfix-vr4130
16595@opindex mfix-vr4130
16596Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
16597workarounds are implemented by the assembler rather than by GCC,
16598although GCC avoids using @code{mflo} and @code{mfhi} if the
16599VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
16600instructions are available instead.
16601
16602@item -mfix-sb1
16603@itemx -mno-fix-sb1
16604@opindex mfix-sb1
16605Work around certain SB-1 CPU core errata.
16606(This flag currently works around the SB-1 revision 2
16607``F1'' and ``F2'' floating-point errata.)
16608
16609@item -mr10k-cache-barrier=@var{setting}
16610@opindex mr10k-cache-barrier
16611Specify whether GCC should insert cache barriers to avoid the
16612side-effects of speculation on R10K processors.
16613
16614In common with many processors, the R10K tries to predict the outcome
16615of a conditional branch and speculatively executes instructions from
16616the ``taken'' branch.  It later aborts these instructions if the
16617predicted outcome is wrong.  However, on the R10K, even aborted
16618instructions can have side effects.
16619
16620This problem only affects kernel stores and, depending on the system,
16621kernel loads.  As an example, a speculatively-executed store may load
16622the target memory into cache and mark the cache line as dirty, even if
16623the store itself is later aborted.  If a DMA operation writes to the
16624same area of memory before the ``dirty'' line is flushed, the cached
16625data overwrites the DMA-ed data.  See the R10K processor manual
16626for a full description, including other potential problems.
16627
16628One workaround is to insert cache barrier instructions before every memory
16629access that might be speculatively executed and that might have side
16630effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
16631controls GCC's implementation of this workaround.  It assumes that
16632aborted accesses to any byte in the following regions does not have
16633side effects:
16634
16635@enumerate
16636@item
16637the memory occupied by the current function's stack frame;
16638
16639@item
16640the memory occupied by an incoming stack argument;
16641
16642@item
16643the memory occupied by an object with a link-time-constant address.
16644@end enumerate
16645
16646It is the kernel's responsibility to ensure that speculative
16647accesses to these regions are indeed safe.
16648
16649If the input program contains a function declaration such as:
16650
16651@smallexample
16652void foo (void);
16653@end smallexample
16654
16655then the implementation of @code{foo} must allow @code{j foo} and
16656@code{jal foo} to be executed speculatively.  GCC honors this
16657restriction for functions it compiles itself.  It expects non-GCC
16658functions (such as hand-written assembly code) to do the same.
16659
16660The option has three forms:
16661
16662@table @gcctabopt
16663@item -mr10k-cache-barrier=load-store
16664Insert a cache barrier before a load or store that might be
16665speculatively executed and that might have side effects even
16666if aborted.
16667
16668@item -mr10k-cache-barrier=store
16669Insert a cache barrier before a store that might be speculatively
16670executed and that might have side effects even if aborted.
16671
16672@item -mr10k-cache-barrier=none
16673Disable the insertion of cache barriers.  This is the default setting.
16674@end table
16675
16676@item -mflush-func=@var{func}
16677@itemx -mno-flush-func
16678@opindex mflush-func
16679Specifies the function to call to flush the I and D caches, or to not
16680call any such function.  If called, the function must take the same
16681arguments as the common @code{_flush_func()}, that is, the address of the
16682memory range for which the cache is being flushed, the size of the
16683memory range, and the number 3 (to flush both caches).  The default
16684depends on the target GCC was configured for, but commonly is either
16685@samp{_flush_func} or @samp{__cpu_flush}.
16686
16687@item mbranch-cost=@var{num}
16688@opindex mbranch-cost
16689Set the cost of branches to roughly @var{num} ``simple'' instructions.
16690This cost is only a heuristic and is not guaranteed to produce
16691consistent results across releases.  A zero cost redundantly selects
16692the default, which is based on the @option{-mtune} setting.
16693
16694@item -mbranch-likely
16695@itemx -mno-branch-likely
16696@opindex mbranch-likely
16697@opindex mno-branch-likely
16698Enable or disable use of Branch Likely instructions, regardless of the
16699default for the selected architecture.  By default, Branch Likely
16700instructions may be generated if they are supported by the selected
16701architecture.  An exception is for the MIPS32 and MIPS64 architectures
16702and processors that implement those architectures; for those, Branch
16703Likely instructions are not be generated by default because the MIPS32
16704and MIPS64 architectures specifically deprecate their use.
16705
16706@item -mfp-exceptions
16707@itemx -mno-fp-exceptions
16708@opindex mfp-exceptions
16709Specifies whether FP exceptions are enabled.  This affects how
16710FP instructions are scheduled for some processors.
16711The default is that FP exceptions are
16712enabled.
16713
16714For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
1671564-bit code, then we can use both FP pipes.  Otherwise, we can only use one
16716FP pipe.
16717
16718@item -mvr4130-align
16719@itemx -mno-vr4130-align
16720@opindex mvr4130-align
16721The VR4130 pipeline is two-way superscalar, but can only issue two
16722instructions together if the first one is 8-byte aligned.  When this
16723option is enabled, GCC aligns pairs of instructions that it
16724thinks should execute in parallel.
16725
16726This option only has an effect when optimizing for the VR4130.
16727It normally makes code faster, but at the expense of making it bigger.
16728It is enabled by default at optimization level @option{-O3}.
16729
16730@item -msynci
16731@itemx -mno-synci
16732@opindex msynci
16733Enable (disable) generation of @code{synci} instructions on
16734architectures that support it.  The @code{synci} instructions (if
16735enabled) are generated when @code{__builtin___clear_cache()} is
16736compiled.
16737
16738This option defaults to @code{-mno-synci}, but the default can be
16739overridden by configuring with @code{--with-synci}.
16740
16741When compiling code for single processor systems, it is generally safe
16742to use @code{synci}.  However, on many multi-core (SMP) systems, it
16743does not invalidate the instruction caches on all cores and may lead
16744to undefined behavior.
16745
16746@item -mrelax-pic-calls
16747@itemx -mno-relax-pic-calls
16748@opindex mrelax-pic-calls
16749Try to turn PIC calls that are normally dispatched via register
16750@code{$25} into direct calls.  This is only possible if the linker can
16751resolve the destination at link-time and if the destination is within
16752range for a direct call.
16753
16754@option{-mrelax-pic-calls} is the default if GCC was configured to use
16755an assembler and a linker that support the @code{.reloc} assembly
16756directive and @code{-mexplicit-relocs} is in effect.  With
16757@code{-mno-explicit-relocs}, this optimization can be performed by the
16758assembler and the linker alone without help from the compiler.
16759
16760@item -mmcount-ra-address
16761@itemx -mno-mcount-ra-address
16762@opindex mmcount-ra-address
16763@opindex mno-mcount-ra-address
16764Emit (do not emit) code that allows @code{_mcount} to modify the
16765calling function's return address.  When enabled, this option extends
16766the usual @code{_mcount} interface with a new @var{ra-address}
16767parameter, which has type @code{intptr_t *} and is passed in register
16768@code{$12}.  @code{_mcount} can then modify the return address by
16769doing both of the following:
16770@itemize
16771@item
16772Returning the new address in register @code{$31}.
16773@item
16774Storing the new address in @code{*@var{ra-address}},
16775if @var{ra-address} is nonnull.
16776@end itemize
16777
16778The default is @option{-mno-mcount-ra-address}.
16779
16780@end table
16781
16782@node MMIX Options
16783@subsection MMIX Options
16784@cindex MMIX Options
16785
16786These options are defined for the MMIX:
16787
16788@table @gcctabopt
16789@item -mlibfuncs
16790@itemx -mno-libfuncs
16791@opindex mlibfuncs
16792@opindex mno-libfuncs
16793Specify that intrinsic library functions are being compiled, passing all
16794values in registers, no matter the size.
16795
16796@item -mepsilon
16797@itemx -mno-epsilon
16798@opindex mepsilon
16799@opindex mno-epsilon
16800Generate floating-point comparison instructions that compare with respect
16801to the @code{rE} epsilon register.
16802
16803@item -mabi=mmixware
16804@itemx -mabi=gnu
16805@opindex mabi=mmixware
16806@opindex mabi=gnu
16807Generate code that passes function parameters and return values that (in
16808the called function) are seen as registers @code{$0} and up, as opposed to
16809the GNU ABI which uses global registers @code{$231} and up.
16810
16811@item -mzero-extend
16812@itemx -mno-zero-extend
16813@opindex mzero-extend
16814@opindex mno-zero-extend
16815When reading data from memory in sizes shorter than 64 bits, use (do not
16816use) zero-extending load instructions by default, rather than
16817sign-extending ones.
16818
16819@item -mknuthdiv
16820@itemx -mno-knuthdiv
16821@opindex mknuthdiv
16822@opindex mno-knuthdiv
16823Make the result of a division yielding a remainder have the same sign as
16824the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
16825remainder follows the sign of the dividend.  Both methods are
16826arithmetically valid, the latter being almost exclusively used.
16827
16828@item -mtoplevel-symbols
16829@itemx -mno-toplevel-symbols
16830@opindex mtoplevel-symbols
16831@opindex mno-toplevel-symbols
16832Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
16833code can be used with the @code{PREFIX} assembly directive.
16834
16835@item -melf
16836@opindex melf
16837Generate an executable in the ELF format, rather than the default
16838@samp{mmo} format used by the @command{mmix} simulator.
16839
16840@item -mbranch-predict
16841@itemx -mno-branch-predict
16842@opindex mbranch-predict
16843@opindex mno-branch-predict
16844Use (do not use) the probable-branch instructions, when static branch
16845prediction indicates a probable branch.
16846
16847@item -mbase-addresses
16848@itemx -mno-base-addresses
16849@opindex mbase-addresses
16850@opindex mno-base-addresses
16851Generate (do not generate) code that uses @emph{base addresses}.  Using a
16852base address automatically generates a request (handled by the assembler
16853and the linker) for a constant to be set up in a global register.  The
16854register is used for one or more base address requests within the range 0
16855to 255 from the value held in the register.  The generally leads to short
16856and fast code, but the number of different data items that can be
16857addressed is limited.  This means that a program that uses lots of static
16858data may require @option{-mno-base-addresses}.
16859
16860@item -msingle-exit
16861@itemx -mno-single-exit
16862@opindex msingle-exit
16863@opindex mno-single-exit
16864Force (do not force) generated code to have a single exit point in each
16865function.
16866@end table
16867
16868@node MN10300 Options
16869@subsection MN10300 Options
16870@cindex MN10300 options
16871
16872These @option{-m} options are defined for Matsushita MN10300 architectures:
16873
16874@table @gcctabopt
16875@item -mmult-bug
16876@opindex mmult-bug
16877Generate code to avoid bugs in the multiply instructions for the MN10300
16878processors.  This is the default.
16879
16880@item -mno-mult-bug
16881@opindex mno-mult-bug
16882Do not generate code to avoid bugs in the multiply instructions for the
16883MN10300 processors.
16884
16885@item -mam33
16886@opindex mam33
16887Generate code using features specific to the AM33 processor.
16888
16889@item -mno-am33
16890@opindex mno-am33
16891Do not generate code using features specific to the AM33 processor.  This
16892is the default.
16893
16894@item -mam33-2
16895@opindex mam33-2
16896Generate code using features specific to the AM33/2.0 processor.
16897
16898@item -mam34
16899@opindex mam34
16900Generate code using features specific to the AM34 processor.
16901
16902@item -mtune=@var{cpu-type}
16903@opindex mtune
16904Use the timing characteristics of the indicated CPU type when
16905scheduling instructions.  This does not change the targeted processor
16906type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
16907@samp{am33-2} or @samp{am34}.
16908
16909@item -mreturn-pointer-on-d0
16910@opindex mreturn-pointer-on-d0
16911When generating a function that returns a pointer, return the pointer
16912in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
16913only in @code{a0}, and attempts to call such functions without a prototype
16914result in errors.  Note that this option is on by default; use
16915@option{-mno-return-pointer-on-d0} to disable it.
16916
16917@item -mno-crt0
16918@opindex mno-crt0
16919Do not link in the C run-time initialization object file.
16920
16921@item -mrelax
16922@opindex mrelax
16923Indicate to the linker that it should perform a relaxation optimization pass
16924to shorten branches, calls and absolute memory addresses.  This option only
16925has an effect when used on the command line for the final link step.
16926
16927This option makes symbolic debugging impossible.
16928
16929@item -mliw
16930@opindex mliw
16931Allow the compiler to generate @emph{Long Instruction Word}
16932instructions if the target is the @samp{AM33} or later.  This is the
16933default.  This option defines the preprocessor macro @samp{__LIW__}.
16934
16935@item -mnoliw
16936@opindex mnoliw
16937Do not allow the compiler to generate @emph{Long Instruction Word}
16938instructions.  This option defines the preprocessor macro
16939@samp{__NO_LIW__}.
16940
16941@item -msetlb
16942@opindex msetlb
16943Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
16944instructions if the target is the @samp{AM33} or later.  This is the
16945default.  This option defines the preprocessor macro @samp{__SETLB__}.
16946
16947@item -mnosetlb
16948@opindex mnosetlb
16949Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
16950instructions.  This option defines the preprocessor macro
16951@samp{__NO_SETLB__}.
16952
16953@end table
16954
16955@node Moxie Options
16956@subsection Moxie Options
16957@cindex Moxie Options
16958
16959@table @gcctabopt
16960
16961@item -meb
16962@opindex meb
16963Generate big-endian code.  This is the default for @samp{moxie-*-*}
16964configurations.
16965
16966@item -mel
16967@opindex mel
16968Generate little-endian code.
16969
16970@item -mno-crt0
16971@opindex mno-crt0
16972Do not link in the C run-time initialization object file.
16973
16974@end table
16975
16976@node PDP-11 Options
16977@subsection PDP-11 Options
16978@cindex PDP-11 Options
16979
16980These options are defined for the PDP-11:
16981
16982@table @gcctabopt
16983@item -mfpu
16984@opindex mfpu
16985Use hardware FPP floating point.  This is the default.  (FIS floating
16986point on the PDP-11/40 is not supported.)
16987
16988@item -msoft-float
16989@opindex msoft-float
16990Do not use hardware floating point.
16991
16992@item -mac0
16993@opindex mac0
16994Return floating-point results in ac0 (fr0 in Unix assembler syntax).
16995
16996@item -mno-ac0
16997@opindex mno-ac0
16998Return floating-point results in memory.  This is the default.
16999
17000@item -m40
17001@opindex m40
17002Generate code for a PDP-11/40.
17003
17004@item -m45
17005@opindex m45
17006Generate code for a PDP-11/45.  This is the default.
17007
17008@item -m10
17009@opindex m10
17010Generate code for a PDP-11/10.
17011
17012@item -mbcopy-builtin
17013@opindex mbcopy-builtin
17014Use inline @code{movmemhi} patterns for copying memory.  This is the
17015default.
17016
17017@item -mbcopy
17018@opindex mbcopy
17019Do not use inline @code{movmemhi} patterns for copying memory.
17020
17021@item -mint16
17022@itemx -mno-int32
17023@opindex mint16
17024@opindex mno-int32
17025Use 16-bit @code{int}.  This is the default.
17026
17027@item -mint32
17028@itemx -mno-int16
17029@opindex mint32
17030@opindex mno-int16
17031Use 32-bit @code{int}.
17032
17033@item -mfloat64
17034@itemx -mno-float32
17035@opindex mfloat64
17036@opindex mno-float32
17037Use 64-bit @code{float}.  This is the default.
17038
17039@item -mfloat32
17040@itemx -mno-float64
17041@opindex mfloat32
17042@opindex mno-float64
17043Use 32-bit @code{float}.
17044
17045@item -mabshi
17046@opindex mabshi
17047Use @code{abshi2} pattern.  This is the default.
17048
17049@item -mno-abshi
17050@opindex mno-abshi
17051Do not use @code{abshi2} pattern.
17052
17053@item -mbranch-expensive
17054@opindex mbranch-expensive
17055Pretend that branches are expensive.  This is for experimenting with
17056code generation only.
17057
17058@item -mbranch-cheap
17059@opindex mbranch-cheap
17060Do not pretend that branches are expensive.  This is the default.
17061
17062@item -munix-asm
17063@opindex munix-asm
17064Use Unix assembler syntax.  This is the default when configured for
17065@samp{pdp11-*-bsd}.
17066
17067@item -mdec-asm
17068@opindex mdec-asm
17069Use DEC assembler syntax.  This is the default when configured for any
17070PDP-11 target other than @samp{pdp11-*-bsd}.
17071@end table
17072
17073@node picoChip Options
17074@subsection picoChip Options
17075@cindex picoChip options
17076
17077These @samp{-m} options are defined for picoChip implementations:
17078
17079@table @gcctabopt
17080
17081@item -mae=@var{ae_type}
17082@opindex mcpu
17083Set the instruction set, register set, and instruction scheduling
17084parameters for array element type @var{ae_type}.  Supported values
17085for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
17086
17087@option{-mae=ANY} selects a completely generic AE type.  Code
17088generated with this option runs on any of the other AE types.  The
17089code is not as efficient as it would be if compiled for a specific
17090AE type, and some types of operation (e.g., multiplication) do not
17091work properly on all types of AE.
17092
17093@option{-mae=MUL} selects a MUL AE type.  This is the most useful AE type
17094for compiled code, and is the default.
17095
17096@option{-mae=MAC} selects a DSP-style MAC AE.  Code compiled with this
17097option may suffer from poor performance of byte (char) manipulation,
17098since the DSP AE does not provide hardware support for byte load/stores.
17099
17100@item -msymbol-as-address
17101Enable the compiler to directly use a symbol name as an address in a
17102load/store instruction, without first loading it into a
17103register.  Typically, the use of this option generates larger
17104programs, which run faster than when the option isn't used.  However, the
17105results vary from program to program, so it is left as a user option,
17106rather than being permanently enabled.
17107
17108@item -mno-inefficient-warnings
17109Disables warnings about the generation of inefficient code.  These
17110warnings can be generated, for example, when compiling code that
17111performs byte-level memory operations on the MAC AE type.  The MAC AE has
17112no hardware support for byte-level memory operations, so all byte
17113load/stores must be synthesized from word load/store operations.  This is
17114inefficient and a warning is generated to indicate
17115that you should rewrite the code to avoid byte operations, or to target
17116an AE type that has the necessary hardware support.  This option disables
17117these warnings.
17118
17119@end table
17120
17121@node PowerPC Options
17122@subsection PowerPC Options
17123@cindex PowerPC options
17124
17125These are listed under @xref{RS/6000 and PowerPC Options}.
17126
17127@node RL78 Options
17128@subsection RL78 Options
17129@cindex RL78 Options
17130
17131@table @gcctabopt
17132
17133@item -msim
17134@opindex msim
17135Links in additional target libraries to support operation within a
17136simulator.
17137
17138@item -mmul=none
17139@itemx -mmul=g13
17140@itemx -mmul=rl78
17141@opindex mmul
17142Specifies the type of hardware multiplication support to be used.  The
17143default is @code{none}, which uses software multiplication functions.
17144The @code{g13} option is for the hardware multiply/divide peripheral
17145only on the RL78/G13 targets.  The @code{rl78} option is for the
17146standard hardware multiplication defined in the RL78 software manual.
17147
17148@end table
17149
17150@node RS/6000 and PowerPC Options
17151@subsection IBM RS/6000 and PowerPC Options
17152@cindex RS/6000 and PowerPC Options
17153@cindex IBM RS/6000 and PowerPC Options
17154
17155These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
17156@table @gcctabopt
17157@item -mpowerpc-gpopt
17158@itemx -mno-powerpc-gpopt
17159@itemx -mpowerpc-gfxopt
17160@itemx -mno-powerpc-gfxopt
17161@need 800
17162@itemx -mpowerpc64
17163@itemx -mno-powerpc64
17164@itemx -mmfcrf
17165@itemx -mno-mfcrf
17166@itemx -mpopcntb
17167@itemx -mno-popcntb
17168@itemx -mpopcntd
17169@itemx -mno-popcntd
17170@itemx -mfprnd
17171@itemx -mno-fprnd
17172@need 800
17173@itemx -mcmpb
17174@itemx -mno-cmpb
17175@itemx -mmfpgpr
17176@itemx -mno-mfpgpr
17177@itemx -mhard-dfp
17178@itemx -mno-hard-dfp
17179@opindex mpowerpc-gpopt
17180@opindex mno-powerpc-gpopt
17181@opindex mpowerpc-gfxopt
17182@opindex mno-powerpc-gfxopt
17183@opindex mpowerpc64
17184@opindex mno-powerpc64
17185@opindex mmfcrf
17186@opindex mno-mfcrf
17187@opindex mpopcntb
17188@opindex mno-popcntb
17189@opindex mpopcntd
17190@opindex mno-popcntd
17191@opindex mfprnd
17192@opindex mno-fprnd
17193@opindex mcmpb
17194@opindex mno-cmpb
17195@opindex mmfpgpr
17196@opindex mno-mfpgpr
17197@opindex mhard-dfp
17198@opindex mno-hard-dfp
17199You use these options to specify which instructions are available on the
17200processor you are using.  The default value of these options is
17201determined when configuring GCC@.  Specifying the
17202@option{-mcpu=@var{cpu_type}} overrides the specification of these
17203options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
17204rather than the options listed above.
17205
17206Specifying @option{-mpowerpc-gpopt} allows
17207GCC to use the optional PowerPC architecture instructions in the
17208General Purpose group, including floating-point square root.  Specifying
17209@option{-mpowerpc-gfxopt} allows GCC to
17210use the optional PowerPC architecture instructions in the Graphics
17211group, including floating-point select.
17212
17213The @option{-mmfcrf} option allows GCC to generate the move from
17214condition register field instruction implemented on the POWER4
17215processor and other processors that support the PowerPC V2.01
17216architecture.
17217The @option{-mpopcntb} option allows GCC to generate the popcount and
17218double-precision FP reciprocal estimate instruction implemented on the
17219POWER5 processor and other processors that support the PowerPC V2.02
17220architecture.
17221The @option{-mpopcntd} option allows GCC to generate the popcount
17222instruction implemented on the POWER7 processor and other processors
17223that support the PowerPC V2.06 architecture.
17224The @option{-mfprnd} option allows GCC to generate the FP round to
17225integer instructions implemented on the POWER5+ processor and other
17226processors that support the PowerPC V2.03 architecture.
17227The @option{-mcmpb} option allows GCC to generate the compare bytes
17228instruction implemented on the POWER6 processor and other processors
17229that support the PowerPC V2.05 architecture.
17230The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
17231general-purpose register instructions implemented on the POWER6X
17232processor and other processors that support the extended PowerPC V2.05
17233architecture.
17234The @option{-mhard-dfp} option allows GCC to generate the decimal
17235floating-point instructions implemented on some POWER processors.
17236
17237The @option{-mpowerpc64} option allows GCC to generate the additional
1723864-bit instructions that are found in the full PowerPC64 architecture
17239and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
17240@option{-mno-powerpc64}.
17241
17242@item -mcpu=@var{cpu_type}
17243@opindex mcpu
17244Set architecture type, register usage, and
17245instruction scheduling parameters for machine type @var{cpu_type}.
17246Supported values for @var{cpu_type} are @samp{401}, @samp{403},
17247@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
17248@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
17249@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
17250@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
17251@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
17252@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
17253@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
17254@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
17255@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, @samp{powerpc},
17256@samp{powerpc64}, @samp{powerpc64le}, and @samp{rs64}.
17257
17258@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
17259@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
17260endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
17261architecture machine types, with an appropriate, generic processor
17262model assumed for scheduling purposes.
17263
17264The other options specify a specific processor.  Code generated under
17265those options runs best on that processor, and may not run at all on
17266others.
17267
17268The @option{-mcpu} options automatically enable or disable the
17269following options:
17270
17271@gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
17272-mpopcntb -mpopcntd  -mpowerpc64 @gol
17273-mpowerpc-gpopt  -mpowerpc-gfxopt  -msingle-float -mdouble-float @gol
17274-msimple-fpu -mstring  -mmulhw  -mdlmzb  -mmfpgpr -mvsx @gol
17275-mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol
17276-mquad-memory -mquad-memory-atomic}
17277
17278The particular options set for any particular CPU varies between
17279compiler versions, depending on what setting seems to produce optimal
17280code for that CPU; it doesn't necessarily reflect the actual hardware's
17281capabilities.  If you wish to set an individual option to a particular
17282value, you may specify it after the @option{-mcpu} option, like
17283@option{-mcpu=970 -mno-altivec}.
17284
17285On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
17286not enabled or disabled by the @option{-mcpu} option at present because
17287AIX does not have full support for these options.  You may still
17288enable or disable them individually if you're sure it'll work in your
17289environment.
17290
17291@item -mtune=@var{cpu_type}
17292@opindex mtune
17293Set the instruction scheduling parameters for machine type
17294@var{cpu_type}, but do not set the architecture type or register usage,
17295as @option{-mcpu=@var{cpu_type}} does.  The same
17296values for @var{cpu_type} are used for @option{-mtune} as for
17297@option{-mcpu}.  If both are specified, the code generated uses the
17298architecture and registers set by @option{-mcpu}, but the
17299scheduling parameters set by @option{-mtune}.
17300
17301@item -mcmodel=small
17302@opindex mcmodel=small
17303Generate PowerPC64 code for the small model: The TOC is limited to
1730464k.
17305
17306@item -mcmodel=medium
17307@opindex mcmodel=medium
17308Generate PowerPC64 code for the medium model: The TOC and other static
17309data may be up to a total of 4G in size.
17310
17311@item -mcmodel=large
17312@opindex mcmodel=large
17313Generate PowerPC64 code for the large model: The TOC may be up to 4G
17314in size.  Other data and code is only limited by the 64-bit address
17315space.
17316
17317@item -maltivec
17318@itemx -mno-altivec
17319@opindex maltivec
17320@opindex mno-altivec
17321Generate code that uses (does not use) AltiVec instructions, and also
17322enable the use of built-in functions that allow more direct access to
17323the AltiVec instruction set.  You may also need to set
17324@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
17325enhancements.
17326
17327When @option{-maltivec} is used, rather than @option{-maltivec=le} or
17328@option{-maltivec=be}, the element order for Altivec intrinsics such
17329as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} will
17330match array element order corresponding to the endianness of the
17331target.  That is, element zero identifies the leftmost element in a
17332vector register when targeting a big-endian platform, and identifies
17333the rightmost element in a vector register when targeting a
17334little-endian platform.
17335
17336@item -maltivec=be
17337@opindex maltivec=be
17338Generate Altivec instructions using big-endian element order,
17339regardless of whether the target is big- or little-endian.  This is
17340the default when targeting a big-endian platform.
17341
17342The element order is used to interpret element numbers in Altivec
17343intrinsics such as @code{vec_splat}, @code{vec_extract}, and
17344@code{vec_insert}.  By default, these will match array element order
17345corresponding to the endianness for the target.
17346
17347@item -maltivec=le
17348@opindex maltivec=le
17349Generate Altivec instructions using little-endian element order,
17350regardless of whether the target is big- or little-endian.  This is
17351the default when targeting a little-endian platform.  This option is
17352currently ignored when targeting a big-endian platform.
17353
17354The element order is used to interpret element numbers in Altivec
17355intrinsics such as @code{vec_splat}, @code{vec_extract}, and
17356@code{vec_insert}.  By default, these will match array element order
17357corresponding to the endianness for the target.
17358
17359@item -mvrsave
17360@itemx -mno-vrsave
17361@opindex mvrsave
17362@opindex mno-vrsave
17363Generate VRSAVE instructions when generating AltiVec code.
17364
17365@item -mgen-cell-microcode
17366@opindex mgen-cell-microcode
17367Generate Cell microcode instructions.
17368
17369@item -mwarn-cell-microcode
17370@opindex mwarn-cell-microcode
17371Warn when a Cell microcode instruction is emitted.  An example
17372of a Cell microcode instruction is a variable shift.
17373
17374@item -msecure-plt
17375@opindex msecure-plt
17376Generate code that allows @command{ld} and @command{ld.so}
17377to build executables and shared
17378libraries with non-executable @code{.plt} and @code{.got} sections.
17379This is a PowerPC
1738032-bit SYSV ABI option.
17381
17382@item -mbss-plt
17383@opindex mbss-plt
17384Generate code that uses a BSS @code{.plt} section that @command{ld.so}
17385fills in, and
17386requires @code{.plt} and @code{.got}
17387sections that are both writable and executable.
17388This is a PowerPC 32-bit SYSV ABI option.
17389
17390@item -misel
17391@itemx -mno-isel
17392@opindex misel
17393@opindex mno-isel
17394This switch enables or disables the generation of ISEL instructions.
17395
17396@item -misel=@var{yes/no}
17397This switch has been deprecated.  Use @option{-misel} and
17398@option{-mno-isel} instead.
17399
17400@item -mspe
17401@itemx -mno-spe
17402@opindex mspe
17403@opindex mno-spe
17404This switch enables or disables the generation of SPE simd
17405instructions.
17406
17407@item -mpaired
17408@itemx -mno-paired
17409@opindex mpaired
17410@opindex mno-paired
17411This switch enables or disables the generation of PAIRED simd
17412instructions.
17413
17414@item -mspe=@var{yes/no}
17415This option has been deprecated.  Use @option{-mspe} and
17416@option{-mno-spe} instead.
17417
17418@item -mvsx
17419@itemx -mno-vsx
17420@opindex mvsx
17421@opindex mno-vsx
17422Generate code that uses (does not use) vector/scalar (VSX)
17423instructions, and also enable the use of built-in functions that allow
17424more direct access to the VSX instruction set.
17425
17426@item -mcrypto
17427@itemx -mno-crypto
17428@opindex mcrypto
17429@opindex mno-crypto
17430Enable the use (disable) of the built-in functions that allow direct
17431access to the cryptographic instructions that were added in version
174322.07 of the PowerPC ISA.
17433
17434@item -mdirect-move
17435@itemx -mno-direct-move
17436@opindex mdirect-move
17437@opindex mno-direct-move
17438Generate code that uses (does not use) the instructions to move data
17439between the general purpose registers and the vector/scalar (VSX)
17440registers that were added in version 2.07 of the PowerPC ISA.
17441
17442@item -mpower8-fusion
17443@itemx -mno-power8-fusion
17444@opindex mpower8-fusion
17445@opindex mno-power8-fusion
17446Generate code that keeps (does not keeps) some integer operations
17447adjacent so that the instructions can be fused together on power8 and
17448later processors.
17449
17450@item -mpower8-vector
17451@itemx -mno-power8-vector
17452@opindex mpower8-vector
17453@opindex mno-power8-vector
17454Generate code that uses (does not use) the vector and scalar
17455instructions that were added in version 2.07 of the PowerPC ISA.  Also
17456enable the use of built-in functions that allow more direct access to
17457the vector instructions.
17458
17459@item -mquad-memory
17460@itemx -mno-quad-memory
17461@opindex mquad-memory
17462@opindex mno-quad-memory
17463Generate code that uses (does not use) the non-atomic quad word memory
17464instructions.  The @option{-mquad-memory} option requires use of
1746564-bit mode.
17466
17467@item -mquad-memory-atomic
17468@itemx -mno-quad-memory-atomic
17469@opindex mquad-memory-atomic
17470@opindex mno-quad-memory-atomic
17471Generate code that uses (does not use) the atomic quad word memory
17472instructions.  The @option{-mquad-memory-atomic} option requires use of
1747364-bit mode.
17474
17475@item -mfloat-gprs=@var{yes/single/double/no}
17476@itemx -mfloat-gprs
17477@opindex mfloat-gprs
17478This switch enables or disables the generation of floating-point
17479operations on the general-purpose registers for architectures that
17480support it.
17481
17482The argument @var{yes} or @var{single} enables the use of
17483single-precision floating-point operations.
17484
17485The argument @var{double} enables the use of single and
17486double-precision floating-point operations.
17487
17488The argument @var{no} disables floating-point operations on the
17489general-purpose registers.
17490
17491This option is currently only available on the MPC854x.
17492
17493@item -m32
17494@itemx -m64
17495@opindex m32
17496@opindex m64
17497Generate code for 32-bit or 64-bit environments of Darwin and SVR4
17498targets (including GNU/Linux).  The 32-bit environment sets int, long
17499and pointer to 32 bits and generates code that runs on any PowerPC
17500variant.  The 64-bit environment sets int to 32 bits and long and
17501pointer to 64 bits, and generates code for PowerPC64, as for
17502@option{-mpowerpc64}.
17503
17504@item -mfull-toc
17505@itemx -mno-fp-in-toc
17506@itemx -mno-sum-in-toc
17507@itemx -mminimal-toc
17508@opindex mfull-toc
17509@opindex mno-fp-in-toc
17510@opindex mno-sum-in-toc
17511@opindex mminimal-toc
17512Modify generation of the TOC (Table Of Contents), which is created for
17513every executable file.  The @option{-mfull-toc} option is selected by
17514default.  In that case, GCC allocates at least one TOC entry for
17515each unique non-automatic variable reference in your program.  GCC
17516also places floating-point constants in the TOC@.  However, only
1751716,384 entries are available in the TOC@.
17518
17519If you receive a linker error message that saying you have overflowed
17520the available TOC space, you can reduce the amount of TOC space used
17521with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
17522@option{-mno-fp-in-toc} prevents GCC from putting floating-point
17523constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
17524generate code to calculate the sum of an address and a constant at
17525run time instead of putting that sum into the TOC@.  You may specify one
17526or both of these options.  Each causes GCC to produce very slightly
17527slower and larger code at the expense of conserving TOC space.
17528
17529If you still run out of space in the TOC even when you specify both of
17530these options, specify @option{-mminimal-toc} instead.  This option causes
17531GCC to make only one TOC entry for every file.  When you specify this
17532option, GCC produces code that is slower and larger but which
17533uses extremely little TOC space.  You may wish to use this option
17534only on files that contain less frequently-executed code.
17535
17536@item -maix64
17537@itemx -maix32
17538@opindex maix64
17539@opindex maix32
17540Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
17541@code{long} type, and the infrastructure needed to support them.
17542Specifying @option{-maix64} implies @option{-mpowerpc64},
17543while @option{-maix32} disables the 64-bit ABI and
17544implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
17545
17546@item -mxl-compat
17547@itemx -mno-xl-compat
17548@opindex mxl-compat
17549@opindex mno-xl-compat
17550Produce code that conforms more closely to IBM XL compiler semantics
17551when using AIX-compatible ABI@.  Pass floating-point arguments to
17552prototyped functions beyond the register save area (RSA) on the stack
17553in addition to argument FPRs.  Do not assume that most significant
17554double in 128-bit long double value is properly rounded when comparing
17555values and converting to double.  Use XL symbol names for long double
17556support routines.
17557
17558The AIX calling convention was extended but not initially documented to
17559handle an obscure K&R C case of calling a function that takes the
17560address of its arguments with fewer arguments than declared.  IBM XL
17561compilers access floating-point arguments that do not fit in the
17562RSA from the stack when a subroutine is compiled without
17563optimization.  Because always storing floating-point arguments on the
17564stack is inefficient and rarely needed, this option is not enabled by
17565default and only is necessary when calling subroutines compiled by IBM
17566XL compilers without optimization.
17567
17568@item -mpe
17569@opindex mpe
17570Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
17571application written to use message passing with special startup code to
17572enable the application to run.  The system must have PE installed in the
17573standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
17574must be overridden with the @option{-specs=} option to specify the
17575appropriate directory location.  The Parallel Environment does not
17576support threads, so the @option{-mpe} option and the @option{-pthread}
17577option are incompatible.
17578
17579@item -malign-natural
17580@itemx -malign-power
17581@opindex malign-natural
17582@opindex malign-power
17583On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
17584@option{-malign-natural} overrides the ABI-defined alignment of larger
17585types, such as floating-point doubles, on their natural size-based boundary.
17586The option @option{-malign-power} instructs GCC to follow the ABI-specified
17587alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
17588
17589On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
17590is not supported.
17591
17592@item -msoft-float
17593@itemx -mhard-float
17594@opindex msoft-float
17595@opindex mhard-float
17596Generate code that does not use (uses) the floating-point register set.
17597Software floating-point emulation is provided if you use the
17598@option{-msoft-float} option, and pass the option to GCC when linking.
17599
17600@item -msingle-float
17601@itemx -mdouble-float
17602@opindex msingle-float
17603@opindex mdouble-float
17604Generate code for single- or double-precision floating-point operations.
17605@option{-mdouble-float} implies @option{-msingle-float}.
17606
17607@item -msimple-fpu
17608@opindex msimple-fpu
17609Do not generate @code{sqrt} and @code{div} instructions for hardware
17610floating-point unit.
17611
17612@item -mfpu=@var{name}
17613@opindex mfpu
17614Specify type of floating-point unit.  Valid values for @var{name} are
17615@samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
17616@samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
17617@samp{sp_full} (equivalent to @option{-msingle-float}),
17618and @samp{dp_full} (equivalent to @option{-mdouble-float}).
17619
17620@item -mxilinx-fpu
17621@opindex mxilinx-fpu
17622Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
17623
17624@item -mmultiple
17625@itemx -mno-multiple
17626@opindex mmultiple
17627@opindex mno-multiple
17628Generate code that uses (does not use) the load multiple word
17629instructions and the store multiple word instructions.  These
17630instructions are generated by default on POWER systems, and not
17631generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
17632PowerPC systems, since those instructions do not work when the
17633processor is in little-endian mode.  The exceptions are PPC740 and
17634PPC750 which permit these instructions in little-endian mode.
17635
17636@item -mstring
17637@itemx -mno-string
17638@opindex mstring
17639@opindex mno-string
17640Generate code that uses (does not use) the load string instructions
17641and the store string word instructions to save multiple registers and
17642do small block moves.  These instructions are generated by default on
17643POWER systems, and not generated on PowerPC systems.  Do not use
17644@option{-mstring} on little-endian PowerPC systems, since those
17645instructions do not work when the processor is in little-endian mode.
17646The exceptions are PPC740 and PPC750 which permit these instructions
17647in little-endian mode.
17648
17649@item -mupdate
17650@itemx -mno-update
17651@opindex mupdate
17652@opindex mno-update
17653Generate code that uses (does not use) the load or store instructions
17654that update the base register to the address of the calculated memory
17655location.  These instructions are generated by default.  If you use
17656@option{-mno-update}, there is a small window between the time that the
17657stack pointer is updated and the address of the previous frame is
17658stored, which means code that walks the stack frame across interrupts or
17659signals may get corrupted data.
17660
17661@item -mavoid-indexed-addresses
17662@itemx -mno-avoid-indexed-addresses
17663@opindex mavoid-indexed-addresses
17664@opindex mno-avoid-indexed-addresses
17665Generate code that tries to avoid (not avoid) the use of indexed load
17666or store instructions. These instructions can incur a performance
17667penalty on Power6 processors in certain situations, such as when
17668stepping through large arrays that cross a 16M boundary.  This option
17669is enabled by default when targeting Power6 and disabled otherwise.
17670
17671@item -mfused-madd
17672@itemx -mno-fused-madd
17673@opindex mfused-madd
17674@opindex mno-fused-madd
17675Generate code that uses (does not use) the floating-point multiply and
17676accumulate instructions.  These instructions are generated by default
17677if hardware floating point is used.  The machine-dependent
17678@option{-mfused-madd} option is now mapped to the machine-independent
17679@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
17680mapped to @option{-ffp-contract=off}.
17681
17682@item -mmulhw
17683@itemx -mno-mulhw
17684@opindex mmulhw
17685@opindex mno-mulhw
17686Generate code that uses (does not use) the half-word multiply and
17687multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
17688These instructions are generated by default when targeting those
17689processors.
17690
17691@item -mdlmzb
17692@itemx -mno-dlmzb
17693@opindex mdlmzb
17694@opindex mno-dlmzb
17695Generate code that uses (does not use) the string-search @samp{dlmzb}
17696instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
17697generated by default when targeting those processors.
17698
17699@item -mno-bit-align
17700@itemx -mbit-align
17701@opindex mno-bit-align
17702@opindex mbit-align
17703On System V.4 and embedded PowerPC systems do not (do) force structures
17704and unions that contain bit-fields to be aligned to the base type of the
17705bit-field.
17706
17707For example, by default a structure containing nothing but 8
17708@code{unsigned} bit-fields of length 1 is aligned to a 4-byte
17709boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
17710the structure is aligned to a 1-byte boundary and is 1 byte in
17711size.
17712
17713@item -mno-strict-align
17714@itemx -mstrict-align
17715@opindex mno-strict-align
17716@opindex mstrict-align
17717On System V.4 and embedded PowerPC systems do not (do) assume that
17718unaligned memory references are handled by the system.
17719
17720@item -mrelocatable
17721@itemx -mno-relocatable
17722@opindex mrelocatable
17723@opindex mno-relocatable
17724Generate code that allows (does not allow) a static executable to be
17725relocated to a different address at run time.  A simple embedded
17726PowerPC system loader should relocate the entire contents of
17727@code{.got2} and 4-byte locations listed in the @code{.fixup} section,
17728a table of 32-bit addresses generated by this option.  For this to
17729work, all objects linked together must be compiled with
17730@option{-mrelocatable} or @option{-mrelocatable-lib}.
17731@option{-mrelocatable} code aligns the stack to an 8-byte boundary.
17732
17733@item -mrelocatable-lib
17734@itemx -mno-relocatable-lib
17735@opindex mrelocatable-lib
17736@opindex mno-relocatable-lib
17737Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
17738@code{.fixup} section to allow static executables to be relocated at
17739run time, but @option{-mrelocatable-lib} does not use the smaller stack
17740alignment of @option{-mrelocatable}.  Objects compiled with
17741@option{-mrelocatable-lib} may be linked with objects compiled with
17742any combination of the @option{-mrelocatable} options.
17743
17744@item -mno-toc
17745@itemx -mtoc
17746@opindex mno-toc
17747@opindex mtoc
17748On System V.4 and embedded PowerPC systems do not (do) assume that
17749register 2 contains a pointer to a global area pointing to the addresses
17750used in the program.
17751
17752@item -mlittle
17753@itemx -mlittle-endian
17754@opindex mlittle
17755@opindex mlittle-endian
17756On System V.4 and embedded PowerPC systems compile code for the
17757processor in little-endian mode.  The @option{-mlittle-endian} option is
17758the same as @option{-mlittle}.
17759
17760@item -mbig
17761@itemx -mbig-endian
17762@opindex mbig
17763@opindex mbig-endian
17764On System V.4 and embedded PowerPC systems compile code for the
17765processor in big-endian mode.  The @option{-mbig-endian} option is
17766the same as @option{-mbig}.
17767
17768@item -mdynamic-no-pic
17769@opindex mdynamic-no-pic
17770On Darwin and Mac OS X systems, compile code so that it is not
17771relocatable, but that its external references are relocatable.  The
17772resulting code is suitable for applications, but not shared
17773libraries.
17774
17775@item -msingle-pic-base
17776@opindex msingle-pic-base
17777Treat the register used for PIC addressing as read-only, rather than
17778loading it in the prologue for each function.  The runtime system is
17779responsible for initializing this register with an appropriate value
17780before execution begins.
17781
17782@item -mprioritize-restricted-insns=@var{priority}
17783@opindex mprioritize-restricted-insns
17784This option controls the priority that is assigned to
17785dispatch-slot restricted instructions during the second scheduling
17786pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
17787or @samp{2} to assign no, highest, or second-highest (respectively)
17788priority to dispatch-slot restricted
17789instructions.
17790
17791@item -msched-costly-dep=@var{dependence_type}
17792@opindex msched-costly-dep
17793This option controls which dependences are considered costly
17794by the target during instruction scheduling.  The argument
17795@var{dependence_type} takes one of the following values:
17796
17797@table @asis
17798@item @samp{no}
17799No dependence is costly.
17800
17801@item @samp{all}
17802All dependences are costly.
17803
17804@item @samp{true_store_to_load}
17805A true dependence from store to load is costly.
17806
17807@item @samp{store_to_load}
17808Any dependence from store to load is costly.
17809
17810@item @var{number}
17811Any dependence for which the latency is greater than or equal to
17812@var{number} is costly.
17813@end table
17814
17815@item -minsert-sched-nops=@var{scheme}
17816@opindex minsert-sched-nops
17817This option controls which NOP insertion scheme is used during
17818the second scheduling pass.  The argument @var{scheme} takes one of the
17819following values:
17820
17821@table @asis
17822@item @samp{no}
17823Don't insert NOPs.
17824
17825@item @samp{pad}
17826Pad with NOPs any dispatch group that has vacant issue slots,
17827according to the scheduler's grouping.
17828
17829@item @samp{regroup_exact}
17830Insert NOPs to force costly dependent insns into
17831separate groups.  Insert exactly as many NOPs as needed to force an insn
17832to a new group, according to the estimated processor grouping.
17833
17834@item @var{number}
17835Insert NOPs to force costly dependent insns into
17836separate groups.  Insert @var{number} NOPs to force an insn to a new group.
17837@end table
17838
17839@item -mcall-sysv
17840@opindex mcall-sysv
17841On System V.4 and embedded PowerPC systems compile code using calling
17842conventions that adhere to the March 1995 draft of the System V
17843Application Binary Interface, PowerPC processor supplement.  This is the
17844default unless you configured GCC using @samp{powerpc-*-eabiaix}.
17845
17846@item -mcall-sysv-eabi
17847@itemx -mcall-eabi
17848@opindex mcall-sysv-eabi
17849@opindex mcall-eabi
17850Specify both @option{-mcall-sysv} and @option{-meabi} options.
17851
17852@item -mcall-sysv-noeabi
17853@opindex mcall-sysv-noeabi
17854Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
17855
17856@item -mcall-aixdesc
17857@opindex m
17858On System V.4 and embedded PowerPC systems compile code for the AIX
17859operating system.
17860
17861@item -mcall-linux
17862@opindex mcall-linux
17863On System V.4 and embedded PowerPC systems compile code for the
17864Linux-based GNU system.
17865
17866@item -mcall-freebsd
17867@opindex mcall-freebsd
17868On System V.4 and embedded PowerPC systems compile code for the
17869FreeBSD operating system.
17870
17871@item -mcall-netbsd
17872@opindex mcall-netbsd
17873On System V.4 and embedded PowerPC systems compile code for the
17874NetBSD operating system.
17875
17876@item -mcall-openbsd
17877@opindex mcall-netbsd
17878On System V.4 and embedded PowerPC systems compile code for the
17879OpenBSD operating system.
17880
17881@item -maix-struct-return
17882@opindex maix-struct-return
17883Return all structures in memory (as specified by the AIX ABI)@.
17884
17885@item -msvr4-struct-return
17886@opindex msvr4-struct-return
17887Return structures smaller than 8 bytes in registers (as specified by the
17888SVR4 ABI)@.
17889
17890@item -mabi=@var{abi-type}
17891@opindex mabi
17892Extend the current ABI with a particular extension, or remove such extension.
17893Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
17894@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble},
17895@var{elfv1}, @var{elfv2}@.
17896
17897@item -mabi=spe
17898@opindex mabi=spe
17899Extend the current ABI with SPE ABI extensions.  This does not change
17900the default ABI, instead it adds the SPE ABI extensions to the current
17901ABI@.
17902
17903@item -mabi=no-spe
17904@opindex mabi=no-spe
17905Disable Book-E SPE ABI extensions for the current ABI@.
17906
17907@item -mabi=ibmlongdouble
17908@opindex mabi=ibmlongdouble
17909Change the current ABI to use IBM extended-precision long double.
17910This is a PowerPC 32-bit SYSV ABI option.
17911
17912@item -mabi=ieeelongdouble
17913@opindex mabi=ieeelongdouble
17914Change the current ABI to use IEEE extended-precision long double.
17915This is a PowerPC 32-bit Linux ABI option.
17916
17917@item -mabi=elfv1
17918@opindex mabi=elfv1
17919Change the current ABI to use the ELFv1 ABI.
17920This is the default ABI for big-endian PowerPC 64-bit Linux.
17921Overriding the default ABI requires special system support and is
17922likely to fail in spectacular ways.
17923
17924@item -mabi=elfv2
17925@opindex mabi=elfv2
17926Change the current ABI to use the ELFv2 ABI.
17927This is the default ABI for little-endian PowerPC 64-bit Linux.
17928Overriding the default ABI requires special system support and is
17929likely to fail in spectacular ways.
17930
17931@item -mprototype
17932@itemx -mno-prototype
17933@opindex mprototype
17934@opindex mno-prototype
17935On System V.4 and embedded PowerPC systems assume that all calls to
17936variable argument functions are properly prototyped.  Otherwise, the
17937compiler must insert an instruction before every non-prototyped call to
17938set or clear bit 6 of the condition code register (@var{CR}) to
17939indicate whether floating-point values are passed in the floating-point
17940registers in case the function takes variable arguments.  With
17941@option{-mprototype}, only calls to prototyped variable argument functions
17942set or clear the bit.
17943
17944@item -msim
17945@opindex msim
17946On embedded PowerPC systems, assume that the startup module is called
17947@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
17948@file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
17949configurations.
17950
17951@item -mmvme
17952@opindex mmvme
17953On embedded PowerPC systems, assume that the startup module is called
17954@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
17955@file{libc.a}.
17956
17957@item -mads
17958@opindex mads
17959On embedded PowerPC systems, assume that the startup module is called
17960@file{crt0.o} and the standard C libraries are @file{libads.a} and
17961@file{libc.a}.
17962
17963@item -myellowknife
17964@opindex myellowknife
17965On embedded PowerPC systems, assume that the startup module is called
17966@file{crt0.o} and the standard C libraries are @file{libyk.a} and
17967@file{libc.a}.
17968
17969@item -mvxworks
17970@opindex mvxworks
17971On System V.4 and embedded PowerPC systems, specify that you are
17972compiling for a VxWorks system.
17973
17974@item -memb
17975@opindex memb
17976On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
17977header to indicate that @samp{eabi} extended relocations are used.
17978
17979@item -meabi
17980@itemx -mno-eabi
17981@opindex meabi
17982@opindex mno-eabi
17983On System V.4 and embedded PowerPC systems do (do not) adhere to the
17984Embedded Applications Binary Interface (EABI), which is a set of
17985modifications to the System V.4 specifications.  Selecting @option{-meabi}
17986means that the stack is aligned to an 8-byte boundary, a function
17987@code{__eabi} is called from @code{main} to set up the EABI
17988environment, and the @option{-msdata} option can use both @code{r2} and
17989@code{r13} to point to two separate small data areas.  Selecting
17990@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
17991no EABI initialization function is called from @code{main}, and the
17992@option{-msdata} option only uses @code{r13} to point to a single
17993small data area.  The @option{-meabi} option is on by default if you
17994configured GCC using one of the @samp{powerpc*-*-eabi*} options.
17995
17996@item -msdata=eabi
17997@opindex msdata=eabi
17998On System V.4 and embedded PowerPC systems, put small initialized
17999@code{const} global and static data in the @samp{.sdata2} section, which
18000is pointed to by register @code{r2}.  Put small initialized
18001non-@code{const} global and static data in the @samp{.sdata} section,
18002which is pointed to by register @code{r13}.  Put small uninitialized
18003global and static data in the @samp{.sbss} section, which is adjacent to
18004the @samp{.sdata} section.  The @option{-msdata=eabi} option is
18005incompatible with the @option{-mrelocatable} option.  The
18006@option{-msdata=eabi} option also sets the @option{-memb} option.
18007
18008@item -msdata=sysv
18009@opindex msdata=sysv
18010On System V.4 and embedded PowerPC systems, put small global and static
18011data in the @samp{.sdata} section, which is pointed to by register
18012@code{r13}.  Put small uninitialized global and static data in the
18013@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
18014The @option{-msdata=sysv} option is incompatible with the
18015@option{-mrelocatable} option.
18016
18017@item -msdata=default
18018@itemx -msdata
18019@opindex msdata=default
18020@opindex msdata
18021On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
18022compile code the same as @option{-msdata=eabi}, otherwise compile code the
18023same as @option{-msdata=sysv}.
18024
18025@item -msdata=data
18026@opindex msdata=data
18027On System V.4 and embedded PowerPC systems, put small global
18028data in the @samp{.sdata} section.  Put small uninitialized global
18029data in the @samp{.sbss} section.  Do not use register @code{r13}
18030to address small data however.  This is the default behavior unless
18031other @option{-msdata} options are used.
18032
18033@item -msdata=none
18034@itemx -mno-sdata
18035@opindex msdata=none
18036@opindex mno-sdata
18037On embedded PowerPC systems, put all initialized global and static data
18038in the @samp{.data} section, and all uninitialized data in the
18039@samp{.bss} section.
18040
18041@item -mblock-move-inline-limit=@var{num}
18042@opindex mblock-move-inline-limit
18043Inline all block moves (such as calls to @code{memcpy} or structure
18044copies) less than or equal to @var{num} bytes.  The minimum value for
18045@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
18046targets.  The default value is target-specific.
18047
18048@item -G @var{num}
18049@opindex G
18050@cindex smaller data references (PowerPC)
18051@cindex .sdata/.sdata2 references (PowerPC)
18052On embedded PowerPC systems, put global and static items less than or
18053equal to @var{num} bytes into the small data or BSS sections instead of
18054the normal data or BSS section.  By default, @var{num} is 8.  The
18055@option{-G @var{num}} switch is also passed to the linker.
18056All modules should be compiled with the same @option{-G @var{num}} value.
18057
18058@item -mregnames
18059@itemx -mno-regnames
18060@opindex mregnames
18061@opindex mno-regnames
18062On System V.4 and embedded PowerPC systems do (do not) emit register
18063names in the assembly language output using symbolic forms.
18064
18065@item -mlongcall
18066@itemx -mno-longcall
18067@opindex mlongcall
18068@opindex mno-longcall
18069By default assume that all calls are far away so that a longer and more
18070expensive calling sequence is required.  This is required for calls
18071farther than 32 megabytes (33,554,432 bytes) from the current location.
18072A short call is generated if the compiler knows
18073the call cannot be that far away.  This setting can be overridden by
18074the @code{shortcall} function attribute, or by @code{#pragma
18075longcall(0)}.
18076
18077Some linkers are capable of detecting out-of-range calls and generating
18078glue code on the fly.  On these systems, long calls are unnecessary and
18079generate slower code.  As of this writing, the AIX linker can do this,
18080as can the GNU linker for PowerPC/64.  It is planned to add this feature
18081to the GNU linker for 32-bit PowerPC systems as well.
18082
18083On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
18084callee, L42}, plus a @dfn{branch island} (glue code).  The two target
18085addresses represent the callee and the branch island.  The
18086Darwin/PPC linker prefers the first address and generates a @code{bl
18087callee} if the PPC @code{bl} instruction reaches the callee directly;
18088otherwise, the linker generates @code{bl L42} to call the branch
18089island.  The branch island is appended to the body of the
18090calling function; it computes the full 32-bit address of the callee
18091and jumps to it.
18092
18093On Mach-O (Darwin) systems, this option directs the compiler emit to
18094the glue for every direct call, and the Darwin linker decides whether
18095to use or discard it.
18096
18097In the future, GCC may ignore all longcall specifications
18098when the linker is known to generate glue.
18099
18100@item -mtls-markers
18101@itemx -mno-tls-markers
18102@opindex mtls-markers
18103@opindex mno-tls-markers
18104Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
18105specifying the function argument.  The relocation allows the linker to
18106reliably associate function call with argument setup instructions for
18107TLS optimization, which in turn allows GCC to better schedule the
18108sequence.
18109
18110@item -pthread
18111@opindex pthread
18112Adds support for multithreading with the @dfn{pthreads} library.
18113This option sets flags for both the preprocessor and linker.
18114
18115@item -mrecip
18116@itemx -mno-recip
18117@opindex mrecip
18118This option enables use of the reciprocal estimate and
18119reciprocal square root estimate instructions with additional
18120Newton-Raphson steps to increase precision instead of doing a divide or
18121square root and divide for floating-point arguments.  You should use
18122the @option{-ffast-math} option when using @option{-mrecip} (or at
18123least @option{-funsafe-math-optimizations},
18124@option{-finite-math-only}, @option{-freciprocal-math} and
18125@option{-fno-trapping-math}).  Note that while the throughput of the
18126sequence is generally higher than the throughput of the non-reciprocal
18127instruction, the precision of the sequence can be decreased by up to 2
18128ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
18129roots.
18130
18131@item -mrecip=@var{opt}
18132@opindex mrecip=opt
18133This option controls which reciprocal estimate instructions
18134may be used.  @var{opt} is a comma-separated list of options, which may
18135be preceded by a @code{!} to invert the option:
18136@code{all}: enable all estimate instructions,
18137@code{default}: enable the default instructions, equivalent to @option{-mrecip},
18138@code{none}: disable all estimate instructions, equivalent to @option{-mno-recip};
18139@code{div}: enable the reciprocal approximation instructions for both single and double precision;
18140@code{divf}: enable the single-precision reciprocal approximation instructions;
18141@code{divd}: enable the double-precision reciprocal approximation instructions;
18142@code{rsqrt}: enable the reciprocal square root approximation instructions for both single and double precision;
18143@code{rsqrtf}: enable the single-precision reciprocal square root approximation instructions;
18144@code{rsqrtd}: enable the double-precision reciprocal square root approximation instructions;
18145
18146So, for example, @option{-mrecip=all,!rsqrtd} enables
18147all of the reciprocal estimate instructions, except for the
18148@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
18149which handle the double-precision reciprocal square root calculations.
18150
18151@item -mrecip-precision
18152@itemx -mno-recip-precision
18153@opindex mrecip-precision
18154Assume (do not assume) that the reciprocal estimate instructions
18155provide higher-precision estimates than is mandated by the PowerPC
18156ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
18157@option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
18158The double-precision square root estimate instructions are not generated by
18159default on low-precision machines, since they do not provide an
18160estimate that converges after three steps.
18161
18162@item -mveclibabi=@var{type}
18163@opindex mveclibabi
18164Specifies the ABI type to use for vectorizing intrinsics using an
18165external library.  The only type supported at present is @code{mass},
18166which specifies to use IBM's Mathematical Acceleration Subsystem
18167(MASS) libraries for vectorizing intrinsics using external libraries.
18168GCC currently emits calls to @code{acosd2}, @code{acosf4},
18169@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
18170@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
18171@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
18172@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
18173@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
18174@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
18175@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
18176@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
18177@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
18178@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
18179@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
18180@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
18181@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
18182for power7.  Both @option{-ftree-vectorize} and
18183@option{-funsafe-math-optimizations} must also be enabled.  The MASS
18184libraries must be specified at link time.
18185
18186@item -mfriz
18187@itemx -mno-friz
18188@opindex mfriz
18189Generate (do not generate) the @code{friz} instruction when the
18190@option{-funsafe-math-optimizations} option is used to optimize
18191rounding of floating-point values to 64-bit integer and back to floating
18192point.  The @code{friz} instruction does not return the same value if
18193the floating-point number is too large to fit in an integer.
18194
18195@item -mpointers-to-nested-functions
18196@itemx -mno-pointers-to-nested-functions
18197@opindex mpointers-to-nested-functions
18198Generate (do not generate) code to load up the static chain register
18199(@var{r11}) when calling through a pointer on AIX and 64-bit Linux
18200systems where a function pointer points to a 3-word descriptor giving
18201the function address, TOC value to be loaded in register @var{r2}, and
18202static chain value to be loaded in register @var{r11}.  The
18203@option{-mpointers-to-nested-functions} is on by default.  You cannot
18204call through pointers to nested functions or pointers
18205to functions compiled in other languages that use the static chain if
18206you use the @option{-mno-pointers-to-nested-functions}.
18207
18208@item -msave-toc-indirect
18209@itemx -mno-save-toc-indirect
18210@opindex msave-toc-indirect
18211Generate (do not generate) code to save the TOC value in the reserved
18212stack location in the function prologue if the function calls through
18213a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
18214saved in the prologue, it is saved just before the call through the
18215pointer.  The @option{-mno-save-toc-indirect} option is the default.
18216
18217@item -mcompat-align-parm
18218@itemx -mno-compat-align-parm
18219@opindex mcompat-align-parm
18220Generate (do not generate) code to pass structure parameters with a
18221maximum alignment of 64 bits, for compatibility with older versions
18222of GCC.
18223
18224Older versions of GCC (prior to 4.9.0) incorrectly did not align a
18225structure parameter on a 128-bit boundary when that structure contained
18226a member requiring 128-bit alignment.  This is corrected in more
18227recent versions of GCC.  This option may be used to generate code
18228that is compatible with functions compiled with older versions of
18229GCC.
18230
18231In this version of the compiler, the @option{-mcompat-align-parm}
18232is the default, except when using the Linux ELFv2 ABI.
18233@end table
18234
18235@node RX Options
18236@subsection RX Options
18237@cindex RX Options
18238
18239These command-line options are defined for RX targets:
18240
18241@table @gcctabopt
18242@item -m64bit-doubles
18243@itemx -m32bit-doubles
18244@opindex m64bit-doubles
18245@opindex m32bit-doubles
18246Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
18247or 32 bits (@option{-m32bit-doubles}) in size.  The default is
18248@option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
18249works on 32-bit values, which is why the default is
18250@option{-m32bit-doubles}.
18251
18252@item -fpu
18253@itemx -nofpu
18254@opindex fpu
18255@opindex nofpu
18256Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
18257floating-point hardware.  The default is enabled for the @var{RX600}
18258series and disabled for the @var{RX200} series.
18259
18260Floating-point instructions are only generated for 32-bit floating-point
18261values, however, so the FPU hardware is not used for doubles if the
18262@option{-m64bit-doubles} option is used.
18263
18264@emph{Note} If the @option{-fpu} option is enabled then
18265@option{-funsafe-math-optimizations} is also enabled automatically.
18266This is because the RX FPU instructions are themselves unsafe.
18267
18268@item -mcpu=@var{name}
18269@opindex -mcpu
18270Selects the type of RX CPU to be targeted.  Currently three types are
18271supported, the generic @var{RX600} and @var{RX200} series hardware and
18272the specific @var{RX610} CPU.  The default is @var{RX600}.
18273
18274The only difference between @var{RX600} and @var{RX610} is that the
18275@var{RX610} does not support the @code{MVTIPL} instruction.
18276
18277The @var{RX200} series does not have a hardware floating-point unit
18278and so @option{-nofpu} is enabled by default when this type is
18279selected.
18280
18281@item -mbig-endian-data
18282@itemx -mlittle-endian-data
18283@opindex mbig-endian-data
18284@opindex mlittle-endian-data
18285Store data (but not code) in the big-endian format.  The default is
18286@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
18287format.
18288
18289@item -msmall-data-limit=@var{N}
18290@opindex msmall-data-limit
18291Specifies the maximum size in bytes of global and static variables
18292which can be placed into the small data area.  Using the small data
18293area can lead to smaller and faster code, but the size of area is
18294limited and it is up to the programmer to ensure that the area does
18295not overflow.  Also when the small data area is used one of the RX's
18296registers (usually @code{r13}) is reserved for use pointing to this
18297area, so it is no longer available for use by the compiler.  This
18298could result in slower and/or larger code if variables are pushed onto
18299the stack instead of being held in this register.
18300
18301Note, common variables (variables that have not been initialized) and
18302constants are not placed into the small data area as they are assigned
18303to other sections in the output executable.
18304
18305The default value is zero, which disables this feature.  Note, this
18306feature is not enabled by default with higher optimization levels
18307(@option{-O2} etc) because of the potentially detrimental effects of
18308reserving a register.  It is up to the programmer to experiment and
18309discover whether this feature is of benefit to their program.  See the
18310description of the @option{-mpid} option for a description of how the
18311actual register to hold the small data area pointer is chosen.
18312
18313@item -msim
18314@itemx -mno-sim
18315@opindex msim
18316@opindex mno-sim
18317Use the simulator runtime.  The default is to use the libgloss
18318board-specific runtime.
18319
18320@item -mas100-syntax
18321@itemx -mno-as100-syntax
18322@opindex mas100-syntax
18323@opindex mno-as100-syntax
18324When generating assembler output use a syntax that is compatible with
18325Renesas's AS100 assembler.  This syntax can also be handled by the GAS
18326assembler, but it has some restrictions so it is not generated by default.
18327
18328@item -mmax-constant-size=@var{N}
18329@opindex mmax-constant-size
18330Specifies the maximum size, in bytes, of a constant that can be used as
18331an operand in a RX instruction.  Although the RX instruction set does
18332allow constants of up to 4 bytes in length to be used in instructions,
18333a longer value equates to a longer instruction.  Thus in some
18334circumstances it can be beneficial to restrict the size of constants
18335that are used in instructions.  Constants that are too big are instead
18336placed into a constant pool and referenced via register indirection.
18337
18338The value @var{N} can be between 0 and 4.  A value of 0 (the default)
18339or 4 means that constants of any size are allowed.
18340
18341@item -mrelax
18342@opindex mrelax
18343Enable linker relaxation.  Linker relaxation is a process whereby the
18344linker attempts to reduce the size of a program by finding shorter
18345versions of various instructions.  Disabled by default.
18346
18347@item -mint-register=@var{N}
18348@opindex mint-register
18349Specify the number of registers to reserve for fast interrupt handler
18350functions.  The value @var{N} can be between 0 and 4.  A value of 1
18351means that register @code{r13} is reserved for the exclusive use
18352of fast interrupt handlers.  A value of 2 reserves @code{r13} and
18353@code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
18354@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
18355A value of 0, the default, does not reserve any registers.
18356
18357@item -msave-acc-in-interrupts
18358@opindex msave-acc-in-interrupts
18359Specifies that interrupt handler functions should preserve the
18360accumulator register.  This is only necessary if normal code might use
18361the accumulator register, for example because it performs 64-bit
18362multiplications.  The default is to ignore the accumulator as this
18363makes the interrupt handlers faster.
18364
18365@item -mpid
18366@itemx -mno-pid
18367@opindex mpid
18368@opindex mno-pid
18369Enables the generation of position independent data.  When enabled any
18370access to constant data is done via an offset from a base address
18371held in a register.  This allows the location of constant data to be
18372determined at run time without requiring the executable to be
18373relocated, which is a benefit to embedded applications with tight
18374memory constraints.  Data that can be modified is not affected by this
18375option.
18376
18377Note, using this feature reserves a register, usually @code{r13}, for
18378the constant data base address.  This can result in slower and/or
18379larger code, especially in complicated functions.
18380
18381The actual register chosen to hold the constant data base address
18382depends upon whether the @option{-msmall-data-limit} and/or the
18383@option{-mint-register} command-line options are enabled.  Starting
18384with register @code{r13} and proceeding downwards, registers are
18385allocated first to satisfy the requirements of @option{-mint-register},
18386then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
18387is possible for the small data area register to be @code{r8} if both
18388@option{-mint-register=4} and @option{-mpid} are specified on the
18389command line.
18390
18391By default this feature is not enabled.  The default can be restored
18392via the @option{-mno-pid} command-line option.
18393
18394@item -mno-warn-multiple-fast-interrupts
18395@itemx -mwarn-multiple-fast-interrupts
18396@opindex mno-warn-multiple-fast-interrupts
18397@opindex mwarn-multiple-fast-interrupts
18398Prevents GCC from issuing a warning message if it finds more than one
18399fast interrupt handler when it is compiling a file.  The default is to
18400issue a warning for each extra fast interrupt handler found, as the RX
18401only supports one such interrupt.
18402
18403@end table
18404
18405@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
18406has special significance to the RX port when used with the
18407@code{interrupt} function attribute.  This attribute indicates a
18408function intended to process fast interrupts.  GCC ensures
18409that it only uses the registers @code{r10}, @code{r11}, @code{r12}
18410and/or @code{r13} and only provided that the normal use of the
18411corresponding registers have been restricted via the
18412@option{-ffixed-@var{reg}} or @option{-mint-register} command-line
18413options.
18414
18415@node S/390 and zSeries Options
18416@subsection S/390 and zSeries Options
18417@cindex S/390 and zSeries Options
18418
18419These are the @samp{-m} options defined for the S/390 and zSeries architecture.
18420
18421@table @gcctabopt
18422@item -mhard-float
18423@itemx -msoft-float
18424@opindex mhard-float
18425@opindex msoft-float
18426Use (do not use) the hardware floating-point instructions and registers
18427for floating-point operations.  When @option{-msoft-float} is specified,
18428functions in @file{libgcc.a} are used to perform floating-point
18429operations.  When @option{-mhard-float} is specified, the compiler
18430generates IEEE floating-point instructions.  This is the default.
18431
18432@item -mhard-dfp
18433@itemx -mno-hard-dfp
18434@opindex mhard-dfp
18435@opindex mno-hard-dfp
18436Use (do not use) the hardware decimal-floating-point instructions for
18437decimal-floating-point operations.  When @option{-mno-hard-dfp} is
18438specified, functions in @file{libgcc.a} are used to perform
18439decimal-floating-point operations.  When @option{-mhard-dfp} is
18440specified, the compiler generates decimal-floating-point hardware
18441instructions.  This is the default for @option{-march=z9-ec} or higher.
18442
18443@item -mlong-double-64
18444@itemx -mlong-double-128
18445@opindex mlong-double-64
18446@opindex mlong-double-128
18447These switches control the size of @code{long double} type. A size
18448of 64 bits makes the @code{long double} type equivalent to the @code{double}
18449type. This is the default.
18450
18451@item -mbackchain
18452@itemx -mno-backchain
18453@opindex mbackchain
18454@opindex mno-backchain
18455Store (do not store) the address of the caller's frame as backchain pointer
18456into the callee's stack frame.
18457A backchain may be needed to allow debugging using tools that do not understand
18458DWARF 2 call frame information.
18459When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
18460at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
18461the backchain is placed into the topmost word of the 96/160 byte register
18462save area.
18463
18464In general, code compiled with @option{-mbackchain} is call-compatible with
18465code compiled with @option{-mmo-backchain}; however, use of the backchain
18466for debugging purposes usually requires that the whole binary is built with
18467@option{-mbackchain}.  Note that the combination of @option{-mbackchain},
18468@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
18469to build a linux kernel use @option{-msoft-float}.
18470
18471The default is to not maintain the backchain.
18472
18473@item -mpacked-stack
18474@itemx -mno-packed-stack
18475@opindex mpacked-stack
18476@opindex mno-packed-stack
18477Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
18478specified, the compiler uses the all fields of the 96/160 byte register save
18479area only for their default purpose; unused fields still take up stack space.
18480When @option{-mpacked-stack} is specified, register save slots are densely
18481packed at the top of the register save area; unused space is reused for other
18482purposes, allowing for more efficient use of the available stack space.
18483However, when @option{-mbackchain} is also in effect, the topmost word of
18484the save area is always used to store the backchain, and the return address
18485register is always saved two words below the backchain.
18486
18487As long as the stack frame backchain is not used, code generated with
18488@option{-mpacked-stack} is call-compatible with code generated with
18489@option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
18490S/390 or zSeries generated code that uses the stack frame backchain at run
18491time, not just for debugging purposes.  Such code is not call-compatible
18492with code compiled with @option{-mpacked-stack}.  Also, note that the
18493combination of @option{-mbackchain},
18494@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
18495to build a linux kernel use @option{-msoft-float}.
18496
18497The default is to not use the packed stack layout.
18498
18499@item -msmall-exec
18500@itemx -mno-small-exec
18501@opindex msmall-exec
18502@opindex mno-small-exec
18503Generate (or do not generate) code using the @code{bras} instruction
18504to do subroutine calls.
18505This only works reliably if the total executable size does not
18506exceed 64k.  The default is to use the @code{basr} instruction instead,
18507which does not have this limitation.
18508
18509@item -m64
18510@itemx -m31
18511@opindex m64
18512@opindex m31
18513When @option{-m31} is specified, generate code compliant to the
18514GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
18515code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
18516particular to generate 64-bit instructions.  For the @samp{s390}
18517targets, the default is @option{-m31}, while the @samp{s390x}
18518targets default to @option{-m64}.
18519
18520@item -mzarch
18521@itemx -mesa
18522@opindex mzarch
18523@opindex mesa
18524When @option{-mzarch} is specified, generate code using the
18525instructions available on z/Architecture.
18526When @option{-mesa} is specified, generate code using the
18527instructions available on ESA/390.  Note that @option{-mesa} is
18528not possible with @option{-m64}.
18529When generating code compliant to the GNU/Linux for S/390 ABI,
18530the default is @option{-mesa}.  When generating code compliant
18531to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
18532
18533@item -mmvcle
18534@itemx -mno-mvcle
18535@opindex mmvcle
18536@opindex mno-mvcle
18537Generate (or do not generate) code using the @code{mvcle} instruction
18538to perform block moves.  When @option{-mno-mvcle} is specified,
18539use a @code{mvc} loop instead.  This is the default unless optimizing for
18540size.
18541
18542@item -mdebug
18543@itemx -mno-debug
18544@opindex mdebug
18545@opindex mno-debug
18546Print (or do not print) additional debug information when compiling.
18547The default is to not print debug information.
18548
18549@item -march=@var{cpu-type}
18550@opindex march
18551Generate code that runs on @var{cpu-type}, which is the name of a system
18552representing a certain processor type.  Possible values for
18553@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
18554@samp{z9-109}, @samp{z9-ec}, @samp{z10}, @samp{z196}, and @samp{zEC12}.
18555When generating code using the instructions available on z/Architecture,
18556the default is @option{-march=z900}.  Otherwise, the default is
18557@option{-march=g5}.
18558
18559@item -mtune=@var{cpu-type}
18560@opindex mtune
18561Tune to @var{cpu-type} everything applicable about the generated code,
18562except for the ABI and the set of available instructions.
18563The list of @var{cpu-type} values is the same as for @option{-march}.
18564The default is the value used for @option{-march}.
18565
18566@item -mtpf-trace
18567@itemx -mno-tpf-trace
18568@opindex mtpf-trace
18569@opindex mno-tpf-trace
18570Generate code that adds (does not add) in TPF OS specific branches to trace
18571routines in the operating system.  This option is off by default, even
18572when compiling for the TPF OS@.
18573
18574@item -mfused-madd
18575@itemx -mno-fused-madd
18576@opindex mfused-madd
18577@opindex mno-fused-madd
18578Generate code that uses (does not use) the floating-point multiply and
18579accumulate instructions.  These instructions are generated by default if
18580hardware floating point is used.
18581
18582@item -mwarn-framesize=@var{framesize}
18583@opindex mwarn-framesize
18584Emit a warning if the current function exceeds the given frame size.  Because
18585this is a compile-time check it doesn't need to be a real problem when the program
18586runs.  It is intended to identify functions that most probably cause
18587a stack overflow.  It is useful to be used in an environment with limited stack
18588size e.g.@: the linux kernel.
18589
18590@item -mwarn-dynamicstack
18591@opindex mwarn-dynamicstack
18592Emit a warning if the function calls @code{alloca} or uses dynamically-sized
18593arrays.  This is generally a bad idea with a limited stack size.
18594
18595@item -mstack-guard=@var{stack-guard}
18596@itemx -mstack-size=@var{stack-size}
18597@opindex mstack-guard
18598@opindex mstack-size
18599If these options are provided the S/390 back end emits additional instructions in
18600the function prologue that trigger a trap if the stack size is @var{stack-guard}
18601bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
18602If the @var{stack-guard} option is omitted the smallest power of 2 larger than
18603the frame size of the compiled function is chosen.
18604These options are intended to be used to help debugging stack overflow problems.
18605The additionally emitted code causes only little overhead and hence can also be
18606used in production-like systems without greater performance degradation.  The given
18607values have to be exact powers of 2 and @var{stack-size} has to be greater than
18608@var{stack-guard} without exceeding 64k.
18609In order to be efficient the extra code makes the assumption that the stack starts
18610at an address aligned to the value given by @var{stack-size}.
18611The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
18612
18613@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
18614@opindex mhotpatch
18615If the hotpatch option is enabled, a ``hot-patching'' function
18616prologue is generated for all functions in the compilation unit.
18617The funtion label is prepended with the given number of two-byte
18618NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
18619the label, 2 * @var{post-halfwords} bytes are appended, using the
18620largest NOP like instructions the architecture allows (maximum
186211000000).
18622
18623If both arguments are zero, hotpatching is disabled.
18624
18625This option can be overridden for individual functions with the
18626@code{hotpatch} attribute.
18627@end table
18628
18629@node Score Options
18630@subsection Score Options
18631@cindex Score Options
18632
18633These options are defined for Score implementations:
18634
18635@table @gcctabopt
18636@item -meb
18637@opindex meb
18638Compile code for big-endian mode.  This is the default.
18639
18640@item -mel
18641@opindex mel
18642Compile code for little-endian mode.
18643
18644@item -mnhwloop
18645@opindex mnhwloop
18646Disable generation of @code{bcnz} instructions.
18647
18648@item -muls
18649@opindex muls
18650Enable generation of unaligned load and store instructions.
18651
18652@item -mmac
18653@opindex mmac
18654Enable the use of multiply-accumulate instructions. Disabled by default.
18655
18656@item -mscore5
18657@opindex mscore5
18658Specify the SCORE5 as the target architecture.
18659
18660@item -mscore5u
18661@opindex mscore5u
18662Specify the SCORE5U of the target architecture.
18663
18664@item -mscore7
18665@opindex mscore7
18666Specify the SCORE7 as the target architecture. This is the default.
18667
18668@item -mscore7d
18669@opindex mscore7d
18670Specify the SCORE7D as the target architecture.
18671@end table
18672
18673@node SH Options
18674@subsection SH Options
18675
18676These @samp{-m} options are defined for the SH implementations:
18677
18678@table @gcctabopt
18679@item -m1
18680@opindex m1
18681Generate code for the SH1.
18682
18683@item -m2
18684@opindex m2
18685Generate code for the SH2.
18686
18687@item -m2e
18688Generate code for the SH2e.
18689
18690@item -m2a-nofpu
18691@opindex m2a-nofpu
18692Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
18693that the floating-point unit is not used.
18694
18695@item -m2a-single-only
18696@opindex m2a-single-only
18697Generate code for the SH2a-FPU, in such a way that no double-precision
18698floating-point operations are used.
18699
18700@item -m2a-single
18701@opindex m2a-single
18702Generate code for the SH2a-FPU assuming the floating-point unit is in
18703single-precision mode by default.
18704
18705@item -m2a
18706@opindex m2a
18707Generate code for the SH2a-FPU assuming the floating-point unit is in
18708double-precision mode by default.
18709
18710@item -m3
18711@opindex m3
18712Generate code for the SH3.
18713
18714@item -m3e
18715@opindex m3e
18716Generate code for the SH3e.
18717
18718@item -m4-nofpu
18719@opindex m4-nofpu
18720Generate code for the SH4 without a floating-point unit.
18721
18722@item -m4-single-only
18723@opindex m4-single-only
18724Generate code for the SH4 with a floating-point unit that only
18725supports single-precision arithmetic.
18726
18727@item -m4-single
18728@opindex m4-single
18729Generate code for the SH4 assuming the floating-point unit is in
18730single-precision mode by default.
18731
18732@item -m4
18733@opindex m4
18734Generate code for the SH4.
18735
18736@item -m4-100
18737@opindex m4-100
18738Generate code for SH4-100.
18739
18740@item -m4-100-nofpu
18741@opindex m4-100-nofpu
18742Generate code for SH4-100 in such a way that the
18743floating-point unit is not used.
18744
18745@item -m4-100-single
18746@opindex m4-100-single
18747Generate code for SH4-100 assuming the floating-point unit is in
18748single-precision mode by default.
18749
18750@item -m4-100-single-only
18751@opindex m4-100-single-only
18752Generate code for SH4-100 in such a way that no double-precision
18753floating-point operations are used.
18754
18755@item -m4-200
18756@opindex m4-200
18757Generate code for SH4-200.
18758
18759@item -m4-200-nofpu
18760@opindex m4-200-nofpu
18761Generate code for SH4-200 without in such a way that the
18762floating-point unit is not used.
18763
18764@item -m4-200-single
18765@opindex m4-200-single
18766Generate code for SH4-200 assuming the floating-point unit is in
18767single-precision mode by default.
18768
18769@item -m4-200-single-only
18770@opindex m4-200-single-only
18771Generate code for SH4-200 in such a way that no double-precision
18772floating-point operations are used.
18773
18774@item -m4-300
18775@opindex m4-300
18776Generate code for SH4-300.
18777
18778@item -m4-300-nofpu
18779@opindex m4-300-nofpu
18780Generate code for SH4-300 without in such a way that the
18781floating-point unit is not used.
18782
18783@item -m4-300-single
18784@opindex m4-300-single
18785Generate code for SH4-300 in such a way that no double-precision
18786floating-point operations are used.
18787
18788@item -m4-300-single-only
18789@opindex m4-300-single-only
18790Generate code for SH4-300 in such a way that no double-precision
18791floating-point operations are used.
18792
18793@item -m4-340
18794@opindex m4-340
18795Generate code for SH4-340 (no MMU, no FPU).
18796
18797@item -m4-500
18798@opindex m4-500
18799Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
18800assembler.
18801
18802@item -m4a-nofpu
18803@opindex m4a-nofpu
18804Generate code for the SH4al-dsp, or for a SH4a in such a way that the
18805floating-point unit is not used.
18806
18807@item -m4a-single-only
18808@opindex m4a-single-only
18809Generate code for the SH4a, in such a way that no double-precision
18810floating-point operations are used.
18811
18812@item -m4a-single
18813@opindex m4a-single
18814Generate code for the SH4a assuming the floating-point unit is in
18815single-precision mode by default.
18816
18817@item -m4a
18818@opindex m4a
18819Generate code for the SH4a.
18820
18821@item -m4al
18822@opindex m4al
18823Same as @option{-m4a-nofpu}, except that it implicitly passes
18824@option{-dsp} to the assembler.  GCC doesn't generate any DSP
18825instructions at the moment.
18826
18827@item -m5-32media
18828@opindex m5-32media
18829Generate 32-bit code for SHmedia.
18830
18831@item -m5-32media-nofpu
18832@opindex m5-32media-nofpu
18833Generate 32-bit code for SHmedia in such a way that the
18834floating-point unit is not used.
18835
18836@item -m5-64media
18837@opindex m5-64media
18838Generate 64-bit code for SHmedia.
18839
18840@item -m5-64media-nofpu
18841@opindex m5-64media-nofpu
18842Generate 64-bit code for SHmedia in such a way that the
18843floating-point unit is not used.
18844
18845@item -m5-compact
18846@opindex m5-compact
18847Generate code for SHcompact.
18848
18849@item -m5-compact-nofpu
18850@opindex m5-compact-nofpu
18851Generate code for SHcompact in such a way that the
18852floating-point unit is not used.
18853
18854@item -mb
18855@opindex mb
18856Compile code for the processor in big-endian mode.
18857
18858@item -ml
18859@opindex ml
18860Compile code for the processor in little-endian mode.
18861
18862@item -mdalign
18863@opindex mdalign
18864Align doubles at 64-bit boundaries.  Note that this changes the calling
18865conventions, and thus some functions from the standard C library do
18866not work unless you recompile it first with @option{-mdalign}.
18867
18868@item -mrelax
18869@opindex mrelax
18870Shorten some address references at link time, when possible; uses the
18871linker option @option{-relax}.
18872
18873@item -mbigtable
18874@opindex mbigtable
18875Use 32-bit offsets in @code{switch} tables.  The default is to use
1887616-bit offsets.
18877
18878@item -mbitops
18879@opindex mbitops
18880Enable the use of bit manipulation instructions on SH2A.
18881
18882@item -mfmovd
18883@opindex mfmovd
18884Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
18885alignment constraints.
18886
18887@item -mrenesas
18888@opindex mrenesas
18889Comply with the calling conventions defined by Renesas.
18890
18891@item -mno-renesas
18892@opindex mno-renesas
18893Comply with the calling conventions defined for GCC before the Renesas
18894conventions were available.  This option is the default for all
18895targets of the SH toolchain.
18896
18897@item -mnomacsave
18898@opindex mnomacsave
18899Mark the @code{MAC} register as call-clobbered, even if
18900@option{-mrenesas} is given.
18901
18902@item -mieee
18903@itemx -mno-ieee
18904@opindex mieee
18905@opindex mno-ieee
18906Control the IEEE compliance of floating-point comparisons, which affects the
18907handling of cases where the result of a comparison is unordered.  By default
18908@option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
18909enabled @option{-mno-ieee} is implicitly set, which results in faster
18910floating-point greater-equal and less-equal comparisons.  The implcit settings
18911can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
18912
18913@item -minline-ic_invalidate
18914@opindex minline-ic_invalidate
18915Inline code to invalidate instruction cache entries after setting up
18916nested function trampolines.
18917This option has no effect if @option{-musermode} is in effect and the selected
18918code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
18919instruction.
18920If the selected code generation option does not allow the use of the @code{icbi}
18921instruction, and @option{-musermode} is not in effect, the inlined code
18922manipulates the instruction cache address array directly with an associative
18923write.  This not only requires privileged mode at run time, but it also
18924fails if the cache line had been mapped via the TLB and has become unmapped.
18925
18926@item -misize
18927@opindex misize
18928Dump instruction size and location in the assembly code.
18929
18930@item -mpadstruct
18931@opindex mpadstruct
18932This option is deprecated.  It pads structures to multiple of 4 bytes,
18933which is incompatible with the SH ABI@.
18934
18935@item -matomic-model=@var{model}
18936@opindex matomic-model=@var{model}
18937Sets the model of atomic operations and additional parameters as a comma
18938separated list.  For details on the atomic built-in functions see
18939@ref{__atomic Builtins}.  The following models and parameters are supported:
18940
18941@table @samp
18942
18943@item none
18944Disable compiler generated atomic sequences and emit library calls for atomic
18945operations.  This is the default if the target is not @code{sh*-*-linux*}.
18946
18947@item soft-gusa
18948Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
18949built-in functions.  The generated atomic sequences require additional support
18950from the interrupt/exception handling code of the system and are only suitable
18951for SH3* and SH4* single-core systems.  This option is enabled by default when
18952the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
18953this option will also partially utilize the hardware atomic instructions
18954@code{movli.l} and @code{movco.l} to create more efficient code, unless
18955@samp{strict} is specified.
18956
18957@item soft-tcb
18958Generate software atomic sequences that use a variable in the thread control
18959block.  This is a variation of the gUSA sequences which can also be used on
18960SH1* and SH2* targets.  The generated atomic sequences require additional
18961support from the interrupt/exception handling code of the system and are only
18962suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
18963parameter has to be specified as well.
18964
18965@item soft-imask
18966Generate software atomic sequences that temporarily disable interrupts by
18967setting @code{SR.IMASK = 1111}.  This model works only when the program runs
18968in privileged mode and is only suitable for single-core systems.  Additional
18969support from the interrupt/exception handling code of the system is not
18970required.  This model is enabled by default when the target is
18971@code{sh*-*-linux*} and SH1* or SH2*.
18972
18973@item hard-llcs
18974Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
18975instructions only.  This is only available on SH4A and is suitable for
18976multi-core systems.  Since the hardware instructions support only 32 bit atomic
18977variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
18978Code compiled with this option will also be compatible with other software
18979atomic model interrupt/exception handling systems if executed on an SH4A
18980system.  Additional support from the interrupt/exception handling code of the
18981system is not required for this model.
18982
18983@item gbr-offset=
18984This parameter specifies the offset in bytes of the variable in the thread
18985control block structure that should be used by the generated atomic sequences
18986when the @samp{soft-tcb} model has been selected.  For other models this
18987parameter is ignored.  The specified value must be an integer multiple of four
18988and in the range 0-1020.
18989
18990@item strict
18991This parameter prevents mixed usage of multiple atomic models, even though they
18992would be compatible, and will make the compiler generate atomic sequences of the
18993specified model only.
18994
18995@end table
18996
18997@item -mtas
18998@opindex mtas
18999Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
19000Notice that depending on the particular hardware and software configuration
19001this can degrade overall performance due to the operand cache line flushes
19002that are implied by the @code{tas.b} instruction.  On multi-core SH4A
19003processors the @code{tas.b} instruction must be used with caution since it
19004can result in data corruption for certain cache configurations.
19005
19006@item -mprefergot
19007@opindex mprefergot
19008When generating position-independent code, emit function calls using
19009the Global Offset Table instead of the Procedure Linkage Table.
19010
19011@item -musermode
19012@itemx -mno-usermode
19013@opindex musermode
19014@opindex mno-usermode
19015Don't allow (allow) the compiler generating privileged mode code.  Specifying
19016@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
19017inlined code would not work in user mode.  @option{-musermode} is the default
19018when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
19019@option{-musermode} has no effect, since there is no user mode.
19020
19021@item -multcost=@var{number}
19022@opindex multcost=@var{number}
19023Set the cost to assume for a multiply insn.
19024
19025@item -mdiv=@var{strategy}
19026@opindex mdiv=@var{strategy}
19027Set the division strategy to be used for integer division operations.
19028For SHmedia @var{strategy} can be one of:
19029
19030@table @samp
19031
19032@item fp
19033Performs the operation in floating point.  This has a very high latency,
19034but needs only a few instructions, so it might be a good choice if
19035your code has enough easily-exploitable ILP to allow the compiler to
19036schedule the floating-point instructions together with other instructions.
19037Division by zero causes a floating-point exception.
19038
19039@item inv
19040Uses integer operations to calculate the inverse of the divisor,
19041and then multiplies the dividend with the inverse.  This strategy allows
19042CSE and hoisting of the inverse calculation.  Division by zero calculates
19043an unspecified result, but does not trap.
19044
19045@item inv:minlat
19046A variant of @samp{inv} where, if no CSE or hoisting opportunities
19047have been found, or if the entire operation has been hoisted to the same
19048place, the last stages of the inverse calculation are intertwined with the
19049final multiply to reduce the overall latency, at the expense of using a few
19050more instructions, and thus offering fewer scheduling opportunities with
19051other code.
19052
19053@item call
19054Calls a library function that usually implements the @samp{inv:minlat}
19055strategy.
19056This gives high code density for @code{m5-*media-nofpu} compilations.
19057
19058@item call2
19059Uses a different entry point of the same library function, where it
19060assumes that a pointer to a lookup table has already been set up, which
19061exposes the pointer load to CSE and code hoisting optimizations.
19062
19063@item inv:call
19064@itemx inv:call2
19065@itemx inv:fp
19066Use the @samp{inv} algorithm for initial
19067code generation, but if the code stays unoptimized, revert to the @samp{call},
19068@samp{call2}, or @samp{fp} strategies, respectively.  Note that the
19069potentially-trapping side effect of division by zero is carried by a
19070separate instruction, so it is possible that all the integer instructions
19071are hoisted out, but the marker for the side effect stays where it is.
19072A recombination to floating-point operations or a call is not possible
19073in that case.
19074
19075@item inv20u
19076@itemx inv20l
19077Variants of the @samp{inv:minlat} strategy.  In the case
19078that the inverse calculation is not separated from the multiply, they speed
19079up division where the dividend fits into 20 bits (plus sign where applicable)
19080by inserting a test to skip a number of operations in this case; this test
19081slows down the case of larger dividends.  @samp{inv20u} assumes the case of a such
19082a small dividend to be unlikely, and @samp{inv20l} assumes it to be likely.
19083
19084@end table
19085
19086For targets other than SHmedia @var{strategy} can be one of:
19087
19088@table @samp
19089
19090@item call-div1
19091Calls a library function that uses the single-step division instruction
19092@code{div1} to perform the operation.  Division by zero calculates an
19093unspecified result and does not trap.  This is the default except for SH4,
19094SH2A and SHcompact.
19095
19096@item call-fp
19097Calls a library function that performs the operation in double precision
19098floating point.  Division by zero causes a floating-point exception.  This is
19099the default for SHcompact with FPU.  Specifying this for targets that do not
19100have a double precision FPU will default to @code{call-div1}.
19101
19102@item call-table
19103Calls a library function that uses a lookup table for small divisors and
19104the @code{div1} instruction with case distinction for larger divisors.  Division
19105by zero calculates an unspecified result and does not trap.  This is the default
19106for SH4.  Specifying this for targets that do not have dynamic shift
19107instructions will default to @code{call-div1}.
19108
19109@end table
19110
19111When a division strategy has not been specified the default strategy will be
19112selected based on the current target.  For SH2A the default strategy is to
19113use the @code{divs} and @code{divu} instructions instead of library function
19114calls.
19115
19116@item -maccumulate-outgoing-args
19117@opindex maccumulate-outgoing-args
19118Reserve space once for outgoing arguments in the function prologue rather
19119than around each call.  Generally beneficial for performance and size.  Also
19120needed for unwinding to avoid changing the stack frame around conditional code.
19121
19122@item -mdivsi3_libfunc=@var{name}
19123@opindex mdivsi3_libfunc=@var{name}
19124Set the name of the library function used for 32-bit signed division to
19125@var{name}.
19126This only affects the name used in the @samp{call} and @samp{inv:call}
19127division strategies, and the compiler still expects the same
19128sets of input/output/clobbered registers as if this option were not present.
19129
19130@item -mfixed-range=@var{register-range}
19131@opindex mfixed-range
19132Generate code treating the given register range as fixed registers.
19133A fixed register is one that the register allocator can not use.  This is
19134useful when compiling kernel code.  A register range is specified as
19135two registers separated by a dash.  Multiple register ranges can be
19136specified separated by a comma.
19137
19138@item -mindexed-addressing
19139@opindex mindexed-addressing
19140Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
19141This is only safe if the hardware and/or OS implement 32-bit wrap-around
19142semantics for the indexed addressing mode.  The architecture allows the
19143implementation of processors with 64-bit MMU, which the OS could use to
19144get 32-bit addressing, but since no current hardware implementation supports
19145this or any other way to make the indexed addressing mode safe to use in
19146the 32-bit ABI, the default is @option{-mno-indexed-addressing}.
19147
19148@item -mgettrcost=@var{number}
19149@opindex mgettrcost=@var{number}
19150Set the cost assumed for the @code{gettr} instruction to @var{number}.
19151The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
19152
19153@item -mpt-fixed
19154@opindex mpt-fixed
19155Assume @code{pt*} instructions won't trap.  This generally generates
19156better-scheduled code, but is unsafe on current hardware.
19157The current architecture
19158definition says that @code{ptabs} and @code{ptrel} trap when the target
19159anded with 3 is 3.
19160This has the unintentional effect of making it unsafe to schedule these
19161instructions before a branch, or hoist them out of a loop.  For example,
19162@code{__do_global_ctors}, a part of @file{libgcc}
19163that runs constructors at program
19164startup, calls functions in a list which is delimited by @minus{}1.  With the
19165@option{-mpt-fixed} option, the @code{ptabs} is done before testing against @minus{}1.
19166That means that all the constructors run a bit more quickly, but when
19167the loop comes to the end of the list, the program crashes because @code{ptabs}
19168loads @minus{}1 into a target register.
19169
19170Since this option is unsafe for any
19171hardware implementing the current architecture specification, the default
19172is @option{-mno-pt-fixed}.  Unless specified explicitly with
19173@option{-mgettrcost}, @option{-mno-pt-fixed} also implies @option{-mgettrcost=100};
19174this deters register allocation from using target registers for storing
19175ordinary integers.
19176
19177@item -minvalid-symbols
19178@opindex minvalid-symbols
19179Assume symbols might be invalid.  Ordinary function symbols generated by
19180the compiler are always valid to load with
19181@code{movi}/@code{shori}/@code{ptabs} or
19182@code{movi}/@code{shori}/@code{ptrel},
19183but with assembler and/or linker tricks it is possible
19184to generate symbols that cause @code{ptabs} or @code{ptrel} to trap.
19185This option is only meaningful when @option{-mno-pt-fixed} is in effect.
19186It prevents cross-basic-block CSE, hoisting and most scheduling
19187of symbol loads.  The default is @option{-mno-invalid-symbols}.
19188
19189@item -mbranch-cost=@var{num}
19190@opindex mbranch-cost=@var{num}
19191Assume @var{num} to be the cost for a branch instruction.  Higher numbers
19192make the compiler try to generate more branch-free code if possible.
19193If not specified the value is selected depending on the processor type that
19194is being compiled for.
19195
19196@item -mzdcbranch
19197@itemx -mno-zdcbranch
19198@opindex mzdcbranch
19199@opindex mno-zdcbranch
19200Assume (do not assume) that zero displacement conditional branch instructions
19201@code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
19202compiler will try to prefer zero displacement branch code sequences.  This is
19203enabled by default when generating code for SH4 and SH4A.  It can be explicitly
19204disabled by specifying @option{-mno-zdcbranch}.
19205
19206@item -mcbranchdi
19207@opindex mcbranchdi
19208Enable the @code{cbranchdi4} instruction pattern.
19209
19210@item -mcmpeqdi
19211@opindex mcmpeqdi
19212Emit the @code{cmpeqdi_t} instruction pattern even when @option{-mcbranchdi}
19213is in effect.
19214
19215@item -mfused-madd
19216@itemx -mno-fused-madd
19217@opindex mfused-madd
19218@opindex mno-fused-madd
19219Generate code that uses (does not use) the floating-point multiply and
19220accumulate instructions.  These instructions are generated by default
19221if hardware floating point is used.  The machine-dependent
19222@option{-mfused-madd} option is now mapped to the machine-independent
19223@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
19224mapped to @option{-ffp-contract=off}.
19225
19226@item -mfsca
19227@itemx -mno-fsca
19228@opindex mfsca
19229@opindex mno-fsca
19230Allow or disallow the compiler to emit the @code{fsca} instruction for sine
19231and cosine approximations.  The option @code{-mfsca} must be used in
19232combination with @code{-funsafe-math-optimizations}.  It is enabled by default
19233when generating code for SH4A.  Using @code{-mno-fsca} disables sine and cosine
19234approximations even if @code{-funsafe-math-optimizations} is in effect.
19235
19236@item -mfsrra
19237@itemx -mno-fsrra
19238@opindex mfsrra
19239@opindex mno-fsrra
19240Allow or disallow the compiler to emit the @code{fsrra} instruction for
19241reciprocal square root approximations.  The option @code{-mfsrra} must be used
19242in combination with @code{-funsafe-math-optimizations} and
19243@code{-ffinite-math-only}.  It is enabled by default when generating code for
19244SH4A.  Using @code{-mno-fsrra} disables reciprocal square root approximations
19245even if @code{-funsafe-math-optimizations} and @code{-ffinite-math-only} are
19246in effect.
19247
19248@item -mpretend-cmove
19249@opindex mpretend-cmove
19250Prefer zero-displacement conditional branches for conditional move instruction
19251patterns.  This can result in faster code on the SH4 processor.
19252
19253@end table
19254
19255@node Solaris 2 Options
19256@subsection Solaris 2 Options
19257@cindex Solaris 2 options
19258
19259These @samp{-m} options are supported on Solaris 2:
19260
19261@table @gcctabopt
19262@item -mimpure-text
19263@opindex mimpure-text
19264@option{-mimpure-text}, used in addition to @option{-shared}, tells
19265the compiler to not pass @option{-z text} to the linker when linking a
19266shared object.  Using this option, you can link position-dependent
19267code into a shared object.
19268
19269@option{-mimpure-text} suppresses the ``relocations remain against
19270allocatable but non-writable sections'' linker error message.
19271However, the necessary relocations trigger copy-on-write, and the
19272shared object is not actually shared across processes.  Instead of
19273using @option{-mimpure-text}, you should compile all source code with
19274@option{-fpic} or @option{-fPIC}.
19275
19276@end table
19277
19278These switches are supported in addition to the above on Solaris 2:
19279
19280@table @gcctabopt
19281@item -pthreads
19282@opindex pthreads
19283Add support for multithreading using the POSIX threads library.  This
19284option sets flags for both the preprocessor and linker.  This option does
19285not affect the thread safety of object code produced  by the compiler or
19286that of libraries supplied with it.
19287
19288@item -pthread
19289@opindex pthread
19290This is a synonym for @option{-pthreads}.
19291@end table
19292
19293@node SPARC Options
19294@subsection SPARC Options
19295@cindex SPARC options
19296
19297These @samp{-m} options are supported on the SPARC:
19298
19299@table @gcctabopt
19300@item -mno-app-regs
19301@itemx -mapp-regs
19302@opindex mno-app-regs
19303@opindex mapp-regs
19304Specify @option{-mapp-regs} to generate output using the global registers
193052 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
19306global register 1, each global register 2 through 4 is then treated as an
19307allocable register that is clobbered by function calls.  This is the default.
19308
19309To be fully SVR4 ABI-compliant at the cost of some performance loss,
19310specify @option{-mno-app-regs}.  You should compile libraries and system
19311software with this option.
19312
19313@item -mflat
19314@itemx -mno-flat
19315@opindex mflat
19316@opindex mno-flat
19317With @option{-mflat}, the compiler does not generate save/restore instructions
19318and uses a ``flat'' or single register window model.  This model is compatible
19319with the regular register window model.  The local registers and the input
19320registers (0--5) are still treated as ``call-saved'' registers and are
19321saved on the stack as needed.
19322
19323With @option{-mno-flat} (the default), the compiler generates save/restore
19324instructions (except for leaf functions).  This is the normal operating mode.
19325
19326@item -mfpu
19327@itemx -mhard-float
19328@opindex mfpu
19329@opindex mhard-float
19330Generate output containing floating-point instructions.  This is the
19331default.
19332
19333@item -mno-fpu
19334@itemx -msoft-float
19335@opindex mno-fpu
19336@opindex msoft-float
19337Generate output containing library calls for floating point.
19338@strong{Warning:} the requisite libraries are not available for all SPARC
19339targets.  Normally the facilities of the machine's usual C compiler are
19340used, but this cannot be done directly in cross-compilation.  You must make
19341your own arrangements to provide suitable library functions for
19342cross-compilation.  The embedded targets @samp{sparc-*-aout} and
19343@samp{sparclite-*-*} do provide software floating-point support.
19344
19345@option{-msoft-float} changes the calling convention in the output file;
19346therefore, it is only useful if you compile @emph{all} of a program with
19347this option.  In particular, you need to compile @file{libgcc.a}, the
19348library that comes with GCC, with @option{-msoft-float} in order for
19349this to work.
19350
19351@item -mhard-quad-float
19352@opindex mhard-quad-float
19353Generate output containing quad-word (long double) floating-point
19354instructions.
19355
19356@item -msoft-quad-float
19357@opindex msoft-quad-float
19358Generate output containing library calls for quad-word (long double)
19359floating-point instructions.  The functions called are those specified
19360in the SPARC ABI@.  This is the default.
19361
19362As of this writing, there are no SPARC implementations that have hardware
19363support for the quad-word floating-point instructions.  They all invoke
19364a trap handler for one of these instructions, and then the trap handler
19365emulates the effect of the instruction.  Because of the trap handler overhead,
19366this is much slower than calling the ABI library routines.  Thus the
19367@option{-msoft-quad-float} option is the default.
19368
19369@item -mno-unaligned-doubles
19370@itemx -munaligned-doubles
19371@opindex mno-unaligned-doubles
19372@opindex munaligned-doubles
19373Assume that doubles have 8-byte alignment.  This is the default.
19374
19375With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
19376alignment only if they are contained in another type, or if they have an
19377absolute address.  Otherwise, it assumes they have 4-byte alignment.
19378Specifying this option avoids some rare compatibility problems with code
19379generated by other compilers.  It is not the default because it results
19380in a performance loss, especially for floating-point code.
19381
19382@item -muser-mode
19383@itemx -mno-user-mode
19384@opindex muser-mode
19385@opindex mno-user-mode
19386Do not generate code that can only run in supervisor mode.  This is relevant
19387only for the @code{casa} instruction emitted for the LEON3 processor.  The
19388default is @option{-mno-user-mode}.
19389
19390@item -mno-faster-structs
19391@itemx -mfaster-structs
19392@opindex mno-faster-structs
19393@opindex mfaster-structs
19394With @option{-mfaster-structs}, the compiler assumes that structures
19395should have 8-byte alignment.  This enables the use of pairs of
19396@code{ldd} and @code{std} instructions for copies in structure
19397assignment, in place of twice as many @code{ld} and @code{st} pairs.
19398However, the use of this changed alignment directly violates the SPARC
19399ABI@.  Thus, it's intended only for use on targets where the developer
19400acknowledges that their resulting code is not directly in line with
19401the rules of the ABI@.
19402
19403@item -mcpu=@var{cpu_type}
19404@opindex mcpu
19405Set the instruction set, register set, and instruction scheduling parameters
19406for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
19407@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
19408@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
19409@samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
19410@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
19411@samp{niagara3} and @samp{niagara4}.
19412
19413Native Solaris and GNU/Linux toolchains also support the value @samp{native},
19414which selects the best architecture option for the host processor.
19415@option{-mcpu=native} has no effect if GCC does not recognize
19416the processor.
19417
19418Default instruction scheduling parameters are used for values that select
19419an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
19420@samp{sparclite}, @samp{sparclet}, @samp{v9}.
19421
19422Here is a list of each supported architecture and their supported
19423implementations.
19424
19425@table @asis
19426@item v7
19427cypress, leon3v7
19428
19429@item v8
19430supersparc, hypersparc, leon, leon3
19431
19432@item sparclite
19433f930, f934, sparclite86x
19434
19435@item sparclet
19436tsc701
19437
19438@item v9
19439ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
19440@end table
19441
19442By default (unless configured otherwise), GCC generates code for the V7
19443variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
19444additionally optimizes it for the Cypress CY7C602 chip, as used in the
19445SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
19446SPARCStation 1, 2, IPX etc.
19447
19448With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
19449architecture.  The only difference from V7 code is that the compiler emits
19450the integer multiply and integer divide instructions which exist in SPARC-V8
19451but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
19452optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
194532000 series.
19454
19455With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
19456the SPARC architecture.  This adds the integer multiply, integer divide step
19457and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
19458With @option{-mcpu=f930}, the compiler additionally optimizes it for the
19459Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
19460@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
19461MB86934 chip, which is the more recent SPARClite with FPU@.
19462
19463With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
19464the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
19465integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
19466but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
19467optimizes it for the TEMIC SPARClet chip.
19468
19469With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
19470architecture.  This adds 64-bit integer and floating-point move instructions,
194713 additional floating-point condition code registers and conditional move
19472instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
19473optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
19474@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
19475Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
19476@option{-mcpu=niagara}, the compiler additionally optimizes it for
19477Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
19478additionally optimizes it for Sun UltraSPARC T2 chips. With
19479@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
19480UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
19481additionally optimizes it for Sun UltraSPARC T4 chips.
19482
19483@item -mtune=@var{cpu_type}
19484@opindex mtune
19485Set the instruction scheduling parameters for machine type
19486@var{cpu_type}, but do not set the instruction set or register set that the
19487option @option{-mcpu=@var{cpu_type}} does.
19488
19489The same values for @option{-mcpu=@var{cpu_type}} can be used for
19490@option{-mtune=@var{cpu_type}}, but the only useful values are those
19491that select a particular CPU implementation.  Those are @samp{cypress},
19492@samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3},
19493@samp{leon3v7}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{tsc701},
19494@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
19495@samp{niagara3} and @samp{niagara4}.  With native Solaris and GNU/Linux
19496toolchains, @samp{native} can also be used.
19497
19498@item -mv8plus
19499@itemx -mno-v8plus
19500@opindex mv8plus
19501@opindex mno-v8plus
19502With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
19503difference from the V8 ABI is that the global and out registers are
19504considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
19505mode for all SPARC-V9 processors.
19506
19507@item -mvis
19508@itemx -mno-vis
19509@opindex mvis
19510@opindex mno-vis
19511With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
19512Visual Instruction Set extensions.  The default is @option{-mno-vis}.
19513
19514@item -mvis2
19515@itemx -mno-vis2
19516@opindex mvis2
19517@opindex mno-vis2
19518With @option{-mvis2}, GCC generates code that takes advantage of
19519version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
19520default is @option{-mvis2} when targeting a cpu that supports such
19521instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
19522also sets @option{-mvis}.
19523
19524@item -mvis3
19525@itemx -mno-vis3
19526@opindex mvis3
19527@opindex mno-vis3
19528With @option{-mvis3}, GCC generates code that takes advantage of
19529version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
19530default is @option{-mvis3} when targeting a cpu that supports such
19531instructions, such as niagara-3 and later.  Setting @option{-mvis3}
19532also sets @option{-mvis2} and @option{-mvis}.
19533
19534@item -mcbcond
19535@itemx -mno-cbcond
19536@opindex mcbcond
19537@opindex mno-cbcond
19538With @option{-mcbcond}, GCC generates code that takes advantage of
19539compare-and-branch instructions, as defined in the Sparc Architecture 2011.
19540The default is @option{-mcbcond} when targeting a cpu that supports such
19541instructions, such as niagara-4 and later.
19542
19543@item -mpopc
19544@itemx -mno-popc
19545@opindex mpopc
19546@opindex mno-popc
19547With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
19548population count instruction.  The default is @option{-mpopc}
19549when targeting a cpu that supports such instructions, such as Niagara-2 and
19550later.
19551
19552@item -mfmaf
19553@itemx -mno-fmaf
19554@opindex mfmaf
19555@opindex mno-fmaf
19556With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
19557Fused Multiply-Add Floating-point extensions.  The default is @option{-mfmaf}
19558when targeting a cpu that supports such instructions, such as Niagara-3 and
19559later.
19560
19561@item -mfix-at697f
19562@opindex mfix-at697f
19563Enable the documented workaround for the single erratum of the Atmel AT697F
19564processor (which corresponds to erratum #13 of the AT697E processor).
19565
19566@item -mfix-ut699
19567@opindex mfix-ut699
19568Enable the documented workarounds for the floating-point errata and the data
19569cache nullify errata of the UT699 processor.
19570@end table
19571
19572These @samp{-m} options are supported in addition to the above
19573on SPARC-V9 processors in 64-bit environments:
19574
19575@table @gcctabopt
19576@item -m32
19577@itemx -m64
19578@opindex m32
19579@opindex m64
19580Generate code for a 32-bit or 64-bit environment.
19581The 32-bit environment sets int, long and pointer to 32 bits.
19582The 64-bit environment sets int to 32 bits and long and pointer
19583to 64 bits.
19584
19585@item -mcmodel=@var{which}
19586@opindex mcmodel
19587Set the code model to one of
19588
19589@table @samp
19590@item medlow
19591The Medium/Low code model: 64-bit addresses, programs
19592must be linked in the low 32 bits of memory.  Programs can be statically
19593or dynamically linked.
19594
19595@item medmid
19596The Medium/Middle code model: 64-bit addresses, programs
19597must be linked in the low 44 bits of memory, the text and data segments must
19598be less than 2GB in size and the data segment must be located within 2GB of
19599the text segment.
19600
19601@item medany
19602The Medium/Anywhere code model: 64-bit addresses, programs
19603may be linked anywhere in memory, the text and data segments must be less
19604than 2GB in size and the data segment must be located within 2GB of the
19605text segment.
19606
19607@item embmedany
19608The Medium/Anywhere code model for embedded systems:
1960964-bit addresses, the text and data segments must be less than 2GB in
19610size, both starting anywhere in memory (determined at link time).  The
19611global register %g4 points to the base of the data segment.  Programs
19612are statically linked and PIC is not supported.
19613@end table
19614
19615@item -mmemory-model=@var{mem-model}
19616@opindex mmemory-model
19617Set the memory model in force on the processor to one of
19618
19619@table @samp
19620@item default
19621The default memory model for the processor and operating system.
19622
19623@item rmo
19624Relaxed Memory Order
19625
19626@item pso
19627Partial Store Order
19628
19629@item tso
19630Total Store Order
19631
19632@item sc
19633Sequential Consistency
19634@end table
19635
19636These memory models are formally defined in Appendix D of the Sparc V9
19637architecture manual, as set in the processor's @code{PSTATE.MM} field.
19638
19639@item -mstack-bias
19640@itemx -mno-stack-bias
19641@opindex mstack-bias
19642@opindex mno-stack-bias
19643With @option{-mstack-bias}, GCC assumes that the stack pointer, and
19644frame pointer if present, are offset by @minus{}2047 which must be added back
19645when making stack frame references.  This is the default in 64-bit mode.
19646Otherwise, assume no such offset is present.
19647@end table
19648
19649@node SPU Options
19650@subsection SPU Options
19651@cindex SPU options
19652
19653These @samp{-m} options are supported on the SPU:
19654
19655@table @gcctabopt
19656@item -mwarn-reloc
19657@itemx -merror-reloc
19658@opindex mwarn-reloc
19659@opindex merror-reloc
19660
19661The loader for SPU does not handle dynamic relocations.  By default, GCC
19662gives an error when it generates code that requires a dynamic
19663relocation.  @option{-mno-error-reloc} disables the error,
19664@option{-mwarn-reloc} generates a warning instead.
19665
19666@item -msafe-dma
19667@itemx -munsafe-dma
19668@opindex msafe-dma
19669@opindex munsafe-dma
19670
19671Instructions that initiate or test completion of DMA must not be
19672reordered with respect to loads and stores of the memory that is being
19673accessed.
19674With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
19675memory accesses, but that can lead to inefficient code in places where the
19676memory is known to not change.  Rather than mark the memory as volatile,
19677you can use @option{-msafe-dma} to tell the compiler to treat
19678the DMA instructions as potentially affecting all memory.
19679
19680@item -mbranch-hints
19681@opindex mbranch-hints
19682
19683By default, GCC generates a branch hint instruction to avoid
19684pipeline stalls for always-taken or probably-taken branches.  A hint
19685is not generated closer than 8 instructions away from its branch.
19686There is little reason to disable them, except for debugging purposes,
19687or to make an object a little bit smaller.
19688
19689@item -msmall-mem
19690@itemx -mlarge-mem
19691@opindex msmall-mem
19692@opindex mlarge-mem
19693
19694By default, GCC generates code assuming that addresses are never larger
19695than 18 bits.  With @option{-mlarge-mem} code is generated that assumes
19696a full 32-bit address.
19697
19698@item -mstdmain
19699@opindex mstdmain
19700
19701By default, GCC links against startup code that assumes the SPU-style
19702main function interface (which has an unconventional parameter list).
19703With @option{-mstdmain}, GCC links your program against startup
19704code that assumes a C99-style interface to @code{main}, including a
19705local copy of @code{argv} strings.
19706
19707@item -mfixed-range=@var{register-range}
19708@opindex mfixed-range
19709Generate code treating the given register range as fixed registers.
19710A fixed register is one that the register allocator cannot use.  This is
19711useful when compiling kernel code.  A register range is specified as
19712two registers separated by a dash.  Multiple register ranges can be
19713specified separated by a comma.
19714
19715@item -mea32
19716@itemx -mea64
19717@opindex mea32
19718@opindex mea64
19719Compile code assuming that pointers to the PPU address space accessed
19720via the @code{__ea} named address space qualifier are either 32 or 64
19721bits wide.  The default is 32 bits.  As this is an ABI-changing option,
19722all object code in an executable must be compiled with the same setting.
19723
19724@item -maddress-space-conversion
19725@itemx -mno-address-space-conversion
19726@opindex maddress-space-conversion
19727@opindex mno-address-space-conversion
19728Allow/disallow treating the @code{__ea} address space as superset
19729of the generic address space.  This enables explicit type casts
19730between @code{__ea} and generic pointer as well as implicit
19731conversions of generic pointers to @code{__ea} pointers.  The
19732default is to allow address space pointer conversions.
19733
19734@item -mcache-size=@var{cache-size}
19735@opindex mcache-size
19736This option controls the version of libgcc that the compiler links to an
19737executable and selects a software-managed cache for accessing variables
19738in the @code{__ea} address space with a particular cache size.  Possible
19739options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
19740and @samp{128}.  The default cache size is 64KB.
19741
19742@item -matomic-updates
19743@itemx -mno-atomic-updates
19744@opindex matomic-updates
19745@opindex mno-atomic-updates
19746This option controls the version of libgcc that the compiler links to an
19747executable and selects whether atomic updates to the software-managed
19748cache of PPU-side variables are used.  If you use atomic updates, changes
19749to a PPU variable from SPU code using the @code{__ea} named address space
19750qualifier do not interfere with changes to other PPU variables residing
19751in the same cache line from PPU code.  If you do not use atomic updates,
19752such interference may occur; however, writing back cache lines is
19753more efficient.  The default behavior is to use atomic updates.
19754
19755@item -mdual-nops
19756@itemx -mdual-nops=@var{n}
19757@opindex mdual-nops
19758By default, GCC inserts nops to increase dual issue when it expects
19759it to increase performance.  @var{n} can be a value from 0 to 10.  A
19760smaller @var{n} inserts fewer nops.  10 is the default, 0 is the
19761same as @option{-mno-dual-nops}.  Disabled with @option{-Os}.
19762
19763@item -mhint-max-nops=@var{n}
19764@opindex mhint-max-nops
19765Maximum number of nops to insert for a branch hint.  A branch hint must
19766be at least 8 instructions away from the branch it is affecting.  GCC
19767inserts up to @var{n} nops to enforce this, otherwise it does not
19768generate the branch hint.
19769
19770@item -mhint-max-distance=@var{n}
19771@opindex mhint-max-distance
19772The encoding of the branch hint instruction limits the hint to be within
19773256 instructions of the branch it is affecting.  By default, GCC makes
19774sure it is within 125.
19775
19776@item -msafe-hints
19777@opindex msafe-hints
19778Work around a hardware bug that causes the SPU to stall indefinitely.
19779By default, GCC inserts the @code{hbrp} instruction to make sure
19780this stall won't happen.
19781
19782@end table
19783
19784@node System V Options
19785@subsection Options for System V
19786
19787These additional options are available on System V Release 4 for
19788compatibility with other compilers on those systems:
19789
19790@table @gcctabopt
19791@item -G
19792@opindex G
19793Create a shared object.
19794It is recommended that @option{-symbolic} or @option{-shared} be used instead.
19795
19796@item -Qy
19797@opindex Qy
19798Identify the versions of each tool used by the compiler, in a
19799@code{.ident} assembler directive in the output.
19800
19801@item -Qn
19802@opindex Qn
19803Refrain from adding @code{.ident} directives to the output file (this is
19804the default).
19805
19806@item -YP,@var{dirs}
19807@opindex YP
19808Search the directories @var{dirs}, and no others, for libraries
19809specified with @option{-l}.
19810
19811@item -Ym,@var{dir}
19812@opindex Ym
19813Look in the directory @var{dir} to find the M4 preprocessor.
19814The assembler uses this option.
19815@c This is supposed to go with a -Yd for predefined M4 macro files, but
19816@c the generic assembler that comes with Solaris takes just -Ym.
19817@end table
19818
19819@node TILE-Gx Options
19820@subsection TILE-Gx Options
19821@cindex TILE-Gx options
19822
19823These @samp{-m} options are supported on the TILE-Gx:
19824
19825@table @gcctabopt
19826@item -mcmodel=small
19827@opindex mcmodel=small
19828Generate code for the small model.  The distance for direct calls is
19829limited to 500M in either direction.  PC-relative addresses are 32
19830bits.  Absolute addresses support the full address range.
19831
19832@item -mcmodel=large
19833@opindex mcmodel=large
19834Generate code for the large model.  There is no limitation on call
19835distance, pc-relative addresses, or absolute addresses.
19836
19837@item -mcpu=@var{name}
19838@opindex mcpu
19839Selects the type of CPU to be targeted.  Currently the only supported
19840type is @samp{tilegx}.
19841
19842@item -m32
19843@itemx -m64
19844@opindex m32
19845@opindex m64
19846Generate code for a 32-bit or 64-bit environment.  The 32-bit
19847environment sets int, long, and pointer to 32 bits.  The 64-bit
19848environment sets int to 32 bits and long and pointer to 64 bits.
19849@end table
19850
19851@node TILEPro Options
19852@subsection TILEPro Options
19853@cindex TILEPro options
19854
19855These @samp{-m} options are supported on the TILEPro:
19856
19857@table @gcctabopt
19858@item -mcpu=@var{name}
19859@opindex mcpu
19860Selects the type of CPU to be targeted.  Currently the only supported
19861type is @samp{tilepro}.
19862
19863@item -m32
19864@opindex m32
19865Generate code for a 32-bit environment, which sets int, long, and
19866pointer to 32 bits.  This is the only supported behavior so the flag
19867is essentially ignored.
19868@end table
19869
19870@node V850 Options
19871@subsection V850 Options
19872@cindex V850 Options
19873
19874These @samp{-m} options are defined for V850 implementations:
19875
19876@table @gcctabopt
19877@item -mlong-calls
19878@itemx -mno-long-calls
19879@opindex mlong-calls
19880@opindex mno-long-calls
19881Treat all calls as being far away (near).  If calls are assumed to be
19882far away, the compiler always loads the function's address into a
19883register, and calls indirect through the pointer.
19884
19885@item -mno-ep
19886@itemx -mep
19887@opindex mno-ep
19888@opindex mep
19889Do not optimize (do optimize) basic blocks that use the same index
19890pointer 4 or more times to copy pointer into the @code{ep} register, and
19891use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
19892option is on by default if you optimize.
19893
19894@item -mno-prolog-function
19895@itemx -mprolog-function
19896@opindex mno-prolog-function
19897@opindex mprolog-function
19898Do not use (do use) external functions to save and restore registers
19899at the prologue and epilogue of a function.  The external functions
19900are slower, but use less code space if more than one function saves
19901the same number of registers.  The @option{-mprolog-function} option
19902is on by default if you optimize.
19903
19904@item -mspace
19905@opindex mspace
19906Try to make the code as small as possible.  At present, this just turns
19907on the @option{-mep} and @option{-mprolog-function} options.
19908
19909@item -mtda=@var{n}
19910@opindex mtda
19911Put static or global variables whose size is @var{n} bytes or less into
19912the tiny data area that register @code{ep} points to.  The tiny data
19913area can hold up to 256 bytes in total (128 bytes for byte references).
19914
19915@item -msda=@var{n}
19916@opindex msda
19917Put static or global variables whose size is @var{n} bytes or less into
19918the small data area that register @code{gp} points to.  The small data
19919area can hold up to 64 kilobytes.
19920
19921@item -mzda=@var{n}
19922@opindex mzda
19923Put static or global variables whose size is @var{n} bytes or less into
19924the first 32 kilobytes of memory.
19925
19926@item -mv850
19927@opindex mv850
19928Specify that the target processor is the V850.
19929
19930@item -mv850e3v5
19931@opindex mv850e3v5
19932Specify that the target processor is the V850E3V5.  The preprocessor
19933constant @samp{__v850e3v5__} is defined if this option is used.
19934
19935@item -mv850e2v4
19936@opindex mv850e2v4
19937Specify that the target processor is the V850E3V5.  This is an alias for
19938the @option{-mv850e3v5} option.
19939
19940@item -mv850e2v3
19941@opindex mv850e2v3
19942Specify that the target processor is the V850E2V3.  The preprocessor
19943constant @samp{__v850e2v3__} is defined if this option is used.
19944
19945@item -mv850e2
19946@opindex mv850e2
19947Specify that the target processor is the V850E2.  The preprocessor
19948constant @samp{__v850e2__} is defined if this option is used.
19949
19950@item -mv850e1
19951@opindex mv850e1
19952Specify that the target processor is the V850E1.  The preprocessor
19953constants @samp{__v850e1__} and @samp{__v850e__} are defined if
19954this option is used.
19955
19956@item -mv850es
19957@opindex mv850es
19958Specify that the target processor is the V850ES.  This is an alias for
19959the @option{-mv850e1} option.
19960
19961@item -mv850e
19962@opindex mv850e
19963Specify that the target processor is the V850E@.  The preprocessor
19964constant @samp{__v850e__} is defined if this option is used.
19965
19966If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
19967nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
19968are defined then a default target processor is chosen and the
19969relevant @samp{__v850*__} preprocessor constant is defined.
19970
19971The preprocessor constants @samp{__v850} and @samp{__v851__} are always
19972defined, regardless of which processor variant is the target.
19973
19974@item -mdisable-callt
19975@itemx -mno-disable-callt
19976@opindex mdisable-callt
19977@opindex mno-disable-callt
19978This option suppresses generation of the @code{CALLT} instruction for the
19979v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
19980architecture.
19981
19982This option is enabled by default when the RH850 ABI is
19983in use (see @option{-mrh850-abi}), and disabled by default when the
19984GCC ABI is in use.  If @code{CALLT} instructions are being generated
19985then the C preprocessor symbol @code{__V850_CALLT__} will be defined.
19986
19987@item -mrelax
19988@itemx -mno-relax
19989@opindex mrelax
19990@opindex mno-relax
19991Pass on (or do not pass on) the @option{-mrelax} command line option
19992to the assembler.
19993
19994@item -mlong-jumps
19995@itemx -mno-long-jumps
19996@opindex mlong-jumps
19997@opindex mno-long-jumps
19998Disable (or re-enable) the generation of PC-relative jump instructions.
19999
20000@item -msoft-float
20001@itemx -mhard-float
20002@opindex msoft-float
20003@opindex mhard-float
20004Disable (or re-enable) the generation of hardware floating point
20005instructions.  This option is only significant when the target
20006architecture is @samp{V850E2V3} or higher.  If hardware floating point
20007instructions are being generated then the C preprocessor symbol
20008@code{__FPU_OK__} will be defined, otherwise the symbol
20009@code{__NO_FPU__} will be defined.
20010
20011@item -mloop
20012@opindex mloop
20013Enables the use of the e3v5 LOOP instruction.  The use of this
20014instruction is not enabled by default when the e3v5 architecture is
20015selected because its use is still experimental.
20016
20017@item -mrh850-abi
20018@itemx -mghs
20019@opindex mrh850-abi
20020@opindex mghs
20021Enables support for the RH850 version of the V850 ABI.  This is the
20022default.  With this version of the ABI the following rules apply:
20023
20024@itemize
20025@item
20026Integer sized structures and unions are returned via a memory pointer
20027rather than a register.
20028
20029@item
20030Large structures and unions (more than 8 bytes in size) are passed by
20031value.
20032
20033@item
20034Functions are aligned to 16-bit boundaries.
20035
20036@item
20037The @option{-m8byte-align} command line option is supported.
20038
20039@item
20040The @option{-mdisable-callt} command line option is enabled by
20041default.  The @option{-mno-disable-callt} command line option is not
20042supported.
20043@end itemize
20044
20045When this version of the ABI is enabled the C preprocessor symbol
20046@code{__V850_RH850_ABI__} is defined.
20047
20048@item -mgcc-abi
20049@opindex mgcc-abi
20050Enables support for the old GCC version of the V850 ABI.  With this
20051version of the ABI the following rules apply:
20052
20053@itemize
20054@item
20055Integer sized structures and unions are returned in register @code{r10}.
20056
20057@item
20058Large structures and unions (more than 8 bytes in size) are passed by
20059reference.
20060
20061@item
20062Functions are aligned to 32-bit boundaries, unless optimizing for
20063size.
20064
20065@item
20066The @option{-m8byte-align} command line option is not supported.
20067
20068@item
20069The @option{-mdisable-callt} command line option is supported but not
20070enabled by default.
20071@end itemize
20072
20073When this version of the ABI is enabled the C preprocessor symbol
20074@code{__V850_GCC_ABI__} is defined.
20075
20076@item -m8byte-align
20077@itemx -mno-8byte-align
20078@opindex m8byte-align
20079@opindex mno-8byte-align
20080Enables support for @code{doubles} and @code{long long} types to be
20081aligned on 8-byte boundaries.  The default is to restrict the
20082alignment of all objects to at most 4-bytes.  When
20083@option{-m8byte-align} is in effect the C preprocessor symbol
20084@code{__V850_8BYTE_ALIGN__} will be defined.
20085
20086@item -mbig-switch
20087@opindex mbig-switch
20088Generate code suitable for big switch tables.  Use this option only if
20089the assembler/linker complain about out of range branches within a switch
20090table.
20091
20092@item -mapp-regs
20093@opindex mapp-regs
20094This option causes r2 and r5 to be used in the code generated by
20095the compiler.  This setting is the default.
20096
20097@item -mno-app-regs
20098@opindex mno-app-regs
20099This option causes r2 and r5 to be treated as fixed registers.
20100
20101@end table
20102
20103@node VAX Options
20104@subsection VAX Options
20105@cindex VAX options
20106
20107These @samp{-m} options are defined for the VAX:
20108
20109@table @gcctabopt
20110@item -munix
20111@opindex munix
20112Do not output certain jump instructions (@code{aobleq} and so on)
20113that the Unix assembler for the VAX cannot handle across long
20114ranges.
20115
20116@item -mgnu
20117@opindex mgnu
20118Do output those jump instructions, on the assumption that the
20119GNU assembler is being used.
20120
20121@item -mg
20122@opindex mg
20123Output code for G-format floating-point numbers instead of D-format.
20124@end table
20125
20126@node VMS Options
20127@subsection VMS Options
20128
20129These @samp{-m} options are defined for the VMS implementations:
20130
20131@table @gcctabopt
20132@item -mvms-return-codes
20133@opindex mvms-return-codes
20134Return VMS condition codes from @code{main}. The default is to return POSIX-style
20135condition (e.g.@ error) codes.
20136
20137@item -mdebug-main=@var{prefix}
20138@opindex mdebug-main=@var{prefix}
20139Flag the first routine whose name starts with @var{prefix} as the main
20140routine for the debugger.
20141
20142@item -mmalloc64
20143@opindex mmalloc64
20144Default to 64-bit memory allocation routines.
20145
20146@item -mpointer-size=@var{size}
20147@opindex -mpointer-size=@var{size}
20148Set the default size of pointers. Possible options for @var{size} are
20149@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
20150for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
20151The later option disables @code{pragma pointer_size}.
20152@end table
20153
20154@node VxWorks Options
20155@subsection VxWorks Options
20156@cindex VxWorks Options
20157
20158The options in this section are defined for all VxWorks targets.
20159Options specific to the target hardware are listed with the other
20160options for that target.
20161
20162@table @gcctabopt
20163@item -mrtp
20164@opindex mrtp
20165GCC can generate code for both VxWorks kernels and real time processes
20166(RTPs).  This option switches from the former to the latter.  It also
20167defines the preprocessor macro @code{__RTP__}.
20168
20169@item -non-static
20170@opindex non-static
20171Link an RTP executable against shared libraries rather than static
20172libraries.  The options @option{-static} and @option{-shared} can
20173also be used for RTPs (@pxref{Link Options}); @option{-static}
20174is the default.
20175
20176@item -Bstatic
20177@itemx -Bdynamic
20178@opindex Bstatic
20179@opindex Bdynamic
20180These options are passed down to the linker.  They are defined for
20181compatibility with Diab.
20182
20183@item -Xbind-lazy
20184@opindex Xbind-lazy
20185Enable lazy binding of function calls.  This option is equivalent to
20186@option{-Wl,-z,now} and is defined for compatibility with Diab.
20187
20188@item -Xbind-now
20189@opindex Xbind-now
20190Disable lazy binding of function calls.  This option is the default and
20191is defined for compatibility with Diab.
20192@end table
20193
20194@node x86-64 Options
20195@subsection x86-64 Options
20196@cindex x86-64 options
20197
20198These are listed under @xref{i386 and x86-64 Options}.
20199
20200@node Xstormy16 Options
20201@subsection Xstormy16 Options
20202@cindex Xstormy16 Options
20203
20204These options are defined for Xstormy16:
20205
20206@table @gcctabopt
20207@item -msim
20208@opindex msim
20209Choose startup files and linker script suitable for the simulator.
20210@end table
20211
20212@node Xtensa Options
20213@subsection Xtensa Options
20214@cindex Xtensa Options
20215
20216These options are supported for Xtensa targets:
20217
20218@table @gcctabopt
20219@item -mconst16
20220@itemx -mno-const16
20221@opindex mconst16
20222@opindex mno-const16
20223Enable or disable use of @code{CONST16} instructions for loading
20224constant values.  The @code{CONST16} instruction is currently not a
20225standard option from Tensilica.  When enabled, @code{CONST16}
20226instructions are always used in place of the standard @code{L32R}
20227instructions.  The use of @code{CONST16} is enabled by default only if
20228the @code{L32R} instruction is not available.
20229
20230@item -mfused-madd
20231@itemx -mno-fused-madd
20232@opindex mfused-madd
20233@opindex mno-fused-madd
20234Enable or disable use of fused multiply/add and multiply/subtract
20235instructions in the floating-point option.  This has no effect if the
20236floating-point option is not also enabled.  Disabling fused multiply/add
20237and multiply/subtract instructions forces the compiler to use separate
20238instructions for the multiply and add/subtract operations.  This may be
20239desirable in some cases where strict IEEE 754-compliant results are
20240required: the fused multiply add/subtract instructions do not round the
20241intermediate result, thereby producing results with @emph{more} bits of
20242precision than specified by the IEEE standard.  Disabling fused multiply
20243add/subtract instructions also ensures that the program output is not
20244sensitive to the compiler's ability to combine multiply and add/subtract
20245operations.
20246
20247@item -mserialize-volatile
20248@itemx -mno-serialize-volatile
20249@opindex mserialize-volatile
20250@opindex mno-serialize-volatile
20251When this option is enabled, GCC inserts @code{MEMW} instructions before
20252@code{volatile} memory references to guarantee sequential consistency.
20253The default is @option{-mserialize-volatile}.  Use
20254@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
20255
20256@item -mforce-no-pic
20257@opindex mforce-no-pic
20258For targets, like GNU/Linux, where all user-mode Xtensa code must be
20259position-independent code (PIC), this option disables PIC for compiling
20260kernel code.
20261
20262@item -mtext-section-literals
20263@itemx -mno-text-section-literals
20264@opindex mtext-section-literals
20265@opindex mno-text-section-literals
20266Control the treatment of literal pools.  The default is
20267@option{-mno-text-section-literals}, which places literals in a separate
20268section in the output file.  This allows the literal pool to be placed
20269in a data RAM/ROM, and it also allows the linker to combine literal
20270pools from separate object files to remove redundant literals and
20271improve code size.  With @option{-mtext-section-literals}, the literals
20272are interspersed in the text section in order to keep them as close as
20273possible to their references.  This may be necessary for large assembly
20274files.
20275
20276@item -mtarget-align
20277@itemx -mno-target-align
20278@opindex mtarget-align
20279@opindex mno-target-align
20280When this option is enabled, GCC instructs the assembler to
20281automatically align instructions to reduce branch penalties at the
20282expense of some code density.  The assembler attempts to widen density
20283instructions to align branch targets and the instructions following call
20284instructions.  If there are not enough preceding safe density
20285instructions to align a target, no widening is performed.  The
20286default is @option{-mtarget-align}.  These options do not affect the
20287treatment of auto-aligned instructions like @code{LOOP}, which the
20288assembler always aligns, either by widening density instructions or
20289by inserting NOP instructions.
20290
20291@item -mlongcalls
20292@itemx -mno-longcalls
20293@opindex mlongcalls
20294@opindex mno-longcalls
20295When this option is enabled, GCC instructs the assembler to translate
20296direct calls to indirect calls unless it can determine that the target
20297of a direct call is in the range allowed by the call instruction.  This
20298translation typically occurs for calls to functions in other source
20299files.  Specifically, the assembler translates a direct @code{CALL}
20300instruction into an @code{L32R} followed by a @code{CALLX} instruction.
20301The default is @option{-mno-longcalls}.  This option should be used in
20302programs where the call target can potentially be out of range.  This
20303option is implemented in the assembler, not the compiler, so the
20304assembly code generated by GCC still shows direct call
20305instructions---look at the disassembled object code to see the actual
20306instructions.  Note that the assembler uses an indirect call for
20307every cross-file call, not just those that really are out of range.
20308@end table
20309
20310@node zSeries Options
20311@subsection zSeries Options
20312@cindex zSeries options
20313
20314These are listed under @xref{S/390 and zSeries Options}.
20315
20316@node Code Gen Options
20317@section Options for Code Generation Conventions
20318@cindex code generation conventions
20319@cindex options, code generation
20320@cindex run-time options
20321
20322These machine-independent options control the interface conventions
20323used in code generation.
20324
20325Most of them have both positive and negative forms; the negative form
20326of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
20327one of the forms is listed---the one that is not the default.  You
20328can figure out the other form by either removing @samp{no-} or adding
20329it.
20330
20331@table @gcctabopt
20332@item -fbounds-check
20333@opindex fbounds-check
20334For front ends that support it, generate additional code to check that
20335indices used to access arrays are within the declared range.  This is
20336currently only supported by the Java and Fortran front ends, where
20337this option defaults to true and false respectively.
20338
20339@item -fstack-reuse=@var{reuse-level}
20340@opindex fstack_reuse
20341This option controls stack space reuse for user declared local/auto variables
20342and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
20343@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
20344local variables and temporaries, @samp{named_vars} enables the reuse only for
20345user defined local variables with names, and @samp{none} disables stack reuse
20346completely. The default value is @samp{all}. The option is needed when the
20347program extends the lifetime of a scoped local variable or a compiler generated
20348temporary beyond the end point defined by the language.  When a lifetime of
20349a variable ends, and if the variable lives in memory, the optimizing compiler
20350has the freedom to reuse its stack space with other temporaries or scoped
20351local variables whose live range does not overlap with it. Legacy code extending
20352local lifetime will likely to break with the stack reuse optimization.
20353
20354For example,
20355
20356@smallexample
20357   int *p;
20358   @{
20359     int local1;
20360
20361     p = &local1;
20362     local1 = 10;
20363     ....
20364   @}
20365   @{
20366      int local2;
20367      local2 = 20;
20368      ...
20369   @}
20370
20371   if (*p == 10)  // out of scope use of local1
20372     @{
20373
20374     @}
20375@end smallexample
20376
20377Another example:
20378@smallexample
20379
20380   struct A
20381   @{
20382       A(int k) : i(k), j(k) @{ @}
20383       int i;
20384       int j;
20385   @};
20386
20387   A *ap;
20388
20389   void foo(const A& ar)
20390   @{
20391      ap = &ar;
20392   @}
20393
20394   void bar()
20395   @{
20396      foo(A(10)); // temp object's lifetime ends when foo returns
20397
20398      @{
20399        A a(20);
20400        ....
20401      @}
20402      ap->i+= 10;  // ap references out of scope temp whose space
20403                   // is reused with a. What is the value of ap->i?
20404   @}
20405
20406@end smallexample
20407
20408The lifetime of a compiler generated temporary is well defined by the C++
20409standard. When a lifetime of a temporary ends, and if the temporary lives
20410in memory, the optimizing compiler has the freedom to reuse its stack
20411space with other temporaries or scoped local variables whose live range
20412does not overlap with it. However some of the legacy code relies on
20413the behavior of older compilers in which temporaries' stack space is
20414not reused, the aggressive stack reuse can lead to runtime errors. This
20415option is used to control the temporary stack reuse optimization.
20416
20417@item -ftrapv
20418@opindex ftrapv
20419This option generates traps for signed overflow on addition, subtraction,
20420multiplication operations.
20421
20422@item -fwrapv
20423@opindex fwrapv
20424This option instructs the compiler to assume that signed arithmetic
20425overflow of addition, subtraction and multiplication wraps around
20426using twos-complement representation.  This flag enables some optimizations
20427and disables others.  This option is enabled by default for the Java
20428front end, as required by the Java language specification.
20429
20430@item -fexceptions
20431@opindex fexceptions
20432Enable exception handling.  Generates extra code needed to propagate
20433exceptions.  For some targets, this implies GCC generates frame
20434unwind information for all functions, which can produce significant data
20435size overhead, although it does not affect execution.  If you do not
20436specify this option, GCC enables it by default for languages like
20437C++ that normally require exception handling, and disables it for
20438languages like C that do not normally require it.  However, you may need
20439to enable this option when compiling C code that needs to interoperate
20440properly with exception handlers written in C++.  You may also wish to
20441disable this option if you are compiling older C++ programs that don't
20442use exception handling.
20443
20444@item -fnon-call-exceptions
20445@opindex fnon-call-exceptions
20446Generate code that allows trapping instructions to throw exceptions.
20447Note that this requires platform-specific runtime support that does
20448not exist everywhere.  Moreover, it only allows @emph{trapping}
20449instructions to throw exceptions, i.e.@: memory references or floating-point
20450instructions.  It does not allow exceptions to be thrown from
20451arbitrary signal handlers such as @code{SIGALRM}.
20452
20453@item -fdelete-dead-exceptions
20454@opindex fdelete-dead-exceptions
20455Consider that instructions that may throw exceptions but don't otherwise
20456contribute to the execution of the program can be optimized away.
20457This option is enabled by default for the Ada front end, as permitted by
20458the Ada language specification.
20459Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
20460
20461@item -funwind-tables
20462@opindex funwind-tables
20463Similar to @option{-fexceptions}, except that it just generates any needed
20464static data, but does not affect the generated code in any other way.
20465You normally do not need to enable this option; instead, a language processor
20466that needs this handling enables it on your behalf.
20467
20468@item -fasynchronous-unwind-tables
20469@opindex fasynchronous-unwind-tables
20470Generate unwind table in DWARF 2 format, if supported by target machine.  The
20471table is exact at each instruction boundary, so it can be used for stack
20472unwinding from asynchronous events (such as debugger or garbage collector).
20473
20474@item -fno-gnu-unique
20475@opindex fno-gnu-unique
20476On systems with recent GNU assembler and C library, the C++ compiler
20477uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
20478of template static data members and static local variables in inline
20479functions are unique even in the presence of @code{RTLD_LOCAL}; this
20480is necessary to avoid problems with a library used by two different
20481@code{RTLD_LOCAL} plugins depending on a definition in one of them and
20482therefore disagreeing with the other one about the binding of the
20483symbol.  But this causes @code{dlclose} to be ignored for affected
20484DSOs; if your program relies on reinitialization of a DSO via
20485@code{dlclose} and @code{dlopen}, you can use
20486@option{-fno-gnu-unique}.
20487
20488@item -fpcc-struct-return
20489@opindex fpcc-struct-return
20490Return ``short'' @code{struct} and @code{union} values in memory like
20491longer ones, rather than in registers.  This convention is less
20492efficient, but it has the advantage of allowing intercallability between
20493GCC-compiled files and files compiled with other compilers, particularly
20494the Portable C Compiler (pcc).
20495
20496The precise convention for returning structures in memory depends
20497on the target configuration macros.
20498
20499Short structures and unions are those whose size and alignment match
20500that of some integer type.
20501
20502@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
20503switch is not binary compatible with code compiled with the
20504@option{-freg-struct-return} switch.
20505Use it to conform to a non-default application binary interface.
20506
20507@item -freg-struct-return
20508@opindex freg-struct-return
20509Return @code{struct} and @code{union} values in registers when possible.
20510This is more efficient for small structures than
20511@option{-fpcc-struct-return}.
20512
20513If you specify neither @option{-fpcc-struct-return} nor
20514@option{-freg-struct-return}, GCC defaults to whichever convention is
20515standard for the target.  If there is no standard convention, GCC
20516defaults to @option{-fpcc-struct-return}, except on targets where GCC is
20517the principal compiler.  In those cases, we can choose the standard, and
20518we chose the more efficient register return alternative.
20519
20520@strong{Warning:} code compiled with the @option{-freg-struct-return}
20521switch is not binary compatible with code compiled with the
20522@option{-fpcc-struct-return} switch.
20523Use it to conform to a non-default application binary interface.
20524
20525@item -fshort-enums
20526@opindex fshort-enums
20527Allocate to an @code{enum} type only as many bytes as it needs for the
20528declared range of possible values.  Specifically, the @code{enum} type
20529is equivalent to the smallest integer type that has enough room.
20530
20531@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
20532code that is not binary compatible with code generated without that switch.
20533Use it to conform to a non-default application binary interface.
20534
20535@item -fshort-double
20536@opindex fshort-double
20537Use the same size for @code{double} as for @code{float}.
20538
20539@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
20540code that is not binary compatible with code generated without that switch.
20541Use it to conform to a non-default application binary interface.
20542
20543@item -fshort-wchar
20544@opindex fshort-wchar
20545Override the underlying type for @samp{wchar_t} to be @samp{short
20546unsigned int} instead of the default for the target.  This option is
20547useful for building programs to run under WINE@.
20548
20549@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
20550code that is not binary compatible with code generated without that switch.
20551Use it to conform to a non-default application binary interface.
20552
20553@item -fno-common
20554@opindex fno-common
20555In C code, controls the placement of uninitialized global variables.
20556Unix C compilers have traditionally permitted multiple definitions of
20557such variables in different compilation units by placing the variables
20558in a common block.
20559This is the behavior specified by @option{-fcommon}, and is the default
20560for GCC on most targets.
20561On the other hand, this behavior is not required by ISO C, and on some
20562targets may carry a speed or code size penalty on variable references.
20563The @option{-fno-common} option specifies that the compiler should place
20564uninitialized global variables in the data section of the object file,
20565rather than generating them as common blocks.
20566This has the effect that if the same variable is declared
20567(without @code{extern}) in two different compilations,
20568you get a multiple-definition error when you link them.
20569In this case, you must compile with @option{-fcommon} instead.
20570Compiling with @option{-fno-common} is useful on targets for which
20571it provides better performance, or if you wish to verify that the
20572program will work on other systems that always treat uninitialized
20573variable declarations this way.
20574
20575@item -fno-ident
20576@opindex fno-ident
20577Ignore the @samp{#ident} directive.
20578
20579@item -finhibit-size-directive
20580@opindex finhibit-size-directive
20581Don't output a @code{.size} assembler directive, or anything else that
20582would cause trouble if the function is split in the middle, and the
20583two halves are placed at locations far apart in memory.  This option is
20584used when compiling @file{crtstuff.c}; you should not need to use it
20585for anything else.
20586
20587@item -fverbose-asm
20588@opindex fverbose-asm
20589Put extra commentary information in the generated assembly code to
20590make it more readable.  This option is generally only of use to those
20591who actually need to read the generated assembly code (perhaps while
20592debugging the compiler itself).
20593
20594@option{-fno-verbose-asm}, the default, causes the
20595extra information to be omitted and is useful when comparing two assembler
20596files.
20597
20598@item -frecord-gcc-switches
20599@opindex frecord-gcc-switches
20600This switch causes the command line used to invoke the
20601compiler to be recorded into the object file that is being created.
20602This switch is only implemented on some targets and the exact format
20603of the recording is target and binary file format dependent, but it
20604usually takes the form of a section containing ASCII text.  This
20605switch is related to the @option{-fverbose-asm} switch, but that
20606switch only records information in the assembler output file as
20607comments, so it never reaches the object file.
20608See also @option{-grecord-gcc-switches} for another
20609way of storing compiler options into the object file.
20610
20611@item -fpic
20612@opindex fpic
20613@cindex global offset table
20614@cindex PIC
20615Generate position-independent code (PIC) suitable for use in a shared
20616library, if supported for the target machine.  Such code accesses all
20617constant addresses through a global offset table (GOT)@.  The dynamic
20618loader resolves the GOT entries when the program starts (the dynamic
20619loader is not part of GCC; it is part of the operating system).  If
20620the GOT size for the linked executable exceeds a machine-specific
20621maximum size, you get an error message from the linker indicating that
20622@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
20623instead.  (These maximums are 8k on the SPARC and 32k
20624on the m68k and RS/6000.  The 386 has no such limit.)
20625
20626Position-independent code requires special support, and therefore works
20627only on certain machines.  For the 386, GCC supports PIC for System V
20628but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
20629position-independent.
20630
20631When this flag is set, the macros @code{__pic__} and @code{__PIC__}
20632are defined to 1.
20633
20634@item -fPIC
20635@opindex fPIC
20636If supported for the target machine, emit position-independent code,
20637suitable for dynamic linking and avoiding any limit on the size of the
20638global offset table.  This option makes a difference on the m68k,
20639PowerPC and SPARC@.
20640
20641Position-independent code requires special support, and therefore works
20642only on certain machines.
20643
20644When this flag is set, the macros @code{__pic__} and @code{__PIC__}
20645are defined to 2.
20646
20647@item -fpie
20648@itemx -fPIE
20649@opindex fpie
20650@opindex fPIE
20651These options are similar to @option{-fpic} and @option{-fPIC}, but
20652generated position independent code can be only linked into executables.
20653Usually these options are used when @option{-pie} GCC option is
20654used during linking.
20655
20656@option{-fpie} and @option{-fPIE} both define the macros
20657@code{__pie__} and @code{__PIE__}.  The macros have the value 1
20658for @option{-fpie} and 2 for @option{-fPIE}.
20659
20660@item -fno-jump-tables
20661@opindex fno-jump-tables
20662Do not use jump tables for switch statements even where it would be
20663more efficient than other code generation strategies.  This option is
20664of use in conjunction with @option{-fpic} or @option{-fPIC} for
20665building code that forms part of a dynamic linker and cannot
20666reference the address of a jump table.  On some targets, jump tables
20667do not require a GOT and this option is not needed.
20668
20669@item -ffixed-@var{reg}
20670@opindex ffixed
20671Treat the register named @var{reg} as a fixed register; generated code
20672should never refer to it (except perhaps as a stack pointer, frame
20673pointer or in some other fixed role).
20674
20675@var{reg} must be the name of a register.  The register names accepted
20676are machine-specific and are defined in the @code{REGISTER_NAMES}
20677macro in the machine description macro file.
20678
20679This flag does not have a negative form, because it specifies a
20680three-way choice.
20681
20682@item -fcall-used-@var{reg}
20683@opindex fcall-used
20684Treat the register named @var{reg} as an allocable register that is
20685clobbered by function calls.  It may be allocated for temporaries or
20686variables that do not live across a call.  Functions compiled this way
20687do not save and restore the register @var{reg}.
20688
20689It is an error to use this flag with the frame pointer or stack pointer.
20690Use of this flag for other registers that have fixed pervasive roles in
20691the machine's execution model produces disastrous results.
20692
20693This flag does not have a negative form, because it specifies a
20694three-way choice.
20695
20696@item -fcall-saved-@var{reg}
20697@opindex fcall-saved
20698Treat the register named @var{reg} as an allocable register saved by
20699functions.  It may be allocated even for temporaries or variables that
20700live across a call.  Functions compiled this way save and restore
20701the register @var{reg} if they use it.
20702
20703It is an error to use this flag with the frame pointer or stack pointer.
20704Use of this flag for other registers that have fixed pervasive roles in
20705the machine's execution model produces disastrous results.
20706
20707A different sort of disaster results from the use of this flag for
20708a register in which function values may be returned.
20709
20710This flag does not have a negative form, because it specifies a
20711three-way choice.
20712
20713@item -fpack-struct[=@var{n}]
20714@opindex fpack-struct
20715Without a value specified, pack all structure members together without
20716holes.  When a value is specified (which must be a small power of two), pack
20717structure members according to this value, representing the maximum
20718alignment (that is, objects with default alignment requirements larger than
20719this are output potentially unaligned at the next fitting location.
20720
20721@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
20722code that is not binary compatible with code generated without that switch.
20723Additionally, it makes the code suboptimal.
20724Use it to conform to a non-default application binary interface.
20725
20726@item -finstrument-functions
20727@opindex finstrument-functions
20728Generate instrumentation calls for entry and exit to functions.  Just
20729after function entry and just before function exit, the following
20730profiling functions are called with the address of the current
20731function and its call site.  (On some platforms,
20732@code{__builtin_return_address} does not work beyond the current
20733function, so the call site information may not be available to the
20734profiling functions otherwise.)
20735
20736@smallexample
20737void __cyg_profile_func_enter (void *this_fn,
20738                               void *call_site);
20739void __cyg_profile_func_exit  (void *this_fn,
20740                               void *call_site);
20741@end smallexample
20742
20743The first argument is the address of the start of the current function,
20744which may be looked up exactly in the symbol table.
20745
20746This instrumentation is also done for functions expanded inline in other
20747functions.  The profiling calls indicate where, conceptually, the
20748inline function is entered and exited.  This means that addressable
20749versions of such functions must be available.  If all your uses of a
20750function are expanded inline, this may mean an additional expansion of
20751code size.  If you use @samp{extern inline} in your C code, an
20752addressable version of such functions must be provided.  (This is
20753normally the case anyway, but if you get lucky and the optimizer always
20754expands the functions inline, you might have gotten away without
20755providing static copies.)
20756
20757A function may be given the attribute @code{no_instrument_function}, in
20758which case this instrumentation is not done.  This can be used, for
20759example, for the profiling functions listed above, high-priority
20760interrupt routines, and any functions from which the profiling functions
20761cannot safely be called (perhaps signal handlers, if the profiling
20762routines generate output or allocate memory).
20763
20764@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
20765@opindex finstrument-functions-exclude-file-list
20766
20767Set the list of functions that are excluded from instrumentation (see
20768the description of @code{-finstrument-functions}).  If the file that
20769contains a function definition matches with one of @var{file}, then
20770that function is not instrumented.  The match is done on substrings:
20771if the @var{file} parameter is a substring of the file name, it is
20772considered to be a match.
20773
20774For example:
20775
20776@smallexample
20777-finstrument-functions-exclude-file-list=/bits/stl,include/sys
20778@end smallexample
20779
20780@noindent
20781excludes any inline function defined in files whose pathnames
20782contain @code{/bits/stl} or @code{include/sys}.
20783
20784If, for some reason, you want to include letter @code{','} in one of
20785@var{sym}, write @code{'\,'}. For example,
20786@code{-finstrument-functions-exclude-file-list='\,\,tmp'}
20787(note the single quote surrounding the option).
20788
20789@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
20790@opindex finstrument-functions-exclude-function-list
20791
20792This is similar to @code{-finstrument-functions-exclude-file-list},
20793but this option sets the list of function names to be excluded from
20794instrumentation.  The function name to be matched is its user-visible
20795name, such as @code{vector<int> blah(const vector<int> &)}, not the
20796internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
20797match is done on substrings: if the @var{sym} parameter is a substring
20798of the function name, it is considered to be a match.  For C99 and C++
20799extended identifiers, the function name must be given in UTF-8, not
20800using universal character names.
20801
20802@item -fstack-check
20803@opindex fstack-check
20804Generate code to verify that you do not go beyond the boundary of the
20805stack.  You should specify this flag if you are running in an
20806environment with multiple threads, but you only rarely need to specify it in
20807a single-threaded environment since stack overflow is automatically
20808detected on nearly all systems if there is only one stack.
20809
20810Note that this switch does not actually cause checking to be done; the
20811operating system or the language runtime must do that.  The switch causes
20812generation of code to ensure that they see the stack being extended.
20813
20814You can additionally specify a string parameter: @code{no} means no
20815checking, @code{generic} means force the use of old-style checking,
20816@code{specific} means use the best checking method and is equivalent
20817to bare @option{-fstack-check}.
20818
20819Old-style checking is a generic mechanism that requires no specific
20820target support in the compiler but comes with the following drawbacks:
20821
20822@enumerate
20823@item
20824Modified allocation strategy for large objects: they are always
20825allocated dynamically if their size exceeds a fixed threshold.
20826
20827@item
20828Fixed limit on the size of the static frame of functions: when it is
20829topped by a particular function, stack checking is not reliable and
20830a warning is issued by the compiler.
20831
20832@item
20833Inefficiency: because of both the modified allocation strategy and the
20834generic implementation, code performance is hampered.
20835@end enumerate
20836
20837Note that old-style stack checking is also the fallback method for
20838@code{specific} if no target support has been added in the compiler.
20839
20840@item -fstack-limit-register=@var{reg}
20841@itemx -fstack-limit-symbol=@var{sym}
20842@itemx -fno-stack-limit
20843@opindex fstack-limit-register
20844@opindex fstack-limit-symbol
20845@opindex fno-stack-limit
20846Generate code to ensure that the stack does not grow beyond a certain value,
20847either the value of a register or the address of a symbol.  If a larger
20848stack is required, a signal is raised at run time.  For most targets,
20849the signal is raised before the stack overruns the boundary, so
20850it is possible to catch the signal without taking special precautions.
20851
20852For instance, if the stack starts at absolute address @samp{0x80000000}
20853and grows downwards, you can use the flags
20854@option{-fstack-limit-symbol=__stack_limit} and
20855@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
20856of 128KB@.  Note that this may only work with the GNU linker.
20857
20858@item -fsplit-stack
20859@opindex fsplit-stack
20860Generate code to automatically split the stack before it overflows.
20861The resulting program has a discontiguous stack which can only
20862overflow if the program is unable to allocate any more memory.  This
20863is most useful when running threaded programs, as it is no longer
20864necessary to calculate a good stack size to use for each thread.  This
20865is currently only implemented for the i386 and x86_64 back ends running
20866GNU/Linux.
20867
20868When code compiled with @option{-fsplit-stack} calls code compiled
20869without @option{-fsplit-stack}, there may not be much stack space
20870available for the latter code to run.  If compiling all code,
20871including library code, with @option{-fsplit-stack} is not an option,
20872then the linker can fix up these calls so that the code compiled
20873without @option{-fsplit-stack} always has a large stack.  Support for
20874this is implemented in the gold linker in GNU binutils release 2.21
20875and later.
20876
20877@item -fleading-underscore
20878@opindex fleading-underscore
20879This option and its counterpart, @option{-fno-leading-underscore}, forcibly
20880change the way C symbols are represented in the object file.  One use
20881is to help link with legacy assembly code.
20882
20883@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
20884generate code that is not binary compatible with code generated without that
20885switch.  Use it to conform to a non-default application binary interface.
20886Not all targets provide complete support for this switch.
20887
20888@item -ftls-model=@var{model}
20889@opindex ftls-model
20890Alter the thread-local storage model to be used (@pxref{Thread-Local}).
20891The @var{model} argument should be one of @code{global-dynamic},
20892@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
20893
20894The default without @option{-fpic} is @code{initial-exec}; with
20895@option{-fpic} the default is @code{global-dynamic}.
20896
20897@item -fvisibility=@var{default|internal|hidden|protected}
20898@opindex fvisibility
20899Set the default ELF image symbol visibility to the specified option---all
20900symbols are marked with this unless overridden within the code.
20901Using this feature can very substantially improve linking and
20902load times of shared object libraries, produce more optimized
20903code, provide near-perfect API export and prevent symbol clashes.
20904It is @strong{strongly} recommended that you use this in any shared objects
20905you distribute.
20906
20907Despite the nomenclature, @code{default} always means public; i.e.,
20908available to be linked against from outside the shared object.
20909@code{protected} and @code{internal} are pretty useless in real-world
20910usage so the only other commonly used option is @code{hidden}.
20911The default if @option{-fvisibility} isn't specified is
20912@code{default}, i.e., make every
20913symbol public---this causes the same behavior as previous versions of
20914GCC@.
20915
20916A good explanation of the benefits offered by ensuring ELF
20917symbols have the correct visibility is given by ``How To Write
20918Shared Libraries'' by Ulrich Drepper (which can be found at
20919@w{@uref{http://people.redhat.com/~drepper/}})---however a superior
20920solution made possible by this option to marking things hidden when
20921the default is public is to make the default hidden and mark things
20922public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
20923and @code{__attribute__ ((visibility("default")))} instead of
20924@code{__declspec(dllexport)} you get almost identical semantics with
20925identical syntax.  This is a great boon to those working with
20926cross-platform projects.
20927
20928For those adding visibility support to existing code, you may find
20929@samp{#pragma GCC visibility} of use.  This works by you enclosing
20930the declarations you wish to set visibility for with (for example)
20931@samp{#pragma GCC visibility push(hidden)} and
20932@samp{#pragma GCC visibility pop}.
20933Bear in mind that symbol visibility should be viewed @strong{as
20934part of the API interface contract} and thus all new code should
20935always specify visibility when it is not the default; i.e., declarations
20936only for use within the local DSO should @strong{always} be marked explicitly
20937as hidden as so to avoid PLT indirection overheads---making this
20938abundantly clear also aids readability and self-documentation of the code.
20939Note that due to ISO C++ specification requirements, @code{operator new} and
20940@code{operator delete} must always be of default visibility.
20941
20942Be aware that headers from outside your project, in particular system
20943headers and headers from any other library you use, may not be
20944expecting to be compiled with visibility other than the default.  You
20945may need to explicitly say @samp{#pragma GCC visibility push(default)}
20946before including any such headers.
20947
20948@samp{extern} declarations are not affected by @option{-fvisibility}, so
20949a lot of code can be recompiled with @option{-fvisibility=hidden} with
20950no modifications.  However, this means that calls to @code{extern}
20951functions with no explicit visibility use the PLT, so it is more
20952effective to use @code{__attribute ((visibility))} and/or
20953@code{#pragma GCC visibility} to tell the compiler which @code{extern}
20954declarations should be treated as hidden.
20955
20956Note that @option{-fvisibility} does affect C++ vague linkage
20957entities. This means that, for instance, an exception class that is
20958be thrown between DSOs must be explicitly marked with default
20959visibility so that the @samp{type_info} nodes are unified between
20960the DSOs.
20961
20962An overview of these techniques, their benefits and how to use them
20963is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
20964
20965@item -fstrict-volatile-bitfields
20966@opindex fstrict-volatile-bitfields
20967This option should be used if accesses to volatile bit-fields (or other
20968structure fields, although the compiler usually honors those types
20969anyway) should use a single access of the width of the
20970field's type, aligned to a natural alignment if possible.  For
20971example, targets with memory-mapped peripheral registers might require
20972all such accesses to be 16 bits wide; with this flag you can
20973declare all peripheral bit-fields as @code{unsigned short} (assuming short
20974is 16 bits on these targets) to force GCC to use 16-bit accesses
20975instead of, perhaps, a more efficient 32-bit access.
20976
20977If this option is disabled, the compiler uses the most efficient
20978instruction.  In the previous example, that might be a 32-bit load
20979instruction, even though that accesses bytes that do not contain
20980any portion of the bit-field, or memory-mapped registers unrelated to
20981the one being updated.
20982
20983If the target requires strict alignment, and honoring the field
20984type would require violating this alignment, a warning is issued.
20985If the field has @code{packed} attribute, the access is done without
20986honoring the field type.  If the field doesn't have @code{packed}
20987attribute, the access is done honoring the field type.  In both cases,
20988GCC assumes that the user knows something about the target hardware
20989that it is unaware of.
20990
20991The default value of this option is determined by the application binary
20992interface for the target processor.
20993
20994@item -fsync-libcalls
20995@opindex fsync-libcalls
20996This option controls whether any out-of-line instance of the @code{__sync}
20997family of functions may be used to implement the C++11 @code{__atomic}
20998family of functions.
20999
21000The default value of this option is enabled, thus the only useful form
21001of the option is @option{-fno-sync-libcalls}.  This option is used in
21002the implementation of the @file{libatomic} runtime library.
21003
21004@end table
21005
21006@c man end
21007
21008@node Environment Variables
21009@section Environment Variables Affecting GCC
21010@cindex environment variables
21011
21012@c man begin ENVIRONMENT
21013This section describes several environment variables that affect how GCC
21014operates.  Some of them work by specifying directories or prefixes to use
21015when searching for various kinds of files.  Some are used to specify other
21016aspects of the compilation environment.
21017
21018Note that you can also specify places to search using options such as
21019@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
21020take precedence over places specified using environment variables, which
21021in turn take precedence over those specified by the configuration of GCC@.
21022@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
21023GNU Compiler Collection (GCC) Internals}.
21024
21025@table @env
21026@item LANG
21027@itemx LC_CTYPE
21028@c @itemx LC_COLLATE
21029@itemx LC_MESSAGES
21030@c @itemx LC_MONETARY
21031@c @itemx LC_NUMERIC
21032@c @itemx LC_TIME
21033@itemx LC_ALL
21034@findex LANG
21035@findex LC_CTYPE
21036@c @findex LC_COLLATE
21037@findex LC_MESSAGES
21038@c @findex LC_MONETARY
21039@c @findex LC_NUMERIC
21040@c @findex LC_TIME
21041@findex LC_ALL
21042@cindex locale
21043These environment variables control the way that GCC uses
21044localization information which allows GCC to work with different
21045national conventions.  GCC inspects the locale categories
21046@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
21047so.  These locale categories can be set to any value supported by your
21048installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
21049Kingdom encoded in UTF-8.
21050
21051The @env{LC_CTYPE} environment variable specifies character
21052classification.  GCC uses it to determine the character boundaries in
21053a string; this is needed for some multibyte encodings that contain quote
21054and escape characters that are otherwise interpreted as a string
21055end or escape.
21056
21057The @env{LC_MESSAGES} environment variable specifies the language to
21058use in diagnostic messages.
21059
21060If the @env{LC_ALL} environment variable is set, it overrides the value
21061of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
21062and @env{LC_MESSAGES} default to the value of the @env{LANG}
21063environment variable.  If none of these variables are set, GCC
21064defaults to traditional C English behavior.
21065
21066@item TMPDIR
21067@findex TMPDIR
21068If @env{TMPDIR} is set, it specifies the directory to use for temporary
21069files.  GCC uses temporary files to hold the output of one stage of
21070compilation which is to be used as input to the next stage: for example,
21071the output of the preprocessor, which is the input to the compiler
21072proper.
21073
21074@item GCC_COMPARE_DEBUG
21075@findex GCC_COMPARE_DEBUG
21076Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
21077@option{-fcompare-debug} to the compiler driver.  See the documentation
21078of this option for more details.
21079
21080@item GCC_EXEC_PREFIX
21081@findex GCC_EXEC_PREFIX
21082If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
21083names of the subprograms executed by the compiler.  No slash is added
21084when this prefix is combined with the name of a subprogram, but you can
21085specify a prefix that ends with a slash if you wish.
21086
21087If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
21088an appropriate prefix to use based on the pathname it is invoked with.
21089
21090If GCC cannot find the subprogram using the specified prefix, it
21091tries looking in the usual places for the subprogram.
21092
21093The default value of @env{GCC_EXEC_PREFIX} is
21094@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
21095the installed compiler. In many cases @var{prefix} is the value
21096of @code{prefix} when you ran the @file{configure} script.
21097
21098Other prefixes specified with @option{-B} take precedence over this prefix.
21099
21100This prefix is also used for finding files such as @file{crt0.o} that are
21101used for linking.
21102
21103In addition, the prefix is used in an unusual way in finding the
21104directories to search for header files.  For each of the standard
21105directories whose name normally begins with @samp{/usr/local/lib/gcc}
21106(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
21107replacing that beginning with the specified prefix to produce an
21108alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
21109@file{foo/bar} just before it searches the standard directory
21110@file{/usr/local/lib/bar}.
21111If a standard directory begins with the configured
21112@var{prefix} then the value of @var{prefix} is replaced by
21113@env{GCC_EXEC_PREFIX} when looking for header files.
21114
21115@item COMPILER_PATH
21116@findex COMPILER_PATH
21117The value of @env{COMPILER_PATH} is a colon-separated list of
21118directories, much like @env{PATH}.  GCC tries the directories thus
21119specified when searching for subprograms, if it can't find the
21120subprograms using @env{GCC_EXEC_PREFIX}.
21121
21122@item LIBRARY_PATH
21123@findex LIBRARY_PATH
21124The value of @env{LIBRARY_PATH} is a colon-separated list of
21125directories, much like @env{PATH}.  When configured as a native compiler,
21126GCC tries the directories thus specified when searching for special
21127linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
21128using GCC also uses these directories when searching for ordinary
21129libraries for the @option{-l} option (but directories specified with
21130@option{-L} come first).
21131
21132@item LANG
21133@findex LANG
21134@cindex locale definition
21135This variable is used to pass locale information to the compiler.  One way in
21136which this information is used is to determine the character set to be used
21137when character literals, string literals and comments are parsed in C and C++.
21138When the compiler is configured to allow multibyte characters,
21139the following values for @env{LANG} are recognized:
21140
21141@table @samp
21142@item C-JIS
21143Recognize JIS characters.
21144@item C-SJIS
21145Recognize SJIS characters.
21146@item C-EUCJP
21147Recognize EUCJP characters.
21148@end table
21149
21150If @env{LANG} is not defined, or if it has some other value, then the
21151compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
21152recognize and translate multibyte characters.
21153@end table
21154
21155@noindent
21156Some additional environment variables affect the behavior of the
21157preprocessor.
21158
21159@include cppenv.texi
21160
21161@c man end
21162
21163@node Precompiled Headers
21164@section Using Precompiled Headers
21165@cindex precompiled headers
21166@cindex speed of compilation
21167
21168Often large projects have many header files that are included in every
21169source file.  The time the compiler takes to process these header files
21170over and over again can account for nearly all of the time required to
21171build the project.  To make builds faster, GCC allows you to
21172@dfn{precompile} a header file.
21173
21174To create a precompiled header file, simply compile it as you would any
21175other file, if necessary using the @option{-x} option to make the driver
21176treat it as a C or C++ header file.  You may want to use a
21177tool like @command{make} to keep the precompiled header up-to-date when
21178the headers it contains change.
21179
21180A precompiled header file is searched for when @code{#include} is
21181seen in the compilation.  As it searches for the included file
21182(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
21183compiler looks for a precompiled header in each directory just before it
21184looks for the include file in that directory.  The name searched for is
21185the name specified in the @code{#include} with @samp{.gch} appended.  If
21186the precompiled header file can't be used, it is ignored.
21187
21188For instance, if you have @code{#include "all.h"}, and you have
21189@file{all.h.gch} in the same directory as @file{all.h}, then the
21190precompiled header file is used if possible, and the original
21191header is used otherwise.
21192
21193Alternatively, you might decide to put the precompiled header file in a
21194directory and use @option{-I} to ensure that directory is searched
21195before (or instead of) the directory containing the original header.
21196Then, if you want to check that the precompiled header file is always
21197used, you can put a file of the same name as the original header in this
21198directory containing an @code{#error} command.
21199
21200This also works with @option{-include}.  So yet another way to use
21201precompiled headers, good for projects not designed with precompiled
21202header files in mind, is to simply take most of the header files used by
21203a project, include them from another header file, precompile that header
21204file, and @option{-include} the precompiled header.  If the header files
21205have guards against multiple inclusion, they are skipped because
21206they've already been included (in the precompiled header).
21207
21208If you need to precompile the same header file for different
21209languages, targets, or compiler options, you can instead make a
21210@emph{directory} named like @file{all.h.gch}, and put each precompiled
21211header in the directory, perhaps using @option{-o}.  It doesn't matter
21212what you call the files in the directory; every precompiled header in
21213the directory is considered.  The first precompiled header
21214encountered in the directory that is valid for this compilation is
21215used; they're searched in no particular order.
21216
21217There are many other possibilities, limited only by your imagination,
21218good sense, and the constraints of your build system.
21219
21220A precompiled header file can be used only when these conditions apply:
21221
21222@itemize
21223@item
21224Only one precompiled header can be used in a particular compilation.
21225
21226@item
21227A precompiled header can't be used once the first C token is seen.  You
21228can have preprocessor directives before a precompiled header; you cannot
21229include a precompiled header from inside another header.
21230
21231@item
21232The precompiled header file must be produced for the same language as
21233the current compilation.  You can't use a C precompiled header for a C++
21234compilation.
21235
21236@item
21237The precompiled header file must have been produced by the same compiler
21238binary as the current compilation is using.
21239
21240@item
21241Any macros defined before the precompiled header is included must
21242either be defined in the same way as when the precompiled header was
21243generated, or must not affect the precompiled header, which usually
21244means that they don't appear in the precompiled header at all.
21245
21246The @option{-D} option is one way to define a macro before a
21247precompiled header is included; using a @code{#define} can also do it.
21248There are also some options that define macros implicitly, like
21249@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
21250defined this way.
21251
21252@item If debugging information is output when using the precompiled
21253header, using @option{-g} or similar, the same kind of debugging information
21254must have been output when building the precompiled header.  However,
21255a precompiled header built using @option{-g} can be used in a compilation
21256when no debugging information is being output.
21257
21258@item The same @option{-m} options must generally be used when building
21259and using the precompiled header.  @xref{Submodel Options},
21260for any cases where this rule is relaxed.
21261
21262@item Each of the following options must be the same when building and using
21263the precompiled header:
21264
21265@gccoptlist{-fexceptions}
21266
21267@item
21268Some other command-line options starting with @option{-f},
21269@option{-p}, or @option{-O} must be defined in the same way as when
21270the precompiled header was generated.  At present, it's not clear
21271which options are safe to change and which are not; the safest choice
21272is to use exactly the same options when generating and using the
21273precompiled header.  The following are known to be safe:
21274
21275@gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
21276-fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
21277-fsched-verbose=@var{number}  -fschedule-insns  -fvisibility= @gol
21278-pedantic-errors}
21279
21280@end itemize
21281
21282For all of these except the last, the compiler automatically
21283ignores the precompiled header if the conditions aren't met.  If you
21284find an option combination that doesn't work and doesn't cause the
21285precompiled header to be ignored, please consider filing a bug report,
21286see @ref{Bugs}.
21287
21288If you do use differing options when generating and using the
21289precompiled header, the actual behavior is a mixture of the
21290behavior for the options.  For instance, if you use @option{-g} to
21291generate the precompiled header but not when using it, you may or may
21292not get debugging information for routines in the precompiled header.
21293