]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
config.gcc: Handle --enable-fdpic.
[thirdparty/gcc.git] / gcc / doc / invoke.texi
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
11 Copyright @copyright{} 1988-2015 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included 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
35 gcc [@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
43 Only the most useful options are listed here; see below for the
44 remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
49 and 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
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for 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
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
75
76 Other options are passed on to one stage of processing. Some options
77 control the preprocessor and others the compiler itself. Yet other
78 options control the assembler and linker; most of these are not
79 documented here, since you rarely need to use any of them.
80
81 @cindex C compilation options
82 Most of the command-line options that you can use with GCC are useful
83 for C programs; when an option is only useful with another language
84 (usually C++), the explanation says so explicitly. If the description
85 for a particular option does not mention a source language, you can use
86 that option with all supported languages.
87
88 @cindex C++ compilation options
89 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
90 options for compiling C++ programs.
91
92 @cindex grouping options
93 @cindex options, grouping
94 The @command{gcc} program accepts options and file names as operands. Many
95 options have multi-letter names; therefore multiple single-letter options
96 may @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
101 You can mix options and other arguments. For the most part, the order
102 you use doesn't matter. Order does matter when you use several
103 options of the same kind; for example, if you specify @option{-L} more
104 than once, the directories are searched in the order specified. Also,
105 the placement of the @option{-l} option is significant.
106
107 Many 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
110 these have both positive and negative forms; the negative form of
111 @option{-ffoo} is @option{-fno-foo}. This manual documents
112 only 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 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
129 be 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
154 Here is a summary of all the options, grouped by type. Explanations are
155 in 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 -fopenacc -fopenmp -fopenmp-simd @gol
172 -fms-extensions -fplan9-extensions -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 -fsized-deallocation @gol
191 -fstats -ftemplate-backtrace-limit=@var{n} @gol
192 -ftemplate-depth=@var{n} @gol
193 -fno-threadsafe-statics -fuse-cxa-atexit @gol
194 -fno-weak -nostdinc++ @gol
195 -fvisibility-inlines-hidden @gol
196 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
197 -fvtv-counts -fvtv-debug @gol
198 -fvisibility-ms-compat @gol
199 -fext-numeric-literals @gol
200 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
201 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
202 -Wnamespaces -Wnarrowing @gol
203 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
204 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
205 -Wno-non-template-friend -Wold-style-cast @gol
206 -Woverloaded-virtual -Wno-pmf-conversions @gol
207 -Wsign-promo -Wvirtual-inheritance}
208
209 @item Objective-C and Objective-C++ Language Options
210 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
211 Objective-C and Objective-C++ Dialects}.
212 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
213 -fgnu-runtime -fnext-runtime @gol
214 -fno-nil-receivers @gol
215 -fobjc-abi-version=@var{n} @gol
216 -fobjc-call-cxx-cdtors @gol
217 -fobjc-direct-dispatch @gol
218 -fobjc-exceptions @gol
219 -fobjc-gc @gol
220 -fobjc-nilcheck @gol
221 -fobjc-std=objc1 @gol
222 -fno-local-ivars @gol
223 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
224 -freplace-objc-classes @gol
225 -fzero-link @gol
226 -gen-decls @gol
227 -Wassign-intercept @gol
228 -Wno-protocol -Wselector @gol
229 -Wstrict-selector-match @gol
230 -Wundeclared-selector}
231
232 @item Diagnostic Message Formatting Options
233 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
234 @gccoptlist{-fmessage-length=@var{n} @gol
235 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
236 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
237 -fno-diagnostics-show-option -fno-diagnostics-show-caret}
238
239 @item Warning Options
240 @xref{Warning Options,,Options to Request or Suppress Warnings}.
241 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
242 -pedantic-errors @gol
243 -w -Wextra -Wall -Waddress -Waggregate-return @gol
244 -Waggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
245 -Wbool-compare -Wduplicated-cond -Wframe-address @gol
246 -Wno-attributes -Wno-builtin-macro-redefined @gol
247 -Wc90-c99-compat -Wc99-c11-compat @gol
248 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
249 -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
250 -Wconversion -Wcoverage-mismatch -Wdate-time -Wdelete-incomplete -Wno-cpp @gol
251 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
252 -Wdisabled-optimization @gol
253 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
254 -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
255 -Wno-endif-labels -Werror -Werror=* @gol
256 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
257 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
258 -Wformat-security -Wformat-signedness -Wformat-y2k @gol
259 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
260 -Wignored-qualifiers -Wincompatible-pointer-types @gol
261 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
262 -Winit-self -Winline -Wno-int-conversion @gol
263 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
264 -Wnull-dereference @gol
265 -Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
266 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
267 -Wmain -Wmaybe-uninitialized -Wmemset-transposed-args @gol
268 -Wmisleading-indentation -Wmissing-braces @gol
269 -Wmissing-field-initializers -Wmissing-include-dirs @gol
270 -Wno-multichar -Wnonnull -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
271 -Wodr -Wno-overflow -Wopenmp-simd @gol
272 -Woverride-init-side-effects @gol
273 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
274 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
275 -Wpointer-arith -Wno-pointer-to-int-cast @gol
276 -Wredundant-decls -Wno-return-local-addr @gol
277 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
278 -Wshift-overflow -Wshift-overflow=@var{n} @gol
279 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
280 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
281 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
282 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
283 -Wstrict-aliasing=n @gol -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
284 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
285 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
286 -Wmissing-format-attribute -Wsubobject-linkage @gol
287 -Wswitch -Wswitch-default -Wswitch-enum -Wswitch-bool -Wsync-nand @gol
288 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
289 -Wtype-limits -Wundef @gol
290 -Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol
291 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
292 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
293 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
294 -Wunused-const-variable @gol
295 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
296 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
297 -Wvla -Wvolatile-register-var -Wwrite-strings @gol
298 -Wzero-as-null-pointer-constant}
299
300 @item C and Objective-C-only Warning Options
301 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
302 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
303 -Wold-style-declaration -Wold-style-definition @gol
304 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
305 -Wdeclaration-after-statement -Wpointer-sign}
306
307 @item Debugging Options
308 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
309 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
310 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
311 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
312 -fsanitize-undefined-trap-on-error @gol
313 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
314 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
315 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
316 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
317 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
318 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
319 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
320 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
321 -fchkp-use-wrappers @gol
322 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
323 -fdisable-ipa-@var{pass_name} @gol
324 -fdisable-rtl-@var{pass_name} @gol
325 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
326 -fdisable-tree-@var{pass_name} @gol
327 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
328 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
329 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
330 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
331 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
332 -fdump-passes @gol
333 -fdump-statistics @gol
334 -fdump-tree-all @gol
335 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
336 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
337 -fdump-tree-cfg -fdump-tree-alias @gol
338 -fdump-tree-ch @gol
339 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
340 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
341 -fdump-tree-gimple@r{[}-raw@r{]} @gol
342 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
343 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
344 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
345 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
346 -fdump-tree-backprop@r{[}-@var{n}@r{]} @gol
347 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
348 -fdump-tree-nrv -fdump-tree-vect @gol
349 -fdump-tree-sink @gol
350 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
351 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
352 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
353 -fdump-tree-vtable-verify @gol
354 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
355 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
356 -fdump-final-insns=@var{file} @gol
357 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
358 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
359 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
360 -fenable-@var{kind}-@var{pass} @gol
361 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
362 -fdebug-types-section -fmem-report-wpa @gol
363 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
364 -fopt-info @gol
365 -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
366 -frandom-seed=@var{number} -fsched-verbose=@var{n} @gol
367 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
368 -fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol
369 -fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol
370 -g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
371 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
372 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
373 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
374 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
375 -fdebug-prefix-map=@var{old}=@var{new} @gol
376 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
377 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
378 -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
379 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
380 -print-prog-name=@var{program} -print-search-dirs -Q @gol
381 -print-sysroot -print-sysroot-headers-suffix @gol
382 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
383
384 @item Optimization Options
385 @xref{Optimize Options,,Options that Control Optimization}.
386 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
387 -falign-jumps[=@var{n}] @gol
388 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
389 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
390 -fauto-inc-dec -fbranch-probabilities @gol
391 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
392 -fbtr-bb-exclusive -fcaller-saves @gol
393 -fcombine-stack-adjustments -fconserve-stack @gol
394 -fcompare-elim -fcprop-registers -fcrossjumping @gol
395 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
396 -fcx-limited-range @gol
397 -fdata-sections -fdce -fdelayed-branch @gol
398 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
399 -fdevirtualize-at-ltrans -fdse @gol
400 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
401 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
402 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
403 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
404 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
405 -fif-conversion2 -findirect-inlining @gol
406 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
407 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment @gol
408 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
409 -fira-algorithm=@var{algorithm} @gol
410 -fira-region=@var{region} -fira-hoist-pressure @gol
411 -fira-loop-pressure -fno-ira-share-save-slots @gol
412 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
413 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
414 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
415 -fkeep-static-consts -flive-range-shrinkage @gol
416 -floop-block -floop-interchange -floop-strip-mine @gol
417 -floop-unroll-and-jam -floop-nest-optimize @gol
418 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
419 -flto-partition=@var{alg} -flto-report -flto-report-wpa -fmerge-all-constants @gol
420 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
421 -fmove-loop-invariants -fno-branch-count-reg @gol
422 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
423 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
424 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
425 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
426 -fomit-frame-pointer -foptimize-sibling-calls @gol
427 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
428 -fprefetch-loop-arrays -fprofile-report @gol
429 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
430 -fprofile-generate=@var{path} @gol
431 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
432 -fprofile-reorder-functions @gol
433 -freciprocal-math -free -frename-registers -freorder-blocks @gol
434 -freorder-blocks-algorithm=@var{algorithm} @gol
435 -freorder-blocks-and-partition -freorder-functions @gol
436 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
437 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
438 -fsched-spec-load -fsched-spec-load-dangerous @gol
439 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
440 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
441 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
442 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
443 -fschedule-fusion @gol
444 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
445 -fselective-scheduling -fselective-scheduling2 @gol
446 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
447 -fsemantic-interposition -fshrink-wrap -fsignaling-nans @gol
448 -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
449 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
450 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
451 -fstack-protector-explicit -fstdarg-opt -fstrict-aliasing @gol
452 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
453 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
454 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
455 -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
456 -ftree-loop-if-convert-stores -ftree-loop-im @gol
457 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
458 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
459 -ftree-loop-vectorize @gol
460 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
461 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
462 -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
463 -ftree-vectorize -ftree-vrp @gol
464 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
465 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
466 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
467 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
468 --param @var{name}=@var{value}
469 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
470
471 @item Preprocessor Options
472 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
473 @gccoptlist{-A@var{question}=@var{answer} @gol
474 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
475 -C -dD -dI -dM -dN @gol
476 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
477 -idirafter @var{dir} @gol
478 -include @var{file} -imacros @var{file} @gol
479 -iprefix @var{file} -iwithprefix @var{dir} @gol
480 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
481 -imultilib @var{dir} -isysroot @var{dir} @gol
482 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
483 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
484 -remap -trigraphs -undef -U@var{macro} @gol
485 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
486
487 @item Assembler Option
488 @xref{Assembler Options,,Passing Options to the Assembler}.
489 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
490
491 @item Linker Options
492 @xref{Link Options,,Options for Linking}.
493 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
494 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
495 -s -static -static-libgcc -static-libstdc++ @gol
496 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
497 -static-libmpx -static-libmpxwrappers @gol
498 -shared -shared-libgcc -symbolic @gol
499 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
500 -u @var{symbol} -z @var{keyword}}
501
502 @item Directory Options
503 @xref{Directory Options,,Options for Directory Search}.
504 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
505 -iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
506 --sysroot=@var{dir} --no-sysroot-suffix}
507
508 @item Machine Dependent Options
509 @xref{Submodel Options,,Hardware Models and Configurations}.
510 @c This list is ordered alphanumerically by subsection name.
511 @c Try and put the significant identifier (CPU or system) first,
512 @c so users have a clue at guessing where the ones they want will be.
513
514 @emph{AArch64 Options}
515 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
516 -mgeneral-regs-only @gol
517 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
518 -mstrict-align @gol
519 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
520 -mtls-dialect=desc -mtls-dialect=traditional @gol
521 -mtls-size=@var{size} @gol
522 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
523 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol
524 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
525
526 @emph{Adapteva Epiphany Options}
527 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
528 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
529 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
530 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
531 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
532 -msplit-vecmove-early -m1reg-@var{reg}}
533
534 @emph{ARC Options}
535 @gccoptlist{-mbarrel-shifter @gol
536 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
537 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
538 -mea -mno-mpy -mmul32x16 -mmul64 @gol
539 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
540 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
541 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
542 -mepilogue-cfi -mlong-calls -mmedium-calls -msdata @gol
543 -mucb-mcount -mvolatile-cache @gol
544 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
545 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
546 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
547 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
548 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
549 -mtune=@var{cpu} -mmultcost=@var{num} -munalign-prob-threshold=@var{probability}}
550
551 @emph{ARM Options}
552 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
553 -mabi=@var{name} @gol
554 -mapcs-stack-check -mno-apcs-stack-check @gol
555 -mapcs-float -mno-apcs-float @gol
556 -mapcs-reentrant -mno-apcs-reentrant @gol
557 -msched-prolog -mno-sched-prolog @gol
558 -mlittle-endian -mbig-endian @gol
559 -mfloat-abi=@var{name} @gol
560 -mfp16-format=@var{name}
561 -mthumb-interwork -mno-thumb-interwork @gol
562 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
563 -mtune=@var{name} -mprint-tune-info @gol
564 -mstructure-size-boundary=@var{n} @gol
565 -mabort-on-noreturn @gol
566 -mlong-calls -mno-long-calls @gol
567 -msingle-pic-base -mno-single-pic-base @gol
568 -mpic-register=@var{reg} @gol
569 -mnop-fun-dllimport @gol
570 -mpoke-function-name @gol
571 -mthumb -marm @gol
572 -mtpcs-frame -mtpcs-leaf-frame @gol
573 -mcaller-super-interworking -mcallee-super-interworking @gol
574 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
575 -mword-relocations @gol
576 -mfix-cortex-m3-ldrd @gol
577 -munaligned-access @gol
578 -mneon-for-64bits @gol
579 -mslow-flash-data @gol
580 -masm-syntax-unified @gol
581 -mrestrict-it}
582
583 @emph{AVR Options}
584 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
585 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
586 -mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert}
587
588 @emph{Blackfin Options}
589 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
590 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
591 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
592 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
593 -mno-id-shared-library -mshared-library-id=@var{n} @gol
594 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
595 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
596 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
597 -micplb}
598
599 @emph{C6X Options}
600 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
601 -msim -msdata=@var{sdata-type}}
602
603 @emph{CRIS Options}
604 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
605 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
606 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
607 -mstack-align -mdata-align -mconst-align @gol
608 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
609 -melf -maout -melinux -mlinux -sim -sim2 @gol
610 -mmul-bug-workaround -mno-mul-bug-workaround}
611
612 @emph{CR16 Options}
613 @gccoptlist{-mmac @gol
614 -mcr16cplus -mcr16c @gol
615 -msim -mint32 -mbit-ops
616 -mdata-model=@var{model}}
617
618 @emph{Darwin Options}
619 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
620 -arch_only -bind_at_load -bundle -bundle_loader @gol
621 -client_name -compatibility_version -current_version @gol
622 -dead_strip @gol
623 -dependency-file -dylib_file -dylinker_install_name @gol
624 -dynamic -dynamiclib -exported_symbols_list @gol
625 -filelist -flat_namespace -force_cpusubtype_ALL @gol
626 -force_flat_namespace -headerpad_max_install_names @gol
627 -iframework @gol
628 -image_base -init -install_name -keep_private_externs @gol
629 -multi_module -multiply_defined -multiply_defined_unused @gol
630 -noall_load -no_dead_strip_inits_and_terms @gol
631 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
632 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
633 -private_bundle -read_only_relocs -sectalign @gol
634 -sectobjectsymbols -whyload -seg1addr @gol
635 -sectcreate -sectobjectsymbols -sectorder @gol
636 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
637 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
638 -segprot -segs_read_only_addr -segs_read_write_addr @gol
639 -single_module -static -sub_library -sub_umbrella @gol
640 -twolevel_namespace -umbrella -undefined @gol
641 -unexported_symbols_list -weak_reference_mismatches @gol
642 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
643 -mkernel -mone-byte-bool}
644
645 @emph{DEC Alpha Options}
646 @gccoptlist{-mno-fp-regs -msoft-float @gol
647 -mieee -mieee-with-inexact -mieee-conformant @gol
648 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
649 -mtrap-precision=@var{mode} -mbuild-constants @gol
650 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
651 -mbwx -mmax -mfix -mcix @gol
652 -mfloat-vax -mfloat-ieee @gol
653 -mexplicit-relocs -msmall-data -mlarge-data @gol
654 -msmall-text -mlarge-text @gol
655 -mmemory-latency=@var{time}}
656
657 @emph{FR30 Options}
658 @gccoptlist{-msmall-model -mno-lsim}
659
660 @emph{FT32 Options}
661 @gccoptlist{-msim -mlra}
662
663 @emph{FRV Options}
664 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
665 -mhard-float -msoft-float @gol
666 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
667 -mdouble -mno-double @gol
668 -mmedia -mno-media -mmuladd -mno-muladd @gol
669 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
670 -mlinked-fp -mlong-calls -malign-labels @gol
671 -mlibrary-pic -macc-4 -macc-8 @gol
672 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
673 -moptimize-membar -mno-optimize-membar @gol
674 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
675 -mvliw-branch -mno-vliw-branch @gol
676 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
677 -mno-nested-cond-exec -mtomcat-stats @gol
678 -mTLS -mtls @gol
679 -mcpu=@var{cpu}}
680
681 @emph{GNU/Linux Options}
682 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
683 -tno-android-cc -tno-android-ld}
684
685 @emph{H8/300 Options}
686 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
687
688 @emph{HPPA Options}
689 @gccoptlist{-march=@var{architecture-type} @gol
690 -mdisable-fpregs -mdisable-indexing @gol
691 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
692 -mfixed-range=@var{register-range} @gol
693 -mjump-in-delay -mlinker-opt -mlong-calls @gol
694 -mlong-load-store -mno-disable-fpregs @gol
695 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
696 -mno-jump-in-delay -mno-long-load-store @gol
697 -mno-portable-runtime -mno-soft-float @gol
698 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
699 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
700 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
701 -munix=@var{unix-std} -nolibdld -static -threads}
702
703 @emph{IA-64 Options}
704 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
705 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
706 -mconstant-gp -mauto-pic -mfused-madd @gol
707 -minline-float-divide-min-latency @gol
708 -minline-float-divide-max-throughput @gol
709 -mno-inline-float-divide @gol
710 -minline-int-divide-min-latency @gol
711 -minline-int-divide-max-throughput @gol
712 -mno-inline-int-divide @gol
713 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
714 -mno-inline-sqrt @gol
715 -mdwarf2-asm -mearly-stop-bits @gol
716 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
717 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
718 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
719 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
720 -msched-spec-ldc -msched-spec-control-ldc @gol
721 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
722 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
723 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
724 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
725
726 @emph{LM32 Options}
727 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
728 -msign-extend-enabled -muser-enabled}
729
730 @emph{M32R/D Options}
731 @gccoptlist{-m32r2 -m32rx -m32r @gol
732 -mdebug @gol
733 -malign-loops -mno-align-loops @gol
734 -missue-rate=@var{number} @gol
735 -mbranch-cost=@var{number} @gol
736 -mmodel=@var{code-size-model-type} @gol
737 -msdata=@var{sdata-type} @gol
738 -mno-flush-func -mflush-func=@var{name} @gol
739 -mno-flush-trap -mflush-trap=@var{number} @gol
740 -G @var{num}}
741
742 @emph{M32C Options}
743 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
744
745 @emph{M680x0 Options}
746 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
747 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
748 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
749 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
750 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
751 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
752 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
753 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
754 -mxgot -mno-xgot}
755
756 @emph{MCore Options}
757 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
758 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
759 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
760 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
761 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
762
763 @emph{MeP Options}
764 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
765 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
766 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
767 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
768 -mtiny=@var{n}}
769
770 @emph{MicroBlaze Options}
771 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
772 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
773 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
774 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
775 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
776
777 @emph{MIPS Options}
778 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
779 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
780 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
781 -mips16 -mno-mips16 -mflip-mips16 @gol
782 -minterlink-compressed -mno-interlink-compressed @gol
783 -minterlink-mips16 -mno-interlink-mips16 @gol
784 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
785 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
786 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
787 -mno-float -msingle-float -mdouble-float @gol
788 -modd-spreg -mno-odd-spreg @gol
789 -mcompact-branches=@var{policy} @gol
790 -mabs=@var{mode} -mnan=@var{encoding} @gol
791 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
792 -mmcu -mmno-mcu @gol
793 -meva -mno-eva @gol
794 -mvirt -mno-virt @gol
795 -mxpa -mno-xpa @gol
796 -mmicromips -mno-micromips @gol
797 -mfpu=@var{fpu-type} @gol
798 -msmartmips -mno-smartmips @gol
799 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
800 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
801 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
802 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
803 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
804 -membedded-data -mno-embedded-data @gol
805 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
806 -mcode-readable=@var{setting} @gol
807 -msplit-addresses -mno-split-addresses @gol
808 -mexplicit-relocs -mno-explicit-relocs @gol
809 -mcheck-zero-division -mno-check-zero-division @gol
810 -mdivide-traps -mdivide-breaks @gol
811 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
812 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
813 -mfix-24k -mno-fix-24k @gol
814 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
815 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
816 -mfix-vr4120 -mno-fix-vr4120 @gol
817 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
818 -mflush-func=@var{func} -mno-flush-func @gol
819 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
820 -mfp-exceptions -mno-fp-exceptions @gol
821 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
822 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
823 -mframe-header-opt -mno-frame-header-opt}
824
825 @emph{MMIX Options}
826 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
827 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
828 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
829 -mno-base-addresses -msingle-exit -mno-single-exit}
830
831 @emph{MN10300 Options}
832 @gccoptlist{-mmult-bug -mno-mult-bug @gol
833 -mno-am33 -mam33 -mam33-2 -mam34 @gol
834 -mtune=@var{cpu-type} @gol
835 -mreturn-pointer-on-d0 @gol
836 -mno-crt0 -mrelax -mliw -msetlb}
837
838 @emph{Moxie Options}
839 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
840
841 @emph{MSP430 Options}
842 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
843 -mcode-region= -mdata-region= @gol
844 -msilicon-errata= -msilicon-errata-warn= @gol
845 -mhwmult= -minrt}
846
847 @emph{NDS32 Options}
848 @gccoptlist{-mbig-endian -mlittle-endian @gol
849 -mreduced-regs -mfull-regs @gol
850 -mcmov -mno-cmov @gol
851 -mperf-ext -mno-perf-ext @gol
852 -mv3push -mno-v3push @gol
853 -m16bit -mno-16bit @gol
854 -misr-vector-size=@var{num} @gol
855 -mcache-block-size=@var{num} @gol
856 -march=@var{arch} @gol
857 -mcmodel=@var{code-model} @gol
858 -mctor-dtor -mrelax}
859
860 @emph{Nios II Options}
861 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
862 -mel -meb @gol
863 -mno-bypass-cache -mbypass-cache @gol
864 -mno-cache-volatile -mcache-volatile @gol
865 -mno-fast-sw-div -mfast-sw-div @gol
866 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
867 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
868 -mcustom-fpu-cfg=@var{name} @gol
869 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
870 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
871
872 @emph{Nvidia PTX Options}
873 @gccoptlist{-m32 -m64 -mmainkernel}
874
875 @emph{PDP-11 Options}
876 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
877 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
878 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
879 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
880 -mbranch-expensive -mbranch-cheap @gol
881 -munix-asm -mdec-asm}
882
883 @emph{picoChip Options}
884 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
885 -msymbol-as-address -mno-inefficient-warnings}
886
887 @emph{PowerPC Options}
888 See RS/6000 and PowerPC Options.
889
890 @emph{RL78 Options}
891 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
892 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
893 -m64bit-doubles -m32bit-doubles}
894
895 @emph{RS/6000 and PowerPC Options}
896 @gccoptlist{-mcpu=@var{cpu-type} @gol
897 -mtune=@var{cpu-type} @gol
898 -mcmodel=@var{code-model} @gol
899 -mpowerpc64 @gol
900 -maltivec -mno-altivec @gol
901 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
902 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
903 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
904 -mfprnd -mno-fprnd @gol
905 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
906 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
907 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
908 -malign-power -malign-natural @gol
909 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
910 -msingle-float -mdouble-float -msimple-fpu @gol
911 -mstring -mno-string -mupdate -mno-update @gol
912 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
913 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
914 -mstrict-align -mno-strict-align -mrelocatable @gol
915 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
916 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
917 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
918 -mprioritize-restricted-insns=@var{priority} @gol
919 -msched-costly-dep=@var{dependence_type} @gol
920 -minsert-sched-nops=@var{scheme} @gol
921 -mcall-sysv -mcall-netbsd @gol
922 -maix-struct-return -msvr4-struct-return @gol
923 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
924 -mblock-move-inline-limit=@var{num} @gol
925 -misel -mno-isel @gol
926 -misel=yes -misel=no @gol
927 -mspe -mno-spe @gol
928 -mspe=yes -mspe=no @gol
929 -mpaired @gol
930 -mgen-cell-microcode -mwarn-cell-microcode @gol
931 -mvrsave -mno-vrsave @gol
932 -mmulhw -mno-mulhw @gol
933 -mdlmzb -mno-dlmzb @gol
934 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
935 -mprototype -mno-prototype @gol
936 -msim -mmvme -mads -myellowknife -memb -msdata @gol
937 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
938 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
939 -mno-recip-precision @gol
940 -mveclibabi=@var{type} -mfriz -mno-friz @gol
941 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
942 -msave-toc-indirect -mno-save-toc-indirect @gol
943 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
944 -mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol
945 -mquad-memory -mno-quad-memory @gol
946 -mquad-memory-atomic -mno-quad-memory-atomic @gol
947 -mcompat-align-parm -mno-compat-align-parm @gol
948 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
949 -mupper-regs -mno-upper-regs}
950
951 @emph{RX Options}
952 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
953 -mcpu=@gol
954 -mbig-endian-data -mlittle-endian-data @gol
955 -msmall-data @gol
956 -msim -mno-sim@gol
957 -mas100-syntax -mno-as100-syntax@gol
958 -mrelax@gol
959 -mmax-constant-size=@gol
960 -mint-register=@gol
961 -mpid@gol
962 -mallow-string-insns -mno-allow-string-insns@gol
963 -mno-warn-multiple-fast-interrupts@gol
964 -msave-acc-in-interrupts}
965
966 @emph{S/390 and zSeries Options}
967 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
968 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
969 -mlong-double-64 -mlong-double-128 @gol
970 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
971 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
972 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
973 -mhtm -mvx -mzvector @gol
974 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
975 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
976 -mhotpatch=@var{halfwords},@var{halfwords}}
977
978 @emph{Score Options}
979 @gccoptlist{-meb -mel @gol
980 -mnhwloop @gol
981 -muls @gol
982 -mmac @gol
983 -mscore5 -mscore5u -mscore7 -mscore7d}
984
985 @emph{SH Options}
986 @gccoptlist{-m1 -m2 -m2e @gol
987 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
988 -m3 -m3e @gol
989 -m4-nofpu -m4-single-only -m4-single -m4 @gol
990 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
991 -mb -ml -mdalign -mrelax @gol
992 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
993 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
994 -mspace -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
995 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
996 -maccumulate-outgoing-args @gol
997 -matomic-model=@var{atomic-model} @gol
998 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
999 -mcbranch-force-delay-slot @gol
1000 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1001 -mpretend-cmove -mtas}
1002
1003 @emph{Solaris 2 Options}
1004 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1005 -pthreads -pthread}
1006
1007 @emph{SPARC Options}
1008 @gccoptlist{-mcpu=@var{cpu-type} @gol
1009 -mtune=@var{cpu-type} @gol
1010 -mcmodel=@var{code-model} @gol
1011 -mmemory-model=@var{mem-model} @gol
1012 -m32 -m64 -mapp-regs -mno-app-regs @gol
1013 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1014 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1015 -mhard-quad-float -msoft-quad-float @gol
1016 -mstack-bias -mno-stack-bias @gol
1017 -munaligned-doubles -mno-unaligned-doubles @gol
1018 -muser-mode -mno-user-mode @gol
1019 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1020 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1021 -mcbcond -mno-cbcond @gol
1022 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
1023 -mfix-at697f -mfix-ut699}
1024
1025 @emph{SPU Options}
1026 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1027 -msafe-dma -munsafe-dma @gol
1028 -mbranch-hints @gol
1029 -msmall-mem -mlarge-mem -mstdmain @gol
1030 -mfixed-range=@var{register-range} @gol
1031 -mea32 -mea64 @gol
1032 -maddress-space-conversion -mno-address-space-conversion @gol
1033 -mcache-size=@var{cache-size} @gol
1034 -matomic-updates -mno-atomic-updates}
1035
1036 @emph{System V Options}
1037 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1038
1039 @emph{TILE-Gx Options}
1040 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1041 -mcmodel=@var{code-model}}
1042
1043 @emph{TILEPro Options}
1044 @gccoptlist{-mcpu=@var{cpu} -m32}
1045
1046 @emph{V850 Options}
1047 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1048 -mprolog-function -mno-prolog-function -mspace @gol
1049 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1050 -mapp-regs -mno-app-regs @gol
1051 -mdisable-callt -mno-disable-callt @gol
1052 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1053 -mv850e -mv850 -mv850e3v5 @gol
1054 -mloop @gol
1055 -mrelax @gol
1056 -mlong-jumps @gol
1057 -msoft-float @gol
1058 -mhard-float @gol
1059 -mgcc-abi @gol
1060 -mrh850-abi @gol
1061 -mbig-switch}
1062
1063 @emph{VAX Options}
1064 @gccoptlist{-mg -mgnu -munix}
1065
1066 @emph{Visium Options}
1067 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1068 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1069
1070 @emph{VMS Options}
1071 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1072 -mpointer-size=@var{size}}
1073
1074 @emph{VxWorks Options}
1075 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1076 -Xbind-lazy -Xbind-now}
1077
1078 @emph{x86 Options}
1079 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1080 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1081 -mfpmath=@var{unit} @gol
1082 -masm=@var{dialect} -mno-fancy-math-387 @gol
1083 -mno-fp-ret-in-387 -msoft-float @gol
1084 -mno-wide-multiply -mrtd -malign-double @gol
1085 -mpreferred-stack-boundary=@var{num} @gol
1086 -mincoming-stack-boundary=@var{num} @gol
1087 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1088 -mrecip -mrecip=@var{opt} @gol
1089 -mvzeroupper -mprefer-avx128 @gol
1090 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1091 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1092 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1093 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1094 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1095 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
1096 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mthreads @gol
1097 -mno-align-stringops -minline-all-stringops @gol
1098 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1099 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1100 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1101 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1102 -mregparm=@var{num} -msseregparm @gol
1103 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1104 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1105 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1106 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1107 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1108 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1109 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1110 -malign-data=@var{type} -mstack-protector-guard=@var{guard}}
1111
1112 @emph{x86 Windows Options}
1113 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1114 -mnop-fun-dllimport -mthread @gol
1115 -municode -mwin32 -mwindows -fno-set-stack-executable}
1116
1117 @emph{Xstormy16 Options}
1118 @gccoptlist{-msim}
1119
1120 @emph{Xtensa Options}
1121 @gccoptlist{-mconst16 -mno-const16 @gol
1122 -mfused-madd -mno-fused-madd @gol
1123 -mforce-no-pic @gol
1124 -mserialize-volatile -mno-serialize-volatile @gol
1125 -mtext-section-literals -mno-text-section-literals @gol
1126 -mauto-litpools -mno-auto-litpools @gol
1127 -mtarget-align -mno-target-align @gol
1128 -mlongcalls -mno-longcalls}
1129
1130 @emph{zSeries Options}
1131 See S/390 and zSeries Options.
1132
1133 @item Code Generation Options
1134 @xref{Code Gen Options,,Options for Code Generation Conventions}.
1135 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
1136 -ffixed-@var{reg} -fexceptions @gol
1137 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
1138 -fasynchronous-unwind-tables @gol
1139 -fno-gnu-unique @gol
1140 -finhibit-size-directive -finstrument-functions @gol
1141 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
1142 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
1143 -fno-common -fno-ident @gol
1144 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
1145 -fno-jump-tables @gol
1146 -frecord-gcc-switches @gol
1147 -freg-struct-return -fshort-enums @gol
1148 -fshort-double -fshort-wchar @gol
1149 -fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
1150 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
1151 -fno-stack-limit -fsplit-stack @gol
1152 -fleading-underscore -ftls-model=@var{model} @gol
1153 -fstack-reuse=@var{reuse_level} @gol
1154 -ftrapv -fwrapv -fbounds-check @gol
1155 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
1156 -fstrict-volatile-bitfields -fsync-libcalls}
1157 @end table
1158
1159
1160 @node Overall Options
1161 @section Options Controlling the Kind of Output
1162
1163 Compilation can involve up to four stages: preprocessing, compilation
1164 proper, assembly and linking, always in that order. GCC is capable of
1165 preprocessing and compiling several files either into several
1166 assembler input files, or into one assembler input file; then each
1167 assembler input file produces an object file, and linking combines all
1168 the object files (those newly compiled, and those specified as input)
1169 into an executable file.
1170
1171 @cindex file name suffix
1172 For any given input file, the file name suffix determines what kind of
1173 compilation is done:
1174
1175 @table @gcctabopt
1176 @item @var{file}.c
1177 C source code that must be preprocessed.
1178
1179 @item @var{file}.i
1180 C source code that should not be preprocessed.
1181
1182 @item @var{file}.ii
1183 C++ source code that should not be preprocessed.
1184
1185 @item @var{file}.m
1186 Objective-C source code. Note that you must link with the @file{libobjc}
1187 library to make an Objective-C program work.
1188
1189 @item @var{file}.mi
1190 Objective-C source code that should not be preprocessed.
1191
1192 @item @var{file}.mm
1193 @itemx @var{file}.M
1194 Objective-C++ source code. Note that you must link with the @file{libobjc}
1195 library to make an Objective-C++ program work. Note that @samp{.M} refers
1196 to a literal capital M@.
1197
1198 @item @var{file}.mii
1199 Objective-C++ source code that should not be preprocessed.
1200
1201 @item @var{file}.h
1202 C, C++, Objective-C or Objective-C++ header file to be turned into a
1203 precompiled header (default), or C, C++ header file to be turned into an
1204 Ada spec (via the @option{-fdump-ada-spec} switch).
1205
1206 @item @var{file}.cc
1207 @itemx @var{file}.cp
1208 @itemx @var{file}.cxx
1209 @itemx @var{file}.cpp
1210 @itemx @var{file}.CPP
1211 @itemx @var{file}.c++
1212 @itemx @var{file}.C
1213 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1214 the last two letters must both be literally @samp{x}. Likewise,
1215 @samp{.C} refers to a literal capital C@.
1216
1217 @item @var{file}.mm
1218 @itemx @var{file}.M
1219 Objective-C++ source code that must be preprocessed.
1220
1221 @item @var{file}.mii
1222 Objective-C++ source code that should not be preprocessed.
1223
1224 @item @var{file}.hh
1225 @itemx @var{file}.H
1226 @itemx @var{file}.hp
1227 @itemx @var{file}.hxx
1228 @itemx @var{file}.hpp
1229 @itemx @var{file}.HPP
1230 @itemx @var{file}.h++
1231 @itemx @var{file}.tcc
1232 C++ header file to be turned into a precompiled header or Ada spec.
1233
1234 @item @var{file}.f
1235 @itemx @var{file}.for
1236 @itemx @var{file}.ftn
1237 Fixed form Fortran source code that should not be preprocessed.
1238
1239 @item @var{file}.F
1240 @itemx @var{file}.FOR
1241 @itemx @var{file}.fpp
1242 @itemx @var{file}.FPP
1243 @itemx @var{file}.FTN
1244 Fixed form Fortran source code that must be preprocessed (with the traditional
1245 preprocessor).
1246
1247 @item @var{file}.f90
1248 @itemx @var{file}.f95
1249 @itemx @var{file}.f03
1250 @itemx @var{file}.f08
1251 Free form Fortran source code that should not be preprocessed.
1252
1253 @item @var{file}.F90
1254 @itemx @var{file}.F95
1255 @itemx @var{file}.F03
1256 @itemx @var{file}.F08
1257 Free form Fortran source code that must be preprocessed (with the
1258 traditional preprocessor).
1259
1260 @item @var{file}.go
1261 Go source code.
1262
1263 @c FIXME: Descriptions of Java file types.
1264 @c @var{file}.java
1265 @c @var{file}.class
1266 @c @var{file}.zip
1267 @c @var{file}.jar
1268
1269 @item @var{file}.ads
1270 Ada source code file that contains a library unit declaration (a
1271 declaration of a package, subprogram, or generic, or a generic
1272 instantiation), or a library unit renaming declaration (a package,
1273 generic, or subprogram renaming declaration). Such files are also
1274 called @dfn{specs}.
1275
1276 @item @var{file}.adb
1277 Ada source code file containing a library unit body (a subprogram or
1278 package body). Such files are also called @dfn{bodies}.
1279
1280 @c GCC also knows about some suffixes for languages not yet included:
1281 @c Pascal:
1282 @c @var{file}.p
1283 @c @var{file}.pas
1284 @c Ratfor:
1285 @c @var{file}.r
1286
1287 @item @var{file}.s
1288 Assembler code.
1289
1290 @item @var{file}.S
1291 @itemx @var{file}.sx
1292 Assembler code that must be preprocessed.
1293
1294 @item @var{other}
1295 An object file to be fed straight into linking.
1296 Any file name with no recognized suffix is treated this way.
1297 @end table
1298
1299 @opindex x
1300 You can specify the input language explicitly with the @option{-x} option:
1301
1302 @table @gcctabopt
1303 @item -x @var{language}
1304 Specify explicitly the @var{language} for the following input files
1305 (rather than letting the compiler choose a default based on the file
1306 name suffix). This option applies to all following input files until
1307 the next @option{-x} option. Possible values for @var{language} are:
1308 @smallexample
1309 c c-header cpp-output
1310 c++ c++-header c++-cpp-output
1311 objective-c objective-c-header objective-c-cpp-output
1312 objective-c++ objective-c++-header objective-c++-cpp-output
1313 assembler assembler-with-cpp
1314 ada
1315 f77 f77-cpp-input f95 f95-cpp-input
1316 go
1317 java
1318 @end smallexample
1319
1320 @item -x none
1321 Turn off any specification of a language, so that subsequent files are
1322 handled according to their file name suffixes (as they are if @option{-x}
1323 has not been used at all).
1324
1325 @item -pass-exit-codes
1326 @opindex pass-exit-codes
1327 Normally the @command{gcc} program exits with the code of 1 if any
1328 phase of the compiler returns a non-success return code. If you specify
1329 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1330 the numerically highest error produced by any phase returning an error
1331 indication. The C, C++, and Fortran front ends return 4 if an internal
1332 compiler error is encountered.
1333 @end table
1334
1335 If you only want some of the stages of compilation, you can use
1336 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1337 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1338 @command{gcc} is to stop. Note that some combinations (for example,
1339 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1340
1341 @table @gcctabopt
1342 @item -c
1343 @opindex c
1344 Compile or assemble the source files, but do not link. The linking
1345 stage simply is not done. The ultimate output is in the form of an
1346 object file for each source file.
1347
1348 By default, the object file name for a source file is made by replacing
1349 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1350
1351 Unrecognized input files, not requiring compilation or assembly, are
1352 ignored.
1353
1354 @item -S
1355 @opindex S
1356 Stop after the stage of compilation proper; do not assemble. The output
1357 is in the form of an assembler code file for each non-assembler input
1358 file specified.
1359
1360 By default, the assembler file name for a source file is made by
1361 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1362
1363 Input files that don't require compilation are ignored.
1364
1365 @item -E
1366 @opindex E
1367 Stop after the preprocessing stage; do not run the compiler proper. The
1368 output is in the form of preprocessed source code, which is sent to the
1369 standard output.
1370
1371 Input files that don't require preprocessing are ignored.
1372
1373 @cindex output file option
1374 @item -o @var{file}
1375 @opindex o
1376 Place output in file @var{file}. This applies to whatever
1377 sort of output is being produced, whether it be an executable file,
1378 an object file, an assembler file or preprocessed C code.
1379
1380 If @option{-o} is not specified, the default is to put an executable
1381 file in @file{a.out}, the object file for
1382 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1383 assembler file in @file{@var{source}.s}, a precompiled header file in
1384 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1385 standard output.
1386
1387 @item -v
1388 @opindex v
1389 Print (on standard error output) the commands executed to run the stages
1390 of compilation. Also print the version number of the compiler driver
1391 program and of the preprocessor and the compiler proper.
1392
1393 @item -###
1394 @opindex ###
1395 Like @option{-v} except the commands are not executed and arguments
1396 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1397 This is useful for shell scripts to capture the driver-generated command lines.
1398
1399 @item -pipe
1400 @opindex pipe
1401 Use pipes rather than temporary files for communication between the
1402 various stages of compilation. This fails to work on some systems where
1403 the assembler is unable to read from a pipe; but the GNU assembler has
1404 no trouble.
1405
1406 @item --help
1407 @opindex help
1408 Print (on the standard output) a description of the command-line options
1409 understood by @command{gcc}. If the @option{-v} option is also specified
1410 then @option{--help} is also passed on to the various processes
1411 invoked by @command{gcc}, so that they can display the command-line options
1412 they accept. If the @option{-Wextra} option has also been specified
1413 (prior to the @option{--help} option), then command-line options that
1414 have no documentation associated with them are also displayed.
1415
1416 @item --target-help
1417 @opindex target-help
1418 Print (on the standard output) a description of target-specific command-line
1419 options for each tool. For some targets extra target-specific
1420 information may also be printed.
1421
1422 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1423 Print (on the standard output) a description of the command-line
1424 options understood by the compiler that fit into all specified classes
1425 and qualifiers. These are the supported classes:
1426
1427 @table @asis
1428 @item @samp{optimizers}
1429 Display all of the optimization options supported by the
1430 compiler.
1431
1432 @item @samp{warnings}
1433 Display all of the options controlling warning messages
1434 produced by the compiler.
1435
1436 @item @samp{target}
1437 Display target-specific options. Unlike the
1438 @option{--target-help} option however, target-specific options of the
1439 linker and assembler are not displayed. This is because those
1440 tools do not currently support the extended @option{--help=} syntax.
1441
1442 @item @samp{params}
1443 Display the values recognized by the @option{--param}
1444 option.
1445
1446 @item @var{language}
1447 Display the options supported for @var{language}, where
1448 @var{language} is the name of one of the languages supported in this
1449 version of GCC@.
1450
1451 @item @samp{common}
1452 Display the options that are common to all languages.
1453 @end table
1454
1455 These are the supported qualifiers:
1456
1457 @table @asis
1458 @item @samp{undocumented}
1459 Display only those options that are undocumented.
1460
1461 @item @samp{joined}
1462 Display options taking an argument that appears after an equal
1463 sign in the same continuous piece of text, such as:
1464 @samp{--help=target}.
1465
1466 @item @samp{separate}
1467 Display options taking an argument that appears as a separate word
1468 following the original option, such as: @samp{-o output-file}.
1469 @end table
1470
1471 Thus for example to display all the undocumented target-specific
1472 switches supported by the compiler, use:
1473
1474 @smallexample
1475 --help=target,undocumented
1476 @end smallexample
1477
1478 The sense of a qualifier can be inverted by prefixing it with the
1479 @samp{^} character, so for example to display all binary warning
1480 options (i.e., ones that are either on or off and that do not take an
1481 argument) that have a description, use:
1482
1483 @smallexample
1484 --help=warnings,^joined,^undocumented
1485 @end smallexample
1486
1487 The argument to @option{--help=} should not consist solely of inverted
1488 qualifiers.
1489
1490 Combining several classes is possible, although this usually
1491 restricts the output so much that there is nothing to display. One
1492 case where it does work, however, is when one of the classes is
1493 @var{target}. For example, to display all the target-specific
1494 optimization options, use:
1495
1496 @smallexample
1497 --help=target,optimizers
1498 @end smallexample
1499
1500 The @option{--help=} option can be repeated on the command line. Each
1501 successive use displays its requested class of options, skipping
1502 those that have already been displayed.
1503
1504 If the @option{-Q} option appears on the command line before the
1505 @option{--help=} option, then the descriptive text displayed by
1506 @option{--help=} is changed. Instead of describing the displayed
1507 options, an indication is given as to whether the option is enabled,
1508 disabled or set to a specific value (assuming that the compiler
1509 knows this at the point where the @option{--help=} option is used).
1510
1511 Here is a truncated example from the ARM port of @command{gcc}:
1512
1513 @smallexample
1514 % gcc -Q -mabi=2 --help=target -c
1515 The following options are target specific:
1516 -mabi= 2
1517 -mabort-on-noreturn [disabled]
1518 -mapcs [disabled]
1519 @end smallexample
1520
1521 The output is sensitive to the effects of previous command-line
1522 options, so for example it is possible to find out which optimizations
1523 are enabled at @option{-O2} by using:
1524
1525 @smallexample
1526 -Q -O2 --help=optimizers
1527 @end smallexample
1528
1529 Alternatively you can discover which binary optimizations are enabled
1530 by @option{-O3} by using:
1531
1532 @smallexample
1533 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1534 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1535 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1536 @end smallexample
1537
1538 @item -no-canonical-prefixes
1539 @opindex no-canonical-prefixes
1540 Do not expand any symbolic links, resolve references to @samp{/../}
1541 or @samp{/./}, or make the path absolute when generating a relative
1542 prefix.
1543
1544 @item --version
1545 @opindex version
1546 Display the version number and copyrights of the invoked GCC@.
1547
1548 @item -wrapper
1549 @opindex wrapper
1550 Invoke all subcommands under a wrapper program. The name of the
1551 wrapper program and its parameters are passed as a comma separated
1552 list.
1553
1554 @smallexample
1555 gcc -c t.c -wrapper gdb,--args
1556 @end smallexample
1557
1558 @noindent
1559 This invokes all subprograms of @command{gcc} under
1560 @samp{gdb --args}, thus the invocation of @command{cc1} is
1561 @samp{gdb --args cc1 @dots{}}.
1562
1563 @item -fplugin=@var{name}.so
1564 @opindex fplugin
1565 Load the plugin code in file @var{name}.so, assumed to be a
1566 shared object to be dlopen'd by the compiler. The base name of
1567 the shared object file is used to identify the plugin for the
1568 purposes of argument parsing (See
1569 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1570 Each plugin should define the callback functions specified in the
1571 Plugins API.
1572
1573 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1574 @opindex fplugin-arg
1575 Define an argument called @var{key} with a value of @var{value}
1576 for the plugin called @var{name}.
1577
1578 @item -fdump-ada-spec@r{[}-slim@r{]}
1579 @opindex fdump-ada-spec
1580 For C and C++ source and include files, generate corresponding Ada specs.
1581 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1582 GNAT User's Guide}, which provides detailed documentation on this feature.
1583
1584 @item -fada-spec-parent=@var{unit}
1585 @opindex fada-spec-parent
1586 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1587 Ada specs as child units of parent @var{unit}.
1588
1589 @item -fdump-go-spec=@var{file}
1590 @opindex fdump-go-spec
1591 For input files in any language, generate corresponding Go
1592 declarations in @var{file}. This generates Go @code{const},
1593 @code{type}, @code{var}, and @code{func} declarations which may be a
1594 useful way to start writing a Go interface to code written in some
1595 other language.
1596
1597 @include @value{srcdir}/../libiberty/at-file.texi
1598 @end table
1599
1600 @node Invoking G++
1601 @section Compiling C++ Programs
1602
1603 @cindex suffixes for C++ source
1604 @cindex C++ source file suffixes
1605 C++ source files conventionally use one of the suffixes @samp{.C},
1606 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1607 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1608 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1609 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1610 files with these names and compiles them as C++ programs even if you
1611 call the compiler the same way as for compiling C programs (usually
1612 with the name @command{gcc}).
1613
1614 @findex g++
1615 @findex c++
1616 However, the use of @command{gcc} does not add the C++ library.
1617 @command{g++} is a program that calls GCC and automatically specifies linking
1618 against the C++ library. It treats @samp{.c},
1619 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1620 files unless @option{-x} is used. This program is also useful when
1621 precompiling a C header file with a @samp{.h} extension for use in C++
1622 compilations. On many systems, @command{g++} is also installed with
1623 the name @command{c++}.
1624
1625 @cindex invoking @command{g++}
1626 When you compile C++ programs, you may specify many of the same
1627 command-line options that you use for compiling programs in any
1628 language; or command-line options meaningful for C and related
1629 languages; or options that are meaningful only for C++ programs.
1630 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1631 explanations of options for languages related to C@.
1632 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1633 explanations of options that are meaningful only for C++ programs.
1634
1635 @node C Dialect Options
1636 @section Options Controlling C Dialect
1637 @cindex dialect options
1638 @cindex language dialect options
1639 @cindex options, dialect
1640
1641 The following options control the dialect of C (or languages derived
1642 from C, such as C++, Objective-C and Objective-C++) that the compiler
1643 accepts:
1644
1645 @table @gcctabopt
1646 @cindex ANSI support
1647 @cindex ISO support
1648 @item -ansi
1649 @opindex ansi
1650 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1651 equivalent to @option{-std=c++98}.
1652
1653 This turns off certain features of GCC that are incompatible with ISO
1654 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1655 such as the @code{asm} and @code{typeof} keywords, and
1656 predefined macros such as @code{unix} and @code{vax} that identify the
1657 type of system you are using. It also enables the undesirable and
1658 rarely used ISO trigraph feature. For the C compiler,
1659 it disables recognition of C++ style @samp{//} comments as well as
1660 the @code{inline} keyword.
1661
1662 The alternate keywords @code{__asm__}, @code{__extension__},
1663 @code{__inline__} and @code{__typeof__} continue to work despite
1664 @option{-ansi}. You would not want to use them in an ISO C program, of
1665 course, but it is useful to put them in header files that might be included
1666 in compilations done with @option{-ansi}. Alternate predefined macros
1667 such as @code{__unix__} and @code{__vax__} are also available, with or
1668 without @option{-ansi}.
1669
1670 The @option{-ansi} option does not cause non-ISO programs to be
1671 rejected gratuitously. For that, @option{-Wpedantic} is required in
1672 addition to @option{-ansi}. @xref{Warning Options}.
1673
1674 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1675 option is used. Some header files may notice this macro and refrain
1676 from declaring certain functions or defining certain macros that the
1677 ISO standard doesn't call for; this is to avoid interfering with any
1678 programs that might use these names for other things.
1679
1680 Functions that are normally built in but do not have semantics
1681 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1682 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1683 built-in functions provided by GCC}, for details of the functions
1684 affected.
1685
1686 @item -std=
1687 @opindex std
1688 Determine the language standard. @xref{Standards,,Language Standards
1689 Supported by GCC}, for details of these standard versions. This option
1690 is currently only supported when compiling C or C++.
1691
1692 The compiler can accept several base standards, such as @samp{c90} or
1693 @samp{c++98}, and GNU dialects of those standards, such as
1694 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1695 compiler accepts all programs following that standard plus those
1696 using GNU extensions that do not contradict it. For example,
1697 @option{-std=c90} turns off certain features of GCC that are
1698 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1699 keywords, but not other GNU extensions that do not have a meaning in
1700 ISO C90, such as omitting the middle term of a @code{?:}
1701 expression. On the other hand, when a GNU dialect of a standard is
1702 specified, all features supported by the compiler are enabled, even when
1703 those features change the meaning of the base standard. As a result, some
1704 strict-conforming programs may be rejected. The particular standard
1705 is used by @option{-Wpedantic} to identify which features are GNU
1706 extensions given that version of the standard. For example
1707 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1708 comments, while @option{-std=gnu99 -Wpedantic} does not.
1709
1710 A value for this option must be provided; possible values are
1711
1712 @table @samp
1713 @item c90
1714 @itemx c89
1715 @itemx iso9899:1990
1716 Support all ISO C90 programs (certain GNU extensions that conflict
1717 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1718
1719 @item iso9899:199409
1720 ISO C90 as modified in amendment 1.
1721
1722 @item c99
1723 @itemx c9x
1724 @itemx iso9899:1999
1725 @itemx iso9899:199x
1726 ISO C99. This standard is substantially completely supported, modulo
1727 bugs and floating-point issues
1728 (mainly but not entirely relating to optional C99 features from
1729 Annexes F and G). See
1730 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1731 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1732
1733 @item c11
1734 @itemx c1x
1735 @itemx iso9899:2011
1736 ISO C11, the 2011 revision of the ISO C standard. This standard is
1737 substantially completely supported, modulo bugs, floating-point issues
1738 (mainly but not entirely relating to optional C11 features from
1739 Annexes F and G) and the optional Annexes K (Bounds-checking
1740 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1741
1742 @item gnu90
1743 @itemx gnu89
1744 GNU dialect of ISO C90 (including some C99 features).
1745
1746 @item gnu99
1747 @itemx gnu9x
1748 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1749
1750 @item gnu11
1751 @itemx gnu1x
1752 GNU dialect of ISO C11. This is the default for C code.
1753 The name @samp{gnu1x} is deprecated.
1754
1755 @item c++98
1756 @itemx c++03
1757 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1758 additional defect reports. Same as @option{-ansi} for C++ code.
1759
1760 @item gnu++98
1761 @itemx gnu++03
1762 GNU dialect of @option{-std=c++98}. This is the default for
1763 C++ code.
1764
1765 @item c++11
1766 @itemx c++0x
1767 The 2011 ISO C++ standard plus amendments.
1768 The name @samp{c++0x} is deprecated.
1769
1770 @item gnu++11
1771 @itemx gnu++0x
1772 GNU dialect of @option{-std=c++11}.
1773 The name @samp{gnu++0x} is deprecated.
1774
1775 @item c++14
1776 @itemx c++1y
1777 The 2014 ISO C++ standard plus amendments.
1778 The name @samp{c++1y} is deprecated.
1779
1780 @item gnu++14
1781 @itemx gnu++1y
1782 GNU dialect of @option{-std=c++14}.
1783 The name @samp{gnu++1y} is deprecated.
1784
1785 @item c++1z
1786 The next revision of the ISO C++ standard, tentatively planned for
1787 2017. Support is highly experimental, and will almost certainly
1788 change in incompatible ways in future releases.
1789
1790 @item gnu++1z
1791 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1792 and will almost certainly change in incompatible ways in future
1793 releases.
1794 @end table
1795
1796 @item -fgnu89-inline
1797 @opindex fgnu89-inline
1798 The option @option{-fgnu89-inline} tells GCC to use the traditional
1799 GNU semantics for @code{inline} functions when in C99 mode.
1800 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1801 Using this option is roughly equivalent to adding the
1802 @code{gnu_inline} function attribute to all inline functions
1803 (@pxref{Function Attributes}).
1804
1805 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1806 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1807 specifies the default behavior).
1808 This option is not supported in @option{-std=c90} or
1809 @option{-std=gnu90} mode.
1810
1811 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1812 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1813 in effect for @code{inline} functions. @xref{Common Predefined
1814 Macros,,,cpp,The C Preprocessor}.
1815
1816 @item -aux-info @var{filename}
1817 @opindex aux-info
1818 Output to the given filename prototyped declarations for all functions
1819 declared and/or defined in a translation unit, including those in header
1820 files. This option is silently ignored in any language other than C@.
1821
1822 Besides declarations, the file indicates, in comments, the origin of
1823 each declaration (source file and line), whether the declaration was
1824 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1825 @samp{O} for old, respectively, in the first character after the line
1826 number and the colon), and whether it came from a declaration or a
1827 definition (@samp{C} or @samp{F}, respectively, in the following
1828 character). In the case of function definitions, a K&R-style list of
1829 arguments followed by their declarations is also provided, inside
1830 comments, after the declaration.
1831
1832 @item -fallow-parameterless-variadic-functions
1833 @opindex fallow-parameterless-variadic-functions
1834 Accept variadic functions without named parameters.
1835
1836 Although it is possible to define such a function, this is not very
1837 useful as it is not possible to read the arguments. This is only
1838 supported for C as this construct is allowed by C++.
1839
1840 @item -fno-asm
1841 @opindex fno-asm
1842 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1843 keyword, so that code can use these words as identifiers. You can use
1844 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1845 instead. @option{-ansi} implies @option{-fno-asm}.
1846
1847 In C++, this switch only affects the @code{typeof} keyword, since
1848 @code{asm} and @code{inline} are standard keywords. You may want to
1849 use the @option{-fno-gnu-keywords} flag instead, which has the same
1850 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1851 switch only affects the @code{asm} and @code{typeof} keywords, since
1852 @code{inline} is a standard keyword in ISO C99.
1853
1854 @item -fno-builtin
1855 @itemx -fno-builtin-@var{function}
1856 @opindex fno-builtin
1857 @cindex built-in functions
1858 Don't recognize built-in functions that do not begin with
1859 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1860 functions provided by GCC}, for details of the functions affected,
1861 including those which are not built-in functions when @option{-ansi} or
1862 @option{-std} options for strict ISO C conformance are used because they
1863 do not have an ISO standard meaning.
1864
1865 GCC normally generates special code to handle certain built-in functions
1866 more efficiently; for instance, calls to @code{alloca} may become single
1867 instructions which adjust the stack directly, and calls to @code{memcpy}
1868 may become inline copy loops. The resulting code is often both smaller
1869 and faster, but since the function calls no longer appear as such, you
1870 cannot set a breakpoint on those calls, nor can you change the behavior
1871 of the functions by linking with a different library. In addition,
1872 when a function is recognized as a built-in function, GCC may use
1873 information about that function to warn about problems with calls to
1874 that function, or to generate more efficient code, even if the
1875 resulting code still contains calls to that function. For example,
1876 warnings are given with @option{-Wformat} for bad calls to
1877 @code{printf} when @code{printf} is built in and @code{strlen} is
1878 known not to modify global memory.
1879
1880 With the @option{-fno-builtin-@var{function}} option
1881 only the built-in function @var{function} is
1882 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1883 function is named that is not built-in in this version of GCC, this
1884 option is ignored. There is no corresponding
1885 @option{-fbuiltin-@var{function}} option; if you wish to enable
1886 built-in functions selectively when using @option{-fno-builtin} or
1887 @option{-ffreestanding}, you may define macros such as:
1888
1889 @smallexample
1890 #define abs(n) __builtin_abs ((n))
1891 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1892 @end smallexample
1893
1894 @item -fhosted
1895 @opindex fhosted
1896 @cindex hosted environment
1897
1898 Assert that compilation targets a hosted environment. This implies
1899 @option{-fbuiltin}. A hosted environment is one in which the
1900 entire standard library is available, and in which @code{main} has a return
1901 type of @code{int}. Examples are nearly everything except a kernel.
1902 This is equivalent to @option{-fno-freestanding}.
1903
1904 @item -ffreestanding
1905 @opindex ffreestanding
1906 @cindex hosted environment
1907
1908 Assert that compilation targets a freestanding environment. This
1909 implies @option{-fno-builtin}. A freestanding environment
1910 is one in which the standard library may not exist, and program startup may
1911 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1912 This is equivalent to @option{-fno-hosted}.
1913
1914 @xref{Standards,,Language Standards Supported by GCC}, for details of
1915 freestanding and hosted environments.
1916
1917 @item -fopenacc
1918 @opindex fopenacc
1919 @cindex OpenACC accelerator programming
1920 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
1921 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
1922 compiler generates accelerated code according to the OpenACC Application
1923 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
1924 implies @option{-pthread}, and thus is only supported on targets that
1925 have support for @option{-pthread}.
1926
1927 Note that this is an experimental feature, incomplete, and subject to
1928 change in future versions of GCC. See
1929 @w{@uref{https://gcc.gnu.org/wiki/OpenACC}} for more information.
1930
1931 @item -fopenmp
1932 @opindex fopenmp
1933 @cindex OpenMP parallel
1934 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1935 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1936 compiler generates parallel code according to the OpenMP Application
1937 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
1938 implies @option{-pthread}, and thus is only supported on targets that
1939 have support for @option{-pthread}. @option{-fopenmp} implies
1940 @option{-fopenmp-simd}.
1941
1942 @item -fopenmp-simd
1943 @opindex fopenmp-simd
1944 @cindex OpenMP SIMD
1945 @cindex SIMD
1946 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
1947 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
1948 are ignored.
1949
1950 @item -fcilkplus
1951 @opindex fcilkplus
1952 @cindex Enable Cilk Plus
1953 Enable the usage of Cilk Plus language extension features for C/C++.
1954 When the option @option{-fcilkplus} is specified, enable the usage of
1955 the Cilk Plus Language extension features for C/C++. The present
1956 implementation follows ABI version 1.2. This is an experimental
1957 feature that is only partially complete, and whose interface may
1958 change in future versions of GCC as the official specification
1959 changes. Currently, all features but @code{_Cilk_for} have been
1960 implemented.
1961
1962 @item -fgnu-tm
1963 @opindex fgnu-tm
1964 When the option @option{-fgnu-tm} is specified, the compiler
1965 generates code for the Linux variant of Intel's current Transactional
1966 Memory ABI specification document (Revision 1.1, May 6 2009). This is
1967 an experimental feature whose interface may change in future versions
1968 of GCC, as the official specification changes. Please note that not
1969 all architectures are supported for this feature.
1970
1971 For more information on GCC's support for transactional memory,
1972 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
1973 Transactional Memory Library}.
1974
1975 Note that the transactional memory feature is not supported with
1976 non-call exceptions (@option{-fnon-call-exceptions}).
1977
1978 @item -fms-extensions
1979 @opindex fms-extensions
1980 Accept some non-standard constructs used in Microsoft header files.
1981
1982 In C++ code, this allows member names in structures to be similar
1983 to previous types declarations.
1984
1985 @smallexample
1986 typedef int UOW;
1987 struct ABC @{
1988 UOW UOW;
1989 @};
1990 @end smallexample
1991
1992 Some cases of unnamed fields in structures and unions are only
1993 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1994 fields within structs/unions}, for details.
1995
1996 Note that this option is off for all targets but x86
1997 targets using ms-abi.
1998
1999 @item -fplan9-extensions
2000 @opindex fplan9-extensions
2001 Accept some non-standard constructs used in Plan 9 code.
2002
2003 This enables @option{-fms-extensions}, permits passing pointers to
2004 structures with anonymous fields to functions that expect pointers to
2005 elements of the type of the field, and permits referring to anonymous
2006 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2007 struct/union fields within structs/unions}, for details. This is only
2008 supported for C, not C++.
2009
2010 @item -trigraphs
2011 @opindex trigraphs
2012 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
2013 options for strict ISO C conformance) implies @option{-trigraphs}.
2014
2015 @cindex traditional C language
2016 @cindex C language, traditional
2017 @item -traditional
2018 @itemx -traditional-cpp
2019 @opindex traditional-cpp
2020 @opindex traditional
2021 Formerly, these options caused GCC to attempt to emulate a pre-standard
2022 C compiler. They are now only supported with the @option{-E} switch.
2023 The preprocessor continues to support a pre-standard mode. See the GNU
2024 CPP manual for details.
2025
2026 @item -fcond-mismatch
2027 @opindex fcond-mismatch
2028 Allow conditional expressions with mismatched types in the second and
2029 third arguments. The value of such an expression is void. This option
2030 is not supported for C++.
2031
2032 @item -flax-vector-conversions
2033 @opindex flax-vector-conversions
2034 Allow implicit conversions between vectors with differing numbers of
2035 elements and/or incompatible element types. This option should not be
2036 used for new code.
2037
2038 @item -funsigned-char
2039 @opindex funsigned-char
2040 Let the type @code{char} be unsigned, like @code{unsigned char}.
2041
2042 Each kind of machine has a default for what @code{char} should
2043 be. It is either like @code{unsigned char} by default or like
2044 @code{signed char} by default.
2045
2046 Ideally, a portable program should always use @code{signed char} or
2047 @code{unsigned char} when it depends on the signedness of an object.
2048 But many programs have been written to use plain @code{char} and
2049 expect it to be signed, or expect it to be unsigned, depending on the
2050 machines they were written for. This option, and its inverse, let you
2051 make such a program work with the opposite default.
2052
2053 The type @code{char} is always a distinct type from each of
2054 @code{signed char} or @code{unsigned char}, even though its behavior
2055 is always just like one of those two.
2056
2057 @item -fsigned-char
2058 @opindex fsigned-char
2059 Let the type @code{char} be signed, like @code{signed char}.
2060
2061 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2062 the negative form of @option{-funsigned-char}. Likewise, the option
2063 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2064
2065 @item -fsigned-bitfields
2066 @itemx -funsigned-bitfields
2067 @itemx -fno-signed-bitfields
2068 @itemx -fno-unsigned-bitfields
2069 @opindex fsigned-bitfields
2070 @opindex funsigned-bitfields
2071 @opindex fno-signed-bitfields
2072 @opindex fno-unsigned-bitfields
2073 These options control whether a bit-field is signed or unsigned, when the
2074 declaration does not use either @code{signed} or @code{unsigned}. By
2075 default, such a bit-field is signed, because this is consistent: the
2076 basic integer types such as @code{int} are signed types.
2077 @end table
2078
2079 @node C++ Dialect Options
2080 @section Options Controlling C++ Dialect
2081
2082 @cindex compiler options, C++
2083 @cindex C++ options, command-line
2084 @cindex options, C++
2085 This section describes the command-line options that are only meaningful
2086 for C++ programs. You can also use most of the GNU compiler options
2087 regardless of what language your program is in. For example, you
2088 might compile a file @file{firstClass.C} like this:
2089
2090 @smallexample
2091 g++ -g -fstrict-enums -O -c firstClass.C
2092 @end smallexample
2093
2094 @noindent
2095 In this example, only @option{-fstrict-enums} is an option meant
2096 only for C++ programs; you can use the other options with any
2097 language supported by GCC@.
2098
2099 Here is a list of options that are @emph{only} for compiling C++ programs:
2100
2101 @table @gcctabopt
2102
2103 @item -fabi-version=@var{n}
2104 @opindex fabi-version
2105 Use version @var{n} of the C++ ABI@. The default is version 0.
2106
2107 Version 0 refers to the version conforming most closely to
2108 the C++ ABI specification. Therefore, the ABI obtained using version 0
2109 will change in different versions of G++ as ABI bugs are fixed.
2110
2111 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2112
2113 Version 2 is the version of the C++ ABI that first appeared in G++
2114 3.4, and was the default through G++ 4.9.
2115
2116 Version 3 corrects an error in mangling a constant address as a
2117 template argument.
2118
2119 Version 4, which first appeared in G++ 4.5, implements a standard
2120 mangling for vector types.
2121
2122 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2123 attribute const/volatile on function pointer types, decltype of a
2124 plain decl, and use of a function parameter in the declaration of
2125 another parameter.
2126
2127 Version 6, which first appeared in G++ 4.7, corrects the promotion
2128 behavior of C++11 scoped enums and the mangling of template argument
2129 packs, const/static_cast, prefix ++ and --, and a class scope function
2130 used as a template argument.
2131
2132 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2133 builtin type and corrects the mangling of lambdas in default argument
2134 scope.
2135
2136 Version 8, which first appeared in G++ 4.9, corrects the substitution
2137 behavior of function types with function-cv-qualifiers.
2138
2139 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2140 @code{nullptr_t}.
2141
2142 Version 10, which first appeared in G++ 6.1, adds mangling of
2143 attributes that affect type identity, such as ia32 calling convention
2144 attributes (e.g. @samp{stdcall}).
2145
2146 See also @option{-Wabi}.
2147
2148 @item -fabi-compat-version=@var{n}
2149 @opindex fabi-compat-version
2150 On targets that support strong aliases, G++
2151 works around mangling changes by creating an alias with the correct
2152 mangled name when defining a symbol with an incorrect mangled name.
2153 This switch specifies which ABI version to use for the alias.
2154
2155 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2156 compatibility). If another ABI version is explicitly selected, this
2157 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2158 use @option{-fabi-compat-version=2}.
2159
2160 If this option is not provided but @option{-Wabi=@var{n}} is, that
2161 version is used for compatibility aliases. If this option is provided
2162 along with @option{-Wabi} (without the version), the version from this
2163 option is used for the warning.
2164
2165 @item -fno-access-control
2166 @opindex fno-access-control
2167 Turn off all access checking. This switch is mainly useful for working
2168 around bugs in the access control code.
2169
2170 @item -fcheck-new
2171 @opindex fcheck-new
2172 Check that the pointer returned by @code{operator new} is non-null
2173 before attempting to modify the storage allocated. This check is
2174 normally unnecessary because the C++ standard specifies that
2175 @code{operator new} only returns @code{0} if it is declared
2176 @code{throw()}, in which case the compiler always checks the
2177 return value even without this option. In all other cases, when
2178 @code{operator new} has a non-empty exception specification, memory
2179 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2180 @samp{new (nothrow)}.
2181
2182 @item -fconstexpr-depth=@var{n}
2183 @opindex fconstexpr-depth
2184 Set the maximum nested evaluation depth for C++11 constexpr functions
2185 to @var{n}. A limit is needed to detect endless recursion during
2186 constant expression evaluation. The minimum specified by the standard
2187 is 512.
2188
2189 @item -fdeduce-init-list
2190 @opindex fdeduce-init-list
2191 Enable deduction of a template type parameter as
2192 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2193
2194 @smallexample
2195 template <class T> auto forward(T t) -> decltype (realfn (t))
2196 @{
2197 return realfn (t);
2198 @}
2199
2200 void f()
2201 @{
2202 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2203 @}
2204 @end smallexample
2205
2206 This deduction was implemented as a possible extension to the
2207 originally proposed semantics for the C++11 standard, but was not part
2208 of the final standard, so it is disabled by default. This option is
2209 deprecated, and may be removed in a future version of G++.
2210
2211 @item -ffriend-injection
2212 @opindex ffriend-injection
2213 Inject friend functions into the enclosing namespace, so that they are
2214 visible outside the scope of the class in which they are declared.
2215 Friend functions were documented to work this way in the old Annotated
2216 C++ Reference Manual.
2217 However, in ISO C++ a friend function that is not declared
2218 in an enclosing scope can only be found using argument dependent
2219 lookup. GCC defaults to the standard behavior.
2220
2221 This option is for compatibility, and may be removed in a future
2222 release of G++.
2223
2224 @item -fno-elide-constructors
2225 @opindex fno-elide-constructors
2226 The C++ standard allows an implementation to omit creating a temporary
2227 that is only used to initialize another object of the same type.
2228 Specifying this option disables that optimization, and forces G++ to
2229 call the copy constructor in all cases.
2230
2231 @item -fno-enforce-eh-specs
2232 @opindex fno-enforce-eh-specs
2233 Don't generate code to check for violation of exception specifications
2234 at run time. This option violates the C++ standard, but may be useful
2235 for reducing code size in production builds, much like defining
2236 @code{NDEBUG}. This does not give user code permission to throw
2237 exceptions in violation of the exception specifications; the compiler
2238 still optimizes based on the specifications, so throwing an
2239 unexpected exception results in undefined behavior at run time.
2240
2241 @item -fextern-tls-init
2242 @itemx -fno-extern-tls-init
2243 @opindex fextern-tls-init
2244 @opindex fno-extern-tls-init
2245 The C++11 and OpenMP standards allow @code{thread_local} and
2246 @code{threadprivate} variables to have dynamic (runtime)
2247 initialization. To support this, any use of such a variable goes
2248 through a wrapper function that performs any necessary initialization.
2249 When the use and definition of the variable are in the same
2250 translation unit, this overhead can be optimized away, but when the
2251 use is in a different translation unit there is significant overhead
2252 even if the variable doesn't actually need dynamic initialization. If
2253 the programmer can be sure that no use of the variable in a
2254 non-defining TU needs to trigger dynamic initialization (either
2255 because the variable is statically initialized, or a use of the
2256 variable in the defining TU will be executed before any uses in
2257 another TU), they can avoid this overhead with the
2258 @option{-fno-extern-tls-init} option.
2259
2260 On targets that support symbol aliases, the default is
2261 @option{-fextern-tls-init}. On targets that do not support symbol
2262 aliases, the default is @option{-fno-extern-tls-init}.
2263
2264 @item -ffor-scope
2265 @itemx -fno-for-scope
2266 @opindex ffor-scope
2267 @opindex fno-for-scope
2268 If @option{-ffor-scope} is specified, the scope of variables declared in
2269 a @i{for-init-statement} is limited to the @code{for} loop itself,
2270 as specified by the C++ standard.
2271 If @option{-fno-for-scope} is specified, the scope of variables declared in
2272 a @i{for-init-statement} extends to the end of the enclosing scope,
2273 as was the case in old versions of G++, and other (traditional)
2274 implementations of C++.
2275
2276 If neither flag is given, the default is to follow the standard,
2277 but to allow and give a warning for old-style code that would
2278 otherwise be invalid, or have different behavior.
2279
2280 @item -fno-gnu-keywords
2281 @opindex fno-gnu-keywords
2282 Do not recognize @code{typeof} as a keyword, so that code can use this
2283 word as an identifier. You can use the keyword @code{__typeof__} instead.
2284 @option{-ansi} implies @option{-fno-gnu-keywords}.
2285
2286 @item -fno-implicit-templates
2287 @opindex fno-implicit-templates
2288 Never emit code for non-inline templates that are instantiated
2289 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2290 @xref{Template Instantiation}, for more information.
2291
2292 @item -fno-implicit-inline-templates
2293 @opindex fno-implicit-inline-templates
2294 Don't emit code for implicit instantiations of inline templates, either.
2295 The default is to handle inlines differently so that compiles with and
2296 without optimization need the same set of explicit instantiations.
2297
2298 @item -fno-implement-inlines
2299 @opindex fno-implement-inlines
2300 To save space, do not emit out-of-line copies of inline functions
2301 controlled by @code{#pragma implementation}. This causes linker
2302 errors if these functions are not inlined everywhere they are called.
2303
2304 @item -fms-extensions
2305 @opindex fms-extensions
2306 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2307 int and getting a pointer to member function via non-standard syntax.
2308
2309 @item -fno-nonansi-builtins
2310 @opindex fno-nonansi-builtins
2311 Disable built-in declarations of functions that are not mandated by
2312 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2313 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2314
2315 @item -fnothrow-opt
2316 @opindex fnothrow-opt
2317 Treat a @code{throw()} exception specification as if it were a
2318 @code{noexcept} specification to reduce or eliminate the text size
2319 overhead relative to a function with no exception specification. If
2320 the function has local variables of types with non-trivial
2321 destructors, the exception specification actually makes the
2322 function smaller because the EH cleanups for those variables can be
2323 optimized away. The semantic effect is that an exception thrown out of
2324 a function with such an exception specification results in a call
2325 to @code{terminate} rather than @code{unexpected}.
2326
2327 @item -fno-operator-names
2328 @opindex fno-operator-names
2329 Do not treat the operator name keywords @code{and}, @code{bitand},
2330 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2331 synonyms as keywords.
2332
2333 @item -fno-optional-diags
2334 @opindex fno-optional-diags
2335 Disable diagnostics that the standard says a compiler does not need to
2336 issue. Currently, the only such diagnostic issued by G++ is the one for
2337 a name having multiple meanings within a class.
2338
2339 @item -fpermissive
2340 @opindex fpermissive
2341 Downgrade some diagnostics about nonconformant code from errors to
2342 warnings. Thus, using @option{-fpermissive} allows some
2343 nonconforming code to compile.
2344
2345 @item -fno-pretty-templates
2346 @opindex fno-pretty-templates
2347 When an error message refers to a specialization of a function
2348 template, the compiler normally prints the signature of the
2349 template followed by the template arguments and any typedefs or
2350 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2351 rather than @code{void f(int)}) so that it's clear which template is
2352 involved. When an error message refers to a specialization of a class
2353 template, the compiler omits any template arguments that match
2354 the default template arguments for that template. If either of these
2355 behaviors make it harder to understand the error message rather than
2356 easier, you can use @option{-fno-pretty-templates} to disable them.
2357
2358 @item -frepo
2359 @opindex frepo
2360 Enable automatic template instantiation at link time. This option also
2361 implies @option{-fno-implicit-templates}. @xref{Template
2362 Instantiation}, for more information.
2363
2364 @item -fno-rtti
2365 @opindex fno-rtti
2366 Disable generation of information about every class with virtual
2367 functions for use by the C++ run-time type identification features
2368 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2369 of the language, you can save some space by using this flag. Note that
2370 exception handling uses the same information, but G++ generates it as
2371 needed. The @code{dynamic_cast} operator can still be used for casts that
2372 do not require run-time type information, i.e.@: casts to @code{void *} or to
2373 unambiguous base classes.
2374
2375 @item -fsized-deallocation
2376 @opindex fsized-deallocation
2377 Enable the built-in global declarations
2378 @smallexample
2379 void operator delete (void *, std::size_t) noexcept;
2380 void operator delete[] (void *, std::size_t) noexcept;
2381 @end smallexample
2382 as introduced in C++14. This is useful for user-defined replacement
2383 deallocation functions that, for example, use the size of the object
2384 to make deallocation faster. Enabled by default under
2385 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2386 warns about places that might want to add a definition.
2387
2388 @item -fstats
2389 @opindex fstats
2390 Emit statistics about front-end processing at the end of the compilation.
2391 This information is generally only useful to the G++ development team.
2392
2393 @item -fstrict-enums
2394 @opindex fstrict-enums
2395 Allow the compiler to optimize using the assumption that a value of
2396 enumerated type can only be one of the values of the enumeration (as
2397 defined in the C++ standard; basically, a value that can be
2398 represented in the minimum number of bits needed to represent all the
2399 enumerators). This assumption may not be valid if the program uses a
2400 cast to convert an arbitrary integer value to the enumerated type.
2401
2402 @item -ftemplate-backtrace-limit=@var{n}
2403 @opindex ftemplate-backtrace-limit
2404 Set the maximum number of template instantiation notes for a single
2405 warning or error to @var{n}. The default value is 10.
2406
2407 @item -ftemplate-depth=@var{n}
2408 @opindex ftemplate-depth
2409 Set the maximum instantiation depth for template classes to @var{n}.
2410 A limit on the template instantiation depth is needed to detect
2411 endless recursions during template class instantiation. ANSI/ISO C++
2412 conforming programs must not rely on a maximum depth greater than 17
2413 (changed to 1024 in C++11). The default value is 900, as the compiler
2414 can run out of stack space before hitting 1024 in some situations.
2415
2416 @item -fno-threadsafe-statics
2417 @opindex fno-threadsafe-statics
2418 Do not emit the extra code to use the routines specified in the C++
2419 ABI for thread-safe initialization of local statics. You can use this
2420 option to reduce code size slightly in code that doesn't need to be
2421 thread-safe.
2422
2423 @item -fuse-cxa-atexit
2424 @opindex fuse-cxa-atexit
2425 Register destructors for objects with static storage duration with the
2426 @code{__cxa_atexit} function rather than the @code{atexit} function.
2427 This option is required for fully standards-compliant handling of static
2428 destructors, but only works if your C library supports
2429 @code{__cxa_atexit}.
2430
2431 @item -fno-use-cxa-get-exception-ptr
2432 @opindex fno-use-cxa-get-exception-ptr
2433 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2434 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2435 if the runtime routine is not available.
2436
2437 @item -fvisibility-inlines-hidden
2438 @opindex fvisibility-inlines-hidden
2439 This switch declares that the user does not attempt to compare
2440 pointers to inline functions or methods where the addresses of the two functions
2441 are taken in different shared objects.
2442
2443 The effect of this is that GCC may, effectively, mark inline methods with
2444 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2445 appear in the export table of a DSO and do not require a PLT indirection
2446 when used within the DSO@. Enabling this option can have a dramatic effect
2447 on load and link times of a DSO as it massively reduces the size of the
2448 dynamic export table when the library makes heavy use of templates.
2449
2450 The behavior of this switch is not quite the same as marking the
2451 methods as hidden directly, because it does not affect static variables
2452 local to the function or cause the compiler to deduce that
2453 the function is defined in only one shared object.
2454
2455 You may mark a method as having a visibility explicitly to negate the
2456 effect of the switch for that method. For example, if you do want to
2457 compare pointers to a particular inline method, you might mark it as
2458 having default visibility. Marking the enclosing class with explicit
2459 visibility has no effect.
2460
2461 Explicitly instantiated inline methods are unaffected by this option
2462 as their linkage might otherwise cross a shared library boundary.
2463 @xref{Template Instantiation}.
2464
2465 @item -fvisibility-ms-compat
2466 @opindex fvisibility-ms-compat
2467 This flag attempts to use visibility settings to make GCC's C++
2468 linkage model compatible with that of Microsoft Visual Studio.
2469
2470 The flag makes these changes to GCC's linkage model:
2471
2472 @enumerate
2473 @item
2474 It sets the default visibility to @code{hidden}, like
2475 @option{-fvisibility=hidden}.
2476
2477 @item
2478 Types, but not their members, are not hidden by default.
2479
2480 @item
2481 The One Definition Rule is relaxed for types without explicit
2482 visibility specifications that are defined in more than one
2483 shared object: those declarations are permitted if they are
2484 permitted when this option is not used.
2485 @end enumerate
2486
2487 In new code it is better to use @option{-fvisibility=hidden} and
2488 export those classes that are intended to be externally visible.
2489 Unfortunately it is possible for code to rely, perhaps accidentally,
2490 on the Visual Studio behavior.
2491
2492 Among the consequences of these changes are that static data members
2493 of the same type with the same name but defined in different shared
2494 objects are different, so changing one does not change the other;
2495 and that pointers to function members defined in different shared
2496 objects may not compare equal. When this flag is given, it is a
2497 violation of the ODR to define types with the same name differently.
2498
2499 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
2500 @opindex fvtable-verify
2501 Turn on (or off, if using @option{-fvtable-verify=none}) the security
2502 feature that verifies at run time, for every virtual call, that
2503 the vtable pointer through which the call is made is valid for the type of
2504 the object, and has not been corrupted or overwritten. If an invalid vtable
2505 pointer is detected at run time, an error is reported and execution of the
2506 program is immediately halted.
2507
2508 This option causes run-time data structures to be built at program startup,
2509 which are used for verifying the vtable pointers.
2510 The options @samp{std} and @samp{preinit}
2511 control the timing of when these data structures are built. In both cases the
2512 data structures are built before execution reaches @code{main}. Using
2513 @option{-fvtable-verify=std} causes the data structures to be built after
2514 shared libraries have been loaded and initialized.
2515 @option{-fvtable-verify=preinit} causes them to be built before shared
2516 libraries have been loaded and initialized.
2517
2518 If this option appears multiple times in the command line with different
2519 values specified, @samp{none} takes highest priority over both @samp{std} and
2520 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
2521
2522 @item -fvtv-debug
2523 @opindex fvtv-debug
2524 When used in conjunction with @option{-fvtable-verify=std} or
2525 @option{-fvtable-verify=preinit}, causes debug versions of the
2526 runtime functions for the vtable verification feature to be called.
2527 This flag also causes the compiler to log information about which
2528 vtable pointers it finds for each class.
2529 This information is written to a file named @file{vtv_set_ptr_data.log}
2530 in the directory named by the environment variable @env{VTV_LOGS_DIR}
2531 if that is defined or the current working directory otherwise.
2532
2533 Note: This feature @emph{appends} data to the log file. If you want a fresh log
2534 file, be sure to delete any existing one.
2535
2536 @item -fvtv-counts
2537 @opindex fvtv-counts
2538 This is a debugging flag. When used in conjunction with
2539 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
2540 causes the compiler to keep track of the total number of virtual calls
2541 it encounters and the number of verifications it inserts. It also
2542 counts the number of calls to certain run-time library functions
2543 that it inserts and logs this information for each compilation unit.
2544 The compiler writes this information to a file named
2545 @file{vtv_count_data.log} in the directory named by the environment
2546 variable @env{VTV_LOGS_DIR} if that is defined or the current working
2547 directory otherwise. It also counts the size of the vtable pointer sets
2548 for each class, and writes this information to @file{vtv_class_set_sizes.log}
2549 in the same directory.
2550
2551 Note: This feature @emph{appends} data to the log files. To get fresh log
2552 files, be sure to delete any existing ones.
2553
2554 @item -fno-weak
2555 @opindex fno-weak
2556 Do not use weak symbol support, even if it is provided by the linker.
2557 By default, G++ uses weak symbols if they are available. This
2558 option exists only for testing, and should not be used by end-users;
2559 it results in inferior code and has no benefits. This option may
2560 be removed in a future release of G++.
2561
2562 @item -nostdinc++
2563 @opindex nostdinc++
2564 Do not search for header files in the standard directories specific to
2565 C++, but do still search the other standard directories. (This option
2566 is used when building the C++ library.)
2567 @end table
2568
2569 In addition, these optimization, warning, and code generation options
2570 have meanings only for C++ programs:
2571
2572 @table @gcctabopt
2573 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2574 @opindex Wabi
2575 @opindex Wno-abi
2576 Warn when G++ it generates code that is probably not compatible with
2577 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2578 ABI with each major release, normally @option{-Wabi} will warn only if
2579 there is a check added later in a release series for an ABI issue
2580 discovered since the initial release. @option{-Wabi} will warn about
2581 more things if an older ABI version is selected (with
2582 @option{-fabi-version=@var{n}}).
2583
2584 @option{-Wabi} can also be used with an explicit version number to
2585 warn about compatibility with a particular @option{-fabi-version}
2586 level, e.g. @option{-Wabi=2} to warn about changes relative to
2587 @option{-fabi-version=2}.
2588
2589 If an explicit version number is provided and
2590 @option{-fabi-compat-version} is not specified, the version number
2591 from this option is used for compatibility aliases. If no explicit
2592 version number is provided with this option, but
2593 @option{-fabi-compat-version} is specified, that version number is
2594 used for ABI warnings.
2595
2596 Although an effort has been made to warn about
2597 all such cases, there are probably some cases that are not warned about,
2598 even though G++ is generating incompatible code. There may also be
2599 cases where warnings are emitted even though the code that is generated
2600 is compatible.
2601
2602 You should rewrite your code to avoid these warnings if you are
2603 concerned about the fact that code generated by G++ may not be binary
2604 compatible with code generated by other compilers.
2605
2606 Known incompatibilities in @option{-fabi-version=2} (which was the
2607 default from GCC 3.4 to 4.9) include:
2608
2609 @itemize @bullet
2610
2611 @item
2612 A template with a non-type template parameter of reference type was
2613 mangled incorrectly:
2614 @smallexample
2615 extern int N;
2616 template <int &> struct S @{@};
2617 void n (S<N>) @{2@}
2618 @end smallexample
2619
2620 This was fixed in @option{-fabi-version=3}.
2621
2622 @item
2623 SIMD vector types declared using @code{__attribute ((vector_size))} were
2624 mangled in a non-standard way that does not allow for overloading of
2625 functions taking vectors of different sizes.
2626
2627 The mangling was changed in @option{-fabi-version=4}.
2628
2629 @item
2630 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2631 qualifiers, and @code{decltype} of a plain declaration was folded away.
2632
2633 These mangling issues were fixed in @option{-fabi-version=5}.
2634
2635 @item
2636 Scoped enumerators passed as arguments to a variadic function are
2637 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2638 On most targets this does not actually affect the parameter passing
2639 ABI, as there is no way to pass an argument smaller than @code{int}.
2640
2641 Also, the ABI changed the mangling of template argument packs,
2642 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2643 a class scope function used as a template argument.
2644
2645 These issues were corrected in @option{-fabi-version=6}.
2646
2647 @item
2648 Lambdas in default argument scope were mangled incorrectly, and the
2649 ABI changed the mangling of @code{nullptr_t}.
2650
2651 These issues were corrected in @option{-fabi-version=7}.
2652
2653 @item
2654 When mangling a function type with function-cv-qualifiers, the
2655 un-qualified function type was incorrectly treated as a substitution
2656 candidate.
2657
2658 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2659
2660 @item
2661 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2662 unaligned accesses. Note that this did not affect the ABI of a
2663 function with a @code{nullptr_t} parameter, as parameters have a
2664 minimum alignment.
2665
2666 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2667
2668 @item
2669 Target-specific attributes that affect the identity of a type, such as
2670 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2671 did not affect the mangled name, leading to name collisions when
2672 function pointers were used as template arguments.
2673
2674 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2675
2676 @end itemize
2677
2678 It also warns about psABI-related changes. The known psABI changes at this
2679 point include:
2680
2681 @itemize @bullet
2682
2683 @item
2684 For SysV/x86-64, unions with @code{long double} members are
2685 passed in memory as specified in psABI. For example:
2686
2687 @smallexample
2688 union U @{
2689 long double ld;
2690 int i;
2691 @};
2692 @end smallexample
2693
2694 @noindent
2695 @code{union U} is always passed in memory.
2696
2697 @end itemize
2698
2699 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2700 @opindex Wabi-tag
2701 @opindex -Wabi-tag
2702 Warn when a type with an ABI tag is used in a context that does not
2703 have that ABI tag. See @ref{C++ Attributes} for more information
2704 about ABI tags.
2705
2706 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2707 @opindex Wctor-dtor-privacy
2708 @opindex Wno-ctor-dtor-privacy
2709 Warn when a class seems unusable because all the constructors or
2710 destructors in that class are private, and it has neither friends nor
2711 public static member functions. Also warn if there are no non-private
2712 methods, and there's at least one private member function that isn't
2713 a constructor or destructor.
2714
2715 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2716 @opindex Wdelete-non-virtual-dtor
2717 @opindex Wno-delete-non-virtual-dtor
2718 Warn when @code{delete} is used to destroy an instance of a class that
2719 has virtual functions and non-virtual destructor. It is unsafe to delete
2720 an instance of a derived class through a pointer to a base class if the
2721 base class does not have a virtual destructor. This warning is enabled
2722 by @option{-Wall}.
2723
2724 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2725 @opindex Wliteral-suffix
2726 @opindex Wno-literal-suffix
2727 Warn when a string or character literal is followed by a ud-suffix which does
2728 not begin with an underscore. As a conforming extension, GCC treats such
2729 suffixes as separate preprocessing tokens in order to maintain backwards
2730 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2731 For example:
2732
2733 @smallexample
2734 #define __STDC_FORMAT_MACROS
2735 #include <inttypes.h>
2736 #include <stdio.h>
2737
2738 int main() @{
2739 int64_t i64 = 123;
2740 printf("My int64: %" PRId64"\n", i64);
2741 @}
2742 @end smallexample
2743
2744 In this case, @code{PRId64} is treated as a separate preprocessing token.
2745
2746 This warning is enabled by default.
2747
2748 @item -Wlto-type-mismatch
2749 @opindex Wlto-type-mismatch
2750 @opindex Wno-lto-type-mistmach
2751
2752 During the link-time optimization warn about type mismatches in between
2753 global declarations from different compilation units.
2754 Requires @option{-flto} to be enabled. Enabled by default.
2755
2756 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2757 @opindex Wnarrowing
2758 @opindex Wno-narrowing
2759 Warn when a narrowing conversion prohibited by C++11 occurs within
2760 @samp{@{ @}}, e.g.
2761
2762 @smallexample
2763 int i = @{ 2.2 @}; // error: narrowing from double to int
2764 @end smallexample
2765
2766 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2767
2768 With @option{-std=c++11}, @option{-Wno-narrowing} suppresses the diagnostic
2769 required by the standard. Note that this does not affect the meaning
2770 of well-formed code; narrowing conversions are still considered
2771 ill-formed in SFINAE context.
2772
2773 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2774 @opindex Wnoexcept
2775 @opindex Wno-noexcept
2776 Warn when a noexcept-expression evaluates to false because of a call
2777 to a function that does not have a non-throwing exception
2778 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2779 the compiler to never throw an exception.
2780
2781 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2782 @opindex Wnon-virtual-dtor
2783 @opindex Wno-non-virtual-dtor
2784 Warn when a class has virtual functions and an accessible non-virtual
2785 destructor itself or in an accessible polymorphic base class, in which
2786 case it is possible but unsafe to delete an instance of a derived
2787 class through a pointer to the class itself or base class. This
2788 warning is automatically enabled if @option{-Weffc++} is specified.
2789
2790 @item -Wreorder @r{(C++ and Objective-C++ only)}
2791 @opindex Wreorder
2792 @opindex Wno-reorder
2793 @cindex reordering, warning
2794 @cindex warning for reordering of member initializers
2795 Warn when the order of member initializers given in the code does not
2796 match the order in which they must be executed. For instance:
2797
2798 @smallexample
2799 struct A @{
2800 int i;
2801 int j;
2802 A(): j (0), i (1) @{ @}
2803 @};
2804 @end smallexample
2805
2806 @noindent
2807 The compiler rearranges the member initializers for @code{i}
2808 and @code{j} to match the declaration order of the members, emitting
2809 a warning to that effect. This warning is enabled by @option{-Wall}.
2810
2811 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2812 @opindex fext-numeric-literals
2813 @opindex fno-ext-numeric-literals
2814 Accept imaginary, fixed-point, or machine-defined
2815 literal number suffixes as GNU extensions.
2816 When this option is turned off these suffixes are treated
2817 as C++11 user-defined literal numeric suffixes.
2818 This is on by default for all pre-C++11 dialects and all GNU dialects:
2819 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2820 @option{-std=gnu++14}.
2821 This option is off by default
2822 for ISO C++11 onwards (@option{-std=c++11}, ...).
2823 @end table
2824
2825 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2826
2827 @table @gcctabopt
2828 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2829 @opindex Weffc++
2830 @opindex Wno-effc++
2831 Warn about violations of the following style guidelines from Scott Meyers'
2832 @cite{Effective C++} series of books:
2833
2834 @itemize @bullet
2835 @item
2836 Define a copy constructor and an assignment operator for classes
2837 with dynamically-allocated memory.
2838
2839 @item
2840 Prefer initialization to assignment in constructors.
2841
2842 @item
2843 Have @code{operator=} return a reference to @code{*this}.
2844
2845 @item
2846 Don't try to return a reference when you must return an object.
2847
2848 @item
2849 Distinguish between prefix and postfix forms of increment and
2850 decrement operators.
2851
2852 @item
2853 Never overload @code{&&}, @code{||}, or @code{,}.
2854
2855 @end itemize
2856
2857 This option also enables @option{-Wnon-virtual-dtor}, which is also
2858 one of the effective C++ recommendations. However, the check is
2859 extended to warn about the lack of virtual destructor in accessible
2860 non-polymorphic bases classes too.
2861
2862 When selecting this option, be aware that the standard library
2863 headers do not obey all of these guidelines; use @samp{grep -v}
2864 to filter out those warnings.
2865
2866 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2867 @opindex Wstrict-null-sentinel
2868 @opindex Wno-strict-null-sentinel
2869 Warn about the use of an uncasted @code{NULL} as sentinel. When
2870 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2871 to @code{__null}. Although it is a null pointer constant rather than a
2872 null pointer, it is guaranteed to be of the same size as a pointer.
2873 But this use is not portable across different compilers.
2874
2875 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2876 @opindex Wno-non-template-friend
2877 @opindex Wnon-template-friend
2878 Disable warnings when non-templatized friend functions are declared
2879 within a template. Since the advent of explicit template specification
2880 support in G++, if the name of the friend is an unqualified-id (i.e.,
2881 @samp{friend foo(int)}), the C++ language specification demands that the
2882 friend declare or define an ordinary, nontemplate function. (Section
2883 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2884 could be interpreted as a particular specialization of a templatized
2885 function. Because this non-conforming behavior is no longer the default
2886 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2887 check existing code for potential trouble spots and is on by default.
2888 This new compiler behavior can be turned off with
2889 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2890 but disables the helpful warning.
2891
2892 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2893 @opindex Wold-style-cast
2894 @opindex Wno-old-style-cast
2895 Warn if an old-style (C-style) cast to a non-void type is used within
2896 a C++ program. The new-style casts (@code{dynamic_cast},
2897 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
2898 less vulnerable to unintended effects and much easier to search for.
2899
2900 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2901 @opindex Woverloaded-virtual
2902 @opindex Wno-overloaded-virtual
2903 @cindex overloaded virtual function, warning
2904 @cindex warning for overloaded virtual function
2905 Warn when a function declaration hides virtual functions from a
2906 base class. For example, in:
2907
2908 @smallexample
2909 struct A @{
2910 virtual void f();
2911 @};
2912
2913 struct B: public A @{
2914 void f(int);
2915 @};
2916 @end smallexample
2917
2918 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2919 like:
2920
2921 @smallexample
2922 B* b;
2923 b->f();
2924 @end smallexample
2925
2926 @noindent
2927 fails to compile.
2928
2929 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2930 @opindex Wno-pmf-conversions
2931 @opindex Wpmf-conversions
2932 Disable the diagnostic for converting a bound pointer to member function
2933 to a plain pointer.
2934
2935 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2936 @opindex Wsign-promo
2937 @opindex Wno-sign-promo
2938 Warn when overload resolution chooses a promotion from unsigned or
2939 enumerated type to a signed type, over a conversion to an unsigned type of
2940 the same size. Previous versions of G++ tried to preserve
2941 unsignedness, but the standard mandates the current behavior.
2942
2943 @item -Wtemplates @r{(C++ and Objective-C++ only)}
2944 @opindex Wtemplates
2945 Warn when a primary template declaration is encountered. Some coding
2946 rules disallow templates, and this may be used to enforce that rule.
2947 The warning is inactive inside a system header file, such as the STL, so
2948 one can still use the STL. One may also instantiate or specialize
2949 templates.
2950
2951 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
2952 @opindex Wmultiple-inheritance
2953 Warn when a class is defined with multiple direct base classes. Some
2954 coding rules disallow multiple inheritance, and this may be used to
2955 enforce that rule. The warning is inactive inside a system header file,
2956 such as the STL, so one can still use the STL. One may also define
2957 classes that indirectly use multiple inheritance.
2958
2959 @item -Wvirtual-inheritance
2960 @opindex Wvirtual-inheritance
2961 Warn when a class is defined with a virtual direct base classe. Some
2962 coding rules disallow multiple inheritance, and this may be used to
2963 enforce that rule. The warning is inactive inside a system header file,
2964 such as the STL, so one can still use the STL. One may also define
2965 classes that indirectly use virtual inheritance.
2966
2967 @item -Wnamespaces
2968 @opindex Wnamespaces
2969 Warn when a namespace definition is opened. Some coding rules disallow
2970 namespaces, and this may be used to enforce that rule. The warning is
2971 inactive inside a system header file, such as the STL, so one can still
2972 use the STL. One may also use using directives and qualified names.
2973
2974 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
2975 @opindex Wterminate
2976 @opindex Wno-terminate
2977 Disable the warning about a throw-expression that will immediately
2978 result in a call to @code{terminate}.
2979 @end table
2980
2981 @node Objective-C and Objective-C++ Dialect Options
2982 @section Options Controlling Objective-C and Objective-C++ Dialects
2983
2984 @cindex compiler options, Objective-C and Objective-C++
2985 @cindex Objective-C and Objective-C++ options, command-line
2986 @cindex options, Objective-C and Objective-C++
2987 (NOTE: This manual does not describe the Objective-C and Objective-C++
2988 languages themselves. @xref{Standards,,Language Standards
2989 Supported by GCC}, for references.)
2990
2991 This section describes the command-line options that are only meaningful
2992 for Objective-C and Objective-C++ programs. You can also use most of
2993 the language-independent GNU compiler options.
2994 For example, you might compile a file @file{some_class.m} like this:
2995
2996 @smallexample
2997 gcc -g -fgnu-runtime -O -c some_class.m
2998 @end smallexample
2999
3000 @noindent
3001 In this example, @option{-fgnu-runtime} is an option meant only for
3002 Objective-C and Objective-C++ programs; you can use the other options with
3003 any language supported by GCC@.
3004
3005 Note that since Objective-C is an extension of the C language, Objective-C
3006 compilations may also use options specific to the C front-end (e.g.,
3007 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3008 C++-specific options (e.g., @option{-Wabi}).
3009
3010 Here is a list of options that are @emph{only} for compiling Objective-C
3011 and Objective-C++ programs:
3012
3013 @table @gcctabopt
3014 @item -fconstant-string-class=@var{class-name}
3015 @opindex fconstant-string-class
3016 Use @var{class-name} as the name of the class to instantiate for each
3017 literal string specified with the syntax @code{@@"@dots{}"}. The default
3018 class name is @code{NXConstantString} if the GNU runtime is being used, and
3019 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3020 @option{-fconstant-cfstrings} option, if also present, overrides the
3021 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3022 to be laid out as constant CoreFoundation strings.
3023
3024 @item -fgnu-runtime
3025 @opindex fgnu-runtime
3026 Generate object code compatible with the standard GNU Objective-C
3027 runtime. This is the default for most types of systems.
3028
3029 @item -fnext-runtime
3030 @opindex fnext-runtime
3031 Generate output compatible with the NeXT runtime. This is the default
3032 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3033 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3034 used.
3035
3036 @item -fno-nil-receivers
3037 @opindex fno-nil-receivers
3038 Assume that all Objective-C message dispatches (@code{[receiver
3039 message:arg]}) in this translation unit ensure that the receiver is
3040 not @code{nil}. This allows for more efficient entry points in the
3041 runtime to be used. This option is only available in conjunction with
3042 the NeXT runtime and ABI version 0 or 1.
3043
3044 @item -fobjc-abi-version=@var{n}
3045 @opindex fobjc-abi-version
3046 Use version @var{n} of the Objective-C ABI for the selected runtime.
3047 This option is currently supported only for the NeXT runtime. In that
3048 case, Version 0 is the traditional (32-bit) ABI without support for
3049 properties and other Objective-C 2.0 additions. Version 1 is the
3050 traditional (32-bit) ABI with support for properties and other
3051 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3052 nothing is specified, the default is Version 0 on 32-bit target
3053 machines, and Version 2 on 64-bit target machines.
3054
3055 @item -fobjc-call-cxx-cdtors
3056 @opindex fobjc-call-cxx-cdtors
3057 For each Objective-C class, check if any of its instance variables is a
3058 C++ object with a non-trivial default constructor. If so, synthesize a
3059 special @code{- (id) .cxx_construct} instance method which runs
3060 non-trivial default constructors on any such instance variables, in order,
3061 and then return @code{self}. Similarly, check if any instance variable
3062 is a C++ object with a non-trivial destructor, and if so, synthesize a
3063 special @code{- (void) .cxx_destruct} method which runs
3064 all such default destructors, in reverse order.
3065
3066 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3067 methods thusly generated only operate on instance variables
3068 declared in the current Objective-C class, and not those inherited
3069 from superclasses. It is the responsibility of the Objective-C
3070 runtime to invoke all such methods in an object's inheritance
3071 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3072 by the runtime immediately after a new object instance is allocated;
3073 the @code{- (void) .cxx_destruct} methods are invoked immediately
3074 before the runtime deallocates an object instance.
3075
3076 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3077 support for invoking the @code{- (id) .cxx_construct} and
3078 @code{- (void) .cxx_destruct} methods.
3079
3080 @item -fobjc-direct-dispatch
3081 @opindex fobjc-direct-dispatch
3082 Allow fast jumps to the message dispatcher. On Darwin this is
3083 accomplished via the comm page.
3084
3085 @item -fobjc-exceptions
3086 @opindex fobjc-exceptions
3087 Enable syntactic support for structured exception handling in
3088 Objective-C, similar to what is offered by C++ and Java. This option
3089 is required to use the Objective-C keywords @code{@@try},
3090 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3091 @code{@@synchronized}. This option is available with both the GNU
3092 runtime and the NeXT runtime (but not available in conjunction with
3093 the NeXT runtime on Mac OS X 10.2 and earlier).
3094
3095 @item -fobjc-gc
3096 @opindex fobjc-gc
3097 Enable garbage collection (GC) in Objective-C and Objective-C++
3098 programs. This option is only available with the NeXT runtime; the
3099 GNU runtime has a different garbage collection implementation that
3100 does not require special compiler flags.
3101
3102 @item -fobjc-nilcheck
3103 @opindex fobjc-nilcheck
3104 For the NeXT runtime with version 2 of the ABI, check for a nil
3105 receiver in method invocations before doing the actual method call.
3106 This is the default and can be disabled using
3107 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3108 checked for nil in this way no matter what this flag is set to.
3109 Currently this flag does nothing when the GNU runtime, or an older
3110 version of the NeXT runtime ABI, is used.
3111
3112 @item -fobjc-std=objc1
3113 @opindex fobjc-std
3114 Conform to the language syntax of Objective-C 1.0, the language
3115 recognized by GCC 4.0. This only affects the Objective-C additions to
3116 the C/C++ language; it does not affect conformance to C/C++ standards,
3117 which is controlled by the separate C/C++ dialect option flags. When
3118 this option is used with the Objective-C or Objective-C++ compiler,
3119 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3120 This is useful if you need to make sure that your Objective-C code can
3121 be compiled with older versions of GCC@.
3122
3123 @item -freplace-objc-classes
3124 @opindex freplace-objc-classes
3125 Emit a special marker instructing @command{ld(1)} not to statically link in
3126 the resulting object file, and allow @command{dyld(1)} to load it in at
3127 run time instead. This is used in conjunction with the Fix-and-Continue
3128 debugging mode, where the object file in question may be recompiled and
3129 dynamically reloaded in the course of program execution, without the need
3130 to restart the program itself. Currently, Fix-and-Continue functionality
3131 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3132 and later.
3133
3134 @item -fzero-link
3135 @opindex fzero-link
3136 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3137 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3138 compile time) with static class references that get initialized at load time,
3139 which improves run-time performance. Specifying the @option{-fzero-link} flag
3140 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3141 to be retained. This is useful in Zero-Link debugging mode, since it allows
3142 for individual class implementations to be modified during program execution.
3143 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3144 regardless of command-line options.
3145
3146 @item -fno-local-ivars
3147 @opindex fno-local-ivars
3148 @opindex flocal-ivars
3149 By default instance variables in Objective-C can be accessed as if
3150 they were local variables from within the methods of the class they're
3151 declared in. This can lead to shadowing between instance variables
3152 and other variables declared either locally inside a class method or
3153 globally with the same name. Specifying the @option{-fno-local-ivars}
3154 flag disables this behavior thus avoiding variable shadowing issues.
3155
3156 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3157 @opindex fivar-visibility
3158 Set the default instance variable visibility to the specified option
3159 so that instance variables declared outside the scope of any access
3160 modifier directives default to the specified visibility.
3161
3162 @item -gen-decls
3163 @opindex gen-decls
3164 Dump interface declarations for all classes seen in the source file to a
3165 file named @file{@var{sourcename}.decl}.
3166
3167 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3168 @opindex Wassign-intercept
3169 @opindex Wno-assign-intercept
3170 Warn whenever an Objective-C assignment is being intercepted by the
3171 garbage collector.
3172
3173 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3174 @opindex Wno-protocol
3175 @opindex Wprotocol
3176 If a class is declared to implement a protocol, a warning is issued for
3177 every method in the protocol that is not implemented by the class. The
3178 default behavior is to issue a warning for every method not explicitly
3179 implemented in the class, even if a method implementation is inherited
3180 from the superclass. If you use the @option{-Wno-protocol} option, then
3181 methods inherited from the superclass are considered to be implemented,
3182 and no warning is issued for them.
3183
3184 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3185 @opindex Wselector
3186 @opindex Wno-selector
3187 Warn if multiple methods of different types for the same selector are
3188 found during compilation. The check is performed on the list of methods
3189 in the final stage of compilation. Additionally, a check is performed
3190 for each selector appearing in a @code{@@selector(@dots{})}
3191 expression, and a corresponding method for that selector has been found
3192 during compilation. Because these checks scan the method table only at
3193 the end of compilation, these warnings are not produced if the final
3194 stage of compilation is not reached, for example because an error is
3195 found during compilation, or because the @option{-fsyntax-only} option is
3196 being used.
3197
3198 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3199 @opindex Wstrict-selector-match
3200 @opindex Wno-strict-selector-match
3201 Warn if multiple methods with differing argument and/or return types are
3202 found for a given selector when attempting to send a message using this
3203 selector to a receiver of type @code{id} or @code{Class}. When this flag
3204 is off (which is the default behavior), the compiler omits such warnings
3205 if any differences found are confined to types that share the same size
3206 and alignment.
3207
3208 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3209 @opindex Wundeclared-selector
3210 @opindex Wno-undeclared-selector
3211 Warn if a @code{@@selector(@dots{})} expression referring to an
3212 undeclared selector is found. A selector is considered undeclared if no
3213 method with that name has been declared before the
3214 @code{@@selector(@dots{})} expression, either explicitly in an
3215 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3216 an @code{@@implementation} section. This option always performs its
3217 checks as soon as a @code{@@selector(@dots{})} expression is found,
3218 while @option{-Wselector} only performs its checks in the final stage of
3219 compilation. This also enforces the coding style convention
3220 that methods and selectors must be declared before being used.
3221
3222 @item -print-objc-runtime-info
3223 @opindex print-objc-runtime-info
3224 Generate C header describing the largest structure that is passed by
3225 value, if any.
3226
3227 @end table
3228
3229 @node Diagnostic Message Formatting Options
3230 @section Options to Control Diagnostic Messages Formatting
3231 @cindex options to control diagnostics formatting
3232 @cindex diagnostic messages
3233 @cindex message formatting
3234
3235 Traditionally, diagnostic messages have been formatted irrespective of
3236 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3237 options described below
3238 to control the formatting algorithm for diagnostic messages,
3239 e.g.@: how many characters per line, how often source location
3240 information should be reported. Note that some language front ends may not
3241 honor these options.
3242
3243 @table @gcctabopt
3244 @item -fmessage-length=@var{n}
3245 @opindex fmessage-length
3246 Try to format error messages so that they fit on lines of about
3247 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3248 done; each error message appears on a single line. This is the
3249 default for all front ends.
3250
3251 @item -fdiagnostics-show-location=once
3252 @opindex fdiagnostics-show-location
3253 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3254 reporter to emit source location information @emph{once}; that is, in
3255 case the message is too long to fit on a single physical line and has to
3256 be wrapped, the source location won't be emitted (as prefix) again,
3257 over and over, in subsequent continuation lines. This is the default
3258 behavior.
3259
3260 @item -fdiagnostics-show-location=every-line
3261 Only meaningful in line-wrapping mode. Instructs the diagnostic
3262 messages reporter to emit the same source location information (as
3263 prefix) for physical lines that result from the process of breaking
3264 a message which is too long to fit on a single line.
3265
3266 @item -fdiagnostics-color[=@var{WHEN}]
3267 @itemx -fno-diagnostics-color
3268 @opindex fdiagnostics-color
3269 @cindex highlight, color, colour
3270 @vindex GCC_COLORS @r{environment variable}
3271 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3272 or @samp{auto}. The default depends on how the compiler has been configured,
3273 it can be any of the above @var{WHEN} options or also @samp{never}
3274 if @env{GCC_COLORS} environment variable isn't present in the environment,
3275 and @samp{auto} otherwise.
3276 @samp{auto} means to use color only when the standard error is a terminal.
3277 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3278 aliases for @option{-fdiagnostics-color=always} and
3279 @option{-fdiagnostics-color=never}, respectively.
3280
3281 The colors are defined by the environment variable @env{GCC_COLORS}.
3282 Its value is a colon-separated list of capabilities and Select Graphic
3283 Rendition (SGR) substrings. SGR commands are interpreted by the
3284 terminal or terminal emulator. (See the section in the documentation
3285 of your text terminal for permitted values and their meanings as
3286 character attributes.) These substring values are integers in decimal
3287 representation and can be concatenated with semicolons.
3288 Common values to concatenate include
3289 @samp{1} for bold,
3290 @samp{4} for underline,
3291 @samp{5} for blink,
3292 @samp{7} for inverse,
3293 @samp{39} for default foreground color,
3294 @samp{30} to @samp{37} for foreground colors,
3295 @samp{90} to @samp{97} for 16-color mode foreground colors,
3296 @samp{38;5;0} to @samp{38;5;255}
3297 for 88-color and 256-color modes foreground colors,
3298 @samp{49} for default background color,
3299 @samp{40} to @samp{47} for background colors,
3300 @samp{100} to @samp{107} for 16-color mode background colors,
3301 and @samp{48;5;0} to @samp{48;5;255}
3302 for 88-color and 256-color modes background colors.
3303
3304 The default @env{GCC_COLORS} is
3305 @smallexample
3306 error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01
3307 @end smallexample
3308 @noindent
3309 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3310 @samp{01;36} is bold cyan, @samp{01;32} is bold green and
3311 @samp{01} is bold. Setting @env{GCC_COLORS} to the empty
3312 string disables colors.
3313 Supported capabilities are as follows.
3314
3315 @table @code
3316 @item error=
3317 @vindex error GCC_COLORS @r{capability}
3318 SGR substring for error: markers.
3319
3320 @item warning=
3321 @vindex warning GCC_COLORS @r{capability}
3322 SGR substring for warning: markers.
3323
3324 @item note=
3325 @vindex note GCC_COLORS @r{capability}
3326 SGR substring for note: markers.
3327
3328 @item caret=
3329 @vindex caret GCC_COLORS @r{capability}
3330 SGR substring for caret line.
3331
3332 @item locus=
3333 @vindex locus GCC_COLORS @r{capability}
3334 SGR substring for location information, @samp{file:line} or
3335 @samp{file:line:column} etc.
3336
3337 @item quote=
3338 @vindex quote GCC_COLORS @r{capability}
3339 SGR substring for information printed within quotes.
3340 @end table
3341
3342 @item -fno-diagnostics-show-option
3343 @opindex fno-diagnostics-show-option
3344 @opindex fdiagnostics-show-option
3345 By default, each diagnostic emitted includes text indicating the
3346 command-line option that directly controls the diagnostic (if such an
3347 option is known to the diagnostic machinery). Specifying the
3348 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3349
3350 @item -fno-diagnostics-show-caret
3351 @opindex fno-diagnostics-show-caret
3352 @opindex fdiagnostics-show-caret
3353 By default, each diagnostic emitted includes the original source line
3354 and a caret '^' indicating the column. This option suppresses this
3355 information. The source line is truncated to @var{n} characters, if
3356 the @option{-fmessage-length=n} option is given. When the output is done
3357 to the terminal, the width is limited to the width given by the
3358 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3359
3360 @end table
3361
3362 @node Warning Options
3363 @section Options to Request or Suppress Warnings
3364 @cindex options to control warnings
3365 @cindex warning messages
3366 @cindex messages, warning
3367 @cindex suppressing warnings
3368
3369 Warnings are diagnostic messages that report constructions that
3370 are not inherently erroneous but that are risky or suggest there
3371 may have been an error.
3372
3373 The following language-independent options do not enable specific
3374 warnings but control the kinds of diagnostics produced by GCC@.
3375
3376 @table @gcctabopt
3377 @cindex syntax checking
3378 @item -fsyntax-only
3379 @opindex fsyntax-only
3380 Check the code for syntax errors, but don't do anything beyond that.
3381
3382 @item -fmax-errors=@var{n}
3383 @opindex fmax-errors
3384 Limits the maximum number of error messages to @var{n}, at which point
3385 GCC bails out rather than attempting to continue processing the source
3386 code. If @var{n} is 0 (the default), there is no limit on the number
3387 of error messages produced. If @option{-Wfatal-errors} is also
3388 specified, then @option{-Wfatal-errors} takes precedence over this
3389 option.
3390
3391 @item -w
3392 @opindex w
3393 Inhibit all warning messages.
3394
3395 @item -Werror
3396 @opindex Werror
3397 @opindex Wno-error
3398 Make all warnings into errors.
3399
3400 @item -Werror=
3401 @opindex Werror=
3402 @opindex Wno-error=
3403 Make the specified warning into an error. The specifier for a warning
3404 is appended; for example @option{-Werror=switch} turns the warnings
3405 controlled by @option{-Wswitch} into errors. This switch takes a
3406 negative form, to be used to negate @option{-Werror} for specific
3407 warnings; for example @option{-Wno-error=switch} makes
3408 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3409 is in effect.
3410
3411 The warning message for each controllable warning includes the
3412 option that controls the warning. That option can then be used with
3413 @option{-Werror=} and @option{-Wno-error=} as described above.
3414 (Printing of the option in the warning message can be disabled using the
3415 @option{-fno-diagnostics-show-option} flag.)
3416
3417 Note that specifying @option{-Werror=}@var{foo} automatically implies
3418 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3419 imply anything.
3420
3421 @item -Wfatal-errors
3422 @opindex Wfatal-errors
3423 @opindex Wno-fatal-errors
3424 This option causes the compiler to abort compilation on the first error
3425 occurred rather than trying to keep going and printing further error
3426 messages.
3427
3428 @end table
3429
3430 You can request many specific warnings with options beginning with
3431 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3432 implicit declarations. Each of these specific warning options also
3433 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3434 example, @option{-Wno-implicit}. This manual lists only one of the
3435 two forms, whichever is not the default. For further
3436 language-specific options also refer to @ref{C++ Dialect Options} and
3437 @ref{Objective-C and Objective-C++ Dialect Options}.
3438
3439 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3440 options, such as @option{-Wunused}, which may turn on further options,
3441 such as @option{-Wunused-value}. The combined effect of positive and
3442 negative forms is that more specific options have priority over less
3443 specific ones, independently of their position in the command-line. For
3444 options of the same specificity, the last one takes effect. Options
3445 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3446 as if they appeared at the end of the command-line.
3447
3448 When an unrecognized warning option is requested (e.g.,
3449 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3450 that the option is not recognized. However, if the @option{-Wno-} form
3451 is used, the behavior is slightly different: no diagnostic is
3452 produced for @option{-Wno-unknown-warning} unless other diagnostics
3453 are being produced. This allows the use of new @option{-Wno-} options
3454 with old compilers, but if something goes wrong, the compiler
3455 warns that an unrecognized option is present.
3456
3457 @table @gcctabopt
3458 @item -Wpedantic
3459 @itemx -pedantic
3460 @opindex pedantic
3461 @opindex Wpedantic
3462 Issue all the warnings demanded by strict ISO C and ISO C++;
3463 reject all programs that use forbidden extensions, and some other
3464 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3465 version of the ISO C standard specified by any @option{-std} option used.
3466
3467 Valid ISO C and ISO C++ programs should compile properly with or without
3468 this option (though a rare few require @option{-ansi} or a
3469 @option{-std} option specifying the required version of ISO C)@. However,
3470 without this option, certain GNU extensions and traditional C and C++
3471 features are supported as well. With this option, they are rejected.
3472
3473 @option{-Wpedantic} does not cause warning messages for use of the
3474 alternate keywords whose names begin and end with @samp{__}. Pedantic
3475 warnings are also disabled in the expression that follows
3476 @code{__extension__}. However, only system header files should use
3477 these escape routes; application programs should avoid them.
3478 @xref{Alternate Keywords}.
3479
3480 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3481 C conformance. They soon find that it does not do quite what they want:
3482 it finds some non-ISO practices, but not all---only those for which
3483 ISO C @emph{requires} a diagnostic, and some others for which
3484 diagnostics have been added.
3485
3486 A feature to report any failure to conform to ISO C might be useful in
3487 some instances, but would require considerable additional work and would
3488 be quite different from @option{-Wpedantic}. We don't have plans to
3489 support such a feature in the near future.
3490
3491 Where the standard specified with @option{-std} represents a GNU
3492 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3493 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3494 extended dialect is based. Warnings from @option{-Wpedantic} are given
3495 where they are required by the base standard. (It does not make sense
3496 for such warnings to be given only for features not in the specified GNU
3497 C dialect, since by definition the GNU dialects of C include all
3498 features the compiler supports with the given option, and there would be
3499 nothing to warn about.)
3500
3501 @item -pedantic-errors
3502 @opindex pedantic-errors
3503 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3504 requires a diagnostic, in some cases where there is undefined behavior
3505 at compile-time and in some other cases that do not prevent compilation
3506 of programs that are valid according to the standard. This is not
3507 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3508 by this option and not enabled by the latter and vice versa.
3509
3510 @item -Wall
3511 @opindex Wall
3512 @opindex Wno-all
3513 This enables all the warnings about constructions that some users
3514 consider questionable, and that are easy to avoid (or modify to
3515 prevent the warning), even in conjunction with macros. This also
3516 enables some language-specific warnings described in @ref{C++ Dialect
3517 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3518
3519 @option{-Wall} turns on the following warning flags:
3520
3521 @gccoptlist{-Waddress @gol
3522 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3523 -Wc++11-compat -Wc++14-compat@gol
3524 -Wchar-subscripts @gol
3525 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3526 -Wimplicit-int @r{(C and Objective-C only)} @gol
3527 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3528 -Wbool-compare @gol
3529 -Wduplicated-cond @gol
3530 -Wcomment @gol
3531 -Wformat @gol
3532 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3533 -Wmaybe-uninitialized @gol
3534 -Wmissing-braces @r{(only for C/ObjC)} @gol
3535 -Wnonnull @gol
3536 -Wopenmp-simd @gol
3537 -Wparentheses @gol
3538 -Wpointer-sign @gol
3539 -Wreorder @gol
3540 -Wreturn-type @gol
3541 -Wsequence-point @gol
3542 -Wsign-compare @r{(only in C++)} @gol
3543 -Wstrict-aliasing @gol
3544 -Wstrict-overflow=1 @gol
3545 -Wswitch @gol
3546 -Wtautological-compare @gol
3547 -Wtrigraphs @gol
3548 -Wuninitialized @gol
3549 -Wunknown-pragmas @gol
3550 -Wunused-function @gol
3551 -Wunused-label @gol
3552 -Wunused-value @gol
3553 -Wunused-variable @gol
3554 -Wvolatile-register-var @gol
3555 }
3556
3557 Note that some warning flags are not implied by @option{-Wall}. Some of
3558 them warn about constructions that users generally do not consider
3559 questionable, but which occasionally you might wish to check for;
3560 others warn about constructions that are necessary or hard to avoid in
3561 some cases, and there is no simple way to modify the code to suppress
3562 the warning. Some of them are enabled by @option{-Wextra} but many of
3563 them must be enabled individually.
3564
3565 @item -Wextra
3566 @opindex W
3567 @opindex Wextra
3568 @opindex Wno-extra
3569 This enables some extra warning flags that are not enabled by
3570 @option{-Wall}. (This option used to be called @option{-W}. The older
3571 name is still supported, but the newer name is more descriptive.)
3572
3573 @gccoptlist{-Wclobbered @gol
3574 -Wempty-body @gol
3575 -Wignored-qualifiers @gol
3576 -Wmissing-field-initializers @gol
3577 -Wmissing-parameter-type @r{(C only)} @gol
3578 -Wold-style-declaration @r{(C only)} @gol
3579 -Woverride-init @gol
3580 -Wsign-compare @gol
3581 -Wtype-limits @gol
3582 -Wuninitialized @gol
3583 -Wshift-negative-value @gol
3584 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3585 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3586 }
3587
3588 The option @option{-Wextra} also prints warning messages for the
3589 following cases:
3590
3591 @itemize @bullet
3592
3593 @item
3594 A pointer is compared against integer zero with @code{<}, @code{<=},
3595 @code{>}, or @code{>=}.
3596
3597 @item
3598 (C++ only) An enumerator and a non-enumerator both appear in a
3599 conditional expression.
3600
3601 @item
3602 (C++ only) Ambiguous virtual bases.
3603
3604 @item
3605 (C++ only) Subscripting an array that has been declared @code{register}.
3606
3607 @item
3608 (C++ only) Taking the address of a variable that has been declared
3609 @code{register}.
3610
3611 @item
3612 (C++ only) A base class is not initialized in a derived class's copy
3613 constructor.
3614
3615 @end itemize
3616
3617 @item -Wchar-subscripts
3618 @opindex Wchar-subscripts
3619 @opindex Wno-char-subscripts
3620 Warn if an array subscript has type @code{char}. This is a common cause
3621 of error, as programmers often forget that this type is signed on some
3622 machines.
3623 This warning is enabled by @option{-Wall}.
3624
3625 @item -Wcomment
3626 @opindex Wcomment
3627 @opindex Wno-comment
3628 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3629 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3630 This warning is enabled by @option{-Wall}.
3631
3632 @item -Wno-coverage-mismatch
3633 @opindex Wno-coverage-mismatch
3634 Warn if feedback profiles do not match when using the
3635 @option{-fprofile-use} option.
3636 If a source file is changed between compiling with @option{-fprofile-gen} and
3637 with @option{-fprofile-use}, the files with the profile feedback can fail
3638 to match the source file and GCC cannot use the profile feedback
3639 information. By default, this warning is enabled and is treated as an
3640 error. @option{-Wno-coverage-mismatch} can be used to disable the
3641 warning or @option{-Wno-error=coverage-mismatch} can be used to
3642 disable the error. Disabling the error for this warning can result in
3643 poorly optimized code and is useful only in the
3644 case of very minor changes such as bug fixes to an existing code-base.
3645 Completely disabling the warning is not recommended.
3646
3647 @item -Wno-cpp
3648 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3649
3650 Suppress warning messages emitted by @code{#warning} directives.
3651
3652 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3653 @opindex Wdouble-promotion
3654 @opindex Wno-double-promotion
3655 Give a warning when a value of type @code{float} is implicitly
3656 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3657 floating-point unit implement @code{float} in hardware, but emulate
3658 @code{double} in software. On such a machine, doing computations
3659 using @code{double} values is much more expensive because of the
3660 overhead required for software emulation.
3661
3662 It is easy to accidentally do computations with @code{double} because
3663 floating-point literals are implicitly of type @code{double}. For
3664 example, in:
3665 @smallexample
3666 @group
3667 float area(float radius)
3668 @{
3669 return 3.14159 * radius * radius;
3670 @}
3671 @end group
3672 @end smallexample
3673 the compiler performs the entire computation with @code{double}
3674 because the floating-point literal is a @code{double}.
3675
3676 @item -Wformat
3677 @itemx -Wformat=@var{n}
3678 @opindex Wformat
3679 @opindex Wno-format
3680 @opindex ffreestanding
3681 @opindex fno-builtin
3682 @opindex Wformat=
3683 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3684 the arguments supplied have types appropriate to the format string
3685 specified, and that the conversions specified in the format string make
3686 sense. This includes standard functions, and others specified by format
3687 attributes (@pxref{Function Attributes}), in the @code{printf},
3688 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3689 not in the C standard) families (or other target-specific families).
3690 Which functions are checked without format attributes having been
3691 specified depends on the standard version selected, and such checks of
3692 functions without the attribute specified are disabled by
3693 @option{-ffreestanding} or @option{-fno-builtin}.
3694
3695 The formats are checked against the format features supported by GNU
3696 libc version 2.2. These include all ISO C90 and C99 features, as well
3697 as features from the Single Unix Specification and some BSD and GNU
3698 extensions. Other library implementations may not support all these
3699 features; GCC does not support warning about features that go beyond a
3700 particular library's limitations. However, if @option{-Wpedantic} is used
3701 with @option{-Wformat}, warnings are given about format features not
3702 in the selected standard version (but not for @code{strfmon} formats,
3703 since those are not in any version of the C standard). @xref{C Dialect
3704 Options,,Options Controlling C Dialect}.
3705
3706 @table @gcctabopt
3707 @item -Wformat=1
3708 @itemx -Wformat
3709 @opindex Wformat
3710 @opindex Wformat=1
3711 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3712 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3713 @option{-Wformat} also checks for null format arguments for several
3714 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3715 aspects of this level of format checking can be disabled by the
3716 options: @option{-Wno-format-contains-nul},
3717 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3718 @option{-Wformat} is enabled by @option{-Wall}.
3719
3720 @item -Wno-format-contains-nul
3721 @opindex Wno-format-contains-nul
3722 @opindex Wformat-contains-nul
3723 If @option{-Wformat} is specified, do not warn about format strings that
3724 contain NUL bytes.
3725
3726 @item -Wno-format-extra-args
3727 @opindex Wno-format-extra-args
3728 @opindex Wformat-extra-args
3729 If @option{-Wformat} is specified, do not warn about excess arguments to a
3730 @code{printf} or @code{scanf} format function. The C standard specifies
3731 that such arguments are ignored.
3732
3733 Where the unused arguments lie between used arguments that are
3734 specified with @samp{$} operand number specifications, normally
3735 warnings are still given, since the implementation could not know what
3736 type to pass to @code{va_arg} to skip the unused arguments. However,
3737 in the case of @code{scanf} formats, this option suppresses the
3738 warning if the unused arguments are all pointers, since the Single
3739 Unix Specification says that such unused arguments are allowed.
3740
3741 @item -Wno-format-zero-length
3742 @opindex Wno-format-zero-length
3743 @opindex Wformat-zero-length
3744 If @option{-Wformat} is specified, do not warn about zero-length formats.
3745 The C standard specifies that zero-length formats are allowed.
3746
3747
3748 @item -Wformat=2
3749 @opindex Wformat=2
3750 Enable @option{-Wformat} plus additional format checks. Currently
3751 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3752 -Wformat-y2k}.
3753
3754 @item -Wformat-nonliteral
3755 @opindex Wformat-nonliteral
3756 @opindex Wno-format-nonliteral
3757 If @option{-Wformat} is specified, also warn if the format string is not a
3758 string literal and so cannot be checked, unless the format function
3759 takes its format arguments as a @code{va_list}.
3760
3761 @item -Wformat-security
3762 @opindex Wformat-security
3763 @opindex Wno-format-security
3764 If @option{-Wformat} is specified, also warn about uses of format
3765 functions that represent possible security problems. At present, this
3766 warns about calls to @code{printf} and @code{scanf} functions where the
3767 format string is not a string literal and there are no format arguments,
3768 as in @code{printf (foo);}. This may be a security hole if the format
3769 string came from untrusted input and contains @samp{%n}. (This is
3770 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3771 in future warnings may be added to @option{-Wformat-security} that are not
3772 included in @option{-Wformat-nonliteral}.)
3773
3774 @item -Wformat-signedness
3775 @opindex Wformat-signedness
3776 @opindex Wno-format-signedness
3777 If @option{-Wformat} is specified, also warn if the format string
3778 requires an unsigned argument and the argument is signed and vice versa.
3779
3780 @item -Wformat-y2k
3781 @opindex Wformat-y2k
3782 @opindex Wno-format-y2k
3783 If @option{-Wformat} is specified, also warn about @code{strftime}
3784 formats that may yield only a two-digit year.
3785 @end table
3786
3787 @item -Wnonnull
3788 @opindex Wnonnull
3789 @opindex Wno-nonnull
3790 Warn about passing a null pointer for arguments marked as
3791 requiring a non-null value by the @code{nonnull} function attribute.
3792
3793 Also warns when comparing an argument marked with the @code{nonnull}
3794 function attribute against null inside the function.
3795
3796 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3797 can be disabled with the @option{-Wno-nonnull} option.
3798
3799 @item -Wnull-dereference
3800 @opindex Wnull-dereference
3801 @opindex Wno-null-dereference
3802 Warn if the compiler detects paths that trigger erroneous or
3803 undefined behavior due to dereferencing a null pointer. This option
3804 is only active when @option{-fdelete-null-pointer-checks} is active,
3805 which is enabled by optimizations in most targets. The precision of
3806 the warnings depends on the optimization options used.
3807
3808 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3809 @opindex Winit-self
3810 @opindex Wno-init-self
3811 Warn about uninitialized variables that are initialized with themselves.
3812 Note this option can only be used with the @option{-Wuninitialized} option.
3813
3814 For example, GCC warns about @code{i} being uninitialized in the
3815 following snippet only when @option{-Winit-self} has been specified:
3816 @smallexample
3817 @group
3818 int f()
3819 @{
3820 int i = i;
3821 return i;
3822 @}
3823 @end group
3824 @end smallexample
3825
3826 This warning is enabled by @option{-Wall} in C++.
3827
3828 @item -Wimplicit-int @r{(C and Objective-C only)}
3829 @opindex Wimplicit-int
3830 @opindex Wno-implicit-int
3831 Warn when a declaration does not specify a type.
3832 This warning is enabled by @option{-Wall}.
3833
3834 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3835 @opindex Wimplicit-function-declaration
3836 @opindex Wno-implicit-function-declaration
3837 Give a warning whenever a function is used before being declared. In
3838 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3839 enabled by default and it is made into an error by
3840 @option{-pedantic-errors}. This warning is also enabled by
3841 @option{-Wall}.
3842
3843 @item -Wimplicit @r{(C and Objective-C only)}
3844 @opindex Wimplicit
3845 @opindex Wno-implicit
3846 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3847 This warning is enabled by @option{-Wall}.
3848
3849 @item -Wignored-qualifiers @r{(C and C++ only)}
3850 @opindex Wignored-qualifiers
3851 @opindex Wno-ignored-qualifiers
3852 Warn if the return type of a function has a type qualifier
3853 such as @code{const}. For ISO C such a type qualifier has no effect,
3854 since the value returned by a function is not an lvalue.
3855 For C++, the warning is only emitted for scalar types or @code{void}.
3856 ISO C prohibits qualified @code{void} return types on function
3857 definitions, so such return types always receive a warning
3858 even without this option.
3859
3860 This warning is also enabled by @option{-Wextra}.
3861
3862 @item -Wmain
3863 @opindex Wmain
3864 @opindex Wno-main
3865 Warn if the type of @code{main} is suspicious. @code{main} should be
3866 a function with external linkage, returning int, taking either zero
3867 arguments, two, or three arguments of appropriate types. This warning
3868 is enabled by default in C++ and is enabled by either @option{-Wall}
3869 or @option{-Wpedantic}.
3870
3871 @item -Wmisleading-indentation @r{(C and C++ only)}
3872 @opindex Wmisleading-indentation
3873 @opindex Wno-misleading-indentation
3874 Warn when the indentation of the code does not reflect the block structure.
3875 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
3876 @code{for} clauses with a guarded statement that does not use braces,
3877 followed by an unguarded statement with the same indentation.
3878
3879 This warning is disabled by default.
3880
3881 In the following example, the call to ``bar'' is misleadingly indented as
3882 if it were guarded by the ``if'' conditional.
3883
3884 @smallexample
3885 if (some_condition ())
3886 foo ();
3887 bar (); /* Gotcha: this is not guarded by the "if". */
3888 @end smallexample
3889
3890 In the case of mixed tabs and spaces, the warning uses the
3891 @option{-ftabstop=} option to determine if the statements line up
3892 (defaulting to 8).
3893
3894 The warning is not issued for code involving multiline preprocessor logic
3895 such as the following example.
3896
3897 @smallexample
3898 if (flagA)
3899 foo (0);
3900 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
3901 if (flagB)
3902 #endif
3903 foo (1);
3904 @end smallexample
3905
3906 The warning is not issued after a @code{#line} directive, since this
3907 typically indicates autogenerated code, and no assumptions can be made
3908 about the layout of the file that the directive references.
3909
3910 @item -Wmissing-braces
3911 @opindex Wmissing-braces
3912 @opindex Wno-missing-braces
3913 Warn if an aggregate or union initializer is not fully bracketed. In
3914 the following example, the initializer for @code{a} is not fully
3915 bracketed, but that for @code{b} is fully bracketed. This warning is
3916 enabled by @option{-Wall} in C.
3917
3918 @smallexample
3919 int a[2][2] = @{ 0, 1, 2, 3 @};
3920 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3921 @end smallexample
3922
3923 This warning is enabled by @option{-Wall}.
3924
3925 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3926 @opindex Wmissing-include-dirs
3927 @opindex Wno-missing-include-dirs
3928 Warn if a user-supplied include directory does not exist.
3929
3930 @item -Wparentheses
3931 @opindex Wparentheses
3932 @opindex Wno-parentheses
3933 Warn if parentheses are omitted in certain contexts, such
3934 as when there is an assignment in a context where a truth value
3935 is expected, or when operators are nested whose precedence people
3936 often get confused about.
3937
3938 Also warn if a comparison like @code{x<=y<=z} appears; this is
3939 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
3940 interpretation from that of ordinary mathematical notation.
3941
3942 Also warn about constructions where there may be confusion to which
3943 @code{if} statement an @code{else} branch belongs. Here is an example of
3944 such a case:
3945
3946 @smallexample
3947 @group
3948 @{
3949 if (a)
3950 if (b)
3951 foo ();
3952 else
3953 bar ();
3954 @}
3955 @end group
3956 @end smallexample
3957
3958 In C/C++, every @code{else} branch belongs to the innermost possible
3959 @code{if} statement, which in this example is @code{if (b)}. This is
3960 often not what the programmer expected, as illustrated in the above
3961 example by indentation the programmer chose. When there is the
3962 potential for this confusion, GCC issues a warning when this flag
3963 is specified. To eliminate the warning, add explicit braces around
3964 the innermost @code{if} statement so there is no way the @code{else}
3965 can belong to the enclosing @code{if}. The resulting code
3966 looks like this:
3967
3968 @smallexample
3969 @group
3970 @{
3971 if (a)
3972 @{
3973 if (b)
3974 foo ();
3975 else
3976 bar ();
3977 @}
3978 @}
3979 @end group
3980 @end smallexample
3981
3982 Also warn for dangerous uses of the GNU extension to
3983 @code{?:} with omitted middle operand. When the condition
3984 in the @code{?}: operator is a boolean expression, the omitted value is
3985 always 1. Often programmers expect it to be a value computed
3986 inside the conditional expression instead.
3987
3988 This warning is enabled by @option{-Wall}.
3989
3990 @item -Wsequence-point
3991 @opindex Wsequence-point
3992 @opindex Wno-sequence-point
3993 Warn about code that may have undefined semantics because of violations
3994 of sequence point rules in the C and C++ standards.
3995
3996 The C and C++ standards define the order in which expressions in a C/C++
3997 program are evaluated in terms of @dfn{sequence points}, which represent
3998 a partial ordering between the execution of parts of the program: those
3999 executed before the sequence point, and those executed after it. These
4000 occur after the evaluation of a full expression (one which is not part
4001 of a larger expression), after the evaluation of the first operand of a
4002 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4003 function is called (but after the evaluation of its arguments and the
4004 expression denoting the called function), and in certain other places.
4005 Other than as expressed by the sequence point rules, the order of
4006 evaluation of subexpressions of an expression is not specified. All
4007 these rules describe only a partial order rather than a total order,
4008 since, for example, if two functions are called within one expression
4009 with no sequence point between them, the order in which the functions
4010 are called is not specified. However, the standards committee have
4011 ruled that function calls do not overlap.
4012
4013 It is not specified when between sequence points modifications to the
4014 values of objects take effect. Programs whose behavior depends on this
4015 have undefined behavior; the C and C++ standards specify that ``Between
4016 the previous and next sequence point an object shall have its stored
4017 value modified at most once by the evaluation of an expression.
4018 Furthermore, the prior value shall be read only to determine the value
4019 to be stored.''. If a program breaks these rules, the results on any
4020 particular implementation are entirely unpredictable.
4021
4022 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4023 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4024 diagnosed by this option, and it may give an occasional false positive
4025 result, but in general it has been found fairly effective at detecting
4026 this sort of problem in programs.
4027
4028 The standard is worded confusingly, therefore there is some debate
4029 over the precise meaning of the sequence point rules in subtle cases.
4030 Links to discussions of the problem, including proposed formal
4031 definitions, may be found on the GCC readings page, at
4032 @uref{http://gcc.gnu.org/@/readings.html}.
4033
4034 This warning is enabled by @option{-Wall} for C and C++.
4035
4036 @item -Wno-return-local-addr
4037 @opindex Wno-return-local-addr
4038 @opindex Wreturn-local-addr
4039 Do not warn about returning a pointer (or in C++, a reference) to a
4040 variable that goes out of scope after the function returns.
4041
4042 @item -Wreturn-type
4043 @opindex Wreturn-type
4044 @opindex Wno-return-type
4045 Warn whenever a function is defined with a return type that defaults
4046 to @code{int}. Also warn about any @code{return} statement with no
4047 return value in a function whose return type is not @code{void}
4048 (falling off the end of the function body is considered returning
4049 without a value), and about a @code{return} statement with an
4050 expression in a function whose return type is @code{void}.
4051
4052 For C++, a function without return type always produces a diagnostic
4053 message, even when @option{-Wno-return-type} is specified. The only
4054 exceptions are @code{main} and functions defined in system headers.
4055
4056 This warning is enabled by @option{-Wall}.
4057
4058 @item -Wshift-count-negative
4059 @opindex Wshift-count-negative
4060 @opindex Wno-shift-count-negative
4061 Warn if shift count is negative. This warning is enabled by default.
4062
4063 @item -Wshift-count-overflow
4064 @opindex Wshift-count-overflow
4065 @opindex Wno-shift-count-overflow
4066 Warn if shift count >= width of type. This warning is enabled by default.
4067
4068 @item -Wshift-negative-value
4069 @opindex Wshift-negative-value
4070 @opindex Wno-shift-negative-value
4071 Warn if left shifting a negative value. This warning is enabled by
4072 @option{-Wextra} in C99 and C++11 modes (and newer).
4073
4074 @item -Wshift-overflow
4075 @itemx -Wshift-overflow=@var{n}
4076 @opindex Wshift-overflow
4077 @opindex Wno-shift-overflow
4078 Warn about left shift overflows. This warning is enabled by
4079 default in C99 and C++11 modes (and newer).
4080
4081 @table @gcctabopt
4082 @item -Wshift-overflow=1
4083 This is the warning level of @option{-Wshift-overflow} and is enabled
4084 by default in C99 and C++11 modes (and newer). This warning level does
4085 not warn about left-shifting 1 into the sign bit. (However, in C, such
4086 an overflow is still rejected in contexts where an integer constant expression
4087 is required.)
4088
4089 @item -Wshift-overflow=2
4090 This warning level also warns about left-shifting 1 into the sign bit,
4091 unless C++14 mode is active.
4092 @end table
4093
4094 @item -Wswitch
4095 @opindex Wswitch
4096 @opindex Wno-switch
4097 Warn whenever a @code{switch} statement has an index of enumerated type
4098 and lacks a @code{case} for one or more of the named codes of that
4099 enumeration. (The presence of a @code{default} label prevents this
4100 warning.) @code{case} labels outside the enumeration range also
4101 provoke warnings when this option is used (even if there is a
4102 @code{default} label).
4103 This warning is enabled by @option{-Wall}.
4104
4105 @item -Wswitch-default
4106 @opindex Wswitch-default
4107 @opindex Wno-switch-default
4108 Warn whenever a @code{switch} statement does not have a @code{default}
4109 case.
4110
4111 @item -Wswitch-enum
4112 @opindex Wswitch-enum
4113 @opindex Wno-switch-enum
4114 Warn whenever a @code{switch} statement has an index of enumerated type
4115 and lacks a @code{case} for one or more of the named codes of that
4116 enumeration. @code{case} labels outside the enumeration range also
4117 provoke warnings when this option is used. The only difference
4118 between @option{-Wswitch} and this option is that this option gives a
4119 warning about an omitted enumeration code even if there is a
4120 @code{default} label.
4121
4122 @item -Wswitch-bool
4123 @opindex Wswitch-bool
4124 @opindex Wno-switch-bool
4125 Warn whenever a @code{switch} statement has an index of boolean type
4126 and the case values are outside the range of a boolean type.
4127 It is possible to suppress this warning by casting the controlling
4128 expression to a type other than @code{bool}. For example:
4129 @smallexample
4130 @group
4131 switch ((int) (a == 4))
4132 @{
4133 @dots{}
4134 @}
4135 @end group
4136 @end smallexample
4137 This warning is enabled by default for C and C++ programs.
4138
4139 @item -Wsync-nand @r{(C and C++ only)}
4140 @opindex Wsync-nand
4141 @opindex Wno-sync-nand
4142 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4143 built-in functions are used. These functions changed semantics in GCC 4.4.
4144
4145 @item -Wtrigraphs
4146 @opindex Wtrigraphs
4147 @opindex Wno-trigraphs
4148 Warn if any trigraphs are encountered that might change the meaning of
4149 the program (trigraphs within comments are not warned about).
4150 This warning is enabled by @option{-Wall}.
4151
4152 @item -Wunused-but-set-parameter
4153 @opindex Wunused-but-set-parameter
4154 @opindex Wno-unused-but-set-parameter
4155 Warn whenever a function parameter is assigned to, but otherwise unused
4156 (aside from its declaration).
4157
4158 To suppress this warning use the @code{unused} attribute
4159 (@pxref{Variable Attributes}).
4160
4161 This warning is also enabled by @option{-Wunused} together with
4162 @option{-Wextra}.
4163
4164 @item -Wunused-but-set-variable
4165 @opindex Wunused-but-set-variable
4166 @opindex Wno-unused-but-set-variable
4167 Warn whenever a local variable is assigned to, but otherwise unused
4168 (aside from its declaration).
4169 This warning is enabled by @option{-Wall}.
4170
4171 To suppress this warning use the @code{unused} attribute
4172 (@pxref{Variable Attributes}).
4173
4174 This warning is also enabled by @option{-Wunused}, which is enabled
4175 by @option{-Wall}.
4176
4177 @item -Wunused-function
4178 @opindex Wunused-function
4179 @opindex Wno-unused-function
4180 Warn whenever a static function is declared but not defined or a
4181 non-inline static function is unused.
4182 This warning is enabled by @option{-Wall}.
4183
4184 @item -Wunused-label
4185 @opindex Wunused-label
4186 @opindex Wno-unused-label
4187 Warn whenever a label is declared but not used.
4188 This warning is enabled by @option{-Wall}.
4189
4190 To suppress this warning use the @code{unused} attribute
4191 (@pxref{Variable Attributes}).
4192
4193 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4194 @opindex Wunused-local-typedefs
4195 Warn when a typedef locally defined in a function is not used.
4196 This warning is enabled by @option{-Wall}.
4197
4198 @item -Wunused-parameter
4199 @opindex Wunused-parameter
4200 @opindex Wno-unused-parameter
4201 Warn whenever a function parameter is unused aside from its declaration.
4202
4203 To suppress this warning use the @code{unused} attribute
4204 (@pxref{Variable Attributes}).
4205
4206 @item -Wno-unused-result
4207 @opindex Wunused-result
4208 @opindex Wno-unused-result
4209 Do not warn if a caller of a function marked with attribute
4210 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4211 its return value. The default is @option{-Wunused-result}.
4212
4213 @item -Wunused-variable
4214 @opindex Wunused-variable
4215 @opindex Wno-unused-variable
4216 Warn whenever a local or static variable is unused aside from its
4217 declaration. This option implies @option{-Wunused-const-variable} for C,
4218 but not for C++. This warning is enabled by @option{-Wall}.
4219
4220 To suppress this warning use the @code{unused} attribute
4221 (@pxref{Variable Attributes}).
4222
4223 @item -Wunused-const-variable
4224 @opindex Wunused-const-variable
4225 @opindex Wno-unused-const-variable
4226 Warn whenever a constant static variable is unused aside from its declaration.
4227 This warning is enabled by @option{-Wunused-variable} for C, but not for C++.
4228 In C++ this is normally not an error since const variables take the place of
4229 @code{#define}s in C++.
4230
4231 To suppress this warning use the @code{unused} attribute
4232 (@pxref{Variable Attributes}).
4233
4234 @item -Wunused-value
4235 @opindex Wunused-value
4236 @opindex Wno-unused-value
4237 Warn whenever a statement computes a result that is explicitly not
4238 used. To suppress this warning cast the unused expression to
4239 @code{void}. This includes an expression-statement or the left-hand
4240 side of a comma expression that contains no side effects. For example,
4241 an expression such as @code{x[i,j]} causes a warning, while
4242 @code{x[(void)i,j]} does not.
4243
4244 This warning is enabled by @option{-Wall}.
4245
4246 @item -Wunused
4247 @opindex Wunused
4248 @opindex Wno-unused
4249 All the above @option{-Wunused} options combined.
4250
4251 In order to get a warning about an unused function parameter, you must
4252 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4253 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4254
4255 @item -Wuninitialized
4256 @opindex Wuninitialized
4257 @opindex Wno-uninitialized
4258 Warn if an automatic variable is used without first being initialized
4259 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4260 warn if a non-static reference or non-static @code{const} member
4261 appears in a class without constructors.
4262
4263 If you want to warn about code that uses the uninitialized value of the
4264 variable in its own initializer, use the @option{-Winit-self} option.
4265
4266 These warnings occur for individual uninitialized or clobbered
4267 elements of structure, union or array variables as well as for
4268 variables that are uninitialized or clobbered as a whole. They do
4269 not occur for variables or elements declared @code{volatile}. Because
4270 these warnings depend on optimization, the exact variables or elements
4271 for which there are warnings depends on the precise optimization
4272 options and version of GCC used.
4273
4274 Note that there may be no warning about a variable that is used only
4275 to compute a value that itself is never used, because such
4276 computations may be deleted by data flow analysis before the warnings
4277 are printed.
4278
4279 @item -Wmaybe-uninitialized
4280 @opindex Wmaybe-uninitialized
4281 @opindex Wno-maybe-uninitialized
4282 For an automatic variable, if there exists a path from the function
4283 entry to a use of the variable that is initialized, but there exist
4284 some other paths for which the variable is not initialized, the compiler
4285 emits a warning if it cannot prove the uninitialized paths are not
4286 executed at run time. These warnings are made optional because GCC is
4287 not smart enough to see all the reasons why the code might be correct
4288 in spite of appearing to have an error. Here is one example of how
4289 this can happen:
4290
4291 @smallexample
4292 @group
4293 @{
4294 int x;
4295 switch (y)
4296 @{
4297 case 1: x = 1;
4298 break;
4299 case 2: x = 4;
4300 break;
4301 case 3: x = 5;
4302 @}
4303 foo (x);
4304 @}
4305 @end group
4306 @end smallexample
4307
4308 @noindent
4309 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4310 always initialized, but GCC doesn't know this. To suppress the
4311 warning, you need to provide a default case with assert(0) or
4312 similar code.
4313
4314 @cindex @code{longjmp} warnings
4315 This option also warns when a non-volatile automatic variable might be
4316 changed by a call to @code{longjmp}. These warnings as well are possible
4317 only in optimizing compilation.
4318
4319 The compiler sees only the calls to @code{setjmp}. It cannot know
4320 where @code{longjmp} will be called; in fact, a signal handler could
4321 call it at any point in the code. As a result, you may get a warning
4322 even when there is in fact no problem because @code{longjmp} cannot
4323 in fact be called at the place that would cause a problem.
4324
4325 Some spurious warnings can be avoided if you declare all the functions
4326 you use that never return as @code{noreturn}. @xref{Function
4327 Attributes}.
4328
4329 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4330
4331 @item -Wunknown-pragmas
4332 @opindex Wunknown-pragmas
4333 @opindex Wno-unknown-pragmas
4334 @cindex warning for unknown pragmas
4335 @cindex unknown pragmas, warning
4336 @cindex pragmas, warning of unknown
4337 Warn when a @code{#pragma} directive is encountered that is not understood by
4338 GCC@. If this command-line option is used, warnings are even issued
4339 for unknown pragmas in system header files. This is not the case if
4340 the warnings are only enabled by the @option{-Wall} command-line option.
4341
4342 @item -Wno-pragmas
4343 @opindex Wno-pragmas
4344 @opindex Wpragmas
4345 Do not warn about misuses of pragmas, such as incorrect parameters,
4346 invalid syntax, or conflicts between pragmas. See also
4347 @option{-Wunknown-pragmas}.
4348
4349 @item -Wstrict-aliasing
4350 @opindex Wstrict-aliasing
4351 @opindex Wno-strict-aliasing
4352 This option is only active when @option{-fstrict-aliasing} is active.
4353 It warns about code that might break the strict aliasing rules that the
4354 compiler is using for optimization. The warning does not catch all
4355 cases, but does attempt to catch the more common pitfalls. It is
4356 included in @option{-Wall}.
4357 It is equivalent to @option{-Wstrict-aliasing=3}
4358
4359 @item -Wstrict-aliasing=n
4360 @opindex Wstrict-aliasing=n
4361 This option is only active when @option{-fstrict-aliasing} is active.
4362 It warns about code that might break the strict aliasing rules that the
4363 compiler is using for optimization.
4364 Higher levels correspond to higher accuracy (fewer false positives).
4365 Higher levels also correspond to more effort, similar to the way @option{-O}
4366 works.
4367 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4368
4369 Level 1: Most aggressive, quick, least accurate.
4370 Possibly useful when higher levels
4371 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4372 false negatives. However, it has many false positives.
4373 Warns for all pointer conversions between possibly incompatible types,
4374 even if never dereferenced. Runs in the front end only.
4375
4376 Level 2: Aggressive, quick, not too precise.
4377 May still have many false positives (not as many as level 1 though),
4378 and few false negatives (but possibly more than level 1).
4379 Unlike level 1, it only warns when an address is taken. Warns about
4380 incomplete types. Runs in the front end only.
4381
4382 Level 3 (default for @option{-Wstrict-aliasing}):
4383 Should have very few false positives and few false
4384 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4385 Takes care of the common pun+dereference pattern in the front end:
4386 @code{*(int*)&some_float}.
4387 If optimization is enabled, it also runs in the back end, where it deals
4388 with multiple statement cases using flow-sensitive points-to information.
4389 Only warns when the converted pointer is dereferenced.
4390 Does not warn about incomplete types.
4391
4392 @item -Wstrict-overflow
4393 @itemx -Wstrict-overflow=@var{n}
4394 @opindex Wstrict-overflow
4395 @opindex Wno-strict-overflow
4396 This option is only active when @option{-fstrict-overflow} is active.
4397 It warns about cases where the compiler optimizes based on the
4398 assumption that signed overflow does not occur. Note that it does not
4399 warn about all cases where the code might overflow: it only warns
4400 about cases where the compiler implements some optimization. Thus
4401 this warning depends on the optimization level.
4402
4403 An optimization that assumes that signed overflow does not occur is
4404 perfectly safe if the values of the variables involved are such that
4405 overflow never does, in fact, occur. Therefore this warning can
4406 easily give a false positive: a warning about code that is not
4407 actually a problem. To help focus on important issues, several
4408 warning levels are defined. No warnings are issued for the use of
4409 undefined signed overflow when estimating how many iterations a loop
4410 requires, in particular when determining whether a loop will be
4411 executed at all.
4412
4413 @table @gcctabopt
4414 @item -Wstrict-overflow=1
4415 Warn about cases that are both questionable and easy to avoid. For
4416 example, with @option{-fstrict-overflow}, the compiler simplifies
4417 @code{x + 1 > x} to @code{1}. This level of
4418 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4419 are not, and must be explicitly requested.
4420
4421 @item -Wstrict-overflow=2
4422 Also warn about other cases where a comparison is simplified to a
4423 constant. For example: @code{abs (x) >= 0}. This can only be
4424 simplified when @option{-fstrict-overflow} is in effect, because
4425 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4426 zero. @option{-Wstrict-overflow} (with no level) is the same as
4427 @option{-Wstrict-overflow=2}.
4428
4429 @item -Wstrict-overflow=3
4430 Also warn about other cases where a comparison is simplified. For
4431 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4432
4433 @item -Wstrict-overflow=4
4434 Also warn about other simplifications not covered by the above cases.
4435 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4436
4437 @item -Wstrict-overflow=5
4438 Also warn about cases where the compiler reduces the magnitude of a
4439 constant involved in a comparison. For example: @code{x + 2 > y} is
4440 simplified to @code{x + 1 >= y}. This is reported only at the
4441 highest warning level because this simplification applies to many
4442 comparisons, so this warning level gives a very large number of
4443 false positives.
4444 @end table
4445
4446 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4447 @opindex Wsuggest-attribute=
4448 @opindex Wno-suggest-attribute=
4449 Warn for cases where adding an attribute may be beneficial. The
4450 attributes currently supported are listed below.
4451
4452 @table @gcctabopt
4453 @item -Wsuggest-attribute=pure
4454 @itemx -Wsuggest-attribute=const
4455 @itemx -Wsuggest-attribute=noreturn
4456 @opindex Wsuggest-attribute=pure
4457 @opindex Wno-suggest-attribute=pure
4458 @opindex Wsuggest-attribute=const
4459 @opindex Wno-suggest-attribute=const
4460 @opindex Wsuggest-attribute=noreturn
4461 @opindex Wno-suggest-attribute=noreturn
4462
4463 Warn about functions that might be candidates for attributes
4464 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4465 functions visible in other compilation units or (in the case of @code{pure} and
4466 @code{const}) if it cannot prove that the function returns normally. A function
4467 returns normally if it doesn't contain an infinite loop or return abnormally
4468 by throwing, calling @code{abort} or trapping. This analysis requires option
4469 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4470 higher. Higher optimization levels improve the accuracy of the analysis.
4471
4472 @item -Wsuggest-attribute=format
4473 @itemx -Wmissing-format-attribute
4474 @opindex Wsuggest-attribute=format
4475 @opindex Wmissing-format-attribute
4476 @opindex Wno-suggest-attribute=format
4477 @opindex Wno-missing-format-attribute
4478 @opindex Wformat
4479 @opindex Wno-format
4480
4481 Warn about function pointers that might be candidates for @code{format}
4482 attributes. Note these are only possible candidates, not absolute ones.
4483 GCC guesses that function pointers with @code{format} attributes that
4484 are used in assignment, initialization, parameter passing or return
4485 statements should have a corresponding @code{format} attribute in the
4486 resulting type. I.e.@: the left-hand side of the assignment or
4487 initialization, the type of the parameter variable, or the return type
4488 of the containing function respectively should also have a @code{format}
4489 attribute to avoid the warning.
4490
4491 GCC also warns about function definitions that might be
4492 candidates for @code{format} attributes. Again, these are only
4493 possible candidates. GCC guesses that @code{format} attributes
4494 might be appropriate for any function that calls a function like
4495 @code{vprintf} or @code{vscanf}, but this might not always be the
4496 case, and some functions for which @code{format} attributes are
4497 appropriate may not be detected.
4498 @end table
4499
4500 @item -Wsuggest-final-types
4501 @opindex Wno-suggest-final-types
4502 @opindex Wsuggest-final-types
4503 Warn about types with virtual methods where code quality would be improved
4504 if the type were declared with the C++11 @code{final} specifier,
4505 or, if possible,
4506 declared in an anonymous namespace. This allows GCC to more aggressively
4507 devirtualize the polymorphic calls. This warning is more effective with link
4508 time optimization, where the information about the class hierarchy graph is
4509 more complete.
4510
4511 @item -Wsuggest-final-methods
4512 @opindex Wno-suggest-final-methods
4513 @opindex Wsuggest-final-methods
4514 Warn about virtual methods where code quality would be improved if the method
4515 were declared with the C++11 @code{final} specifier,
4516 or, if possible, its type were
4517 declared in an anonymous namespace or with the @code{final} specifier.
4518 This warning is
4519 more effective with link time optimization, where the information about the
4520 class hierarchy graph is more complete. It is recommended to first consider
4521 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4522 annotations.
4523
4524 @item -Wsuggest-override
4525 Warn about overriding virtual functions that are not marked with the override
4526 keyword.
4527
4528 @item -Warray-bounds
4529 @itemx -Warray-bounds=@var{n}
4530 @opindex Wno-array-bounds
4531 @opindex Warray-bounds
4532 This option is only active when @option{-ftree-vrp} is active
4533 (default for @option{-O2} and above). It warns about subscripts to arrays
4534 that are always out of bounds. This warning is enabled by @option{-Wall}.
4535
4536 @table @gcctabopt
4537 @item -Warray-bounds=1
4538 This is the warning level of @option{-Warray-bounds} and is enabled
4539 by @option{-Wall}; higher levels are not, and must be explicitly requested.
4540
4541 @item -Warray-bounds=2
4542 This warning level also warns about out of bounds access for
4543 arrays at the end of a struct and for arrays accessed through
4544 pointers. This warning level may give a larger number of
4545 false positives and is deactivated by default.
4546 @end table
4547
4548 @item -Wbool-compare
4549 @opindex Wno-bool-compare
4550 @opindex Wbool-compare
4551 Warn about boolean expression compared with an integer value different from
4552 @code{true}/@code{false}. For instance, the following comparison is
4553 always false:
4554 @smallexample
4555 int n = 5;
4556 @dots{}
4557 if ((n > 1) == 2) @{ @dots{} @}
4558 @end smallexample
4559 This warning is enabled by @option{-Wall}.
4560
4561 @item -Wduplicated-cond
4562 @opindex Wno-duplicated-cond
4563 @opindex Wduplicated-cond
4564 Warn about duplicated conditions in an if-else-if chain. For instance,
4565 warn for the following code:
4566 @smallexample
4567 if (p->q != NULL) @{ @dots{} @}
4568 else if (p->q != NULL) @{ @dots{} @}
4569 @end smallexample
4570 This warning is enabled by @option{-Wall}.
4571
4572 @item -Wframe-address
4573 @opindex Wno-frame-address
4574 @opindex Wframe-address
4575 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
4576 is called with an argument greater than 0. Such calls may return indeterminate
4577 values or crash the program. The warning is included in @option{-Wall}.
4578
4579 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
4580 @opindex Wno-discarded-qualifiers
4581 @opindex Wdiscarded-qualifiers
4582 Do not warn if type qualifiers on pointers are being discarded.
4583 Typically, the compiler warns if a @code{const char *} variable is
4584 passed to a function that takes a @code{char *} parameter. This option
4585 can be used to suppress such a warning.
4586
4587 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
4588 @opindex Wno-discarded-array-qualifiers
4589 @opindex Wdiscarded-array-qualifiers
4590 Do not warn if type qualifiers on arrays which are pointer targets
4591 are being discarded. Typically, the compiler warns if a
4592 @code{const int (*)[]} variable is passed to a function that
4593 takes a @code{int (*)[]} parameter. This option can be used to
4594 suppress such a warning.
4595
4596 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
4597 @opindex Wno-incompatible-pointer-types
4598 @opindex Wincompatible-pointer-types
4599 Do not warn when there is a conversion between pointers that have incompatible
4600 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
4601 which warns for pointer argument passing or assignment with different
4602 signedness.
4603
4604 @item -Wno-int-conversion @r{(C and Objective-C only)}
4605 @opindex Wno-int-conversion
4606 @opindex Wint-conversion
4607 Do not warn about incompatible integer to pointer and pointer to integer
4608 conversions. This warning is about implicit conversions; for explicit
4609 conversions the warnings @option{-Wno-int-to-pointer-cast} and
4610 @option{-Wno-pointer-to-int-cast} may be used.
4611
4612 @item -Wno-div-by-zero
4613 @opindex Wno-div-by-zero
4614 @opindex Wdiv-by-zero
4615 Do not warn about compile-time integer division by zero. Floating-point
4616 division by zero is not warned about, as it can be a legitimate way of
4617 obtaining infinities and NaNs.
4618
4619 @item -Wsystem-headers
4620 @opindex Wsystem-headers
4621 @opindex Wno-system-headers
4622 @cindex warnings from system headers
4623 @cindex system headers, warnings from
4624 Print warning messages for constructs found in system header files.
4625 Warnings from system headers are normally suppressed, on the assumption
4626 that they usually do not indicate real problems and would only make the
4627 compiler output harder to read. Using this command-line option tells
4628 GCC to emit warnings from system headers as if they occurred in user
4629 code. However, note that using @option{-Wall} in conjunction with this
4630 option does @emph{not} warn about unknown pragmas in system
4631 headers---for that, @option{-Wunknown-pragmas} must also be used.
4632
4633 @item -Wtautological-compare
4634 @opindex Wtautological-compare
4635 @opindex Wno-tautological-compare
4636 Warn if a self-comparison always evaluates to true or false. This
4637 warning detects various mistakes such as:
4638 @smallexample
4639 int i = 1;
4640 @dots{}
4641 if (i > i) @{ @dots{} @}
4642 @end smallexample
4643 This warning is enabled by @option{-Wall}.
4644
4645 @item -Wtrampolines
4646 @opindex Wtrampolines
4647 @opindex Wno-trampolines
4648 Warn about trampolines generated for pointers to nested functions.
4649 A trampoline is a small piece of data or code that is created at run
4650 time on the stack when the address of a nested function is taken, and is
4651 used to call the nested function indirectly. For some targets, it is
4652 made up of data only and thus requires no special treatment. But, for
4653 most targets, it is made up of code and thus requires the stack to be
4654 made executable in order for the program to work properly.
4655
4656 @item -Wfloat-equal
4657 @opindex Wfloat-equal
4658 @opindex Wno-float-equal
4659 Warn if floating-point values are used in equality comparisons.
4660
4661 The idea behind this is that sometimes it is convenient (for the
4662 programmer) to consider floating-point values as approximations to
4663 infinitely precise real numbers. If you are doing this, then you need
4664 to compute (by analyzing the code, or in some other way) the maximum or
4665 likely maximum error that the computation introduces, and allow for it
4666 when performing comparisons (and when producing output, but that's a
4667 different problem). In particular, instead of testing for equality, you
4668 should check to see whether the two values have ranges that overlap; and
4669 this is done with the relational operators, so equality comparisons are
4670 probably mistaken.
4671
4672 @item -Wtraditional @r{(C and Objective-C only)}
4673 @opindex Wtraditional
4674 @opindex Wno-traditional
4675 Warn about certain constructs that behave differently in traditional and
4676 ISO C@. Also warn about ISO C constructs that have no traditional C
4677 equivalent, and/or problematic constructs that should be avoided.
4678
4679 @itemize @bullet
4680 @item
4681 Macro parameters that appear within string literals in the macro body.
4682 In traditional C macro replacement takes place within string literals,
4683 but in ISO C it does not.
4684
4685 @item
4686 In traditional C, some preprocessor directives did not exist.
4687 Traditional preprocessors only considered a line to be a directive
4688 if the @samp{#} appeared in column 1 on the line. Therefore
4689 @option{-Wtraditional} warns about directives that traditional C
4690 understands but ignores because the @samp{#} does not appear as the
4691 first character on the line. It also suggests you hide directives like
4692 @code{#pragma} not understood by traditional C by indenting them. Some
4693 traditional implementations do not recognize @code{#elif}, so this option
4694 suggests avoiding it altogether.
4695
4696 @item
4697 A function-like macro that appears without arguments.
4698
4699 @item
4700 The unary plus operator.
4701
4702 @item
4703 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4704 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
4705 constants.) Note, these suffixes appear in macros defined in the system
4706 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4707 Use of these macros in user code might normally lead to spurious
4708 warnings, however GCC's integrated preprocessor has enough context to
4709 avoid warning in these cases.
4710
4711 @item
4712 A function declared external in one block and then used after the end of
4713 the block.
4714
4715 @item
4716 A @code{switch} statement has an operand of type @code{long}.
4717
4718 @item
4719 A non-@code{static} function declaration follows a @code{static} one.
4720 This construct is not accepted by some traditional C compilers.
4721
4722 @item
4723 The ISO type of an integer constant has a different width or
4724 signedness from its traditional type. This warning is only issued if
4725 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
4726 typically represent bit patterns, are not warned about.
4727
4728 @item
4729 Usage of ISO string concatenation is detected.
4730
4731 @item
4732 Initialization of automatic aggregates.
4733
4734 @item
4735 Identifier conflicts with labels. Traditional C lacks a separate
4736 namespace for labels.
4737
4738 @item
4739 Initialization of unions. If the initializer is zero, the warning is
4740 omitted. This is done under the assumption that the zero initializer in
4741 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4742 initializer warnings and relies on default initialization to zero in the
4743 traditional C case.
4744
4745 @item
4746 Conversions by prototypes between fixed/floating-point values and vice
4747 versa. The absence of these prototypes when compiling with traditional
4748 C causes serious problems. This is a subset of the possible
4749 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4750
4751 @item
4752 Use of ISO C style function definitions. This warning intentionally is
4753 @emph{not} issued for prototype declarations or variadic functions
4754 because these ISO C features appear in your code when using
4755 libiberty's traditional C compatibility macros, @code{PARAMS} and
4756 @code{VPARAMS}. This warning is also bypassed for nested functions
4757 because that feature is already a GCC extension and thus not relevant to
4758 traditional C compatibility.
4759 @end itemize
4760
4761 @item -Wtraditional-conversion @r{(C and Objective-C only)}
4762 @opindex Wtraditional-conversion
4763 @opindex Wno-traditional-conversion
4764 Warn if a prototype causes a type conversion that is different from what
4765 would happen to the same argument in the absence of a prototype. This
4766 includes conversions of fixed point to floating and vice versa, and
4767 conversions changing the width or signedness of a fixed-point argument
4768 except when the same as the default promotion.
4769
4770 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4771 @opindex Wdeclaration-after-statement
4772 @opindex Wno-declaration-after-statement
4773 Warn when a declaration is found after a statement in a block. This
4774 construct, known from C++, was introduced with ISO C99 and is by default
4775 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
4776
4777 @item -Wundef
4778 @opindex Wundef
4779 @opindex Wno-undef
4780 Warn if an undefined identifier is evaluated in an @code{#if} directive.
4781
4782 @item -Wno-endif-labels
4783 @opindex Wno-endif-labels
4784 @opindex Wendif-labels
4785 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
4786
4787 @item -Wshadow
4788 @opindex Wshadow
4789 @opindex Wno-shadow
4790 Warn whenever a local variable or type declaration shadows another
4791 variable, parameter, type, class member (in C++), or instance variable
4792 (in Objective-C) or whenever a built-in function is shadowed. Note
4793 that in C++, the compiler warns if a local variable shadows an
4794 explicit typedef, but not if it shadows a struct/class/enum.
4795
4796 @item -Wno-shadow-ivar @r{(Objective-C only)}
4797 @opindex Wno-shadow-ivar
4798 @opindex Wshadow-ivar
4799 Do not warn whenever a local variable shadows an instance variable in an
4800 Objective-C method.
4801
4802 @item -Wlarger-than=@var{len}
4803 @opindex Wlarger-than=@var{len}
4804 @opindex Wlarger-than-@var{len}
4805 Warn whenever an object of larger than @var{len} bytes is defined.
4806
4807 @item -Wframe-larger-than=@var{len}
4808 @opindex Wframe-larger-than
4809 Warn if the size of a function frame is larger than @var{len} bytes.
4810 The computation done to determine the stack frame size is approximate
4811 and not conservative.
4812 The actual requirements may be somewhat greater than @var{len}
4813 even if you do not get a warning. In addition, any space allocated
4814 via @code{alloca}, variable-length arrays, or related constructs
4815 is not included by the compiler when determining
4816 whether or not to issue a warning.
4817
4818 @item -Wno-free-nonheap-object
4819 @opindex Wno-free-nonheap-object
4820 @opindex Wfree-nonheap-object
4821 Do not warn when attempting to free an object that was not allocated
4822 on the heap.
4823
4824 @item -Wstack-usage=@var{len}
4825 @opindex Wstack-usage
4826 Warn if the stack usage of a function might be larger than @var{len} bytes.
4827 The computation done to determine the stack usage is conservative.
4828 Any space allocated via @code{alloca}, variable-length arrays, or related
4829 constructs is included by the compiler when determining whether or not to
4830 issue a warning.
4831
4832 The message is in keeping with the output of @option{-fstack-usage}.
4833
4834 @itemize
4835 @item
4836 If the stack usage is fully static but exceeds the specified amount, it's:
4837
4838 @smallexample
4839 warning: stack usage is 1120 bytes
4840 @end smallexample
4841 @item
4842 If the stack usage is (partly) dynamic but bounded, it's:
4843
4844 @smallexample
4845 warning: stack usage might be 1648 bytes
4846 @end smallexample
4847 @item
4848 If the stack usage is (partly) dynamic and not bounded, it's:
4849
4850 @smallexample
4851 warning: stack usage might be unbounded
4852 @end smallexample
4853 @end itemize
4854
4855 @item -Wunsafe-loop-optimizations
4856 @opindex Wunsafe-loop-optimizations
4857 @opindex Wno-unsafe-loop-optimizations
4858 Warn if the loop cannot be optimized because the compiler cannot
4859 assume anything on the bounds of the loop indices. With
4860 @option{-funsafe-loop-optimizations} warn if the compiler makes
4861 such assumptions.
4862
4863 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
4864 @opindex Wno-pedantic-ms-format
4865 @opindex Wpedantic-ms-format
4866 When used in combination with @option{-Wformat}
4867 and @option{-pedantic} without GNU extensions, this option
4868 disables the warnings about non-ISO @code{printf} / @code{scanf} format
4869 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
4870 which depend on the MS runtime.
4871
4872 @item -Wpointer-arith
4873 @opindex Wpointer-arith
4874 @opindex Wno-pointer-arith
4875 Warn about anything that depends on the ``size of'' a function type or
4876 of @code{void}. GNU C assigns these types a size of 1, for
4877 convenience in calculations with @code{void *} pointers and pointers
4878 to functions. In C++, warn also when an arithmetic operation involves
4879 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
4880
4881 @item -Wtype-limits
4882 @opindex Wtype-limits
4883 @opindex Wno-type-limits
4884 Warn if a comparison is always true or always false due to the limited
4885 range of the data type, but do not warn for constant expressions. For
4886 example, warn if an unsigned variable is compared against zero with
4887 @code{<} or @code{>=}. This warning is also enabled by
4888 @option{-Wextra}.
4889
4890 @item -Wbad-function-cast @r{(C and Objective-C only)}
4891 @opindex Wbad-function-cast
4892 @opindex Wno-bad-function-cast
4893 Warn when a function call is cast to a non-matching type.
4894 For example, warn if a call to a function returning an integer type
4895 is cast to a pointer type.
4896
4897 @item -Wc90-c99-compat @r{(C and Objective-C only)}
4898 @opindex Wc90-c99-compat
4899 @opindex Wno-c90-c99-compat
4900 Warn about features not present in ISO C90, but present in ISO C99.
4901 For instance, warn about use of variable length arrays, @code{long long}
4902 type, @code{bool} type, compound literals, designated initializers, and so
4903 on. This option is independent of the standards mode. Warnings are disabled
4904 in the expression that follows @code{__extension__}.
4905
4906 @item -Wc99-c11-compat @r{(C and Objective-C only)}
4907 @opindex Wc99-c11-compat
4908 @opindex Wno-c99-c11-compat
4909 Warn about features not present in ISO C99, but present in ISO C11.
4910 For instance, warn about use of anonymous structures and unions,
4911 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
4912 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
4913 and so on. This option is independent of the standards mode. Warnings are
4914 disabled in the expression that follows @code{__extension__}.
4915
4916 @item -Wc++-compat @r{(C and Objective-C only)}
4917 @opindex Wc++-compat
4918 Warn about ISO C constructs that are outside of the common subset of
4919 ISO C and ISO C++, e.g.@: request for implicit conversion from
4920 @code{void *} to a pointer to non-@code{void} type.
4921
4922 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
4923 @opindex Wc++11-compat
4924 Warn about C++ constructs whose meaning differs between ISO C++ 1998
4925 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
4926 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
4927 enabled by @option{-Wall}.
4928
4929 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
4930 @opindex Wc++14-compat
4931 Warn about C++ constructs whose meaning differs between ISO C++ 2011
4932 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
4933
4934 @item -Wcast-qual
4935 @opindex Wcast-qual
4936 @opindex Wno-cast-qual
4937 Warn whenever a pointer is cast so as to remove a type qualifier from
4938 the target type. For example, warn if a @code{const char *} is cast
4939 to an ordinary @code{char *}.
4940
4941 Also warn when making a cast that introduces a type qualifier in an
4942 unsafe way. For example, casting @code{char **} to @code{const char **}
4943 is unsafe, as in this example:
4944
4945 @smallexample
4946 /* p is char ** value. */
4947 const char **q = (const char **) p;
4948 /* Assignment of readonly string to const char * is OK. */
4949 *q = "string";
4950 /* Now char** pointer points to read-only memory. */
4951 **p = 'b';
4952 @end smallexample
4953
4954 @item -Wcast-align
4955 @opindex Wcast-align
4956 @opindex Wno-cast-align
4957 Warn whenever a pointer is cast such that the required alignment of the
4958 target is increased. For example, warn if a @code{char *} is cast to
4959 an @code{int *} on machines where integers can only be accessed at
4960 two- or four-byte boundaries.
4961
4962 @item -Wwrite-strings
4963 @opindex Wwrite-strings
4964 @opindex Wno-write-strings
4965 When compiling C, give string constants the type @code{const
4966 char[@var{length}]} so that copying the address of one into a
4967 non-@code{const} @code{char *} pointer produces a warning. These
4968 warnings help you find at compile time code that can try to write
4969 into a string constant, but only if you have been very careful about
4970 using @code{const} in declarations and prototypes. Otherwise, it is
4971 just a nuisance. This is why we did not make @option{-Wall} request
4972 these warnings.
4973
4974 When compiling C++, warn about the deprecated conversion from string
4975 literals to @code{char *}. This warning is enabled by default for C++
4976 programs.
4977
4978 @item -Wclobbered
4979 @opindex Wclobbered
4980 @opindex Wno-clobbered
4981 Warn for variables that might be changed by @code{longjmp} or
4982 @code{vfork}. This warning is also enabled by @option{-Wextra}.
4983
4984 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4985 @opindex Wconditionally-supported
4986 @opindex Wno-conditionally-supported
4987 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4988
4989 @item -Wconversion
4990 @opindex Wconversion
4991 @opindex Wno-conversion
4992 Warn for implicit conversions that may alter a value. This includes
4993 conversions between real and integer, like @code{abs (x)} when
4994 @code{x} is @code{double}; conversions between signed and unsigned,
4995 like @code{unsigned ui = -1}; and conversions to smaller types, like
4996 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
4997 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
4998 changed by the conversion like in @code{abs (2.0)}. Warnings about
4999 conversions between signed and unsigned integers can be disabled by
5000 using @option{-Wno-sign-conversion}.
5001
5002 For C++, also warn for confusing overload resolution for user-defined
5003 conversions; and conversions that never use a type conversion
5004 operator: conversions to @code{void}, the same type, a base class or a
5005 reference to them. Warnings about conversions between signed and
5006 unsigned integers are disabled by default in C++ unless
5007 @option{-Wsign-conversion} is explicitly enabled.
5008
5009 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5010 @opindex Wconversion-null
5011 @opindex Wno-conversion-null
5012 Do not warn for conversions between @code{NULL} and non-pointer
5013 types. @option{-Wconversion-null} is enabled by default.
5014
5015 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5016 @opindex Wzero-as-null-pointer-constant
5017 @opindex Wno-zero-as-null-pointer-constant
5018 Warn when a literal '0' is used as null pointer constant. This can
5019 be useful to facilitate the conversion to @code{nullptr} in C++11.
5020
5021 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5022 @opindex Wsubobject-linkage
5023 @opindex Wno-subobject-linkage
5024 Warn if a class type has a base or a field whose type uses the anonymous
5025 namespace or depends on a type with no linkage. If a type A depends on
5026 a type B with no or internal linkage, defining it in multiple
5027 translation units would be an ODR violation because the meaning of B
5028 is different in each translation unit. If A only appears in a single
5029 translation unit, the best way to silence the warning is to give it
5030 internal linkage by putting it in an anonymous namespace as well. The
5031 compiler doesn't give this warning for types defined in the main .C
5032 file, as those are unlikely to have multiple definitions.
5033 @option{-Wsubobject-linkage} is enabled by default.
5034
5035 @item -Wdate-time
5036 @opindex Wdate-time
5037 @opindex Wno-date-time
5038 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5039 are encountered as they might prevent bit-wise-identical reproducible
5040 compilations.
5041
5042 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5043 @opindex Wdelete-incomplete
5044 @opindex Wno-delete-incomplete
5045 Warn when deleting a pointer to incomplete type, which may cause
5046 undefined behavior at runtime. This warning is enabled by default.
5047
5048 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5049 @opindex Wuseless-cast
5050 @opindex Wno-useless-cast
5051 Warn when an expression is casted to its own type.
5052
5053 @item -Wempty-body
5054 @opindex Wempty-body
5055 @opindex Wno-empty-body
5056 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5057 while} statement. This warning is also enabled by @option{-Wextra}.
5058
5059 @item -Wenum-compare
5060 @opindex Wenum-compare
5061 @opindex Wno-enum-compare
5062 Warn about a comparison between values of different enumerated types.
5063 In C++ enumeral mismatches in conditional expressions are also
5064 diagnosed and the warning is enabled by default. In C this warning is
5065 enabled by @option{-Wall}.
5066
5067 @item -Wjump-misses-init @r{(C, Objective-C only)}
5068 @opindex Wjump-misses-init
5069 @opindex Wno-jump-misses-init
5070 Warn if a @code{goto} statement or a @code{switch} statement jumps
5071 forward across the initialization of a variable, or jumps backward to a
5072 label after the variable has been initialized. This only warns about
5073 variables that are initialized when they are declared. This warning is
5074 only supported for C and Objective-C; in C++ this sort of branch is an
5075 error in any case.
5076
5077 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5078 can be disabled with the @option{-Wno-jump-misses-init} option.
5079
5080 @item -Wsign-compare
5081 @opindex Wsign-compare
5082 @opindex Wno-sign-compare
5083 @cindex warning for comparison of signed and unsigned values
5084 @cindex comparison of signed and unsigned values, warning
5085 @cindex signed and unsigned values, comparison warning
5086 Warn when a comparison between signed and unsigned values could produce
5087 an incorrect result when the signed value is converted to unsigned.
5088 This warning is also enabled by @option{-Wextra}; to get the other warnings
5089 of @option{-Wextra} without this warning, use @option{-Wextra -Wno-sign-compare}.
5090
5091 @item -Wsign-conversion
5092 @opindex Wsign-conversion
5093 @opindex Wno-sign-conversion
5094 Warn for implicit conversions that may change the sign of an integer
5095 value, like assigning a signed integer expression to an unsigned
5096 integer variable. An explicit cast silences the warning. In C, this
5097 option is enabled also by @option{-Wconversion}.
5098
5099 @item -Wfloat-conversion
5100 @opindex Wfloat-conversion
5101 @opindex Wno-float-conversion
5102 Warn for implicit conversions that reduce the precision of a real value.
5103 This includes conversions from real to integer, and from higher precision
5104 real to lower precision real values. This option is also enabled by
5105 @option{-Wconversion}.
5106
5107 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
5108 @opindex Wsized-deallocation
5109 @opindex Wno-sized-deallocation
5110 Warn about a definition of an unsized deallocation function
5111 @smallexample
5112 void operator delete (void *) noexcept;
5113 void operator delete[] (void *) noexcept;
5114 @end smallexample
5115 without a definition of the corresponding sized deallocation function
5116 @smallexample
5117 void operator delete (void *, std::size_t) noexcept;
5118 void operator delete[] (void *, std::size_t) noexcept;
5119 @end smallexample
5120 or vice versa. Enabled by @option{-Wextra} along with
5121 @option{-fsized-deallocation}.
5122
5123 @item -Wsizeof-pointer-memaccess
5124 @opindex Wsizeof-pointer-memaccess
5125 @opindex Wno-sizeof-pointer-memaccess
5126 Warn for suspicious length parameters to certain string and memory built-in
5127 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
5128 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
5129 but a pointer, and suggests a possible fix, or about
5130 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
5131 @option{-Wall}.
5132
5133 @item -Wsizeof-array-argument
5134 @opindex Wsizeof-array-argument
5135 @opindex Wno-sizeof-array-argument
5136 Warn when the @code{sizeof} operator is applied to a parameter that is
5137 declared as an array in a function definition. This warning is enabled by
5138 default for C and C++ programs.
5139
5140 @item -Wmemset-transposed-args
5141 @opindex Wmemset-transposed-args
5142 @opindex Wno-memset-transposed-args
5143 Warn for suspicious calls to the @code{memset} built-in function, if the
5144 second argument is not zero and the third argument is zero. This warns e.g.@
5145 about @code{memset (buf, sizeof buf, 0)} where most probably
5146 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
5147 is only emitted if the third argument is literal zero. If it is some
5148 expression that is folded to zero, a cast of zero to some type, etc.,
5149 it is far less likely that the user has mistakenly exchanged the arguments
5150 and no warning is emitted. This warning is enabled by @option{-Wall}.
5151
5152 @item -Waddress
5153 @opindex Waddress
5154 @opindex Wno-address
5155 Warn about suspicious uses of memory addresses. These include using
5156 the address of a function in a conditional expression, such as
5157 @code{void func(void); if (func)}, and comparisons against the memory
5158 address of a string literal, such as @code{if (x == "abc")}. Such
5159 uses typically indicate a programmer error: the address of a function
5160 always evaluates to true, so their use in a conditional usually
5161 indicate that the programmer forgot the parentheses in a function
5162 call; and comparisons against string literals result in unspecified
5163 behavior and are not portable in C, so they usually indicate that the
5164 programmer intended to use @code{strcmp}. This warning is enabled by
5165 @option{-Wall}.
5166
5167 @item -Wlogical-op
5168 @opindex Wlogical-op
5169 @opindex Wno-logical-op
5170 Warn about suspicious uses of logical operators in expressions.
5171 This includes using logical operators in contexts where a
5172 bit-wise operator is likely to be expected. Also warns when
5173 the operands of a logical operator are the same:
5174 @smallexample
5175 extern int a;
5176 if (a < 0 && a < 0) @{ @dots{} @}
5177 @end smallexample
5178
5179 @item -Wlogical-not-parentheses
5180 @opindex Wlogical-not-parentheses
5181 @opindex Wno-logical-not-parentheses
5182 Warn about logical not used on the left hand side operand of a comparison.
5183 This option does not warn if the RHS operand is of a boolean type. Its
5184 purpose is to detect suspicious code like the following:
5185 @smallexample
5186 int a;
5187 @dots{}
5188 if (!a > 1) @{ @dots{} @}
5189 @end smallexample
5190
5191 It is possible to suppress the warning by wrapping the LHS into
5192 parentheses:
5193 @smallexample
5194 if ((!a) > 1) @{ @dots{} @}
5195 @end smallexample
5196
5197 This warning is enabled by @option{-Wall}.
5198
5199 @item -Waggregate-return
5200 @opindex Waggregate-return
5201 @opindex Wno-aggregate-return
5202 Warn if any functions that return structures or unions are defined or
5203 called. (In languages where you can return an array, this also elicits
5204 a warning.)
5205
5206 @item -Wno-aggressive-loop-optimizations
5207 @opindex Wno-aggressive-loop-optimizations
5208 @opindex Waggressive-loop-optimizations
5209 Warn if in a loop with constant number of iterations the compiler detects
5210 undefined behavior in some statement during one or more of the iterations.
5211
5212 @item -Wno-attributes
5213 @opindex Wno-attributes
5214 @opindex Wattributes
5215 Do not warn if an unexpected @code{__attribute__} is used, such as
5216 unrecognized attributes, function attributes applied to variables,
5217 etc. This does not stop errors for incorrect use of supported
5218 attributes.
5219
5220 @item -Wno-builtin-macro-redefined
5221 @opindex Wno-builtin-macro-redefined
5222 @opindex Wbuiltin-macro-redefined
5223 Do not warn if certain built-in macros are redefined. This suppresses
5224 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
5225 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
5226
5227 @item -Wstrict-prototypes @r{(C and Objective-C only)}
5228 @opindex Wstrict-prototypes
5229 @opindex Wno-strict-prototypes
5230 Warn if a function is declared or defined without specifying the
5231 argument types. (An old-style function definition is permitted without
5232 a warning if preceded by a declaration that specifies the argument
5233 types.)
5234
5235 @item -Wold-style-declaration @r{(C and Objective-C only)}
5236 @opindex Wold-style-declaration
5237 @opindex Wno-old-style-declaration
5238 Warn for obsolescent usages, according to the C Standard, in a
5239 declaration. For example, warn if storage-class specifiers like
5240 @code{static} are not the first things in a declaration. This warning
5241 is also enabled by @option{-Wextra}.
5242
5243 @item -Wold-style-definition @r{(C and Objective-C only)}
5244 @opindex Wold-style-definition
5245 @opindex Wno-old-style-definition
5246 Warn if an old-style function definition is used. A warning is given
5247 even if there is a previous prototype.
5248
5249 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5250 @opindex Wmissing-parameter-type
5251 @opindex Wno-missing-parameter-type
5252 A function parameter is declared without a type specifier in K&R-style
5253 functions:
5254
5255 @smallexample
5256 void foo(bar) @{ @}
5257 @end smallexample
5258
5259 This warning is also enabled by @option{-Wextra}.
5260
5261 @item -Wmissing-prototypes @r{(C and Objective-C only)}
5262 @opindex Wmissing-prototypes
5263 @opindex Wno-missing-prototypes
5264 Warn if a global function is defined without a previous prototype
5265 declaration. This warning is issued even if the definition itself
5266 provides a prototype. Use this option to detect global functions
5267 that do not have a matching prototype declaration in a header file.
5268 This option is not valid for C++ because all function declarations
5269 provide prototypes and a non-matching declaration declares an
5270 overload rather than conflict with an earlier declaration.
5271 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
5272
5273 @item -Wmissing-declarations
5274 @opindex Wmissing-declarations
5275 @opindex Wno-missing-declarations
5276 Warn if a global function is defined without a previous declaration.
5277 Do so even if the definition itself provides a prototype.
5278 Use this option to detect global functions that are not declared in
5279 header files. In C, no warnings are issued for functions with previous
5280 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
5281 missing prototypes. In C++, no warnings are issued for function templates,
5282 or for inline functions, or for functions in anonymous namespaces.
5283
5284 @item -Wmissing-field-initializers
5285 @opindex Wmissing-field-initializers
5286 @opindex Wno-missing-field-initializers
5287 @opindex W
5288 @opindex Wextra
5289 @opindex Wno-extra
5290 Warn if a structure's initializer has some fields missing. For
5291 example, the following code causes such a warning, because
5292 @code{x.h} is implicitly zero:
5293
5294 @smallexample
5295 struct s @{ int f, g, h; @};
5296 struct s x = @{ 3, 4 @};
5297 @end smallexample
5298
5299 This option does not warn about designated initializers, so the following
5300 modification does not trigger a warning:
5301
5302 @smallexample
5303 struct s @{ int f, g, h; @};
5304 struct s x = @{ .f = 3, .g = 4 @};
5305 @end smallexample
5306
5307 In C++ this option does not warn either about the empty @{ @}
5308 initializer, for example:
5309
5310 @smallexample
5311 struct s @{ int f, g, h; @};
5312 s x = @{ @};
5313 @end smallexample
5314
5315 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
5316 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
5317
5318 @item -Wno-multichar
5319 @opindex Wno-multichar
5320 @opindex Wmultichar
5321 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
5322 Usually they indicate a typo in the user's code, as they have
5323 implementation-defined values, and should not be used in portable code.
5324
5325 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
5326 @opindex Wnormalized=
5327 @opindex Wnormalized
5328 @opindex Wno-normalized
5329 @cindex NFC
5330 @cindex NFKC
5331 @cindex character set, input normalization
5332 In ISO C and ISO C++, two identifiers are different if they are
5333 different sequences of characters. However, sometimes when characters
5334 outside the basic ASCII character set are used, you can have two
5335 different character sequences that look the same. To avoid confusion,
5336 the ISO 10646 standard sets out some @dfn{normalization rules} which
5337 when applied ensure that two sequences that look the same are turned into
5338 the same sequence. GCC can warn you if you are using identifiers that
5339 have not been normalized; this option controls that warning.
5340
5341 There are four levels of warning supported by GCC@. The default is
5342 @option{-Wnormalized=nfc}, which warns about any identifier that is
5343 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
5344 recommended form for most uses. It is equivalent to
5345 @option{-Wnormalized}.
5346
5347 Unfortunately, there are some characters allowed in identifiers by
5348 ISO C and ISO C++ that, when turned into NFC, are not allowed in
5349 identifiers. That is, there's no way to use these symbols in portable
5350 ISO C or C++ and have all your identifiers in NFC@.
5351 @option{-Wnormalized=id} suppresses the warning for these characters.
5352 It is hoped that future versions of the standards involved will correct
5353 this, which is why this option is not the default.
5354
5355 You can switch the warning off for all characters by writing
5356 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
5357 only do this if you are using some other normalization scheme (like
5358 ``D''), because otherwise you can easily create bugs that are
5359 literally impossible to see.
5360
5361 Some characters in ISO 10646 have distinct meanings but look identical
5362 in some fonts or display methodologies, especially once formatting has
5363 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
5364 LETTER N'', displays just like a regular @code{n} that has been
5365 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
5366 normalization scheme to convert all these into a standard form as
5367 well, and GCC warns if your code is not in NFKC if you use
5368 @option{-Wnormalized=nfkc}. This warning is comparable to warning
5369 about every identifier that contains the letter O because it might be
5370 confused with the digit 0, and so is not the default, but may be
5371 useful as a local coding convention if the programming environment
5372 cannot be fixed to display these characters distinctly.
5373
5374 @item -Wno-deprecated
5375 @opindex Wno-deprecated
5376 @opindex Wdeprecated
5377 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
5378
5379 @item -Wno-deprecated-declarations
5380 @opindex Wno-deprecated-declarations
5381 @opindex Wdeprecated-declarations
5382 Do not warn about uses of functions (@pxref{Function Attributes}),
5383 variables (@pxref{Variable Attributes}), and types (@pxref{Type
5384 Attributes}) marked as deprecated by using the @code{deprecated}
5385 attribute.
5386
5387 @item -Wno-overflow
5388 @opindex Wno-overflow
5389 @opindex Woverflow
5390 Do not warn about compile-time overflow in constant expressions.
5391
5392 @item -Wno-odr
5393 @opindex Wno-odr
5394 @opindex Wodr
5395 Warn about One Definition Rule violations during link-time optimization.
5396 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
5397
5398 @item -Wopenmp-simd
5399 @opindex Wopenm-simd
5400 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
5401 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
5402 option can be used to relax the cost model.
5403
5404 @item -Woverride-init @r{(C and Objective-C only)}
5405 @opindex Woverride-init
5406 @opindex Wno-override-init
5407 @opindex W
5408 @opindex Wextra
5409 @opindex Wno-extra
5410 Warn if an initialized field without side effects is overridden when
5411 using designated initializers (@pxref{Designated Inits, , Designated
5412 Initializers}).
5413
5414 This warning is included in @option{-Wextra}. To get other
5415 @option{-Wextra} warnings without this one, use @option{-Wextra
5416 -Wno-override-init}.
5417
5418 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
5419 @opindex Woverride-init-side-effects
5420 @opindex Wno-override-init-side-effects
5421 Warn if an initialized field with side effects is overridden when
5422 using designated initializers (@pxref{Designated Inits, , Designated
5423 Initializers}). This warning is enabled by default.
5424
5425 @item -Wpacked
5426 @opindex Wpacked
5427 @opindex Wno-packed
5428 Warn if a structure is given the packed attribute, but the packed
5429 attribute has no effect on the layout or size of the structure.
5430 Such structures may be mis-aligned for little benefit. For
5431 instance, in this code, the variable @code{f.x} in @code{struct bar}
5432 is misaligned even though @code{struct bar} does not itself
5433 have the packed attribute:
5434
5435 @smallexample
5436 @group
5437 struct foo @{
5438 int x;
5439 char a, b, c, d;
5440 @} __attribute__((packed));
5441 struct bar @{
5442 char z;
5443 struct foo f;
5444 @};
5445 @end group
5446 @end smallexample
5447
5448 @item -Wpacked-bitfield-compat
5449 @opindex Wpacked-bitfield-compat
5450 @opindex Wno-packed-bitfield-compat
5451 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
5452 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
5453 the change can lead to differences in the structure layout. GCC
5454 informs you when the offset of such a field has changed in GCC 4.4.
5455 For example there is no longer a 4-bit padding between field @code{a}
5456 and @code{b} in this structure:
5457
5458 @smallexample
5459 struct foo
5460 @{
5461 char a:4;
5462 char b:8;
5463 @} __attribute__ ((packed));
5464 @end smallexample
5465
5466 This warning is enabled by default. Use
5467 @option{-Wno-packed-bitfield-compat} to disable this warning.
5468
5469 @item -Wpadded
5470 @opindex Wpadded
5471 @opindex Wno-padded
5472 Warn if padding is included in a structure, either to align an element
5473 of the structure or to align the whole structure. Sometimes when this
5474 happens it is possible to rearrange the fields of the structure to
5475 reduce the padding and so make the structure smaller.
5476
5477 @item -Wredundant-decls
5478 @opindex Wredundant-decls
5479 @opindex Wno-redundant-decls
5480 Warn if anything is declared more than once in the same scope, even in
5481 cases where multiple declaration is valid and changes nothing.
5482
5483 @item -Wnested-externs @r{(C and Objective-C only)}
5484 @opindex Wnested-externs
5485 @opindex Wno-nested-externs
5486 Warn if an @code{extern} declaration is encountered within a function.
5487
5488 @item -Wno-inherited-variadic-ctor
5489 @opindex Winherited-variadic-ctor
5490 @opindex Wno-inherited-variadic-ctor
5491 Suppress warnings about use of C++11 inheriting constructors when the
5492 base class inherited from has a C variadic constructor; the warning is
5493 on by default because the ellipsis is not inherited.
5494
5495 @item -Winline
5496 @opindex Winline
5497 @opindex Wno-inline
5498 Warn if a function that is declared as inline cannot be inlined.
5499 Even with this option, the compiler does not warn about failures to
5500 inline functions declared in system headers.
5501
5502 The compiler uses a variety of heuristics to determine whether or not
5503 to inline a function. For example, the compiler takes into account
5504 the size of the function being inlined and the amount of inlining
5505 that has already been done in the current function. Therefore,
5506 seemingly insignificant changes in the source program can cause the
5507 warnings produced by @option{-Winline} to appear or disappear.
5508
5509 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
5510 @opindex Wno-invalid-offsetof
5511 @opindex Winvalid-offsetof
5512 Suppress warnings from applying the @code{offsetof} macro to a non-POD
5513 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
5514 to a non-standard-layout type is undefined. In existing C++ implementations,
5515 however, @code{offsetof} typically gives meaningful results.
5516 This flag is for users who are aware that they are
5517 writing nonportable code and who have deliberately chosen to ignore the
5518 warning about it.
5519
5520 The restrictions on @code{offsetof} may be relaxed in a future version
5521 of the C++ standard.
5522
5523 @item -Wno-int-to-pointer-cast
5524 @opindex Wno-int-to-pointer-cast
5525 @opindex Wint-to-pointer-cast
5526 Suppress warnings from casts to pointer type of an integer of a
5527 different size. In C++, casting to a pointer type of smaller size is
5528 an error. @option{Wint-to-pointer-cast} is enabled by default.
5529
5530
5531 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
5532 @opindex Wno-pointer-to-int-cast
5533 @opindex Wpointer-to-int-cast
5534 Suppress warnings from casts from a pointer to an integer type of a
5535 different size.
5536
5537 @item -Winvalid-pch
5538 @opindex Winvalid-pch
5539 @opindex Wno-invalid-pch
5540 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
5541 the search path but can't be used.
5542
5543 @item -Wlong-long
5544 @opindex Wlong-long
5545 @opindex Wno-long-long
5546 Warn if @code{long long} type is used. This is enabled by either
5547 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
5548 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
5549
5550 @item -Wvariadic-macros
5551 @opindex Wvariadic-macros
5552 @opindex Wno-variadic-macros
5553 Warn if variadic macros are used in ISO C90 mode, or if the GNU
5554 alternate syntax is used in ISO C99 mode. This is enabled by either
5555 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
5556 messages, use @option{-Wno-variadic-macros}.
5557
5558 @item -Wvarargs
5559 @opindex Wvarargs
5560 @opindex Wno-varargs
5561 Warn upon questionable usage of the macros used to handle variable
5562 arguments like @code{va_start}. This is default. To inhibit the
5563 warning messages, use @option{-Wno-varargs}.
5564
5565 @item -Wvector-operation-performance
5566 @opindex Wvector-operation-performance
5567 @opindex Wno-vector-operation-performance
5568 Warn if vector operation is not implemented via SIMD capabilities of the
5569 architecture. Mainly useful for the performance tuning.
5570 Vector operation can be implemented @code{piecewise}, which means that the
5571 scalar operation is performed on every vector element;
5572 @code{in parallel}, which means that the vector operation is implemented
5573 using scalars of wider type, which normally is more performance efficient;
5574 and @code{as a single scalar}, which means that vector fits into a
5575 scalar type.
5576
5577 @item -Wno-virtual-move-assign
5578 @opindex Wvirtual-move-assign
5579 @opindex Wno-virtual-move-assign
5580 Suppress warnings about inheriting from a virtual base with a
5581 non-trivial C++11 move assignment operator. This is dangerous because
5582 if the virtual base is reachable along more than one path, it is
5583 moved multiple times, which can mean both objects end up in the
5584 moved-from state. If the move assignment operator is written to avoid
5585 moving from a moved-from object, this warning can be disabled.
5586
5587 @item -Wvla
5588 @opindex Wvla
5589 @opindex Wno-vla
5590 Warn if variable length array is used in the code.
5591 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
5592 the variable length array.
5593
5594 @item -Wvolatile-register-var
5595 @opindex Wvolatile-register-var
5596 @opindex Wno-volatile-register-var
5597 Warn if a register variable is declared volatile. The volatile
5598 modifier does not inhibit all optimizations that may eliminate reads
5599 and/or writes to register variables. This warning is enabled by
5600 @option{-Wall}.
5601
5602 @item -Wdisabled-optimization
5603 @opindex Wdisabled-optimization
5604 @opindex Wno-disabled-optimization
5605 Warn if a requested optimization pass is disabled. This warning does
5606 not generally indicate that there is anything wrong with your code; it
5607 merely indicates that GCC's optimizers are unable to handle the code
5608 effectively. Often, the problem is that your code is too big or too
5609 complex; GCC refuses to optimize programs when the optimization
5610 itself is likely to take inordinate amounts of time.
5611
5612 @item -Wpointer-sign @r{(C and Objective-C only)}
5613 @opindex Wpointer-sign
5614 @opindex Wno-pointer-sign
5615 Warn for pointer argument passing or assignment with different signedness.
5616 This option is only supported for C and Objective-C@. It is implied by
5617 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
5618 @option{-Wno-pointer-sign}.
5619
5620 @item -Wstack-protector
5621 @opindex Wstack-protector
5622 @opindex Wno-stack-protector
5623 This option is only active when @option{-fstack-protector} is active. It
5624 warns about functions that are not protected against stack smashing.
5625
5626 @item -Woverlength-strings
5627 @opindex Woverlength-strings
5628 @opindex Wno-overlength-strings
5629 Warn about string constants that are longer than the ``minimum
5630 maximum'' length specified in the C standard. Modern compilers
5631 generally allow string constants that are much longer than the
5632 standard's minimum limit, but very portable programs should avoid
5633 using longer strings.
5634
5635 The limit applies @emph{after} string constant concatenation, and does
5636 not count the trailing NUL@. In C90, the limit was 509 characters; in
5637 C99, it was raised to 4095. C++98 does not specify a normative
5638 minimum maximum, so we do not diagnose overlength strings in C++@.
5639
5640 This option is implied by @option{-Wpedantic}, and can be disabled with
5641 @option{-Wno-overlength-strings}.
5642
5643 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
5644 @opindex Wunsuffixed-float-constants
5645
5646 Issue a warning for any floating constant that does not have
5647 a suffix. When used together with @option{-Wsystem-headers} it
5648 warns about such constants in system header files. This can be useful
5649 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
5650 from the decimal floating-point extension to C99.
5651
5652 @item -Wno-designated-init @r{(C and Objective-C only)}
5653 Suppress warnings when a positional initializer is used to initialize
5654 a structure that has been marked with the @code{designated_init}
5655 attribute.
5656
5657 @end table
5658
5659 @node Debugging Options
5660 @section Options for Debugging Your Program or GCC
5661 @cindex options, debugging
5662 @cindex debugging information options
5663
5664 GCC has various special options that are used for debugging
5665 either your program or GCC:
5666
5667 @table @gcctabopt
5668 @item -g
5669 @opindex g
5670 Produce debugging information in the operating system's native format
5671 (stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
5672 information.
5673
5674 On most systems that use stabs format, @option{-g} enables use of extra
5675 debugging information that only GDB can use; this extra information
5676 makes debugging work better in GDB but probably makes other debuggers
5677 crash or
5678 refuse to read the program. If you want to control for certain whether
5679 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
5680 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
5681
5682 GCC allows you to use @option{-g} with
5683 @option{-O}. The shortcuts taken by optimized code may occasionally
5684 produce surprising results: some variables you declared may not exist
5685 at all; flow of control may briefly move where you did not expect it;
5686 some statements may not be executed because they compute constant
5687 results or their values are already at hand; some statements may
5688 execute in different places because they have been moved out of loops.
5689
5690 Nevertheless it proves possible to debug optimized output. This makes
5691 it reasonable to use the optimizer for programs that might have bugs.
5692
5693 The following options are useful when GCC is generated with the
5694 capability for more than one debugging format.
5695
5696 @item -gsplit-dwarf
5697 @opindex gsplit-dwarf
5698 Separate as much dwarf debugging information as possible into a
5699 separate output file with the extension .dwo. This option allows
5700 the build system to avoid linking files with debug information. To
5701 be useful, this option requires a debugger capable of reading .dwo
5702 files.
5703
5704 @item -ggdb
5705 @opindex ggdb
5706 Produce debugging information for use by GDB@. This means to use the
5707 most expressive format available (DWARF 2, stabs, or the native format
5708 if neither of those are supported), including GDB extensions if at all
5709 possible.
5710
5711 @item -gpubnames
5712 @opindex gpubnames
5713 Generate dwarf .debug_pubnames and .debug_pubtypes sections.
5714
5715 @item -ggnu-pubnames
5716 @opindex ggnu-pubnames
5717 Generate .debug_pubnames and .debug_pubtypes sections in a format
5718 suitable for conversion into a GDB@ index. This option is only useful
5719 with a linker that can produce GDB@ index version 7.
5720
5721 @item -gstabs
5722 @opindex gstabs
5723 Produce debugging information in stabs format (if that is supported),
5724 without GDB extensions. This is the format used by DBX on most BSD
5725 systems. On MIPS, Alpha and System V Release 4 systems this option
5726 produces stabs debugging output that is not understood by DBX or SDB@.
5727 On System V Release 4 systems this option requires the GNU assembler.
5728
5729 @item -feliminate-unused-debug-symbols
5730 @opindex feliminate-unused-debug-symbols
5731 Produce debugging information in stabs format (if that is supported),
5732 for only symbols that are actually used.
5733
5734 @item -femit-class-debug-always
5735 @opindex femit-class-debug-always
5736 Instead of emitting debugging information for a C++ class in only one
5737 object file, emit it in all object files using the class. This option
5738 should be used only with debuggers that are unable to handle the way GCC
5739 normally emits debugging information for classes because using this
5740 option increases the size of debugging information by as much as a
5741 factor of two.
5742
5743 @item -fdebug-types-section
5744 @opindex fdebug-types-section
5745 @opindex fno-debug-types-section
5746 When using DWARF Version 4 or higher, type DIEs can be put into
5747 their own @code{.debug_types} section instead of making them part of the
5748 @code{.debug_info} section. It is more efficient to put them in a separate
5749 comdat sections since the linker can then remove duplicates.
5750 But not all DWARF consumers support @code{.debug_types} sections yet
5751 and on some objects @code{.debug_types} produces larger instead of smaller
5752 debugging information.
5753
5754 @item -gstabs+
5755 @opindex gstabs+
5756 Produce debugging information in stabs format (if that is supported),
5757 using GNU extensions understood only by the GNU debugger (GDB)@. The
5758 use of these extensions is likely to make other debuggers crash or
5759 refuse to read the program.
5760
5761 @item -gcoff
5762 @opindex gcoff
5763 Produce debugging information in COFF format (if that is supported).
5764 This is the format used by SDB on most System V systems prior to
5765 System V Release 4.
5766
5767 @item -gxcoff
5768 @opindex gxcoff
5769 Produce debugging information in XCOFF format (if that is supported).
5770 This is the format used by the DBX debugger on IBM RS/6000 systems.
5771
5772 @item -gxcoff+
5773 @opindex gxcoff+
5774 Produce debugging information in XCOFF format (if that is supported),
5775 using GNU extensions understood only by the GNU debugger (GDB)@. The
5776 use of these extensions is likely to make other debuggers crash or
5777 refuse to read the program, and may cause assemblers other than the GNU
5778 assembler (GAS) to fail with an error.
5779
5780 @item -gdwarf-@var{version}
5781 @opindex gdwarf-@var{version}
5782 Produce debugging information in DWARF format (if that is supported).
5783 The value of @var{version} may be either 2, 3, 4 or 5; the default version
5784 for most targets is 4. DWARF Version 5 is only experimental.
5785
5786 Note that with DWARF Version 2, some ports require and always
5787 use some non-conflicting DWARF 3 extensions in the unwind tables.
5788
5789 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
5790 for maximum benefit.
5791
5792 @item -grecord-gcc-switches
5793 @opindex grecord-gcc-switches
5794 This switch causes the command-line options used to invoke the
5795 compiler that may affect code generation to be appended to the
5796 DW_AT_producer attribute in DWARF debugging information. The options
5797 are concatenated with spaces separating them from each other and from
5798 the compiler version. See also @option{-frecord-gcc-switches} for another
5799 way of storing compiler options into the object file. This is the default.
5800
5801 @item -gno-record-gcc-switches
5802 @opindex gno-record-gcc-switches
5803 Disallow appending command-line options to the DW_AT_producer attribute
5804 in DWARF debugging information.
5805
5806 @item -gstrict-dwarf
5807 @opindex gstrict-dwarf
5808 Disallow using extensions of later DWARF standard version than selected
5809 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
5810 DWARF extensions from later standard versions is allowed.
5811
5812 @item -gno-strict-dwarf
5813 @opindex gno-strict-dwarf
5814 Allow using extensions of later DWARF standard version than selected with
5815 @option{-gdwarf-@var{version}}.
5816
5817 @item -gz@r{[}=@var{type}@r{]}
5818 @opindex gz
5819 Produce compressed debug sections in DWARF format, if that is supported.
5820 If @var{type} is not given, the default type depends on the capabilities
5821 of the assembler and linker used. @var{type} may be one of
5822 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
5823 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
5824 compression in traditional GNU format). If the linker doesn't support
5825 writing compressed debug sections, the option is rejected. Otherwise,
5826 if the assembler does not support them, @option{-gz} is silently ignored
5827 when producing object files.
5828
5829 @item -gvms
5830 @opindex gvms
5831 Produce debugging information in Alpha/VMS debug format (if that is
5832 supported). This is the format used by DEBUG on Alpha/VMS systems.
5833
5834 @item -g@var{level}
5835 @itemx -ggdb@var{level}
5836 @itemx -gstabs@var{level}
5837 @itemx -gcoff@var{level}
5838 @itemx -gxcoff@var{level}
5839 @itemx -gvms@var{level}
5840 Request debugging information and also use @var{level} to specify how
5841 much information. The default level is 2.
5842
5843 Level 0 produces no debug information at all. Thus, @option{-g0} negates
5844 @option{-g}.
5845
5846 Level 1 produces minimal information, enough for making backtraces in
5847 parts of the program that you don't plan to debug. This includes
5848 descriptions of functions and external variables, and line number
5849 tables, but no information about local variables.
5850
5851 Level 3 includes extra information, such as all the macro definitions
5852 present in the program. Some debuggers support macro expansion when
5853 you use @option{-g3}.
5854
5855 @option{-gdwarf-2} does not accept a concatenated debug level, because
5856 GCC used to support an option @option{-gdwarf} that meant to generate
5857 debug information in version 1 of the DWARF format (which is very
5858 different from version 2), and it would have been too confusing. That
5859 debug format is long obsolete, but the option cannot be changed now.
5860 Instead use an additional @option{-g@var{level}} option to change the
5861 debug level for DWARF.
5862
5863 @item -gtoggle
5864 @opindex gtoggle
5865 Turn off generation of debug info, if leaving out this option
5866 generates it, or turn it on at level 2 otherwise. The position of this
5867 argument in the command line does not matter; it takes effect after all
5868 other options are processed, and it does so only once, no matter how
5869 many times it is given. This is mainly intended to be used with
5870 @option{-fcompare-debug}.
5871
5872 @item -fsanitize=address
5873 @opindex fsanitize=address
5874 Enable AddressSanitizer, a fast memory error detector.
5875 Memory access instructions are instrumented to detect
5876 out-of-bounds and use-after-free bugs.
5877 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
5878 more details. The run-time behavior can be influenced using the
5879 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
5880 the available options are shown at startup of the instrumended program. See
5881 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
5882 for a list of supported options.
5883
5884 @item -fsanitize=kernel-address
5885 @opindex fsanitize=kernel-address
5886 Enable AddressSanitizer for Linux kernel.
5887 See @uref{https://github.com/google/kasan/wiki} for more details.
5888
5889 @item -fsanitize=thread
5890 @opindex fsanitize=thread
5891 Enable ThreadSanitizer, a fast data race detector.
5892 Memory access instructions are instrumented to detect
5893 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
5894 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
5895 environment variable; see
5896 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
5897 supported options.
5898
5899 @item -fsanitize=leak
5900 @opindex fsanitize=leak
5901 Enable LeakSanitizer, a memory leak detector.
5902 This option only matters for linking of executables and if neither
5903 @option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that
5904 case the executable is linked against a library that overrides @code{malloc}
5905 and other allocator functions. See
5906 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
5907 details. The run-time behavior can be influenced using the
5908 @env{LSAN_OPTIONS} environment variable.
5909
5910 @item -fsanitize=undefined
5911 @opindex fsanitize=undefined
5912 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
5913 Various computations are instrumented to detect undefined behavior
5914 at runtime. Current suboptions are:
5915
5916 @table @gcctabopt
5917
5918 @item -fsanitize=shift
5919 @opindex fsanitize=shift
5920 This option enables checking that the result of a shift operation is
5921 not undefined. Note that what exactly is considered undefined differs
5922 slightly between C and C++, as well as between ISO C90 and C99, etc.
5923
5924 @item -fsanitize=integer-divide-by-zero
5925 @opindex fsanitize=integer-divide-by-zero
5926 Detect integer division by zero as well as @code{INT_MIN / -1} division.
5927
5928 @item -fsanitize=unreachable
5929 @opindex fsanitize=unreachable
5930 With this option, the compiler turns the @code{__builtin_unreachable}
5931 call into a diagnostics message call instead. When reaching the
5932 @code{__builtin_unreachable} call, the behavior is undefined.
5933
5934 @item -fsanitize=vla-bound
5935 @opindex fsanitize=vla-bound
5936 This option instructs the compiler to check that the size of a variable
5937 length array is positive.
5938
5939 @item -fsanitize=null
5940 @opindex fsanitize=null
5941 This option enables pointer checking. Particularly, the application
5942 built with this option turned on will issue an error message when it
5943 tries to dereference a NULL pointer, or if a reference (possibly an
5944 rvalue reference) is bound to a NULL pointer, or if a method is invoked
5945 on an object pointed by a NULL pointer.
5946
5947 @item -fsanitize=return
5948 @opindex fsanitize=return
5949 This option enables return statement checking. Programs
5950 built with this option turned on will issue an error message
5951 when the end of a non-void function is reached without actually
5952 returning a value. This option works in C++ only.
5953
5954 @item -fsanitize=signed-integer-overflow
5955 @opindex fsanitize=signed-integer-overflow
5956 This option enables signed integer overflow checking. We check that
5957 the result of @code{+}, @code{*}, and both unary and binary @code{-}
5958 does not overflow in the signed arithmetics. Note, integer promotion
5959 rules must be taken into account. That is, the following is not an
5960 overflow:
5961 @smallexample
5962 signed char a = SCHAR_MAX;
5963 a++;
5964 @end smallexample
5965
5966 @item -fsanitize=bounds
5967 @opindex fsanitize=bounds
5968 This option enables instrumentation of array bounds. Various out of bounds
5969 accesses are detected. Flexible array members, flexible array member-like
5970 arrays, and initializers of variables with static storage are not instrumented.
5971
5972 @item -fsanitize=bounds-strict
5973 @opindex fsanitize=bounds-strict
5974 This option enables strict instrumentation of array bounds. Most out of bounds
5975 accesses are detected, including flexible array members and flexible array
5976 member-like arrays. Initializers of variables with static storage are not
5977 instrumented.
5978
5979 @item -fsanitize=alignment
5980 @opindex fsanitize=alignment
5981
5982 This option enables checking of alignment of pointers when they are
5983 dereferenced, or when a reference is bound to insufficiently aligned target,
5984 or when a method or constructor is invoked on insufficiently aligned object.
5985
5986 @item -fsanitize=object-size
5987 @opindex fsanitize=object-size
5988 This option enables instrumentation of memory references using the
5989 @code{__builtin_object_size} function. Various out of bounds pointer
5990 accesses are detected.
5991
5992 @item -fsanitize=float-divide-by-zero
5993 @opindex fsanitize=float-divide-by-zero
5994 Detect floating-point division by zero. Unlike other similar options,
5995 @option{-fsanitize=float-divide-by-zero} is not enabled by
5996 @option{-fsanitize=undefined}, since floating-point division by zero can
5997 be a legitimate way of obtaining infinities and NaNs.
5998
5999 @item -fsanitize=float-cast-overflow
6000 @opindex fsanitize=float-cast-overflow
6001 This option enables floating-point type to integer conversion checking.
6002 We check that the result of the conversion does not overflow.
6003 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
6004 not enabled by @option{-fsanitize=undefined}.
6005 This option does not work well with @code{FE_INVALID} exceptions enabled.
6006
6007 @item -fsanitize=nonnull-attribute
6008 @opindex fsanitize=nonnull-attribute
6009
6010 This option enables instrumentation of calls, checking whether null values
6011 are not passed to arguments marked as requiring a non-null value by the
6012 @code{nonnull} function attribute.
6013
6014 @item -fsanitize=returns-nonnull-attribute
6015 @opindex fsanitize=returns-nonnull-attribute
6016
6017 This option enables instrumentation of return statements in functions
6018 marked with @code{returns_nonnull} function attribute, to detect returning
6019 of null values from such functions.
6020
6021 @item -fsanitize=bool
6022 @opindex fsanitize=bool
6023
6024 This option enables instrumentation of loads from bool. If a value other
6025 than 0/1 is loaded, a run-time error is issued.
6026
6027 @item -fsanitize=enum
6028 @opindex fsanitize=enum
6029
6030 This option enables instrumentation of loads from an enum type. If
6031 a value outside the range of values for the enum type is loaded,
6032 a run-time error is issued.
6033
6034 @item -fsanitize=vptr
6035 @opindex fsanitize=vptr
6036
6037 This option enables instrumentation of C++ member function calls, member
6038 accesses and some conversions between pointers to base and derived classes,
6039 to verify the referenced object has the correct dynamic type.
6040
6041 @end table
6042
6043 While @option{-ftrapv} causes traps for signed overflows to be emitted,
6044 @option{-fsanitize=undefined} gives a diagnostic message.
6045 This currently works only for the C family of languages.
6046
6047 @item -fno-sanitize=all
6048 @opindex fno-sanitize=all
6049
6050 This option disables all previously enabled sanitizers.
6051 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
6052 together.
6053
6054 @item -fasan-shadow-offset=@var{number}
6055 @opindex fasan-shadow-offset
6056 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
6057 It is useful for experimenting with different shadow memory layouts in
6058 Kernel AddressSanitizer.
6059
6060 @item -fsanitize-sections=@var{s1},@var{s2},...
6061 @opindex fsanitize-sections
6062 Sanitize global variables in selected user-defined sections. @var{si} may
6063 contain wildcards.
6064
6065 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
6066 @opindex fsanitize-recover
6067 @opindex fno-sanitize-recover
6068 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
6069 mentioned in comma-separated list of @var{opts}. Enabling this option
6070 for a sanitizer component causes it to attempt to continue
6071 running the program as if no error happened. This means multiple
6072 runtime errors can be reported in a single program run, and the exit
6073 code of the program may indicate success even when errors
6074 have been reported. The @option{-fno-sanitize-recover=} option
6075 can be used to alter
6076 this behavior: only the first detected error is reported
6077 and program then exits with a non-zero exit code.
6078
6079 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
6080 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
6081 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero} and
6082 @option{-fsanitize=kernel-address}. For these sanitizers error recovery is turned on by default.
6083 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
6084 accepted, the former enables recovery for all sanitizers that support it,
6085 the latter disables recovery for all sanitizers that support it.
6086
6087 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
6088 @smallexample
6089 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
6090 @end smallexample
6091 @noindent
6092 Similarly @option{-fno-sanitize-recover} is equivalent to
6093 @smallexample
6094 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
6095 @end smallexample
6096
6097 @item -fsanitize-undefined-trap-on-error
6098 @opindex fsanitize-undefined-trap-on-error
6099 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
6100 report undefined behavior using @code{__builtin_trap} rather than
6101 a @code{libubsan} library routine. The advantage of this is that the
6102 @code{libubsan} library is not needed and is not linked in, so this
6103 is usable even in freestanding environments.
6104
6105 @item -fcheck-pointer-bounds
6106 @opindex fcheck-pointer-bounds
6107 @opindex fno-check-pointer-bounds
6108 @cindex Pointer Bounds Checker options
6109 Enable Pointer Bounds Checker instrumentation. Each memory reference
6110 is instrumented with checks of the pointer used for memory access against
6111 bounds associated with that pointer.
6112
6113 Currently there
6114 is only an implementation for Intel MPX available, thus x86 target
6115 and @option{-mmpx} are required to enable this feature.
6116 MPX-based instrumentation requires
6117 a runtime library to enable MPX in hardware and handle bounds
6118 violation signals. By default when @option{-fcheck-pointer-bounds}
6119 and @option{-mmpx} options are used to link a program, the GCC driver
6120 links against the @file{libmpx} runtime library and @file{libmpxwrappers}
6121 library. It also passes '-z bndplt' to a linker in case it supports this
6122 option (which is checked on libmpx configuration). Note that old versions
6123 of linker may ignore option. Gold linker doesn't support '-z bndplt'
6124 option. With no '-z bndplt' support in linker all calls to dynamic libraries
6125 lose passed bounds reducing overall protection level. It's highly
6126 recommended to use linker with '-z bndplt' support. In case such linker
6127 is not available it is adviced to always use @option{-static-libmpxwrappers}
6128 for better protection level or use @option{-static} to completely avoid
6129 external calls to dynamic libraries. MPX-based instrumentation
6130 may be used for debugging and also may be included in production code
6131 to increase program security. Depending on usage, you may
6132 have different requirements for the runtime library. The current version
6133 of the MPX runtime library is more oriented for use as a debugging
6134 tool. MPX runtime library usage implies @option{-lpthread}. See
6135 also @option{-static-libmpx}. The runtime library behavior can be
6136 influenced using various @env{CHKP_RT_*} environment variables. See
6137 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
6138 for more details.
6139
6140 Generated instrumentation may be controlled by various
6141 @option{-fchkp-*} options and by the @code{bnd_variable_size}
6142 structure field attribute (@pxref{Type Attributes}) and
6143 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
6144 (@pxref{Function Attributes}). GCC also provides a number of built-in
6145 functions for controlling the Pointer Bounds Checker. @xref{Pointer
6146 Bounds Checker builtins}, for more information.
6147
6148 @item -fchkp-check-incomplete-type
6149 @opindex fchkp-check-incomplete-type
6150 @opindex fno-chkp-check-incomplete-type
6151 Generate pointer bounds checks for variables with incomplete type.
6152 Enabled by default.
6153
6154 @item -fchkp-narrow-bounds
6155 @opindex fchkp-narrow-bounds
6156 @opindex fno-chkp-narrow-bounds
6157 Controls bounds used by Pointer Bounds Checker for pointers to object
6158 fields. If narrowing is enabled then field bounds are used. Otherwise
6159 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
6160 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
6161
6162 @item -fchkp-first-field-has-own-bounds
6163 @opindex fchkp-first-field-has-own-bounds
6164 @opindex fno-chkp-first-field-has-own-bounds
6165 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
6166 first field in the structure. By default a pointer to the first field has
6167 the same bounds as a pointer to the whole structure.
6168
6169 @item -fchkp-narrow-to-innermost-array
6170 @opindex fchkp-narrow-to-innermost-array
6171 @opindex fno-chkp-narrow-to-innermost-array
6172 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
6173 case of nested static array access. By default this option is disabled and
6174 bounds of the outermost array are used.
6175
6176 @item -fchkp-optimize
6177 @opindex fchkp-optimize
6178 @opindex fno-chkp-optimize
6179 Enables Pointer Bounds Checker optimizations. Enabled by default at
6180 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
6181
6182 @item -fchkp-use-fast-string-functions
6183 @opindex fchkp-use-fast-string-functions
6184 @opindex fno-chkp-use-fast-string-functions
6185 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
6186 by Pointer Bounds Checker. Disabled by default.
6187
6188 @item -fchkp-use-nochk-string-functions
6189 @opindex fchkp-use-nochk-string-functions
6190 @opindex fno-chkp-use-nochk-string-functions
6191 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
6192 by Pointer Bounds Checker. Disabled by default.
6193
6194 @item -fchkp-use-static-bounds
6195 @opindex fchkp-use-static-bounds
6196 @opindex fno-chkp-use-static-bounds
6197 Allow Pointer Bounds Checker to generate static bounds holding
6198 bounds of static variables. Enabled by default.
6199
6200 @item -fchkp-use-static-const-bounds
6201 @opindex fchkp-use-static-const-bounds
6202 @opindex fno-chkp-use-static-const-bounds
6203 Use statically-initialized bounds for constant bounds instead of
6204 generating them each time they are required. By default enabled when
6205 @option{-fchkp-use-static-bounds} is enabled.
6206
6207 @item -fchkp-treat-zero-dynamic-size-as-infinite
6208 @opindex fchkp-treat-zero-dynamic-size-as-infinite
6209 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
6210 With this option, objects with incomplete type whose
6211 dynamically-obtained size is zero are treated as having infinite size
6212 instead by Pointer Bounds
6213 Checker. This option may be helpful if a program is linked with a library
6214 missing size information for some symbols. Disabled by default.
6215
6216 @item -fchkp-check-read
6217 @opindex fchkp-check-read
6218 @opindex fno-chkp-check-read
6219 Instructs Pointer Bounds Checker to generate checks for all read
6220 accesses to memory. Enabled by default.
6221
6222 @item -fchkp-check-write
6223 @opindex fchkp-check-write
6224 @opindex fno-chkp-check-write
6225 Instructs Pointer Bounds Checker to generate checks for all write
6226 accesses to memory. Enabled by default.
6227
6228 @item -fchkp-store-bounds
6229 @opindex fchkp-store-bounds
6230 @opindex fno-chkp-store-bounds
6231 Instructs Pointer Bounds Checker to generate bounds stores for
6232 pointer writes. Enabled by default.
6233
6234 @item -fchkp-instrument-calls
6235 @opindex fchkp-instrument-calls
6236 @opindex fno-chkp-instrument-calls
6237 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
6238 Enabled by default.
6239
6240 @item -fchkp-instrument-marked-only
6241 @opindex fchkp-instrument-marked-only
6242 @opindex fno-chkp-instrument-marked-only
6243 Instructs Pointer Bounds Checker to instrument only functions
6244 marked with the @code{bnd_instrument} attribute
6245 (@pxref{Function Attributes}). Disabled by default.
6246
6247 @item -fchkp-use-wrappers
6248 @opindex fchkp-use-wrappers
6249 @opindex fno-chkp-use-wrappers
6250 Allows Pointer Bounds Checker to replace calls to built-in functions
6251 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
6252 is used to link a program, the GCC driver automatically links
6253 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
6254 Enabled by default.
6255
6256 @item -fdump-final-insns@r{[}=@var{file}@r{]}
6257 @opindex fdump-final-insns
6258 Dump the final internal representation (RTL) to @var{file}. If the
6259 optional argument is omitted (or if @var{file} is @code{.}), the name
6260 of the dump file is determined by appending @code{.gkd} to the
6261 compilation output file name.
6262
6263 @item -fcompare-debug@r{[}=@var{opts}@r{]}
6264 @opindex fcompare-debug
6265 @opindex fno-compare-debug
6266 If no error occurs during compilation, run the compiler a second time,
6267 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
6268 passed to the second compilation. Dump the final internal
6269 representation in both compilations, and print an error if they differ.
6270
6271 If the equal sign is omitted, the default @option{-gtoggle} is used.
6272
6273 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
6274 and nonzero, implicitly enables @option{-fcompare-debug}. If
6275 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
6276 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
6277 is used.
6278
6279 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
6280 is equivalent to @option{-fno-compare-debug}, which disables the dumping
6281 of the final representation and the second compilation, preventing even
6282 @env{GCC_COMPARE_DEBUG} from taking effect.
6283
6284 To verify full coverage during @option{-fcompare-debug} testing, set
6285 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
6286 which GCC rejects as an invalid option in any actual compilation
6287 (rather than preprocessing, assembly or linking). To get just a
6288 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
6289 not overridden} will do.
6290
6291 @item -fcompare-debug-second
6292 @opindex fcompare-debug-second
6293 This option is implicitly passed to the compiler for the second
6294 compilation requested by @option{-fcompare-debug}, along with options to
6295 silence warnings, and omitting other options that would cause
6296 side-effect compiler outputs to files or to the standard output. Dump
6297 files and preserved temporary files are renamed so as to contain the
6298 @code{.gk} additional extension during the second compilation, to avoid
6299 overwriting those generated by the first.
6300
6301 When this option is passed to the compiler driver, it causes the
6302 @emph{first} compilation to be skipped, which makes it useful for little
6303 other than debugging the compiler proper.
6304
6305 @item -feliminate-dwarf2-dups
6306 @opindex feliminate-dwarf2-dups
6307 Compress DWARF 2 debugging information by eliminating duplicated
6308 information about each symbol. This option only makes sense when
6309 generating DWARF 2 debugging information with @option{-gdwarf-2}.
6310
6311 @item -femit-struct-debug-baseonly
6312 @opindex femit-struct-debug-baseonly
6313 Emit debug information for struct-like types
6314 only when the base name of the compilation source file
6315 matches the base name of file in which the struct is defined.
6316
6317 This option substantially reduces the size of debugging information,
6318 but at significant potential loss in type information to the debugger.
6319 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6320 See @option{-femit-struct-debug-detailed} for more detailed control.
6321
6322 This option works only with DWARF 2.
6323
6324 @item -femit-struct-debug-reduced
6325 @opindex femit-struct-debug-reduced
6326 Emit debug information for struct-like types
6327 only when the base name of the compilation source file
6328 matches the base name of file in which the type is defined,
6329 unless the struct is a template or defined in a system header.
6330
6331 This option significantly reduces the size of debugging information,
6332 with some potential loss in type information to the debugger.
6333 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6334 See @option{-femit-struct-debug-detailed} for more detailed control.
6335
6336 This option works only with DWARF 2.
6337
6338 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6339 @opindex femit-struct-debug-detailed
6340 Specify the struct-like types
6341 for which the compiler generates debug information.
6342 The intent is to reduce duplicate struct debug information
6343 between different object files within the same program.
6344
6345 This option is a detailed version of
6346 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6347 which serves for most needs.
6348
6349 A specification has the syntax@*
6350 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6351
6352 The optional first word limits the specification to
6353 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6354 A struct type is used directly when it is the type of a variable, member.
6355 Indirect uses arise through pointers to structs.
6356 That is, when use of an incomplete struct is valid, the use is indirect.
6357 An example is
6358 @samp{struct one direct; struct two * indirect;}.
6359
6360 The optional second word limits the specification to
6361 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6362 Generic structs are a bit complicated to explain.
6363 For C++, these are non-explicit specializations of template classes,
6364 or non-template classes within the above.
6365 Other programming languages have generics,
6366 but @option{-femit-struct-debug-detailed} does not yet implement them.
6367
6368 The third word specifies the source files for those
6369 structs for which the compiler should emit debug information.
6370 The values @samp{none} and @samp{any} have the normal meaning.
6371 The value @samp{base} means that
6372 the base of name of the file in which the type declaration appears
6373 must match the base of the name of the main compilation file.
6374 In practice, this means that when compiling @file{foo.c}, debug information
6375 is generated for types declared in that file and @file{foo.h},
6376 but not other header files.
6377 The value @samp{sys} means those types satisfying @samp{base}
6378 or declared in system or compiler headers.
6379
6380 You may need to experiment to determine the best settings for your application.
6381
6382 The default is @option{-femit-struct-debug-detailed=all}.
6383
6384 This option works only with DWARF 2.
6385
6386 @item -fno-merge-debug-strings
6387 @opindex fmerge-debug-strings
6388 @opindex fno-merge-debug-strings
6389 Direct the linker to not merge together strings in the debugging
6390 information that are identical in different object files. Merging is
6391 not supported by all assemblers or linkers. Merging decreases the size
6392 of the debug information in the output file at the cost of increasing
6393 link processing time. Merging is enabled by default.
6394
6395 @item -fdebug-prefix-map=@var{old}=@var{new}
6396 @opindex fdebug-prefix-map
6397 When compiling files in directory @file{@var{old}}, record debugging
6398 information describing them as in @file{@var{new}} instead.
6399
6400 @item -fno-dwarf2-cfi-asm
6401 @opindex fdwarf2-cfi-asm
6402 @opindex fno-dwarf2-cfi-asm
6403 Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
6404 instead of using GAS @code{.cfi_*} directives.
6405
6406 @cindex @command{prof}
6407 @item -p
6408 @opindex p
6409 Generate extra code to write profile information suitable for the
6410 analysis program @command{prof}. You must use this option when compiling
6411 the source files you want data about, and you must also use it when
6412 linking.
6413
6414 @cindex @command{gprof}
6415 @item -pg
6416 @opindex pg
6417 Generate extra code to write profile information suitable for the
6418 analysis program @command{gprof}. You must use this option when compiling
6419 the source files you want data about, and you must also use it when
6420 linking.
6421
6422 @item -Q
6423 @opindex Q
6424 Makes the compiler print out each function name as it is compiled, and
6425 print some statistics about each pass when it finishes.
6426
6427 @item -ftime-report
6428 @opindex ftime-report
6429 Makes the compiler print some statistics about the time consumed by each
6430 pass when it finishes.
6431
6432 @item -fmem-report
6433 @opindex fmem-report
6434 Makes the compiler print some statistics about permanent memory
6435 allocation when it finishes.
6436
6437 @item -fmem-report-wpa
6438 @opindex fmem-report-wpa
6439 Makes the compiler print some statistics about permanent memory
6440 allocation for the WPA phase only.
6441
6442 @item -fpre-ipa-mem-report
6443 @opindex fpre-ipa-mem-report
6444 @item -fpost-ipa-mem-report
6445 @opindex fpost-ipa-mem-report
6446 Makes the compiler print some statistics about permanent memory
6447 allocation before or after interprocedural optimization.
6448
6449 @item -fprofile-report
6450 @opindex fprofile-report
6451 Makes the compiler print some statistics about consistency of the
6452 (estimated) profile and effect of individual passes.
6453
6454 @item -fstack-usage
6455 @opindex fstack-usage
6456 Makes the compiler output stack usage information for the program, on a
6457 per-function basis. The filename for the dump is made by appending
6458 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
6459 the output file, if explicitly specified and it is not an executable,
6460 otherwise it is the basename of the source file. An entry is made up
6461 of three fields:
6462
6463 @itemize
6464 @item
6465 The name of the function.
6466 @item
6467 A number of bytes.
6468 @item
6469 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
6470 @end itemize
6471
6472 The qualifier @code{static} means that the function manipulates the stack
6473 statically: a fixed number of bytes are allocated for the frame on function
6474 entry and released on function exit; no stack adjustments are otherwise made
6475 in the function. The second field is this fixed number of bytes.
6476
6477 The qualifier @code{dynamic} means that the function manipulates the stack
6478 dynamically: in addition to the static allocation described above, stack
6479 adjustments are made in the body of the function, for example to push/pop
6480 arguments around function calls. If the qualifier @code{bounded} is also
6481 present, the amount of these adjustments is bounded at compile time and
6482 the second field is an upper bound of the total amount of stack used by
6483 the function. If it is not present, the amount of these adjustments is
6484 not bounded at compile time and the second field only represents the
6485 bounded part.
6486
6487 @item -fprofile-arcs
6488 @opindex fprofile-arcs
6489 Add code so that program flow @dfn{arcs} are instrumented. During
6490 execution the program records how many times each branch and call is
6491 executed and how many times it is taken or returns. When the compiled
6492 program exits it saves this data to a file called
6493 @file{@var{auxname}.gcda} for each source file. The data may be used for
6494 profile-directed optimizations (@option{-fbranch-probabilities}), or for
6495 test coverage analysis (@option{-ftest-coverage}). Each object file's
6496 @var{auxname} is generated from the name of the output file, if
6497 explicitly specified and it is not the final executable, otherwise it is
6498 the basename of the source file. In both cases any suffix is removed
6499 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
6500 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
6501 @xref{Cross-profiling}.
6502
6503 @cindex @command{gcov}
6504 @item --coverage
6505 @opindex coverage
6506
6507 This option is used to compile and link code instrumented for coverage
6508 analysis. The option is a synonym for @option{-fprofile-arcs}
6509 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
6510 linking). See the documentation for those options for more details.
6511
6512 @itemize
6513
6514 @item
6515 Compile the source files with @option{-fprofile-arcs} plus optimization
6516 and code generation options. For test coverage analysis, use the
6517 additional @option{-ftest-coverage} option. You do not need to profile
6518 every source file in a program.
6519
6520 @item
6521 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
6522 (the latter implies the former).
6523
6524 @item
6525 Run the program on a representative workload to generate the arc profile
6526 information. This may be repeated any number of times. You can run
6527 concurrent instances of your program, and provided that the file system
6528 supports locking, the data files will be correctly updated. Also
6529 @code{fork} calls are detected and correctly handled (double counting
6530 will not happen).
6531
6532 @item
6533 For profile-directed optimizations, compile the source files again with
6534 the same optimization and code generation options plus
6535 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
6536 Control Optimization}).
6537
6538 @item
6539 For test coverage analysis, use @command{gcov} to produce human readable
6540 information from the @file{.gcno} and @file{.gcda} files. Refer to the
6541 @command{gcov} documentation for further information.
6542
6543 @end itemize
6544
6545 With @option{-fprofile-arcs}, for each function of your program GCC
6546 creates a program flow graph, then finds a spanning tree for the graph.
6547 Only arcs that are not on the spanning tree have to be instrumented: the
6548 compiler adds code to count the number of times that these arcs are
6549 executed. When an arc is the only exit or only entrance to a block, the
6550 instrumentation code can be added to the block; otherwise, a new basic
6551 block must be created to hold the instrumentation code.
6552
6553 @need 2000
6554 @item -ftest-coverage
6555 @opindex ftest-coverage
6556 Produce a notes file that the @command{gcov} code-coverage utility
6557 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
6558 show program coverage. Each source file's note file is called
6559 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
6560 above for a description of @var{auxname} and instructions on how to
6561 generate test coverage data. Coverage data matches the source files
6562 more closely if you do not optimize.
6563
6564 @item -fdbg-cnt-list
6565 @opindex fdbg-cnt-list
6566 Print the name and the counter upper bound for all debug counters.
6567
6568
6569 @item -fdbg-cnt=@var{counter-value-list}
6570 @opindex fdbg-cnt
6571 Set the internal debug counter upper bound. @var{counter-value-list}
6572 is a comma-separated list of @var{name}:@var{value} pairs
6573 which sets the upper bound of each debug counter @var{name} to @var{value}.
6574 All debug counters have the initial upper bound of @code{UINT_MAX};
6575 thus @code{dbg_cnt} returns true always unless the upper bound
6576 is set by this option.
6577 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
6578 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
6579
6580 @item -fenable-@var{kind}-@var{pass}
6581 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
6582 @opindex fdisable-
6583 @opindex fenable-
6584
6585 This is a set of options that are used to explicitly disable/enable
6586 optimization passes. These options are intended for use for debugging GCC.
6587 Compiler users should use regular options for enabling/disabling
6588 passes instead.
6589
6590 @table @gcctabopt
6591
6592 @item -fdisable-ipa-@var{pass}
6593 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
6594 statically invoked in the compiler multiple times, the pass name should be
6595 appended with a sequential number starting from 1.
6596
6597 @item -fdisable-rtl-@var{pass}
6598 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
6599 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
6600 statically invoked in the compiler multiple times, the pass name should be
6601 appended with a sequential number starting from 1. @var{range-list} is a
6602 comma-separated list of function ranges or assembler names. Each range is a number
6603 pair separated by a colon. The range is inclusive in both ends. If the range
6604 is trivial, the number pair can be simplified as a single number. If the
6605 function's call graph node's @var{uid} falls within one of the specified ranges,
6606 the @var{pass} is disabled for that function. The @var{uid} is shown in the
6607 function header of a dump file, and the pass names can be dumped by using
6608 option @option{-fdump-passes}.
6609
6610 @item -fdisable-tree-@var{pass}
6611 @itemx -fdisable-tree-@var{pass}=@var{range-list}
6612 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
6613 option arguments.
6614
6615 @item -fenable-ipa-@var{pass}
6616 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
6617 statically invoked in the compiler multiple times, the pass name should be
6618 appended with a sequential number starting from 1.
6619
6620 @item -fenable-rtl-@var{pass}
6621 @itemx -fenable-rtl-@var{pass}=@var{range-list}
6622 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
6623 description and examples.
6624
6625 @item -fenable-tree-@var{pass}
6626 @itemx -fenable-tree-@var{pass}=@var{range-list}
6627 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
6628 of option arguments.
6629
6630 @end table
6631
6632 Here are some examples showing uses of these options.
6633
6634 @smallexample
6635
6636 # disable ccp1 for all functions
6637 -fdisable-tree-ccp1
6638 # disable complete unroll for function whose cgraph node uid is 1
6639 -fenable-tree-cunroll=1
6640 # disable gcse2 for functions at the following ranges [1,1],
6641 # [300,400], and [400,1000]
6642 # disable gcse2 for functions foo and foo2
6643 -fdisable-rtl-gcse2=foo,foo2
6644 # disable early inlining
6645 -fdisable-tree-einline
6646 # disable ipa inlining
6647 -fdisable-ipa-inline
6648 # enable tree full unroll
6649 -fenable-tree-unroll
6650
6651 @end smallexample
6652
6653 @item -d@var{letters}
6654 @itemx -fdump-rtl-@var{pass}
6655 @itemx -fdump-rtl-@var{pass}=@var{filename}
6656 @opindex d
6657 @opindex fdump-rtl-@var{pass}
6658 Says to make debugging dumps during compilation at times specified by
6659 @var{letters}. This is used for debugging the RTL-based passes of the
6660 compiler. The file names for most of the dumps are made by appending
6661 a pass number and a word to the @var{dumpname}, and the files are
6662 created in the directory of the output file. In case of
6663 @option{=@var{filename}} option, the dump is output on the given file
6664 instead of the pass numbered dump files. Note that the pass number is
6665 computed statically as passes get registered into the pass manager.
6666 Thus the numbering is not related to the dynamic order of execution of
6667 passes. In particular, a pass installed by a plugin could have a
6668 number over 200 even if it executed quite early. @var{dumpname} is
6669 generated from the name of the output file, if explicitly specified
6670 and it is not an executable, otherwise it is the basename of the
6671 source file. These switches may have different effects when
6672 @option{-E} is used for preprocessing.
6673
6674 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
6675 @option{-d} option @var{letters}. Here are the possible
6676 letters for use in @var{pass} and @var{letters}, and their meanings:
6677
6678 @table @gcctabopt
6679
6680 @item -fdump-rtl-alignments
6681 @opindex fdump-rtl-alignments
6682 Dump after branch alignments have been computed.
6683
6684 @item -fdump-rtl-asmcons
6685 @opindex fdump-rtl-asmcons
6686 Dump after fixing rtl statements that have unsatisfied in/out constraints.
6687
6688 @item -fdump-rtl-auto_inc_dec
6689 @opindex fdump-rtl-auto_inc_dec
6690 Dump after auto-inc-dec discovery. This pass is only run on
6691 architectures that have auto inc or auto dec instructions.
6692
6693 @item -fdump-rtl-barriers
6694 @opindex fdump-rtl-barriers
6695 Dump after cleaning up the barrier instructions.
6696
6697 @item -fdump-rtl-bbpart
6698 @opindex fdump-rtl-bbpart
6699 Dump after partitioning hot and cold basic blocks.
6700
6701 @item -fdump-rtl-bbro
6702 @opindex fdump-rtl-bbro
6703 Dump after block reordering.
6704
6705 @item -fdump-rtl-btl1
6706 @itemx -fdump-rtl-btl2
6707 @opindex fdump-rtl-btl2
6708 @opindex fdump-rtl-btl2
6709 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
6710 after the two branch
6711 target load optimization passes.
6712
6713 @item -fdump-rtl-bypass
6714 @opindex fdump-rtl-bypass
6715 Dump after jump bypassing and control flow optimizations.
6716
6717 @item -fdump-rtl-combine
6718 @opindex fdump-rtl-combine
6719 Dump after the RTL instruction combination pass.
6720
6721 @item -fdump-rtl-compgotos
6722 @opindex fdump-rtl-compgotos
6723 Dump after duplicating the computed gotos.
6724
6725 @item -fdump-rtl-ce1
6726 @itemx -fdump-rtl-ce2
6727 @itemx -fdump-rtl-ce3
6728 @opindex fdump-rtl-ce1
6729 @opindex fdump-rtl-ce2
6730 @opindex fdump-rtl-ce3
6731 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
6732 @option{-fdump-rtl-ce3} enable dumping after the three
6733 if conversion passes.
6734
6735 @item -fdump-rtl-cprop_hardreg
6736 @opindex fdump-rtl-cprop_hardreg
6737 Dump after hard register copy propagation.
6738
6739 @item -fdump-rtl-csa
6740 @opindex fdump-rtl-csa
6741 Dump after combining stack adjustments.
6742
6743 @item -fdump-rtl-cse1
6744 @itemx -fdump-rtl-cse2
6745 @opindex fdump-rtl-cse1
6746 @opindex fdump-rtl-cse2
6747 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
6748 the two common subexpression elimination passes.
6749
6750 @item -fdump-rtl-dce
6751 @opindex fdump-rtl-dce
6752 Dump after the standalone dead code elimination passes.
6753
6754 @item -fdump-rtl-dbr
6755 @opindex fdump-rtl-dbr
6756 Dump after delayed branch scheduling.
6757
6758 @item -fdump-rtl-dce1
6759 @itemx -fdump-rtl-dce2
6760 @opindex fdump-rtl-dce1
6761 @opindex fdump-rtl-dce2
6762 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
6763 the two dead store elimination passes.
6764
6765 @item -fdump-rtl-eh
6766 @opindex fdump-rtl-eh
6767 Dump after finalization of EH handling code.
6768
6769 @item -fdump-rtl-eh_ranges
6770 @opindex fdump-rtl-eh_ranges
6771 Dump after conversion of EH handling range regions.
6772
6773 @item -fdump-rtl-expand
6774 @opindex fdump-rtl-expand
6775 Dump after RTL generation.
6776
6777 @item -fdump-rtl-fwprop1
6778 @itemx -fdump-rtl-fwprop2
6779 @opindex fdump-rtl-fwprop1
6780 @opindex fdump-rtl-fwprop2
6781 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
6782 dumping after the two forward propagation passes.
6783
6784 @item -fdump-rtl-gcse1
6785 @itemx -fdump-rtl-gcse2
6786 @opindex fdump-rtl-gcse1
6787 @opindex fdump-rtl-gcse2
6788 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
6789 after global common subexpression elimination.
6790
6791 @item -fdump-rtl-init-regs
6792 @opindex fdump-rtl-init-regs
6793 Dump after the initialization of the registers.
6794
6795 @item -fdump-rtl-initvals
6796 @opindex fdump-rtl-initvals
6797 Dump after the computation of the initial value sets.
6798
6799 @item -fdump-rtl-into_cfglayout
6800 @opindex fdump-rtl-into_cfglayout
6801 Dump after converting to cfglayout mode.
6802
6803 @item -fdump-rtl-ira
6804 @opindex fdump-rtl-ira
6805 Dump after iterated register allocation.
6806
6807 @item -fdump-rtl-jump
6808 @opindex fdump-rtl-jump
6809 Dump after the second jump optimization.
6810
6811 @item -fdump-rtl-loop2
6812 @opindex fdump-rtl-loop2
6813 @option{-fdump-rtl-loop2} enables dumping after the rtl
6814 loop optimization passes.
6815
6816 @item -fdump-rtl-mach
6817 @opindex fdump-rtl-mach
6818 Dump after performing the machine dependent reorganization pass, if that
6819 pass exists.
6820
6821 @item -fdump-rtl-mode_sw
6822 @opindex fdump-rtl-mode_sw
6823 Dump after removing redundant mode switches.
6824
6825 @item -fdump-rtl-rnreg
6826 @opindex fdump-rtl-rnreg
6827 Dump after register renumbering.
6828
6829 @item -fdump-rtl-outof_cfglayout
6830 @opindex fdump-rtl-outof_cfglayout
6831 Dump after converting from cfglayout mode.
6832
6833 @item -fdump-rtl-peephole2
6834 @opindex fdump-rtl-peephole2
6835 Dump after the peephole pass.
6836
6837 @item -fdump-rtl-postreload
6838 @opindex fdump-rtl-postreload
6839 Dump after post-reload optimizations.
6840
6841 @item -fdump-rtl-pro_and_epilogue
6842 @opindex fdump-rtl-pro_and_epilogue
6843 Dump after generating the function prologues and epilogues.
6844
6845 @item -fdump-rtl-sched1
6846 @itemx -fdump-rtl-sched2
6847 @opindex fdump-rtl-sched1
6848 @opindex fdump-rtl-sched2
6849 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
6850 after the basic block scheduling passes.
6851
6852 @item -fdump-rtl-ree
6853 @opindex fdump-rtl-ree
6854 Dump after sign/zero extension elimination.
6855
6856 @item -fdump-rtl-seqabstr
6857 @opindex fdump-rtl-seqabstr
6858 Dump after common sequence discovery.
6859
6860 @item -fdump-rtl-shorten
6861 @opindex fdump-rtl-shorten
6862 Dump after shortening branches.
6863
6864 @item -fdump-rtl-sibling
6865 @opindex fdump-rtl-sibling
6866 Dump after sibling call optimizations.
6867
6868 @item -fdump-rtl-split1
6869 @itemx -fdump-rtl-split2
6870 @itemx -fdump-rtl-split3
6871 @itemx -fdump-rtl-split4
6872 @itemx -fdump-rtl-split5
6873 @opindex fdump-rtl-split1
6874 @opindex fdump-rtl-split2
6875 @opindex fdump-rtl-split3
6876 @opindex fdump-rtl-split4
6877 @opindex fdump-rtl-split5
6878 These options enable dumping after five rounds of
6879 instruction splitting.
6880
6881 @item -fdump-rtl-sms
6882 @opindex fdump-rtl-sms
6883 Dump after modulo scheduling. This pass is only run on some
6884 architectures.
6885
6886 @item -fdump-rtl-stack
6887 @opindex fdump-rtl-stack
6888 Dump after conversion from GCC's ``flat register file'' registers to the
6889 x87's stack-like registers. This pass is only run on x86 variants.
6890
6891 @item -fdump-rtl-subreg1
6892 @itemx -fdump-rtl-subreg2
6893 @opindex fdump-rtl-subreg1
6894 @opindex fdump-rtl-subreg2
6895 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
6896 the two subreg expansion passes.
6897
6898 @item -fdump-rtl-unshare
6899 @opindex fdump-rtl-unshare
6900 Dump after all rtl has been unshared.
6901
6902 @item -fdump-rtl-vartrack
6903 @opindex fdump-rtl-vartrack
6904 Dump after variable tracking.
6905
6906 @item -fdump-rtl-vregs
6907 @opindex fdump-rtl-vregs
6908 Dump after converting virtual registers to hard registers.
6909
6910 @item -fdump-rtl-web
6911 @opindex fdump-rtl-web
6912 Dump after live range splitting.
6913
6914 @item -fdump-rtl-regclass
6915 @itemx -fdump-rtl-subregs_of_mode_init
6916 @itemx -fdump-rtl-subregs_of_mode_finish
6917 @itemx -fdump-rtl-dfinit
6918 @itemx -fdump-rtl-dfinish
6919 @opindex fdump-rtl-regclass
6920 @opindex fdump-rtl-subregs_of_mode_init
6921 @opindex fdump-rtl-subregs_of_mode_finish
6922 @opindex fdump-rtl-dfinit
6923 @opindex fdump-rtl-dfinish
6924 These dumps are defined but always produce empty files.
6925
6926 @item -da
6927 @itemx -fdump-rtl-all
6928 @opindex da
6929 @opindex fdump-rtl-all
6930 Produce all the dumps listed above.
6931
6932 @item -dA
6933 @opindex dA
6934 Annotate the assembler output with miscellaneous debugging information.
6935
6936 @item -dD
6937 @opindex dD
6938 Dump all macro definitions, at the end of preprocessing, in addition to
6939 normal output.
6940
6941 @item -dH
6942 @opindex dH
6943 Produce a core dump whenever an error occurs.
6944
6945 @item -dp
6946 @opindex dp
6947 Annotate the assembler output with a comment indicating which
6948 pattern and alternative is used. The length of each instruction is
6949 also printed.
6950
6951 @item -dP
6952 @opindex dP
6953 Dump the RTL in the assembler output as a comment before each instruction.
6954 Also turns on @option{-dp} annotation.
6955
6956 @item -dx
6957 @opindex dx
6958 Just generate RTL for a function instead of compiling it. Usually used
6959 with @option{-fdump-rtl-expand}.
6960 @end table
6961
6962 @item -fdump-noaddr
6963 @opindex fdump-noaddr
6964 When doing debugging dumps, suppress address output. This makes it more
6965 feasible to use diff on debugging dumps for compiler invocations with
6966 different compiler binaries and/or different
6967 text / bss / data / heap / stack / dso start locations.
6968
6969 @item -freport-bug
6970 @opindex freport-bug
6971 Collect and dump debug information into temporary file if ICE in C/C++
6972 compiler occured.
6973
6974 @item -fdump-unnumbered
6975 @opindex fdump-unnumbered
6976 When doing debugging dumps, suppress instruction numbers and address output.
6977 This makes it more feasible to use diff on debugging dumps for compiler
6978 invocations with different options, in particular with and without
6979 @option{-g}.
6980
6981 @item -fdump-unnumbered-links
6982 @opindex fdump-unnumbered-links
6983 When doing debugging dumps (see @option{-d} option above), suppress
6984 instruction numbers for the links to the previous and next instructions
6985 in a sequence.
6986
6987 @item -fdump-translation-unit @r{(C++ only)}
6988 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
6989 @opindex fdump-translation-unit
6990 Dump a representation of the tree structure for the entire translation
6991 unit to a file. The file name is made by appending @file{.tu} to the
6992 source file name, and the file is created in the same directory as the
6993 output file. If the @samp{-@var{options}} form is used, @var{options}
6994 controls the details of the dump as described for the
6995 @option{-fdump-tree} options.
6996
6997 @item -fdump-class-hierarchy @r{(C++ only)}
6998 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
6999 @opindex fdump-class-hierarchy
7000 Dump a representation of each class's hierarchy and virtual function
7001 table layout to a file. The file name is made by appending
7002 @file{.class} to the source file name, and the file is created in the
7003 same directory as the output file. If the @samp{-@var{options}} form
7004 is used, @var{options} controls the details of the dump as described
7005 for the @option{-fdump-tree} options.
7006
7007 @item -fdump-ipa-@var{switch}
7008 @opindex fdump-ipa
7009 Control the dumping at various stages of inter-procedural analysis
7010 language tree to a file. The file name is generated by appending a
7011 switch specific suffix to the source file name, and the file is created
7012 in the same directory as the output file. The following dumps are
7013 possible:
7014
7015 @table @samp
7016 @item all
7017 Enables all inter-procedural analysis dumps.
7018
7019 @item cgraph
7020 Dumps information about call-graph optimization, unused function removal,
7021 and inlining decisions.
7022
7023 @item inline
7024 Dump after function inlining.
7025
7026 @end table
7027
7028 @item -fdump-passes
7029 @opindex fdump-passes
7030 Dump the list of optimization passes that are turned on and off by
7031 the current command-line options.
7032
7033 @item -fdump-statistics-@var{option}
7034 @opindex fdump-statistics
7035 Enable and control dumping of pass statistics in a separate file. The
7036 file name is generated by appending a suffix ending in
7037 @samp{.statistics} to the source file name, and the file is created in
7038 the same directory as the output file. If the @samp{-@var{option}}
7039 form is used, @samp{-stats} causes counters to be summed over the
7040 whole compilation unit while @samp{-details} dumps every event as
7041 the passes generate them. The default with no option is to sum
7042 counters for each function compiled.
7043
7044 @item -fdump-tree-@var{switch}
7045 @itemx -fdump-tree-@var{switch}-@var{options}
7046 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
7047 @opindex fdump-tree
7048 Control the dumping at various stages of processing the intermediate
7049 language tree to a file. The file name is generated by appending a
7050 switch-specific suffix to the source file name, and the file is
7051 created in the same directory as the output file. In case of
7052 @option{=@var{filename}} option, the dump is output on the given file
7053 instead of the auto named dump files. If the @samp{-@var{options}}
7054 form is used, @var{options} is a list of @samp{-} separated options
7055 which control the details of the dump. Not all options are applicable
7056 to all dumps; those that are not meaningful are ignored. The
7057 following options are available
7058
7059 @table @samp
7060 @item address
7061 Print the address of each node. Usually this is not meaningful as it
7062 changes according to the environment and source file. Its primary use
7063 is for tying up a dump file with a debug environment.
7064 @item asmname
7065 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
7066 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
7067 use working backward from mangled names in the assembly file.
7068 @item slim
7069 When dumping front-end intermediate representations, inhibit dumping
7070 of members of a scope or body of a function merely because that scope
7071 has been reached. Only dump such items when they are directly reachable
7072 by some other path.
7073
7074 When dumping pretty-printed trees, this option inhibits dumping the
7075 bodies of control structures.
7076
7077 When dumping RTL, print the RTL in slim (condensed) form instead of
7078 the default LISP-like representation.
7079 @item raw
7080 Print a raw representation of the tree. By default, trees are
7081 pretty-printed into a C-like representation.
7082 @item details
7083 Enable more detailed dumps (not honored by every dump option). Also
7084 include information from the optimization passes.
7085 @item stats
7086 Enable dumping various statistics about the pass (not honored by every dump
7087 option).
7088 @item blocks
7089 Enable showing basic block boundaries (disabled in raw dumps).
7090 @item graph
7091 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
7092 dump a representation of the control flow graph suitable for viewing with
7093 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
7094 the file is pretty-printed as a subgraph, so that GraphViz can render them
7095 all in a single plot.
7096
7097 This option currently only works for RTL dumps, and the RTL is always
7098 dumped in slim form.
7099 @item vops
7100 Enable showing virtual operands for every statement.
7101 @item lineno
7102 Enable showing line numbers for statements.
7103 @item uid
7104 Enable showing the unique ID (@code{DECL_UID}) for each variable.
7105 @item verbose
7106 Enable showing the tree dump for each statement.
7107 @item eh
7108 Enable showing the EH region number holding each statement.
7109 @item scev
7110 Enable showing scalar evolution analysis details.
7111 @item optimized
7112 Enable showing optimization information (only available in certain
7113 passes).
7114 @item missed
7115 Enable showing missed optimization information (only available in certain
7116 passes).
7117 @item note
7118 Enable other detailed optimization information (only available in
7119 certain passes).
7120 @item =@var{filename}
7121 Instead of an auto named dump file, output into the given file
7122 name. The file names @file{stdout} and @file{stderr} are treated
7123 specially and are considered already open standard streams. For
7124 example,
7125
7126 @smallexample
7127 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
7128 -fdump-tree-pre=stderr file.c
7129 @end smallexample
7130
7131 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
7132 output on to @file{stderr}. If two conflicting dump filenames are
7133 given for the same pass, then the latter option overrides the earlier
7134 one.
7135
7136 @item all
7137 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
7138 and @option{lineno}.
7139
7140 @item optall
7141 Turn on all optimization options, i.e., @option{optimized},
7142 @option{missed}, and @option{note}.
7143 @end table
7144
7145 The following tree dumps are possible:
7146 @table @samp
7147
7148 @item original
7149 @opindex fdump-tree-original
7150 Dump before any tree based optimization, to @file{@var{file}.original}.
7151
7152 @item optimized
7153 @opindex fdump-tree-optimized
7154 Dump after all tree based optimization, to @file{@var{file}.optimized}.
7155
7156 @item gimple
7157 @opindex fdump-tree-gimple
7158 Dump each function before and after the gimplification pass to a file. The
7159 file name is made by appending @file{.gimple} to the source file name.
7160
7161 @item cfg
7162 @opindex fdump-tree-cfg
7163 Dump the control flow graph of each function to a file. The file name is
7164 made by appending @file{.cfg} to the source file name.
7165
7166 @item ch
7167 @opindex fdump-tree-ch
7168 Dump each function after copying loop headers. The file name is made by
7169 appending @file{.ch} to the source file name.
7170
7171 @item ssa
7172 @opindex fdump-tree-ssa
7173 Dump SSA related information to a file. The file name is made by appending
7174 @file{.ssa} to the source file name.
7175
7176 @item alias
7177 @opindex fdump-tree-alias
7178 Dump aliasing information for each function. The file name is made by
7179 appending @file{.alias} to the source file name.
7180
7181 @item ccp
7182 @opindex fdump-tree-ccp
7183 Dump each function after CCP@. The file name is made by appending
7184 @file{.ccp} to the source file name.
7185
7186 @item storeccp
7187 @opindex fdump-tree-storeccp
7188 Dump each function after STORE-CCP@. The file name is made by appending
7189 @file{.storeccp} to the source file name.
7190
7191 @item pre
7192 @opindex fdump-tree-pre
7193 Dump trees after partial redundancy elimination. The file name is made
7194 by appending @file{.pre} to the source file name.
7195
7196 @item fre
7197 @opindex fdump-tree-fre
7198 Dump trees after full redundancy elimination. The file name is made
7199 by appending @file{.fre} to the source file name.
7200
7201 @item copyprop
7202 @opindex fdump-tree-copyprop
7203 Dump trees after copy propagation. The file name is made
7204 by appending @file{.copyprop} to the source file name.
7205
7206 @item store_copyprop
7207 @opindex fdump-tree-store_copyprop
7208 Dump trees after store copy-propagation. The file name is made
7209 by appending @file{.store_copyprop} to the source file name.
7210
7211 @item dce
7212 @opindex fdump-tree-dce
7213 Dump each function after dead code elimination. The file name is made by
7214 appending @file{.dce} to the source file name.
7215
7216 @item sra
7217 @opindex fdump-tree-sra
7218 Dump each function after performing scalar replacement of aggregates. The
7219 file name is made by appending @file{.sra} to the source file name.
7220
7221 @item sink
7222 @opindex fdump-tree-sink
7223 Dump each function after performing code sinking. The file name is made
7224 by appending @file{.sink} to the source file name.
7225
7226 @item dom
7227 @opindex fdump-tree-dom
7228 Dump each function after applying dominator tree optimizations. The file
7229 name is made by appending @file{.dom} to the source file name.
7230
7231 @item dse
7232 @opindex fdump-tree-dse
7233 Dump each function after applying dead store elimination. The file
7234 name is made by appending @file{.dse} to the source file name.
7235
7236 @item phiopt
7237 @opindex fdump-tree-phiopt
7238 Dump each function after optimizing PHI nodes into straightline code. The file
7239 name is made by appending @file{.phiopt} to the source file name.
7240
7241 @item backprop
7242 @opindex fdump-tree-backprop
7243 Dump each function after back-propagating use information up the definition
7244 chain. The file name is made by appending @file{.backprop} to the
7245 source file name.
7246
7247 @item forwprop
7248 @opindex fdump-tree-forwprop
7249 Dump each function after forward propagating single use variables. The file
7250 name is made by appending @file{.forwprop} to the source file name.
7251
7252 @item nrv
7253 @opindex fdump-tree-nrv
7254 Dump each function after applying the named return value optimization on
7255 generic trees. The file name is made by appending @file{.nrv} to the source
7256 file name.
7257
7258 @item vect
7259 @opindex fdump-tree-vect
7260 Dump each function after applying vectorization of loops. The file name is
7261 made by appending @file{.vect} to the source file name.
7262
7263 @item slp
7264 @opindex fdump-tree-slp
7265 Dump each function after applying vectorization of basic blocks. The file name
7266 is made by appending @file{.slp} to the source file name.
7267
7268 @item vrp
7269 @opindex fdump-tree-vrp
7270 Dump each function after Value Range Propagation (VRP). The file name
7271 is made by appending @file{.vrp} to the source file name.
7272
7273 @item oaccdevlow
7274 @opindex fdump-tree-oaccdevlow
7275 Dump each function after applying device-specific OpenACC transformations.
7276 The file name is made by appending @file{.oaccdevlow} to the source file name.
7277
7278 @item all
7279 @opindex fdump-tree-all
7280 Enable all the available tree dumps with the flags provided in this option.
7281 @end table
7282
7283 @item -fopt-info
7284 @itemx -fopt-info-@var{options}
7285 @itemx -fopt-info-@var{options}=@var{filename}
7286 @opindex fopt-info
7287 Controls optimization dumps from various optimization passes. If the
7288 @samp{-@var{options}} form is used, @var{options} is a list of
7289 @samp{-} separated option keywords to select the dump details and
7290 optimizations.
7291
7292 The @var{options} can be divided into two groups: options describing the
7293 verbosity of the dump, and options describing which optimizations
7294 should be included. The options from both the groups can be freely
7295 mixed as they are non-overlapping. However, in case of any conflicts,
7296 the later options override the earlier options on the command
7297 line.
7298
7299 The following options control the dump verbosity:
7300
7301 @table @samp
7302 @item optimized
7303 Print information when an optimization is successfully applied. It is
7304 up to a pass to decide which information is relevant. For example, the
7305 vectorizer passes print the source location of loops which are
7306 successfully vectorized.
7307 @item missed
7308 Print information about missed optimizations. Individual passes
7309 control which information to include in the output.
7310 @item note
7311 Print verbose information about optimizations, such as certain
7312 transformations, more detailed messages about decisions etc.
7313 @item all
7314 Print detailed optimization information. This includes
7315 @samp{optimized}, @samp{missed}, and @samp{note}.
7316 @end table
7317
7318 One or more of the following option keywords can be used to describe a
7319 group of optimizations:
7320
7321 @table @samp
7322 @item ipa
7323 Enable dumps from all interprocedural optimizations.
7324 @item loop
7325 Enable dumps from all loop optimizations.
7326 @item inline
7327 Enable dumps from all inlining optimizations.
7328 @item vec
7329 Enable dumps from all vectorization optimizations.
7330 @item optall
7331 Enable dumps from all optimizations. This is a superset of
7332 the optimization groups listed above.
7333 @end table
7334
7335 If @var{options} is
7336 omitted, it defaults to @samp{optimized-optall}, which means to dump all
7337 info about successful optimizations from all the passes.
7338
7339 If the @var{filename} is provided, then the dumps from all the
7340 applicable optimizations are concatenated into the @var{filename}.
7341 Otherwise the dump is output onto @file{stderr}. Though multiple
7342 @option{-fopt-info} options are accepted, only one of them can include
7343 a @var{filename}. If other filenames are provided then all but the
7344 first such option are ignored.
7345
7346 Note that the output @var{filename} is overwritten
7347 in case of multiple translation units. If a combined output from
7348 multiple translation units is desired, @file{stderr} should be used
7349 instead.
7350
7351 In the following example, the optimization info is output to
7352 @file{stderr}:
7353
7354 @smallexample
7355 gcc -O3 -fopt-info
7356 @end smallexample
7357
7358 This example:
7359 @smallexample
7360 gcc -O3 -fopt-info-missed=missed.all
7361 @end smallexample
7362
7363 @noindent
7364 outputs missed optimization report from all the passes into
7365 @file{missed.all}, and this one:
7366
7367 @smallexample
7368 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
7369 @end smallexample
7370
7371 @noindent
7372 prints information about missed optimization opportunities from
7373 vectorization passes on @file{stderr}.
7374 Note that @option{-fopt-info-vec-missed} is equivalent to
7375 @option{-fopt-info-missed-vec}.
7376
7377 As another example,
7378 @smallexample
7379 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
7380 @end smallexample
7381
7382 @noindent
7383 outputs information about missed optimizations as well as
7384 optimized locations from all the inlining passes into
7385 @file{inline.txt}.
7386
7387 Finally, consider:
7388
7389 @smallexample
7390 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
7391 @end smallexample
7392
7393 @noindent
7394 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
7395 in conflict since only one output file is allowed. In this case, only
7396 the first option takes effect and the subsequent options are
7397 ignored. Thus only @file{vec.miss} is produced which contains
7398 dumps from the vectorizer about missed opportunities.
7399
7400 @item -frandom-seed=@var{number}
7401 @opindex frandom-seed
7402 This option provides a seed that GCC uses in place of
7403 random numbers in generating certain symbol names
7404 that have to be different in every compiled file. It is also used to
7405 place unique stamps in coverage data files and the object files that
7406 produce them. You can use the @option{-frandom-seed} option to produce
7407 reproducibly identical object files.
7408
7409 The @var{number} should be different for every file you compile.
7410
7411 @item -fsched-verbose=@var{n}
7412 @opindex fsched-verbose
7413 On targets that use instruction scheduling, this option controls the
7414 amount of debugging output the scheduler prints. This information is
7415 written to standard error, unless @option{-fdump-rtl-sched1} or
7416 @option{-fdump-rtl-sched2} is specified, in which case it is output
7417 to the usual dump listing file, @file{.sched1} or @file{.sched2}
7418 respectively. However for @var{n} greater than nine, the output is
7419 always printed to standard error.
7420
7421 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
7422 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
7423 For @var{n} greater than one, it also output basic block probabilities,
7424 detailed ready list information and unit/insn info. For @var{n} greater
7425 than two, it includes RTL at abort point, control-flow and regions info.
7426 And for @var{n} over four, @option{-fsched-verbose} also includes
7427 dependence info.
7428
7429 @item -save-temps
7430 @itemx -save-temps=cwd
7431 @opindex save-temps
7432 Store the usual ``temporary'' intermediate files permanently; place them
7433 in the current directory and name them based on the source file. Thus,
7434 compiling @file{foo.c} with @option{-c -save-temps} produces files
7435 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
7436 preprocessed @file{foo.i} output file even though the compiler now
7437 normally uses an integrated preprocessor.
7438
7439 When used in combination with the @option{-x} command-line option,
7440 @option{-save-temps} is sensible enough to avoid over writing an
7441 input source file with the same extension as an intermediate file.
7442 The corresponding intermediate file may be obtained by renaming the
7443 source file before using @option{-save-temps}.
7444
7445 If you invoke GCC in parallel, compiling several different source
7446 files that share a common base name in different subdirectories or the
7447 same source file compiled for multiple output destinations, it is
7448 likely that the different parallel compilers will interfere with each
7449 other, and overwrite the temporary files. For instance:
7450
7451 @smallexample
7452 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
7453 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
7454 @end smallexample
7455
7456 may result in @file{foo.i} and @file{foo.o} being written to
7457 simultaneously by both compilers.
7458
7459 @item -save-temps=obj
7460 @opindex save-temps=obj
7461 Store the usual ``temporary'' intermediate files permanently. If the
7462 @option{-o} option is used, the temporary files are based on the
7463 object file. If the @option{-o} option is not used, the
7464 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
7465
7466 For example:
7467
7468 @smallexample
7469 gcc -save-temps=obj -c foo.c
7470 gcc -save-temps=obj -c bar.c -o dir/xbar.o
7471 gcc -save-temps=obj foobar.c -o dir2/yfoobar
7472 @end smallexample
7473
7474 @noindent
7475 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
7476 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
7477 @file{dir2/yfoobar.o}.
7478
7479 @item -time@r{[}=@var{file}@r{]}
7480 @opindex time
7481 Report the CPU time taken by each subprocess in the compilation
7482 sequence. For C source files, this is the compiler proper and assembler
7483 (plus the linker if linking is done).
7484
7485 Without the specification of an output file, the output looks like this:
7486
7487 @smallexample
7488 # cc1 0.12 0.01
7489 # as 0.00 0.01
7490 @end smallexample
7491
7492 The first number on each line is the ``user time'', that is time spent
7493 executing the program itself. The second number is ``system time'',
7494 time spent executing operating system routines on behalf of the program.
7495 Both numbers are in seconds.
7496
7497 With the specification of an output file, the output is appended to the
7498 named file, and it looks like this:
7499
7500 @smallexample
7501 0.12 0.01 cc1 @var{options}
7502 0.00 0.01 as @var{options}
7503 @end smallexample
7504
7505 The ``user time'' and the ``system time'' are moved before the program
7506 name, and the options passed to the program are displayed, so that one
7507 can later tell what file was being compiled, and with which options.
7508
7509 @item -fvar-tracking
7510 @opindex fvar-tracking
7511 Run variable tracking pass. It computes where variables are stored at each
7512 position in code. Better debugging information is then generated
7513 (if the debugging information format supports this information).
7514
7515 It is enabled by default when compiling with optimization (@option{-Os},
7516 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7517 the debug info format supports it.
7518
7519 @item -fvar-tracking-assignments
7520 @opindex fvar-tracking-assignments
7521 @opindex fno-var-tracking-assignments
7522 Annotate assignments to user variables early in the compilation and
7523 attempt to carry the annotations over throughout the compilation all the
7524 way to the end, in an attempt to improve debug information while
7525 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7526
7527 It can be enabled even if var-tracking is disabled, in which case
7528 annotations are created and maintained, but discarded at the end.
7529 By default, this flag is enabled together with @option{-fvar-tracking},
7530 except when selective scheduling is enabled.
7531
7532 @item -fvar-tracking-assignments-toggle
7533 @opindex fvar-tracking-assignments-toggle
7534 @opindex fno-var-tracking-assignments-toggle
7535 Toggle @option{-fvar-tracking-assignments}, in the same way that
7536 @option{-gtoggle} toggles @option{-g}.
7537
7538 @item -print-file-name=@var{library}
7539 @opindex print-file-name
7540 Print the full absolute name of the library file @var{library} that
7541 would be used when linking---and don't do anything else. With this
7542 option, GCC does not compile or link anything; it just prints the
7543 file name.
7544
7545 @item -print-multi-directory
7546 @opindex print-multi-directory
7547 Print the directory name corresponding to the multilib selected by any
7548 other switches present in the command line. This directory is supposed
7549 to exist in @env{GCC_EXEC_PREFIX}.
7550
7551 @item -print-multi-lib
7552 @opindex print-multi-lib
7553 Print the mapping from multilib directory names to compiler switches
7554 that enable them. The directory name is separated from the switches by
7555 @samp{;}, and each switch starts with an @samp{@@} instead of the
7556 @samp{-}, without spaces between multiple switches. This is supposed to
7557 ease shell processing.
7558
7559 @item -print-multi-os-directory
7560 @opindex print-multi-os-directory
7561 Print the path to OS libraries for the selected
7562 multilib, relative to some @file{lib} subdirectory. If OS libraries are
7563 present in the @file{lib} subdirectory and no multilibs are used, this is
7564 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
7565 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
7566 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
7567 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
7568
7569 @item -print-multiarch
7570 @opindex print-multiarch
7571 Print the path to OS libraries for the selected multiarch,
7572 relative to some @file{lib} subdirectory.
7573
7574 @item -print-prog-name=@var{program}
7575 @opindex print-prog-name
7576 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
7577
7578 @item -print-libgcc-file-name
7579 @opindex print-libgcc-file-name
7580 Same as @option{-print-file-name=libgcc.a}.
7581
7582 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
7583 but you do want to link with @file{libgcc.a}. You can do:
7584
7585 @smallexample
7586 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
7587 @end smallexample
7588
7589 @item -print-search-dirs
7590 @opindex print-search-dirs
7591 Print the name of the configured installation directory and a list of
7592 program and library directories @command{gcc} searches---and don't do anything else.
7593
7594 This is useful when @command{gcc} prints the error message
7595 @samp{installation problem, cannot exec cpp0: No such file or directory}.
7596 To resolve this you either need to put @file{cpp0} and the other compiler
7597 components where @command{gcc} expects to find them, or you can set the environment
7598 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
7599 Don't forget the trailing @samp{/}.
7600 @xref{Environment Variables}.
7601
7602 @item -print-sysroot
7603 @opindex print-sysroot
7604 Print the target sysroot directory that is used during
7605 compilation. This is the target sysroot specified either at configure
7606 time or using the @option{--sysroot} option, possibly with an extra
7607 suffix that depends on compilation options. If no target sysroot is
7608 specified, the option prints nothing.
7609
7610 @item -print-sysroot-headers-suffix
7611 @opindex print-sysroot-headers-suffix
7612 Print the suffix added to the target sysroot when searching for
7613 headers, or give an error if the compiler is not configured with such
7614 a suffix---and don't do anything else.
7615
7616 @item -dumpmachine
7617 @opindex dumpmachine
7618 Print the compiler's target machine (for example,
7619 @samp{i686-pc-linux-gnu})---and don't do anything else.
7620
7621 @item -dumpversion
7622 @opindex dumpversion
7623 Print the compiler version (for example, @code{3.0})---and don't do
7624 anything else.
7625
7626 @item -dumpspecs
7627 @opindex dumpspecs
7628 Print the compiler's built-in specs---and don't do anything else. (This
7629 is used when GCC itself is being built.) @xref{Spec Files}.
7630
7631 @item -fno-eliminate-unused-debug-types
7632 @opindex feliminate-unused-debug-types
7633 @opindex fno-eliminate-unused-debug-types
7634 Normally, when producing DWARF 2 output, GCC avoids producing debug symbol
7635 output for types that are nowhere used in the source file being compiled.
7636 Sometimes it is useful to have GCC emit debugging
7637 information for all types declared in a compilation
7638 unit, regardless of whether or not they are actually used
7639 in that compilation unit, for example
7640 if, in the debugger, you want to cast a value to a type that is
7641 not actually used in your program (but is declared). More often,
7642 however, this results in a significant amount of wasted space.
7643 @end table
7644
7645 @node Optimize Options
7646 @section Options That Control Optimization
7647 @cindex optimize options
7648 @cindex options, optimization
7649
7650 These options control various sorts of optimizations.
7651
7652 Without any optimization option, the compiler's goal is to reduce the
7653 cost of compilation and to make debugging produce the expected
7654 results. Statements are independent: if you stop the program with a
7655 breakpoint between statements, you can then assign a new value to any
7656 variable or change the program counter to any other statement in the
7657 function and get exactly the results you expect from the source
7658 code.
7659
7660 Turning on optimization flags makes the compiler attempt to improve
7661 the performance and/or code size at the expense of compilation time
7662 and possibly the ability to debug the program.
7663
7664 The compiler performs optimization based on the knowledge it has of the
7665 program. Compiling multiple files at once to a single output file mode allows
7666 the compiler to use information gained from all of the files when compiling
7667 each of them.
7668
7669 Not all optimizations are controlled directly by a flag. Only
7670 optimizations that have a flag are listed in this section.
7671
7672 Most optimizations are only enabled if an @option{-O} level is set on
7673 the command line. Otherwise they are disabled, even if individual
7674 optimization flags are specified.
7675
7676 Depending on the target and how GCC was configured, a slightly different
7677 set of optimizations may be enabled at each @option{-O} level than
7678 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7679 to find out the exact set of optimizations that are enabled at each level.
7680 @xref{Overall Options}, for examples.
7681
7682 @table @gcctabopt
7683 @item -O
7684 @itemx -O1
7685 @opindex O
7686 @opindex O1
7687 Optimize. Optimizing compilation takes somewhat more time, and a lot
7688 more memory for a large function.
7689
7690 With @option{-O}, the compiler tries to reduce code size and execution
7691 time, without performing any optimizations that take a great deal of
7692 compilation time.
7693
7694 @option{-O} turns on the following optimization flags:
7695 @gccoptlist{
7696 -fauto-inc-dec @gol
7697 -fbranch-count-reg @gol
7698 -fcombine-stack-adjustments @gol
7699 -fcompare-elim @gol
7700 -fcprop-registers @gol
7701 -fdce @gol
7702 -fdefer-pop @gol
7703 -fdelayed-branch @gol
7704 -fdse @gol
7705 -fforward-propagate @gol
7706 -fguess-branch-probability @gol
7707 -fif-conversion2 @gol
7708 -fif-conversion @gol
7709 -finline-functions-called-once @gol
7710 -fipa-pure-const @gol
7711 -fipa-profile @gol
7712 -fipa-reference @gol
7713 -fmerge-constants @gol
7714 -fmove-loop-invariants @gol
7715 -freorder-blocks @gol
7716 -fshrink-wrap @gol
7717 -fsplit-wide-types @gol
7718 -fssa-backprop @gol
7719 -fssa-phiopt @gol
7720 -ftree-bit-ccp @gol
7721 -ftree-ccp @gol
7722 -ftree-ch @gol
7723 -ftree-coalesce-vars @gol
7724 -ftree-copy-prop @gol
7725 -ftree-dce @gol
7726 -ftree-dominator-opts @gol
7727 -ftree-dse @gol
7728 -ftree-forwprop @gol
7729 -ftree-fre @gol
7730 -ftree-phiprop @gol
7731 -ftree-sink @gol
7732 -ftree-slsr @gol
7733 -ftree-sra @gol
7734 -ftree-pta @gol
7735 -ftree-ter @gol
7736 -funit-at-a-time}
7737
7738 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
7739 where doing so does not interfere with debugging.
7740
7741 @item -O2
7742 @opindex O2
7743 Optimize even more. GCC performs nearly all supported optimizations
7744 that do not involve a space-speed tradeoff.
7745 As compared to @option{-O}, this option increases both compilation time
7746 and the performance of the generated code.
7747
7748 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7749 also turns on the following optimization flags:
7750 @gccoptlist{-fthread-jumps @gol
7751 -falign-functions -falign-jumps @gol
7752 -falign-loops -falign-labels @gol
7753 -fcaller-saves @gol
7754 -fcrossjumping @gol
7755 -fcse-follow-jumps -fcse-skip-blocks @gol
7756 -fdelete-null-pointer-checks @gol
7757 -fdevirtualize -fdevirtualize-speculatively @gol
7758 -fexpensive-optimizations @gol
7759 -fgcse -fgcse-lm @gol
7760 -fhoist-adjacent-loads @gol
7761 -finline-small-functions @gol
7762 -findirect-inlining @gol
7763 -fipa-cp @gol
7764 -fipa-cp-alignment @gol
7765 -fipa-sra @gol
7766 -fipa-icf @gol
7767 -fisolate-erroneous-paths-dereference @gol
7768 -flra-remat @gol
7769 -foptimize-sibling-calls @gol
7770 -foptimize-strlen @gol
7771 -fpartial-inlining @gol
7772 -fpeephole2 @gol
7773 -freorder-blocks-algorithm=stc @gol
7774 -freorder-blocks-and-partition -freorder-functions @gol
7775 -frerun-cse-after-loop @gol
7776 -fsched-interblock -fsched-spec @gol
7777 -fschedule-insns -fschedule-insns2 @gol
7778 -fstrict-aliasing -fstrict-overflow @gol
7779 -ftree-builtin-call-dce @gol
7780 -ftree-switch-conversion -ftree-tail-merge @gol
7781 -ftree-pre @gol
7782 -ftree-vrp @gol
7783 -fipa-ra}
7784
7785 Please note the warning under @option{-fgcse} about
7786 invoking @option{-O2} on programs that use computed gotos.
7787
7788 @item -O3
7789 @opindex O3
7790 Optimize yet more. @option{-O3} turns on all optimizations specified
7791 by @option{-O2} and also turns on the @option{-finline-functions},
7792 @option{-funswitch-loops}, @option{-fpredictive-commoning},
7793 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
7794 @option{-ftree-loop-distribute-patterns},
7795 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
7796 @option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
7797
7798 @item -O0
7799 @opindex O0
7800 Reduce compilation time and make debugging produce the expected
7801 results. This is the default.
7802
7803 @item -Os
7804 @opindex Os
7805 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7806 do not typically increase code size. It also performs further
7807 optimizations designed to reduce code size.
7808
7809 @option{-Os} disables the following optimization flags:
7810 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7811 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
7812 -freorder-blocks-and-partition -fprefetch-loop-arrays}
7813
7814 @item -Ofast
7815 @opindex Ofast
7816 Disregard strict standards compliance. @option{-Ofast} enables all
7817 @option{-O3} optimizations. It also enables optimizations that are not
7818 valid for all standard-compliant programs.
7819 It turns on @option{-ffast-math} and the Fortran-specific
7820 @option{-fno-protect-parens} and @option{-fstack-arrays}.
7821
7822 @item -Og
7823 @opindex Og
7824 Optimize debugging experience. @option{-Og} enables optimizations
7825 that do not interfere with debugging. It should be the optimization
7826 level of choice for the standard edit-compile-debug cycle, offering
7827 a reasonable level of optimization while maintaining fast compilation
7828 and a good debugging experience.
7829
7830 If you use multiple @option{-O} options, with or without level numbers,
7831 the last such option is the one that is effective.
7832 @end table
7833
7834 Options of the form @option{-f@var{flag}} specify machine-independent
7835 flags. Most flags have both positive and negative forms; the negative
7836 form of @option{-ffoo} is @option{-fno-foo}. In the table
7837 below, only one of the forms is listed---the one you typically
7838 use. You can figure out the other form by either removing @samp{no-}
7839 or adding it.
7840
7841 The following options control specific optimizations. They are either
7842 activated by @option{-O} options or are related to ones that are. You
7843 can use the following flags in the rare cases when ``fine-tuning'' of
7844 optimizations to be performed is desired.
7845
7846 @table @gcctabopt
7847 @item -fno-defer-pop
7848 @opindex fno-defer-pop
7849 Always pop the arguments to each function call as soon as that function
7850 returns. For machines that must pop arguments after a function call,
7851 the compiler normally lets arguments accumulate on the stack for several
7852 function calls and pops them all at once.
7853
7854 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7855
7856 @item -fforward-propagate
7857 @opindex fforward-propagate
7858 Perform a forward propagation pass on RTL@. The pass tries to combine two
7859 instructions and checks if the result can be simplified. If loop unrolling
7860 is active, two passes are performed and the second is scheduled after
7861 loop unrolling.
7862
7863 This option is enabled by default at optimization levels @option{-O},
7864 @option{-O2}, @option{-O3}, @option{-Os}.
7865
7866 @item -ffp-contract=@var{style}
7867 @opindex ffp-contract
7868 @option{-ffp-contract=off} disables floating-point expression contraction.
7869 @option{-ffp-contract=fast} enables floating-point expression contraction
7870 such as forming of fused multiply-add operations if the target has
7871 native support for them.
7872 @option{-ffp-contract=on} enables floating-point expression contraction
7873 if allowed by the language standard. This is currently not implemented
7874 and treated equal to @option{-ffp-contract=off}.
7875
7876 The default is @option{-ffp-contract=fast}.
7877
7878 @item -fomit-frame-pointer
7879 @opindex fomit-frame-pointer
7880 Don't keep the frame pointer in a register for functions that
7881 don't need one. This avoids the instructions to save, set up and
7882 restore frame pointers; it also makes an extra register available
7883 in many functions. @strong{It also makes debugging impossible on
7884 some machines.}
7885
7886 On some machines, such as the VAX, this flag has no effect, because
7887 the standard calling sequence automatically handles the frame pointer
7888 and nothing is saved by pretending it doesn't exist. The
7889 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
7890 whether a target machine supports this flag. @xref{Registers,,Register
7891 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
7892
7893 The default setting (when not optimizing for
7894 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
7895 @option{-fomit-frame-pointer}. You can configure GCC with the
7896 @option{--enable-frame-pointer} configure option to change the default.
7897
7898 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7899
7900 @item -foptimize-sibling-calls
7901 @opindex foptimize-sibling-calls
7902 Optimize sibling and tail recursive calls.
7903
7904 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7905
7906 @item -foptimize-strlen
7907 @opindex foptimize-strlen
7908 Optimize various standard C string functions (e.g. @code{strlen},
7909 @code{strchr} or @code{strcpy}) and
7910 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7911
7912 Enabled at levels @option{-O2}, @option{-O3}.
7913
7914 @item -fno-inline
7915 @opindex fno-inline
7916 Do not expand any functions inline apart from those marked with
7917 the @code{always_inline} attribute. This is the default when not
7918 optimizing.
7919
7920 Single functions can be exempted from inlining by marking them
7921 with the @code{noinline} attribute.
7922
7923 @item -finline-small-functions
7924 @opindex finline-small-functions
7925 Integrate functions into their callers when their body is smaller than expected
7926 function call code (so overall size of program gets smaller). The compiler
7927 heuristically decides which functions are simple enough to be worth integrating
7928 in this way. This inlining applies to all functions, even those not declared
7929 inline.
7930
7931 Enabled at level @option{-O2}.
7932
7933 @item -findirect-inlining
7934 @opindex findirect-inlining
7935 Inline also indirect calls that are discovered to be known at compile
7936 time thanks to previous inlining. This option has any effect only
7937 when inlining itself is turned on by the @option{-finline-functions}
7938 or @option{-finline-small-functions} options.
7939
7940 Enabled at level @option{-O2}.
7941
7942 @item -finline-functions
7943 @opindex finline-functions
7944 Consider all functions for inlining, even if they are not declared inline.
7945 The compiler heuristically decides which functions are worth integrating
7946 in this way.
7947
7948 If all calls to a given function are integrated, and the function is
7949 declared @code{static}, then the function is normally not output as
7950 assembler code in its own right.
7951
7952 Enabled at level @option{-O3}.
7953
7954 @item -finline-functions-called-once
7955 @opindex finline-functions-called-once
7956 Consider all @code{static} functions called once for inlining into their
7957 caller even if they are not marked @code{inline}. If a call to a given
7958 function is integrated, then the function is not output as assembler code
7959 in its own right.
7960
7961 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7962
7963 @item -fearly-inlining
7964 @opindex fearly-inlining
7965 Inline functions marked by @code{always_inline} and functions whose body seems
7966 smaller than the function call overhead early before doing
7967 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7968 makes profiling significantly cheaper and usually inlining faster on programs
7969 having large chains of nested wrapper functions.
7970
7971 Enabled by default.
7972
7973 @item -fipa-sra
7974 @opindex fipa-sra
7975 Perform interprocedural scalar replacement of aggregates, removal of
7976 unused parameters and replacement of parameters passed by reference
7977 by parameters passed by value.
7978
7979 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7980
7981 @item -finline-limit=@var{n}
7982 @opindex finline-limit
7983 By default, GCC limits the size of functions that can be inlined. This flag
7984 allows coarse control of this limit. @var{n} is the size of functions that
7985 can be inlined in number of pseudo instructions.
7986
7987 Inlining is actually controlled by a number of parameters, which may be
7988 specified individually by using @option{--param @var{name}=@var{value}}.
7989 The @option{-finline-limit=@var{n}} option sets some of these parameters
7990 as follows:
7991
7992 @table @gcctabopt
7993 @item max-inline-insns-single
7994 is set to @var{n}/2.
7995 @item max-inline-insns-auto
7996 is set to @var{n}/2.
7997 @end table
7998
7999 See below for a documentation of the individual
8000 parameters controlling inlining and for the defaults of these parameters.
8001
8002 @emph{Note:} there may be no value to @option{-finline-limit} that results
8003 in default behavior.
8004
8005 @emph{Note:} pseudo instruction represents, in this particular context, an
8006 abstract measurement of function's size. In no way does it represent a count
8007 of assembly instructions and as such its exact meaning might change from one
8008 release to an another.
8009
8010 @item -fno-keep-inline-dllexport
8011 @opindex fno-keep-inline-dllexport
8012 This is a more fine-grained version of @option{-fkeep-inline-functions},
8013 which applies only to functions that are declared using the @code{dllexport}
8014 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
8015 Functions}.)
8016
8017 @item -fkeep-inline-functions
8018 @opindex fkeep-inline-functions
8019 In C, emit @code{static} functions that are declared @code{inline}
8020 into the object file, even if the function has been inlined into all
8021 of its callers. This switch does not affect functions using the
8022 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8023 inline functions into the object file.
8024
8025 @item -fkeep-static-functions
8026 @opindex fkeep-static-functions
8027 Emit @code{static} functions into the object file, even if the function
8028 is never used.
8029
8030 @item -fkeep-static-consts
8031 @opindex fkeep-static-consts
8032 Emit variables declared @code{static const} when optimization isn't turned
8033 on, even if the variables aren't referenced.
8034
8035 GCC enables this option by default. If you want to force the compiler to
8036 check if a variable is referenced, regardless of whether or not
8037 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8038
8039 @item -fmerge-constants
8040 @opindex fmerge-constants
8041 Attempt to merge identical constants (string constants and floating-point
8042 constants) across compilation units.
8043
8044 This option is the default for optimized compilation if the assembler and
8045 linker support it. Use @option{-fno-merge-constants} to inhibit this
8046 behavior.
8047
8048 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8049
8050 @item -fmerge-all-constants
8051 @opindex fmerge-all-constants
8052 Attempt to merge identical constants and identical variables.
8053
8054 This option implies @option{-fmerge-constants}. In addition to
8055 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8056 arrays or initialized constant variables with integral or floating-point
8057 types. Languages like C or C++ require each variable, including multiple
8058 instances of the same variable in recursive calls, to have distinct locations,
8059 so using this option results in non-conforming
8060 behavior.
8061
8062 @item -fmodulo-sched
8063 @opindex fmodulo-sched
8064 Perform swing modulo scheduling immediately before the first scheduling
8065 pass. This pass looks at innermost loops and reorders their
8066 instructions by overlapping different iterations.
8067
8068 @item -fmodulo-sched-allow-regmoves
8069 @opindex fmodulo-sched-allow-regmoves
8070 Perform more aggressive SMS-based modulo scheduling with register moves
8071 allowed. By setting this flag certain anti-dependences edges are
8072 deleted, which triggers the generation of reg-moves based on the
8073 life-range analysis. This option is effective only with
8074 @option{-fmodulo-sched} enabled.
8075
8076 @item -fno-branch-count-reg
8077 @opindex fno-branch-count-reg
8078 Do not use ``decrement and branch'' instructions on a count register,
8079 but instead generate a sequence of instructions that decrement a
8080 register, compare it against zero, then branch based upon the result.
8081 This option is only meaningful on architectures that support such
8082 instructions, which include x86, PowerPC, IA-64 and S/390.
8083
8084 Enabled by default at @option{-O1} and higher.
8085
8086 The default is @option{-fbranch-count-reg}.
8087
8088 @item -fno-function-cse
8089 @opindex fno-function-cse
8090 Do not put function addresses in registers; make each instruction that
8091 calls a constant function contain the function's address explicitly.
8092
8093 This option results in less efficient code, but some strange hacks
8094 that alter the assembler output may be confused by the optimizations
8095 performed when this option is not used.
8096
8097 The default is @option{-ffunction-cse}
8098
8099 @item -fno-zero-initialized-in-bss
8100 @opindex fno-zero-initialized-in-bss
8101 If the target supports a BSS section, GCC by default puts variables that
8102 are initialized to zero into BSS@. This can save space in the resulting
8103 code.
8104
8105 This option turns off this behavior because some programs explicitly
8106 rely on variables going to the data section---e.g., so that the
8107 resulting executable can find the beginning of that section and/or make
8108 assumptions based on that.
8109
8110 The default is @option{-fzero-initialized-in-bss}.
8111
8112 @item -fthread-jumps
8113 @opindex fthread-jumps
8114 Perform optimizations that check to see if a jump branches to a
8115 location where another comparison subsumed by the first is found. If
8116 so, the first branch is redirected to either the destination of the
8117 second branch or a point immediately following it, depending on whether
8118 the condition is known to be true or false.
8119
8120 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8121
8122 @item -fsplit-wide-types
8123 @opindex fsplit-wide-types
8124 When using a type that occupies multiple registers, such as @code{long
8125 long} on a 32-bit system, split the registers apart and allocate them
8126 independently. This normally generates better code for those types,
8127 but may make debugging more difficult.
8128
8129 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8130 @option{-Os}.
8131
8132 @item -fcse-follow-jumps
8133 @opindex fcse-follow-jumps
8134 In common subexpression elimination (CSE), scan through jump instructions
8135 when the target of the jump is not reached by any other path. For
8136 example, when CSE encounters an @code{if} statement with an
8137 @code{else} clause, CSE follows the jump when the condition
8138 tested is false.
8139
8140 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8141
8142 @item -fcse-skip-blocks
8143 @opindex fcse-skip-blocks
8144 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8145 follow jumps that conditionally skip over blocks. When CSE
8146 encounters a simple @code{if} statement with no else clause,
8147 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8148 body of the @code{if}.
8149
8150 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8151
8152 @item -frerun-cse-after-loop
8153 @opindex frerun-cse-after-loop
8154 Re-run common subexpression elimination after loop optimizations are
8155 performed.
8156
8157 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8158
8159 @item -fgcse
8160 @opindex fgcse
8161 Perform a global common subexpression elimination pass.
8162 This pass also performs global constant and copy propagation.
8163
8164 @emph{Note:} When compiling a program using computed gotos, a GCC
8165 extension, you may get better run-time performance if you disable
8166 the global common subexpression elimination pass by adding
8167 @option{-fno-gcse} to the command line.
8168
8169 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8170
8171 @item -fgcse-lm
8172 @opindex fgcse-lm
8173 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8174 attempts to move loads that are only killed by stores into themselves. This
8175 allows a loop containing a load/store sequence to be changed to a load outside
8176 the loop, and a copy/store within the loop.
8177
8178 Enabled by default when @option{-fgcse} is enabled.
8179
8180 @item -fgcse-sm
8181 @opindex fgcse-sm
8182 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8183 global common subexpression elimination. This pass attempts to move
8184 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8185 loops containing a load/store sequence can be changed to a load before
8186 the loop and a store after the loop.
8187
8188 Not enabled at any optimization level.
8189
8190 @item -fgcse-las
8191 @opindex fgcse-las
8192 When @option{-fgcse-las} is enabled, the global common subexpression
8193 elimination pass eliminates redundant loads that come after stores to the
8194 same memory location (both partial and full redundancies).
8195
8196 Not enabled at any optimization level.
8197
8198 @item -fgcse-after-reload
8199 @opindex fgcse-after-reload
8200 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8201 pass is performed after reload. The purpose of this pass is to clean up
8202 redundant spilling.
8203
8204 @item -faggressive-loop-optimizations
8205 @opindex faggressive-loop-optimizations
8206 This option tells the loop optimizer to use language constraints to
8207 derive bounds for the number of iterations of a loop. This assumes that
8208 loop code does not invoke undefined behavior by for example causing signed
8209 integer overflows or out-of-bound array accesses. The bounds for the
8210 number of iterations of a loop are used to guide loop unrolling and peeling
8211 and loop exit test optimizations.
8212 This option is enabled by default.
8213
8214 @item -funsafe-loop-optimizations
8215 @opindex funsafe-loop-optimizations
8216 This option tells the loop optimizer to assume that loop indices do not
8217 overflow, and that loops with nontrivial exit condition are not
8218 infinite. This enables a wider range of loop optimizations even if
8219 the loop optimizer itself cannot prove that these assumptions are valid.
8220 If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you
8221 if it finds this kind of loop.
8222
8223 @item -fcrossjumping
8224 @opindex fcrossjumping
8225 Perform cross-jumping transformation.
8226 This transformation unifies equivalent code and saves code size. The
8227 resulting code may or may not perform better than without cross-jumping.
8228
8229 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8230
8231 @item -fauto-inc-dec
8232 @opindex fauto-inc-dec
8233 Combine increments or decrements of addresses with memory accesses.
8234 This pass is always skipped on architectures that do not have
8235 instructions to support this. Enabled by default at @option{-O} and
8236 higher on architectures that support this.
8237
8238 @item -fdce
8239 @opindex fdce
8240 Perform dead code elimination (DCE) on RTL@.
8241 Enabled by default at @option{-O} and higher.
8242
8243 @item -fdse
8244 @opindex fdse
8245 Perform dead store elimination (DSE) on RTL@.
8246 Enabled by default at @option{-O} and higher.
8247
8248 @item -fif-conversion
8249 @opindex fif-conversion
8250 Attempt to transform conditional jumps into branch-less equivalents. This
8251 includes use of conditional moves, min, max, set flags and abs instructions, and
8252 some tricks doable by standard arithmetics. The use of conditional execution
8253 on chips where it is available is controlled by @option{-fif-conversion2}.
8254
8255 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8256
8257 @item -fif-conversion2
8258 @opindex fif-conversion2
8259 Use conditional execution (where available) to transform conditional jumps into
8260 branch-less equivalents.
8261
8262 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8263
8264 @item -fdeclone-ctor-dtor
8265 @opindex fdeclone-ctor-dtor
8266 The C++ ABI requires multiple entry points for constructors and
8267 destructors: one for a base subobject, one for a complete object, and
8268 one for a virtual destructor that calls operator delete afterwards.
8269 For a hierarchy with virtual bases, the base and complete variants are
8270 clones, which means two copies of the function. With this option, the
8271 base and complete variants are changed to be thunks that call a common
8272 implementation.
8273
8274 Enabled by @option{-Os}.
8275
8276 @item -fdelete-null-pointer-checks
8277 @opindex fdelete-null-pointer-checks
8278 Assume that programs cannot safely dereference null pointers, and that
8279 no code or data element resides at address zero.
8280 This option enables simple constant
8281 folding optimizations at all optimization levels. In addition, other
8282 optimization passes in GCC use this flag to control global dataflow
8283 analyses that eliminate useless checks for null pointers; these assume
8284 that a memory access to address zero always results in a trap, so
8285 that if a pointer is checked after it has already been dereferenced,
8286 it cannot be null.
8287
8288 Note however that in some environments this assumption is not true.
8289 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8290 for programs that depend on that behavior.
8291
8292 This option is enabled by default on most targets. On Nios II ELF, it
8293 defaults to off. On AVR and CR16, this option is completely disabled.
8294
8295 Passes that use the dataflow information
8296 are enabled independently at different optimization levels.
8297
8298 @item -fdevirtualize
8299 @opindex fdevirtualize
8300 Attempt to convert calls to virtual functions to direct calls. This
8301 is done both within a procedure and interprocedurally as part of
8302 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8303 propagation (@option{-fipa-cp}).
8304 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8305
8306 @item -fdevirtualize-speculatively
8307 @opindex fdevirtualize-speculatively
8308 Attempt to convert calls to virtual functions to speculative direct calls.
8309 Based on the analysis of the type inheritance graph, determine for a given call
8310 the set of likely targets. If the set is small, preferably of size 1, change
8311 the call into a conditional deciding between direct and indirect calls. The
8312 speculative calls enable more optimizations, such as inlining. When they seem
8313 useless after further optimization, they are converted back into original form.
8314
8315 @item -fdevirtualize-at-ltrans
8316 @opindex fdevirtualize-at-ltrans
8317 Stream extra information needed for aggressive devirtualization when running
8318 the link-time optimizer in local transformation mode.
8319 This option enables more devirtualization but
8320 significantly increases the size of streamed data. For this reason it is
8321 disabled by default.
8322
8323 @item -fexpensive-optimizations
8324 @opindex fexpensive-optimizations
8325 Perform a number of minor optimizations that are relatively expensive.
8326
8327 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8328
8329 @item -free
8330 @opindex free
8331 Attempt to remove redundant extension instructions. This is especially
8332 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8333 registers after writing to their lower 32-bit half.
8334
8335 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8336 @option{-O3}, @option{-Os}.
8337
8338 @item -fno-lifetime-dse
8339 @opindex fno-lifetime-dse
8340 In C++ the value of an object is only affected by changes within its
8341 lifetime: when the constructor begins, the object has an indeterminate
8342 value, and any changes during the lifetime of the object are dead when
8343 the object is destroyed. Normally dead store elimination will take
8344 advantage of this; if your code relies on the value of the object
8345 storage persisting beyond the lifetime of the object, you can use this
8346 flag to disable this optimization.
8347
8348 @item -flive-range-shrinkage
8349 @opindex flive-range-shrinkage
8350 Attempt to decrease register pressure through register live range
8351 shrinkage. This is helpful for fast processors with small or moderate
8352 size register sets.
8353
8354 @item -fira-algorithm=@var{algorithm}
8355 @opindex fira-algorithm
8356 Use the specified coloring algorithm for the integrated register
8357 allocator. The @var{algorithm} argument can be @samp{priority}, which
8358 specifies Chow's priority coloring, or @samp{CB}, which specifies
8359 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8360 for all architectures, but for those targets that do support it, it is
8361 the default because it generates better code.
8362
8363 @item -fira-region=@var{region}
8364 @opindex fira-region
8365 Use specified regions for the integrated register allocator. The
8366 @var{region} argument should be one of the following:
8367
8368 @table @samp
8369
8370 @item all
8371 Use all loops as register allocation regions.
8372 This can give the best results for machines with a small and/or
8373 irregular register set.
8374
8375 @item mixed
8376 Use all loops except for loops with small register pressure
8377 as the regions. This value usually gives
8378 the best results in most cases and for most architectures,
8379 and is enabled by default when compiling with optimization for speed
8380 (@option{-O}, @option{-O2}, @dots{}).
8381
8382 @item one
8383 Use all functions as a single region.
8384 This typically results in the smallest code size, and is enabled by default for
8385 @option{-Os} or @option{-O0}.
8386
8387 @end table
8388
8389 @item -fira-hoist-pressure
8390 @opindex fira-hoist-pressure
8391 Use IRA to evaluate register pressure in the code hoisting pass for
8392 decisions to hoist expressions. This option usually results in smaller
8393 code, but it can slow the compiler down.
8394
8395 This option is enabled at level @option{-Os} for all targets.
8396
8397 @item -fira-loop-pressure
8398 @opindex fira-loop-pressure
8399 Use IRA to evaluate register pressure in loops for decisions to move
8400 loop invariants. This option usually results in generation
8401 of faster and smaller code on machines with large register files (>= 32
8402 registers), but it can slow the compiler down.
8403
8404 This option is enabled at level @option{-O3} for some targets.
8405
8406 @item -fno-ira-share-save-slots
8407 @opindex fno-ira-share-save-slots
8408 Disable sharing of stack slots used for saving call-used hard
8409 registers living through a call. Each hard register gets a
8410 separate stack slot, and as a result function stack frames are
8411 larger.
8412
8413 @item -fno-ira-share-spill-slots
8414 @opindex fno-ira-share-spill-slots
8415 Disable sharing of stack slots allocated for pseudo-registers. Each
8416 pseudo-register that does not get a hard register gets a separate
8417 stack slot, and as a result function stack frames are larger.
8418
8419 @item -fira-verbose=@var{n}
8420 @opindex fira-verbose
8421 Control the verbosity of the dump file for the integrated register allocator.
8422 The default value is 5. If the value @var{n} is greater or equal to 10,
8423 the dump output is sent to stderr using the same format as @var{n} minus 10.
8424
8425 @item -flra-remat
8426 @opindex flra-remat
8427 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8428 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8429 values if it is profitable.
8430
8431 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8432
8433 @item -fdelayed-branch
8434 @opindex fdelayed-branch
8435 If supported for the target machine, attempt to reorder instructions
8436 to exploit instruction slots available after delayed branch
8437 instructions.
8438
8439 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8440
8441 @item -fschedule-insns
8442 @opindex fschedule-insns
8443 If supported for the target machine, attempt to reorder instructions to
8444 eliminate execution stalls due to required data being unavailable. This
8445 helps machines that have slow floating point or memory load instructions
8446 by allowing other instructions to be issued until the result of the load
8447 or floating-point instruction is required.
8448
8449 Enabled at levels @option{-O2}, @option{-O3}.
8450
8451 @item -fschedule-insns2
8452 @opindex fschedule-insns2
8453 Similar to @option{-fschedule-insns}, but requests an additional pass of
8454 instruction scheduling after register allocation has been done. This is
8455 especially useful on machines with a relatively small number of
8456 registers and where memory load instructions take more than one cycle.
8457
8458 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8459
8460 @item -fno-sched-interblock
8461 @opindex fno-sched-interblock
8462 Don't schedule instructions across basic blocks. This is normally
8463 enabled by default when scheduling before register allocation, i.e.@:
8464 with @option{-fschedule-insns} or at @option{-O2} or higher.
8465
8466 @item -fno-sched-spec
8467 @opindex fno-sched-spec
8468 Don't allow speculative motion of non-load instructions. This is normally
8469 enabled by default when scheduling before register allocation, i.e.@:
8470 with @option{-fschedule-insns} or at @option{-O2} or higher.
8471
8472 @item -fsched-pressure
8473 @opindex fsched-pressure
8474 Enable register pressure sensitive insn scheduling before register
8475 allocation. This only makes sense when scheduling before register
8476 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8477 @option{-O2} or higher. Usage of this option can improve the
8478 generated code and decrease its size by preventing register pressure
8479 increase above the number of available hard registers and subsequent
8480 spills in register allocation.
8481
8482 @item -fsched-spec-load
8483 @opindex fsched-spec-load
8484 Allow speculative motion of some load instructions. This only makes
8485 sense when scheduling before register allocation, i.e.@: with
8486 @option{-fschedule-insns} or at @option{-O2} or higher.
8487
8488 @item -fsched-spec-load-dangerous
8489 @opindex fsched-spec-load-dangerous
8490 Allow speculative motion of more load instructions. This only makes
8491 sense when scheduling before register allocation, i.e.@: with
8492 @option{-fschedule-insns} or at @option{-O2} or higher.
8493
8494 @item -fsched-stalled-insns
8495 @itemx -fsched-stalled-insns=@var{n}
8496 @opindex fsched-stalled-insns
8497 Define how many insns (if any) can be moved prematurely from the queue
8498 of stalled insns into the ready list during the second scheduling pass.
8499 @option{-fno-sched-stalled-insns} means that no insns are moved
8500 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8501 on how many queued insns can be moved prematurely.
8502 @option{-fsched-stalled-insns} without a value is equivalent to
8503 @option{-fsched-stalled-insns=1}.
8504
8505 @item -fsched-stalled-insns-dep
8506 @itemx -fsched-stalled-insns-dep=@var{n}
8507 @opindex fsched-stalled-insns-dep
8508 Define how many insn groups (cycles) are examined for a dependency
8509 on a stalled insn that is a candidate for premature removal from the queue
8510 of stalled insns. This has an effect only during the second scheduling pass,
8511 and only if @option{-fsched-stalled-insns} is used.
8512 @option{-fno-sched-stalled-insns-dep} is equivalent to
8513 @option{-fsched-stalled-insns-dep=0}.
8514 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8515 @option{-fsched-stalled-insns-dep=1}.
8516
8517 @item -fsched2-use-superblocks
8518 @opindex fsched2-use-superblocks
8519 When scheduling after register allocation, use superblock scheduling.
8520 This allows motion across basic block boundaries,
8521 resulting in faster schedules. This option is experimental, as not all machine
8522 descriptions used by GCC model the CPU closely enough to avoid unreliable
8523 results from the algorithm.
8524
8525 This only makes sense when scheduling after register allocation, i.e.@: with
8526 @option{-fschedule-insns2} or at @option{-O2} or higher.
8527
8528 @item -fsched-group-heuristic
8529 @opindex fsched-group-heuristic
8530 Enable the group heuristic in the scheduler. This heuristic favors
8531 the instruction that belongs to a schedule group. This is enabled
8532 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8533 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8534
8535 @item -fsched-critical-path-heuristic
8536 @opindex fsched-critical-path-heuristic
8537 Enable the critical-path heuristic in the scheduler. This heuristic favors
8538 instructions on the critical path. This is enabled by default when
8539 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8540 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8541
8542 @item -fsched-spec-insn-heuristic
8543 @opindex fsched-spec-insn-heuristic
8544 Enable the speculative instruction heuristic in the scheduler. This
8545 heuristic favors speculative instructions with greater dependency weakness.
8546 This is enabled by default when scheduling is enabled, i.e.@:
8547 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8548 or at @option{-O2} or higher.
8549
8550 @item -fsched-rank-heuristic
8551 @opindex fsched-rank-heuristic
8552 Enable the rank heuristic in the scheduler. This heuristic favors
8553 the instruction belonging to a basic block with greater size or frequency.
8554 This is enabled by default when scheduling is enabled, i.e.@:
8555 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8556 at @option{-O2} or higher.
8557
8558 @item -fsched-last-insn-heuristic
8559 @opindex fsched-last-insn-heuristic
8560 Enable the last-instruction heuristic in the scheduler. This heuristic
8561 favors the instruction that is less dependent on the last instruction
8562 scheduled. This is enabled by default when scheduling is enabled,
8563 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8564 at @option{-O2} or higher.
8565
8566 @item -fsched-dep-count-heuristic
8567 @opindex fsched-dep-count-heuristic
8568 Enable the dependent-count heuristic in the scheduler. This heuristic
8569 favors the instruction that has more instructions depending on it.
8570 This is enabled by default when scheduling is enabled, i.e.@:
8571 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8572 at @option{-O2} or higher.
8573
8574 @item -freschedule-modulo-scheduled-loops
8575 @opindex freschedule-modulo-scheduled-loops
8576 Modulo scheduling is performed before traditional scheduling. If a loop
8577 is modulo scheduled, later scheduling passes may change its schedule.
8578 Use this option to control that behavior.
8579
8580 @item -fselective-scheduling
8581 @opindex fselective-scheduling
8582 Schedule instructions using selective scheduling algorithm. Selective
8583 scheduling runs instead of the first scheduler pass.
8584
8585 @item -fselective-scheduling2
8586 @opindex fselective-scheduling2
8587 Schedule instructions using selective scheduling algorithm. Selective
8588 scheduling runs instead of the second scheduler pass.
8589
8590 @item -fsel-sched-pipelining
8591 @opindex fsel-sched-pipelining
8592 Enable software pipelining of innermost loops during selective scheduling.
8593 This option has no effect unless one of @option{-fselective-scheduling} or
8594 @option{-fselective-scheduling2} is turned on.
8595
8596 @item -fsel-sched-pipelining-outer-loops
8597 @opindex fsel-sched-pipelining-outer-loops
8598 When pipelining loops during selective scheduling, also pipeline outer loops.
8599 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8600
8601 @item -fsemantic-interposition
8602 @opindex fsemantic-interposition
8603 Some object formats, like ELF, allow interposing of symbols by the
8604 dynamic linker.
8605 This means that for symbols exported from the DSO, the compiler cannot perform
8606 interprocedural propagation, inlining and other optimizations in anticipation
8607 that the function or variable in question may change. While this feature is
8608 useful, for example, to rewrite memory allocation functions by a debugging
8609 implementation, it is expensive in the terms of code quality.
8610 With @option{-fno-semantic-interposition} the compiler assumes that
8611 if interposition happens for functions the overwriting function will have
8612 precisely the same semantics (and side effects).
8613 Similarly if interposition happens
8614 for variables, the constructor of the variable will be the same. The flag
8615 has no effect for functions explicitly declared inline
8616 (where it is never allowed for interposition to change semantics)
8617 and for symbols explicitly declared weak.
8618
8619 @item -fshrink-wrap
8620 @opindex fshrink-wrap
8621 Emit function prologues only before parts of the function that need it,
8622 rather than at the top of the function. This flag is enabled by default at
8623 @option{-O} and higher.
8624
8625 @item -fcaller-saves
8626 @opindex fcaller-saves
8627 Enable allocation of values to registers that are clobbered by
8628 function calls, by emitting extra instructions to save and restore the
8629 registers around such calls. Such allocation is done only when it
8630 seems to result in better code.
8631
8632 This option is always enabled by default on certain machines, usually
8633 those which have no call-preserved registers to use instead.
8634
8635 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8636
8637 @item -fcombine-stack-adjustments
8638 @opindex fcombine-stack-adjustments
8639 Tracks stack adjustments (pushes and pops) and stack memory references
8640 and then tries to find ways to combine them.
8641
8642 Enabled by default at @option{-O1} and higher.
8643
8644 @item -fipa-ra
8645 @opindex fipa-ra
8646 Use caller save registers for allocation if those registers are not used by
8647 any called function. In that case it is not necessary to save and restore
8648 them around calls. This is only possible if called functions are part of
8649 same compilation unit as current function and they are compiled before it.
8650
8651 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8652
8653 @item -fconserve-stack
8654 @opindex fconserve-stack
8655 Attempt to minimize stack usage. The compiler attempts to use less
8656 stack space, even if that makes the program slower. This option
8657 implies setting the @option{large-stack-frame} parameter to 100
8658 and the @option{large-stack-frame-growth} parameter to 400.
8659
8660 @item -ftree-reassoc
8661 @opindex ftree-reassoc
8662 Perform reassociation on trees. This flag is enabled by default
8663 at @option{-O} and higher.
8664
8665 @item -ftree-pre
8666 @opindex ftree-pre
8667 Perform partial redundancy elimination (PRE) on trees. This flag is
8668 enabled by default at @option{-O2} and @option{-O3}.
8669
8670 @item -ftree-partial-pre
8671 @opindex ftree-partial-pre
8672 Make partial redundancy elimination (PRE) more aggressive. This flag is
8673 enabled by default at @option{-O3}.
8674
8675 @item -ftree-forwprop
8676 @opindex ftree-forwprop
8677 Perform forward propagation on trees. This flag is enabled by default
8678 at @option{-O} and higher.
8679
8680 @item -ftree-fre
8681 @opindex ftree-fre
8682 Perform full redundancy elimination (FRE) on trees. The difference
8683 between FRE and PRE is that FRE only considers expressions
8684 that are computed on all paths leading to the redundant computation.
8685 This analysis is faster than PRE, though it exposes fewer redundancies.
8686 This flag is enabled by default at @option{-O} and higher.
8687
8688 @item -ftree-phiprop
8689 @opindex ftree-phiprop
8690 Perform hoisting of loads from conditional pointers on trees. This
8691 pass is enabled by default at @option{-O} and higher.
8692
8693 @item -fhoist-adjacent-loads
8694 @opindex fhoist-adjacent-loads
8695 Speculatively hoist loads from both branches of an if-then-else if the
8696 loads are from adjacent locations in the same structure and the target
8697 architecture has a conditional move instruction. This flag is enabled
8698 by default at @option{-O2} and higher.
8699
8700 @item -ftree-copy-prop
8701 @opindex ftree-copy-prop
8702 Perform copy propagation on trees. This pass eliminates unnecessary
8703 copy operations. This flag is enabled by default at @option{-O} and
8704 higher.
8705
8706 @item -fipa-pure-const
8707 @opindex fipa-pure-const
8708 Discover which functions are pure or constant.
8709 Enabled by default at @option{-O} and higher.
8710
8711 @item -fipa-reference
8712 @opindex fipa-reference
8713 Discover which static variables do not escape the
8714 compilation unit.
8715 Enabled by default at @option{-O} and higher.
8716
8717 @item -fipa-pta
8718 @opindex fipa-pta
8719 Perform interprocedural pointer analysis and interprocedural modification
8720 and reference analysis. This option can cause excessive memory and
8721 compile-time usage on large compilation units. It is not enabled by
8722 default at any optimization level.
8723
8724 @item -fipa-profile
8725 @opindex fipa-profile
8726 Perform interprocedural profile propagation. The functions called only from
8727 cold functions are marked as cold. Also functions executed once (such as
8728 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8729 functions and loop less parts of functions executed once are then optimized for
8730 size.
8731 Enabled by default at @option{-O} and higher.
8732
8733 @item -fipa-cp
8734 @opindex fipa-cp
8735 Perform interprocedural constant propagation.
8736 This optimization analyzes the program to determine when values passed
8737 to functions are constants and then optimizes accordingly.
8738 This optimization can substantially increase performance
8739 if the application has constants passed to functions.
8740 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8741
8742 @item -fipa-cp-clone
8743 @opindex fipa-cp-clone
8744 Perform function cloning to make interprocedural constant propagation stronger.
8745 When enabled, interprocedural constant propagation performs function cloning
8746 when externally visible function can be called with constant arguments.
8747 Because this optimization can create multiple copies of functions,
8748 it may significantly increase code size
8749 (see @option{--param ipcp-unit-growth=@var{value}}).
8750 This flag is enabled by default at @option{-O3}.
8751
8752 @item -fipa-cp-alignment
8753 @opindex -fipa-cp-alignment
8754 When enabled, this optimization propagates alignment of function
8755 parameters to support better vectorization and string operations.
8756
8757 This flag is enabled by default at @option{-O2} and @option{-Os}. It
8758 requires that @option{-fipa-cp} is enabled.
8759
8760 @item -fipa-icf
8761 @opindex fipa-icf
8762 Perform Identical Code Folding for functions and read-only variables.
8763 The optimization reduces code size and may disturb unwind stacks by replacing
8764 a function by equivalent one with a different name. The optimization works
8765 more effectively with link time optimization enabled.
8766
8767 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8768 works on different levels and thus the optimizations are not same - there are
8769 equivalences that are found only by GCC and equivalences found only by Gold.
8770
8771 This flag is enabled by default at @option{-O2} and @option{-Os}.
8772
8773 @item -fisolate-erroneous-paths-dereference
8774 @opindex fisolate-erroneous-paths-dereference
8775 Detect paths that trigger erroneous or undefined behavior due to
8776 dereferencing a null pointer. Isolate those paths from the main control
8777 flow and turn the statement with erroneous or undefined behavior into a trap.
8778 This flag is enabled by default at @option{-O2} and higher and depends on
8779 @option{-fdelete-null-pointer-checks} also being enabled.
8780
8781 @item -fisolate-erroneous-paths-attribute
8782 @opindex fisolate-erroneous-paths-attribute
8783 Detect paths that trigger erroneous or undefined behavior due a null value
8784 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8785 attribute. Isolate those paths from the main control flow and turn the
8786 statement with erroneous or undefined behavior into a trap. This is not
8787 currently enabled, but may be enabled by @option{-O2} in the future.
8788
8789 @item -ftree-sink
8790 @opindex ftree-sink
8791 Perform forward store motion on trees. This flag is
8792 enabled by default at @option{-O} and higher.
8793
8794 @item -ftree-bit-ccp
8795 @opindex ftree-bit-ccp
8796 Perform sparse conditional bit constant propagation on trees and propagate
8797 pointer alignment information.
8798 This pass only operates on local scalar variables and is enabled by default
8799 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8800
8801 @item -ftree-ccp
8802 @opindex ftree-ccp
8803 Perform sparse conditional constant propagation (CCP) on trees. This
8804 pass only operates on local scalar variables and is enabled by default
8805 at @option{-O} and higher.
8806
8807 @item -fssa-backprop
8808 @opindex fssa-backprop
8809 Propagate information about uses of a value up the definition chain
8810 in order to simplify the definitions. For example, this pass strips
8811 sign operations if the sign of a value never matters. The flag is
8812 enabled by default at @option{-O} and higher.
8813
8814 @item -fssa-phiopt
8815 @opindex fssa-phiopt
8816 Perform pattern matching on SSA PHI nodes to optimize conditional
8817 code. This pass is enabled by default at @option{-O} and higher.
8818
8819 @item -ftree-switch-conversion
8820 @opindex ftree-switch-conversion
8821 Perform conversion of simple initializations in a switch to
8822 initializations from a scalar array. This flag is enabled by default
8823 at @option{-O2} and higher.
8824
8825 @item -ftree-tail-merge
8826 @opindex ftree-tail-merge
8827 Look for identical code sequences. When found, replace one with a jump to the
8828 other. This optimization is known as tail merging or cross jumping. This flag
8829 is enabled by default at @option{-O2} and higher. The compilation time
8830 in this pass can
8831 be limited using @option{max-tail-merge-comparisons} parameter and
8832 @option{max-tail-merge-iterations} parameter.
8833
8834 @item -ftree-dce
8835 @opindex ftree-dce
8836 Perform dead code elimination (DCE) on trees. This flag is enabled by
8837 default at @option{-O} and higher.
8838
8839 @item -ftree-builtin-call-dce
8840 @opindex ftree-builtin-call-dce
8841 Perform conditional dead code elimination (DCE) for calls to built-in functions
8842 that may set @code{errno} but are otherwise side-effect free. This flag is
8843 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8844 specified.
8845
8846 @item -ftree-dominator-opts
8847 @opindex ftree-dominator-opts
8848 Perform a variety of simple scalar cleanups (constant/copy
8849 propagation, redundancy elimination, range propagation and expression
8850 simplification) based on a dominator tree traversal. This also
8851 performs jump threading (to reduce jumps to jumps). This flag is
8852 enabled by default at @option{-O} and higher.
8853
8854 @item -ftree-dse
8855 @opindex ftree-dse
8856 Perform dead store elimination (DSE) on trees. A dead store is a store into
8857 a memory location that is later overwritten by another store without
8858 any intervening loads. In this case the earlier store can be deleted. This
8859 flag is enabled by default at @option{-O} and higher.
8860
8861 @item -ftree-ch
8862 @opindex ftree-ch
8863 Perform loop header copying on trees. This is beneficial since it increases
8864 effectiveness of code motion optimizations. It also saves one jump. This flag
8865 is enabled by default at @option{-O} and higher. It is not enabled
8866 for @option{-Os}, since it usually increases code size.
8867
8868 @item -ftree-loop-optimize
8869 @opindex ftree-loop-optimize
8870 Perform loop optimizations on trees. This flag is enabled by default
8871 at @option{-O} and higher.
8872
8873 @item -ftree-loop-linear
8874 @itemx -floop-interchange
8875 @itemx -floop-strip-mine
8876 @itemx -floop-block
8877 @itemx -floop-unroll-and-jam
8878 @opindex ftree-loop-linear
8879 @opindex floop-interchange
8880 @opindex floop-strip-mine
8881 @opindex floop-block
8882 @opindex floop-unroll-and-jam
8883 Perform loop nest optimizations. Same as
8884 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8885 to be configured with @option{--with-isl} to enable the Graphite loop
8886 transformation infrastructure.
8887
8888 @item -fgraphite-identity
8889 @opindex fgraphite-identity
8890 Enable the identity transformation for graphite. For every SCoP we generate
8891 the polyhedral representation and transform it back to gimple. Using
8892 @option{-fgraphite-identity} we can check the costs or benefits of the
8893 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8894 are also performed by the code generator ISL, like index splitting and
8895 dead code elimination in loops.
8896
8897 @item -floop-nest-optimize
8898 @opindex floop-nest-optimize
8899 Enable the ISL based loop nest optimizer. This is a generic loop nest
8900 optimizer based on the Pluto optimization algorithms. It calculates a loop
8901 structure optimized for data-locality and parallelism. This option
8902 is experimental.
8903
8904 @item -floop-parallelize-all
8905 @opindex floop-parallelize-all
8906 Use the Graphite data dependence analysis to identify loops that can
8907 be parallelized. Parallelize all the loops that can be analyzed to
8908 not contain loop carried dependences without checking that it is
8909 profitable to parallelize the loops.
8910
8911 @item -ftree-coalesce-vars
8912 @opindex ftree-coalesce-vars
8913 While transforming the program out of the SSA representation, attempt to
8914 reduce copying by coalescing versions of different user-defined
8915 variables, instead of just compiler temporaries. This may severely
8916 limit the ability to debug an optimized program compiled with
8917 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8918 prevents SSA coalescing of user variables. This option is enabled by
8919 default if optimization is enabled, and it does very little otherwise.
8920
8921 @item -ftree-loop-if-convert
8922 @opindex ftree-loop-if-convert
8923 Attempt to transform conditional jumps in the innermost loops to
8924 branch-less equivalents. The intent is to remove control-flow from
8925 the innermost loops in order to improve the ability of the
8926 vectorization pass to handle these loops. This is enabled by default
8927 if vectorization is enabled.
8928
8929 @item -ftree-loop-if-convert-stores
8930 @opindex ftree-loop-if-convert-stores
8931 Attempt to also if-convert conditional jumps containing memory writes.
8932 This transformation can be unsafe for multi-threaded programs as it
8933 transforms conditional memory writes into unconditional memory writes.
8934 For example,
8935 @smallexample
8936 for (i = 0; i < N; i++)
8937 if (cond)
8938 A[i] = expr;
8939 @end smallexample
8940 is transformed to
8941 @smallexample
8942 for (i = 0; i < N; i++)
8943 A[i] = cond ? expr : A[i];
8944 @end smallexample
8945 potentially producing data races.
8946
8947 @item -ftree-loop-distribution
8948 @opindex ftree-loop-distribution
8949 Perform loop distribution. This flag can improve cache performance on
8950 big loop bodies and allow further loop optimizations, like
8951 parallelization or vectorization, to take place. For example, the loop
8952 @smallexample
8953 DO I = 1, N
8954 A(I) = B(I) + C
8955 D(I) = E(I) * F
8956 ENDDO
8957 @end smallexample
8958 is transformed to
8959 @smallexample
8960 DO I = 1, N
8961 A(I) = B(I) + C
8962 ENDDO
8963 DO I = 1, N
8964 D(I) = E(I) * F
8965 ENDDO
8966 @end smallexample
8967
8968 @item -ftree-loop-distribute-patterns
8969 @opindex ftree-loop-distribute-patterns
8970 Perform loop distribution of patterns that can be code generated with
8971 calls to a library. This flag is enabled by default at @option{-O3}.
8972
8973 This pass distributes the initialization loops and generates a call to
8974 memset zero. For example, the loop
8975 @smallexample
8976 DO I = 1, N
8977 A(I) = 0
8978 B(I) = A(I) + I
8979 ENDDO
8980 @end smallexample
8981 is transformed to
8982 @smallexample
8983 DO I = 1, N
8984 A(I) = 0
8985 ENDDO
8986 DO I = 1, N
8987 B(I) = A(I) + I
8988 ENDDO
8989 @end smallexample
8990 and the initialization loop is transformed into a call to memset zero.
8991
8992 @item -ftree-loop-im
8993 @opindex ftree-loop-im
8994 Perform loop invariant motion on trees. This pass moves only invariants that
8995 are hard to handle at RTL level (function calls, operations that expand to
8996 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8997 operands of conditions that are invariant out of the loop, so that we can use
8998 just trivial invariantness analysis in loop unswitching. The pass also includes
8999 store motion.
9000
9001 @item -ftree-loop-ivcanon
9002 @opindex ftree-loop-ivcanon
9003 Create a canonical counter for number of iterations in loops for which
9004 determining number of iterations requires complicated analysis. Later
9005 optimizations then may determine the number easily. Useful especially
9006 in connection with unrolling.
9007
9008 @item -fivopts
9009 @opindex fivopts
9010 Perform induction variable optimizations (strength reduction, induction
9011 variable merging and induction variable elimination) on trees.
9012
9013 @item -ftree-parallelize-loops=n
9014 @opindex ftree-parallelize-loops
9015 Parallelize loops, i.e., split their iteration space to run in n threads.
9016 This is only possible for loops whose iterations are independent
9017 and can be arbitrarily reordered. The optimization is only
9018 profitable on multiprocessor machines, for loops that are CPU-intensive,
9019 rather than constrained e.g.@: by memory bandwidth. This option
9020 implies @option{-pthread}, and thus is only supported on targets
9021 that have support for @option{-pthread}.
9022
9023 @item -ftree-pta
9024 @opindex ftree-pta
9025 Perform function-local points-to analysis on trees. This flag is
9026 enabled by default at @option{-O} and higher.
9027
9028 @item -ftree-sra
9029 @opindex ftree-sra
9030 Perform scalar replacement of aggregates. This pass replaces structure
9031 references with scalars to prevent committing structures to memory too
9032 early. This flag is enabled by default at @option{-O} and higher.
9033
9034 @item -ftree-ter
9035 @opindex ftree-ter
9036 Perform temporary expression replacement during the SSA->normal phase. Single
9037 use/single def temporaries are replaced at their use location with their
9038 defining expression. This results in non-GIMPLE code, but gives the expanders
9039 much more complex trees to work on resulting in better RTL generation. This is
9040 enabled by default at @option{-O} and higher.
9041
9042 @item -ftree-slsr
9043 @opindex ftree-slsr
9044 Perform straight-line strength reduction on trees. This recognizes related
9045 expressions involving multiplications and replaces them by less expensive
9046 calculations when possible. This is enabled by default at @option{-O} and
9047 higher.
9048
9049 @item -ftree-vectorize
9050 @opindex ftree-vectorize
9051 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9052 and @option{-ftree-slp-vectorize} if not explicitly specified.
9053
9054 @item -ftree-loop-vectorize
9055 @opindex ftree-loop-vectorize
9056 Perform loop vectorization on trees. This flag is enabled by default at
9057 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9058
9059 @item -ftree-slp-vectorize
9060 @opindex ftree-slp-vectorize
9061 Perform basic block vectorization on trees. This flag is enabled by default at
9062 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9063
9064 @item -fvect-cost-model=@var{model}
9065 @opindex fvect-cost-model
9066 Alter the cost model used for vectorization. The @var{model} argument
9067 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9068 With the @samp{unlimited} model the vectorized code-path is assumed
9069 to be profitable while with the @samp{dynamic} model a runtime check
9070 guards the vectorized code-path to enable it only for iteration
9071 counts that will likely execute faster than when executing the original
9072 scalar loop. The @samp{cheap} model disables vectorization of
9073 loops where doing so would be cost prohibitive for example due to
9074 required runtime checks for data dependence or alignment but otherwise
9075 is equal to the @samp{dynamic} model.
9076 The default cost model depends on other optimization flags and is
9077 either @samp{dynamic} or @samp{cheap}.
9078
9079 @item -fsimd-cost-model=@var{model}
9080 @opindex fsimd-cost-model
9081 Alter the cost model used for vectorization of loops marked with the OpenMP
9082 or Cilk Plus simd directive. The @var{model} argument should be one of
9083 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9084 have the same meaning as described in @option{-fvect-cost-model} and by
9085 default a cost model defined with @option{-fvect-cost-model} is used.
9086
9087 @item -ftree-vrp
9088 @opindex ftree-vrp
9089 Perform Value Range Propagation on trees. This is similar to the
9090 constant propagation pass, but instead of values, ranges of values are
9091 propagated. This allows the optimizers to remove unnecessary range
9092 checks like array bound checks and null pointer checks. This is
9093 enabled by default at @option{-O2} and higher. Null pointer check
9094 elimination is only done if @option{-fdelete-null-pointer-checks} is
9095 enabled.
9096
9097 @item -fsplit-ivs-in-unroller
9098 @opindex fsplit-ivs-in-unroller
9099 Enables expression of values of induction variables in later iterations
9100 of the unrolled loop using the value in the first iteration. This breaks
9101 long dependency chains, thus improving efficiency of the scheduling passes.
9102
9103 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9104 same effect. However, that is not reliable in cases where the loop body
9105 is more complicated than a single basic block. It also does not work at all
9106 on some architectures due to restrictions in the CSE pass.
9107
9108 This optimization is enabled by default.
9109
9110 @item -fvariable-expansion-in-unroller
9111 @opindex fvariable-expansion-in-unroller
9112 With this option, the compiler creates multiple copies of some
9113 local variables when unrolling a loop, which can result in superior code.
9114
9115 @item -fpartial-inlining
9116 @opindex fpartial-inlining
9117 Inline parts of functions. This option has any effect only
9118 when inlining itself is turned on by the @option{-finline-functions}
9119 or @option{-finline-small-functions} options.
9120
9121 Enabled at level @option{-O2}.
9122
9123 @item -fpredictive-commoning
9124 @opindex fpredictive-commoning
9125 Perform predictive commoning optimization, i.e., reusing computations
9126 (especially memory loads and stores) performed in previous
9127 iterations of loops.
9128
9129 This option is enabled at level @option{-O3}.
9130
9131 @item -fprefetch-loop-arrays
9132 @opindex fprefetch-loop-arrays
9133 If supported by the target machine, generate instructions to prefetch
9134 memory to improve the performance of loops that access large arrays.
9135
9136 This option may generate better or worse code; results are highly
9137 dependent on the structure of loops within the source code.
9138
9139 Disabled at level @option{-Os}.
9140
9141 @item -fno-peephole
9142 @itemx -fno-peephole2
9143 @opindex fno-peephole
9144 @opindex fno-peephole2
9145 Disable any machine-specific peephole optimizations. The difference
9146 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9147 are implemented in the compiler; some targets use one, some use the
9148 other, a few use both.
9149
9150 @option{-fpeephole} is enabled by default.
9151 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9152
9153 @item -fno-guess-branch-probability
9154 @opindex fno-guess-branch-probability
9155 Do not guess branch probabilities using heuristics.
9156
9157 GCC uses heuristics to guess branch probabilities if they are
9158 not provided by profiling feedback (@option{-fprofile-arcs}). These
9159 heuristics are based on the control flow graph. If some branch probabilities
9160 are specified by @code{__builtin_expect}, then the heuristics are
9161 used to guess branch probabilities for the rest of the control flow graph,
9162 taking the @code{__builtin_expect} info into account. The interactions
9163 between the heuristics and @code{__builtin_expect} can be complex, and in
9164 some cases, it may be useful to disable the heuristics so that the effects
9165 of @code{__builtin_expect} are easier to understand.
9166
9167 The default is @option{-fguess-branch-probability} at levels
9168 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9169
9170 @item -freorder-blocks
9171 @opindex freorder-blocks
9172 Reorder basic blocks in the compiled function in order to reduce number of
9173 taken branches and improve code locality.
9174
9175 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9176
9177 @item -freorder-blocks-algorithm=@var{algorithm}
9178 @opindex freorder-blocks-algorithm
9179 Use the specified algorithm for basic block reordering. The
9180 @var{algorithm} argument can be @samp{simple}, which does not increase
9181 code size (except sometimes due to secondary effects like alignment),
9182 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9183 put all often executed code together, minimizing the number of branches
9184 executed by making extra copies of code.
9185
9186 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9187 @samp{stc} at levels @option{-O2}, @option{-O3}.
9188
9189 @item -freorder-blocks-and-partition
9190 @opindex freorder-blocks-and-partition
9191 In addition to reordering basic blocks in the compiled function, in order
9192 to reduce number of taken branches, partitions hot and cold basic blocks
9193 into separate sections of the assembly and .o files, to improve
9194 paging and cache locality performance.
9195
9196 This optimization is automatically turned off in the presence of
9197 exception handling, for linkonce sections, for functions with a user-defined
9198 section attribute and on any architecture that does not support named
9199 sections.
9200
9201 Enabled for x86 at levels @option{-O2}, @option{-O3}.
9202
9203 @item -freorder-functions
9204 @opindex freorder-functions
9205 Reorder functions in the object file in order to
9206 improve code locality. This is implemented by using special
9207 subsections @code{.text.hot} for most frequently executed functions and
9208 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9209 the linker so object file format must support named sections and linker must
9210 place them in a reasonable way.
9211
9212 Also profile feedback must be available to make this option effective. See
9213 @option{-fprofile-arcs} for details.
9214
9215 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9216
9217 @item -fstrict-aliasing
9218 @opindex fstrict-aliasing
9219 Allow the compiler to assume the strictest aliasing rules applicable to
9220 the language being compiled. For C (and C++), this activates
9221 optimizations based on the type of expressions. In particular, an
9222 object of one type is assumed never to reside at the same address as an
9223 object of a different type, unless the types are almost the same. For
9224 example, an @code{unsigned int} can alias an @code{int}, but not a
9225 @code{void*} or a @code{double}. A character type may alias any other
9226 type.
9227
9228 @anchor{Type-punning}Pay special attention to code like this:
9229 @smallexample
9230 union a_union @{
9231 int i;
9232 double d;
9233 @};
9234
9235 int f() @{
9236 union a_union t;
9237 t.d = 3.0;
9238 return t.i;
9239 @}
9240 @end smallexample
9241 The practice of reading from a different union member than the one most
9242 recently written to (called ``type-punning'') is common. Even with
9243 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9244 is accessed through the union type. So, the code above works as
9245 expected. @xref{Structures unions enumerations and bit-fields
9246 implementation}. However, this code might not:
9247 @smallexample
9248 int f() @{
9249 union a_union t;
9250 int* ip;
9251 t.d = 3.0;
9252 ip = &t.i;
9253 return *ip;
9254 @}
9255 @end smallexample
9256
9257 Similarly, access by taking the address, casting the resulting pointer
9258 and dereferencing the result has undefined behavior, even if the cast
9259 uses a union type, e.g.:
9260 @smallexample
9261 int f() @{
9262 double d = 3.0;
9263 return ((union a_union *) &d)->i;
9264 @}
9265 @end smallexample
9266
9267 The @option{-fstrict-aliasing} option is enabled at levels
9268 @option{-O2}, @option{-O3}, @option{-Os}.
9269
9270 @item -fstrict-overflow
9271 @opindex fstrict-overflow
9272 Allow the compiler to assume strict signed overflow rules, depending
9273 on the language being compiled. For C (and C++) this means that
9274 overflow when doing arithmetic with signed numbers is undefined, which
9275 means that the compiler may assume that it does not happen. This
9276 permits various optimizations. For example, the compiler assumes
9277 that an expression like @code{i + 10 > i} is always true for
9278 signed @code{i}. This assumption is only valid if signed overflow is
9279 undefined, as the expression is false if @code{i + 10} overflows when
9280 using twos complement arithmetic. When this option is in effect any
9281 attempt to determine whether an operation on signed numbers
9282 overflows must be written carefully to not actually involve overflow.
9283
9284 This option also allows the compiler to assume strict pointer
9285 semantics: given a pointer to an object, if adding an offset to that
9286 pointer does not produce a pointer to the same object, the addition is
9287 undefined. This permits the compiler to conclude that @code{p + u >
9288 p} is always true for a pointer @code{p} and unsigned integer
9289 @code{u}. This assumption is only valid because pointer wraparound is
9290 undefined, as the expression is false if @code{p + u} overflows using
9291 twos complement arithmetic.
9292
9293 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
9294 that integer signed overflow is fully defined: it wraps. When
9295 @option{-fwrapv} is used, there is no difference between
9296 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
9297 integers. With @option{-fwrapv} certain types of overflow are
9298 permitted. For example, if the compiler gets an overflow when doing
9299 arithmetic on constants, the overflowed value can still be used with
9300 @option{-fwrapv}, but not otherwise.
9301
9302 The @option{-fstrict-overflow} option is enabled at levels
9303 @option{-O2}, @option{-O3}, @option{-Os}.
9304
9305 @item -falign-functions
9306 @itemx -falign-functions=@var{n}
9307 @opindex falign-functions
9308 Align the start of functions to the next power-of-two greater than
9309 @var{n}, skipping up to @var{n} bytes. For instance,
9310 @option{-falign-functions=32} aligns functions to the next 32-byte
9311 boundary, but @option{-falign-functions=24} aligns to the next
9312 32-byte boundary only if this can be done by skipping 23 bytes or less.
9313
9314 @option{-fno-align-functions} and @option{-falign-functions=1} are
9315 equivalent and mean that functions are not aligned.
9316
9317 Some assemblers only support this flag when @var{n} is a power of two;
9318 in that case, it is rounded up.
9319
9320 If @var{n} is not specified or is zero, use a machine-dependent default.
9321
9322 Enabled at levels @option{-O2}, @option{-O3}.
9323
9324 @item -falign-labels
9325 @itemx -falign-labels=@var{n}
9326 @opindex falign-labels
9327 Align all branch targets to a power-of-two boundary, skipping up to
9328 @var{n} bytes like @option{-falign-functions}. This option can easily
9329 make code slower, because it must insert dummy operations for when the
9330 branch target is reached in the usual flow of the code.
9331
9332 @option{-fno-align-labels} and @option{-falign-labels=1} are
9333 equivalent and mean that labels are not aligned.
9334
9335 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9336 are greater than this value, then their values are used instead.
9337
9338 If @var{n} is not specified or is zero, use a machine-dependent default
9339 which is very likely to be @samp{1}, meaning no alignment.
9340
9341 Enabled at levels @option{-O2}, @option{-O3}.
9342
9343 @item -falign-loops
9344 @itemx -falign-loops=@var{n}
9345 @opindex falign-loops
9346 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
9347 like @option{-falign-functions}. If the loops are
9348 executed many times, this makes up for any execution of the dummy
9349 operations.
9350
9351 @option{-fno-align-loops} and @option{-falign-loops=1} are
9352 equivalent and mean that loops are not aligned.
9353
9354 If @var{n} is not specified or is zero, use a machine-dependent default.
9355
9356 Enabled at levels @option{-O2}, @option{-O3}.
9357
9358 @item -falign-jumps
9359 @itemx -falign-jumps=@var{n}
9360 @opindex falign-jumps
9361 Align branch targets to a power-of-two boundary, for branch targets
9362 where the targets can only be reached by jumping, skipping up to @var{n}
9363 bytes like @option{-falign-functions}. In this case, no dummy operations
9364 need be executed.
9365
9366 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9367 equivalent and mean that loops are not aligned.
9368
9369 If @var{n} is not specified or is zero, use a machine-dependent default.
9370
9371 Enabled at levels @option{-O2}, @option{-O3}.
9372
9373 @item -funit-at-a-time
9374 @opindex funit-at-a-time
9375 This option is left for compatibility reasons. @option{-funit-at-a-time}
9376 has no effect, while @option{-fno-unit-at-a-time} implies
9377 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9378
9379 Enabled by default.
9380
9381 @item -fno-toplevel-reorder
9382 @opindex fno-toplevel-reorder
9383 Do not reorder top-level functions, variables, and @code{asm}
9384 statements. Output them in the same order that they appear in the
9385 input file. When this option is used, unreferenced static variables
9386 are not removed. This option is intended to support existing code
9387 that relies on a particular ordering. For new code, it is better to
9388 use attributes when possible.
9389
9390 Enabled at level @option{-O0}. When disabled explicitly, it also implies
9391 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
9392 targets.
9393
9394 @item -fweb
9395 @opindex fweb
9396 Constructs webs as commonly used for register allocation purposes and assign
9397 each web individual pseudo register. This allows the register allocation pass
9398 to operate on pseudos directly, but also strengthens several other optimization
9399 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9400 however, make debugging impossible, since variables no longer stay in a
9401 ``home register''.
9402
9403 Enabled by default with @option{-funroll-loops}.
9404
9405 @item -fwhole-program
9406 @opindex fwhole-program
9407 Assume that the current compilation unit represents the whole program being
9408 compiled. All public functions and variables with the exception of @code{main}
9409 and those merged by attribute @code{externally_visible} become static functions
9410 and in effect are optimized more aggressively by interprocedural optimizers.
9411
9412 This option should not be used in combination with @option{-flto}.
9413 Instead relying on a linker plugin should provide safer and more precise
9414 information.
9415
9416 @item -flto[=@var{n}]
9417 @opindex flto
9418 This option runs the standard link-time optimizer. When invoked
9419 with source code, it generates GIMPLE (one of GCC's internal
9420 representations) and writes it to special ELF sections in the object
9421 file. When the object files are linked together, all the function
9422 bodies are read from these ELF sections and instantiated as if they
9423 had been part of the same translation unit.
9424
9425 To use the link-time optimizer, @option{-flto} and optimization
9426 options should be specified at compile time and during the final link.
9427 For example:
9428
9429 @smallexample
9430 gcc -c -O2 -flto foo.c
9431 gcc -c -O2 -flto bar.c
9432 gcc -o myprog -flto -O2 foo.o bar.o
9433 @end smallexample
9434
9435 The first two invocations to GCC save a bytecode representation
9436 of GIMPLE into special ELF sections inside @file{foo.o} and
9437 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9438 @file{foo.o} and @file{bar.o}, merges the two files into a single
9439 internal image, and compiles the result as usual. Since both
9440 @file{foo.o} and @file{bar.o} are merged into a single image, this
9441 causes all the interprocedural analyses and optimizations in GCC to
9442 work across the two files as if they were a single one. This means,
9443 for example, that the inliner is able to inline functions in
9444 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9445
9446 Another (simpler) way to enable link-time optimization is:
9447
9448 @smallexample
9449 gcc -o myprog -flto -O2 foo.c bar.c
9450 @end smallexample
9451
9452 The above generates bytecode for @file{foo.c} and @file{bar.c},
9453 merges them together into a single GIMPLE representation and optimizes
9454 them as usual to produce @file{myprog}.
9455
9456 The only important thing to keep in mind is that to enable link-time
9457 optimizations you need to use the GCC driver to perform the link-step.
9458 GCC then automatically performs link-time optimization if any of the
9459 objects involved were compiled with the @option{-flto} command-line option.
9460 You generally
9461 should specify the optimization options to be used for link-time
9462 optimization though GCC tries to be clever at guessing an
9463 optimization level to use from the options used at compile-time
9464 if you fail to specify one at link-time. You can always override
9465 the automatic decision to do link-time optimization at link-time
9466 by passing @option{-fno-lto} to the link command.
9467
9468 To make whole program optimization effective, it is necessary to make
9469 certain whole program assumptions. The compiler needs to know
9470 what functions and variables can be accessed by libraries and runtime
9471 outside of the link-time optimized unit. When supported by the linker,
9472 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9473 to the compiler about used and externally visible symbols. When
9474 the linker plugin is not available, @option{-fwhole-program} should be
9475 used to allow the compiler to make these assumptions, which leads
9476 to more aggressive optimization decisions.
9477
9478 When @option{-fuse-linker-plugin} is not enabled then, when a file is
9479 compiled with @option{-flto}, the generated object file is larger than
9480 a regular object file because it contains GIMPLE bytecodes and the usual
9481 final code (see @option{-ffat-lto-objects}. This means that
9482 object files with LTO information can be linked as normal object
9483 files; if @option{-fno-lto} is passed to the linker, no
9484 interprocedural optimizations are applied. Note that when
9485 @option{-fno-fat-lto-objects} is enabled the compile-stage is faster
9486 but you cannot perform a regular, non-LTO link on them.
9487
9488 Additionally, the optimization flags used to compile individual files
9489 are not necessarily related to those used at link time. For instance,
9490
9491 @smallexample
9492 gcc -c -O0 -ffat-lto-objects -flto foo.c
9493 gcc -c -O0 -ffat-lto-objects -flto bar.c
9494 gcc -o myprog -O3 foo.o bar.o
9495 @end smallexample
9496
9497 This produces individual object files with unoptimized assembler
9498 code, but the resulting binary @file{myprog} is optimized at
9499 @option{-O3}. If, instead, the final binary is generated with
9500 @option{-fno-lto}, then @file{myprog} is not optimized.
9501
9502 When producing the final binary, GCC only
9503 applies link-time optimizations to those files that contain bytecode.
9504 Therefore, you can mix and match object files and libraries with
9505 GIMPLE bytecodes and final object code. GCC automatically selects
9506 which files to optimize in LTO mode and which files to link without
9507 further processing.
9508
9509 There are some code generation flags preserved by GCC when
9510 generating bytecodes, as they need to be used during the final link
9511 stage. Generally options specified at link-time override those
9512 specified at compile-time.
9513
9514 If you do not specify an optimization level option @option{-O} at
9515 link-time then GCC computes one based on the optimization levels
9516 used when compiling the object files. The highest optimization
9517 level wins here.
9518
9519 Currently, the following options and their setting are take from
9520 the first object file that explicitely specified it:
9521 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9522 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9523 and all the @option{-m} target flags.
9524
9525 Certain ABI changing flags are required to match in all compilation-units
9526 and trying to override this at link-time with a conflicting value
9527 is ignored. This includes options such as @option{-freg-struct-return}
9528 and @option{-fpcc-struct-return}.
9529
9530 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9531 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9532 are passed through to the link stage and merged conservatively for
9533 conflicting translation units. Specifically
9534 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9535 precedence and for example @option{-ffp-contract=off} takes precedence
9536 over @option{-ffp-contract=fast}. You can override them at linke-time.
9537
9538 It is recommended that you compile all the files participating in the
9539 same link with the same options and also specify those options at
9540 link time.
9541
9542 If LTO encounters objects with C linkage declared with incompatible
9543 types in separate translation units to be linked together (undefined
9544 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9545 issued. The behavior is still undefined at run time. Similar
9546 diagnostics may be raised for other languages.
9547
9548 Another feature of LTO is that it is possible to apply interprocedural
9549 optimizations on files written in different languages:
9550
9551 @smallexample
9552 gcc -c -flto foo.c
9553 g++ -c -flto bar.cc
9554 gfortran -c -flto baz.f90
9555 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9556 @end smallexample
9557
9558 Notice that the final link is done with @command{g++} to get the C++
9559 runtime libraries and @option{-lgfortran} is added to get the Fortran
9560 runtime libraries. In general, when mixing languages in LTO mode, you
9561 should use the same link command options as when mixing languages in a
9562 regular (non-LTO) compilation.
9563
9564 If object files containing GIMPLE bytecode are stored in a library archive, say
9565 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9566 are using a linker with plugin support. To create static libraries suitable
9567 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9568 and @command{ranlib};
9569 to show the symbols of object files with GIMPLE bytecode, use
9570 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9571 and @command{nm} have been compiled with plugin support. At link time, use the the
9572 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9573 the LTO optimization process:
9574
9575 @smallexample
9576 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9577 @end smallexample
9578
9579 With the linker plugin enabled, the linker extracts the needed
9580 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9581 to make them part of the aggregated GIMPLE image to be optimized.
9582
9583 If you are not using a linker with plugin support and/or do not
9584 enable the linker plugin, then the objects inside @file{libfoo.a}
9585 are extracted and linked as usual, but they do not participate
9586 in the LTO optimization process. In order to make a static library suitable
9587 for both LTO optimization and usual linkage, compile its object files with
9588 @option{-flto} @option{-ffat-lto-objects}.
9589
9590 Link-time optimizations do not require the presence of the whole program to
9591 operate. If the program does not require any symbols to be exported, it is
9592 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9593 the interprocedural optimizers to use more aggressive assumptions which may
9594 lead to improved optimization opportunities.
9595 Use of @option{-fwhole-program} is not needed when linker plugin is
9596 active (see @option{-fuse-linker-plugin}).
9597
9598 The current implementation of LTO makes no
9599 attempt to generate bytecode that is portable between different
9600 types of hosts. The bytecode files are versioned and there is a
9601 strict version check, so bytecode files generated in one version of
9602 GCC do not work with an older or newer version of GCC.
9603
9604 Link-time optimization does not work well with generation of debugging
9605 information. Combining @option{-flto} with
9606 @option{-g} is currently experimental and expected to produce unexpected
9607 results.
9608
9609 If you specify the optional @var{n}, the optimization and code
9610 generation done at link time is executed in parallel using @var{n}
9611 parallel jobs by utilizing an installed @command{make} program. The
9612 environment variable @env{MAKE} may be used to override the program
9613 used. The default value for @var{n} is 1.
9614
9615 You can also specify @option{-flto=jobserver} to use GNU make's
9616 job server mode to determine the number of parallel jobs. This
9617 is useful when the Makefile calling GCC is already executing in parallel.
9618 You must prepend a @samp{+} to the command recipe in the parent Makefile
9619 for this to work. This option likely only works if @env{MAKE} is
9620 GNU make.
9621
9622 @item -flto-partition=@var{alg}
9623 @opindex flto-partition
9624 Specify the partitioning algorithm used by the link-time optimizer.
9625 The value is either @samp{1to1} to specify a partitioning mirroring
9626 the original source files or @samp{balanced} to specify partitioning
9627 into equally sized chunks (whenever possible) or @samp{max} to create
9628 new partition for every symbol where possible. Specifying @samp{none}
9629 as an algorithm disables partitioning and streaming completely.
9630 The default value is @samp{balanced}. While @samp{1to1} can be used
9631 as an workaround for various code ordering issues, the @samp{max}
9632 partitioning is intended for internal testing only.
9633 The value @samp{one} specifies that exactly one partition should be
9634 used while the value @samp{none} bypasses partitioning and executes
9635 the link-time optimization step directly from the WPA phase.
9636
9637 @item -flto-odr-type-merging
9638 @opindex flto-odr-type-merging
9639 Enable streaming of mangled types names of C++ types and their unification
9640 at linktime. This increases size of LTO object files, but enable
9641 diagnostics about One Definition Rule violations.
9642
9643 @item -flto-compression-level=@var{n}
9644 @opindex flto-compression-level
9645 This option specifies the level of compression used for intermediate
9646 language written to LTO object files, and is only meaningful in
9647 conjunction with LTO mode (@option{-flto}). Valid
9648 values are 0 (no compression) to 9 (maximum compression). Values
9649 outside this range are clamped to either 0 or 9. If the option is not
9650 given, a default balanced compression setting is used.
9651
9652 @item -flto-report
9653 @opindex flto-report
9654 Prints a report with internal details on the workings of the link-time
9655 optimizer. The contents of this report vary from version to version.
9656 It is meant to be useful to GCC developers when processing object
9657 files in LTO mode (via @option{-flto}).
9658
9659 Disabled by default.
9660
9661 @item -flto-report-wpa
9662 @opindex flto-report-wpa
9663 Like @option{-flto-report}, but only print for the WPA phase of Link
9664 Time Optimization.
9665
9666 @item -fuse-linker-plugin
9667 @opindex fuse-linker-plugin
9668 Enables the use of a linker plugin during link-time optimization. This
9669 option relies on plugin support in the linker, which is available in gold
9670 or in GNU ld 2.21 or newer.
9671
9672 This option enables the extraction of object files with GIMPLE bytecode out
9673 of library archives. This improves the quality of optimization by exposing
9674 more code to the link-time optimizer. This information specifies what
9675 symbols can be accessed externally (by non-LTO object or during dynamic
9676 linking). Resulting code quality improvements on binaries (and shared
9677 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9678 See @option{-flto} for a description of the effect of this flag and how to
9679 use it.
9680
9681 This option is enabled by default when LTO support in GCC is enabled
9682 and GCC was configured for use with
9683 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9684
9685 @item -ffat-lto-objects
9686 @opindex ffat-lto-objects
9687 Fat LTO objects are object files that contain both the intermediate language
9688 and the object code. This makes them usable for both LTO linking and normal
9689 linking. This option is effective only when compiling with @option{-flto}
9690 and is ignored at link time.
9691
9692 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9693 requires the complete toolchain to be aware of LTO. It requires a linker with
9694 linker plugin support for basic functionality. Additionally,
9695 @command{nm}, @command{ar} and @command{ranlib}
9696 need to support linker plugins to allow a full-featured build environment
9697 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9698 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9699 to these tools. With non fat LTO makefiles need to be modified to use them.
9700
9701 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9702 support.
9703
9704 @item -fcompare-elim
9705 @opindex fcompare-elim
9706 After register allocation and post-register allocation instruction splitting,
9707 identify arithmetic instructions that compute processor flags similar to a
9708 comparison operation based on that arithmetic. If possible, eliminate the
9709 explicit comparison operation.
9710
9711 This pass only applies to certain targets that cannot explicitly represent
9712 the comparison operation before register allocation is complete.
9713
9714 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9715
9716 @item -fcprop-registers
9717 @opindex fcprop-registers
9718 After register allocation and post-register allocation instruction splitting,
9719 perform a copy-propagation pass to try to reduce scheduling dependencies
9720 and occasionally eliminate the copy.
9721
9722 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9723
9724 @item -fprofile-correction
9725 @opindex fprofile-correction
9726 Profiles collected using an instrumented binary for multi-threaded programs may
9727 be inconsistent due to missed counter updates. When this option is specified,
9728 GCC uses heuristics to correct or smooth out such inconsistencies. By
9729 default, GCC emits an error message when an inconsistent profile is detected.
9730
9731 @item -fprofile-dir=@var{path}
9732 @opindex fprofile-dir
9733
9734 Set the directory to search for the profile data files in to @var{path}.
9735 This option affects only the profile data generated by
9736 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
9737 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
9738 and its related options. Both absolute and relative paths can be used.
9739 By default, GCC uses the current directory as @var{path}, thus the
9740 profile data file appears in the same directory as the object file.
9741
9742 @item -fprofile-generate
9743 @itemx -fprofile-generate=@var{path}
9744 @opindex fprofile-generate
9745
9746 Enable options usually used for instrumenting application to produce
9747 profile useful for later recompilation with profile feedback based
9748 optimization. You must use @option{-fprofile-generate} both when
9749 compiling and when linking your program.
9750
9751 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
9752
9753 If @var{path} is specified, GCC looks at the @var{path} to find
9754 the profile feedback data files. See @option{-fprofile-dir}.
9755
9756 @item -fprofile-use
9757 @itemx -fprofile-use=@var{path}
9758 @opindex fprofile-use
9759 Enable profile feedback-directed optimizations,
9760 and the following optimizations
9761 which are generally profitable only with profile feedback available:
9762 @option{-fbranch-probabilities}, @option{-fvpt},
9763 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9764 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9765
9766 By default, GCC emits an error message if the feedback profiles do not
9767 match the source code. This error can be turned into a warning by using
9768 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9769 code.
9770
9771 If @var{path} is specified, GCC looks at the @var{path} to find
9772 the profile feedback data files. See @option{-fprofile-dir}.
9773
9774 @item -fauto-profile
9775 @itemx -fauto-profile=@var{path}
9776 @opindex fauto-profile
9777 Enable sampling-based feedback-directed optimizations,
9778 and the following optimizations
9779 which are generally profitable only with profile feedback available:
9780 @option{-fbranch-probabilities}, @option{-fvpt},
9781 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9782 @option{-ftree-vectorize},
9783 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9784 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9785 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9786
9787 @var{path} is the name of a file containing AutoFDO profile information.
9788 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9789
9790 Producing an AutoFDO profile data file requires running your program
9791 with the @command{perf} utility on a supported GNU/Linux target system.
9792 For more information, see @uref{https://perf.wiki.kernel.org/}.
9793
9794 E.g.
9795 @smallexample
9796 perf record -e br_inst_retired:near_taken -b -o perf.data \
9797 -- your_program
9798 @end smallexample
9799
9800 Then use the @command{create_gcov} tool to convert the raw profile data
9801 to a format that can be used by GCC.@ You must also supply the
9802 unstripped binary for your program to this tool.
9803 See @uref{https://github.com/google/autofdo}.
9804
9805 E.g.
9806 @smallexample
9807 create_gcov --binary=your_program.unstripped --profile=perf.data \
9808 --gcov=profile.afdo
9809 @end smallexample
9810 @end table
9811
9812 The following options control compiler behavior regarding floating-point
9813 arithmetic. These options trade off between speed and
9814 correctness. All must be specifically enabled.
9815
9816 @table @gcctabopt
9817 @item -ffloat-store
9818 @opindex ffloat-store
9819 Do not store floating-point variables in registers, and inhibit other
9820 options that might change whether a floating-point value is taken from a
9821 register or memory.
9822
9823 @cindex floating-point precision
9824 This option prevents undesirable excess precision on machines such as
9825 the 68000 where the floating registers (of the 68881) keep more
9826 precision than a @code{double} is supposed to have. Similarly for the
9827 x86 architecture. For most programs, the excess precision does only
9828 good, but a few programs rely on the precise definition of IEEE floating
9829 point. Use @option{-ffloat-store} for such programs, after modifying
9830 them to store all pertinent intermediate computations into variables.
9831
9832 @item -fexcess-precision=@var{style}
9833 @opindex fexcess-precision
9834 This option allows further control over excess precision on machines
9835 where floating-point registers have more precision than the IEEE
9836 @code{float} and @code{double} types and the processor does not
9837 support operations rounding to those types. By default,
9838 @option{-fexcess-precision=fast} is in effect; this means that
9839 operations are carried out in the precision of the registers and that
9840 it is unpredictable when rounding to the types specified in the source
9841 code takes place. When compiling C, if
9842 @option{-fexcess-precision=standard} is specified then excess
9843 precision follows the rules specified in ISO C99; in particular,
9844 both casts and assignments cause values to be rounded to their
9845 semantic types (whereas @option{-ffloat-store} only affects
9846 assignments). This option is enabled by default for C if a strict
9847 conformance option such as @option{-std=c99} is used.
9848
9849 @opindex mfpmath
9850 @option{-fexcess-precision=standard} is not implemented for languages
9851 other than C, and has no effect if
9852 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
9853 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
9854 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9855 semantics apply without excess precision, and in the latter, rounding
9856 is unpredictable.
9857
9858 @item -ffast-math
9859 @opindex ffast-math
9860 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9861 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9862 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
9863
9864 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9865
9866 This option is not turned on by any @option{-O} option besides
9867 @option{-Ofast} since it can result in incorrect output for programs
9868 that depend on an exact implementation of IEEE or ISO rules/specifications
9869 for math functions. It may, however, yield faster code for programs
9870 that do not require the guarantees of these specifications.
9871
9872 @item -fno-math-errno
9873 @opindex fno-math-errno
9874 Do not set @code{errno} after calling math functions that are executed
9875 with a single instruction, e.g., @code{sqrt}. A program that relies on
9876 IEEE exceptions for math error handling may want to use this flag
9877 for speed while maintaining IEEE arithmetic compatibility.
9878
9879 This option is not turned on by any @option{-O} option since
9880 it can result in incorrect output for programs that depend on
9881 an exact implementation of IEEE or ISO rules/specifications for
9882 math functions. It may, however, yield faster code for programs
9883 that do not require the guarantees of these specifications.
9884
9885 The default is @option{-fmath-errno}.
9886
9887 On Darwin systems, the math library never sets @code{errno}. There is
9888 therefore no reason for the compiler to consider the possibility that
9889 it might, and @option{-fno-math-errno} is the default.
9890
9891 @item -funsafe-math-optimizations
9892 @opindex funsafe-math-optimizations
9893
9894 Allow optimizations for floating-point arithmetic that (a) assume
9895 that arguments and results are valid and (b) may violate IEEE or
9896 ANSI standards. When used at link-time, it may include libraries
9897 or startup files that change the default FPU control word or other
9898 similar optimizations.
9899
9900 This option is not turned on by any @option{-O} option since
9901 it can result in incorrect output for programs that depend on
9902 an exact implementation of IEEE or ISO rules/specifications for
9903 math functions. It may, however, yield faster code for programs
9904 that do not require the guarantees of these specifications.
9905 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9906 @option{-fassociative-math} and @option{-freciprocal-math}.
9907
9908 The default is @option{-fno-unsafe-math-optimizations}.
9909
9910 @item -fassociative-math
9911 @opindex fassociative-math
9912
9913 Allow re-association of operands in series of floating-point operations.
9914 This violates the ISO C and C++ language standard by possibly changing
9915 computation result. NOTE: re-ordering may change the sign of zero as
9916 well as ignore NaNs and inhibit or create underflow or overflow (and
9917 thus cannot be used on code that relies on rounding behavior like
9918 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9919 and thus may not be used when ordered comparisons are required.
9920 This option requires that both @option{-fno-signed-zeros} and
9921 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9922 much sense with @option{-frounding-math}. For Fortran the option
9923 is automatically enabled when both @option{-fno-signed-zeros} and
9924 @option{-fno-trapping-math} are in effect.
9925
9926 The default is @option{-fno-associative-math}.
9927
9928 @item -freciprocal-math
9929 @opindex freciprocal-math
9930
9931 Allow the reciprocal of a value to be used instead of dividing by
9932 the value if this enables optimizations. For example @code{x / y}
9933 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9934 is subject to common subexpression elimination. Note that this loses
9935 precision and increases the number of flops operating on the value.
9936
9937 The default is @option{-fno-reciprocal-math}.
9938
9939 @item -ffinite-math-only
9940 @opindex ffinite-math-only
9941 Allow optimizations for floating-point arithmetic that assume
9942 that arguments and results are not NaNs or +-Infs.
9943
9944 This option is not turned on by any @option{-O} option since
9945 it can result in incorrect output for programs that depend on
9946 an exact implementation of IEEE or ISO rules/specifications for
9947 math functions. It may, however, yield faster code for programs
9948 that do not require the guarantees of these specifications.
9949
9950 The default is @option{-fno-finite-math-only}.
9951
9952 @item -fno-signed-zeros
9953 @opindex fno-signed-zeros
9954 Allow optimizations for floating-point arithmetic that ignore the
9955 signedness of zero. IEEE arithmetic specifies the behavior of
9956 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9957 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9958 This option implies that the sign of a zero result isn't significant.
9959
9960 The default is @option{-fsigned-zeros}.
9961
9962 @item -fno-trapping-math
9963 @opindex fno-trapping-math
9964 Compile code assuming that floating-point operations cannot generate
9965 user-visible traps. These traps include division by zero, overflow,
9966 underflow, inexact result and invalid operation. This option requires
9967 that @option{-fno-signaling-nans} be in effect. Setting this option may
9968 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9969
9970 This option should never be turned on by any @option{-O} option since
9971 it can result in incorrect output for programs that depend on
9972 an exact implementation of IEEE or ISO rules/specifications for
9973 math functions.
9974
9975 The default is @option{-ftrapping-math}.
9976
9977 @item -frounding-math
9978 @opindex frounding-math
9979 Disable transformations and optimizations that assume default floating-point
9980 rounding behavior. This is round-to-zero for all floating point
9981 to integer conversions, and round-to-nearest for all other arithmetic
9982 truncations. This option should be specified for programs that change
9983 the FP rounding mode dynamically, or that may be executed with a
9984 non-default rounding mode. This option disables constant folding of
9985 floating-point expressions at compile time (which may be affected by
9986 rounding mode) and arithmetic transformations that are unsafe in the
9987 presence of sign-dependent rounding modes.
9988
9989 The default is @option{-fno-rounding-math}.
9990
9991 This option is experimental and does not currently guarantee to
9992 disable all GCC optimizations that are affected by rounding mode.
9993 Future versions of GCC may provide finer control of this setting
9994 using C99's @code{FENV_ACCESS} pragma. This command-line option
9995 will be used to specify the default state for @code{FENV_ACCESS}.
9996
9997 @item -fsignaling-nans
9998 @opindex fsignaling-nans
9999 Compile code assuming that IEEE signaling NaNs may generate user-visible
10000 traps during floating-point operations. Setting this option disables
10001 optimizations that may change the number of exceptions visible with
10002 signaling NaNs. This option implies @option{-ftrapping-math}.
10003
10004 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10005 be defined.
10006
10007 The default is @option{-fno-signaling-nans}.
10008
10009 This option is experimental and does not currently guarantee to
10010 disable all GCC optimizations that affect signaling NaN behavior.
10011
10012 @item -fsingle-precision-constant
10013 @opindex fsingle-precision-constant
10014 Treat floating-point constants as single precision instead of
10015 implicitly converting them to double-precision constants.
10016
10017 @item -fcx-limited-range
10018 @opindex fcx-limited-range
10019 When enabled, this option states that a range reduction step is not
10020 needed when performing complex division. Also, there is no checking
10021 whether the result of a complex multiplication or division is @code{NaN
10022 + I*NaN}, with an attempt to rescue the situation in that case. The
10023 default is @option{-fno-cx-limited-range}, but is enabled by
10024 @option{-ffast-math}.
10025
10026 This option controls the default setting of the ISO C99
10027 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10028 all languages.
10029
10030 @item -fcx-fortran-rules
10031 @opindex fcx-fortran-rules
10032 Complex multiplication and division follow Fortran rules. Range
10033 reduction is done as part of complex division, but there is no checking
10034 whether the result of a complex multiplication or division is @code{NaN
10035 + I*NaN}, with an attempt to rescue the situation in that case.
10036
10037 The default is @option{-fno-cx-fortran-rules}.
10038
10039 @end table
10040
10041 The following options control optimizations that may improve
10042 performance, but are not enabled by any @option{-O} options. This
10043 section includes experimental options that may produce broken code.
10044
10045 @table @gcctabopt
10046 @item -fbranch-probabilities
10047 @opindex fbranch-probabilities
10048 After running a program compiled with @option{-fprofile-arcs}
10049 (@pxref{Debugging Options,, Options for Debugging Your Program or
10050 @command{gcc}}), you can compile it a second time using
10051 @option{-fbranch-probabilities}, to improve optimizations based on
10052 the number of times each branch was taken. When a program
10053 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10054 counts to a file called @file{@var{sourcename}.gcda} for each source
10055 file. The information in this data file is very dependent on the
10056 structure of the generated code, so you must use the same source code
10057 and the same optimization options for both compilations.
10058
10059 With @option{-fbranch-probabilities}, GCC puts a
10060 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10061 These can be used to improve optimization. Currently, they are only
10062 used in one place: in @file{reorg.c}, instead of guessing which path a
10063 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10064 exactly determine which path is taken more often.
10065
10066 @item -fprofile-values
10067 @opindex fprofile-values
10068 If combined with @option{-fprofile-arcs}, it adds code so that some
10069 data about values of expressions in the program is gathered.
10070
10071 With @option{-fbranch-probabilities}, it reads back the data gathered
10072 from profiling values of expressions for usage in optimizations.
10073
10074 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
10075
10076 @item -fprofile-reorder-functions
10077 @opindex fprofile-reorder-functions
10078 Function reordering based on profile instrumentation collects
10079 first time of execution of a function and orders these functions
10080 in ascending order.
10081
10082 Enabled with @option{-fprofile-use}.
10083
10084 @item -fvpt
10085 @opindex fvpt
10086 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10087 to add code to gather information about values of expressions.
10088
10089 With @option{-fbranch-probabilities}, it reads back the data gathered
10090 and actually performs the optimizations based on them.
10091 Currently the optimizations include specialization of division operations
10092 using the knowledge about the value of the denominator.
10093
10094 @item -frename-registers
10095 @opindex frename-registers
10096 Attempt to avoid false dependencies in scheduled code by making use
10097 of registers left over after register allocation. This optimization
10098 most benefits processors with lots of registers. Depending on the
10099 debug information format adopted by the target, however, it can
10100 make debugging impossible, since variables no longer stay in
10101 a ``home register''.
10102
10103 Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
10104
10105 @item -fschedule-fusion
10106 @opindex fschedule-fusion
10107 Performs a target dependent pass over the instruction stream to schedule
10108 instructions of same type together because target machine can execute them
10109 more efficiently if they are adjacent to each other in the instruction flow.
10110
10111 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10112
10113 @item -ftracer
10114 @opindex ftracer
10115 Perform tail duplication to enlarge superblock size. This transformation
10116 simplifies the control flow of the function allowing other optimizations to do
10117 a better job.
10118
10119 Enabled with @option{-fprofile-use}.
10120
10121 @item -funroll-loops
10122 @opindex funroll-loops
10123 Unroll loops whose number of iterations can be determined at compile time or
10124 upon entry to the loop. @option{-funroll-loops} implies
10125 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10126 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10127 a small constant number of iterations). This option makes code larger, and may
10128 or may not make it run faster.
10129
10130 Enabled with @option{-fprofile-use}.
10131
10132 @item -funroll-all-loops
10133 @opindex funroll-all-loops
10134 Unroll all loops, even if their number of iterations is uncertain when
10135 the loop is entered. This usually makes programs run more slowly.
10136 @option{-funroll-all-loops} implies the same options as
10137 @option{-funroll-loops}.
10138
10139 @item -fpeel-loops
10140 @opindex fpeel-loops
10141 Peels loops for which there is enough information that they do not
10142 roll much (from profile feedback). It also turns on complete loop peeling
10143 (i.e.@: complete removal of loops with small constant number of iterations).
10144
10145 Enabled with @option{-fprofile-use}.
10146
10147 @item -fmove-loop-invariants
10148 @opindex fmove-loop-invariants
10149 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10150 at level @option{-O1}
10151
10152 @item -funswitch-loops
10153 @opindex funswitch-loops
10154 Move branches with loop invariant conditions out of the loop, with duplicates
10155 of the loop on both branches (modified according to result of the condition).
10156
10157 @item -ffunction-sections
10158 @itemx -fdata-sections
10159 @opindex ffunction-sections
10160 @opindex fdata-sections
10161 Place each function or data item into its own section in the output
10162 file if the target supports arbitrary sections. The name of the
10163 function or the name of the data item determines the section's name
10164 in the output file.
10165
10166 Use these options on systems where the linker can perform optimizations
10167 to improve locality of reference in the instruction space. Most systems
10168 using the ELF object format and SPARC processors running Solaris 2 have
10169 linkers with such optimizations. AIX may have these optimizations in
10170 the future.
10171
10172 Only use these options when there are significant benefits from doing
10173 so. When you specify these options, the assembler and linker
10174 create larger object and executable files and are also slower.
10175 You cannot use @command{gprof} on all systems if you
10176 specify this option, and you may have problems with debugging if
10177 you specify both this option and @option{-g}.
10178
10179 @item -fbranch-target-load-optimize
10180 @opindex fbranch-target-load-optimize
10181 Perform branch target register load optimization before prologue / epilogue
10182 threading.
10183 The use of target registers can typically be exposed only during reload,
10184 thus hoisting loads out of loops and doing inter-block scheduling needs
10185 a separate optimization pass.
10186
10187 @item -fbranch-target-load-optimize2
10188 @opindex fbranch-target-load-optimize2
10189 Perform branch target register load optimization after prologue / epilogue
10190 threading.
10191
10192 @item -fbtr-bb-exclusive
10193 @opindex fbtr-bb-exclusive
10194 When performing branch target register load optimization, don't reuse
10195 branch target registers within any basic block.
10196
10197 @item -fstack-protector
10198 @opindex fstack-protector
10199 Emit extra code to check for buffer overflows, such as stack smashing
10200 attacks. This is done by adding a guard variable to functions with
10201 vulnerable objects. This includes functions that call @code{alloca}, and
10202 functions with buffers larger than 8 bytes. The guards are initialized
10203 when a function is entered and then checked when the function exits.
10204 If a guard check fails, an error message is printed and the program exits.
10205
10206 @item -fstack-protector-all
10207 @opindex fstack-protector-all
10208 Like @option{-fstack-protector} except that all functions are protected.
10209
10210 @item -fstack-protector-strong
10211 @opindex fstack-protector-strong
10212 Like @option{-fstack-protector} but includes additional functions to
10213 be protected --- those that have local array definitions, or have
10214 references to local frame addresses.
10215
10216 @item -fstack-protector-explicit
10217 @opindex fstack-protector-explicit
10218 Like @option{-fstack-protector} but only protects those functions which
10219 have the @code{stack_protect} attribute
10220
10221 @item -fstdarg-opt
10222 @opindex fstdarg-opt
10223 Optimize the prologue of variadic argument functions with respect to usage of
10224 those arguments.
10225
10226 @item -fsection-anchors
10227 @opindex fsection-anchors
10228 Try to reduce the number of symbolic address calculations by using
10229 shared ``anchor'' symbols to address nearby objects. This transformation
10230 can help to reduce the number of GOT entries and GOT accesses on some
10231 targets.
10232
10233 For example, the implementation of the following function @code{foo}:
10234
10235 @smallexample
10236 static int a, b, c;
10237 int foo (void) @{ return a + b + c; @}
10238 @end smallexample
10239
10240 @noindent
10241 usually calculates the addresses of all three variables, but if you
10242 compile it with @option{-fsection-anchors}, it accesses the variables
10243 from a common anchor point instead. The effect is similar to the
10244 following pseudocode (which isn't valid C):
10245
10246 @smallexample
10247 int foo (void)
10248 @{
10249 register int *xr = &x;
10250 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10251 @}
10252 @end smallexample
10253
10254 Not all targets support this option.
10255
10256 @item --param @var{name}=@var{value}
10257 @opindex param
10258 In some places, GCC uses various constants to control the amount of
10259 optimization that is done. For example, GCC does not inline functions
10260 that contain more than a certain number of instructions. You can
10261 control some of these constants on the command line using the
10262 @option{--param} option.
10263
10264 The names of specific parameters, and the meaning of the values, are
10265 tied to the internals of the compiler, and are subject to change
10266 without notice in future releases.
10267
10268 In each case, the @var{value} is an integer. The allowable choices for
10269 @var{name} are:
10270
10271 @table @gcctabopt
10272 @item predictable-branch-outcome
10273 When branch is predicted to be taken with probability lower than this threshold
10274 (in percent), then it is considered well predictable. The default is 10.
10275
10276 @item max-crossjump-edges
10277 The maximum number of incoming edges to consider for cross-jumping.
10278 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10279 the number of edges incoming to each block. Increasing values mean
10280 more aggressive optimization, making the compilation time increase with
10281 probably small improvement in executable size.
10282
10283 @item min-crossjump-insns
10284 The minimum number of instructions that must be matched at the end
10285 of two blocks before cross-jumping is performed on them. This
10286 value is ignored in the case where all instructions in the block being
10287 cross-jumped from are matched. The default value is 5.
10288
10289 @item max-grow-copy-bb-insns
10290 The maximum code size expansion factor when copying basic blocks
10291 instead of jumping. The expansion is relative to a jump instruction.
10292 The default value is 8.
10293
10294 @item max-goto-duplication-insns
10295 The maximum number of instructions to duplicate to a block that jumps
10296 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10297 passes, GCC factors computed gotos early in the compilation process,
10298 and unfactors them as late as possible. Only computed jumps at the
10299 end of a basic blocks with no more than max-goto-duplication-insns are
10300 unfactored. The default value is 8.
10301
10302 @item max-delay-slot-insn-search
10303 The maximum number of instructions to consider when looking for an
10304 instruction to fill a delay slot. If more than this arbitrary number of
10305 instructions are searched, the time savings from filling the delay slot
10306 are minimal, so stop searching. Increasing values mean more
10307 aggressive optimization, making the compilation time increase with probably
10308 small improvement in execution time.
10309
10310 @item max-delay-slot-live-search
10311 When trying to fill delay slots, the maximum number of instructions to
10312 consider when searching for a block with valid live register
10313 information. Increasing this arbitrarily chosen value means more
10314 aggressive optimization, increasing the compilation time. This parameter
10315 should be removed when the delay slot code is rewritten to maintain the
10316 control-flow graph.
10317
10318 @item max-gcse-memory
10319 The approximate maximum amount of memory that can be allocated in
10320 order to perform the global common subexpression elimination
10321 optimization. If more memory than specified is required, the
10322 optimization is not done.
10323
10324 @item max-gcse-insertion-ratio
10325 If the ratio of expression insertions to deletions is larger than this value
10326 for any expression, then RTL PRE inserts or removes the expression and thus
10327 leaves partially redundant computations in the instruction stream. The default value is 20.
10328
10329 @item max-pending-list-length
10330 The maximum number of pending dependencies scheduling allows
10331 before flushing the current state and starting over. Large functions
10332 with few branches or calls can create excessively large lists which
10333 needlessly consume memory and resources.
10334
10335 @item max-modulo-backtrack-attempts
10336 The maximum number of backtrack attempts the scheduler should make
10337 when modulo scheduling a loop. Larger values can exponentially increase
10338 compilation time.
10339
10340 @item max-inline-insns-single
10341 Several parameters control the tree inliner used in GCC@.
10342 This number sets the maximum number of instructions (counted in GCC's
10343 internal representation) in a single function that the tree inliner
10344 considers for inlining. This only affects functions declared
10345 inline and methods implemented in a class declaration (C++).
10346 The default value is 400.
10347
10348 @item max-inline-insns-auto
10349 When you use @option{-finline-functions} (included in @option{-O3}),
10350 a lot of functions that would otherwise not be considered for inlining
10351 by the compiler are investigated. To those functions, a different
10352 (more restrictive) limit compared to functions declared inline can
10353 be applied.
10354 The default value is 40.
10355
10356 @item inline-min-speedup
10357 When estimated performance improvement of caller + callee runtime exceeds this
10358 threshold (in precent), the function can be inlined regardless the limit on
10359 @option{--param max-inline-insns-single} and @option{--param
10360 max-inline-insns-auto}.
10361
10362 @item large-function-insns
10363 The limit specifying really large functions. For functions larger than this
10364 limit after inlining, inlining is constrained by
10365 @option{--param large-function-growth}. This parameter is useful primarily
10366 to avoid extreme compilation time caused by non-linear algorithms used by the
10367 back end.
10368 The default value is 2700.
10369
10370 @item large-function-growth
10371 Specifies maximal growth of large function caused by inlining in percents.
10372 The default value is 100 which limits large function growth to 2.0 times
10373 the original size.
10374
10375 @item large-unit-insns
10376 The limit specifying large translation unit. Growth caused by inlining of
10377 units larger than this limit is limited by @option{--param inline-unit-growth}.
10378 For small units this might be too tight.
10379 For example, consider a unit consisting of function A
10380 that is inline and B that just calls A three times. If B is small relative to
10381 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10382 large units consisting of small inlineable functions, however, the overall unit
10383 growth limit is needed to avoid exponential explosion of code size. Thus for
10384 smaller units, the size is increased to @option{--param large-unit-insns}
10385 before applying @option{--param inline-unit-growth}. The default is 10000.
10386
10387 @item inline-unit-growth
10388 Specifies maximal overall growth of the compilation unit caused by inlining.
10389 The default value is 20 which limits unit growth to 1.2 times the original
10390 size. Cold functions (either marked cold via an attribute or by profile
10391 feedback) are not accounted into the unit size.
10392
10393 @item ipcp-unit-growth
10394 Specifies maximal overall growth of the compilation unit caused by
10395 interprocedural constant propagation. The default value is 10 which limits
10396 unit growth to 1.1 times the original size.
10397
10398 @item large-stack-frame
10399 The limit specifying large stack frames. While inlining the algorithm is trying
10400 to not grow past this limit too much. The default value is 256 bytes.
10401
10402 @item large-stack-frame-growth
10403 Specifies maximal growth of large stack frames caused by inlining in percents.
10404 The default value is 1000 which limits large stack frame growth to 11 times
10405 the original size.
10406
10407 @item max-inline-insns-recursive
10408 @itemx max-inline-insns-recursive-auto
10409 Specifies the maximum number of instructions an out-of-line copy of a
10410 self-recursive inline
10411 function can grow into by performing recursive inlining.
10412
10413 @option{--param max-inline-insns-recursive} applies to functions
10414 declared inline.
10415 For functions not declared inline, recursive inlining
10416 happens only when @option{-finline-functions} (included in @option{-O3}) is
10417 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
10418 default value is 450.
10419
10420 @item max-inline-recursive-depth
10421 @itemx max-inline-recursive-depth-auto
10422 Specifies the maximum recursion depth used for recursive inlining.
10423
10424 @option{--param max-inline-recursive-depth} applies to functions
10425 declared inline. For functions not declared inline, recursive inlining
10426 happens only when @option{-finline-functions} (included in @option{-O3}) is
10427 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
10428 default value is 8.
10429
10430 @item min-inline-recursive-probability
10431 Recursive inlining is profitable only for function having deep recursion
10432 in average and can hurt for function having little recursion depth by
10433 increasing the prologue size or complexity of function body to other
10434 optimizers.
10435
10436 When profile feedback is available (see @option{-fprofile-generate}) the actual
10437 recursion depth can be guessed from probability that function recurses via a
10438 given call expression. This parameter limits inlining only to call expressions
10439 whose probability exceeds the given threshold (in percents).
10440 The default value is 10.
10441
10442 @item early-inlining-insns
10443 Specify growth that the early inliner can make. In effect it increases
10444 the amount of inlining for code having a large abstraction penalty.
10445 The default value is 14.
10446
10447 @item max-early-inliner-iterations
10448 Limit of iterations of the early inliner. This basically bounds
10449 the number of nested indirect calls the early inliner can resolve.
10450 Deeper chains are still handled by late inlining.
10451
10452 @item comdat-sharing-probability
10453 Probability (in percent) that C++ inline function with comdat visibility
10454 are shared across multiple compilation units. The default value is 20.
10455
10456 @item profile-func-internal-id
10457 A parameter to control whether to use function internal id in profile
10458 database lookup. If the value is 0, the compiler uses an id that
10459 is based on function assembler name and filename, which makes old profile
10460 data more tolerant to source changes such as function reordering etc.
10461 The default value is 0.
10462
10463 @item min-vect-loop-bound
10464 The minimum number of iterations under which loops are not vectorized
10465 when @option{-ftree-vectorize} is used. The number of iterations after
10466 vectorization needs to be greater than the value specified by this option
10467 to allow vectorization. The default value is 0.
10468
10469 @item gcse-cost-distance-ratio
10470 Scaling factor in calculation of maximum distance an expression
10471 can be moved by GCSE optimizations. This is currently supported only in the
10472 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10473 is with simple expressions, i.e., the expressions that have cost
10474 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10475 hoisting of simple expressions. The default value is 10.
10476
10477 @item gcse-unrestricted-cost
10478 Cost, roughly measured as the cost of a single typical machine
10479 instruction, at which GCSE optimizations do not constrain
10480 the distance an expression can travel. This is currently
10481 supported only in the code hoisting pass. The lesser the cost,
10482 the more aggressive code hoisting is. Specifying 0
10483 allows all expressions to travel unrestricted distances.
10484 The default value is 3.
10485
10486 @item max-hoist-depth
10487 The depth of search in the dominator tree for expressions to hoist.
10488 This is used to avoid quadratic behavior in hoisting algorithm.
10489 The value of 0 does not limit on the search, but may slow down compilation
10490 of huge functions. The default value is 30.
10491
10492 @item max-tail-merge-comparisons
10493 The maximum amount of similar bbs to compare a bb with. This is used to
10494 avoid quadratic behavior in tree tail merging. The default value is 10.
10495
10496 @item max-tail-merge-iterations
10497 The maximum amount of iterations of the pass over the function. This is used to
10498 limit compilation time in tree tail merging. The default value is 2.
10499
10500 @item max-unrolled-insns
10501 The maximum number of instructions that a loop may have to be unrolled.
10502 If a loop is unrolled, this parameter also determines how many times
10503 the loop code is unrolled.
10504
10505 @item max-average-unrolled-insns
10506 The maximum number of instructions biased by probabilities of their execution
10507 that a loop may have to be unrolled. If a loop is unrolled,
10508 this parameter also determines how many times the loop code is unrolled.
10509
10510 @item max-unroll-times
10511 The maximum number of unrollings of a single loop.
10512
10513 @item max-peeled-insns
10514 The maximum number of instructions that a loop may have to be peeled.
10515 If a loop is peeled, this parameter also determines how many times
10516 the loop code is peeled.
10517
10518 @item max-peel-times
10519 The maximum number of peelings of a single loop.
10520
10521 @item max-peel-branches
10522 The maximum number of branches on the hot path through the peeled sequence.
10523
10524 @item max-completely-peeled-insns
10525 The maximum number of insns of a completely peeled loop.
10526
10527 @item max-completely-peel-times
10528 The maximum number of iterations of a loop to be suitable for complete peeling.
10529
10530 @item max-completely-peel-loop-nest-depth
10531 The maximum depth of a loop nest suitable for complete peeling.
10532
10533 @item max-unswitch-insns
10534 The maximum number of insns of an unswitched loop.
10535
10536 @item max-unswitch-level
10537 The maximum number of branches unswitched in a single loop.
10538
10539 @item lim-expensive
10540 The minimum cost of an expensive expression in the loop invariant motion.
10541
10542 @item iv-consider-all-candidates-bound
10543 Bound on number of candidates for induction variables, below which
10544 all candidates are considered for each use in induction variable
10545 optimizations. If there are more candidates than this,
10546 only the most relevant ones are considered to avoid quadratic time complexity.
10547
10548 @item iv-max-considered-uses
10549 The induction variable optimizations give up on loops that contain more
10550 induction variable uses.
10551
10552 @item iv-always-prune-cand-set-bound
10553 If the number of candidates in the set is smaller than this value,
10554 always try to remove unnecessary ivs from the set
10555 when adding a new one.
10556
10557 @item scev-max-expr-size
10558 Bound on size of expressions used in the scalar evolutions analyzer.
10559 Large expressions slow the analyzer.
10560
10561 @item scev-max-expr-complexity
10562 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10563 Complex expressions slow the analyzer.
10564
10565 @item vect-max-version-for-alignment-checks
10566 The maximum number of run-time checks that can be performed when
10567 doing loop versioning for alignment in the vectorizer.
10568
10569 @item vect-max-version-for-alias-checks
10570 The maximum number of run-time checks that can be performed when
10571 doing loop versioning for alias in the vectorizer.
10572
10573 @item vect-max-peeling-for-alignment
10574 The maximum number of loop peels to enhance access alignment
10575 for vectorizer. Value -1 means 'no limit'.
10576
10577 @item max-iterations-to-track
10578 The maximum number of iterations of a loop the brute-force algorithm
10579 for analysis of the number of iterations of the loop tries to evaluate.
10580
10581 @item hot-bb-count-ws-permille
10582 A basic block profile count is considered hot if it contributes to
10583 the given permillage (i.e. 0...1000) of the entire profiled execution.
10584
10585 @item hot-bb-frequency-fraction
10586 Select fraction of the entry block frequency of executions of basic block in
10587 function given basic block needs to have to be considered hot.
10588
10589 @item max-predicted-iterations
10590 The maximum number of loop iterations we predict statically. This is useful
10591 in cases where a function contains a single loop with known bound and
10592 another loop with unknown bound.
10593 The known number of iterations is predicted correctly, while
10594 the unknown number of iterations average to roughly 10. This means that the
10595 loop without bounds appears artificially cold relative to the other one.
10596
10597 @item builtin-expect-probability
10598 Control the probability of the expression having the specified value. This
10599 parameter takes a percentage (i.e. 0 ... 100) as input.
10600 The default probability of 90 is obtained empirically.
10601
10602 @item align-threshold
10603
10604 Select fraction of the maximal frequency of executions of a basic block in
10605 a function to align the basic block.
10606
10607 @item align-loop-iterations
10608
10609 A loop expected to iterate at least the selected number of iterations is
10610 aligned.
10611
10612 @item tracer-dynamic-coverage
10613 @itemx tracer-dynamic-coverage-feedback
10614
10615 This value is used to limit superblock formation once the given percentage of
10616 executed instructions is covered. This limits unnecessary code size
10617 expansion.
10618
10619 The @option{tracer-dynamic-coverage-feedback} parameter
10620 is used only when profile
10621 feedback is available. The real profiles (as opposed to statically estimated
10622 ones) are much less balanced allowing the threshold to be larger value.
10623
10624 @item tracer-max-code-growth
10625 Stop tail duplication once code growth has reached given percentage. This is
10626 a rather artificial limit, as most of the duplicates are eliminated later in
10627 cross jumping, so it may be set to much higher values than is the desired code
10628 growth.
10629
10630 @item tracer-min-branch-ratio
10631
10632 Stop reverse growth when the reverse probability of best edge is less than this
10633 threshold (in percent).
10634
10635 @item tracer-min-branch-ratio
10636 @itemx tracer-min-branch-ratio-feedback
10637
10638 Stop forward growth if the best edge has probability lower than this
10639 threshold.
10640
10641 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
10642 compilation for profile feedback and one for compilation without. The value
10643 for compilation with profile feedback needs to be more conservative (higher) in
10644 order to make tracer effective.
10645
10646 @item max-cse-path-length
10647
10648 The maximum number of basic blocks on path that CSE considers.
10649 The default is 10.
10650
10651 @item max-cse-insns
10652 The maximum number of instructions CSE processes before flushing.
10653 The default is 1000.
10654
10655 @item ggc-min-expand
10656
10657 GCC uses a garbage collector to manage its own memory allocation. This
10658 parameter specifies the minimum percentage by which the garbage
10659 collector's heap should be allowed to expand between collections.
10660 Tuning this may improve compilation speed; it has no effect on code
10661 generation.
10662
10663 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10664 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10665 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10666 GCC is not able to calculate RAM on a particular platform, the lower
10667 bound of 30% is used. Setting this parameter and
10668 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10669 every opportunity. This is extremely slow, but can be useful for
10670 debugging.
10671
10672 @item ggc-min-heapsize
10673
10674 Minimum size of the garbage collector's heap before it begins bothering
10675 to collect garbage. The first collection occurs after the heap expands
10676 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10677 tuning this may improve compilation speed, and has no effect on code
10678 generation.
10679
10680 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10681 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10682 with a lower bound of 4096 (four megabytes) and an upper bound of
10683 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10684 particular platform, the lower bound is used. Setting this parameter
10685 very large effectively disables garbage collection. Setting this
10686 parameter and @option{ggc-min-expand} to zero causes a full collection
10687 to occur at every opportunity.
10688
10689 @item max-reload-search-insns
10690 The maximum number of instruction reload should look backward for equivalent
10691 register. Increasing values mean more aggressive optimization, making the
10692 compilation time increase with probably slightly better performance.
10693 The default value is 100.
10694
10695 @item max-cselib-memory-locations
10696 The maximum number of memory locations cselib should take into account.
10697 Increasing values mean more aggressive optimization, making the compilation time
10698 increase with probably slightly better performance. The default value is 500.
10699
10700 @item reorder-blocks-duplicate
10701 @itemx reorder-blocks-duplicate-feedback
10702
10703 Used by the basic block reordering pass to decide whether to use unconditional
10704 branch or duplicate the code on its destination. Code is duplicated when its
10705 estimated size is smaller than this value multiplied by the estimated size of
10706 unconditional jump in the hot spots of the program.
10707
10708 The @option{reorder-block-duplicate-feedback} parameter
10709 is used only when profile
10710 feedback is available. It may be set to higher values than
10711 @option{reorder-block-duplicate} since information about the hot spots is more
10712 accurate.
10713
10714 @item max-sched-ready-insns
10715 The maximum number of instructions ready to be issued the scheduler should
10716 consider at any given time during the first scheduling pass. Increasing
10717 values mean more thorough searches, making the compilation time increase
10718 with probably little benefit. The default value is 100.
10719
10720 @item max-sched-region-blocks
10721 The maximum number of blocks in a region to be considered for
10722 interblock scheduling. The default value is 10.
10723
10724 @item max-pipeline-region-blocks
10725 The maximum number of blocks in a region to be considered for
10726 pipelining in the selective scheduler. The default value is 15.
10727
10728 @item max-sched-region-insns
10729 The maximum number of insns in a region to be considered for
10730 interblock scheduling. The default value is 100.
10731
10732 @item max-pipeline-region-insns
10733 The maximum number of insns in a region to be considered for
10734 pipelining in the selective scheduler. The default value is 200.
10735
10736 @item min-spec-prob
10737 The minimum probability (in percents) of reaching a source block
10738 for interblock speculative scheduling. The default value is 40.
10739
10740 @item max-sched-extend-regions-iters
10741 The maximum number of iterations through CFG to extend regions.
10742 A value of 0 (the default) disables region extensions.
10743
10744 @item max-sched-insn-conflict-delay
10745 The maximum conflict delay for an insn to be considered for speculative motion.
10746 The default value is 3.
10747
10748 @item sched-spec-prob-cutoff
10749 The minimal probability of speculation success (in percents), so that
10750 speculative insns are scheduled.
10751 The default value is 40.
10752
10753 @item sched-spec-state-edge-prob-cutoff
10754 The minimum probability an edge must have for the scheduler to save its
10755 state across it.
10756 The default value is 10.
10757
10758 @item sched-mem-true-dep-cost
10759 Minimal distance (in CPU cycles) between store and load targeting same
10760 memory locations. The default value is 1.
10761
10762 @item selsched-max-lookahead
10763 The maximum size of the lookahead window of selective scheduling. It is a
10764 depth of search for available instructions.
10765 The default value is 50.
10766
10767 @item selsched-max-sched-times
10768 The maximum number of times that an instruction is scheduled during
10769 selective scheduling. This is the limit on the number of iterations
10770 through which the instruction may be pipelined. The default value is 2.
10771
10772 @item selsched-max-insns-to-rename
10773 The maximum number of best instructions in the ready list that are considered
10774 for renaming in the selective scheduler. The default value is 2.
10775
10776 @item sms-min-sc
10777 The minimum value of stage count that swing modulo scheduler
10778 generates. The default value is 2.
10779
10780 @item max-last-value-rtl
10781 The maximum size measured as number of RTLs that can be recorded in an expression
10782 in combiner for a pseudo register as last known value of that register. The default
10783 is 10000.
10784
10785 @item max-combine-insns
10786 The maximum number of instructions the RTL combiner tries to combine.
10787 The default value is 2 at @option{-Og} and 4 otherwise.
10788
10789 @item integer-share-limit
10790 Small integer constants can use a shared data structure, reducing the
10791 compiler's memory usage and increasing its speed. This sets the maximum
10792 value of a shared integer constant. The default value is 256.
10793
10794 @item ssp-buffer-size
10795 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10796 protection when @option{-fstack-protection} is used.
10797
10798 @item min-size-for-stack-sharing
10799 The minimum size of variables taking part in stack slot sharing when not
10800 optimizing. The default value is 32.
10801
10802 @item max-jump-thread-duplication-stmts
10803 Maximum number of statements allowed in a block that needs to be
10804 duplicated when threading jumps.
10805
10806 @item max-fields-for-field-sensitive
10807 Maximum number of fields in a structure treated in
10808 a field sensitive manner during pointer analysis. The default is zero
10809 for @option{-O0} and @option{-O1},
10810 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10811
10812 @item prefetch-latency
10813 Estimate on average number of instructions that are executed before
10814 prefetch finishes. The distance prefetched ahead is proportional
10815 to this constant. Increasing this number may also lead to less
10816 streams being prefetched (see @option{simultaneous-prefetches}).
10817
10818 @item simultaneous-prefetches
10819 Maximum number of prefetches that can run at the same time.
10820
10821 @item l1-cache-line-size
10822 The size of cache line in L1 cache, in bytes.
10823
10824 @item l1-cache-size
10825 The size of L1 cache, in kilobytes.
10826
10827 @item l2-cache-size
10828 The size of L2 cache, in kilobytes.
10829
10830 @item min-insn-to-prefetch-ratio
10831 The minimum ratio between the number of instructions and the
10832 number of prefetches to enable prefetching in a loop.
10833
10834 @item prefetch-min-insn-to-mem-ratio
10835 The minimum ratio between the number of instructions and the
10836 number of memory references to enable prefetching in a loop.
10837
10838 @item use-canonical-types
10839 Whether the compiler should use the ``canonical'' type system. By
10840 default, this should always be 1, which uses a more efficient internal
10841 mechanism for comparing types in C++ and Objective-C++. However, if
10842 bugs in the canonical type system are causing compilation failures,
10843 set this value to 0 to disable canonical types.
10844
10845 @item switch-conversion-max-branch-ratio
10846 Switch initialization conversion refuses to create arrays that are
10847 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10848 branches in the switch.
10849
10850 @item max-partial-antic-length
10851 Maximum length of the partial antic set computed during the tree
10852 partial redundancy elimination optimization (@option{-ftree-pre}) when
10853 optimizing at @option{-O3} and above. For some sorts of source code
10854 the enhanced partial redundancy elimination optimization can run away,
10855 consuming all of the memory available on the host machine. This
10856 parameter sets a limit on the length of the sets that are computed,
10857 which prevents the runaway behavior. Setting a value of 0 for
10858 this parameter allows an unlimited set length.
10859
10860 @item sccvn-max-scc-size
10861 Maximum size of a strongly connected component (SCC) during SCCVN
10862 processing. If this limit is hit, SCCVN processing for the whole
10863 function is not done and optimizations depending on it are
10864 disabled. The default maximum SCC size is 10000.
10865
10866 @item sccvn-max-alias-queries-per-access
10867 Maximum number of alias-oracle queries we perform when looking for
10868 redundancies for loads and stores. If this limit is hit the search
10869 is aborted and the load or store is not considered redundant. The
10870 number of queries is algorithmically limited to the number of
10871 stores on all paths from the load to the function entry.
10872 The default maxmimum number of queries is 1000.
10873
10874 @item ira-max-loops-num
10875 IRA uses regional register allocation by default. If a function
10876 contains more loops than the number given by this parameter, only at most
10877 the given number of the most frequently-executed loops form regions
10878 for regional register allocation. The default value of the
10879 parameter is 100.
10880
10881 @item ira-max-conflict-table-size
10882 Although IRA uses a sophisticated algorithm to compress the conflict
10883 table, the table can still require excessive amounts of memory for
10884 huge functions. If the conflict table for a function could be more
10885 than the size in MB given by this parameter, the register allocator
10886 instead uses a faster, simpler, and lower-quality
10887 algorithm that does not require building a pseudo-register conflict table.
10888 The default value of the parameter is 2000.
10889
10890 @item ira-loop-reserved-regs
10891 IRA can be used to evaluate more accurate register pressure in loops
10892 for decisions to move loop invariants (see @option{-O3}). The number
10893 of available registers reserved for some other purposes is given
10894 by this parameter. The default value of the parameter is 2, which is
10895 the minimal number of registers needed by typical instructions.
10896 This value is the best found from numerous experiments.
10897
10898 @item lra-inheritance-ebb-probability-cutoff
10899 LRA tries to reuse values reloaded in registers in subsequent insns.
10900 This optimization is called inheritance. EBB is used as a region to
10901 do this optimization. The parameter defines a minimal fall-through
10902 edge probability in percentage used to add BB to inheritance EBB in
10903 LRA. The default value of the parameter is 40. The value was chosen
10904 from numerous runs of SPEC2000 on x86-64.
10905
10906 @item loop-invariant-max-bbs-in-loop
10907 Loop invariant motion can be very expensive, both in compilation time and
10908 in amount of needed compile-time memory, with very large loops. Loops
10909 with more basic blocks than this parameter won't have loop invariant
10910 motion optimization performed on them. The default value of the
10911 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10912
10913 @item loop-max-datarefs-for-datadeps
10914 Building data dapendencies is expensive for very large loops. This
10915 parameter limits the number of data references in loops that are
10916 considered for data dependence analysis. These large loops are no
10917 handled by the optimizations using loop data dependencies.
10918 The default value is 1000.
10919
10920 @item max-vartrack-size
10921 Sets a maximum number of hash table slots to use during variable
10922 tracking dataflow analysis of any function. If this limit is exceeded
10923 with variable tracking at assignments enabled, analysis for that
10924 function is retried without it, after removing all debug insns from
10925 the function. If the limit is exceeded even without debug insns, var
10926 tracking analysis is completely disabled for the function. Setting
10927 the parameter to zero makes it unlimited.
10928
10929 @item max-vartrack-expr-depth
10930 Sets a maximum number of recursion levels when attempting to map
10931 variable names or debug temporaries to value expressions. This trades
10932 compilation time for more complete debug information. If this is set too
10933 low, value expressions that are available and could be represented in
10934 debug information may end up not being used; setting this higher may
10935 enable the compiler to find more complex debug expressions, but compile
10936 time and memory use may grow. The default is 12.
10937
10938 @item min-nondebug-insn-uid
10939 Use uids starting at this parameter for nondebug insns. The range below
10940 the parameter is reserved exclusively for debug insns created by
10941 @option{-fvar-tracking-assignments}, but debug insns may get
10942 (non-overlapping) uids above it if the reserved range is exhausted.
10943
10944 @item ipa-sra-ptr-growth-factor
10945 IPA-SRA replaces a pointer to an aggregate with one or more new
10946 parameters only when their cumulative size is less or equal to
10947 @option{ipa-sra-ptr-growth-factor} times the size of the original
10948 pointer parameter.
10949
10950 @item sra-max-scalarization-size-Ospeed
10951 @item sra-max-scalarization-size-Osize
10952 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10953 replace scalar parts of aggregates with uses of independent scalar
10954 variables. These parameters control the maximum size, in storage units,
10955 of aggregate which is considered for replacement when compiling for
10956 speed
10957 (@option{sra-max-scalarization-size-Ospeed}) or size
10958 (@option{sra-max-scalarization-size-Osize}) respectively.
10959
10960 @item tm-max-aggregate-size
10961 When making copies of thread-local variables in a transaction, this
10962 parameter specifies the size in bytes after which variables are
10963 saved with the logging functions as opposed to save/restore code
10964 sequence pairs. This option only applies when using
10965 @option{-fgnu-tm}.
10966
10967 @item graphite-max-nb-scop-params
10968 To avoid exponential effects in the Graphite loop transforms, the
10969 number of parameters in a Static Control Part (SCoP) is bounded. The
10970 default value is 10 parameters. A variable whose value is unknown at
10971 compilation time and defined outside a SCoP is a parameter of the SCoP.
10972
10973 @item graphite-max-bbs-per-function
10974 To avoid exponential effects in the detection of SCoPs, the size of
10975 the functions analyzed by Graphite is bounded. The default value is
10976 100 basic blocks.
10977
10978 @item loop-block-tile-size
10979 Loop blocking or strip mining transforms, enabled with
10980 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10981 loop in the loop nest by a given number of iterations. The strip
10982 length can be changed using the @option{loop-block-tile-size}
10983 parameter. The default value is 51 iterations.
10984
10985 @item loop-unroll-jam-size
10986 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
10987 default value is 4.
10988
10989 @item loop-unroll-jam-depth
10990 Specify the dimension to be unrolled (counting from the most inner loop)
10991 for the @option{-floop-unroll-and-jam}. The default value is 2.
10992
10993 @item ipa-cp-value-list-size
10994 IPA-CP attempts to track all possible values and types passed to a function's
10995 parameter in order to propagate them and perform devirtualization.
10996 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10997 stores per one formal parameter of a function.
10998
10999 @item ipa-cp-eval-threshold
11000 IPA-CP calculates its own score of cloning profitability heuristics
11001 and performs those cloning opportunities with scores that exceed
11002 @option{ipa-cp-eval-threshold}.
11003
11004 @item ipa-cp-recursion-penalty
11005 Percentage penalty the recursive functions will receive when they
11006 are evaluated for cloning.
11007
11008 @item ipa-cp-single-call-penalty
11009 Percentage penalty functions containg a single call to another
11010 function will receive when they are evaluated for cloning.
11011
11012
11013 @item ipa-max-agg-items
11014 IPA-CP is also capable to propagate a number of scalar values passed
11015 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11016 number of such values per one parameter.
11017
11018 @item ipa-cp-loop-hint-bonus
11019 When IPA-CP determines that a cloning candidate would make the number
11020 of iterations of a loop known, it adds a bonus of
11021 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11022 the candidate.
11023
11024 @item ipa-cp-array-index-hint-bonus
11025 When IPA-CP determines that a cloning candidate would make the index of
11026 an array access known, it adds a bonus of
11027 @option{ipa-cp-array-index-hint-bonus} to the profitability
11028 score of the candidate.
11029
11030 @item ipa-max-aa-steps
11031 During its analysis of function bodies, IPA-CP employs alias analysis
11032 in order to track values pointed to by function parameters. In order
11033 not spend too much time analyzing huge functions, it gives up and
11034 consider all memory clobbered after examining
11035 @option{ipa-max-aa-steps} statements modifying memory.
11036
11037 @item lto-partitions
11038 Specify desired number of partitions produced during WHOPR compilation.
11039 The number of partitions should exceed the number of CPUs used for compilation.
11040 The default value is 32.
11041
11042 @item lto-minpartition
11043 Size of minimal partition for WHOPR (in estimated instructions).
11044 This prevents expenses of splitting very small programs into too many
11045 partitions.
11046
11047 @item cxx-max-namespaces-for-diagnostic-help
11048 The maximum number of namespaces to consult for suggestions when C++
11049 name lookup fails for an identifier. The default is 1000.
11050
11051 @item sink-frequency-threshold
11052 The maximum relative execution frequency (in percents) of the target block
11053 relative to a statement's original block to allow statement sinking of a
11054 statement. Larger numbers result in more aggressive statement sinking.
11055 The default value is 75. A small positive adjustment is applied for
11056 statements with memory operands as those are even more profitable so sink.
11057
11058 @item max-stores-to-sink
11059 The maximum number of conditional stores paires that can be sunk. Set to 0
11060 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11061 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
11062
11063 @item allow-store-data-races
11064 Allow optimizers to introduce new data races on stores.
11065 Set to 1 to allow, otherwise to 0. This option is enabled by default
11066 at optimization level @option{-Ofast}.
11067
11068 @item case-values-threshold
11069 The smallest number of different values for which it is best to use a
11070 jump-table instead of a tree of conditional branches. If the value is
11071 0, use the default for the machine. The default is 0.
11072
11073 @item tree-reassoc-width
11074 Set the maximum number of instructions executed in parallel in
11075 reassociated tree. This parameter overrides target dependent
11076 heuristics used by default if has non zero value.
11077
11078 @item sched-pressure-algorithm
11079 Choose between the two available implementations of
11080 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11081 and is the more likely to prevent instructions from being reordered.
11082 Algorithm 2 was designed to be a compromise between the relatively
11083 conservative approach taken by algorithm 1 and the rather aggressive
11084 approach taken by the default scheduler. It relies more heavily on
11085 having a regular register file and accurate register pressure classes.
11086 See @file{haifa-sched.c} in the GCC sources for more details.
11087
11088 The default choice depends on the target.
11089
11090 @item max-slsr-cand-scan
11091 Set the maximum number of existing candidates that are considered when
11092 seeking a basis for a new straight-line strength reduction candidate.
11093
11094 @item asan-globals
11095 Enable buffer overflow detection for global objects. This kind
11096 of protection is enabled by default if you are using
11097 @option{-fsanitize=address} option.
11098 To disable global objects protection use @option{--param asan-globals=0}.
11099
11100 @item asan-stack
11101 Enable buffer overflow detection for stack objects. This kind of
11102 protection is enabled by default when using @option{-fsanitize=address}.
11103 To disable stack protection use @option{--param asan-stack=0} option.
11104
11105 @item asan-instrument-reads
11106 Enable buffer overflow detection for memory reads. This kind of
11107 protection is enabled by default when using @option{-fsanitize=address}.
11108 To disable memory reads protection use
11109 @option{--param asan-instrument-reads=0}.
11110
11111 @item asan-instrument-writes
11112 Enable buffer overflow detection for memory writes. This kind of
11113 protection is enabled by default when using @option{-fsanitize=address}.
11114 To disable memory writes protection use
11115 @option{--param asan-instrument-writes=0} option.
11116
11117 @item asan-memintrin
11118 Enable detection for built-in functions. This kind of protection
11119 is enabled by default when using @option{-fsanitize=address}.
11120 To disable built-in functions protection use
11121 @option{--param asan-memintrin=0}.
11122
11123 @item asan-use-after-return
11124 Enable detection of use-after-return. This kind of protection
11125 is enabled by default when using @option{-fsanitize=address} option.
11126 To disable use-after-return detection use
11127 @option{--param asan-use-after-return=0}.
11128
11129 @item asan-instrumentation-with-call-threshold
11130 If number of memory accesses in function being instrumented
11131 is greater or equal to this number, use callbacks instead of inline checks.
11132 E.g. to disable inline code use
11133 @option{--param asan-instrumentation-with-call-threshold=0}.
11134
11135 @item chkp-max-ctor-size
11136 Static constructors generated by Pointer Bounds Checker may become very
11137 large and significantly increase compile time at optimization level
11138 @option{-O1} and higher. This parameter is a maximum nubmer of statements
11139 in a single generated constructor. Default value is 5000.
11140
11141 @item max-fsm-thread-path-insns
11142 Maximum number of instructions to copy when duplicating blocks on a
11143 finite state automaton jump thread path. The default is 100.
11144
11145 @item max-fsm-thread-length
11146 Maximum number of basic blocks on a finite state automaton jump thread
11147 path. The default is 10.
11148
11149 @item max-fsm-thread-paths
11150 Maximum number of new jump thread paths to create for a finite state
11151 automaton. The default is 50.
11152
11153 @item parloops-chunk-size
11154 Chunk size of omp schedule for loops parallelized by parloops. The default
11155 is 0.
11156
11157 @item parloops-schedule
11158 Schedule type of omp schedule for loops parallelized by parloops (static,
11159 dynamic, guided, auto, runtime). The default is static.
11160
11161 @item max-ssa-name-query-depth
11162 Maximum depth of recursion when querying properties of SSA names in things
11163 like fold routines. One level of recursion corresponds to following a
11164 use-def chain.
11165 @end table
11166 @end table
11167
11168 @node Preprocessor Options
11169 @section Options Controlling the Preprocessor
11170 @cindex preprocessor options
11171 @cindex options, preprocessor
11172
11173 These options control the C preprocessor, which is run on each C source
11174 file before actual compilation.
11175
11176 If you use the @option{-E} option, nothing is done except preprocessing.
11177 Some of these options make sense only together with @option{-E} because
11178 they cause the preprocessor output to be unsuitable for actual
11179 compilation.
11180
11181 @table @gcctabopt
11182 @item -Wp,@var{option}
11183 @opindex Wp
11184 You can use @option{-Wp,@var{option}} to bypass the compiler driver
11185 and pass @var{option} directly through to the preprocessor. If
11186 @var{option} contains commas, it is split into multiple options at the
11187 commas. However, many options are modified, translated or interpreted
11188 by the compiler driver before being passed to the preprocessor, and
11189 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
11190 interface is undocumented and subject to change, so whenever possible
11191 you should avoid using @option{-Wp} and let the driver handle the
11192 options instead.
11193
11194 @item -Xpreprocessor @var{option}
11195 @opindex Xpreprocessor
11196 Pass @var{option} as an option to the preprocessor. You can use this to
11197 supply system-specific preprocessor options that GCC does not
11198 recognize.
11199
11200 If you want to pass an option that takes an argument, you must use
11201 @option{-Xpreprocessor} twice, once for the option and once for the argument.
11202
11203 @item -no-integrated-cpp
11204 @opindex no-integrated-cpp
11205 Perform preprocessing as a separate pass before compilation.
11206 By default, GCC performs preprocessing as an integrated part of
11207 input tokenization and parsing.
11208 If this option is provided, the appropriate language front end
11209 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
11210 and Objective-C, respectively) is instead invoked twice,
11211 once for preprocessing only and once for actual compilation
11212 of the preprocessed input.
11213 This option may be useful in conjunction with the @option{-B} or
11214 @option{-wrapper} options to specify an alternate preprocessor or
11215 perform additional processing of the program source between
11216 normal preprocessing and compilation.
11217 @end table
11218
11219 @include cppopts.texi
11220
11221 @node Assembler Options
11222 @section Passing Options to the Assembler
11223
11224 @c prevent bad page break with this line
11225 You can pass options to the assembler.
11226
11227 @table @gcctabopt
11228 @item -Wa,@var{option}
11229 @opindex Wa
11230 Pass @var{option} as an option to the assembler. If @var{option}
11231 contains commas, it is split into multiple options at the commas.
11232
11233 @item -Xassembler @var{option}
11234 @opindex Xassembler
11235 Pass @var{option} as an option to the assembler. You can use this to
11236 supply system-specific assembler options that GCC does not
11237 recognize.
11238
11239 If you want to pass an option that takes an argument, you must use
11240 @option{-Xassembler} twice, once for the option and once for the argument.
11241
11242 @end table
11243
11244 @node Link Options
11245 @section Options for Linking
11246 @cindex link options
11247 @cindex options, linking
11248
11249 These options come into play when the compiler links object files into
11250 an executable output file. They are meaningless if the compiler is
11251 not doing a link step.
11252
11253 @table @gcctabopt
11254 @cindex file names
11255 @item @var{object-file-name}
11256 A file name that does not end in a special recognized suffix is
11257 considered to name an object file or library. (Object files are
11258 distinguished from libraries by the linker according to the file
11259 contents.) If linking is done, these object files are used as input
11260 to the linker.
11261
11262 @item -c
11263 @itemx -S
11264 @itemx -E
11265 @opindex c
11266 @opindex S
11267 @opindex E
11268 If any of these options is used, then the linker is not run, and
11269 object file names should not be used as arguments. @xref{Overall
11270 Options}.
11271
11272 @item -fuse-ld=bfd
11273 @opindex fuse-ld=bfd
11274 Use the @command{bfd} linker instead of the default linker.
11275
11276 @item -fuse-ld=gold
11277 @opindex fuse-ld=gold
11278 Use the @command{gold} linker instead of the default linker.
11279
11280 @cindex Libraries
11281 @item -l@var{library}
11282 @itemx -l @var{library}
11283 @opindex l
11284 Search the library named @var{library} when linking. (The second
11285 alternative with the library as a separate argument is only for
11286 POSIX compliance and is not recommended.)
11287
11288 It makes a difference where in the command you write this option; the
11289 linker searches and processes libraries and object files in the order they
11290 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
11291 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
11292 to functions in @samp{z}, those functions may not be loaded.
11293
11294 The linker searches a standard list of directories for the library,
11295 which is actually a file named @file{lib@var{library}.a}. The linker
11296 then uses this file as if it had been specified precisely by name.
11297
11298 The directories searched include several standard system directories
11299 plus any that you specify with @option{-L}.
11300
11301 Normally the files found this way are library files---archive files
11302 whose members are object files. The linker handles an archive file by
11303 scanning through it for members which define symbols that have so far
11304 been referenced but not defined. But if the file that is found is an
11305 ordinary object file, it is linked in the usual fashion. The only
11306 difference between using an @option{-l} option and specifying a file name
11307 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
11308 and searches several directories.
11309
11310 @item -lobjc
11311 @opindex lobjc
11312 You need this special case of the @option{-l} option in order to
11313 link an Objective-C or Objective-C++ program.
11314
11315 @item -nostartfiles
11316 @opindex nostartfiles
11317 Do not use the standard system startup files when linking.
11318 The standard system libraries are used normally, unless @option{-nostdlib}
11319 or @option{-nodefaultlibs} is used.
11320
11321 @item -nodefaultlibs
11322 @opindex nodefaultlibs
11323 Do not use the standard system libraries when linking.
11324 Only the libraries you specify are passed to the linker, and options
11325 specifying linkage of the system libraries, such as @option{-static-libgcc}
11326 or @option{-shared-libgcc}, are ignored.
11327 The standard startup files are used normally, unless @option{-nostartfiles}
11328 is used.
11329
11330 The compiler may generate calls to @code{memcmp},
11331 @code{memset}, @code{memcpy} and @code{memmove}.
11332 These entries are usually resolved by entries in
11333 libc. These entry points should be supplied through some other
11334 mechanism when this option is specified.
11335
11336 @item -nostdlib
11337 @opindex nostdlib
11338 Do not use the standard system startup files or libraries when linking.
11339 No startup files and only the libraries you specify are passed to
11340 the linker, and options specifying linkage of the system libraries, such as
11341 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
11342
11343 The compiler may generate calls to @code{memcmp}, @code{memset},
11344 @code{memcpy} and @code{memmove}.
11345 These entries are usually resolved by entries in
11346 libc. These entry points should be supplied through some other
11347 mechanism when this option is specified.
11348
11349 @cindex @option{-lgcc}, use with @option{-nostdlib}
11350 @cindex @option{-nostdlib} and unresolved references
11351 @cindex unresolved references and @option{-nostdlib}
11352 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
11353 @cindex @option{-nodefaultlibs} and unresolved references
11354 @cindex unresolved references and @option{-nodefaultlibs}
11355 One of the standard libraries bypassed by @option{-nostdlib} and
11356 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
11357 which GCC uses to overcome shortcomings of particular machines, or special
11358 needs for some languages.
11359 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
11360 Collection (GCC) Internals},
11361 for more discussion of @file{libgcc.a}.)
11362 In most cases, you need @file{libgcc.a} even when you want to avoid
11363 other standard libraries. In other words, when you specify @option{-nostdlib}
11364 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
11365 This ensures that you have no unresolved references to internal GCC
11366 library subroutines.
11367 (An example of such an internal subroutine is @code{__main}, used to ensure C++
11368 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
11369 GNU Compiler Collection (GCC) Internals}.)
11370
11371 @item -pie
11372 @opindex pie
11373 Produce a position independent executable on targets that support it.
11374 For predictable results, you must also specify the same set of options
11375 used for compilation (@option{-fpie}, @option{-fPIE},
11376 or model suboptions) when you specify this linker option.
11377
11378 @item -no-pie
11379 @opindex no-pie
11380 Don't produce a position independent executable.
11381
11382 @item -rdynamic
11383 @opindex rdynamic
11384 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
11385 that support it. This instructs the linker to add all symbols, not
11386 only used ones, to the dynamic symbol table. This option is needed
11387 for some uses of @code{dlopen} or to allow obtaining backtraces
11388 from within a program.
11389
11390 @item -s
11391 @opindex s
11392 Remove all symbol table and relocation information from the executable.
11393
11394 @item -static
11395 @opindex static
11396 On systems that support dynamic linking, this prevents linking with the shared
11397 libraries. On other systems, this option has no effect.
11398
11399 @item -shared
11400 @opindex shared
11401 Produce a shared object which can then be linked with other objects to
11402 form an executable. Not all systems support this option. For predictable
11403 results, you must also specify the same set of options used for compilation
11404 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
11405 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
11406 needs to build supplementary stub code for constructors to work. On
11407 multi-libbed systems, @samp{gcc -shared} must select the correct support
11408 libraries to link against. Failing to supply the correct flags may lead
11409 to subtle defects. Supplying them in cases where they are not necessary
11410 is innocuous.}
11411
11412 @item -shared-libgcc
11413 @itemx -static-libgcc
11414 @opindex shared-libgcc
11415 @opindex static-libgcc
11416 On systems that provide @file{libgcc} as a shared library, these options
11417 force the use of either the shared or static version, respectively.
11418 If no shared version of @file{libgcc} was built when the compiler was
11419 configured, these options have no effect.
11420
11421 There are several situations in which an application should use the
11422 shared @file{libgcc} instead of the static version. The most common
11423 of these is when the application wishes to throw and catch exceptions
11424 across different shared libraries. In that case, each of the libraries
11425 as well as the application itself should use the shared @file{libgcc}.
11426
11427 Therefore, the G++ and GCJ drivers automatically add
11428 @option{-shared-libgcc} whenever you build a shared library or a main
11429 executable, because C++ and Java programs typically use exceptions, so
11430 this is the right thing to do.
11431
11432 If, instead, you use the GCC driver to create shared libraries, you may
11433 find that they are not always linked with the shared @file{libgcc}.
11434 If GCC finds, at its configuration time, that you have a non-GNU linker
11435 or a GNU linker that does not support option @option{--eh-frame-hdr},
11436 it links the shared version of @file{libgcc} into shared libraries
11437 by default. Otherwise, it takes advantage of the linker and optimizes
11438 away the linking with the shared version of @file{libgcc}, linking with
11439 the static version of libgcc by default. This allows exceptions to
11440 propagate through such shared libraries, without incurring relocation
11441 costs at library load time.
11442
11443 However, if a library or main executable is supposed to throw or catch
11444 exceptions, you must link it using the G++ or GCJ driver, as appropriate
11445 for the languages used in the program, or using the option
11446 @option{-shared-libgcc}, such that it is linked with the shared
11447 @file{libgcc}.
11448
11449 @item -static-libasan
11450 @opindex static-libasan
11451 When the @option{-fsanitize=address} option is used to link a program,
11452 the GCC driver automatically links against @option{libasan}. If
11453 @file{libasan} is available as a shared library, and the @option{-static}
11454 option is not used, then this links against the shared version of
11455 @file{libasan}. The @option{-static-libasan} option directs the GCC
11456 driver to link @file{libasan} statically, without necessarily linking
11457 other libraries statically.
11458
11459 @item -static-libtsan
11460 @opindex static-libtsan
11461 When the @option{-fsanitize=thread} option is used to link a program,
11462 the GCC driver automatically links against @option{libtsan}. If
11463 @file{libtsan} is available as a shared library, and the @option{-static}
11464 option is not used, then this links against the shared version of
11465 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
11466 driver to link @file{libtsan} statically, without necessarily linking
11467 other libraries statically.
11468
11469 @item -static-liblsan
11470 @opindex static-liblsan
11471 When the @option{-fsanitize=leak} option is used to link a program,
11472 the GCC driver automatically links against @option{liblsan}. If
11473 @file{liblsan} is available as a shared library, and the @option{-static}
11474 option is not used, then this links against the shared version of
11475 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
11476 driver to link @file{liblsan} statically, without necessarily linking
11477 other libraries statically.
11478
11479 @item -static-libubsan
11480 @opindex static-libubsan
11481 When the @option{-fsanitize=undefined} option is used to link a program,
11482 the GCC driver automatically links against @option{libubsan}. If
11483 @file{libubsan} is available as a shared library, and the @option{-static}
11484 option is not used, then this links against the shared version of
11485 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
11486 driver to link @file{libubsan} statically, without necessarily linking
11487 other libraries statically.
11488
11489 @item -static-libmpx
11490 @opindex static-libmpx
11491 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
11492 used to link a program, the GCC driver automatically links against
11493 @file{libmpx}. If @file{libmpx} is available as a shared library,
11494 and the @option{-static} option is not used, then this links against
11495 the shared version of @file{libmpx}. The @option{-static-libmpx}
11496 option directs the GCC driver to link @file{libmpx} statically,
11497 without necessarily linking other libraries statically.
11498
11499 @item -static-libmpxwrappers
11500 @opindex static-libmpxwrappers
11501 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
11502 to link a program without also using @option{-fno-chkp-use-wrappers}, the
11503 GCC driver automatically links against @file{libmpxwrappers}. If
11504 @file{libmpxwrappers} is available as a shared library, and the
11505 @option{-static} option is not used, then this links against the shared
11506 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
11507 option directs the GCC driver to link @file{libmpxwrappers} statically,
11508 without necessarily linking other libraries statically.
11509
11510 @item -static-libstdc++
11511 @opindex static-libstdc++
11512 When the @command{g++} program is used to link a C++ program, it
11513 normally automatically links against @option{libstdc++}. If
11514 @file{libstdc++} is available as a shared library, and the
11515 @option{-static} option is not used, then this links against the
11516 shared version of @file{libstdc++}. That is normally fine. However, it
11517 is sometimes useful to freeze the version of @file{libstdc++} used by
11518 the program without going all the way to a fully static link. The
11519 @option{-static-libstdc++} option directs the @command{g++} driver to
11520 link @file{libstdc++} statically, without necessarily linking other
11521 libraries statically.
11522
11523 @item -symbolic
11524 @opindex symbolic
11525 Bind references to global symbols when building a shared object. Warn
11526 about any unresolved references (unless overridden by the link editor
11527 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
11528 this option.
11529
11530 @item -T @var{script}
11531 @opindex T
11532 @cindex linker script
11533 Use @var{script} as the linker script. This option is supported by most
11534 systems using the GNU linker. On some targets, such as bare-board
11535 targets without an operating system, the @option{-T} option may be required
11536 when linking to avoid references to undefined symbols.
11537
11538 @item -Xlinker @var{option}
11539 @opindex Xlinker
11540 Pass @var{option} as an option to the linker. You can use this to
11541 supply system-specific linker options that GCC does not recognize.
11542
11543 If you want to pass an option that takes a separate argument, you must use
11544 @option{-Xlinker} twice, once for the option and once for the argument.
11545 For example, to pass @option{-assert definitions}, you must write
11546 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
11547 @option{-Xlinker "-assert definitions"}, because this passes the entire
11548 string as a single argument, which is not what the linker expects.
11549
11550 When using the GNU linker, it is usually more convenient to pass
11551 arguments to linker options using the @option{@var{option}=@var{value}}
11552 syntax than as separate arguments. For example, you can specify
11553 @option{-Xlinker -Map=output.map} rather than
11554 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
11555 this syntax for command-line options.
11556
11557 @item -Wl,@var{option}
11558 @opindex Wl
11559 Pass @var{option} as an option to the linker. If @var{option} contains
11560 commas, it is split into multiple options at the commas. You can use this
11561 syntax to pass an argument to the option.
11562 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
11563 linker. When using the GNU linker, you can also get the same effect with
11564 @option{-Wl,-Map=output.map}.
11565
11566 @item -u @var{symbol}
11567 @opindex u
11568 Pretend the symbol @var{symbol} is undefined, to force linking of
11569 library modules to define it. You can use @option{-u} multiple times with
11570 different symbols to force loading of additional library modules.
11571
11572 @item -z @var{keyword}
11573 @opindex z
11574 @option{-z} is passed directly on to the linker along with the keyword
11575 @var{keyword}. See the section in the documentation of your linker for
11576 permitted values and their meanings.
11577 @end table
11578
11579 @node Directory Options
11580 @section Options for Directory Search
11581 @cindex directory options
11582 @cindex options, directory search
11583 @cindex search path
11584
11585 These options specify directories to search for header files, for
11586 libraries and for parts of the compiler:
11587
11588 @table @gcctabopt
11589 @item -I@var{dir}
11590 @opindex I
11591 Add the directory @var{dir} to the head of the list of directories to be
11592 searched for header files. This can be used to override a system header
11593 file, substituting your own version, since these directories are
11594 searched before the system header file directories. However, you should
11595 not use this option to add directories that contain vendor-supplied
11596 system header files (use @option{-isystem} for that). If you use more than
11597 one @option{-I} option, the directories are scanned in left-to-right
11598 order; the standard system directories come after.
11599
11600 If a standard system include directory, or a directory specified with
11601 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
11602 option is ignored. The directory is still searched but as a
11603 system directory at its normal position in the system include chain.
11604 This is to ensure that GCC's procedure to fix buggy system headers and
11605 the ordering for the @code{include_next} directive are not inadvertently changed.
11606 If you really need to change the search order for system directories,
11607 use the @option{-nostdinc} and/or @option{-isystem} options.
11608
11609 @item -iplugindir=@var{dir}
11610 @opindex iplugindir=
11611 Set the directory to search for plugins that are passed
11612 by @option{-fplugin=@var{name}} instead of
11613 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
11614 to be used by the user, but only passed by the driver.
11615
11616 @item -iquote@var{dir}
11617 @opindex iquote
11618 Add the directory @var{dir} to the head of the list of directories to
11619 be searched for header files only for the case of @code{#include
11620 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
11621 otherwise just like @option{-I}.
11622
11623 @item -L@var{dir}
11624 @opindex L
11625 Add directory @var{dir} to the list of directories to be searched
11626 for @option{-l}.
11627
11628 @item -B@var{prefix}
11629 @opindex B
11630 This option specifies where to find the executables, libraries,
11631 include files, and data files of the compiler itself.
11632
11633 The compiler driver program runs one or more of the subprograms
11634 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
11635 @var{prefix} as a prefix for each program it tries to run, both with and
11636 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
11637
11638 For each subprogram to be run, the compiler driver first tries the
11639 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
11640 is not specified, the driver tries two standard prefixes,
11641 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
11642 those results in a file name that is found, the unmodified program
11643 name is searched for using the directories specified in your
11644 @env{PATH} environment variable.
11645
11646 The compiler checks to see if the path provided by @option{-B}
11647 refers to a directory, and if necessary it adds a directory
11648 separator character at the end of the path.
11649
11650 @option{-B} prefixes that effectively specify directory names also apply
11651 to libraries in the linker, because the compiler translates these
11652 options into @option{-L} options for the linker. They also apply to
11653 include files in the preprocessor, because the compiler translates these
11654 options into @option{-isystem} options for the preprocessor. In this case,
11655 the compiler appends @samp{include} to the prefix.
11656
11657 The runtime support file @file{libgcc.a} can also be searched for using
11658 the @option{-B} prefix, if needed. If it is not found there, the two
11659 standard prefixes above are tried, and that is all. The file is left
11660 out of the link if it is not found by those means.
11661
11662 Another way to specify a prefix much like the @option{-B} prefix is to use
11663 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
11664 Variables}.
11665
11666 As a special kludge, if the path provided by @option{-B} is
11667 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
11668 9, then it is replaced by @file{[dir/]include}. This is to help
11669 with boot-strapping the compiler.
11670
11671 @item -specs=@var{file}
11672 @opindex specs
11673 Process @var{file} after the compiler reads in the standard @file{specs}
11674 file, in order to override the defaults which the @command{gcc} driver
11675 program uses when determining what switches to pass to @command{cc1},
11676 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
11677 @option{-specs=@var{file}} can be specified on the command line, and they
11678 are processed in order, from left to right.
11679
11680 @item --sysroot=@var{dir}
11681 @opindex sysroot
11682 Use @var{dir} as the logical root directory for headers and libraries.
11683 For example, if the compiler normally searches for headers in
11684 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
11685 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
11686
11687 If you use both this option and the @option{-isysroot} option, then
11688 the @option{--sysroot} option applies to libraries, but the
11689 @option{-isysroot} option applies to header files.
11690
11691 The GNU linker (beginning with version 2.16) has the necessary support
11692 for this option. If your linker does not support this option, the
11693 header file aspect of @option{--sysroot} still works, but the
11694 library aspect does not.
11695
11696 @item --no-sysroot-suffix
11697 @opindex no-sysroot-suffix
11698 For some targets, a suffix is added to the root directory specified
11699 with @option{--sysroot}, depending on the other options used, so that
11700 headers may for example be found in
11701 @file{@var{dir}/@var{suffix}/usr/include} instead of
11702 @file{@var{dir}/usr/include}. This option disables the addition of
11703 such a suffix.
11704
11705 @item -I-
11706 @opindex I-
11707 This option has been deprecated. Please use @option{-iquote} instead for
11708 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
11709 option.
11710 Any directories you specify with @option{-I} options before the @option{-I-}
11711 option are searched only for the case of @code{#include "@var{file}"};
11712 they are not searched for @code{#include <@var{file}>}.
11713
11714 If additional directories are specified with @option{-I} options after
11715 the @option{-I-} option, these directories are searched for all @code{#include}
11716 directives. (Ordinarily @emph{all} @option{-I} directories are used
11717 this way.)
11718
11719 In addition, the @option{-I-} option inhibits the use of the current
11720 directory (where the current input file came from) as the first search
11721 directory for @code{#include "@var{file}"}. There is no way to
11722 override this effect of @option{-I-}. With @option{-I.} you can specify
11723 searching the directory that is current when the compiler is
11724 invoked. That is not exactly the same as what the preprocessor does
11725 by default, but it is often satisfactory.
11726
11727 @option{-I-} does not inhibit the use of the standard system directories
11728 for header files. Thus, @option{-I-} and @option{-nostdinc} are
11729 independent.
11730 @end table
11731
11732 @c man end
11733
11734 @node Spec Files
11735 @section Specifying Subprocesses and the Switches to Pass to Them
11736 @cindex Spec Files
11737
11738 @command{gcc} is a driver program. It performs its job by invoking a
11739 sequence of other programs to do the work of compiling, assembling and
11740 linking. GCC interprets its command-line parameters and uses these to
11741 deduce which programs it should invoke, and which command-line options
11742 it ought to place on their command lines. This behavior is controlled
11743 by @dfn{spec strings}. In most cases there is one spec string for each
11744 program that GCC can invoke, but a few programs have multiple spec
11745 strings to control their behavior. The spec strings built into GCC can
11746 be overridden by using the @option{-specs=} command-line switch to specify
11747 a spec file.
11748
11749 @dfn{Spec files} are plaintext files that are used to construct spec
11750 strings. They consist of a sequence of directives separated by blank
11751 lines. The type of directive is determined by the first non-whitespace
11752 character on the line, which can be one of the following:
11753
11754 @table @code
11755 @item %@var{command}
11756 Issues a @var{command} to the spec file processor. The commands that can
11757 appear here are:
11758
11759 @table @code
11760 @item %include <@var{file}>
11761 @cindex @code{%include}
11762 Search for @var{file} and insert its text at the current point in the
11763 specs file.
11764
11765 @item %include_noerr <@var{file}>
11766 @cindex @code{%include_noerr}
11767 Just like @samp{%include}, but do not generate an error message if the include
11768 file cannot be found.
11769
11770 @item %rename @var{old_name} @var{new_name}
11771 @cindex @code{%rename}
11772 Rename the spec string @var{old_name} to @var{new_name}.
11773
11774 @end table
11775
11776 @item *[@var{spec_name}]:
11777 This tells the compiler to create, override or delete the named spec
11778 string. All lines after this directive up to the next directive or
11779 blank line are considered to be the text for the spec string. If this
11780 results in an empty string then the spec is deleted. (Or, if the
11781 spec did not exist, then nothing happens.) Otherwise, if the spec
11782 does not currently exist a new spec is created. If the spec does
11783 exist then its contents are overridden by the text of this
11784 directive, unless the first character of that text is the @samp{+}
11785 character, in which case the text is appended to the spec.
11786
11787 @item [@var{suffix}]:
11788 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
11789 and up to the next directive or blank line are considered to make up the
11790 spec string for the indicated suffix. When the compiler encounters an
11791 input file with the named suffix, it processes the spec string in
11792 order to work out how to compile that file. For example:
11793
11794 @smallexample
11795 .ZZ:
11796 z-compile -input %i
11797 @end smallexample
11798
11799 This says that any input file whose name ends in @samp{.ZZ} should be
11800 passed to the program @samp{z-compile}, which should be invoked with the
11801 command-line switch @option{-input} and with the result of performing the
11802 @samp{%i} substitution. (See below.)
11803
11804 As an alternative to providing a spec string, the text following a
11805 suffix directive can be one of the following:
11806
11807 @table @code
11808 @item @@@var{language}
11809 This says that the suffix is an alias for a known @var{language}. This is
11810 similar to using the @option{-x} command-line switch to GCC to specify a
11811 language explicitly. For example:
11812
11813 @smallexample
11814 .ZZ:
11815 @@c++
11816 @end smallexample
11817
11818 Says that .ZZ files are, in fact, C++ source files.
11819
11820 @item #@var{name}
11821 This causes an error messages saying:
11822
11823 @smallexample
11824 @var{name} compiler not installed on this system.
11825 @end smallexample
11826 @end table
11827
11828 GCC already has an extensive list of suffixes built into it.
11829 This directive adds an entry to the end of the list of suffixes, but
11830 since the list is searched from the end backwards, it is effectively
11831 possible to override earlier entries using this technique.
11832
11833 @end table
11834
11835 GCC has the following spec strings built into it. Spec files can
11836 override these strings or create their own. Note that individual
11837 targets can also add their own spec strings to this list.
11838
11839 @smallexample
11840 asm Options to pass to the assembler
11841 asm_final Options to pass to the assembler post-processor
11842 cpp Options to pass to the C preprocessor
11843 cc1 Options to pass to the C compiler
11844 cc1plus Options to pass to the C++ compiler
11845 endfile Object files to include at the end of the link
11846 link Options to pass to the linker
11847 lib Libraries to include on the command line to the linker
11848 libgcc Decides which GCC support library to pass to the linker
11849 linker Sets the name of the linker
11850 predefines Defines to be passed to the C preprocessor
11851 signed_char Defines to pass to CPP to say whether @code{char} is signed
11852 by default
11853 startfile Object files to include at the start of the link
11854 @end smallexample
11855
11856 Here is a small example of a spec file:
11857
11858 @smallexample
11859 %rename lib old_lib
11860
11861 *lib:
11862 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
11863 @end smallexample
11864
11865 This example renames the spec called @samp{lib} to @samp{old_lib} and
11866 then overrides the previous definition of @samp{lib} with a new one.
11867 The new definition adds in some extra command-line options before
11868 including the text of the old definition.
11869
11870 @dfn{Spec strings} are a list of command-line options to be passed to their
11871 corresponding program. In addition, the spec strings can contain
11872 @samp{%}-prefixed sequences to substitute variable text or to
11873 conditionally insert text into the command line. Using these constructs
11874 it is possible to generate quite complex command lines.
11875
11876 Here is a table of all defined @samp{%}-sequences for spec
11877 strings. Note that spaces are not generated automatically around the
11878 results of expanding these sequences. Therefore you can concatenate them
11879 together or combine them with constant text in a single argument.
11880
11881 @table @code
11882 @item %%
11883 Substitute one @samp{%} into the program name or argument.
11884
11885 @item %i
11886 Substitute the name of the input file being processed.
11887
11888 @item %b
11889 Substitute the basename of the input file being processed.
11890 This is the substring up to (and not including) the last period
11891 and not including the directory.
11892
11893 @item %B
11894 This is the same as @samp{%b}, but include the file suffix (text after
11895 the last period).
11896
11897 @item %d
11898 Marks the argument containing or following the @samp{%d} as a
11899 temporary file name, so that that file is deleted if GCC exits
11900 successfully. Unlike @samp{%g}, this contributes no text to the
11901 argument.
11902
11903 @item %g@var{suffix}
11904 Substitute a file name that has suffix @var{suffix} and is chosen
11905 once per compilation, and mark the argument in the same way as
11906 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
11907 name is now chosen in a way that is hard to predict even when previously
11908 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
11909 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
11910 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
11911 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
11912 was simply substituted with a file name chosen once per compilation,
11913 without regard to any appended suffix (which was therefore treated
11914 just like ordinary text), making such attacks more likely to succeed.
11915
11916 @item %u@var{suffix}
11917 Like @samp{%g}, but generates a new temporary file name
11918 each time it appears instead of once per compilation.
11919
11920 @item %U@var{suffix}
11921 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
11922 new one if there is no such last file name. In the absence of any
11923 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
11924 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
11925 involves the generation of two distinct file names, one
11926 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
11927 simply substituted with a file name chosen for the previous @samp{%u},
11928 without regard to any appended suffix.
11929
11930 @item %j@var{suffix}
11931 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
11932 writable, and if @option{-save-temps} is not used;
11933 otherwise, substitute the name
11934 of a temporary file, just like @samp{%u}. This temporary file is not
11935 meant for communication between processes, but rather as a junk
11936 disposal mechanism.
11937
11938 @item %|@var{suffix}
11939 @itemx %m@var{suffix}
11940 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
11941 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
11942 all. These are the two most common ways to instruct a program that it
11943 should read from standard input or write to standard output. If you
11944 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
11945 construct: see for example @file{f/lang-specs.h}.
11946
11947 @item %.@var{SUFFIX}
11948 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
11949 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
11950 terminated by the next space or %.
11951
11952 @item %w
11953 Marks the argument containing or following the @samp{%w} as the
11954 designated output file of this compilation. This puts the argument
11955 into the sequence of arguments that @samp{%o} substitutes.
11956
11957 @item %o
11958 Substitutes the names of all the output files, with spaces
11959 automatically placed around them. You should write spaces
11960 around the @samp{%o} as well or the results are undefined.
11961 @samp{%o} is for use in the specs for running the linker.
11962 Input files whose names have no recognized suffix are not compiled
11963 at all, but they are included among the output files, so they are
11964 linked.
11965
11966 @item %O
11967 Substitutes the suffix for object files. Note that this is
11968 handled specially when it immediately follows @samp{%g, %u, or %U},
11969 because of the need for those to form complete file names. The
11970 handling is such that @samp{%O} is treated exactly as if it had already
11971 been substituted, except that @samp{%g, %u, and %U} do not currently
11972 support additional @var{suffix} characters following @samp{%O} as they do
11973 following, for example, @samp{.o}.
11974
11975 @item %p
11976 Substitutes the standard macro predefinitions for the
11977 current target machine. Use this when running @command{cpp}.
11978
11979 @item %P
11980 Like @samp{%p}, but puts @samp{__} before and after the name of each
11981 predefined macro, except for macros that start with @samp{__} or with
11982 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
11983 C@.
11984
11985 @item %I
11986 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
11987 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
11988 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
11989 and @option{-imultilib} as necessary.
11990
11991 @item %s
11992 Current argument is the name of a library or startup file of some sort.
11993 Search for that file in a standard list of directories and substitute
11994 the full name found. The current working directory is included in the
11995 list of directories scanned.
11996
11997 @item %T
11998 Current argument is the name of a linker script. Search for that file
11999 in the current list of directories to scan for libraries. If the file
12000 is located insert a @option{--script} option into the command line
12001 followed by the full path name found. If the file is not found then
12002 generate an error message. Note: the current working directory is not
12003 searched.
12004
12005 @item %e@var{str}
12006 Print @var{str} as an error message. @var{str} is terminated by a newline.
12007 Use this when inconsistent options are detected.
12008
12009 @item %(@var{name})
12010 Substitute the contents of spec string @var{name} at this point.
12011
12012 @item %x@{@var{option}@}
12013 Accumulate an option for @samp{%X}.
12014
12015 @item %X
12016 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
12017 spec string.
12018
12019 @item %Y
12020 Output the accumulated assembler options specified by @option{-Wa}.
12021
12022 @item %Z
12023 Output the accumulated preprocessor options specified by @option{-Wp}.
12024
12025 @item %a
12026 Process the @code{asm} spec. This is used to compute the
12027 switches to be passed to the assembler.
12028
12029 @item %A
12030 Process the @code{asm_final} spec. This is a spec string for
12031 passing switches to an assembler post-processor, if such a program is
12032 needed.
12033
12034 @item %l
12035 Process the @code{link} spec. This is the spec for computing the
12036 command line passed to the linker. Typically it makes use of the
12037 @samp{%L %G %S %D and %E} sequences.
12038
12039 @item %D
12040 Dump out a @option{-L} option for each directory that GCC believes might
12041 contain startup files. If the target supports multilibs then the
12042 current multilib directory is prepended to each of these paths.
12043
12044 @item %L
12045 Process the @code{lib} spec. This is a spec string for deciding which
12046 libraries are included on the command line to the linker.
12047
12048 @item %G
12049 Process the @code{libgcc} spec. This is a spec string for deciding
12050 which GCC support library is included on the command line to the linker.
12051
12052 @item %S
12053 Process the @code{startfile} spec. This is a spec for deciding which
12054 object files are the first ones passed to the linker. Typically
12055 this might be a file named @file{crt0.o}.
12056
12057 @item %E
12058 Process the @code{endfile} spec. This is a spec string that specifies
12059 the last object files that are passed to the linker.
12060
12061 @item %C
12062 Process the @code{cpp} spec. This is used to construct the arguments
12063 to be passed to the C preprocessor.
12064
12065 @item %1
12066 Process the @code{cc1} spec. This is used to construct the options to be
12067 passed to the actual C compiler (@command{cc1}).
12068
12069 @item %2
12070 Process the @code{cc1plus} spec. This is used to construct the options to be
12071 passed to the actual C++ compiler (@command{cc1plus}).
12072
12073 @item %*
12074 Substitute the variable part of a matched option. See below.
12075 Note that each comma in the substituted string is replaced by
12076 a single space.
12077
12078 @item %<@code{S}
12079 Remove all occurrences of @code{-S} from the command line. Note---this
12080 command is position dependent. @samp{%} commands in the spec string
12081 before this one see @code{-S}, @samp{%} commands in the spec string
12082 after this one do not.
12083
12084 @item %:@var{function}(@var{args})
12085 Call the named function @var{function}, passing it @var{args}.
12086 @var{args} is first processed as a nested spec string, then split
12087 into an argument vector in the usual fashion. The function returns
12088 a string which is processed as if it had appeared literally as part
12089 of the current spec.
12090
12091 The following built-in spec functions are provided:
12092
12093 @table @code
12094 @item @code{getenv}
12095 The @code{getenv} spec function takes two arguments: an environment
12096 variable name and a string. If the environment variable is not
12097 defined, a fatal error is issued. Otherwise, the return value is the
12098 value of the environment variable concatenated with the string. For
12099 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
12100
12101 @smallexample
12102 %:getenv(TOPDIR /include)
12103 @end smallexample
12104
12105 expands to @file{/path/to/top/include}.
12106
12107 @item @code{if-exists}
12108 The @code{if-exists} spec function takes one argument, an absolute
12109 pathname to a file. If the file exists, @code{if-exists} returns the
12110 pathname. Here is a small example of its usage:
12111
12112 @smallexample
12113 *startfile:
12114 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
12115 @end smallexample
12116
12117 @item @code{if-exists-else}
12118 The @code{if-exists-else} spec function is similar to the @code{if-exists}
12119 spec function, except that it takes two arguments. The first argument is
12120 an absolute pathname to a file. If the file exists, @code{if-exists-else}
12121 returns the pathname. If it does not exist, it returns the second argument.
12122 This way, @code{if-exists-else} can be used to select one file or another,
12123 based on the existence of the first. Here is a small example of its usage:
12124
12125 @smallexample
12126 *startfile:
12127 crt0%O%s %:if-exists(crti%O%s) \
12128 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
12129 @end smallexample
12130
12131 @item @code{replace-outfile}
12132 The @code{replace-outfile} spec function takes two arguments. It looks for the
12133 first argument in the outfiles array and replaces it with the second argument. Here
12134 is a small example of its usage:
12135
12136 @smallexample
12137 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
12138 @end smallexample
12139
12140 @item @code{remove-outfile}
12141 The @code{remove-outfile} spec function takes one argument. It looks for the
12142 first argument in the outfiles array and removes it. Here is a small example
12143 its usage:
12144
12145 @smallexample
12146 %:remove-outfile(-lm)
12147 @end smallexample
12148
12149 @item @code{pass-through-libs}
12150 The @code{pass-through-libs} spec function takes any number of arguments. It
12151 finds any @option{-l} options and any non-options ending in @file{.a} (which it
12152 assumes are the names of linker input library archive files) and returns a
12153 result containing all the found arguments each prepended by
12154 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
12155 intended to be passed to the LTO linker plugin.
12156
12157 @smallexample
12158 %:pass-through-libs(%G %L %G)
12159 @end smallexample
12160
12161 @item @code{print-asm-header}
12162 The @code{print-asm-header} function takes no arguments and simply
12163 prints a banner like:
12164
12165 @smallexample
12166 Assembler options
12167 =================
12168
12169 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
12170 @end smallexample
12171
12172 It is used to separate compiler options from assembler options
12173 in the @option{--target-help} output.
12174 @end table
12175
12176 @item %@{@code{S}@}
12177 Substitutes the @code{-S} switch, if that switch is given to GCC@.
12178 If that switch is not specified, this substitutes nothing. Note that
12179 the leading dash is omitted when specifying this option, and it is
12180 automatically inserted if the substitution is performed. Thus the spec
12181 string @samp{%@{foo@}} matches the command-line option @option{-foo}
12182 and outputs the command-line option @option{-foo}.
12183
12184 @item %W@{@code{S}@}
12185 Like %@{@code{S}@} but mark last argument supplied within as a file to be
12186 deleted on failure.
12187
12188 @item %@{@code{S}*@}
12189 Substitutes all the switches specified to GCC whose names start
12190 with @code{-S}, but which also take an argument. This is used for
12191 switches like @option{-o}, @option{-D}, @option{-I}, etc.
12192 GCC considers @option{-o foo} as being
12193 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
12194 text, including the space. Thus two arguments are generated.
12195
12196 @item %@{@code{S}*&@code{T}*@}
12197 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
12198 (the order of @code{S} and @code{T} in the spec is not significant).
12199 There can be any number of ampersand-separated variables; for each the
12200 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
12201
12202 @item %@{@code{S}:@code{X}@}
12203 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
12204
12205 @item %@{!@code{S}:@code{X}@}
12206 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
12207
12208 @item %@{@code{S}*:@code{X}@}
12209 Substitutes @code{X} if one or more switches whose names start with
12210 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
12211 once, no matter how many such switches appeared. However, if @code{%*}
12212 appears somewhere in @code{X}, then @code{X} is substituted once
12213 for each matching switch, with the @code{%*} replaced by the part of
12214 that switch matching the @code{*}.
12215
12216 If @code{%*} appears as the last part of a spec sequence then a space
12217 is added after the end of the last substitution. If there is more
12218 text in the sequence, however, then a space is not generated. This
12219 allows the @code{%*} substitution to be used as part of a larger
12220 string. For example, a spec string like this:
12221
12222 @smallexample
12223 %@{mcu=*:--script=%*/memory.ld@}
12224 @end smallexample
12225
12226 @noindent
12227 when matching an option like @option{-mcu=newchip} produces:
12228
12229 @smallexample
12230 --script=newchip/memory.ld
12231 @end smallexample
12232
12233 @item %@{.@code{S}:@code{X}@}
12234 Substitutes @code{X}, if processing a file with suffix @code{S}.
12235
12236 @item %@{!.@code{S}:@code{X}@}
12237 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
12238
12239 @item %@{,@code{S}:@code{X}@}
12240 Substitutes @code{X}, if processing a file for language @code{S}.
12241
12242 @item %@{!,@code{S}:@code{X}@}
12243 Substitutes @code{X}, if not processing a file for language @code{S}.
12244
12245 @item %@{@code{S}|@code{P}:@code{X}@}
12246 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
12247 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
12248 @code{*} sequences as well, although they have a stronger binding than
12249 the @samp{|}. If @code{%*} appears in @code{X}, all of the
12250 alternatives must be starred, and only the first matching alternative
12251 is substituted.
12252
12253 For example, a spec string like this:
12254
12255 @smallexample
12256 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
12257 @end smallexample
12258
12259 @noindent
12260 outputs the following command-line options from the following input
12261 command-line options:
12262
12263 @smallexample
12264 fred.c -foo -baz
12265 jim.d -bar -boggle
12266 -d fred.c -foo -baz -boggle
12267 -d jim.d -bar -baz -boggle
12268 @end smallexample
12269
12270 @item %@{S:X; T:Y; :D@}
12271
12272 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
12273 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
12274 be as many clauses as you need. This may be combined with @code{.},
12275 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
12276
12277
12278 @end table
12279
12280 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
12281 construct may contain other nested @samp{%} constructs or spaces, or
12282 even newlines. They are processed as usual, as described above.
12283 Trailing white space in @code{X} is ignored. White space may also
12284 appear anywhere on the left side of the colon in these constructs,
12285 except between @code{.} or @code{*} and the corresponding word.
12286
12287 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
12288 handled specifically in these constructs. If another value of
12289 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
12290 @option{-W} switch is found later in the command line, the earlier
12291 switch value is ignored, except with @{@code{S}*@} where @code{S} is
12292 just one letter, which passes all matching options.
12293
12294 The character @samp{|} at the beginning of the predicate text is used to
12295 indicate that a command should be piped to the following command, but
12296 only if @option{-pipe} is specified.
12297
12298 It is built into GCC which switches take arguments and which do not.
12299 (You might think it would be useful to generalize this to allow each
12300 compiler's spec to say which switches take arguments. But this cannot
12301 be done in a consistent fashion. GCC cannot even decide which input
12302 files have been specified without knowing which switches take arguments,
12303 and it must know which input files to compile in order to tell which
12304 compilers to run).
12305
12306 GCC also knows implicitly that arguments starting in @option{-l} are to be
12307 treated as compiler output files, and passed to the linker in their
12308 proper position among the other output files.
12309
12310 @c man begin OPTIONS
12311
12312 @node Target Options
12313 @section Specifying Target Machine and Compiler Version
12314 @cindex target options
12315 @cindex cross compiling
12316 @cindex specifying machine version
12317 @cindex specifying compiler version and target machine
12318 @cindex compiler version, specifying
12319 @cindex target machine, specifying
12320
12321 The usual way to run GCC is to run the executable called @command{gcc}, or
12322 @command{@var{machine}-gcc} when cross-compiling, or
12323 @command{@var{machine}-gcc-@var{version}} to run a version other than the
12324 one that was installed last.
12325
12326 @node Submodel Options
12327 @section Hardware Models and Configurations
12328 @cindex submodel options
12329 @cindex specifying hardware config
12330 @cindex hardware models and configurations, specifying
12331 @cindex machine dependent options
12332
12333 Each target machine types can have its own
12334 special options, starting with @samp{-m}, to choose among various
12335 hardware models or configurations---for example, 68010 vs 68020,
12336 floating coprocessor or none. A single installed version of the
12337 compiler can compile for any model or configuration, according to the
12338 options specified.
12339
12340 Some configurations of the compiler also support additional special
12341 options, usually for compatibility with other compilers on the same
12342 platform.
12343
12344 @c This list is ordered alphanumerically by subsection name.
12345 @c It should be the same order and spelling as these options are listed
12346 @c in Machine Dependent Options
12347
12348 @menu
12349 * AArch64 Options::
12350 * Adapteva Epiphany Options::
12351 * ARC Options::
12352 * ARM Options::
12353 * AVR Options::
12354 * Blackfin Options::
12355 * C6X Options::
12356 * CRIS Options::
12357 * CR16 Options::
12358 * Darwin Options::
12359 * DEC Alpha Options::
12360 * FR30 Options::
12361 * FT32 Options::
12362 * FRV Options::
12363 * GNU/Linux Options::
12364 * H8/300 Options::
12365 * HPPA Options::
12366 * IA-64 Options::
12367 * LM32 Options::
12368 * M32C Options::
12369 * M32R/D Options::
12370 * M680x0 Options::
12371 * MCore Options::
12372 * MeP Options::
12373 * MicroBlaze Options::
12374 * MIPS Options::
12375 * MMIX Options::
12376 * MN10300 Options::
12377 * Moxie Options::
12378 * MSP430 Options::
12379 * NDS32 Options::
12380 * Nios II Options::
12381 * Nvidia PTX Options::
12382 * PDP-11 Options::
12383 * picoChip Options::
12384 * PowerPC Options::
12385 * RL78 Options::
12386 * RS/6000 and PowerPC Options::
12387 * RX Options::
12388 * S/390 and zSeries Options::
12389 * Score Options::
12390 * SH Options::
12391 * Solaris 2 Options::
12392 * SPARC Options::
12393 * SPU Options::
12394 * System V Options::
12395 * TILE-Gx Options::
12396 * TILEPro Options::
12397 * V850 Options::
12398 * VAX Options::
12399 * Visium Options::
12400 * VMS Options::
12401 * VxWorks Options::
12402 * x86 Options::
12403 * x86 Windows Options::
12404 * Xstormy16 Options::
12405 * Xtensa Options::
12406 * zSeries Options::
12407 @end menu
12408
12409 @node AArch64 Options
12410 @subsection AArch64 Options
12411 @cindex AArch64 Options
12412
12413 These options are defined for AArch64 implementations:
12414
12415 @table @gcctabopt
12416
12417 @item -mabi=@var{name}
12418 @opindex mabi
12419 Generate code for the specified data model. Permissible values
12420 are @samp{ilp32} for SysV-like data model where int, long int and pointer
12421 are 32-bit, and @samp{lp64} for SysV-like data model where int is 32-bit,
12422 but long int and pointer are 64-bit.
12423
12424 The default depends on the specific target configuration. Note that
12425 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
12426 entire program with the same ABI, and link with a compatible set of libraries.
12427
12428 @item -mbig-endian
12429 @opindex mbig-endian
12430 Generate big-endian code. This is the default when GCC is configured for an
12431 @samp{aarch64_be-*-*} target.
12432
12433 @item -mgeneral-regs-only
12434 @opindex mgeneral-regs-only
12435 Generate code which uses only the general-purpose registers. This is equivalent
12436 to feature modifier @option{nofp} of @option{-march} or @option{-mcpu}, except
12437 that @option{-mgeneral-regs-only} takes precedence over any conflicting feature
12438 modifier regardless of sequence.
12439
12440 @item -mlittle-endian
12441 @opindex mlittle-endian
12442 Generate little-endian code. This is the default when GCC is configured for an
12443 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
12444
12445 @item -mcmodel=tiny
12446 @opindex mcmodel=tiny
12447 Generate code for the tiny code model. The program and its statically defined
12448 symbols must be within 1GB of each other. Pointers are 64 bits. Programs can
12449 be statically or dynamically linked. This model is not fully implemented and
12450 mostly treated as @samp{small}.
12451
12452 @item -mcmodel=small
12453 @opindex mcmodel=small
12454 Generate code for the small code model. The program and its statically defined
12455 symbols must be within 4GB of each other. Pointers are 64 bits. Programs can
12456 be statically or dynamically linked. This is the default code model.
12457
12458 @item -mcmodel=large
12459 @opindex mcmodel=large
12460 Generate code for the large code model. This makes no assumptions about
12461 addresses and sizes of sections. Pointers are 64 bits. Programs can be
12462 statically linked only.
12463
12464 @item -mstrict-align
12465 @opindex mstrict-align
12466 Do not assume that unaligned memory references are handled by the system.
12467
12468 @item -momit-leaf-frame-pointer
12469 @itemx -mno-omit-leaf-frame-pointer
12470 @opindex momit-leaf-frame-pointer
12471 @opindex mno-omit-leaf-frame-pointer
12472 Omit or keep the frame pointer in leaf functions. The former behaviour is the
12473 default.
12474
12475 @item -mtls-dialect=desc
12476 @opindex mtls-dialect=desc
12477 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
12478 of TLS variables. This is the default.
12479
12480 @item -mtls-dialect=traditional
12481 @opindex mtls-dialect=traditional
12482 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
12483 of TLS variables.
12484
12485 @item -mtls-size=@var{size}
12486 @opindex mtls-size
12487 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
12488 This option depends on binutils higher than 2.25.
12489
12490 @item -mfix-cortex-a53-835769
12491 @itemx -mno-fix-cortex-a53-835769
12492 @opindex mfix-cortex-a53-835769
12493 @opindex mno-fix-cortex-a53-835769
12494 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
12495 This involves inserting a NOP instruction between memory instructions and
12496 64-bit integer multiply-accumulate instructions.
12497
12498 @item -mfix-cortex-a53-843419
12499 @itemx -mno-fix-cortex-a53-843419
12500 @opindex mfix-cortex-a53-843419
12501 @opindex mno-fix-cortex-a53-843419
12502 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
12503 This erratum workaround is made at link time and this will only pass the
12504 corresponding flag to the linker.
12505
12506 @item -march=@var{name}
12507 @opindex march
12508 Specify the name of the target architecture, optionally suffixed by one or
12509 more feature modifiers. This option has the form
12510 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
12511
12512 The permissible values for @var{arch} are @samp{armv8-a} or
12513 @samp{armv8.1-a}.
12514
12515 For the permissible values for @var{feature}, see the sub-section on
12516 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
12517 Feature Modifiers}. Where conflicting feature modifiers are
12518 specified, the right-most feature is used.
12519
12520 Additionally on native AArch64 GNU/Linux systems the value
12521 @samp{native} is available. This option causes the compiler to pick the
12522 architecture of the host system. If the compiler is unable to recognize the
12523 architecture of the host system this option has no effect.
12524
12525 GCC uses @var{name} to determine what kind of instructions it can emit
12526 when generating assembly code. If @option{-march} is specified
12527 without either of @option{-mtune} or @option{-mcpu} also being
12528 specified, the code is tuned to perform well across a range of target
12529 processors implementing the target architecture.
12530
12531 @item -mtune=@var{name}
12532 @opindex mtune
12533 Specify the name of the target processor for which GCC should tune the
12534 performance of the code. Permissible values for this option are:
12535 @samp{generic}, @samp{cortex-a53}, @samp{cortex-a57}, @samp{cortex-a72},
12536 @samp{exynos-m1}, @samp{thunderx}, @samp{xgene1}.
12537
12538 Additionally, this option can specify that GCC should tune the performance
12539 of the code for a big.LITTLE system. Permissible values for this
12540 option are: @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}.
12541
12542 Additionally on native AArch64 GNU/Linux systems the value
12543 @samp{native} is available. This option causes the compiler to pick
12544 the architecture of and tune the performance of the code for the
12545 processor of the host system. If the compiler is unable to recognize
12546 the processor of the host system this option has no effect.
12547
12548 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
12549 are specified, the code is tuned to perform well across a range
12550 of target processors.
12551
12552 This option cannot be suffixed by feature modifiers.
12553
12554 @item -mcpu=@var{name}
12555 @opindex mcpu
12556 Specify the name of the target processor, optionally suffixed by one
12557 or more feature modifiers. This option has the form
12558 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
12559 the permissible values for @var{cpu} are the same as those available
12560 for @option{-mtune}. The permissible values for @var{feature} are
12561 documented in the sub-section on
12562 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
12563 Feature Modifiers}. Where conflicting feature modifiers are
12564 specified, the right-most feature is used.
12565
12566 Additionally on native AArch64 GNU/Linux systems the value
12567 @samp{native} is available. This option causes the compiler to tune
12568 the performance of the code for the processor of the host system. If
12569 the compiler is unable to recognize the processor of the host system
12570 this option has no effect.
12571
12572 GCC uses @var{name} to determine what kind of instructions it can emit when
12573 generating assembly code (as if by @option{-march}) and to determine
12574 the target processor for which to tune for performance (as if
12575 by @option{-mtune}). Where this option is used in conjunction
12576 with @option{-march} or @option{-mtune}, those options take precedence
12577 over the appropriate part of this option.
12578
12579 @item -moverride=@var{string}
12580 @opindex moverride
12581 Override tuning decisions made by the back-end in response to a
12582 @option{-mtune=} switch. The syntax, semantics, and accepted values
12583 for @var{string} in this option are not guaranteed to be consistent
12584 across releases.
12585
12586 This option is only intended to be useful when developing GCC.
12587
12588 @item -mpc-relative-literal-loads
12589 @opindex mpcrelativeliteralloads
12590 Enable PC relative literal loads. If this option is used, literal
12591 pools are assumed to have a range of up to 1MiB and an appropriate
12592 instruction sequence is used. This option has no impact when used
12593 with @option{-mcmodel=tiny}.
12594
12595 @end table
12596
12597 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
12598 @anchor{aarch64-feature-modifiers}
12599 @cindex @option{-march} feature modifiers
12600 @cindex @option{-mcpu} feature modifiers
12601 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
12602 the following and their inverses @option{no@var{feature}}:
12603
12604 @table @samp
12605 @item crc
12606 Enable CRC extension.
12607 @item crypto
12608 Enable Crypto extension. This also enables Advanced SIMD and floating-point
12609 instructions.
12610 @item fp
12611 Enable floating-point instructions. This is on by default for all possible
12612 values for options @option{-march} and @option{-mcpu}.
12613 @item simd
12614 Enable Advanced SIMD instructions. This also enables floating-point
12615 instructions. This is on by default for all possible values for options
12616 @option{-march} and @option{-mcpu}.
12617 @item lse
12618 Enable Large System Extension instructions.
12619 @item pan
12620 Enable Privileged Access Never support.
12621 @item lor
12622 Enable Limited Ordering Regions support.
12623 @item rdma
12624 Enable ARMv8.1 Advanced SIMD instructions. This implies Advanced SIMD
12625 is enabled.
12626
12627 @end table
12628
12629 That is, @option{crypto} implies @option{simd} implies @option{fp}.
12630 Conversely, @option{nofp} (or equivalently, @option{-mgeneral-regs-only})
12631 implies @option{nosimd} implies @option{nocrypto}.
12632
12633 @node Adapteva Epiphany Options
12634 @subsection Adapteva Epiphany Options
12635
12636 These @samp{-m} options are defined for Adapteva Epiphany:
12637
12638 @table @gcctabopt
12639 @item -mhalf-reg-file
12640 @opindex mhalf-reg-file
12641 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
12642 That allows code to run on hardware variants that lack these registers.
12643
12644 @item -mprefer-short-insn-regs
12645 @opindex mprefer-short-insn-regs
12646 Preferrentially allocate registers that allow short instruction generation.
12647 This can result in increased instruction count, so this may either reduce or
12648 increase overall code size.
12649
12650 @item -mbranch-cost=@var{num}
12651 @opindex mbranch-cost
12652 Set the cost of branches to roughly @var{num} ``simple'' instructions.
12653 This cost is only a heuristic and is not guaranteed to produce
12654 consistent results across releases.
12655
12656 @item -mcmove
12657 @opindex mcmove
12658 Enable the generation of conditional moves.
12659
12660 @item -mnops=@var{num}
12661 @opindex mnops
12662 Emit @var{num} NOPs before every other generated instruction.
12663
12664 @item -mno-soft-cmpsf
12665 @opindex mno-soft-cmpsf
12666 For single-precision floating-point comparisons, emit an @code{fsub} instruction
12667 and test the flags. This is faster than a software comparison, but can
12668 get incorrect results in the presence of NaNs, or when two different small
12669 numbers are compared such that their difference is calculated as zero.
12670 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
12671 software comparisons.
12672
12673 @item -mstack-offset=@var{num}
12674 @opindex mstack-offset
12675 Set the offset between the top of the stack and the stack pointer.
12676 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
12677 can be used by leaf functions without stack allocation.
12678 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
12679 Note also that this option changes the ABI; compiling a program with a
12680 different stack offset than the libraries have been compiled with
12681 generally does not work.
12682 This option can be useful if you want to evaluate if a different stack
12683 offset would give you better code, but to actually use a different stack
12684 offset to build working programs, it is recommended to configure the
12685 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
12686
12687 @item -mno-round-nearest
12688 @opindex mno-round-nearest
12689 Make the scheduler assume that the rounding mode has been set to
12690 truncating. The default is @option{-mround-nearest}.
12691
12692 @item -mlong-calls
12693 @opindex mlong-calls
12694 If not otherwise specified by an attribute, assume all calls might be beyond
12695 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
12696 function address into a register before performing a (otherwise direct) call.
12697 This is the default.
12698
12699 @item -mshort-calls
12700 @opindex short-calls
12701 If not otherwise specified by an attribute, assume all direct calls are
12702 in the range of the @code{b} / @code{bl} instructions, so use these instructions
12703 for direct calls. The default is @option{-mlong-calls}.
12704
12705 @item -msmall16
12706 @opindex msmall16
12707 Assume addresses can be loaded as 16-bit unsigned values. This does not
12708 apply to function addresses for which @option{-mlong-calls} semantics
12709 are in effect.
12710
12711 @item -mfp-mode=@var{mode}
12712 @opindex mfp-mode
12713 Set the prevailing mode of the floating-point unit.
12714 This determines the floating-point mode that is provided and expected
12715 at function call and return time. Making this mode match the mode you
12716 predominantly need at function start can make your programs smaller and
12717 faster by avoiding unnecessary mode switches.
12718
12719 @var{mode} can be set to one the following values:
12720
12721 @table @samp
12722 @item caller
12723 Any mode at function entry is valid, and retained or restored when
12724 the function returns, and when it calls other functions.
12725 This mode is useful for compiling libraries or other compilation units
12726 you might want to incorporate into different programs with different
12727 prevailing FPU modes, and the convenience of being able to use a single
12728 object file outweighs the size and speed overhead for any extra
12729 mode switching that might be needed, compared with what would be needed
12730 with a more specific choice of prevailing FPU mode.
12731
12732 @item truncate
12733 This is the mode used for floating-point calculations with
12734 truncating (i.e.@: round towards zero) rounding mode. That includes
12735 conversion from floating point to integer.
12736
12737 @item round-nearest
12738 This is the mode used for floating-point calculations with
12739 round-to-nearest-or-even rounding mode.
12740
12741 @item int
12742 This is the mode used to perform integer calculations in the FPU, e.g.@:
12743 integer multiply, or integer multiply-and-accumulate.
12744 @end table
12745
12746 The default is @option{-mfp-mode=caller}
12747
12748 @item -mnosplit-lohi
12749 @itemx -mno-postinc
12750 @itemx -mno-postmodify
12751 @opindex mnosplit-lohi
12752 @opindex mno-postinc
12753 @opindex mno-postmodify
12754 Code generation tweaks that disable, respectively, splitting of 32-bit
12755 loads, generation of post-increment addresses, and generation of
12756 post-modify addresses. The defaults are @option{msplit-lohi},
12757 @option{-mpost-inc}, and @option{-mpost-modify}.
12758
12759 @item -mnovect-double
12760 @opindex mno-vect-double
12761 Change the preferred SIMD mode to SImode. The default is
12762 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
12763
12764 @item -max-vect-align=@var{num}
12765 @opindex max-vect-align
12766 The maximum alignment for SIMD vector mode types.
12767 @var{num} may be 4 or 8. The default is 8.
12768 Note that this is an ABI change, even though many library function
12769 interfaces are unaffected if they don't use SIMD vector modes
12770 in places that affect size and/or alignment of relevant types.
12771
12772 @item -msplit-vecmove-early
12773 @opindex msplit-vecmove-early
12774 Split vector moves into single word moves before reload. In theory this
12775 can give better register allocation, but so far the reverse seems to be
12776 generally the case.
12777
12778 @item -m1reg-@var{reg}
12779 @opindex m1reg-
12780 Specify a register to hold the constant @minus{}1, which makes loading small negative
12781 constants and certain bitmasks faster.
12782 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
12783 which specify use of that register as a fixed register,
12784 and @samp{none}, which means that no register is used for this
12785 purpose. The default is @option{-m1reg-none}.
12786
12787 @end table
12788
12789 @node ARC Options
12790 @subsection ARC Options
12791 @cindex ARC options
12792
12793 The following options control the architecture variant for which code
12794 is being compiled:
12795
12796 @c architecture variants
12797 @table @gcctabopt
12798
12799 @item -mbarrel-shifter
12800 @opindex mbarrel-shifter
12801 Generate instructions supported by barrel shifter. This is the default
12802 unless @option{-mcpu=ARC601} is in effect.
12803
12804 @item -mcpu=@var{cpu}
12805 @opindex mcpu
12806 Set architecture type, register usage, and instruction scheduling
12807 parameters for @var{cpu}. There are also shortcut alias options
12808 available for backward compatibility and convenience. Supported
12809 values for @var{cpu} are
12810
12811 @table @samp
12812 @opindex mA6
12813 @opindex mARC600
12814 @item ARC600
12815 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
12816
12817 @item ARC601
12818 @opindex mARC601
12819 Compile for ARC601. Alias: @option{-mARC601}.
12820
12821 @item ARC700
12822 @opindex mA7
12823 @opindex mARC700
12824 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
12825 This is the default when configured with @option{--with-cpu=arc700}@.
12826 @end table
12827
12828 @item -mdpfp
12829 @opindex mdpfp
12830 @itemx -mdpfp-compact
12831 @opindex mdpfp-compact
12832 FPX: Generate Double Precision FPX instructions, tuned for the compact
12833 implementation.
12834
12835 @item -mdpfp-fast
12836 @opindex mdpfp-fast
12837 FPX: Generate Double Precision FPX instructions, tuned for the fast
12838 implementation.
12839
12840 @item -mno-dpfp-lrsr
12841 @opindex mno-dpfp-lrsr
12842 Disable LR and SR instructions from using FPX extension aux registers.
12843
12844 @item -mea
12845 @opindex mea
12846 Generate Extended arithmetic instructions. Currently only
12847 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
12848 supported. This is always enabled for @option{-mcpu=ARC700}.
12849
12850 @item -mno-mpy
12851 @opindex mno-mpy
12852 Do not generate mpy instructions for ARC700.
12853
12854 @item -mmul32x16
12855 @opindex mmul32x16
12856 Generate 32x16 bit multiply and mac instructions.
12857
12858 @item -mmul64
12859 @opindex mmul64
12860 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
12861
12862 @item -mnorm
12863 @opindex mnorm
12864 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
12865 is in effect.
12866
12867 @item -mspfp
12868 @opindex mspfp
12869 @itemx -mspfp-compact
12870 @opindex mspfp-compact
12871 FPX: Generate Single Precision FPX instructions, tuned for the compact
12872 implementation.
12873
12874 @item -mspfp-fast
12875 @opindex mspfp-fast
12876 FPX: Generate Single Precision FPX instructions, tuned for the fast
12877 implementation.
12878
12879 @item -msimd
12880 @opindex msimd
12881 Enable generation of ARC SIMD instructions via target-specific
12882 builtins. Only valid for @option{-mcpu=ARC700}.
12883
12884 @item -msoft-float
12885 @opindex msoft-float
12886 This option ignored; it is provided for compatibility purposes only.
12887 Software floating point code is emitted by default, and this default
12888 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
12889 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
12890 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
12891
12892 @item -mswap
12893 @opindex mswap
12894 Generate swap instructions.
12895
12896 @end table
12897
12898 The following options are passed through to the assembler, and also
12899 define preprocessor macro symbols.
12900
12901 @c Flags used by the assembler, but for which we define preprocessor
12902 @c macro symbols as well.
12903 @table @gcctabopt
12904 @item -mdsp-packa
12905 @opindex mdsp-packa
12906 Passed down to the assembler to enable the DSP Pack A extensions.
12907 Also sets the preprocessor symbol @code{__Xdsp_packa}.
12908
12909 @item -mdvbf
12910 @opindex mdvbf
12911 Passed down to the assembler to enable the dual viterbi butterfly
12912 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
12913
12914 @c ARC700 4.10 extension instruction
12915 @item -mlock
12916 @opindex mlock
12917 Passed down to the assembler to enable the Locked Load/Store
12918 Conditional extension. Also sets the preprocessor symbol
12919 @code{__Xlock}.
12920
12921 @item -mmac-d16
12922 @opindex mmac-d16
12923 Passed down to the assembler. Also sets the preprocessor symbol
12924 @code{__Xxmac_d16}.
12925
12926 @item -mmac-24
12927 @opindex mmac-24
12928 Passed down to the assembler. Also sets the preprocessor symbol
12929 @code{__Xxmac_24}.
12930
12931 @c ARC700 4.10 extension instruction
12932 @item -mrtsc
12933 @opindex mrtsc
12934 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
12935 extension instruction. Also sets the preprocessor symbol
12936 @code{__Xrtsc}.
12937
12938 @c ARC700 4.10 extension instruction
12939 @item -mswape
12940 @opindex mswape
12941 Passed down to the assembler to enable the swap byte ordering
12942 extension instruction. Also sets the preprocessor symbol
12943 @code{__Xswape}.
12944
12945 @item -mtelephony
12946 @opindex mtelephony
12947 Passed down to the assembler to enable dual and single operand
12948 instructions for telephony. Also sets the preprocessor symbol
12949 @code{__Xtelephony}.
12950
12951 @item -mxy
12952 @opindex mxy
12953 Passed down to the assembler to enable the XY Memory extension. Also
12954 sets the preprocessor symbol @code{__Xxy}.
12955
12956 @end table
12957
12958 The following options control how the assembly code is annotated:
12959
12960 @c Assembly annotation options
12961 @table @gcctabopt
12962 @item -misize
12963 @opindex misize
12964 Annotate assembler instructions with estimated addresses.
12965
12966 @item -mannotate-align
12967 @opindex mannotate-align
12968 Explain what alignment considerations lead to the decision to make an
12969 instruction short or long.
12970
12971 @end table
12972
12973 The following options are passed through to the linker:
12974
12975 @c options passed through to the linker
12976 @table @gcctabopt
12977 @item -marclinux
12978 @opindex marclinux
12979 Passed through to the linker, to specify use of the @code{arclinux} emulation.
12980 This option is enabled by default in tool chains built for
12981 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
12982 when profiling is not requested.
12983
12984 @item -marclinux_prof
12985 @opindex marclinux_prof
12986 Passed through to the linker, to specify use of the
12987 @code{arclinux_prof} emulation. This option is enabled by default in
12988 tool chains built for @w{@code{arc-linux-uclibc}} and
12989 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
12990
12991 @end table
12992
12993 The following options control the semantics of generated code:
12994
12995 @c semantically relevant code generation options
12996 @table @gcctabopt
12997 @item -mepilogue-cfi
12998 @opindex mepilogue-cfi
12999 Enable generation of call frame information for epilogues.
13000
13001 @item -mno-epilogue-cfi
13002 @opindex mno-epilogue-cfi
13003 Disable generation of call frame information for epilogues.
13004
13005 @item -mlong-calls
13006 @opindex mlong-calls
13007 Generate call insns as register indirect calls, thus providing access
13008 to the full 32-bit address range.
13009
13010 @item -mmedium-calls
13011 @opindex mmedium-calls
13012 Don't use less than 25 bit addressing range for calls, which is the
13013 offset available for an unconditional branch-and-link
13014 instruction. Conditional execution of function calls is suppressed, to
13015 allow use of the 25-bit range, rather than the 21-bit range with
13016 conditional branch-and-link. This is the default for tool chains built
13017 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
13018
13019 @item -mno-sdata
13020 @opindex mno-sdata
13021 Do not generate sdata references. This is the default for tool chains
13022 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
13023 targets.
13024
13025 @item -mucb-mcount
13026 @opindex mucb-mcount
13027 Instrument with mcount calls as used in UCB code. I.e. do the
13028 counting in the callee, not the caller. By default ARC instrumentation
13029 counts in the caller.
13030
13031 @item -mvolatile-cache
13032 @opindex mvolatile-cache
13033 Use ordinarily cached memory accesses for volatile references. This is the
13034 default.
13035
13036 @item -mno-volatile-cache
13037 @opindex mno-volatile-cache
13038 Enable cache bypass for volatile references.
13039
13040 @end table
13041
13042 The following options fine tune code generation:
13043 @c code generation tuning options
13044 @table @gcctabopt
13045 @item -malign-call
13046 @opindex malign-call
13047 Do alignment optimizations for call instructions.
13048
13049 @item -mauto-modify-reg
13050 @opindex mauto-modify-reg
13051 Enable the use of pre/post modify with register displacement.
13052
13053 @item -mbbit-peephole
13054 @opindex mbbit-peephole
13055 Enable bbit peephole2.
13056
13057 @item -mno-brcc
13058 @opindex mno-brcc
13059 This option disables a target-specific pass in @file{arc_reorg} to
13060 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
13061 generation driven by the combiner pass.
13062
13063 @item -mcase-vector-pcrel
13064 @opindex mcase-vector-pcrel
13065 Use pc-relative switch case tables - this enables case table shortening.
13066 This is the default for @option{-Os}.
13067
13068 @item -mcompact-casesi
13069 @opindex mcompact-casesi
13070 Enable compact casesi pattern.
13071 This is the default for @option{-Os}.
13072
13073 @item -mno-cond-exec
13074 @opindex mno-cond-exec
13075 Disable ARCompact specific pass to generate conditional execution instructions.
13076 Due to delay slot scheduling and interactions between operand numbers,
13077 literal sizes, instruction lengths, and the support for conditional execution,
13078 the target-independent pass to generate conditional execution is often lacking,
13079 so the ARC port has kept a special pass around that tries to find more
13080 conditional execution generating opportunities after register allocation,
13081 branch shortening, and delay slot scheduling have been done. This pass
13082 generally, but not always, improves performance and code size, at the cost of
13083 extra compilation time, which is why there is an option to switch it off.
13084 If you have a problem with call instructions exceeding their allowable
13085 offset range because they are conditionalized, you should consider using
13086 @option{-mmedium-calls} instead.
13087
13088 @item -mearly-cbranchsi
13089 @opindex mearly-cbranchsi
13090 Enable pre-reload use of the cbranchsi pattern.
13091
13092 @item -mexpand-adddi
13093 @opindex mexpand-adddi
13094 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
13095 @code{add.f}, @code{adc} etc.
13096
13097 @item -mindexed-loads
13098 @opindex mindexed-loads
13099 Enable the use of indexed loads. This can be problematic because some
13100 optimizers then assume that indexed stores exist, which is not
13101 the case.
13102
13103 @item -mlra
13104 @opindex mlra
13105 Enable Local Register Allocation. This is still experimental for ARC,
13106 so by default the compiler uses standard reload
13107 (i.e. @option{-mno-lra}).
13108
13109 @item -mlra-priority-none
13110 @opindex mlra-priority-none
13111 Don't indicate any priority for target registers.
13112
13113 @item -mlra-priority-compact
13114 @opindex mlra-priority-compact
13115 Indicate target register priority for r0..r3 / r12..r15.
13116
13117 @item -mlra-priority-noncompact
13118 @opindex mlra-priority-noncompact
13119 Reduce target regsiter priority for r0..r3 / r12..r15.
13120
13121 @item -mno-millicode
13122 @opindex mno-millicode
13123 When optimizing for size (using @option{-Os}), prologues and epilogues
13124 that have to save or restore a large number of registers are often
13125 shortened by using call to a special function in libgcc; this is
13126 referred to as a @emph{millicode} call. As these calls can pose
13127 performance issues, and/or cause linking issues when linking in a
13128 nonstandard way, this option is provided to turn off millicode call
13129 generation.
13130
13131 @item -mmixed-code
13132 @opindex mmixed-code
13133 Tweak register allocation to help 16-bit instruction generation.
13134 This generally has the effect of decreasing the average instruction size
13135 while increasing the instruction count.
13136
13137 @item -mq-class
13138 @opindex mq-class
13139 Enable 'q' instruction alternatives.
13140 This is the default for @option{-Os}.
13141
13142 @item -mRcq
13143 @opindex mRcq
13144 Enable Rcq constraint handling - most short code generation depends on this.
13145 This is the default.
13146
13147 @item -mRcw
13148 @opindex mRcw
13149 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
13150 This is the default.
13151
13152 @item -msize-level=@var{level}
13153 @opindex msize-level
13154 Fine-tune size optimization with regards to instruction lengths and alignment.
13155 The recognized values for @var{level} are:
13156 @table @samp
13157 @item 0
13158 No size optimization. This level is deprecated and treated like @samp{1}.
13159
13160 @item 1
13161 Short instructions are used opportunistically.
13162
13163 @item 2
13164 In addition, alignment of loops and of code after barriers are dropped.
13165
13166 @item 3
13167 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
13168
13169 @end table
13170
13171 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
13172 the behavior when this is not set is equivalent to level @samp{1}.
13173
13174 @item -mtune=@var{cpu}
13175 @opindex mtune
13176 Set instruction scheduling parameters for @var{cpu}, overriding any implied
13177 by @option{-mcpu=}.
13178
13179 Supported values for @var{cpu} are
13180
13181 @table @samp
13182 @item ARC600
13183 Tune for ARC600 cpu.
13184
13185 @item ARC601
13186 Tune for ARC601 cpu.
13187
13188 @item ARC700
13189 Tune for ARC700 cpu with standard multiplier block.
13190
13191 @item ARC700-xmac
13192 Tune for ARC700 cpu with XMAC block.
13193
13194 @item ARC725D
13195 Tune for ARC725D cpu.
13196
13197 @item ARC750D
13198 Tune for ARC750D cpu.
13199
13200 @end table
13201
13202 @item -mmultcost=@var{num}
13203 @opindex mmultcost
13204 Cost to assume for a multiply instruction, with @samp{4} being equal to a
13205 normal instruction.
13206
13207 @item -munalign-prob-threshold=@var{probability}
13208 @opindex munalign-prob-threshold
13209 Set probability threshold for unaligning branches.
13210 When tuning for @samp{ARC700} and optimizing for speed, branches without
13211 filled delay slot are preferably emitted unaligned and long, unless
13212 profiling indicates that the probability for the branch to be taken
13213 is below @var{probability}. @xref{Cross-profiling}.
13214 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
13215
13216 @end table
13217
13218 The following options are maintained for backward compatibility, but
13219 are now deprecated and will be removed in a future release:
13220
13221 @c Deprecated options
13222 @table @gcctabopt
13223
13224 @item -margonaut
13225 @opindex margonaut
13226 Obsolete FPX.
13227
13228 @item -mbig-endian
13229 @opindex mbig-endian
13230 @itemx -EB
13231 @opindex EB
13232 Compile code for big endian targets. Use of these options is now
13233 deprecated. Users wanting big-endian code, should use the
13234 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
13235 building the tool chain, for which big-endian is the default.
13236
13237 @item -mlittle-endian
13238 @opindex mlittle-endian
13239 @itemx -EL
13240 @opindex EL
13241 Compile code for little endian targets. Use of these options is now
13242 deprecated. Users wanting little-endian code should use the
13243 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
13244 building the tool chain, for which little-endian is the default.
13245
13246 @item -mbarrel_shifter
13247 @opindex mbarrel_shifter
13248 Replaced by @option{-mbarrel-shifter}.
13249
13250 @item -mdpfp_compact
13251 @opindex mdpfp_compact
13252 Replaced by @option{-mdpfp-compact}.
13253
13254 @item -mdpfp_fast
13255 @opindex mdpfp_fast
13256 Replaced by @option{-mdpfp-fast}.
13257
13258 @item -mdsp_packa
13259 @opindex mdsp_packa
13260 Replaced by @option{-mdsp-packa}.
13261
13262 @item -mEA
13263 @opindex mEA
13264 Replaced by @option{-mea}.
13265
13266 @item -mmac_24
13267 @opindex mmac_24
13268 Replaced by @option{-mmac-24}.
13269
13270 @item -mmac_d16
13271 @opindex mmac_d16
13272 Replaced by @option{-mmac-d16}.
13273
13274 @item -mspfp_compact
13275 @opindex mspfp_compact
13276 Replaced by @option{-mspfp-compact}.
13277
13278 @item -mspfp_fast
13279 @opindex mspfp_fast
13280 Replaced by @option{-mspfp-fast}.
13281
13282 @item -mtune=@var{cpu}
13283 @opindex mtune
13284 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
13285 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
13286 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
13287
13288 @item -multcost=@var{num}
13289 @opindex multcost
13290 Replaced by @option{-mmultcost}.
13291
13292 @end table
13293
13294 @node ARM Options
13295 @subsection ARM Options
13296 @cindex ARM options
13297
13298 These @samp{-m} options are defined for the ARM port:
13299
13300 @table @gcctabopt
13301 @item -mabi=@var{name}
13302 @opindex mabi
13303 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
13304 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
13305
13306 @item -mapcs-frame
13307 @opindex mapcs-frame
13308 Generate a stack frame that is compliant with the ARM Procedure Call
13309 Standard for all functions, even if this is not strictly necessary for
13310 correct execution of the code. Specifying @option{-fomit-frame-pointer}
13311 with this option causes the stack frames not to be generated for
13312 leaf functions. The default is @option{-mno-apcs-frame}.
13313 This option is deprecated.
13314
13315 @item -mapcs
13316 @opindex mapcs
13317 This is a synonym for @option{-mapcs-frame} and is deprecated.
13318
13319 @ignore
13320 @c not currently implemented
13321 @item -mapcs-stack-check
13322 @opindex mapcs-stack-check
13323 Generate code to check the amount of stack space available upon entry to
13324 every function (that actually uses some stack space). If there is
13325 insufficient space available then either the function
13326 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
13327 called, depending upon the amount of stack space required. The runtime
13328 system is required to provide these functions. The default is
13329 @option{-mno-apcs-stack-check}, since this produces smaller code.
13330
13331 @c not currently implemented
13332 @item -mapcs-float
13333 @opindex mapcs-float
13334 Pass floating-point arguments using the floating-point registers. This is
13335 one of the variants of the APCS@. This option is recommended if the
13336 target hardware has a floating-point unit or if a lot of floating-point
13337 arithmetic is going to be performed by the code. The default is
13338 @option{-mno-apcs-float}, since the size of integer-only code is
13339 slightly increased if @option{-mapcs-float} is used.
13340
13341 @c not currently implemented
13342 @item -mapcs-reentrant
13343 @opindex mapcs-reentrant
13344 Generate reentrant, position-independent code. The default is
13345 @option{-mno-apcs-reentrant}.
13346 @end ignore
13347
13348 @item -mthumb-interwork
13349 @opindex mthumb-interwork
13350 Generate code that supports calling between the ARM and Thumb
13351 instruction sets. Without this option, on pre-v5 architectures, the
13352 two instruction sets cannot be reliably used inside one program. The
13353 default is @option{-mno-thumb-interwork}, since slightly larger code
13354 is generated when @option{-mthumb-interwork} is specified. In AAPCS
13355 configurations this option is meaningless.
13356
13357 @item -mno-sched-prolog
13358 @opindex mno-sched-prolog
13359 Prevent the reordering of instructions in the function prologue, or the
13360 merging of those instruction with the instructions in the function's
13361 body. This means that all functions start with a recognizable set
13362 of instructions (or in fact one of a choice from a small set of
13363 different function prologues), and this information can be used to
13364 locate the start of functions inside an executable piece of code. The
13365 default is @option{-msched-prolog}.
13366
13367 @item -mfloat-abi=@var{name}
13368 @opindex mfloat-abi
13369 Specifies which floating-point ABI to use. Permissible values
13370 are: @samp{soft}, @samp{softfp} and @samp{hard}.
13371
13372 Specifying @samp{soft} causes GCC to generate output containing
13373 library calls for floating-point operations.
13374 @samp{softfp} allows the generation of code using hardware floating-point
13375 instructions, but still uses the soft-float calling conventions.
13376 @samp{hard} allows generation of floating-point instructions
13377 and uses FPU-specific calling conventions.
13378
13379 The default depends on the specific target configuration. Note that
13380 the hard-float and soft-float ABIs are not link-compatible; you must
13381 compile your entire program with the same ABI, and link with a
13382 compatible set of libraries.
13383
13384 @item -mlittle-endian
13385 @opindex mlittle-endian
13386 Generate code for a processor running in little-endian mode. This is
13387 the default for all standard configurations.
13388
13389 @item -mbig-endian
13390 @opindex mbig-endian
13391 Generate code for a processor running in big-endian mode; the default is
13392 to compile code for a little-endian processor.
13393
13394 @item -march=@var{name}
13395 @opindex march
13396 This specifies the name of the target ARM architecture. GCC uses this
13397 name to determine what kind of instructions it can emit when generating
13398 assembly code. This option can be used in conjunction with or instead
13399 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
13400 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
13401 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
13402 @samp{armv6}, @samp{armv6j},
13403 @samp{armv6t2}, @samp{armv6z}, @samp{armv6kz}, @samp{armv6-m},
13404 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m},
13405 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc},
13406 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
13407
13408 @option{-march=armv7ve} is the armv7-a architecture with virtualization
13409 extensions.
13410
13411 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
13412 architecture together with the optional CRC32 extensions.
13413
13414 @option{-march=native} causes the compiler to auto-detect the architecture
13415 of the build computer. At present, this feature is only supported on
13416 GNU/Linux, and not all architectures are recognized. If the auto-detect
13417 is unsuccessful the option has no effect.
13418
13419 @item -mtune=@var{name}
13420 @opindex mtune
13421 This option specifies the name of the target ARM processor for
13422 which GCC should tune the performance of the code.
13423 For some ARM implementations better performance can be obtained by using
13424 this option.
13425 Permissible names are: @samp{arm2}, @samp{arm250},
13426 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
13427 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
13428 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
13429 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
13430 @samp{arm720},
13431 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
13432 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
13433 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
13434 @samp{strongarm1110},
13435 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
13436 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
13437 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
13438 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
13439 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
13440 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
13441 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
13442 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
13443 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
13444 @samp{cortex-a53}, @samp{cortex-a57}, @samp{cortex-a72},
13445 @samp{cortex-r4},
13446 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-m7},
13447 @samp{cortex-m4},
13448 @samp{cortex-m3},
13449 @samp{cortex-m1},
13450 @samp{cortex-m0},
13451 @samp{cortex-m0plus},
13452 @samp{cortex-m1.small-multiply},
13453 @samp{cortex-m0.small-multiply},
13454 @samp{cortex-m0plus.small-multiply},
13455 @samp{exynos-m1},
13456 @samp{marvell-pj4},
13457 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
13458 @samp{fa526}, @samp{fa626},
13459 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
13460 @samp{xgene1}.
13461
13462 Additionally, this option can specify that GCC should tune the performance
13463 of the code for a big.LITTLE system. Permissible names are:
13464 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
13465 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}.
13466
13467 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
13468 performance for a blend of processors within architecture @var{arch}.
13469 The aim is to generate code that run well on the current most popular
13470 processors, balancing between optimizations that benefit some CPUs in the
13471 range, and avoiding performance pitfalls of other CPUs. The effects of
13472 this option may change in future GCC versions as CPU models come and go.
13473
13474 @option{-mtune=native} causes the compiler to auto-detect the CPU
13475 of the build computer. At present, this feature is only supported on
13476 GNU/Linux, and not all architectures are recognized. If the auto-detect is
13477 unsuccessful the option has no effect.
13478
13479 @item -mcpu=@var{name}
13480 @opindex mcpu
13481 This specifies the name of the target ARM processor. GCC uses this name
13482 to derive the name of the target ARM architecture (as if specified
13483 by @option{-march}) and the ARM processor type for which to tune for
13484 performance (as if specified by @option{-mtune}). Where this option
13485 is used in conjunction with @option{-march} or @option{-mtune},
13486 those options take precedence over the appropriate part of this option.
13487
13488 Permissible names for this option are the same as those for
13489 @option{-mtune}.
13490
13491 @option{-mcpu=generic-@var{arch}} is also permissible, and is
13492 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
13493 See @option{-mtune} for more information.
13494
13495 @option{-mcpu=native} causes the compiler to auto-detect the CPU
13496 of the build computer. At present, this feature is only supported on
13497 GNU/Linux, and not all architectures are recognized. If the auto-detect
13498 is unsuccessful the option has no effect.
13499
13500 @item -mfpu=@var{name}
13501 @opindex mfpu
13502 This specifies what floating-point hardware (or hardware emulation) is
13503 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
13504 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
13505 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
13506 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
13507 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
13508 @samp{fp-armv8}, @samp{neon-fp-armv8}, and @samp{crypto-neon-fp-armv8}.
13509
13510 If @option{-msoft-float} is specified this specifies the format of
13511 floating-point values.
13512
13513 If the selected floating-point hardware includes the NEON extension
13514 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
13515 operations are not generated by GCC's auto-vectorization pass unless
13516 @option{-funsafe-math-optimizations} is also specified. This is
13517 because NEON hardware does not fully implement the IEEE 754 standard for
13518 floating-point arithmetic (in particular denormal values are treated as
13519 zero), so the use of NEON instructions may lead to a loss of precision.
13520
13521 @item -mfp16-format=@var{name}
13522 @opindex mfp16-format
13523 Specify the format of the @code{__fp16} half-precision floating-point type.
13524 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
13525 the default is @samp{none}, in which case the @code{__fp16} type is not
13526 defined. @xref{Half-Precision}, for more information.
13527
13528 @item -mstructure-size-boundary=@var{n}
13529 @opindex mstructure-size-boundary
13530 The sizes of all structures and unions are rounded up to a multiple
13531 of the number of bits set by this option. Permissible values are 8, 32
13532 and 64. The default value varies for different toolchains. For the COFF
13533 targeted toolchain the default value is 8. A value of 64 is only allowed
13534 if the underlying ABI supports it.
13535
13536 Specifying a larger number can produce faster, more efficient code, but
13537 can also increase the size of the program. Different values are potentially
13538 incompatible. Code compiled with one value cannot necessarily expect to
13539 work with code or libraries compiled with another value, if they exchange
13540 information using structures or unions.
13541
13542 @item -mabort-on-noreturn
13543 @opindex mabort-on-noreturn
13544 Generate a call to the function @code{abort} at the end of a
13545 @code{noreturn} function. It is executed if the function tries to
13546 return.
13547
13548 @item -mlong-calls
13549 @itemx -mno-long-calls
13550 @opindex mlong-calls
13551 @opindex mno-long-calls
13552 Tells the compiler to perform function calls by first loading the
13553 address of the function into a register and then performing a subroutine
13554 call on this register. This switch is needed if the target function
13555 lies outside of the 64-megabyte addressing range of the offset-based
13556 version of subroutine call instruction.
13557
13558 Even if this switch is enabled, not all function calls are turned
13559 into long calls. The heuristic is that static functions, functions
13560 that have the @code{short_call} attribute, functions that are inside
13561 the scope of a @code{#pragma no_long_calls} directive, and functions whose
13562 definitions have already been compiled within the current compilation
13563 unit are not turned into long calls. The exceptions to this rule are
13564 that weak function definitions, functions with the @code{long_call}
13565 attribute or the @code{section} attribute, and functions that are within
13566 the scope of a @code{#pragma long_calls} directive are always
13567 turned into long calls.
13568
13569 This feature is not enabled by default. Specifying
13570 @option{-mno-long-calls} restores the default behavior, as does
13571 placing the function calls within the scope of a @code{#pragma
13572 long_calls_off} directive. Note these switches have no effect on how
13573 the compiler generates code to handle function calls via function
13574 pointers.
13575
13576 @item -msingle-pic-base
13577 @opindex msingle-pic-base
13578 Treat the register used for PIC addressing as read-only, rather than
13579 loading it in the prologue for each function. The runtime system is
13580 responsible for initializing this register with an appropriate value
13581 before execution begins.
13582
13583 @item -mpic-register=@var{reg}
13584 @opindex mpic-register
13585 Specify the register to be used for PIC addressing.
13586 For standard PIC base case, the default is any suitable register
13587 determined by compiler. For single PIC base case, the default is
13588 @samp{R9} if target is EABI based or stack-checking is enabled,
13589 otherwise the default is @samp{R10}.
13590
13591 @item -mpic-data-is-text-relative
13592 @opindex mpic-data-is-text-relative
13593 Assume that each data segments are relative to text segment at load time.
13594 Therefore, it permits addressing data using PC-relative operations.
13595 This option is on by default for targets other than VxWorks RTP.
13596
13597 @item -mpoke-function-name
13598 @opindex mpoke-function-name
13599 Write the name of each function into the text section, directly
13600 preceding the function prologue. The generated code is similar to this:
13601
13602 @smallexample
13603 t0
13604 .ascii "arm_poke_function_name", 0
13605 .align
13606 t1
13607 .word 0xff000000 + (t1 - t0)
13608 arm_poke_function_name
13609 mov ip, sp
13610 stmfd sp!, @{fp, ip, lr, pc@}
13611 sub fp, ip, #4
13612 @end smallexample
13613
13614 When performing a stack backtrace, code can inspect the value of
13615 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
13616 location @code{pc - 12} and the top 8 bits are set, then we know that
13617 there is a function name embedded immediately preceding this location
13618 and has length @code{((pc[-3]) & 0xff000000)}.
13619
13620 @item -mthumb
13621 @itemx -marm
13622 @opindex marm
13623 @opindex mthumb
13624
13625 Select between generating code that executes in ARM and Thumb
13626 states. The default for most configurations is to generate code
13627 that executes in ARM state, but the default can be changed by
13628 configuring GCC with the @option{--with-mode=}@var{state}
13629 configure option.
13630
13631 You can also override the ARM and Thumb mode for each function
13632 by using the @code{target("thumb")} and @code{target("arm")} function attributes
13633 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
13634
13635 @item -mtpcs-frame
13636 @opindex mtpcs-frame
13637 Generate a stack frame that is compliant with the Thumb Procedure Call
13638 Standard for all non-leaf functions. (A leaf function is one that does
13639 not call any other functions.) The default is @option{-mno-tpcs-frame}.
13640
13641 @item -mtpcs-leaf-frame
13642 @opindex mtpcs-leaf-frame
13643 Generate a stack frame that is compliant with the Thumb Procedure Call
13644 Standard for all leaf functions. (A leaf function is one that does
13645 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
13646
13647 @item -mcallee-super-interworking
13648 @opindex mcallee-super-interworking
13649 Gives all externally visible functions in the file being compiled an ARM
13650 instruction set header which switches to Thumb mode before executing the
13651 rest of the function. This allows these functions to be called from
13652 non-interworking code. This option is not valid in AAPCS configurations
13653 because interworking is enabled by default.
13654
13655 @item -mcaller-super-interworking
13656 @opindex mcaller-super-interworking
13657 Allows calls via function pointers (including virtual functions) to
13658 execute correctly regardless of whether the target code has been
13659 compiled for interworking or not. There is a small overhead in the cost
13660 of executing a function pointer if this option is enabled. This option
13661 is not valid in AAPCS configurations because interworking is enabled
13662 by default.
13663
13664 @item -mtp=@var{name}
13665 @opindex mtp
13666 Specify the access model for the thread local storage pointer. The valid
13667 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
13668 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
13669 (supported in the arm6k architecture), and @samp{auto}, which uses the
13670 best available method for the selected processor. The default setting is
13671 @samp{auto}.
13672
13673 @item -mtls-dialect=@var{dialect}
13674 @opindex mtls-dialect
13675 Specify the dialect to use for accessing thread local storage. Two
13676 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
13677 @samp{gnu} dialect selects the original GNU scheme for supporting
13678 local and global dynamic TLS models. The @samp{gnu2} dialect
13679 selects the GNU descriptor scheme, which provides better performance
13680 for shared libraries. The GNU descriptor scheme is compatible with
13681 the original scheme, but does require new assembler, linker and
13682 library support. Initial and local exec TLS models are unaffected by
13683 this option and always use the original scheme.
13684
13685 @item -mword-relocations
13686 @opindex mword-relocations
13687 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
13688 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
13689 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
13690 is specified.
13691
13692 @item -mfix-cortex-m3-ldrd
13693 @opindex mfix-cortex-m3-ldrd
13694 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
13695 with overlapping destination and base registers are used. This option avoids
13696 generating these instructions. This option is enabled by default when
13697 @option{-mcpu=cortex-m3} is specified.
13698
13699 @item -munaligned-access
13700 @itemx -mno-unaligned-access
13701 @opindex munaligned-access
13702 @opindex mno-unaligned-access
13703 Enables (or disables) reading and writing of 16- and 32- bit values
13704 from addresses that are not 16- or 32- bit aligned. By default
13705 unaligned access is disabled for all pre-ARMv6 and all ARMv6-M
13706 architectures, and enabled for all other architectures. If unaligned
13707 access is not enabled then words in packed data structures are
13708 accessed a byte at a time.
13709
13710 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
13711 generated object file to either true or false, depending upon the
13712 setting of this option. If unaligned access is enabled then the
13713 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
13714 defined.
13715
13716 @item -mneon-for-64bits
13717 @opindex mneon-for-64bits
13718 Enables using Neon to handle scalar 64-bits operations. This is
13719 disabled by default since the cost of moving data from core registers
13720 to Neon is high.
13721
13722 @item -mslow-flash-data
13723 @opindex mslow-flash-data
13724 Assume loading data from flash is slower than fetching instruction.
13725 Therefore literal load is minimized for better performance.
13726 This option is only supported when compiling for ARMv7 M-profile and
13727 off by default.
13728
13729 @item -masm-syntax-unified
13730 @opindex masm-syntax-unified
13731 Assume inline assembler is using unified asm syntax. The default is
13732 currently off which implies divided syntax. Currently this option is
13733 available only for Thumb1 and has no effect on ARM state and Thumb2.
13734 However, this may change in future releases of GCC. Divided syntax
13735 should be considered deprecated.
13736
13737 @item -mrestrict-it
13738 @opindex mrestrict-it
13739 Restricts generation of IT blocks to conform to the rules of ARMv8.
13740 IT blocks can only contain a single 16-bit instruction from a select
13741 set of instructions. This option is on by default for ARMv8 Thumb mode.
13742
13743 @item -mprint-tune-info
13744 @opindex mprint-tune-info
13745 Print CPU tuning information as comment in assembler file. This is
13746 an option used only for regression testing of the compiler and not
13747 intended for ordinary use in compiling code. This option is disabled
13748 by default.
13749 @end table
13750
13751 @node AVR Options
13752 @subsection AVR Options
13753 @cindex AVR Options
13754
13755 These options are defined for AVR implementations:
13756
13757 @table @gcctabopt
13758 @item -mmcu=@var{mcu}
13759 @opindex mmcu
13760 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
13761
13762 The default for this option is@tie{}@samp{avr2}.
13763
13764 GCC supports the following AVR devices and ISAs:
13765
13766 @include avr-mmcu.texi
13767
13768 @item -maccumulate-args
13769 @opindex maccumulate-args
13770 Accumulate outgoing function arguments and acquire/release the needed
13771 stack space for outgoing function arguments once in function
13772 prologue/epilogue. Without this option, outgoing arguments are pushed
13773 before calling a function and popped afterwards.
13774
13775 Popping the arguments after the function call can be expensive on
13776 AVR so that accumulating the stack space might lead to smaller
13777 executables because arguments need not to be removed from the
13778 stack after such a function call.
13779
13780 This option can lead to reduced code size for functions that perform
13781 several calls to functions that get their arguments on the stack like
13782 calls to printf-like functions.
13783
13784 @item -mbranch-cost=@var{cost}
13785 @opindex mbranch-cost
13786 Set the branch costs for conditional branch instructions to
13787 @var{cost}. Reasonable values for @var{cost} are small, non-negative
13788 integers. The default branch cost is 0.
13789
13790 @item -mcall-prologues
13791 @opindex mcall-prologues
13792 Functions prologues/epilogues are expanded as calls to appropriate
13793 subroutines. Code size is smaller.
13794
13795 @item -mint8
13796 @opindex mint8
13797 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
13798 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
13799 and @code{long long} is 4 bytes. Please note that this option does not
13800 conform to the C standards, but it results in smaller code
13801 size.
13802
13803 @item -mn-flash=@var{num}
13804 @opindex mn-flash
13805 Assume that the flash memory has a size of
13806 @var{num} times 64@tie{}KiB.
13807
13808 @item -mno-interrupts
13809 @opindex mno-interrupts
13810 Generated code is not compatible with hardware interrupts.
13811 Code size is smaller.
13812
13813 @item -mrelax
13814 @opindex mrelax
13815 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
13816 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
13817 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
13818 the assembler's command line and the @option{--relax} option to the
13819 linker's command line.
13820
13821 Jump relaxing is performed by the linker because jump offsets are not
13822 known before code is located. Therefore, the assembler code generated by the
13823 compiler is the same, but the instructions in the executable may
13824 differ from instructions in the assembler code.
13825
13826 Relaxing must be turned on if linker stubs are needed, see the
13827 section on @code{EIND} and linker stubs below.
13828
13829 @item -mrmw
13830 @opindex mrmw
13831 Assume that the device supports the Read-Modify-Write
13832 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
13833
13834 @item -msp8
13835 @opindex msp8
13836 Treat the stack pointer register as an 8-bit register,
13837 i.e.@: assume the high byte of the stack pointer is zero.
13838 In general, you don't need to set this option by hand.
13839
13840 This option is used internally by the compiler to select and
13841 build multilibs for architectures @code{avr2} and @code{avr25}.
13842 These architectures mix devices with and without @code{SPH}.
13843 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
13844 the compiler driver adds or removes this option from the compiler
13845 proper's command line, because the compiler then knows if the device
13846 or architecture has an 8-bit stack pointer and thus no @code{SPH}
13847 register or not.
13848
13849 @item -mstrict-X
13850 @opindex mstrict-X
13851 Use address register @code{X} in a way proposed by the hardware. This means
13852 that @code{X} is only used in indirect, post-increment or
13853 pre-decrement addressing.
13854
13855 Without this option, the @code{X} register may be used in the same way
13856 as @code{Y} or @code{Z} which then is emulated by additional
13857 instructions.
13858 For example, loading a value with @code{X+const} addressing with a
13859 small non-negative @code{const < 64} to a register @var{Rn} is
13860 performed as
13861
13862 @example
13863 adiw r26, const ; X += const
13864 ld @var{Rn}, X ; @var{Rn} = *X
13865 sbiw r26, const ; X -= const
13866 @end example
13867
13868 @item -mtiny-stack
13869 @opindex mtiny-stack
13870 Only change the lower 8@tie{}bits of the stack pointer.
13871
13872 @item -nodevicelib
13873 @opindex nodevicelib
13874 Don't link against AVR-LibC's device specific library @code{libdev.a}.
13875
13876 @item -Waddr-space-convert
13877 @opindex Waddr-space-convert
13878 Warn about conversions between address spaces in the case where the
13879 resulting address space is not contained in the incoming address space.
13880 @end table
13881
13882 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
13883 @cindex @code{EIND}
13884 Pointers in the implementation are 16@tie{}bits wide.
13885 The address of a function or label is represented as word address so
13886 that indirect jumps and calls can target any code address in the
13887 range of 64@tie{}Ki words.
13888
13889 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
13890 bytes of program memory space, there is a special function register called
13891 @code{EIND} that serves as most significant part of the target address
13892 when @code{EICALL} or @code{EIJMP} instructions are used.
13893
13894 Indirect jumps and calls on these devices are handled as follows by
13895 the compiler and are subject to some limitations:
13896
13897 @itemize @bullet
13898
13899 @item
13900 The compiler never sets @code{EIND}.
13901
13902 @item
13903 The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP}
13904 instructions or might read @code{EIND} directly in order to emulate an
13905 indirect call/jump by means of a @code{RET} instruction.
13906
13907 @item
13908 The compiler assumes that @code{EIND} never changes during the startup
13909 code or during the application. In particular, @code{EIND} is not
13910 saved/restored in function or interrupt service routine
13911 prologue/epilogue.
13912
13913 @item
13914 For indirect calls to functions and computed goto, the linker
13915 generates @emph{stubs}. Stubs are jump pads sometimes also called
13916 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
13917 The stub contains a direct jump to the desired address.
13918
13919 @item
13920 Linker relaxation must be turned on so that the linker generates
13921 the stubs correctly in all situations. See the compiler option
13922 @option{-mrelax} and the linker option @option{--relax}.
13923 There are corner cases where the linker is supposed to generate stubs
13924 but aborts without relaxation and without a helpful error message.
13925
13926 @item
13927 The default linker script is arranged for code with @code{EIND = 0}.
13928 If code is supposed to work for a setup with @code{EIND != 0}, a custom
13929 linker script has to be used in order to place the sections whose
13930 name start with @code{.trampolines} into the segment where @code{EIND}
13931 points to.
13932
13933 @item
13934 The startup code from libgcc never sets @code{EIND}.
13935 Notice that startup code is a blend of code from libgcc and AVR-LibC.
13936 For the impact of AVR-LibC on @code{EIND}, see the
13937 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
13938
13939 @item
13940 It is legitimate for user-specific startup code to set up @code{EIND}
13941 early, for example by means of initialization code located in
13942 section @code{.init3}. Such code runs prior to general startup code
13943 that initializes RAM and calls constructors, but after the bit
13944 of startup code from AVR-LibC that sets @code{EIND} to the segment
13945 where the vector table is located.
13946 @example
13947 #include <avr/io.h>
13948
13949 static void
13950 __attribute__((section(".init3"),naked,used,no_instrument_function))
13951 init3_set_eind (void)
13952 @{
13953 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
13954 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
13955 @}
13956 @end example
13957
13958 @noindent
13959 The @code{__trampolines_start} symbol is defined in the linker script.
13960
13961 @item
13962 Stubs are generated automatically by the linker if
13963 the following two conditions are met:
13964 @itemize @minus
13965
13966 @item The address of a label is taken by means of the @code{gs} modifier
13967 (short for @emph{generate stubs}) like so:
13968 @example
13969 LDI r24, lo8(gs(@var{func}))
13970 LDI r25, hi8(gs(@var{func}))
13971 @end example
13972 @item The final location of that label is in a code segment
13973 @emph{outside} the segment where the stubs are located.
13974 @end itemize
13975
13976 @item
13977 The compiler emits such @code{gs} modifiers for code labels in the
13978 following situations:
13979 @itemize @minus
13980 @item Taking address of a function or code label.
13981 @item Computed goto.
13982 @item If prologue-save function is used, see @option{-mcall-prologues}
13983 command-line option.
13984 @item Switch/case dispatch tables. If you do not want such dispatch
13985 tables you can specify the @option{-fno-jump-tables} command-line option.
13986 @item C and C++ constructors/destructors called during startup/shutdown.
13987 @item If the tools hit a @code{gs()} modifier explained above.
13988 @end itemize
13989
13990 @item
13991 Jumping to non-symbolic addresses like so is @emph{not} supported:
13992
13993 @example
13994 int main (void)
13995 @{
13996 /* Call function at word address 0x2 */
13997 return ((int(*)(void)) 0x2)();
13998 @}
13999 @end example
14000
14001 Instead, a stub has to be set up, i.e.@: the function has to be called
14002 through a symbol (@code{func_4} in the example):
14003
14004 @example
14005 int main (void)
14006 @{
14007 extern int func_4 (void);
14008
14009 /* Call function at byte address 0x4 */
14010 return func_4();
14011 @}
14012 @end example
14013
14014 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
14015 Alternatively, @code{func_4} can be defined in the linker script.
14016 @end itemize
14017
14018 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
14019 @cindex @code{RAMPD}
14020 @cindex @code{RAMPX}
14021 @cindex @code{RAMPY}
14022 @cindex @code{RAMPZ}
14023 Some AVR devices support memories larger than the 64@tie{}KiB range
14024 that can be accessed with 16-bit pointers. To access memory locations
14025 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
14026 register is used as high part of the address:
14027 The @code{X}, @code{Y}, @code{Z} address register is concatenated
14028 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
14029 register, respectively, to get a wide address. Similarly,
14030 @code{RAMPD} is used together with direct addressing.
14031
14032 @itemize
14033 @item
14034 The startup code initializes the @code{RAMP} special function
14035 registers with zero.
14036
14037 @item
14038 If a @ref{AVR Named Address Spaces,named address space} other than
14039 generic or @code{__flash} is used, then @code{RAMPZ} is set
14040 as needed before the operation.
14041
14042 @item
14043 If the device supports RAM larger than 64@tie{}KiB and the compiler
14044 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
14045 is reset to zero after the operation.
14046
14047 @item
14048 If the device comes with a specific @code{RAMP} register, the ISR
14049 prologue/epilogue saves/restores that SFR and initializes it with
14050 zero in case the ISR code might (implicitly) use it.
14051
14052 @item
14053 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
14054 If you use inline assembler to read from locations outside the
14055 16-bit address range and change one of the @code{RAMP} registers,
14056 you must reset it to zero after the access.
14057
14058 @end itemize
14059
14060 @subsubsection AVR Built-in Macros
14061
14062 GCC defines several built-in macros so that the user code can test
14063 for the presence or absence of features. Almost any of the following
14064 built-in macros are deduced from device capabilities and thus
14065 triggered by the @option{-mmcu=} command-line option.
14066
14067 For even more AVR-specific built-in macros see
14068 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
14069
14070 @table @code
14071
14072 @item __AVR_ARCH__
14073 Build-in macro that resolves to a decimal number that identifies the
14074 architecture and depends on the @option{-mmcu=@var{mcu}} option.
14075 Possible values are:
14076
14077 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
14078 @code{4}, @code{5}, @code{51}, @code{6}
14079
14080 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
14081 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
14082
14083 respectively and
14084
14085 @code{100}, @code{102}, @code{104},
14086 @code{105}, @code{106}, @code{107}
14087
14088 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
14089 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
14090 If @var{mcu} specifies a device, this built-in macro is set
14091 accordingly. For example, with @option{-mmcu=atmega8} the macro is
14092 defined to @code{4}.
14093
14094 @item __AVR_@var{Device}__
14095 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
14096 the device's name. For example, @option{-mmcu=atmega8} defines the
14097 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
14098 @code{__AVR_ATtiny261A__}, etc.
14099
14100 The built-in macros' names follow
14101 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
14102 the device name as from the AVR user manual. The difference between
14103 @var{Device} in the built-in macro and @var{device} in
14104 @option{-mmcu=@var{device}} is that the latter is always lowercase.
14105
14106 If @var{device} is not a device but only a core architecture like
14107 @samp{avr51}, this macro is not defined.
14108
14109 @item __AVR_DEVICE_NAME__
14110 Setting @option{-mmcu=@var{device}} defines this built-in macro to
14111 the device's name. For example, with @option{-mmcu=atmega8} the macro
14112 is defined to @code{atmega8}.
14113
14114 If @var{device} is not a device but only a core architecture like
14115 @samp{avr51}, this macro is not defined.
14116
14117 @item __AVR_XMEGA__
14118 The device / architecture belongs to the XMEGA family of devices.
14119
14120 @item __AVR_HAVE_ELPM__
14121 The device has the @code{ELPM} instruction.
14122
14123 @item __AVR_HAVE_ELPMX__
14124 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
14125 R@var{n},Z+} instructions.
14126
14127 @item __AVR_HAVE_MOVW__
14128 The device has the @code{MOVW} instruction to perform 16-bit
14129 register-register moves.
14130
14131 @item __AVR_HAVE_LPMX__
14132 The device has the @code{LPM R@var{n},Z} and
14133 @code{LPM R@var{n},Z+} instructions.
14134
14135 @item __AVR_HAVE_MUL__
14136 The device has a hardware multiplier.
14137
14138 @item __AVR_HAVE_JMP_CALL__
14139 The device has the @code{JMP} and @code{CALL} instructions.
14140 This is the case for devices with at least 16@tie{}KiB of program
14141 memory.
14142
14143 @item __AVR_HAVE_EIJMP_EICALL__
14144 @itemx __AVR_3_BYTE_PC__
14145 The device has the @code{EIJMP} and @code{EICALL} instructions.
14146 This is the case for devices with more than 128@tie{}KiB of program memory.
14147 This also means that the program counter
14148 (PC) is 3@tie{}bytes wide.
14149
14150 @item __AVR_2_BYTE_PC__
14151 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
14152 with up to 128@tie{}KiB of program memory.
14153
14154 @item __AVR_HAVE_8BIT_SP__
14155 @itemx __AVR_HAVE_16BIT_SP__
14156 The stack pointer (SP) register is treated as 8-bit respectively
14157 16-bit register by the compiler.
14158 The definition of these macros is affected by @option{-mtiny-stack}.
14159
14160 @item __AVR_HAVE_SPH__
14161 @itemx __AVR_SP8__
14162 The device has the SPH (high part of stack pointer) special function
14163 register or has an 8-bit stack pointer, respectively.
14164 The definition of these macros is affected by @option{-mmcu=} and
14165 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
14166 by @option{-msp8}.
14167
14168 @item __AVR_HAVE_RAMPD__
14169 @itemx __AVR_HAVE_RAMPX__
14170 @itemx __AVR_HAVE_RAMPY__
14171 @itemx __AVR_HAVE_RAMPZ__
14172 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
14173 @code{RAMPZ} special function register, respectively.
14174
14175 @item __NO_INTERRUPTS__
14176 This macro reflects the @option{-mno-interrupts} command-line option.
14177
14178 @item __AVR_ERRATA_SKIP__
14179 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
14180 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
14181 instructions because of a hardware erratum. Skip instructions are
14182 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
14183 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
14184 set.
14185
14186 @item __AVR_ISA_RMW__
14187 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
14188
14189 @item __AVR_SFR_OFFSET__=@var{offset}
14190 Instructions that can address I/O special function registers directly
14191 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
14192 address as if addressed by an instruction to access RAM like @code{LD}
14193 or @code{STS}. This offset depends on the device architecture and has
14194 to be subtracted from the RAM address in order to get the
14195 respective I/O@tie{}address.
14196
14197 @item __WITH_AVRLIBC__
14198 The compiler is configured to be used together with AVR-Libc.
14199 See the @option{--with-avrlibc} configure option.
14200
14201 @end table
14202
14203 @node Blackfin Options
14204 @subsection Blackfin Options
14205 @cindex Blackfin Options
14206
14207 @table @gcctabopt
14208 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
14209 @opindex mcpu=
14210 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
14211 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
14212 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
14213 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
14214 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
14215 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
14216 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
14217 @samp{bf561}, @samp{bf592}.
14218
14219 The optional @var{sirevision} specifies the silicon revision of the target
14220 Blackfin processor. Any workarounds available for the targeted silicon revision
14221 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
14222 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
14223 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
14224 hexadecimal digits representing the major and minor numbers in the silicon
14225 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
14226 is not defined. If @var{sirevision} is @samp{any}, the
14227 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
14228 If this optional @var{sirevision} is not used, GCC assumes the latest known
14229 silicon revision of the targeted Blackfin processor.
14230
14231 GCC defines a preprocessor macro for the specified @var{cpu}.
14232 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
14233 provided by libgloss to be linked in if @option{-msim} is not given.
14234
14235 Without this option, @samp{bf532} is used as the processor by default.
14236
14237 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
14238 only the preprocessor macro is defined.
14239
14240 @item -msim
14241 @opindex msim
14242 Specifies that the program will be run on the simulator. This causes
14243 the simulator BSP provided by libgloss to be linked in. This option
14244 has effect only for @samp{bfin-elf} toolchain.
14245 Certain other options, such as @option{-mid-shared-library} and
14246 @option{-mfdpic}, imply @option{-msim}.
14247
14248 @item -momit-leaf-frame-pointer
14249 @opindex momit-leaf-frame-pointer
14250 Don't keep the frame pointer in a register for leaf functions. This
14251 avoids the instructions to save, set up and restore frame pointers and
14252 makes an extra register available in leaf functions. The option
14253 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
14254 which might make debugging harder.
14255
14256 @item -mspecld-anomaly
14257 @opindex mspecld-anomaly
14258 When enabled, the compiler ensures that the generated code does not
14259 contain speculative loads after jump instructions. If this option is used,
14260 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
14261
14262 @item -mno-specld-anomaly
14263 @opindex mno-specld-anomaly
14264 Don't generate extra code to prevent speculative loads from occurring.
14265
14266 @item -mcsync-anomaly
14267 @opindex mcsync-anomaly
14268 When enabled, the compiler ensures that the generated code does not
14269 contain CSYNC or SSYNC instructions too soon after conditional branches.
14270 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
14271
14272 @item -mno-csync-anomaly
14273 @opindex mno-csync-anomaly
14274 Don't generate extra code to prevent CSYNC or SSYNC instructions from
14275 occurring too soon after a conditional branch.
14276
14277 @item -mlow-64k
14278 @opindex mlow-64k
14279 When enabled, the compiler is free to take advantage of the knowledge that
14280 the entire program fits into the low 64k of memory.
14281
14282 @item -mno-low-64k
14283 @opindex mno-low-64k
14284 Assume that the program is arbitrarily large. This is the default.
14285
14286 @item -mstack-check-l1
14287 @opindex mstack-check-l1
14288 Do stack checking using information placed into L1 scratchpad memory by the
14289 uClinux kernel.
14290
14291 @item -mid-shared-library
14292 @opindex mid-shared-library
14293 Generate code that supports shared libraries via the library ID method.
14294 This allows for execute in place and shared libraries in an environment
14295 without virtual memory management. This option implies @option{-fPIC}.
14296 With a @samp{bfin-elf} target, this option implies @option{-msim}.
14297
14298 @item -mno-id-shared-library
14299 @opindex mno-id-shared-library
14300 Generate code that doesn't assume ID-based shared libraries are being used.
14301 This is the default.
14302
14303 @item -mleaf-id-shared-library
14304 @opindex mleaf-id-shared-library
14305 Generate code that supports shared libraries via the library ID method,
14306 but assumes that this library or executable won't link against any other
14307 ID shared libraries. That allows the compiler to use faster code for jumps
14308 and calls.
14309
14310 @item -mno-leaf-id-shared-library
14311 @opindex mno-leaf-id-shared-library
14312 Do not assume that the code being compiled won't link against any ID shared
14313 libraries. Slower code is generated for jump and call insns.
14314
14315 @item -mshared-library-id=n
14316 @opindex mshared-library-id
14317 Specifies the identification number of the ID-based shared library being
14318 compiled. Specifying a value of 0 generates more compact code; specifying
14319 other values forces the allocation of that number to the current
14320 library but is no more space- or time-efficient than omitting this option.
14321
14322 @item -msep-data
14323 @opindex msep-data
14324 Generate code that allows the data segment to be located in a different
14325 area of memory from the text segment. This allows for execute in place in
14326 an environment without virtual memory management by eliminating relocations
14327 against the text section.
14328
14329 @item -mno-sep-data
14330 @opindex mno-sep-data
14331 Generate code that assumes that the data segment follows the text segment.
14332 This is the default.
14333
14334 @item -mlong-calls
14335 @itemx -mno-long-calls
14336 @opindex mlong-calls
14337 @opindex mno-long-calls
14338 Tells the compiler to perform function calls by first loading the
14339 address of the function into a register and then performing a subroutine
14340 call on this register. This switch is needed if the target function
14341 lies outside of the 24-bit addressing range of the offset-based
14342 version of subroutine call instruction.
14343
14344 This feature is not enabled by default. Specifying
14345 @option{-mno-long-calls} restores the default behavior. Note these
14346 switches have no effect on how the compiler generates code to handle
14347 function calls via function pointers.
14348
14349 @item -mfast-fp
14350 @opindex mfast-fp
14351 Link with the fast floating-point library. This library relaxes some of
14352 the IEEE floating-point standard's rules for checking inputs against
14353 Not-a-Number (NAN), in the interest of performance.
14354
14355 @item -minline-plt
14356 @opindex minline-plt
14357 Enable inlining of PLT entries in function calls to functions that are
14358 not known to bind locally. It has no effect without @option{-mfdpic}.
14359
14360 @item -mmulticore
14361 @opindex mmulticore
14362 Build a standalone application for multicore Blackfin processors.
14363 This option causes proper start files and link scripts supporting
14364 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
14365 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
14366
14367 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
14368 selects the one-application-per-core programming model. Without
14369 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
14370 programming model is used. In this model, the main function of Core B
14371 should be named as @code{coreb_main}.
14372
14373 If this option is not used, the single-core application programming
14374 model is used.
14375
14376 @item -mcorea
14377 @opindex mcorea
14378 Build a standalone application for Core A of BF561 when using
14379 the one-application-per-core programming model. Proper start files
14380 and link scripts are used to support Core A, and the macro
14381 @code{__BFIN_COREA} is defined.
14382 This option can only be used in conjunction with @option{-mmulticore}.
14383
14384 @item -mcoreb
14385 @opindex mcoreb
14386 Build a standalone application for Core B of BF561 when using
14387 the one-application-per-core programming model. Proper start files
14388 and link scripts are used to support Core B, and the macro
14389 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
14390 should be used instead of @code{main}.
14391 This option can only be used in conjunction with @option{-mmulticore}.
14392
14393 @item -msdram
14394 @opindex msdram
14395 Build a standalone application for SDRAM. Proper start files and
14396 link scripts are used to put the application into SDRAM, and the macro
14397 @code{__BFIN_SDRAM} is defined.
14398 The loader should initialize SDRAM before loading the application.
14399
14400 @item -micplb
14401 @opindex micplb
14402 Assume that ICPLBs are enabled at run time. This has an effect on certain
14403 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
14404 are enabled; for standalone applications the default is off.
14405 @end table
14406
14407 @node C6X Options
14408 @subsection C6X Options
14409 @cindex C6X Options
14410
14411 @table @gcctabopt
14412 @item -march=@var{name}
14413 @opindex march
14414 This specifies the name of the target architecture. GCC uses this
14415 name to determine what kind of instructions it can emit when generating
14416 assembly code. Permissible names are: @samp{c62x},
14417 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
14418
14419 @item -mbig-endian
14420 @opindex mbig-endian
14421 Generate code for a big-endian target.
14422
14423 @item -mlittle-endian
14424 @opindex mlittle-endian
14425 Generate code for a little-endian target. This is the default.
14426
14427 @item -msim
14428 @opindex msim
14429 Choose startup files and linker script suitable for the simulator.
14430
14431 @item -msdata=default
14432 @opindex msdata=default
14433 Put small global and static data in the @code{.neardata} section,
14434 which is pointed to by register @code{B14}. Put small uninitialized
14435 global and static data in the @code{.bss} section, which is adjacent
14436 to the @code{.neardata} section. Put small read-only data into the
14437 @code{.rodata} section. The corresponding sections used for large
14438 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
14439
14440 @item -msdata=all
14441 @opindex msdata=all
14442 Put all data, not just small objects, into the sections reserved for
14443 small data, and use addressing relative to the @code{B14} register to
14444 access them.
14445
14446 @item -msdata=none
14447 @opindex msdata=none
14448 Make no use of the sections reserved for small data, and use absolute
14449 addresses to access all data. Put all initialized global and static
14450 data in the @code{.fardata} section, and all uninitialized data in the
14451 @code{.far} section. Put all constant data into the @code{.const}
14452 section.
14453 @end table
14454
14455 @node CRIS Options
14456 @subsection CRIS Options
14457 @cindex CRIS Options
14458
14459 These options are defined specifically for the CRIS ports.
14460
14461 @table @gcctabopt
14462 @item -march=@var{architecture-type}
14463 @itemx -mcpu=@var{architecture-type}
14464 @opindex march
14465 @opindex mcpu
14466 Generate code for the specified architecture. The choices for
14467 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
14468 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
14469 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
14470 @samp{v10}.
14471
14472 @item -mtune=@var{architecture-type}
14473 @opindex mtune
14474 Tune to @var{architecture-type} everything applicable about the generated
14475 code, except for the ABI and the set of available instructions. The
14476 choices for @var{architecture-type} are the same as for
14477 @option{-march=@var{architecture-type}}.
14478
14479 @item -mmax-stack-frame=@var{n}
14480 @opindex mmax-stack-frame
14481 Warn when the stack frame of a function exceeds @var{n} bytes.
14482
14483 @item -metrax4
14484 @itemx -metrax100
14485 @opindex metrax4
14486 @opindex metrax100
14487 The options @option{-metrax4} and @option{-metrax100} are synonyms for
14488 @option{-march=v3} and @option{-march=v8} respectively.
14489
14490 @item -mmul-bug-workaround
14491 @itemx -mno-mul-bug-workaround
14492 @opindex mmul-bug-workaround
14493 @opindex mno-mul-bug-workaround
14494 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
14495 models where it applies. This option is active by default.
14496
14497 @item -mpdebug
14498 @opindex mpdebug
14499 Enable CRIS-specific verbose debug-related information in the assembly
14500 code. This option also has the effect of turning off the @samp{#NO_APP}
14501 formatted-code indicator to the assembler at the beginning of the
14502 assembly file.
14503
14504 @item -mcc-init
14505 @opindex mcc-init
14506 Do not use condition-code results from previous instruction; always emit
14507 compare and test instructions before use of condition codes.
14508
14509 @item -mno-side-effects
14510 @opindex mno-side-effects
14511 Do not emit instructions with side effects in addressing modes other than
14512 post-increment.
14513
14514 @item -mstack-align
14515 @itemx -mno-stack-align
14516 @itemx -mdata-align
14517 @itemx -mno-data-align
14518 @itemx -mconst-align
14519 @itemx -mno-const-align
14520 @opindex mstack-align
14521 @opindex mno-stack-align
14522 @opindex mdata-align
14523 @opindex mno-data-align
14524 @opindex mconst-align
14525 @opindex mno-const-align
14526 These options (@samp{no-} options) arrange (eliminate arrangements) for the
14527 stack frame, individual data and constants to be aligned for the maximum
14528 single data access size for the chosen CPU model. The default is to
14529 arrange for 32-bit alignment. ABI details such as structure layout are
14530 not affected by these options.
14531
14532 @item -m32-bit
14533 @itemx -m16-bit
14534 @itemx -m8-bit
14535 @opindex m32-bit
14536 @opindex m16-bit
14537 @opindex m8-bit
14538 Similar to the stack- data- and const-align options above, these options
14539 arrange for stack frame, writable data and constants to all be 32-bit,
14540 16-bit or 8-bit aligned. The default is 32-bit alignment.
14541
14542 @item -mno-prologue-epilogue
14543 @itemx -mprologue-epilogue
14544 @opindex mno-prologue-epilogue
14545 @opindex mprologue-epilogue
14546 With @option{-mno-prologue-epilogue}, the normal function prologue and
14547 epilogue which set up the stack frame are omitted and no return
14548 instructions or return sequences are generated in the code. Use this
14549 option only together with visual inspection of the compiled code: no
14550 warnings or errors are generated when call-saved registers must be saved,
14551 or storage for local variables needs to be allocated.
14552
14553 @item -mno-gotplt
14554 @itemx -mgotplt
14555 @opindex mno-gotplt
14556 @opindex mgotplt
14557 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
14558 instruction sequences that load addresses for functions from the PLT part
14559 of the GOT rather than (traditional on other architectures) calls to the
14560 PLT@. The default is @option{-mgotplt}.
14561
14562 @item -melf
14563 @opindex melf
14564 Legacy no-op option only recognized with the cris-axis-elf and
14565 cris-axis-linux-gnu targets.
14566
14567 @item -mlinux
14568 @opindex mlinux
14569 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
14570
14571 @item -sim
14572 @opindex sim
14573 This option, recognized for the cris-axis-elf, arranges
14574 to link with input-output functions from a simulator library. Code,
14575 initialized data and zero-initialized data are allocated consecutively.
14576
14577 @item -sim2
14578 @opindex sim2
14579 Like @option{-sim}, but pass linker options to locate initialized data at
14580 0x40000000 and zero-initialized data at 0x80000000.
14581 @end table
14582
14583 @node CR16 Options
14584 @subsection CR16 Options
14585 @cindex CR16 Options
14586
14587 These options are defined specifically for the CR16 ports.
14588
14589 @table @gcctabopt
14590
14591 @item -mmac
14592 @opindex mmac
14593 Enable the use of multiply-accumulate instructions. Disabled by default.
14594
14595 @item -mcr16cplus
14596 @itemx -mcr16c
14597 @opindex mcr16cplus
14598 @opindex mcr16c
14599 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
14600 is default.
14601
14602 @item -msim
14603 @opindex msim
14604 Links the library libsim.a which is in compatible with simulator. Applicable
14605 to ELF compiler only.
14606
14607 @item -mint32
14608 @opindex mint32
14609 Choose integer type as 32-bit wide.
14610
14611 @item -mbit-ops
14612 @opindex mbit-ops
14613 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
14614
14615 @item -mdata-model=@var{model}
14616 @opindex mdata-model
14617 Choose a data model. The choices for @var{model} are @samp{near},
14618 @samp{far} or @samp{medium}. @samp{medium} is default.
14619 However, @samp{far} is not valid with @option{-mcr16c}, as the
14620 CR16C architecture does not support the far data model.
14621 @end table
14622
14623 @node Darwin Options
14624 @subsection Darwin Options
14625 @cindex Darwin options
14626
14627 These options are defined for all architectures running the Darwin operating
14628 system.
14629
14630 FSF GCC on Darwin does not create ``fat'' object files; it creates
14631 an object file for the single architecture that GCC was built to
14632 target. Apple's GCC on Darwin does create ``fat'' files if multiple
14633 @option{-arch} options are used; it does so by running the compiler or
14634 linker multiple times and joining the results together with
14635 @file{lipo}.
14636
14637 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
14638 @samp{i686}) is determined by the flags that specify the ISA
14639 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
14640 @option{-force_cpusubtype_ALL} option can be used to override this.
14641
14642 The Darwin tools vary in their behavior when presented with an ISA
14643 mismatch. The assembler, @file{as}, only permits instructions to
14644 be used that are valid for the subtype of the file it is generating,
14645 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
14646 The linker for shared libraries, @file{/usr/bin/libtool}, fails
14647 and prints an error if asked to create a shared library with a less
14648 restrictive subtype than its input files (for instance, trying to put
14649 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
14650 for executables, @command{ld}, quietly gives the executable the most
14651 restrictive subtype of any of its input files.
14652
14653 @table @gcctabopt
14654 @item -F@var{dir}
14655 @opindex F
14656 Add the framework directory @var{dir} to the head of the list of
14657 directories to be searched for header files. These directories are
14658 interleaved with those specified by @option{-I} options and are
14659 scanned in a left-to-right order.
14660
14661 A framework directory is a directory with frameworks in it. A
14662 framework is a directory with a @file{Headers} and/or
14663 @file{PrivateHeaders} directory contained directly in it that ends
14664 in @file{.framework}. The name of a framework is the name of this
14665 directory excluding the @file{.framework}. Headers associated with
14666 the framework are found in one of those two directories, with
14667 @file{Headers} being searched first. A subframework is a framework
14668 directory that is in a framework's @file{Frameworks} directory.
14669 Includes of subframework headers can only appear in a header of a
14670 framework that contains the subframework, or in a sibling subframework
14671 header. Two subframeworks are siblings if they occur in the same
14672 framework. A subframework should not have the same name as a
14673 framework; a warning is issued if this is violated. Currently a
14674 subframework cannot have subframeworks; in the future, the mechanism
14675 may be extended to support this. The standard frameworks can be found
14676 in @file{/System/Library/Frameworks} and
14677 @file{/Library/Frameworks}. An example include looks like
14678 @code{#include <Framework/header.h>}, where @file{Framework} denotes
14679 the name of the framework and @file{header.h} is found in the
14680 @file{PrivateHeaders} or @file{Headers} directory.
14681
14682 @item -iframework@var{dir}
14683 @opindex iframework
14684 Like @option{-F} except the directory is a treated as a system
14685 directory. The main difference between this @option{-iframework} and
14686 @option{-F} is that with @option{-iframework} the compiler does not
14687 warn about constructs contained within header files found via
14688 @var{dir}. This option is valid only for the C family of languages.
14689
14690 @item -gused
14691 @opindex gused
14692 Emit debugging information for symbols that are used. For stabs
14693 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
14694 This is by default ON@.
14695
14696 @item -gfull
14697 @opindex gfull
14698 Emit debugging information for all symbols and types.
14699
14700 @item -mmacosx-version-min=@var{version}
14701 The earliest version of MacOS X that this executable will run on
14702 is @var{version}. Typical values of @var{version} include @code{10.1},
14703 @code{10.2}, and @code{10.3.9}.
14704
14705 If the compiler was built to use the system's headers by default,
14706 then the default for this option is the system version on which the
14707 compiler is running, otherwise the default is to make choices that
14708 are compatible with as many systems and code bases as possible.
14709
14710 @item -mkernel
14711 @opindex mkernel
14712 Enable kernel development mode. The @option{-mkernel} option sets
14713 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
14714 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
14715 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
14716 applicable. This mode also sets @option{-mno-altivec},
14717 @option{-msoft-float}, @option{-fno-builtin} and
14718 @option{-mlong-branch} for PowerPC targets.
14719
14720 @item -mone-byte-bool
14721 @opindex mone-byte-bool
14722 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
14723 By default @code{sizeof(bool)} is @code{4} when compiling for
14724 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
14725 option has no effect on x86.
14726
14727 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
14728 to generate code that is not binary compatible with code generated
14729 without that switch. Using this switch may require recompiling all
14730 other modules in a program, including system libraries. Use this
14731 switch to conform to a non-default data model.
14732
14733 @item -mfix-and-continue
14734 @itemx -ffix-and-continue
14735 @itemx -findirect-data
14736 @opindex mfix-and-continue
14737 @opindex ffix-and-continue
14738 @opindex findirect-data
14739 Generate code suitable for fast turnaround development, such as to
14740 allow GDB to dynamically load @file{.o} files into already-running
14741 programs. @option{-findirect-data} and @option{-ffix-and-continue}
14742 are provided for backwards compatibility.
14743
14744 @item -all_load
14745 @opindex all_load
14746 Loads all members of static archive libraries.
14747 See man ld(1) for more information.
14748
14749 @item -arch_errors_fatal
14750 @opindex arch_errors_fatal
14751 Cause the errors having to do with files that have the wrong architecture
14752 to be fatal.
14753
14754 @item -bind_at_load
14755 @opindex bind_at_load
14756 Causes the output file to be marked such that the dynamic linker will
14757 bind all undefined references when the file is loaded or launched.
14758
14759 @item -bundle
14760 @opindex bundle
14761 Produce a Mach-o bundle format file.
14762 See man ld(1) for more information.
14763
14764 @item -bundle_loader @var{executable}
14765 @opindex bundle_loader
14766 This option specifies the @var{executable} that will load the build
14767 output file being linked. See man ld(1) for more information.
14768
14769 @item -dynamiclib
14770 @opindex dynamiclib
14771 When passed this option, GCC produces a dynamic library instead of
14772 an executable when linking, using the Darwin @file{libtool} command.
14773
14774 @item -force_cpusubtype_ALL
14775 @opindex force_cpusubtype_ALL
14776 This causes GCC's output file to have the @samp{ALL} subtype, instead of
14777 one controlled by the @option{-mcpu} or @option{-march} option.
14778
14779 @item -allowable_client @var{client_name}
14780 @itemx -client_name
14781 @itemx -compatibility_version
14782 @itemx -current_version
14783 @itemx -dead_strip
14784 @itemx -dependency-file
14785 @itemx -dylib_file
14786 @itemx -dylinker_install_name
14787 @itemx -dynamic
14788 @itemx -exported_symbols_list
14789 @itemx -filelist
14790 @need 800
14791 @itemx -flat_namespace
14792 @itemx -force_flat_namespace
14793 @itemx -headerpad_max_install_names
14794 @itemx -image_base
14795 @itemx -init
14796 @itemx -install_name
14797 @itemx -keep_private_externs
14798 @itemx -multi_module
14799 @itemx -multiply_defined
14800 @itemx -multiply_defined_unused
14801 @need 800
14802 @itemx -noall_load
14803 @itemx -no_dead_strip_inits_and_terms
14804 @itemx -nofixprebinding
14805 @itemx -nomultidefs
14806 @itemx -noprebind
14807 @itemx -noseglinkedit
14808 @itemx -pagezero_size
14809 @itemx -prebind
14810 @itemx -prebind_all_twolevel_modules
14811 @itemx -private_bundle
14812 @need 800
14813 @itemx -read_only_relocs
14814 @itemx -sectalign
14815 @itemx -sectobjectsymbols
14816 @itemx -whyload
14817 @itemx -seg1addr
14818 @itemx -sectcreate
14819 @itemx -sectobjectsymbols
14820 @itemx -sectorder
14821 @itemx -segaddr
14822 @itemx -segs_read_only_addr
14823 @need 800
14824 @itemx -segs_read_write_addr
14825 @itemx -seg_addr_table
14826 @itemx -seg_addr_table_filename
14827 @itemx -seglinkedit
14828 @itemx -segprot
14829 @itemx -segs_read_only_addr
14830 @itemx -segs_read_write_addr
14831 @itemx -single_module
14832 @itemx -static
14833 @itemx -sub_library
14834 @need 800
14835 @itemx -sub_umbrella
14836 @itemx -twolevel_namespace
14837 @itemx -umbrella
14838 @itemx -undefined
14839 @itemx -unexported_symbols_list
14840 @itemx -weak_reference_mismatches
14841 @itemx -whatsloaded
14842 @opindex allowable_client
14843 @opindex client_name
14844 @opindex compatibility_version
14845 @opindex current_version
14846 @opindex dead_strip
14847 @opindex dependency-file
14848 @opindex dylib_file
14849 @opindex dylinker_install_name
14850 @opindex dynamic
14851 @opindex exported_symbols_list
14852 @opindex filelist
14853 @opindex flat_namespace
14854 @opindex force_flat_namespace
14855 @opindex headerpad_max_install_names
14856 @opindex image_base
14857 @opindex init
14858 @opindex install_name
14859 @opindex keep_private_externs
14860 @opindex multi_module
14861 @opindex multiply_defined
14862 @opindex multiply_defined_unused
14863 @opindex noall_load
14864 @opindex no_dead_strip_inits_and_terms
14865 @opindex nofixprebinding
14866 @opindex nomultidefs
14867 @opindex noprebind
14868 @opindex noseglinkedit
14869 @opindex pagezero_size
14870 @opindex prebind
14871 @opindex prebind_all_twolevel_modules
14872 @opindex private_bundle
14873 @opindex read_only_relocs
14874 @opindex sectalign
14875 @opindex sectobjectsymbols
14876 @opindex whyload
14877 @opindex seg1addr
14878 @opindex sectcreate
14879 @opindex sectobjectsymbols
14880 @opindex sectorder
14881 @opindex segaddr
14882 @opindex segs_read_only_addr
14883 @opindex segs_read_write_addr
14884 @opindex seg_addr_table
14885 @opindex seg_addr_table_filename
14886 @opindex seglinkedit
14887 @opindex segprot
14888 @opindex segs_read_only_addr
14889 @opindex segs_read_write_addr
14890 @opindex single_module
14891 @opindex static
14892 @opindex sub_library
14893 @opindex sub_umbrella
14894 @opindex twolevel_namespace
14895 @opindex umbrella
14896 @opindex undefined
14897 @opindex unexported_symbols_list
14898 @opindex weak_reference_mismatches
14899 @opindex whatsloaded
14900 These options are passed to the Darwin linker. The Darwin linker man page
14901 describes them in detail.
14902 @end table
14903
14904 @node DEC Alpha Options
14905 @subsection DEC Alpha Options
14906
14907 These @samp{-m} options are defined for the DEC Alpha implementations:
14908
14909 @table @gcctabopt
14910 @item -mno-soft-float
14911 @itemx -msoft-float
14912 @opindex mno-soft-float
14913 @opindex msoft-float
14914 Use (do not use) the hardware floating-point instructions for
14915 floating-point operations. When @option{-msoft-float} is specified,
14916 functions in @file{libgcc.a} are used to perform floating-point
14917 operations. Unless they are replaced by routines that emulate the
14918 floating-point operations, or compiled in such a way as to call such
14919 emulations routines, these routines issue floating-point
14920 operations. If you are compiling for an Alpha without floating-point
14921 operations, you must ensure that the library is built so as not to call
14922 them.
14923
14924 Note that Alpha implementations without floating-point operations are
14925 required to have floating-point registers.
14926
14927 @item -mfp-reg
14928 @itemx -mno-fp-regs
14929 @opindex mfp-reg
14930 @opindex mno-fp-regs
14931 Generate code that uses (does not use) the floating-point register set.
14932 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
14933 register set is not used, floating-point operands are passed in integer
14934 registers as if they were integers and floating-point results are passed
14935 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
14936 so any function with a floating-point argument or return value called by code
14937 compiled with @option{-mno-fp-regs} must also be compiled with that
14938 option.
14939
14940 A typical use of this option is building a kernel that does not use,
14941 and hence need not save and restore, any floating-point registers.
14942
14943 @item -mieee
14944 @opindex mieee
14945 The Alpha architecture implements floating-point hardware optimized for
14946 maximum performance. It is mostly compliant with the IEEE floating-point
14947 standard. However, for full compliance, software assistance is
14948 required. This option generates code fully IEEE-compliant code
14949 @emph{except} that the @var{inexact-flag} is not maintained (see below).
14950 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
14951 defined during compilation. The resulting code is less efficient but is
14952 able to correctly support denormalized numbers and exceptional IEEE
14953 values such as not-a-number and plus/minus infinity. Other Alpha
14954 compilers call this option @option{-ieee_with_no_inexact}.
14955
14956 @item -mieee-with-inexact
14957 @opindex mieee-with-inexact
14958 This is like @option{-mieee} except the generated code also maintains
14959 the IEEE @var{inexact-flag}. Turning on this option causes the
14960 generated code to implement fully-compliant IEEE math. In addition to
14961 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
14962 macro. On some Alpha implementations the resulting code may execute
14963 significantly slower than the code generated by default. Since there is
14964 very little code that depends on the @var{inexact-flag}, you should
14965 normally not specify this option. Other Alpha compilers call this
14966 option @option{-ieee_with_inexact}.
14967
14968 @item -mfp-trap-mode=@var{trap-mode}
14969 @opindex mfp-trap-mode
14970 This option controls what floating-point related traps are enabled.
14971 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
14972 The trap mode can be set to one of four values:
14973
14974 @table @samp
14975 @item n
14976 This is the default (normal) setting. The only traps that are enabled
14977 are the ones that cannot be disabled in software (e.g., division by zero
14978 trap).
14979
14980 @item u
14981 In addition to the traps enabled by @samp{n}, underflow traps are enabled
14982 as well.
14983
14984 @item su
14985 Like @samp{u}, but the instructions are marked to be safe for software
14986 completion (see Alpha architecture manual for details).
14987
14988 @item sui
14989 Like @samp{su}, but inexact traps are enabled as well.
14990 @end table
14991
14992 @item -mfp-rounding-mode=@var{rounding-mode}
14993 @opindex mfp-rounding-mode
14994 Selects the IEEE rounding mode. Other Alpha compilers call this option
14995 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
14996 of:
14997
14998 @table @samp
14999 @item n
15000 Normal IEEE rounding mode. Floating-point numbers are rounded towards
15001 the nearest machine number or towards the even machine number in case
15002 of a tie.
15003
15004 @item m
15005 Round towards minus infinity.
15006
15007 @item c
15008 Chopped rounding mode. Floating-point numbers are rounded towards zero.
15009
15010 @item d
15011 Dynamic rounding mode. A field in the floating-point control register
15012 (@var{fpcr}, see Alpha architecture reference manual) controls the
15013 rounding mode in effect. The C library initializes this register for
15014 rounding towards plus infinity. Thus, unless your program modifies the
15015 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
15016 @end table
15017
15018 @item -mtrap-precision=@var{trap-precision}
15019 @opindex mtrap-precision
15020 In the Alpha architecture, floating-point traps are imprecise. This
15021 means without software assistance it is impossible to recover from a
15022 floating trap and program execution normally needs to be terminated.
15023 GCC can generate code that can assist operating system trap handlers
15024 in determining the exact location that caused a floating-point trap.
15025 Depending on the requirements of an application, different levels of
15026 precisions can be selected:
15027
15028 @table @samp
15029 @item p
15030 Program precision. This option is the default and means a trap handler
15031 can only identify which program caused a floating-point exception.
15032
15033 @item f
15034 Function precision. The trap handler can determine the function that
15035 caused a floating-point exception.
15036
15037 @item i
15038 Instruction precision. The trap handler can determine the exact
15039 instruction that caused a floating-point exception.
15040 @end table
15041
15042 Other Alpha compilers provide the equivalent options called
15043 @option{-scope_safe} and @option{-resumption_safe}.
15044
15045 @item -mieee-conformant
15046 @opindex mieee-conformant
15047 This option marks the generated code as IEEE conformant. You must not
15048 use this option unless you also specify @option{-mtrap-precision=i} and either
15049 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
15050 is to emit the line @samp{.eflag 48} in the function prologue of the
15051 generated assembly file.
15052
15053 @item -mbuild-constants
15054 @opindex mbuild-constants
15055 Normally GCC examines a 32- or 64-bit integer constant to
15056 see if it can construct it from smaller constants in two or three
15057 instructions. If it cannot, it outputs the constant as a literal and
15058 generates code to load it from the data segment at run time.
15059
15060 Use this option to require GCC to construct @emph{all} integer constants
15061 using code, even if it takes more instructions (the maximum is six).
15062
15063 You typically use this option to build a shared library dynamic
15064 loader. Itself a shared library, it must relocate itself in memory
15065 before it can find the variables and constants in its own data segment.
15066
15067 @item -mbwx
15068 @itemx -mno-bwx
15069 @itemx -mcix
15070 @itemx -mno-cix
15071 @itemx -mfix
15072 @itemx -mno-fix
15073 @itemx -mmax
15074 @itemx -mno-max
15075 @opindex mbwx
15076 @opindex mno-bwx
15077 @opindex mcix
15078 @opindex mno-cix
15079 @opindex mfix
15080 @opindex mno-fix
15081 @opindex mmax
15082 @opindex mno-max
15083 Indicate whether GCC should generate code to use the optional BWX,
15084 CIX, FIX and MAX instruction sets. The default is to use the instruction
15085 sets supported by the CPU type specified via @option{-mcpu=} option or that
15086 of the CPU on which GCC was built if none is specified.
15087
15088 @item -mfloat-vax
15089 @itemx -mfloat-ieee
15090 @opindex mfloat-vax
15091 @opindex mfloat-ieee
15092 Generate code that uses (does not use) VAX F and G floating-point
15093 arithmetic instead of IEEE single and double precision.
15094
15095 @item -mexplicit-relocs
15096 @itemx -mno-explicit-relocs
15097 @opindex mexplicit-relocs
15098 @opindex mno-explicit-relocs
15099 Older Alpha assemblers provided no way to generate symbol relocations
15100 except via assembler macros. Use of these macros does not allow
15101 optimal instruction scheduling. GNU binutils as of version 2.12
15102 supports a new syntax that allows the compiler to explicitly mark
15103 which relocations should apply to which instructions. This option
15104 is mostly useful for debugging, as GCC detects the capabilities of
15105 the assembler when it is built and sets the default accordingly.
15106
15107 @item -msmall-data
15108 @itemx -mlarge-data
15109 @opindex msmall-data
15110 @opindex mlarge-data
15111 When @option{-mexplicit-relocs} is in effect, static data is
15112 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
15113 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
15114 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
15115 16-bit relocations off of the @code{$gp} register. This limits the
15116 size of the small data area to 64KB, but allows the variables to be
15117 directly accessed via a single instruction.
15118
15119 The default is @option{-mlarge-data}. With this option the data area
15120 is limited to just below 2GB@. Programs that require more than 2GB of
15121 data must use @code{malloc} or @code{mmap} to allocate the data in the
15122 heap instead of in the program's data segment.
15123
15124 When generating code for shared libraries, @option{-fpic} implies
15125 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
15126
15127 @item -msmall-text
15128 @itemx -mlarge-text
15129 @opindex msmall-text
15130 @opindex mlarge-text
15131 When @option{-msmall-text} is used, the compiler assumes that the
15132 code of the entire program (or shared library) fits in 4MB, and is
15133 thus reachable with a branch instruction. When @option{-msmall-data}
15134 is used, the compiler can assume that all local symbols share the
15135 same @code{$gp} value, and thus reduce the number of instructions
15136 required for a function call from 4 to 1.
15137
15138 The default is @option{-mlarge-text}.
15139
15140 @item -mcpu=@var{cpu_type}
15141 @opindex mcpu
15142 Set the instruction set and instruction scheduling parameters for
15143 machine type @var{cpu_type}. You can specify either the @samp{EV}
15144 style name or the corresponding chip number. GCC supports scheduling
15145 parameters for the EV4, EV5 and EV6 family of processors and
15146 chooses the default values for the instruction set from the processor
15147 you specify. If you do not specify a processor type, GCC defaults
15148 to the processor on which the compiler was built.
15149
15150 Supported values for @var{cpu_type} are
15151
15152 @table @samp
15153 @item ev4
15154 @itemx ev45
15155 @itemx 21064
15156 Schedules as an EV4 and has no instruction set extensions.
15157
15158 @item ev5
15159 @itemx 21164
15160 Schedules as an EV5 and has no instruction set extensions.
15161
15162 @item ev56
15163 @itemx 21164a
15164 Schedules as an EV5 and supports the BWX extension.
15165
15166 @item pca56
15167 @itemx 21164pc
15168 @itemx 21164PC
15169 Schedules as an EV5 and supports the BWX and MAX extensions.
15170
15171 @item ev6
15172 @itemx 21264
15173 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
15174
15175 @item ev67
15176 @itemx 21264a
15177 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
15178 @end table
15179
15180 Native toolchains also support the value @samp{native},
15181 which selects the best architecture option for the host processor.
15182 @option{-mcpu=native} has no effect if GCC does not recognize
15183 the processor.
15184
15185 @item -mtune=@var{cpu_type}
15186 @opindex mtune
15187 Set only the instruction scheduling parameters for machine type
15188 @var{cpu_type}. The instruction set is not changed.
15189
15190 Native toolchains also support the value @samp{native},
15191 which selects the best architecture option for the host processor.
15192 @option{-mtune=native} has no effect if GCC does not recognize
15193 the processor.
15194
15195 @item -mmemory-latency=@var{time}
15196 @opindex mmemory-latency
15197 Sets the latency the scheduler should assume for typical memory
15198 references as seen by the application. This number is highly
15199 dependent on the memory access patterns used by the application
15200 and the size of the external cache on the machine.
15201
15202 Valid options for @var{time} are
15203
15204 @table @samp
15205 @item @var{number}
15206 A decimal number representing clock cycles.
15207
15208 @item L1
15209 @itemx L2
15210 @itemx L3
15211 @itemx main
15212 The compiler contains estimates of the number of clock cycles for
15213 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
15214 (also called Dcache, Scache, and Bcache), as well as to main memory.
15215 Note that L3 is only valid for EV5.
15216
15217 @end table
15218 @end table
15219
15220 @node FR30 Options
15221 @subsection FR30 Options
15222 @cindex FR30 Options
15223
15224 These options are defined specifically for the FR30 port.
15225
15226 @table @gcctabopt
15227
15228 @item -msmall-model
15229 @opindex msmall-model
15230 Use the small address space model. This can produce smaller code, but
15231 it does assume that all symbolic values and addresses fit into a
15232 20-bit range.
15233
15234 @item -mno-lsim
15235 @opindex mno-lsim
15236 Assume that runtime support has been provided and so there is no need
15237 to include the simulator library (@file{libsim.a}) on the linker
15238 command line.
15239
15240 @end table
15241
15242 @node FT32 Options
15243 @subsection FT32 Options
15244 @cindex FT32 Options
15245
15246 These options are defined specifically for the FT32 port.
15247
15248 @table @gcctabopt
15249
15250 @item -msim
15251 @opindex msim
15252 Specifies that the program will be run on the simulator. This causes
15253 an alternate runtime startup and library to be linked.
15254 You must not use this option when generating programs that will run on
15255 real hardware; you must provide your own runtime library for whatever
15256 I/O functions are needed.
15257
15258 @item -mlra
15259 @opindex mlra
15260 Enable Local Register Allocation. This is still experimental for FT32,
15261 so by default the compiler uses standard reload.
15262
15263 @end table
15264
15265 @node FRV Options
15266 @subsection FRV Options
15267 @cindex FRV Options
15268
15269 @table @gcctabopt
15270 @item -mgpr-32
15271 @opindex mgpr-32
15272
15273 Only use the first 32 general-purpose registers.
15274
15275 @item -mgpr-64
15276 @opindex mgpr-64
15277
15278 Use all 64 general-purpose registers.
15279
15280 @item -mfpr-32
15281 @opindex mfpr-32
15282
15283 Use only the first 32 floating-point registers.
15284
15285 @item -mfpr-64
15286 @opindex mfpr-64
15287
15288 Use all 64 floating-point registers.
15289
15290 @item -mhard-float
15291 @opindex mhard-float
15292
15293 Use hardware instructions for floating-point operations.
15294
15295 @item -msoft-float
15296 @opindex msoft-float
15297
15298 Use library routines for floating-point operations.
15299
15300 @item -malloc-cc
15301 @opindex malloc-cc
15302
15303 Dynamically allocate condition code registers.
15304
15305 @item -mfixed-cc
15306 @opindex mfixed-cc
15307
15308 Do not try to dynamically allocate condition code registers, only
15309 use @code{icc0} and @code{fcc0}.
15310
15311 @item -mdword
15312 @opindex mdword
15313
15314 Change ABI to use double word insns.
15315
15316 @item -mno-dword
15317 @opindex mno-dword
15318
15319 Do not use double word instructions.
15320
15321 @item -mdouble
15322 @opindex mdouble
15323
15324 Use floating-point double instructions.
15325
15326 @item -mno-double
15327 @opindex mno-double
15328
15329 Do not use floating-point double instructions.
15330
15331 @item -mmedia
15332 @opindex mmedia
15333
15334 Use media instructions.
15335
15336 @item -mno-media
15337 @opindex mno-media
15338
15339 Do not use media instructions.
15340
15341 @item -mmuladd
15342 @opindex mmuladd
15343
15344 Use multiply and add/subtract instructions.
15345
15346 @item -mno-muladd
15347 @opindex mno-muladd
15348
15349 Do not use multiply and add/subtract instructions.
15350
15351 @item -mfdpic
15352 @opindex mfdpic
15353
15354 Select the FDPIC ABI, which uses function descriptors to represent
15355 pointers to functions. Without any PIC/PIE-related options, it
15356 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
15357 assumes GOT entries and small data are within a 12-bit range from the
15358 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
15359 are computed with 32 bits.
15360 With a @samp{bfin-elf} target, this option implies @option{-msim}.
15361
15362 @item -minline-plt
15363 @opindex minline-plt
15364
15365 Enable inlining of PLT entries in function calls to functions that are
15366 not known to bind locally. It has no effect without @option{-mfdpic}.
15367 It's enabled by default if optimizing for speed and compiling for
15368 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
15369 optimization option such as @option{-O3} or above is present in the
15370 command line.
15371
15372 @item -mTLS
15373 @opindex mTLS
15374
15375 Assume a large TLS segment when generating thread-local code.
15376
15377 @item -mtls
15378 @opindex mtls
15379
15380 Do not assume a large TLS segment when generating thread-local code.
15381
15382 @item -mgprel-ro
15383 @opindex mgprel-ro
15384
15385 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
15386 that is known to be in read-only sections. It's enabled by default,
15387 except for @option{-fpic} or @option{-fpie}: even though it may help
15388 make the global offset table smaller, it trades 1 instruction for 4.
15389 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
15390 one of which may be shared by multiple symbols, and it avoids the need
15391 for a GOT entry for the referenced symbol, so it's more likely to be a
15392 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
15393
15394 @item -multilib-library-pic
15395 @opindex multilib-library-pic
15396
15397 Link with the (library, not FD) pic libraries. It's implied by
15398 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
15399 @option{-fpic} without @option{-mfdpic}. You should never have to use
15400 it explicitly.
15401
15402 @item -mlinked-fp
15403 @opindex mlinked-fp
15404
15405 Follow the EABI requirement of always creating a frame pointer whenever
15406 a stack frame is allocated. This option is enabled by default and can
15407 be disabled with @option{-mno-linked-fp}.
15408
15409 @item -mlong-calls
15410 @opindex mlong-calls
15411
15412 Use indirect addressing to call functions outside the current
15413 compilation unit. This allows the functions to be placed anywhere
15414 within the 32-bit address space.
15415
15416 @item -malign-labels
15417 @opindex malign-labels
15418
15419 Try to align labels to an 8-byte boundary by inserting NOPs into the
15420 previous packet. This option only has an effect when VLIW packing
15421 is enabled. It doesn't create new packets; it merely adds NOPs to
15422 existing ones.
15423
15424 @item -mlibrary-pic
15425 @opindex mlibrary-pic
15426
15427 Generate position-independent EABI code.
15428
15429 @item -macc-4
15430 @opindex macc-4
15431
15432 Use only the first four media accumulator registers.
15433
15434 @item -macc-8
15435 @opindex macc-8
15436
15437 Use all eight media accumulator registers.
15438
15439 @item -mpack
15440 @opindex mpack
15441
15442 Pack VLIW instructions.
15443
15444 @item -mno-pack
15445 @opindex mno-pack
15446
15447 Do not pack VLIW instructions.
15448
15449 @item -mno-eflags
15450 @opindex mno-eflags
15451
15452 Do not mark ABI switches in e_flags.
15453
15454 @item -mcond-move
15455 @opindex mcond-move
15456
15457 Enable the use of conditional-move instructions (default).
15458
15459 This switch is mainly for debugging the compiler and will likely be removed
15460 in a future version.
15461
15462 @item -mno-cond-move
15463 @opindex mno-cond-move
15464
15465 Disable the use of conditional-move instructions.
15466
15467 This switch is mainly for debugging the compiler and will likely be removed
15468 in a future version.
15469
15470 @item -mscc
15471 @opindex mscc
15472
15473 Enable the use of conditional set instructions (default).
15474
15475 This switch is mainly for debugging the compiler and will likely be removed
15476 in a future version.
15477
15478 @item -mno-scc
15479 @opindex mno-scc
15480
15481 Disable the use of conditional set instructions.
15482
15483 This switch is mainly for debugging the compiler and will likely be removed
15484 in a future version.
15485
15486 @item -mcond-exec
15487 @opindex mcond-exec
15488
15489 Enable the use of conditional execution (default).
15490
15491 This switch is mainly for debugging the compiler and will likely be removed
15492 in a future version.
15493
15494 @item -mno-cond-exec
15495 @opindex mno-cond-exec
15496
15497 Disable the use of conditional execution.
15498
15499 This switch is mainly for debugging the compiler and will likely be removed
15500 in a future version.
15501
15502 @item -mvliw-branch
15503 @opindex mvliw-branch
15504
15505 Run a pass to pack branches into VLIW instructions (default).
15506
15507 This switch is mainly for debugging the compiler and will likely be removed
15508 in a future version.
15509
15510 @item -mno-vliw-branch
15511 @opindex mno-vliw-branch
15512
15513 Do not run a pass to pack branches into VLIW instructions.
15514
15515 This switch is mainly for debugging the compiler and will likely be removed
15516 in a future version.
15517
15518 @item -mmulti-cond-exec
15519 @opindex mmulti-cond-exec
15520
15521 Enable optimization of @code{&&} and @code{||} in conditional execution
15522 (default).
15523
15524 This switch is mainly for debugging the compiler and will likely be removed
15525 in a future version.
15526
15527 @item -mno-multi-cond-exec
15528 @opindex mno-multi-cond-exec
15529
15530 Disable optimization of @code{&&} and @code{||} in conditional execution.
15531
15532 This switch is mainly for debugging the compiler and will likely be removed
15533 in a future version.
15534
15535 @item -mnested-cond-exec
15536 @opindex mnested-cond-exec
15537
15538 Enable nested conditional execution optimizations (default).
15539
15540 This switch is mainly for debugging the compiler and will likely be removed
15541 in a future version.
15542
15543 @item -mno-nested-cond-exec
15544 @opindex mno-nested-cond-exec
15545
15546 Disable nested conditional execution optimizations.
15547
15548 This switch is mainly for debugging the compiler and will likely be removed
15549 in a future version.
15550
15551 @item -moptimize-membar
15552 @opindex moptimize-membar
15553
15554 This switch removes redundant @code{membar} instructions from the
15555 compiler-generated code. It is enabled by default.
15556
15557 @item -mno-optimize-membar
15558 @opindex mno-optimize-membar
15559
15560 This switch disables the automatic removal of redundant @code{membar}
15561 instructions from the generated code.
15562
15563 @item -mtomcat-stats
15564 @opindex mtomcat-stats
15565
15566 Cause gas to print out tomcat statistics.
15567
15568 @item -mcpu=@var{cpu}
15569 @opindex mcpu
15570
15571 Select the processor type for which to generate code. Possible values are
15572 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
15573 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
15574
15575 @end table
15576
15577 @node GNU/Linux Options
15578 @subsection GNU/Linux Options
15579
15580 These @samp{-m} options are defined for GNU/Linux targets:
15581
15582 @table @gcctabopt
15583 @item -mglibc
15584 @opindex mglibc
15585 Use the GNU C library. This is the default except
15586 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
15587 @samp{*-*-linux-*android*} targets.
15588
15589 @item -muclibc
15590 @opindex muclibc
15591 Use uClibc C library. This is the default on
15592 @samp{*-*-linux-*uclibc*} targets.
15593
15594 @item -mmusl
15595 @opindex mmusl
15596 Use the musl C library. This is the default on
15597 @samp{*-*-linux-*musl*} targets.
15598
15599 @item -mbionic
15600 @opindex mbionic
15601 Use Bionic C library. This is the default on
15602 @samp{*-*-linux-*android*} targets.
15603
15604 @item -mandroid
15605 @opindex mandroid
15606 Compile code compatible with Android platform. This is the default on
15607 @samp{*-*-linux-*android*} targets.
15608
15609 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
15610 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
15611 this option makes the GCC driver pass Android-specific options to the linker.
15612 Finally, this option causes the preprocessor macro @code{__ANDROID__}
15613 to be defined.
15614
15615 @item -tno-android-cc
15616 @opindex tno-android-cc
15617 Disable compilation effects of @option{-mandroid}, i.e., do not enable
15618 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
15619 @option{-fno-rtti} by default.
15620
15621 @item -tno-android-ld
15622 @opindex tno-android-ld
15623 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
15624 linking options to the linker.
15625
15626 @end table
15627
15628 @node H8/300 Options
15629 @subsection H8/300 Options
15630
15631 These @samp{-m} options are defined for the H8/300 implementations:
15632
15633 @table @gcctabopt
15634 @item -mrelax
15635 @opindex mrelax
15636 Shorten some address references at link time, when possible; uses the
15637 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
15638 ld, Using ld}, for a fuller description.
15639
15640 @item -mh
15641 @opindex mh
15642 Generate code for the H8/300H@.
15643
15644 @item -ms
15645 @opindex ms
15646 Generate code for the H8S@.
15647
15648 @item -mn
15649 @opindex mn
15650 Generate code for the H8S and H8/300H in the normal mode. This switch
15651 must be used either with @option{-mh} or @option{-ms}.
15652
15653 @item -ms2600
15654 @opindex ms2600
15655 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
15656
15657 @item -mexr
15658 @opindex mexr
15659 Extended registers are stored on stack before execution of function
15660 with monitor attribute. Default option is @option{-mexr}.
15661 This option is valid only for H8S targets.
15662
15663 @item -mno-exr
15664 @opindex mno-exr
15665 Extended registers are not stored on stack before execution of function
15666 with monitor attribute. Default option is @option{-mno-exr}.
15667 This option is valid only for H8S targets.
15668
15669 @item -mint32
15670 @opindex mint32
15671 Make @code{int} data 32 bits by default.
15672
15673 @item -malign-300
15674 @opindex malign-300
15675 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
15676 The default for the H8/300H and H8S is to align longs and floats on
15677 4-byte boundaries.
15678 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
15679 This option has no effect on the H8/300.
15680 @end table
15681
15682 @node HPPA Options
15683 @subsection HPPA Options
15684 @cindex HPPA Options
15685
15686 These @samp{-m} options are defined for the HPPA family of computers:
15687
15688 @table @gcctabopt
15689 @item -march=@var{architecture-type}
15690 @opindex march
15691 Generate code for the specified architecture. The choices for
15692 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
15693 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
15694 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
15695 architecture option for your machine. Code compiled for lower numbered
15696 architectures runs on higher numbered architectures, but not the
15697 other way around.
15698
15699 @item -mpa-risc-1-0
15700 @itemx -mpa-risc-1-1
15701 @itemx -mpa-risc-2-0
15702 @opindex mpa-risc-1-0
15703 @opindex mpa-risc-1-1
15704 @opindex mpa-risc-2-0
15705 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
15706
15707 @item -mjump-in-delay
15708 @opindex mjump-in-delay
15709 This option is ignored and provided for compatibility purposes only.
15710
15711 @item -mdisable-fpregs
15712 @opindex mdisable-fpregs
15713 Prevent floating-point registers from being used in any manner. This is
15714 necessary for compiling kernels that perform lazy context switching of
15715 floating-point registers. If you use this option and attempt to perform
15716 floating-point operations, the compiler aborts.
15717
15718 @item -mdisable-indexing
15719 @opindex mdisable-indexing
15720 Prevent the compiler from using indexing address modes. This avoids some
15721 rather obscure problems when compiling MIG generated code under MACH@.
15722
15723 @item -mno-space-regs
15724 @opindex mno-space-regs
15725 Generate code that assumes the target has no space registers. This allows
15726 GCC to generate faster indirect calls and use unscaled index address modes.
15727
15728 Such code is suitable for level 0 PA systems and kernels.
15729
15730 @item -mfast-indirect-calls
15731 @opindex mfast-indirect-calls
15732 Generate code that assumes calls never cross space boundaries. This
15733 allows GCC to emit code that performs faster indirect calls.
15734
15735 This option does not work in the presence of shared libraries or nested
15736 functions.
15737
15738 @item -mfixed-range=@var{register-range}
15739 @opindex mfixed-range
15740 Generate code treating the given register range as fixed registers.
15741 A fixed register is one that the register allocator cannot use. This is
15742 useful when compiling kernel code. A register range is specified as
15743 two registers separated by a dash. Multiple register ranges can be
15744 specified separated by a comma.
15745
15746 @item -mlong-load-store
15747 @opindex mlong-load-store
15748 Generate 3-instruction load and store sequences as sometimes required by
15749 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
15750 the HP compilers.
15751
15752 @item -mportable-runtime
15753 @opindex mportable-runtime
15754 Use the portable calling conventions proposed by HP for ELF systems.
15755
15756 @item -mgas
15757 @opindex mgas
15758 Enable the use of assembler directives only GAS understands.
15759
15760 @item -mschedule=@var{cpu-type}
15761 @opindex mschedule
15762 Schedule code according to the constraints for the machine type
15763 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
15764 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
15765 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
15766 proper scheduling option for your machine. The default scheduling is
15767 @samp{8000}.
15768
15769 @item -mlinker-opt
15770 @opindex mlinker-opt
15771 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
15772 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
15773 linkers in which they give bogus error messages when linking some programs.
15774
15775 @item -msoft-float
15776 @opindex msoft-float
15777 Generate output containing library calls for floating point.
15778 @strong{Warning:} the requisite libraries are not available for all HPPA
15779 targets. Normally the facilities of the machine's usual C compiler are
15780 used, but this cannot be done directly in cross-compilation. You must make
15781 your own arrangements to provide suitable library functions for
15782 cross-compilation.
15783
15784 @option{-msoft-float} changes the calling convention in the output file;
15785 therefore, it is only useful if you compile @emph{all} of a program with
15786 this option. In particular, you need to compile @file{libgcc.a}, the
15787 library that comes with GCC, with @option{-msoft-float} in order for
15788 this to work.
15789
15790 @item -msio
15791 @opindex msio
15792 Generate the predefine, @code{_SIO}, for server IO@. The default is
15793 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
15794 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
15795 options are available under HP-UX and HI-UX@.
15796
15797 @item -mgnu-ld
15798 @opindex mgnu-ld
15799 Use options specific to GNU @command{ld}.
15800 This passes @option{-shared} to @command{ld} when
15801 building a shared library. It is the default when GCC is configured,
15802 explicitly or implicitly, with the GNU linker. This option does not
15803 affect which @command{ld} is called; it only changes what parameters
15804 are passed to that @command{ld}.
15805 The @command{ld} that is called is determined by the
15806 @option{--with-ld} configure option, GCC's program search path, and
15807 finally by the user's @env{PATH}. The linker used by GCC can be printed
15808 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
15809 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
15810
15811 @item -mhp-ld
15812 @opindex mhp-ld
15813 Use options specific to HP @command{ld}.
15814 This passes @option{-b} to @command{ld} when building
15815 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
15816 links. It is the default when GCC is configured, explicitly or
15817 implicitly, with the HP linker. This option does not affect
15818 which @command{ld} is called; it only changes what parameters are passed to that
15819 @command{ld}.
15820 The @command{ld} that is called is determined by the @option{--with-ld}
15821 configure option, GCC's program search path, and finally by the user's
15822 @env{PATH}. The linker used by GCC can be printed using @samp{which
15823 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
15824 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
15825
15826 @item -mlong-calls
15827 @opindex mno-long-calls
15828 Generate code that uses long call sequences. This ensures that a call
15829 is always able to reach linker generated stubs. The default is to generate
15830 long calls only when the distance from the call site to the beginning
15831 of the function or translation unit, as the case may be, exceeds a
15832 predefined limit set by the branch type being used. The limits for
15833 normal calls are 7,600,000 and 240,000 bytes, respectively for the
15834 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
15835 240,000 bytes.
15836
15837 Distances are measured from the beginning of functions when using the
15838 @option{-ffunction-sections} option, or when using the @option{-mgas}
15839 and @option{-mno-portable-runtime} options together under HP-UX with
15840 the SOM linker.
15841
15842 It is normally not desirable to use this option as it degrades
15843 performance. However, it may be useful in large applications,
15844 particularly when partial linking is used to build the application.
15845
15846 The types of long calls used depends on the capabilities of the
15847 assembler and linker, and the type of code being generated. The
15848 impact on systems that support long absolute calls, and long pic
15849 symbol-difference or pc-relative calls should be relatively small.
15850 However, an indirect call is used on 32-bit ELF systems in pic code
15851 and it is quite long.
15852
15853 @item -munix=@var{unix-std}
15854 @opindex march
15855 Generate compiler predefines and select a startfile for the specified
15856 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
15857 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
15858 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
15859 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
15860 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
15861 and later.
15862
15863 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
15864 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
15865 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
15866 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
15867 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
15868 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
15869
15870 It is @emph{important} to note that this option changes the interfaces
15871 for various library routines. It also affects the operational behavior
15872 of the C library. Thus, @emph{extreme} care is needed in using this
15873 option.
15874
15875 Library code that is intended to operate with more than one UNIX
15876 standard must test, set and restore the variable @code{__xpg4_extended_mask}
15877 as appropriate. Most GNU software doesn't provide this capability.
15878
15879 @item -nolibdld
15880 @opindex nolibdld
15881 Suppress the generation of link options to search libdld.sl when the
15882 @option{-static} option is specified on HP-UX 10 and later.
15883
15884 @item -static
15885 @opindex static
15886 The HP-UX implementation of setlocale in libc has a dependency on
15887 libdld.sl. There isn't an archive version of libdld.sl. Thus,
15888 when the @option{-static} option is specified, special link options
15889 are needed to resolve this dependency.
15890
15891 On HP-UX 10 and later, the GCC driver adds the necessary options to
15892 link with libdld.sl when the @option{-static} option is specified.
15893 This causes the resulting binary to be dynamic. On the 64-bit port,
15894 the linkers generate dynamic binaries by default in any case. The
15895 @option{-nolibdld} option can be used to prevent the GCC driver from
15896 adding these link options.
15897
15898 @item -threads
15899 @opindex threads
15900 Add support for multithreading with the @dfn{dce thread} library
15901 under HP-UX@. This option sets flags for both the preprocessor and
15902 linker.
15903 @end table
15904
15905 @node IA-64 Options
15906 @subsection IA-64 Options
15907 @cindex IA-64 Options
15908
15909 These are the @samp{-m} options defined for the Intel IA-64 architecture.
15910
15911 @table @gcctabopt
15912 @item -mbig-endian
15913 @opindex mbig-endian
15914 Generate code for a big-endian target. This is the default for HP-UX@.
15915
15916 @item -mlittle-endian
15917 @opindex mlittle-endian
15918 Generate code for a little-endian target. This is the default for AIX5
15919 and GNU/Linux.
15920
15921 @item -mgnu-as
15922 @itemx -mno-gnu-as
15923 @opindex mgnu-as
15924 @opindex mno-gnu-as
15925 Generate (or don't) code for the GNU assembler. This is the default.
15926 @c Also, this is the default if the configure option @option{--with-gnu-as}
15927 @c is used.
15928
15929 @item -mgnu-ld
15930 @itemx -mno-gnu-ld
15931 @opindex mgnu-ld
15932 @opindex mno-gnu-ld
15933 Generate (or don't) code for the GNU linker. This is the default.
15934 @c Also, this is the default if the configure option @option{--with-gnu-ld}
15935 @c is used.
15936
15937 @item -mno-pic
15938 @opindex mno-pic
15939 Generate code that does not use a global pointer register. The result
15940 is not position independent code, and violates the IA-64 ABI@.
15941
15942 @item -mvolatile-asm-stop
15943 @itemx -mno-volatile-asm-stop
15944 @opindex mvolatile-asm-stop
15945 @opindex mno-volatile-asm-stop
15946 Generate (or don't) a stop bit immediately before and after volatile asm
15947 statements.
15948
15949 @item -mregister-names
15950 @itemx -mno-register-names
15951 @opindex mregister-names
15952 @opindex mno-register-names
15953 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
15954 the stacked registers. This may make assembler output more readable.
15955
15956 @item -mno-sdata
15957 @itemx -msdata
15958 @opindex mno-sdata
15959 @opindex msdata
15960 Disable (or enable) optimizations that use the small data section. This may
15961 be useful for working around optimizer bugs.
15962
15963 @item -mconstant-gp
15964 @opindex mconstant-gp
15965 Generate code that uses a single constant global pointer value. This is
15966 useful when compiling kernel code.
15967
15968 @item -mauto-pic
15969 @opindex mauto-pic
15970 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
15971 This is useful when compiling firmware code.
15972
15973 @item -minline-float-divide-min-latency
15974 @opindex minline-float-divide-min-latency
15975 Generate code for inline divides of floating-point values
15976 using the minimum latency algorithm.
15977
15978 @item -minline-float-divide-max-throughput
15979 @opindex minline-float-divide-max-throughput
15980 Generate code for inline divides of floating-point values
15981 using the maximum throughput algorithm.
15982
15983 @item -mno-inline-float-divide
15984 @opindex mno-inline-float-divide
15985 Do not generate inline code for divides of floating-point values.
15986
15987 @item -minline-int-divide-min-latency
15988 @opindex minline-int-divide-min-latency
15989 Generate code for inline divides of integer values
15990 using the minimum latency algorithm.
15991
15992 @item -minline-int-divide-max-throughput
15993 @opindex minline-int-divide-max-throughput
15994 Generate code for inline divides of integer values
15995 using the maximum throughput algorithm.
15996
15997 @item -mno-inline-int-divide
15998 @opindex mno-inline-int-divide
15999 Do not generate inline code for divides of integer values.
16000
16001 @item -minline-sqrt-min-latency
16002 @opindex minline-sqrt-min-latency
16003 Generate code for inline square roots
16004 using the minimum latency algorithm.
16005
16006 @item -minline-sqrt-max-throughput
16007 @opindex minline-sqrt-max-throughput
16008 Generate code for inline square roots
16009 using the maximum throughput algorithm.
16010
16011 @item -mno-inline-sqrt
16012 @opindex mno-inline-sqrt
16013 Do not generate inline code for @code{sqrt}.
16014
16015 @item -mfused-madd
16016 @itemx -mno-fused-madd
16017 @opindex mfused-madd
16018 @opindex mno-fused-madd
16019 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
16020 instructions. The default is to use these instructions.
16021
16022 @item -mno-dwarf2-asm
16023 @itemx -mdwarf2-asm
16024 @opindex mno-dwarf2-asm
16025 @opindex mdwarf2-asm
16026 Don't (or do) generate assembler code for the DWARF 2 line number debugging
16027 info. This may be useful when not using the GNU assembler.
16028
16029 @item -mearly-stop-bits
16030 @itemx -mno-early-stop-bits
16031 @opindex mearly-stop-bits
16032 @opindex mno-early-stop-bits
16033 Allow stop bits to be placed earlier than immediately preceding the
16034 instruction that triggered the stop bit. This can improve instruction
16035 scheduling, but does not always do so.
16036
16037 @item -mfixed-range=@var{register-range}
16038 @opindex mfixed-range
16039 Generate code treating the given register range as fixed registers.
16040 A fixed register is one that the register allocator cannot use. This is
16041 useful when compiling kernel code. A register range is specified as
16042 two registers separated by a dash. Multiple register ranges can be
16043 specified separated by a comma.
16044
16045 @item -mtls-size=@var{tls-size}
16046 @opindex mtls-size
16047 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
16048 64.
16049
16050 @item -mtune=@var{cpu-type}
16051 @opindex mtune
16052 Tune the instruction scheduling for a particular CPU, Valid values are
16053 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
16054 and @samp{mckinley}.
16055
16056 @item -milp32
16057 @itemx -mlp64
16058 @opindex milp32
16059 @opindex mlp64
16060 Generate code for a 32-bit or 64-bit environment.
16061 The 32-bit environment sets int, long and pointer to 32 bits.
16062 The 64-bit environment sets int to 32 bits and long and pointer
16063 to 64 bits. These are HP-UX specific flags.
16064
16065 @item -mno-sched-br-data-spec
16066 @itemx -msched-br-data-spec
16067 @opindex mno-sched-br-data-spec
16068 @opindex msched-br-data-spec
16069 (Dis/En)able data speculative scheduling before reload.
16070 This results in generation of @code{ld.a} instructions and
16071 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16072 The default is 'disable'.
16073
16074 @item -msched-ar-data-spec
16075 @itemx -mno-sched-ar-data-spec
16076 @opindex msched-ar-data-spec
16077 @opindex mno-sched-ar-data-spec
16078 (En/Dis)able data speculative scheduling after reload.
16079 This results in generation of @code{ld.a} instructions and
16080 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16081 The default is 'enable'.
16082
16083 @item -mno-sched-control-spec
16084 @itemx -msched-control-spec
16085 @opindex mno-sched-control-spec
16086 @opindex msched-control-spec
16087 (Dis/En)able control speculative scheduling. This feature is
16088 available only during region scheduling (i.e.@: before reload).
16089 This results in generation of the @code{ld.s} instructions and
16090 the corresponding check instructions @code{chk.s}.
16091 The default is 'disable'.
16092
16093 @item -msched-br-in-data-spec
16094 @itemx -mno-sched-br-in-data-spec
16095 @opindex msched-br-in-data-spec
16096 @opindex mno-sched-br-in-data-spec
16097 (En/Dis)able speculative scheduling of the instructions that
16098 are dependent on the data speculative loads before reload.
16099 This is effective only with @option{-msched-br-data-spec} enabled.
16100 The default is 'enable'.
16101
16102 @item -msched-ar-in-data-spec
16103 @itemx -mno-sched-ar-in-data-spec
16104 @opindex msched-ar-in-data-spec
16105 @opindex mno-sched-ar-in-data-spec
16106 (En/Dis)able speculative scheduling of the instructions that
16107 are dependent on the data speculative loads after reload.
16108 This is effective only with @option{-msched-ar-data-spec} enabled.
16109 The default is 'enable'.
16110
16111 @item -msched-in-control-spec
16112 @itemx -mno-sched-in-control-spec
16113 @opindex msched-in-control-spec
16114 @opindex mno-sched-in-control-spec
16115 (En/Dis)able speculative scheduling of the instructions that
16116 are dependent on the control speculative loads.
16117 This is effective only with @option{-msched-control-spec} enabled.
16118 The default is 'enable'.
16119
16120 @item -mno-sched-prefer-non-data-spec-insns
16121 @itemx -msched-prefer-non-data-spec-insns
16122 @opindex mno-sched-prefer-non-data-spec-insns
16123 @opindex msched-prefer-non-data-spec-insns
16124 If enabled, data-speculative instructions are chosen for schedule
16125 only if there are no other choices at the moment. This makes
16126 the use of the data speculation much more conservative.
16127 The default is 'disable'.
16128
16129 @item -mno-sched-prefer-non-control-spec-insns
16130 @itemx -msched-prefer-non-control-spec-insns
16131 @opindex mno-sched-prefer-non-control-spec-insns
16132 @opindex msched-prefer-non-control-spec-insns
16133 If enabled, control-speculative instructions are chosen for schedule
16134 only if there are no other choices at the moment. This makes
16135 the use of the control speculation much more conservative.
16136 The default is 'disable'.
16137
16138 @item -mno-sched-count-spec-in-critical-path
16139 @itemx -msched-count-spec-in-critical-path
16140 @opindex mno-sched-count-spec-in-critical-path
16141 @opindex msched-count-spec-in-critical-path
16142 If enabled, speculative dependencies are considered during
16143 computation of the instructions priorities. This makes the use of the
16144 speculation a bit more conservative.
16145 The default is 'disable'.
16146
16147 @item -msched-spec-ldc
16148 @opindex msched-spec-ldc
16149 Use a simple data speculation check. This option is on by default.
16150
16151 @item -msched-control-spec-ldc
16152 @opindex msched-spec-ldc
16153 Use a simple check for control speculation. This option is on by default.
16154
16155 @item -msched-stop-bits-after-every-cycle
16156 @opindex msched-stop-bits-after-every-cycle
16157 Place a stop bit after every cycle when scheduling. This option is on
16158 by default.
16159
16160 @item -msched-fp-mem-deps-zero-cost
16161 @opindex msched-fp-mem-deps-zero-cost
16162 Assume that floating-point stores and loads are not likely to cause a conflict
16163 when placed into the same instruction group. This option is disabled by
16164 default.
16165
16166 @item -msel-sched-dont-check-control-spec
16167 @opindex msel-sched-dont-check-control-spec
16168 Generate checks for control speculation in selective scheduling.
16169 This flag is disabled by default.
16170
16171 @item -msched-max-memory-insns=@var{max-insns}
16172 @opindex msched-max-memory-insns
16173 Limit on the number of memory insns per instruction group, giving lower
16174 priority to subsequent memory insns attempting to schedule in the same
16175 instruction group. Frequently useful to prevent cache bank conflicts.
16176 The default value is 1.
16177
16178 @item -msched-max-memory-insns-hard-limit
16179 @opindex msched-max-memory-insns-hard-limit
16180 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
16181 disallowing more than that number in an instruction group.
16182 Otherwise, the limit is ``soft'', meaning that non-memory operations
16183 are preferred when the limit is reached, but memory operations may still
16184 be scheduled.
16185
16186 @end table
16187
16188 @node LM32 Options
16189 @subsection LM32 Options
16190 @cindex LM32 options
16191
16192 These @option{-m} options are defined for the LatticeMico32 architecture:
16193
16194 @table @gcctabopt
16195 @item -mbarrel-shift-enabled
16196 @opindex mbarrel-shift-enabled
16197 Enable barrel-shift instructions.
16198
16199 @item -mdivide-enabled
16200 @opindex mdivide-enabled
16201 Enable divide and modulus instructions.
16202
16203 @item -mmultiply-enabled
16204 @opindex multiply-enabled
16205 Enable multiply instructions.
16206
16207 @item -msign-extend-enabled
16208 @opindex msign-extend-enabled
16209 Enable sign extend instructions.
16210
16211 @item -muser-enabled
16212 @opindex muser-enabled
16213 Enable user-defined instructions.
16214
16215 @end table
16216
16217 @node M32C Options
16218 @subsection M32C Options
16219 @cindex M32C options
16220
16221 @table @gcctabopt
16222 @item -mcpu=@var{name}
16223 @opindex mcpu=
16224 Select the CPU for which code is generated. @var{name} may be one of
16225 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
16226 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
16227 the M32C/80 series.
16228
16229 @item -msim
16230 @opindex msim
16231 Specifies that the program will be run on the simulator. This causes
16232 an alternate runtime library to be linked in which supports, for
16233 example, file I/O@. You must not use this option when generating
16234 programs that will run on real hardware; you must provide your own
16235 runtime library for whatever I/O functions are needed.
16236
16237 @item -memregs=@var{number}
16238 @opindex memregs=
16239 Specifies the number of memory-based pseudo-registers GCC uses
16240 during code generation. These pseudo-registers are used like real
16241 registers, so there is a tradeoff between GCC's ability to fit the
16242 code into available registers, and the performance penalty of using
16243 memory instead of registers. Note that all modules in a program must
16244 be compiled with the same value for this option. Because of that, you
16245 must not use this option with GCC's default runtime libraries.
16246
16247 @end table
16248
16249 @node M32R/D Options
16250 @subsection M32R/D Options
16251 @cindex M32R/D options
16252
16253 These @option{-m} options are defined for Renesas M32R/D architectures:
16254
16255 @table @gcctabopt
16256 @item -m32r2
16257 @opindex m32r2
16258 Generate code for the M32R/2@.
16259
16260 @item -m32rx
16261 @opindex m32rx
16262 Generate code for the M32R/X@.
16263
16264 @item -m32r
16265 @opindex m32r
16266 Generate code for the M32R@. This is the default.
16267
16268 @item -mmodel=small
16269 @opindex mmodel=small
16270 Assume all objects live in the lower 16MB of memory (so that their addresses
16271 can be loaded with the @code{ld24} instruction), and assume all subroutines
16272 are reachable with the @code{bl} instruction.
16273 This is the default.
16274
16275 The addressability of a particular object can be set with the
16276 @code{model} attribute.
16277
16278 @item -mmodel=medium
16279 @opindex mmodel=medium
16280 Assume objects may be anywhere in the 32-bit address space (the compiler
16281 generates @code{seth/add3} instructions to load their addresses), and
16282 assume all subroutines are reachable with the @code{bl} instruction.
16283
16284 @item -mmodel=large
16285 @opindex mmodel=large
16286 Assume objects may be anywhere in the 32-bit address space (the compiler
16287 generates @code{seth/add3} instructions to load their addresses), and
16288 assume subroutines may not be reachable with the @code{bl} instruction
16289 (the compiler generates the much slower @code{seth/add3/jl}
16290 instruction sequence).
16291
16292 @item -msdata=none
16293 @opindex msdata=none
16294 Disable use of the small data area. Variables are put into
16295 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
16296 @code{section} attribute has been specified).
16297 This is the default.
16298
16299 The small data area consists of sections @code{.sdata} and @code{.sbss}.
16300 Objects may be explicitly put in the small data area with the
16301 @code{section} attribute using one of these sections.
16302
16303 @item -msdata=sdata
16304 @opindex msdata=sdata
16305 Put small global and static data in the small data area, but do not
16306 generate special code to reference them.
16307
16308 @item -msdata=use
16309 @opindex msdata=use
16310 Put small global and static data in the small data area, and generate
16311 special instructions to reference them.
16312
16313 @item -G @var{num}
16314 @opindex G
16315 @cindex smaller data references
16316 Put global and static objects less than or equal to @var{num} bytes
16317 into the small data or BSS sections instead of the normal data or BSS
16318 sections. The default value of @var{num} is 8.
16319 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
16320 for this option to have any effect.
16321
16322 All modules should be compiled with the same @option{-G @var{num}} value.
16323 Compiling with different values of @var{num} may or may not work; if it
16324 doesn't the linker gives an error message---incorrect code is not
16325 generated.
16326
16327 @item -mdebug
16328 @opindex mdebug
16329 Makes the M32R-specific code in the compiler display some statistics
16330 that might help in debugging programs.
16331
16332 @item -malign-loops
16333 @opindex malign-loops
16334 Align all loops to a 32-byte boundary.
16335
16336 @item -mno-align-loops
16337 @opindex mno-align-loops
16338 Do not enforce a 32-byte alignment for loops. This is the default.
16339
16340 @item -missue-rate=@var{number}
16341 @opindex missue-rate=@var{number}
16342 Issue @var{number} instructions per cycle. @var{number} can only be 1
16343 or 2.
16344
16345 @item -mbranch-cost=@var{number}
16346 @opindex mbranch-cost=@var{number}
16347 @var{number} can only be 1 or 2. If it is 1 then branches are
16348 preferred over conditional code, if it is 2, then the opposite applies.
16349
16350 @item -mflush-trap=@var{number}
16351 @opindex mflush-trap=@var{number}
16352 Specifies the trap number to use to flush the cache. The default is
16353 12. Valid numbers are between 0 and 15 inclusive.
16354
16355 @item -mno-flush-trap
16356 @opindex mno-flush-trap
16357 Specifies that the cache cannot be flushed by using a trap.
16358
16359 @item -mflush-func=@var{name}
16360 @opindex mflush-func=@var{name}
16361 Specifies the name of the operating system function to call to flush
16362 the cache. The default is @samp{_flush_cache}, but a function call
16363 is only used if a trap is not available.
16364
16365 @item -mno-flush-func
16366 @opindex mno-flush-func
16367 Indicates that there is no OS function for flushing the cache.
16368
16369 @end table
16370
16371 @node M680x0 Options
16372 @subsection M680x0 Options
16373 @cindex M680x0 options
16374
16375 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
16376 The default settings depend on which architecture was selected when
16377 the compiler was configured; the defaults for the most common choices
16378 are given below.
16379
16380 @table @gcctabopt
16381 @item -march=@var{arch}
16382 @opindex march
16383 Generate code for a specific M680x0 or ColdFire instruction set
16384 architecture. Permissible values of @var{arch} for M680x0
16385 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
16386 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
16387 architectures are selected according to Freescale's ISA classification
16388 and the permissible values are: @samp{isaa}, @samp{isaaplus},
16389 @samp{isab} and @samp{isac}.
16390
16391 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
16392 code for a ColdFire target. The @var{arch} in this macro is one of the
16393 @option{-march} arguments given above.
16394
16395 When used together, @option{-march} and @option{-mtune} select code
16396 that runs on a family of similar processors but that is optimized
16397 for a particular microarchitecture.
16398
16399 @item -mcpu=@var{cpu}
16400 @opindex mcpu
16401 Generate code for a specific M680x0 or ColdFire processor.
16402 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
16403 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
16404 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
16405 below, which also classifies the CPUs into families:
16406
16407 @multitable @columnfractions 0.20 0.80
16408 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
16409 @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}
16410 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
16411 @item @samp{5206e} @tab @samp{5206e}
16412 @item @samp{5208} @tab @samp{5207} @samp{5208}
16413 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
16414 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
16415 @item @samp{5216} @tab @samp{5214} @samp{5216}
16416 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
16417 @item @samp{5225} @tab @samp{5224} @samp{5225}
16418 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
16419 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
16420 @item @samp{5249} @tab @samp{5249}
16421 @item @samp{5250} @tab @samp{5250}
16422 @item @samp{5271} @tab @samp{5270} @samp{5271}
16423 @item @samp{5272} @tab @samp{5272}
16424 @item @samp{5275} @tab @samp{5274} @samp{5275}
16425 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
16426 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
16427 @item @samp{5307} @tab @samp{5307}
16428 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
16429 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
16430 @item @samp{5407} @tab @samp{5407}
16431 @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}
16432 @end multitable
16433
16434 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
16435 @var{arch} is compatible with @var{cpu}. Other combinations of
16436 @option{-mcpu} and @option{-march} are rejected.
16437
16438 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
16439 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
16440 where the value of @var{family} is given by the table above.
16441
16442 @item -mtune=@var{tune}
16443 @opindex mtune
16444 Tune the code for a particular microarchitecture within the
16445 constraints set by @option{-march} and @option{-mcpu}.
16446 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
16447 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
16448 and @samp{cpu32}. The ColdFire microarchitectures
16449 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
16450
16451 You can also use @option{-mtune=68020-40} for code that needs
16452 to run relatively well on 68020, 68030 and 68040 targets.
16453 @option{-mtune=68020-60} is similar but includes 68060 targets
16454 as well. These two options select the same tuning decisions as
16455 @option{-m68020-40} and @option{-m68020-60} respectively.
16456
16457 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
16458 when tuning for 680x0 architecture @var{arch}. It also defines
16459 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
16460 option is used. If GCC is tuning for a range of architectures,
16461 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
16462 it defines the macros for every architecture in the range.
16463
16464 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
16465 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
16466 of the arguments given above.
16467
16468 @item -m68000
16469 @itemx -mc68000
16470 @opindex m68000
16471 @opindex mc68000
16472 Generate output for a 68000. This is the default
16473 when the compiler is configured for 68000-based systems.
16474 It is equivalent to @option{-march=68000}.
16475
16476 Use this option for microcontrollers with a 68000 or EC000 core,
16477 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
16478
16479 @item -m68010
16480 @opindex m68010
16481 Generate output for a 68010. This is the default
16482 when the compiler is configured for 68010-based systems.
16483 It is equivalent to @option{-march=68010}.
16484
16485 @item -m68020
16486 @itemx -mc68020
16487 @opindex m68020
16488 @opindex mc68020
16489 Generate output for a 68020. This is the default
16490 when the compiler is configured for 68020-based systems.
16491 It is equivalent to @option{-march=68020}.
16492
16493 @item -m68030
16494 @opindex m68030
16495 Generate output for a 68030. This is the default when the compiler is
16496 configured for 68030-based systems. It is equivalent to
16497 @option{-march=68030}.
16498
16499 @item -m68040
16500 @opindex m68040
16501 Generate output for a 68040. This is the default when the compiler is
16502 configured for 68040-based systems. It is equivalent to
16503 @option{-march=68040}.
16504
16505 This option inhibits the use of 68881/68882 instructions that have to be
16506 emulated by software on the 68040. Use this option if your 68040 does not
16507 have code to emulate those instructions.
16508
16509 @item -m68060
16510 @opindex m68060
16511 Generate output for a 68060. This is the default when the compiler is
16512 configured for 68060-based systems. It is equivalent to
16513 @option{-march=68060}.
16514
16515 This option inhibits the use of 68020 and 68881/68882 instructions that
16516 have to be emulated by software on the 68060. Use this option if your 68060
16517 does not have code to emulate those instructions.
16518
16519 @item -mcpu32
16520 @opindex mcpu32
16521 Generate output for a CPU32. This is the default
16522 when the compiler is configured for CPU32-based systems.
16523 It is equivalent to @option{-march=cpu32}.
16524
16525 Use this option for microcontrollers with a
16526 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
16527 68336, 68340, 68341, 68349 and 68360.
16528
16529 @item -m5200
16530 @opindex m5200
16531 Generate output for a 520X ColdFire CPU@. This is the default
16532 when the compiler is configured for 520X-based systems.
16533 It is equivalent to @option{-mcpu=5206}, and is now deprecated
16534 in favor of that option.
16535
16536 Use this option for microcontroller with a 5200 core, including
16537 the MCF5202, MCF5203, MCF5204 and MCF5206.
16538
16539 @item -m5206e
16540 @opindex m5206e
16541 Generate output for a 5206e ColdFire CPU@. The option is now
16542 deprecated in favor of the equivalent @option{-mcpu=5206e}.
16543
16544 @item -m528x
16545 @opindex m528x
16546 Generate output for a member of the ColdFire 528X family.
16547 The option is now deprecated in favor of the equivalent
16548 @option{-mcpu=528x}.
16549
16550 @item -m5307
16551 @opindex m5307
16552 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
16553 in favor of the equivalent @option{-mcpu=5307}.
16554
16555 @item -m5407
16556 @opindex m5407
16557 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
16558 in favor of the equivalent @option{-mcpu=5407}.
16559
16560 @item -mcfv4e
16561 @opindex mcfv4e
16562 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
16563 This includes use of hardware floating-point instructions.
16564 The option is equivalent to @option{-mcpu=547x}, and is now
16565 deprecated in favor of that option.
16566
16567 @item -m68020-40
16568 @opindex m68020-40
16569 Generate output for a 68040, without using any of the new instructions.
16570 This results in code that can run relatively efficiently on either a
16571 68020/68881 or a 68030 or a 68040. The generated code does use the
16572 68881 instructions that are emulated on the 68040.
16573
16574 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
16575
16576 @item -m68020-60
16577 @opindex m68020-60
16578 Generate output for a 68060, without using any of the new instructions.
16579 This results in code that can run relatively efficiently on either a
16580 68020/68881 or a 68030 or a 68040. The generated code does use the
16581 68881 instructions that are emulated on the 68060.
16582
16583 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
16584
16585 @item -mhard-float
16586 @itemx -m68881
16587 @opindex mhard-float
16588 @opindex m68881
16589 Generate floating-point instructions. This is the default for 68020
16590 and above, and for ColdFire devices that have an FPU@. It defines the
16591 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
16592 on ColdFire targets.
16593
16594 @item -msoft-float
16595 @opindex msoft-float
16596 Do not generate floating-point instructions; use library calls instead.
16597 This is the default for 68000, 68010, and 68832 targets. It is also
16598 the default for ColdFire devices that have no FPU.
16599
16600 @item -mdiv
16601 @itemx -mno-div
16602 @opindex mdiv
16603 @opindex mno-div
16604 Generate (do not generate) ColdFire hardware divide and remainder
16605 instructions. If @option{-march} is used without @option{-mcpu},
16606 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
16607 architectures. Otherwise, the default is taken from the target CPU
16608 (either the default CPU, or the one specified by @option{-mcpu}). For
16609 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
16610 @option{-mcpu=5206e}.
16611
16612 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
16613
16614 @item -mshort
16615 @opindex mshort
16616 Consider type @code{int} to be 16 bits wide, like @code{short int}.
16617 Additionally, parameters passed on the stack are also aligned to a
16618 16-bit boundary even on targets whose API mandates promotion to 32-bit.
16619
16620 @item -mno-short
16621 @opindex mno-short
16622 Do not consider type @code{int} to be 16 bits wide. This is the default.
16623
16624 @item -mnobitfield
16625 @itemx -mno-bitfield
16626 @opindex mnobitfield
16627 @opindex mno-bitfield
16628 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
16629 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
16630
16631 @item -mbitfield
16632 @opindex mbitfield
16633 Do use the bit-field instructions. The @option{-m68020} option implies
16634 @option{-mbitfield}. This is the default if you use a configuration
16635 designed for a 68020.
16636
16637 @item -mrtd
16638 @opindex mrtd
16639 Use a different function-calling convention, in which functions
16640 that take a fixed number of arguments return with the @code{rtd}
16641 instruction, which pops their arguments while returning. This
16642 saves one instruction in the caller since there is no need to pop
16643 the arguments there.
16644
16645 This calling convention is incompatible with the one normally
16646 used on Unix, so you cannot use it if you need to call libraries
16647 compiled with the Unix compiler.
16648
16649 Also, you must provide function prototypes for all functions that
16650 take variable numbers of arguments (including @code{printf});
16651 otherwise incorrect code is generated for calls to those
16652 functions.
16653
16654 In addition, seriously incorrect code results if you call a
16655 function with too many arguments. (Normally, extra arguments are
16656 harmlessly ignored.)
16657
16658 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
16659 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
16660
16661 @item -mno-rtd
16662 @opindex mno-rtd
16663 Do not use the calling conventions selected by @option{-mrtd}.
16664 This is the default.
16665
16666 @item -malign-int
16667 @itemx -mno-align-int
16668 @opindex malign-int
16669 @opindex mno-align-int
16670 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
16671 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
16672 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
16673 Aligning variables on 32-bit boundaries produces code that runs somewhat
16674 faster on processors with 32-bit busses at the expense of more memory.
16675
16676 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
16677 aligns structures containing the above types differently than
16678 most published application binary interface specifications for the m68k.
16679
16680 @item -mpcrel
16681 @opindex mpcrel
16682 Use the pc-relative addressing mode of the 68000 directly, instead of
16683 using a global offset table. At present, this option implies @option{-fpic},
16684 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
16685 not presently supported with @option{-mpcrel}, though this could be supported for
16686 68020 and higher processors.
16687
16688 @item -mno-strict-align
16689 @itemx -mstrict-align
16690 @opindex mno-strict-align
16691 @opindex mstrict-align
16692 Do not (do) assume that unaligned memory references are handled by
16693 the system.
16694
16695 @item -msep-data
16696 Generate code that allows the data segment to be located in a different
16697 area of memory from the text segment. This allows for execute-in-place in
16698 an environment without virtual memory management. This option implies
16699 @option{-fPIC}.
16700
16701 @item -mno-sep-data
16702 Generate code that assumes that the data segment follows the text segment.
16703 This is the default.
16704
16705 @item -mid-shared-library
16706 Generate code that supports shared libraries via the library ID method.
16707 This allows for execute-in-place and shared libraries in an environment
16708 without virtual memory management. This option implies @option{-fPIC}.
16709
16710 @item -mno-id-shared-library
16711 Generate code that doesn't assume ID-based shared libraries are being used.
16712 This is the default.
16713
16714 @item -mshared-library-id=n
16715 Specifies the identification number of the ID-based shared library being
16716 compiled. Specifying a value of 0 generates more compact code; specifying
16717 other values forces the allocation of that number to the current
16718 library, but is no more space- or time-efficient than omitting this option.
16719
16720 @item -mxgot
16721 @itemx -mno-xgot
16722 @opindex mxgot
16723 @opindex mno-xgot
16724 When generating position-independent code for ColdFire, generate code
16725 that works if the GOT has more than 8192 entries. This code is
16726 larger and slower than code generated without this option. On M680x0
16727 processors, this option is not needed; @option{-fPIC} suffices.
16728
16729 GCC normally uses a single instruction to load values from the GOT@.
16730 While this is relatively efficient, it only works if the GOT
16731 is smaller than about 64k. Anything larger causes the linker
16732 to report an error such as:
16733
16734 @cindex relocation truncated to fit (ColdFire)
16735 @smallexample
16736 relocation truncated to fit: R_68K_GOT16O foobar
16737 @end smallexample
16738
16739 If this happens, you should recompile your code with @option{-mxgot}.
16740 It should then work with very large GOTs. However, code generated with
16741 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
16742 the value of a global symbol.
16743
16744 Note that some linkers, including newer versions of the GNU linker,
16745 can create multiple GOTs and sort GOT entries. If you have such a linker,
16746 you should only need to use @option{-mxgot} when compiling a single
16747 object file that accesses more than 8192 GOT entries. Very few do.
16748
16749 These options have no effect unless GCC is generating
16750 position-independent code.
16751
16752 @end table
16753
16754 @node MCore Options
16755 @subsection MCore Options
16756 @cindex MCore options
16757
16758 These are the @samp{-m} options defined for the Motorola M*Core
16759 processors.
16760
16761 @table @gcctabopt
16762
16763 @item -mhardlit
16764 @itemx -mno-hardlit
16765 @opindex mhardlit
16766 @opindex mno-hardlit
16767 Inline constants into the code stream if it can be done in two
16768 instructions or less.
16769
16770 @item -mdiv
16771 @itemx -mno-div
16772 @opindex mdiv
16773 @opindex mno-div
16774 Use the divide instruction. (Enabled by default).
16775
16776 @item -mrelax-immediate
16777 @itemx -mno-relax-immediate
16778 @opindex mrelax-immediate
16779 @opindex mno-relax-immediate
16780 Allow arbitrary-sized immediates in bit operations.
16781
16782 @item -mwide-bitfields
16783 @itemx -mno-wide-bitfields
16784 @opindex mwide-bitfields
16785 @opindex mno-wide-bitfields
16786 Always treat bit-fields as @code{int}-sized.
16787
16788 @item -m4byte-functions
16789 @itemx -mno-4byte-functions
16790 @opindex m4byte-functions
16791 @opindex mno-4byte-functions
16792 Force all functions to be aligned to a 4-byte boundary.
16793
16794 @item -mcallgraph-data
16795 @itemx -mno-callgraph-data
16796 @opindex mcallgraph-data
16797 @opindex mno-callgraph-data
16798 Emit callgraph information.
16799
16800 @item -mslow-bytes
16801 @itemx -mno-slow-bytes
16802 @opindex mslow-bytes
16803 @opindex mno-slow-bytes
16804 Prefer word access when reading byte quantities.
16805
16806 @item -mlittle-endian
16807 @itemx -mbig-endian
16808 @opindex mlittle-endian
16809 @opindex mbig-endian
16810 Generate code for a little-endian target.
16811
16812 @item -m210
16813 @itemx -m340
16814 @opindex m210
16815 @opindex m340
16816 Generate code for the 210 processor.
16817
16818 @item -mno-lsim
16819 @opindex mno-lsim
16820 Assume that runtime support has been provided and so omit the
16821 simulator library (@file{libsim.a)} from the linker command line.
16822
16823 @item -mstack-increment=@var{size}
16824 @opindex mstack-increment
16825 Set the maximum amount for a single stack increment operation. Large
16826 values can increase the speed of programs that contain functions
16827 that need a large amount of stack space, but they can also trigger a
16828 segmentation fault if the stack is extended too much. The default
16829 value is 0x1000.
16830
16831 @end table
16832
16833 @node MeP Options
16834 @subsection MeP Options
16835 @cindex MeP options
16836
16837 @table @gcctabopt
16838
16839 @item -mabsdiff
16840 @opindex mabsdiff
16841 Enables the @code{abs} instruction, which is the absolute difference
16842 between two registers.
16843
16844 @item -mall-opts
16845 @opindex mall-opts
16846 Enables all the optional instructions---average, multiply, divide, bit
16847 operations, leading zero, absolute difference, min/max, clip, and
16848 saturation.
16849
16850
16851 @item -maverage
16852 @opindex maverage
16853 Enables the @code{ave} instruction, which computes the average of two
16854 registers.
16855
16856 @item -mbased=@var{n}
16857 @opindex mbased=
16858 Variables of size @var{n} bytes or smaller are placed in the
16859 @code{.based} section by default. Based variables use the @code{$tp}
16860 register as a base register, and there is a 128-byte limit to the
16861 @code{.based} section.
16862
16863 @item -mbitops
16864 @opindex mbitops
16865 Enables the bit operation instructions---bit test (@code{btstm}), set
16866 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
16867 test-and-set (@code{tas}).
16868
16869 @item -mc=@var{name}
16870 @opindex mc=
16871 Selects which section constant data is placed in. @var{name} may
16872 be @samp{tiny}, @samp{near}, or @samp{far}.
16873
16874 @item -mclip
16875 @opindex mclip
16876 Enables the @code{clip} instruction. Note that @option{-mclip} is not
16877 useful unless you also provide @option{-mminmax}.
16878
16879 @item -mconfig=@var{name}
16880 @opindex mconfig=
16881 Selects one of the built-in core configurations. Each MeP chip has
16882 one or more modules in it; each module has a core CPU and a variety of
16883 coprocessors, optional instructions, and peripherals. The
16884 @code{MeP-Integrator} tool, not part of GCC, provides these
16885 configurations through this option; using this option is the same as
16886 using all the corresponding command-line options. The default
16887 configuration is @samp{default}.
16888
16889 @item -mcop
16890 @opindex mcop
16891 Enables the coprocessor instructions. By default, this is a 32-bit
16892 coprocessor. Note that the coprocessor is normally enabled via the
16893 @option{-mconfig=} option.
16894
16895 @item -mcop32
16896 @opindex mcop32
16897 Enables the 32-bit coprocessor's instructions.
16898
16899 @item -mcop64
16900 @opindex mcop64
16901 Enables the 64-bit coprocessor's instructions.
16902
16903 @item -mivc2
16904 @opindex mivc2
16905 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
16906
16907 @item -mdc
16908 @opindex mdc
16909 Causes constant variables to be placed in the @code{.near} section.
16910
16911 @item -mdiv
16912 @opindex mdiv
16913 Enables the @code{div} and @code{divu} instructions.
16914
16915 @item -meb
16916 @opindex meb
16917 Generate big-endian code.
16918
16919 @item -mel
16920 @opindex mel
16921 Generate little-endian code.
16922
16923 @item -mio-volatile
16924 @opindex mio-volatile
16925 Tells the compiler that any variable marked with the @code{io}
16926 attribute is to be considered volatile.
16927
16928 @item -ml
16929 @opindex ml
16930 Causes variables to be assigned to the @code{.far} section by default.
16931
16932 @item -mleadz
16933 @opindex mleadz
16934 Enables the @code{leadz} (leading zero) instruction.
16935
16936 @item -mm
16937 @opindex mm
16938 Causes variables to be assigned to the @code{.near} section by default.
16939
16940 @item -mminmax
16941 @opindex mminmax
16942 Enables the @code{min} and @code{max} instructions.
16943
16944 @item -mmult
16945 @opindex mmult
16946 Enables the multiplication and multiply-accumulate instructions.
16947
16948 @item -mno-opts
16949 @opindex mno-opts
16950 Disables all the optional instructions enabled by @option{-mall-opts}.
16951
16952 @item -mrepeat
16953 @opindex mrepeat
16954 Enables the @code{repeat} and @code{erepeat} instructions, used for
16955 low-overhead looping.
16956
16957 @item -ms
16958 @opindex ms
16959 Causes all variables to default to the @code{.tiny} section. Note
16960 that there is a 65536-byte limit to this section. Accesses to these
16961 variables use the @code{%gp} base register.
16962
16963 @item -msatur
16964 @opindex msatur
16965 Enables the saturation instructions. Note that the compiler does not
16966 currently generate these itself, but this option is included for
16967 compatibility with other tools, like @code{as}.
16968
16969 @item -msdram
16970 @opindex msdram
16971 Link the SDRAM-based runtime instead of the default ROM-based runtime.
16972
16973 @item -msim
16974 @opindex msim
16975 Link the simulator run-time libraries.
16976
16977 @item -msimnovec
16978 @opindex msimnovec
16979 Link the simulator runtime libraries, excluding built-in support
16980 for reset and exception vectors and tables.
16981
16982 @item -mtf
16983 @opindex mtf
16984 Causes all functions to default to the @code{.far} section. Without
16985 this option, functions default to the @code{.near} section.
16986
16987 @item -mtiny=@var{n}
16988 @opindex mtiny=
16989 Variables that are @var{n} bytes or smaller are allocated to the
16990 @code{.tiny} section. These variables use the @code{$gp} base
16991 register. The default for this option is 4, but note that there's a
16992 65536-byte limit to the @code{.tiny} section.
16993
16994 @end table
16995
16996 @node MicroBlaze Options
16997 @subsection MicroBlaze Options
16998 @cindex MicroBlaze Options
16999
17000 @table @gcctabopt
17001
17002 @item -msoft-float
17003 @opindex msoft-float
17004 Use software emulation for floating point (default).
17005
17006 @item -mhard-float
17007 @opindex mhard-float
17008 Use hardware floating-point instructions.
17009
17010 @item -mmemcpy
17011 @opindex mmemcpy
17012 Do not optimize block moves, use @code{memcpy}.
17013
17014 @item -mno-clearbss
17015 @opindex mno-clearbss
17016 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
17017
17018 @item -mcpu=@var{cpu-type}
17019 @opindex mcpu=
17020 Use features of, and schedule code for, the given CPU.
17021 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
17022 where @var{X} is a major version, @var{YY} is the minor version, and
17023 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
17024 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
17025
17026 @item -mxl-soft-mul
17027 @opindex mxl-soft-mul
17028 Use software multiply emulation (default).
17029
17030 @item -mxl-soft-div
17031 @opindex mxl-soft-div
17032 Use software emulation for divides (default).
17033
17034 @item -mxl-barrel-shift
17035 @opindex mxl-barrel-shift
17036 Use the hardware barrel shifter.
17037
17038 @item -mxl-pattern-compare
17039 @opindex mxl-pattern-compare
17040 Use pattern compare instructions.
17041
17042 @item -msmall-divides
17043 @opindex msmall-divides
17044 Use table lookup optimization for small signed integer divisions.
17045
17046 @item -mxl-stack-check
17047 @opindex mxl-stack-check
17048 This option is deprecated. Use @option{-fstack-check} instead.
17049
17050 @item -mxl-gp-opt
17051 @opindex mxl-gp-opt
17052 Use GP-relative @code{.sdata}/@code{.sbss} sections.
17053
17054 @item -mxl-multiply-high
17055 @opindex mxl-multiply-high
17056 Use multiply high instructions for high part of 32x32 multiply.
17057
17058 @item -mxl-float-convert
17059 @opindex mxl-float-convert
17060 Use hardware floating-point conversion instructions.
17061
17062 @item -mxl-float-sqrt
17063 @opindex mxl-float-sqrt
17064 Use hardware floating-point square root instruction.
17065
17066 @item -mbig-endian
17067 @opindex mbig-endian
17068 Generate code for a big-endian target.
17069
17070 @item -mlittle-endian
17071 @opindex mlittle-endian
17072 Generate code for a little-endian target.
17073
17074 @item -mxl-reorder
17075 @opindex mxl-reorder
17076 Use reorder instructions (swap and byte reversed load/store).
17077
17078 @item -mxl-mode-@var{app-model}
17079 Select application model @var{app-model}. Valid models are
17080 @table @samp
17081 @item executable
17082 normal executable (default), uses startup code @file{crt0.o}.
17083
17084 @item xmdstub
17085 for use with Xilinx Microprocessor Debugger (XMD) based
17086 software intrusive debug agent called xmdstub. This uses startup file
17087 @file{crt1.o} and sets the start address of the program to 0x800.
17088
17089 @item bootstrap
17090 for applications that are loaded using a bootloader.
17091 This model uses startup file @file{crt2.o} which does not contain a processor
17092 reset vector handler. This is suitable for transferring control on a
17093 processor reset to the bootloader rather than the application.
17094
17095 @item novectors
17096 for applications that do not require any of the
17097 MicroBlaze vectors. This option may be useful for applications running
17098 within a monitoring application. This model uses @file{crt3.o} as a startup file.
17099 @end table
17100
17101 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
17102 @option{-mxl-mode-@var{app-model}}.
17103
17104 @end table
17105
17106 @node MIPS Options
17107 @subsection MIPS Options
17108 @cindex MIPS options
17109
17110 @table @gcctabopt
17111
17112 @item -EB
17113 @opindex EB
17114 Generate big-endian code.
17115
17116 @item -EL
17117 @opindex EL
17118 Generate little-endian code. This is the default for @samp{mips*el-*-*}
17119 configurations.
17120
17121 @item -march=@var{arch}
17122 @opindex march
17123 Generate code that runs on @var{arch}, which can be the name of a
17124 generic MIPS ISA, or the name of a particular processor.
17125 The ISA names are:
17126 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
17127 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
17128 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
17129 @samp{mips64r5} and @samp{mips64r6}.
17130 The processor names are:
17131 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
17132 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
17133 @samp{5kc}, @samp{5kf},
17134 @samp{20kc},
17135 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
17136 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
17137 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
17138 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
17139 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
17140 @samp{i6400},
17141 @samp{interaptiv},
17142 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
17143 @samp{m4k},
17144 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
17145 @samp{m5100}, @samp{m5101},
17146 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
17147 @samp{orion},
17148 @samp{p5600},
17149 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
17150 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
17151 @samp{rm7000}, @samp{rm9000},
17152 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
17153 @samp{sb1},
17154 @samp{sr71000},
17155 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
17156 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
17157 @samp{xlr} and @samp{xlp}.
17158 The special value @samp{from-abi} selects the
17159 most compatible architecture for the selected ABI (that is,
17160 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
17161
17162 The native Linux/GNU toolchain also supports the value @samp{native},
17163 which selects the best architecture option for the host processor.
17164 @option{-march=native} has no effect if GCC does not recognize
17165 the processor.
17166
17167 In processor names, a final @samp{000} can be abbreviated as @samp{k}
17168 (for example, @option{-march=r2k}). Prefixes are optional, and
17169 @samp{vr} may be written @samp{r}.
17170
17171 Names of the form @samp{@var{n}f2_1} refer to processors with
17172 FPUs clocked at half the rate of the core, names of the form
17173 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
17174 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
17175 processors with FPUs clocked a ratio of 3:2 with respect to the core.
17176 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
17177 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
17178 accepted as synonyms for @samp{@var{n}f1_1}.
17179
17180 GCC defines two macros based on the value of this option. The first
17181 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
17182 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
17183 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
17184 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
17185 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
17186
17187 Note that the @code{_MIPS_ARCH} macro uses the processor names given
17188 above. In other words, it has the full prefix and does not
17189 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
17190 the macro names the resolved architecture (either @code{"mips1"} or
17191 @code{"mips3"}). It names the default architecture when no
17192 @option{-march} option is given.
17193
17194 @item -mtune=@var{arch}
17195 @opindex mtune
17196 Optimize for @var{arch}. Among other things, this option controls
17197 the way instructions are scheduled, and the perceived cost of arithmetic
17198 operations. The list of @var{arch} values is the same as for
17199 @option{-march}.
17200
17201 When this option is not used, GCC optimizes for the processor
17202 specified by @option{-march}. By using @option{-march} and
17203 @option{-mtune} together, it is possible to generate code that
17204 runs on a family of processors, but optimize the code for one
17205 particular member of that family.
17206
17207 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
17208 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
17209 @option{-march} ones described above.
17210
17211 @item -mips1
17212 @opindex mips1
17213 Equivalent to @option{-march=mips1}.
17214
17215 @item -mips2
17216 @opindex mips2
17217 Equivalent to @option{-march=mips2}.
17218
17219 @item -mips3
17220 @opindex mips3
17221 Equivalent to @option{-march=mips3}.
17222
17223 @item -mips4
17224 @opindex mips4
17225 Equivalent to @option{-march=mips4}.
17226
17227 @item -mips32
17228 @opindex mips32
17229 Equivalent to @option{-march=mips32}.
17230
17231 @item -mips32r3
17232 @opindex mips32r3
17233 Equivalent to @option{-march=mips32r3}.
17234
17235 @item -mips32r5
17236 @opindex mips32r5
17237 Equivalent to @option{-march=mips32r5}.
17238
17239 @item -mips32r6
17240 @opindex mips32r6
17241 Equivalent to @option{-march=mips32r6}.
17242
17243 @item -mips64
17244 @opindex mips64
17245 Equivalent to @option{-march=mips64}.
17246
17247 @item -mips64r2
17248 @opindex mips64r2
17249 Equivalent to @option{-march=mips64r2}.
17250
17251 @item -mips64r3
17252 @opindex mips64r3
17253 Equivalent to @option{-march=mips64r3}.
17254
17255 @item -mips64r5
17256 @opindex mips64r5
17257 Equivalent to @option{-march=mips64r5}.
17258
17259 @item -mips64r6
17260 @opindex mips64r6
17261 Equivalent to @option{-march=mips64r6}.
17262
17263 @item -mips16
17264 @itemx -mno-mips16
17265 @opindex mips16
17266 @opindex mno-mips16
17267 Generate (do not generate) MIPS16 code. If GCC is targeting a
17268 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
17269
17270 MIPS16 code generation can also be controlled on a per-function basis
17271 by means of @code{mips16} and @code{nomips16} attributes.
17272 @xref{Function Attributes}, for more information.
17273
17274 @item -mflip-mips16
17275 @opindex mflip-mips16
17276 Generate MIPS16 code on alternating functions. This option is provided
17277 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
17278 not intended for ordinary use in compiling user code.
17279
17280 @item -minterlink-compressed
17281 @item -mno-interlink-compressed
17282 @opindex minterlink-compressed
17283 @opindex mno-interlink-compressed
17284 Require (do not require) that code using the standard (uncompressed) MIPS ISA
17285 be link-compatible with MIPS16 and microMIPS code, and vice versa.
17286
17287 For example, code using the standard ISA encoding cannot jump directly
17288 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
17289 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
17290 knows that the target of the jump is not compressed.
17291
17292 @item -minterlink-mips16
17293 @itemx -mno-interlink-mips16
17294 @opindex minterlink-mips16
17295 @opindex mno-interlink-mips16
17296 Aliases of @option{-minterlink-compressed} and
17297 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
17298 and are retained for backwards compatibility.
17299
17300 @item -mabi=32
17301 @itemx -mabi=o64
17302 @itemx -mabi=n32
17303 @itemx -mabi=64
17304 @itemx -mabi=eabi
17305 @opindex mabi=32
17306 @opindex mabi=o64
17307 @opindex mabi=n32
17308 @opindex mabi=64
17309 @opindex mabi=eabi
17310 Generate code for the given ABI@.
17311
17312 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
17313 generates 64-bit code when you select a 64-bit architecture, but you
17314 can use @option{-mgp32} to get 32-bit code instead.
17315
17316 For information about the O64 ABI, see
17317 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
17318
17319 GCC supports a variant of the o32 ABI in which floating-point registers
17320 are 64 rather than 32 bits wide. You can select this combination with
17321 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
17322 and @code{mfhc1} instructions and is therefore only supported for
17323 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
17324
17325 The register assignments for arguments and return values remain the
17326 same, but each scalar value is passed in a single 64-bit register
17327 rather than a pair of 32-bit registers. For example, scalar
17328 floating-point values are returned in @samp{$f0} only, not a
17329 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
17330 remains the same in that the even-numbered double-precision registers
17331 are saved.
17332
17333 Two additional variants of the o32 ABI are supported to enable
17334 a transition from 32-bit to 64-bit registers. These are FPXX
17335 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
17336 The FPXX extension mandates that all code must execute correctly
17337 when run using 32-bit or 64-bit registers. The code can be interlinked
17338 with either FP32 or FP64, but not both.
17339 The FP64A extension is similar to the FP64 extension but forbids the
17340 use of odd-numbered single-precision registers. This can be used
17341 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
17342 processors and allows both FP32 and FP64A code to interlink and
17343 run in the same process without changing FPU modes.
17344
17345 @item -mabicalls
17346 @itemx -mno-abicalls
17347 @opindex mabicalls
17348 @opindex mno-abicalls
17349 Generate (do not generate) code that is suitable for SVR4-style
17350 dynamic objects. @option{-mabicalls} is the default for SVR4-based
17351 systems.
17352
17353 @item -mshared
17354 @itemx -mno-shared
17355 Generate (do not generate) code that is fully position-independent,
17356 and that can therefore be linked into shared libraries. This option
17357 only affects @option{-mabicalls}.
17358
17359 All @option{-mabicalls} code has traditionally been position-independent,
17360 regardless of options like @option{-fPIC} and @option{-fpic}. However,
17361 as an extension, the GNU toolchain allows executables to use absolute
17362 accesses for locally-binding symbols. It can also use shorter GP
17363 initialization sequences and generate direct calls to locally-defined
17364 functions. This mode is selected by @option{-mno-shared}.
17365
17366 @option{-mno-shared} depends on binutils 2.16 or higher and generates
17367 objects that can only be linked by the GNU linker. However, the option
17368 does not affect the ABI of the final executable; it only affects the ABI
17369 of relocatable objects. Using @option{-mno-shared} generally makes
17370 executables both smaller and quicker.
17371
17372 @option{-mshared} is the default.
17373
17374 @item -mplt
17375 @itemx -mno-plt
17376 @opindex mplt
17377 @opindex mno-plt
17378 Assume (do not assume) that the static and dynamic linkers
17379 support PLTs and copy relocations. This option only affects
17380 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
17381 has no effect without @option{-msym32}.
17382
17383 You can make @option{-mplt} the default by configuring
17384 GCC with @option{--with-mips-plt}. The default is
17385 @option{-mno-plt} otherwise.
17386
17387 @item -mxgot
17388 @itemx -mno-xgot
17389 @opindex mxgot
17390 @opindex mno-xgot
17391 Lift (do not lift) the usual restrictions on the size of the global
17392 offset table.
17393
17394 GCC normally uses a single instruction to load values from the GOT@.
17395 While this is relatively efficient, it only works if the GOT
17396 is smaller than about 64k. Anything larger causes the linker
17397 to report an error such as:
17398
17399 @cindex relocation truncated to fit (MIPS)
17400 @smallexample
17401 relocation truncated to fit: R_MIPS_GOT16 foobar
17402 @end smallexample
17403
17404 If this happens, you should recompile your code with @option{-mxgot}.
17405 This works with very large GOTs, although the code is also
17406 less efficient, since it takes three instructions to fetch the
17407 value of a global symbol.
17408
17409 Note that some linkers can create multiple GOTs. If you have such a
17410 linker, you should only need to use @option{-mxgot} when a single object
17411 file accesses more than 64k's worth of GOT entries. Very few do.
17412
17413 These options have no effect unless GCC is generating position
17414 independent code.
17415
17416 @item -mgp32
17417 @opindex mgp32
17418 Assume that general-purpose registers are 32 bits wide.
17419
17420 @item -mgp64
17421 @opindex mgp64
17422 Assume that general-purpose registers are 64 bits wide.
17423
17424 @item -mfp32
17425 @opindex mfp32
17426 Assume that floating-point registers are 32 bits wide.
17427
17428 @item -mfp64
17429 @opindex mfp64
17430 Assume that floating-point registers are 64 bits wide.
17431
17432 @item -mfpxx
17433 @opindex mfpxx
17434 Do not assume the width of floating-point registers.
17435
17436 @item -mhard-float
17437 @opindex mhard-float
17438 Use floating-point coprocessor instructions.
17439
17440 @item -msoft-float
17441 @opindex msoft-float
17442 Do not use floating-point coprocessor instructions. Implement
17443 floating-point calculations using library calls instead.
17444
17445 @item -mno-float
17446 @opindex mno-float
17447 Equivalent to @option{-msoft-float}, but additionally asserts that the
17448 program being compiled does not perform any floating-point operations.
17449 This option is presently supported only by some bare-metal MIPS
17450 configurations, where it may select a special set of libraries
17451 that lack all floating-point support (including, for example, the
17452 floating-point @code{printf} formats).
17453 If code compiled with @option{-mno-float} accidentally contains
17454 floating-point operations, it is likely to suffer a link-time
17455 or run-time failure.
17456
17457 @item -msingle-float
17458 @opindex msingle-float
17459 Assume that the floating-point coprocessor only supports single-precision
17460 operations.
17461
17462 @item -mdouble-float
17463 @opindex mdouble-float
17464 Assume that the floating-point coprocessor supports double-precision
17465 operations. This is the default.
17466
17467 @item -modd-spreg
17468 @itemx -mno-odd-spreg
17469 @opindex modd-spreg
17470 @opindex mno-odd-spreg
17471 Enable the use of odd-numbered single-precision floating-point registers
17472 for the o32 ABI. This is the default for processors that are known to
17473 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
17474 is set by default.
17475
17476 @item -mcompact-branches=never
17477 @itemx -mcompact-branches=optimal
17478 @itemx -mcompact-branches=always
17479 @opindex mcompact-branches=never
17480 @opindex mcompact-branches=optimal
17481 @opindex mcompact-branches=always
17482 These options control which form of branches will be generated. The
17483 default is @option{-mcompact-branches=optimal}.
17484
17485 The @option{-mcompact-branches=never} option ensures that compact branch
17486 instructions will never be generated.
17487
17488 The @option{-mcompact-branches=always} option ensures that a compact
17489 branch instruction will be generated if available. If a compact branch
17490 instruction is not available, a delay slot form of the branch will be
17491 used instead.
17492
17493 This option is supported from MIPS Release 6 onwards.
17494
17495 The @option{-mcompact-branches=optimal} option will cause a delay slot
17496 branch to be used if one is available in the current ISA and the delay
17497 slot is successfully filled. If the delay slot is not filled, a compact
17498 branch will be chosen if one is available.
17499
17500 @item -mabs=2008
17501 @itemx -mabs=legacy
17502 @opindex mabs=2008
17503 @opindex mabs=legacy
17504 These options control the treatment of the special not-a-number (NaN)
17505 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
17506 @code{neg.@i{fmt}} machine instructions.
17507
17508 By default or when @option{-mabs=legacy} is used the legacy
17509 treatment is selected. In this case these instructions are considered
17510 arithmetic and avoided where correct operation is required and the
17511 input operand might be a NaN. A longer sequence of instructions that
17512 manipulate the sign bit of floating-point datum manually is used
17513 instead unless the @option{-ffinite-math-only} option has also been
17514 specified.
17515
17516 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
17517 this case these instructions are considered non-arithmetic and therefore
17518 operating correctly in all cases, including in particular where the
17519 input operand is a NaN. These instructions are therefore always used
17520 for the respective operations.
17521
17522 @item -mnan=2008
17523 @itemx -mnan=legacy
17524 @opindex mnan=2008
17525 @opindex mnan=legacy
17526 These options control the encoding of the special not-a-number (NaN)
17527 IEEE 754 floating-point data.
17528
17529 The @option{-mnan=legacy} option selects the legacy encoding. In this
17530 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
17531 significand field being 0, whereas signalling NaNs (sNaNs) are denoted
17532 by the first bit of their trailing significand field being 1.
17533
17534 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
17535 this case qNaNs are denoted by the first bit of their trailing
17536 significand field being 1, whereas sNaNs are denoted by the first bit of
17537 their trailing significand field being 0.
17538
17539 The default is @option{-mnan=legacy} unless GCC has been configured with
17540 @option{--with-nan=2008}.
17541
17542 @item -mllsc
17543 @itemx -mno-llsc
17544 @opindex mllsc
17545 @opindex mno-llsc
17546 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
17547 implement atomic memory built-in functions. When neither option is
17548 specified, GCC uses the instructions if the target architecture
17549 supports them.
17550
17551 @option{-mllsc} is useful if the runtime environment can emulate the
17552 instructions and @option{-mno-llsc} can be useful when compiling for
17553 nonstandard ISAs. You can make either option the default by
17554 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
17555 respectively. @option{--with-llsc} is the default for some
17556 configurations; see the installation documentation for details.
17557
17558 @item -mdsp
17559 @itemx -mno-dsp
17560 @opindex mdsp
17561 @opindex mno-dsp
17562 Use (do not use) revision 1 of the MIPS DSP ASE@.
17563 @xref{MIPS DSP Built-in Functions}. This option defines the
17564 preprocessor macro @code{__mips_dsp}. It also defines
17565 @code{__mips_dsp_rev} to 1.
17566
17567 @item -mdspr2
17568 @itemx -mno-dspr2
17569 @opindex mdspr2
17570 @opindex mno-dspr2
17571 Use (do not use) revision 2 of the MIPS DSP ASE@.
17572 @xref{MIPS DSP Built-in Functions}. This option defines the
17573 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
17574 It also defines @code{__mips_dsp_rev} to 2.
17575
17576 @item -msmartmips
17577 @itemx -mno-smartmips
17578 @opindex msmartmips
17579 @opindex mno-smartmips
17580 Use (do not use) the MIPS SmartMIPS ASE.
17581
17582 @item -mpaired-single
17583 @itemx -mno-paired-single
17584 @opindex mpaired-single
17585 @opindex mno-paired-single
17586 Use (do not use) paired-single floating-point instructions.
17587 @xref{MIPS Paired-Single Support}. This option requires
17588 hardware floating-point support to be enabled.
17589
17590 @item -mdmx
17591 @itemx -mno-mdmx
17592 @opindex mdmx
17593 @opindex mno-mdmx
17594 Use (do not use) MIPS Digital Media Extension instructions.
17595 This option can only be used when generating 64-bit code and requires
17596 hardware floating-point support to be enabled.
17597
17598 @item -mips3d
17599 @itemx -mno-mips3d
17600 @opindex mips3d
17601 @opindex mno-mips3d
17602 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
17603 The option @option{-mips3d} implies @option{-mpaired-single}.
17604
17605 @item -mmicromips
17606 @itemx -mno-micromips
17607 @opindex mmicromips
17608 @opindex mno-mmicromips
17609 Generate (do not generate) microMIPS code.
17610
17611 MicroMIPS code generation can also be controlled on a per-function basis
17612 by means of @code{micromips} and @code{nomicromips} attributes.
17613 @xref{Function Attributes}, for more information.
17614
17615 @item -mmt
17616 @itemx -mno-mt
17617 @opindex mmt
17618 @opindex mno-mt
17619 Use (do not use) MT Multithreading instructions.
17620
17621 @item -mmcu
17622 @itemx -mno-mcu
17623 @opindex mmcu
17624 @opindex mno-mcu
17625 Use (do not use) the MIPS MCU ASE instructions.
17626
17627 @item -meva
17628 @itemx -mno-eva
17629 @opindex meva
17630 @opindex mno-eva
17631 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
17632
17633 @item -mvirt
17634 @itemx -mno-virt
17635 @opindex mvirt
17636 @opindex mno-virt
17637 Use (do not use) the MIPS Virtualization Application Specific instructions.
17638
17639 @item -mxpa
17640 @itemx -mno-xpa
17641 @opindex mxpa
17642 @opindex mno-xpa
17643 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
17644
17645 @item -mlong64
17646 @opindex mlong64
17647 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
17648 an explanation of the default and the way that the pointer size is
17649 determined.
17650
17651 @item -mlong32
17652 @opindex mlong32
17653 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
17654
17655 The default size of @code{int}s, @code{long}s and pointers depends on
17656 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
17657 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
17658 32-bit @code{long}s. Pointers are the same size as @code{long}s,
17659 or the same size as integer registers, whichever is smaller.
17660
17661 @item -msym32
17662 @itemx -mno-sym32
17663 @opindex msym32
17664 @opindex mno-sym32
17665 Assume (do not assume) that all symbols have 32-bit values, regardless
17666 of the selected ABI@. This option is useful in combination with
17667 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
17668 to generate shorter and faster references to symbolic addresses.
17669
17670 @item -G @var{num}
17671 @opindex G
17672 Put definitions of externally-visible data in a small data section
17673 if that data is no bigger than @var{num} bytes. GCC can then generate
17674 more efficient accesses to the data; see @option{-mgpopt} for details.
17675
17676 The default @option{-G} option depends on the configuration.
17677
17678 @item -mlocal-sdata
17679 @itemx -mno-local-sdata
17680 @opindex mlocal-sdata
17681 @opindex mno-local-sdata
17682 Extend (do not extend) the @option{-G} behavior to local data too,
17683 such as to static variables in C@. @option{-mlocal-sdata} is the
17684 default for all configurations.
17685
17686 If the linker complains that an application is using too much small data,
17687 you might want to try rebuilding the less performance-critical parts with
17688 @option{-mno-local-sdata}. You might also want to build large
17689 libraries with @option{-mno-local-sdata}, so that the libraries leave
17690 more room for the main program.
17691
17692 @item -mextern-sdata
17693 @itemx -mno-extern-sdata
17694 @opindex mextern-sdata
17695 @opindex mno-extern-sdata
17696 Assume (do not assume) that externally-defined data is in
17697 a small data section if the size of that data is within the @option{-G} limit.
17698 @option{-mextern-sdata} is the default for all configurations.
17699
17700 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
17701 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
17702 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
17703 is placed in a small data section. If @var{Var} is defined by another
17704 module, you must either compile that module with a high-enough
17705 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
17706 definition. If @var{Var} is common, you must link the application
17707 with a high-enough @option{-G} setting.
17708
17709 The easiest way of satisfying these restrictions is to compile
17710 and link every module with the same @option{-G} option. However,
17711 you may wish to build a library that supports several different
17712 small data limits. You can do this by compiling the library with
17713 the highest supported @option{-G} setting and additionally using
17714 @option{-mno-extern-sdata} to stop the library from making assumptions
17715 about externally-defined data.
17716
17717 @item -mgpopt
17718 @itemx -mno-gpopt
17719 @opindex mgpopt
17720 @opindex mno-gpopt
17721 Use (do not use) GP-relative accesses for symbols that are known to be
17722 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
17723 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
17724 configurations.
17725
17726 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
17727 might not hold the value of @code{_gp}. For example, if the code is
17728 part of a library that might be used in a boot monitor, programs that
17729 call boot monitor routines pass an unknown value in @code{$gp}.
17730 (In such situations, the boot monitor itself is usually compiled
17731 with @option{-G0}.)
17732
17733 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
17734 @option{-mno-extern-sdata}.
17735
17736 @item -membedded-data
17737 @itemx -mno-embedded-data
17738 @opindex membedded-data
17739 @opindex mno-embedded-data
17740 Allocate variables to the read-only data section first if possible, then
17741 next in the small data section if possible, otherwise in data. This gives
17742 slightly slower code than the default, but reduces the amount of RAM required
17743 when executing, and thus may be preferred for some embedded systems.
17744
17745 @item -muninit-const-in-rodata
17746 @itemx -mno-uninit-const-in-rodata
17747 @opindex muninit-const-in-rodata
17748 @opindex mno-uninit-const-in-rodata
17749 Put uninitialized @code{const} variables in the read-only data section.
17750 This option is only meaningful in conjunction with @option{-membedded-data}.
17751
17752 @item -mcode-readable=@var{setting}
17753 @opindex mcode-readable
17754 Specify whether GCC may generate code that reads from executable sections.
17755 There are three possible settings:
17756
17757 @table @gcctabopt
17758 @item -mcode-readable=yes
17759 Instructions may freely access executable sections. This is the
17760 default setting.
17761
17762 @item -mcode-readable=pcrel
17763 MIPS16 PC-relative load instructions can access executable sections,
17764 but other instructions must not do so. This option is useful on 4KSc
17765 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
17766 It is also useful on processors that can be configured to have a dual
17767 instruction/data SRAM interface and that, like the M4K, automatically
17768 redirect PC-relative loads to the instruction RAM.
17769
17770 @item -mcode-readable=no
17771 Instructions must not access executable sections. This option can be
17772 useful on targets that are configured to have a dual instruction/data
17773 SRAM interface but that (unlike the M4K) do not automatically redirect
17774 PC-relative loads to the instruction RAM.
17775 @end table
17776
17777 @item -msplit-addresses
17778 @itemx -mno-split-addresses
17779 @opindex msplit-addresses
17780 @opindex mno-split-addresses
17781 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
17782 relocation operators. This option has been superseded by
17783 @option{-mexplicit-relocs} but is retained for backwards compatibility.
17784
17785 @item -mexplicit-relocs
17786 @itemx -mno-explicit-relocs
17787 @opindex mexplicit-relocs
17788 @opindex mno-explicit-relocs
17789 Use (do not use) assembler relocation operators when dealing with symbolic
17790 addresses. The alternative, selected by @option{-mno-explicit-relocs},
17791 is to use assembler macros instead.
17792
17793 @option{-mexplicit-relocs} is the default if GCC was configured
17794 to use an assembler that supports relocation operators.
17795
17796 @item -mcheck-zero-division
17797 @itemx -mno-check-zero-division
17798 @opindex mcheck-zero-division
17799 @opindex mno-check-zero-division
17800 Trap (do not trap) on integer division by zero.
17801
17802 The default is @option{-mcheck-zero-division}.
17803
17804 @item -mdivide-traps
17805 @itemx -mdivide-breaks
17806 @opindex mdivide-traps
17807 @opindex mdivide-breaks
17808 MIPS systems check for division by zero by generating either a
17809 conditional trap or a break instruction. Using traps results in
17810 smaller code, but is only supported on MIPS II and later. Also, some
17811 versions of the Linux kernel have a bug that prevents trap from
17812 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
17813 allow conditional traps on architectures that support them and
17814 @option{-mdivide-breaks} to force the use of breaks.
17815
17816 The default is usually @option{-mdivide-traps}, but this can be
17817 overridden at configure time using @option{--with-divide=breaks}.
17818 Divide-by-zero checks can be completely disabled using
17819 @option{-mno-check-zero-division}.
17820
17821 @item -mmemcpy
17822 @itemx -mno-memcpy
17823 @opindex mmemcpy
17824 @opindex mno-memcpy
17825 Force (do not force) the use of @code{memcpy} for non-trivial block
17826 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
17827 most constant-sized copies.
17828
17829 @item -mlong-calls
17830 @itemx -mno-long-calls
17831 @opindex mlong-calls
17832 @opindex mno-long-calls
17833 Disable (do not disable) use of the @code{jal} instruction. Calling
17834 functions using @code{jal} is more efficient but requires the caller
17835 and callee to be in the same 256 megabyte segment.
17836
17837 This option has no effect on abicalls code. The default is
17838 @option{-mno-long-calls}.
17839
17840 @item -mmad
17841 @itemx -mno-mad
17842 @opindex mmad
17843 @opindex mno-mad
17844 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
17845 instructions, as provided by the R4650 ISA@.
17846
17847 @item -mimadd
17848 @itemx -mno-imadd
17849 @opindex mimadd
17850 @opindex mno-imadd
17851 Enable (disable) use of the @code{madd} and @code{msub} integer
17852 instructions. The default is @option{-mimadd} on architectures
17853 that support @code{madd} and @code{msub} except for the 74k
17854 architecture where it was found to generate slower code.
17855
17856 @item -mfused-madd
17857 @itemx -mno-fused-madd
17858 @opindex mfused-madd
17859 @opindex mno-fused-madd
17860 Enable (disable) use of the floating-point multiply-accumulate
17861 instructions, when they are available. The default is
17862 @option{-mfused-madd}.
17863
17864 On the R8000 CPU when multiply-accumulate instructions are used,
17865 the intermediate product is calculated to infinite precision
17866 and is not subject to the FCSR Flush to Zero bit. This may be
17867 undesirable in some circumstances. On other processors the result
17868 is numerically identical to the equivalent computation using
17869 separate multiply, add, subtract and negate instructions.
17870
17871 @item -nocpp
17872 @opindex nocpp
17873 Tell the MIPS assembler to not run its preprocessor over user
17874 assembler files (with a @samp{.s} suffix) when assembling them.
17875
17876 @item -mfix-24k
17877 @item -mno-fix-24k
17878 @opindex mfix-24k
17879 @opindex mno-fix-24k
17880 Work around the 24K E48 (lost data on stores during refill) errata.
17881 The workarounds are implemented by the assembler rather than by GCC@.
17882
17883 @item -mfix-r4000
17884 @itemx -mno-fix-r4000
17885 @opindex mfix-r4000
17886 @opindex mno-fix-r4000
17887 Work around certain R4000 CPU errata:
17888 @itemize @minus
17889 @item
17890 A double-word or a variable shift may give an incorrect result if executed
17891 immediately after starting an integer division.
17892 @item
17893 A double-word or a variable shift may give an incorrect result if executed
17894 while an integer multiplication is in progress.
17895 @item
17896 An integer division may give an incorrect result if started in a delay slot
17897 of a taken branch or a jump.
17898 @end itemize
17899
17900 @item -mfix-r4400
17901 @itemx -mno-fix-r4400
17902 @opindex mfix-r4400
17903 @opindex mno-fix-r4400
17904 Work around certain R4400 CPU errata:
17905 @itemize @minus
17906 @item
17907 A double-word or a variable shift may give an incorrect result if executed
17908 immediately after starting an integer division.
17909 @end itemize
17910
17911 @item -mfix-r10000
17912 @itemx -mno-fix-r10000
17913 @opindex mfix-r10000
17914 @opindex mno-fix-r10000
17915 Work around certain R10000 errata:
17916 @itemize @minus
17917 @item
17918 @code{ll}/@code{sc} sequences may not behave atomically on revisions
17919 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
17920 @end itemize
17921
17922 This option can only be used if the target architecture supports
17923 branch-likely instructions. @option{-mfix-r10000} is the default when
17924 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
17925 otherwise.
17926
17927 @item -mfix-rm7000
17928 @itemx -mno-fix-rm7000
17929 @opindex mfix-rm7000
17930 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
17931 workarounds are implemented by the assembler rather than by GCC@.
17932
17933 @item -mfix-vr4120
17934 @itemx -mno-fix-vr4120
17935 @opindex mfix-vr4120
17936 Work around certain VR4120 errata:
17937 @itemize @minus
17938 @item
17939 @code{dmultu} does not always produce the correct result.
17940 @item
17941 @code{div} and @code{ddiv} do not always produce the correct result if one
17942 of the operands is negative.
17943 @end itemize
17944 The workarounds for the division errata rely on special functions in
17945 @file{libgcc.a}. At present, these functions are only provided by
17946 the @code{mips64vr*-elf} configurations.
17947
17948 Other VR4120 errata require a NOP to be inserted between certain pairs of
17949 instructions. These errata are handled by the assembler, not by GCC itself.
17950
17951 @item -mfix-vr4130
17952 @opindex mfix-vr4130
17953 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
17954 workarounds are implemented by the assembler rather than by GCC,
17955 although GCC avoids using @code{mflo} and @code{mfhi} if the
17956 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
17957 instructions are available instead.
17958
17959 @item -mfix-sb1
17960 @itemx -mno-fix-sb1
17961 @opindex mfix-sb1
17962 Work around certain SB-1 CPU core errata.
17963 (This flag currently works around the SB-1 revision 2
17964 ``F1'' and ``F2'' floating-point errata.)
17965
17966 @item -mr10k-cache-barrier=@var{setting}
17967 @opindex mr10k-cache-barrier
17968 Specify whether GCC should insert cache barriers to avoid the
17969 side-effects of speculation on R10K processors.
17970
17971 In common with many processors, the R10K tries to predict the outcome
17972 of a conditional branch and speculatively executes instructions from
17973 the ``taken'' branch. It later aborts these instructions if the
17974 predicted outcome is wrong. However, on the R10K, even aborted
17975 instructions can have side effects.
17976
17977 This problem only affects kernel stores and, depending on the system,
17978 kernel loads. As an example, a speculatively-executed store may load
17979 the target memory into cache and mark the cache line as dirty, even if
17980 the store itself is later aborted. If a DMA operation writes to the
17981 same area of memory before the ``dirty'' line is flushed, the cached
17982 data overwrites the DMA-ed data. See the R10K processor manual
17983 for a full description, including other potential problems.
17984
17985 One workaround is to insert cache barrier instructions before every memory
17986 access that might be speculatively executed and that might have side
17987 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
17988 controls GCC's implementation of this workaround. It assumes that
17989 aborted accesses to any byte in the following regions does not have
17990 side effects:
17991
17992 @enumerate
17993 @item
17994 the memory occupied by the current function's stack frame;
17995
17996 @item
17997 the memory occupied by an incoming stack argument;
17998
17999 @item
18000 the memory occupied by an object with a link-time-constant address.
18001 @end enumerate
18002
18003 It is the kernel's responsibility to ensure that speculative
18004 accesses to these regions are indeed safe.
18005
18006 If the input program contains a function declaration such as:
18007
18008 @smallexample
18009 void foo (void);
18010 @end smallexample
18011
18012 then the implementation of @code{foo} must allow @code{j foo} and
18013 @code{jal foo} to be executed speculatively. GCC honors this
18014 restriction for functions it compiles itself. It expects non-GCC
18015 functions (such as hand-written assembly code) to do the same.
18016
18017 The option has three forms:
18018
18019 @table @gcctabopt
18020 @item -mr10k-cache-barrier=load-store
18021 Insert a cache barrier before a load or store that might be
18022 speculatively executed and that might have side effects even
18023 if aborted.
18024
18025 @item -mr10k-cache-barrier=store
18026 Insert a cache barrier before a store that might be speculatively
18027 executed and that might have side effects even if aborted.
18028
18029 @item -mr10k-cache-barrier=none
18030 Disable the insertion of cache barriers. This is the default setting.
18031 @end table
18032
18033 @item -mflush-func=@var{func}
18034 @itemx -mno-flush-func
18035 @opindex mflush-func
18036 Specifies the function to call to flush the I and D caches, or to not
18037 call any such function. If called, the function must take the same
18038 arguments as the common @code{_flush_func}, that is, the address of the
18039 memory range for which the cache is being flushed, the size of the
18040 memory range, and the number 3 (to flush both caches). The default
18041 depends on the target GCC was configured for, but commonly is either
18042 @code{_flush_func} or @code{__cpu_flush}.
18043
18044 @item mbranch-cost=@var{num}
18045 @opindex mbranch-cost
18046 Set the cost of branches to roughly @var{num} ``simple'' instructions.
18047 This cost is only a heuristic and is not guaranteed to produce
18048 consistent results across releases. A zero cost redundantly selects
18049 the default, which is based on the @option{-mtune} setting.
18050
18051 @item -mbranch-likely
18052 @itemx -mno-branch-likely
18053 @opindex mbranch-likely
18054 @opindex mno-branch-likely
18055 Enable or disable use of Branch Likely instructions, regardless of the
18056 default for the selected architecture. By default, Branch Likely
18057 instructions may be generated if they are supported by the selected
18058 architecture. An exception is for the MIPS32 and MIPS64 architectures
18059 and processors that implement those architectures; for those, Branch
18060 Likely instructions are not be generated by default because the MIPS32
18061 and MIPS64 architectures specifically deprecate their use.
18062
18063 @item -mfp-exceptions
18064 @itemx -mno-fp-exceptions
18065 @opindex mfp-exceptions
18066 Specifies whether FP exceptions are enabled. This affects how
18067 FP instructions are scheduled for some processors.
18068 The default is that FP exceptions are
18069 enabled.
18070
18071 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
18072 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
18073 FP pipe.
18074
18075 @item -mvr4130-align
18076 @itemx -mno-vr4130-align
18077 @opindex mvr4130-align
18078 The VR4130 pipeline is two-way superscalar, but can only issue two
18079 instructions together if the first one is 8-byte aligned. When this
18080 option is enabled, GCC aligns pairs of instructions that it
18081 thinks should execute in parallel.
18082
18083 This option only has an effect when optimizing for the VR4130.
18084 It normally makes code faster, but at the expense of making it bigger.
18085 It is enabled by default at optimization level @option{-O3}.
18086
18087 @item -msynci
18088 @itemx -mno-synci
18089 @opindex msynci
18090 Enable (disable) generation of @code{synci} instructions on
18091 architectures that support it. The @code{synci} instructions (if
18092 enabled) are generated when @code{__builtin___clear_cache} is
18093 compiled.
18094
18095 This option defaults to @option{-mno-synci}, but the default can be
18096 overridden by configuring GCC with @option{--with-synci}.
18097
18098 When compiling code for single processor systems, it is generally safe
18099 to use @code{synci}. However, on many multi-core (SMP) systems, it
18100 does not invalidate the instruction caches on all cores and may lead
18101 to undefined behavior.
18102
18103 @item -mrelax-pic-calls
18104 @itemx -mno-relax-pic-calls
18105 @opindex mrelax-pic-calls
18106 Try to turn PIC calls that are normally dispatched via register
18107 @code{$25} into direct calls. This is only possible if the linker can
18108 resolve the destination at link-time and if the destination is within
18109 range for a direct call.
18110
18111 @option{-mrelax-pic-calls} is the default if GCC was configured to use
18112 an assembler and a linker that support the @code{.reloc} assembly
18113 directive and @option{-mexplicit-relocs} is in effect. With
18114 @option{-mno-explicit-relocs}, this optimization can be performed by the
18115 assembler and the linker alone without help from the compiler.
18116
18117 @item -mmcount-ra-address
18118 @itemx -mno-mcount-ra-address
18119 @opindex mmcount-ra-address
18120 @opindex mno-mcount-ra-address
18121 Emit (do not emit) code that allows @code{_mcount} to modify the
18122 calling function's return address. When enabled, this option extends
18123 the usual @code{_mcount} interface with a new @var{ra-address}
18124 parameter, which has type @code{intptr_t *} and is passed in register
18125 @code{$12}. @code{_mcount} can then modify the return address by
18126 doing both of the following:
18127 @itemize
18128 @item
18129 Returning the new address in register @code{$31}.
18130 @item
18131 Storing the new address in @code{*@var{ra-address}},
18132 if @var{ra-address} is nonnull.
18133 @end itemize
18134
18135 The default is @option{-mno-mcount-ra-address}.
18136
18137 @item -mframe-header-opt
18138 @itemx -mno-frame-header-opt
18139 @opindex mframe-header-opt
18140 Enable (disable) frame header optimization in the o32 ABI. When using the
18141 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
18142 function to write out register arguments. When enabled, this optimization
18143 will suppress the allocation of the frame header if it can be determined that
18144 it is unused.
18145
18146 This optimization is off by default at all optimization levels.
18147
18148 @end table
18149
18150 @node MMIX Options
18151 @subsection MMIX Options
18152 @cindex MMIX Options
18153
18154 These options are defined for the MMIX:
18155
18156 @table @gcctabopt
18157 @item -mlibfuncs
18158 @itemx -mno-libfuncs
18159 @opindex mlibfuncs
18160 @opindex mno-libfuncs
18161 Specify that intrinsic library functions are being compiled, passing all
18162 values in registers, no matter the size.
18163
18164 @item -mepsilon
18165 @itemx -mno-epsilon
18166 @opindex mepsilon
18167 @opindex mno-epsilon
18168 Generate floating-point comparison instructions that compare with respect
18169 to the @code{rE} epsilon register.
18170
18171 @item -mabi=mmixware
18172 @itemx -mabi=gnu
18173 @opindex mabi=mmixware
18174 @opindex mabi=gnu
18175 Generate code that passes function parameters and return values that (in
18176 the called function) are seen as registers @code{$0} and up, as opposed to
18177 the GNU ABI which uses global registers @code{$231} and up.
18178
18179 @item -mzero-extend
18180 @itemx -mno-zero-extend
18181 @opindex mzero-extend
18182 @opindex mno-zero-extend
18183 When reading data from memory in sizes shorter than 64 bits, use (do not
18184 use) zero-extending load instructions by default, rather than
18185 sign-extending ones.
18186
18187 @item -mknuthdiv
18188 @itemx -mno-knuthdiv
18189 @opindex mknuthdiv
18190 @opindex mno-knuthdiv
18191 Make the result of a division yielding a remainder have the same sign as
18192 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
18193 remainder follows the sign of the dividend. Both methods are
18194 arithmetically valid, the latter being almost exclusively used.
18195
18196 @item -mtoplevel-symbols
18197 @itemx -mno-toplevel-symbols
18198 @opindex mtoplevel-symbols
18199 @opindex mno-toplevel-symbols
18200 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
18201 code can be used with the @code{PREFIX} assembly directive.
18202
18203 @item -melf
18204 @opindex melf
18205 Generate an executable in the ELF format, rather than the default
18206 @samp{mmo} format used by the @command{mmix} simulator.
18207
18208 @item -mbranch-predict
18209 @itemx -mno-branch-predict
18210 @opindex mbranch-predict
18211 @opindex mno-branch-predict
18212 Use (do not use) the probable-branch instructions, when static branch
18213 prediction indicates a probable branch.
18214
18215 @item -mbase-addresses
18216 @itemx -mno-base-addresses
18217 @opindex mbase-addresses
18218 @opindex mno-base-addresses
18219 Generate (do not generate) code that uses @emph{base addresses}. Using a
18220 base address automatically generates a request (handled by the assembler
18221 and the linker) for a constant to be set up in a global register. The
18222 register is used for one or more base address requests within the range 0
18223 to 255 from the value held in the register. The generally leads to short
18224 and fast code, but the number of different data items that can be
18225 addressed is limited. This means that a program that uses lots of static
18226 data may require @option{-mno-base-addresses}.
18227
18228 @item -msingle-exit
18229 @itemx -mno-single-exit
18230 @opindex msingle-exit
18231 @opindex mno-single-exit
18232 Force (do not force) generated code to have a single exit point in each
18233 function.
18234 @end table
18235
18236 @node MN10300 Options
18237 @subsection MN10300 Options
18238 @cindex MN10300 options
18239
18240 These @option{-m} options are defined for Matsushita MN10300 architectures:
18241
18242 @table @gcctabopt
18243 @item -mmult-bug
18244 @opindex mmult-bug
18245 Generate code to avoid bugs in the multiply instructions for the MN10300
18246 processors. This is the default.
18247
18248 @item -mno-mult-bug
18249 @opindex mno-mult-bug
18250 Do not generate code to avoid bugs in the multiply instructions for the
18251 MN10300 processors.
18252
18253 @item -mam33
18254 @opindex mam33
18255 Generate code using features specific to the AM33 processor.
18256
18257 @item -mno-am33
18258 @opindex mno-am33
18259 Do not generate code using features specific to the AM33 processor. This
18260 is the default.
18261
18262 @item -mam33-2
18263 @opindex mam33-2
18264 Generate code using features specific to the AM33/2.0 processor.
18265
18266 @item -mam34
18267 @opindex mam34
18268 Generate code using features specific to the AM34 processor.
18269
18270 @item -mtune=@var{cpu-type}
18271 @opindex mtune
18272 Use the timing characteristics of the indicated CPU type when
18273 scheduling instructions. This does not change the targeted processor
18274 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
18275 @samp{am33-2} or @samp{am34}.
18276
18277 @item -mreturn-pointer-on-d0
18278 @opindex mreturn-pointer-on-d0
18279 When generating a function that returns a pointer, return the pointer
18280 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
18281 only in @code{a0}, and attempts to call such functions without a prototype
18282 result in errors. Note that this option is on by default; use
18283 @option{-mno-return-pointer-on-d0} to disable it.
18284
18285 @item -mno-crt0
18286 @opindex mno-crt0
18287 Do not link in the C run-time initialization object file.
18288
18289 @item -mrelax
18290 @opindex mrelax
18291 Indicate to the linker that it should perform a relaxation optimization pass
18292 to shorten branches, calls and absolute memory addresses. This option only
18293 has an effect when used on the command line for the final link step.
18294
18295 This option makes symbolic debugging impossible.
18296
18297 @item -mliw
18298 @opindex mliw
18299 Allow the compiler to generate @emph{Long Instruction Word}
18300 instructions if the target is the @samp{AM33} or later. This is the
18301 default. This option defines the preprocessor macro @code{__LIW__}.
18302
18303 @item -mnoliw
18304 @opindex mnoliw
18305 Do not allow the compiler to generate @emph{Long Instruction Word}
18306 instructions. This option defines the preprocessor macro
18307 @code{__NO_LIW__}.
18308
18309 @item -msetlb
18310 @opindex msetlb
18311 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
18312 instructions if the target is the @samp{AM33} or later. This is the
18313 default. This option defines the preprocessor macro @code{__SETLB__}.
18314
18315 @item -mnosetlb
18316 @opindex mnosetlb
18317 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
18318 instructions. This option defines the preprocessor macro
18319 @code{__NO_SETLB__}.
18320
18321 @end table
18322
18323 @node Moxie Options
18324 @subsection Moxie Options
18325 @cindex Moxie Options
18326
18327 @table @gcctabopt
18328
18329 @item -meb
18330 @opindex meb
18331 Generate big-endian code. This is the default for @samp{moxie-*-*}
18332 configurations.
18333
18334 @item -mel
18335 @opindex mel
18336 Generate little-endian code.
18337
18338 @item -mmul.x
18339 @opindex mmul.x
18340 Generate mul.x and umul.x instructions. This is the default for
18341 @samp{moxiebox-*-*} configurations.
18342
18343 @item -mno-crt0
18344 @opindex mno-crt0
18345 Do not link in the C run-time initialization object file.
18346
18347 @end table
18348
18349 @node MSP430 Options
18350 @subsection MSP430 Options
18351 @cindex MSP430 Options
18352
18353 These options are defined for the MSP430:
18354
18355 @table @gcctabopt
18356
18357 @item -masm-hex
18358 @opindex masm-hex
18359 Force assembly output to always use hex constants. Normally such
18360 constants are signed decimals, but this option is available for
18361 testsuite and/or aesthetic purposes.
18362
18363 @item -mmcu=
18364 @opindex mmcu=
18365 Select the MCU to target. This is used to create a C preprocessor
18366 symbol based upon the MCU name, converted to upper case and pre- and
18367 post-fixed with @samp{__}. This in turn is used by the
18368 @file{msp430.h} header file to select an MCU-specific supplementary
18369 header file.
18370
18371 The option also sets the ISA to use. If the MCU name is one that is
18372 known to only support the 430 ISA then that is selected, otherwise the
18373 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
18374 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
18375 name selects the 430X ISA.
18376
18377 In addition an MCU-specific linker script is added to the linker
18378 command line. The script's name is the name of the MCU with
18379 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
18380 command line defines the C preprocessor symbol @code{__XXX__} and
18381 cause the linker to search for a script called @file{xxx.ld}.
18382
18383 This option is also passed on to the assembler.
18384
18385 @item -mcpu=
18386 @opindex mcpu=
18387 Specifies the ISA to use. Accepted values are @samp{msp430},
18388 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
18389 @option{-mmcu=} option should be used to select the ISA.
18390
18391 @item -msim
18392 @opindex msim
18393 Link to the simulator runtime libraries and linker script. Overrides
18394 any scripts that would be selected by the @option{-mmcu=} option.
18395
18396 @item -mlarge
18397 @opindex mlarge
18398 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
18399
18400 @item -msmall
18401 @opindex msmall
18402 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
18403
18404 @item -mrelax
18405 @opindex mrelax
18406 This option is passed to the assembler and linker, and allows the
18407 linker to perform certain optimizations that cannot be done until
18408 the final link.
18409
18410 @item mhwmult=
18411 @opindex mhwmult=
18412 Describes the type of hardware multiply supported by the target.
18413 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
18414 for the original 16-bit-only multiply supported by early MCUs.
18415 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
18416 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
18417 A value of @samp{auto} can also be given. This tells GCC to deduce
18418 the hardware multiply support based upon the MCU name provided by the
18419 @option{-mmcu} option. If no @option{-mmcu} option is specified then
18420 @samp{32bit} hardware multiply support is assumed. If the MCU name is
18421 not recognised then no hardware multiply support is assumed.
18422 @code{auto} is the default setting.
18423
18424 Hardware multiplies are normally performed by calling a library
18425 routine. This saves space in the generated code. When compiling at
18426 @option{-O3} or higher however the hardware multiplier is invoked
18427 inline. This makes for bigger, but faster code.
18428
18429 The hardware multiply routines disable interrupts whilst running and
18430 restore the previous interrupt state when they finish. This makes
18431 them safe to use inside interrupt handlers as well as in normal code.
18432
18433 @item -minrt
18434 @opindex minrt
18435 Enable the use of a minimum runtime environment - no static
18436 initializers or constructors. This is intended for memory-constrained
18437 devices. The compiler includes special symbols in some objects
18438 that tell the linker and runtime which code fragments are required.
18439
18440 @item -mcode-region=
18441 @itemx -mdata-region=
18442 @opindex mcode-region
18443 @opindex mdata-region
18444 These options tell the compiler where to place functions and data that
18445 do not have one of the @code{lower}, @code{upper}, @code{either} or
18446 @code{section} attributes. Possible values are @code{lower},
18447 @code{upper}, @code{either} or @code{any}. The first three behave
18448 like the corresponding attribute. The fourth possible value -
18449 @code{any} - is the default. It leaves placement entirely up to the
18450 linker script and how it assigns the standard sections (.text, .data
18451 etc) to the memory regions.
18452
18453 @item -msilicon-errata=
18454 @opindex msilicon-errata
18455 This option passes on a request to assembler to enable the fixes for
18456 the named silicon errata.
18457
18458 @item -msilicon-errata-warn=
18459 @opindex msilicon-errata-warn
18460 This option passes on a request to the assembler to enable warning
18461 messages when a silicon errata might need to be applied.
18462
18463 @end table
18464
18465 @node NDS32 Options
18466 @subsection NDS32 Options
18467 @cindex NDS32 Options
18468
18469 These options are defined for NDS32 implementations:
18470
18471 @table @gcctabopt
18472
18473 @item -mbig-endian
18474 @opindex mbig-endian
18475 Generate code in big-endian mode.
18476
18477 @item -mlittle-endian
18478 @opindex mlittle-endian
18479 Generate code in little-endian mode.
18480
18481 @item -mreduced-regs
18482 @opindex mreduced-regs
18483 Use reduced-set registers for register allocation.
18484
18485 @item -mfull-regs
18486 @opindex mfull-regs
18487 Use full-set registers for register allocation.
18488
18489 @item -mcmov
18490 @opindex mcmov
18491 Generate conditional move instructions.
18492
18493 @item -mno-cmov
18494 @opindex mno-cmov
18495 Do not generate conditional move instructions.
18496
18497 @item -mperf-ext
18498 @opindex mperf-ext
18499 Generate performance extension instructions.
18500
18501 @item -mno-perf-ext
18502 @opindex mno-perf-ext
18503 Do not generate performance extension instructions.
18504
18505 @item -mv3push
18506 @opindex mv3push
18507 Generate v3 push25/pop25 instructions.
18508
18509 @item -mno-v3push
18510 @opindex mno-v3push
18511 Do not generate v3 push25/pop25 instructions.
18512
18513 @item -m16-bit
18514 @opindex m16-bit
18515 Generate 16-bit instructions.
18516
18517 @item -mno-16-bit
18518 @opindex mno-16-bit
18519 Do not generate 16-bit instructions.
18520
18521 @item -misr-vector-size=@var{num}
18522 @opindex misr-vector-size
18523 Specify the size of each interrupt vector, which must be 4 or 16.
18524
18525 @item -mcache-block-size=@var{num}
18526 @opindex mcache-block-size
18527 Specify the size of each cache block,
18528 which must be a power of 2 between 4 and 512.
18529
18530 @item -march=@var{arch}
18531 @opindex march
18532 Specify the name of the target architecture.
18533
18534 @item -mcmodel=@var{code-model}
18535 @opindex mcmodel
18536 Set the code model to one of
18537 @table @asis
18538 @item @samp{small}
18539 All the data and read-only data segments must be within 512KB addressing space.
18540 The text segment must be within 16MB addressing space.
18541 @item @samp{medium}
18542 The data segment must be within 512KB while the read-only data segment can be
18543 within 4GB addressing space. The text segment should be still within 16MB
18544 addressing space.
18545 @item @samp{large}
18546 All the text and data segments can be within 4GB addressing space.
18547 @end table
18548
18549 @item -mctor-dtor
18550 @opindex mctor-dtor
18551 Enable constructor/destructor feature.
18552
18553 @item -mrelax
18554 @opindex mrelax
18555 Guide linker to relax instructions.
18556
18557 @end table
18558
18559 @node Nios II Options
18560 @subsection Nios II Options
18561 @cindex Nios II options
18562 @cindex Altera Nios II options
18563
18564 These are the options defined for the Altera Nios II processor.
18565
18566 @table @gcctabopt
18567
18568 @item -G @var{num}
18569 @opindex G
18570 @cindex smaller data references
18571 Put global and static objects less than or equal to @var{num} bytes
18572 into the small data or BSS sections instead of the normal data or BSS
18573 sections. The default value of @var{num} is 8.
18574
18575 @item -mgpopt=@var{option}
18576 @item -mgpopt
18577 @itemx -mno-gpopt
18578 @opindex mgpopt
18579 @opindex mno-gpopt
18580 Generate (do not generate) GP-relative accesses. The following
18581 @var{option} names are recognized:
18582
18583 @table @samp
18584
18585 @item none
18586 Do not generate GP-relative accesses.
18587
18588 @item local
18589 Generate GP-relative accesses for small data objects that are not
18590 external, weak, or uninitialized common symbols.
18591 Also use GP-relative addressing for objects that
18592 have been explicitly placed in a small data section via a @code{section}
18593 attribute.
18594
18595 @item global
18596 As for @samp{local}, but also generate GP-relative accesses for
18597 small data objects that are external, weak, or common. If you use this option,
18598 you must ensure that all parts of your program (including libraries) are
18599 compiled with the same @option{-G} setting.
18600
18601 @item data
18602 Generate GP-relative accesses for all data objects in the program. If you
18603 use this option, the entire data and BSS segments
18604 of your program must fit in 64K of memory and you must use an appropriate
18605 linker script to allocate them within the addressible range of the
18606 global pointer.
18607
18608 @item all
18609 Generate GP-relative addresses for function pointers as well as data
18610 pointers. If you use this option, the entire text, data, and BSS segments
18611 of your program must fit in 64K of memory and you must use an appropriate
18612 linker script to allocate them within the addressible range of the
18613 global pointer.
18614
18615 @end table
18616
18617 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
18618 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
18619
18620 The default is @option{-mgpopt} except when @option{-fpic} or
18621 @option{-fPIC} is specified to generate position-independent code.
18622 Note that the Nios II ABI does not permit GP-relative accesses from
18623 shared libraries.
18624
18625 You may need to specify @option{-mno-gpopt} explicitly when building
18626 programs that include large amounts of small data, including large
18627 GOT data sections. In this case, the 16-bit offset for GP-relative
18628 addressing may not be large enough to allow access to the entire
18629 small data section.
18630
18631 @item -mel
18632 @itemx -meb
18633 @opindex mel
18634 @opindex meb
18635 Generate little-endian (default) or big-endian (experimental) code,
18636 respectively.
18637
18638 @item -march=@var{arch}
18639 @opindex march
18640 This specifies the name of the target Nios II architecture. GCC uses this
18641 name to determine what kind of instructions it can emit when generating
18642 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
18643
18644 The preprocessor macro @code{__nios2_arch__} is available to programs,
18645 with value 1 or 2, indicating the targeted ISA level.
18646
18647 @item -mbypass-cache
18648 @itemx -mno-bypass-cache
18649 @opindex mno-bypass-cache
18650 @opindex mbypass-cache
18651 Force all load and store instructions to always bypass cache by
18652 using I/O variants of the instructions. The default is not to
18653 bypass the cache.
18654
18655 @item -mno-cache-volatile
18656 @itemx -mcache-volatile
18657 @opindex mcache-volatile
18658 @opindex mno-cache-volatile
18659 Volatile memory access bypass the cache using the I/O variants of
18660 the load and store instructions. The default is not to bypass the cache.
18661
18662 @item -mno-fast-sw-div
18663 @itemx -mfast-sw-div
18664 @opindex mno-fast-sw-div
18665 @opindex mfast-sw-div
18666 Do not use table-based fast divide for small numbers. The default
18667 is to use the fast divide at @option{-O3} and above.
18668
18669 @item -mno-hw-mul
18670 @itemx -mhw-mul
18671 @itemx -mno-hw-mulx
18672 @itemx -mhw-mulx
18673 @itemx -mno-hw-div
18674 @itemx -mhw-div
18675 @opindex mno-hw-mul
18676 @opindex mhw-mul
18677 @opindex mno-hw-mulx
18678 @opindex mhw-mulx
18679 @opindex mno-hw-div
18680 @opindex mhw-div
18681 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
18682 instructions by the compiler. The default is to emit @code{mul}
18683 and not emit @code{div} and @code{mulx}.
18684
18685 @item -mbmx
18686 @itemx -mno-bmx
18687 @itemx -mcdx
18688 @itemx -mno-cdx
18689 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
18690 CDX (code density) instructions. Enabling these instructions also
18691 requires @option{-march=r2}. Since these instructions are optional
18692 extensions to the R2 architecture, the default is not to emit them.
18693
18694 @item -mcustom-@var{insn}=@var{N}
18695 @itemx -mno-custom-@var{insn}
18696 @opindex mcustom-@var{insn}
18697 @opindex mno-custom-@var{insn}
18698 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
18699 custom instruction with encoding @var{N} when generating code that uses
18700 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
18701 instruction 253 for single-precision floating-point add operations instead
18702 of the default behavior of using a library call.
18703
18704 The following values of @var{insn} are supported. Except as otherwise
18705 noted, floating-point operations are expected to be implemented with
18706 normal IEEE 754 semantics and correspond directly to the C operators or the
18707 equivalent GCC built-in functions (@pxref{Other Builtins}).
18708
18709 Single-precision floating point:
18710 @table @asis
18711
18712 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
18713 Binary arithmetic operations.
18714
18715 @item @samp{fnegs}
18716 Unary negation.
18717
18718 @item @samp{fabss}
18719 Unary absolute value.
18720
18721 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
18722 Comparison operations.
18723
18724 @item @samp{fmins}, @samp{fmaxs}
18725 Floating-point minimum and maximum. These instructions are only
18726 generated if @option{-ffinite-math-only} is specified.
18727
18728 @item @samp{fsqrts}
18729 Unary square root operation.
18730
18731 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
18732 Floating-point trigonometric and exponential functions. These instructions
18733 are only generated if @option{-funsafe-math-optimizations} is also specified.
18734
18735 @end table
18736
18737 Double-precision floating point:
18738 @table @asis
18739
18740 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
18741 Binary arithmetic operations.
18742
18743 @item @samp{fnegd}
18744 Unary negation.
18745
18746 @item @samp{fabsd}
18747 Unary absolute value.
18748
18749 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
18750 Comparison operations.
18751
18752 @item @samp{fmind}, @samp{fmaxd}
18753 Double-precision minimum and maximum. These instructions are only
18754 generated if @option{-ffinite-math-only} is specified.
18755
18756 @item @samp{fsqrtd}
18757 Unary square root operation.
18758
18759 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
18760 Double-precision trigonometric and exponential functions. These instructions
18761 are only generated if @option{-funsafe-math-optimizations} is also specified.
18762
18763 @end table
18764
18765 Conversions:
18766 @table @asis
18767 @item @samp{fextsd}
18768 Conversion from single precision to double precision.
18769
18770 @item @samp{ftruncds}
18771 Conversion from double precision to single precision.
18772
18773 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
18774 Conversion from floating point to signed or unsigned integer types, with
18775 truncation towards zero.
18776
18777 @item @samp{round}
18778 Conversion from single-precision floating point to signed integer,
18779 rounding to the nearest integer and ties away from zero.
18780 This corresponds to the @code{__builtin_lroundf} function when
18781 @option{-fno-math-errno} is used.
18782
18783 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
18784 Conversion from signed or unsigned integer types to floating-point types.
18785
18786 @end table
18787
18788 In addition, all of the following transfer instructions for internal
18789 registers X and Y must be provided to use any of the double-precision
18790 floating-point instructions. Custom instructions taking two
18791 double-precision source operands expect the first operand in the
18792 64-bit register X. The other operand (or only operand of a unary
18793 operation) is given to the custom arithmetic instruction with the
18794 least significant half in source register @var{src1} and the most
18795 significant half in @var{src2}. A custom instruction that returns a
18796 double-precision result returns the most significant 32 bits in the
18797 destination register and the other half in 32-bit register Y.
18798 GCC automatically generates the necessary code sequences to write
18799 register X and/or read register Y when double-precision floating-point
18800 instructions are used.
18801
18802 @table @asis
18803
18804 @item @samp{fwrx}
18805 Write @var{src1} into the least significant half of X and @var{src2} into
18806 the most significant half of X.
18807
18808 @item @samp{fwry}
18809 Write @var{src1} into Y.
18810
18811 @item @samp{frdxhi}, @samp{frdxlo}
18812 Read the most or least (respectively) significant half of X and store it in
18813 @var{dest}.
18814
18815 @item @samp{frdy}
18816 Read the value of Y and store it into @var{dest}.
18817 @end table
18818
18819 Note that you can gain more local control over generation of Nios II custom
18820 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
18821 and @code{target("no-custom-@var{insn}")} function attributes
18822 (@pxref{Function Attributes})
18823 or pragmas (@pxref{Function Specific Option Pragmas}).
18824
18825 @item -mcustom-fpu-cfg=@var{name}
18826 @opindex mcustom-fpu-cfg
18827
18828 This option enables a predefined, named set of custom instruction encodings
18829 (see @option{-mcustom-@var{insn}} above).
18830 Currently, the following sets are defined:
18831
18832 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
18833 @gccoptlist{-mcustom-fmuls=252 @gol
18834 -mcustom-fadds=253 @gol
18835 -mcustom-fsubs=254 @gol
18836 -fsingle-precision-constant}
18837
18838 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
18839 @gccoptlist{-mcustom-fmuls=252 @gol
18840 -mcustom-fadds=253 @gol
18841 -mcustom-fsubs=254 @gol
18842 -mcustom-fdivs=255 @gol
18843 -fsingle-precision-constant}
18844
18845 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
18846 @gccoptlist{-mcustom-floatus=243 @gol
18847 -mcustom-fixsi=244 @gol
18848 -mcustom-floatis=245 @gol
18849 -mcustom-fcmpgts=246 @gol
18850 -mcustom-fcmples=249 @gol
18851 -mcustom-fcmpeqs=250 @gol
18852 -mcustom-fcmpnes=251 @gol
18853 -mcustom-fmuls=252 @gol
18854 -mcustom-fadds=253 @gol
18855 -mcustom-fsubs=254 @gol
18856 -mcustom-fdivs=255 @gol
18857 -fsingle-precision-constant}
18858
18859 Custom instruction assignments given by individual
18860 @option{-mcustom-@var{insn}=} options override those given by
18861 @option{-mcustom-fpu-cfg=}, regardless of the
18862 order of the options on the command line.
18863
18864 Note that you can gain more local control over selection of a FPU
18865 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
18866 function attribute (@pxref{Function Attributes})
18867 or pragma (@pxref{Function Specific Option Pragmas}).
18868
18869 @end table
18870
18871 These additional @samp{-m} options are available for the Altera Nios II
18872 ELF (bare-metal) target:
18873
18874 @table @gcctabopt
18875
18876 @item -mhal
18877 @opindex mhal
18878 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
18879 startup and termination code, and is typically used in conjunction with
18880 @option{-msys-crt0=} to specify the location of the alternate startup code
18881 provided by the HAL BSP.
18882
18883 @item -msmallc
18884 @opindex msmallc
18885 Link with a limited version of the C library, @option{-lsmallc}, rather than
18886 Newlib.
18887
18888 @item -msys-crt0=@var{startfile}
18889 @opindex msys-crt0
18890 @var{startfile} is the file name of the startfile (crt0) to use
18891 when linking. This option is only useful in conjunction with @option{-mhal}.
18892
18893 @item -msys-lib=@var{systemlib}
18894 @opindex msys-lib
18895 @var{systemlib} is the library name of the library that provides
18896 low-level system calls required by the C library,
18897 e.g. @code{read} and @code{write}.
18898 This option is typically used to link with a library provided by a HAL BSP.
18899
18900 @end table
18901
18902 @node Nvidia PTX Options
18903 @subsection Nvidia PTX Options
18904 @cindex Nvidia PTX options
18905 @cindex nvptx options
18906
18907 These options are defined for Nvidia PTX:
18908
18909 @table @gcctabopt
18910
18911 @item -m32
18912 @itemx -m64
18913 @opindex m32
18914 @opindex m64
18915 Generate code for 32-bit or 64-bit ABI.
18916
18917 @item -mmainkernel
18918 @opindex mmainkernel
18919 Link in code for a __main kernel. This is for stand-alone instead of
18920 offloading execution.
18921
18922 @end table
18923
18924 @node PDP-11 Options
18925 @subsection PDP-11 Options
18926 @cindex PDP-11 Options
18927
18928 These options are defined for the PDP-11:
18929
18930 @table @gcctabopt
18931 @item -mfpu
18932 @opindex mfpu
18933 Use hardware FPP floating point. This is the default. (FIS floating
18934 point on the PDP-11/40 is not supported.)
18935
18936 @item -msoft-float
18937 @opindex msoft-float
18938 Do not use hardware floating point.
18939
18940 @item -mac0
18941 @opindex mac0
18942 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
18943
18944 @item -mno-ac0
18945 @opindex mno-ac0
18946 Return floating-point results in memory. This is the default.
18947
18948 @item -m40
18949 @opindex m40
18950 Generate code for a PDP-11/40.
18951
18952 @item -m45
18953 @opindex m45
18954 Generate code for a PDP-11/45. This is the default.
18955
18956 @item -m10
18957 @opindex m10
18958 Generate code for a PDP-11/10.
18959
18960 @item -mbcopy-builtin
18961 @opindex mbcopy-builtin
18962 Use inline @code{movmemhi} patterns for copying memory. This is the
18963 default.
18964
18965 @item -mbcopy
18966 @opindex mbcopy
18967 Do not use inline @code{movmemhi} patterns for copying memory.
18968
18969 @item -mint16
18970 @itemx -mno-int32
18971 @opindex mint16
18972 @opindex mno-int32
18973 Use 16-bit @code{int}. This is the default.
18974
18975 @item -mint32
18976 @itemx -mno-int16
18977 @opindex mint32
18978 @opindex mno-int16
18979 Use 32-bit @code{int}.
18980
18981 @item -mfloat64
18982 @itemx -mno-float32
18983 @opindex mfloat64
18984 @opindex mno-float32
18985 Use 64-bit @code{float}. This is the default.
18986
18987 @item -mfloat32
18988 @itemx -mno-float64
18989 @opindex mfloat32
18990 @opindex mno-float64
18991 Use 32-bit @code{float}.
18992
18993 @item -mabshi
18994 @opindex mabshi
18995 Use @code{abshi2} pattern. This is the default.
18996
18997 @item -mno-abshi
18998 @opindex mno-abshi
18999 Do not use @code{abshi2} pattern.
19000
19001 @item -mbranch-expensive
19002 @opindex mbranch-expensive
19003 Pretend that branches are expensive. This is for experimenting with
19004 code generation only.
19005
19006 @item -mbranch-cheap
19007 @opindex mbranch-cheap
19008 Do not pretend that branches are expensive. This is the default.
19009
19010 @item -munix-asm
19011 @opindex munix-asm
19012 Use Unix assembler syntax. This is the default when configured for
19013 @samp{pdp11-*-bsd}.
19014
19015 @item -mdec-asm
19016 @opindex mdec-asm
19017 Use DEC assembler syntax. This is the default when configured for any
19018 PDP-11 target other than @samp{pdp11-*-bsd}.
19019 @end table
19020
19021 @node picoChip Options
19022 @subsection picoChip Options
19023 @cindex picoChip options
19024
19025 These @samp{-m} options are defined for picoChip implementations:
19026
19027 @table @gcctabopt
19028
19029 @item -mae=@var{ae_type}
19030 @opindex mcpu
19031 Set the instruction set, register set, and instruction scheduling
19032 parameters for array element type @var{ae_type}. Supported values
19033 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
19034
19035 @option{-mae=ANY} selects a completely generic AE type. Code
19036 generated with this option runs on any of the other AE types. The
19037 code is not as efficient as it would be if compiled for a specific
19038 AE type, and some types of operation (e.g., multiplication) do not
19039 work properly on all types of AE.
19040
19041 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
19042 for compiled code, and is the default.
19043
19044 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
19045 option may suffer from poor performance of byte (char) manipulation,
19046 since the DSP AE does not provide hardware support for byte load/stores.
19047
19048 @item -msymbol-as-address
19049 Enable the compiler to directly use a symbol name as an address in a
19050 load/store instruction, without first loading it into a
19051 register. Typically, the use of this option generates larger
19052 programs, which run faster than when the option isn't used. However, the
19053 results vary from program to program, so it is left as a user option,
19054 rather than being permanently enabled.
19055
19056 @item -mno-inefficient-warnings
19057 Disables warnings about the generation of inefficient code. These
19058 warnings can be generated, for example, when compiling code that
19059 performs byte-level memory operations on the MAC AE type. The MAC AE has
19060 no hardware support for byte-level memory operations, so all byte
19061 load/stores must be synthesized from word load/store operations. This is
19062 inefficient and a warning is generated to indicate
19063 that you should rewrite the code to avoid byte operations, or to target
19064 an AE type that has the necessary hardware support. This option disables
19065 these warnings.
19066
19067 @end table
19068
19069 @node PowerPC Options
19070 @subsection PowerPC Options
19071 @cindex PowerPC options
19072
19073 These are listed under @xref{RS/6000 and PowerPC Options}.
19074
19075 @node RL78 Options
19076 @subsection RL78 Options
19077 @cindex RL78 Options
19078
19079 @table @gcctabopt
19080
19081 @item -msim
19082 @opindex msim
19083 Links in additional target libraries to support operation within a
19084 simulator.
19085
19086 @item -mmul=none
19087 @itemx -mmul=g10
19088 @itemx -mmul=g13
19089 @itemx -mmul=g14
19090 @itemx -mmul=rl78
19091 @opindex mmul
19092 Specifies the type of hardware multiplication and division support to
19093 be used. The simplest is @code{none}, which uses software for both
19094 multiplication and division. This is the default. The @code{g13}
19095 value is for the hardware multiply/divide peripheral found on the
19096 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
19097 the multiplication and division instructions supported by the RL78/G14
19098 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
19099 the value @code{mg10} is an alias for @code{none}.
19100
19101 In addition a C preprocessor macro is defined, based upon the setting
19102 of this option. Possible values are: @code{__RL78_MUL_NONE__},
19103 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
19104
19105 @item -mcpu=g10
19106 @itemx -mcpu=g13
19107 @itemx -mcpu=g14
19108 @itemx -mcpu=rl78
19109 @opindex mcpu
19110 Specifies the RL78 core to target. The default is the G14 core, also
19111 known as an S3 core or just RL78. The G13 or S2 core does not have
19112 multiply or divide instructions, instead it uses a hardware peripheral
19113 for these operations. The G10 or S1 core does not have register
19114 banks, so it uses a different calling convention.
19115
19116 If this option is set it also selects the type of hardware multiply
19117 support to use, unless this is overridden by an explicit
19118 @option{-mmul=none} option on the command line. Thus specifying
19119 @option{-mcpu=g13} enables the use of the G13 hardware multiply
19120 peripheral and specifying @option{-mcpu=g10} disables the use of
19121 hardware multipications altogether.
19122
19123 Note, although the RL78/G14 core is the default target, specifying
19124 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
19125 change the behaviour of the toolchain since it also enables G14
19126 hardware multiply support. If these options are not specified on the
19127 command line then software multiplication routines will be used even
19128 though the code targets the RL78 core. This is for backwards
19129 compatibility with older toolchains which did not have hardware
19130 multiply and divide support.
19131
19132 In addition a C preprocessor macro is defined, based upon the setting
19133 of this option. Possible values are: @code{__RL78_G10__},
19134 @code{__RL78_G13__} or @code{__RL78_G14__}.
19135
19136 @item -mg10
19137 @itemx -mg13
19138 @itemx -mg14
19139 @itemx -mrl78
19140 @opindex mg10
19141 @opindex mg13
19142 @opindex mg14
19143 @opindex mrl78
19144 These are aliases for the corresponding @option{-mcpu=} option. They
19145 are provided for backwards compatibility.
19146
19147 @item -mallregs
19148 @opindex mallregs
19149 Allow the compiler to use all of the available registers. By default
19150 registers @code{r24..r31} are reserved for use in interrupt handlers.
19151 With this option enabled these registers can be used in ordinary
19152 functions as well.
19153
19154 @item -m64bit-doubles
19155 @itemx -m32bit-doubles
19156 @opindex m64bit-doubles
19157 @opindex m32bit-doubles
19158 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
19159 or 32 bits (@option{-m32bit-doubles}) in size. The default is
19160 @option{-m32bit-doubles}.
19161
19162 @end table
19163
19164 @node RS/6000 and PowerPC Options
19165 @subsection IBM RS/6000 and PowerPC Options
19166 @cindex RS/6000 and PowerPC Options
19167 @cindex IBM RS/6000 and PowerPC Options
19168
19169 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
19170 @table @gcctabopt
19171 @item -mpowerpc-gpopt
19172 @itemx -mno-powerpc-gpopt
19173 @itemx -mpowerpc-gfxopt
19174 @itemx -mno-powerpc-gfxopt
19175 @need 800
19176 @itemx -mpowerpc64
19177 @itemx -mno-powerpc64
19178 @itemx -mmfcrf
19179 @itemx -mno-mfcrf
19180 @itemx -mpopcntb
19181 @itemx -mno-popcntb
19182 @itemx -mpopcntd
19183 @itemx -mno-popcntd
19184 @itemx -mfprnd
19185 @itemx -mno-fprnd
19186 @need 800
19187 @itemx -mcmpb
19188 @itemx -mno-cmpb
19189 @itemx -mmfpgpr
19190 @itemx -mno-mfpgpr
19191 @itemx -mhard-dfp
19192 @itemx -mno-hard-dfp
19193 @opindex mpowerpc-gpopt
19194 @opindex mno-powerpc-gpopt
19195 @opindex mpowerpc-gfxopt
19196 @opindex mno-powerpc-gfxopt
19197 @opindex mpowerpc64
19198 @opindex mno-powerpc64
19199 @opindex mmfcrf
19200 @opindex mno-mfcrf
19201 @opindex mpopcntb
19202 @opindex mno-popcntb
19203 @opindex mpopcntd
19204 @opindex mno-popcntd
19205 @opindex mfprnd
19206 @opindex mno-fprnd
19207 @opindex mcmpb
19208 @opindex mno-cmpb
19209 @opindex mmfpgpr
19210 @opindex mno-mfpgpr
19211 @opindex mhard-dfp
19212 @opindex mno-hard-dfp
19213 You use these options to specify which instructions are available on the
19214 processor you are using. The default value of these options is
19215 determined when configuring GCC@. Specifying the
19216 @option{-mcpu=@var{cpu_type}} overrides the specification of these
19217 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
19218 rather than the options listed above.
19219
19220 Specifying @option{-mpowerpc-gpopt} allows
19221 GCC to use the optional PowerPC architecture instructions in the
19222 General Purpose group, including floating-point square root. Specifying
19223 @option{-mpowerpc-gfxopt} allows GCC to
19224 use the optional PowerPC architecture instructions in the Graphics
19225 group, including floating-point select.
19226
19227 The @option{-mmfcrf} option allows GCC to generate the move from
19228 condition register field instruction implemented on the POWER4
19229 processor and other processors that support the PowerPC V2.01
19230 architecture.
19231 The @option{-mpopcntb} option allows GCC to generate the popcount and
19232 double-precision FP reciprocal estimate instruction implemented on the
19233 POWER5 processor and other processors that support the PowerPC V2.02
19234 architecture.
19235 The @option{-mpopcntd} option allows GCC to generate the popcount
19236 instruction implemented on the POWER7 processor and other processors
19237 that support the PowerPC V2.06 architecture.
19238 The @option{-mfprnd} option allows GCC to generate the FP round to
19239 integer instructions implemented on the POWER5+ processor and other
19240 processors that support the PowerPC V2.03 architecture.
19241 The @option{-mcmpb} option allows GCC to generate the compare bytes
19242 instruction implemented on the POWER6 processor and other processors
19243 that support the PowerPC V2.05 architecture.
19244 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
19245 general-purpose register instructions implemented on the POWER6X
19246 processor and other processors that support the extended PowerPC V2.05
19247 architecture.
19248 The @option{-mhard-dfp} option allows GCC to generate the decimal
19249 floating-point instructions implemented on some POWER processors.
19250
19251 The @option{-mpowerpc64} option allows GCC to generate the additional
19252 64-bit instructions that are found in the full PowerPC64 architecture
19253 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
19254 @option{-mno-powerpc64}.
19255
19256 @item -mcpu=@var{cpu_type}
19257 @opindex mcpu
19258 Set architecture type, register usage, and
19259 instruction scheduling parameters for machine type @var{cpu_type}.
19260 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
19261 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
19262 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
19263 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
19264 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
19265 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
19266 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
19267 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
19268 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
19269 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, @samp{powerpc},
19270 @samp{powerpc64}, @samp{powerpc64le}, and @samp{rs64}.
19271
19272 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
19273 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
19274 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
19275 architecture machine types, with an appropriate, generic processor
19276 model assumed for scheduling purposes.
19277
19278 The other options specify a specific processor. Code generated under
19279 those options runs best on that processor, and may not run at all on
19280 others.
19281
19282 The @option{-mcpu} options automatically enable or disable the
19283 following options:
19284
19285 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
19286 -mpopcntb -mpopcntd -mpowerpc64 @gol
19287 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
19288 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
19289 -mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol
19290 -mquad-memory -mquad-memory-atomic}
19291
19292 The particular options set for any particular CPU varies between
19293 compiler versions, depending on what setting seems to produce optimal
19294 code for that CPU; it doesn't necessarily reflect the actual hardware's
19295 capabilities. If you wish to set an individual option to a particular
19296 value, you may specify it after the @option{-mcpu} option, like
19297 @option{-mcpu=970 -mno-altivec}.
19298
19299 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
19300 not enabled or disabled by the @option{-mcpu} option at present because
19301 AIX does not have full support for these options. You may still
19302 enable or disable them individually if you're sure it'll work in your
19303 environment.
19304
19305 @item -mtune=@var{cpu_type}
19306 @opindex mtune
19307 Set the instruction scheduling parameters for machine type
19308 @var{cpu_type}, but do not set the architecture type or register usage,
19309 as @option{-mcpu=@var{cpu_type}} does. The same
19310 values for @var{cpu_type} are used for @option{-mtune} as for
19311 @option{-mcpu}. If both are specified, the code generated uses the
19312 architecture and registers set by @option{-mcpu}, but the
19313 scheduling parameters set by @option{-mtune}.
19314
19315 @item -mcmodel=small
19316 @opindex mcmodel=small
19317 Generate PowerPC64 code for the small model: The TOC is limited to
19318 64k.
19319
19320 @item -mcmodel=medium
19321 @opindex mcmodel=medium
19322 Generate PowerPC64 code for the medium model: The TOC and other static
19323 data may be up to a total of 4G in size.
19324
19325 @item -mcmodel=large
19326 @opindex mcmodel=large
19327 Generate PowerPC64 code for the large model: The TOC may be up to 4G
19328 in size. Other data and code is only limited by the 64-bit address
19329 space.
19330
19331 @item -maltivec
19332 @itemx -mno-altivec
19333 @opindex maltivec
19334 @opindex mno-altivec
19335 Generate code that uses (does not use) AltiVec instructions, and also
19336 enable the use of built-in functions that allow more direct access to
19337 the AltiVec instruction set. You may also need to set
19338 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
19339 enhancements.
19340
19341 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
19342 @option{-maltivec=be}, the element order for Altivec intrinsics such
19343 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
19344 match array element order corresponding to the endianness of the
19345 target. That is, element zero identifies the leftmost element in a
19346 vector register when targeting a big-endian platform, and identifies
19347 the rightmost element in a vector register when targeting a
19348 little-endian platform.
19349
19350 @item -maltivec=be
19351 @opindex maltivec=be
19352 Generate Altivec instructions using big-endian element order,
19353 regardless of whether the target is big- or little-endian. This is
19354 the default when targeting a big-endian platform.
19355
19356 The element order is used to interpret element numbers in Altivec
19357 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
19358 @code{vec_insert}. By default, these match array element order
19359 corresponding to the endianness for the target.
19360
19361 @item -maltivec=le
19362 @opindex maltivec=le
19363 Generate Altivec instructions using little-endian element order,
19364 regardless of whether the target is big- or little-endian. This is
19365 the default when targeting a little-endian platform. This option is
19366 currently ignored when targeting a big-endian platform.
19367
19368 The element order is used to interpret element numbers in Altivec
19369 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
19370 @code{vec_insert}. By default, these match array element order
19371 corresponding to the endianness for the target.
19372
19373 @item -mvrsave
19374 @itemx -mno-vrsave
19375 @opindex mvrsave
19376 @opindex mno-vrsave
19377 Generate VRSAVE instructions when generating AltiVec code.
19378
19379 @item -mgen-cell-microcode
19380 @opindex mgen-cell-microcode
19381 Generate Cell microcode instructions.
19382
19383 @item -mwarn-cell-microcode
19384 @opindex mwarn-cell-microcode
19385 Warn when a Cell microcode instruction is emitted. An example
19386 of a Cell microcode instruction is a variable shift.
19387
19388 @item -msecure-plt
19389 @opindex msecure-plt
19390 Generate code that allows @command{ld} and @command{ld.so}
19391 to build executables and shared
19392 libraries with non-executable @code{.plt} and @code{.got} sections.
19393 This is a PowerPC
19394 32-bit SYSV ABI option.
19395
19396 @item -mbss-plt
19397 @opindex mbss-plt
19398 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
19399 fills in, and
19400 requires @code{.plt} and @code{.got}
19401 sections that are both writable and executable.
19402 This is a PowerPC 32-bit SYSV ABI option.
19403
19404 @item -misel
19405 @itemx -mno-isel
19406 @opindex misel
19407 @opindex mno-isel
19408 This switch enables or disables the generation of ISEL instructions.
19409
19410 @item -misel=@var{yes/no}
19411 This switch has been deprecated. Use @option{-misel} and
19412 @option{-mno-isel} instead.
19413
19414 @item -mspe
19415 @itemx -mno-spe
19416 @opindex mspe
19417 @opindex mno-spe
19418 This switch enables or disables the generation of SPE simd
19419 instructions.
19420
19421 @item -mpaired
19422 @itemx -mno-paired
19423 @opindex mpaired
19424 @opindex mno-paired
19425 This switch enables or disables the generation of PAIRED simd
19426 instructions.
19427
19428 @item -mspe=@var{yes/no}
19429 This option has been deprecated. Use @option{-mspe} and
19430 @option{-mno-spe} instead.
19431
19432 @item -mvsx
19433 @itemx -mno-vsx
19434 @opindex mvsx
19435 @opindex mno-vsx
19436 Generate code that uses (does not use) vector/scalar (VSX)
19437 instructions, and also enable the use of built-in functions that allow
19438 more direct access to the VSX instruction set.
19439
19440 @item -mcrypto
19441 @itemx -mno-crypto
19442 @opindex mcrypto
19443 @opindex mno-crypto
19444 Enable the use (disable) of the built-in functions that allow direct
19445 access to the cryptographic instructions that were added in version
19446 2.07 of the PowerPC ISA.
19447
19448 @item -mdirect-move
19449 @itemx -mno-direct-move
19450 @opindex mdirect-move
19451 @opindex mno-direct-move
19452 Generate code that uses (does not use) the instructions to move data
19453 between the general purpose registers and the vector/scalar (VSX)
19454 registers that were added in version 2.07 of the PowerPC ISA.
19455
19456 @item -mpower8-fusion
19457 @itemx -mno-power8-fusion
19458 @opindex mpower8-fusion
19459 @opindex mno-power8-fusion
19460 Generate code that keeps (does not keeps) some integer operations
19461 adjacent so that the instructions can be fused together on power8 and
19462 later processors.
19463
19464 @item -mpower8-vector
19465 @itemx -mno-power8-vector
19466 @opindex mpower8-vector
19467 @opindex mno-power8-vector
19468 Generate code that uses (does not use) the vector and scalar
19469 instructions that were added in version 2.07 of the PowerPC ISA. Also
19470 enable the use of built-in functions that allow more direct access to
19471 the vector instructions.
19472
19473 @item -mquad-memory
19474 @itemx -mno-quad-memory
19475 @opindex mquad-memory
19476 @opindex mno-quad-memory
19477 Generate code that uses (does not use) the non-atomic quad word memory
19478 instructions. The @option{-mquad-memory} option requires use of
19479 64-bit mode.
19480
19481 @item -mquad-memory-atomic
19482 @itemx -mno-quad-memory-atomic
19483 @opindex mquad-memory-atomic
19484 @opindex mno-quad-memory-atomic
19485 Generate code that uses (does not use) the atomic quad word memory
19486 instructions. The @option{-mquad-memory-atomic} option requires use of
19487 64-bit mode.
19488
19489 @item -mupper-regs-df
19490 @itemx -mno-upper-regs-df
19491 @opindex mupper-regs-df
19492 @opindex mno-upper-regs-df
19493 Generate code that uses (does not use) the scalar double precision
19494 instructions that target all 64 registers in the vector/scalar
19495 floating point register set that were added in version 2.06 of the
19496 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
19497 use any of the @option{-mcpu=power7}, @option{-mcpu=power8}, or
19498 @option{-mvsx} options.
19499
19500 @item -mupper-regs-sf
19501 @itemx -mno-upper-regs-sf
19502 @opindex mupper-regs-sf
19503 @opindex mno-upper-regs-sf
19504 Generate code that uses (does not use) the scalar single precision
19505 instructions that target all 64 registers in the vector/scalar
19506 floating point register set that were added in version 2.07 of the
19507 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
19508 use either of the @option{-mcpu=power8} or @option{-mpower8-vector}
19509 options.
19510
19511 @item -mupper-regs
19512 @itemx -mno-upper-regs
19513 @opindex mupper-regs
19514 @opindex mno-upper-regs
19515 Generate code that uses (does not use) the scalar
19516 instructions that target all 64 registers in the vector/scalar
19517 floating point register set, depending on the model of the machine.
19518
19519 If the @option{-mno-upper-regs} option is used, it turns off both
19520 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
19521
19522 @item -mfloat-gprs=@var{yes/single/double/no}
19523 @itemx -mfloat-gprs
19524 @opindex mfloat-gprs
19525 This switch enables or disables the generation of floating-point
19526 operations on the general-purpose registers for architectures that
19527 support it.
19528
19529 The argument @samp{yes} or @samp{single} enables the use of
19530 single-precision floating-point operations.
19531
19532 The argument @samp{double} enables the use of single and
19533 double-precision floating-point operations.
19534
19535 The argument @samp{no} disables floating-point operations on the
19536 general-purpose registers.
19537
19538 This option is currently only available on the MPC854x.
19539
19540 @item -m32
19541 @itemx -m64
19542 @opindex m32
19543 @opindex m64
19544 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
19545 targets (including GNU/Linux). The 32-bit environment sets int, long
19546 and pointer to 32 bits and generates code that runs on any PowerPC
19547 variant. The 64-bit environment sets int to 32 bits and long and
19548 pointer to 64 bits, and generates code for PowerPC64, as for
19549 @option{-mpowerpc64}.
19550
19551 @item -mfull-toc
19552 @itemx -mno-fp-in-toc
19553 @itemx -mno-sum-in-toc
19554 @itemx -mminimal-toc
19555 @opindex mfull-toc
19556 @opindex mno-fp-in-toc
19557 @opindex mno-sum-in-toc
19558 @opindex mminimal-toc
19559 Modify generation of the TOC (Table Of Contents), which is created for
19560 every executable file. The @option{-mfull-toc} option is selected by
19561 default. In that case, GCC allocates at least one TOC entry for
19562 each unique non-automatic variable reference in your program. GCC
19563 also places floating-point constants in the TOC@. However, only
19564 16,384 entries are available in the TOC@.
19565
19566 If you receive a linker error message that saying you have overflowed
19567 the available TOC space, you can reduce the amount of TOC space used
19568 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
19569 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
19570 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
19571 generate code to calculate the sum of an address and a constant at
19572 run time instead of putting that sum into the TOC@. You may specify one
19573 or both of these options. Each causes GCC to produce very slightly
19574 slower and larger code at the expense of conserving TOC space.
19575
19576 If you still run out of space in the TOC even when you specify both of
19577 these options, specify @option{-mminimal-toc} instead. This option causes
19578 GCC to make only one TOC entry for every file. When you specify this
19579 option, GCC produces code that is slower and larger but which
19580 uses extremely little TOC space. You may wish to use this option
19581 only on files that contain less frequently-executed code.
19582
19583 @item -maix64
19584 @itemx -maix32
19585 @opindex maix64
19586 @opindex maix32
19587 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
19588 @code{long} type, and the infrastructure needed to support them.
19589 Specifying @option{-maix64} implies @option{-mpowerpc64},
19590 while @option{-maix32} disables the 64-bit ABI and
19591 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
19592
19593 @item -mxl-compat
19594 @itemx -mno-xl-compat
19595 @opindex mxl-compat
19596 @opindex mno-xl-compat
19597 Produce code that conforms more closely to IBM XL compiler semantics
19598 when using AIX-compatible ABI@. Pass floating-point arguments to
19599 prototyped functions beyond the register save area (RSA) on the stack
19600 in addition to argument FPRs. Do not assume that most significant
19601 double in 128-bit long double value is properly rounded when comparing
19602 values and converting to double. Use XL symbol names for long double
19603 support routines.
19604
19605 The AIX calling convention was extended but not initially documented to
19606 handle an obscure K&R C case of calling a function that takes the
19607 address of its arguments with fewer arguments than declared. IBM XL
19608 compilers access floating-point arguments that do not fit in the
19609 RSA from the stack when a subroutine is compiled without
19610 optimization. Because always storing floating-point arguments on the
19611 stack is inefficient and rarely needed, this option is not enabled by
19612 default and only is necessary when calling subroutines compiled by IBM
19613 XL compilers without optimization.
19614
19615 @item -mpe
19616 @opindex mpe
19617 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
19618 application written to use message passing with special startup code to
19619 enable the application to run. The system must have PE installed in the
19620 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
19621 must be overridden with the @option{-specs=} option to specify the
19622 appropriate directory location. The Parallel Environment does not
19623 support threads, so the @option{-mpe} option and the @option{-pthread}
19624 option are incompatible.
19625
19626 @item -malign-natural
19627 @itemx -malign-power
19628 @opindex malign-natural
19629 @opindex malign-power
19630 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
19631 @option{-malign-natural} overrides the ABI-defined alignment of larger
19632 types, such as floating-point doubles, on their natural size-based boundary.
19633 The option @option{-malign-power} instructs GCC to follow the ABI-specified
19634 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
19635
19636 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
19637 is not supported.
19638
19639 @item -msoft-float
19640 @itemx -mhard-float
19641 @opindex msoft-float
19642 @opindex mhard-float
19643 Generate code that does not use (uses) the floating-point register set.
19644 Software floating-point emulation is provided if you use the
19645 @option{-msoft-float} option, and pass the option to GCC when linking.
19646
19647 @item -msingle-float
19648 @itemx -mdouble-float
19649 @opindex msingle-float
19650 @opindex mdouble-float
19651 Generate code for single- or double-precision floating-point operations.
19652 @option{-mdouble-float} implies @option{-msingle-float}.
19653
19654 @item -msimple-fpu
19655 @opindex msimple-fpu
19656 Do not generate @code{sqrt} and @code{div} instructions for hardware
19657 floating-point unit.
19658
19659 @item -mfpu=@var{name}
19660 @opindex mfpu
19661 Specify type of floating-point unit. Valid values for @var{name} are
19662 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
19663 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
19664 @samp{sp_full} (equivalent to @option{-msingle-float}),
19665 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
19666
19667 @item -mxilinx-fpu
19668 @opindex mxilinx-fpu
19669 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
19670
19671 @item -mmultiple
19672 @itemx -mno-multiple
19673 @opindex mmultiple
19674 @opindex mno-multiple
19675 Generate code that uses (does not use) the load multiple word
19676 instructions and the store multiple word instructions. These
19677 instructions are generated by default on POWER systems, and not
19678 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
19679 PowerPC systems, since those instructions do not work when the
19680 processor is in little-endian mode. The exceptions are PPC740 and
19681 PPC750 which permit these instructions in little-endian mode.
19682
19683 @item -mstring
19684 @itemx -mno-string
19685 @opindex mstring
19686 @opindex mno-string
19687 Generate code that uses (does not use) the load string instructions
19688 and the store string word instructions to save multiple registers and
19689 do small block moves. These instructions are generated by default on
19690 POWER systems, and not generated on PowerPC systems. Do not use
19691 @option{-mstring} on little-endian PowerPC systems, since those
19692 instructions do not work when the processor is in little-endian mode.
19693 The exceptions are PPC740 and PPC750 which permit these instructions
19694 in little-endian mode.
19695
19696 @item -mupdate
19697 @itemx -mno-update
19698 @opindex mupdate
19699 @opindex mno-update
19700 Generate code that uses (does not use) the load or store instructions
19701 that update the base register to the address of the calculated memory
19702 location. These instructions are generated by default. If you use
19703 @option{-mno-update}, there is a small window between the time that the
19704 stack pointer is updated and the address of the previous frame is
19705 stored, which means code that walks the stack frame across interrupts or
19706 signals may get corrupted data.
19707
19708 @item -mavoid-indexed-addresses
19709 @itemx -mno-avoid-indexed-addresses
19710 @opindex mavoid-indexed-addresses
19711 @opindex mno-avoid-indexed-addresses
19712 Generate code that tries to avoid (not avoid) the use of indexed load
19713 or store instructions. These instructions can incur a performance
19714 penalty on Power6 processors in certain situations, such as when
19715 stepping through large arrays that cross a 16M boundary. This option
19716 is enabled by default when targeting Power6 and disabled otherwise.
19717
19718 @item -mfused-madd
19719 @itemx -mno-fused-madd
19720 @opindex mfused-madd
19721 @opindex mno-fused-madd
19722 Generate code that uses (does not use) the floating-point multiply and
19723 accumulate instructions. These instructions are generated by default
19724 if hardware floating point is used. The machine-dependent
19725 @option{-mfused-madd} option is now mapped to the machine-independent
19726 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
19727 mapped to @option{-ffp-contract=off}.
19728
19729 @item -mmulhw
19730 @itemx -mno-mulhw
19731 @opindex mmulhw
19732 @opindex mno-mulhw
19733 Generate code that uses (does not use) the half-word multiply and
19734 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
19735 These instructions are generated by default when targeting those
19736 processors.
19737
19738 @item -mdlmzb
19739 @itemx -mno-dlmzb
19740 @opindex mdlmzb
19741 @opindex mno-dlmzb
19742 Generate code that uses (does not use) the string-search @samp{dlmzb}
19743 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
19744 generated by default when targeting those processors.
19745
19746 @item -mno-bit-align
19747 @itemx -mbit-align
19748 @opindex mno-bit-align
19749 @opindex mbit-align
19750 On System V.4 and embedded PowerPC systems do not (do) force structures
19751 and unions that contain bit-fields to be aligned to the base type of the
19752 bit-field.
19753
19754 For example, by default a structure containing nothing but 8
19755 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
19756 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
19757 the structure is aligned to a 1-byte boundary and is 1 byte in
19758 size.
19759
19760 @item -mno-strict-align
19761 @itemx -mstrict-align
19762 @opindex mno-strict-align
19763 @opindex mstrict-align
19764 On System V.4 and embedded PowerPC systems do not (do) assume that
19765 unaligned memory references are handled by the system.
19766
19767 @item -mrelocatable
19768 @itemx -mno-relocatable
19769 @opindex mrelocatable
19770 @opindex mno-relocatable
19771 Generate code that allows (does not allow) a static executable to be
19772 relocated to a different address at run time. A simple embedded
19773 PowerPC system loader should relocate the entire contents of
19774 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
19775 a table of 32-bit addresses generated by this option. For this to
19776 work, all objects linked together must be compiled with
19777 @option{-mrelocatable} or @option{-mrelocatable-lib}.
19778 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
19779
19780 @item -mrelocatable-lib
19781 @itemx -mno-relocatable-lib
19782 @opindex mrelocatable-lib
19783 @opindex mno-relocatable-lib
19784 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
19785 @code{.fixup} section to allow static executables to be relocated at
19786 run time, but @option{-mrelocatable-lib} does not use the smaller stack
19787 alignment of @option{-mrelocatable}. Objects compiled with
19788 @option{-mrelocatable-lib} may be linked with objects compiled with
19789 any combination of the @option{-mrelocatable} options.
19790
19791 @item -mno-toc
19792 @itemx -mtoc
19793 @opindex mno-toc
19794 @opindex mtoc
19795 On System V.4 and embedded PowerPC systems do not (do) assume that
19796 register 2 contains a pointer to a global area pointing to the addresses
19797 used in the program.
19798
19799 @item -mlittle
19800 @itemx -mlittle-endian
19801 @opindex mlittle
19802 @opindex mlittle-endian
19803 On System V.4 and embedded PowerPC systems compile code for the
19804 processor in little-endian mode. The @option{-mlittle-endian} option is
19805 the same as @option{-mlittle}.
19806
19807 @item -mbig
19808 @itemx -mbig-endian
19809 @opindex mbig
19810 @opindex mbig-endian
19811 On System V.4 and embedded PowerPC systems compile code for the
19812 processor in big-endian mode. The @option{-mbig-endian} option is
19813 the same as @option{-mbig}.
19814
19815 @item -mdynamic-no-pic
19816 @opindex mdynamic-no-pic
19817 On Darwin and Mac OS X systems, compile code so that it is not
19818 relocatable, but that its external references are relocatable. The
19819 resulting code is suitable for applications, but not shared
19820 libraries.
19821
19822 @item -msingle-pic-base
19823 @opindex msingle-pic-base
19824 Treat the register used for PIC addressing as read-only, rather than
19825 loading it in the prologue for each function. The runtime system is
19826 responsible for initializing this register with an appropriate value
19827 before execution begins.
19828
19829 @item -mprioritize-restricted-insns=@var{priority}
19830 @opindex mprioritize-restricted-insns
19831 This option controls the priority that is assigned to
19832 dispatch-slot restricted instructions during the second scheduling
19833 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
19834 or @samp{2} to assign no, highest, or second-highest (respectively)
19835 priority to dispatch-slot restricted
19836 instructions.
19837
19838 @item -msched-costly-dep=@var{dependence_type}
19839 @opindex msched-costly-dep
19840 This option controls which dependences are considered costly
19841 by the target during instruction scheduling. The argument
19842 @var{dependence_type} takes one of the following values:
19843
19844 @table @asis
19845 @item @samp{no}
19846 No dependence is costly.
19847
19848 @item @samp{all}
19849 All dependences are costly.
19850
19851 @item @samp{true_store_to_load}
19852 A true dependence from store to load is costly.
19853
19854 @item @samp{store_to_load}
19855 Any dependence from store to load is costly.
19856
19857 @item @var{number}
19858 Any dependence for which the latency is greater than or equal to
19859 @var{number} is costly.
19860 @end table
19861
19862 @item -minsert-sched-nops=@var{scheme}
19863 @opindex minsert-sched-nops
19864 This option controls which NOP insertion scheme is used during
19865 the second scheduling pass. The argument @var{scheme} takes one of the
19866 following values:
19867
19868 @table @asis
19869 @item @samp{no}
19870 Don't insert NOPs.
19871
19872 @item @samp{pad}
19873 Pad with NOPs any dispatch group that has vacant issue slots,
19874 according to the scheduler's grouping.
19875
19876 @item @samp{regroup_exact}
19877 Insert NOPs to force costly dependent insns into
19878 separate groups. Insert exactly as many NOPs as needed to force an insn
19879 to a new group, according to the estimated processor grouping.
19880
19881 @item @var{number}
19882 Insert NOPs to force costly dependent insns into
19883 separate groups. Insert @var{number} NOPs to force an insn to a new group.
19884 @end table
19885
19886 @item -mcall-sysv
19887 @opindex mcall-sysv
19888 On System V.4 and embedded PowerPC systems compile code using calling
19889 conventions that adhere to the March 1995 draft of the System V
19890 Application Binary Interface, PowerPC processor supplement. This is the
19891 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
19892
19893 @item -mcall-sysv-eabi
19894 @itemx -mcall-eabi
19895 @opindex mcall-sysv-eabi
19896 @opindex mcall-eabi
19897 Specify both @option{-mcall-sysv} and @option{-meabi} options.
19898
19899 @item -mcall-sysv-noeabi
19900 @opindex mcall-sysv-noeabi
19901 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
19902
19903 @item -mcall-aixdesc
19904 @opindex m
19905 On System V.4 and embedded PowerPC systems compile code for the AIX
19906 operating system.
19907
19908 @item -mcall-linux
19909 @opindex mcall-linux
19910 On System V.4 and embedded PowerPC systems compile code for the
19911 Linux-based GNU system.
19912
19913 @item -mcall-freebsd
19914 @opindex mcall-freebsd
19915 On System V.4 and embedded PowerPC systems compile code for the
19916 FreeBSD operating system.
19917
19918 @item -mcall-netbsd
19919 @opindex mcall-netbsd
19920 On System V.4 and embedded PowerPC systems compile code for the
19921 NetBSD operating system.
19922
19923 @item -mcall-openbsd
19924 @opindex mcall-netbsd
19925 On System V.4 and embedded PowerPC systems compile code for the
19926 OpenBSD operating system.
19927
19928 @item -maix-struct-return
19929 @opindex maix-struct-return
19930 Return all structures in memory (as specified by the AIX ABI)@.
19931
19932 @item -msvr4-struct-return
19933 @opindex msvr4-struct-return
19934 Return structures smaller than 8 bytes in registers (as specified by the
19935 SVR4 ABI)@.
19936
19937 @item -mabi=@var{abi-type}
19938 @opindex mabi
19939 Extend the current ABI with a particular extension, or remove such extension.
19940 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
19941 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
19942 @samp{elfv1}, @samp{elfv2}@.
19943
19944 @item -mabi=spe
19945 @opindex mabi=spe
19946 Extend the current ABI with SPE ABI extensions. This does not change
19947 the default ABI, instead it adds the SPE ABI extensions to the current
19948 ABI@.
19949
19950 @item -mabi=no-spe
19951 @opindex mabi=no-spe
19952 Disable Book-E SPE ABI extensions for the current ABI@.
19953
19954 @item -mabi=ibmlongdouble
19955 @opindex mabi=ibmlongdouble
19956 Change the current ABI to use IBM extended-precision long double.
19957 This is a PowerPC 32-bit SYSV ABI option.
19958
19959 @item -mabi=ieeelongdouble
19960 @opindex mabi=ieeelongdouble
19961 Change the current ABI to use IEEE extended-precision long double.
19962 This is a PowerPC 32-bit Linux ABI option.
19963
19964 @item -mabi=elfv1
19965 @opindex mabi=elfv1
19966 Change the current ABI to use the ELFv1 ABI.
19967 This is the default ABI for big-endian PowerPC 64-bit Linux.
19968 Overriding the default ABI requires special system support and is
19969 likely to fail in spectacular ways.
19970
19971 @item -mabi=elfv2
19972 @opindex mabi=elfv2
19973 Change the current ABI to use the ELFv2 ABI.
19974 This is the default ABI for little-endian PowerPC 64-bit Linux.
19975 Overriding the default ABI requires special system support and is
19976 likely to fail in spectacular ways.
19977
19978 @item -mprototype
19979 @itemx -mno-prototype
19980 @opindex mprototype
19981 @opindex mno-prototype
19982 On System V.4 and embedded PowerPC systems assume that all calls to
19983 variable argument functions are properly prototyped. Otherwise, the
19984 compiler must insert an instruction before every non-prototyped call to
19985 set or clear bit 6 of the condition code register (@code{CR}) to
19986 indicate whether floating-point values are passed in the floating-point
19987 registers in case the function takes variable arguments. With
19988 @option{-mprototype}, only calls to prototyped variable argument functions
19989 set or clear the bit.
19990
19991 @item -msim
19992 @opindex msim
19993 On embedded PowerPC systems, assume that the startup module is called
19994 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
19995 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
19996 configurations.
19997
19998 @item -mmvme
19999 @opindex mmvme
20000 On embedded PowerPC systems, assume that the startup module is called
20001 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
20002 @file{libc.a}.
20003
20004 @item -mads
20005 @opindex mads
20006 On embedded PowerPC systems, assume that the startup module is called
20007 @file{crt0.o} and the standard C libraries are @file{libads.a} and
20008 @file{libc.a}.
20009
20010 @item -myellowknife
20011 @opindex myellowknife
20012 On embedded PowerPC systems, assume that the startup module is called
20013 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
20014 @file{libc.a}.
20015
20016 @item -mvxworks
20017 @opindex mvxworks
20018 On System V.4 and embedded PowerPC systems, specify that you are
20019 compiling for a VxWorks system.
20020
20021 @item -memb
20022 @opindex memb
20023 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
20024 header to indicate that @samp{eabi} extended relocations are used.
20025
20026 @item -meabi
20027 @itemx -mno-eabi
20028 @opindex meabi
20029 @opindex mno-eabi
20030 On System V.4 and embedded PowerPC systems do (do not) adhere to the
20031 Embedded Applications Binary Interface (EABI), which is a set of
20032 modifications to the System V.4 specifications. Selecting @option{-meabi}
20033 means that the stack is aligned to an 8-byte boundary, a function
20034 @code{__eabi} is called from @code{main} to set up the EABI
20035 environment, and the @option{-msdata} option can use both @code{r2} and
20036 @code{r13} to point to two separate small data areas. Selecting
20037 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
20038 no EABI initialization function is called from @code{main}, and the
20039 @option{-msdata} option only uses @code{r13} to point to a single
20040 small data area. The @option{-meabi} option is on by default if you
20041 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
20042
20043 @item -msdata=eabi
20044 @opindex msdata=eabi
20045 On System V.4 and embedded PowerPC systems, put small initialized
20046 @code{const} global and static data in the @code{.sdata2} section, which
20047 is pointed to by register @code{r2}. Put small initialized
20048 non-@code{const} global and static data in the @code{.sdata} section,
20049 which is pointed to by register @code{r13}. Put small uninitialized
20050 global and static data in the @code{.sbss} section, which is adjacent to
20051 the @code{.sdata} section. The @option{-msdata=eabi} option is
20052 incompatible with the @option{-mrelocatable} option. The
20053 @option{-msdata=eabi} option also sets the @option{-memb} option.
20054
20055 @item -msdata=sysv
20056 @opindex msdata=sysv
20057 On System V.4 and embedded PowerPC systems, put small global and static
20058 data in the @code{.sdata} section, which is pointed to by register
20059 @code{r13}. Put small uninitialized global and static data in the
20060 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
20061 The @option{-msdata=sysv} option is incompatible with the
20062 @option{-mrelocatable} option.
20063
20064 @item -msdata=default
20065 @itemx -msdata
20066 @opindex msdata=default
20067 @opindex msdata
20068 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
20069 compile code the same as @option{-msdata=eabi}, otherwise compile code the
20070 same as @option{-msdata=sysv}.
20071
20072 @item -msdata=data
20073 @opindex msdata=data
20074 On System V.4 and embedded PowerPC systems, put small global
20075 data in the @code{.sdata} section. Put small uninitialized global
20076 data in the @code{.sbss} section. Do not use register @code{r13}
20077 to address small data however. This is the default behavior unless
20078 other @option{-msdata} options are used.
20079
20080 @item -msdata=none
20081 @itemx -mno-sdata
20082 @opindex msdata=none
20083 @opindex mno-sdata
20084 On embedded PowerPC systems, put all initialized global and static data
20085 in the @code{.data} section, and all uninitialized data in the
20086 @code{.bss} section.
20087
20088 @item -mblock-move-inline-limit=@var{num}
20089 @opindex mblock-move-inline-limit
20090 Inline all block moves (such as calls to @code{memcpy} or structure
20091 copies) less than or equal to @var{num} bytes. The minimum value for
20092 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
20093 targets. The default value is target-specific.
20094
20095 @item -G @var{num}
20096 @opindex G
20097 @cindex smaller data references (PowerPC)
20098 @cindex .sdata/.sdata2 references (PowerPC)
20099 On embedded PowerPC systems, put global and static items less than or
20100 equal to @var{num} bytes into the small data or BSS sections instead of
20101 the normal data or BSS section. By default, @var{num} is 8. The
20102 @option{-G @var{num}} switch is also passed to the linker.
20103 All modules should be compiled with the same @option{-G @var{num}} value.
20104
20105 @item -mregnames
20106 @itemx -mno-regnames
20107 @opindex mregnames
20108 @opindex mno-regnames
20109 On System V.4 and embedded PowerPC systems do (do not) emit register
20110 names in the assembly language output using symbolic forms.
20111
20112 @item -mlongcall
20113 @itemx -mno-longcall
20114 @opindex mlongcall
20115 @opindex mno-longcall
20116 By default assume that all calls are far away so that a longer and more
20117 expensive calling sequence is required. This is required for calls
20118 farther than 32 megabytes (33,554,432 bytes) from the current location.
20119 A short call is generated if the compiler knows
20120 the call cannot be that far away. This setting can be overridden by
20121 the @code{shortcall} function attribute, or by @code{#pragma
20122 longcall(0)}.
20123
20124 Some linkers are capable of detecting out-of-range calls and generating
20125 glue code on the fly. On these systems, long calls are unnecessary and
20126 generate slower code. As of this writing, the AIX linker can do this,
20127 as can the GNU linker for PowerPC/64. It is planned to add this feature
20128 to the GNU linker for 32-bit PowerPC systems as well.
20129
20130 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
20131 callee, L42}, plus a @dfn{branch island} (glue code). The two target
20132 addresses represent the callee and the branch island. The
20133 Darwin/PPC linker prefers the first address and generates a @code{bl
20134 callee} if the PPC @code{bl} instruction reaches the callee directly;
20135 otherwise, the linker generates @code{bl L42} to call the branch
20136 island. The branch island is appended to the body of the
20137 calling function; it computes the full 32-bit address of the callee
20138 and jumps to it.
20139
20140 On Mach-O (Darwin) systems, this option directs the compiler emit to
20141 the glue for every direct call, and the Darwin linker decides whether
20142 to use or discard it.
20143
20144 In the future, GCC may ignore all longcall specifications
20145 when the linker is known to generate glue.
20146
20147 @item -mtls-markers
20148 @itemx -mno-tls-markers
20149 @opindex mtls-markers
20150 @opindex mno-tls-markers
20151 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
20152 specifying the function argument. The relocation allows the linker to
20153 reliably associate function call with argument setup instructions for
20154 TLS optimization, which in turn allows GCC to better schedule the
20155 sequence.
20156
20157 @item -pthread
20158 @opindex pthread
20159 Adds support for multithreading with the @dfn{pthreads} library.
20160 This option sets flags for both the preprocessor and linker.
20161
20162 @item -mrecip
20163 @itemx -mno-recip
20164 @opindex mrecip
20165 This option enables use of the reciprocal estimate and
20166 reciprocal square root estimate instructions with additional
20167 Newton-Raphson steps to increase precision instead of doing a divide or
20168 square root and divide for floating-point arguments. You should use
20169 the @option{-ffast-math} option when using @option{-mrecip} (or at
20170 least @option{-funsafe-math-optimizations},
20171 @option{-finite-math-only}, @option{-freciprocal-math} and
20172 @option{-fno-trapping-math}). Note that while the throughput of the
20173 sequence is generally higher than the throughput of the non-reciprocal
20174 instruction, the precision of the sequence can be decreased by up to 2
20175 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
20176 roots.
20177
20178 @item -mrecip=@var{opt}
20179 @opindex mrecip=opt
20180 This option controls which reciprocal estimate instructions
20181 may be used. @var{opt} is a comma-separated list of options, which may
20182 be preceded by a @code{!} to invert the option:
20183
20184 @table @samp
20185
20186 @item all
20187 Enable all estimate instructions.
20188
20189 @item default
20190 Enable the default instructions, equivalent to @option{-mrecip}.
20191
20192 @item none
20193 Disable all estimate instructions, equivalent to @option{-mno-recip}.
20194
20195 @item div
20196 Enable the reciprocal approximation instructions for both
20197 single and double precision.
20198
20199 @item divf
20200 Enable the single-precision reciprocal approximation instructions.
20201
20202 @item divd
20203 Enable the double-precision reciprocal approximation instructions.
20204
20205 @item rsqrt
20206 Enable the reciprocal square root approximation instructions for both
20207 single and double precision.
20208
20209 @item rsqrtf
20210 Enable the single-precision reciprocal square root approximation instructions.
20211
20212 @item rsqrtd
20213 Enable the double-precision reciprocal square root approximation instructions.
20214
20215 @end table
20216
20217 So, for example, @option{-mrecip=all,!rsqrtd} enables
20218 all of the reciprocal estimate instructions, except for the
20219 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
20220 which handle the double-precision reciprocal square root calculations.
20221
20222 @item -mrecip-precision
20223 @itemx -mno-recip-precision
20224 @opindex mrecip-precision
20225 Assume (do not assume) that the reciprocal estimate instructions
20226 provide higher-precision estimates than is mandated by the PowerPC
20227 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
20228 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
20229 The double-precision square root estimate instructions are not generated by
20230 default on low-precision machines, since they do not provide an
20231 estimate that converges after three steps.
20232
20233 @item -mveclibabi=@var{type}
20234 @opindex mveclibabi
20235 Specifies the ABI type to use for vectorizing intrinsics using an
20236 external library. The only type supported at present is @samp{mass},
20237 which specifies to use IBM's Mathematical Acceleration Subsystem
20238 (MASS) libraries for vectorizing intrinsics using external libraries.
20239 GCC currently emits calls to @code{acosd2}, @code{acosf4},
20240 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
20241 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
20242 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
20243 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
20244 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
20245 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
20246 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
20247 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
20248 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
20249 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
20250 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
20251 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
20252 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
20253 for power7. Both @option{-ftree-vectorize} and
20254 @option{-funsafe-math-optimizations} must also be enabled. The MASS
20255 libraries must be specified at link time.
20256
20257 @item -mfriz
20258 @itemx -mno-friz
20259 @opindex mfriz
20260 Generate (do not generate) the @code{friz} instruction when the
20261 @option{-funsafe-math-optimizations} option is used to optimize
20262 rounding of floating-point values to 64-bit integer and back to floating
20263 point. The @code{friz} instruction does not return the same value if
20264 the floating-point number is too large to fit in an integer.
20265
20266 @item -mpointers-to-nested-functions
20267 @itemx -mno-pointers-to-nested-functions
20268 @opindex mpointers-to-nested-functions
20269 Generate (do not generate) code to load up the static chain register
20270 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
20271 systems where a function pointer points to a 3-word descriptor giving
20272 the function address, TOC value to be loaded in register @code{r2}, and
20273 static chain value to be loaded in register @code{r11}. The
20274 @option{-mpointers-to-nested-functions} is on by default. You cannot
20275 call through pointers to nested functions or pointers
20276 to functions compiled in other languages that use the static chain if
20277 you use @option{-mno-pointers-to-nested-functions}.
20278
20279 @item -msave-toc-indirect
20280 @itemx -mno-save-toc-indirect
20281 @opindex msave-toc-indirect
20282 Generate (do not generate) code to save the TOC value in the reserved
20283 stack location in the function prologue if the function calls through
20284 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
20285 saved in the prologue, it is saved just before the call through the
20286 pointer. The @option{-mno-save-toc-indirect} option is the default.
20287
20288 @item -mcompat-align-parm
20289 @itemx -mno-compat-align-parm
20290 @opindex mcompat-align-parm
20291 Generate (do not generate) code to pass structure parameters with a
20292 maximum alignment of 64 bits, for compatibility with older versions
20293 of GCC.
20294
20295 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
20296 structure parameter on a 128-bit boundary when that structure contained
20297 a member requiring 128-bit alignment. This is corrected in more
20298 recent versions of GCC. This option may be used to generate code
20299 that is compatible with functions compiled with older versions of
20300 GCC.
20301
20302 The @option{-mno-compat-align-parm} option is the default.
20303 @end table
20304
20305 @node RX Options
20306 @subsection RX Options
20307 @cindex RX Options
20308
20309 These command-line options are defined for RX targets:
20310
20311 @table @gcctabopt
20312 @item -m64bit-doubles
20313 @itemx -m32bit-doubles
20314 @opindex m64bit-doubles
20315 @opindex m32bit-doubles
20316 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
20317 or 32 bits (@option{-m32bit-doubles}) in size. The default is
20318 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
20319 works on 32-bit values, which is why the default is
20320 @option{-m32bit-doubles}.
20321
20322 @item -fpu
20323 @itemx -nofpu
20324 @opindex fpu
20325 @opindex nofpu
20326 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
20327 floating-point hardware. The default is enabled for the RX600
20328 series and disabled for the RX200 series.
20329
20330 Floating-point instructions are only generated for 32-bit floating-point
20331 values, however, so the FPU hardware is not used for doubles if the
20332 @option{-m64bit-doubles} option is used.
20333
20334 @emph{Note} If the @option{-fpu} option is enabled then
20335 @option{-funsafe-math-optimizations} is also enabled automatically.
20336 This is because the RX FPU instructions are themselves unsafe.
20337
20338 @item -mcpu=@var{name}
20339 @opindex mcpu
20340 Selects the type of RX CPU to be targeted. Currently three types are
20341 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
20342 the specific @samp{RX610} CPU. The default is @samp{RX600}.
20343
20344 The only difference between @samp{RX600} and @samp{RX610} is that the
20345 @samp{RX610} does not support the @code{MVTIPL} instruction.
20346
20347 The @samp{RX200} series does not have a hardware floating-point unit
20348 and so @option{-nofpu} is enabled by default when this type is
20349 selected.
20350
20351 @item -mbig-endian-data
20352 @itemx -mlittle-endian-data
20353 @opindex mbig-endian-data
20354 @opindex mlittle-endian-data
20355 Store data (but not code) in the big-endian format. The default is
20356 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
20357 format.
20358
20359 @item -msmall-data-limit=@var{N}
20360 @opindex msmall-data-limit
20361 Specifies the maximum size in bytes of global and static variables
20362 which can be placed into the small data area. Using the small data
20363 area can lead to smaller and faster code, but the size of area is
20364 limited and it is up to the programmer to ensure that the area does
20365 not overflow. Also when the small data area is used one of the RX's
20366 registers (usually @code{r13}) is reserved for use pointing to this
20367 area, so it is no longer available for use by the compiler. This
20368 could result in slower and/or larger code if variables are pushed onto
20369 the stack instead of being held in this register.
20370
20371 Note, common variables (variables that have not been initialized) and
20372 constants are not placed into the small data area as they are assigned
20373 to other sections in the output executable.
20374
20375 The default value is zero, which disables this feature. Note, this
20376 feature is not enabled by default with higher optimization levels
20377 (@option{-O2} etc) because of the potentially detrimental effects of
20378 reserving a register. It is up to the programmer to experiment and
20379 discover whether this feature is of benefit to their program. See the
20380 description of the @option{-mpid} option for a description of how the
20381 actual register to hold the small data area pointer is chosen.
20382
20383 @item -msim
20384 @itemx -mno-sim
20385 @opindex msim
20386 @opindex mno-sim
20387 Use the simulator runtime. The default is to use the libgloss
20388 board-specific runtime.
20389
20390 @item -mas100-syntax
20391 @itemx -mno-as100-syntax
20392 @opindex mas100-syntax
20393 @opindex mno-as100-syntax
20394 When generating assembler output use a syntax that is compatible with
20395 Renesas's AS100 assembler. This syntax can also be handled by the GAS
20396 assembler, but it has some restrictions so it is not generated by default.
20397
20398 @item -mmax-constant-size=@var{N}
20399 @opindex mmax-constant-size
20400 Specifies the maximum size, in bytes, of a constant that can be used as
20401 an operand in a RX instruction. Although the RX instruction set does
20402 allow constants of up to 4 bytes in length to be used in instructions,
20403 a longer value equates to a longer instruction. Thus in some
20404 circumstances it can be beneficial to restrict the size of constants
20405 that are used in instructions. Constants that are too big are instead
20406 placed into a constant pool and referenced via register indirection.
20407
20408 The value @var{N} can be between 0 and 4. A value of 0 (the default)
20409 or 4 means that constants of any size are allowed.
20410
20411 @item -mrelax
20412 @opindex mrelax
20413 Enable linker relaxation. Linker relaxation is a process whereby the
20414 linker attempts to reduce the size of a program by finding shorter
20415 versions of various instructions. Disabled by default.
20416
20417 @item -mint-register=@var{N}
20418 @opindex mint-register
20419 Specify the number of registers to reserve for fast interrupt handler
20420 functions. The value @var{N} can be between 0 and 4. A value of 1
20421 means that register @code{r13} is reserved for the exclusive use
20422 of fast interrupt handlers. A value of 2 reserves @code{r13} and
20423 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
20424 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
20425 A value of 0, the default, does not reserve any registers.
20426
20427 @item -msave-acc-in-interrupts
20428 @opindex msave-acc-in-interrupts
20429 Specifies that interrupt handler functions should preserve the
20430 accumulator register. This is only necessary if normal code might use
20431 the accumulator register, for example because it performs 64-bit
20432 multiplications. The default is to ignore the accumulator as this
20433 makes the interrupt handlers faster.
20434
20435 @item -mpid
20436 @itemx -mno-pid
20437 @opindex mpid
20438 @opindex mno-pid
20439 Enables the generation of position independent data. When enabled any
20440 access to constant data is done via an offset from a base address
20441 held in a register. This allows the location of constant data to be
20442 determined at run time without requiring the executable to be
20443 relocated, which is a benefit to embedded applications with tight
20444 memory constraints. Data that can be modified is not affected by this
20445 option.
20446
20447 Note, using this feature reserves a register, usually @code{r13}, for
20448 the constant data base address. This can result in slower and/or
20449 larger code, especially in complicated functions.
20450
20451 The actual register chosen to hold the constant data base address
20452 depends upon whether the @option{-msmall-data-limit} and/or the
20453 @option{-mint-register} command-line options are enabled. Starting
20454 with register @code{r13} and proceeding downwards, registers are
20455 allocated first to satisfy the requirements of @option{-mint-register},
20456 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
20457 is possible for the small data area register to be @code{r8} if both
20458 @option{-mint-register=4} and @option{-mpid} are specified on the
20459 command line.
20460
20461 By default this feature is not enabled. The default can be restored
20462 via the @option{-mno-pid} command-line option.
20463
20464 @item -mno-warn-multiple-fast-interrupts
20465 @itemx -mwarn-multiple-fast-interrupts
20466 @opindex mno-warn-multiple-fast-interrupts
20467 @opindex mwarn-multiple-fast-interrupts
20468 Prevents GCC from issuing a warning message if it finds more than one
20469 fast interrupt handler when it is compiling a file. The default is to
20470 issue a warning for each extra fast interrupt handler found, as the RX
20471 only supports one such interrupt.
20472
20473 @item -mallow-string-insns
20474 @itemx -mno-allow-string-insns
20475 @opindex mallow-string-insns
20476 @opindex mno-allow-string-insns
20477 Enables or disables the use of the string manipulation instructions
20478 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
20479 @code{SWHILE} and also the @code{RMPA} instruction. These
20480 instructions may prefetch data, which is not safe to do if accessing
20481 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
20482 for more information).
20483
20484 The default is to allow these instructions, but it is not possible for
20485 GCC to reliably detect all circumstances where a string instruction
20486 might be used to access an I/O register, so their use cannot be
20487 disabled automatically. Instead it is reliant upon the programmer to
20488 use the @option{-mno-allow-string-insns} option if their program
20489 accesses I/O space.
20490
20491 When the instructions are enabled GCC defines the C preprocessor
20492 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
20493 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
20494 @end table
20495
20496 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
20497 has special significance to the RX port when used with the
20498 @code{interrupt} function attribute. This attribute indicates a
20499 function intended to process fast interrupts. GCC ensures
20500 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
20501 and/or @code{r13} and only provided that the normal use of the
20502 corresponding registers have been restricted via the
20503 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
20504 options.
20505
20506 @node S/390 and zSeries Options
20507 @subsection S/390 and zSeries Options
20508 @cindex S/390 and zSeries Options
20509
20510 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
20511
20512 @table @gcctabopt
20513 @item -mhard-float
20514 @itemx -msoft-float
20515 @opindex mhard-float
20516 @opindex msoft-float
20517 Use (do not use) the hardware floating-point instructions and registers
20518 for floating-point operations. When @option{-msoft-float} is specified,
20519 functions in @file{libgcc.a} are used to perform floating-point
20520 operations. When @option{-mhard-float} is specified, the compiler
20521 generates IEEE floating-point instructions. This is the default.
20522
20523 @item -mhard-dfp
20524 @itemx -mno-hard-dfp
20525 @opindex mhard-dfp
20526 @opindex mno-hard-dfp
20527 Use (do not use) the hardware decimal-floating-point instructions for
20528 decimal-floating-point operations. When @option{-mno-hard-dfp} is
20529 specified, functions in @file{libgcc.a} are used to perform
20530 decimal-floating-point operations. When @option{-mhard-dfp} is
20531 specified, the compiler generates decimal-floating-point hardware
20532 instructions. This is the default for @option{-march=z9-ec} or higher.
20533
20534 @item -mlong-double-64
20535 @itemx -mlong-double-128
20536 @opindex mlong-double-64
20537 @opindex mlong-double-128
20538 These switches control the size of @code{long double} type. A size
20539 of 64 bits makes the @code{long double} type equivalent to the @code{double}
20540 type. This is the default.
20541
20542 @item -mbackchain
20543 @itemx -mno-backchain
20544 @opindex mbackchain
20545 @opindex mno-backchain
20546 Store (do not store) the address of the caller's frame as backchain pointer
20547 into the callee's stack frame.
20548 A backchain may be needed to allow debugging using tools that do not understand
20549 DWARF 2 call frame information.
20550 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
20551 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
20552 the backchain is placed into the topmost word of the 96/160 byte register
20553 save area.
20554
20555 In general, code compiled with @option{-mbackchain} is call-compatible with
20556 code compiled with @option{-mmo-backchain}; however, use of the backchain
20557 for debugging purposes usually requires that the whole binary is built with
20558 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
20559 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
20560 to build a linux kernel use @option{-msoft-float}.
20561
20562 The default is to not maintain the backchain.
20563
20564 @item -mpacked-stack
20565 @itemx -mno-packed-stack
20566 @opindex mpacked-stack
20567 @opindex mno-packed-stack
20568 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
20569 specified, the compiler uses the all fields of the 96/160 byte register save
20570 area only for their default purpose; unused fields still take up stack space.
20571 When @option{-mpacked-stack} is specified, register save slots are densely
20572 packed at the top of the register save area; unused space is reused for other
20573 purposes, allowing for more efficient use of the available stack space.
20574 However, when @option{-mbackchain} is also in effect, the topmost word of
20575 the save area is always used to store the backchain, and the return address
20576 register is always saved two words below the backchain.
20577
20578 As long as the stack frame backchain is not used, code generated with
20579 @option{-mpacked-stack} is call-compatible with code generated with
20580 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
20581 S/390 or zSeries generated code that uses the stack frame backchain at run
20582 time, not just for debugging purposes. Such code is not call-compatible
20583 with code compiled with @option{-mpacked-stack}. Also, note that the
20584 combination of @option{-mbackchain},
20585 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
20586 to build a linux kernel use @option{-msoft-float}.
20587
20588 The default is to not use the packed stack layout.
20589
20590 @item -msmall-exec
20591 @itemx -mno-small-exec
20592 @opindex msmall-exec
20593 @opindex mno-small-exec
20594 Generate (or do not generate) code using the @code{bras} instruction
20595 to do subroutine calls.
20596 This only works reliably if the total executable size does not
20597 exceed 64k. The default is to use the @code{basr} instruction instead,
20598 which does not have this limitation.
20599
20600 @item -m64
20601 @itemx -m31
20602 @opindex m64
20603 @opindex m31
20604 When @option{-m31} is specified, generate code compliant to the
20605 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
20606 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
20607 particular to generate 64-bit instructions. For the @samp{s390}
20608 targets, the default is @option{-m31}, while the @samp{s390x}
20609 targets default to @option{-m64}.
20610
20611 @item -mzarch
20612 @itemx -mesa
20613 @opindex mzarch
20614 @opindex mesa
20615 When @option{-mzarch} is specified, generate code using the
20616 instructions available on z/Architecture.
20617 When @option{-mesa} is specified, generate code using the
20618 instructions available on ESA/390. Note that @option{-mesa} is
20619 not possible with @option{-m64}.
20620 When generating code compliant to the GNU/Linux for S/390 ABI,
20621 the default is @option{-mesa}. When generating code compliant
20622 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
20623
20624 @item -mhtm
20625 @itemx -mno-htm
20626 @opindex mhtm
20627 @opindex mno-htm
20628 The @option{-mhtm} option enables a set of builtins making use of
20629 instructions available with the transactional execution facility
20630 introduced with the IBM zEnterprise EC12 machine generation
20631 @ref{S/390 System z Built-in Functions}.
20632 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
20633
20634 @item -mvx
20635 @itemx -mno-vx
20636 @opindex mvx
20637 @opindex mno-vx
20638 When @option{-mvx} is specified, generate code using the instructions
20639 available with the vector extension facility introduced with the IBM
20640 z13 machine generation.
20641 This option changes the ABI for some vector type values with regard to
20642 alignment and calling conventions. In case vector type values are
20643 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
20644 command will be added to mark the resulting binary with the ABI used.
20645 @option{-mvx} is enabled by default when using @option{-march=z13}.
20646
20647 @item -mzvector
20648 @itemx -mno-zvector
20649 @opindex mzvector
20650 @opindex mno-zvector
20651 The @option{-mzvector} option enables vector language extensions and
20652 builtins using instructions available with the vector extension
20653 facility introduced with the IBM z13 machine generation.
20654 This option adds support for @samp{vector} to be used as a keyword to
20655 define vector type variables and arguments. @samp{vector} is only
20656 available when GNU extensions are enabled. It will not be expanded
20657 when requesting strict standard compliance e.g. with @option{-std=c99}.
20658 In addition to the GCC low-level builtins @option{-mzvector} enables
20659 a set of builtins added for compatibility with Altivec-style
20660 implementations like Power and Cell. In order to make use of these
20661 builtins the header file @file{vecintrin.h} needs to be included.
20662 @option{-mzvector} is disabled by default.
20663
20664 @item -mmvcle
20665 @itemx -mno-mvcle
20666 @opindex mmvcle
20667 @opindex mno-mvcle
20668 Generate (or do not generate) code using the @code{mvcle} instruction
20669 to perform block moves. When @option{-mno-mvcle} is specified,
20670 use a @code{mvc} loop instead. This is the default unless optimizing for
20671 size.
20672
20673 @item -mdebug
20674 @itemx -mno-debug
20675 @opindex mdebug
20676 @opindex mno-debug
20677 Print (or do not print) additional debug information when compiling.
20678 The default is to not print debug information.
20679
20680 @item -march=@var{cpu-type}
20681 @opindex march
20682 Generate code that runs on @var{cpu-type}, which is the name of a system
20683 representing a certain processor type. Possible values for
20684 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
20685 @samp{z9-109}, @samp{z9-ec}, @samp{z10}, @samp{z196}, @samp{zEC12},
20686 and @samp{z13}.
20687 When generating code using the instructions available on z/Architecture,
20688 the default is @option{-march=z900}. Otherwise, the default is
20689 @option{-march=g5}.
20690
20691 @item -mtune=@var{cpu-type}
20692 @opindex mtune
20693 Tune to @var{cpu-type} everything applicable about the generated code,
20694 except for the ABI and the set of available instructions.
20695 The list of @var{cpu-type} values is the same as for @option{-march}.
20696 The default is the value used for @option{-march}.
20697
20698 @item -mtpf-trace
20699 @itemx -mno-tpf-trace
20700 @opindex mtpf-trace
20701 @opindex mno-tpf-trace
20702 Generate code that adds (does not add) in TPF OS specific branches to trace
20703 routines in the operating system. This option is off by default, even
20704 when compiling for the TPF OS@.
20705
20706 @item -mfused-madd
20707 @itemx -mno-fused-madd
20708 @opindex mfused-madd
20709 @opindex mno-fused-madd
20710 Generate code that uses (does not use) the floating-point multiply and
20711 accumulate instructions. These instructions are generated by default if
20712 hardware floating point is used.
20713
20714 @item -mwarn-framesize=@var{framesize}
20715 @opindex mwarn-framesize
20716 Emit a warning if the current function exceeds the given frame size. Because
20717 this is a compile-time check it doesn't need to be a real problem when the program
20718 runs. It is intended to identify functions that most probably cause
20719 a stack overflow. It is useful to be used in an environment with limited stack
20720 size e.g.@: the linux kernel.
20721
20722 @item -mwarn-dynamicstack
20723 @opindex mwarn-dynamicstack
20724 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
20725 arrays. This is generally a bad idea with a limited stack size.
20726
20727 @item -mstack-guard=@var{stack-guard}
20728 @itemx -mstack-size=@var{stack-size}
20729 @opindex mstack-guard
20730 @opindex mstack-size
20731 If these options are provided the S/390 back end emits additional instructions in
20732 the function prologue that trigger a trap if the stack size is @var{stack-guard}
20733 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
20734 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
20735 the frame size of the compiled function is chosen.
20736 These options are intended to be used to help debugging stack overflow problems.
20737 The additionally emitted code causes only little overhead and hence can also be
20738 used in production-like systems without greater performance degradation. The given
20739 values have to be exact powers of 2 and @var{stack-size} has to be greater than
20740 @var{stack-guard} without exceeding 64k.
20741 In order to be efficient the extra code makes the assumption that the stack starts
20742 at an address aligned to the value given by @var{stack-size}.
20743 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
20744
20745 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
20746 @opindex mhotpatch
20747 If the hotpatch option is enabled, a ``hot-patching'' function
20748 prologue is generated for all functions in the compilation unit.
20749 The funtion label is prepended with the given number of two-byte
20750 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
20751 the label, 2 * @var{post-halfwords} bytes are appended, using the
20752 largest NOP like instructions the architecture allows (maximum
20753 1000000).
20754
20755 If both arguments are zero, hotpatching is disabled.
20756
20757 This option can be overridden for individual functions with the
20758 @code{hotpatch} attribute.
20759 @end table
20760
20761 @node Score Options
20762 @subsection Score Options
20763 @cindex Score Options
20764
20765 These options are defined for Score implementations:
20766
20767 @table @gcctabopt
20768 @item -meb
20769 @opindex meb
20770 Compile code for big-endian mode. This is the default.
20771
20772 @item -mel
20773 @opindex mel
20774 Compile code for little-endian mode.
20775
20776 @item -mnhwloop
20777 @opindex mnhwloop
20778 Disable generation of @code{bcnz} instructions.
20779
20780 @item -muls
20781 @opindex muls
20782 Enable generation of unaligned load and store instructions.
20783
20784 @item -mmac
20785 @opindex mmac
20786 Enable the use of multiply-accumulate instructions. Disabled by default.
20787
20788 @item -mscore5
20789 @opindex mscore5
20790 Specify the SCORE5 as the target architecture.
20791
20792 @item -mscore5u
20793 @opindex mscore5u
20794 Specify the SCORE5U of the target architecture.
20795
20796 @item -mscore7
20797 @opindex mscore7
20798 Specify the SCORE7 as the target architecture. This is the default.
20799
20800 @item -mscore7d
20801 @opindex mscore7d
20802 Specify the SCORE7D as the target architecture.
20803 @end table
20804
20805 @node SH Options
20806 @subsection SH Options
20807
20808 These @samp{-m} options are defined for the SH implementations:
20809
20810 @table @gcctabopt
20811 @item -m1
20812 @opindex m1
20813 Generate code for the SH1.
20814
20815 @item -m2
20816 @opindex m2
20817 Generate code for the SH2.
20818
20819 @item -m2e
20820 Generate code for the SH2e.
20821
20822 @item -m2a-nofpu
20823 @opindex m2a-nofpu
20824 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
20825 that the floating-point unit is not used.
20826
20827 @item -m2a-single-only
20828 @opindex m2a-single-only
20829 Generate code for the SH2a-FPU, in such a way that no double-precision
20830 floating-point operations are used.
20831
20832 @item -m2a-single
20833 @opindex m2a-single
20834 Generate code for the SH2a-FPU assuming the floating-point unit is in
20835 single-precision mode by default.
20836
20837 @item -m2a
20838 @opindex m2a
20839 Generate code for the SH2a-FPU assuming the floating-point unit is in
20840 double-precision mode by default.
20841
20842 @item -m3
20843 @opindex m3
20844 Generate code for the SH3.
20845
20846 @item -m3e
20847 @opindex m3e
20848 Generate code for the SH3e.
20849
20850 @item -m4-nofpu
20851 @opindex m4-nofpu
20852 Generate code for the SH4 without a floating-point unit.
20853
20854 @item -m4-single-only
20855 @opindex m4-single-only
20856 Generate code for the SH4 with a floating-point unit that only
20857 supports single-precision arithmetic.
20858
20859 @item -m4-single
20860 @opindex m4-single
20861 Generate code for the SH4 assuming the floating-point unit is in
20862 single-precision mode by default.
20863
20864 @item -m4
20865 @opindex m4
20866 Generate code for the SH4.
20867
20868 @item -m4-100
20869 @opindex m4-100
20870 Generate code for SH4-100.
20871
20872 @item -m4-100-nofpu
20873 @opindex m4-100-nofpu
20874 Generate code for SH4-100 in such a way that the
20875 floating-point unit is not used.
20876
20877 @item -m4-100-single
20878 @opindex m4-100-single
20879 Generate code for SH4-100 assuming the floating-point unit is in
20880 single-precision mode by default.
20881
20882 @item -m4-100-single-only
20883 @opindex m4-100-single-only
20884 Generate code for SH4-100 in such a way that no double-precision
20885 floating-point operations are used.
20886
20887 @item -m4-200
20888 @opindex m4-200
20889 Generate code for SH4-200.
20890
20891 @item -m4-200-nofpu
20892 @opindex m4-200-nofpu
20893 Generate code for SH4-200 without in such a way that the
20894 floating-point unit is not used.
20895
20896 @item -m4-200-single
20897 @opindex m4-200-single
20898 Generate code for SH4-200 assuming the floating-point unit is in
20899 single-precision mode by default.
20900
20901 @item -m4-200-single-only
20902 @opindex m4-200-single-only
20903 Generate code for SH4-200 in such a way that no double-precision
20904 floating-point operations are used.
20905
20906 @item -m4-300
20907 @opindex m4-300
20908 Generate code for SH4-300.
20909
20910 @item -m4-300-nofpu
20911 @opindex m4-300-nofpu
20912 Generate code for SH4-300 without in such a way that the
20913 floating-point unit is not used.
20914
20915 @item -m4-300-single
20916 @opindex m4-300-single
20917 Generate code for SH4-300 in such a way that no double-precision
20918 floating-point operations are used.
20919
20920 @item -m4-300-single-only
20921 @opindex m4-300-single-only
20922 Generate code for SH4-300 in such a way that no double-precision
20923 floating-point operations are used.
20924
20925 @item -m4-340
20926 @opindex m4-340
20927 Generate code for SH4-340 (no MMU, no FPU).
20928
20929 @item -m4-500
20930 @opindex m4-500
20931 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
20932 assembler.
20933
20934 @item -m4a-nofpu
20935 @opindex m4a-nofpu
20936 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
20937 floating-point unit is not used.
20938
20939 @item -m4a-single-only
20940 @opindex m4a-single-only
20941 Generate code for the SH4a, in such a way that no double-precision
20942 floating-point operations are used.
20943
20944 @item -m4a-single
20945 @opindex m4a-single
20946 Generate code for the SH4a assuming the floating-point unit is in
20947 single-precision mode by default.
20948
20949 @item -m4a
20950 @opindex m4a
20951 Generate code for the SH4a.
20952
20953 @item -m4al
20954 @opindex m4al
20955 Same as @option{-m4a-nofpu}, except that it implicitly passes
20956 @option{-dsp} to the assembler. GCC doesn't generate any DSP
20957 instructions at the moment.
20958
20959 @item -mb
20960 @opindex mb
20961 Compile code for the processor in big-endian mode.
20962
20963 @item -ml
20964 @opindex ml
20965 Compile code for the processor in little-endian mode.
20966
20967 @item -mdalign
20968 @opindex mdalign
20969 Align doubles at 64-bit boundaries. Note that this changes the calling
20970 conventions, and thus some functions from the standard C library do
20971 not work unless you recompile it first with @option{-mdalign}.
20972
20973 @item -mrelax
20974 @opindex mrelax
20975 Shorten some address references at link time, when possible; uses the
20976 linker option @option{-relax}.
20977
20978 @item -mbigtable
20979 @opindex mbigtable
20980 Use 32-bit offsets in @code{switch} tables. The default is to use
20981 16-bit offsets.
20982
20983 @item -mbitops
20984 @opindex mbitops
20985 Enable the use of bit manipulation instructions on SH2A.
20986
20987 @item -mfmovd
20988 @opindex mfmovd
20989 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
20990 alignment constraints.
20991
20992 @item -mrenesas
20993 @opindex mrenesas
20994 Comply with the calling conventions defined by Renesas.
20995
20996 @item -mno-renesas
20997 @opindex mno-renesas
20998 Comply with the calling conventions defined for GCC before the Renesas
20999 conventions were available. This option is the default for all
21000 targets of the SH toolchain.
21001
21002 @item -mnomacsave
21003 @opindex mnomacsave
21004 Mark the @code{MAC} register as call-clobbered, even if
21005 @option{-mrenesas} is given.
21006
21007 @item -mieee
21008 @itemx -mno-ieee
21009 @opindex mieee
21010 @opindex mno-ieee
21011 Control the IEEE compliance of floating-point comparisons, which affects the
21012 handling of cases where the result of a comparison is unordered. By default
21013 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
21014 enabled @option{-mno-ieee} is implicitly set, which results in faster
21015 floating-point greater-equal and less-equal comparisons. The implcit settings
21016 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
21017
21018 @item -minline-ic_invalidate
21019 @opindex minline-ic_invalidate
21020 Inline code to invalidate instruction cache entries after setting up
21021 nested function trampolines.
21022 This option has no effect if @option{-musermode} is in effect and the selected
21023 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
21024 instruction.
21025 If the selected code generation option does not allow the use of the @code{icbi}
21026 instruction, and @option{-musermode} is not in effect, the inlined code
21027 manipulates the instruction cache address array directly with an associative
21028 write. This not only requires privileged mode at run time, but it also
21029 fails if the cache line had been mapped via the TLB and has become unmapped.
21030
21031 @item -misize
21032 @opindex misize
21033 Dump instruction size and location in the assembly code.
21034
21035 @item -mpadstruct
21036 @opindex mpadstruct
21037 This option is deprecated. It pads structures to multiple of 4 bytes,
21038 which is incompatible with the SH ABI@.
21039
21040 @item -matomic-model=@var{model}
21041 @opindex matomic-model=@var{model}
21042 Sets the model of atomic operations and additional parameters as a comma
21043 separated list. For details on the atomic built-in functions see
21044 @ref{__atomic Builtins}. The following models and parameters are supported:
21045
21046 @table @samp
21047
21048 @item none
21049 Disable compiler generated atomic sequences and emit library calls for atomic
21050 operations. This is the default if the target is not @code{sh*-*-linux*}.
21051
21052 @item soft-gusa
21053 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
21054 built-in functions. The generated atomic sequences require additional support
21055 from the interrupt/exception handling code of the system and are only suitable
21056 for SH3* and SH4* single-core systems. This option is enabled by default when
21057 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
21058 this option also partially utilizes the hardware atomic instructions
21059 @code{movli.l} and @code{movco.l} to create more efficient code, unless
21060 @samp{strict} is specified.
21061
21062 @item soft-tcb
21063 Generate software atomic sequences that use a variable in the thread control
21064 block. This is a variation of the gUSA sequences which can also be used on
21065 SH1* and SH2* targets. The generated atomic sequences require additional
21066 support from the interrupt/exception handling code of the system and are only
21067 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
21068 parameter has to be specified as well.
21069
21070 @item soft-imask
21071 Generate software atomic sequences that temporarily disable interrupts by
21072 setting @code{SR.IMASK = 1111}. This model works only when the program runs
21073 in privileged mode and is only suitable for single-core systems. Additional
21074 support from the interrupt/exception handling code of the system is not
21075 required. This model is enabled by default when the target is
21076 @code{sh*-*-linux*} and SH1* or SH2*.
21077
21078 @item hard-llcs
21079 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
21080 instructions only. This is only available on SH4A and is suitable for
21081 multi-core systems. Since the hardware instructions support only 32 bit atomic
21082 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
21083 Code compiled with this option is also compatible with other software
21084 atomic model interrupt/exception handling systems if executed on an SH4A
21085 system. Additional support from the interrupt/exception handling code of the
21086 system is not required for this model.
21087
21088 @item gbr-offset=
21089 This parameter specifies the offset in bytes of the variable in the thread
21090 control block structure that should be used by the generated atomic sequences
21091 when the @samp{soft-tcb} model has been selected. For other models this
21092 parameter is ignored. The specified value must be an integer multiple of four
21093 and in the range 0-1020.
21094
21095 @item strict
21096 This parameter prevents mixed usage of multiple atomic models, even if they
21097 are compatible, and makes the compiler generate atomic sequences of the
21098 specified model only.
21099
21100 @end table
21101
21102 @item -mtas
21103 @opindex mtas
21104 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
21105 Notice that depending on the particular hardware and software configuration
21106 this can degrade overall performance due to the operand cache line flushes
21107 that are implied by the @code{tas.b} instruction. On multi-core SH4A
21108 processors the @code{tas.b} instruction must be used with caution since it
21109 can result in data corruption for certain cache configurations.
21110
21111 @item -mprefergot
21112 @opindex mprefergot
21113 When generating position-independent code, emit function calls using
21114 the Global Offset Table instead of the Procedure Linkage Table.
21115
21116 @item -musermode
21117 @itemx -mno-usermode
21118 @opindex musermode
21119 @opindex mno-usermode
21120 Don't allow (allow) the compiler generating privileged mode code. Specifying
21121 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
21122 inlined code would not work in user mode. @option{-musermode} is the default
21123 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
21124 @option{-musermode} has no effect, since there is no user mode.
21125
21126 @item -multcost=@var{number}
21127 @opindex multcost=@var{number}
21128 Set the cost to assume for a multiply insn.
21129
21130 @item -mdiv=@var{strategy}
21131 @opindex mdiv=@var{strategy}
21132 Set the division strategy to be used for integer division operations.
21133 @var{strategy} can be one of:
21134
21135 @table @samp
21136
21137 @item call-div1
21138 Calls a library function that uses the single-step division instruction
21139 @code{div1} to perform the operation. Division by zero calculates an
21140 unspecified result and does not trap. This is the default except for SH4,
21141 SH2A and SHcompact.
21142
21143 @item call-fp
21144 Calls a library function that performs the operation in double precision
21145 floating point. Division by zero causes a floating-point exception. This is
21146 the default for SHcompact with FPU. Specifying this for targets that do not
21147 have a double precision FPU defaults to @code{call-div1}.
21148
21149 @item call-table
21150 Calls a library function that uses a lookup table for small divisors and
21151 the @code{div1} instruction with case distinction for larger divisors. Division
21152 by zero calculates an unspecified result and does not trap. This is the default
21153 for SH4. Specifying this for targets that do not have dynamic shift
21154 instructions defaults to @code{call-div1}.
21155
21156 @end table
21157
21158 When a division strategy has not been specified the default strategy is
21159 selected based on the current target. For SH2A the default strategy is to
21160 use the @code{divs} and @code{divu} instructions instead of library function
21161 calls.
21162
21163 @item -maccumulate-outgoing-args
21164 @opindex maccumulate-outgoing-args
21165 Reserve space once for outgoing arguments in the function prologue rather
21166 than around each call. Generally beneficial for performance and size. Also
21167 needed for unwinding to avoid changing the stack frame around conditional code.
21168
21169 @item -mdivsi3_libfunc=@var{name}
21170 @opindex mdivsi3_libfunc=@var{name}
21171 Set the name of the library function used for 32-bit signed division to
21172 @var{name}.
21173 This only affects the name used in the @samp{call} division strategies, and
21174 the compiler still expects the same sets of input/output/clobbered registers as
21175 if this option were not present.
21176
21177 @item -mfixed-range=@var{register-range}
21178 @opindex mfixed-range
21179 Generate code treating the given register range as fixed registers.
21180 A fixed register is one that the register allocator can not use. This is
21181 useful when compiling kernel code. A register range is specified as
21182 two registers separated by a dash. Multiple register ranges can be
21183 specified separated by a comma.
21184
21185 @item -mbranch-cost=@var{num}
21186 @opindex mbranch-cost=@var{num}
21187 Assume @var{num} to be the cost for a branch instruction. Higher numbers
21188 make the compiler try to generate more branch-free code if possible.
21189 If not specified the value is selected depending on the processor type that
21190 is being compiled for.
21191
21192 @item -mzdcbranch
21193 @itemx -mno-zdcbranch
21194 @opindex mzdcbranch
21195 @opindex mno-zdcbranch
21196 Assume (do not assume) that zero displacement conditional branch instructions
21197 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
21198 compiler prefers zero displacement branch code sequences. This is
21199 enabled by default when generating code for SH4 and SH4A. It can be explicitly
21200 disabled by specifying @option{-mno-zdcbranch}.
21201
21202 @item -mcbranch-force-delay-slot
21203 @opindex mcbranch-force-delay-slot
21204 Force the usage of delay slots for conditional branches, which stuffs the delay
21205 slot with a @code{nop} if a suitable instruction can't be found. By default
21206 this option is disabled. It can be enabled to work around hardware bugs as
21207 found in the original SH7055.
21208
21209 @item -mfused-madd
21210 @itemx -mno-fused-madd
21211 @opindex mfused-madd
21212 @opindex mno-fused-madd
21213 Generate code that uses (does not use) the floating-point multiply and
21214 accumulate instructions. These instructions are generated by default
21215 if hardware floating point is used. The machine-dependent
21216 @option{-mfused-madd} option is now mapped to the machine-independent
21217 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
21218 mapped to @option{-ffp-contract=off}.
21219
21220 @item -mfsca
21221 @itemx -mno-fsca
21222 @opindex mfsca
21223 @opindex mno-fsca
21224 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
21225 and cosine approximations. The option @option{-mfsca} must be used in
21226 combination with @option{-funsafe-math-optimizations}. It is enabled by default
21227 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
21228 approximations even if @option{-funsafe-math-optimizations} is in effect.
21229
21230 @item -mfsrra
21231 @itemx -mno-fsrra
21232 @opindex mfsrra
21233 @opindex mno-fsrra
21234 Allow or disallow the compiler to emit the @code{fsrra} instruction for
21235 reciprocal square root approximations. The option @option{-mfsrra} must be used
21236 in combination with @option{-funsafe-math-optimizations} and
21237 @option{-ffinite-math-only}. It is enabled by default when generating code for
21238 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
21239 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
21240 in effect.
21241
21242 @item -mpretend-cmove
21243 @opindex mpretend-cmove
21244 Prefer zero-displacement conditional branches for conditional move instruction
21245 patterns. This can result in faster code on the SH4 processor.
21246
21247 @item -mfdpic
21248 @opindex fdpic
21249 Generate code using the FDPIC ABI.
21250
21251 @end table
21252
21253 @node Solaris 2 Options
21254 @subsection Solaris 2 Options
21255 @cindex Solaris 2 options
21256
21257 These @samp{-m} options are supported on Solaris 2:
21258
21259 @table @gcctabopt
21260 @item -mclear-hwcap
21261 @opindex mclear-hwcap
21262 @option{-mclear-hwcap} tells the compiler to remove the hardware
21263 capabilities generated by the Solaris assembler. This is only necessary
21264 when object files use ISA extensions not supported by the current
21265 machine, but check at runtime whether or not to use them.
21266
21267 @item -mimpure-text
21268 @opindex mimpure-text
21269 @option{-mimpure-text}, used in addition to @option{-shared}, tells
21270 the compiler to not pass @option{-z text} to the linker when linking a
21271 shared object. Using this option, you can link position-dependent
21272 code into a shared object.
21273
21274 @option{-mimpure-text} suppresses the ``relocations remain against
21275 allocatable but non-writable sections'' linker error message.
21276 However, the necessary relocations trigger copy-on-write, and the
21277 shared object is not actually shared across processes. Instead of
21278 using @option{-mimpure-text}, you should compile all source code with
21279 @option{-fpic} or @option{-fPIC}.
21280
21281 @end table
21282
21283 These switches are supported in addition to the above on Solaris 2:
21284
21285 @table @gcctabopt
21286 @item -pthreads
21287 @opindex pthreads
21288 Add support for multithreading using the POSIX threads library. This
21289 option sets flags for both the preprocessor and linker. This option does
21290 not affect the thread safety of object code produced by the compiler or
21291 that of libraries supplied with it.
21292
21293 @item -pthread
21294 @opindex pthread
21295 This is a synonym for @option{-pthreads}.
21296 @end table
21297
21298 @node SPARC Options
21299 @subsection SPARC Options
21300 @cindex SPARC options
21301
21302 These @samp{-m} options are supported on the SPARC:
21303
21304 @table @gcctabopt
21305 @item -mno-app-regs
21306 @itemx -mapp-regs
21307 @opindex mno-app-regs
21308 @opindex mapp-regs
21309 Specify @option{-mapp-regs} to generate output using the global registers
21310 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
21311 global register 1, each global register 2 through 4 is then treated as an
21312 allocable register that is clobbered by function calls. This is the default.
21313
21314 To be fully SVR4 ABI-compliant at the cost of some performance loss,
21315 specify @option{-mno-app-regs}. You should compile libraries and system
21316 software with this option.
21317
21318 @item -mflat
21319 @itemx -mno-flat
21320 @opindex mflat
21321 @opindex mno-flat
21322 With @option{-mflat}, the compiler does not generate save/restore instructions
21323 and uses a ``flat'' or single register window model. This model is compatible
21324 with the regular register window model. The local registers and the input
21325 registers (0--5) are still treated as ``call-saved'' registers and are
21326 saved on the stack as needed.
21327
21328 With @option{-mno-flat} (the default), the compiler generates save/restore
21329 instructions (except for leaf functions). This is the normal operating mode.
21330
21331 @item -mfpu
21332 @itemx -mhard-float
21333 @opindex mfpu
21334 @opindex mhard-float
21335 Generate output containing floating-point instructions. This is the
21336 default.
21337
21338 @item -mno-fpu
21339 @itemx -msoft-float
21340 @opindex mno-fpu
21341 @opindex msoft-float
21342 Generate output containing library calls for floating point.
21343 @strong{Warning:} the requisite libraries are not available for all SPARC
21344 targets. Normally the facilities of the machine's usual C compiler are
21345 used, but this cannot be done directly in cross-compilation. You must make
21346 your own arrangements to provide suitable library functions for
21347 cross-compilation. The embedded targets @samp{sparc-*-aout} and
21348 @samp{sparclite-*-*} do provide software floating-point support.
21349
21350 @option{-msoft-float} changes the calling convention in the output file;
21351 therefore, it is only useful if you compile @emph{all} of a program with
21352 this option. In particular, you need to compile @file{libgcc.a}, the
21353 library that comes with GCC, with @option{-msoft-float} in order for
21354 this to work.
21355
21356 @item -mhard-quad-float
21357 @opindex mhard-quad-float
21358 Generate output containing quad-word (long double) floating-point
21359 instructions.
21360
21361 @item -msoft-quad-float
21362 @opindex msoft-quad-float
21363 Generate output containing library calls for quad-word (long double)
21364 floating-point instructions. The functions called are those specified
21365 in the SPARC ABI@. This is the default.
21366
21367 As of this writing, there are no SPARC implementations that have hardware
21368 support for the quad-word floating-point instructions. They all invoke
21369 a trap handler for one of these instructions, and then the trap handler
21370 emulates the effect of the instruction. Because of the trap handler overhead,
21371 this is much slower than calling the ABI library routines. Thus the
21372 @option{-msoft-quad-float} option is the default.
21373
21374 @item -mno-unaligned-doubles
21375 @itemx -munaligned-doubles
21376 @opindex mno-unaligned-doubles
21377 @opindex munaligned-doubles
21378 Assume that doubles have 8-byte alignment. This is the default.
21379
21380 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
21381 alignment only if they are contained in another type, or if they have an
21382 absolute address. Otherwise, it assumes they have 4-byte alignment.
21383 Specifying this option avoids some rare compatibility problems with code
21384 generated by other compilers. It is not the default because it results
21385 in a performance loss, especially for floating-point code.
21386
21387 @item -muser-mode
21388 @itemx -mno-user-mode
21389 @opindex muser-mode
21390 @opindex mno-user-mode
21391 Do not generate code that can only run in supervisor mode. This is relevant
21392 only for the @code{casa} instruction emitted for the LEON3 processor. This
21393 is the default.
21394
21395 @item -mno-faster-structs
21396 @itemx -mfaster-structs
21397 @opindex mno-faster-structs
21398 @opindex mfaster-structs
21399 With @option{-mfaster-structs}, the compiler assumes that structures
21400 should have 8-byte alignment. This enables the use of pairs of
21401 @code{ldd} and @code{std} instructions for copies in structure
21402 assignment, in place of twice as many @code{ld} and @code{st} pairs.
21403 However, the use of this changed alignment directly violates the SPARC
21404 ABI@. Thus, it's intended only for use on targets where the developer
21405 acknowledges that their resulting code is not directly in line with
21406 the rules of the ABI@.
21407
21408 @item -mcpu=@var{cpu_type}
21409 @opindex mcpu
21410 Set the instruction set, register set, and instruction scheduling parameters
21411 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
21412 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
21413 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
21414 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
21415 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
21416 @samp{niagara3} and @samp{niagara4}.
21417
21418 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
21419 which selects the best architecture option for the host processor.
21420 @option{-mcpu=native} has no effect if GCC does not recognize
21421 the processor.
21422
21423 Default instruction scheduling parameters are used for values that select
21424 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
21425 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
21426
21427 Here is a list of each supported architecture and their supported
21428 implementations.
21429
21430 @table @asis
21431 @item v7
21432 cypress, leon3v7
21433
21434 @item v8
21435 supersparc, hypersparc, leon, leon3
21436
21437 @item sparclite
21438 f930, f934, sparclite86x
21439
21440 @item sparclet
21441 tsc701
21442
21443 @item v9
21444 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
21445 @end table
21446
21447 By default (unless configured otherwise), GCC generates code for the V7
21448 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
21449 additionally optimizes it for the Cypress CY7C602 chip, as used in the
21450 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
21451 SPARCStation 1, 2, IPX etc.
21452
21453 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
21454 architecture. The only difference from V7 code is that the compiler emits
21455 the integer multiply and integer divide instructions which exist in SPARC-V8
21456 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
21457 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
21458 2000 series.
21459
21460 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
21461 the SPARC architecture. This adds the integer multiply, integer divide step
21462 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
21463 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
21464 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
21465 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
21466 MB86934 chip, which is the more recent SPARClite with FPU@.
21467
21468 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
21469 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
21470 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
21471 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
21472 optimizes it for the TEMIC SPARClet chip.
21473
21474 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
21475 architecture. This adds 64-bit integer and floating-point move instructions,
21476 3 additional floating-point condition code registers and conditional move
21477 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
21478 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
21479 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
21480 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
21481 @option{-mcpu=niagara}, the compiler additionally optimizes it for
21482 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
21483 additionally optimizes it for Sun UltraSPARC T2 chips. With
21484 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
21485 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
21486 additionally optimizes it for Sun UltraSPARC T4 chips.
21487
21488 @item -mtune=@var{cpu_type}
21489 @opindex mtune
21490 Set the instruction scheduling parameters for machine type
21491 @var{cpu_type}, but do not set the instruction set or register set that the
21492 option @option{-mcpu=@var{cpu_type}} does.
21493
21494 The same values for @option{-mcpu=@var{cpu_type}} can be used for
21495 @option{-mtune=@var{cpu_type}}, but the only useful values are those
21496 that select a particular CPU implementation. Those are @samp{cypress},
21497 @samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3},
21498 @samp{leon3v7}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{tsc701},
21499 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
21500 @samp{niagara3} and @samp{niagara4}. With native Solaris and GNU/Linux
21501 toolchains, @samp{native} can also be used.
21502
21503 @item -mv8plus
21504 @itemx -mno-v8plus
21505 @opindex mv8plus
21506 @opindex mno-v8plus
21507 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
21508 difference from the V8 ABI is that the global and out registers are
21509 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
21510 mode for all SPARC-V9 processors.
21511
21512 @item -mvis
21513 @itemx -mno-vis
21514 @opindex mvis
21515 @opindex mno-vis
21516 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
21517 Visual Instruction Set extensions. The default is @option{-mno-vis}.
21518
21519 @item -mvis2
21520 @itemx -mno-vis2
21521 @opindex mvis2
21522 @opindex mno-vis2
21523 With @option{-mvis2}, GCC generates code that takes advantage of
21524 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
21525 default is @option{-mvis2} when targeting a cpu that supports such
21526 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
21527 also sets @option{-mvis}.
21528
21529 @item -mvis3
21530 @itemx -mno-vis3
21531 @opindex mvis3
21532 @opindex mno-vis3
21533 With @option{-mvis3}, GCC generates code that takes advantage of
21534 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
21535 default is @option{-mvis3} when targeting a cpu that supports such
21536 instructions, such as niagara-3 and later. Setting @option{-mvis3}
21537 also sets @option{-mvis2} and @option{-mvis}.
21538
21539 @item -mcbcond
21540 @itemx -mno-cbcond
21541 @opindex mcbcond
21542 @opindex mno-cbcond
21543 With @option{-mcbcond}, GCC generates code that takes advantage of
21544 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
21545 The default is @option{-mcbcond} when targeting a cpu that supports such
21546 instructions, such as niagara-4 and later.
21547
21548 @item -mpopc
21549 @itemx -mno-popc
21550 @opindex mpopc
21551 @opindex mno-popc
21552 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
21553 population count instruction. The default is @option{-mpopc}
21554 when targeting a cpu that supports such instructions, such as Niagara-2 and
21555 later.
21556
21557 @item -mfmaf
21558 @itemx -mno-fmaf
21559 @opindex mfmaf
21560 @opindex mno-fmaf
21561 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
21562 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
21563 when targeting a cpu that supports such instructions, such as Niagara-3 and
21564 later.
21565
21566 @item -mfix-at697f
21567 @opindex mfix-at697f
21568 Enable the documented workaround for the single erratum of the Atmel AT697F
21569 processor (which corresponds to erratum #13 of the AT697E processor).
21570
21571 @item -mfix-ut699
21572 @opindex mfix-ut699
21573 Enable the documented workarounds for the floating-point errata and the data
21574 cache nullify errata of the UT699 processor.
21575 @end table
21576
21577 These @samp{-m} options are supported in addition to the above
21578 on SPARC-V9 processors in 64-bit environments:
21579
21580 @table @gcctabopt
21581 @item -m32
21582 @itemx -m64
21583 @opindex m32
21584 @opindex m64
21585 Generate code for a 32-bit or 64-bit environment.
21586 The 32-bit environment sets int, long and pointer to 32 bits.
21587 The 64-bit environment sets int to 32 bits and long and pointer
21588 to 64 bits.
21589
21590 @item -mcmodel=@var{which}
21591 @opindex mcmodel
21592 Set the code model to one of
21593
21594 @table @samp
21595 @item medlow
21596 The Medium/Low code model: 64-bit addresses, programs
21597 must be linked in the low 32 bits of memory. Programs can be statically
21598 or dynamically linked.
21599
21600 @item medmid
21601 The Medium/Middle code model: 64-bit addresses, programs
21602 must be linked in the low 44 bits of memory, the text and data segments must
21603 be less than 2GB in size and the data segment must be located within 2GB of
21604 the text segment.
21605
21606 @item medany
21607 The Medium/Anywhere code model: 64-bit addresses, programs
21608 may be linked anywhere in memory, the text and data segments must be less
21609 than 2GB in size and the data segment must be located within 2GB of the
21610 text segment.
21611
21612 @item embmedany
21613 The Medium/Anywhere code model for embedded systems:
21614 64-bit addresses, the text and data segments must be less than 2GB in
21615 size, both starting anywhere in memory (determined at link time). The
21616 global register %g4 points to the base of the data segment. Programs
21617 are statically linked and PIC is not supported.
21618 @end table
21619
21620 @item -mmemory-model=@var{mem-model}
21621 @opindex mmemory-model
21622 Set the memory model in force on the processor to one of
21623
21624 @table @samp
21625 @item default
21626 The default memory model for the processor and operating system.
21627
21628 @item rmo
21629 Relaxed Memory Order
21630
21631 @item pso
21632 Partial Store Order
21633
21634 @item tso
21635 Total Store Order
21636
21637 @item sc
21638 Sequential Consistency
21639 @end table
21640
21641 These memory models are formally defined in Appendix D of the Sparc V9
21642 architecture manual, as set in the processor's @code{PSTATE.MM} field.
21643
21644 @item -mstack-bias
21645 @itemx -mno-stack-bias
21646 @opindex mstack-bias
21647 @opindex mno-stack-bias
21648 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
21649 frame pointer if present, are offset by @minus{}2047 which must be added back
21650 when making stack frame references. This is the default in 64-bit mode.
21651 Otherwise, assume no such offset is present.
21652 @end table
21653
21654 @node SPU Options
21655 @subsection SPU Options
21656 @cindex SPU options
21657
21658 These @samp{-m} options are supported on the SPU:
21659
21660 @table @gcctabopt
21661 @item -mwarn-reloc
21662 @itemx -merror-reloc
21663 @opindex mwarn-reloc
21664 @opindex merror-reloc
21665
21666 The loader for SPU does not handle dynamic relocations. By default, GCC
21667 gives an error when it generates code that requires a dynamic
21668 relocation. @option{-mno-error-reloc} disables the error,
21669 @option{-mwarn-reloc} generates a warning instead.
21670
21671 @item -msafe-dma
21672 @itemx -munsafe-dma
21673 @opindex msafe-dma
21674 @opindex munsafe-dma
21675
21676 Instructions that initiate or test completion of DMA must not be
21677 reordered with respect to loads and stores of the memory that is being
21678 accessed.
21679 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
21680 memory accesses, but that can lead to inefficient code in places where the
21681 memory is known to not change. Rather than mark the memory as volatile,
21682 you can use @option{-msafe-dma} to tell the compiler to treat
21683 the DMA instructions as potentially affecting all memory.
21684
21685 @item -mbranch-hints
21686 @opindex mbranch-hints
21687
21688 By default, GCC generates a branch hint instruction to avoid
21689 pipeline stalls for always-taken or probably-taken branches. A hint
21690 is not generated closer than 8 instructions away from its branch.
21691 There is little reason to disable them, except for debugging purposes,
21692 or to make an object a little bit smaller.
21693
21694 @item -msmall-mem
21695 @itemx -mlarge-mem
21696 @opindex msmall-mem
21697 @opindex mlarge-mem
21698
21699 By default, GCC generates code assuming that addresses are never larger
21700 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
21701 a full 32-bit address.
21702
21703 @item -mstdmain
21704 @opindex mstdmain
21705
21706 By default, GCC links against startup code that assumes the SPU-style
21707 main function interface (which has an unconventional parameter list).
21708 With @option{-mstdmain}, GCC links your program against startup
21709 code that assumes a C99-style interface to @code{main}, including a
21710 local copy of @code{argv} strings.
21711
21712 @item -mfixed-range=@var{register-range}
21713 @opindex mfixed-range
21714 Generate code treating the given register range as fixed registers.
21715 A fixed register is one that the register allocator cannot use. This is
21716 useful when compiling kernel code. A register range is specified as
21717 two registers separated by a dash. Multiple register ranges can be
21718 specified separated by a comma.
21719
21720 @item -mea32
21721 @itemx -mea64
21722 @opindex mea32
21723 @opindex mea64
21724 Compile code assuming that pointers to the PPU address space accessed
21725 via the @code{__ea} named address space qualifier are either 32 or 64
21726 bits wide. The default is 32 bits. As this is an ABI-changing option,
21727 all object code in an executable must be compiled with the same setting.
21728
21729 @item -maddress-space-conversion
21730 @itemx -mno-address-space-conversion
21731 @opindex maddress-space-conversion
21732 @opindex mno-address-space-conversion
21733 Allow/disallow treating the @code{__ea} address space as superset
21734 of the generic address space. This enables explicit type casts
21735 between @code{__ea} and generic pointer as well as implicit
21736 conversions of generic pointers to @code{__ea} pointers. The
21737 default is to allow address space pointer conversions.
21738
21739 @item -mcache-size=@var{cache-size}
21740 @opindex mcache-size
21741 This option controls the version of libgcc that the compiler links to an
21742 executable and selects a software-managed cache for accessing variables
21743 in the @code{__ea} address space with a particular cache size. Possible
21744 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
21745 and @samp{128}. The default cache size is 64KB.
21746
21747 @item -matomic-updates
21748 @itemx -mno-atomic-updates
21749 @opindex matomic-updates
21750 @opindex mno-atomic-updates
21751 This option controls the version of libgcc that the compiler links to an
21752 executable and selects whether atomic updates to the software-managed
21753 cache of PPU-side variables are used. If you use atomic updates, changes
21754 to a PPU variable from SPU code using the @code{__ea} named address space
21755 qualifier do not interfere with changes to other PPU variables residing
21756 in the same cache line from PPU code. If you do not use atomic updates,
21757 such interference may occur; however, writing back cache lines is
21758 more efficient. The default behavior is to use atomic updates.
21759
21760 @item -mdual-nops
21761 @itemx -mdual-nops=@var{n}
21762 @opindex mdual-nops
21763 By default, GCC inserts nops to increase dual issue when it expects
21764 it to increase performance. @var{n} can be a value from 0 to 10. A
21765 smaller @var{n} inserts fewer nops. 10 is the default, 0 is the
21766 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
21767
21768 @item -mhint-max-nops=@var{n}
21769 @opindex mhint-max-nops
21770 Maximum number of nops to insert for a branch hint. A branch hint must
21771 be at least 8 instructions away from the branch it is affecting. GCC
21772 inserts up to @var{n} nops to enforce this, otherwise it does not
21773 generate the branch hint.
21774
21775 @item -mhint-max-distance=@var{n}
21776 @opindex mhint-max-distance
21777 The encoding of the branch hint instruction limits the hint to be within
21778 256 instructions of the branch it is affecting. By default, GCC makes
21779 sure it is within 125.
21780
21781 @item -msafe-hints
21782 @opindex msafe-hints
21783 Work around a hardware bug that causes the SPU to stall indefinitely.
21784 By default, GCC inserts the @code{hbrp} instruction to make sure
21785 this stall won't happen.
21786
21787 @end table
21788
21789 @node System V Options
21790 @subsection Options for System V
21791
21792 These additional options are available on System V Release 4 for
21793 compatibility with other compilers on those systems:
21794
21795 @table @gcctabopt
21796 @item -G
21797 @opindex G
21798 Create a shared object.
21799 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
21800
21801 @item -Qy
21802 @opindex Qy
21803 Identify the versions of each tool used by the compiler, in a
21804 @code{.ident} assembler directive in the output.
21805
21806 @item -Qn
21807 @opindex Qn
21808 Refrain from adding @code{.ident} directives to the output file (this is
21809 the default).
21810
21811 @item -YP,@var{dirs}
21812 @opindex YP
21813 Search the directories @var{dirs}, and no others, for libraries
21814 specified with @option{-l}.
21815
21816 @item -Ym,@var{dir}
21817 @opindex Ym
21818 Look in the directory @var{dir} to find the M4 preprocessor.
21819 The assembler uses this option.
21820 @c This is supposed to go with a -Yd for predefined M4 macro files, but
21821 @c the generic assembler that comes with Solaris takes just -Ym.
21822 @end table
21823
21824 @node TILE-Gx Options
21825 @subsection TILE-Gx Options
21826 @cindex TILE-Gx options
21827
21828 These @samp{-m} options are supported on the TILE-Gx:
21829
21830 @table @gcctabopt
21831 @item -mcmodel=small
21832 @opindex mcmodel=small
21833 Generate code for the small model. The distance for direct calls is
21834 limited to 500M in either direction. PC-relative addresses are 32
21835 bits. Absolute addresses support the full address range.
21836
21837 @item -mcmodel=large
21838 @opindex mcmodel=large
21839 Generate code for the large model. There is no limitation on call
21840 distance, pc-relative addresses, or absolute addresses.
21841
21842 @item -mcpu=@var{name}
21843 @opindex mcpu
21844 Selects the type of CPU to be targeted. Currently the only supported
21845 type is @samp{tilegx}.
21846
21847 @item -m32
21848 @itemx -m64
21849 @opindex m32
21850 @opindex m64
21851 Generate code for a 32-bit or 64-bit environment. The 32-bit
21852 environment sets int, long, and pointer to 32 bits. The 64-bit
21853 environment sets int to 32 bits and long and pointer to 64 bits.
21854
21855 @item -mbig-endian
21856 @itemx -mlittle-endian
21857 @opindex mbig-endian
21858 @opindex mlittle-endian
21859 Generate code in big/little endian mode, respectively.
21860 @end table
21861
21862 @node TILEPro Options
21863 @subsection TILEPro Options
21864 @cindex TILEPro options
21865
21866 These @samp{-m} options are supported on the TILEPro:
21867
21868 @table @gcctabopt
21869 @item -mcpu=@var{name}
21870 @opindex mcpu
21871 Selects the type of CPU to be targeted. Currently the only supported
21872 type is @samp{tilepro}.
21873
21874 @item -m32
21875 @opindex m32
21876 Generate code for a 32-bit environment, which sets int, long, and
21877 pointer to 32 bits. This is the only supported behavior so the flag
21878 is essentially ignored.
21879 @end table
21880
21881 @node V850 Options
21882 @subsection V850 Options
21883 @cindex V850 Options
21884
21885 These @samp{-m} options are defined for V850 implementations:
21886
21887 @table @gcctabopt
21888 @item -mlong-calls
21889 @itemx -mno-long-calls
21890 @opindex mlong-calls
21891 @opindex mno-long-calls
21892 Treat all calls as being far away (near). If calls are assumed to be
21893 far away, the compiler always loads the function's address into a
21894 register, and calls indirect through the pointer.
21895
21896 @item -mno-ep
21897 @itemx -mep
21898 @opindex mno-ep
21899 @opindex mep
21900 Do not optimize (do optimize) basic blocks that use the same index
21901 pointer 4 or more times to copy pointer into the @code{ep} register, and
21902 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
21903 option is on by default if you optimize.
21904
21905 @item -mno-prolog-function
21906 @itemx -mprolog-function
21907 @opindex mno-prolog-function
21908 @opindex mprolog-function
21909 Do not use (do use) external functions to save and restore registers
21910 at the prologue and epilogue of a function. The external functions
21911 are slower, but use less code space if more than one function saves
21912 the same number of registers. The @option{-mprolog-function} option
21913 is on by default if you optimize.
21914
21915 @item -mspace
21916 @opindex mspace
21917 Try to make the code as small as possible. At present, this just turns
21918 on the @option{-mep} and @option{-mprolog-function} options.
21919
21920 @item -mtda=@var{n}
21921 @opindex mtda
21922 Put static or global variables whose size is @var{n} bytes or less into
21923 the tiny data area that register @code{ep} points to. The tiny data
21924 area can hold up to 256 bytes in total (128 bytes for byte references).
21925
21926 @item -msda=@var{n}
21927 @opindex msda
21928 Put static or global variables whose size is @var{n} bytes or less into
21929 the small data area that register @code{gp} points to. The small data
21930 area can hold up to 64 kilobytes.
21931
21932 @item -mzda=@var{n}
21933 @opindex mzda
21934 Put static or global variables whose size is @var{n} bytes or less into
21935 the first 32 kilobytes of memory.
21936
21937 @item -mv850
21938 @opindex mv850
21939 Specify that the target processor is the V850.
21940
21941 @item -mv850e3v5
21942 @opindex mv850e3v5
21943 Specify that the target processor is the V850E3V5. The preprocessor
21944 constant @code{__v850e3v5__} is defined if this option is used.
21945
21946 @item -mv850e2v4
21947 @opindex mv850e2v4
21948 Specify that the target processor is the V850E3V5. This is an alias for
21949 the @option{-mv850e3v5} option.
21950
21951 @item -mv850e2v3
21952 @opindex mv850e2v3
21953 Specify that the target processor is the V850E2V3. The preprocessor
21954 constant @code{__v850e2v3__} is defined if this option is used.
21955
21956 @item -mv850e2
21957 @opindex mv850e2
21958 Specify that the target processor is the V850E2. The preprocessor
21959 constant @code{__v850e2__} is defined if this option is used.
21960
21961 @item -mv850e1
21962 @opindex mv850e1
21963 Specify that the target processor is the V850E1. The preprocessor
21964 constants @code{__v850e1__} and @code{__v850e__} are defined if
21965 this option is used.
21966
21967 @item -mv850es
21968 @opindex mv850es
21969 Specify that the target processor is the V850ES. This is an alias for
21970 the @option{-mv850e1} option.
21971
21972 @item -mv850e
21973 @opindex mv850e
21974 Specify that the target processor is the V850E@. The preprocessor
21975 constant @code{__v850e__} is defined if this option is used.
21976
21977 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
21978 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
21979 are defined then a default target processor is chosen and the
21980 relevant @samp{__v850*__} preprocessor constant is defined.
21981
21982 The preprocessor constants @code{__v850} and @code{__v851__} are always
21983 defined, regardless of which processor variant is the target.
21984
21985 @item -mdisable-callt
21986 @itemx -mno-disable-callt
21987 @opindex mdisable-callt
21988 @opindex mno-disable-callt
21989 This option suppresses generation of the @code{CALLT} instruction for the
21990 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
21991 architecture.
21992
21993 This option is enabled by default when the RH850 ABI is
21994 in use (see @option{-mrh850-abi}), and disabled by default when the
21995 GCC ABI is in use. If @code{CALLT} instructions are being generated
21996 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
21997
21998 @item -mrelax
21999 @itemx -mno-relax
22000 @opindex mrelax
22001 @opindex mno-relax
22002 Pass on (or do not pass on) the @option{-mrelax} command-line option
22003 to the assembler.
22004
22005 @item -mlong-jumps
22006 @itemx -mno-long-jumps
22007 @opindex mlong-jumps
22008 @opindex mno-long-jumps
22009 Disable (or re-enable) the generation of PC-relative jump instructions.
22010
22011 @item -msoft-float
22012 @itemx -mhard-float
22013 @opindex msoft-float
22014 @opindex mhard-float
22015 Disable (or re-enable) the generation of hardware floating point
22016 instructions. This option is only significant when the target
22017 architecture is @samp{V850E2V3} or higher. If hardware floating point
22018 instructions are being generated then the C preprocessor symbol
22019 @code{__FPU_OK__} is defined, otherwise the symbol
22020 @code{__NO_FPU__} is defined.
22021
22022 @item -mloop
22023 @opindex mloop
22024 Enables the use of the e3v5 LOOP instruction. The use of this
22025 instruction is not enabled by default when the e3v5 architecture is
22026 selected because its use is still experimental.
22027
22028 @item -mrh850-abi
22029 @itemx -mghs
22030 @opindex mrh850-abi
22031 @opindex mghs
22032 Enables support for the RH850 version of the V850 ABI. This is the
22033 default. With this version of the ABI the following rules apply:
22034
22035 @itemize
22036 @item
22037 Integer sized structures and unions are returned via a memory pointer
22038 rather than a register.
22039
22040 @item
22041 Large structures and unions (more than 8 bytes in size) are passed by
22042 value.
22043
22044 @item
22045 Functions are aligned to 16-bit boundaries.
22046
22047 @item
22048 The @option{-m8byte-align} command-line option is supported.
22049
22050 @item
22051 The @option{-mdisable-callt} command-line option is enabled by
22052 default. The @option{-mno-disable-callt} command-line option is not
22053 supported.
22054 @end itemize
22055
22056 When this version of the ABI is enabled the C preprocessor symbol
22057 @code{__V850_RH850_ABI__} is defined.
22058
22059 @item -mgcc-abi
22060 @opindex mgcc-abi
22061 Enables support for the old GCC version of the V850 ABI. With this
22062 version of the ABI the following rules apply:
22063
22064 @itemize
22065 @item
22066 Integer sized structures and unions are returned in register @code{r10}.
22067
22068 @item
22069 Large structures and unions (more than 8 bytes in size) are passed by
22070 reference.
22071
22072 @item
22073 Functions are aligned to 32-bit boundaries, unless optimizing for
22074 size.
22075
22076 @item
22077 The @option{-m8byte-align} command-line option is not supported.
22078
22079 @item
22080 The @option{-mdisable-callt} command-line option is supported but not
22081 enabled by default.
22082 @end itemize
22083
22084 When this version of the ABI is enabled the C preprocessor symbol
22085 @code{__V850_GCC_ABI__} is defined.
22086
22087 @item -m8byte-align
22088 @itemx -mno-8byte-align
22089 @opindex m8byte-align
22090 @opindex mno-8byte-align
22091 Enables support for @code{double} and @code{long long} types to be
22092 aligned on 8-byte boundaries. The default is to restrict the
22093 alignment of all objects to at most 4-bytes. When
22094 @option{-m8byte-align} is in effect the C preprocessor symbol
22095 @code{__V850_8BYTE_ALIGN__} is defined.
22096
22097 @item -mbig-switch
22098 @opindex mbig-switch
22099 Generate code suitable for big switch tables. Use this option only if
22100 the assembler/linker complain about out of range branches within a switch
22101 table.
22102
22103 @item -mapp-regs
22104 @opindex mapp-regs
22105 This option causes r2 and r5 to be used in the code generated by
22106 the compiler. This setting is the default.
22107
22108 @item -mno-app-regs
22109 @opindex mno-app-regs
22110 This option causes r2 and r5 to be treated as fixed registers.
22111
22112 @end table
22113
22114 @node VAX Options
22115 @subsection VAX Options
22116 @cindex VAX options
22117
22118 These @samp{-m} options are defined for the VAX:
22119
22120 @table @gcctabopt
22121 @item -munix
22122 @opindex munix
22123 Do not output certain jump instructions (@code{aobleq} and so on)
22124 that the Unix assembler for the VAX cannot handle across long
22125 ranges.
22126
22127 @item -mgnu
22128 @opindex mgnu
22129 Do output those jump instructions, on the assumption that the
22130 GNU assembler is being used.
22131
22132 @item -mg
22133 @opindex mg
22134 Output code for G-format floating-point numbers instead of D-format.
22135 @end table
22136
22137 @node Visium Options
22138 @subsection Visium Options
22139 @cindex Visium options
22140
22141 @table @gcctabopt
22142
22143 @item -mdebug
22144 @opindex mdebug
22145 A program which performs file I/O and is destined to run on an MCM target
22146 should be linked with this option. It causes the libraries libc.a and
22147 libdebug.a to be linked. The program should be run on the target under
22148 the control of the GDB remote debugging stub.
22149
22150 @item -msim
22151 @opindex msim
22152 A program which performs file I/O and is destined to run on the simulator
22153 should be linked with option. This causes libraries libc.a and libsim.a to
22154 be linked.
22155
22156 @item -mfpu
22157 @itemx -mhard-float
22158 @opindex mfpu
22159 @opindex mhard-float
22160 Generate code containing floating-point instructions. This is the
22161 default.
22162
22163 @item -mno-fpu
22164 @itemx -msoft-float
22165 @opindex mno-fpu
22166 @opindex msoft-float
22167 Generate code containing library calls for floating-point.
22168
22169 @option{-msoft-float} changes the calling convention in the output file;
22170 therefore, it is only useful if you compile @emph{all} of a program with
22171 this option. In particular, you need to compile @file{libgcc.a}, the
22172 library that comes with GCC, with @option{-msoft-float} in order for
22173 this to work.
22174
22175 @item -mcpu=@var{cpu_type}
22176 @opindex mcpu
22177 Set the instruction set, register set, and instruction scheduling parameters
22178 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22179 @samp{mcm}, @samp{gr5} and @samp{gr6}.
22180
22181 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
22182
22183 By default (unless configured otherwise), GCC generates code for the GR5
22184 variant of the Visium architecture.
22185
22186 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
22187 architecture. The only difference from GR5 code is that the compiler will
22188 generate block move instructions.
22189
22190 @item -mtune=@var{cpu_type}
22191 @opindex mtune
22192 Set the instruction scheduling parameters for machine type @var{cpu_type},
22193 but do not set the instruction set or register set that the option
22194 @option{-mcpu=@var{cpu_type}} would.
22195
22196 @item -msv-mode
22197 @opindex msv-mode
22198 Generate code for the supervisor mode, where there are no restrictions on
22199 the access to general registers. This is the default.
22200
22201 @item -muser-mode
22202 @opindex muser-mode
22203 Generate code for the user mode, where the access to some general registers
22204 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
22205 mode; on the GR6, only registers r29 to r31 are affected.
22206 @end table
22207
22208 @node VMS Options
22209 @subsection VMS Options
22210
22211 These @samp{-m} options are defined for the VMS implementations:
22212
22213 @table @gcctabopt
22214 @item -mvms-return-codes
22215 @opindex mvms-return-codes
22216 Return VMS condition codes from @code{main}. The default is to return POSIX-style
22217 condition (e.g.@ error) codes.
22218
22219 @item -mdebug-main=@var{prefix}
22220 @opindex mdebug-main=@var{prefix}
22221 Flag the first routine whose name starts with @var{prefix} as the main
22222 routine for the debugger.
22223
22224 @item -mmalloc64
22225 @opindex mmalloc64
22226 Default to 64-bit memory allocation routines.
22227
22228 @item -mpointer-size=@var{size}
22229 @opindex mpointer-size=@var{size}
22230 Set the default size of pointers. Possible options for @var{size} are
22231 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
22232 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
22233 The later option disables @code{pragma pointer_size}.
22234 @end table
22235
22236 @node VxWorks Options
22237 @subsection VxWorks Options
22238 @cindex VxWorks Options
22239
22240 The options in this section are defined for all VxWorks targets.
22241 Options specific to the target hardware are listed with the other
22242 options for that target.
22243
22244 @table @gcctabopt
22245 @item -mrtp
22246 @opindex mrtp
22247 GCC can generate code for both VxWorks kernels and real time processes
22248 (RTPs). This option switches from the former to the latter. It also
22249 defines the preprocessor macro @code{__RTP__}.
22250
22251 @item -non-static
22252 @opindex non-static
22253 Link an RTP executable against shared libraries rather than static
22254 libraries. The options @option{-static} and @option{-shared} can
22255 also be used for RTPs (@pxref{Link Options}); @option{-static}
22256 is the default.
22257
22258 @item -Bstatic
22259 @itemx -Bdynamic
22260 @opindex Bstatic
22261 @opindex Bdynamic
22262 These options are passed down to the linker. They are defined for
22263 compatibility with Diab.
22264
22265 @item -Xbind-lazy
22266 @opindex Xbind-lazy
22267 Enable lazy binding of function calls. This option is equivalent to
22268 @option{-Wl,-z,now} and is defined for compatibility with Diab.
22269
22270 @item -Xbind-now
22271 @opindex Xbind-now
22272 Disable lazy binding of function calls. This option is the default and
22273 is defined for compatibility with Diab.
22274 @end table
22275
22276 @node x86 Options
22277 @subsection x86 Options
22278 @cindex x86 Options
22279
22280 These @samp{-m} options are defined for the x86 family of computers.
22281
22282 @table @gcctabopt
22283
22284 @item -march=@var{cpu-type}
22285 @opindex march
22286 Generate instructions for the machine type @var{cpu-type}. In contrast to
22287 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
22288 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
22289 to generate code that may not run at all on processors other than the one
22290 indicated. Specifying @option{-march=@var{cpu-type}} implies
22291 @option{-mtune=@var{cpu-type}}.
22292
22293 The choices for @var{cpu-type} are:
22294
22295 @table @samp
22296 @item native
22297 This selects the CPU to generate code for at compilation time by determining
22298 the processor type of the compiling machine. Using @option{-march=native}
22299 enables all instruction subsets supported by the local machine (hence
22300 the result might not run on different machines). Using @option{-mtune=native}
22301 produces code optimized for the local machine under the constraints
22302 of the selected instruction set.
22303
22304 @item i386
22305 Original Intel i386 CPU@.
22306
22307 @item i486
22308 Intel i486 CPU@. (No scheduling is implemented for this chip.)
22309
22310 @item i586
22311 @itemx pentium
22312 Intel Pentium CPU with no MMX support.
22313
22314 @item lakemont
22315 Intel Lakemont MCU, based on Intel Pentium CPU.
22316
22317 @item pentium-mmx
22318 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
22319
22320 @item pentiumpro
22321 Intel Pentium Pro CPU@.
22322
22323 @item i686
22324 When used with @option{-march}, the Pentium Pro
22325 instruction set is used, so the code runs on all i686 family chips.
22326 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
22327
22328 @item pentium2
22329 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
22330 support.
22331
22332 @item pentium3
22333 @itemx pentium3m
22334 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
22335 set support.
22336
22337 @item pentium-m
22338 Intel Pentium M; low-power version of Intel Pentium III CPU
22339 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
22340
22341 @item pentium4
22342 @itemx pentium4m
22343 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
22344
22345 @item prescott
22346 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
22347 set support.
22348
22349 @item nocona
22350 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
22351 SSE2 and SSE3 instruction set support.
22352
22353 @item core2
22354 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
22355 instruction set support.
22356
22357 @item nehalem
22358 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
22359 SSE4.1, SSE4.2 and POPCNT instruction set support.
22360
22361 @item westmere
22362 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
22363 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
22364
22365 @item sandybridge
22366 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
22367 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
22368
22369 @item ivybridge
22370 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
22371 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
22372 instruction set support.
22373
22374 @item haswell
22375 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
22376 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
22377 BMI, BMI2 and F16C instruction set support.
22378
22379 @item broadwell
22380 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
22381 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
22382 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
22383
22384 @item skylake
22385 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
22386 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
22387 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
22388 XSAVES instruction set support.
22389
22390 @item bonnell
22391 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
22392 instruction set support.
22393
22394 @item silvermont
22395 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
22396 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
22397
22398 @item knl
22399 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
22400 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
22401 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
22402 AVX512CD instruction set support.
22403
22404 @item skylake-avx512
22405 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
22406 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
22407 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
22408 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
22409
22410 @item k6
22411 AMD K6 CPU with MMX instruction set support.
22412
22413 @item k6-2
22414 @itemx k6-3
22415 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
22416
22417 @item athlon
22418 @itemx athlon-tbird
22419 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
22420 support.
22421
22422 @item athlon-4
22423 @itemx athlon-xp
22424 @itemx athlon-mp
22425 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
22426 instruction set support.
22427
22428 @item k8
22429 @itemx opteron
22430 @itemx athlon64
22431 @itemx athlon-fx
22432 Processors based on the AMD K8 core with x86-64 instruction set support,
22433 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
22434 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
22435 instruction set extensions.)
22436
22437 @item k8-sse3
22438 @itemx opteron-sse3
22439 @itemx athlon64-sse3
22440 Improved versions of AMD K8 cores with SSE3 instruction set support.
22441
22442 @item amdfam10
22443 @itemx barcelona
22444 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
22445 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
22446 instruction set extensions.)
22447
22448 @item bdver1
22449 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
22450 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
22451 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
22452 @item bdver2
22453 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
22454 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
22455 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
22456 extensions.)
22457 @item bdver3
22458 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
22459 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
22460 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
22461 64-bit instruction set extensions.
22462 @item bdver4
22463 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
22464 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
22465 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
22466 SSE4.2, ABM and 64-bit instruction set extensions.
22467
22468 @item znver1
22469 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
22470 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
22471 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
22472 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
22473 instruction set extensions.
22474
22475 @item btver1
22476 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
22477 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
22478 instruction set extensions.)
22479
22480 @item btver2
22481 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
22482 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
22483 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
22484
22485 @item winchip-c6
22486 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
22487 set support.
22488
22489 @item winchip2
22490 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
22491 instruction set support.
22492
22493 @item c3
22494 VIA C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is
22495 implemented for this chip.)
22496
22497 @item c3-2
22498 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
22499 (No scheduling is
22500 implemented for this chip.)
22501
22502 @item geode
22503 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
22504 @end table
22505
22506 @item -mtune=@var{cpu-type}
22507 @opindex mtune
22508 Tune to @var{cpu-type} everything applicable about the generated code, except
22509 for the ABI and the set of available instructions.
22510 While picking a specific @var{cpu-type} schedules things appropriately
22511 for that particular chip, the compiler does not generate any code that
22512 cannot run on the default machine type unless you use a
22513 @option{-march=@var{cpu-type}} option.
22514 For example, if GCC is configured for i686-pc-linux-gnu
22515 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
22516 but still runs on i686 machines.
22517
22518 The choices for @var{cpu-type} are the same as for @option{-march}.
22519 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
22520
22521 @table @samp
22522 @item generic
22523 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
22524 If you know the CPU on which your code will run, then you should use
22525 the corresponding @option{-mtune} or @option{-march} option instead of
22526 @option{-mtune=generic}. But, if you do not know exactly what CPU users
22527 of your application will have, then you should use this option.
22528
22529 As new processors are deployed in the marketplace, the behavior of this
22530 option will change. Therefore, if you upgrade to a newer version of
22531 GCC, code generation controlled by this option will change to reflect
22532 the processors
22533 that are most common at the time that version of GCC is released.
22534
22535 There is no @option{-march=generic} option because @option{-march}
22536 indicates the instruction set the compiler can use, and there is no
22537 generic instruction set applicable to all processors. In contrast,
22538 @option{-mtune} indicates the processor (or, in this case, collection of
22539 processors) for which the code is optimized.
22540
22541 @item intel
22542 Produce code optimized for the most current Intel processors, which are
22543 Haswell and Silvermont for this version of GCC. If you know the CPU
22544 on which your code will run, then you should use the corresponding
22545 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
22546 But, if you want your application performs better on both Haswell and
22547 Silvermont, then you should use this option.
22548
22549 As new Intel processors are deployed in the marketplace, the behavior of
22550 this option will change. Therefore, if you upgrade to a newer version of
22551 GCC, code generation controlled by this option will change to reflect
22552 the most current Intel processors at the time that version of GCC is
22553 released.
22554
22555 There is no @option{-march=intel} option because @option{-march} indicates
22556 the instruction set the compiler can use, and there is no common
22557 instruction set applicable to all processors. In contrast,
22558 @option{-mtune} indicates the processor (or, in this case, collection of
22559 processors) for which the code is optimized.
22560 @end table
22561
22562 @item -mcpu=@var{cpu-type}
22563 @opindex mcpu
22564 A deprecated synonym for @option{-mtune}.
22565
22566 @item -mfpmath=@var{unit}
22567 @opindex mfpmath
22568 Generate floating-point arithmetic for selected unit @var{unit}. The choices
22569 for @var{unit} are:
22570
22571 @table @samp
22572 @item 387
22573 Use the standard 387 floating-point coprocessor present on the majority of chips and
22574 emulated otherwise. Code compiled with this option runs almost everywhere.
22575 The temporary results are computed in 80-bit precision instead of the precision
22576 specified by the type, resulting in slightly different results compared to most
22577 of other chips. See @option{-ffloat-store} for more detailed description.
22578
22579 This is the default choice for x86-32 targets.
22580
22581 @item sse
22582 Use scalar floating-point instructions present in the SSE instruction set.
22583 This instruction set is supported by Pentium III and newer chips,
22584 and in the AMD line
22585 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
22586 instruction set supports only single-precision arithmetic, thus the double and
22587 extended-precision arithmetic are still done using 387. A later version, present
22588 only in Pentium 4 and AMD x86-64 chips, supports double-precision
22589 arithmetic too.
22590
22591 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
22592 or @option{-msse2} switches to enable SSE extensions and make this option
22593 effective. For the x86-64 compiler, these extensions are enabled by default.
22594
22595 The resulting code should be considerably faster in the majority of cases and avoid
22596 the numerical instability problems of 387 code, but may break some existing
22597 code that expects temporaries to be 80 bits.
22598
22599 This is the default choice for the x86-64 compiler.
22600
22601 @item sse,387
22602 @itemx sse+387
22603 @itemx both
22604 Attempt to utilize both instruction sets at once. This effectively doubles the
22605 amount of available registers, and on chips with separate execution units for
22606 387 and SSE the execution resources too. Use this option with care, as it is
22607 still experimental, because the GCC register allocator does not model separate
22608 functional units well, resulting in unstable performance.
22609 @end table
22610
22611 @item -masm=@var{dialect}
22612 @opindex masm=@var{dialect}
22613 Output assembly instructions using selected @var{dialect}. Also affects
22614 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
22615 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
22616 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
22617 not support @samp{intel}.
22618
22619 @item -mieee-fp
22620 @itemx -mno-ieee-fp
22621 @opindex mieee-fp
22622 @opindex mno-ieee-fp
22623 Control whether or not the compiler uses IEEE floating-point
22624 comparisons. These correctly handle the case where the result of a
22625 comparison is unordered.
22626
22627 @item -msoft-float
22628 @opindex msoft-float
22629 Generate output containing library calls for floating point.
22630
22631 @strong{Warning:} the requisite libraries are not part of GCC@.
22632 Normally the facilities of the machine's usual C compiler are used, but
22633 this can't be done directly in cross-compilation. You must make your
22634 own arrangements to provide suitable library functions for
22635 cross-compilation.
22636
22637 On machines where a function returns floating-point results in the 80387
22638 register stack, some floating-point opcodes may be emitted even if
22639 @option{-msoft-float} is used.
22640
22641 @item -mno-fp-ret-in-387
22642 @opindex mno-fp-ret-in-387
22643 Do not use the FPU registers for return values of functions.
22644
22645 The usual calling convention has functions return values of types
22646 @code{float} and @code{double} in an FPU register, even if there
22647 is no FPU@. The idea is that the operating system should emulate
22648 an FPU@.
22649
22650 The option @option{-mno-fp-ret-in-387} causes such values to be returned
22651 in ordinary CPU registers instead.
22652
22653 @item -mno-fancy-math-387
22654 @opindex mno-fancy-math-387
22655 Some 387 emulators do not support the @code{sin}, @code{cos} and
22656 @code{sqrt} instructions for the 387. Specify this option to avoid
22657 generating those instructions. This option is the default on
22658 OpenBSD and NetBSD@. This option is overridden when @option{-march}
22659 indicates that the target CPU always has an FPU and so the
22660 instruction does not need emulation. These
22661 instructions are not generated unless you also use the
22662 @option{-funsafe-math-optimizations} switch.
22663
22664 @item -malign-double
22665 @itemx -mno-align-double
22666 @opindex malign-double
22667 @opindex mno-align-double
22668 Control whether GCC aligns @code{double}, @code{long double}, and
22669 @code{long long} variables on a two-word boundary or a one-word
22670 boundary. Aligning @code{double} variables on a two-word boundary
22671 produces code that runs somewhat faster on a Pentium at the
22672 expense of more memory.
22673
22674 On x86-64, @option{-malign-double} is enabled by default.
22675
22676 @strong{Warning:} if you use the @option{-malign-double} switch,
22677 structures containing the above types are aligned differently than
22678 the published application binary interface specifications for the x86-32
22679 and are not binary compatible with structures in code compiled
22680 without that switch.
22681
22682 @item -m96bit-long-double
22683 @itemx -m128bit-long-double
22684 @opindex m96bit-long-double
22685 @opindex m128bit-long-double
22686 These switches control the size of @code{long double} type. The x86-32
22687 application binary interface specifies the size to be 96 bits,
22688 so @option{-m96bit-long-double} is the default in 32-bit mode.
22689
22690 Modern architectures (Pentium and newer) prefer @code{long double}
22691 to be aligned to an 8- or 16-byte boundary. In arrays or structures
22692 conforming to the ABI, this is not possible. So specifying
22693 @option{-m128bit-long-double} aligns @code{long double}
22694 to a 16-byte boundary by padding the @code{long double} with an additional
22695 32-bit zero.
22696
22697 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
22698 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
22699
22700 Notice that neither of these options enable any extra precision over the x87
22701 standard of 80 bits for a @code{long double}.
22702
22703 @strong{Warning:} if you override the default value for your target ABI, this
22704 changes the size of
22705 structures and arrays containing @code{long double} variables,
22706 as well as modifying the function calling convention for functions taking
22707 @code{long double}. Hence they are not binary-compatible
22708 with code compiled without that switch.
22709
22710 @item -mlong-double-64
22711 @itemx -mlong-double-80
22712 @itemx -mlong-double-128
22713 @opindex mlong-double-64
22714 @opindex mlong-double-80
22715 @opindex mlong-double-128
22716 These switches control the size of @code{long double} type. A size
22717 of 64 bits makes the @code{long double} type equivalent to the @code{double}
22718 type. This is the default for 32-bit Bionic C library. A size
22719 of 128 bits makes the @code{long double} type equivalent to the
22720 @code{__float128} type. This is the default for 64-bit Bionic C library.
22721
22722 @strong{Warning:} if you override the default value for your target ABI, this
22723 changes the size of
22724 structures and arrays containing @code{long double} variables,
22725 as well as modifying the function calling convention for functions taking
22726 @code{long double}. Hence they are not binary-compatible
22727 with code compiled without that switch.
22728
22729 @item -malign-data=@var{type}
22730 @opindex malign-data
22731 Control how GCC aligns variables. Supported values for @var{type} are
22732 @samp{compat} uses increased alignment value compatible uses GCC 4.8
22733 and earlier, @samp{abi} uses alignment value as specified by the
22734 psABI, and @samp{cacheline} uses increased alignment value to match
22735 the cache line size. @samp{compat} is the default.
22736
22737 @item -mlarge-data-threshold=@var{threshold}
22738 @opindex mlarge-data-threshold
22739 When @option{-mcmodel=medium} is specified, data objects larger than
22740 @var{threshold} are placed in the large data section. This value must be the
22741 same across all objects linked into the binary, and defaults to 65535.
22742
22743 @item -mrtd
22744 @opindex mrtd
22745 Use a different function-calling convention, in which functions that
22746 take a fixed number of arguments return with the @code{ret @var{num}}
22747 instruction, which pops their arguments while returning. This saves one
22748 instruction in the caller since there is no need to pop the arguments
22749 there.
22750
22751 You can specify that an individual function is called with this calling
22752 sequence with the function attribute @code{stdcall}. You can also
22753 override the @option{-mrtd} option by using the function attribute
22754 @code{cdecl}. @xref{Function Attributes}.
22755
22756 @strong{Warning:} this calling convention is incompatible with the one
22757 normally used on Unix, so you cannot use it if you need to call
22758 libraries compiled with the Unix compiler.
22759
22760 Also, you must provide function prototypes for all functions that
22761 take variable numbers of arguments (including @code{printf});
22762 otherwise incorrect code is generated for calls to those
22763 functions.
22764
22765 In addition, seriously incorrect code results if you call a
22766 function with too many arguments. (Normally, extra arguments are
22767 harmlessly ignored.)
22768
22769 @item -mregparm=@var{num}
22770 @opindex mregparm
22771 Control how many registers are used to pass integer arguments. By
22772 default, no registers are used to pass arguments, and at most 3
22773 registers can be used. You can control this behavior for a specific
22774 function by using the function attribute @code{regparm}.
22775 @xref{Function Attributes}.
22776
22777 @strong{Warning:} if you use this switch, and
22778 @var{num} is nonzero, then you must build all modules with the same
22779 value, including any libraries. This includes the system libraries and
22780 startup modules.
22781
22782 @item -msseregparm
22783 @opindex msseregparm
22784 Use SSE register passing conventions for float and double arguments
22785 and return values. You can control this behavior for a specific
22786 function by using the function attribute @code{sseregparm}.
22787 @xref{Function Attributes}.
22788
22789 @strong{Warning:} if you use this switch then you must build all
22790 modules with the same value, including any libraries. This includes
22791 the system libraries and startup modules.
22792
22793 @item -mvect8-ret-in-mem
22794 @opindex mvect8-ret-in-mem
22795 Return 8-byte vectors in memory instead of MMX registers. This is the
22796 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
22797 Studio compilers until version 12. Later compiler versions (starting
22798 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
22799 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
22800 you need to remain compatible with existing code produced by those
22801 previous compiler versions or older versions of GCC@.
22802
22803 @item -mpc32
22804 @itemx -mpc64
22805 @itemx -mpc80
22806 @opindex mpc32
22807 @opindex mpc64
22808 @opindex mpc80
22809
22810 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
22811 is specified, the significands of results of floating-point operations are
22812 rounded to 24 bits (single precision); @option{-mpc64} rounds the
22813 significands of results of floating-point operations to 53 bits (double
22814 precision) and @option{-mpc80} rounds the significands of results of
22815 floating-point operations to 64 bits (extended double precision), which is
22816 the default. When this option is used, floating-point operations in higher
22817 precisions are not available to the programmer without setting the FPU
22818 control word explicitly.
22819
22820 Setting the rounding of floating-point operations to less than the default
22821 80 bits can speed some programs by 2% or more. Note that some mathematical
22822 libraries assume that extended-precision (80-bit) floating-point operations
22823 are enabled by default; routines in such libraries could suffer significant
22824 loss of accuracy, typically through so-called ``catastrophic cancellation'',
22825 when this option is used to set the precision to less than extended precision.
22826
22827 @item -mstackrealign
22828 @opindex mstackrealign
22829 Realign the stack at entry. On the x86, the @option{-mstackrealign}
22830 option generates an alternate prologue and epilogue that realigns the
22831 run-time stack if necessary. This supports mixing legacy codes that keep
22832 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
22833 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
22834 applicable to individual functions.
22835
22836 @item -mpreferred-stack-boundary=@var{num}
22837 @opindex mpreferred-stack-boundary
22838 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
22839 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
22840 the default is 4 (16 bytes or 128 bits).
22841
22842 @strong{Warning:} When generating code for the x86-64 architecture with
22843 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
22844 used to keep the stack boundary aligned to 8 byte boundary. Since
22845 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
22846 intended to be used in controlled environment where stack space is
22847 important limitation. This option leads to wrong code when functions
22848 compiled with 16 byte stack alignment (such as functions from a standard
22849 library) are called with misaligned stack. In this case, SSE
22850 instructions may lead to misaligned memory access traps. In addition,
22851 variable arguments are handled incorrectly for 16 byte aligned
22852 objects (including x87 long double and __int128), leading to wrong
22853 results. You must build all modules with
22854 @option{-mpreferred-stack-boundary=3}, including any libraries. This
22855 includes the system libraries and startup modules.
22856
22857 @item -mincoming-stack-boundary=@var{num}
22858 @opindex mincoming-stack-boundary
22859 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
22860 boundary. If @option{-mincoming-stack-boundary} is not specified,
22861 the one specified by @option{-mpreferred-stack-boundary} is used.
22862
22863 On Pentium and Pentium Pro, @code{double} and @code{long double} values
22864 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
22865 suffer significant run time performance penalties. On Pentium III, the
22866 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
22867 properly if it is not 16-byte aligned.
22868
22869 To ensure proper alignment of this values on the stack, the stack boundary
22870 must be as aligned as that required by any value stored on the stack.
22871 Further, every function must be generated such that it keeps the stack
22872 aligned. Thus calling a function compiled with a higher preferred
22873 stack boundary from a function compiled with a lower preferred stack
22874 boundary most likely misaligns the stack. It is recommended that
22875 libraries that use callbacks always use the default setting.
22876
22877 This extra alignment does consume extra stack space, and generally
22878 increases code size. Code that is sensitive to stack space usage, such
22879 as embedded systems and operating system kernels, may want to reduce the
22880 preferred alignment to @option{-mpreferred-stack-boundary=2}.
22881
22882 @need 200
22883 @item -mmmx
22884 @opindex mmmx
22885 @need 200
22886 @itemx -msse
22887 @opindex msse
22888 @need 200
22889 @itemx -msse2
22890 @opindex msse2
22891 @need 200
22892 @itemx -msse3
22893 @opindex msse3
22894 @need 200
22895 @itemx -mssse3
22896 @opindex mssse3
22897 @need 200
22898 @itemx -msse4
22899 @opindex msse4
22900 @need 200
22901 @itemx -msse4a
22902 @opindex msse4a
22903 @need 200
22904 @itemx -msse4.1
22905 @opindex msse4.1
22906 @need 200
22907 @itemx -msse4.2
22908 @opindex msse4.2
22909 @need 200
22910 @itemx -mavx
22911 @opindex mavx
22912 @need 200
22913 @itemx -mavx2
22914 @opindex mavx2
22915 @need 200
22916 @itemx -mavx512f
22917 @opindex mavx512f
22918 @need 200
22919 @itemx -mavx512pf
22920 @opindex mavx512pf
22921 @need 200
22922 @itemx -mavx512er
22923 @opindex mavx512er
22924 @need 200
22925 @itemx -mavx512cd
22926 @opindex mavx512cd
22927 @need 200
22928 @itemx -mavx512vl
22929 @opindex mavx512vl
22930 @need 200
22931 @itemx -mavx512bw
22932 @opindex mavx512bw
22933 @need 200
22934 @itemx -mavx512dq
22935 @opindex mavx512dq
22936 @need 200
22937 @itemx -mavx512ifma
22938 @opindex mavx512ifma
22939 @need 200
22940 @itemx -mavx512vbmi
22941 @opindex mavx512vbmi
22942 @need 200
22943 @itemx -msha
22944 @opindex msha
22945 @need 200
22946 @itemx -maes
22947 @opindex maes
22948 @need 200
22949 @itemx -mpclmul
22950 @opindex mpclmul
22951 @need 200
22952 @itemx -mclfushopt
22953 @opindex mclfushopt
22954 @need 200
22955 @itemx -mfsgsbase
22956 @opindex mfsgsbase
22957 @need 200
22958 @itemx -mrdrnd
22959 @opindex mrdrnd
22960 @need 200
22961 @itemx -mf16c
22962 @opindex mf16c
22963 @need 200
22964 @itemx -mfma
22965 @opindex mfma
22966 @need 200
22967 @itemx -mfma4
22968 @opindex mfma4
22969 @need 200
22970 @itemx -mno-fma4
22971 @opindex mno-fma4
22972 @need 200
22973 @itemx -mprefetchwt1
22974 @opindex mprefetchwt1
22975 @need 200
22976 @itemx -mxop
22977 @opindex mxop
22978 @need 200
22979 @itemx -mlwp
22980 @opindex mlwp
22981 @need 200
22982 @itemx -m3dnow
22983 @opindex m3dnow
22984 @need 200
22985 @itemx -mpopcnt
22986 @opindex mpopcnt
22987 @need 200
22988 @itemx -mabm
22989 @opindex mabm
22990 @need 200
22991 @itemx -mbmi
22992 @opindex mbmi
22993 @need 200
22994 @itemx -mbmi2
22995 @need 200
22996 @itemx -mlzcnt
22997 @opindex mlzcnt
22998 @need 200
22999 @itemx -mfxsr
23000 @opindex mfxsr
23001 @need 200
23002 @itemx -mxsave
23003 @opindex mxsave
23004 @need 200
23005 @itemx -mxsaveopt
23006 @opindex mxsaveopt
23007 @need 200
23008 @itemx -mxsavec
23009 @opindex mxsavec
23010 @need 200
23011 @itemx -mxsaves
23012 @opindex mxsaves
23013 @need 200
23014 @itemx -mrtm
23015 @opindex mrtm
23016 @need 200
23017 @itemx -mtbm
23018 @opindex mtbm
23019 @need 200
23020 @itemx -mmpx
23021 @opindex mmpx
23022 @need 200
23023 @itemx -mmwaitx
23024 @opindex mmwaitx
23025 These switches enable the use of instructions in the MMX, SSE,
23026 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
23027 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
23028 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
23029 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX or 3DNow!@:
23030 extended instruction sets. Each has a corresponding @option{-mno-} option
23031 to disable use of these instructions.
23032
23033 These extensions are also available as built-in functions: see
23034 @ref{x86 Built-in Functions}, for details of the functions enabled and
23035 disabled by these switches.
23036
23037 To generate SSE/SSE2 instructions automatically from floating-point
23038 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
23039
23040 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
23041 generates new AVX instructions or AVX equivalence for all SSEx instructions
23042 when needed.
23043
23044 These options enable GCC to use these extended instructions in
23045 generated code, even without @option{-mfpmath=sse}. Applications that
23046 perform run-time CPU detection must compile separate files for each
23047 supported architecture, using the appropriate flags. In particular,
23048 the file containing the CPU detection code should be compiled without
23049 these options.
23050
23051 @item -mdump-tune-features
23052 @opindex mdump-tune-features
23053 This option instructs GCC to dump the names of the x86 performance
23054 tuning features and default settings. The names can be used in
23055 @option{-mtune-ctrl=@var{feature-list}}.
23056
23057 @item -mtune-ctrl=@var{feature-list}
23058 @opindex mtune-ctrl=@var{feature-list}
23059 This option is used to do fine grain control of x86 code generation features.
23060 @var{feature-list} is a comma separated list of @var{feature} names. See also
23061 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
23062 on if it is not preceded with @samp{^}, otherwise, it is turned off.
23063 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
23064 developers. Using it may lead to code paths not covered by testing and can
23065 potentially result in compiler ICEs or runtime errors.
23066
23067 @item -mno-default
23068 @opindex mno-default
23069 This option instructs GCC to turn off all tunable features. See also
23070 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
23071
23072 @item -mcld
23073 @opindex mcld
23074 This option instructs GCC to emit a @code{cld} instruction in the prologue
23075 of functions that use string instructions. String instructions depend on
23076 the DF flag to select between autoincrement or autodecrement mode. While the
23077 ABI specifies the DF flag to be cleared on function entry, some operating
23078 systems violate this specification by not clearing the DF flag in their
23079 exception dispatchers. The exception handler can be invoked with the DF flag
23080 set, which leads to wrong direction mode when string instructions are used.
23081 This option can be enabled by default on 32-bit x86 targets by configuring
23082 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
23083 instructions can be suppressed with the @option{-mno-cld} compiler option
23084 in this case.
23085
23086 @item -mvzeroupper
23087 @opindex mvzeroupper
23088 This option instructs GCC to emit a @code{vzeroupper} instruction
23089 before a transfer of control flow out of the function to minimize
23090 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
23091 intrinsics.
23092
23093 @item -mprefer-avx128
23094 @opindex mprefer-avx128
23095 This option instructs GCC to use 128-bit AVX instructions instead of
23096 256-bit AVX instructions in the auto-vectorizer.
23097
23098 @item -mcx16
23099 @opindex mcx16
23100 This option enables GCC to generate @code{CMPXCHG16B} instructions.
23101 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
23102 (or oword) data types.
23103 This is useful for high-resolution counters that can be updated
23104 by multiple processors (or cores). This instruction is generated as part of
23105 atomic built-in functions: see @ref{__sync Builtins} or
23106 @ref{__atomic Builtins} for details.
23107
23108 @item -msahf
23109 @opindex msahf
23110 This option enables generation of @code{SAHF} instructions in 64-bit code.
23111 Early Intel Pentium 4 CPUs with Intel 64 support,
23112 prior to the introduction of Pentium 4 G1 step in December 2005,
23113 lacked the @code{LAHF} and @code{SAHF} instructions
23114 which are supported by AMD64.
23115 These are load and store instructions, respectively, for certain status flags.
23116 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
23117 @code{drem}, and @code{remainder} built-in functions;
23118 see @ref{Other Builtins} for details.
23119
23120 @item -mmovbe
23121 @opindex mmovbe
23122 This option enables use of the @code{movbe} instruction to implement
23123 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
23124
23125 @item -mcrc32
23126 @opindex mcrc32
23127 This option enables built-in functions @code{__builtin_ia32_crc32qi},
23128 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
23129 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
23130
23131 @item -mrecip
23132 @opindex mrecip
23133 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
23134 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
23135 with an additional Newton-Raphson step
23136 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
23137 (and their vectorized
23138 variants) for single-precision floating-point arguments. These instructions
23139 are generated only when @option{-funsafe-math-optimizations} is enabled
23140 together with @option{-finite-math-only} and @option{-fno-trapping-math}.
23141 Note that while the throughput of the sequence is higher than the throughput
23142 of the non-reciprocal instruction, the precision of the sequence can be
23143 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
23144
23145 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
23146 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
23147 combination), and doesn't need @option{-mrecip}.
23148
23149 Also note that GCC emits the above sequence with additional Newton-Raphson step
23150 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
23151 already with @option{-ffast-math} (or the above option combination), and
23152 doesn't need @option{-mrecip}.
23153
23154 @item -mrecip=@var{opt}
23155 @opindex mrecip=opt
23156 This option controls which reciprocal estimate instructions
23157 may be used. @var{opt} is a comma-separated list of options, which may
23158 be preceded by a @samp{!} to invert the option:
23159
23160 @table @samp
23161 @item all
23162 Enable all estimate instructions.
23163
23164 @item default
23165 Enable the default instructions, equivalent to @option{-mrecip}.
23166
23167 @item none
23168 Disable all estimate instructions, equivalent to @option{-mno-recip}.
23169
23170 @item div
23171 Enable the approximation for scalar division.
23172
23173 @item vec-div
23174 Enable the approximation for vectorized division.
23175
23176 @item sqrt
23177 Enable the approximation for scalar square root.
23178
23179 @item vec-sqrt
23180 Enable the approximation for vectorized square root.
23181 @end table
23182
23183 So, for example, @option{-mrecip=all,!sqrt} enables
23184 all of the reciprocal approximations, except for square root.
23185
23186 @item -mveclibabi=@var{type}
23187 @opindex mveclibabi
23188 Specifies the ABI type to use for vectorizing intrinsics using an
23189 external library. Supported values for @var{type} are @samp{svml}
23190 for the Intel short
23191 vector math library and @samp{acml} for the AMD math core library.
23192 To use this option, both @option{-ftree-vectorize} and
23193 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
23194 ABI-compatible library must be specified at link time.
23195
23196 GCC currently emits calls to @code{vmldExp2},
23197 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
23198 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
23199 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
23200 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
23201 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
23202 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
23203 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
23204 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
23205 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
23206 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
23207 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
23208 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
23209 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
23210 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
23211 when @option{-mveclibabi=acml} is used.
23212
23213 @item -mabi=@var{name}
23214 @opindex mabi
23215 Generate code for the specified calling convention. Permissible values
23216 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
23217 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
23218 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
23219 You can control this behavior for specific functions by
23220 using the function attributes @code{ms_abi} and @code{sysv_abi}.
23221 @xref{Function Attributes}.
23222
23223 @item -mtls-dialect=@var{type}
23224 @opindex mtls-dialect
23225 Generate code to access thread-local storage using the @samp{gnu} or
23226 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
23227 @samp{gnu2} is more efficient, but it may add compile- and run-time
23228 requirements that cannot be satisfied on all systems.
23229
23230 @item -mpush-args
23231 @itemx -mno-push-args
23232 @opindex mpush-args
23233 @opindex mno-push-args
23234 Use PUSH operations to store outgoing parameters. This method is shorter
23235 and usually equally fast as method using SUB/MOV operations and is enabled
23236 by default. In some cases disabling it may improve performance because of
23237 improved scheduling and reduced dependencies.
23238
23239 @item -maccumulate-outgoing-args
23240 @opindex maccumulate-outgoing-args
23241 If enabled, the maximum amount of space required for outgoing arguments is
23242 computed in the function prologue. This is faster on most modern CPUs
23243 because of reduced dependencies, improved scheduling and reduced stack usage
23244 when the preferred stack boundary is not equal to 2. The drawback is a notable
23245 increase in code size. This switch implies @option{-mno-push-args}.
23246
23247 @item -mthreads
23248 @opindex mthreads
23249 Support thread-safe exception handling on MinGW. Programs that rely
23250 on thread-safe exception handling must compile and link all code with the
23251 @option{-mthreads} option. When compiling, @option{-mthreads} defines
23252 @option{-D_MT}; when linking, it links in a special thread helper library
23253 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
23254
23255 @item -mno-align-stringops
23256 @opindex mno-align-stringops
23257 Do not align the destination of inlined string operations. This switch reduces
23258 code size and improves performance in case the destination is already aligned,
23259 but GCC doesn't know about it.
23260
23261 @item -minline-all-stringops
23262 @opindex minline-all-stringops
23263 By default GCC inlines string operations only when the destination is
23264 known to be aligned to least a 4-byte boundary.
23265 This enables more inlining and increases code
23266 size, but may improve performance of code that depends on fast
23267 @code{memcpy}, @code{strlen},
23268 and @code{memset} for short lengths.
23269
23270 @item -minline-stringops-dynamically
23271 @opindex minline-stringops-dynamically
23272 For string operations of unknown size, use run-time checks with
23273 inline code for small blocks and a library call for large blocks.
23274
23275 @item -mstringop-strategy=@var{alg}
23276 @opindex mstringop-strategy=@var{alg}
23277 Override the internal decision heuristic for the particular algorithm to use
23278 for inlining string operations. The allowed values for @var{alg} are:
23279
23280 @table @samp
23281 @item rep_byte
23282 @itemx rep_4byte
23283 @itemx rep_8byte
23284 Expand using i386 @code{rep} prefix of the specified size.
23285
23286 @item byte_loop
23287 @itemx loop
23288 @itemx unrolled_loop
23289 Expand into an inline loop.
23290
23291 @item libcall
23292 Always use a library call.
23293 @end table
23294
23295 @item -mmemcpy-strategy=@var{strategy}
23296 @opindex mmemcpy-strategy=@var{strategy}
23297 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
23298 should be inlined and what inline algorithm to use when the expected size
23299 of the copy operation is known. @var{strategy}
23300 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
23301 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
23302 the max byte size with which inline algorithm @var{alg} is allowed. For the last
23303 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
23304 in the list must be specified in increasing order. The minimal byte size for
23305 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
23306 preceding range.
23307
23308 @item -mmemset-strategy=@var{strategy}
23309 @opindex mmemset-strategy=@var{strategy}
23310 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
23311 @code{__builtin_memset} expansion.
23312
23313 @item -momit-leaf-frame-pointer
23314 @opindex momit-leaf-frame-pointer
23315 Don't keep the frame pointer in a register for leaf functions. This
23316 avoids the instructions to save, set up, and restore frame pointers and
23317 makes an extra register available in leaf functions. The option
23318 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
23319 which might make debugging harder.
23320
23321 @item -mtls-direct-seg-refs
23322 @itemx -mno-tls-direct-seg-refs
23323 @opindex mtls-direct-seg-refs
23324 Controls whether TLS variables may be accessed with offsets from the
23325 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
23326 or whether the thread base pointer must be added. Whether or not this
23327 is valid depends on the operating system, and whether it maps the
23328 segment to cover the entire TLS area.
23329
23330 For systems that use the GNU C Library, the default is on.
23331
23332 @item -msse2avx
23333 @itemx -mno-sse2avx
23334 @opindex msse2avx
23335 Specify that the assembler should encode SSE instructions with VEX
23336 prefix. The option @option{-mavx} turns this on by default.
23337
23338 @item -mfentry
23339 @itemx -mno-fentry
23340 @opindex mfentry
23341 If profiling is active (@option{-pg}), put the profiling
23342 counter call before the prologue.
23343 Note: On x86 architectures the attribute @code{ms_hook_prologue}
23344 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
23345
23346 @item -mrecord-mcount
23347 @itemx -mno-record-mcount
23348 @opindex mrecord-mcount
23349 If profiling is active (@option{-pg}), generate a __mcount_loc section
23350 that contains pointers to each profiling call. This is useful for
23351 automatically patching and out calls.
23352
23353 @item -mnop-mcount
23354 @itemx -mno-nop-mcount
23355 @opindex mnop-mcount
23356 If profiling is active (@option{-pg}), generate the calls to
23357 the profiling functions as nops. This is useful when they
23358 should be patched in later dynamically. This is likely only
23359 useful together with @option{-mrecord-mcount}.
23360
23361 @item -mskip-rax-setup
23362 @itemx -mno-skip-rax-setup
23363 @opindex mskip-rax-setup
23364 When generating code for the x86-64 architecture with SSE extensions
23365 disabled, @option{-skip-rax-setup} can be used to skip setting up RAX
23366 register when there are no variable arguments passed in vector registers.
23367
23368 @strong{Warning:} Since RAX register is used to avoid unnecessarily
23369 saving vector registers on stack when passing variable arguments, the
23370 impacts of this option are callees may waste some stack space,
23371 misbehave or jump to a random location. GCC 4.4 or newer don't have
23372 those issues, regardless the RAX register value.
23373
23374 @item -m8bit-idiv
23375 @itemx -mno-8bit-idiv
23376 @opindex m8bit-idiv
23377 On some processors, like Intel Atom, 8-bit unsigned integer divide is
23378 much faster than 32-bit/64-bit integer divide. This option generates a
23379 run-time check. If both dividend and divisor are within range of 0
23380 to 255, 8-bit unsigned integer divide is used instead of
23381 32-bit/64-bit integer divide.
23382
23383 @item -mavx256-split-unaligned-load
23384 @itemx -mavx256-split-unaligned-store
23385 @opindex mavx256-split-unaligned-load
23386 @opindex mavx256-split-unaligned-store
23387 Split 32-byte AVX unaligned load and store.
23388
23389 @item -mstack-protector-guard=@var{guard}
23390 @opindex mstack-protector-guard=@var{guard}
23391 Generate stack protection code using canary at @var{guard}. Supported
23392 locations are @samp{global} for global canary or @samp{tls} for per-thread
23393 canary in the TLS block (the default). This option has effect only when
23394 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
23395
23396 @end table
23397
23398 These @samp{-m} switches are supported in addition to the above
23399 on x86-64 processors in 64-bit environments.
23400
23401 @table @gcctabopt
23402 @item -m32
23403 @itemx -m64
23404 @itemx -mx32
23405 @itemx -m16
23406 @itemx -miamcu
23407 @opindex m32
23408 @opindex m64
23409 @opindex mx32
23410 @opindex m16
23411 @opindex miamcu
23412 Generate code for a 16-bit, 32-bit or 64-bit environment.
23413 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
23414 to 32 bits, and
23415 generates code that runs on any i386 system.
23416
23417 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
23418 types to 64 bits, and generates code for the x86-64 architecture.
23419 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
23420 and @option{-mdynamic-no-pic} options.
23421
23422 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
23423 to 32 bits, and
23424 generates code for the x86-64 architecture.
23425
23426 The @option{-m16} option is the same as @option{-m32}, except for that
23427 it outputs the @code{.code16gcc} assembly directive at the beginning of
23428 the assembly output so that the binary can run in 16-bit mode.
23429
23430 The @option{-miamcu} option generates code which conforms to Intel MCU
23431 psABI. It requires the @option{-m32} option to be turned on.
23432
23433 @item -mno-red-zone
23434 @opindex mno-red-zone
23435 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
23436 by the x86-64 ABI; it is a 128-byte area beyond the location of the
23437 stack pointer that is not modified by signal or interrupt handlers
23438 and therefore can be used for temporary data without adjusting the stack
23439 pointer. The flag @option{-mno-red-zone} disables this red zone.
23440
23441 @item -mcmodel=small
23442 @opindex mcmodel=small
23443 Generate code for the small code model: the program and its symbols must
23444 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
23445 Programs can be statically or dynamically linked. This is the default
23446 code model.
23447
23448 @item -mcmodel=kernel
23449 @opindex mcmodel=kernel
23450 Generate code for the kernel code model. The kernel runs in the
23451 negative 2 GB of the address space.
23452 This model has to be used for Linux kernel code.
23453
23454 @item -mcmodel=medium
23455 @opindex mcmodel=medium
23456 Generate code for the medium model: the program is linked in the lower 2
23457 GB of the address space. Small symbols are also placed there. Symbols
23458 with sizes larger than @option{-mlarge-data-threshold} are put into
23459 large data or BSS sections and can be located above 2GB. Programs can
23460 be statically or dynamically linked.
23461
23462 @item -mcmodel=large
23463 @opindex mcmodel=large
23464 Generate code for the large model. This model makes no assumptions
23465 about addresses and sizes of sections.
23466
23467 @item -maddress-mode=long
23468 @opindex maddress-mode=long
23469 Generate code for long address mode. This is only supported for 64-bit
23470 and x32 environments. It is the default address mode for 64-bit
23471 environments.
23472
23473 @item -maddress-mode=short
23474 @opindex maddress-mode=short
23475 Generate code for short address mode. This is only supported for 32-bit
23476 and x32 environments. It is the default address mode for 32-bit and
23477 x32 environments.
23478 @end table
23479
23480 @node x86 Windows Options
23481 @subsection x86 Windows Options
23482 @cindex x86 Windows Options
23483 @cindex Windows Options for x86
23484
23485 These additional options are available for Microsoft Windows targets:
23486
23487 @table @gcctabopt
23488 @item -mconsole
23489 @opindex mconsole
23490 This option
23491 specifies that a console application is to be generated, by
23492 instructing the linker to set the PE header subsystem type
23493 required for console applications.
23494 This option is available for Cygwin and MinGW targets and is
23495 enabled by default on those targets.
23496
23497 @item -mdll
23498 @opindex mdll
23499 This option is available for Cygwin and MinGW targets. It
23500 specifies that a DLL---a dynamic link library---is to be
23501 generated, enabling the selection of the required runtime
23502 startup object and entry point.
23503
23504 @item -mnop-fun-dllimport
23505 @opindex mnop-fun-dllimport
23506 This option is available for Cygwin and MinGW targets. It
23507 specifies that the @code{dllimport} attribute should be ignored.
23508
23509 @item -mthread
23510 @opindex mthread
23511 This option is available for MinGW targets. It specifies
23512 that MinGW-specific thread support is to be used.
23513
23514 @item -municode
23515 @opindex municode
23516 This option is available for MinGW-w64 targets. It causes
23517 the @code{UNICODE} preprocessor macro to be predefined, and
23518 chooses Unicode-capable runtime startup code.
23519
23520 @item -mwin32
23521 @opindex mwin32
23522 This option is available for Cygwin and MinGW targets. It
23523 specifies that the typical Microsoft Windows predefined macros are to
23524 be set in the pre-processor, but does not influence the choice
23525 of runtime library/startup code.
23526
23527 @item -mwindows
23528 @opindex mwindows
23529 This option is available for Cygwin and MinGW targets. It
23530 specifies that a GUI application is to be generated by
23531 instructing the linker to set the PE header subsystem type
23532 appropriately.
23533
23534 @item -fno-set-stack-executable
23535 @opindex fno-set-stack-executable
23536 This option is available for MinGW targets. It specifies that
23537 the executable flag for the stack used by nested functions isn't
23538 set. This is necessary for binaries running in kernel mode of
23539 Microsoft Windows, as there the User32 API, which is used to set executable
23540 privileges, isn't available.
23541
23542 @item -fwritable-relocated-rdata
23543 @opindex fno-writable-relocated-rdata
23544 This option is available for MinGW and Cygwin targets. It specifies
23545 that relocated-data in read-only section is put into .data
23546 section. This is a necessary for older runtimes not supporting
23547 modification of .rdata sections for pseudo-relocation.
23548
23549 @item -mpe-aligned-commons
23550 @opindex mpe-aligned-commons
23551 This option is available for Cygwin and MinGW targets. It
23552 specifies that the GNU extension to the PE file format that
23553 permits the correct alignment of COMMON variables should be
23554 used when generating code. It is enabled by default if
23555 GCC detects that the target assembler found during configuration
23556 supports the feature.
23557 @end table
23558
23559 See also under @ref{x86 Options} for standard options.
23560
23561 @node Xstormy16 Options
23562 @subsection Xstormy16 Options
23563 @cindex Xstormy16 Options
23564
23565 These options are defined for Xstormy16:
23566
23567 @table @gcctabopt
23568 @item -msim
23569 @opindex msim
23570 Choose startup files and linker script suitable for the simulator.
23571 @end table
23572
23573 @node Xtensa Options
23574 @subsection Xtensa Options
23575 @cindex Xtensa Options
23576
23577 These options are supported for Xtensa targets:
23578
23579 @table @gcctabopt
23580 @item -mconst16
23581 @itemx -mno-const16
23582 @opindex mconst16
23583 @opindex mno-const16
23584 Enable or disable use of @code{CONST16} instructions for loading
23585 constant values. The @code{CONST16} instruction is currently not a
23586 standard option from Tensilica. When enabled, @code{CONST16}
23587 instructions are always used in place of the standard @code{L32R}
23588 instructions. The use of @code{CONST16} is enabled by default only if
23589 the @code{L32R} instruction is not available.
23590
23591 @item -mfused-madd
23592 @itemx -mno-fused-madd
23593 @opindex mfused-madd
23594 @opindex mno-fused-madd
23595 Enable or disable use of fused multiply/add and multiply/subtract
23596 instructions in the floating-point option. This has no effect if the
23597 floating-point option is not also enabled. Disabling fused multiply/add
23598 and multiply/subtract instructions forces the compiler to use separate
23599 instructions for the multiply and add/subtract operations. This may be
23600 desirable in some cases where strict IEEE 754-compliant results are
23601 required: the fused multiply add/subtract instructions do not round the
23602 intermediate result, thereby producing results with @emph{more} bits of
23603 precision than specified by the IEEE standard. Disabling fused multiply
23604 add/subtract instructions also ensures that the program output is not
23605 sensitive to the compiler's ability to combine multiply and add/subtract
23606 operations.
23607
23608 @item -mserialize-volatile
23609 @itemx -mno-serialize-volatile
23610 @opindex mserialize-volatile
23611 @opindex mno-serialize-volatile
23612 When this option is enabled, GCC inserts @code{MEMW} instructions before
23613 @code{volatile} memory references to guarantee sequential consistency.
23614 The default is @option{-mserialize-volatile}. Use
23615 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
23616
23617 @item -mforce-no-pic
23618 @opindex mforce-no-pic
23619 For targets, like GNU/Linux, where all user-mode Xtensa code must be
23620 position-independent code (PIC), this option disables PIC for compiling
23621 kernel code.
23622
23623 @item -mtext-section-literals
23624 @itemx -mno-text-section-literals
23625 @opindex mtext-section-literals
23626 @opindex mno-text-section-literals
23627 These options control the treatment of literal pools. The default is
23628 @option{-mno-text-section-literals}, which places literals in a separate
23629 section in the output file. This allows the literal pool to be placed
23630 in a data RAM/ROM, and it also allows the linker to combine literal
23631 pools from separate object files to remove redundant literals and
23632 improve code size. With @option{-mtext-section-literals}, the literals
23633 are interspersed in the text section in order to keep them as close as
23634 possible to their references. This may be necessary for large assembly
23635 files. Literals for each function are placed right before that function.
23636
23637 @item -mauto-litpools
23638 @itemx -mno-auto-litpools
23639 @opindex mauto-litpools
23640 @opindex mno-auto-litpools
23641 These options control the treatment of literal pools. The default is
23642 @option{-mno-auto-litpools}, which places literals in a separate
23643 section in the output file unless @option{-mtext-section-literals} is
23644 used. With @option{-mauto-litpools} the literals are interspersed in
23645 the text section by the assembler. Compiler does not produce explicit
23646 @code{.literal} directives and loads literals into registers with
23647 @code{MOVI} instructions instead of @code{L32R} to let the assembler
23648 do relaxation and place literals as necessary. This option allows
23649 assembler to create several literal pools per function and assemble
23650 very big functions, which may not be possible with
23651 @option{-mtext-section-literals}.
23652
23653 @item -mtarget-align
23654 @itemx -mno-target-align
23655 @opindex mtarget-align
23656 @opindex mno-target-align
23657 When this option is enabled, GCC instructs the assembler to
23658 automatically align instructions to reduce branch penalties at the
23659 expense of some code density. The assembler attempts to widen density
23660 instructions to align branch targets and the instructions following call
23661 instructions. If there are not enough preceding safe density
23662 instructions to align a target, no widening is performed. The
23663 default is @option{-mtarget-align}. These options do not affect the
23664 treatment of auto-aligned instructions like @code{LOOP}, which the
23665 assembler always aligns, either by widening density instructions or
23666 by inserting NOP instructions.
23667
23668 @item -mlongcalls
23669 @itemx -mno-longcalls
23670 @opindex mlongcalls
23671 @opindex mno-longcalls
23672 When this option is enabled, GCC instructs the assembler to translate
23673 direct calls to indirect calls unless it can determine that the target
23674 of a direct call is in the range allowed by the call instruction. This
23675 translation typically occurs for calls to functions in other source
23676 files. Specifically, the assembler translates a direct @code{CALL}
23677 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
23678 The default is @option{-mno-longcalls}. This option should be used in
23679 programs where the call target can potentially be out of range. This
23680 option is implemented in the assembler, not the compiler, so the
23681 assembly code generated by GCC still shows direct call
23682 instructions---look at the disassembled object code to see the actual
23683 instructions. Note that the assembler uses an indirect call for
23684 every cross-file call, not just those that really are out of range.
23685 @end table
23686
23687 @node zSeries Options
23688 @subsection zSeries Options
23689 @cindex zSeries options
23690
23691 These are listed under @xref{S/390 and zSeries Options}.
23692
23693 @node Code Gen Options
23694 @section Options for Code Generation Conventions
23695 @cindex code generation conventions
23696 @cindex options, code generation
23697 @cindex run-time options
23698
23699 These machine-independent options control the interface conventions
23700 used in code generation.
23701
23702 Most of them have both positive and negative forms; the negative form
23703 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
23704 one of the forms is listed---the one that is not the default. You
23705 can figure out the other form by either removing @samp{no-} or adding
23706 it.
23707
23708 @table @gcctabopt
23709 @item -fbounds-check
23710 @opindex fbounds-check
23711 For front ends that support it, generate additional code to check that
23712 indices used to access arrays are within the declared range. This is
23713 currently only supported by the Java and Fortran front ends, where
23714 this option defaults to true and false respectively.
23715
23716 @item -fstack-reuse=@var{reuse-level}
23717 @opindex fstack_reuse
23718 This option controls stack space reuse for user declared local/auto variables
23719 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
23720 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
23721 local variables and temporaries, @samp{named_vars} enables the reuse only for
23722 user defined local variables with names, and @samp{none} disables stack reuse
23723 completely. The default value is @samp{all}. The option is needed when the
23724 program extends the lifetime of a scoped local variable or a compiler generated
23725 temporary beyond the end point defined by the language. When a lifetime of
23726 a variable ends, and if the variable lives in memory, the optimizing compiler
23727 has the freedom to reuse its stack space with other temporaries or scoped
23728 local variables whose live range does not overlap with it. Legacy code extending
23729 local lifetime is likely to break with the stack reuse optimization.
23730
23731 For example,
23732
23733 @smallexample
23734 int *p;
23735 @{
23736 int local1;
23737
23738 p = &local1;
23739 local1 = 10;
23740 ....
23741 @}
23742 @{
23743 int local2;
23744 local2 = 20;
23745 ...
23746 @}
23747
23748 if (*p == 10) // out of scope use of local1
23749 @{
23750
23751 @}
23752 @end smallexample
23753
23754 Another example:
23755 @smallexample
23756
23757 struct A
23758 @{
23759 A(int k) : i(k), j(k) @{ @}
23760 int i;
23761 int j;
23762 @};
23763
23764 A *ap;
23765
23766 void foo(const A& ar)
23767 @{
23768 ap = &ar;
23769 @}
23770
23771 void bar()
23772 @{
23773 foo(A(10)); // temp object's lifetime ends when foo returns
23774
23775 @{
23776 A a(20);
23777 ....
23778 @}
23779 ap->i+= 10; // ap references out of scope temp whose space
23780 // is reused with a. What is the value of ap->i?
23781 @}
23782
23783 @end smallexample
23784
23785 The lifetime of a compiler generated temporary is well defined by the C++
23786 standard. When a lifetime of a temporary ends, and if the temporary lives
23787 in memory, the optimizing compiler has the freedom to reuse its stack
23788 space with other temporaries or scoped local variables whose live range
23789 does not overlap with it. However some of the legacy code relies on
23790 the behavior of older compilers in which temporaries' stack space is
23791 not reused, the aggressive stack reuse can lead to runtime errors. This
23792 option is used to control the temporary stack reuse optimization.
23793
23794 @item -ftrapv
23795 @opindex ftrapv
23796 This option generates traps for signed overflow on addition, subtraction,
23797 multiplication operations.
23798 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
23799 @option{-ftrapv} @option{-fwrapv} on the command-line results in
23800 @option{-fwrapv} being effective. Note that only active options override, so
23801 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
23802 results in @option{-ftrapv} being effective.
23803
23804 @item -fwrapv
23805 @opindex fwrapv
23806 This option instructs the compiler to assume that signed arithmetic
23807 overflow of addition, subtraction and multiplication wraps around
23808 using twos-complement representation. This flag enables some optimizations
23809 and disables others. This option is enabled by default for the Java
23810 front end, as required by the Java language specification.
23811 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
23812 @option{-ftrapv} @option{-fwrapv} on the command-line results in
23813 @option{-fwrapv} being effective. Note that only active options override, so
23814 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
23815 results in @option{-ftrapv} being effective.
23816
23817 @item -fexceptions
23818 @opindex fexceptions
23819 Enable exception handling. Generates extra code needed to propagate
23820 exceptions. For some targets, this implies GCC generates frame
23821 unwind information for all functions, which can produce significant data
23822 size overhead, although it does not affect execution. If you do not
23823 specify this option, GCC enables it by default for languages like
23824 C++ that normally require exception handling, and disables it for
23825 languages like C that do not normally require it. However, you may need
23826 to enable this option when compiling C code that needs to interoperate
23827 properly with exception handlers written in C++. You may also wish to
23828 disable this option if you are compiling older C++ programs that don't
23829 use exception handling.
23830
23831 @item -fnon-call-exceptions
23832 @opindex fnon-call-exceptions
23833 Generate code that allows trapping instructions to throw exceptions.
23834 Note that this requires platform-specific runtime support that does
23835 not exist everywhere. Moreover, it only allows @emph{trapping}
23836 instructions to throw exceptions, i.e.@: memory references or floating-point
23837 instructions. It does not allow exceptions to be thrown from
23838 arbitrary signal handlers such as @code{SIGALRM}.
23839
23840 @item -fdelete-dead-exceptions
23841 @opindex fdelete-dead-exceptions
23842 Consider that instructions that may throw exceptions but don't otherwise
23843 contribute to the execution of the program can be optimized away.
23844 This option is enabled by default for the Ada front end, as permitted by
23845 the Ada language specification.
23846 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
23847
23848 @item -funwind-tables
23849 @opindex funwind-tables
23850 Similar to @option{-fexceptions}, except that it just generates any needed
23851 static data, but does not affect the generated code in any other way.
23852 You normally do not need to enable this option; instead, a language processor
23853 that needs this handling enables it on your behalf.
23854
23855 @item -fasynchronous-unwind-tables
23856 @opindex fasynchronous-unwind-tables
23857 Generate unwind table in DWARF 2 format, if supported by target machine. The
23858 table is exact at each instruction boundary, so it can be used for stack
23859 unwinding from asynchronous events (such as debugger or garbage collector).
23860
23861 @item -fno-gnu-unique
23862 @opindex fno-gnu-unique
23863 On systems with recent GNU assembler and C library, the C++ compiler
23864 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
23865 of template static data members and static local variables in inline
23866 functions are unique even in the presence of @code{RTLD_LOCAL}; this
23867 is necessary to avoid problems with a library used by two different
23868 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
23869 therefore disagreeing with the other one about the binding of the
23870 symbol. But this causes @code{dlclose} to be ignored for affected
23871 DSOs; if your program relies on reinitialization of a DSO via
23872 @code{dlclose} and @code{dlopen}, you can use
23873 @option{-fno-gnu-unique}.
23874
23875 @item -fpcc-struct-return
23876 @opindex fpcc-struct-return
23877 Return ``short'' @code{struct} and @code{union} values in memory like
23878 longer ones, rather than in registers. This convention is less
23879 efficient, but it has the advantage of allowing intercallability between
23880 GCC-compiled files and files compiled with other compilers, particularly
23881 the Portable C Compiler (pcc).
23882
23883 The precise convention for returning structures in memory depends
23884 on the target configuration macros.
23885
23886 Short structures and unions are those whose size and alignment match
23887 that of some integer type.
23888
23889 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
23890 switch is not binary compatible with code compiled with the
23891 @option{-freg-struct-return} switch.
23892 Use it to conform to a non-default application binary interface.
23893
23894 @item -freg-struct-return
23895 @opindex freg-struct-return
23896 Return @code{struct} and @code{union} values in registers when possible.
23897 This is more efficient for small structures than
23898 @option{-fpcc-struct-return}.
23899
23900 If you specify neither @option{-fpcc-struct-return} nor
23901 @option{-freg-struct-return}, GCC defaults to whichever convention is
23902 standard for the target. If there is no standard convention, GCC
23903 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
23904 the principal compiler. In those cases, we can choose the standard, and
23905 we chose the more efficient register return alternative.
23906
23907 @strong{Warning:} code compiled with the @option{-freg-struct-return}
23908 switch is not binary compatible with code compiled with the
23909 @option{-fpcc-struct-return} switch.
23910 Use it to conform to a non-default application binary interface.
23911
23912 @item -fshort-enums
23913 @opindex fshort-enums
23914 Allocate to an @code{enum} type only as many bytes as it needs for the
23915 declared range of possible values. Specifically, the @code{enum} type
23916 is equivalent to the smallest integer type that has enough room.
23917
23918 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
23919 code that is not binary compatible with code generated without that switch.
23920 Use it to conform to a non-default application binary interface.
23921
23922 @item -fshort-double
23923 @opindex fshort-double
23924 Use the same size for @code{double} as for @code{float}.
23925
23926 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
23927 code that is not binary compatible with code generated without that switch.
23928 Use it to conform to a non-default application binary interface.
23929
23930 @item -fshort-wchar
23931 @opindex fshort-wchar
23932 Override the underlying type for @code{wchar_t} to be @code{short
23933 unsigned int} instead of the default for the target. This option is
23934 useful for building programs to run under WINE@.
23935
23936 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
23937 code that is not binary compatible with code generated without that switch.
23938 Use it to conform to a non-default application binary interface.
23939
23940 @item -fno-common
23941 @opindex fno-common
23942 In C code, controls the placement of uninitialized global variables.
23943 Unix C compilers have traditionally permitted multiple definitions of
23944 such variables in different compilation units by placing the variables
23945 in a common block.
23946 This is the behavior specified by @option{-fcommon}, and is the default
23947 for GCC on most targets.
23948 On the other hand, this behavior is not required by ISO C, and on some
23949 targets may carry a speed or code size penalty on variable references.
23950 The @option{-fno-common} option specifies that the compiler should place
23951 uninitialized global variables in the data section of the object file,
23952 rather than generating them as common blocks.
23953 This has the effect that if the same variable is declared
23954 (without @code{extern}) in two different compilations,
23955 you get a multiple-definition error when you link them.
23956 In this case, you must compile with @option{-fcommon} instead.
23957 Compiling with @option{-fno-common} is useful on targets for which
23958 it provides better performance, or if you wish to verify that the
23959 program will work on other systems that always treat uninitialized
23960 variable declarations this way.
23961
23962 @item -fno-ident
23963 @opindex fno-ident
23964 Ignore the @code{#ident} directive.
23965
23966 @item -finhibit-size-directive
23967 @opindex finhibit-size-directive
23968 Don't output a @code{.size} assembler directive, or anything else that
23969 would cause trouble if the function is split in the middle, and the
23970 two halves are placed at locations far apart in memory. This option is
23971 used when compiling @file{crtstuff.c}; you should not need to use it
23972 for anything else.
23973
23974 @item -fverbose-asm
23975 @opindex fverbose-asm
23976 Put extra commentary information in the generated assembly code to
23977 make it more readable. This option is generally only of use to those
23978 who actually need to read the generated assembly code (perhaps while
23979 debugging the compiler itself).
23980
23981 @option{-fno-verbose-asm}, the default, causes the
23982 extra information to be omitted and is useful when comparing two assembler
23983 files.
23984
23985 @item -frecord-gcc-switches
23986 @opindex frecord-gcc-switches
23987 This switch causes the command line used to invoke the
23988 compiler to be recorded into the object file that is being created.
23989 This switch is only implemented on some targets and the exact format
23990 of the recording is target and binary file format dependent, but it
23991 usually takes the form of a section containing ASCII text. This
23992 switch is related to the @option{-fverbose-asm} switch, but that
23993 switch only records information in the assembler output file as
23994 comments, so it never reaches the object file.
23995 See also @option{-grecord-gcc-switches} for another
23996 way of storing compiler options into the object file.
23997
23998 @item -fpic
23999 @opindex fpic
24000 @cindex global offset table
24001 @cindex PIC
24002 Generate position-independent code (PIC) suitable for use in a shared
24003 library, if supported for the target machine. Such code accesses all
24004 constant addresses through a global offset table (GOT)@. The dynamic
24005 loader resolves the GOT entries when the program starts (the dynamic
24006 loader is not part of GCC; it is part of the operating system). If
24007 the GOT size for the linked executable exceeds a machine-specific
24008 maximum size, you get an error message from the linker indicating that
24009 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
24010 instead. (These maximums are 8k on the SPARC and 32k
24011 on the m68k and RS/6000. The x86 has no such limit.)
24012
24013 Position-independent code requires special support, and therefore works
24014 only on certain machines. For the x86, GCC supports PIC for System V
24015 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
24016 position-independent.
24017
24018 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
24019 are defined to 1.
24020
24021 @item -fPIC
24022 @opindex fPIC
24023 If supported for the target machine, emit position-independent code,
24024 suitable for dynamic linking and avoiding any limit on the size of the
24025 global offset table. This option makes a difference on the m68k,
24026 PowerPC and SPARC@.
24027
24028 Position-independent code requires special support, and therefore works
24029 only on certain machines.
24030
24031 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
24032 are defined to 2.
24033
24034 @item -fpie
24035 @itemx -fPIE
24036 @opindex fpie
24037 @opindex fPIE
24038 These options are similar to @option{-fpic} and @option{-fPIC}, but
24039 generated position independent code can be only linked into executables.
24040 Usually these options are used when @option{-pie} GCC option is
24041 used during linking.
24042
24043 @option{-fpie} and @option{-fPIE} both define the macros
24044 @code{__pie__} and @code{__PIE__}. The macros have the value 1
24045 for @option{-fpie} and 2 for @option{-fPIE}.
24046
24047 @item -fno-plt
24048 @opindex fno-plt
24049 Do not use PLT for external function calls in position-independent code.
24050 Instead, load callee address at call site from GOT and branch to it.
24051 This leads to more efficient code by eliminating PLT stubs and exposing
24052 GOT load to optimizations. On architectures such as 32-bit x86 where
24053 PLT stubs expect GOT pointer in a specific register, this gives more
24054 register allocation freedom to the compiler. Lazy binding requires PLT:
24055 with @option{-fno-plt} all external symbols are resolved at load time.
24056
24057 Alternatively, function attribute @code{noplt} can be used to avoid PLT
24058 for calls to specific external functions by marking those functions with
24059 this attribute.
24060
24061 Additionally, a few targets also convert calls to those functions that are
24062 marked to not use the PLT to use the GOT instead for non-position independent
24063 code.
24064
24065 @item -fno-jump-tables
24066 @opindex fno-jump-tables
24067 Do not use jump tables for switch statements even where it would be
24068 more efficient than other code generation strategies. This option is
24069 of use in conjunction with @option{-fpic} or @option{-fPIC} for
24070 building code that forms part of a dynamic linker and cannot
24071 reference the address of a jump table. On some targets, jump tables
24072 do not require a GOT and this option is not needed.
24073
24074 @item -ffixed-@var{reg}
24075 @opindex ffixed
24076 Treat the register named @var{reg} as a fixed register; generated code
24077 should never refer to it (except perhaps as a stack pointer, frame
24078 pointer or in some other fixed role).
24079
24080 @var{reg} must be the name of a register. The register names accepted
24081 are machine-specific and are defined in the @code{REGISTER_NAMES}
24082 macro in the machine description macro file.
24083
24084 This flag does not have a negative form, because it specifies a
24085 three-way choice.
24086
24087 @item -fcall-used-@var{reg}
24088 @opindex fcall-used
24089 Treat the register named @var{reg} as an allocable register that is
24090 clobbered by function calls. It may be allocated for temporaries or
24091 variables that do not live across a call. Functions compiled this way
24092 do not save and restore the register @var{reg}.
24093
24094 It is an error to use this flag with the frame pointer or stack pointer.
24095 Use of this flag for other registers that have fixed pervasive roles in
24096 the machine's execution model produces disastrous results.
24097
24098 This flag does not have a negative form, because it specifies a
24099 three-way choice.
24100
24101 @item -fcall-saved-@var{reg}
24102 @opindex fcall-saved
24103 Treat the register named @var{reg} as an allocable register saved by
24104 functions. It may be allocated even for temporaries or variables that
24105 live across a call. Functions compiled this way save and restore
24106 the register @var{reg} if they use it.
24107
24108 It is an error to use this flag with the frame pointer or stack pointer.
24109 Use of this flag for other registers that have fixed pervasive roles in
24110 the machine's execution model produces disastrous results.
24111
24112 A different sort of disaster results from the use of this flag for
24113 a register in which function values may be returned.
24114
24115 This flag does not have a negative form, because it specifies a
24116 three-way choice.
24117
24118 @item -fpack-struct[=@var{n}]
24119 @opindex fpack-struct
24120 Without a value specified, pack all structure members together without
24121 holes. When a value is specified (which must be a small power of two), pack
24122 structure members according to this value, representing the maximum
24123 alignment (that is, objects with default alignment requirements larger than
24124 this are output potentially unaligned at the next fitting location.
24125
24126 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
24127 code that is not binary compatible with code generated without that switch.
24128 Additionally, it makes the code suboptimal.
24129 Use it to conform to a non-default application binary interface.
24130
24131 @item -finstrument-functions
24132 @opindex finstrument-functions
24133 Generate instrumentation calls for entry and exit to functions. Just
24134 after function entry and just before function exit, the following
24135 profiling functions are called with the address of the current
24136 function and its call site. (On some platforms,
24137 @code{__builtin_return_address} does not work beyond the current
24138 function, so the call site information may not be available to the
24139 profiling functions otherwise.)
24140
24141 @smallexample
24142 void __cyg_profile_func_enter (void *this_fn,
24143 void *call_site);
24144 void __cyg_profile_func_exit (void *this_fn,
24145 void *call_site);
24146 @end smallexample
24147
24148 The first argument is the address of the start of the current function,
24149 which may be looked up exactly in the symbol table.
24150
24151 This instrumentation is also done for functions expanded inline in other
24152 functions. The profiling calls indicate where, conceptually, the
24153 inline function is entered and exited. This means that addressable
24154 versions of such functions must be available. If all your uses of a
24155 function are expanded inline, this may mean an additional expansion of
24156 code size. If you use @code{extern inline} in your C code, an
24157 addressable version of such functions must be provided. (This is
24158 normally the case anyway, but if you get lucky and the optimizer always
24159 expands the functions inline, you might have gotten away without
24160 providing static copies.)
24161
24162 A function may be given the attribute @code{no_instrument_function}, in
24163 which case this instrumentation is not done. This can be used, for
24164 example, for the profiling functions listed above, high-priority
24165 interrupt routines, and any functions from which the profiling functions
24166 cannot safely be called (perhaps signal handlers, if the profiling
24167 routines generate output or allocate memory).
24168
24169 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
24170 @opindex finstrument-functions-exclude-file-list
24171
24172 Set the list of functions that are excluded from instrumentation (see
24173 the description of @option{-finstrument-functions}). If the file that
24174 contains a function definition matches with one of @var{file}, then
24175 that function is not instrumented. The match is done on substrings:
24176 if the @var{file} parameter is a substring of the file name, it is
24177 considered to be a match.
24178
24179 For example:
24180
24181 @smallexample
24182 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
24183 @end smallexample
24184
24185 @noindent
24186 excludes any inline function defined in files whose pathnames
24187 contain @file{/bits/stl} or @file{include/sys}.
24188
24189 If, for some reason, you want to include letter @samp{,} in one of
24190 @var{sym}, write @samp{\,}. For example,
24191 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
24192 (note the single quote surrounding the option).
24193
24194 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
24195 @opindex finstrument-functions-exclude-function-list
24196
24197 This is similar to @option{-finstrument-functions-exclude-file-list},
24198 but this option sets the list of function names to be excluded from
24199 instrumentation. The function name to be matched is its user-visible
24200 name, such as @code{vector<int> blah(const vector<int> &)}, not the
24201 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
24202 match is done on substrings: if the @var{sym} parameter is a substring
24203 of the function name, it is considered to be a match. For C99 and C++
24204 extended identifiers, the function name must be given in UTF-8, not
24205 using universal character names.
24206
24207 @item -fstack-check
24208 @opindex fstack-check
24209 Generate code to verify that you do not go beyond the boundary of the
24210 stack. You should specify this flag if you are running in an
24211 environment with multiple threads, but you only rarely need to specify it in
24212 a single-threaded environment since stack overflow is automatically
24213 detected on nearly all systems if there is only one stack.
24214
24215 Note that this switch does not actually cause checking to be done; the
24216 operating system or the language runtime must do that. The switch causes
24217 generation of code to ensure that they see the stack being extended.
24218
24219 You can additionally specify a string parameter: @samp{no} means no
24220 checking, @samp{generic} means force the use of old-style checking,
24221 @samp{specific} means use the best checking method and is equivalent
24222 to bare @option{-fstack-check}.
24223
24224 Old-style checking is a generic mechanism that requires no specific
24225 target support in the compiler but comes with the following drawbacks:
24226
24227 @enumerate
24228 @item
24229 Modified allocation strategy for large objects: they are always
24230 allocated dynamically if their size exceeds a fixed threshold.
24231
24232 @item
24233 Fixed limit on the size of the static frame of functions: when it is
24234 topped by a particular function, stack checking is not reliable and
24235 a warning is issued by the compiler.
24236
24237 @item
24238 Inefficiency: because of both the modified allocation strategy and the
24239 generic implementation, code performance is hampered.
24240 @end enumerate
24241
24242 Note that old-style stack checking is also the fallback method for
24243 @samp{specific} if no target support has been added in the compiler.
24244
24245 @item -fstack-limit-register=@var{reg}
24246 @itemx -fstack-limit-symbol=@var{sym}
24247 @itemx -fno-stack-limit
24248 @opindex fstack-limit-register
24249 @opindex fstack-limit-symbol
24250 @opindex fno-stack-limit
24251 Generate code to ensure that the stack does not grow beyond a certain value,
24252 either the value of a register or the address of a symbol. If a larger
24253 stack is required, a signal is raised at run time. For most targets,
24254 the signal is raised before the stack overruns the boundary, so
24255 it is possible to catch the signal without taking special precautions.
24256
24257 For instance, if the stack starts at absolute address @samp{0x80000000}
24258 and grows downwards, you can use the flags
24259 @option{-fstack-limit-symbol=__stack_limit} and
24260 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
24261 of 128KB@. Note that this may only work with the GNU linker.
24262
24263 @item -fsplit-stack
24264 @opindex fsplit-stack
24265 Generate code to automatically split the stack before it overflows.
24266 The resulting program has a discontiguous stack which can only
24267 overflow if the program is unable to allocate any more memory. This
24268 is most useful when running threaded programs, as it is no longer
24269 necessary to calculate a good stack size to use for each thread. This
24270 is currently only implemented for the x86 targets running
24271 GNU/Linux.
24272
24273 When code compiled with @option{-fsplit-stack} calls code compiled
24274 without @option{-fsplit-stack}, there may not be much stack space
24275 available for the latter code to run. If compiling all code,
24276 including library code, with @option{-fsplit-stack} is not an option,
24277 then the linker can fix up these calls so that the code compiled
24278 without @option{-fsplit-stack} always has a large stack. Support for
24279 this is implemented in the gold linker in GNU binutils release 2.21
24280 and later.
24281
24282 @item -fleading-underscore
24283 @opindex fleading-underscore
24284 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
24285 change the way C symbols are represented in the object file. One use
24286 is to help link with legacy assembly code.
24287
24288 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
24289 generate code that is not binary compatible with code generated without that
24290 switch. Use it to conform to a non-default application binary interface.
24291 Not all targets provide complete support for this switch.
24292
24293 @item -ftls-model=@var{model}
24294 @opindex ftls-model
24295 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
24296 The @var{model} argument should be one of @samp{global-dynamic},
24297 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
24298 Note that the choice is subject to optimization: the compiler may use
24299 a more efficient model for symbols not visible outside of the translation
24300 unit, or if @option{-fpic} is not given on the command line.
24301
24302 The default without @option{-fpic} is @samp{initial-exec}; with
24303 @option{-fpic} the default is @samp{global-dynamic}.
24304
24305 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
24306 @opindex fvisibility
24307 Set the default ELF image symbol visibility to the specified option---all
24308 symbols are marked with this unless overridden within the code.
24309 Using this feature can very substantially improve linking and
24310 load times of shared object libraries, produce more optimized
24311 code, provide near-perfect API export and prevent symbol clashes.
24312 It is @strong{strongly} recommended that you use this in any shared objects
24313 you distribute.
24314
24315 Despite the nomenclature, @samp{default} always means public; i.e.,
24316 available to be linked against from outside the shared object.
24317 @samp{protected} and @samp{internal} are pretty useless in real-world
24318 usage so the only other commonly used option is @samp{hidden}.
24319 The default if @option{-fvisibility} isn't specified is
24320 @samp{default}, i.e., make every symbol public.
24321
24322 A good explanation of the benefits offered by ensuring ELF
24323 symbols have the correct visibility is given by ``How To Write
24324 Shared Libraries'' by Ulrich Drepper (which can be found at
24325 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
24326 solution made possible by this option to marking things hidden when
24327 the default is public is to make the default hidden and mark things
24328 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
24329 and @code{__attribute__ ((visibility("default")))} instead of
24330 @code{__declspec(dllexport)} you get almost identical semantics with
24331 identical syntax. This is a great boon to those working with
24332 cross-platform projects.
24333
24334 For those adding visibility support to existing code, you may find
24335 @code{#pragma GCC visibility} of use. This works by you enclosing
24336 the declarations you wish to set visibility for with (for example)
24337 @code{#pragma GCC visibility push(hidden)} and
24338 @code{#pragma GCC visibility pop}.
24339 Bear in mind that symbol visibility should be viewed @strong{as
24340 part of the API interface contract} and thus all new code should
24341 always specify visibility when it is not the default; i.e., declarations
24342 only for use within the local DSO should @strong{always} be marked explicitly
24343 as hidden as so to avoid PLT indirection overheads---making this
24344 abundantly clear also aids readability and self-documentation of the code.
24345 Note that due to ISO C++ specification requirements, @code{operator new} and
24346 @code{operator delete} must always be of default visibility.
24347
24348 Be aware that headers from outside your project, in particular system
24349 headers and headers from any other library you use, may not be
24350 expecting to be compiled with visibility other than the default. You
24351 may need to explicitly say @code{#pragma GCC visibility push(default)}
24352 before including any such headers.
24353
24354 @code{extern} declarations are not affected by @option{-fvisibility}, so
24355 a lot of code can be recompiled with @option{-fvisibility=hidden} with
24356 no modifications. However, this means that calls to @code{extern}
24357 functions with no explicit visibility use the PLT, so it is more
24358 effective to use @code{__attribute ((visibility))} and/or
24359 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
24360 declarations should be treated as hidden.
24361
24362 Note that @option{-fvisibility} does affect C++ vague linkage
24363 entities. This means that, for instance, an exception class that is
24364 be thrown between DSOs must be explicitly marked with default
24365 visibility so that the @samp{type_info} nodes are unified between
24366 the DSOs.
24367
24368 An overview of these techniques, their benefits and how to use them
24369 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
24370
24371 @item -fstrict-volatile-bitfields
24372 @opindex fstrict-volatile-bitfields
24373 This option should be used if accesses to volatile bit-fields (or other
24374 structure fields, although the compiler usually honors those types
24375 anyway) should use a single access of the width of the
24376 field's type, aligned to a natural alignment if possible. For
24377 example, targets with memory-mapped peripheral registers might require
24378 all such accesses to be 16 bits wide; with this flag you can
24379 declare all peripheral bit-fields as @code{unsigned short} (assuming short
24380 is 16 bits on these targets) to force GCC to use 16-bit accesses
24381 instead of, perhaps, a more efficient 32-bit access.
24382
24383 If this option is disabled, the compiler uses the most efficient
24384 instruction. In the previous example, that might be a 32-bit load
24385 instruction, even though that accesses bytes that do not contain
24386 any portion of the bit-field, or memory-mapped registers unrelated to
24387 the one being updated.
24388
24389 In some cases, such as when the @code{packed} attribute is applied to a
24390 structure field, it may not be possible to access the field with a single
24391 read or write that is correctly aligned for the target machine. In this
24392 case GCC falls back to generating multiple accesses rather than code that
24393 will fault or truncate the result at run time.
24394
24395 Note: Due to restrictions of the C/C++11 memory model, write accesses are
24396 not allowed to touch non bit-field members. It is therefore recommended
24397 to define all bits of the field's type as bit-field members.
24398
24399 The default value of this option is determined by the application binary
24400 interface for the target processor.
24401
24402 @item -fsync-libcalls
24403 @opindex fsync-libcalls
24404 This option controls whether any out-of-line instance of the @code{__sync}
24405 family of functions may be used to implement the C++11 @code{__atomic}
24406 family of functions.
24407
24408 The default value of this option is enabled, thus the only useful form
24409 of the option is @option{-fno-sync-libcalls}. This option is used in
24410 the implementation of the @file{libatomic} runtime library.
24411
24412 @end table
24413
24414 @c man end
24415
24416 @node Environment Variables
24417 @section Environment Variables Affecting GCC
24418 @cindex environment variables
24419
24420 @c man begin ENVIRONMENT
24421 This section describes several environment variables that affect how GCC
24422 operates. Some of them work by specifying directories or prefixes to use
24423 when searching for various kinds of files. Some are used to specify other
24424 aspects of the compilation environment.
24425
24426 Note that you can also specify places to search using options such as
24427 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
24428 take precedence over places specified using environment variables, which
24429 in turn take precedence over those specified by the configuration of GCC@.
24430 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
24431 GNU Compiler Collection (GCC) Internals}.
24432
24433 @table @env
24434 @item LANG
24435 @itemx LC_CTYPE
24436 @c @itemx LC_COLLATE
24437 @itemx LC_MESSAGES
24438 @c @itemx LC_MONETARY
24439 @c @itemx LC_NUMERIC
24440 @c @itemx LC_TIME
24441 @itemx LC_ALL
24442 @findex LANG
24443 @findex LC_CTYPE
24444 @c @findex LC_COLLATE
24445 @findex LC_MESSAGES
24446 @c @findex LC_MONETARY
24447 @c @findex LC_NUMERIC
24448 @c @findex LC_TIME
24449 @findex LC_ALL
24450 @cindex locale
24451 These environment variables control the way that GCC uses
24452 localization information which allows GCC to work with different
24453 national conventions. GCC inspects the locale categories
24454 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
24455 so. These locale categories can be set to any value supported by your
24456 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
24457 Kingdom encoded in UTF-8.
24458
24459 The @env{LC_CTYPE} environment variable specifies character
24460 classification. GCC uses it to determine the character boundaries in
24461 a string; this is needed for some multibyte encodings that contain quote
24462 and escape characters that are otherwise interpreted as a string
24463 end or escape.
24464
24465 The @env{LC_MESSAGES} environment variable specifies the language to
24466 use in diagnostic messages.
24467
24468 If the @env{LC_ALL} environment variable is set, it overrides the value
24469 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
24470 and @env{LC_MESSAGES} default to the value of the @env{LANG}
24471 environment variable. If none of these variables are set, GCC
24472 defaults to traditional C English behavior.
24473
24474 @item TMPDIR
24475 @findex TMPDIR
24476 If @env{TMPDIR} is set, it specifies the directory to use for temporary
24477 files. GCC uses temporary files to hold the output of one stage of
24478 compilation which is to be used as input to the next stage: for example,
24479 the output of the preprocessor, which is the input to the compiler
24480 proper.
24481
24482 @item GCC_COMPARE_DEBUG
24483 @findex GCC_COMPARE_DEBUG
24484 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
24485 @option{-fcompare-debug} to the compiler driver. See the documentation
24486 of this option for more details.
24487
24488 @item GCC_EXEC_PREFIX
24489 @findex GCC_EXEC_PREFIX
24490 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
24491 names of the subprograms executed by the compiler. No slash is added
24492 when this prefix is combined with the name of a subprogram, but you can
24493 specify a prefix that ends with a slash if you wish.
24494
24495 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
24496 an appropriate prefix to use based on the pathname it is invoked with.
24497
24498 If GCC cannot find the subprogram using the specified prefix, it
24499 tries looking in the usual places for the subprogram.
24500
24501 The default value of @env{GCC_EXEC_PREFIX} is
24502 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
24503 the installed compiler. In many cases @var{prefix} is the value
24504 of @code{prefix} when you ran the @file{configure} script.
24505
24506 Other prefixes specified with @option{-B} take precedence over this prefix.
24507
24508 This prefix is also used for finding files such as @file{crt0.o} that are
24509 used for linking.
24510
24511 In addition, the prefix is used in an unusual way in finding the
24512 directories to search for header files. For each of the standard
24513 directories whose name normally begins with @samp{/usr/local/lib/gcc}
24514 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
24515 replacing that beginning with the specified prefix to produce an
24516 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
24517 @file{foo/bar} just before it searches the standard directory
24518 @file{/usr/local/lib/bar}.
24519 If a standard directory begins with the configured
24520 @var{prefix} then the value of @var{prefix} is replaced by
24521 @env{GCC_EXEC_PREFIX} when looking for header files.
24522
24523 @item COMPILER_PATH
24524 @findex COMPILER_PATH
24525 The value of @env{COMPILER_PATH} is a colon-separated list of
24526 directories, much like @env{PATH}. GCC tries the directories thus
24527 specified when searching for subprograms, if it can't find the
24528 subprograms using @env{GCC_EXEC_PREFIX}.
24529
24530 @item LIBRARY_PATH
24531 @findex LIBRARY_PATH
24532 The value of @env{LIBRARY_PATH} is a colon-separated list of
24533 directories, much like @env{PATH}. When configured as a native compiler,
24534 GCC tries the directories thus specified when searching for special
24535 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
24536 using GCC also uses these directories when searching for ordinary
24537 libraries for the @option{-l} option (but directories specified with
24538 @option{-L} come first).
24539
24540 @item LANG
24541 @findex LANG
24542 @cindex locale definition
24543 This variable is used to pass locale information to the compiler. One way in
24544 which this information is used is to determine the character set to be used
24545 when character literals, string literals and comments are parsed in C and C++.
24546 When the compiler is configured to allow multibyte characters,
24547 the following values for @env{LANG} are recognized:
24548
24549 @table @samp
24550 @item C-JIS
24551 Recognize JIS characters.
24552 @item C-SJIS
24553 Recognize SJIS characters.
24554 @item C-EUCJP
24555 Recognize EUCJP characters.
24556 @end table
24557
24558 If @env{LANG} is not defined, or if it has some other value, then the
24559 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
24560 recognize and translate multibyte characters.
24561 @end table
24562
24563 @noindent
24564 Some additional environment variables affect the behavior of the
24565 preprocessor.
24566
24567 @include cppenv.texi
24568
24569 @c man end
24570
24571 @node Precompiled Headers
24572 @section Using Precompiled Headers
24573 @cindex precompiled headers
24574 @cindex speed of compilation
24575
24576 Often large projects have many header files that are included in every
24577 source file. The time the compiler takes to process these header files
24578 over and over again can account for nearly all of the time required to
24579 build the project. To make builds faster, GCC allows you to
24580 @dfn{precompile} a header file.
24581
24582 To create a precompiled header file, simply compile it as you would any
24583 other file, if necessary using the @option{-x} option to make the driver
24584 treat it as a C or C++ header file. You may want to use a
24585 tool like @command{make} to keep the precompiled header up-to-date when
24586 the headers it contains change.
24587
24588 A precompiled header file is searched for when @code{#include} is
24589 seen in the compilation. As it searches for the included file
24590 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
24591 compiler looks for a precompiled header in each directory just before it
24592 looks for the include file in that directory. The name searched for is
24593 the name specified in the @code{#include} with @samp{.gch} appended. If
24594 the precompiled header file can't be used, it is ignored.
24595
24596 For instance, if you have @code{#include "all.h"}, and you have
24597 @file{all.h.gch} in the same directory as @file{all.h}, then the
24598 precompiled header file is used if possible, and the original
24599 header is used otherwise.
24600
24601 Alternatively, you might decide to put the precompiled header file in a
24602 directory and use @option{-I} to ensure that directory is searched
24603 before (or instead of) the directory containing the original header.
24604 Then, if you want to check that the precompiled header file is always
24605 used, you can put a file of the same name as the original header in this
24606 directory containing an @code{#error} command.
24607
24608 This also works with @option{-include}. So yet another way to use
24609 precompiled headers, good for projects not designed with precompiled
24610 header files in mind, is to simply take most of the header files used by
24611 a project, include them from another header file, precompile that header
24612 file, and @option{-include} the precompiled header. If the header files
24613 have guards against multiple inclusion, they are skipped because
24614 they've already been included (in the precompiled header).
24615
24616 If you need to precompile the same header file for different
24617 languages, targets, or compiler options, you can instead make a
24618 @emph{directory} named like @file{all.h.gch}, and put each precompiled
24619 header in the directory, perhaps using @option{-o}. It doesn't matter
24620 what you call the files in the directory; every precompiled header in
24621 the directory is considered. The first precompiled header
24622 encountered in the directory that is valid for this compilation is
24623 used; they're searched in no particular order.
24624
24625 There are many other possibilities, limited only by your imagination,
24626 good sense, and the constraints of your build system.
24627
24628 A precompiled header file can be used only when these conditions apply:
24629
24630 @itemize
24631 @item
24632 Only one precompiled header can be used in a particular compilation.
24633
24634 @item
24635 A precompiled header can't be used once the first C token is seen. You
24636 can have preprocessor directives before a precompiled header; you cannot
24637 include a precompiled header from inside another header.
24638
24639 @item
24640 The precompiled header file must be produced for the same language as
24641 the current compilation. You can't use a C precompiled header for a C++
24642 compilation.
24643
24644 @item
24645 The precompiled header file must have been produced by the same compiler
24646 binary as the current compilation is using.
24647
24648 @item
24649 Any macros defined before the precompiled header is included must
24650 either be defined in the same way as when the precompiled header was
24651 generated, or must not affect the precompiled header, which usually
24652 means that they don't appear in the precompiled header at all.
24653
24654 The @option{-D} option is one way to define a macro before a
24655 precompiled header is included; using a @code{#define} can also do it.
24656 There are also some options that define macros implicitly, like
24657 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
24658 defined this way.
24659
24660 @item If debugging information is output when using the precompiled
24661 header, using @option{-g} or similar, the same kind of debugging information
24662 must have been output when building the precompiled header. However,
24663 a precompiled header built using @option{-g} can be used in a compilation
24664 when no debugging information is being output.
24665
24666 @item The same @option{-m} options must generally be used when building
24667 and using the precompiled header. @xref{Submodel Options},
24668 for any cases where this rule is relaxed.
24669
24670 @item Each of the following options must be the same when building and using
24671 the precompiled header:
24672
24673 @gccoptlist{-fexceptions}
24674
24675 @item
24676 Some other command-line options starting with @option{-f},
24677 @option{-p}, or @option{-O} must be defined in the same way as when
24678 the precompiled header was generated. At present, it's not clear
24679 which options are safe to change and which are not; the safest choice
24680 is to use exactly the same options when generating and using the
24681 precompiled header. The following are known to be safe:
24682
24683 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
24684 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
24685 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
24686 -pedantic-errors}
24687
24688 @end itemize
24689
24690 For all of these except the last, the compiler automatically
24691 ignores the precompiled header if the conditions aren't met. If you
24692 find an option combination that doesn't work and doesn't cause the
24693 precompiled header to be ignored, please consider filing a bug report,
24694 see @ref{Bugs}.
24695
24696 If you do use differing options when generating and using the
24697 precompiled header, the actual behavior is a mixture of the
24698 behavior for the options. For instance, if you use @option{-g} to
24699 generate the precompiled header but not when using it, you may or may
24700 not get debugging information for routines in the precompiled header.