]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
* invoke.texi (inline-unit-growth): Increase growth to 20%
[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 * Language Independent Options:: Controlling how diagnostics should be
129 formatted.
130 * Warning Options:: How picky should the compiler be?
131 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
132 * Optimize Options:: How much optimization?
133 * Preprocessor Options:: Controlling header files and macro definitions.
134 Also, getting dependency information for Make.
135 * Assembler Options:: Passing options to the assembler.
136 * Link Options:: Specifying libraries and so on.
137 * Directory Options:: Where to find header files and libraries.
138 Where to find the compiler executable files.
139 * Spec Files:: How to pass switches to sub-processes.
140 * Target Options:: Running a cross-compiler, or an old version of GCC.
141 * Submodel Options:: Specifying minor hardware or convention variations,
142 such as 68010 vs 68020.
143 * Code Gen Options:: Specifying conventions for function calls, data layout
144 and register usage.
145 * Environment Variables:: Env vars that affect GCC.
146 * Precompiled Headers:: Compiling a header once, and using it many times.
147 @end menu
148
149 @c man begin OPTIONS
150
151 @node Option Summary
152 @section Option Summary
153
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 -Wnarrowing @gol
202 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
203 -Weffc++ -Wstrict-null-sentinel @gol
204 -Wno-non-template-friend -Wold-style-cast @gol
205 -Woverloaded-virtual -Wno-pmf-conversions @gol
206 -Wsign-promo}
207
208 @item Objective-C and Objective-C++ Language Options
209 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
210 Objective-C and Objective-C++ Dialects}.
211 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
212 -fgnu-runtime -fnext-runtime @gol
213 -fno-nil-receivers @gol
214 -fobjc-abi-version=@var{n} @gol
215 -fobjc-call-cxx-cdtors @gol
216 -fobjc-direct-dispatch @gol
217 -fobjc-exceptions @gol
218 -fobjc-gc @gol
219 -fobjc-nilcheck @gol
220 -fobjc-std=objc1 @gol
221 -fno-local-ivars @gol
222 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
223 -freplace-objc-classes @gol
224 -fzero-link @gol
225 -gen-decls @gol
226 -Wassign-intercept @gol
227 -Wno-protocol -Wselector @gol
228 -Wstrict-selector-match @gol
229 -Wundeclared-selector}
230
231 @item Language Independent Options
232 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
233 @gccoptlist{-fmessage-length=@var{n} @gol
234 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
235 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
236 -fno-diagnostics-show-option -fno-diagnostics-show-caret}
237
238 @item Warning Options
239 @xref{Warning Options,,Options to Request or Suppress Warnings}.
240 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
241 -pedantic-errors @gol
242 -w -Wextra -Wall -Waddress -Waggregate-return @gol
243 -Waggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
244 -Wbool-compare @gol
245 -Wno-attributes -Wno-builtin-macro-redefined @gol
246 -Wc90-c99-compat -Wc99-c11-compat @gol
247 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
248 -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
249 -Wconversion -Wcoverage-mismatch -Wdate-time -Wdelete-incomplete -Wno-cpp @gol
250 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
251 -Wdisabled-optimization @gol
252 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
253 -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
254 -Wno-endif-labels -Werror -Werror=* @gol
255 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
256 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
257 -Wformat-security -Wformat-signedness -Wformat-y2k @gol
258 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
259 -Wignored-qualifiers -Wincompatible-pointer-types @gol
260 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
261 -Winit-self -Winline -Wno-int-conversion @gol
262 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
263 -Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
264 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
265 -Wmain -Wmaybe-uninitialized -Wmemset-transposed-args -Wmissing-braces @gol
266 -Wmissing-field-initializers -Wmissing-include-dirs @gol
267 -Wno-multichar -Wnonnull -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
268 -Wodr -Wno-overflow -Wopenmp-simd @gol
269 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
270 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
271 -Wpointer-arith -Wno-pointer-to-int-cast @gol
272 -Wredundant-decls -Wno-return-local-addr @gol
273 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
274 -Wshift-count-negative -Wshift-count-overflow @gol
275 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
276 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
277 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
278 -Wstrict-aliasing=n @gol -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
279 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
280 -Wsuggest-final-types @gol -Wsuggest-final-methods @gol -Wsuggest-override @gol
281 -Wmissing-format-attribute @gol
282 -Wswitch -Wswitch-default -Wswitch-enum -Wswitch-bool -Wsync-nand @gol
283 -Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol
284 -Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol
285 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
286 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
287 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
288 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
289 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
290 -Wvla -Wvolatile-register-var -Wwrite-strings @gol
291 -Wzero-as-null-pointer-constant}
292
293 @item C and Objective-C-only Warning Options
294 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
295 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
296 -Wold-style-declaration -Wold-style-definition @gol
297 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
298 -Wdeclaration-after-statement -Wpointer-sign}
299
300 @item Debugging Options
301 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
302 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
303 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
304 -fasan-shadow-offset=@var{number} -fsanitize-undefined-trap-on-error @gol
305 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
306 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
307 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
308 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
309 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
310 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
311 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
312 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
313 -fchkp-use-wrappers @gol
314 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
315 -fdisable-ipa-@var{pass_name} @gol
316 -fdisable-rtl-@var{pass_name} @gol
317 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
318 -fdisable-tree-@var{pass_name} @gol
319 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
320 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
321 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
322 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
323 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
324 -fdump-passes @gol
325 -fdump-statistics @gol
326 -fdump-tree-all @gol
327 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
328 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
329 -fdump-tree-cfg -fdump-tree-alias @gol
330 -fdump-tree-ch @gol
331 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
332 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
333 -fdump-tree-gimple@r{[}-raw@r{]} @gol
334 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
335 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
336 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
337 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
338 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
339 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
340 -fdump-tree-nrv -fdump-tree-vect @gol
341 -fdump-tree-sink @gol
342 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
343 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
344 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
345 -fdump-tree-vtable-verify @gol
346 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
347 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
348 -fdump-final-insns=@var{file} @gol
349 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
350 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
351 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
352 -fenable-@var{kind}-@var{pass} @gol
353 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
354 -fdebug-types-section -fmem-report-wpa @gol
355 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
356 -fopt-info @gol
357 -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
358 -frandom-seed=@var{number} -fsched-verbose=@var{n} @gol
359 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
360 -fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol
361 -fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol
362 -g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
363 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
364 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
365 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
366 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
367 -fdebug-prefix-map=@var{old}=@var{new} @gol
368 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
369 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
370 -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
371 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
372 -print-prog-name=@var{program} -print-search-dirs -Q @gol
373 -print-sysroot -print-sysroot-headers-suffix @gol
374 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
375
376 @item Optimization Options
377 @xref{Optimize Options,,Options that Control Optimization}.
378 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
379 -falign-jumps[=@var{n}] @gol
380 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
381 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
382 -fauto-inc-dec -fbranch-probabilities @gol
383 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
384 -fbtr-bb-exclusive -fcaller-saves @gol
385 -fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
386 -fcompare-elim -fcprop-registers -fcrossjumping @gol
387 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
388 -fcx-limited-range @gol
389 -fdata-sections -fdce -fdelayed-branch @gol
390 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
391 -fdevirtualize-at-ltrans -fdse @gol
392 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
393 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
394 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
395 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
396 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
397 -fif-conversion2 -findirect-inlining @gol
398 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
399 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment @gol
400 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
401 -fira-algorithm=@var{algorithm} @gol
402 -fira-region=@var{region} -fira-hoist-pressure @gol
403 -fira-loop-pressure -fno-ira-share-save-slots @gol
404 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
405 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
406 -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
407 -flive-range-shrinkage @gol
408 -floop-block -floop-interchange -floop-strip-mine @gol
409 -floop-unroll-and-jam -floop-nest-optimize @gol
410 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
411 -flto-partition=@var{alg} -flto-report -flto-report-wpa -fmerge-all-constants @gol
412 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
413 -fmove-loop-invariants -fno-branch-count-reg @gol
414 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
415 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
416 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
417 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
418 -fomit-frame-pointer -foptimize-sibling-calls @gol
419 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
420 -fprefetch-loop-arrays -fprofile-report @gol
421 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
422 -fprofile-generate=@var{path} @gol
423 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
424 -fprofile-reorder-functions @gol
425 -freciprocal-math -free -frename-registers -freorder-blocks @gol
426 -freorder-blocks-and-partition -freorder-functions @gol
427 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
428 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
429 -fsched-spec-load -fsched-spec-load-dangerous @gol
430 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
431 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
432 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
433 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
434 -fschedule-fusion @gol
435 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
436 -fselective-scheduling -fselective-scheduling2 @gol
437 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
438 -fsemantic-interposition @gol
439 -fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol
440 -fsplit-ivs-in-unroller -fsplit-wide-types -fssa-phiopt @gol
441 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
442 -fstack-protector-explicit -fstdarg-opt -fstrict-aliasing @gol
443 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
444 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
445 -ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol
446 -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
447 -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
448 -ftree-loop-if-convert-stores -ftree-loop-im @gol
449 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
450 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
451 -ftree-loop-vectorize @gol
452 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
453 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
454 -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
455 -ftree-vectorize -ftree-vrp @gol
456 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
457 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
458 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
459 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
460 --param @var{name}=@var{value}
461 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
462
463 @item Preprocessor Options
464 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
465 @gccoptlist{-A@var{question}=@var{answer} @gol
466 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
467 -C -dD -dI -dM -dN @gol
468 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
469 -idirafter @var{dir} @gol
470 -include @var{file} -imacros @var{file} @gol
471 -iprefix @var{file} -iwithprefix @var{dir} @gol
472 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
473 -imultilib @var{dir} -isysroot @var{dir} @gol
474 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
475 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
476 -remap -trigraphs -undef -U@var{macro} @gol
477 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
478
479 @item Assembler Option
480 @xref{Assembler Options,,Passing Options to the Assembler}.
481 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
482
483 @item Linker Options
484 @xref{Link Options,,Options for Linking}.
485 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
486 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
487 -s -static -static-libgcc -static-libstdc++ @gol
488 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
489 -static-libmpx -static-libmpxwrappers @gol
490 -shared -shared-libgcc -symbolic @gol
491 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
492 -u @var{symbol} -z @var{keyword}}
493
494 @item Directory Options
495 @xref{Directory Options,,Options for Directory Search}.
496 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
497 -iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
498 --sysroot=@var{dir} --no-sysroot-suffix}
499
500 @item Machine Dependent Options
501 @xref{Submodel Options,,Hardware Models and Configurations}.
502 @c This list is ordered alphanumerically by subsection name.
503 @c Try and put the significant identifier (CPU or system) first,
504 @c so users have a clue at guessing where the ones they want will be.
505
506 @emph{AArch64 Options}
507 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
508 -mgeneral-regs-only @gol
509 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
510 -mstrict-align @gol
511 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
512 -mtls-dialect=desc -mtls-dialect=traditional @gol
513 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
514 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
515
516 @emph{Adapteva Epiphany Options}
517 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
518 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
519 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
520 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
521 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
522 -msplit-vecmove-early -m1reg-@var{reg}}
523
524 @emph{ARC Options}
525 @gccoptlist{-mbarrel-shifter @gol
526 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
527 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
528 -mea -mno-mpy -mmul32x16 -mmul64 @gol
529 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
530 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
531 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
532 -mepilogue-cfi -mlong-calls -mmedium-calls -msdata @gol
533 -mucb-mcount -mvolatile-cache @gol
534 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
535 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
536 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
537 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
538 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
539 -mtune=@var{cpu} -mmultcost=@var{num} -munalign-prob-threshold=@var{probability}}
540
541 @emph{ARM Options}
542 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
543 -mabi=@var{name} @gol
544 -mapcs-stack-check -mno-apcs-stack-check @gol
545 -mapcs-float -mno-apcs-float @gol
546 -mapcs-reentrant -mno-apcs-reentrant @gol
547 -msched-prolog -mno-sched-prolog @gol
548 -mlittle-endian -mbig-endian @gol
549 -mfloat-abi=@var{name} @gol
550 -mfp16-format=@var{name}
551 -mthumb-interwork -mno-thumb-interwork @gol
552 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
553 -mtune=@var{name} -mprint-tune-info @gol
554 -mstructure-size-boundary=@var{n} @gol
555 -mabort-on-noreturn @gol
556 -mlong-calls -mno-long-calls @gol
557 -msingle-pic-base -mno-single-pic-base @gol
558 -mpic-register=@var{reg} @gol
559 -mnop-fun-dllimport @gol
560 -mpoke-function-name @gol
561 -mthumb -marm @gol
562 -mtpcs-frame -mtpcs-leaf-frame @gol
563 -mcaller-super-interworking -mcallee-super-interworking @gol
564 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
565 -mword-relocations @gol
566 -mfix-cortex-m3-ldrd @gol
567 -munaligned-access @gol
568 -mneon-for-64bits @gol
569 -mslow-flash-data @gol
570 -masm-syntax-unified @gol
571 -mrestrict-it}
572
573 @emph{AVR Options}
574 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
575 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
576 -mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert}
577
578 @emph{Blackfin Options}
579 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
580 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
581 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
582 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
583 -mno-id-shared-library -mshared-library-id=@var{n} @gol
584 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
585 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
586 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
587 -micplb}
588
589 @emph{C6X Options}
590 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
591 -msim -msdata=@var{sdata-type}}
592
593 @emph{CRIS Options}
594 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
595 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
596 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
597 -mstack-align -mdata-align -mconst-align @gol
598 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
599 -melf -maout -melinux -mlinux -sim -sim2 @gol
600 -mmul-bug-workaround -mno-mul-bug-workaround}
601
602 @emph{CR16 Options}
603 @gccoptlist{-mmac @gol
604 -mcr16cplus -mcr16c @gol
605 -msim -mint32 -mbit-ops
606 -mdata-model=@var{model}}
607
608 @emph{Darwin Options}
609 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
610 -arch_only -bind_at_load -bundle -bundle_loader @gol
611 -client_name -compatibility_version -current_version @gol
612 -dead_strip @gol
613 -dependency-file -dylib_file -dylinker_install_name @gol
614 -dynamic -dynamiclib -exported_symbols_list @gol
615 -filelist -flat_namespace -force_cpusubtype_ALL @gol
616 -force_flat_namespace -headerpad_max_install_names @gol
617 -iframework @gol
618 -image_base -init -install_name -keep_private_externs @gol
619 -multi_module -multiply_defined -multiply_defined_unused @gol
620 -noall_load -no_dead_strip_inits_and_terms @gol
621 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
622 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
623 -private_bundle -read_only_relocs -sectalign @gol
624 -sectobjectsymbols -whyload -seg1addr @gol
625 -sectcreate -sectobjectsymbols -sectorder @gol
626 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
627 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
628 -segprot -segs_read_only_addr -segs_read_write_addr @gol
629 -single_module -static -sub_library -sub_umbrella @gol
630 -twolevel_namespace -umbrella -undefined @gol
631 -unexported_symbols_list -weak_reference_mismatches @gol
632 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
633 -mkernel -mone-byte-bool}
634
635 @emph{DEC Alpha Options}
636 @gccoptlist{-mno-fp-regs -msoft-float @gol
637 -mieee -mieee-with-inexact -mieee-conformant @gol
638 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
639 -mtrap-precision=@var{mode} -mbuild-constants @gol
640 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
641 -mbwx -mmax -mfix -mcix @gol
642 -mfloat-vax -mfloat-ieee @gol
643 -mexplicit-relocs -msmall-data -mlarge-data @gol
644 -msmall-text -mlarge-text @gol
645 -mmemory-latency=@var{time}}
646
647 @emph{FR30 Options}
648 @gccoptlist{-msmall-model -mno-lsim}
649
650 @emph{FRV Options}
651 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
652 -mhard-float -msoft-float @gol
653 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
654 -mdouble -mno-double @gol
655 -mmedia -mno-media -mmuladd -mno-muladd @gol
656 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
657 -mlinked-fp -mlong-calls -malign-labels @gol
658 -mlibrary-pic -macc-4 -macc-8 @gol
659 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
660 -moptimize-membar -mno-optimize-membar @gol
661 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
662 -mvliw-branch -mno-vliw-branch @gol
663 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
664 -mno-nested-cond-exec -mtomcat-stats @gol
665 -mTLS -mtls @gol
666 -mcpu=@var{cpu}}
667
668 @emph{GNU/Linux Options}
669 @gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
670 -tno-android-cc -tno-android-ld}
671
672 @emph{H8/300 Options}
673 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
674
675 @emph{HPPA Options}
676 @gccoptlist{-march=@var{architecture-type} @gol
677 -mdisable-fpregs -mdisable-indexing @gol
678 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
679 -mfixed-range=@var{register-range} @gol
680 -mjump-in-delay -mlinker-opt -mlong-calls @gol
681 -mlong-load-store -mno-disable-fpregs @gol
682 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
683 -mno-jump-in-delay -mno-long-load-store @gol
684 -mno-portable-runtime -mno-soft-float @gol
685 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
686 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
687 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
688 -munix=@var{unix-std} -nolibdld -static -threads}
689
690 @emph{IA-64 Options}
691 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
692 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
693 -mconstant-gp -mauto-pic -mfused-madd @gol
694 -minline-float-divide-min-latency @gol
695 -minline-float-divide-max-throughput @gol
696 -mno-inline-float-divide @gol
697 -minline-int-divide-min-latency @gol
698 -minline-int-divide-max-throughput @gol
699 -mno-inline-int-divide @gol
700 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
701 -mno-inline-sqrt @gol
702 -mdwarf2-asm -mearly-stop-bits @gol
703 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
704 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
705 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
706 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
707 -msched-spec-ldc -msched-spec-control-ldc @gol
708 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
709 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
710 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
711 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
712
713 @emph{LM32 Options}
714 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
715 -msign-extend-enabled -muser-enabled}
716
717 @emph{M32R/D Options}
718 @gccoptlist{-m32r2 -m32rx -m32r @gol
719 -mdebug @gol
720 -malign-loops -mno-align-loops @gol
721 -missue-rate=@var{number} @gol
722 -mbranch-cost=@var{number} @gol
723 -mmodel=@var{code-size-model-type} @gol
724 -msdata=@var{sdata-type} @gol
725 -mno-flush-func -mflush-func=@var{name} @gol
726 -mno-flush-trap -mflush-trap=@var{number} @gol
727 -G @var{num}}
728
729 @emph{M32C Options}
730 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
731
732 @emph{M680x0 Options}
733 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
734 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
735 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
736 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
737 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
738 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
739 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
740 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
741 -mxgot -mno-xgot}
742
743 @emph{MCore Options}
744 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
745 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
746 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
747 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
748 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
749
750 @emph{MeP Options}
751 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
752 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
753 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
754 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
755 -mtiny=@var{n}}
756
757 @emph{MicroBlaze Options}
758 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
759 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
760 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
761 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
762 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
763
764 @emph{MIPS Options}
765 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
766 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
767 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
768 -mips16 -mno-mips16 -mflip-mips16 @gol
769 -minterlink-compressed -mno-interlink-compressed @gol
770 -minterlink-mips16 -mno-interlink-mips16 @gol
771 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
772 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
773 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
774 -mno-float -msingle-float -mdouble-float @gol
775 -modd-spreg -mno-odd-spreg @gol
776 -mabs=@var{mode} -mnan=@var{encoding} @gol
777 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
778 -mmcu -mmno-mcu @gol
779 -meva -mno-eva @gol
780 -mvirt -mno-virt @gol
781 -mxpa -mno-xpa @gol
782 -mmicromips -mno-micromips @gol
783 -mfpu=@var{fpu-type} @gol
784 -msmartmips -mno-smartmips @gol
785 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
786 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
787 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
788 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
789 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
790 -membedded-data -mno-embedded-data @gol
791 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
792 -mcode-readable=@var{setting} @gol
793 -msplit-addresses -mno-split-addresses @gol
794 -mexplicit-relocs -mno-explicit-relocs @gol
795 -mcheck-zero-division -mno-check-zero-division @gol
796 -mdivide-traps -mdivide-breaks @gol
797 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
798 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
799 -mfix-24k -mno-fix-24k @gol
800 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
801 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
802 -mfix-vr4120 -mno-fix-vr4120 @gol
803 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
804 -mflush-func=@var{func} -mno-flush-func @gol
805 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
806 -mfp-exceptions -mno-fp-exceptions @gol
807 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
808 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
809
810 @emph{MMIX Options}
811 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
812 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
813 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
814 -mno-base-addresses -msingle-exit -mno-single-exit}
815
816 @emph{MN10300 Options}
817 @gccoptlist{-mmult-bug -mno-mult-bug @gol
818 -mno-am33 -mam33 -mam33-2 -mam34 @gol
819 -mtune=@var{cpu-type} @gol
820 -mreturn-pointer-on-d0 @gol
821 -mno-crt0 -mrelax -mliw -msetlb}
822
823 @emph{Moxie Options}
824 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
825
826 @emph{MSP430 Options}
827 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
828 -mhwmult= -minrt}
829
830 @emph{NDS32 Options}
831 @gccoptlist{-mbig-endian -mlittle-endian @gol
832 -mreduced-regs -mfull-regs @gol
833 -mcmov -mno-cmov @gol
834 -mperf-ext -mno-perf-ext @gol
835 -mv3push -mno-v3push @gol
836 -m16bit -mno-16bit @gol
837 -misr-vector-size=@var{num} @gol
838 -mcache-block-size=@var{num} @gol
839 -march=@var{arch} @gol
840 -mcmodel=@var{code-model} @gol
841 -mctor-dtor -mrelax}
842
843 @emph{Nios II Options}
844 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
845 -mel -meb @gol
846 -mno-bypass-cache -mbypass-cache @gol
847 -mno-cache-volatile -mcache-volatile @gol
848 -mno-fast-sw-div -mfast-sw-div @gol
849 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
850 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
851 -mcustom-fpu-cfg=@var{name} @gol
852 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name}}
853
854 @emph{Nvidia PTX Options}
855 @gccoptlist{-m32 -m64 -mmainkernel}
856
857 @emph{PDP-11 Options}
858 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
859 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
860 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
861 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
862 -mbranch-expensive -mbranch-cheap @gol
863 -munix-asm -mdec-asm}
864
865 @emph{picoChip Options}
866 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
867 -msymbol-as-address -mno-inefficient-warnings}
868
869 @emph{PowerPC Options}
870 See RS/6000 and PowerPC Options.
871
872 @emph{RL78 Options}
873 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78 @gol
874 -m64bit-doubles -m32bit-doubles}
875
876 @emph{RS/6000 and PowerPC Options}
877 @gccoptlist{-mcpu=@var{cpu-type} @gol
878 -mtune=@var{cpu-type} @gol
879 -mcmodel=@var{code-model} @gol
880 -mpowerpc64 @gol
881 -maltivec -mno-altivec @gol
882 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
883 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
884 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
885 -mfprnd -mno-fprnd @gol
886 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
887 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
888 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
889 -malign-power -malign-natural @gol
890 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
891 -msingle-float -mdouble-float -msimple-fpu @gol
892 -mstring -mno-string -mupdate -mno-update @gol
893 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
894 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
895 -mstrict-align -mno-strict-align -mrelocatable @gol
896 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
897 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
898 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
899 -mprioritize-restricted-insns=@var{priority} @gol
900 -msched-costly-dep=@var{dependence_type} @gol
901 -minsert-sched-nops=@var{scheme} @gol
902 -mcall-sysv -mcall-netbsd @gol
903 -maix-struct-return -msvr4-struct-return @gol
904 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
905 -mblock-move-inline-limit=@var{num} @gol
906 -misel -mno-isel @gol
907 -misel=yes -misel=no @gol
908 -mspe -mno-spe @gol
909 -mspe=yes -mspe=no @gol
910 -mpaired @gol
911 -mgen-cell-microcode -mwarn-cell-microcode @gol
912 -mvrsave -mno-vrsave @gol
913 -mmulhw -mno-mulhw @gol
914 -mdlmzb -mno-dlmzb @gol
915 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
916 -mprototype -mno-prototype @gol
917 -msim -mmvme -mads -myellowknife -memb -msdata @gol
918 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
919 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
920 -mno-recip-precision @gol
921 -mveclibabi=@var{type} -mfriz -mno-friz @gol
922 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
923 -msave-toc-indirect -mno-save-toc-indirect @gol
924 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
925 -mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol
926 -mquad-memory -mno-quad-memory @gol
927 -mquad-memory-atomic -mno-quad-memory-atomic @gol
928 -mcompat-align-parm -mno-compat-align-parm @gol
929 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
930 -mupper-regs -mno-upper-regs}
931
932 @emph{RX Options}
933 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
934 -mcpu=@gol
935 -mbig-endian-data -mlittle-endian-data @gol
936 -msmall-data @gol
937 -msim -mno-sim@gol
938 -mas100-syntax -mno-as100-syntax@gol
939 -mrelax@gol
940 -mmax-constant-size=@gol
941 -mint-register=@gol
942 -mpid@gol
943 -mno-warn-multiple-fast-interrupts@gol
944 -msave-acc-in-interrupts}
945
946 @emph{S/390 and zSeries Options}
947 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
948 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
949 -mlong-double-64 -mlong-double-128 @gol
950 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
951 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
952 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
953 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
954 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
955 -mhotpatch=@var{halfwords},@var{halfwords}}
956
957 @emph{Score Options}
958 @gccoptlist{-meb -mel @gol
959 -mnhwloop @gol
960 -muls @gol
961 -mmac @gol
962 -mscore5 -mscore5u -mscore7 -mscore7d}
963
964 @emph{SH Options}
965 @gccoptlist{-m1 -m2 -m2e @gol
966 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
967 -m3 -m3e @gol
968 -m4-nofpu -m4-single-only -m4-single -m4 @gol
969 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
970 -m5-64media -m5-64media-nofpu @gol
971 -m5-32media -m5-32media-nofpu @gol
972 -m5-compact -m5-compact-nofpu @gol
973 -mb -ml -mdalign -mrelax @gol
974 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
975 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
976 -mspace -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
977 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
978 -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
979 -maccumulate-outgoing-args -minvalid-symbols @gol
980 -matomic-model=@var{atomic-model} @gol
981 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
982 -mcbranch-force-delay-slot @gol
983 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
984 -mpretend-cmove -mtas}
985
986 @emph{Solaris 2 Options}
987 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
988 -pthreads -pthread}
989
990 @emph{SPARC Options}
991 @gccoptlist{-mcpu=@var{cpu-type} @gol
992 -mtune=@var{cpu-type} @gol
993 -mcmodel=@var{code-model} @gol
994 -mmemory-model=@var{mem-model} @gol
995 -m32 -m64 -mapp-regs -mno-app-regs @gol
996 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
997 -mfpu -mno-fpu -mhard-float -msoft-float @gol
998 -mhard-quad-float -msoft-quad-float @gol
999 -mstack-bias -mno-stack-bias @gol
1000 -munaligned-doubles -mno-unaligned-doubles @gol
1001 -muser-mode -mno-user-mode @gol
1002 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1003 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1004 -mcbcond -mno-cbcond @gol
1005 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
1006 -mfix-at697f -mfix-ut699}
1007
1008 @emph{SPU Options}
1009 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1010 -msafe-dma -munsafe-dma @gol
1011 -mbranch-hints @gol
1012 -msmall-mem -mlarge-mem -mstdmain @gol
1013 -mfixed-range=@var{register-range} @gol
1014 -mea32 -mea64 @gol
1015 -maddress-space-conversion -mno-address-space-conversion @gol
1016 -mcache-size=@var{cache-size} @gol
1017 -matomic-updates -mno-atomic-updates}
1018
1019 @emph{System V Options}
1020 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1021
1022 @emph{TILE-Gx Options}
1023 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1024 -mcmodel=@var{code-model}}
1025
1026 @emph{TILEPro Options}
1027 @gccoptlist{-mcpu=@var{cpu} -m32}
1028
1029 @emph{V850 Options}
1030 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1031 -mprolog-function -mno-prolog-function -mspace @gol
1032 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1033 -mapp-regs -mno-app-regs @gol
1034 -mdisable-callt -mno-disable-callt @gol
1035 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1036 -mv850e -mv850 -mv850e3v5 @gol
1037 -mloop @gol
1038 -mrelax @gol
1039 -mlong-jumps @gol
1040 -msoft-float @gol
1041 -mhard-float @gol
1042 -mgcc-abi @gol
1043 -mrh850-abi @gol
1044 -mbig-switch}
1045
1046 @emph{VAX Options}
1047 @gccoptlist{-mg -mgnu -munix}
1048
1049 @emph{Visium Options}
1050 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1051 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1052
1053 @emph{VMS Options}
1054 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1055 -mpointer-size=@var{size}}
1056
1057 @emph{VxWorks Options}
1058 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1059 -Xbind-lazy -Xbind-now}
1060
1061 @emph{x86 Options}
1062 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1063 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1064 -mfpmath=@var{unit} @gol
1065 -masm=@var{dialect} -mno-fancy-math-387 @gol
1066 -mno-fp-ret-in-387 -msoft-float @gol
1067 -mno-wide-multiply -mrtd -malign-double @gol
1068 -mpreferred-stack-boundary=@var{num} @gol
1069 -mincoming-stack-boundary=@var{num} @gol
1070 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1071 -mrecip -mrecip=@var{opt} @gol
1072 -mvzeroupper -mprefer-avx128 @gol
1073 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1074 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -msha @gol
1075 -maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mprefetchwt1 @gol
1076 -mclflushopt -mxsavec -mxsaves @gol
1077 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
1078 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mthreads @gol
1079 -mno-align-stringops -minline-all-stringops @gol
1080 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1081 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1082 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1083 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1084 -mregparm=@var{num} -msseregparm @gol
1085 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1086 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1087 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1088 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1089 -m32 -m64 -mx32 -m16 -mlarge-data-threshold=@var{num} @gol
1090 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1091 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1092 -malign-data=@var{type} -mstack-protector-guard=@var{guard}}
1093
1094 @emph{x86 Windows Options}
1095 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1096 -mnop-fun-dllimport -mthread @gol
1097 -municode -mwin32 -mwindows -fno-set-stack-executable}
1098
1099 @emph{Xstormy16 Options}
1100 @gccoptlist{-msim}
1101
1102 @emph{Xtensa Options}
1103 @gccoptlist{-mconst16 -mno-const16 @gol
1104 -mfused-madd -mno-fused-madd @gol
1105 -mforce-no-pic @gol
1106 -mserialize-volatile -mno-serialize-volatile @gol
1107 -mtext-section-literals -mno-text-section-literals @gol
1108 -mtarget-align -mno-target-align @gol
1109 -mlongcalls -mno-longcalls}
1110
1111 @emph{zSeries Options}
1112 See S/390 and zSeries Options.
1113
1114 @item Code Generation Options
1115 @xref{Code Gen Options,,Options for Code Generation Conventions}.
1116 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
1117 -ffixed-@var{reg} -fexceptions @gol
1118 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
1119 -fasynchronous-unwind-tables @gol
1120 -fno-gnu-unique @gol
1121 -finhibit-size-directive -finstrument-functions @gol
1122 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
1123 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
1124 -fno-common -fno-ident @gol
1125 -fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
1126 -fno-jump-tables @gol
1127 -frecord-gcc-switches @gol
1128 -freg-struct-return -fshort-enums @gol
1129 -fshort-double -fshort-wchar @gol
1130 -fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
1131 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
1132 -fno-stack-limit -fsplit-stack @gol
1133 -fleading-underscore -ftls-model=@var{model} @gol
1134 -fstack-reuse=@var{reuse_level} @gol
1135 -ftrapv -fwrapv -fbounds-check @gol
1136 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
1137 -fstrict-volatile-bitfields -fsync-libcalls}
1138 @end table
1139
1140
1141 @node Overall Options
1142 @section Options Controlling the Kind of Output
1143
1144 Compilation can involve up to four stages: preprocessing, compilation
1145 proper, assembly and linking, always in that order. GCC is capable of
1146 preprocessing and compiling several files either into several
1147 assembler input files, or into one assembler input file; then each
1148 assembler input file produces an object file, and linking combines all
1149 the object files (those newly compiled, and those specified as input)
1150 into an executable file.
1151
1152 @cindex file name suffix
1153 For any given input file, the file name suffix determines what kind of
1154 compilation is done:
1155
1156 @table @gcctabopt
1157 @item @var{file}.c
1158 C source code that must be preprocessed.
1159
1160 @item @var{file}.i
1161 C source code that should not be preprocessed.
1162
1163 @item @var{file}.ii
1164 C++ source code that should not be preprocessed.
1165
1166 @item @var{file}.m
1167 Objective-C source code. Note that you must link with the @file{libobjc}
1168 library to make an Objective-C program work.
1169
1170 @item @var{file}.mi
1171 Objective-C source code that should not be preprocessed.
1172
1173 @item @var{file}.mm
1174 @itemx @var{file}.M
1175 Objective-C++ source code. Note that you must link with the @file{libobjc}
1176 library to make an Objective-C++ program work. Note that @samp{.M} refers
1177 to a literal capital M@.
1178
1179 @item @var{file}.mii
1180 Objective-C++ source code that should not be preprocessed.
1181
1182 @item @var{file}.h
1183 C, C++, Objective-C or Objective-C++ header file to be turned into a
1184 precompiled header (default), or C, C++ header file to be turned into an
1185 Ada spec (via the @option{-fdump-ada-spec} switch).
1186
1187 @item @var{file}.cc
1188 @itemx @var{file}.cp
1189 @itemx @var{file}.cxx
1190 @itemx @var{file}.cpp
1191 @itemx @var{file}.CPP
1192 @itemx @var{file}.c++
1193 @itemx @var{file}.C
1194 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1195 the last two letters must both be literally @samp{x}. Likewise,
1196 @samp{.C} refers to a literal capital C@.
1197
1198 @item @var{file}.mm
1199 @itemx @var{file}.M
1200 Objective-C++ source code that must be preprocessed.
1201
1202 @item @var{file}.mii
1203 Objective-C++ source code that should not be preprocessed.
1204
1205 @item @var{file}.hh
1206 @itemx @var{file}.H
1207 @itemx @var{file}.hp
1208 @itemx @var{file}.hxx
1209 @itemx @var{file}.hpp
1210 @itemx @var{file}.HPP
1211 @itemx @var{file}.h++
1212 @itemx @var{file}.tcc
1213 C++ header file to be turned into a precompiled header or Ada spec.
1214
1215 @item @var{file}.f
1216 @itemx @var{file}.for
1217 @itemx @var{file}.ftn
1218 Fixed form Fortran source code that should not be preprocessed.
1219
1220 @item @var{file}.F
1221 @itemx @var{file}.FOR
1222 @itemx @var{file}.fpp
1223 @itemx @var{file}.FPP
1224 @itemx @var{file}.FTN
1225 Fixed form Fortran source code that must be preprocessed (with the traditional
1226 preprocessor).
1227
1228 @item @var{file}.f90
1229 @itemx @var{file}.f95
1230 @itemx @var{file}.f03
1231 @itemx @var{file}.f08
1232 Free form Fortran source code that should not be preprocessed.
1233
1234 @item @var{file}.F90
1235 @itemx @var{file}.F95
1236 @itemx @var{file}.F03
1237 @itemx @var{file}.F08
1238 Free form Fortran source code that must be preprocessed (with the
1239 traditional preprocessor).
1240
1241 @item @var{file}.go
1242 Go source code.
1243
1244 @c FIXME: Descriptions of Java file types.
1245 @c @var{file}.java
1246 @c @var{file}.class
1247 @c @var{file}.zip
1248 @c @var{file}.jar
1249
1250 @item @var{file}.ads
1251 Ada source code file that contains a library unit declaration (a
1252 declaration of a package, subprogram, or generic, or a generic
1253 instantiation), or a library unit renaming declaration (a package,
1254 generic, or subprogram renaming declaration). Such files are also
1255 called @dfn{specs}.
1256
1257 @item @var{file}.adb
1258 Ada source code file containing a library unit body (a subprogram or
1259 package body). Such files are also called @dfn{bodies}.
1260
1261 @c GCC also knows about some suffixes for languages not yet included:
1262 @c Pascal:
1263 @c @var{file}.p
1264 @c @var{file}.pas
1265 @c Ratfor:
1266 @c @var{file}.r
1267
1268 @item @var{file}.s
1269 Assembler code.
1270
1271 @item @var{file}.S
1272 @itemx @var{file}.sx
1273 Assembler code that must be preprocessed.
1274
1275 @item @var{other}
1276 An object file to be fed straight into linking.
1277 Any file name with no recognized suffix is treated this way.
1278 @end table
1279
1280 @opindex x
1281 You can specify the input language explicitly with the @option{-x} option:
1282
1283 @table @gcctabopt
1284 @item -x @var{language}
1285 Specify explicitly the @var{language} for the following input files
1286 (rather than letting the compiler choose a default based on the file
1287 name suffix). This option applies to all following input files until
1288 the next @option{-x} option. Possible values for @var{language} are:
1289 @smallexample
1290 c c-header cpp-output
1291 c++ c++-header c++-cpp-output
1292 objective-c objective-c-header objective-c-cpp-output
1293 objective-c++ objective-c++-header objective-c++-cpp-output
1294 assembler assembler-with-cpp
1295 ada
1296 f77 f77-cpp-input f95 f95-cpp-input
1297 go
1298 java
1299 @end smallexample
1300
1301 @item -x none
1302 Turn off any specification of a language, so that subsequent files are
1303 handled according to their file name suffixes (as they are if @option{-x}
1304 has not been used at all).
1305
1306 @item -pass-exit-codes
1307 @opindex pass-exit-codes
1308 Normally the @command{gcc} program exits with the code of 1 if any
1309 phase of the compiler returns a non-success return code. If you specify
1310 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1311 the numerically highest error produced by any phase returning an error
1312 indication. The C, C++, and Fortran front ends return 4 if an internal
1313 compiler error is encountered.
1314 @end table
1315
1316 If you only want some of the stages of compilation, you can use
1317 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1318 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1319 @command{gcc} is to stop. Note that some combinations (for example,
1320 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1321
1322 @table @gcctabopt
1323 @item -c
1324 @opindex c
1325 Compile or assemble the source files, but do not link. The linking
1326 stage simply is not done. The ultimate output is in the form of an
1327 object file for each source file.
1328
1329 By default, the object file name for a source file is made by replacing
1330 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1331
1332 Unrecognized input files, not requiring compilation or assembly, are
1333 ignored.
1334
1335 @item -S
1336 @opindex S
1337 Stop after the stage of compilation proper; do not assemble. The output
1338 is in the form of an assembler code file for each non-assembler input
1339 file specified.
1340
1341 By default, the assembler file name for a source file is made by
1342 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1343
1344 Input files that don't require compilation are ignored.
1345
1346 @item -E
1347 @opindex E
1348 Stop after the preprocessing stage; do not run the compiler proper. The
1349 output is in the form of preprocessed source code, which is sent to the
1350 standard output.
1351
1352 Input files that don't require preprocessing are ignored.
1353
1354 @cindex output file option
1355 @item -o @var{file}
1356 @opindex o
1357 Place output in file @var{file}. This applies to whatever
1358 sort of output is being produced, whether it be an executable file,
1359 an object file, an assembler file or preprocessed C code.
1360
1361 If @option{-o} is not specified, the default is to put an executable
1362 file in @file{a.out}, the object file for
1363 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1364 assembler file in @file{@var{source}.s}, a precompiled header file in
1365 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1366 standard output.
1367
1368 @item -v
1369 @opindex v
1370 Print (on standard error output) the commands executed to run the stages
1371 of compilation. Also print the version number of the compiler driver
1372 program and of the preprocessor and the compiler proper.
1373
1374 @item -###
1375 @opindex ###
1376 Like @option{-v} except the commands are not executed and arguments
1377 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1378 This is useful for shell scripts to capture the driver-generated command lines.
1379
1380 @item -pipe
1381 @opindex pipe
1382 Use pipes rather than temporary files for communication between the
1383 various stages of compilation. This fails to work on some systems where
1384 the assembler is unable to read from a pipe; but the GNU assembler has
1385 no trouble.
1386
1387 @item --help
1388 @opindex help
1389 Print (on the standard output) a description of the command-line options
1390 understood by @command{gcc}. If the @option{-v} option is also specified
1391 then @option{--help} is also passed on to the various processes
1392 invoked by @command{gcc}, so that they can display the command-line options
1393 they accept. If the @option{-Wextra} option has also been specified
1394 (prior to the @option{--help} option), then command-line options that
1395 have no documentation associated with them are also displayed.
1396
1397 @item --target-help
1398 @opindex target-help
1399 Print (on the standard output) a description of target-specific command-line
1400 options for each tool. For some targets extra target-specific
1401 information may also be printed.
1402
1403 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1404 Print (on the standard output) a description of the command-line
1405 options understood by the compiler that fit into all specified classes
1406 and qualifiers. These are the supported classes:
1407
1408 @table @asis
1409 @item @samp{optimizers}
1410 Display all of the optimization options supported by the
1411 compiler.
1412
1413 @item @samp{warnings}
1414 Display all of the options controlling warning messages
1415 produced by the compiler.
1416
1417 @item @samp{target}
1418 Display target-specific options. Unlike the
1419 @option{--target-help} option however, target-specific options of the
1420 linker and assembler are not displayed. This is because those
1421 tools do not currently support the extended @option{--help=} syntax.
1422
1423 @item @samp{params}
1424 Display the values recognized by the @option{--param}
1425 option.
1426
1427 @item @var{language}
1428 Display the options supported for @var{language}, where
1429 @var{language} is the name of one of the languages supported in this
1430 version of GCC@.
1431
1432 @item @samp{common}
1433 Display the options that are common to all languages.
1434 @end table
1435
1436 These are the supported qualifiers:
1437
1438 @table @asis
1439 @item @samp{undocumented}
1440 Display only those options that are undocumented.
1441
1442 @item @samp{joined}
1443 Display options taking an argument that appears after an equal
1444 sign in the same continuous piece of text, such as:
1445 @samp{--help=target}.
1446
1447 @item @samp{separate}
1448 Display options taking an argument that appears as a separate word
1449 following the original option, such as: @samp{-o output-file}.
1450 @end table
1451
1452 Thus for example to display all the undocumented target-specific
1453 switches supported by the compiler, use:
1454
1455 @smallexample
1456 --help=target,undocumented
1457 @end smallexample
1458
1459 The sense of a qualifier can be inverted by prefixing it with the
1460 @samp{^} character, so for example to display all binary warning
1461 options (i.e., ones that are either on or off and that do not take an
1462 argument) that have a description, use:
1463
1464 @smallexample
1465 --help=warnings,^joined,^undocumented
1466 @end smallexample
1467
1468 The argument to @option{--help=} should not consist solely of inverted
1469 qualifiers.
1470
1471 Combining several classes is possible, although this usually
1472 restricts the output so much that there is nothing to display. One
1473 case where it does work, however, is when one of the classes is
1474 @var{target}. For example, to display all the target-specific
1475 optimization options, use:
1476
1477 @smallexample
1478 --help=target,optimizers
1479 @end smallexample
1480
1481 The @option{--help=} option can be repeated on the command line. Each
1482 successive use displays its requested class of options, skipping
1483 those that have already been displayed.
1484
1485 If the @option{-Q} option appears on the command line before the
1486 @option{--help=} option, then the descriptive text displayed by
1487 @option{--help=} is changed. Instead of describing the displayed
1488 options, an indication is given as to whether the option is enabled,
1489 disabled or set to a specific value (assuming that the compiler
1490 knows this at the point where the @option{--help=} option is used).
1491
1492 Here is a truncated example from the ARM port of @command{gcc}:
1493
1494 @smallexample
1495 % gcc -Q -mabi=2 --help=target -c
1496 The following options are target specific:
1497 -mabi= 2
1498 -mabort-on-noreturn [disabled]
1499 -mapcs [disabled]
1500 @end smallexample
1501
1502 The output is sensitive to the effects of previous command-line
1503 options, so for example it is possible to find out which optimizations
1504 are enabled at @option{-O2} by using:
1505
1506 @smallexample
1507 -Q -O2 --help=optimizers
1508 @end smallexample
1509
1510 Alternatively you can discover which binary optimizations are enabled
1511 by @option{-O3} by using:
1512
1513 @smallexample
1514 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1515 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1516 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1517 @end smallexample
1518
1519 @item -no-canonical-prefixes
1520 @opindex no-canonical-prefixes
1521 Do not expand any symbolic links, resolve references to @samp{/../}
1522 or @samp{/./}, or make the path absolute when generating a relative
1523 prefix.
1524
1525 @item --version
1526 @opindex version
1527 Display the version number and copyrights of the invoked GCC@.
1528
1529 @item -wrapper
1530 @opindex wrapper
1531 Invoke all subcommands under a wrapper program. The name of the
1532 wrapper program and its parameters are passed as a comma separated
1533 list.
1534
1535 @smallexample
1536 gcc -c t.c -wrapper gdb,--args
1537 @end smallexample
1538
1539 @noindent
1540 This invokes all subprograms of @command{gcc} under
1541 @samp{gdb --args}, thus the invocation of @command{cc1} is
1542 @samp{gdb --args cc1 @dots{}}.
1543
1544 @item -fplugin=@var{name}.so
1545 @opindex fplugin
1546 Load the plugin code in file @var{name}.so, assumed to be a
1547 shared object to be dlopen'd by the compiler. The base name of
1548 the shared object file is used to identify the plugin for the
1549 purposes of argument parsing (See
1550 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1551 Each plugin should define the callback functions specified in the
1552 Plugins API.
1553
1554 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1555 @opindex fplugin-arg
1556 Define an argument called @var{key} with a value of @var{value}
1557 for the plugin called @var{name}.
1558
1559 @item -fdump-ada-spec@r{[}-slim@r{]}
1560 @opindex fdump-ada-spec
1561 For C and C++ source and include files, generate corresponding Ada specs.
1562 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1563 GNAT User's Guide}, which provides detailed documentation on this feature.
1564
1565 @item -fada-spec-parent=@var{unit}
1566 @opindex fada-spec-parent
1567 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1568 Ada specs as child units of parent @var{unit}.
1569
1570 @item -fdump-go-spec=@var{file}
1571 @opindex fdump-go-spec
1572 For input files in any language, generate corresponding Go
1573 declarations in @var{file}. This generates Go @code{const},
1574 @code{type}, @code{var}, and @code{func} declarations which may be a
1575 useful way to start writing a Go interface to code written in some
1576 other language.
1577
1578 @include @value{srcdir}/../libiberty/at-file.texi
1579 @end table
1580
1581 @node Invoking G++
1582 @section Compiling C++ Programs
1583
1584 @cindex suffixes for C++ source
1585 @cindex C++ source file suffixes
1586 C++ source files conventionally use one of the suffixes @samp{.C},
1587 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1588 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1589 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1590 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1591 files with these names and compiles them as C++ programs even if you
1592 call the compiler the same way as for compiling C programs (usually
1593 with the name @command{gcc}).
1594
1595 @findex g++
1596 @findex c++
1597 However, the use of @command{gcc} does not add the C++ library.
1598 @command{g++} is a program that calls GCC and automatically specifies linking
1599 against the C++ library. It treats @samp{.c},
1600 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1601 files unless @option{-x} is used. This program is also useful when
1602 precompiling a C header file with a @samp{.h} extension for use in C++
1603 compilations. On many systems, @command{g++} is also installed with
1604 the name @command{c++}.
1605
1606 @cindex invoking @command{g++}
1607 When you compile C++ programs, you may specify many of the same
1608 command-line options that you use for compiling programs in any
1609 language; or command-line options meaningful for C and related
1610 languages; or options that are meaningful only for C++ programs.
1611 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1612 explanations of options for languages related to C@.
1613 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1614 explanations of options that are meaningful only for C++ programs.
1615
1616 @node C Dialect Options
1617 @section Options Controlling C Dialect
1618 @cindex dialect options
1619 @cindex language dialect options
1620 @cindex options, dialect
1621
1622 The following options control the dialect of C (or languages derived
1623 from C, such as C++, Objective-C and Objective-C++) that the compiler
1624 accepts:
1625
1626 @table @gcctabopt
1627 @cindex ANSI support
1628 @cindex ISO support
1629 @item -ansi
1630 @opindex ansi
1631 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1632 equivalent to @option{-std=c++98}.
1633
1634 This turns off certain features of GCC that are incompatible with ISO
1635 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1636 such as the @code{asm} and @code{typeof} keywords, and
1637 predefined macros such as @code{unix} and @code{vax} that identify the
1638 type of system you are using. It also enables the undesirable and
1639 rarely used ISO trigraph feature. For the C compiler,
1640 it disables recognition of C++ style @samp{//} comments as well as
1641 the @code{inline} keyword.
1642
1643 The alternate keywords @code{__asm__}, @code{__extension__},
1644 @code{__inline__} and @code{__typeof__} continue to work despite
1645 @option{-ansi}. You would not want to use them in an ISO C program, of
1646 course, but it is useful to put them in header files that might be included
1647 in compilations done with @option{-ansi}. Alternate predefined macros
1648 such as @code{__unix__} and @code{__vax__} are also available, with or
1649 without @option{-ansi}.
1650
1651 The @option{-ansi} option does not cause non-ISO programs to be
1652 rejected gratuitously. For that, @option{-Wpedantic} is required in
1653 addition to @option{-ansi}. @xref{Warning Options}.
1654
1655 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1656 option is used. Some header files may notice this macro and refrain
1657 from declaring certain functions or defining certain macros that the
1658 ISO standard doesn't call for; this is to avoid interfering with any
1659 programs that might use these names for other things.
1660
1661 Functions that are normally built in but do not have semantics
1662 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1663 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1664 built-in functions provided by GCC}, for details of the functions
1665 affected.
1666
1667 @item -std=
1668 @opindex std
1669 Determine the language standard. @xref{Standards,,Language Standards
1670 Supported by GCC}, for details of these standard versions. This option
1671 is currently only supported when compiling C or C++.
1672
1673 The compiler can accept several base standards, such as @samp{c90} or
1674 @samp{c++98}, and GNU dialects of those standards, such as
1675 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1676 compiler accepts all programs following that standard plus those
1677 using GNU extensions that do not contradict it. For example,
1678 @option{-std=c90} turns off certain features of GCC that are
1679 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1680 keywords, but not other GNU extensions that do not have a meaning in
1681 ISO C90, such as omitting the middle term of a @code{?:}
1682 expression. On the other hand, when a GNU dialect of a standard is
1683 specified, all features supported by the compiler are enabled, even when
1684 those features change the meaning of the base standard. As a result, some
1685 strict-conforming programs may be rejected. The particular standard
1686 is used by @option{-Wpedantic} to identify which features are GNU
1687 extensions given that version of the standard. For example
1688 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1689 comments, while @option{-std=gnu99 -Wpedantic} does not.
1690
1691 A value for this option must be provided; possible values are
1692
1693 @table @samp
1694 @item c90
1695 @itemx c89
1696 @itemx iso9899:1990
1697 Support all ISO C90 programs (certain GNU extensions that conflict
1698 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1699
1700 @item iso9899:199409
1701 ISO C90 as modified in amendment 1.
1702
1703 @item c99
1704 @itemx c9x
1705 @itemx iso9899:1999
1706 @itemx iso9899:199x
1707 ISO C99. This standard is substantially completely supported, modulo
1708 bugs and floating-point issues
1709 (mainly but not entirely relating to optional C99 features from
1710 Annexes F and G). See
1711 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1712 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1713
1714 @item c11
1715 @itemx c1x
1716 @itemx iso9899:2011
1717 ISO C11, the 2011 revision of the ISO C standard. This standard is
1718 substantially completely supported, modulo bugs, floating-point issues
1719 (mainly but not entirely relating to optional C11 features from
1720 Annexes F and G) and the optional Annexes K (Bounds-checking
1721 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1722
1723 @item gnu90
1724 @itemx gnu89
1725 GNU dialect of ISO C90 (including some C99 features).
1726
1727 @item gnu99
1728 @itemx gnu9x
1729 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1730
1731 @item gnu11
1732 @itemx gnu1x
1733 GNU dialect of ISO C11. This is the default for C code.
1734 The name @samp{gnu1x} is deprecated.
1735
1736 @item c++98
1737 @itemx c++03
1738 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1739 additional defect reports. Same as @option{-ansi} for C++ code.
1740
1741 @item gnu++98
1742 @itemx gnu++03
1743 GNU dialect of @option{-std=c++98}. This is the default for
1744 C++ code.
1745
1746 @item c++11
1747 @itemx c++0x
1748 The 2011 ISO C++ standard plus amendments.
1749 The name @samp{c++0x} is deprecated.
1750
1751 @item gnu++11
1752 @itemx gnu++0x
1753 GNU dialect of @option{-std=c++11}.
1754 The name @samp{gnu++0x} is deprecated.
1755
1756 @item c++14
1757 @itemx c++1y
1758 The 2014 ISO C++ standard plus amendments.
1759 The name @samp{c++1y} is deprecated.
1760
1761 @item gnu++14
1762 @itemx gnu++1y
1763 GNU dialect of @option{-std=c++14}.
1764 The name @samp{gnu++1y} is deprecated.
1765
1766 @item c++1z
1767 The next revision of the ISO C++ standard, tentatively planned for
1768 2017. Support is highly experimental, and will almost certainly
1769 change in incompatible ways in future releases.
1770
1771 @item gnu++1z
1772 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1773 and will almost certainly change in incompatible ways in future
1774 releases.
1775 @end table
1776
1777 @item -fgnu89-inline
1778 @opindex fgnu89-inline
1779 The option @option{-fgnu89-inline} tells GCC to use the traditional
1780 GNU semantics for @code{inline} functions when in C99 mode.
1781 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1782 Using this option is roughly equivalent to adding the
1783 @code{gnu_inline} function attribute to all inline functions
1784 (@pxref{Function Attributes}).
1785
1786 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1787 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1788 specifies the default behavior).
1789 This option is not supported in @option{-std=c90} or
1790 @option{-std=gnu90} mode.
1791
1792 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1793 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1794 in effect for @code{inline} functions. @xref{Common Predefined
1795 Macros,,,cpp,The C Preprocessor}.
1796
1797 @item -aux-info @var{filename}
1798 @opindex aux-info
1799 Output to the given filename prototyped declarations for all functions
1800 declared and/or defined in a translation unit, including those in header
1801 files. This option is silently ignored in any language other than C@.
1802
1803 Besides declarations, the file indicates, in comments, the origin of
1804 each declaration (source file and line), whether the declaration was
1805 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1806 @samp{O} for old, respectively, in the first character after the line
1807 number and the colon), and whether it came from a declaration or a
1808 definition (@samp{C} or @samp{F}, respectively, in the following
1809 character). In the case of function definitions, a K&R-style list of
1810 arguments followed by their declarations is also provided, inside
1811 comments, after the declaration.
1812
1813 @item -fallow-parameterless-variadic-functions
1814 @opindex fallow-parameterless-variadic-functions
1815 Accept variadic functions without named parameters.
1816
1817 Although it is possible to define such a function, this is not very
1818 useful as it is not possible to read the arguments. This is only
1819 supported for C as this construct is allowed by C++.
1820
1821 @item -fno-asm
1822 @opindex fno-asm
1823 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1824 keyword, so that code can use these words as identifiers. You can use
1825 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1826 instead. @option{-ansi} implies @option{-fno-asm}.
1827
1828 In C++, this switch only affects the @code{typeof} keyword, since
1829 @code{asm} and @code{inline} are standard keywords. You may want to
1830 use the @option{-fno-gnu-keywords} flag instead, which has the same
1831 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1832 switch only affects the @code{asm} and @code{typeof} keywords, since
1833 @code{inline} is a standard keyword in ISO C99.
1834
1835 @item -fno-builtin
1836 @itemx -fno-builtin-@var{function}
1837 @opindex fno-builtin
1838 @cindex built-in functions
1839 Don't recognize built-in functions that do not begin with
1840 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1841 functions provided by GCC}, for details of the functions affected,
1842 including those which are not built-in functions when @option{-ansi} or
1843 @option{-std} options for strict ISO C conformance are used because they
1844 do not have an ISO standard meaning.
1845
1846 GCC normally generates special code to handle certain built-in functions
1847 more efficiently; for instance, calls to @code{alloca} may become single
1848 instructions which adjust the stack directly, and calls to @code{memcpy}
1849 may become inline copy loops. The resulting code is often both smaller
1850 and faster, but since the function calls no longer appear as such, you
1851 cannot set a breakpoint on those calls, nor can you change the behavior
1852 of the functions by linking with a different library. In addition,
1853 when a function is recognized as a built-in function, GCC may use
1854 information about that function to warn about problems with calls to
1855 that function, or to generate more efficient code, even if the
1856 resulting code still contains calls to that function. For example,
1857 warnings are given with @option{-Wformat} for bad calls to
1858 @code{printf} when @code{printf} is built in and @code{strlen} is
1859 known not to modify global memory.
1860
1861 With the @option{-fno-builtin-@var{function}} option
1862 only the built-in function @var{function} is
1863 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1864 function is named that is not built-in in this version of GCC, this
1865 option is ignored. There is no corresponding
1866 @option{-fbuiltin-@var{function}} option; if you wish to enable
1867 built-in functions selectively when using @option{-fno-builtin} or
1868 @option{-ffreestanding}, you may define macros such as:
1869
1870 @smallexample
1871 #define abs(n) __builtin_abs ((n))
1872 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1873 @end smallexample
1874
1875 @item -fhosted
1876 @opindex fhosted
1877 @cindex hosted environment
1878
1879 Assert that compilation targets a hosted environment. This implies
1880 @option{-fbuiltin}. A hosted environment is one in which the
1881 entire standard library is available, and in which @code{main} has a return
1882 type of @code{int}. Examples are nearly everything except a kernel.
1883 This is equivalent to @option{-fno-freestanding}.
1884
1885 @item -ffreestanding
1886 @opindex ffreestanding
1887 @cindex hosted environment
1888
1889 Assert that compilation targets a freestanding environment. This
1890 implies @option{-fno-builtin}. A freestanding environment
1891 is one in which the standard library may not exist, and program startup may
1892 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1893 This is equivalent to @option{-fno-hosted}.
1894
1895 @xref{Standards,,Language Standards Supported by GCC}, for details of
1896 freestanding and hosted environments.
1897
1898 @item -fopenacc
1899 @opindex fopenacc
1900 @cindex OpenACC accelerator programming
1901 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
1902 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
1903 compiler generates accelerated code according to the OpenACC Application
1904 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
1905 implies @option{-pthread}, and thus is only supported on targets that
1906 have support for @option{-pthread}.
1907
1908 Note that this is an experimental feature, incomplete, and subject to
1909 change in future versions of GCC. See
1910 @w{@uref{https://gcc.gnu.org/wiki/OpenACC}} for more information.
1911
1912 @item -fopenmp
1913 @opindex fopenmp
1914 @cindex OpenMP parallel
1915 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1916 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1917 compiler generates parallel code according to the OpenMP Application
1918 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
1919 implies @option{-pthread}, and thus is only supported on targets that
1920 have support for @option{-pthread}. @option{-fopenmp} implies
1921 @option{-fopenmp-simd}.
1922
1923 @item -fopenmp-simd
1924 @opindex fopenmp-simd
1925 @cindex OpenMP SIMD
1926 @cindex SIMD
1927 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
1928 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
1929 are ignored.
1930
1931 @item -fcilkplus
1932 @opindex fcilkplus
1933 @cindex Enable Cilk Plus
1934 Enable the usage of Cilk Plus language extension features for C/C++.
1935 When the option @option{-fcilkplus} is specified, enable the usage of
1936 the Cilk Plus Language extension features for C/C++. The present
1937 implementation follows ABI version 1.2. This is an experimental
1938 feature that is only partially complete, and whose interface may
1939 change in future versions of GCC as the official specification
1940 changes. Currently, all features but @code{_Cilk_for} have been
1941 implemented.
1942
1943 @item -fgnu-tm
1944 @opindex fgnu-tm
1945 When the option @option{-fgnu-tm} is specified, the compiler
1946 generates code for the Linux variant of Intel's current Transactional
1947 Memory ABI specification document (Revision 1.1, May 6 2009). This is
1948 an experimental feature whose interface may change in future versions
1949 of GCC, as the official specification changes. Please note that not
1950 all architectures are supported for this feature.
1951
1952 For more information on GCC's support for transactional memory,
1953 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
1954 Transactional Memory Library}.
1955
1956 Note that the transactional memory feature is not supported with
1957 non-call exceptions (@option{-fnon-call-exceptions}).
1958
1959 @item -fms-extensions
1960 @opindex fms-extensions
1961 Accept some non-standard constructs used in Microsoft header files.
1962
1963 In C++ code, this allows member names in structures to be similar
1964 to previous types declarations.
1965
1966 @smallexample
1967 typedef int UOW;
1968 struct ABC @{
1969 UOW UOW;
1970 @};
1971 @end smallexample
1972
1973 Some cases of unnamed fields in structures and unions are only
1974 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1975 fields within structs/unions}, for details.
1976
1977 Note that this option is off for all targets but x86
1978 targets using ms-abi.
1979
1980 @item -fplan9-extensions
1981 @opindex fplan9-extensions
1982 Accept some non-standard constructs used in Plan 9 code.
1983
1984 This enables @option{-fms-extensions}, permits passing pointers to
1985 structures with anonymous fields to functions that expect pointers to
1986 elements of the type of the field, and permits referring to anonymous
1987 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
1988 struct/union fields within structs/unions}, for details. This is only
1989 supported for C, not C++.
1990
1991 @item -trigraphs
1992 @opindex trigraphs
1993 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1994 options for strict ISO C conformance) implies @option{-trigraphs}.
1995
1996 @cindex traditional C language
1997 @cindex C language, traditional
1998 @item -traditional
1999 @itemx -traditional-cpp
2000 @opindex traditional-cpp
2001 @opindex traditional
2002 Formerly, these options caused GCC to attempt to emulate a pre-standard
2003 C compiler. They are now only supported with the @option{-E} switch.
2004 The preprocessor continues to support a pre-standard mode. See the GNU
2005 CPP manual for details.
2006
2007 @item -fcond-mismatch
2008 @opindex fcond-mismatch
2009 Allow conditional expressions with mismatched types in the second and
2010 third arguments. The value of such an expression is void. This option
2011 is not supported for C++.
2012
2013 @item -flax-vector-conversions
2014 @opindex flax-vector-conversions
2015 Allow implicit conversions between vectors with differing numbers of
2016 elements and/or incompatible element types. This option should not be
2017 used for new code.
2018
2019 @item -funsigned-char
2020 @opindex funsigned-char
2021 Let the type @code{char} be unsigned, like @code{unsigned char}.
2022
2023 Each kind of machine has a default for what @code{char} should
2024 be. It is either like @code{unsigned char} by default or like
2025 @code{signed char} by default.
2026
2027 Ideally, a portable program should always use @code{signed char} or
2028 @code{unsigned char} when it depends on the signedness of an object.
2029 But many programs have been written to use plain @code{char} and
2030 expect it to be signed, or expect it to be unsigned, depending on the
2031 machines they were written for. This option, and its inverse, let you
2032 make such a program work with the opposite default.
2033
2034 The type @code{char} is always a distinct type from each of
2035 @code{signed char} or @code{unsigned char}, even though its behavior
2036 is always just like one of those two.
2037
2038 @item -fsigned-char
2039 @opindex fsigned-char
2040 Let the type @code{char} be signed, like @code{signed char}.
2041
2042 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2043 the negative form of @option{-funsigned-char}. Likewise, the option
2044 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2045
2046 @item -fsigned-bitfields
2047 @itemx -funsigned-bitfields
2048 @itemx -fno-signed-bitfields
2049 @itemx -fno-unsigned-bitfields
2050 @opindex fsigned-bitfields
2051 @opindex funsigned-bitfields
2052 @opindex fno-signed-bitfields
2053 @opindex fno-unsigned-bitfields
2054 These options control whether a bit-field is signed or unsigned, when the
2055 declaration does not use either @code{signed} or @code{unsigned}. By
2056 default, such a bit-field is signed, because this is consistent: the
2057 basic integer types such as @code{int} are signed types.
2058 @end table
2059
2060 @node C++ Dialect Options
2061 @section Options Controlling C++ Dialect
2062
2063 @cindex compiler options, C++
2064 @cindex C++ options, command-line
2065 @cindex options, C++
2066 This section describes the command-line options that are only meaningful
2067 for C++ programs. You can also use most of the GNU compiler options
2068 regardless of what language your program is in. For example, you
2069 might compile a file @file{firstClass.C} like this:
2070
2071 @smallexample
2072 g++ -g -frepo -O -c firstClass.C
2073 @end smallexample
2074
2075 @noindent
2076 In this example, only @option{-frepo} is an option meant
2077 only for C++ programs; you can use the other options with any
2078 language supported by GCC@.
2079
2080 Here is a list of options that are @emph{only} for compiling C++ programs:
2081
2082 @table @gcctabopt
2083
2084 @item -fabi-version=@var{n}
2085 @opindex fabi-version
2086 Use version @var{n} of the C++ ABI@. The default is version 0.
2087
2088 Version 0 refers to the version conforming most closely to
2089 the C++ ABI specification. Therefore, the ABI obtained using version 0
2090 will change in different versions of G++ as ABI bugs are fixed.
2091
2092 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2093
2094 Version 2 is the version of the C++ ABI that first appeared in G++
2095 3.4, and was the default through G++ 4.9.
2096
2097 Version 3 corrects an error in mangling a constant address as a
2098 template argument.
2099
2100 Version 4, which first appeared in G++ 4.5, implements a standard
2101 mangling for vector types.
2102
2103 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2104 attribute const/volatile on function pointer types, decltype of a
2105 plain decl, and use of a function parameter in the declaration of
2106 another parameter.
2107
2108 Version 6, which first appeared in G++ 4.7, corrects the promotion
2109 behavior of C++11 scoped enums and the mangling of template argument
2110 packs, const/static_cast, prefix ++ and --, and a class scope function
2111 used as a template argument.
2112
2113 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2114 builtin type and corrects the mangling of lambdas in default argument
2115 scope.
2116
2117 Version 8, which first appeared in G++ 4.9, corrects the substitution
2118 behavior of function types with function-cv-qualifiers.
2119
2120 See also @option{-Wabi}.
2121
2122 @item -fabi-compat-version=@var{n}
2123 @opindex fabi-compat-version
2124 On targets that support strong aliases, G++
2125 works around mangling changes by creating an alias with the correct
2126 mangled name when defining a symbol with an incorrect mangled name.
2127 This switch specifies which ABI version to use for the alias.
2128
2129 With @option{-fabi-version=0} (the default), this defaults to 2. If
2130 another ABI version is explicitly selected, this defaults to 0.
2131
2132 The compatibility version is also set by @option{-Wabi=@var{n}}.
2133
2134 @item -fno-access-control
2135 @opindex fno-access-control
2136 Turn off all access checking. This switch is mainly useful for working
2137 around bugs in the access control code.
2138
2139 @item -fcheck-new
2140 @opindex fcheck-new
2141 Check that the pointer returned by @code{operator new} is non-null
2142 before attempting to modify the storage allocated. This check is
2143 normally unnecessary because the C++ standard specifies that
2144 @code{operator new} only returns @code{0} if it is declared
2145 @code{throw()}, in which case the compiler always checks the
2146 return value even without this option. In all other cases, when
2147 @code{operator new} has a non-empty exception specification, memory
2148 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2149 @samp{new (nothrow)}.
2150
2151 @item -fconstexpr-depth=@var{n}
2152 @opindex fconstexpr-depth
2153 Set the maximum nested evaluation depth for C++11 constexpr functions
2154 to @var{n}. A limit is needed to detect endless recursion during
2155 constant expression evaluation. The minimum specified by the standard
2156 is 512.
2157
2158 @item -fdeduce-init-list
2159 @opindex fdeduce-init-list
2160 Enable deduction of a template type parameter as
2161 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2162
2163 @smallexample
2164 template <class T> auto forward(T t) -> decltype (realfn (t))
2165 @{
2166 return realfn (t);
2167 @}
2168
2169 void f()
2170 @{
2171 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2172 @}
2173 @end smallexample
2174
2175 This deduction was implemented as a possible extension to the
2176 originally proposed semantics for the C++11 standard, but was not part
2177 of the final standard, so it is disabled by default. This option is
2178 deprecated, and may be removed in a future version of G++.
2179
2180 @item -ffriend-injection
2181 @opindex ffriend-injection
2182 Inject friend functions into the enclosing namespace, so that they are
2183 visible outside the scope of the class in which they are declared.
2184 Friend functions were documented to work this way in the old Annotated
2185 C++ Reference Manual.
2186 However, in ISO C++ a friend function that is not declared
2187 in an enclosing scope can only be found using argument dependent
2188 lookup. GCC defaults to the standard behavior.
2189
2190 This option is for compatibility, and may be removed in a future
2191 release of G++.
2192
2193 @item -fno-elide-constructors
2194 @opindex fno-elide-constructors
2195 The C++ standard allows an implementation to omit creating a temporary
2196 that is only used to initialize another object of the same type.
2197 Specifying this option disables that optimization, and forces G++ to
2198 call the copy constructor in all cases.
2199
2200 @item -fno-enforce-eh-specs
2201 @opindex fno-enforce-eh-specs
2202 Don't generate code to check for violation of exception specifications
2203 at run time. This option violates the C++ standard, but may be useful
2204 for reducing code size in production builds, much like defining
2205 @code{NDEBUG}. This does not give user code permission to throw
2206 exceptions in violation of the exception specifications; the compiler
2207 still optimizes based on the specifications, so throwing an
2208 unexpected exception results in undefined behavior at run time.
2209
2210 @item -fextern-tls-init
2211 @itemx -fno-extern-tls-init
2212 @opindex fextern-tls-init
2213 @opindex fno-extern-tls-init
2214 The C++11 and OpenMP standards allow @code{thread_local} and
2215 @code{threadprivate} variables to have dynamic (runtime)
2216 initialization. To support this, any use of such a variable goes
2217 through a wrapper function that performs any necessary initialization.
2218 When the use and definition of the variable are in the same
2219 translation unit, this overhead can be optimized away, but when the
2220 use is in a different translation unit there is significant overhead
2221 even if the variable doesn't actually need dynamic initialization. If
2222 the programmer can be sure that no use of the variable in a
2223 non-defining TU needs to trigger dynamic initialization (either
2224 because the variable is statically initialized, or a use of the
2225 variable in the defining TU will be executed before any uses in
2226 another TU), they can avoid this overhead with the
2227 @option{-fno-extern-tls-init} option.
2228
2229 On targets that support symbol aliases, the default is
2230 @option{-fextern-tls-init}. On targets that do not support symbol
2231 aliases, the default is @option{-fno-extern-tls-init}.
2232
2233 @item -ffor-scope
2234 @itemx -fno-for-scope
2235 @opindex ffor-scope
2236 @opindex fno-for-scope
2237 If @option{-ffor-scope} is specified, the scope of variables declared in
2238 a @i{for-init-statement} is limited to the @code{for} loop itself,
2239 as specified by the C++ standard.
2240 If @option{-fno-for-scope} is specified, the scope of variables declared in
2241 a @i{for-init-statement} extends to the end of the enclosing scope,
2242 as was the case in old versions of G++, and other (traditional)
2243 implementations of C++.
2244
2245 If neither flag is given, the default is to follow the standard,
2246 but to allow and give a warning for old-style code that would
2247 otherwise be invalid, or have different behavior.
2248
2249 @item -fno-gnu-keywords
2250 @opindex fno-gnu-keywords
2251 Do not recognize @code{typeof} as a keyword, so that code can use this
2252 word as an identifier. You can use the keyword @code{__typeof__} instead.
2253 @option{-ansi} implies @option{-fno-gnu-keywords}.
2254
2255 @item -fno-implicit-templates
2256 @opindex fno-implicit-templates
2257 Never emit code for non-inline templates that are instantiated
2258 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2259 @xref{Template Instantiation}, for more information.
2260
2261 @item -fno-implicit-inline-templates
2262 @opindex fno-implicit-inline-templates
2263 Don't emit code for implicit instantiations of inline templates, either.
2264 The default is to handle inlines differently so that compiles with and
2265 without optimization need the same set of explicit instantiations.
2266
2267 @item -fno-implement-inlines
2268 @opindex fno-implement-inlines
2269 To save space, do not emit out-of-line copies of inline functions
2270 controlled by @code{#pragma implementation}. This causes linker
2271 errors if these functions are not inlined everywhere they are called.
2272
2273 @item -fms-extensions
2274 @opindex fms-extensions
2275 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2276 int and getting a pointer to member function via non-standard syntax.
2277
2278 @item -fno-nonansi-builtins
2279 @opindex fno-nonansi-builtins
2280 Disable built-in declarations of functions that are not mandated by
2281 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2282 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2283
2284 @item -fnothrow-opt
2285 @opindex fnothrow-opt
2286 Treat a @code{throw()} exception specification as if it were a
2287 @code{noexcept} specification to reduce or eliminate the text size
2288 overhead relative to a function with no exception specification. If
2289 the function has local variables of types with non-trivial
2290 destructors, the exception specification actually makes the
2291 function smaller because the EH cleanups for those variables can be
2292 optimized away. The semantic effect is that an exception thrown out of
2293 a function with such an exception specification results in a call
2294 to @code{terminate} rather than @code{unexpected}.
2295
2296 @item -fno-operator-names
2297 @opindex fno-operator-names
2298 Do not treat the operator name keywords @code{and}, @code{bitand},
2299 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2300 synonyms as keywords.
2301
2302 @item -fno-optional-diags
2303 @opindex fno-optional-diags
2304 Disable diagnostics that the standard says a compiler does not need to
2305 issue. Currently, the only such diagnostic issued by G++ is the one for
2306 a name having multiple meanings within a class.
2307
2308 @item -fpermissive
2309 @opindex fpermissive
2310 Downgrade some diagnostics about nonconformant code from errors to
2311 warnings. Thus, using @option{-fpermissive} allows some
2312 nonconforming code to compile.
2313
2314 @item -fno-pretty-templates
2315 @opindex fno-pretty-templates
2316 When an error message refers to a specialization of a function
2317 template, the compiler normally prints the signature of the
2318 template followed by the template arguments and any typedefs or
2319 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2320 rather than @code{void f(int)}) so that it's clear which template is
2321 involved. When an error message refers to a specialization of a class
2322 template, the compiler omits any template arguments that match
2323 the default template arguments for that template. If either of these
2324 behaviors make it harder to understand the error message rather than
2325 easier, you can use @option{-fno-pretty-templates} to disable them.
2326
2327 @item -frepo
2328 @opindex frepo
2329 Enable automatic template instantiation at link time. This option also
2330 implies @option{-fno-implicit-templates}. @xref{Template
2331 Instantiation}, for more information.
2332
2333 @item -fno-rtti
2334 @opindex fno-rtti
2335 Disable generation of information about every class with virtual
2336 functions for use by the C++ run-time type identification features
2337 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2338 of the language, you can save some space by using this flag. Note that
2339 exception handling uses the same information, but G++ generates it as
2340 needed. The @code{dynamic_cast} operator can still be used for casts that
2341 do not require run-time type information, i.e.@: casts to @code{void *} or to
2342 unambiguous base classes.
2343
2344 @item -fsized-deallocation
2345 @opindex fsized-deallocation
2346 Enable the built-in global declarations
2347 @smallexample
2348 void operator delete (void *, std::size_t) noexcept;
2349 void operator delete[] (void *, std::size_t) noexcept;
2350 @end smallexample
2351 as introduced in C++14. This is useful for user-defined replacement
2352 deallocation functions that, for example, use the size of the object
2353 to make deallocation faster. Enabled by default under
2354 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2355 warns about places that might want to add a definition.
2356
2357 @item -fstats
2358 @opindex fstats
2359 Emit statistics about front-end processing at the end of the compilation.
2360 This information is generally only useful to the G++ development team.
2361
2362 @item -fstrict-enums
2363 @opindex fstrict-enums
2364 Allow the compiler to optimize using the assumption that a value of
2365 enumerated type can only be one of the values of the enumeration (as
2366 defined in the C++ standard; basically, a value that can be
2367 represented in the minimum number of bits needed to represent all the
2368 enumerators). This assumption may not be valid if the program uses a
2369 cast to convert an arbitrary integer value to the enumerated type.
2370
2371 @item -ftemplate-backtrace-limit=@var{n}
2372 @opindex ftemplate-backtrace-limit
2373 Set the maximum number of template instantiation notes for a single
2374 warning or error to @var{n}. The default value is 10.
2375
2376 @item -ftemplate-depth=@var{n}
2377 @opindex ftemplate-depth
2378 Set the maximum instantiation depth for template classes to @var{n}.
2379 A limit on the template instantiation depth is needed to detect
2380 endless recursions during template class instantiation. ANSI/ISO C++
2381 conforming programs must not rely on a maximum depth greater than 17
2382 (changed to 1024 in C++11). The default value is 900, as the compiler
2383 can run out of stack space before hitting 1024 in some situations.
2384
2385 @item -fno-threadsafe-statics
2386 @opindex fno-threadsafe-statics
2387 Do not emit the extra code to use the routines specified in the C++
2388 ABI for thread-safe initialization of local statics. You can use this
2389 option to reduce code size slightly in code that doesn't need to be
2390 thread-safe.
2391
2392 @item -fuse-cxa-atexit
2393 @opindex fuse-cxa-atexit
2394 Register destructors for objects with static storage duration with the
2395 @code{__cxa_atexit} function rather than the @code{atexit} function.
2396 This option is required for fully standards-compliant handling of static
2397 destructors, but only works if your C library supports
2398 @code{__cxa_atexit}.
2399
2400 @item -fno-use-cxa-get-exception-ptr
2401 @opindex fno-use-cxa-get-exception-ptr
2402 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2403 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2404 if the runtime routine is not available.
2405
2406 @item -fvisibility-inlines-hidden
2407 @opindex fvisibility-inlines-hidden
2408 This switch declares that the user does not attempt to compare
2409 pointers to inline functions or methods where the addresses of the two functions
2410 are taken in different shared objects.
2411
2412 The effect of this is that GCC may, effectively, mark inline methods with
2413 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2414 appear in the export table of a DSO and do not require a PLT indirection
2415 when used within the DSO@. Enabling this option can have a dramatic effect
2416 on load and link times of a DSO as it massively reduces the size of the
2417 dynamic export table when the library makes heavy use of templates.
2418
2419 The behavior of this switch is not quite the same as marking the
2420 methods as hidden directly, because it does not affect static variables
2421 local to the function or cause the compiler to deduce that
2422 the function is defined in only one shared object.
2423
2424 You may mark a method as having a visibility explicitly to negate the
2425 effect of the switch for that method. For example, if you do want to
2426 compare pointers to a particular inline method, you might mark it as
2427 having default visibility. Marking the enclosing class with explicit
2428 visibility has no effect.
2429
2430 Explicitly instantiated inline methods are unaffected by this option
2431 as their linkage might otherwise cross a shared library boundary.
2432 @xref{Template Instantiation}.
2433
2434 @item -fvisibility-ms-compat
2435 @opindex fvisibility-ms-compat
2436 This flag attempts to use visibility settings to make GCC's C++
2437 linkage model compatible with that of Microsoft Visual Studio.
2438
2439 The flag makes these changes to GCC's linkage model:
2440
2441 @enumerate
2442 @item
2443 It sets the default visibility to @code{hidden}, like
2444 @option{-fvisibility=hidden}.
2445
2446 @item
2447 Types, but not their members, are not hidden by default.
2448
2449 @item
2450 The One Definition Rule is relaxed for types without explicit
2451 visibility specifications that are defined in more than one
2452 shared object: those declarations are permitted if they are
2453 permitted when this option is not used.
2454 @end enumerate
2455
2456 In new code it is better to use @option{-fvisibility=hidden} and
2457 export those classes that are intended to be externally visible.
2458 Unfortunately it is possible for code to rely, perhaps accidentally,
2459 on the Visual Studio behavior.
2460
2461 Among the consequences of these changes are that static data members
2462 of the same type with the same name but defined in different shared
2463 objects are different, so changing one does not change the other;
2464 and that pointers to function members defined in different shared
2465 objects may not compare equal. When this flag is given, it is a
2466 violation of the ODR to define types with the same name differently.
2467
2468 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
2469 @opindex fvtable-verify
2470 Turn on (or off, if using @option{-fvtable-verify=none}) the security
2471 feature that verifies at run time, for every virtual call, that
2472 the vtable pointer through which the call is made is valid for the type of
2473 the object, and has not been corrupted or overwritten. If an invalid vtable
2474 pointer is detected at run time, an error is reported and execution of the
2475 program is immediately halted.
2476
2477 This option causes run-time data structures to be built at program startup,
2478 which are used for verifying the vtable pointers.
2479 The options @samp{std} and @samp{preinit}
2480 control the timing of when these data structures are built. In both cases the
2481 data structures are built before execution reaches @code{main}. Using
2482 @option{-fvtable-verify=std} causes the data structures to be built after
2483 shared libraries have been loaded and initialized.
2484 @option{-fvtable-verify=preinit} causes them to be built before shared
2485 libraries have been loaded and initialized.
2486
2487 If this option appears multiple times in the command line with different
2488 values specified, @samp{none} takes highest priority over both @samp{std} and
2489 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
2490
2491 @item -fvtv-debug
2492 @opindex fvtv-debug
2493 When used in conjunction with @option{-fvtable-verify=std} or
2494 @option{-fvtable-verify=preinit}, causes debug versions of the
2495 runtime functions for the vtable verification feature to be called.
2496 This flag also causes the compiler to log information about which
2497 vtable pointers it finds for each class.
2498 This information is written to a file named @file{vtv_set_ptr_data.log}
2499 in the directory named by the environment variable @env{VTV_LOGS_DIR}
2500 if that is defined or the current working directory otherwise.
2501
2502 Note: This feature @emph{appends} data to the log file. If you want a fresh log
2503 file, be sure to delete any existing one.
2504
2505 @item -fvtv-counts
2506 @opindex fvtv-counts
2507 This is a debugging flag. When used in conjunction with
2508 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
2509 causes the compiler to keep track of the total number of virtual calls
2510 it encounters and the number of verifications it inserts. It also
2511 counts the number of calls to certain run-time library functions
2512 that it inserts and logs this information for each compilation unit.
2513 The compiler writes this information to a file named
2514 @file{vtv_count_data.log} in the directory named by the environment
2515 variable @env{VTV_LOGS_DIR} if that is defined or the current working
2516 directory otherwise. It also counts the size of the vtable pointer sets
2517 for each class, and writes this information to @file{vtv_class_set_sizes.log}
2518 in the same directory.
2519
2520 Note: This feature @emph{appends} data to the log files. To get fresh log
2521 files, be sure to delete any existing ones.
2522
2523 @item -fno-weak
2524 @opindex fno-weak
2525 Do not use weak symbol support, even if it is provided by the linker.
2526 By default, G++ uses weak symbols if they are available. This
2527 option exists only for testing, and should not be used by end-users;
2528 it results in inferior code and has no benefits. This option may
2529 be removed in a future release of G++.
2530
2531 @item -nostdinc++
2532 @opindex nostdinc++
2533 Do not search for header files in the standard directories specific to
2534 C++, but do still search the other standard directories. (This option
2535 is used when building the C++ library.)
2536 @end table
2537
2538 In addition, these optimization, warning, and code generation options
2539 have meanings only for C++ programs:
2540
2541 @table @gcctabopt
2542 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2543 @opindex Wabi
2544 @opindex Wno-abi
2545 When an explicit @option{-fabi-version=@var{n}} option is used, causes
2546 G++ to warn when it generates code that is probably not compatible with the
2547 vendor-neutral C++ ABI@. Since G++ now defaults to
2548 @option{-fabi-version=0}, @option{-Wabi} has no effect unless either
2549 an older ABI version is selected (with @option{-fabi-version=@var{n}})
2550 or an older compatibility version is selected (with
2551 @option{-Wabi=@var{n}} or @option{-fabi-compat-version=@var{n}}).
2552
2553 Although an effort has been made to warn about
2554 all such cases, there are probably some cases that are not warned about,
2555 even though G++ is generating incompatible code. There may also be
2556 cases where warnings are emitted even though the code that is generated
2557 is compatible.
2558
2559 You should rewrite your code to avoid these warnings if you are
2560 concerned about the fact that code generated by G++ may not be binary
2561 compatible with code generated by other compilers.
2562
2563 @option{-Wabi} can also be used with an explicit version number to
2564 warn about compatibility with a particular @option{-fabi-version}
2565 level, e.g. @option{-Wabi=2} to warn about changes relative to
2566 @option{-fabi-version=2}. Specifying a version number also sets
2567 @option{-fabi-compat-version=@var{n}}.
2568
2569 The known incompatibilities in @option{-fabi-version=2} (which was the
2570 default from GCC 3.4 to 4.9) include:
2571
2572 @itemize @bullet
2573
2574 @item
2575 A template with a non-type template parameter of reference type was
2576 mangled incorrectly:
2577 @smallexample
2578 extern int N;
2579 template <int &> struct S @{@};
2580 void n (S<N>) @{2@}
2581 @end smallexample
2582
2583 This was fixed in @option{-fabi-version=3}.
2584
2585 @item
2586 SIMD vector types declared using @code{__attribute ((vector_size))} were
2587 mangled in a non-standard way that does not allow for overloading of
2588 functions taking vectors of different sizes.
2589
2590 The mangling was changed in @option{-fabi-version=4}.
2591
2592 @item
2593 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2594 qualifiers, and @code{decltype} of a plain declaration was folded away.
2595
2596 These mangling issues were fixed in @option{-fabi-version=5}.
2597
2598 @item
2599 Scoped enumerators passed as arguments to a variadic function are
2600 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2601 On most targets this does not actually affect the parameter passing
2602 ABI, as there is no way to pass an argument smaller than @code{int}.
2603
2604 Also, the ABI changed the mangling of template argument packs,
2605 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2606 a class scope function used as a template argument.
2607
2608 These issues were corrected in @option{-fabi-version=6}.
2609
2610 @item
2611 Lambdas in default argument scope were mangled incorrectly, and the
2612 ABI changed the mangling of @code{nullptr_t}.
2613
2614 These issues were corrected in @option{-fabi-version=7}.
2615
2616 @item
2617 When mangling a function type with function-cv-qualifiers, the
2618 un-qualified function type was incorrectly treated as a substitution
2619 candidate.
2620
2621 This was fixed in @option{-fabi-version=8}.
2622 @end itemize
2623
2624 It also warns about psABI-related changes. The known psABI changes at this
2625 point include:
2626
2627 @itemize @bullet
2628
2629 @item
2630 For SysV/x86-64, unions with @code{long double} members are
2631 passed in memory as specified in psABI. For example:
2632
2633 @smallexample
2634 union U @{
2635 long double ld;
2636 int i;
2637 @};
2638 @end smallexample
2639
2640 @noindent
2641 @code{union U} is always passed in memory.
2642
2643 @end itemize
2644
2645 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2646 @opindex Wabi-tag
2647 @opindex -Wabi-tag
2648 Warn when a type with an ABI tag is used in a context that does not
2649 have that ABI tag. See @ref{C++ Attributes} for more information
2650 about ABI tags.
2651
2652 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2653 @opindex Wctor-dtor-privacy
2654 @opindex Wno-ctor-dtor-privacy
2655 Warn when a class seems unusable because all the constructors or
2656 destructors in that class are private, and it has neither friends nor
2657 public static member functions. Also warn if there are no non-private
2658 methods, and there's at least one private member function that isn't
2659 a constructor or destructor.
2660
2661 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2662 @opindex Wdelete-non-virtual-dtor
2663 @opindex Wno-delete-non-virtual-dtor
2664 Warn when @code{delete} is used to destroy an instance of a class that
2665 has virtual functions and non-virtual destructor. It is unsafe to delete
2666 an instance of a derived class through a pointer to a base class if the
2667 base class does not have a virtual destructor. This warning is enabled
2668 by @option{-Wall}.
2669
2670 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2671 @opindex Wliteral-suffix
2672 @opindex Wno-literal-suffix
2673 Warn when a string or character literal is followed by a ud-suffix which does
2674 not begin with an underscore. As a conforming extension, GCC treats such
2675 suffixes as separate preprocessing tokens in order to maintain backwards
2676 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2677 For example:
2678
2679 @smallexample
2680 #define __STDC_FORMAT_MACROS
2681 #include <inttypes.h>
2682 #include <stdio.h>
2683
2684 int main() @{
2685 int64_t i64 = 123;
2686 printf("My int64: %"PRId64"\n", i64);
2687 @}
2688 @end smallexample
2689
2690 In this case, @code{PRId64} is treated as a separate preprocessing token.
2691
2692 This warning is enabled by default.
2693
2694 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2695 @opindex Wnarrowing
2696 @opindex Wno-narrowing
2697 Warn when a narrowing conversion prohibited by C++11 occurs within
2698 @samp{@{ @}}, e.g.
2699
2700 @smallexample
2701 int i = @{ 2.2 @}; // error: narrowing from double to int
2702 @end smallexample
2703
2704 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2705
2706 With @option{-std=c++11}, @option{-Wno-narrowing} suppresses for
2707 non-constants the diagnostic required by the standard. Note that this
2708 does not affect the meaning of well-formed code; narrowing conversions
2709 are still considered ill-formed in SFINAE context.
2710
2711 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2712 @opindex Wnoexcept
2713 @opindex Wno-noexcept
2714 Warn when a noexcept-expression evaluates to false because of a call
2715 to a function that does not have a non-throwing exception
2716 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2717 the compiler to never throw an exception.
2718
2719 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2720 @opindex Wnon-virtual-dtor
2721 @opindex Wno-non-virtual-dtor
2722 Warn when a class has virtual functions and an accessible non-virtual
2723 destructor itself or in an accessible polymorphic base class, in which
2724 case it is possible but unsafe to delete an instance of a derived
2725 class through a pointer to the class itself or base class. This
2726 warning is automatically enabled if @option{-Weffc++} is specified.
2727
2728 @item -Wreorder @r{(C++ and Objective-C++ only)}
2729 @opindex Wreorder
2730 @opindex Wno-reorder
2731 @cindex reordering, warning
2732 @cindex warning for reordering of member initializers
2733 Warn when the order of member initializers given in the code does not
2734 match the order in which they must be executed. For instance:
2735
2736 @smallexample
2737 struct A @{
2738 int i;
2739 int j;
2740 A(): j (0), i (1) @{ @}
2741 @};
2742 @end smallexample
2743
2744 @noindent
2745 The compiler rearranges the member initializers for @code{i}
2746 and @code{j} to match the declaration order of the members, emitting
2747 a warning to that effect. This warning is enabled by @option{-Wall}.
2748
2749 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2750 @opindex fext-numeric-literals
2751 @opindex fno-ext-numeric-literals
2752 Accept imaginary, fixed-point, or machine-defined
2753 literal number suffixes as GNU extensions.
2754 When this option is turned off these suffixes are treated
2755 as C++11 user-defined literal numeric suffixes.
2756 This is on by default for all pre-C++11 dialects and all GNU dialects:
2757 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2758 @option{-std=gnu++14}.
2759 This option is off by default
2760 for ISO C++11 onwards (@option{-std=c++11}, ...).
2761 @end table
2762
2763 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2764
2765 @table @gcctabopt
2766 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2767 @opindex Weffc++
2768 @opindex Wno-effc++
2769 Warn about violations of the following style guidelines from Scott Meyers'
2770 @cite{Effective C++} series of books:
2771
2772 @itemize @bullet
2773 @item
2774 Define a copy constructor and an assignment operator for classes
2775 with dynamically-allocated memory.
2776
2777 @item
2778 Prefer initialization to assignment in constructors.
2779
2780 @item
2781 Have @code{operator=} return a reference to @code{*this}.
2782
2783 @item
2784 Don't try to return a reference when you must return an object.
2785
2786 @item
2787 Distinguish between prefix and postfix forms of increment and
2788 decrement operators.
2789
2790 @item
2791 Never overload @code{&&}, @code{||}, or @code{,}.
2792
2793 @end itemize
2794
2795 This option also enables @option{-Wnon-virtual-dtor}, which is also
2796 one of the effective C++ recommendations. However, the check is
2797 extended to warn about the lack of virtual destructor in accessible
2798 non-polymorphic bases classes too.
2799
2800 When selecting this option, be aware that the standard library
2801 headers do not obey all of these guidelines; use @samp{grep -v}
2802 to filter out those warnings.
2803
2804 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2805 @opindex Wstrict-null-sentinel
2806 @opindex Wno-strict-null-sentinel
2807 Warn about the use of an uncasted @code{NULL} as sentinel. When
2808 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2809 to @code{__null}. Although it is a null pointer constant rather than a
2810 null pointer, it is guaranteed to be of the same size as a pointer.
2811 But this use is not portable across different compilers.
2812
2813 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2814 @opindex Wno-non-template-friend
2815 @opindex Wnon-template-friend
2816 Disable warnings when non-templatized friend functions are declared
2817 within a template. Since the advent of explicit template specification
2818 support in G++, if the name of the friend is an unqualified-id (i.e.,
2819 @samp{friend foo(int)}), the C++ language specification demands that the
2820 friend declare or define an ordinary, nontemplate function. (Section
2821 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2822 could be interpreted as a particular specialization of a templatized
2823 function. Because this non-conforming behavior is no longer the default
2824 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2825 check existing code for potential trouble spots and is on by default.
2826 This new compiler behavior can be turned off with
2827 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2828 but disables the helpful warning.
2829
2830 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2831 @opindex Wold-style-cast
2832 @opindex Wno-old-style-cast
2833 Warn if an old-style (C-style) cast to a non-void type is used within
2834 a C++ program. The new-style casts (@code{dynamic_cast},
2835 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
2836 less vulnerable to unintended effects and much easier to search for.
2837
2838 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2839 @opindex Woverloaded-virtual
2840 @opindex Wno-overloaded-virtual
2841 @cindex overloaded virtual function, warning
2842 @cindex warning for overloaded virtual function
2843 Warn when a function declaration hides virtual functions from a
2844 base class. For example, in:
2845
2846 @smallexample
2847 struct A @{
2848 virtual void f();
2849 @};
2850
2851 struct B: public A @{
2852 void f(int);
2853 @};
2854 @end smallexample
2855
2856 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2857 like:
2858
2859 @smallexample
2860 B* b;
2861 b->f();
2862 @end smallexample
2863
2864 @noindent
2865 fails to compile.
2866
2867 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2868 @opindex Wno-pmf-conversions
2869 @opindex Wpmf-conversions
2870 Disable the diagnostic for converting a bound pointer to member function
2871 to a plain pointer.
2872
2873 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2874 @opindex Wsign-promo
2875 @opindex Wno-sign-promo
2876 Warn when overload resolution chooses a promotion from unsigned or
2877 enumerated type to a signed type, over a conversion to an unsigned type of
2878 the same size. Previous versions of G++ tried to preserve
2879 unsignedness, but the standard mandates the current behavior.
2880 @end table
2881
2882 @node Objective-C and Objective-C++ Dialect Options
2883 @section Options Controlling Objective-C and Objective-C++ Dialects
2884
2885 @cindex compiler options, Objective-C and Objective-C++
2886 @cindex Objective-C and Objective-C++ options, command-line
2887 @cindex options, Objective-C and Objective-C++
2888 (NOTE: This manual does not describe the Objective-C and Objective-C++
2889 languages themselves. @xref{Standards,,Language Standards
2890 Supported by GCC}, for references.)
2891
2892 This section describes the command-line options that are only meaningful
2893 for Objective-C and Objective-C++ programs. You can also use most of
2894 the language-independent GNU compiler options.
2895 For example, you might compile a file @file{some_class.m} like this:
2896
2897 @smallexample
2898 gcc -g -fgnu-runtime -O -c some_class.m
2899 @end smallexample
2900
2901 @noindent
2902 In this example, @option{-fgnu-runtime} is an option meant only for
2903 Objective-C and Objective-C++ programs; you can use the other options with
2904 any language supported by GCC@.
2905
2906 Note that since Objective-C is an extension of the C language, Objective-C
2907 compilations may also use options specific to the C front-end (e.g.,
2908 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2909 C++-specific options (e.g., @option{-Wabi}).
2910
2911 Here is a list of options that are @emph{only} for compiling Objective-C
2912 and Objective-C++ programs:
2913
2914 @table @gcctabopt
2915 @item -fconstant-string-class=@var{class-name}
2916 @opindex fconstant-string-class
2917 Use @var{class-name} as the name of the class to instantiate for each
2918 literal string specified with the syntax @code{@@"@dots{}"}. The default
2919 class name is @code{NXConstantString} if the GNU runtime is being used, and
2920 @code{NSConstantString} if the NeXT runtime is being used (see below). The
2921 @option{-fconstant-cfstrings} option, if also present, overrides the
2922 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2923 to be laid out as constant CoreFoundation strings.
2924
2925 @item -fgnu-runtime
2926 @opindex fgnu-runtime
2927 Generate object code compatible with the standard GNU Objective-C
2928 runtime. This is the default for most types of systems.
2929
2930 @item -fnext-runtime
2931 @opindex fnext-runtime
2932 Generate output compatible with the NeXT runtime. This is the default
2933 for NeXT-based systems, including Darwin and Mac OS X@. The macro
2934 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2935 used.
2936
2937 @item -fno-nil-receivers
2938 @opindex fno-nil-receivers
2939 Assume that all Objective-C message dispatches (@code{[receiver
2940 message:arg]}) in this translation unit ensure that the receiver is
2941 not @code{nil}. This allows for more efficient entry points in the
2942 runtime to be used. This option is only available in conjunction with
2943 the NeXT runtime and ABI version 0 or 1.
2944
2945 @item -fobjc-abi-version=@var{n}
2946 @opindex fobjc-abi-version
2947 Use version @var{n} of the Objective-C ABI for the selected runtime.
2948 This option is currently supported only for the NeXT runtime. In that
2949 case, Version 0 is the traditional (32-bit) ABI without support for
2950 properties and other Objective-C 2.0 additions. Version 1 is the
2951 traditional (32-bit) ABI with support for properties and other
2952 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
2953 nothing is specified, the default is Version 0 on 32-bit target
2954 machines, and Version 2 on 64-bit target machines.
2955
2956 @item -fobjc-call-cxx-cdtors
2957 @opindex fobjc-call-cxx-cdtors
2958 For each Objective-C class, check if any of its instance variables is a
2959 C++ object with a non-trivial default constructor. If so, synthesize a
2960 special @code{- (id) .cxx_construct} instance method which runs
2961 non-trivial default constructors on any such instance variables, in order,
2962 and then return @code{self}. Similarly, check if any instance variable
2963 is a C++ object with a non-trivial destructor, and if so, synthesize a
2964 special @code{- (void) .cxx_destruct} method which runs
2965 all such default destructors, in reverse order.
2966
2967 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
2968 methods thusly generated only operate on instance variables
2969 declared in the current Objective-C class, and not those inherited
2970 from superclasses. It is the responsibility of the Objective-C
2971 runtime to invoke all such methods in an object's inheritance
2972 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
2973 by the runtime immediately after a new object instance is allocated;
2974 the @code{- (void) .cxx_destruct} methods are invoked immediately
2975 before the runtime deallocates an object instance.
2976
2977 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2978 support for invoking the @code{- (id) .cxx_construct} and
2979 @code{- (void) .cxx_destruct} methods.
2980
2981 @item -fobjc-direct-dispatch
2982 @opindex fobjc-direct-dispatch
2983 Allow fast jumps to the message dispatcher. On Darwin this is
2984 accomplished via the comm page.
2985
2986 @item -fobjc-exceptions
2987 @opindex fobjc-exceptions
2988 Enable syntactic support for structured exception handling in
2989 Objective-C, similar to what is offered by C++ and Java. This option
2990 is required to use the Objective-C keywords @code{@@try},
2991 @code{@@throw}, @code{@@catch}, @code{@@finally} and
2992 @code{@@synchronized}. This option is available with both the GNU
2993 runtime and the NeXT runtime (but not available in conjunction with
2994 the NeXT runtime on Mac OS X 10.2 and earlier).
2995
2996 @item -fobjc-gc
2997 @opindex fobjc-gc
2998 Enable garbage collection (GC) in Objective-C and Objective-C++
2999 programs. This option is only available with the NeXT runtime; the
3000 GNU runtime has a different garbage collection implementation that
3001 does not require special compiler flags.
3002
3003 @item -fobjc-nilcheck
3004 @opindex fobjc-nilcheck
3005 For the NeXT runtime with version 2 of the ABI, check for a nil
3006 receiver in method invocations before doing the actual method call.
3007 This is the default and can be disabled using
3008 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3009 checked for nil in this way no matter what this flag is set to.
3010 Currently this flag does nothing when the GNU runtime, or an older
3011 version of the NeXT runtime ABI, is used.
3012
3013 @item -fobjc-std=objc1
3014 @opindex fobjc-std
3015 Conform to the language syntax of Objective-C 1.0, the language
3016 recognized by GCC 4.0. This only affects the Objective-C additions to
3017 the C/C++ language; it does not affect conformance to C/C++ standards,
3018 which is controlled by the separate C/C++ dialect option flags. When
3019 this option is used with the Objective-C or Objective-C++ compiler,
3020 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3021 This is useful if you need to make sure that your Objective-C code can
3022 be compiled with older versions of GCC@.
3023
3024 @item -freplace-objc-classes
3025 @opindex freplace-objc-classes
3026 Emit a special marker instructing @command{ld(1)} not to statically link in
3027 the resulting object file, and allow @command{dyld(1)} to load it in at
3028 run time instead. This is used in conjunction with the Fix-and-Continue
3029 debugging mode, where the object file in question may be recompiled and
3030 dynamically reloaded in the course of program execution, without the need
3031 to restart the program itself. Currently, Fix-and-Continue functionality
3032 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3033 and later.
3034
3035 @item -fzero-link
3036 @opindex fzero-link
3037 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3038 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3039 compile time) with static class references that get initialized at load time,
3040 which improves run-time performance. Specifying the @option{-fzero-link} flag
3041 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3042 to be retained. This is useful in Zero-Link debugging mode, since it allows
3043 for individual class implementations to be modified during program execution.
3044 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3045 regardless of command-line options.
3046
3047 @item -fno-local-ivars
3048 @opindex fno-local-ivars
3049 @opindex flocal-ivars
3050 By default instance variables in Objective-C can be accessed as if
3051 they were local variables from within the methods of the class they're
3052 declared in. This can lead to shadowing between instance variables
3053 and other variables declared either locally inside a class method or
3054 globally with the same name. Specifying the @option{-fno-local-ivars}
3055 flag disables this behavior thus avoiding variable shadowing issues.
3056
3057 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3058 @opindex fivar-visibility
3059 Set the default instance variable visibility to the specified option
3060 so that instance variables declared outside the scope of any access
3061 modifier directives default to the specified visibility.
3062
3063 @item -gen-decls
3064 @opindex gen-decls
3065 Dump interface declarations for all classes seen in the source file to a
3066 file named @file{@var{sourcename}.decl}.
3067
3068 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3069 @opindex Wassign-intercept
3070 @opindex Wno-assign-intercept
3071 Warn whenever an Objective-C assignment is being intercepted by the
3072 garbage collector.
3073
3074 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3075 @opindex Wno-protocol
3076 @opindex Wprotocol
3077 If a class is declared to implement a protocol, a warning is issued for
3078 every method in the protocol that is not implemented by the class. The
3079 default behavior is to issue a warning for every method not explicitly
3080 implemented in the class, even if a method implementation is inherited
3081 from the superclass. If you use the @option{-Wno-protocol} option, then
3082 methods inherited from the superclass are considered to be implemented,
3083 and no warning is issued for them.
3084
3085 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3086 @opindex Wselector
3087 @opindex Wno-selector
3088 Warn if multiple methods of different types for the same selector are
3089 found during compilation. The check is performed on the list of methods
3090 in the final stage of compilation. Additionally, a check is performed
3091 for each selector appearing in a @code{@@selector(@dots{})}
3092 expression, and a corresponding method for that selector has been found
3093 during compilation. Because these checks scan the method table only at
3094 the end of compilation, these warnings are not produced if the final
3095 stage of compilation is not reached, for example because an error is
3096 found during compilation, or because the @option{-fsyntax-only} option is
3097 being used.
3098
3099 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3100 @opindex Wstrict-selector-match
3101 @opindex Wno-strict-selector-match
3102 Warn if multiple methods with differing argument and/or return types are
3103 found for a given selector when attempting to send a message using this
3104 selector to a receiver of type @code{id} or @code{Class}. When this flag
3105 is off (which is the default behavior), the compiler omits such warnings
3106 if any differences found are confined to types that share the same size
3107 and alignment.
3108
3109 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3110 @opindex Wundeclared-selector
3111 @opindex Wno-undeclared-selector
3112 Warn if a @code{@@selector(@dots{})} expression referring to an
3113 undeclared selector is found. A selector is considered undeclared if no
3114 method with that name has been declared before the
3115 @code{@@selector(@dots{})} expression, either explicitly in an
3116 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3117 an @code{@@implementation} section. This option always performs its
3118 checks as soon as a @code{@@selector(@dots{})} expression is found,
3119 while @option{-Wselector} only performs its checks in the final stage of
3120 compilation. This also enforces the coding style convention
3121 that methods and selectors must be declared before being used.
3122
3123 @item -print-objc-runtime-info
3124 @opindex print-objc-runtime-info
3125 Generate C header describing the largest structure that is passed by
3126 value, if any.
3127
3128 @end table
3129
3130 @node Language Independent Options
3131 @section Options to Control Diagnostic Messages Formatting
3132 @cindex options to control diagnostics formatting
3133 @cindex diagnostic messages
3134 @cindex message formatting
3135
3136 Traditionally, diagnostic messages have been formatted irrespective of
3137 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3138 options described below
3139 to control the formatting algorithm for diagnostic messages,
3140 e.g.@: how many characters per line, how often source location
3141 information should be reported. Note that some language front ends may not
3142 honor these options.
3143
3144 @table @gcctabopt
3145 @item -fmessage-length=@var{n}
3146 @opindex fmessage-length
3147 Try to format error messages so that they fit on lines of about
3148 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3149 done; each error message appears on a single line. This is the
3150 default for all front ends.
3151
3152 @item -fdiagnostics-show-location=once
3153 @opindex fdiagnostics-show-location
3154 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3155 reporter to emit source location information @emph{once}; that is, in
3156 case the message is too long to fit on a single physical line and has to
3157 be wrapped, the source location won't be emitted (as prefix) again,
3158 over and over, in subsequent continuation lines. This is the default
3159 behavior.
3160
3161 @item -fdiagnostics-show-location=every-line
3162 Only meaningful in line-wrapping mode. Instructs the diagnostic
3163 messages reporter to emit the same source location information (as
3164 prefix) for physical lines that result from the process of breaking
3165 a message which is too long to fit on a single line.
3166
3167 @item -fdiagnostics-color[=@var{WHEN}]
3168 @itemx -fno-diagnostics-color
3169 @opindex fdiagnostics-color
3170 @cindex highlight, color, colour
3171 @vindex GCC_COLORS @r{environment variable}
3172 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3173 or @samp{auto}. The default depends on how the compiler has been configured,
3174 it can be any of the above @var{WHEN} options or also @samp{never}
3175 if @env{GCC_COLORS} environment variable isn't present in the environment,
3176 and @samp{auto} otherwise.
3177 @samp{auto} means to use color only when the standard error is a terminal.
3178 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3179 aliases for @option{-fdiagnostics-color=always} and
3180 @option{-fdiagnostics-color=never}, respectively.
3181
3182 The colors are defined by the environment variable @env{GCC_COLORS}.
3183 Its value is a colon-separated list of capabilities and Select Graphic
3184 Rendition (SGR) substrings. SGR commands are interpreted by the
3185 terminal or terminal emulator. (See the section in the documentation
3186 of your text terminal for permitted values and their meanings as
3187 character attributes.) These substring values are integers in decimal
3188 representation and can be concatenated with semicolons.
3189 Common values to concatenate include
3190 @samp{1} for bold,
3191 @samp{4} for underline,
3192 @samp{5} for blink,
3193 @samp{7} for inverse,
3194 @samp{39} for default foreground color,
3195 @samp{30} to @samp{37} for foreground colors,
3196 @samp{90} to @samp{97} for 16-color mode foreground colors,
3197 @samp{38;5;0} to @samp{38;5;255}
3198 for 88-color and 256-color modes foreground colors,
3199 @samp{49} for default background color,
3200 @samp{40} to @samp{47} for background colors,
3201 @samp{100} to @samp{107} for 16-color mode background colors,
3202 and @samp{48;5;0} to @samp{48;5;255}
3203 for 88-color and 256-color modes background colors.
3204
3205 The default @env{GCC_COLORS} is
3206 @smallexample
3207 error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01
3208 @end smallexample
3209 @noindent
3210 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3211 @samp{01;36} is bold cyan, @samp{01;32} is bold green and
3212 @samp{01} is bold. Setting @env{GCC_COLORS} to the empty
3213 string disables colors.
3214 Supported capabilities are as follows.
3215
3216 @table @code
3217 @item error=
3218 @vindex error GCC_COLORS @r{capability}
3219 SGR substring for error: markers.
3220
3221 @item warning=
3222 @vindex warning GCC_COLORS @r{capability}
3223 SGR substring for warning: markers.
3224
3225 @item note=
3226 @vindex note GCC_COLORS @r{capability}
3227 SGR substring for note: markers.
3228
3229 @item caret=
3230 @vindex caret GCC_COLORS @r{capability}
3231 SGR substring for caret line.
3232
3233 @item locus=
3234 @vindex locus GCC_COLORS @r{capability}
3235 SGR substring for location information, @samp{file:line} or
3236 @samp{file:line:column} etc.
3237
3238 @item quote=
3239 @vindex quote GCC_COLORS @r{capability}
3240 SGR substring for information printed within quotes.
3241 @end table
3242
3243 @item -fno-diagnostics-show-option
3244 @opindex fno-diagnostics-show-option
3245 @opindex fdiagnostics-show-option
3246 By default, each diagnostic emitted includes text indicating the
3247 command-line option that directly controls the diagnostic (if such an
3248 option is known to the diagnostic machinery). Specifying the
3249 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3250
3251 @item -fno-diagnostics-show-caret
3252 @opindex fno-diagnostics-show-caret
3253 @opindex fdiagnostics-show-caret
3254 By default, each diagnostic emitted includes the original source line
3255 and a caret '^' indicating the column. This option suppresses this
3256 information. The source line is truncated to @var{n} characters, if
3257 the @option{-fmessage-length=n} option is given. When the output is done
3258 to the terminal, the width is limited to the width given by the
3259 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3260
3261 @end table
3262
3263 @node Warning Options
3264 @section Options to Request or Suppress Warnings
3265 @cindex options to control warnings
3266 @cindex warning messages
3267 @cindex messages, warning
3268 @cindex suppressing warnings
3269
3270 Warnings are diagnostic messages that report constructions that
3271 are not inherently erroneous but that are risky or suggest there
3272 may have been an error.
3273
3274 The following language-independent options do not enable specific
3275 warnings but control the kinds of diagnostics produced by GCC@.
3276
3277 @table @gcctabopt
3278 @cindex syntax checking
3279 @item -fsyntax-only
3280 @opindex fsyntax-only
3281 Check the code for syntax errors, but don't do anything beyond that.
3282
3283 @item -fmax-errors=@var{n}
3284 @opindex fmax-errors
3285 Limits the maximum number of error messages to @var{n}, at which point
3286 GCC bails out rather than attempting to continue processing the source
3287 code. If @var{n} is 0 (the default), there is no limit on the number
3288 of error messages produced. If @option{-Wfatal-errors} is also
3289 specified, then @option{-Wfatal-errors} takes precedence over this
3290 option.
3291
3292 @item -w
3293 @opindex w
3294 Inhibit all warning messages.
3295
3296 @item -Werror
3297 @opindex Werror
3298 @opindex Wno-error
3299 Make all warnings into errors.
3300
3301 @item -Werror=
3302 @opindex Werror=
3303 @opindex Wno-error=
3304 Make the specified warning into an error. The specifier for a warning
3305 is appended; for example @option{-Werror=switch} turns the warnings
3306 controlled by @option{-Wswitch} into errors. This switch takes a
3307 negative form, to be used to negate @option{-Werror} for specific
3308 warnings; for example @option{-Wno-error=switch} makes
3309 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3310 is in effect.
3311
3312 The warning message for each controllable warning includes the
3313 option that controls the warning. That option can then be used with
3314 @option{-Werror=} and @option{-Wno-error=} as described above.
3315 (Printing of the option in the warning message can be disabled using the
3316 @option{-fno-diagnostics-show-option} flag.)
3317
3318 Note that specifying @option{-Werror=}@var{foo} automatically implies
3319 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3320 imply anything.
3321
3322 @item -Wfatal-errors
3323 @opindex Wfatal-errors
3324 @opindex Wno-fatal-errors
3325 This option causes the compiler to abort compilation on the first error
3326 occurred rather than trying to keep going and printing further error
3327 messages.
3328
3329 @end table
3330
3331 You can request many specific warnings with options beginning with
3332 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3333 implicit declarations. Each of these specific warning options also
3334 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3335 example, @option{-Wno-implicit}. This manual lists only one of the
3336 two forms, whichever is not the default. For further
3337 language-specific options also refer to @ref{C++ Dialect Options} and
3338 @ref{Objective-C and Objective-C++ Dialect Options}.
3339
3340 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3341 options, such as @option{-Wunused}, which may turn on further options,
3342 such as @option{-Wunused-value}. The combined effect of positive and
3343 negative forms is that more specific options have priority over less
3344 specific ones, independently of their position in the command-line. For
3345 options of the same specificity, the last one takes effect. Options
3346 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3347 as if they appeared at the end of the command-line.
3348
3349 When an unrecognized warning option is requested (e.g.,
3350 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3351 that the option is not recognized. However, if the @option{-Wno-} form
3352 is used, the behavior is slightly different: no diagnostic is
3353 produced for @option{-Wno-unknown-warning} unless other diagnostics
3354 are being produced. This allows the use of new @option{-Wno-} options
3355 with old compilers, but if something goes wrong, the compiler
3356 warns that an unrecognized option is present.
3357
3358 @table @gcctabopt
3359 @item -Wpedantic
3360 @itemx -pedantic
3361 @opindex pedantic
3362 @opindex Wpedantic
3363 Issue all the warnings demanded by strict ISO C and ISO C++;
3364 reject all programs that use forbidden extensions, and some other
3365 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3366 version of the ISO C standard specified by any @option{-std} option used.
3367
3368 Valid ISO C and ISO C++ programs should compile properly with or without
3369 this option (though a rare few require @option{-ansi} or a
3370 @option{-std} option specifying the required version of ISO C)@. However,
3371 without this option, certain GNU extensions and traditional C and C++
3372 features are supported as well. With this option, they are rejected.
3373
3374 @option{-Wpedantic} does not cause warning messages for use of the
3375 alternate keywords whose names begin and end with @samp{__}. Pedantic
3376 warnings are also disabled in the expression that follows
3377 @code{__extension__}. However, only system header files should use
3378 these escape routes; application programs should avoid them.
3379 @xref{Alternate Keywords}.
3380
3381 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3382 C conformance. They soon find that it does not do quite what they want:
3383 it finds some non-ISO practices, but not all---only those for which
3384 ISO C @emph{requires} a diagnostic, and some others for which
3385 diagnostics have been added.
3386
3387 A feature to report any failure to conform to ISO C might be useful in
3388 some instances, but would require considerable additional work and would
3389 be quite different from @option{-Wpedantic}. We don't have plans to
3390 support such a feature in the near future.
3391
3392 Where the standard specified with @option{-std} represents a GNU
3393 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3394 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3395 extended dialect is based. Warnings from @option{-Wpedantic} are given
3396 where they are required by the base standard. (It does not make sense
3397 for such warnings to be given only for features not in the specified GNU
3398 C dialect, since by definition the GNU dialects of C include all
3399 features the compiler supports with the given option, and there would be
3400 nothing to warn about.)
3401
3402 @item -pedantic-errors
3403 @opindex pedantic-errors
3404 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3405 requires a diagnostic, in some cases where there is undefined behavior
3406 at compile-time and in some other cases that do not prevent compilation
3407 of programs that are valid according to the standard. This is not
3408 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3409 by this option and not enabled by the latter and vice versa.
3410
3411 @item -Wall
3412 @opindex Wall
3413 @opindex Wno-all
3414 This enables all the warnings about constructions that some users
3415 consider questionable, and that are easy to avoid (or modify to
3416 prevent the warning), even in conjunction with macros. This also
3417 enables some language-specific warnings described in @ref{C++ Dialect
3418 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3419
3420 @option{-Wall} turns on the following warning flags:
3421
3422 @gccoptlist{-Waddress @gol
3423 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3424 -Wc++11-compat -Wc++14-compat@gol
3425 -Wchar-subscripts @gol
3426 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3427 -Wimplicit-int @r{(C and Objective-C only)} @gol
3428 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3429 -Wcomment @gol
3430 -Wformat @gol
3431 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3432 -Wmaybe-uninitialized @gol
3433 -Wmissing-braces @r{(only for C/ObjC)} @gol
3434 -Wnonnull @gol
3435 -Wopenmp-simd @gol
3436 -Wparentheses @gol
3437 -Wpointer-sign @gol
3438 -Wreorder @gol
3439 -Wreturn-type @gol
3440 -Wsequence-point @gol
3441 -Wsign-compare @r{(only in C++)} @gol
3442 -Wstrict-aliasing @gol
3443 -Wstrict-overflow=1 @gol
3444 -Wswitch @gol
3445 -Wtrigraphs @gol
3446 -Wuninitialized @gol
3447 -Wunknown-pragmas @gol
3448 -Wunused-function @gol
3449 -Wunused-label @gol
3450 -Wunused-value @gol
3451 -Wunused-variable @gol
3452 -Wvolatile-register-var @gol
3453 }
3454
3455 Note that some warning flags are not implied by @option{-Wall}. Some of
3456 them warn about constructions that users generally do not consider
3457 questionable, but which occasionally you might wish to check for;
3458 others warn about constructions that are necessary or hard to avoid in
3459 some cases, and there is no simple way to modify the code to suppress
3460 the warning. Some of them are enabled by @option{-Wextra} but many of
3461 them must be enabled individually.
3462
3463 @item -Wextra
3464 @opindex W
3465 @opindex Wextra
3466 @opindex Wno-extra
3467 This enables some extra warning flags that are not enabled by
3468 @option{-Wall}. (This option used to be called @option{-W}. The older
3469 name is still supported, but the newer name is more descriptive.)
3470
3471 @gccoptlist{-Wclobbered @gol
3472 -Wempty-body @gol
3473 -Wignored-qualifiers @gol
3474 -Wmissing-field-initializers @gol
3475 -Wmissing-parameter-type @r{(C only)} @gol
3476 -Wold-style-declaration @r{(C only)} @gol
3477 -Woverride-init @gol
3478 -Wsign-compare @gol
3479 -Wtype-limits @gol
3480 -Wuninitialized @gol
3481 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3482 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3483 }
3484
3485 The option @option{-Wextra} also prints warning messages for the
3486 following cases:
3487
3488 @itemize @bullet
3489
3490 @item
3491 A pointer is compared against integer zero with @code{<}, @code{<=},
3492 @code{>}, or @code{>=}.
3493
3494 @item
3495 (C++ only) An enumerator and a non-enumerator both appear in a
3496 conditional expression.
3497
3498 @item
3499 (C++ only) Ambiguous virtual bases.
3500
3501 @item
3502 (C++ only) Subscripting an array that has been declared @code{register}.
3503
3504 @item
3505 (C++ only) Taking the address of a variable that has been declared
3506 @code{register}.
3507
3508 @item
3509 (C++ only) A base class is not initialized in a derived class's copy
3510 constructor.
3511
3512 @end itemize
3513
3514 @item -Wchar-subscripts
3515 @opindex Wchar-subscripts
3516 @opindex Wno-char-subscripts
3517 Warn if an array subscript has type @code{char}. This is a common cause
3518 of error, as programmers often forget that this type is signed on some
3519 machines.
3520 This warning is enabled by @option{-Wall}.
3521
3522 @item -Wcomment
3523 @opindex Wcomment
3524 @opindex Wno-comment
3525 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3526 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3527 This warning is enabled by @option{-Wall}.
3528
3529 @item -Wno-coverage-mismatch
3530 @opindex Wno-coverage-mismatch
3531 Warn if feedback profiles do not match when using the
3532 @option{-fprofile-use} option.
3533 If a source file is changed between compiling with @option{-fprofile-gen} and
3534 with @option{-fprofile-use}, the files with the profile feedback can fail
3535 to match the source file and GCC cannot use the profile feedback
3536 information. By default, this warning is enabled and is treated as an
3537 error. @option{-Wno-coverage-mismatch} can be used to disable the
3538 warning or @option{-Wno-error=coverage-mismatch} can be used to
3539 disable the error. Disabling the error for this warning can result in
3540 poorly optimized code and is useful only in the
3541 case of very minor changes such as bug fixes to an existing code-base.
3542 Completely disabling the warning is not recommended.
3543
3544 @item -Wno-cpp
3545 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3546
3547 Suppress warning messages emitted by @code{#warning} directives.
3548
3549 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3550 @opindex Wdouble-promotion
3551 @opindex Wno-double-promotion
3552 Give a warning when a value of type @code{float} is implicitly
3553 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3554 floating-point unit implement @code{float} in hardware, but emulate
3555 @code{double} in software. On such a machine, doing computations
3556 using @code{double} values is much more expensive because of the
3557 overhead required for software emulation.
3558
3559 It is easy to accidentally do computations with @code{double} because
3560 floating-point literals are implicitly of type @code{double}. For
3561 example, in:
3562 @smallexample
3563 @group
3564 float area(float radius)
3565 @{
3566 return 3.14159 * radius * radius;
3567 @}
3568 @end group
3569 @end smallexample
3570 the compiler performs the entire computation with @code{double}
3571 because the floating-point literal is a @code{double}.
3572
3573 @item -Wformat
3574 @itemx -Wformat=@var{n}
3575 @opindex Wformat
3576 @opindex Wno-format
3577 @opindex ffreestanding
3578 @opindex fno-builtin
3579 @opindex Wformat=
3580 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3581 the arguments supplied have types appropriate to the format string
3582 specified, and that the conversions specified in the format string make
3583 sense. This includes standard functions, and others specified by format
3584 attributes (@pxref{Function Attributes}), in the @code{printf},
3585 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3586 not in the C standard) families (or other target-specific families).
3587 Which functions are checked without format attributes having been
3588 specified depends on the standard version selected, and such checks of
3589 functions without the attribute specified are disabled by
3590 @option{-ffreestanding} or @option{-fno-builtin}.
3591
3592 The formats are checked against the format features supported by GNU
3593 libc version 2.2. These include all ISO C90 and C99 features, as well
3594 as features from the Single Unix Specification and some BSD and GNU
3595 extensions. Other library implementations may not support all these
3596 features; GCC does not support warning about features that go beyond a
3597 particular library's limitations. However, if @option{-Wpedantic} is used
3598 with @option{-Wformat}, warnings are given about format features not
3599 in the selected standard version (but not for @code{strfmon} formats,
3600 since those are not in any version of the C standard). @xref{C Dialect
3601 Options,,Options Controlling C Dialect}.
3602
3603 @table @gcctabopt
3604 @item -Wformat=1
3605 @itemx -Wformat
3606 @opindex Wformat
3607 @opindex Wformat=1
3608 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3609 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3610 @option{-Wformat} also checks for null format arguments for several
3611 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3612 aspects of this level of format checking can be disabled by the
3613 options: @option{-Wno-format-contains-nul},
3614 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3615 @option{-Wformat} is enabled by @option{-Wall}.
3616
3617 @item -Wno-format-contains-nul
3618 @opindex Wno-format-contains-nul
3619 @opindex Wformat-contains-nul
3620 If @option{-Wformat} is specified, do not warn about format strings that
3621 contain NUL bytes.
3622
3623 @item -Wno-format-extra-args
3624 @opindex Wno-format-extra-args
3625 @opindex Wformat-extra-args
3626 If @option{-Wformat} is specified, do not warn about excess arguments to a
3627 @code{printf} or @code{scanf} format function. The C standard specifies
3628 that such arguments are ignored.
3629
3630 Where the unused arguments lie between used arguments that are
3631 specified with @samp{$} operand number specifications, normally
3632 warnings are still given, since the implementation could not know what
3633 type to pass to @code{va_arg} to skip the unused arguments. However,
3634 in the case of @code{scanf} formats, this option suppresses the
3635 warning if the unused arguments are all pointers, since the Single
3636 Unix Specification says that such unused arguments are allowed.
3637
3638 @item -Wno-format-zero-length
3639 @opindex Wno-format-zero-length
3640 @opindex Wformat-zero-length
3641 If @option{-Wformat} is specified, do not warn about zero-length formats.
3642 The C standard specifies that zero-length formats are allowed.
3643
3644
3645 @item -Wformat=2
3646 @opindex Wformat=2
3647 Enable @option{-Wformat} plus additional format checks. Currently
3648 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3649 -Wformat-y2k}.
3650
3651 @item -Wformat-nonliteral
3652 @opindex Wformat-nonliteral
3653 @opindex Wno-format-nonliteral
3654 If @option{-Wformat} is specified, also warn if the format string is not a
3655 string literal and so cannot be checked, unless the format function
3656 takes its format arguments as a @code{va_list}.
3657
3658 @item -Wformat-security
3659 @opindex Wformat-security
3660 @opindex Wno-format-security
3661 If @option{-Wformat} is specified, also warn about uses of format
3662 functions that represent possible security problems. At present, this
3663 warns about calls to @code{printf} and @code{scanf} functions where the
3664 format string is not a string literal and there are no format arguments,
3665 as in @code{printf (foo);}. This may be a security hole if the format
3666 string came from untrusted input and contains @samp{%n}. (This is
3667 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3668 in future warnings may be added to @option{-Wformat-security} that are not
3669 included in @option{-Wformat-nonliteral}.)
3670
3671 @item -Wformat-signedness
3672 @opindex Wformat-signedness
3673 @opindex Wno-format-signedness
3674 If @option{-Wformat} is specified, also warn if the format string
3675 requires an unsigned argument and the argument is signed and vice versa.
3676
3677 @item -Wformat-y2k
3678 @opindex Wformat-y2k
3679 @opindex Wno-format-y2k
3680 If @option{-Wformat} is specified, also warn about @code{strftime}
3681 formats that may yield only a two-digit year.
3682 @end table
3683
3684 @item -Wnonnull
3685 @opindex Wnonnull
3686 @opindex Wno-nonnull
3687 Warn about passing a null pointer for arguments marked as
3688 requiring a non-null value by the @code{nonnull} function attribute.
3689
3690 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3691 can be disabled with the @option{-Wno-nonnull} option.
3692
3693 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3694 @opindex Winit-self
3695 @opindex Wno-init-self
3696 Warn about uninitialized variables that are initialized with themselves.
3697 Note this option can only be used with the @option{-Wuninitialized} option.
3698
3699 For example, GCC warns about @code{i} being uninitialized in the
3700 following snippet only when @option{-Winit-self} has been specified:
3701 @smallexample
3702 @group
3703 int f()
3704 @{
3705 int i = i;
3706 return i;
3707 @}
3708 @end group
3709 @end smallexample
3710
3711 This warning is enabled by @option{-Wall} in C++.
3712
3713 @item -Wimplicit-int @r{(C and Objective-C only)}
3714 @opindex Wimplicit-int
3715 @opindex Wno-implicit-int
3716 Warn when a declaration does not specify a type.
3717 This warning is enabled by @option{-Wall}.
3718
3719 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3720 @opindex Wimplicit-function-declaration
3721 @opindex Wno-implicit-function-declaration
3722 Give a warning whenever a function is used before being declared. In
3723 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3724 enabled by default and it is made into an error by
3725 @option{-pedantic-errors}. This warning is also enabled by
3726 @option{-Wall}.
3727
3728 @item -Wimplicit @r{(C and Objective-C only)}
3729 @opindex Wimplicit
3730 @opindex Wno-implicit
3731 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3732 This warning is enabled by @option{-Wall}.
3733
3734 @item -Wignored-qualifiers @r{(C and C++ only)}
3735 @opindex Wignored-qualifiers
3736 @opindex Wno-ignored-qualifiers
3737 Warn if the return type of a function has a type qualifier
3738 such as @code{const}. For ISO C such a type qualifier has no effect,
3739 since the value returned by a function is not an lvalue.
3740 For C++, the warning is only emitted for scalar types or @code{void}.
3741 ISO C prohibits qualified @code{void} return types on function
3742 definitions, so such return types always receive a warning
3743 even without this option.
3744
3745 This warning is also enabled by @option{-Wextra}.
3746
3747 @item -Wmain
3748 @opindex Wmain
3749 @opindex Wno-main
3750 Warn if the type of @code{main} is suspicious. @code{main} should be
3751 a function with external linkage, returning int, taking either zero
3752 arguments, two, or three arguments of appropriate types. This warning
3753 is enabled by default in C++ and is enabled by either @option{-Wall}
3754 or @option{-Wpedantic}.
3755
3756 @item -Wmissing-braces
3757 @opindex Wmissing-braces
3758 @opindex Wno-missing-braces
3759 Warn if an aggregate or union initializer is not fully bracketed. In
3760 the following example, the initializer for @code{a} is not fully
3761 bracketed, but that for @code{b} is fully bracketed. This warning is
3762 enabled by @option{-Wall} in C.
3763
3764 @smallexample
3765 int a[2][2] = @{ 0, 1, 2, 3 @};
3766 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3767 @end smallexample
3768
3769 This warning is enabled by @option{-Wall}.
3770
3771 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3772 @opindex Wmissing-include-dirs
3773 @opindex Wno-missing-include-dirs
3774 Warn if a user-supplied include directory does not exist.
3775
3776 @item -Wparentheses
3777 @opindex Wparentheses
3778 @opindex Wno-parentheses
3779 Warn if parentheses are omitted in certain contexts, such
3780 as when there is an assignment in a context where a truth value
3781 is expected, or when operators are nested whose precedence people
3782 often get confused about.
3783
3784 Also warn if a comparison like @code{x<=y<=z} appears; this is
3785 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
3786 interpretation from that of ordinary mathematical notation.
3787
3788 Also warn about constructions where there may be confusion to which
3789 @code{if} statement an @code{else} branch belongs. Here is an example of
3790 such a case:
3791
3792 @smallexample
3793 @group
3794 @{
3795 if (a)
3796 if (b)
3797 foo ();
3798 else
3799 bar ();
3800 @}
3801 @end group
3802 @end smallexample
3803
3804 In C/C++, every @code{else} branch belongs to the innermost possible
3805 @code{if} statement, which in this example is @code{if (b)}. This is
3806 often not what the programmer expected, as illustrated in the above
3807 example by indentation the programmer chose. When there is the
3808 potential for this confusion, GCC issues a warning when this flag
3809 is specified. To eliminate the warning, add explicit braces around
3810 the innermost @code{if} statement so there is no way the @code{else}
3811 can belong to the enclosing @code{if}. The resulting code
3812 looks like this:
3813
3814 @smallexample
3815 @group
3816 @{
3817 if (a)
3818 @{
3819 if (b)
3820 foo ();
3821 else
3822 bar ();
3823 @}
3824 @}
3825 @end group
3826 @end smallexample
3827
3828 Also warn for dangerous uses of the GNU extension to
3829 @code{?:} with omitted middle operand. When the condition
3830 in the @code{?}: operator is a boolean expression, the omitted value is
3831 always 1. Often programmers expect it to be a value computed
3832 inside the conditional expression instead.
3833
3834 This warning is enabled by @option{-Wall}.
3835
3836 @item -Wsequence-point
3837 @opindex Wsequence-point
3838 @opindex Wno-sequence-point
3839 Warn about code that may have undefined semantics because of violations
3840 of sequence point rules in the C and C++ standards.
3841
3842 The C and C++ standards define the order in which expressions in a C/C++
3843 program are evaluated in terms of @dfn{sequence points}, which represent
3844 a partial ordering between the execution of parts of the program: those
3845 executed before the sequence point, and those executed after it. These
3846 occur after the evaluation of a full expression (one which is not part
3847 of a larger expression), after the evaluation of the first operand of a
3848 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3849 function is called (but after the evaluation of its arguments and the
3850 expression denoting the called function), and in certain other places.
3851 Other than as expressed by the sequence point rules, the order of
3852 evaluation of subexpressions of an expression is not specified. All
3853 these rules describe only a partial order rather than a total order,
3854 since, for example, if two functions are called within one expression
3855 with no sequence point between them, the order in which the functions
3856 are called is not specified. However, the standards committee have
3857 ruled that function calls do not overlap.
3858
3859 It is not specified when between sequence points modifications to the
3860 values of objects take effect. Programs whose behavior depends on this
3861 have undefined behavior; the C and C++ standards specify that ``Between
3862 the previous and next sequence point an object shall have its stored
3863 value modified at most once by the evaluation of an expression.
3864 Furthermore, the prior value shall be read only to determine the value
3865 to be stored.''. If a program breaks these rules, the results on any
3866 particular implementation are entirely unpredictable.
3867
3868 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
3869 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
3870 diagnosed by this option, and it may give an occasional false positive
3871 result, but in general it has been found fairly effective at detecting
3872 this sort of problem in programs.
3873
3874 The standard is worded confusingly, therefore there is some debate
3875 over the precise meaning of the sequence point rules in subtle cases.
3876 Links to discussions of the problem, including proposed formal
3877 definitions, may be found on the GCC readings page, at
3878 @uref{http://gcc.gnu.org/@/readings.html}.
3879
3880 This warning is enabled by @option{-Wall} for C and C++.
3881
3882 @item -Wno-return-local-addr
3883 @opindex Wno-return-local-addr
3884 @opindex Wreturn-local-addr
3885 Do not warn about returning a pointer (or in C++, a reference) to a
3886 variable that goes out of scope after the function returns.
3887
3888 @item -Wreturn-type
3889 @opindex Wreturn-type
3890 @opindex Wno-return-type
3891 Warn whenever a function is defined with a return type that defaults
3892 to @code{int}. Also warn about any @code{return} statement with no
3893 return value in a function whose return type is not @code{void}
3894 (falling off the end of the function body is considered returning
3895 without a value), and about a @code{return} statement with an
3896 expression in a function whose return type is @code{void}.
3897
3898 For C++, a function without return type always produces a diagnostic
3899 message, even when @option{-Wno-return-type} is specified. The only
3900 exceptions are @code{main} and functions defined in system headers.
3901
3902 This warning is enabled by @option{-Wall}.
3903
3904 @item -Wshift-count-negative
3905 @opindex Wshift-count-negative
3906 @opindex Wno-shift-count-negative
3907 Warn if shift count is negative. This warning is enabled by default.
3908
3909 @item -Wshift-count-overflow
3910 @opindex Wshift-count-overflow
3911 @opindex Wno-shift-count-overflow
3912 Warn if shift count >= width of type. This warning is enabled by default.
3913
3914 @item -Wswitch
3915 @opindex Wswitch
3916 @opindex Wno-switch
3917 Warn whenever a @code{switch} statement has an index of enumerated type
3918 and lacks a @code{case} for one or more of the named codes of that
3919 enumeration. (The presence of a @code{default} label prevents this
3920 warning.) @code{case} labels outside the enumeration range also
3921 provoke warnings when this option is used (even if there is a
3922 @code{default} label).
3923 This warning is enabled by @option{-Wall}.
3924
3925 @item -Wswitch-default
3926 @opindex Wswitch-default
3927 @opindex Wno-switch-default
3928 Warn whenever a @code{switch} statement does not have a @code{default}
3929 case.
3930
3931 @item -Wswitch-enum
3932 @opindex Wswitch-enum
3933 @opindex Wno-switch-enum
3934 Warn whenever a @code{switch} statement has an index of enumerated type
3935 and lacks a @code{case} for one or more of the named codes of that
3936 enumeration. @code{case} labels outside the enumeration range also
3937 provoke warnings when this option is used. The only difference
3938 between @option{-Wswitch} and this option is that this option gives a
3939 warning about an omitted enumeration code even if there is a
3940 @code{default} label.
3941
3942 @item -Wswitch-bool
3943 @opindex Wswitch-bool
3944 @opindex Wno-switch-bool
3945 Warn whenever a @code{switch} statement has an index of boolean type.
3946 It is possible to suppress this warning by casting the controlling
3947 expression to a type other than @code{bool}. For example:
3948 @smallexample
3949 @group
3950 switch ((int) (a == 4))
3951 @{
3952 @dots{}
3953 @}
3954 @end group
3955 @end smallexample
3956 This warning is enabled by default for C and C++ programs.
3957
3958 @item -Wsync-nand @r{(C and C++ only)}
3959 @opindex Wsync-nand
3960 @opindex Wno-sync-nand
3961 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3962 built-in functions are used. These functions changed semantics in GCC 4.4.
3963
3964 @item -Wtrigraphs
3965 @opindex Wtrigraphs
3966 @opindex Wno-trigraphs
3967 Warn if any trigraphs are encountered that might change the meaning of
3968 the program (trigraphs within comments are not warned about).
3969 This warning is enabled by @option{-Wall}.
3970
3971 @item -Wunused-but-set-parameter
3972 @opindex Wunused-but-set-parameter
3973 @opindex Wno-unused-but-set-parameter
3974 Warn whenever a function parameter is assigned to, but otherwise unused
3975 (aside from its declaration).
3976
3977 To suppress this warning use the @code{unused} attribute
3978 (@pxref{Variable Attributes}).
3979
3980 This warning is also enabled by @option{-Wunused} together with
3981 @option{-Wextra}.
3982
3983 @item -Wunused-but-set-variable
3984 @opindex Wunused-but-set-variable
3985 @opindex Wno-unused-but-set-variable
3986 Warn whenever a local variable is assigned to, but otherwise unused
3987 (aside from its declaration).
3988 This warning is enabled by @option{-Wall}.
3989
3990 To suppress this warning use the @code{unused} attribute
3991 (@pxref{Variable Attributes}).
3992
3993 This warning is also enabled by @option{-Wunused}, which is enabled
3994 by @option{-Wall}.
3995
3996 @item -Wunused-function
3997 @opindex Wunused-function
3998 @opindex Wno-unused-function
3999 Warn whenever a static function is declared but not defined or a
4000 non-inline static function is unused.
4001 This warning is enabled by @option{-Wall}.
4002
4003 @item -Wunused-label
4004 @opindex Wunused-label
4005 @opindex Wno-unused-label
4006 Warn whenever a label is declared but not used.
4007 This warning is enabled by @option{-Wall}.
4008
4009 To suppress this warning use the @code{unused} attribute
4010 (@pxref{Variable Attributes}).
4011
4012 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4013 @opindex Wunused-local-typedefs
4014 Warn when a typedef locally defined in a function is not used.
4015 This warning is enabled by @option{-Wall}.
4016
4017 @item -Wunused-parameter
4018 @opindex Wunused-parameter
4019 @opindex Wno-unused-parameter
4020 Warn whenever a function parameter is unused aside from its declaration.
4021
4022 To suppress this warning use the @code{unused} attribute
4023 (@pxref{Variable Attributes}).
4024
4025 @item -Wno-unused-result
4026 @opindex Wunused-result
4027 @opindex Wno-unused-result
4028 Do not warn if a caller of a function marked with attribute
4029 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4030 its return value. The default is @option{-Wunused-result}.
4031
4032 @item -Wunused-variable
4033 @opindex Wunused-variable
4034 @opindex Wno-unused-variable
4035 Warn whenever a local variable or non-constant static variable is unused
4036 aside from its declaration.
4037 This warning is enabled by @option{-Wall}.
4038
4039 To suppress this warning use the @code{unused} attribute
4040 (@pxref{Variable Attributes}).
4041
4042 @item -Wunused-value
4043 @opindex Wunused-value
4044 @opindex Wno-unused-value
4045 Warn whenever a statement computes a result that is explicitly not
4046 used. To suppress this warning cast the unused expression to
4047 @code{void}. This includes an expression-statement or the left-hand
4048 side of a comma expression that contains no side effects. For example,
4049 an expression such as @code{x[i,j]} causes a warning, while
4050 @code{x[(void)i,j]} does not.
4051
4052 This warning is enabled by @option{-Wall}.
4053
4054 @item -Wunused
4055 @opindex Wunused
4056 @opindex Wno-unused
4057 All the above @option{-Wunused} options combined.
4058
4059 In order to get a warning about an unused function parameter, you must
4060 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4061 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4062
4063 @item -Wuninitialized
4064 @opindex Wuninitialized
4065 @opindex Wno-uninitialized
4066 Warn if an automatic variable is used without first being initialized
4067 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4068 warn if a non-static reference or non-static @code{const} member
4069 appears in a class without constructors.
4070
4071 If you want to warn about code that uses the uninitialized value of the
4072 variable in its own initializer, use the @option{-Winit-self} option.
4073
4074 These warnings occur for individual uninitialized or clobbered
4075 elements of structure, union or array variables as well as for
4076 variables that are uninitialized or clobbered as a whole. They do
4077 not occur for variables or elements declared @code{volatile}. Because
4078 these warnings depend on optimization, the exact variables or elements
4079 for which there are warnings depends on the precise optimization
4080 options and version of GCC used.
4081
4082 Note that there may be no warning about a variable that is used only
4083 to compute a value that itself is never used, because such
4084 computations may be deleted by data flow analysis before the warnings
4085 are printed.
4086
4087 @item -Wmaybe-uninitialized
4088 @opindex Wmaybe-uninitialized
4089 @opindex Wno-maybe-uninitialized
4090 For an automatic variable, if there exists a path from the function
4091 entry to a use of the variable that is initialized, but there exist
4092 some other paths for which the variable is not initialized, the compiler
4093 emits a warning if it cannot prove the uninitialized paths are not
4094 executed at run time. These warnings are made optional because GCC is
4095 not smart enough to see all the reasons why the code might be correct
4096 in spite of appearing to have an error. Here is one example of how
4097 this can happen:
4098
4099 @smallexample
4100 @group
4101 @{
4102 int x;
4103 switch (y)
4104 @{
4105 case 1: x = 1;
4106 break;
4107 case 2: x = 4;
4108 break;
4109 case 3: x = 5;
4110 @}
4111 foo (x);
4112 @}
4113 @end group
4114 @end smallexample
4115
4116 @noindent
4117 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4118 always initialized, but GCC doesn't know this. To suppress the
4119 warning, you need to provide a default case with assert(0) or
4120 similar code.
4121
4122 @cindex @code{longjmp} warnings
4123 This option also warns when a non-volatile automatic variable might be
4124 changed by a call to @code{longjmp}. These warnings as well are possible
4125 only in optimizing compilation.
4126
4127 The compiler sees only the calls to @code{setjmp}. It cannot know
4128 where @code{longjmp} will be called; in fact, a signal handler could
4129 call it at any point in the code. As a result, you may get a warning
4130 even when there is in fact no problem because @code{longjmp} cannot
4131 in fact be called at the place that would cause a problem.
4132
4133 Some spurious warnings can be avoided if you declare all the functions
4134 you use that never return as @code{noreturn}. @xref{Function
4135 Attributes}.
4136
4137 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4138
4139 @item -Wunknown-pragmas
4140 @opindex Wunknown-pragmas
4141 @opindex Wno-unknown-pragmas
4142 @cindex warning for unknown pragmas
4143 @cindex unknown pragmas, warning
4144 @cindex pragmas, warning of unknown
4145 Warn when a @code{#pragma} directive is encountered that is not understood by
4146 GCC@. If this command-line option is used, warnings are even issued
4147 for unknown pragmas in system header files. This is not the case if
4148 the warnings are only enabled by the @option{-Wall} command-line option.
4149
4150 @item -Wno-pragmas
4151 @opindex Wno-pragmas
4152 @opindex Wpragmas
4153 Do not warn about misuses of pragmas, such as incorrect parameters,
4154 invalid syntax, or conflicts between pragmas. See also
4155 @option{-Wunknown-pragmas}.
4156
4157 @item -Wstrict-aliasing
4158 @opindex Wstrict-aliasing
4159 @opindex Wno-strict-aliasing
4160 This option is only active when @option{-fstrict-aliasing} is active.
4161 It warns about code that might break the strict aliasing rules that the
4162 compiler is using for optimization. The warning does not catch all
4163 cases, but does attempt to catch the more common pitfalls. It is
4164 included in @option{-Wall}.
4165 It is equivalent to @option{-Wstrict-aliasing=3}
4166
4167 @item -Wstrict-aliasing=n
4168 @opindex Wstrict-aliasing=n
4169 This option is only active when @option{-fstrict-aliasing} is active.
4170 It warns about code that might break the strict aliasing rules that the
4171 compiler is using for optimization.
4172 Higher levels correspond to higher accuracy (fewer false positives).
4173 Higher levels also correspond to more effort, similar to the way @option{-O}
4174 works.
4175 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4176
4177 Level 1: Most aggressive, quick, least accurate.
4178 Possibly useful when higher levels
4179 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4180 false negatives. However, it has many false positives.
4181 Warns for all pointer conversions between possibly incompatible types,
4182 even if never dereferenced. Runs in the front end only.
4183
4184 Level 2: Aggressive, quick, not too precise.
4185 May still have many false positives (not as many as level 1 though),
4186 and few false negatives (but possibly more than level 1).
4187 Unlike level 1, it only warns when an address is taken. Warns about
4188 incomplete types. Runs in the front end only.
4189
4190 Level 3 (default for @option{-Wstrict-aliasing}):
4191 Should have very few false positives and few false
4192 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4193 Takes care of the common pun+dereference pattern in the front end:
4194 @code{*(int*)&some_float}.
4195 If optimization is enabled, it also runs in the back end, where it deals
4196 with multiple statement cases using flow-sensitive points-to information.
4197 Only warns when the converted pointer is dereferenced.
4198 Does not warn about incomplete types.
4199
4200 @item -Wstrict-overflow
4201 @itemx -Wstrict-overflow=@var{n}
4202 @opindex Wstrict-overflow
4203 @opindex Wno-strict-overflow
4204 This option is only active when @option{-fstrict-overflow} is active.
4205 It warns about cases where the compiler optimizes based on the
4206 assumption that signed overflow does not occur. Note that it does not
4207 warn about all cases where the code might overflow: it only warns
4208 about cases where the compiler implements some optimization. Thus
4209 this warning depends on the optimization level.
4210
4211 An optimization that assumes that signed overflow does not occur is
4212 perfectly safe if the values of the variables involved are such that
4213 overflow never does, in fact, occur. Therefore this warning can
4214 easily give a false positive: a warning about code that is not
4215 actually a problem. To help focus on important issues, several
4216 warning levels are defined. No warnings are issued for the use of
4217 undefined signed overflow when estimating how many iterations a loop
4218 requires, in particular when determining whether a loop will be
4219 executed at all.
4220
4221 @table @gcctabopt
4222 @item -Wstrict-overflow=1
4223 Warn about cases that are both questionable and easy to avoid. For
4224 example, with @option{-fstrict-overflow}, the compiler simplifies
4225 @code{x + 1 > x} to @code{1}. This level of
4226 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4227 are not, and must be explicitly requested.
4228
4229 @item -Wstrict-overflow=2
4230 Also warn about other cases where a comparison is simplified to a
4231 constant. For example: @code{abs (x) >= 0}. This can only be
4232 simplified when @option{-fstrict-overflow} is in effect, because
4233 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4234 zero. @option{-Wstrict-overflow} (with no level) is the same as
4235 @option{-Wstrict-overflow=2}.
4236
4237 @item -Wstrict-overflow=3
4238 Also warn about other cases where a comparison is simplified. For
4239 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4240
4241 @item -Wstrict-overflow=4
4242 Also warn about other simplifications not covered by the above cases.
4243 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4244
4245 @item -Wstrict-overflow=5
4246 Also warn about cases where the compiler reduces the magnitude of a
4247 constant involved in a comparison. For example: @code{x + 2 > y} is
4248 simplified to @code{x + 1 >= y}. This is reported only at the
4249 highest warning level because this simplification applies to many
4250 comparisons, so this warning level gives a very large number of
4251 false positives.
4252 @end table
4253
4254 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4255 @opindex Wsuggest-attribute=
4256 @opindex Wno-suggest-attribute=
4257 Warn for cases where adding an attribute may be beneficial. The
4258 attributes currently supported are listed below.
4259
4260 @table @gcctabopt
4261 @item -Wsuggest-attribute=pure
4262 @itemx -Wsuggest-attribute=const
4263 @itemx -Wsuggest-attribute=noreturn
4264 @opindex Wsuggest-attribute=pure
4265 @opindex Wno-suggest-attribute=pure
4266 @opindex Wsuggest-attribute=const
4267 @opindex Wno-suggest-attribute=const
4268 @opindex Wsuggest-attribute=noreturn
4269 @opindex Wno-suggest-attribute=noreturn
4270
4271 Warn about functions that might be candidates for attributes
4272 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4273 functions visible in other compilation units or (in the case of @code{pure} and
4274 @code{const}) if it cannot prove that the function returns normally. A function
4275 returns normally if it doesn't contain an infinite loop or return abnormally
4276 by throwing, calling @code{abort} or trapping. This analysis requires option
4277 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4278 higher. Higher optimization levels improve the accuracy of the analysis.
4279
4280 @item -Wsuggest-attribute=format
4281 @itemx -Wmissing-format-attribute
4282 @opindex Wsuggest-attribute=format
4283 @opindex Wmissing-format-attribute
4284 @opindex Wno-suggest-attribute=format
4285 @opindex Wno-missing-format-attribute
4286 @opindex Wformat
4287 @opindex Wno-format
4288
4289 Warn about function pointers that might be candidates for @code{format}
4290 attributes. Note these are only possible candidates, not absolute ones.
4291 GCC guesses that function pointers with @code{format} attributes that
4292 are used in assignment, initialization, parameter passing or return
4293 statements should have a corresponding @code{format} attribute in the
4294 resulting type. I.e.@: the left-hand side of the assignment or
4295 initialization, the type of the parameter variable, or the return type
4296 of the containing function respectively should also have a @code{format}
4297 attribute to avoid the warning.
4298
4299 GCC also warns about function definitions that might be
4300 candidates for @code{format} attributes. Again, these are only
4301 possible candidates. GCC guesses that @code{format} attributes
4302 might be appropriate for any function that calls a function like
4303 @code{vprintf} or @code{vscanf}, but this might not always be the
4304 case, and some functions for which @code{format} attributes are
4305 appropriate may not be detected.
4306 @end table
4307
4308 @item -Wsuggest-final-types
4309 @opindex Wno-suggest-final-types
4310 @opindex Wsuggest-final-types
4311 Warn about types with virtual methods where code quality would be improved
4312 if the type were declared with the C++11 @code{final} specifier,
4313 or, if possible,
4314 declared in an anonymous namespace. This allows GCC to more aggressively
4315 devirtualize the polymorphic calls. This warning is more effective with link
4316 time optimization, where the information about the class hierarchy graph is
4317 more complete.
4318
4319 @item -Wsuggest-final-methods
4320 @opindex Wno-suggest-final-methods
4321 @opindex Wsuggest-final-methods
4322 Warn about virtual methods where code quality would be improved if the method
4323 were declared with the C++11 @code{final} specifier,
4324 or, if possible, its type were
4325 declared in an anonymous namespace or with the @code{final} specifier.
4326 This warning is
4327 more effective with link time optimization, where the information about the
4328 class hierarchy graph is more complete. It is recommended to first consider
4329 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4330 annotations.
4331
4332 @item -Wsuggest-override
4333 Warn about overriding virtual functions that are not marked with the override
4334 keyword.
4335
4336 @item -Warray-bounds
4337 @itemx -Warray-bounds=@var{n}
4338 @opindex Wno-array-bounds
4339 @opindex Warray-bounds
4340 This option is only active when @option{-ftree-vrp} is active
4341 (default for @option{-O2} and above). It warns about subscripts to arrays
4342 that are always out of bounds. This warning is enabled by @option{-Wall}.
4343
4344 @table @gcctabopt
4345 @item -Warray-bounds=1
4346 This is the warning level of @option{-Warray-bounds} and is enabled
4347 by @option{-Wall}; higher levels are not, and must be explicitly requested.
4348
4349 @item -Warray-bounds=2
4350 This warning level also warns about out of bounds access for
4351 arrays at the end of a struct and for arrays accessed through
4352 pointers. This warning level may give a larger number of
4353 false positives and is deactivated by default.
4354 @end table
4355
4356
4357 @item -Wbool-compare
4358 @opindex Wno-bool-compare
4359 @opindex Wbool-compare
4360 Warn about boolean expression compared with an integer value different from
4361 @code{true}/@code{false}. For instance, the following comparison is
4362 always false:
4363 @smallexample
4364 int n = 5;
4365 @dots{}
4366 if ((n > 1) == 2) @{ @dots{} @}
4367 @end smallexample
4368 This warning is enabled by @option{-Wall}.
4369
4370 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
4371 @opindex Wno-discarded-qualifiers
4372 @opindex Wdiscarded-qualifiers
4373 Do not warn if type qualifiers on pointers are being discarded.
4374 Typically, the compiler warns if a @code{const char *} variable is
4375 passed to a function that takes a @code{char *} parameter. This option
4376 can be used to suppress such a warning.
4377
4378 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
4379 @opindex Wno-discarded-array-qualifiers
4380 @opindex Wdiscarded-array-qualifiers
4381 Do not warn if type qualifiers on arrays which are pointer targets
4382 are being discarded. Typically, the compiler warns if a
4383 @code{const int (*)[]} variable is passed to a function that
4384 takes a @code{int (*)[]} parameter. This option can be used to
4385 suppress such a warning.
4386
4387 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
4388 @opindex Wno-incompatible-pointer-types
4389 @opindex Wincompatible-pointer-types
4390 Do not warn when there is a conversion between pointers that have incompatible
4391 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
4392 which warns for pointer argument passing or assignment with different
4393 signedness.
4394
4395 @item -Wno-int-conversion @r{(C and Objective-C only)}
4396 @opindex Wno-int-conversion
4397 @opindex Wint-conversion
4398 Do not warn about incompatible integer to pointer and pointer to integer
4399 conversions. This warning is about implicit conversions; for explicit
4400 conversions the warnings @option{-Wno-int-to-pointer-cast} and
4401 @option{-Wno-pointer-to-int-cast} may be used.
4402
4403 @item -Wno-div-by-zero
4404 @opindex Wno-div-by-zero
4405 @opindex Wdiv-by-zero
4406 Do not warn about compile-time integer division by zero. Floating-point
4407 division by zero is not warned about, as it can be a legitimate way of
4408 obtaining infinities and NaNs.
4409
4410 @item -Wsystem-headers
4411 @opindex Wsystem-headers
4412 @opindex Wno-system-headers
4413 @cindex warnings from system headers
4414 @cindex system headers, warnings from
4415 Print warning messages for constructs found in system header files.
4416 Warnings from system headers are normally suppressed, on the assumption
4417 that they usually do not indicate real problems and would only make the
4418 compiler output harder to read. Using this command-line option tells
4419 GCC to emit warnings from system headers as if they occurred in user
4420 code. However, note that using @option{-Wall} in conjunction with this
4421 option does @emph{not} warn about unknown pragmas in system
4422 headers---for that, @option{-Wunknown-pragmas} must also be used.
4423
4424 @item -Wtrampolines
4425 @opindex Wtrampolines
4426 @opindex Wno-trampolines
4427 Warn about trampolines generated for pointers to nested functions.
4428 A trampoline is a small piece of data or code that is created at run
4429 time on the stack when the address of a nested function is taken, and is
4430 used to call the nested function indirectly. For some targets, it is
4431 made up of data only and thus requires no special treatment. But, for
4432 most targets, it is made up of code and thus requires the stack to be
4433 made executable in order for the program to work properly.
4434
4435 @item -Wfloat-equal
4436 @opindex Wfloat-equal
4437 @opindex Wno-float-equal
4438 Warn if floating-point values are used in equality comparisons.
4439
4440 The idea behind this is that sometimes it is convenient (for the
4441 programmer) to consider floating-point values as approximations to
4442 infinitely precise real numbers. If you are doing this, then you need
4443 to compute (by analyzing the code, or in some other way) the maximum or
4444 likely maximum error that the computation introduces, and allow for it
4445 when performing comparisons (and when producing output, but that's a
4446 different problem). In particular, instead of testing for equality, you
4447 should check to see whether the two values have ranges that overlap; and
4448 this is done with the relational operators, so equality comparisons are
4449 probably mistaken.
4450
4451 @item -Wtraditional @r{(C and Objective-C only)}
4452 @opindex Wtraditional
4453 @opindex Wno-traditional
4454 Warn about certain constructs that behave differently in traditional and
4455 ISO C@. Also warn about ISO C constructs that have no traditional C
4456 equivalent, and/or problematic constructs that should be avoided.
4457
4458 @itemize @bullet
4459 @item
4460 Macro parameters that appear within string literals in the macro body.
4461 In traditional C macro replacement takes place within string literals,
4462 but in ISO C it does not.
4463
4464 @item
4465 In traditional C, some preprocessor directives did not exist.
4466 Traditional preprocessors only considered a line to be a directive
4467 if the @samp{#} appeared in column 1 on the line. Therefore
4468 @option{-Wtraditional} warns about directives that traditional C
4469 understands but ignores because the @samp{#} does not appear as the
4470 first character on the line. It also suggests you hide directives like
4471 @code{#pragma} not understood by traditional C by indenting them. Some
4472 traditional implementations do not recognize @code{#elif}, so this option
4473 suggests avoiding it altogether.
4474
4475 @item
4476 A function-like macro that appears without arguments.
4477
4478 @item
4479 The unary plus operator.
4480
4481 @item
4482 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4483 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
4484 constants.) Note, these suffixes appear in macros defined in the system
4485 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4486 Use of these macros in user code might normally lead to spurious
4487 warnings, however GCC's integrated preprocessor has enough context to
4488 avoid warning in these cases.
4489
4490 @item
4491 A function declared external in one block and then used after the end of
4492 the block.
4493
4494 @item
4495 A @code{switch} statement has an operand of type @code{long}.
4496
4497 @item
4498 A non-@code{static} function declaration follows a @code{static} one.
4499 This construct is not accepted by some traditional C compilers.
4500
4501 @item
4502 The ISO type of an integer constant has a different width or
4503 signedness from its traditional type. This warning is only issued if
4504 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
4505 typically represent bit patterns, are not warned about.
4506
4507 @item
4508 Usage of ISO string concatenation is detected.
4509
4510 @item
4511 Initialization of automatic aggregates.
4512
4513 @item
4514 Identifier conflicts with labels. Traditional C lacks a separate
4515 namespace for labels.
4516
4517 @item
4518 Initialization of unions. If the initializer is zero, the warning is
4519 omitted. This is done under the assumption that the zero initializer in
4520 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4521 initializer warnings and relies on default initialization to zero in the
4522 traditional C case.
4523
4524 @item
4525 Conversions by prototypes between fixed/floating-point values and vice
4526 versa. The absence of these prototypes when compiling with traditional
4527 C causes serious problems. This is a subset of the possible
4528 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4529
4530 @item
4531 Use of ISO C style function definitions. This warning intentionally is
4532 @emph{not} issued for prototype declarations or variadic functions
4533 because these ISO C features appear in your code when using
4534 libiberty's traditional C compatibility macros, @code{PARAMS} and
4535 @code{VPARAMS}. This warning is also bypassed for nested functions
4536 because that feature is already a GCC extension and thus not relevant to
4537 traditional C compatibility.
4538 @end itemize
4539
4540 @item -Wtraditional-conversion @r{(C and Objective-C only)}
4541 @opindex Wtraditional-conversion
4542 @opindex Wno-traditional-conversion
4543 Warn if a prototype causes a type conversion that is different from what
4544 would happen to the same argument in the absence of a prototype. This
4545 includes conversions of fixed point to floating and vice versa, and
4546 conversions changing the width or signedness of a fixed-point argument
4547 except when the same as the default promotion.
4548
4549 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4550 @opindex Wdeclaration-after-statement
4551 @opindex Wno-declaration-after-statement
4552 Warn when a declaration is found after a statement in a block. This
4553 construct, known from C++, was introduced with ISO C99 and is by default
4554 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
4555
4556 @item -Wundef
4557 @opindex Wundef
4558 @opindex Wno-undef
4559 Warn if an undefined identifier is evaluated in an @code{#if} directive.
4560
4561 @item -Wno-endif-labels
4562 @opindex Wno-endif-labels
4563 @opindex Wendif-labels
4564 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
4565
4566 @item -Wshadow
4567 @opindex Wshadow
4568 @opindex Wno-shadow
4569 Warn whenever a local variable or type declaration shadows another
4570 variable, parameter, type, class member (in C++), or instance variable
4571 (in Objective-C) or whenever a built-in function is shadowed. Note
4572 that in C++, the compiler warns if a local variable shadows an
4573 explicit typedef, but not if it shadows a struct/class/enum.
4574
4575 @item -Wno-shadow-ivar @r{(Objective-C only)}
4576 @opindex Wno-shadow-ivar
4577 @opindex Wshadow-ivar
4578 Do not warn whenever a local variable shadows an instance variable in an
4579 Objective-C method.
4580
4581 @item -Wlarger-than=@var{len}
4582 @opindex Wlarger-than=@var{len}
4583 @opindex Wlarger-than-@var{len}
4584 Warn whenever an object of larger than @var{len} bytes is defined.
4585
4586 @item -Wframe-larger-than=@var{len}
4587 @opindex Wframe-larger-than
4588 Warn if the size of a function frame is larger than @var{len} bytes.
4589 The computation done to determine the stack frame size is approximate
4590 and not conservative.
4591 The actual requirements may be somewhat greater than @var{len}
4592 even if you do not get a warning. In addition, any space allocated
4593 via @code{alloca}, variable-length arrays, or related constructs
4594 is not included by the compiler when determining
4595 whether or not to issue a warning.
4596
4597 @item -Wno-free-nonheap-object
4598 @opindex Wno-free-nonheap-object
4599 @opindex Wfree-nonheap-object
4600 Do not warn when attempting to free an object that was not allocated
4601 on the heap.
4602
4603 @item -Wstack-usage=@var{len}
4604 @opindex Wstack-usage
4605 Warn if the stack usage of a function might be larger than @var{len} bytes.
4606 The computation done to determine the stack usage is conservative.
4607 Any space allocated via @code{alloca}, variable-length arrays, or related
4608 constructs is included by the compiler when determining whether or not to
4609 issue a warning.
4610
4611 The message is in keeping with the output of @option{-fstack-usage}.
4612
4613 @itemize
4614 @item
4615 If the stack usage is fully static but exceeds the specified amount, it's:
4616
4617 @smallexample
4618 warning: stack usage is 1120 bytes
4619 @end smallexample
4620 @item
4621 If the stack usage is (partly) dynamic but bounded, it's:
4622
4623 @smallexample
4624 warning: stack usage might be 1648 bytes
4625 @end smallexample
4626 @item
4627 If the stack usage is (partly) dynamic and not bounded, it's:
4628
4629 @smallexample
4630 warning: stack usage might be unbounded
4631 @end smallexample
4632 @end itemize
4633
4634 @item -Wunsafe-loop-optimizations
4635 @opindex Wunsafe-loop-optimizations
4636 @opindex Wno-unsafe-loop-optimizations
4637 Warn if the loop cannot be optimized because the compiler cannot
4638 assume anything on the bounds of the loop indices. With
4639 @option{-funsafe-loop-optimizations} warn if the compiler makes
4640 such assumptions.
4641
4642 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
4643 @opindex Wno-pedantic-ms-format
4644 @opindex Wpedantic-ms-format
4645 When used in combination with @option{-Wformat}
4646 and @option{-pedantic} without GNU extensions, this option
4647 disables the warnings about non-ISO @code{printf} / @code{scanf} format
4648 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
4649 which depend on the MS runtime.
4650
4651 @item -Wpointer-arith
4652 @opindex Wpointer-arith
4653 @opindex Wno-pointer-arith
4654 Warn about anything that depends on the ``size of'' a function type or
4655 of @code{void}. GNU C assigns these types a size of 1, for
4656 convenience in calculations with @code{void *} pointers and pointers
4657 to functions. In C++, warn also when an arithmetic operation involves
4658 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
4659
4660 @item -Wtype-limits
4661 @opindex Wtype-limits
4662 @opindex Wno-type-limits
4663 Warn if a comparison is always true or always false due to the limited
4664 range of the data type, but do not warn for constant expressions. For
4665 example, warn if an unsigned variable is compared against zero with
4666 @code{<} or @code{>=}. This warning is also enabled by
4667 @option{-Wextra}.
4668
4669 @item -Wbad-function-cast @r{(C and Objective-C only)}
4670 @opindex Wbad-function-cast
4671 @opindex Wno-bad-function-cast
4672 Warn when a function call is cast to a non-matching type.
4673 For example, warn if a call to a function returning an integer type
4674 is cast to a pointer type.
4675
4676 @item -Wc90-c99-compat @r{(C and Objective-C only)}
4677 @opindex Wc90-c99-compat
4678 @opindex Wno-c90-c99-compat
4679 Warn about features not present in ISO C90, but present in ISO C99.
4680 For instance, warn about use of variable length arrays, @code{long long}
4681 type, @code{bool} type, compound literals, designated initializers, and so
4682 on. This option is independent of the standards mode. Warnings are disabled
4683 in the expression that follows @code{__extension__}.
4684
4685 @item -Wc99-c11-compat @r{(C and Objective-C only)}
4686 @opindex Wc99-c11-compat
4687 @opindex Wno-c99-c11-compat
4688 Warn about features not present in ISO C99, but present in ISO C11.
4689 For instance, warn about use of anonymous structures and unions,
4690 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
4691 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
4692 and so on. This option is independent of the standards mode. Warnings are
4693 disabled in the expression that follows @code{__extension__}.
4694
4695 @item -Wc++-compat @r{(C and Objective-C only)}
4696 @opindex Wc++-compat
4697 Warn about ISO C constructs that are outside of the common subset of
4698 ISO C and ISO C++, e.g.@: request for implicit conversion from
4699 @code{void *} to a pointer to non-@code{void} type.
4700
4701 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
4702 @opindex Wc++11-compat
4703 Warn about C++ constructs whose meaning differs between ISO C++ 1998
4704 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
4705 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
4706 enabled by @option{-Wall}.
4707
4708 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
4709 @opindex Wc++14-compat
4710 Warn about C++ constructs whose meaning differs between ISO C++ 2011
4711 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
4712
4713 @item -Wcast-qual
4714 @opindex Wcast-qual
4715 @opindex Wno-cast-qual
4716 Warn whenever a pointer is cast so as to remove a type qualifier from
4717 the target type. For example, warn if a @code{const char *} is cast
4718 to an ordinary @code{char *}.
4719
4720 Also warn when making a cast that introduces a type qualifier in an
4721 unsafe way. For example, casting @code{char **} to @code{const char **}
4722 is unsafe, as in this example:
4723
4724 @smallexample
4725 /* p is char ** value. */
4726 const char **q = (const char **) p;
4727 /* Assignment of readonly string to const char * is OK. */
4728 *q = "string";
4729 /* Now char** pointer points to read-only memory. */
4730 **p = 'b';
4731 @end smallexample
4732
4733 @item -Wcast-align
4734 @opindex Wcast-align
4735 @opindex Wno-cast-align
4736 Warn whenever a pointer is cast such that the required alignment of the
4737 target is increased. For example, warn if a @code{char *} is cast to
4738 an @code{int *} on machines where integers can only be accessed at
4739 two- or four-byte boundaries.
4740
4741 @item -Wwrite-strings
4742 @opindex Wwrite-strings
4743 @opindex Wno-write-strings
4744 When compiling C, give string constants the type @code{const
4745 char[@var{length}]} so that copying the address of one into a
4746 non-@code{const} @code{char *} pointer produces a warning. These
4747 warnings help you find at compile time code that can try to write
4748 into a string constant, but only if you have been very careful about
4749 using @code{const} in declarations and prototypes. Otherwise, it is
4750 just a nuisance. This is why we did not make @option{-Wall} request
4751 these warnings.
4752
4753 When compiling C++, warn about the deprecated conversion from string
4754 literals to @code{char *}. This warning is enabled by default for C++
4755 programs.
4756
4757 @item -Wclobbered
4758 @opindex Wclobbered
4759 @opindex Wno-clobbered
4760 Warn for variables that might be changed by @code{longjmp} or
4761 @code{vfork}. This warning is also enabled by @option{-Wextra}.
4762
4763 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4764 @opindex Wconditionally-supported
4765 @opindex Wno-conditionally-supported
4766 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4767
4768 @item -Wconversion
4769 @opindex Wconversion
4770 @opindex Wno-conversion
4771 Warn for implicit conversions that may alter a value. This includes
4772 conversions between real and integer, like @code{abs (x)} when
4773 @code{x} is @code{double}; conversions between signed and unsigned,
4774 like @code{unsigned ui = -1}; and conversions to smaller types, like
4775 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
4776 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
4777 changed by the conversion like in @code{abs (2.0)}. Warnings about
4778 conversions between signed and unsigned integers can be disabled by
4779 using @option{-Wno-sign-conversion}.
4780
4781 For C++, also warn for confusing overload resolution for user-defined
4782 conversions; and conversions that never use a type conversion
4783 operator: conversions to @code{void}, the same type, a base class or a
4784 reference to them. Warnings about conversions between signed and
4785 unsigned integers are disabled by default in C++ unless
4786 @option{-Wsign-conversion} is explicitly enabled.
4787
4788 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4789 @opindex Wconversion-null
4790 @opindex Wno-conversion-null
4791 Do not warn for conversions between @code{NULL} and non-pointer
4792 types. @option{-Wconversion-null} is enabled by default.
4793
4794 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4795 @opindex Wzero-as-null-pointer-constant
4796 @opindex Wno-zero-as-null-pointer-constant
4797 Warn when a literal '0' is used as null pointer constant. This can
4798 be useful to facilitate the conversion to @code{nullptr} in C++11.
4799
4800 @item -Wdate-time
4801 @opindex Wdate-time
4802 @opindex Wno-date-time
4803 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
4804 are encountered as they might prevent bit-wise-identical reproducible
4805 compilations.
4806
4807 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
4808 @opindex Wdelete-incomplete
4809 @opindex Wno-delete-incomplete
4810 Warn when deleting a pointer to incomplete type, which may cause
4811 undefined behavior at runtime. This warning is enabled by default.
4812
4813 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4814 @opindex Wuseless-cast
4815 @opindex Wno-useless-cast
4816 Warn when an expression is casted to its own type.
4817
4818 @item -Wempty-body
4819 @opindex Wempty-body
4820 @opindex Wno-empty-body
4821 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
4822 while} statement. This warning is also enabled by @option{-Wextra}.
4823
4824 @item -Wenum-compare
4825 @opindex Wenum-compare
4826 @opindex Wno-enum-compare
4827 Warn about a comparison between values of different enumerated types.
4828 In C++ enumeral mismatches in conditional expressions are also
4829 diagnosed and the warning is enabled by default. In C this warning is
4830 enabled by @option{-Wall}.
4831
4832 @item -Wjump-misses-init @r{(C, Objective-C only)}
4833 @opindex Wjump-misses-init
4834 @opindex Wno-jump-misses-init
4835 Warn if a @code{goto} statement or a @code{switch} statement jumps
4836 forward across the initialization of a variable, or jumps backward to a
4837 label after the variable has been initialized. This only warns about
4838 variables that are initialized when they are declared. This warning is
4839 only supported for C and Objective-C; in C++ this sort of branch is an
4840 error in any case.
4841
4842 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
4843 can be disabled with the @option{-Wno-jump-misses-init} option.
4844
4845 @item -Wsign-compare
4846 @opindex Wsign-compare
4847 @opindex Wno-sign-compare
4848 @cindex warning for comparison of signed and unsigned values
4849 @cindex comparison of signed and unsigned values, warning
4850 @cindex signed and unsigned values, comparison warning
4851 Warn when a comparison between signed and unsigned values could produce
4852 an incorrect result when the signed value is converted to unsigned.
4853 This warning is also enabled by @option{-Wextra}; to get the other warnings
4854 of @option{-Wextra} without this warning, use @option{-Wextra -Wno-sign-compare}.
4855
4856 @item -Wsign-conversion
4857 @opindex Wsign-conversion
4858 @opindex Wno-sign-conversion
4859 Warn for implicit conversions that may change the sign of an integer
4860 value, like assigning a signed integer expression to an unsigned
4861 integer variable. An explicit cast silences the warning. In C, this
4862 option is enabled also by @option{-Wconversion}.
4863
4864 @item -Wfloat-conversion
4865 @opindex Wfloat-conversion
4866 @opindex Wno-float-conversion
4867 Warn for implicit conversions that reduce the precision of a real value.
4868 This includes conversions from real to integer, and from higher precision
4869 real to lower precision real values. This option is also enabled by
4870 @option{-Wconversion}.
4871
4872 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4873 @opindex Wsized-deallocation
4874 @opindex Wno-sized-deallocation
4875 Warn about a definition of an unsized deallocation function
4876 @smallexample
4877 void operator delete (void *) noexcept;
4878 void operator delete[] (void *) noexcept;
4879 @end smallexample
4880 without a definition of the corresponding sized deallocation function
4881 @smallexample
4882 void operator delete (void *, std::size_t) noexcept;
4883 void operator delete[] (void *, std::size_t) noexcept;
4884 @end smallexample
4885 or vice versa. Enabled by @option{-Wextra} along with
4886 @option{-fsized-deallocation}.
4887
4888 @item -Wsizeof-pointer-memaccess
4889 @opindex Wsizeof-pointer-memaccess
4890 @opindex Wno-sizeof-pointer-memaccess
4891 Warn for suspicious length parameters to certain string and memory built-in
4892 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
4893 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
4894 but a pointer, and suggests a possible fix, or about
4895 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
4896 @option{-Wall}.
4897
4898 @item -Wsizeof-array-argument
4899 @opindex Wsizeof-array-argument
4900 @opindex Wno-sizeof-array-argument
4901 Warn when the @code{sizeof} operator is applied to a parameter that is
4902 declared as an array in a function definition. This warning is enabled by
4903 default for C and C++ programs.
4904
4905 @item -Wmemset-transposed-args
4906 @opindex Wmemset-transposed-args
4907 @opindex Wno-memset-transposed-args
4908 Warn for suspicious calls to the @code{memset} built-in function, if the
4909 second argument is not zero and the third argument is zero. This warns e.g.@
4910 about @code{memset (buf, sizeof buf, 0)} where most probably
4911 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
4912 is only emitted if the third argument is literal zero, if it is some expression
4913 that is folded to zero, or e.g. a cast of zero to some type etc., it
4914 is far less likely that user has mistakenly exchanged the arguments and
4915 no warning is emitted. This warning is enabled by @option{-Wall}.
4916
4917 @item -Waddress
4918 @opindex Waddress
4919 @opindex Wno-address
4920 Warn about suspicious uses of memory addresses. These include using
4921 the address of a function in a conditional expression, such as
4922 @code{void func(void); if (func)}, and comparisons against the memory
4923 address of a string literal, such as @code{if (x == "abc")}. Such
4924 uses typically indicate a programmer error: the address of a function
4925 always evaluates to true, so their use in a conditional usually
4926 indicate that the programmer forgot the parentheses in a function
4927 call; and comparisons against string literals result in unspecified
4928 behavior and are not portable in C, so they usually indicate that the
4929 programmer intended to use @code{strcmp}. This warning is enabled by
4930 @option{-Wall}.
4931
4932 @item -Wlogical-op
4933 @opindex Wlogical-op
4934 @opindex Wno-logical-op
4935 Warn about suspicious uses of logical operators in expressions.
4936 This includes using logical operators in contexts where a
4937 bit-wise operator is likely to be expected.
4938
4939 @item -Wlogical-not-parentheses
4940 @opindex Wlogical-not-parentheses
4941 @opindex Wno-logical-not-parentheses
4942 Warn about logical not used on the left hand side operand of a comparison.
4943 This option does not warn if the RHS operand is of a boolean type. Its
4944 purpose is to detect suspicious code like the following:
4945 @smallexample
4946 int a;
4947 @dots{}
4948 if (!a > 1) @{ @dots{} @}
4949 @end smallexample
4950
4951 It is possible to suppress the warning by wrapping the LHS into
4952 parentheses:
4953 @smallexample
4954 if ((!a) > 1) @{ @dots{} @}
4955 @end smallexample
4956
4957 This warning is enabled by @option{-Wall}.
4958
4959 @item -Waggregate-return
4960 @opindex Waggregate-return
4961 @opindex Wno-aggregate-return
4962 Warn if any functions that return structures or unions are defined or
4963 called. (In languages where you can return an array, this also elicits
4964 a warning.)
4965
4966 @item -Wno-aggressive-loop-optimizations
4967 @opindex Wno-aggressive-loop-optimizations
4968 @opindex Waggressive-loop-optimizations
4969 Warn if in a loop with constant number of iterations the compiler detects
4970 undefined behavior in some statement during one or more of the iterations.
4971
4972 @item -Wno-attributes
4973 @opindex Wno-attributes
4974 @opindex Wattributes
4975 Do not warn if an unexpected @code{__attribute__} is used, such as
4976 unrecognized attributes, function attributes applied to variables,
4977 etc. This does not stop errors for incorrect use of supported
4978 attributes.
4979
4980 @item -Wno-builtin-macro-redefined
4981 @opindex Wno-builtin-macro-redefined
4982 @opindex Wbuiltin-macro-redefined
4983 Do not warn if certain built-in macros are redefined. This suppresses
4984 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
4985 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
4986
4987 @item -Wstrict-prototypes @r{(C and Objective-C only)}
4988 @opindex Wstrict-prototypes
4989 @opindex Wno-strict-prototypes
4990 Warn if a function is declared or defined without specifying the
4991 argument types. (An old-style function definition is permitted without
4992 a warning if preceded by a declaration that specifies the argument
4993 types.)
4994
4995 @item -Wold-style-declaration @r{(C and Objective-C only)}
4996 @opindex Wold-style-declaration
4997 @opindex Wno-old-style-declaration
4998 Warn for obsolescent usages, according to the C Standard, in a
4999 declaration. For example, warn if storage-class specifiers like
5000 @code{static} are not the first things in a declaration. This warning
5001 is also enabled by @option{-Wextra}.
5002
5003 @item -Wold-style-definition @r{(C and Objective-C only)}
5004 @opindex Wold-style-definition
5005 @opindex Wno-old-style-definition
5006 Warn if an old-style function definition is used. A warning is given
5007 even if there is a previous prototype.
5008
5009 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5010 @opindex Wmissing-parameter-type
5011 @opindex Wno-missing-parameter-type
5012 A function parameter is declared without a type specifier in K&R-style
5013 functions:
5014
5015 @smallexample
5016 void foo(bar) @{ @}
5017 @end smallexample
5018
5019 This warning is also enabled by @option{-Wextra}.
5020
5021 @item -Wmissing-prototypes @r{(C and Objective-C only)}
5022 @opindex Wmissing-prototypes
5023 @opindex Wno-missing-prototypes
5024 Warn if a global function is defined without a previous prototype
5025 declaration. This warning is issued even if the definition itself
5026 provides a prototype. Use this option to detect global functions
5027 that do not have a matching prototype declaration in a header file.
5028 This option is not valid for C++ because all function declarations
5029 provide prototypes and a non-matching declaration declares an
5030 overload rather than conflict with an earlier declaration.
5031 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
5032
5033 @item -Wmissing-declarations
5034 @opindex Wmissing-declarations
5035 @opindex Wno-missing-declarations
5036 Warn if a global function is defined without a previous declaration.
5037 Do so even if the definition itself provides a prototype.
5038 Use this option to detect global functions that are not declared in
5039 header files. In C, no warnings are issued for functions with previous
5040 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
5041 missing prototypes. In C++, no warnings are issued for function templates,
5042 or for inline functions, or for functions in anonymous namespaces.
5043
5044 @item -Wmissing-field-initializers
5045 @opindex Wmissing-field-initializers
5046 @opindex Wno-missing-field-initializers
5047 @opindex W
5048 @opindex Wextra
5049 @opindex Wno-extra
5050 Warn if a structure's initializer has some fields missing. For
5051 example, the following code causes such a warning, because
5052 @code{x.h} is implicitly zero:
5053
5054 @smallexample
5055 struct s @{ int f, g, h; @};
5056 struct s x = @{ 3, 4 @};
5057 @end smallexample
5058
5059 This option does not warn about designated initializers, so the following
5060 modification does not trigger a warning:
5061
5062 @smallexample
5063 struct s @{ int f, g, h; @};
5064 struct s x = @{ .f = 3, .g = 4 @};
5065 @end smallexample
5066
5067 In C++ this option does not warn either about the empty @{ @}
5068 initializer, for example:
5069
5070 @smallexample
5071 struct s @{ int f, g, h; @};
5072 s x = @{ @};
5073 @end smallexample
5074
5075 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
5076 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
5077
5078 @item -Wno-multichar
5079 @opindex Wno-multichar
5080 @opindex Wmultichar
5081 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
5082 Usually they indicate a typo in the user's code, as they have
5083 implementation-defined values, and should not be used in portable code.
5084
5085 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
5086 @opindex Wnormalized=
5087 @opindex Wnormalized
5088 @opindex Wno-normalized
5089 @cindex NFC
5090 @cindex NFKC
5091 @cindex character set, input normalization
5092 In ISO C and ISO C++, two identifiers are different if they are
5093 different sequences of characters. However, sometimes when characters
5094 outside the basic ASCII character set are used, you can have two
5095 different character sequences that look the same. To avoid confusion,
5096 the ISO 10646 standard sets out some @dfn{normalization rules} which
5097 when applied ensure that two sequences that look the same are turned into
5098 the same sequence. GCC can warn you if you are using identifiers that
5099 have not been normalized; this option controls that warning.
5100
5101 There are four levels of warning supported by GCC@. The default is
5102 @option{-Wnormalized=nfc}, which warns about any identifier that is
5103 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
5104 recommended form for most uses. It is equivalent to
5105 @option{-Wnormalized}.
5106
5107 Unfortunately, there are some characters allowed in identifiers by
5108 ISO C and ISO C++ that, when turned into NFC, are not allowed in
5109 identifiers. That is, there's no way to use these symbols in portable
5110 ISO C or C++ and have all your identifiers in NFC@.
5111 @option{-Wnormalized=id} suppresses the warning for these characters.
5112 It is hoped that future versions of the standards involved will correct
5113 this, which is why this option is not the default.
5114
5115 You can switch the warning off for all characters by writing
5116 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
5117 only do this if you are using some other normalization scheme (like
5118 ``D''), because otherwise you can easily create bugs that are
5119 literally impossible to see.
5120
5121 Some characters in ISO 10646 have distinct meanings but look identical
5122 in some fonts or display methodologies, especially once formatting has
5123 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
5124 LETTER N'', displays just like a regular @code{n} that has been
5125 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
5126 normalization scheme to convert all these into a standard form as
5127 well, and GCC warns if your code is not in NFKC if you use
5128 @option{-Wnormalized=nfkc}. This warning is comparable to warning
5129 about every identifier that contains the letter O because it might be
5130 confused with the digit 0, and so is not the default, but may be
5131 useful as a local coding convention if the programming environment
5132 cannot be fixed to display these characters distinctly.
5133
5134 @item -Wno-deprecated
5135 @opindex Wno-deprecated
5136 @opindex Wdeprecated
5137 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
5138
5139 @item -Wno-deprecated-declarations
5140 @opindex Wno-deprecated-declarations
5141 @opindex Wdeprecated-declarations
5142 Do not warn about uses of functions (@pxref{Function Attributes}),
5143 variables (@pxref{Variable Attributes}), and types (@pxref{Type
5144 Attributes}) marked as deprecated by using the @code{deprecated}
5145 attribute.
5146
5147 @item -Wno-overflow
5148 @opindex Wno-overflow
5149 @opindex Woverflow
5150 Do not warn about compile-time overflow in constant expressions.
5151
5152 @item -Wno-odr
5153 @opindex Wno-odr
5154 @opindex Wodr
5155 Warn about One Definition Rule violations during link-time optimization.
5156 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
5157
5158 @item -Wopenmp-simd
5159 @opindex Wopenm-simd
5160 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
5161 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
5162 option can be used to relax the cost model.
5163
5164 @item -Woverride-init @r{(C and Objective-C only)}
5165 @opindex Woverride-init
5166 @opindex Wno-override-init
5167 @opindex W
5168 @opindex Wextra
5169 @opindex Wno-extra
5170 Warn if an initialized field without side effects is overridden when
5171 using designated initializers (@pxref{Designated Inits, , Designated
5172 Initializers}).
5173
5174 This warning is included in @option{-Wextra}. To get other
5175 @option{-Wextra} warnings without this one, use @option{-Wextra
5176 -Wno-override-init}.
5177
5178 @item -Wpacked
5179 @opindex Wpacked
5180 @opindex Wno-packed
5181 Warn if a structure is given the packed attribute, but the packed
5182 attribute has no effect on the layout or size of the structure.
5183 Such structures may be mis-aligned for little benefit. For
5184 instance, in this code, the variable @code{f.x} in @code{struct bar}
5185 is misaligned even though @code{struct bar} does not itself
5186 have the packed attribute:
5187
5188 @smallexample
5189 @group
5190 struct foo @{
5191 int x;
5192 char a, b, c, d;
5193 @} __attribute__((packed));
5194 struct bar @{
5195 char z;
5196 struct foo f;
5197 @};
5198 @end group
5199 @end smallexample
5200
5201 @item -Wpacked-bitfield-compat
5202 @opindex Wpacked-bitfield-compat
5203 @opindex Wno-packed-bitfield-compat
5204 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
5205 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
5206 the change can lead to differences in the structure layout. GCC
5207 informs you when the offset of such a field has changed in GCC 4.4.
5208 For example there is no longer a 4-bit padding between field @code{a}
5209 and @code{b} in this structure:
5210
5211 @smallexample
5212 struct foo
5213 @{
5214 char a:4;
5215 char b:8;
5216 @} __attribute__ ((packed));
5217 @end smallexample
5218
5219 This warning is enabled by default. Use
5220 @option{-Wno-packed-bitfield-compat} to disable this warning.
5221
5222 @item -Wpadded
5223 @opindex Wpadded
5224 @opindex Wno-padded
5225 Warn if padding is included in a structure, either to align an element
5226 of the structure or to align the whole structure. Sometimes when this
5227 happens it is possible to rearrange the fields of the structure to
5228 reduce the padding and so make the structure smaller.
5229
5230 @item -Wredundant-decls
5231 @opindex Wredundant-decls
5232 @opindex Wno-redundant-decls
5233 Warn if anything is declared more than once in the same scope, even in
5234 cases where multiple declaration is valid and changes nothing.
5235
5236 @item -Wnested-externs @r{(C and Objective-C only)}
5237 @opindex Wnested-externs
5238 @opindex Wno-nested-externs
5239 Warn if an @code{extern} declaration is encountered within a function.
5240
5241 @item -Wno-inherited-variadic-ctor
5242 @opindex Winherited-variadic-ctor
5243 @opindex Wno-inherited-variadic-ctor
5244 Suppress warnings about use of C++11 inheriting constructors when the
5245 base class inherited from has a C variadic constructor; the warning is
5246 on by default because the ellipsis is not inherited.
5247
5248 @item -Winline
5249 @opindex Winline
5250 @opindex Wno-inline
5251 Warn if a function that is declared as inline cannot be inlined.
5252 Even with this option, the compiler does not warn about failures to
5253 inline functions declared in system headers.
5254
5255 The compiler uses a variety of heuristics to determine whether or not
5256 to inline a function. For example, the compiler takes into account
5257 the size of the function being inlined and the amount of inlining
5258 that has already been done in the current function. Therefore,
5259 seemingly insignificant changes in the source program can cause the
5260 warnings produced by @option{-Winline} to appear or disappear.
5261
5262 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
5263 @opindex Wno-invalid-offsetof
5264 @opindex Winvalid-offsetof
5265 Suppress warnings from applying the @code{offsetof} macro to a non-POD
5266 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
5267 to a non-standard-layout type is undefined. In existing C++ implementations,
5268 however, @code{offsetof} typically gives meaningful results.
5269 This flag is for users who are aware that they are
5270 writing nonportable code and who have deliberately chosen to ignore the
5271 warning about it.
5272
5273 The restrictions on @code{offsetof} may be relaxed in a future version
5274 of the C++ standard.
5275
5276 @item -Wno-int-to-pointer-cast
5277 @opindex Wno-int-to-pointer-cast
5278 @opindex Wint-to-pointer-cast
5279 Suppress warnings from casts to pointer type of an integer of a
5280 different size. In C++, casting to a pointer type of smaller size is
5281 an error. @option{Wint-to-pointer-cast} is enabled by default.
5282
5283
5284 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
5285 @opindex Wno-pointer-to-int-cast
5286 @opindex Wpointer-to-int-cast
5287 Suppress warnings from casts from a pointer to an integer type of a
5288 different size.
5289
5290 @item -Winvalid-pch
5291 @opindex Winvalid-pch
5292 @opindex Wno-invalid-pch
5293 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
5294 the search path but can't be used.
5295
5296 @item -Wlong-long
5297 @opindex Wlong-long
5298 @opindex Wno-long-long
5299 Warn if @code{long long} type is used. This is enabled by either
5300 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
5301 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
5302
5303 @item -Wvariadic-macros
5304 @opindex Wvariadic-macros
5305 @opindex Wno-variadic-macros
5306 Warn if variadic macros are used in ISO C90 mode, or if the GNU
5307 alternate syntax is used in ISO C99 mode. This is enabled by either
5308 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
5309 messages, use @option{-Wno-variadic-macros}.
5310
5311 @item -Wvarargs
5312 @opindex Wvarargs
5313 @opindex Wno-varargs
5314 Warn upon questionable usage of the macros used to handle variable
5315 arguments like @code{va_start}. This is default. To inhibit the
5316 warning messages, use @option{-Wno-varargs}.
5317
5318 @item -Wvector-operation-performance
5319 @opindex Wvector-operation-performance
5320 @opindex Wno-vector-operation-performance
5321 Warn if vector operation is not implemented via SIMD capabilities of the
5322 architecture. Mainly useful for the performance tuning.
5323 Vector operation can be implemented @code{piecewise}, which means that the
5324 scalar operation is performed on every vector element;
5325 @code{in parallel}, which means that the vector operation is implemented
5326 using scalars of wider type, which normally is more performance efficient;
5327 and @code{as a single scalar}, which means that vector fits into a
5328 scalar type.
5329
5330 @item -Wno-virtual-move-assign
5331 @opindex Wvirtual-move-assign
5332 @opindex Wno-virtual-move-assign
5333 Suppress warnings about inheriting from a virtual base with a
5334 non-trivial C++11 move assignment operator. This is dangerous because
5335 if the virtual base is reachable along more than one path, it is
5336 moved multiple times, which can mean both objects end up in the
5337 moved-from state. If the move assignment operator is written to avoid
5338 moving from a moved-from object, this warning can be disabled.
5339
5340 @item -Wvla
5341 @opindex Wvla
5342 @opindex Wno-vla
5343 Warn if variable length array is used in the code.
5344 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
5345 the variable length array.
5346
5347 @item -Wvolatile-register-var
5348 @opindex Wvolatile-register-var
5349 @opindex Wno-volatile-register-var
5350 Warn if a register variable is declared volatile. The volatile
5351 modifier does not inhibit all optimizations that may eliminate reads
5352 and/or writes to register variables. This warning is enabled by
5353 @option{-Wall}.
5354
5355 @item -Wdisabled-optimization
5356 @opindex Wdisabled-optimization
5357 @opindex Wno-disabled-optimization
5358 Warn if a requested optimization pass is disabled. This warning does
5359 not generally indicate that there is anything wrong with your code; it
5360 merely indicates that GCC's optimizers are unable to handle the code
5361 effectively. Often, the problem is that your code is too big or too
5362 complex; GCC refuses to optimize programs when the optimization
5363 itself is likely to take inordinate amounts of time.
5364
5365 @item -Wpointer-sign @r{(C and Objective-C only)}
5366 @opindex Wpointer-sign
5367 @opindex Wno-pointer-sign
5368 Warn for pointer argument passing or assignment with different signedness.
5369 This option is only supported for C and Objective-C@. It is implied by
5370 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
5371 @option{-Wno-pointer-sign}.
5372
5373 @item -Wstack-protector
5374 @opindex Wstack-protector
5375 @opindex Wno-stack-protector
5376 This option is only active when @option{-fstack-protector} is active. It
5377 warns about functions that are not protected against stack smashing.
5378
5379 @item -Woverlength-strings
5380 @opindex Woverlength-strings
5381 @opindex Wno-overlength-strings
5382 Warn about string constants that are longer than the ``minimum
5383 maximum'' length specified in the C standard. Modern compilers
5384 generally allow string constants that are much longer than the
5385 standard's minimum limit, but very portable programs should avoid
5386 using longer strings.
5387
5388 The limit applies @emph{after} string constant concatenation, and does
5389 not count the trailing NUL@. In C90, the limit was 509 characters; in
5390 C99, it was raised to 4095. C++98 does not specify a normative
5391 minimum maximum, so we do not diagnose overlength strings in C++@.
5392
5393 This option is implied by @option{-Wpedantic}, and can be disabled with
5394 @option{-Wno-overlength-strings}.
5395
5396 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
5397 @opindex Wunsuffixed-float-constants
5398
5399 Issue a warning for any floating constant that does not have
5400 a suffix. When used together with @option{-Wsystem-headers} it
5401 warns about such constants in system header files. This can be useful
5402 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
5403 from the decimal floating-point extension to C99.
5404
5405 @item -Wno-designated-init @r{(C and Objective-C only)}
5406 Suppress warnings when a positional initializer is used to initialize
5407 a structure that has been marked with the @code{designated_init}
5408 attribute.
5409
5410 @end table
5411
5412 @node Debugging Options
5413 @section Options for Debugging Your Program or GCC
5414 @cindex options, debugging
5415 @cindex debugging information options
5416
5417 GCC has various special options that are used for debugging
5418 either your program or GCC:
5419
5420 @table @gcctabopt
5421 @item -g
5422 @opindex g
5423 Produce debugging information in the operating system's native format
5424 (stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
5425 information.
5426
5427 On most systems that use stabs format, @option{-g} enables use of extra
5428 debugging information that only GDB can use; this extra information
5429 makes debugging work better in GDB but probably makes other debuggers
5430 crash or
5431 refuse to read the program. If you want to control for certain whether
5432 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
5433 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
5434
5435 GCC allows you to use @option{-g} with
5436 @option{-O}. The shortcuts taken by optimized code may occasionally
5437 produce surprising results: some variables you declared may not exist
5438 at all; flow of control may briefly move where you did not expect it;
5439 some statements may not be executed because they compute constant
5440 results or their values are already at hand; some statements may
5441 execute in different places because they have been moved out of loops.
5442
5443 Nevertheless it proves possible to debug optimized output. This makes
5444 it reasonable to use the optimizer for programs that might have bugs.
5445
5446 The following options are useful when GCC is generated with the
5447 capability for more than one debugging format.
5448
5449 @item -gsplit-dwarf
5450 @opindex gsplit-dwarf
5451 Separate as much dwarf debugging information as possible into a
5452 separate output file with the extension .dwo. This option allows
5453 the build system to avoid linking files with debug information. To
5454 be useful, this option requires a debugger capable of reading .dwo
5455 files.
5456
5457 @item -ggdb
5458 @opindex ggdb
5459 Produce debugging information for use by GDB@. This means to use the
5460 most expressive format available (DWARF 2, stabs, or the native format
5461 if neither of those are supported), including GDB extensions if at all
5462 possible.
5463
5464 @item -gpubnames
5465 @opindex gpubnames
5466 Generate dwarf .debug_pubnames and .debug_pubtypes sections.
5467
5468 @item -ggnu-pubnames
5469 @opindex ggnu-pubnames
5470 Generate .debug_pubnames and .debug_pubtypes sections in a format
5471 suitable for conversion into a GDB@ index. This option is only useful
5472 with a linker that can produce GDB@ index version 7.
5473
5474 @item -gstabs
5475 @opindex gstabs
5476 Produce debugging information in stabs format (if that is supported),
5477 without GDB extensions. This is the format used by DBX on most BSD
5478 systems. On MIPS, Alpha and System V Release 4 systems this option
5479 produces stabs debugging output that is not understood by DBX or SDB@.
5480 On System V Release 4 systems this option requires the GNU assembler.
5481
5482 @item -feliminate-unused-debug-symbols
5483 @opindex feliminate-unused-debug-symbols
5484 Produce debugging information in stabs format (if that is supported),
5485 for only symbols that are actually used.
5486
5487 @item -femit-class-debug-always
5488 @opindex femit-class-debug-always
5489 Instead of emitting debugging information for a C++ class in only one
5490 object file, emit it in all object files using the class. This option
5491 should be used only with debuggers that are unable to handle the way GCC
5492 normally emits debugging information for classes because using this
5493 option increases the size of debugging information by as much as a
5494 factor of two.
5495
5496 @item -fdebug-types-section
5497 @opindex fdebug-types-section
5498 @opindex fno-debug-types-section
5499 When using DWARF Version 4 or higher, type DIEs can be put into
5500 their own @code{.debug_types} section instead of making them part of the
5501 @code{.debug_info} section. It is more efficient to put them in a separate
5502 comdat sections since the linker can then remove duplicates.
5503 But not all DWARF consumers support @code{.debug_types} sections yet
5504 and on some objects @code{.debug_types} produces larger instead of smaller
5505 debugging information.
5506
5507 @item -gstabs+
5508 @opindex gstabs+
5509 Produce debugging information in stabs format (if that is supported),
5510 using GNU extensions understood only by the GNU debugger (GDB)@. The
5511 use of these extensions is likely to make other debuggers crash or
5512 refuse to read the program.
5513
5514 @item -gcoff
5515 @opindex gcoff
5516 Produce debugging information in COFF format (if that is supported).
5517 This is the format used by SDB on most System V systems prior to
5518 System V Release 4.
5519
5520 @item -gxcoff
5521 @opindex gxcoff
5522 Produce debugging information in XCOFF format (if that is supported).
5523 This is the format used by the DBX debugger on IBM RS/6000 systems.
5524
5525 @item -gxcoff+
5526 @opindex gxcoff+
5527 Produce debugging information in XCOFF format (if that is supported),
5528 using GNU extensions understood only by the GNU debugger (GDB)@. The
5529 use of these extensions is likely to make other debuggers crash or
5530 refuse to read the program, and may cause assemblers other than the GNU
5531 assembler (GAS) to fail with an error.
5532
5533 @item -gdwarf-@var{version}
5534 @opindex gdwarf-@var{version}
5535 Produce debugging information in DWARF format (if that is supported).
5536 The value of @var{version} may be either 2, 3, 4 or 5; the default version
5537 for most targets is 4. DWARF Version 5 is only experimental.
5538
5539 Note that with DWARF Version 2, some ports require and always
5540 use some non-conflicting DWARF 3 extensions in the unwind tables.
5541
5542 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
5543 for maximum benefit.
5544
5545 @item -grecord-gcc-switches
5546 @opindex grecord-gcc-switches
5547 This switch causes the command-line options used to invoke the
5548 compiler that may affect code generation to be appended to the
5549 DW_AT_producer attribute in DWARF debugging information. The options
5550 are concatenated with spaces separating them from each other and from
5551 the compiler version. See also @option{-frecord-gcc-switches} for another
5552 way of storing compiler options into the object file. This is the default.
5553
5554 @item -gno-record-gcc-switches
5555 @opindex gno-record-gcc-switches
5556 Disallow appending command-line options to the DW_AT_producer attribute
5557 in DWARF debugging information.
5558
5559 @item -gstrict-dwarf
5560 @opindex gstrict-dwarf
5561 Disallow using extensions of later DWARF standard version than selected
5562 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
5563 DWARF extensions from later standard versions is allowed.
5564
5565 @item -gno-strict-dwarf
5566 @opindex gno-strict-dwarf
5567 Allow using extensions of later DWARF standard version than selected with
5568 @option{-gdwarf-@var{version}}.
5569
5570 @item -gz@r{[}=@var{type}@r{]}
5571 @opindex gz
5572 Produce compressed debug sections in DWARF format, if that is supported.
5573 If @var{type} is not given, the default type depends on the capabilities
5574 of the assembler and linker used. @var{type} may be one of
5575 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
5576 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
5577 compression in traditional GNU format). If the linker doesn't support
5578 writing compressed debug sections, the option is rejected. Otherwise,
5579 if the assembler does not support them, @option{-gz} is silently ignored
5580 when producing object files.
5581
5582 @item -gvms
5583 @opindex gvms
5584 Produce debugging information in Alpha/VMS debug format (if that is
5585 supported). This is the format used by DEBUG on Alpha/VMS systems.
5586
5587 @item -g@var{level}
5588 @itemx -ggdb@var{level}
5589 @itemx -gstabs@var{level}
5590 @itemx -gcoff@var{level}
5591 @itemx -gxcoff@var{level}
5592 @itemx -gvms@var{level}
5593 Request debugging information and also use @var{level} to specify how
5594 much information. The default level is 2.
5595
5596 Level 0 produces no debug information at all. Thus, @option{-g0} negates
5597 @option{-g}.
5598
5599 Level 1 produces minimal information, enough for making backtraces in
5600 parts of the program that you don't plan to debug. This includes
5601 descriptions of functions and external variables, and line number
5602 tables, but no information about local variables.
5603
5604 Level 3 includes extra information, such as all the macro definitions
5605 present in the program. Some debuggers support macro expansion when
5606 you use @option{-g3}.
5607
5608 @option{-gdwarf-2} does not accept a concatenated debug level, because
5609 GCC used to support an option @option{-gdwarf} that meant to generate
5610 debug information in version 1 of the DWARF format (which is very
5611 different from version 2), and it would have been too confusing. That
5612 debug format is long obsolete, but the option cannot be changed now.
5613 Instead use an additional @option{-g@var{level}} option to change the
5614 debug level for DWARF.
5615
5616 @item -gtoggle
5617 @opindex gtoggle
5618 Turn off generation of debug info, if leaving out this option
5619 generates it, or turn it on at level 2 otherwise. The position of this
5620 argument in the command line does not matter; it takes effect after all
5621 other options are processed, and it does so only once, no matter how
5622 many times it is given. This is mainly intended to be used with
5623 @option{-fcompare-debug}.
5624
5625 @item -fsanitize=address
5626 @opindex fsanitize=address
5627 Enable AddressSanitizer, a fast memory error detector.
5628 Memory access instructions are instrumented to detect
5629 out-of-bounds and use-after-free bugs.
5630 See @uref{http://code.google.com/p/address-sanitizer/} for
5631 more details. The run-time behavior can be influenced using the
5632 @env{ASAN_OPTIONS} environment variable; see
5633 @url{https://code.google.com/p/address-sanitizer/wiki/Flags#Run-time_flags} for
5634 a list of supported options.
5635
5636 @item -fsanitize=kernel-address
5637 @opindex fsanitize=kernel-address
5638 Enable AddressSanitizer for Linux kernel.
5639 See @uref{http://code.google.com/p/address-sanitizer/wiki/AddressSanitizerForKernel} for more details.
5640
5641 @item -fsanitize=thread
5642 @opindex fsanitize=thread
5643 Enable ThreadSanitizer, a fast data race detector.
5644 Memory access instructions are instrumented to detect
5645 data race bugs. See @uref{http://code.google.com/p/thread-sanitizer/} for more
5646 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
5647 environment variable; see
5648 @url{https://code.google.com/p/thread-sanitizer/wiki/Flags} for a list of
5649 supported options.
5650
5651 @item -fsanitize=leak
5652 @opindex fsanitize=leak
5653 Enable LeakSanitizer, a memory leak detector.
5654 This option only matters for linking of executables and if neither
5655 @option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that
5656 case the executable is linked against a library that overrides @code{malloc}
5657 and other allocator functions. See
5658 @uref{https://code.google.com/p/address-sanitizer/wiki/LeakSanitizer} for more
5659 details. The run-time behavior can be influenced using the
5660 @env{LSAN_OPTIONS} environment variable.
5661
5662 @item -fsanitize=undefined
5663 @opindex fsanitize=undefined
5664 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
5665 Various computations are instrumented to detect undefined behavior
5666 at runtime. Current suboptions are:
5667
5668 @table @gcctabopt
5669
5670 @item -fsanitize=shift
5671 @opindex fsanitize=shift
5672 This option enables checking that the result of a shift operation is
5673 not undefined. Note that what exactly is considered undefined differs
5674 slightly between C and C++, as well as between ISO C90 and C99, etc.
5675
5676 @item -fsanitize=integer-divide-by-zero
5677 @opindex fsanitize=integer-divide-by-zero
5678 Detect integer division by zero as well as @code{INT_MIN / -1} division.
5679
5680 @item -fsanitize=unreachable
5681 @opindex fsanitize=unreachable
5682 With this option, the compiler turns the @code{__builtin_unreachable}
5683 call into a diagnostics message call instead. When reaching the
5684 @code{__builtin_unreachable} call, the behavior is undefined.
5685
5686 @item -fsanitize=vla-bound
5687 @opindex fsanitize=vla-bound
5688 This option instructs the compiler to check that the size of a variable
5689 length array is positive.
5690
5691 @item -fsanitize=null
5692 @opindex fsanitize=null
5693 This option enables pointer checking. Particularly, the application
5694 built with this option turned on will issue an error message when it
5695 tries to dereference a NULL pointer, or if a reference (possibly an
5696 rvalue reference) is bound to a NULL pointer, or if a method is invoked
5697 on an object pointed by a NULL pointer.
5698
5699 @item -fsanitize=return
5700 @opindex fsanitize=return
5701 This option enables return statement checking. Programs
5702 built with this option turned on will issue an error message
5703 when the end of a non-void function is reached without actually
5704 returning a value. This option works in C++ only.
5705
5706 @item -fsanitize=signed-integer-overflow
5707 @opindex fsanitize=signed-integer-overflow
5708 This option enables signed integer overflow checking. We check that
5709 the result of @code{+}, @code{*}, and both unary and binary @code{-}
5710 does not overflow in the signed arithmetics. Note, integer promotion
5711 rules must be taken into account. That is, the following is not an
5712 overflow:
5713 @smallexample
5714 signed char a = SCHAR_MAX;
5715 a++;
5716 @end smallexample
5717
5718 @item -fsanitize=bounds
5719 @opindex fsanitize=bounds
5720 This option enables instrumentation of array bounds. Various out of bounds
5721 accesses are detected. Flexible array members, flexible array member-like
5722 arrays, and initializers of variables with static storage are not instrumented.
5723
5724 @item -fsanitize=alignment
5725 @opindex fsanitize=alignment
5726
5727 This option enables checking of alignment of pointers when they are
5728 dereferenced, or when a reference is bound to insufficiently aligned target,
5729 or when a method or constructor is invoked on insufficiently aligned object.
5730
5731 @item -fsanitize=object-size
5732 @opindex fsanitize=object-size
5733 This option enables instrumentation of memory references using the
5734 @code{__builtin_object_size} function. Various out of bounds pointer
5735 accesses are detected.
5736
5737 @item -fsanitize=float-divide-by-zero
5738 @opindex fsanitize=float-divide-by-zero
5739 Detect floating-point division by zero. Unlike other similar options,
5740 @option{-fsanitize=float-divide-by-zero} is not enabled by
5741 @option{-fsanitize=undefined}, since floating-point division by zero can
5742 be a legitimate way of obtaining infinities and NaNs.
5743
5744 @item -fsanitize=float-cast-overflow
5745 @opindex fsanitize=float-cast-overflow
5746 This option enables floating-point type to integer conversion checking.
5747 We check that the result of the conversion does not overflow.
5748 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
5749 not enabled by @option{-fsanitize=undefined}.
5750 This option does not work well with @code{FE_INVALID} exceptions enabled.
5751
5752 @item -fsanitize=nonnull-attribute
5753 @opindex fsanitize=nonnull-attribute
5754
5755 This option enables instrumentation of calls, checking whether null values
5756 are not passed to arguments marked as requiring a non-null value by the
5757 @code{nonnull} function attribute.
5758
5759 @item -fsanitize=returns-nonnull-attribute
5760 @opindex fsanitize=returns-nonnull-attribute
5761
5762 This option enables instrumentation of return statements in functions
5763 marked with @code{returns_nonnull} function attribute, to detect returning
5764 of null values from such functions.
5765
5766 @item -fsanitize=bool
5767 @opindex fsanitize=bool
5768
5769 This option enables instrumentation of loads from bool. If a value other
5770 than 0/1 is loaded, a run-time error is issued.
5771
5772 @item -fsanitize=enum
5773 @opindex fsanitize=enum
5774
5775 This option enables instrumentation of loads from an enum type. If
5776 a value outside the range of values for the enum type is loaded,
5777 a run-time error is issued.
5778
5779 @item -fsanitize=vptr
5780 @opindex fsanitize=vptr
5781
5782 This option enables instrumentation of C++ member function calls, member
5783 accesses and some conversions between pointers to base and derived classes,
5784 to verify the referenced object has the correct dynamic type.
5785
5786 @end table
5787
5788 While @option{-ftrapv} causes traps for signed overflows to be emitted,
5789 @option{-fsanitize=undefined} gives a diagnostic message.
5790 This currently works only for the C family of languages.
5791
5792 @item -fno-sanitize=all
5793 @opindex fno-sanitize=all
5794
5795 This option disables all previously enabled sanitizers.
5796 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
5797 together.
5798
5799 @item -fasan-shadow-offset=@var{number}
5800 @opindex fasan-shadow-offset
5801 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
5802 It is useful for experimenting with different shadow memory layouts in
5803 Kernel AddressSanitizer.
5804
5805 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
5806 @opindex fsanitize-recover
5807 @opindex fno-sanitize-recover
5808 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
5809 mentioned in comma-separated list of @var{opts}. Enabling this option
5810 for a sanitizer component causes it to attempt to continue
5811 running the program as if no error happened. This means multiple
5812 runtime errors can be reported in a single program run, and the exit
5813 code of the program may indicate success even when errors
5814 have been reported. The @option{-fno-sanitize-recover=} option
5815 can be used to alter
5816 this behavior: only the first detected error is reported
5817 and program then exits with a non-zero exit code.
5818
5819 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
5820 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
5821 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero} and
5822 @option{-fsanitize=kernel-address}. For these sanitizers error recovery is turned on by default.
5823 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
5824 accepted, the former enables recovery for all sanitizers that support it,
5825 the latter disables recovery for all sanitizers that support it.
5826
5827 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
5828 @smallexample
5829 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
5830 @end smallexample
5831 @noindent
5832 Similarly @option{-fno-sanitize-recover} is equivalent to
5833 @smallexample
5834 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
5835 @end smallexample
5836
5837 @item -fsanitize-undefined-trap-on-error
5838 @opindex fsanitize-undefined-trap-on-error
5839 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
5840 report undefined behavior using @code{__builtin_trap} rather than
5841 a @code{libubsan} library routine. The advantage of this is that the
5842 @code{libubsan} library is not needed and is not linked in, so this
5843 is usable even in freestanding environments.
5844
5845 @item -fcheck-pointer-bounds
5846 @opindex fcheck-pointer-bounds
5847 @opindex fno-check-pointer-bounds
5848 @cindex Pointer Bounds Checker options
5849 Enable Pointer Bounds Checker instrumentation. Each memory reference
5850 is instrumented with checks of the pointer used for memory access against
5851 bounds associated with that pointer.
5852
5853 Currently there
5854 is only an implementation for Intel MPX available, thus x86 target
5855 and @option{-mmpx} are required to enable this feature.
5856 MPX-based instrumentation requires
5857 a runtime library to enable MPX in hardware and handle bounds
5858 violation signals. By default when @option{-fcheck-pointer-bounds}
5859 and @option{-mmpx} options are used to link a program, the GCC driver
5860 links against the @file{libmpx} runtime library and @file{libmpxwrappers}
5861 library. It also passes '-z bndplt' to a linker in case it supports this
5862 option (which is checked on libmpx configuration). Note that old versions
5863 of linker may ignore option. Gold linker doesn't support '-z bndplt'
5864 option. With no '-z bndplt' support in linker all calls to dynamic libraries
5865 lose passed bounds reducing overall protection level. It's highly
5866 recommended to use linker with '-z bndplt' support. In case such linker
5867 is not available it is adviced to always use @option{-static-libmpxwrappers}
5868 for better protection level or use @option{-static} to completely avoid
5869 external calls to dynamic libraries. MPX-based instrumentation
5870 may be used for debugging and also may be included in production code
5871 to increase program security. Depending on usage, you may
5872 have different requirements for the runtime library. The current version
5873 of the MPX runtime library is more oriented for use as a debugging
5874 tool. MPX runtime library usage implies @option{-lpthread}. See
5875 also @option{-static-libmpx}. The runtime library behavior can be
5876 influenced using various @env{CHKP_RT_*} environment variables. See
5877 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
5878 for more details.
5879
5880 Generated instrumentation may be controlled by various
5881 @option{-fchkp-*} options and by the @code{bnd_variable_size}
5882 structure field attribute (@pxref{Type Attributes}) and
5883 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
5884 (@pxref{Function Attributes}). GCC also provides a number of built-in
5885 functions for controlling the Pointer Bounds Checker. @xref{Pointer
5886 Bounds Checker builtins}, for more information.
5887
5888 @item -fchkp-check-incomplete-type
5889 @opindex fchkp-check-incomplete-type
5890 @opindex fno-chkp-check-incomplete-type
5891 Generate pointer bounds checks for variables with incomplete type.
5892 Enabled by default.
5893
5894 @item -fchkp-narrow-bounds
5895 @opindex fchkp-narrow-bounds
5896 @opindex fno-chkp-narrow-bounds
5897 Controls bounds used by Pointer Bounds Checker for pointers to object
5898 fields. If narrowing is enabled then field bounds are used. Otherwise
5899 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
5900 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
5901
5902 @item -fchkp-first-field-has-own-bounds
5903 @opindex fchkp-first-field-has-own-bounds
5904 @opindex fno-chkp-first-field-has-own-bounds
5905 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
5906 first field in the structure. By default a pointer to the first field has
5907 the same bounds as a pointer to the whole structure.
5908
5909 @item -fchkp-narrow-to-innermost-array
5910 @opindex fchkp-narrow-to-innermost-array
5911 @opindex fno-chkp-narrow-to-innermost-array
5912 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
5913 case of nested static array access. By default this option is disabled and
5914 bounds of the outermost array are used.
5915
5916 @item -fchkp-optimize
5917 @opindex fchkp-optimize
5918 @opindex fno-chkp-optimize
5919 Enables Pointer Bounds Checker optimizations. Enabled by default at
5920 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
5921
5922 @item -fchkp-use-fast-string-functions
5923 @opindex fchkp-use-fast-string-functions
5924 @opindex fno-chkp-use-fast-string-functions
5925 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
5926 by Pointer Bounds Checker. Disabled by default.
5927
5928 @item -fchkp-use-nochk-string-functions
5929 @opindex fchkp-use-nochk-string-functions
5930 @opindex fno-chkp-use-nochk-string-functions
5931 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
5932 by Pointer Bounds Checker. Disabled by default.
5933
5934 @item -fchkp-use-static-bounds
5935 @opindex fchkp-use-static-bounds
5936 @opindex fno-chkp-use-static-bounds
5937 Allow Pointer Bounds Checker to generate static bounds holding
5938 bounds of static variables. Enabled by default.
5939
5940 @item -fchkp-use-static-const-bounds
5941 @opindex fchkp-use-static-const-bounds
5942 @opindex fno-chkp-use-static-const-bounds
5943 Use statically-initialized bounds for constant bounds instead of
5944 generating them each time they are required. By default enabled when
5945 @option{-fchkp-use-static-bounds} is enabled.
5946
5947 @item -fchkp-treat-zero-dynamic-size-as-infinite
5948 @opindex fchkp-treat-zero-dynamic-size-as-infinite
5949 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
5950 With this option, objects with incomplete type whose
5951 dynamically-obtained size is zero are treated as having infinite size
5952 instead by Pointer Bounds
5953 Checker. This option may be helpful if a program is linked with a library
5954 missing size information for some symbols. Disabled by default.
5955
5956 @item -fchkp-check-read
5957 @opindex fchkp-check-read
5958 @opindex fno-chkp-check-read
5959 Instructs Pointer Bounds Checker to generate checks for all read
5960 accesses to memory. Enabled by default.
5961
5962 @item -fchkp-check-write
5963 @opindex fchkp-check-write
5964 @opindex fno-chkp-check-write
5965 Instructs Pointer Bounds Checker to generate checks for all write
5966 accesses to memory. Enabled by default.
5967
5968 @item -fchkp-store-bounds
5969 @opindex fchkp-store-bounds
5970 @opindex fno-chkp-store-bounds
5971 Instructs Pointer Bounds Checker to generate bounds stores for
5972 pointer writes. Enabled by default.
5973
5974 @item -fchkp-instrument-calls
5975 @opindex fchkp-instrument-calls
5976 @opindex fno-chkp-instrument-calls
5977 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
5978 Enabled by default.
5979
5980 @item -fchkp-instrument-marked-only
5981 @opindex fchkp-instrument-marked-only
5982 @opindex fno-chkp-instrument-marked-only
5983 Instructs Pointer Bounds Checker to instrument only functions
5984 marked with the @code{bnd_instrument} attribute
5985 (@pxref{Function Attributes}). Disabled by default.
5986
5987 @item -fchkp-use-wrappers
5988 @opindex fchkp-use-wrappers
5989 @opindex fno-chkp-use-wrappers
5990 Allows Pointer Bounds Checker to replace calls to built-in functions
5991 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
5992 is used to link a program, the GCC driver automatically links
5993 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
5994 Enabled by default.
5995
5996 @item -fdump-final-insns@r{[}=@var{file}@r{]}
5997 @opindex fdump-final-insns
5998 Dump the final internal representation (RTL) to @var{file}. If the
5999 optional argument is omitted (or if @var{file} is @code{.}), the name
6000 of the dump file is determined by appending @code{.gkd} to the
6001 compilation output file name.
6002
6003 @item -fcompare-debug@r{[}=@var{opts}@r{]}
6004 @opindex fcompare-debug
6005 @opindex fno-compare-debug
6006 If no error occurs during compilation, run the compiler a second time,
6007 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
6008 passed to the second compilation. Dump the final internal
6009 representation in both compilations, and print an error if they differ.
6010
6011 If the equal sign is omitted, the default @option{-gtoggle} is used.
6012
6013 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
6014 and nonzero, implicitly enables @option{-fcompare-debug}. If
6015 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
6016 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
6017 is used.
6018
6019 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
6020 is equivalent to @option{-fno-compare-debug}, which disables the dumping
6021 of the final representation and the second compilation, preventing even
6022 @env{GCC_COMPARE_DEBUG} from taking effect.
6023
6024 To verify full coverage during @option{-fcompare-debug} testing, set
6025 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
6026 which GCC rejects as an invalid option in any actual compilation
6027 (rather than preprocessing, assembly or linking). To get just a
6028 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
6029 not overridden} will do.
6030
6031 @item -fcompare-debug-second
6032 @opindex fcompare-debug-second
6033 This option is implicitly passed to the compiler for the second
6034 compilation requested by @option{-fcompare-debug}, along with options to
6035 silence warnings, and omitting other options that would cause
6036 side-effect compiler outputs to files or to the standard output. Dump
6037 files and preserved temporary files are renamed so as to contain the
6038 @code{.gk} additional extension during the second compilation, to avoid
6039 overwriting those generated by the first.
6040
6041 When this option is passed to the compiler driver, it causes the
6042 @emph{first} compilation to be skipped, which makes it useful for little
6043 other than debugging the compiler proper.
6044
6045 @item -feliminate-dwarf2-dups
6046 @opindex feliminate-dwarf2-dups
6047 Compress DWARF 2 debugging information by eliminating duplicated
6048 information about each symbol. This option only makes sense when
6049 generating DWARF 2 debugging information with @option{-gdwarf-2}.
6050
6051 @item -femit-struct-debug-baseonly
6052 @opindex femit-struct-debug-baseonly
6053 Emit debug information for struct-like types
6054 only when the base name of the compilation source file
6055 matches the base name of file in which the struct is defined.
6056
6057 This option substantially reduces the size of debugging information,
6058 but at significant potential loss in type information to the debugger.
6059 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6060 See @option{-femit-struct-debug-detailed} for more detailed control.
6061
6062 This option works only with DWARF 2.
6063
6064 @item -femit-struct-debug-reduced
6065 @opindex femit-struct-debug-reduced
6066 Emit debug information for struct-like types
6067 only when the base name of the compilation source file
6068 matches the base name of file in which the type is defined,
6069 unless the struct is a template or defined in a system header.
6070
6071 This option significantly reduces the size of debugging information,
6072 with some potential loss in type information to the debugger.
6073 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6074 See @option{-femit-struct-debug-detailed} for more detailed control.
6075
6076 This option works only with DWARF 2.
6077
6078 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6079 @opindex femit-struct-debug-detailed
6080 Specify the struct-like types
6081 for which the compiler generates debug information.
6082 The intent is to reduce duplicate struct debug information
6083 between different object files within the same program.
6084
6085 This option is a detailed version of
6086 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6087 which serves for most needs.
6088
6089 A specification has the syntax@*
6090 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6091
6092 The optional first word limits the specification to
6093 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6094 A struct type is used directly when it is the type of a variable, member.
6095 Indirect uses arise through pointers to structs.
6096 That is, when use of an incomplete struct is valid, the use is indirect.
6097 An example is
6098 @samp{struct one direct; struct two * indirect;}.
6099
6100 The optional second word limits the specification to
6101 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6102 Generic structs are a bit complicated to explain.
6103 For C++, these are non-explicit specializations of template classes,
6104 or non-template classes within the above.
6105 Other programming languages have generics,
6106 but @option{-femit-struct-debug-detailed} does not yet implement them.
6107
6108 The third word specifies the source files for those
6109 structs for which the compiler should emit debug information.
6110 The values @samp{none} and @samp{any} have the normal meaning.
6111 The value @samp{base} means that
6112 the base of name of the file in which the type declaration appears
6113 must match the base of the name of the main compilation file.
6114 In practice, this means that when compiling @file{foo.c}, debug information
6115 is generated for types declared in that file and @file{foo.h},
6116 but not other header files.
6117 The value @samp{sys} means those types satisfying @samp{base}
6118 or declared in system or compiler headers.
6119
6120 You may need to experiment to determine the best settings for your application.
6121
6122 The default is @option{-femit-struct-debug-detailed=all}.
6123
6124 This option works only with DWARF 2.
6125
6126 @item -fno-merge-debug-strings
6127 @opindex fmerge-debug-strings
6128 @opindex fno-merge-debug-strings
6129 Direct the linker to not merge together strings in the debugging
6130 information that are identical in different object files. Merging is
6131 not supported by all assemblers or linkers. Merging decreases the size
6132 of the debug information in the output file at the cost of increasing
6133 link processing time. Merging is enabled by default.
6134
6135 @item -fdebug-prefix-map=@var{old}=@var{new}
6136 @opindex fdebug-prefix-map
6137 When compiling files in directory @file{@var{old}}, record debugging
6138 information describing them as in @file{@var{new}} instead.
6139
6140 @item -fno-dwarf2-cfi-asm
6141 @opindex fdwarf2-cfi-asm
6142 @opindex fno-dwarf2-cfi-asm
6143 Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
6144 instead of using GAS @code{.cfi_*} directives.
6145
6146 @cindex @command{prof}
6147 @item -p
6148 @opindex p
6149 Generate extra code to write profile information suitable for the
6150 analysis program @command{prof}. You must use this option when compiling
6151 the source files you want data about, and you must also use it when
6152 linking.
6153
6154 @cindex @command{gprof}
6155 @item -pg
6156 @opindex pg
6157 Generate extra code to write profile information suitable for the
6158 analysis program @command{gprof}. You must use this option when compiling
6159 the source files you want data about, and you must also use it when
6160 linking.
6161
6162 @item -Q
6163 @opindex Q
6164 Makes the compiler print out each function name as it is compiled, and
6165 print some statistics about each pass when it finishes.
6166
6167 @item -ftime-report
6168 @opindex ftime-report
6169 Makes the compiler print some statistics about the time consumed by each
6170 pass when it finishes.
6171
6172 @item -fmem-report
6173 @opindex fmem-report
6174 Makes the compiler print some statistics about permanent memory
6175 allocation when it finishes.
6176
6177 @item -fmem-report-wpa
6178 @opindex fmem-report-wpa
6179 Makes the compiler print some statistics about permanent memory
6180 allocation for the WPA phase only.
6181
6182 @item -fpre-ipa-mem-report
6183 @opindex fpre-ipa-mem-report
6184 @item -fpost-ipa-mem-report
6185 @opindex fpost-ipa-mem-report
6186 Makes the compiler print some statistics about permanent memory
6187 allocation before or after interprocedural optimization.
6188
6189 @item -fprofile-report
6190 @opindex fprofile-report
6191 Makes the compiler print some statistics about consistency of the
6192 (estimated) profile and effect of individual passes.
6193
6194 @item -fstack-usage
6195 @opindex fstack-usage
6196 Makes the compiler output stack usage information for the program, on a
6197 per-function basis. The filename for the dump is made by appending
6198 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
6199 the output file, if explicitly specified and it is not an executable,
6200 otherwise it is the basename of the source file. An entry is made up
6201 of three fields:
6202
6203 @itemize
6204 @item
6205 The name of the function.
6206 @item
6207 A number of bytes.
6208 @item
6209 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
6210 @end itemize
6211
6212 The qualifier @code{static} means that the function manipulates the stack
6213 statically: a fixed number of bytes are allocated for the frame on function
6214 entry and released on function exit; no stack adjustments are otherwise made
6215 in the function. The second field is this fixed number of bytes.
6216
6217 The qualifier @code{dynamic} means that the function manipulates the stack
6218 dynamically: in addition to the static allocation described above, stack
6219 adjustments are made in the body of the function, for example to push/pop
6220 arguments around function calls. If the qualifier @code{bounded} is also
6221 present, the amount of these adjustments is bounded at compile time and
6222 the second field is an upper bound of the total amount of stack used by
6223 the function. If it is not present, the amount of these adjustments is
6224 not bounded at compile time and the second field only represents the
6225 bounded part.
6226
6227 @item -fprofile-arcs
6228 @opindex fprofile-arcs
6229 Add code so that program flow @dfn{arcs} are instrumented. During
6230 execution the program records how many times each branch and call is
6231 executed and how many times it is taken or returns. When the compiled
6232 program exits it saves this data to a file called
6233 @file{@var{auxname}.gcda} for each source file. The data may be used for
6234 profile-directed optimizations (@option{-fbranch-probabilities}), or for
6235 test coverage analysis (@option{-ftest-coverage}). Each object file's
6236 @var{auxname} is generated from the name of the output file, if
6237 explicitly specified and it is not the final executable, otherwise it is
6238 the basename of the source file. In both cases any suffix is removed
6239 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
6240 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
6241 @xref{Cross-profiling}.
6242
6243 @cindex @command{gcov}
6244 @item --coverage
6245 @opindex coverage
6246
6247 This option is used to compile and link code instrumented for coverage
6248 analysis. The option is a synonym for @option{-fprofile-arcs}
6249 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
6250 linking). See the documentation for those options for more details.
6251
6252 @itemize
6253
6254 @item
6255 Compile the source files with @option{-fprofile-arcs} plus optimization
6256 and code generation options. For test coverage analysis, use the
6257 additional @option{-ftest-coverage} option. You do not need to profile
6258 every source file in a program.
6259
6260 @item
6261 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
6262 (the latter implies the former).
6263
6264 @item
6265 Run the program on a representative workload to generate the arc profile
6266 information. This may be repeated any number of times. You can run
6267 concurrent instances of your program, and provided that the file system
6268 supports locking, the data files will be correctly updated. Also
6269 @code{fork} calls are detected and correctly handled (double counting
6270 will not happen).
6271
6272 @item
6273 For profile-directed optimizations, compile the source files again with
6274 the same optimization and code generation options plus
6275 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
6276 Control Optimization}).
6277
6278 @item
6279 For test coverage analysis, use @command{gcov} to produce human readable
6280 information from the @file{.gcno} and @file{.gcda} files. Refer to the
6281 @command{gcov} documentation for further information.
6282
6283 @end itemize
6284
6285 With @option{-fprofile-arcs}, for each function of your program GCC
6286 creates a program flow graph, then finds a spanning tree for the graph.
6287 Only arcs that are not on the spanning tree have to be instrumented: the
6288 compiler adds code to count the number of times that these arcs are
6289 executed. When an arc is the only exit or only entrance to a block, the
6290 instrumentation code can be added to the block; otherwise, a new basic
6291 block must be created to hold the instrumentation code.
6292
6293 @need 2000
6294 @item -ftest-coverage
6295 @opindex ftest-coverage
6296 Produce a notes file that the @command{gcov} code-coverage utility
6297 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
6298 show program coverage. Each source file's note file is called
6299 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
6300 above for a description of @var{auxname} and instructions on how to
6301 generate test coverage data. Coverage data matches the source files
6302 more closely if you do not optimize.
6303
6304 @item -fdbg-cnt-list
6305 @opindex fdbg-cnt-list
6306 Print the name and the counter upper bound for all debug counters.
6307
6308
6309 @item -fdbg-cnt=@var{counter-value-list}
6310 @opindex fdbg-cnt
6311 Set the internal debug counter upper bound. @var{counter-value-list}
6312 is a comma-separated list of @var{name}:@var{value} pairs
6313 which sets the upper bound of each debug counter @var{name} to @var{value}.
6314 All debug counters have the initial upper bound of @code{UINT_MAX};
6315 thus @code{dbg_cnt} returns true always unless the upper bound
6316 is set by this option.
6317 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
6318 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
6319
6320 @item -fenable-@var{kind}-@var{pass}
6321 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
6322 @opindex fdisable-
6323 @opindex fenable-
6324
6325 This is a set of options that are used to explicitly disable/enable
6326 optimization passes. These options are intended for use for debugging GCC.
6327 Compiler users should use regular options for enabling/disabling
6328 passes instead.
6329
6330 @table @gcctabopt
6331
6332 @item -fdisable-ipa-@var{pass}
6333 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
6334 statically invoked in the compiler multiple times, the pass name should be
6335 appended with a sequential number starting from 1.
6336
6337 @item -fdisable-rtl-@var{pass}
6338 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
6339 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
6340 statically invoked in the compiler multiple times, the pass name should be
6341 appended with a sequential number starting from 1. @var{range-list} is a
6342 comma-separated list of function ranges or assembler names. Each range is a number
6343 pair separated by a colon. The range is inclusive in both ends. If the range
6344 is trivial, the number pair can be simplified as a single number. If the
6345 function's call graph node's @var{uid} falls within one of the specified ranges,
6346 the @var{pass} is disabled for that function. The @var{uid} is shown in the
6347 function header of a dump file, and the pass names can be dumped by using
6348 option @option{-fdump-passes}.
6349
6350 @item -fdisable-tree-@var{pass}
6351 @itemx -fdisable-tree-@var{pass}=@var{range-list}
6352 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
6353 option arguments.
6354
6355 @item -fenable-ipa-@var{pass}
6356 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
6357 statically invoked in the compiler multiple times, the pass name should be
6358 appended with a sequential number starting from 1.
6359
6360 @item -fenable-rtl-@var{pass}
6361 @itemx -fenable-rtl-@var{pass}=@var{range-list}
6362 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
6363 description and examples.
6364
6365 @item -fenable-tree-@var{pass}
6366 @itemx -fenable-tree-@var{pass}=@var{range-list}
6367 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
6368 of option arguments.
6369
6370 @end table
6371
6372 Here are some examples showing uses of these options.
6373
6374 @smallexample
6375
6376 # disable ccp1 for all functions
6377 -fdisable-tree-ccp1
6378 # disable complete unroll for function whose cgraph node uid is 1
6379 -fenable-tree-cunroll=1
6380 # disable gcse2 for functions at the following ranges [1,1],
6381 # [300,400], and [400,1000]
6382 # disable gcse2 for functions foo and foo2
6383 -fdisable-rtl-gcse2=foo,foo2
6384 # disable early inlining
6385 -fdisable-tree-einline
6386 # disable ipa inlining
6387 -fdisable-ipa-inline
6388 # enable tree full unroll
6389 -fenable-tree-unroll
6390
6391 @end smallexample
6392
6393 @item -d@var{letters}
6394 @itemx -fdump-rtl-@var{pass}
6395 @itemx -fdump-rtl-@var{pass}=@var{filename}
6396 @opindex d
6397 @opindex fdump-rtl-@var{pass}
6398 Says to make debugging dumps during compilation at times specified by
6399 @var{letters}. This is used for debugging the RTL-based passes of the
6400 compiler. The file names for most of the dumps are made by appending
6401 a pass number and a word to the @var{dumpname}, and the files are
6402 created in the directory of the output file. In case of
6403 @option{=@var{filename}} option, the dump is output on the given file
6404 instead of the pass numbered dump files. Note that the pass number is
6405 computed statically as passes get registered into the pass manager.
6406 Thus the numbering is not related to the dynamic order of execution of
6407 passes. In particular, a pass installed by a plugin could have a
6408 number over 200 even if it executed quite early. @var{dumpname} is
6409 generated from the name of the output file, if explicitly specified
6410 and it is not an executable, otherwise it is the basename of the
6411 source file. These switches may have different effects when
6412 @option{-E} is used for preprocessing.
6413
6414 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
6415 @option{-d} option @var{letters}. Here are the possible
6416 letters for use in @var{pass} and @var{letters}, and their meanings:
6417
6418 @table @gcctabopt
6419
6420 @item -fdump-rtl-alignments
6421 @opindex fdump-rtl-alignments
6422 Dump after branch alignments have been computed.
6423
6424 @item -fdump-rtl-asmcons
6425 @opindex fdump-rtl-asmcons
6426 Dump after fixing rtl statements that have unsatisfied in/out constraints.
6427
6428 @item -fdump-rtl-auto_inc_dec
6429 @opindex fdump-rtl-auto_inc_dec
6430 Dump after auto-inc-dec discovery. This pass is only run on
6431 architectures that have auto inc or auto dec instructions.
6432
6433 @item -fdump-rtl-barriers
6434 @opindex fdump-rtl-barriers
6435 Dump after cleaning up the barrier instructions.
6436
6437 @item -fdump-rtl-bbpart
6438 @opindex fdump-rtl-bbpart
6439 Dump after partitioning hot and cold basic blocks.
6440
6441 @item -fdump-rtl-bbro
6442 @opindex fdump-rtl-bbro
6443 Dump after block reordering.
6444
6445 @item -fdump-rtl-btl1
6446 @itemx -fdump-rtl-btl2
6447 @opindex fdump-rtl-btl2
6448 @opindex fdump-rtl-btl2
6449 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
6450 after the two branch
6451 target load optimization passes.
6452
6453 @item -fdump-rtl-bypass
6454 @opindex fdump-rtl-bypass
6455 Dump after jump bypassing and control flow optimizations.
6456
6457 @item -fdump-rtl-combine
6458 @opindex fdump-rtl-combine
6459 Dump after the RTL instruction combination pass.
6460
6461 @item -fdump-rtl-compgotos
6462 @opindex fdump-rtl-compgotos
6463 Dump after duplicating the computed gotos.
6464
6465 @item -fdump-rtl-ce1
6466 @itemx -fdump-rtl-ce2
6467 @itemx -fdump-rtl-ce3
6468 @opindex fdump-rtl-ce1
6469 @opindex fdump-rtl-ce2
6470 @opindex fdump-rtl-ce3
6471 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
6472 @option{-fdump-rtl-ce3} enable dumping after the three
6473 if conversion passes.
6474
6475 @item -fdump-rtl-cprop_hardreg
6476 @opindex fdump-rtl-cprop_hardreg
6477 Dump after hard register copy propagation.
6478
6479 @item -fdump-rtl-csa
6480 @opindex fdump-rtl-csa
6481 Dump after combining stack adjustments.
6482
6483 @item -fdump-rtl-cse1
6484 @itemx -fdump-rtl-cse2
6485 @opindex fdump-rtl-cse1
6486 @opindex fdump-rtl-cse2
6487 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
6488 the two common subexpression elimination passes.
6489
6490 @item -fdump-rtl-dce
6491 @opindex fdump-rtl-dce
6492 Dump after the standalone dead code elimination passes.
6493
6494 @item -fdump-rtl-dbr
6495 @opindex fdump-rtl-dbr
6496 Dump after delayed branch scheduling.
6497
6498 @item -fdump-rtl-dce1
6499 @itemx -fdump-rtl-dce2
6500 @opindex fdump-rtl-dce1
6501 @opindex fdump-rtl-dce2
6502 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
6503 the two dead store elimination passes.
6504
6505 @item -fdump-rtl-eh
6506 @opindex fdump-rtl-eh
6507 Dump after finalization of EH handling code.
6508
6509 @item -fdump-rtl-eh_ranges
6510 @opindex fdump-rtl-eh_ranges
6511 Dump after conversion of EH handling range regions.
6512
6513 @item -fdump-rtl-expand
6514 @opindex fdump-rtl-expand
6515 Dump after RTL generation.
6516
6517 @item -fdump-rtl-fwprop1
6518 @itemx -fdump-rtl-fwprop2
6519 @opindex fdump-rtl-fwprop1
6520 @opindex fdump-rtl-fwprop2
6521 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
6522 dumping after the two forward propagation passes.
6523
6524 @item -fdump-rtl-gcse1
6525 @itemx -fdump-rtl-gcse2
6526 @opindex fdump-rtl-gcse1
6527 @opindex fdump-rtl-gcse2
6528 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
6529 after global common subexpression elimination.
6530
6531 @item -fdump-rtl-init-regs
6532 @opindex fdump-rtl-init-regs
6533 Dump after the initialization of the registers.
6534
6535 @item -fdump-rtl-initvals
6536 @opindex fdump-rtl-initvals
6537 Dump after the computation of the initial value sets.
6538
6539 @item -fdump-rtl-into_cfglayout
6540 @opindex fdump-rtl-into_cfglayout
6541 Dump after converting to cfglayout mode.
6542
6543 @item -fdump-rtl-ira
6544 @opindex fdump-rtl-ira
6545 Dump after iterated register allocation.
6546
6547 @item -fdump-rtl-jump
6548 @opindex fdump-rtl-jump
6549 Dump after the second jump optimization.
6550
6551 @item -fdump-rtl-loop2
6552 @opindex fdump-rtl-loop2
6553 @option{-fdump-rtl-loop2} enables dumping after the rtl
6554 loop optimization passes.
6555
6556 @item -fdump-rtl-mach
6557 @opindex fdump-rtl-mach
6558 Dump after performing the machine dependent reorganization pass, if that
6559 pass exists.
6560
6561 @item -fdump-rtl-mode_sw
6562 @opindex fdump-rtl-mode_sw
6563 Dump after removing redundant mode switches.
6564
6565 @item -fdump-rtl-rnreg
6566 @opindex fdump-rtl-rnreg
6567 Dump after register renumbering.
6568
6569 @item -fdump-rtl-outof_cfglayout
6570 @opindex fdump-rtl-outof_cfglayout
6571 Dump after converting from cfglayout mode.
6572
6573 @item -fdump-rtl-peephole2
6574 @opindex fdump-rtl-peephole2
6575 Dump after the peephole pass.
6576
6577 @item -fdump-rtl-postreload
6578 @opindex fdump-rtl-postreload
6579 Dump after post-reload optimizations.
6580
6581 @item -fdump-rtl-pro_and_epilogue
6582 @opindex fdump-rtl-pro_and_epilogue
6583 Dump after generating the function prologues and epilogues.
6584
6585 @item -fdump-rtl-sched1
6586 @itemx -fdump-rtl-sched2
6587 @opindex fdump-rtl-sched1
6588 @opindex fdump-rtl-sched2
6589 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
6590 after the basic block scheduling passes.
6591
6592 @item -fdump-rtl-ree
6593 @opindex fdump-rtl-ree
6594 Dump after sign/zero extension elimination.
6595
6596 @item -fdump-rtl-seqabstr
6597 @opindex fdump-rtl-seqabstr
6598 Dump after common sequence discovery.
6599
6600 @item -fdump-rtl-shorten
6601 @opindex fdump-rtl-shorten
6602 Dump after shortening branches.
6603
6604 @item -fdump-rtl-sibling
6605 @opindex fdump-rtl-sibling
6606 Dump after sibling call optimizations.
6607
6608 @item -fdump-rtl-split1
6609 @itemx -fdump-rtl-split2
6610 @itemx -fdump-rtl-split3
6611 @itemx -fdump-rtl-split4
6612 @itemx -fdump-rtl-split5
6613 @opindex fdump-rtl-split1
6614 @opindex fdump-rtl-split2
6615 @opindex fdump-rtl-split3
6616 @opindex fdump-rtl-split4
6617 @opindex fdump-rtl-split5
6618 These options enable dumping after five rounds of
6619 instruction splitting.
6620
6621 @item -fdump-rtl-sms
6622 @opindex fdump-rtl-sms
6623 Dump after modulo scheduling. This pass is only run on some
6624 architectures.
6625
6626 @item -fdump-rtl-stack
6627 @opindex fdump-rtl-stack
6628 Dump after conversion from GCC's ``flat register file'' registers to the
6629 x87's stack-like registers. This pass is only run on x86 variants.
6630
6631 @item -fdump-rtl-subreg1
6632 @itemx -fdump-rtl-subreg2
6633 @opindex fdump-rtl-subreg1
6634 @opindex fdump-rtl-subreg2
6635 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
6636 the two subreg expansion passes.
6637
6638 @item -fdump-rtl-unshare
6639 @opindex fdump-rtl-unshare
6640 Dump after all rtl has been unshared.
6641
6642 @item -fdump-rtl-vartrack
6643 @opindex fdump-rtl-vartrack
6644 Dump after variable tracking.
6645
6646 @item -fdump-rtl-vregs
6647 @opindex fdump-rtl-vregs
6648 Dump after converting virtual registers to hard registers.
6649
6650 @item -fdump-rtl-web
6651 @opindex fdump-rtl-web
6652 Dump after live range splitting.
6653
6654 @item -fdump-rtl-regclass
6655 @itemx -fdump-rtl-subregs_of_mode_init
6656 @itemx -fdump-rtl-subregs_of_mode_finish
6657 @itemx -fdump-rtl-dfinit
6658 @itemx -fdump-rtl-dfinish
6659 @opindex fdump-rtl-regclass
6660 @opindex fdump-rtl-subregs_of_mode_init
6661 @opindex fdump-rtl-subregs_of_mode_finish
6662 @opindex fdump-rtl-dfinit
6663 @opindex fdump-rtl-dfinish
6664 These dumps are defined but always produce empty files.
6665
6666 @item -da
6667 @itemx -fdump-rtl-all
6668 @opindex da
6669 @opindex fdump-rtl-all
6670 Produce all the dumps listed above.
6671
6672 @item -dA
6673 @opindex dA
6674 Annotate the assembler output with miscellaneous debugging information.
6675
6676 @item -dD
6677 @opindex dD
6678 Dump all macro definitions, at the end of preprocessing, in addition to
6679 normal output.
6680
6681 @item -dH
6682 @opindex dH
6683 Produce a core dump whenever an error occurs.
6684
6685 @item -dp
6686 @opindex dp
6687 Annotate the assembler output with a comment indicating which
6688 pattern and alternative is used. The length of each instruction is
6689 also printed.
6690
6691 @item -dP
6692 @opindex dP
6693 Dump the RTL in the assembler output as a comment before each instruction.
6694 Also turns on @option{-dp} annotation.
6695
6696 @item -dx
6697 @opindex dx
6698 Just generate RTL for a function instead of compiling it. Usually used
6699 with @option{-fdump-rtl-expand}.
6700 @end table
6701
6702 @item -fdump-noaddr
6703 @opindex fdump-noaddr
6704 When doing debugging dumps, suppress address output. This makes it more
6705 feasible to use diff on debugging dumps for compiler invocations with
6706 different compiler binaries and/or different
6707 text / bss / data / heap / stack / dso start locations.
6708
6709 @item -freport-bug
6710 @opindex freport-bug
6711 Collect and dump debug information into temporary file if ICE in C/C++
6712 compiler occured.
6713
6714 @item -fdump-unnumbered
6715 @opindex fdump-unnumbered
6716 When doing debugging dumps, suppress instruction numbers and address output.
6717 This makes it more feasible to use diff on debugging dumps for compiler
6718 invocations with different options, in particular with and without
6719 @option{-g}.
6720
6721 @item -fdump-unnumbered-links
6722 @opindex fdump-unnumbered-links
6723 When doing debugging dumps (see @option{-d} option above), suppress
6724 instruction numbers for the links to the previous and next instructions
6725 in a sequence.
6726
6727 @item -fdump-translation-unit @r{(C++ only)}
6728 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
6729 @opindex fdump-translation-unit
6730 Dump a representation of the tree structure for the entire translation
6731 unit to a file. The file name is made by appending @file{.tu} to the
6732 source file name, and the file is created in the same directory as the
6733 output file. If the @samp{-@var{options}} form is used, @var{options}
6734 controls the details of the dump as described for the
6735 @option{-fdump-tree} options.
6736
6737 @item -fdump-class-hierarchy @r{(C++ only)}
6738 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
6739 @opindex fdump-class-hierarchy
6740 Dump a representation of each class's hierarchy and virtual function
6741 table layout to a file. The file name is made by appending
6742 @file{.class} to the source file name, and the file is created in the
6743 same directory as the output file. If the @samp{-@var{options}} form
6744 is used, @var{options} controls the details of the dump as described
6745 for the @option{-fdump-tree} options.
6746
6747 @item -fdump-ipa-@var{switch}
6748 @opindex fdump-ipa
6749 Control the dumping at various stages of inter-procedural analysis
6750 language tree to a file. The file name is generated by appending a
6751 switch specific suffix to the source file name, and the file is created
6752 in the same directory as the output file. The following dumps are
6753 possible:
6754
6755 @table @samp
6756 @item all
6757 Enables all inter-procedural analysis dumps.
6758
6759 @item cgraph
6760 Dumps information about call-graph optimization, unused function removal,
6761 and inlining decisions.
6762
6763 @item inline
6764 Dump after function inlining.
6765
6766 @end table
6767
6768 @item -fdump-passes
6769 @opindex fdump-passes
6770 Dump the list of optimization passes that are turned on and off by
6771 the current command-line options.
6772
6773 @item -fdump-statistics-@var{option}
6774 @opindex fdump-statistics
6775 Enable and control dumping of pass statistics in a separate file. The
6776 file name is generated by appending a suffix ending in
6777 @samp{.statistics} to the source file name, and the file is created in
6778 the same directory as the output file. If the @samp{-@var{option}}
6779 form is used, @samp{-stats} causes counters to be summed over the
6780 whole compilation unit while @samp{-details} dumps every event as
6781 the passes generate them. The default with no option is to sum
6782 counters for each function compiled.
6783
6784 @item -fdump-tree-@var{switch}
6785 @itemx -fdump-tree-@var{switch}-@var{options}
6786 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
6787 @opindex fdump-tree
6788 Control the dumping at various stages of processing the intermediate
6789 language tree to a file. The file name is generated by appending a
6790 switch-specific suffix to the source file name, and the file is
6791 created in the same directory as the output file. In case of
6792 @option{=@var{filename}} option, the dump is output on the given file
6793 instead of the auto named dump files. If the @samp{-@var{options}}
6794 form is used, @var{options} is a list of @samp{-} separated options
6795 which control the details of the dump. Not all options are applicable
6796 to all dumps; those that are not meaningful are ignored. The
6797 following options are available
6798
6799 @table @samp
6800 @item address
6801 Print the address of each node. Usually this is not meaningful as it
6802 changes according to the environment and source file. Its primary use
6803 is for tying up a dump file with a debug environment.
6804 @item asmname
6805 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
6806 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
6807 use working backward from mangled names in the assembly file.
6808 @item slim
6809 When dumping front-end intermediate representations, inhibit dumping
6810 of members of a scope or body of a function merely because that scope
6811 has been reached. Only dump such items when they are directly reachable
6812 by some other path.
6813
6814 When dumping pretty-printed trees, this option inhibits dumping the
6815 bodies of control structures.
6816
6817 When dumping RTL, print the RTL in slim (condensed) form instead of
6818 the default LISP-like representation.
6819 @item raw
6820 Print a raw representation of the tree. By default, trees are
6821 pretty-printed into a C-like representation.
6822 @item details
6823 Enable more detailed dumps (not honored by every dump option). Also
6824 include information from the optimization passes.
6825 @item stats
6826 Enable dumping various statistics about the pass (not honored by every dump
6827 option).
6828 @item blocks
6829 Enable showing basic block boundaries (disabled in raw dumps).
6830 @item graph
6831 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
6832 dump a representation of the control flow graph suitable for viewing with
6833 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
6834 the file is pretty-printed as a subgraph, so that GraphViz can render them
6835 all in a single plot.
6836
6837 This option currently only works for RTL dumps, and the RTL is always
6838 dumped in slim form.
6839 @item vops
6840 Enable showing virtual operands for every statement.
6841 @item lineno
6842 Enable showing line numbers for statements.
6843 @item uid
6844 Enable showing the unique ID (@code{DECL_UID}) for each variable.
6845 @item verbose
6846 Enable showing the tree dump for each statement.
6847 @item eh
6848 Enable showing the EH region number holding each statement.
6849 @item scev
6850 Enable showing scalar evolution analysis details.
6851 @item optimized
6852 Enable showing optimization information (only available in certain
6853 passes).
6854 @item missed
6855 Enable showing missed optimization information (only available in certain
6856 passes).
6857 @item note
6858 Enable other detailed optimization information (only available in
6859 certain passes).
6860 @item =@var{filename}
6861 Instead of an auto named dump file, output into the given file
6862 name. The file names @file{stdout} and @file{stderr} are treated
6863 specially and are considered already open standard streams. For
6864 example,
6865
6866 @smallexample
6867 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
6868 -fdump-tree-pre=stderr file.c
6869 @end smallexample
6870
6871 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
6872 output on to @file{stderr}. If two conflicting dump filenames are
6873 given for the same pass, then the latter option overrides the earlier
6874 one.
6875
6876 @item all
6877 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
6878 and @option{lineno}.
6879
6880 @item optall
6881 Turn on all optimization options, i.e., @option{optimized},
6882 @option{missed}, and @option{note}.
6883 @end table
6884
6885 The following tree dumps are possible:
6886 @table @samp
6887
6888 @item original
6889 @opindex fdump-tree-original
6890 Dump before any tree based optimization, to @file{@var{file}.original}.
6891
6892 @item optimized
6893 @opindex fdump-tree-optimized
6894 Dump after all tree based optimization, to @file{@var{file}.optimized}.
6895
6896 @item gimple
6897 @opindex fdump-tree-gimple
6898 Dump each function before and after the gimplification pass to a file. The
6899 file name is made by appending @file{.gimple} to the source file name.
6900
6901 @item cfg
6902 @opindex fdump-tree-cfg
6903 Dump the control flow graph of each function to a file. The file name is
6904 made by appending @file{.cfg} to the source file name.
6905
6906 @item ch
6907 @opindex fdump-tree-ch
6908 Dump each function after copying loop headers. The file name is made by
6909 appending @file{.ch} to the source file name.
6910
6911 @item ssa
6912 @opindex fdump-tree-ssa
6913 Dump SSA related information to a file. The file name is made by appending
6914 @file{.ssa} to the source file name.
6915
6916 @item alias
6917 @opindex fdump-tree-alias
6918 Dump aliasing information for each function. The file name is made by
6919 appending @file{.alias} to the source file name.
6920
6921 @item ccp
6922 @opindex fdump-tree-ccp
6923 Dump each function after CCP@. The file name is made by appending
6924 @file{.ccp} to the source file name.
6925
6926 @item storeccp
6927 @opindex fdump-tree-storeccp
6928 Dump each function after STORE-CCP@. The file name is made by appending
6929 @file{.storeccp} to the source file name.
6930
6931 @item pre
6932 @opindex fdump-tree-pre
6933 Dump trees after partial redundancy elimination. The file name is made
6934 by appending @file{.pre} to the source file name.
6935
6936 @item fre
6937 @opindex fdump-tree-fre
6938 Dump trees after full redundancy elimination. The file name is made
6939 by appending @file{.fre} to the source file name.
6940
6941 @item copyprop
6942 @opindex fdump-tree-copyprop
6943 Dump trees after copy propagation. The file name is made
6944 by appending @file{.copyprop} to the source file name.
6945
6946 @item store_copyprop
6947 @opindex fdump-tree-store_copyprop
6948 Dump trees after store copy-propagation. The file name is made
6949 by appending @file{.store_copyprop} to the source file name.
6950
6951 @item dce
6952 @opindex fdump-tree-dce
6953 Dump each function after dead code elimination. The file name is made by
6954 appending @file{.dce} to the source file name.
6955
6956 @item sra
6957 @opindex fdump-tree-sra
6958 Dump each function after performing scalar replacement of aggregates. The
6959 file name is made by appending @file{.sra} to the source file name.
6960
6961 @item sink
6962 @opindex fdump-tree-sink
6963 Dump each function after performing code sinking. The file name is made
6964 by appending @file{.sink} to the source file name.
6965
6966 @item dom
6967 @opindex fdump-tree-dom
6968 Dump each function after applying dominator tree optimizations. The file
6969 name is made by appending @file{.dom} to the source file name.
6970
6971 @item dse
6972 @opindex fdump-tree-dse
6973 Dump each function after applying dead store elimination. The file
6974 name is made by appending @file{.dse} to the source file name.
6975
6976 @item phiopt
6977 @opindex fdump-tree-phiopt
6978 Dump each function after optimizing PHI nodes into straightline code. The file
6979 name is made by appending @file{.phiopt} to the source file name.
6980
6981 @item forwprop
6982 @opindex fdump-tree-forwprop
6983 Dump each function after forward propagating single use variables. The file
6984 name is made by appending @file{.forwprop} to the source file name.
6985
6986 @item copyrename
6987 @opindex fdump-tree-copyrename
6988 Dump each function after applying the copy rename optimization. The file
6989 name is made by appending @file{.copyrename} to the source file name.
6990
6991 @item nrv
6992 @opindex fdump-tree-nrv
6993 Dump each function after applying the named return value optimization on
6994 generic trees. The file name is made by appending @file{.nrv} to the source
6995 file name.
6996
6997 @item vect
6998 @opindex fdump-tree-vect
6999 Dump each function after applying vectorization of loops. The file name is
7000 made by appending @file{.vect} to the source file name.
7001
7002 @item slp
7003 @opindex fdump-tree-slp
7004 Dump each function after applying vectorization of basic blocks. The file name
7005 is made by appending @file{.slp} to the source file name.
7006
7007 @item vrp
7008 @opindex fdump-tree-vrp
7009 Dump each function after Value Range Propagation (VRP). The file name
7010 is made by appending @file{.vrp} to the source file name.
7011
7012 @item all
7013 @opindex fdump-tree-all
7014 Enable all the available tree dumps with the flags provided in this option.
7015 @end table
7016
7017 @item -fopt-info
7018 @itemx -fopt-info-@var{options}
7019 @itemx -fopt-info-@var{options}=@var{filename}
7020 @opindex fopt-info
7021 Controls optimization dumps from various optimization passes. If the
7022 @samp{-@var{options}} form is used, @var{options} is a list of
7023 @samp{-} separated option keywords to select the dump details and
7024 optimizations.
7025
7026 The @var{options} can be divided into two groups: options describing the
7027 verbosity of the dump, and options describing which optimizations
7028 should be included. The options from both the groups can be freely
7029 mixed as they are non-overlapping. However, in case of any conflicts,
7030 the later options override the earlier options on the command
7031 line.
7032
7033 The following options control the dump verbosity:
7034
7035 @table @samp
7036 @item optimized
7037 Print information when an optimization is successfully applied. It is
7038 up to a pass to decide which information is relevant. For example, the
7039 vectorizer passes print the source location of loops which are
7040 successfully vectorized.
7041 @item missed
7042 Print information about missed optimizations. Individual passes
7043 control which information to include in the output.
7044 @item note
7045 Print verbose information about optimizations, such as certain
7046 transformations, more detailed messages about decisions etc.
7047 @item all
7048 Print detailed optimization information. This includes
7049 @samp{optimized}, @samp{missed}, and @samp{note}.
7050 @end table
7051
7052 One or more of the following option keywords can be used to describe a
7053 group of optimizations:
7054
7055 @table @samp
7056 @item ipa
7057 Enable dumps from all interprocedural optimizations.
7058 @item loop
7059 Enable dumps from all loop optimizations.
7060 @item inline
7061 Enable dumps from all inlining optimizations.
7062 @item vec
7063 Enable dumps from all vectorization optimizations.
7064 @item optall
7065 Enable dumps from all optimizations. This is a superset of
7066 the optimization groups listed above.
7067 @end table
7068
7069 If @var{options} is
7070 omitted, it defaults to @samp{optimized-optall}, which means to dump all
7071 info about successful optimizations from all the passes.
7072
7073 If the @var{filename} is provided, then the dumps from all the
7074 applicable optimizations are concatenated into the @var{filename}.
7075 Otherwise the dump is output onto @file{stderr}. Though multiple
7076 @option{-fopt-info} options are accepted, only one of them can include
7077 a @var{filename}. If other filenames are provided then all but the
7078 first such option are ignored.
7079
7080 Note that the output @var{filename} is overwritten
7081 in case of multiple translation units. If a combined output from
7082 multiple translation units is desired, @file{stderr} should be used
7083 instead.
7084
7085 In the following example, the optimization info is output to
7086 @file{stderr}:
7087
7088 @smallexample
7089 gcc -O3 -fopt-info
7090 @end smallexample
7091
7092 This example:
7093 @smallexample
7094 gcc -O3 -fopt-info-missed=missed.all
7095 @end smallexample
7096
7097 @noindent
7098 outputs missed optimization report from all the passes into
7099 @file{missed.all}, and this one:
7100
7101 @smallexample
7102 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
7103 @end smallexample
7104
7105 @noindent
7106 prints information about missed optimization opportunities from
7107 vectorization passes on @file{stderr}.
7108 Note that @option{-fopt-info-vec-missed} is equivalent to
7109 @option{-fopt-info-missed-vec}.
7110
7111 As another example,
7112 @smallexample
7113 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
7114 @end smallexample
7115
7116 @noindent
7117 outputs information about missed optimizations as well as
7118 optimized locations from all the inlining passes into
7119 @file{inline.txt}.
7120
7121 Finally, consider:
7122
7123 @smallexample
7124 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
7125 @end smallexample
7126
7127 @noindent
7128 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
7129 in conflict since only one output file is allowed. In this case, only
7130 the first option takes effect and the subsequent options are
7131 ignored. Thus only @file{vec.miss} is produced which contains
7132 dumps from the vectorizer about missed opportunities.
7133
7134 @item -frandom-seed=@var{number}
7135 @opindex frandom-seed
7136 This option provides a seed that GCC uses in place of
7137 random numbers in generating certain symbol names
7138 that have to be different in every compiled file. It is also used to
7139 place unique stamps in coverage data files and the object files that
7140 produce them. You can use the @option{-frandom-seed} option to produce
7141 reproducibly identical object files.
7142
7143 The @var{number} should be different for every file you compile.
7144
7145 @item -fsched-verbose=@var{n}
7146 @opindex fsched-verbose
7147 On targets that use instruction scheduling, this option controls the
7148 amount of debugging output the scheduler prints. This information is
7149 written to standard error, unless @option{-fdump-rtl-sched1} or
7150 @option{-fdump-rtl-sched2} is specified, in which case it is output
7151 to the usual dump listing file, @file{.sched1} or @file{.sched2}
7152 respectively. However for @var{n} greater than nine, the output is
7153 always printed to standard error.
7154
7155 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
7156 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
7157 For @var{n} greater than one, it also output basic block probabilities,
7158 detailed ready list information and unit/insn info. For @var{n} greater
7159 than two, it includes RTL at abort point, control-flow and regions info.
7160 And for @var{n} over four, @option{-fsched-verbose} also includes
7161 dependence info.
7162
7163 @item -save-temps
7164 @itemx -save-temps=cwd
7165 @opindex save-temps
7166 Store the usual ``temporary'' intermediate files permanently; place them
7167 in the current directory and name them based on the source file. Thus,
7168 compiling @file{foo.c} with @option{-c -save-temps} produces files
7169 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
7170 preprocessed @file{foo.i} output file even though the compiler now
7171 normally uses an integrated preprocessor.
7172
7173 When used in combination with the @option{-x} command-line option,
7174 @option{-save-temps} is sensible enough to avoid over writing an
7175 input source file with the same extension as an intermediate file.
7176 The corresponding intermediate file may be obtained by renaming the
7177 source file before using @option{-save-temps}.
7178
7179 If you invoke GCC in parallel, compiling several different source
7180 files that share a common base name in different subdirectories or the
7181 same source file compiled for multiple output destinations, it is
7182 likely that the different parallel compilers will interfere with each
7183 other, and overwrite the temporary files. For instance:
7184
7185 @smallexample
7186 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
7187 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
7188 @end smallexample
7189
7190 may result in @file{foo.i} and @file{foo.o} being written to
7191 simultaneously by both compilers.
7192
7193 @item -save-temps=obj
7194 @opindex save-temps=obj
7195 Store the usual ``temporary'' intermediate files permanently. If the
7196 @option{-o} option is used, the temporary files are based on the
7197 object file. If the @option{-o} option is not used, the
7198 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
7199
7200 For example:
7201
7202 @smallexample
7203 gcc -save-temps=obj -c foo.c
7204 gcc -save-temps=obj -c bar.c -o dir/xbar.o
7205 gcc -save-temps=obj foobar.c -o dir2/yfoobar
7206 @end smallexample
7207
7208 @noindent
7209 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
7210 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
7211 @file{dir2/yfoobar.o}.
7212
7213 @item -time@r{[}=@var{file}@r{]}
7214 @opindex time
7215 Report the CPU time taken by each subprocess in the compilation
7216 sequence. For C source files, this is the compiler proper and assembler
7217 (plus the linker if linking is done).
7218
7219 Without the specification of an output file, the output looks like this:
7220
7221 @smallexample
7222 # cc1 0.12 0.01
7223 # as 0.00 0.01
7224 @end smallexample
7225
7226 The first number on each line is the ``user time'', that is time spent
7227 executing the program itself. The second number is ``system time'',
7228 time spent executing operating system routines on behalf of the program.
7229 Both numbers are in seconds.
7230
7231 With the specification of an output file, the output is appended to the
7232 named file, and it looks like this:
7233
7234 @smallexample
7235 0.12 0.01 cc1 @var{options}
7236 0.00 0.01 as @var{options}
7237 @end smallexample
7238
7239 The ``user time'' and the ``system time'' are moved before the program
7240 name, and the options passed to the program are displayed, so that one
7241 can later tell what file was being compiled, and with which options.
7242
7243 @item -fvar-tracking
7244 @opindex fvar-tracking
7245 Run variable tracking pass. It computes where variables are stored at each
7246 position in code. Better debugging information is then generated
7247 (if the debugging information format supports this information).
7248
7249 It is enabled by default when compiling with optimization (@option{-Os},
7250 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7251 the debug info format supports it.
7252
7253 @item -fvar-tracking-assignments
7254 @opindex fvar-tracking-assignments
7255 @opindex fno-var-tracking-assignments
7256 Annotate assignments to user variables early in the compilation and
7257 attempt to carry the annotations over throughout the compilation all the
7258 way to the end, in an attempt to improve debug information while
7259 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7260
7261 It can be enabled even if var-tracking is disabled, in which case
7262 annotations are created and maintained, but discarded at the end.
7263 By default, this flag is enabled together with @option{-fvar-tracking},
7264 except when selective scheduling is enabled.
7265
7266 @item -fvar-tracking-assignments-toggle
7267 @opindex fvar-tracking-assignments-toggle
7268 @opindex fno-var-tracking-assignments-toggle
7269 Toggle @option{-fvar-tracking-assignments}, in the same way that
7270 @option{-gtoggle} toggles @option{-g}.
7271
7272 @item -print-file-name=@var{library}
7273 @opindex print-file-name
7274 Print the full absolute name of the library file @var{library} that
7275 would be used when linking---and don't do anything else. With this
7276 option, GCC does not compile or link anything; it just prints the
7277 file name.
7278
7279 @item -print-multi-directory
7280 @opindex print-multi-directory
7281 Print the directory name corresponding to the multilib selected by any
7282 other switches present in the command line. This directory is supposed
7283 to exist in @env{GCC_EXEC_PREFIX}.
7284
7285 @item -print-multi-lib
7286 @opindex print-multi-lib
7287 Print the mapping from multilib directory names to compiler switches
7288 that enable them. The directory name is separated from the switches by
7289 @samp{;}, and each switch starts with an @samp{@@} instead of the
7290 @samp{-}, without spaces between multiple switches. This is supposed to
7291 ease shell processing.
7292
7293 @item -print-multi-os-directory
7294 @opindex print-multi-os-directory
7295 Print the path to OS libraries for the selected
7296 multilib, relative to some @file{lib} subdirectory. If OS libraries are
7297 present in the @file{lib} subdirectory and no multilibs are used, this is
7298 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
7299 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
7300 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
7301 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
7302
7303 @item -print-multiarch
7304 @opindex print-multiarch
7305 Print the path to OS libraries for the selected multiarch,
7306 relative to some @file{lib} subdirectory.
7307
7308 @item -print-prog-name=@var{program}
7309 @opindex print-prog-name
7310 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
7311
7312 @item -print-libgcc-file-name
7313 @opindex print-libgcc-file-name
7314 Same as @option{-print-file-name=libgcc.a}.
7315
7316 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
7317 but you do want to link with @file{libgcc.a}. You can do:
7318
7319 @smallexample
7320 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
7321 @end smallexample
7322
7323 @item -print-search-dirs
7324 @opindex print-search-dirs
7325 Print the name of the configured installation directory and a list of
7326 program and library directories @command{gcc} searches---and don't do anything else.
7327
7328 This is useful when @command{gcc} prints the error message
7329 @samp{installation problem, cannot exec cpp0: No such file or directory}.
7330 To resolve this you either need to put @file{cpp0} and the other compiler
7331 components where @command{gcc} expects to find them, or you can set the environment
7332 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
7333 Don't forget the trailing @samp{/}.
7334 @xref{Environment Variables}.
7335
7336 @item -print-sysroot
7337 @opindex print-sysroot
7338 Print the target sysroot directory that is used during
7339 compilation. This is the target sysroot specified either at configure
7340 time or using the @option{--sysroot} option, possibly with an extra
7341 suffix that depends on compilation options. If no target sysroot is
7342 specified, the option prints nothing.
7343
7344 @item -print-sysroot-headers-suffix
7345 @opindex print-sysroot-headers-suffix
7346 Print the suffix added to the target sysroot when searching for
7347 headers, or give an error if the compiler is not configured with such
7348 a suffix---and don't do anything else.
7349
7350 @item -dumpmachine
7351 @opindex dumpmachine
7352 Print the compiler's target machine (for example,
7353 @samp{i686-pc-linux-gnu})---and don't do anything else.
7354
7355 @item -dumpversion
7356 @opindex dumpversion
7357 Print the compiler version (for example, @code{3.0})---and don't do
7358 anything else.
7359
7360 @item -dumpspecs
7361 @opindex dumpspecs
7362 Print the compiler's built-in specs---and don't do anything else. (This
7363 is used when GCC itself is being built.) @xref{Spec Files}.
7364
7365 @item -fno-eliminate-unused-debug-types
7366 @opindex feliminate-unused-debug-types
7367 @opindex fno-eliminate-unused-debug-types
7368 Normally, when producing DWARF 2 output, GCC avoids producing debug symbol
7369 output for types that are nowhere used in the source file being compiled.
7370 Sometimes it is useful to have GCC emit debugging
7371 information for all types declared in a compilation
7372 unit, regardless of whether or not they are actually used
7373 in that compilation unit, for example
7374 if, in the debugger, you want to cast a value to a type that is
7375 not actually used in your program (but is declared). More often,
7376 however, this results in a significant amount of wasted space.
7377 @end table
7378
7379 @node Optimize Options
7380 @section Options That Control Optimization
7381 @cindex optimize options
7382 @cindex options, optimization
7383
7384 These options control various sorts of optimizations.
7385
7386 Without any optimization option, the compiler's goal is to reduce the
7387 cost of compilation and to make debugging produce the expected
7388 results. Statements are independent: if you stop the program with a
7389 breakpoint between statements, you can then assign a new value to any
7390 variable or change the program counter to any other statement in the
7391 function and get exactly the results you expect from the source
7392 code.
7393
7394 Turning on optimization flags makes the compiler attempt to improve
7395 the performance and/or code size at the expense of compilation time
7396 and possibly the ability to debug the program.
7397
7398 The compiler performs optimization based on the knowledge it has of the
7399 program. Compiling multiple files at once to a single output file mode allows
7400 the compiler to use information gained from all of the files when compiling
7401 each of them.
7402
7403 Not all optimizations are controlled directly by a flag. Only
7404 optimizations that have a flag are listed in this section.
7405
7406 Most optimizations are only enabled if an @option{-O} level is set on
7407 the command line. Otherwise they are disabled, even if individual
7408 optimization flags are specified.
7409
7410 Depending on the target and how GCC was configured, a slightly different
7411 set of optimizations may be enabled at each @option{-O} level than
7412 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7413 to find out the exact set of optimizations that are enabled at each level.
7414 @xref{Overall Options}, for examples.
7415
7416 @table @gcctabopt
7417 @item -O
7418 @itemx -O1
7419 @opindex O
7420 @opindex O1
7421 Optimize. Optimizing compilation takes somewhat more time, and a lot
7422 more memory for a large function.
7423
7424 With @option{-O}, the compiler tries to reduce code size and execution
7425 time, without performing any optimizations that take a great deal of
7426 compilation time.
7427
7428 @option{-O} turns on the following optimization flags:
7429 @gccoptlist{
7430 -fauto-inc-dec @gol
7431 -fbranch-count-reg @gol
7432 -fcombine-stack-adjustments @gol
7433 -fcompare-elim @gol
7434 -fcprop-registers @gol
7435 -fdce @gol
7436 -fdefer-pop @gol
7437 -fdelayed-branch @gol
7438 -fdse @gol
7439 -fforward-propagate @gol
7440 -fguess-branch-probability @gol
7441 -fif-conversion2 @gol
7442 -fif-conversion @gol
7443 -finline-functions-called-once @gol
7444 -fipa-pure-const @gol
7445 -fipa-profile @gol
7446 -fipa-reference @gol
7447 -fmerge-constants @gol
7448 -fmove-loop-invariants @gol
7449 -fshrink-wrap @gol
7450 -fsplit-wide-types @gol
7451 -ftree-bit-ccp @gol
7452 -ftree-ccp @gol
7453 -fssa-phiopt @gol
7454 -ftree-ch @gol
7455 -ftree-copy-prop @gol
7456 -ftree-copyrename @gol
7457 -ftree-dce @gol
7458 -ftree-dominator-opts @gol
7459 -ftree-dse @gol
7460 -ftree-forwprop @gol
7461 -ftree-fre @gol
7462 -ftree-phiprop @gol
7463 -ftree-sink @gol
7464 -ftree-slsr @gol
7465 -ftree-sra @gol
7466 -ftree-pta @gol
7467 -ftree-ter @gol
7468 -funit-at-a-time}
7469
7470 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
7471 where doing so does not interfere with debugging.
7472
7473 @item -O2
7474 @opindex O2
7475 Optimize even more. GCC performs nearly all supported optimizations
7476 that do not involve a space-speed tradeoff.
7477 As compared to @option{-O}, this option increases both compilation time
7478 and the performance of the generated code.
7479
7480 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7481 also turns on the following optimization flags:
7482 @gccoptlist{-fthread-jumps @gol
7483 -falign-functions -falign-jumps @gol
7484 -falign-loops -falign-labels @gol
7485 -fcaller-saves @gol
7486 -fcrossjumping @gol
7487 -fcse-follow-jumps -fcse-skip-blocks @gol
7488 -fdelete-null-pointer-checks @gol
7489 -fdevirtualize -fdevirtualize-speculatively @gol
7490 -fexpensive-optimizations @gol
7491 -fgcse -fgcse-lm @gol
7492 -fhoist-adjacent-loads @gol
7493 -finline-small-functions @gol
7494 -findirect-inlining @gol
7495 -fipa-cp @gol
7496 -fipa-cp-alignment @gol
7497 -fipa-sra @gol
7498 -fipa-icf @gol
7499 -fisolate-erroneous-paths-dereference @gol
7500 -flra-remat @gol
7501 -foptimize-sibling-calls @gol
7502 -foptimize-strlen @gol
7503 -fpartial-inlining @gol
7504 -fpeephole2 @gol
7505 -freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol
7506 -frerun-cse-after-loop @gol
7507 -fsched-interblock -fsched-spec @gol
7508 -fschedule-insns -fschedule-insns2 @gol
7509 -fstrict-aliasing -fstrict-overflow @gol
7510 -ftree-builtin-call-dce @gol
7511 -ftree-switch-conversion -ftree-tail-merge @gol
7512 -ftree-pre @gol
7513 -ftree-vrp @gol
7514 -fipa-ra}
7515
7516 Please note the warning under @option{-fgcse} about
7517 invoking @option{-O2} on programs that use computed gotos.
7518
7519 @item -O3
7520 @opindex O3
7521 Optimize yet more. @option{-O3} turns on all optimizations specified
7522 by @option{-O2} and also turns on the @option{-finline-functions},
7523 @option{-funswitch-loops}, @option{-fpredictive-commoning},
7524 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
7525 @option{-ftree-loop-distribute-patterns},
7526 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
7527 @option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
7528
7529 @item -O0
7530 @opindex O0
7531 Reduce compilation time and make debugging produce the expected
7532 results. This is the default.
7533
7534 @item -Os
7535 @opindex Os
7536 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7537 do not typically increase code size. It also performs further
7538 optimizations designed to reduce code size.
7539
7540 @option{-Os} disables the following optimization flags:
7541 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7542 -falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
7543 -fprefetch-loop-arrays}
7544
7545 @item -Ofast
7546 @opindex Ofast
7547 Disregard strict standards compliance. @option{-Ofast} enables all
7548 @option{-O3} optimizations. It also enables optimizations that are not
7549 valid for all standard-compliant programs.
7550 It turns on @option{-ffast-math} and the Fortran-specific
7551 @option{-fno-protect-parens} and @option{-fstack-arrays}.
7552
7553 @item -Og
7554 @opindex Og
7555 Optimize debugging experience. @option{-Og} enables optimizations
7556 that do not interfere with debugging. It should be the optimization
7557 level of choice for the standard edit-compile-debug cycle, offering
7558 a reasonable level of optimization while maintaining fast compilation
7559 and a good debugging experience.
7560
7561 If you use multiple @option{-O} options, with or without level numbers,
7562 the last such option is the one that is effective.
7563 @end table
7564
7565 Options of the form @option{-f@var{flag}} specify machine-independent
7566 flags. Most flags have both positive and negative forms; the negative
7567 form of @option{-ffoo} is @option{-fno-foo}. In the table
7568 below, only one of the forms is listed---the one you typically
7569 use. You can figure out the other form by either removing @samp{no-}
7570 or adding it.
7571
7572 The following options control specific optimizations. They are either
7573 activated by @option{-O} options or are related to ones that are. You
7574 can use the following flags in the rare cases when ``fine-tuning'' of
7575 optimizations to be performed is desired.
7576
7577 @table @gcctabopt
7578 @item -fno-defer-pop
7579 @opindex fno-defer-pop
7580 Always pop the arguments to each function call as soon as that function
7581 returns. For machines that must pop arguments after a function call,
7582 the compiler normally lets arguments accumulate on the stack for several
7583 function calls and pops them all at once.
7584
7585 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7586
7587 @item -fforward-propagate
7588 @opindex fforward-propagate
7589 Perform a forward propagation pass on RTL@. The pass tries to combine two
7590 instructions and checks if the result can be simplified. If loop unrolling
7591 is active, two passes are performed and the second is scheduled after
7592 loop unrolling.
7593
7594 This option is enabled by default at optimization levels @option{-O},
7595 @option{-O2}, @option{-O3}, @option{-Os}.
7596
7597 @item -ffp-contract=@var{style}
7598 @opindex ffp-contract
7599 @option{-ffp-contract=off} disables floating-point expression contraction.
7600 @option{-ffp-contract=fast} enables floating-point expression contraction
7601 such as forming of fused multiply-add operations if the target has
7602 native support for them.
7603 @option{-ffp-contract=on} enables floating-point expression contraction
7604 if allowed by the language standard. This is currently not implemented
7605 and treated equal to @option{-ffp-contract=off}.
7606
7607 The default is @option{-ffp-contract=fast}.
7608
7609 @item -fomit-frame-pointer
7610 @opindex fomit-frame-pointer
7611 Don't keep the frame pointer in a register for functions that
7612 don't need one. This avoids the instructions to save, set up and
7613 restore frame pointers; it also makes an extra register available
7614 in many functions. @strong{It also makes debugging impossible on
7615 some machines.}
7616
7617 On some machines, such as the VAX, this flag has no effect, because
7618 the standard calling sequence automatically handles the frame pointer
7619 and nothing is saved by pretending it doesn't exist. The
7620 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
7621 whether a target machine supports this flag. @xref{Registers,,Register
7622 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
7623
7624 The default setting (when not optimizing for
7625 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
7626 @option{-fomit-frame-pointer}. You can configure GCC with the
7627 @option{--enable-frame-pointer} configure option to change the default.
7628
7629 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7630
7631 @item -foptimize-sibling-calls
7632 @opindex foptimize-sibling-calls
7633 Optimize sibling and tail recursive calls.
7634
7635 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7636
7637 @item -foptimize-strlen
7638 @opindex foptimize-strlen
7639 Optimize various standard C string functions (e.g. @code{strlen},
7640 @code{strchr} or @code{strcpy}) and
7641 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7642
7643 Enabled at levels @option{-O2}, @option{-O3}.
7644
7645 @item -fno-inline
7646 @opindex fno-inline
7647 Do not expand any functions inline apart from those marked with
7648 the @code{always_inline} attribute. This is the default when not
7649 optimizing.
7650
7651 Single functions can be exempted from inlining by marking them
7652 with the @code{noinline} attribute.
7653
7654 @item -finline-small-functions
7655 @opindex finline-small-functions
7656 Integrate functions into their callers when their body is smaller than expected
7657 function call code (so overall size of program gets smaller). The compiler
7658 heuristically decides which functions are simple enough to be worth integrating
7659 in this way. This inlining applies to all functions, even those not declared
7660 inline.
7661
7662 Enabled at level @option{-O2}.
7663
7664 @item -findirect-inlining
7665 @opindex findirect-inlining
7666 Inline also indirect calls that are discovered to be known at compile
7667 time thanks to previous inlining. This option has any effect only
7668 when inlining itself is turned on by the @option{-finline-functions}
7669 or @option{-finline-small-functions} options.
7670
7671 Enabled at level @option{-O2}.
7672
7673 @item -finline-functions
7674 @opindex finline-functions
7675 Consider all functions for inlining, even if they are not declared inline.
7676 The compiler heuristically decides which functions are worth integrating
7677 in this way.
7678
7679 If all calls to a given function are integrated, and the function is
7680 declared @code{static}, then the function is normally not output as
7681 assembler code in its own right.
7682
7683 Enabled at level @option{-O3}.
7684
7685 @item -finline-functions-called-once
7686 @opindex finline-functions-called-once
7687 Consider all @code{static} functions called once for inlining into their
7688 caller even if they are not marked @code{inline}. If a call to a given
7689 function is integrated, then the function is not output as assembler code
7690 in its own right.
7691
7692 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7693
7694 @item -fearly-inlining
7695 @opindex fearly-inlining
7696 Inline functions marked by @code{always_inline} and functions whose body seems
7697 smaller than the function call overhead early before doing
7698 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7699 makes profiling significantly cheaper and usually inlining faster on programs
7700 having large chains of nested wrapper functions.
7701
7702 Enabled by default.
7703
7704 @item -fipa-sra
7705 @opindex fipa-sra
7706 Perform interprocedural scalar replacement of aggregates, removal of
7707 unused parameters and replacement of parameters passed by reference
7708 by parameters passed by value.
7709
7710 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7711
7712 @item -finline-limit=@var{n}
7713 @opindex finline-limit
7714 By default, GCC limits the size of functions that can be inlined. This flag
7715 allows coarse control of this limit. @var{n} is the size of functions that
7716 can be inlined in number of pseudo instructions.
7717
7718 Inlining is actually controlled by a number of parameters, which may be
7719 specified individually by using @option{--param @var{name}=@var{value}}.
7720 The @option{-finline-limit=@var{n}} option sets some of these parameters
7721 as follows:
7722
7723 @table @gcctabopt
7724 @item max-inline-insns-single
7725 is set to @var{n}/2.
7726 @item max-inline-insns-auto
7727 is set to @var{n}/2.
7728 @end table
7729
7730 See below for a documentation of the individual
7731 parameters controlling inlining and for the defaults of these parameters.
7732
7733 @emph{Note:} there may be no value to @option{-finline-limit} that results
7734 in default behavior.
7735
7736 @emph{Note:} pseudo instruction represents, in this particular context, an
7737 abstract measurement of function's size. In no way does it represent a count
7738 of assembly instructions and as such its exact meaning might change from one
7739 release to an another.
7740
7741 @item -fno-keep-inline-dllexport
7742 @opindex fno-keep-inline-dllexport
7743 This is a more fine-grained version of @option{-fkeep-inline-functions},
7744 which applies only to functions that are declared using the @code{dllexport}
7745 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
7746 Functions}.)
7747
7748 @item -fkeep-inline-functions
7749 @opindex fkeep-inline-functions
7750 In C, emit @code{static} functions that are declared @code{inline}
7751 into the object file, even if the function has been inlined into all
7752 of its callers. This switch does not affect functions using the
7753 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7754 inline functions into the object file.
7755
7756 @item -fkeep-static-consts
7757 @opindex fkeep-static-consts
7758 Emit variables declared @code{static const} when optimization isn't turned
7759 on, even if the variables aren't referenced.
7760
7761 GCC enables this option by default. If you want to force the compiler to
7762 check if a variable is referenced, regardless of whether or not
7763 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7764
7765 @item -fmerge-constants
7766 @opindex fmerge-constants
7767 Attempt to merge identical constants (string constants and floating-point
7768 constants) across compilation units.
7769
7770 This option is the default for optimized compilation if the assembler and
7771 linker support it. Use @option{-fno-merge-constants} to inhibit this
7772 behavior.
7773
7774 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7775
7776 @item -fmerge-all-constants
7777 @opindex fmerge-all-constants
7778 Attempt to merge identical constants and identical variables.
7779
7780 This option implies @option{-fmerge-constants}. In addition to
7781 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7782 arrays or initialized constant variables with integral or floating-point
7783 types. Languages like C or C++ require each variable, including multiple
7784 instances of the same variable in recursive calls, to have distinct locations,
7785 so using this option results in non-conforming
7786 behavior.
7787
7788 @item -fmodulo-sched
7789 @opindex fmodulo-sched
7790 Perform swing modulo scheduling immediately before the first scheduling
7791 pass. This pass looks at innermost loops and reorders their
7792 instructions by overlapping different iterations.
7793
7794 @item -fmodulo-sched-allow-regmoves
7795 @opindex fmodulo-sched-allow-regmoves
7796 Perform more aggressive SMS-based modulo scheduling with register moves
7797 allowed. By setting this flag certain anti-dependences edges are
7798 deleted, which triggers the generation of reg-moves based on the
7799 life-range analysis. This option is effective only with
7800 @option{-fmodulo-sched} enabled.
7801
7802 @item -fno-branch-count-reg
7803 @opindex fno-branch-count-reg
7804 Do not use ``decrement and branch'' instructions on a count register,
7805 but instead generate a sequence of instructions that decrement a
7806 register, compare it against zero, then branch based upon the result.
7807 This option is only meaningful on architectures that support such
7808 instructions, which include x86, PowerPC, IA-64 and S/390.
7809
7810 Enabled by default at @option{-O1} and higher.
7811
7812 The default is @option{-fbranch-count-reg}.
7813
7814 @item -fno-function-cse
7815 @opindex fno-function-cse
7816 Do not put function addresses in registers; make each instruction that
7817 calls a constant function contain the function's address explicitly.
7818
7819 This option results in less efficient code, but some strange hacks
7820 that alter the assembler output may be confused by the optimizations
7821 performed when this option is not used.
7822
7823 The default is @option{-ffunction-cse}
7824
7825 @item -fno-zero-initialized-in-bss
7826 @opindex fno-zero-initialized-in-bss
7827 If the target supports a BSS section, GCC by default puts variables that
7828 are initialized to zero into BSS@. This can save space in the resulting
7829 code.
7830
7831 This option turns off this behavior because some programs explicitly
7832 rely on variables going to the data section---e.g., so that the
7833 resulting executable can find the beginning of that section and/or make
7834 assumptions based on that.
7835
7836 The default is @option{-fzero-initialized-in-bss}.
7837
7838 @item -fthread-jumps
7839 @opindex fthread-jumps
7840 Perform optimizations that check to see if a jump branches to a
7841 location where another comparison subsumed by the first is found. If
7842 so, the first branch is redirected to either the destination of the
7843 second branch or a point immediately following it, depending on whether
7844 the condition is known to be true or false.
7845
7846 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7847
7848 @item -fsplit-wide-types
7849 @opindex fsplit-wide-types
7850 When using a type that occupies multiple registers, such as @code{long
7851 long} on a 32-bit system, split the registers apart and allocate them
7852 independently. This normally generates better code for those types,
7853 but may make debugging more difficult.
7854
7855 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7856 @option{-Os}.
7857
7858 @item -fcse-follow-jumps
7859 @opindex fcse-follow-jumps
7860 In common subexpression elimination (CSE), scan through jump instructions
7861 when the target of the jump is not reached by any other path. For
7862 example, when CSE encounters an @code{if} statement with an
7863 @code{else} clause, CSE follows the jump when the condition
7864 tested is false.
7865
7866 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7867
7868 @item -fcse-skip-blocks
7869 @opindex fcse-skip-blocks
7870 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7871 follow jumps that conditionally skip over blocks. When CSE
7872 encounters a simple @code{if} statement with no else clause,
7873 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7874 body of the @code{if}.
7875
7876 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7877
7878 @item -frerun-cse-after-loop
7879 @opindex frerun-cse-after-loop
7880 Re-run common subexpression elimination after loop optimizations are
7881 performed.
7882
7883 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7884
7885 @item -fgcse
7886 @opindex fgcse
7887 Perform a global common subexpression elimination pass.
7888 This pass also performs global constant and copy propagation.
7889
7890 @emph{Note:} When compiling a program using computed gotos, a GCC
7891 extension, you may get better run-time performance if you disable
7892 the global common subexpression elimination pass by adding
7893 @option{-fno-gcse} to the command line.
7894
7895 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7896
7897 @item -fgcse-lm
7898 @opindex fgcse-lm
7899 When @option{-fgcse-lm} is enabled, global common subexpression elimination
7900 attempts to move loads that are only killed by stores into themselves. This
7901 allows a loop containing a load/store sequence to be changed to a load outside
7902 the loop, and a copy/store within the loop.
7903
7904 Enabled by default when @option{-fgcse} is enabled.
7905
7906 @item -fgcse-sm
7907 @opindex fgcse-sm
7908 When @option{-fgcse-sm} is enabled, a store motion pass is run after
7909 global common subexpression elimination. This pass attempts to move
7910 stores out of loops. When used in conjunction with @option{-fgcse-lm},
7911 loops containing a load/store sequence can be changed to a load before
7912 the loop and a store after the loop.
7913
7914 Not enabled at any optimization level.
7915
7916 @item -fgcse-las
7917 @opindex fgcse-las
7918 When @option{-fgcse-las} is enabled, the global common subexpression
7919 elimination pass eliminates redundant loads that come after stores to the
7920 same memory location (both partial and full redundancies).
7921
7922 Not enabled at any optimization level.
7923
7924 @item -fgcse-after-reload
7925 @opindex fgcse-after-reload
7926 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7927 pass is performed after reload. The purpose of this pass is to clean up
7928 redundant spilling.
7929
7930 @item -faggressive-loop-optimizations
7931 @opindex faggressive-loop-optimizations
7932 This option tells the loop optimizer to use language constraints to
7933 derive bounds for the number of iterations of a loop. This assumes that
7934 loop code does not invoke undefined behavior by for example causing signed
7935 integer overflows or out-of-bound array accesses. The bounds for the
7936 number of iterations of a loop are used to guide loop unrolling and peeling
7937 and loop exit test optimizations.
7938 This option is enabled by default.
7939
7940 @item -funsafe-loop-optimizations
7941 @opindex funsafe-loop-optimizations
7942 This option tells the loop optimizer to assume that loop indices do not
7943 overflow, and that loops with nontrivial exit condition are not
7944 infinite. This enables a wider range of loop optimizations even if
7945 the loop optimizer itself cannot prove that these assumptions are valid.
7946 If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you
7947 if it finds this kind of loop.
7948
7949 @item -fcrossjumping
7950 @opindex fcrossjumping
7951 Perform cross-jumping transformation.
7952 This transformation unifies equivalent code and saves code size. The
7953 resulting code may or may not perform better than without cross-jumping.
7954
7955 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7956
7957 @item -fauto-inc-dec
7958 @opindex fauto-inc-dec
7959 Combine increments or decrements of addresses with memory accesses.
7960 This pass is always skipped on architectures that do not have
7961 instructions to support this. Enabled by default at @option{-O} and
7962 higher on architectures that support this.
7963
7964 @item -fdce
7965 @opindex fdce
7966 Perform dead code elimination (DCE) on RTL@.
7967 Enabled by default at @option{-O} and higher.
7968
7969 @item -fdse
7970 @opindex fdse
7971 Perform dead store elimination (DSE) on RTL@.
7972 Enabled by default at @option{-O} and higher.
7973
7974 @item -fif-conversion
7975 @opindex fif-conversion
7976 Attempt to transform conditional jumps into branch-less equivalents. This
7977 includes use of conditional moves, min, max, set flags and abs instructions, and
7978 some tricks doable by standard arithmetics. The use of conditional execution
7979 on chips where it is available is controlled by @option{-fif-conversion2}.
7980
7981 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7982
7983 @item -fif-conversion2
7984 @opindex fif-conversion2
7985 Use conditional execution (where available) to transform conditional jumps into
7986 branch-less equivalents.
7987
7988 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7989
7990 @item -fdeclone-ctor-dtor
7991 @opindex fdeclone-ctor-dtor
7992 The C++ ABI requires multiple entry points for constructors and
7993 destructors: one for a base subobject, one for a complete object, and
7994 one for a virtual destructor that calls operator delete afterwards.
7995 For a hierarchy with virtual bases, the base and complete variants are
7996 clones, which means two copies of the function. With this option, the
7997 base and complete variants are changed to be thunks that call a common
7998 implementation.
7999
8000 Enabled by @option{-Os}.
8001
8002 @item -fdelete-null-pointer-checks
8003 @opindex fdelete-null-pointer-checks
8004 Assume that programs cannot safely dereference null pointers, and that
8005 no code or data element resides there. This enables simple constant
8006 folding optimizations at all optimization levels. In addition, other
8007 optimization passes in GCC use this flag to control global dataflow
8008 analyses that eliminate useless checks for null pointers; these assume
8009 that if a pointer is checked after it has already been dereferenced,
8010 it cannot be null.
8011
8012 Note however that in some environments this assumption is not true.
8013 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8014 for programs that depend on that behavior.
8015
8016 Some targets, especially embedded ones, disable this option at all levels.
8017 Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
8018 @option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information
8019 are enabled independently at different optimization levels.
8020
8021 @item -fdevirtualize
8022 @opindex fdevirtualize
8023 Attempt to convert calls to virtual functions to direct calls. This
8024 is done both within a procedure and interprocedurally as part of
8025 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8026 propagation (@option{-fipa-cp}).
8027 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8028
8029 @item -fdevirtualize-speculatively
8030 @opindex fdevirtualize-speculatively
8031 Attempt to convert calls to virtual functions to speculative direct calls.
8032 Based on the analysis of the type inheritance graph, determine for a given call
8033 the set of likely targets. If the set is small, preferably of size 1, change
8034 the call into a conditional deciding between direct and indirect calls. The
8035 speculative calls enable more optimizations, such as inlining. When they seem
8036 useless after further optimization, they are converted back into original form.
8037
8038 @item -fdevirtualize-at-ltrans
8039 @opindex fdevirtualize-at-ltrans
8040 Stream extra information needed for aggressive devirtualization when running
8041 the link-time optimizer in local transformation mode.
8042 This option enables more devirtualization but
8043 significantly increases the size of streamed data. For this reason it is
8044 disabled by default.
8045
8046 @item -fexpensive-optimizations
8047 @opindex fexpensive-optimizations
8048 Perform a number of minor optimizations that are relatively expensive.
8049
8050 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8051
8052 @item -free
8053 @opindex free
8054 Attempt to remove redundant extension instructions. This is especially
8055 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8056 registers after writing to their lower 32-bit half.
8057
8058 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8059 @option{-O3}, @option{-Os}.
8060
8061 @item -fno-lifetime-dse
8062 @opindex fno-lifetime-dse
8063 In C++ the value of an object is only affected by changes within its
8064 lifetime: when the constructor begins, the object has an indeterminate
8065 value, and any changes during the lifetime of the object are dead when
8066 the object is destroyed. Normally dead store elimination will take
8067 advantage of this; if your code relies on the value of the object
8068 storage persisting beyond the lifetime of the object, you can use this
8069 flag to disable this optimization.
8070
8071 @item -flive-range-shrinkage
8072 @opindex flive-range-shrinkage
8073 Attempt to decrease register pressure through register live range
8074 shrinkage. This is helpful for fast processors with small or moderate
8075 size register sets.
8076
8077 @item -fira-algorithm=@var{algorithm}
8078 @opindex fira-algorithm
8079 Use the specified coloring algorithm for the integrated register
8080 allocator. The @var{algorithm} argument can be @samp{priority}, which
8081 specifies Chow's priority coloring, or @samp{CB}, which specifies
8082 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8083 for all architectures, but for those targets that do support it, it is
8084 the default because it generates better code.
8085
8086 @item -fira-region=@var{region}
8087 @opindex fira-region
8088 Use specified regions for the integrated register allocator. The
8089 @var{region} argument should be one of the following:
8090
8091 @table @samp
8092
8093 @item all
8094 Use all loops as register allocation regions.
8095 This can give the best results for machines with a small and/or
8096 irregular register set.
8097
8098 @item mixed
8099 Use all loops except for loops with small register pressure
8100 as the regions. This value usually gives
8101 the best results in most cases and for most architectures,
8102 and is enabled by default when compiling with optimization for speed
8103 (@option{-O}, @option{-O2}, @dots{}).
8104
8105 @item one
8106 Use all functions as a single region.
8107 This typically results in the smallest code size, and is enabled by default for
8108 @option{-Os} or @option{-O0}.
8109
8110 @end table
8111
8112 @item -fira-hoist-pressure
8113 @opindex fira-hoist-pressure
8114 Use IRA to evaluate register pressure in the code hoisting pass for
8115 decisions to hoist expressions. This option usually results in smaller
8116 code, but it can slow the compiler down.
8117
8118 This option is enabled at level @option{-Os} for all targets.
8119
8120 @item -fira-loop-pressure
8121 @opindex fira-loop-pressure
8122 Use IRA to evaluate register pressure in loops for decisions to move
8123 loop invariants. This option usually results in generation
8124 of faster and smaller code on machines with large register files (>= 32
8125 registers), but it can slow the compiler down.
8126
8127 This option is enabled at level @option{-O3} for some targets.
8128
8129 @item -fno-ira-share-save-slots
8130 @opindex fno-ira-share-save-slots
8131 Disable sharing of stack slots used for saving call-used hard
8132 registers living through a call. Each hard register gets a
8133 separate stack slot, and as a result function stack frames are
8134 larger.
8135
8136 @item -fno-ira-share-spill-slots
8137 @opindex fno-ira-share-spill-slots
8138 Disable sharing of stack slots allocated for pseudo-registers. Each
8139 pseudo-register that does not get a hard register gets a separate
8140 stack slot, and as a result function stack frames are larger.
8141
8142 @item -fira-verbose=@var{n}
8143 @opindex fira-verbose
8144 Control the verbosity of the dump file for the integrated register allocator.
8145 The default value is 5. If the value @var{n} is greater or equal to 10,
8146 the dump output is sent to stderr using the same format as @var{n} minus 10.
8147
8148 @item -flra-remat
8149 @opindex flra-remat
8150 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8151 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8152 values if it is profitable.
8153
8154 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8155
8156 @item -fdelayed-branch
8157 @opindex fdelayed-branch
8158 If supported for the target machine, attempt to reorder instructions
8159 to exploit instruction slots available after delayed branch
8160 instructions.
8161
8162 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8163
8164 @item -fschedule-insns
8165 @opindex fschedule-insns
8166 If supported for the target machine, attempt to reorder instructions to
8167 eliminate execution stalls due to required data being unavailable. This
8168 helps machines that have slow floating point or memory load instructions
8169 by allowing other instructions to be issued until the result of the load
8170 or floating-point instruction is required.
8171
8172 Enabled at levels @option{-O2}, @option{-O3}.
8173
8174 @item -fschedule-insns2
8175 @opindex fschedule-insns2
8176 Similar to @option{-fschedule-insns}, but requests an additional pass of
8177 instruction scheduling after register allocation has been done. This is
8178 especially useful on machines with a relatively small number of
8179 registers and where memory load instructions take more than one cycle.
8180
8181 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8182
8183 @item -fno-sched-interblock
8184 @opindex fno-sched-interblock
8185 Don't schedule instructions across basic blocks. This is normally
8186 enabled by default when scheduling before register allocation, i.e.@:
8187 with @option{-fschedule-insns} or at @option{-O2} or higher.
8188
8189 @item -fno-sched-spec
8190 @opindex fno-sched-spec
8191 Don't allow speculative motion of non-load instructions. This is normally
8192 enabled by default when scheduling before register allocation, i.e.@:
8193 with @option{-fschedule-insns} or at @option{-O2} or higher.
8194
8195 @item -fsched-pressure
8196 @opindex fsched-pressure
8197 Enable register pressure sensitive insn scheduling before register
8198 allocation. This only makes sense when scheduling before register
8199 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8200 @option{-O2} or higher. Usage of this option can improve the
8201 generated code and decrease its size by preventing register pressure
8202 increase above the number of available hard registers and subsequent
8203 spills in register allocation.
8204
8205 @item -fsched-spec-load
8206 @opindex fsched-spec-load
8207 Allow speculative motion of some load instructions. This only makes
8208 sense when scheduling before register allocation, i.e.@: with
8209 @option{-fschedule-insns} or at @option{-O2} or higher.
8210
8211 @item -fsched-spec-load-dangerous
8212 @opindex fsched-spec-load-dangerous
8213 Allow speculative motion of more load instructions. This only makes
8214 sense when scheduling before register allocation, i.e.@: with
8215 @option{-fschedule-insns} or at @option{-O2} or higher.
8216
8217 @item -fsched-stalled-insns
8218 @itemx -fsched-stalled-insns=@var{n}
8219 @opindex fsched-stalled-insns
8220 Define how many insns (if any) can be moved prematurely from the queue
8221 of stalled insns into the ready list during the second scheduling pass.
8222 @option{-fno-sched-stalled-insns} means that no insns are moved
8223 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8224 on how many queued insns can be moved prematurely.
8225 @option{-fsched-stalled-insns} without a value is equivalent to
8226 @option{-fsched-stalled-insns=1}.
8227
8228 @item -fsched-stalled-insns-dep
8229 @itemx -fsched-stalled-insns-dep=@var{n}
8230 @opindex fsched-stalled-insns-dep
8231 Define how many insn groups (cycles) are examined for a dependency
8232 on a stalled insn that is a candidate for premature removal from the queue
8233 of stalled insns. This has an effect only during the second scheduling pass,
8234 and only if @option{-fsched-stalled-insns} is used.
8235 @option{-fno-sched-stalled-insns-dep} is equivalent to
8236 @option{-fsched-stalled-insns-dep=0}.
8237 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8238 @option{-fsched-stalled-insns-dep=1}.
8239
8240 @item -fsched2-use-superblocks
8241 @opindex fsched2-use-superblocks
8242 When scheduling after register allocation, use superblock scheduling.
8243 This allows motion across basic block boundaries,
8244 resulting in faster schedules. This option is experimental, as not all machine
8245 descriptions used by GCC model the CPU closely enough to avoid unreliable
8246 results from the algorithm.
8247
8248 This only makes sense when scheduling after register allocation, i.e.@: with
8249 @option{-fschedule-insns2} or at @option{-O2} or higher.
8250
8251 @item -fsched-group-heuristic
8252 @opindex fsched-group-heuristic
8253 Enable the group heuristic in the scheduler. This heuristic favors
8254 the instruction that belongs to a schedule group. This is enabled
8255 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8256 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8257
8258 @item -fsched-critical-path-heuristic
8259 @opindex fsched-critical-path-heuristic
8260 Enable the critical-path heuristic in the scheduler. This heuristic favors
8261 instructions on the critical path. This is enabled by default when
8262 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8263 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8264
8265 @item -fsched-spec-insn-heuristic
8266 @opindex fsched-spec-insn-heuristic
8267 Enable the speculative instruction heuristic in the scheduler. This
8268 heuristic favors speculative instructions with greater dependency weakness.
8269 This is enabled by default when scheduling is enabled, i.e.@:
8270 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8271 or at @option{-O2} or higher.
8272
8273 @item -fsched-rank-heuristic
8274 @opindex fsched-rank-heuristic
8275 Enable the rank heuristic in the scheduler. This heuristic favors
8276 the instruction belonging to a basic block with greater size or frequency.
8277 This is enabled by default when scheduling is enabled, i.e.@:
8278 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8279 at @option{-O2} or higher.
8280
8281 @item -fsched-last-insn-heuristic
8282 @opindex fsched-last-insn-heuristic
8283 Enable the last-instruction heuristic in the scheduler. This heuristic
8284 favors the instruction that is less dependent on the last instruction
8285 scheduled. This is enabled by default when scheduling is enabled,
8286 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8287 at @option{-O2} or higher.
8288
8289 @item -fsched-dep-count-heuristic
8290 @opindex fsched-dep-count-heuristic
8291 Enable the dependent-count heuristic in the scheduler. This heuristic
8292 favors the instruction that has more instructions depending on it.
8293 This is enabled by default when scheduling is enabled, i.e.@:
8294 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8295 at @option{-O2} or higher.
8296
8297 @item -freschedule-modulo-scheduled-loops
8298 @opindex freschedule-modulo-scheduled-loops
8299 Modulo scheduling is performed before traditional scheduling. If a loop
8300 is modulo scheduled, later scheduling passes may change its schedule.
8301 Use this option to control that behavior.
8302
8303 @item -fselective-scheduling
8304 @opindex fselective-scheduling
8305 Schedule instructions using selective scheduling algorithm. Selective
8306 scheduling runs instead of the first scheduler pass.
8307
8308 @item -fselective-scheduling2
8309 @opindex fselective-scheduling2
8310 Schedule instructions using selective scheduling algorithm. Selective
8311 scheduling runs instead of the second scheduler pass.
8312
8313 @item -fsel-sched-pipelining
8314 @opindex fsel-sched-pipelining
8315 Enable software pipelining of innermost loops during selective scheduling.
8316 This option has no effect unless one of @option{-fselective-scheduling} or
8317 @option{-fselective-scheduling2} is turned on.
8318
8319 @item -fsel-sched-pipelining-outer-loops
8320 @opindex fsel-sched-pipelining-outer-loops
8321 When pipelining loops during selective scheduling, also pipeline outer loops.
8322 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8323
8324 @item -fsemantic-interposition
8325 @opindex fsemantic-interposition
8326 Some object formats, like ELF, allow interposing of symbols by the
8327 dynamic linker.
8328 This means that for symbols exported from the DSO, the compiler cannot perform
8329 interprocedural propagation, inlining and other optimizations in anticipation
8330 that the function or variable in question may change. While this feature is
8331 useful, for example, to rewrite memory allocation functions by a debugging
8332 implementation, it is expensive in the terms of code quality.
8333 With @option{-fno-semantic-interposition} the compiler assumes that
8334 if interposition happens for functions the overwriting function will have
8335 precisely the same semantics (and side effects).
8336 Similarly if interposition happens
8337 for variables, the constructor of the variable will be the same. The flag
8338 has no effect for functions explicitly declared inline
8339 (where it is never allowed for interposition to change semantics)
8340 and for symbols explicitly declared weak.
8341
8342 @item -fshrink-wrap
8343 @opindex fshrink-wrap
8344 Emit function prologues only before parts of the function that need it,
8345 rather than at the top of the function. This flag is enabled by default at
8346 @option{-O} and higher.
8347
8348 @item -fcaller-saves
8349 @opindex fcaller-saves
8350 Enable allocation of values to registers that are clobbered by
8351 function calls, by emitting extra instructions to save and restore the
8352 registers around such calls. Such allocation is done only when it
8353 seems to result in better code.
8354
8355 This option is always enabled by default on certain machines, usually
8356 those which have no call-preserved registers to use instead.
8357
8358 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8359
8360 @item -fcombine-stack-adjustments
8361 @opindex fcombine-stack-adjustments
8362 Tracks stack adjustments (pushes and pops) and stack memory references
8363 and then tries to find ways to combine them.
8364
8365 Enabled by default at @option{-O1} and higher.
8366
8367 @item -fipa-ra
8368 @opindex fipa-ra
8369 Use caller save registers for allocation if those registers are not used by
8370 any called function. In that case it is not necessary to save and restore
8371 them around calls. This is only possible if called functions are part of
8372 same compilation unit as current function and they are compiled before it.
8373
8374 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8375
8376 @item -fconserve-stack
8377 @opindex fconserve-stack
8378 Attempt to minimize stack usage. The compiler attempts to use less
8379 stack space, even if that makes the program slower. This option
8380 implies setting the @option{large-stack-frame} parameter to 100
8381 and the @option{large-stack-frame-growth} parameter to 400.
8382
8383 @item -ftree-reassoc
8384 @opindex ftree-reassoc
8385 Perform reassociation on trees. This flag is enabled by default
8386 at @option{-O} and higher.
8387
8388 @item -ftree-pre
8389 @opindex ftree-pre
8390 Perform partial redundancy elimination (PRE) on trees. This flag is
8391 enabled by default at @option{-O2} and @option{-O3}.
8392
8393 @item -ftree-partial-pre
8394 @opindex ftree-partial-pre
8395 Make partial redundancy elimination (PRE) more aggressive. This flag is
8396 enabled by default at @option{-O3}.
8397
8398 @item -ftree-forwprop
8399 @opindex ftree-forwprop
8400 Perform forward propagation on trees. This flag is enabled by default
8401 at @option{-O} and higher.
8402
8403 @item -ftree-fre
8404 @opindex ftree-fre
8405 Perform full redundancy elimination (FRE) on trees. The difference
8406 between FRE and PRE is that FRE only considers expressions
8407 that are computed on all paths leading to the redundant computation.
8408 This analysis is faster than PRE, though it exposes fewer redundancies.
8409 This flag is enabled by default at @option{-O} and higher.
8410
8411 @item -ftree-phiprop
8412 @opindex ftree-phiprop
8413 Perform hoisting of loads from conditional pointers on trees. This
8414 pass is enabled by default at @option{-O} and higher.
8415
8416 @item -fhoist-adjacent-loads
8417 @opindex fhoist-adjacent-loads
8418 Speculatively hoist loads from both branches of an if-then-else if the
8419 loads are from adjacent locations in the same structure and the target
8420 architecture has a conditional move instruction. This flag is enabled
8421 by default at @option{-O2} and higher.
8422
8423 @item -ftree-copy-prop
8424 @opindex ftree-copy-prop
8425 Perform copy propagation on trees. This pass eliminates unnecessary
8426 copy operations. This flag is enabled by default at @option{-O} and
8427 higher.
8428
8429 @item -fipa-pure-const
8430 @opindex fipa-pure-const
8431 Discover which functions are pure or constant.
8432 Enabled by default at @option{-O} and higher.
8433
8434 @item -fipa-reference
8435 @opindex fipa-reference
8436 Discover which static variables do not escape the
8437 compilation unit.
8438 Enabled by default at @option{-O} and higher.
8439
8440 @item -fipa-pta
8441 @opindex fipa-pta
8442 Perform interprocedural pointer analysis and interprocedural modification
8443 and reference analysis. This option can cause excessive memory and
8444 compile-time usage on large compilation units. It is not enabled by
8445 default at any optimization level.
8446
8447 @item -fipa-profile
8448 @opindex fipa-profile
8449 Perform interprocedural profile propagation. The functions called only from
8450 cold functions are marked as cold. Also functions executed once (such as
8451 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8452 functions and loop less parts of functions executed once are then optimized for
8453 size.
8454 Enabled by default at @option{-O} and higher.
8455
8456 @item -fipa-cp
8457 @opindex fipa-cp
8458 Perform interprocedural constant propagation.
8459 This optimization analyzes the program to determine when values passed
8460 to functions are constants and then optimizes accordingly.
8461 This optimization can substantially increase performance
8462 if the application has constants passed to functions.
8463 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8464
8465 @item -fipa-cp-clone
8466 @opindex fipa-cp-clone
8467 Perform function cloning to make interprocedural constant propagation stronger.
8468 When enabled, interprocedural constant propagation performs function cloning
8469 when externally visible function can be called with constant arguments.
8470 Because this optimization can create multiple copies of functions,
8471 it may significantly increase code size
8472 (see @option{--param ipcp-unit-growth=@var{value}}).
8473 This flag is enabled by default at @option{-O3}.
8474
8475 @item -fipa-cp-alignment
8476 @opindex -fipa-cp-alignment
8477 When enabled, this optimization propagates alignment of function
8478 parameters to support better vectorization and string operations.
8479
8480 This flag is enabled by default at @option{-O2} and @option{-Os}. It
8481 requires that @option{-fipa-cp} is enabled.
8482
8483 @item -fipa-icf
8484 @opindex fipa-icf
8485 Perform Identical Code Folding for functions and read-only variables.
8486 The optimization reduces code size and may disturb unwind stacks by replacing
8487 a function by equivalent one with a different name. The optimization works
8488 more effectively with link time optimization enabled.
8489
8490 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8491 works on different levels and thus the optimizations are not same - there are
8492 equivalences that are found only by GCC and equivalences found only by Gold.
8493
8494 This flag is enabled by default at @option{-O2} and @option{-Os}.
8495
8496 @item -fisolate-erroneous-paths-dereference
8497 @opindex fisolate-erroneous-paths-dereference
8498 Detect paths that trigger erroneous or undefined behavior due to
8499 dereferencing a null pointer. Isolate those paths from the main control
8500 flow and turn the statement with erroneous or undefined behavior into a trap.
8501 This flag is enabled by default at @option{-O2} and higher.
8502
8503 @item -fisolate-erroneous-paths-attribute
8504 @opindex fisolate-erroneous-paths-attribute
8505 Detect paths that trigger erroneous or undefined behavior due a null value
8506 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8507 attribute. Isolate those paths from the main control flow and turn the
8508 statement with erroneous or undefined behavior into a trap. This is not
8509 currently enabled, but may be enabled by @option{-O2} in the future.
8510
8511 @item -ftree-sink
8512 @opindex ftree-sink
8513 Perform forward store motion on trees. This flag is
8514 enabled by default at @option{-O} and higher.
8515
8516 @item -ftree-bit-ccp
8517 @opindex ftree-bit-ccp
8518 Perform sparse conditional bit constant propagation on trees and propagate
8519 pointer alignment information.
8520 This pass only operates on local scalar variables and is enabled by default
8521 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8522
8523 @item -ftree-ccp
8524 @opindex ftree-ccp
8525 Perform sparse conditional constant propagation (CCP) on trees. This
8526 pass only operates on local scalar variables and is enabled by default
8527 at @option{-O} and higher.
8528
8529 @item -fssa-phiopt
8530 @opindex fssa-phiopt
8531 Perform pattern matching on SSA PHI nodes to optimize conditional
8532 code. This pass is enabled by default at @option{-O} and higher.
8533
8534 @item -ftree-switch-conversion
8535 @opindex ftree-switch-conversion
8536 Perform conversion of simple initializations in a switch to
8537 initializations from a scalar array. This flag is enabled by default
8538 at @option{-O2} and higher.
8539
8540 @item -ftree-tail-merge
8541 @opindex ftree-tail-merge
8542 Look for identical code sequences. When found, replace one with a jump to the
8543 other. This optimization is known as tail merging or cross jumping. This flag
8544 is enabled by default at @option{-O2} and higher. The compilation time
8545 in this pass can
8546 be limited using @option{max-tail-merge-comparisons} parameter and
8547 @option{max-tail-merge-iterations} parameter.
8548
8549 @item -ftree-dce
8550 @opindex ftree-dce
8551 Perform dead code elimination (DCE) on trees. This flag is enabled by
8552 default at @option{-O} and higher.
8553
8554 @item -ftree-builtin-call-dce
8555 @opindex ftree-builtin-call-dce
8556 Perform conditional dead code elimination (DCE) for calls to built-in functions
8557 that may set @code{errno} but are otherwise side-effect free. This flag is
8558 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8559 specified.
8560
8561 @item -ftree-dominator-opts
8562 @opindex ftree-dominator-opts
8563 Perform a variety of simple scalar cleanups (constant/copy
8564 propagation, redundancy elimination, range propagation and expression
8565 simplification) based on a dominator tree traversal. This also
8566 performs jump threading (to reduce jumps to jumps). This flag is
8567 enabled by default at @option{-O} and higher.
8568
8569 @item -ftree-dse
8570 @opindex ftree-dse
8571 Perform dead store elimination (DSE) on trees. A dead store is a store into
8572 a memory location that is later overwritten by another store without
8573 any intervening loads. In this case the earlier store can be deleted. This
8574 flag is enabled by default at @option{-O} and higher.
8575
8576 @item -ftree-ch
8577 @opindex ftree-ch
8578 Perform loop header copying on trees. This is beneficial since it increases
8579 effectiveness of code motion optimizations. It also saves one jump. This flag
8580 is enabled by default at @option{-O} and higher. It is not enabled
8581 for @option{-Os}, since it usually increases code size.
8582
8583 @item -ftree-loop-optimize
8584 @opindex ftree-loop-optimize
8585 Perform loop optimizations on trees. This flag is enabled by default
8586 at @option{-O} and higher.
8587
8588 @item -ftree-loop-linear
8589 @opindex ftree-loop-linear
8590 Perform loop interchange transformations on tree. Same as
8591 @option{-floop-interchange}. To use this code transformation, GCC has
8592 to be configured with @option{--with-isl} to enable the Graphite loop
8593 transformation infrastructure.
8594
8595 @item -floop-interchange
8596 @opindex floop-interchange
8597 Perform loop interchange transformations on loops. Interchanging two
8598 nested loops switches the inner and outer loops. For example, given a
8599 loop like:
8600 @smallexample
8601 DO J = 1, M
8602 DO I = 1, N
8603 A(J, I) = A(J, I) * C
8604 ENDDO
8605 ENDDO
8606 @end smallexample
8607 @noindent
8608 loop interchange transforms the loop as if it were written:
8609 @smallexample
8610 DO I = 1, N
8611 DO J = 1, M
8612 A(J, I) = A(J, I) * C
8613 ENDDO
8614 ENDDO
8615 @end smallexample
8616 which can be beneficial when @code{N} is larger than the caches,
8617 because in Fortran, the elements of an array are stored in memory
8618 contiguously by column, and the original loop iterates over rows,
8619 potentially creating at each access a cache miss. This optimization
8620 applies to all the languages supported by GCC and is not limited to
8621 Fortran. To use this code transformation, GCC has to be configured
8622 with @option{--with-isl} to enable the Graphite loop transformation
8623 infrastructure.
8624
8625 @item -floop-strip-mine
8626 @opindex floop-strip-mine
8627 Perform loop strip mining transformations on loops. Strip mining
8628 splits a loop into two nested loops. The outer loop has strides
8629 equal to the strip size and the inner loop has strides of the
8630 original loop within a strip. The strip length can be changed
8631 using the @option{loop-block-tile-size} parameter. For example,
8632 given a loop like:
8633 @smallexample
8634 DO I = 1, N
8635 A(I) = A(I) + C
8636 ENDDO
8637 @end smallexample
8638 @noindent
8639 loop strip mining transforms the loop as if it were written:
8640 @smallexample
8641 DO II = 1, N, 51
8642 DO I = II, min (II + 50, N)
8643 A(I) = A(I) + C
8644 ENDDO
8645 ENDDO
8646 @end smallexample
8647 This optimization applies to all the languages supported by GCC and is
8648 not limited to Fortran. To use this code transformation, GCC has to
8649 be configured with @option{--with-isl} to enable the Graphite loop
8650 transformation infrastructure.
8651
8652 @item -floop-block
8653 @opindex floop-block
8654 Perform loop blocking transformations on loops. Blocking strip mines
8655 each loop in the loop nest such that the memory accesses of the
8656 element loops fit inside caches. The strip length can be changed
8657 using the @option{loop-block-tile-size} parameter. For example, given
8658 a loop like:
8659 @smallexample
8660 DO I = 1, N
8661 DO J = 1, M
8662 A(J, I) = B(I) + C(J)
8663 ENDDO
8664 ENDDO
8665 @end smallexample
8666 @noindent
8667 loop blocking transforms the loop as if it were written:
8668 @smallexample
8669 DO II = 1, N, 51
8670 DO JJ = 1, M, 51
8671 DO I = II, min (II + 50, N)
8672 DO J = JJ, min (JJ + 50, M)
8673 A(J, I) = B(I) + C(J)
8674 ENDDO
8675 ENDDO
8676 ENDDO
8677 ENDDO
8678 @end smallexample
8679 which can be beneficial when @code{M} is larger than the caches,
8680 because the innermost loop iterates over a smaller amount of data
8681 which can be kept in the caches. This optimization applies to all the
8682 languages supported by GCC and is not limited to Fortran. To use this
8683 code transformation, GCC has to be configured with @option{--with-isl}
8684 to enable the Graphite loop transformation infrastructure.
8685
8686 @item -fgraphite-identity
8687 @opindex fgraphite-identity
8688 Enable the identity transformation for graphite. For every SCoP we generate
8689 the polyhedral representation and transform it back to gimple. Using
8690 @option{-fgraphite-identity} we can check the costs or benefits of the
8691 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8692 are also performed by the code generator ISL, like index splitting and
8693 dead code elimination in loops.
8694
8695 @item -floop-nest-optimize
8696 @opindex floop-nest-optimize
8697 Enable the ISL based loop nest optimizer. This is a generic loop nest
8698 optimizer based on the Pluto optimization algorithms. It calculates a loop
8699 structure optimized for data-locality and parallelism. This option
8700 is experimental.
8701
8702 @item -floop-unroll-and-jam
8703 @opindex floop-unroll-and-jam
8704 Enable unroll and jam for the ISL based loop nest optimizer. The unroll
8705 factor can be changed using the @option{loop-unroll-jam-size} parameter.
8706 The unrolled dimension (counting from the most inner one) can be changed
8707 using the @option{loop-unroll-jam-depth} parameter. .
8708
8709 @item -floop-parallelize-all
8710 @opindex floop-parallelize-all
8711 Use the Graphite data dependence analysis to identify loops that can
8712 be parallelized. Parallelize all the loops that can be analyzed to
8713 not contain loop carried dependences without checking that it is
8714 profitable to parallelize the loops.
8715
8716 @item -fcheck-data-deps
8717 @opindex fcheck-data-deps
8718 Compare the results of several data dependence analyzers. This option
8719 is used for debugging the data dependence analyzers.
8720
8721 @item -ftree-loop-if-convert
8722 @opindex ftree-loop-if-convert
8723 Attempt to transform conditional jumps in the innermost loops to
8724 branch-less equivalents. The intent is to remove control-flow from
8725 the innermost loops in order to improve the ability of the
8726 vectorization pass to handle these loops. This is enabled by default
8727 if vectorization is enabled.
8728
8729 @item -ftree-loop-if-convert-stores
8730 @opindex ftree-loop-if-convert-stores
8731 Attempt to also if-convert conditional jumps containing memory writes.
8732 This transformation can be unsafe for multi-threaded programs as it
8733 transforms conditional memory writes into unconditional memory writes.
8734 For example,
8735 @smallexample
8736 for (i = 0; i < N; i++)
8737 if (cond)
8738 A[i] = expr;
8739 @end smallexample
8740 is transformed to
8741 @smallexample
8742 for (i = 0; i < N; i++)
8743 A[i] = cond ? expr : A[i];
8744 @end smallexample
8745 potentially producing data races.
8746
8747 @item -ftree-loop-distribution
8748 @opindex ftree-loop-distribution
8749 Perform loop distribution. This flag can improve cache performance on
8750 big loop bodies and allow further loop optimizations, like
8751 parallelization or vectorization, to take place. For example, the loop
8752 @smallexample
8753 DO I = 1, N
8754 A(I) = B(I) + C
8755 D(I) = E(I) * F
8756 ENDDO
8757 @end smallexample
8758 is transformed to
8759 @smallexample
8760 DO I = 1, N
8761 A(I) = B(I) + C
8762 ENDDO
8763 DO I = 1, N
8764 D(I) = E(I) * F
8765 ENDDO
8766 @end smallexample
8767
8768 @item -ftree-loop-distribute-patterns
8769 @opindex ftree-loop-distribute-patterns
8770 Perform loop distribution of patterns that can be code generated with
8771 calls to a library. This flag is enabled by default at @option{-O3}.
8772
8773 This pass distributes the initialization loops and generates a call to
8774 memset zero. For example, the loop
8775 @smallexample
8776 DO I = 1, N
8777 A(I) = 0
8778 B(I) = A(I) + I
8779 ENDDO
8780 @end smallexample
8781 is transformed to
8782 @smallexample
8783 DO I = 1, N
8784 A(I) = 0
8785 ENDDO
8786 DO I = 1, N
8787 B(I) = A(I) + I
8788 ENDDO
8789 @end smallexample
8790 and the initialization loop is transformed into a call to memset zero.
8791
8792 @item -ftree-loop-im
8793 @opindex ftree-loop-im
8794 Perform loop invariant motion on trees. This pass moves only invariants that
8795 are hard to handle at RTL level (function calls, operations that expand to
8796 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8797 operands of conditions that are invariant out of the loop, so that we can use
8798 just trivial invariantness analysis in loop unswitching. The pass also includes
8799 store motion.
8800
8801 @item -ftree-loop-ivcanon
8802 @opindex ftree-loop-ivcanon
8803 Create a canonical counter for number of iterations in loops for which
8804 determining number of iterations requires complicated analysis. Later
8805 optimizations then may determine the number easily. Useful especially
8806 in connection with unrolling.
8807
8808 @item -fivopts
8809 @opindex fivopts
8810 Perform induction variable optimizations (strength reduction, induction
8811 variable merging and induction variable elimination) on trees.
8812
8813 @item -ftree-parallelize-loops=n
8814 @opindex ftree-parallelize-loops
8815 Parallelize loops, i.e., split their iteration space to run in n threads.
8816 This is only possible for loops whose iterations are independent
8817 and can be arbitrarily reordered. The optimization is only
8818 profitable on multiprocessor machines, for loops that are CPU-intensive,
8819 rather than constrained e.g.@: by memory bandwidth. This option
8820 implies @option{-pthread}, and thus is only supported on targets
8821 that have support for @option{-pthread}.
8822
8823 @item -ftree-pta
8824 @opindex ftree-pta
8825 Perform function-local points-to analysis on trees. This flag is
8826 enabled by default at @option{-O} and higher.
8827
8828 @item -ftree-sra
8829 @opindex ftree-sra
8830 Perform scalar replacement of aggregates. This pass replaces structure
8831 references with scalars to prevent committing structures to memory too
8832 early. This flag is enabled by default at @option{-O} and higher.
8833
8834 @item -ftree-copyrename
8835 @opindex ftree-copyrename
8836 Perform copy renaming on trees. This pass attempts to rename compiler
8837 temporaries to other variables at copy locations, usually resulting in
8838 variable names which more closely resemble the original variables. This flag
8839 is enabled by default at @option{-O} and higher.
8840
8841 @item -ftree-coalesce-inlined-vars
8842 @opindex ftree-coalesce-inlined-vars
8843 Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to
8844 combine small user-defined variables too, but only if they are inlined
8845 from other functions. It is a more limited form of
8846 @option{-ftree-coalesce-vars}. This may harm debug information of such
8847 inlined variables, but it keeps variables of the inlined-into
8848 function apart from each other, such that they are more likely to
8849 contain the expected values in a debugging session.
8850
8851 @item -ftree-coalesce-vars
8852 @opindex ftree-coalesce-vars
8853 Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to
8854 combine small user-defined variables too, instead of just compiler
8855 temporaries. This may severely limit the ability to debug an optimized
8856 program compiled with @option{-fno-var-tracking-assignments}. In the
8857 negated form, this flag prevents SSA coalescing of user variables,
8858 including inlined ones. This option is enabled by default.
8859
8860 @item -ftree-ter
8861 @opindex ftree-ter
8862 Perform temporary expression replacement during the SSA->normal phase. Single
8863 use/single def temporaries are replaced at their use location with their
8864 defining expression. This results in non-GIMPLE code, but gives the expanders
8865 much more complex trees to work on resulting in better RTL generation. This is
8866 enabled by default at @option{-O} and higher.
8867
8868 @item -ftree-slsr
8869 @opindex ftree-slsr
8870 Perform straight-line strength reduction on trees. This recognizes related
8871 expressions involving multiplications and replaces them by less expensive
8872 calculations when possible. This is enabled by default at @option{-O} and
8873 higher.
8874
8875 @item -ftree-vectorize
8876 @opindex ftree-vectorize
8877 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8878 and @option{-ftree-slp-vectorize} if not explicitly specified.
8879
8880 @item -ftree-loop-vectorize
8881 @opindex ftree-loop-vectorize
8882 Perform loop vectorization on trees. This flag is enabled by default at
8883 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8884
8885 @item -ftree-slp-vectorize
8886 @opindex ftree-slp-vectorize
8887 Perform basic block vectorization on trees. This flag is enabled by default at
8888 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8889
8890 @item -fvect-cost-model=@var{model}
8891 @opindex fvect-cost-model
8892 Alter the cost model used for vectorization. The @var{model} argument
8893 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
8894 With the @samp{unlimited} model the vectorized code-path is assumed
8895 to be profitable while with the @samp{dynamic} model a runtime check
8896 guards the vectorized code-path to enable it only for iteration
8897 counts that will likely execute faster than when executing the original
8898 scalar loop. The @samp{cheap} model disables vectorization of
8899 loops where doing so would be cost prohibitive for example due to
8900 required runtime checks for data dependence or alignment but otherwise
8901 is equal to the @samp{dynamic} model.
8902 The default cost model depends on other optimization flags and is
8903 either @samp{dynamic} or @samp{cheap}.
8904
8905 @item -fsimd-cost-model=@var{model}
8906 @opindex fsimd-cost-model
8907 Alter the cost model used for vectorization of loops marked with the OpenMP
8908 or Cilk Plus simd directive. The @var{model} argument should be one of
8909 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
8910 have the same meaning as described in @option{-fvect-cost-model} and by
8911 default a cost model defined with @option{-fvect-cost-model} is used.
8912
8913 @item -ftree-vrp
8914 @opindex ftree-vrp
8915 Perform Value Range Propagation on trees. This is similar to the
8916 constant propagation pass, but instead of values, ranges of values are
8917 propagated. This allows the optimizers to remove unnecessary range
8918 checks like array bound checks and null pointer checks. This is
8919 enabled by default at @option{-O2} and higher. Null pointer check
8920 elimination is only done if @option{-fdelete-null-pointer-checks} is
8921 enabled.
8922
8923 @item -fsplit-ivs-in-unroller
8924 @opindex fsplit-ivs-in-unroller
8925 Enables expression of values of induction variables in later iterations
8926 of the unrolled loop using the value in the first iteration. This breaks
8927 long dependency chains, thus improving efficiency of the scheduling passes.
8928
8929 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8930 same effect. However, that is not reliable in cases where the loop body
8931 is more complicated than a single basic block. It also does not work at all
8932 on some architectures due to restrictions in the CSE pass.
8933
8934 This optimization is enabled by default.
8935
8936 @item -fvariable-expansion-in-unroller
8937 @opindex fvariable-expansion-in-unroller
8938 With this option, the compiler creates multiple copies of some
8939 local variables when unrolling a loop, which can result in superior code.
8940
8941 @item -fpartial-inlining
8942 @opindex fpartial-inlining
8943 Inline parts of functions. This option has any effect only
8944 when inlining itself is turned on by the @option{-finline-functions}
8945 or @option{-finline-small-functions} options.
8946
8947 Enabled at level @option{-O2}.
8948
8949 @item -fpredictive-commoning
8950 @opindex fpredictive-commoning
8951 Perform predictive commoning optimization, i.e., reusing computations
8952 (especially memory loads and stores) performed in previous
8953 iterations of loops.
8954
8955 This option is enabled at level @option{-O3}.
8956
8957 @item -fprefetch-loop-arrays
8958 @opindex fprefetch-loop-arrays
8959 If supported by the target machine, generate instructions to prefetch
8960 memory to improve the performance of loops that access large arrays.
8961
8962 This option may generate better or worse code; results are highly
8963 dependent on the structure of loops within the source code.
8964
8965 Disabled at level @option{-Os}.
8966
8967 @item -fno-peephole
8968 @itemx -fno-peephole2
8969 @opindex fno-peephole
8970 @opindex fno-peephole2
8971 Disable any machine-specific peephole optimizations. The difference
8972 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
8973 are implemented in the compiler; some targets use one, some use the
8974 other, a few use both.
8975
8976 @option{-fpeephole} is enabled by default.
8977 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8978
8979 @item -fno-guess-branch-probability
8980 @opindex fno-guess-branch-probability
8981 Do not guess branch probabilities using heuristics.
8982
8983 GCC uses heuristics to guess branch probabilities if they are
8984 not provided by profiling feedback (@option{-fprofile-arcs}). These
8985 heuristics are based on the control flow graph. If some branch probabilities
8986 are specified by @code{__builtin_expect}, then the heuristics are
8987 used to guess branch probabilities for the rest of the control flow graph,
8988 taking the @code{__builtin_expect} info into account. The interactions
8989 between the heuristics and @code{__builtin_expect} can be complex, and in
8990 some cases, it may be useful to disable the heuristics so that the effects
8991 of @code{__builtin_expect} are easier to understand.
8992
8993 The default is @option{-fguess-branch-probability} at levels
8994 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8995
8996 @item -freorder-blocks
8997 @opindex freorder-blocks
8998 Reorder basic blocks in the compiled function in order to reduce number of
8999 taken branches and improve code locality.
9000
9001 Enabled at levels @option{-O2}, @option{-O3}.
9002
9003 @item -freorder-blocks-and-partition
9004 @opindex freorder-blocks-and-partition
9005 In addition to reordering basic blocks in the compiled function, in order
9006 to reduce number of taken branches, partitions hot and cold basic blocks
9007 into separate sections of the assembly and .o files, to improve
9008 paging and cache locality performance.
9009
9010 This optimization is automatically turned off in the presence of
9011 exception handling, for linkonce sections, for functions with a user-defined
9012 section attribute and on any architecture that does not support named
9013 sections.
9014
9015 Enabled for x86 at levels @option{-O2}, @option{-O3}.
9016
9017 @item -freorder-functions
9018 @opindex freorder-functions
9019 Reorder functions in the object file in order to
9020 improve code locality. This is implemented by using special
9021 subsections @code{.text.hot} for most frequently executed functions and
9022 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9023 the linker so object file format must support named sections and linker must
9024 place them in a reasonable way.
9025
9026 Also profile feedback must be available to make this option effective. See
9027 @option{-fprofile-arcs} for details.
9028
9029 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9030
9031 @item -fstrict-aliasing
9032 @opindex fstrict-aliasing
9033 Allow the compiler to assume the strictest aliasing rules applicable to
9034 the language being compiled. For C (and C++), this activates
9035 optimizations based on the type of expressions. In particular, an
9036 object of one type is assumed never to reside at the same address as an
9037 object of a different type, unless the types are almost the same. For
9038 example, an @code{unsigned int} can alias an @code{int}, but not a
9039 @code{void*} or a @code{double}. A character type may alias any other
9040 type.
9041
9042 @anchor{Type-punning}Pay special attention to code like this:
9043 @smallexample
9044 union a_union @{
9045 int i;
9046 double d;
9047 @};
9048
9049 int f() @{
9050 union a_union t;
9051 t.d = 3.0;
9052 return t.i;
9053 @}
9054 @end smallexample
9055 The practice of reading from a different union member than the one most
9056 recently written to (called ``type-punning'') is common. Even with
9057 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9058 is accessed through the union type. So, the code above works as
9059 expected. @xref{Structures unions enumerations and bit-fields
9060 implementation}. However, this code might not:
9061 @smallexample
9062 int f() @{
9063 union a_union t;
9064 int* ip;
9065 t.d = 3.0;
9066 ip = &t.i;
9067 return *ip;
9068 @}
9069 @end smallexample
9070
9071 Similarly, access by taking the address, casting the resulting pointer
9072 and dereferencing the result has undefined behavior, even if the cast
9073 uses a union type, e.g.:
9074 @smallexample
9075 int f() @{
9076 double d = 3.0;
9077 return ((union a_union *) &d)->i;
9078 @}
9079 @end smallexample
9080
9081 The @option{-fstrict-aliasing} option is enabled at levels
9082 @option{-O2}, @option{-O3}, @option{-Os}.
9083
9084 @item -fstrict-overflow
9085 @opindex fstrict-overflow
9086 Allow the compiler to assume strict signed overflow rules, depending
9087 on the language being compiled. For C (and C++) this means that
9088 overflow when doing arithmetic with signed numbers is undefined, which
9089 means that the compiler may assume that it does not happen. This
9090 permits various optimizations. For example, the compiler assumes
9091 that an expression like @code{i + 10 > i} is always true for
9092 signed @code{i}. This assumption is only valid if signed overflow is
9093 undefined, as the expression is false if @code{i + 10} overflows when
9094 using twos complement arithmetic. When this option is in effect any
9095 attempt to determine whether an operation on signed numbers
9096 overflows must be written carefully to not actually involve overflow.
9097
9098 This option also allows the compiler to assume strict pointer
9099 semantics: given a pointer to an object, if adding an offset to that
9100 pointer does not produce a pointer to the same object, the addition is
9101 undefined. This permits the compiler to conclude that @code{p + u >
9102 p} is always true for a pointer @code{p} and unsigned integer
9103 @code{u}. This assumption is only valid because pointer wraparound is
9104 undefined, as the expression is false if @code{p + u} overflows using
9105 twos complement arithmetic.
9106
9107 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
9108 that integer signed overflow is fully defined: it wraps. When
9109 @option{-fwrapv} is used, there is no difference between
9110 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
9111 integers. With @option{-fwrapv} certain types of overflow are
9112 permitted. For example, if the compiler gets an overflow when doing
9113 arithmetic on constants, the overflowed value can still be used with
9114 @option{-fwrapv}, but not otherwise.
9115
9116 The @option{-fstrict-overflow} option is enabled at levels
9117 @option{-O2}, @option{-O3}, @option{-Os}.
9118
9119 @item -falign-functions
9120 @itemx -falign-functions=@var{n}
9121 @opindex falign-functions
9122 Align the start of functions to the next power-of-two greater than
9123 @var{n}, skipping up to @var{n} bytes. For instance,
9124 @option{-falign-functions=32} aligns functions to the next 32-byte
9125 boundary, but @option{-falign-functions=24} aligns to the next
9126 32-byte boundary only if this can be done by skipping 23 bytes or less.
9127
9128 @option{-fno-align-functions} and @option{-falign-functions=1} are
9129 equivalent and mean that functions are not aligned.
9130
9131 Some assemblers only support this flag when @var{n} is a power of two;
9132 in that case, it is rounded up.
9133
9134 If @var{n} is not specified or is zero, use a machine-dependent default.
9135
9136 Enabled at levels @option{-O2}, @option{-O3}.
9137
9138 @item -falign-labels
9139 @itemx -falign-labels=@var{n}
9140 @opindex falign-labels
9141 Align all branch targets to a power-of-two boundary, skipping up to
9142 @var{n} bytes like @option{-falign-functions}. This option can easily
9143 make code slower, because it must insert dummy operations for when the
9144 branch target is reached in the usual flow of the code.
9145
9146 @option{-fno-align-labels} and @option{-falign-labels=1} are
9147 equivalent and mean that labels are not aligned.
9148
9149 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9150 are greater than this value, then their values are used instead.
9151
9152 If @var{n} is not specified or is zero, use a machine-dependent default
9153 which is very likely to be @samp{1}, meaning no alignment.
9154
9155 Enabled at levels @option{-O2}, @option{-O3}.
9156
9157 @item -falign-loops
9158 @itemx -falign-loops=@var{n}
9159 @opindex falign-loops
9160 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
9161 like @option{-falign-functions}. If the loops are
9162 executed many times, this makes up for any execution of the dummy
9163 operations.
9164
9165 @option{-fno-align-loops} and @option{-falign-loops=1} are
9166 equivalent and mean that loops are not aligned.
9167
9168 If @var{n} is not specified or is zero, use a machine-dependent default.
9169
9170 Enabled at levels @option{-O2}, @option{-O3}.
9171
9172 @item -falign-jumps
9173 @itemx -falign-jumps=@var{n}
9174 @opindex falign-jumps
9175 Align branch targets to a power-of-two boundary, for branch targets
9176 where the targets can only be reached by jumping, skipping up to @var{n}
9177 bytes like @option{-falign-functions}. In this case, no dummy operations
9178 need be executed.
9179
9180 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9181 equivalent and mean that loops are not aligned.
9182
9183 If @var{n} is not specified or is zero, use a machine-dependent default.
9184
9185 Enabled at levels @option{-O2}, @option{-O3}.
9186
9187 @item -funit-at-a-time
9188 @opindex funit-at-a-time
9189 This option is left for compatibility reasons. @option{-funit-at-a-time}
9190 has no effect, while @option{-fno-unit-at-a-time} implies
9191 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9192
9193 Enabled by default.
9194
9195 @item -fno-toplevel-reorder
9196 @opindex fno-toplevel-reorder
9197 Do not reorder top-level functions, variables, and @code{asm}
9198 statements. Output them in the same order that they appear in the
9199 input file. When this option is used, unreferenced static variables
9200 are not removed. This option is intended to support existing code
9201 that relies on a particular ordering. For new code, it is better to
9202 use attributes when possible.
9203
9204 Enabled at level @option{-O0}. When disabled explicitly, it also implies
9205 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
9206 targets.
9207
9208 @item -fweb
9209 @opindex fweb
9210 Constructs webs as commonly used for register allocation purposes and assign
9211 each web individual pseudo register. This allows the register allocation pass
9212 to operate on pseudos directly, but also strengthens several other optimization
9213 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9214 however, make debugging impossible, since variables no longer stay in a
9215 ``home register''.
9216
9217 Enabled by default with @option{-funroll-loops}.
9218
9219 @item -fwhole-program
9220 @opindex fwhole-program
9221 Assume that the current compilation unit represents the whole program being
9222 compiled. All public functions and variables with the exception of @code{main}
9223 and those merged by attribute @code{externally_visible} become static functions
9224 and in effect are optimized more aggressively by interprocedural optimizers.
9225
9226 This option should not be used in combination with @option{-flto}.
9227 Instead relying on a linker plugin should provide safer and more precise
9228 information.
9229
9230 @item -flto[=@var{n}]
9231 @opindex flto
9232 This option runs the standard link-time optimizer. When invoked
9233 with source code, it generates GIMPLE (one of GCC's internal
9234 representations) and writes it to special ELF sections in the object
9235 file. When the object files are linked together, all the function
9236 bodies are read from these ELF sections and instantiated as if they
9237 had been part of the same translation unit.
9238
9239 To use the link-time optimizer, @option{-flto} and optimization
9240 options should be specified at compile time and during the final link.
9241 For example:
9242
9243 @smallexample
9244 gcc -c -O2 -flto foo.c
9245 gcc -c -O2 -flto bar.c
9246 gcc -o myprog -flto -O2 foo.o bar.o
9247 @end smallexample
9248
9249 The first two invocations to GCC save a bytecode representation
9250 of GIMPLE into special ELF sections inside @file{foo.o} and
9251 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9252 @file{foo.o} and @file{bar.o}, merges the two files into a single
9253 internal image, and compiles the result as usual. Since both
9254 @file{foo.o} and @file{bar.o} are merged into a single image, this
9255 causes all the interprocedural analyses and optimizations in GCC to
9256 work across the two files as if they were a single one. This means,
9257 for example, that the inliner is able to inline functions in
9258 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9259
9260 Another (simpler) way to enable link-time optimization is:
9261
9262 @smallexample
9263 gcc -o myprog -flto -O2 foo.c bar.c
9264 @end smallexample
9265
9266 The above generates bytecode for @file{foo.c} and @file{bar.c},
9267 merges them together into a single GIMPLE representation and optimizes
9268 them as usual to produce @file{myprog}.
9269
9270 The only important thing to keep in mind is that to enable link-time
9271 optimizations you need to use the GCC driver to perform the link-step.
9272 GCC then automatically performs link-time optimization if any of the
9273 objects involved were compiled with the @option{-flto} command-line option.
9274 You generally
9275 should specify the optimization options to be used for link-time
9276 optimization though GCC tries to be clever at guessing an
9277 optimization level to use from the options used at compile-time
9278 if you fail to specify one at link-time. You can always override
9279 the automatic decision to do link-time optimization at link-time
9280 by passing @option{-fno-lto} to the link command.
9281
9282 To make whole program optimization effective, it is necessary to make
9283 certain whole program assumptions. The compiler needs to know
9284 what functions and variables can be accessed by libraries and runtime
9285 outside of the link-time optimized unit. When supported by the linker,
9286 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9287 to the compiler about used and externally visible symbols. When
9288 the linker plugin is not available, @option{-fwhole-program} should be
9289 used to allow the compiler to make these assumptions, which leads
9290 to more aggressive optimization decisions.
9291
9292 When @option{-fuse-linker-plugin} is not enabled then, when a file is
9293 compiled with @option{-flto}, the generated object file is larger than
9294 a regular object file because it contains GIMPLE bytecodes and the usual
9295 final code (see @option{-ffat-lto-objects}. This means that
9296 object files with LTO information can be linked as normal object
9297 files; if @option{-fno-lto} is passed to the linker, no
9298 interprocedural optimizations are applied. Note that when
9299 @option{-fno-fat-lto-objects} is enabled the compile-stage is faster
9300 but you cannot perform a regular, non-LTO link on them.
9301
9302 Additionally, the optimization flags used to compile individual files
9303 are not necessarily related to those used at link time. For instance,
9304
9305 @smallexample
9306 gcc -c -O0 -ffat-lto-objects -flto foo.c
9307 gcc -c -O0 -ffat-lto-objects -flto bar.c
9308 gcc -o myprog -O3 foo.o bar.o
9309 @end smallexample
9310
9311 This produces individual object files with unoptimized assembler
9312 code, but the resulting binary @file{myprog} is optimized at
9313 @option{-O3}. If, instead, the final binary is generated with
9314 @option{-fno-lto}, then @file{myprog} is not optimized.
9315
9316 When producing the final binary, GCC only
9317 applies link-time optimizations to those files that contain bytecode.
9318 Therefore, you can mix and match object files and libraries with
9319 GIMPLE bytecodes and final object code. GCC automatically selects
9320 which files to optimize in LTO mode and which files to link without
9321 further processing.
9322
9323 There are some code generation flags preserved by GCC when
9324 generating bytecodes, as they need to be used during the final link
9325 stage. Generally options specified at link-time override those
9326 specified at compile-time.
9327
9328 If you do not specify an optimization level option @option{-O} at
9329 link-time then GCC computes one based on the optimization levels
9330 used when compiling the object files. The highest optimization
9331 level wins here.
9332
9333 Currently, the following options and their setting are take from
9334 the first object file that explicitely specified it:
9335 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9336 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9337 and all the @option{-m} target flags.
9338
9339 Certain ABI changing flags are required to match in all compilation-units
9340 and trying to override this at link-time with a conflicting value
9341 is ignored. This includes options such as @option{-freg-struct-return}
9342 and @option{-fpcc-struct-return}.
9343
9344 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9345 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9346 are passed through to the link stage and merged conservatively for
9347 conflicting translation units. Specifically
9348 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9349 precedence and for example @option{-ffp-contract=off} takes precedence
9350 over @option{-ffp-contract=fast}. You can override them at linke-time.
9351
9352 It is recommended that you compile all the files participating in the
9353 same link with the same options and also specify those options at
9354 link time.
9355
9356 If LTO encounters objects with C linkage declared with incompatible
9357 types in separate translation units to be linked together (undefined
9358 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9359 issued. The behavior is still undefined at run time. Similar
9360 diagnostics may be raised for other languages.
9361
9362 Another feature of LTO is that it is possible to apply interprocedural
9363 optimizations on files written in different languages:
9364
9365 @smallexample
9366 gcc -c -flto foo.c
9367 g++ -c -flto bar.cc
9368 gfortran -c -flto baz.f90
9369 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9370 @end smallexample
9371
9372 Notice that the final link is done with @command{g++} to get the C++
9373 runtime libraries and @option{-lgfortran} is added to get the Fortran
9374 runtime libraries. In general, when mixing languages in LTO mode, you
9375 should use the same link command options as when mixing languages in a
9376 regular (non-LTO) compilation.
9377
9378 If object files containing GIMPLE bytecode are stored in a library archive, say
9379 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9380 are using a linker with plugin support. To create static libraries suitable
9381 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9382 and @command{ranlib};
9383 to show the symbols of object files with GIMPLE bytecode, use
9384 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9385 and @command{nm} have been compiled with plugin support. At link time, use the the
9386 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9387 the LTO optimization process:
9388
9389 @smallexample
9390 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9391 @end smallexample
9392
9393 With the linker plugin enabled, the linker extracts the needed
9394 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9395 to make them part of the aggregated GIMPLE image to be optimized.
9396
9397 If you are not using a linker with plugin support and/or do not
9398 enable the linker plugin, then the objects inside @file{libfoo.a}
9399 are extracted and linked as usual, but they do not participate
9400 in the LTO optimization process. In order to make a static library suitable
9401 for both LTO optimization and usual linkage, compile its object files with
9402 @option{-flto} @option{-ffat-lto-objects}.
9403
9404 Link-time optimizations do not require the presence of the whole program to
9405 operate. If the program does not require any symbols to be exported, it is
9406 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9407 the interprocedural optimizers to use more aggressive assumptions which may
9408 lead to improved optimization opportunities.
9409 Use of @option{-fwhole-program} is not needed when linker plugin is
9410 active (see @option{-fuse-linker-plugin}).
9411
9412 The current implementation of LTO makes no
9413 attempt to generate bytecode that is portable between different
9414 types of hosts. The bytecode files are versioned and there is a
9415 strict version check, so bytecode files generated in one version of
9416 GCC do not work with an older or newer version of GCC.
9417
9418 Link-time optimization does not work well with generation of debugging
9419 information. Combining @option{-flto} with
9420 @option{-g} is currently experimental and expected to produce unexpected
9421 results.
9422
9423 If you specify the optional @var{n}, the optimization and code
9424 generation done at link time is executed in parallel using @var{n}
9425 parallel jobs by utilizing an installed @command{make} program. The
9426 environment variable @env{MAKE} may be used to override the program
9427 used. The default value for @var{n} is 1.
9428
9429 You can also specify @option{-flto=jobserver} to use GNU make's
9430 job server mode to determine the number of parallel jobs. This
9431 is useful when the Makefile calling GCC is already executing in parallel.
9432 You must prepend a @samp{+} to the command recipe in the parent Makefile
9433 for this to work. This option likely only works if @env{MAKE} is
9434 GNU make.
9435
9436 @item -flto-partition=@var{alg}
9437 @opindex flto-partition
9438 Specify the partitioning algorithm used by the link-time optimizer.
9439 The value is either @samp{1to1} to specify a partitioning mirroring
9440 the original source files or @samp{balanced} to specify partitioning
9441 into equally sized chunks (whenever possible) or @samp{max} to create
9442 new partition for every symbol where possible. Specifying @samp{none}
9443 as an algorithm disables partitioning and streaming completely.
9444 The default value is @samp{balanced}. While @samp{1to1} can be used
9445 as an workaround for various code ordering issues, the @samp{max}
9446 partitioning is intended for internal testing only.
9447 The value @samp{one} specifies that exactly one partition should be
9448 used while the value @samp{none} bypasses partitioning and executes
9449 the link-time optimization step directly from the WPA phase.
9450
9451 @item -flto-odr-type-merging
9452 @opindex flto-odr-type-merging
9453 Enable streaming of mangled types names of C++ types and their unification
9454 at linktime. This increases size of LTO object files, but enable
9455 diagnostics about One Definition Rule violations.
9456
9457 @item -flto-compression-level=@var{n}
9458 @opindex flto-compression-level
9459 This option specifies the level of compression used for intermediate
9460 language written to LTO object files, and is only meaningful in
9461 conjunction with LTO mode (@option{-flto}). Valid
9462 values are 0 (no compression) to 9 (maximum compression). Values
9463 outside this range are clamped to either 0 or 9. If the option is not
9464 given, a default balanced compression setting is used.
9465
9466 @item -flto-report
9467 @opindex flto-report
9468 Prints a report with internal details on the workings of the link-time
9469 optimizer. The contents of this report vary from version to version.
9470 It is meant to be useful to GCC developers when processing object
9471 files in LTO mode (via @option{-flto}).
9472
9473 Disabled by default.
9474
9475 @item -flto-report-wpa
9476 @opindex flto-report-wpa
9477 Like @option{-flto-report}, but only print for the WPA phase of Link
9478 Time Optimization.
9479
9480 @item -fuse-linker-plugin
9481 @opindex fuse-linker-plugin
9482 Enables the use of a linker plugin during link-time optimization. This
9483 option relies on plugin support in the linker, which is available in gold
9484 or in GNU ld 2.21 or newer.
9485
9486 This option enables the extraction of object files with GIMPLE bytecode out
9487 of library archives. This improves the quality of optimization by exposing
9488 more code to the link-time optimizer. This information specifies what
9489 symbols can be accessed externally (by non-LTO object or during dynamic
9490 linking). Resulting code quality improvements on binaries (and shared
9491 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9492 See @option{-flto} for a description of the effect of this flag and how to
9493 use it.
9494
9495 This option is enabled by default when LTO support in GCC is enabled
9496 and GCC was configured for use with
9497 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9498
9499 @item -ffat-lto-objects
9500 @opindex ffat-lto-objects
9501 Fat LTO objects are object files that contain both the intermediate language
9502 and the object code. This makes them usable for both LTO linking and normal
9503 linking. This option is effective only when compiling with @option{-flto}
9504 and is ignored at link time.
9505
9506 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9507 requires the complete toolchain to be aware of LTO. It requires a linker with
9508 linker plugin support for basic functionality. Additionally,
9509 @command{nm}, @command{ar} and @command{ranlib}
9510 need to support linker plugins to allow a full-featured build environment
9511 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9512 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9513 to these tools. With non fat LTO makefiles need to be modified to use them.
9514
9515 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9516 support.
9517
9518 @item -fcompare-elim
9519 @opindex fcompare-elim
9520 After register allocation and post-register allocation instruction splitting,
9521 identify arithmetic instructions that compute processor flags similar to a
9522 comparison operation based on that arithmetic. If possible, eliminate the
9523 explicit comparison operation.
9524
9525 This pass only applies to certain targets that cannot explicitly represent
9526 the comparison operation before register allocation is complete.
9527
9528 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9529
9530 @item -fcprop-registers
9531 @opindex fcprop-registers
9532 After register allocation and post-register allocation instruction splitting,
9533 perform a copy-propagation pass to try to reduce scheduling dependencies
9534 and occasionally eliminate the copy.
9535
9536 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9537
9538 @item -fprofile-correction
9539 @opindex fprofile-correction
9540 Profiles collected using an instrumented binary for multi-threaded programs may
9541 be inconsistent due to missed counter updates. When this option is specified,
9542 GCC uses heuristics to correct or smooth out such inconsistencies. By
9543 default, GCC emits an error message when an inconsistent profile is detected.
9544
9545 @item -fprofile-dir=@var{path}
9546 @opindex fprofile-dir
9547
9548 Set the directory to search for the profile data files in to @var{path}.
9549 This option affects only the profile data generated by
9550 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
9551 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
9552 and its related options. Both absolute and relative paths can be used.
9553 By default, GCC uses the current directory as @var{path}, thus the
9554 profile data file appears in the same directory as the object file.
9555
9556 @item -fprofile-generate
9557 @itemx -fprofile-generate=@var{path}
9558 @opindex fprofile-generate
9559
9560 Enable options usually used for instrumenting application to produce
9561 profile useful for later recompilation with profile feedback based
9562 optimization. You must use @option{-fprofile-generate} both when
9563 compiling and when linking your program.
9564
9565 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
9566
9567 If @var{path} is specified, GCC looks at the @var{path} to find
9568 the profile feedback data files. See @option{-fprofile-dir}.
9569
9570 @item -fprofile-use
9571 @itemx -fprofile-use=@var{path}
9572 @opindex fprofile-use
9573 Enable profile feedback-directed optimizations,
9574 and the following optimizations
9575 which are generally profitable only with profile feedback available:
9576 @option{-fbranch-probabilities}, @option{-fvpt},
9577 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9578 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9579
9580 By default, GCC emits an error message if the feedback profiles do not
9581 match the source code. This error can be turned into a warning by using
9582 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9583 code.
9584
9585 If @var{path} is specified, GCC looks at the @var{path} to find
9586 the profile feedback data files. See @option{-fprofile-dir}.
9587
9588 @item -fauto-profile
9589 @itemx -fauto-profile=@var{path}
9590 @opindex fauto-profile
9591 Enable sampling-based feedback-directed optimizations,
9592 and the following optimizations
9593 which are generally profitable only with profile feedback available:
9594 @option{-fbranch-probabilities}, @option{-fvpt},
9595 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9596 @option{-ftree-vectorize},
9597 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9598 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9599 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9600
9601 @var{path} is the name of a file containing AutoFDO profile information.
9602 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9603
9604 Producing an AutoFDO profile data file requires running your program
9605 with the @command{perf} utility on a supported GNU/Linux target system.
9606 For more information, see @uref{https://perf.wiki.kernel.org/}.
9607
9608 E.g.
9609 @smallexample
9610 perf record -e br_inst_retired:near_taken -b -o perf.data \
9611 -- your_program
9612 @end smallexample
9613
9614 Then use the @command{create_gcov} tool to convert the raw profile data
9615 to a format that can be used by GCC.@ You must also supply the
9616 unstripped binary for your program to this tool.
9617 See @uref{https://github.com/google/autofdo}.
9618
9619 E.g.
9620 @smallexample
9621 create_gcov --binary=your_program.unstripped --profile=perf.data \
9622 --gcov=profile.afdo
9623 @end smallexample
9624 @end table
9625
9626 The following options control compiler behavior regarding floating-point
9627 arithmetic. These options trade off between speed and
9628 correctness. All must be specifically enabled.
9629
9630 @table @gcctabopt
9631 @item -ffloat-store
9632 @opindex ffloat-store
9633 Do not store floating-point variables in registers, and inhibit other
9634 options that might change whether a floating-point value is taken from a
9635 register or memory.
9636
9637 @cindex floating-point precision
9638 This option prevents undesirable excess precision on machines such as
9639 the 68000 where the floating registers (of the 68881) keep more
9640 precision than a @code{double} is supposed to have. Similarly for the
9641 x86 architecture. For most programs, the excess precision does only
9642 good, but a few programs rely on the precise definition of IEEE floating
9643 point. Use @option{-ffloat-store} for such programs, after modifying
9644 them to store all pertinent intermediate computations into variables.
9645
9646 @item -fexcess-precision=@var{style}
9647 @opindex fexcess-precision
9648 This option allows further control over excess precision on machines
9649 where floating-point registers have more precision than the IEEE
9650 @code{float} and @code{double} types and the processor does not
9651 support operations rounding to those types. By default,
9652 @option{-fexcess-precision=fast} is in effect; this means that
9653 operations are carried out in the precision of the registers and that
9654 it is unpredictable when rounding to the types specified in the source
9655 code takes place. When compiling C, if
9656 @option{-fexcess-precision=standard} is specified then excess
9657 precision follows the rules specified in ISO C99; in particular,
9658 both casts and assignments cause values to be rounded to their
9659 semantic types (whereas @option{-ffloat-store} only affects
9660 assignments). This option is enabled by default for C if a strict
9661 conformance option such as @option{-std=c99} is used.
9662
9663 @opindex mfpmath
9664 @option{-fexcess-precision=standard} is not implemented for languages
9665 other than C, and has no effect if
9666 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
9667 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
9668 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9669 semantics apply without excess precision, and in the latter, rounding
9670 is unpredictable.
9671
9672 @item -ffast-math
9673 @opindex ffast-math
9674 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9675 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9676 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
9677
9678 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9679
9680 This option is not turned on by any @option{-O} option besides
9681 @option{-Ofast} since it can result in incorrect output for programs
9682 that depend on an exact implementation of IEEE or ISO rules/specifications
9683 for math functions. It may, however, yield faster code for programs
9684 that do not require the guarantees of these specifications.
9685
9686 @item -fno-math-errno
9687 @opindex fno-math-errno
9688 Do not set @code{errno} after calling math functions that are executed
9689 with a single instruction, e.g., @code{sqrt}. A program that relies on
9690 IEEE exceptions for math error handling may want to use this flag
9691 for speed while maintaining IEEE arithmetic compatibility.
9692
9693 This option is not turned on by any @option{-O} option since
9694 it can result in incorrect output for programs that depend on
9695 an exact implementation of IEEE or ISO rules/specifications for
9696 math functions. It may, however, yield faster code for programs
9697 that do not require the guarantees of these specifications.
9698
9699 The default is @option{-fmath-errno}.
9700
9701 On Darwin systems, the math library never sets @code{errno}. There is
9702 therefore no reason for the compiler to consider the possibility that
9703 it might, and @option{-fno-math-errno} is the default.
9704
9705 @item -funsafe-math-optimizations
9706 @opindex funsafe-math-optimizations
9707
9708 Allow optimizations for floating-point arithmetic that (a) assume
9709 that arguments and results are valid and (b) may violate IEEE or
9710 ANSI standards. When used at link-time, it may include libraries
9711 or startup files that change the default FPU control word or other
9712 similar optimizations.
9713
9714 This option is not turned on by any @option{-O} option since
9715 it can result in incorrect output for programs that depend on
9716 an exact implementation of IEEE or ISO rules/specifications for
9717 math functions. It may, however, yield faster code for programs
9718 that do not require the guarantees of these specifications.
9719 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9720 @option{-fassociative-math} and @option{-freciprocal-math}.
9721
9722 The default is @option{-fno-unsafe-math-optimizations}.
9723
9724 @item -fassociative-math
9725 @opindex fassociative-math
9726
9727 Allow re-association of operands in series of floating-point operations.
9728 This violates the ISO C and C++ language standard by possibly changing
9729 computation result. NOTE: re-ordering may change the sign of zero as
9730 well as ignore NaNs and inhibit or create underflow or overflow (and
9731 thus cannot be used on code that relies on rounding behavior like
9732 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9733 and thus may not be used when ordered comparisons are required.
9734 This option requires that both @option{-fno-signed-zeros} and
9735 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9736 much sense with @option{-frounding-math}. For Fortran the option
9737 is automatically enabled when both @option{-fno-signed-zeros} and
9738 @option{-fno-trapping-math} are in effect.
9739
9740 The default is @option{-fno-associative-math}.
9741
9742 @item -freciprocal-math
9743 @opindex freciprocal-math
9744
9745 Allow the reciprocal of a value to be used instead of dividing by
9746 the value if this enables optimizations. For example @code{x / y}
9747 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9748 is subject to common subexpression elimination. Note that this loses
9749 precision and increases the number of flops operating on the value.
9750
9751 The default is @option{-fno-reciprocal-math}.
9752
9753 @item -ffinite-math-only
9754 @opindex ffinite-math-only
9755 Allow optimizations for floating-point arithmetic that assume
9756 that arguments and results are not NaNs or +-Infs.
9757
9758 This option is not turned on by any @option{-O} option since
9759 it can result in incorrect output for programs that depend on
9760 an exact implementation of IEEE or ISO rules/specifications for
9761 math functions. It may, however, yield faster code for programs
9762 that do not require the guarantees of these specifications.
9763
9764 The default is @option{-fno-finite-math-only}.
9765
9766 @item -fno-signed-zeros
9767 @opindex fno-signed-zeros
9768 Allow optimizations for floating-point arithmetic that ignore the
9769 signedness of zero. IEEE arithmetic specifies the behavior of
9770 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9771 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9772 This option implies that the sign of a zero result isn't significant.
9773
9774 The default is @option{-fsigned-zeros}.
9775
9776 @item -fno-trapping-math
9777 @opindex fno-trapping-math
9778 Compile code assuming that floating-point operations cannot generate
9779 user-visible traps. These traps include division by zero, overflow,
9780 underflow, inexact result and invalid operation. This option requires
9781 that @option{-fno-signaling-nans} be in effect. Setting this option may
9782 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9783
9784 This option should never be turned on by any @option{-O} option since
9785 it can result in incorrect output for programs that depend on
9786 an exact implementation of IEEE or ISO rules/specifications for
9787 math functions.
9788
9789 The default is @option{-ftrapping-math}.
9790
9791 @item -frounding-math
9792 @opindex frounding-math
9793 Disable transformations and optimizations that assume default floating-point
9794 rounding behavior. This is round-to-zero for all floating point
9795 to integer conversions, and round-to-nearest for all other arithmetic
9796 truncations. This option should be specified for programs that change
9797 the FP rounding mode dynamically, or that may be executed with a
9798 non-default rounding mode. This option disables constant folding of
9799 floating-point expressions at compile time (which may be affected by
9800 rounding mode) and arithmetic transformations that are unsafe in the
9801 presence of sign-dependent rounding modes.
9802
9803 The default is @option{-fno-rounding-math}.
9804
9805 This option is experimental and does not currently guarantee to
9806 disable all GCC optimizations that are affected by rounding mode.
9807 Future versions of GCC may provide finer control of this setting
9808 using C99's @code{FENV_ACCESS} pragma. This command-line option
9809 will be used to specify the default state for @code{FENV_ACCESS}.
9810
9811 @item -fsignaling-nans
9812 @opindex fsignaling-nans
9813 Compile code assuming that IEEE signaling NaNs may generate user-visible
9814 traps during floating-point operations. Setting this option disables
9815 optimizations that may change the number of exceptions visible with
9816 signaling NaNs. This option implies @option{-ftrapping-math}.
9817
9818 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9819 be defined.
9820
9821 The default is @option{-fno-signaling-nans}.
9822
9823 This option is experimental and does not currently guarantee to
9824 disable all GCC optimizations that affect signaling NaN behavior.
9825
9826 @item -fsingle-precision-constant
9827 @opindex fsingle-precision-constant
9828 Treat floating-point constants as single precision instead of
9829 implicitly converting them to double-precision constants.
9830
9831 @item -fcx-limited-range
9832 @opindex fcx-limited-range
9833 When enabled, this option states that a range reduction step is not
9834 needed when performing complex division. Also, there is no checking
9835 whether the result of a complex multiplication or division is @code{NaN
9836 + I*NaN}, with an attempt to rescue the situation in that case. The
9837 default is @option{-fno-cx-limited-range}, but is enabled by
9838 @option{-ffast-math}.
9839
9840 This option controls the default setting of the ISO C99
9841 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9842 all languages.
9843
9844 @item -fcx-fortran-rules
9845 @opindex fcx-fortran-rules
9846 Complex multiplication and division follow Fortran rules. Range
9847 reduction is done as part of complex division, but there is no checking
9848 whether the result of a complex multiplication or division is @code{NaN
9849 + I*NaN}, with an attempt to rescue the situation in that case.
9850
9851 The default is @option{-fno-cx-fortran-rules}.
9852
9853 @end table
9854
9855 The following options control optimizations that may improve
9856 performance, but are not enabled by any @option{-O} options. This
9857 section includes experimental options that may produce broken code.
9858
9859 @table @gcctabopt
9860 @item -fbranch-probabilities
9861 @opindex fbranch-probabilities
9862 After running a program compiled with @option{-fprofile-arcs}
9863 (@pxref{Debugging Options,, Options for Debugging Your Program or
9864 @command{gcc}}), you can compile it a second time using
9865 @option{-fbranch-probabilities}, to improve optimizations based on
9866 the number of times each branch was taken. When a program
9867 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9868 counts to a file called @file{@var{sourcename}.gcda} for each source
9869 file. The information in this data file is very dependent on the
9870 structure of the generated code, so you must use the same source code
9871 and the same optimization options for both compilations.
9872
9873 With @option{-fbranch-probabilities}, GCC puts a
9874 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9875 These can be used to improve optimization. Currently, they are only
9876 used in one place: in @file{reorg.c}, instead of guessing which path a
9877 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9878 exactly determine which path is taken more often.
9879
9880 @item -fprofile-values
9881 @opindex fprofile-values
9882 If combined with @option{-fprofile-arcs}, it adds code so that some
9883 data about values of expressions in the program is gathered.
9884
9885 With @option{-fbranch-probabilities}, it reads back the data gathered
9886 from profiling values of expressions for usage in optimizations.
9887
9888 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9889
9890 @item -fprofile-reorder-functions
9891 @opindex fprofile-reorder-functions
9892 Function reordering based on profile instrumentation collects
9893 first time of execution of a function and orders these functions
9894 in ascending order.
9895
9896 Enabled with @option{-fprofile-use}.
9897
9898 @item -fvpt
9899 @opindex fvpt
9900 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9901 to add code to gather information about values of expressions.
9902
9903 With @option{-fbranch-probabilities}, it reads back the data gathered
9904 and actually performs the optimizations based on them.
9905 Currently the optimizations include specialization of division operations
9906 using the knowledge about the value of the denominator.
9907
9908 @item -frename-registers
9909 @opindex frename-registers
9910 Attempt to avoid false dependencies in scheduled code by making use
9911 of registers left over after register allocation. This optimization
9912 most benefits processors with lots of registers. Depending on the
9913 debug information format adopted by the target, however, it can
9914 make debugging impossible, since variables no longer stay in
9915 a ``home register''.
9916
9917 Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
9918
9919 @item -fschedule-fusion
9920 @opindex fschedule-fusion
9921 Performs a target dependent pass over the instruction stream to schedule
9922 instructions of same type together because target machine can execute them
9923 more efficiently if they are adjacent to each other in the instruction flow.
9924
9925 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9926
9927 @item -ftracer
9928 @opindex ftracer
9929 Perform tail duplication to enlarge superblock size. This transformation
9930 simplifies the control flow of the function allowing other optimizations to do
9931 a better job.
9932
9933 Enabled with @option{-fprofile-use}.
9934
9935 @item -funroll-loops
9936 @opindex funroll-loops
9937 Unroll loops whose number of iterations can be determined at compile time or
9938 upon entry to the loop. @option{-funroll-loops} implies
9939 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9940 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9941 a small constant number of iterations). This option makes code larger, and may
9942 or may not make it run faster.
9943
9944 Enabled with @option{-fprofile-use}.
9945
9946 @item -funroll-all-loops
9947 @opindex funroll-all-loops
9948 Unroll all loops, even if their number of iterations is uncertain when
9949 the loop is entered. This usually makes programs run more slowly.
9950 @option{-funroll-all-loops} implies the same options as
9951 @option{-funroll-loops}.
9952
9953 @item -fpeel-loops
9954 @opindex fpeel-loops
9955 Peels loops for which there is enough information that they do not
9956 roll much (from profile feedback). It also turns on complete loop peeling
9957 (i.e.@: complete removal of loops with small constant number of iterations).
9958
9959 Enabled with @option{-fprofile-use}.
9960
9961 @item -fmove-loop-invariants
9962 @opindex fmove-loop-invariants
9963 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
9964 at level @option{-O1}
9965
9966 @item -funswitch-loops
9967 @opindex funswitch-loops
9968 Move branches with loop invariant conditions out of the loop, with duplicates
9969 of the loop on both branches (modified according to result of the condition).
9970
9971 @item -ffunction-sections
9972 @itemx -fdata-sections
9973 @opindex ffunction-sections
9974 @opindex fdata-sections
9975 Place each function or data item into its own section in the output
9976 file if the target supports arbitrary sections. The name of the
9977 function or the name of the data item determines the section's name
9978 in the output file.
9979
9980 Use these options on systems where the linker can perform optimizations
9981 to improve locality of reference in the instruction space. Most systems
9982 using the ELF object format and SPARC processors running Solaris 2 have
9983 linkers with such optimizations. AIX may have these optimizations in
9984 the future.
9985
9986 Only use these options when there are significant benefits from doing
9987 so. When you specify these options, the assembler and linker
9988 create larger object and executable files and are also slower.
9989 You cannot use @command{gprof} on all systems if you
9990 specify this option, and you may have problems with debugging if
9991 you specify both this option and @option{-g}.
9992
9993 @item -fbranch-target-load-optimize
9994 @opindex fbranch-target-load-optimize
9995 Perform branch target register load optimization before prologue / epilogue
9996 threading.
9997 The use of target registers can typically be exposed only during reload,
9998 thus hoisting loads out of loops and doing inter-block scheduling needs
9999 a separate optimization pass.
10000
10001 @item -fbranch-target-load-optimize2
10002 @opindex fbranch-target-load-optimize2
10003 Perform branch target register load optimization after prologue / epilogue
10004 threading.
10005
10006 @item -fbtr-bb-exclusive
10007 @opindex fbtr-bb-exclusive
10008 When performing branch target register load optimization, don't reuse
10009 branch target registers within any basic block.
10010
10011 @item -fstack-protector
10012 @opindex fstack-protector
10013 Emit extra code to check for buffer overflows, such as stack smashing
10014 attacks. This is done by adding a guard variable to functions with
10015 vulnerable objects. This includes functions that call @code{alloca}, and
10016 functions with buffers larger than 8 bytes. The guards are initialized
10017 when a function is entered and then checked when the function exits.
10018 If a guard check fails, an error message is printed and the program exits.
10019
10020 @item -fstack-protector-all
10021 @opindex fstack-protector-all
10022 Like @option{-fstack-protector} except that all functions are protected.
10023
10024 @item -fstack-protector-strong
10025 @opindex fstack-protector-strong
10026 Like @option{-fstack-protector} but includes additional functions to
10027 be protected --- those that have local array definitions, or have
10028 references to local frame addresses.
10029
10030 @item -fstack-protector-explicit
10031 @opindex fstack-protector-explicit
10032 Like @option{-fstack-protector} but only protects those functions which
10033 have the @code{stack_protect} attribute
10034
10035 @item -fstdarg-opt
10036 @opindex fstdarg-opt
10037 Optimize the prologue of variadic argument functions with respect to usage of
10038 those arguments.
10039
10040 @item -fsection-anchors
10041 @opindex fsection-anchors
10042 Try to reduce the number of symbolic address calculations by using
10043 shared ``anchor'' symbols to address nearby objects. This transformation
10044 can help to reduce the number of GOT entries and GOT accesses on some
10045 targets.
10046
10047 For example, the implementation of the following function @code{foo}:
10048
10049 @smallexample
10050 static int a, b, c;
10051 int foo (void) @{ return a + b + c; @}
10052 @end smallexample
10053
10054 @noindent
10055 usually calculates the addresses of all three variables, but if you
10056 compile it with @option{-fsection-anchors}, it accesses the variables
10057 from a common anchor point instead. The effect is similar to the
10058 following pseudocode (which isn't valid C):
10059
10060 @smallexample
10061 int foo (void)
10062 @{
10063 register int *xr = &x;
10064 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10065 @}
10066 @end smallexample
10067
10068 Not all targets support this option.
10069
10070 @item --param @var{name}=@var{value}
10071 @opindex param
10072 In some places, GCC uses various constants to control the amount of
10073 optimization that is done. For example, GCC does not inline functions
10074 that contain more than a certain number of instructions. You can
10075 control some of these constants on the command line using the
10076 @option{--param} option.
10077
10078 The names of specific parameters, and the meaning of the values, are
10079 tied to the internals of the compiler, and are subject to change
10080 without notice in future releases.
10081
10082 In each case, the @var{value} is an integer. The allowable choices for
10083 @var{name} are:
10084
10085 @table @gcctabopt
10086 @item predictable-branch-outcome
10087 When branch is predicted to be taken with probability lower than this threshold
10088 (in percent), then it is considered well predictable. The default is 10.
10089
10090 @item max-crossjump-edges
10091 The maximum number of incoming edges to consider for cross-jumping.
10092 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10093 the number of edges incoming to each block. Increasing values mean
10094 more aggressive optimization, making the compilation time increase with
10095 probably small improvement in executable size.
10096
10097 @item min-crossjump-insns
10098 The minimum number of instructions that must be matched at the end
10099 of two blocks before cross-jumping is performed on them. This
10100 value is ignored in the case where all instructions in the block being
10101 cross-jumped from are matched. The default value is 5.
10102
10103 @item max-grow-copy-bb-insns
10104 The maximum code size expansion factor when copying basic blocks
10105 instead of jumping. The expansion is relative to a jump instruction.
10106 The default value is 8.
10107
10108 @item max-goto-duplication-insns
10109 The maximum number of instructions to duplicate to a block that jumps
10110 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10111 passes, GCC factors computed gotos early in the compilation process,
10112 and unfactors them as late as possible. Only computed jumps at the
10113 end of a basic blocks with no more than max-goto-duplication-insns are
10114 unfactored. The default value is 8.
10115
10116 @item max-delay-slot-insn-search
10117 The maximum number of instructions to consider when looking for an
10118 instruction to fill a delay slot. If more than this arbitrary number of
10119 instructions are searched, the time savings from filling the delay slot
10120 are minimal, so stop searching. Increasing values mean more
10121 aggressive optimization, making the compilation time increase with probably
10122 small improvement in execution time.
10123
10124 @item max-delay-slot-live-search
10125 When trying to fill delay slots, the maximum number of instructions to
10126 consider when searching for a block with valid live register
10127 information. Increasing this arbitrarily chosen value means more
10128 aggressive optimization, increasing the compilation time. This parameter
10129 should be removed when the delay slot code is rewritten to maintain the
10130 control-flow graph.
10131
10132 @item max-gcse-memory
10133 The approximate maximum amount of memory that can be allocated in
10134 order to perform the global common subexpression elimination
10135 optimization. If more memory than specified is required, the
10136 optimization is not done.
10137
10138 @item max-gcse-insertion-ratio
10139 If the ratio of expression insertions to deletions is larger than this value
10140 for any expression, then RTL PRE inserts or removes the expression and thus
10141 leaves partially redundant computations in the instruction stream. The default value is 20.
10142
10143 @item max-pending-list-length
10144 The maximum number of pending dependencies scheduling allows
10145 before flushing the current state and starting over. Large functions
10146 with few branches or calls can create excessively large lists which
10147 needlessly consume memory and resources.
10148
10149 @item max-modulo-backtrack-attempts
10150 The maximum number of backtrack attempts the scheduler should make
10151 when modulo scheduling a loop. Larger values can exponentially increase
10152 compilation time.
10153
10154 @item max-inline-insns-single
10155 Several parameters control the tree inliner used in GCC@.
10156 This number sets the maximum number of instructions (counted in GCC's
10157 internal representation) in a single function that the tree inliner
10158 considers for inlining. This only affects functions declared
10159 inline and methods implemented in a class declaration (C++).
10160 The default value is 400.
10161
10162 @item max-inline-insns-auto
10163 When you use @option{-finline-functions} (included in @option{-O3}),
10164 a lot of functions that would otherwise not be considered for inlining
10165 by the compiler are investigated. To those functions, a different
10166 (more restrictive) limit compared to functions declared inline can
10167 be applied.
10168 The default value is 40.
10169
10170 @item inline-min-speedup
10171 When estimated performance improvement of caller + callee runtime exceeds this
10172 threshold (in precent), the function can be inlined regardless the limit on
10173 @option{--param max-inline-insns-single} and @option{--param
10174 max-inline-insns-auto}.
10175
10176 @item large-function-insns
10177 The limit specifying really large functions. For functions larger than this
10178 limit after inlining, inlining is constrained by
10179 @option{--param large-function-growth}. This parameter is useful primarily
10180 to avoid extreme compilation time caused by non-linear algorithms used by the
10181 back end.
10182 The default value is 2700.
10183
10184 @item large-function-growth
10185 Specifies maximal growth of large function caused by inlining in percents.
10186 The default value is 100 which limits large function growth to 2.0 times
10187 the original size.
10188
10189 @item large-unit-insns
10190 The limit specifying large translation unit. Growth caused by inlining of
10191 units larger than this limit is limited by @option{--param inline-unit-growth}.
10192 For small units this might be too tight.
10193 For example, consider a unit consisting of function A
10194 that is inline and B that just calls A three times. If B is small relative to
10195 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10196 large units consisting of small inlineable functions, however, the overall unit
10197 growth limit is needed to avoid exponential explosion of code size. Thus for
10198 smaller units, the size is increased to @option{--param large-unit-insns}
10199 before applying @option{--param inline-unit-growth}. The default is 10000.
10200
10201 @item inline-unit-growth
10202 Specifies maximal overall growth of the compilation unit caused by inlining.
10203 The default value is 20 which limits unit growth to 1.2 times the original
10204 size. Cold functions (either marked cold via an attribute or by profile
10205 feedback) are not accounted into the unit size.
10206
10207 @item ipcp-unit-growth
10208 Specifies maximal overall growth of the compilation unit caused by
10209 interprocedural constant propagation. The default value is 10 which limits
10210 unit growth to 1.1 times the original size.
10211
10212 @item large-stack-frame
10213 The limit specifying large stack frames. While inlining the algorithm is trying
10214 to not grow past this limit too much. The default value is 256 bytes.
10215
10216 @item large-stack-frame-growth
10217 Specifies maximal growth of large stack frames caused by inlining in percents.
10218 The default value is 1000 which limits large stack frame growth to 11 times
10219 the original size.
10220
10221 @item max-inline-insns-recursive
10222 @itemx max-inline-insns-recursive-auto
10223 Specifies the maximum number of instructions an out-of-line copy of a
10224 self-recursive inline
10225 function can grow into by performing recursive inlining.
10226
10227 @option{--param max-inline-insns-recursive} applies to functions
10228 declared inline.
10229 For functions not declared inline, recursive inlining
10230 happens only when @option{-finline-functions} (included in @option{-O3}) is
10231 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
10232 default value is 450.
10233
10234 @item max-inline-recursive-depth
10235 @itemx max-inline-recursive-depth-auto
10236 Specifies the maximum recursion depth used for recursive inlining.
10237
10238 @option{--param max-inline-recursive-depth} applies to functions
10239 declared inline. For functions not declared inline, recursive inlining
10240 happens only when @option{-finline-functions} (included in @option{-O3}) is
10241 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
10242 default value is 8.
10243
10244 @item min-inline-recursive-probability
10245 Recursive inlining is profitable only for function having deep recursion
10246 in average and can hurt for function having little recursion depth by
10247 increasing the prologue size or complexity of function body to other
10248 optimizers.
10249
10250 When profile feedback is available (see @option{-fprofile-generate}) the actual
10251 recursion depth can be guessed from probability that function recurses via a
10252 given call expression. This parameter limits inlining only to call expressions
10253 whose probability exceeds the given threshold (in percents).
10254 The default value is 10.
10255
10256 @item early-inlining-insns
10257 Specify growth that the early inliner can make. In effect it increases
10258 the amount of inlining for code having a large abstraction penalty.
10259 The default value is 14.
10260
10261 @item max-early-inliner-iterations
10262 Limit of iterations of the early inliner. This basically bounds
10263 the number of nested indirect calls the early inliner can resolve.
10264 Deeper chains are still handled by late inlining.
10265
10266 @item comdat-sharing-probability
10267 Probability (in percent) that C++ inline function with comdat visibility
10268 are shared across multiple compilation units. The default value is 20.
10269
10270 @item profile-func-internal-id
10271 A parameter to control whether to use function internal id in profile
10272 database lookup. If the value is 0, the compiler uses an id that
10273 is based on function assembler name and filename, which makes old profile
10274 data more tolerant to source changes such as function reordering etc.
10275 The default value is 0.
10276
10277 @item min-vect-loop-bound
10278 The minimum number of iterations under which loops are not vectorized
10279 when @option{-ftree-vectorize} is used. The number of iterations after
10280 vectorization needs to be greater than the value specified by this option
10281 to allow vectorization. The default value is 0.
10282
10283 @item gcse-cost-distance-ratio
10284 Scaling factor in calculation of maximum distance an expression
10285 can be moved by GCSE optimizations. This is currently supported only in the
10286 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10287 is with simple expressions, i.e., the expressions that have cost
10288 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10289 hoisting of simple expressions. The default value is 10.
10290
10291 @item gcse-unrestricted-cost
10292 Cost, roughly measured as the cost of a single typical machine
10293 instruction, at which GCSE optimizations do not constrain
10294 the distance an expression can travel. This is currently
10295 supported only in the code hoisting pass. The lesser the cost,
10296 the more aggressive code hoisting is. Specifying 0
10297 allows all expressions to travel unrestricted distances.
10298 The default value is 3.
10299
10300 @item max-hoist-depth
10301 The depth of search in the dominator tree for expressions to hoist.
10302 This is used to avoid quadratic behavior in hoisting algorithm.
10303 The value of 0 does not limit on the search, but may slow down compilation
10304 of huge functions. The default value is 30.
10305
10306 @item max-tail-merge-comparisons
10307 The maximum amount of similar bbs to compare a bb with. This is used to
10308 avoid quadratic behavior in tree tail merging. The default value is 10.
10309
10310 @item max-tail-merge-iterations
10311 The maximum amount of iterations of the pass over the function. This is used to
10312 limit compilation time in tree tail merging. The default value is 2.
10313
10314 @item max-unrolled-insns
10315 The maximum number of instructions that a loop may have to be unrolled.
10316 If a loop is unrolled, this parameter also determines how many times
10317 the loop code is unrolled.
10318
10319 @item max-average-unrolled-insns
10320 The maximum number of instructions biased by probabilities of their execution
10321 that a loop may have to be unrolled. If a loop is unrolled,
10322 this parameter also determines how many times the loop code is unrolled.
10323
10324 @item max-unroll-times
10325 The maximum number of unrollings of a single loop.
10326
10327 @item max-peeled-insns
10328 The maximum number of instructions that a loop may have to be peeled.
10329 If a loop is peeled, this parameter also determines how many times
10330 the loop code is peeled.
10331
10332 @item max-peel-times
10333 The maximum number of peelings of a single loop.
10334
10335 @item max-peel-branches
10336 The maximum number of branches on the hot path through the peeled sequence.
10337
10338 @item max-completely-peeled-insns
10339 The maximum number of insns of a completely peeled loop.
10340
10341 @item max-completely-peel-times
10342 The maximum number of iterations of a loop to be suitable for complete peeling.
10343
10344 @item max-completely-peel-loop-nest-depth
10345 The maximum depth of a loop nest suitable for complete peeling.
10346
10347 @item max-unswitch-insns
10348 The maximum number of insns of an unswitched loop.
10349
10350 @item max-unswitch-level
10351 The maximum number of branches unswitched in a single loop.
10352
10353 @item lim-expensive
10354 The minimum cost of an expensive expression in the loop invariant motion.
10355
10356 @item iv-consider-all-candidates-bound
10357 Bound on number of candidates for induction variables, below which
10358 all candidates are considered for each use in induction variable
10359 optimizations. If there are more candidates than this,
10360 only the most relevant ones are considered to avoid quadratic time complexity.
10361
10362 @item iv-max-considered-uses
10363 The induction variable optimizations give up on loops that contain more
10364 induction variable uses.
10365
10366 @item iv-always-prune-cand-set-bound
10367 If the number of candidates in the set is smaller than this value,
10368 always try to remove unnecessary ivs from the set
10369 when adding a new one.
10370
10371 @item scev-max-expr-size
10372 Bound on size of expressions used in the scalar evolutions analyzer.
10373 Large expressions slow the analyzer.
10374
10375 @item scev-max-expr-complexity
10376 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10377 Complex expressions slow the analyzer.
10378
10379 @item omega-max-vars
10380 The maximum number of variables in an Omega constraint system.
10381 The default value is 128.
10382
10383 @item omega-max-geqs
10384 The maximum number of inequalities in an Omega constraint system.
10385 The default value is 256.
10386
10387 @item omega-max-eqs
10388 The maximum number of equalities in an Omega constraint system.
10389 The default value is 128.
10390
10391 @item omega-max-wild-cards
10392 The maximum number of wildcard variables that the Omega solver is
10393 able to insert. The default value is 18.
10394
10395 @item omega-hash-table-size
10396 The size of the hash table in the Omega solver. The default value is
10397 550.
10398
10399 @item omega-max-keys
10400 The maximal number of keys used by the Omega solver. The default
10401 value is 500.
10402
10403 @item omega-eliminate-redundant-constraints
10404 When set to 1, use expensive methods to eliminate all redundant
10405 constraints. The default value is 0.
10406
10407 @item vect-max-version-for-alignment-checks
10408 The maximum number of run-time checks that can be performed when
10409 doing loop versioning for alignment in the vectorizer.
10410
10411 @item vect-max-version-for-alias-checks
10412 The maximum number of run-time checks that can be performed when
10413 doing loop versioning for alias in the vectorizer.
10414
10415 @item vect-max-peeling-for-alignment
10416 The maximum number of loop peels to enhance access alignment
10417 for vectorizer. Value -1 means 'no limit'.
10418
10419 @item max-iterations-to-track
10420 The maximum number of iterations of a loop the brute-force algorithm
10421 for analysis of the number of iterations of the loop tries to evaluate.
10422
10423 @item hot-bb-count-ws-permille
10424 A basic block profile count is considered hot if it contributes to
10425 the given permillage (i.e. 0...1000) of the entire profiled execution.
10426
10427 @item hot-bb-frequency-fraction
10428 Select fraction of the entry block frequency of executions of basic block in
10429 function given basic block needs to have to be considered hot.
10430
10431 @item max-predicted-iterations
10432 The maximum number of loop iterations we predict statically. This is useful
10433 in cases where a function contains a single loop with known bound and
10434 another loop with unknown bound.
10435 The known number of iterations is predicted correctly, while
10436 the unknown number of iterations average to roughly 10. This means that the
10437 loop without bounds appears artificially cold relative to the other one.
10438
10439 @item builtin-expect-probability
10440 Control the probability of the expression having the specified value. This
10441 parameter takes a percentage (i.e. 0 ... 100) as input.
10442 The default probability of 90 is obtained empirically.
10443
10444 @item align-threshold
10445
10446 Select fraction of the maximal frequency of executions of a basic block in
10447 a function to align the basic block.
10448
10449 @item align-loop-iterations
10450
10451 A loop expected to iterate at least the selected number of iterations is
10452 aligned.
10453
10454 @item tracer-dynamic-coverage
10455 @itemx tracer-dynamic-coverage-feedback
10456
10457 This value is used to limit superblock formation once the given percentage of
10458 executed instructions is covered. This limits unnecessary code size
10459 expansion.
10460
10461 The @option{tracer-dynamic-coverage-feedback} parameter
10462 is used only when profile
10463 feedback is available. The real profiles (as opposed to statically estimated
10464 ones) are much less balanced allowing the threshold to be larger value.
10465
10466 @item tracer-max-code-growth
10467 Stop tail duplication once code growth has reached given percentage. This is
10468 a rather artificial limit, as most of the duplicates are eliminated later in
10469 cross jumping, so it may be set to much higher values than is the desired code
10470 growth.
10471
10472 @item tracer-min-branch-ratio
10473
10474 Stop reverse growth when the reverse probability of best edge is less than this
10475 threshold (in percent).
10476
10477 @item tracer-min-branch-ratio
10478 @itemx tracer-min-branch-ratio-feedback
10479
10480 Stop forward growth if the best edge has probability lower than this
10481 threshold.
10482
10483 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
10484 compilation for profile feedback and one for compilation without. The value
10485 for compilation with profile feedback needs to be more conservative (higher) in
10486 order to make tracer effective.
10487
10488 @item max-cse-path-length
10489
10490 The maximum number of basic blocks on path that CSE considers.
10491 The default is 10.
10492
10493 @item max-cse-insns
10494 The maximum number of instructions CSE processes before flushing.
10495 The default is 1000.
10496
10497 @item ggc-min-expand
10498
10499 GCC uses a garbage collector to manage its own memory allocation. This
10500 parameter specifies the minimum percentage by which the garbage
10501 collector's heap should be allowed to expand between collections.
10502 Tuning this may improve compilation speed; it has no effect on code
10503 generation.
10504
10505 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10506 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10507 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10508 GCC is not able to calculate RAM on a particular platform, the lower
10509 bound of 30% is used. Setting this parameter and
10510 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10511 every opportunity. This is extremely slow, but can be useful for
10512 debugging.
10513
10514 @item ggc-min-heapsize
10515
10516 Minimum size of the garbage collector's heap before it begins bothering
10517 to collect garbage. The first collection occurs after the heap expands
10518 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10519 tuning this may improve compilation speed, and has no effect on code
10520 generation.
10521
10522 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10523 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10524 with a lower bound of 4096 (four megabytes) and an upper bound of
10525 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10526 particular platform, the lower bound is used. Setting this parameter
10527 very large effectively disables garbage collection. Setting this
10528 parameter and @option{ggc-min-expand} to zero causes a full collection
10529 to occur at every opportunity.
10530
10531 @item max-reload-search-insns
10532 The maximum number of instruction reload should look backward for equivalent
10533 register. Increasing values mean more aggressive optimization, making the
10534 compilation time increase with probably slightly better performance.
10535 The default value is 100.
10536
10537 @item max-cselib-memory-locations
10538 The maximum number of memory locations cselib should take into account.
10539 Increasing values mean more aggressive optimization, making the compilation time
10540 increase with probably slightly better performance. The default value is 500.
10541
10542 @item reorder-blocks-duplicate
10543 @itemx reorder-blocks-duplicate-feedback
10544
10545 Used by the basic block reordering pass to decide whether to use unconditional
10546 branch or duplicate the code on its destination. Code is duplicated when its
10547 estimated size is smaller than this value multiplied by the estimated size of
10548 unconditional jump in the hot spots of the program.
10549
10550 The @option{reorder-block-duplicate-feedback} parameter
10551 is used only when profile
10552 feedback is available. It may be set to higher values than
10553 @option{reorder-block-duplicate} since information about the hot spots is more
10554 accurate.
10555
10556 @item max-sched-ready-insns
10557 The maximum number of instructions ready to be issued the scheduler should
10558 consider at any given time during the first scheduling pass. Increasing
10559 values mean more thorough searches, making the compilation time increase
10560 with probably little benefit. The default value is 100.
10561
10562 @item max-sched-region-blocks
10563 The maximum number of blocks in a region to be considered for
10564 interblock scheduling. The default value is 10.
10565
10566 @item max-pipeline-region-blocks
10567 The maximum number of blocks in a region to be considered for
10568 pipelining in the selective scheduler. The default value is 15.
10569
10570 @item max-sched-region-insns
10571 The maximum number of insns in a region to be considered for
10572 interblock scheduling. The default value is 100.
10573
10574 @item max-pipeline-region-insns
10575 The maximum number of insns in a region to be considered for
10576 pipelining in the selective scheduler. The default value is 200.
10577
10578 @item min-spec-prob
10579 The minimum probability (in percents) of reaching a source block
10580 for interblock speculative scheduling. The default value is 40.
10581
10582 @item max-sched-extend-regions-iters
10583 The maximum number of iterations through CFG to extend regions.
10584 A value of 0 (the default) disables region extensions.
10585
10586 @item max-sched-insn-conflict-delay
10587 The maximum conflict delay for an insn to be considered for speculative motion.
10588 The default value is 3.
10589
10590 @item sched-spec-prob-cutoff
10591 The minimal probability of speculation success (in percents), so that
10592 speculative insns are scheduled.
10593 The default value is 40.
10594
10595 @item sched-spec-state-edge-prob-cutoff
10596 The minimum probability an edge must have for the scheduler to save its
10597 state across it.
10598 The default value is 10.
10599
10600 @item sched-mem-true-dep-cost
10601 Minimal distance (in CPU cycles) between store and load targeting same
10602 memory locations. The default value is 1.
10603
10604 @item selsched-max-lookahead
10605 The maximum size of the lookahead window of selective scheduling. It is a
10606 depth of search for available instructions.
10607 The default value is 50.
10608
10609 @item selsched-max-sched-times
10610 The maximum number of times that an instruction is scheduled during
10611 selective scheduling. This is the limit on the number of iterations
10612 through which the instruction may be pipelined. The default value is 2.
10613
10614 @item selsched-max-insns-to-rename
10615 The maximum number of best instructions in the ready list that are considered
10616 for renaming in the selective scheduler. The default value is 2.
10617
10618 @item sms-min-sc
10619 The minimum value of stage count that swing modulo scheduler
10620 generates. The default value is 2.
10621
10622 @item max-last-value-rtl
10623 The maximum size measured as number of RTLs that can be recorded in an expression
10624 in combiner for a pseudo register as last known value of that register. The default
10625 is 10000.
10626
10627 @item max-combine-insns
10628 The maximum number of instructions the RTL combiner tries to combine.
10629 The default value is 2 at @option{-Og} and 4 otherwise.
10630
10631 @item integer-share-limit
10632 Small integer constants can use a shared data structure, reducing the
10633 compiler's memory usage and increasing its speed. This sets the maximum
10634 value of a shared integer constant. The default value is 256.
10635
10636 @item ssp-buffer-size
10637 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10638 protection when @option{-fstack-protection} is used.
10639
10640 @item min-size-for-stack-sharing
10641 The minimum size of variables taking part in stack slot sharing when not
10642 optimizing. The default value is 32.
10643
10644 @item max-jump-thread-duplication-stmts
10645 Maximum number of statements allowed in a block that needs to be
10646 duplicated when threading jumps.
10647
10648 @item max-fields-for-field-sensitive
10649 Maximum number of fields in a structure treated in
10650 a field sensitive manner during pointer analysis. The default is zero
10651 for @option{-O0} and @option{-O1},
10652 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10653
10654 @item prefetch-latency
10655 Estimate on average number of instructions that are executed before
10656 prefetch finishes. The distance prefetched ahead is proportional
10657 to this constant. Increasing this number may also lead to less
10658 streams being prefetched (see @option{simultaneous-prefetches}).
10659
10660 @item simultaneous-prefetches
10661 Maximum number of prefetches that can run at the same time.
10662
10663 @item l1-cache-line-size
10664 The size of cache line in L1 cache, in bytes.
10665
10666 @item l1-cache-size
10667 The size of L1 cache, in kilobytes.
10668
10669 @item l2-cache-size
10670 The size of L2 cache, in kilobytes.
10671
10672 @item min-insn-to-prefetch-ratio
10673 The minimum ratio between the number of instructions and the
10674 number of prefetches to enable prefetching in a loop.
10675
10676 @item prefetch-min-insn-to-mem-ratio
10677 The minimum ratio between the number of instructions and the
10678 number of memory references to enable prefetching in a loop.
10679
10680 @item use-canonical-types
10681 Whether the compiler should use the ``canonical'' type system. By
10682 default, this should always be 1, which uses a more efficient internal
10683 mechanism for comparing types in C++ and Objective-C++. However, if
10684 bugs in the canonical type system are causing compilation failures,
10685 set this value to 0 to disable canonical types.
10686
10687 @item switch-conversion-max-branch-ratio
10688 Switch initialization conversion refuses to create arrays that are
10689 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10690 branches in the switch.
10691
10692 @item max-partial-antic-length
10693 Maximum length of the partial antic set computed during the tree
10694 partial redundancy elimination optimization (@option{-ftree-pre}) when
10695 optimizing at @option{-O3} and above. For some sorts of source code
10696 the enhanced partial redundancy elimination optimization can run away,
10697 consuming all of the memory available on the host machine. This
10698 parameter sets a limit on the length of the sets that are computed,
10699 which prevents the runaway behavior. Setting a value of 0 for
10700 this parameter allows an unlimited set length.
10701
10702 @item sccvn-max-scc-size
10703 Maximum size of a strongly connected component (SCC) during SCCVN
10704 processing. If this limit is hit, SCCVN processing for the whole
10705 function is not done and optimizations depending on it are
10706 disabled. The default maximum SCC size is 10000.
10707
10708 @item sccvn-max-alias-queries-per-access
10709 Maximum number of alias-oracle queries we perform when looking for
10710 redundancies for loads and stores. If this limit is hit the search
10711 is aborted and the load or store is not considered redundant. The
10712 number of queries is algorithmically limited to the number of
10713 stores on all paths from the load to the function entry.
10714 The default maxmimum number of queries is 1000.
10715
10716 @item ira-max-loops-num
10717 IRA uses regional register allocation by default. If a function
10718 contains more loops than the number given by this parameter, only at most
10719 the given number of the most frequently-executed loops form regions
10720 for regional register allocation. The default value of the
10721 parameter is 100.
10722
10723 @item ira-max-conflict-table-size
10724 Although IRA uses a sophisticated algorithm to compress the conflict
10725 table, the table can still require excessive amounts of memory for
10726 huge functions. If the conflict table for a function could be more
10727 than the size in MB given by this parameter, the register allocator
10728 instead uses a faster, simpler, and lower-quality
10729 algorithm that does not require building a pseudo-register conflict table.
10730 The default value of the parameter is 2000.
10731
10732 @item ira-loop-reserved-regs
10733 IRA can be used to evaluate more accurate register pressure in loops
10734 for decisions to move loop invariants (see @option{-O3}). The number
10735 of available registers reserved for some other purposes is given
10736 by this parameter. The default value of the parameter is 2, which is
10737 the minimal number of registers needed by typical instructions.
10738 This value is the best found from numerous experiments.
10739
10740 @item lra-inheritance-ebb-probability-cutoff
10741 LRA tries to reuse values reloaded in registers in subsequent insns.
10742 This optimization is called inheritance. EBB is used as a region to
10743 do this optimization. The parameter defines a minimal fall-through
10744 edge probability in percentage used to add BB to inheritance EBB in
10745 LRA. The default value of the parameter is 40. The value was chosen
10746 from numerous runs of SPEC2000 on x86-64.
10747
10748 @item loop-invariant-max-bbs-in-loop
10749 Loop invariant motion can be very expensive, both in compilation time and
10750 in amount of needed compile-time memory, with very large loops. Loops
10751 with more basic blocks than this parameter won't have loop invariant
10752 motion optimization performed on them. The default value of the
10753 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10754
10755 @item loop-max-datarefs-for-datadeps
10756 Building data dapendencies is expensive for very large loops. This
10757 parameter limits the number of data references in loops that are
10758 considered for data dependence analysis. These large loops are no
10759 handled by the optimizations using loop data dependencies.
10760 The default value is 1000.
10761
10762 @item max-vartrack-size
10763 Sets a maximum number of hash table slots to use during variable
10764 tracking dataflow analysis of any function. If this limit is exceeded
10765 with variable tracking at assignments enabled, analysis for that
10766 function is retried without it, after removing all debug insns from
10767 the function. If the limit is exceeded even without debug insns, var
10768 tracking analysis is completely disabled for the function. Setting
10769 the parameter to zero makes it unlimited.
10770
10771 @item max-vartrack-expr-depth
10772 Sets a maximum number of recursion levels when attempting to map
10773 variable names or debug temporaries to value expressions. This trades
10774 compilation time for more complete debug information. If this is set too
10775 low, value expressions that are available and could be represented in
10776 debug information may end up not being used; setting this higher may
10777 enable the compiler to find more complex debug expressions, but compile
10778 time and memory use may grow. The default is 12.
10779
10780 @item min-nondebug-insn-uid
10781 Use uids starting at this parameter for nondebug insns. The range below
10782 the parameter is reserved exclusively for debug insns created by
10783 @option{-fvar-tracking-assignments}, but debug insns may get
10784 (non-overlapping) uids above it if the reserved range is exhausted.
10785
10786 @item ipa-sra-ptr-growth-factor
10787 IPA-SRA replaces a pointer to an aggregate with one or more new
10788 parameters only when their cumulative size is less or equal to
10789 @option{ipa-sra-ptr-growth-factor} times the size of the original
10790 pointer parameter.
10791
10792 @item sra-max-scalarization-size-Ospeed
10793 @item sra-max-scalarization-size-Osize
10794 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10795 replace scalar parts of aggregates with uses of independent scalar
10796 variables. These parameters control the maximum size, in storage units,
10797 of aggregate which is considered for replacement when compiling for
10798 speed
10799 (@option{sra-max-scalarization-size-Ospeed}) or size
10800 (@option{sra-max-scalarization-size-Osize}) respectively.
10801
10802 @item tm-max-aggregate-size
10803 When making copies of thread-local variables in a transaction, this
10804 parameter specifies the size in bytes after which variables are
10805 saved with the logging functions as opposed to save/restore code
10806 sequence pairs. This option only applies when using
10807 @option{-fgnu-tm}.
10808
10809 @item graphite-max-nb-scop-params
10810 To avoid exponential effects in the Graphite loop transforms, the
10811 number of parameters in a Static Control Part (SCoP) is bounded. The
10812 default value is 10 parameters. A variable whose value is unknown at
10813 compilation time and defined outside a SCoP is a parameter of the SCoP.
10814
10815 @item graphite-max-bbs-per-function
10816 To avoid exponential effects in the detection of SCoPs, the size of
10817 the functions analyzed by Graphite is bounded. The default value is
10818 100 basic blocks.
10819
10820 @item loop-block-tile-size
10821 Loop blocking or strip mining transforms, enabled with
10822 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10823 loop in the loop nest by a given number of iterations. The strip
10824 length can be changed using the @option{loop-block-tile-size}
10825 parameter. The default value is 51 iterations.
10826
10827 @item loop-unroll-jam-size
10828 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
10829 default value is 4.
10830
10831 @item loop-unroll-jam-depth
10832 Specify the dimension to be unrolled (counting from the most inner loop)
10833 for the @option{-floop-unroll-and-jam}. The default value is 2.
10834
10835 @item ipa-cp-value-list-size
10836 IPA-CP attempts to track all possible values and types passed to a function's
10837 parameter in order to propagate them and perform devirtualization.
10838 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10839 stores per one formal parameter of a function.
10840
10841 @item ipa-cp-eval-threshold
10842 IPA-CP calculates its own score of cloning profitability heuristics
10843 and performs those cloning opportunities with scores that exceed
10844 @option{ipa-cp-eval-threshold}.
10845
10846 @item ipa-cp-recursion-penalty
10847 Percentage penalty the recursive functions will receive when they
10848 are evaluated for cloning.
10849
10850 @item ipa-cp-single-call-penalty
10851 Percentage penalty functions containg a single call to another
10852 function will receive when they are evaluated for cloning.
10853
10854
10855 @item ipa-max-agg-items
10856 IPA-CP is also capable to propagate a number of scalar values passed
10857 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10858 number of such values per one parameter.
10859
10860 @item ipa-cp-loop-hint-bonus
10861 When IPA-CP determines that a cloning candidate would make the number
10862 of iterations of a loop known, it adds a bonus of
10863 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10864 the candidate.
10865
10866 @item ipa-cp-array-index-hint-bonus
10867 When IPA-CP determines that a cloning candidate would make the index of
10868 an array access known, it adds a bonus of
10869 @option{ipa-cp-array-index-hint-bonus} to the profitability
10870 score of the candidate.
10871
10872 @item ipa-max-aa-steps
10873 During its analysis of function bodies, IPA-CP employs alias analysis
10874 in order to track values pointed to by function parameters. In order
10875 not spend too much time analyzing huge functions, it gives up and
10876 consider all memory clobbered after examining
10877 @option{ipa-max-aa-steps} statements modifying memory.
10878
10879 @item lto-partitions
10880 Specify desired number of partitions produced during WHOPR compilation.
10881 The number of partitions should exceed the number of CPUs used for compilation.
10882 The default value is 32.
10883
10884 @item lto-minpartition
10885 Size of minimal partition for WHOPR (in estimated instructions).
10886 This prevents expenses of splitting very small programs into too many
10887 partitions.
10888
10889 @item cxx-max-namespaces-for-diagnostic-help
10890 The maximum number of namespaces to consult for suggestions when C++
10891 name lookup fails for an identifier. The default is 1000.
10892
10893 @item sink-frequency-threshold
10894 The maximum relative execution frequency (in percents) of the target block
10895 relative to a statement's original block to allow statement sinking of a
10896 statement. Larger numbers result in more aggressive statement sinking.
10897 The default value is 75. A small positive adjustment is applied for
10898 statements with memory operands as those are even more profitable so sink.
10899
10900 @item max-stores-to-sink
10901 The maximum number of conditional stores paires that can be sunk. Set to 0
10902 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10903 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10904
10905 @item allow-store-data-races
10906 Allow optimizers to introduce new data races on stores.
10907 Set to 1 to allow, otherwise to 0. This option is enabled by default
10908 at optimization level @option{-Ofast}.
10909
10910 @item case-values-threshold
10911 The smallest number of different values for which it is best to use a
10912 jump-table instead of a tree of conditional branches. If the value is
10913 0, use the default for the machine. The default is 0.
10914
10915 @item tree-reassoc-width
10916 Set the maximum number of instructions executed in parallel in
10917 reassociated tree. This parameter overrides target dependent
10918 heuristics used by default if has non zero value.
10919
10920 @item sched-pressure-algorithm
10921 Choose between the two available implementations of
10922 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10923 and is the more likely to prevent instructions from being reordered.
10924 Algorithm 2 was designed to be a compromise between the relatively
10925 conservative approach taken by algorithm 1 and the rather aggressive
10926 approach taken by the default scheduler. It relies more heavily on
10927 having a regular register file and accurate register pressure classes.
10928 See @file{haifa-sched.c} in the GCC sources for more details.
10929
10930 The default choice depends on the target.
10931
10932 @item max-slsr-cand-scan
10933 Set the maximum number of existing candidates that are considered when
10934 seeking a basis for a new straight-line strength reduction candidate.
10935
10936 @item asan-globals
10937 Enable buffer overflow detection for global objects. This kind
10938 of protection is enabled by default if you are using
10939 @option{-fsanitize=address} option.
10940 To disable global objects protection use @option{--param asan-globals=0}.
10941
10942 @item asan-stack
10943 Enable buffer overflow detection for stack objects. This kind of
10944 protection is enabled by default when using@option{-fsanitize=address}.
10945 To disable stack protection use @option{--param asan-stack=0} option.
10946
10947 @item asan-instrument-reads
10948 Enable buffer overflow detection for memory reads. This kind of
10949 protection is enabled by default when using @option{-fsanitize=address}.
10950 To disable memory reads protection use
10951 @option{--param asan-instrument-reads=0}.
10952
10953 @item asan-instrument-writes
10954 Enable buffer overflow detection for memory writes. This kind of
10955 protection is enabled by default when using @option{-fsanitize=address}.
10956 To disable memory writes protection use
10957 @option{--param asan-instrument-writes=0} option.
10958
10959 @item asan-memintrin
10960 Enable detection for built-in functions. This kind of protection
10961 is enabled by default when using @option{-fsanitize=address}.
10962 To disable built-in functions protection use
10963 @option{--param asan-memintrin=0}.
10964
10965 @item asan-use-after-return
10966 Enable detection of use-after-return. This kind of protection
10967 is enabled by default when using @option{-fsanitize=address} option.
10968 To disable use-after-return detection use
10969 @option{--param asan-use-after-return=0}.
10970
10971 @item asan-instrumentation-with-call-threshold
10972 If number of memory accesses in function being instrumented
10973 is greater or equal to this number, use callbacks instead of inline checks.
10974 E.g. to disable inline code use
10975 @option{--param asan-instrumentation-with-call-threshold=0}.
10976
10977 @item chkp-max-ctor-size
10978 Static constructors generated by Pointer Bounds Checker may become very
10979 large and significantly increase compile time at optimization level
10980 @option{-O1} and higher. This parameter is a maximum nubmer of statements
10981 in a single generated constructor. Default value is 5000.
10982
10983 @item max-fsm-thread-path-insns
10984 Maximum number of instructions to copy when duplicating blocks on a
10985 finite state automaton jump thread path. The default is 100.
10986
10987 @item max-fsm-thread-length
10988 Maximum number of basic blocks on a finite state automaton jump thread
10989 path. The default is 10.
10990
10991 @item max-fsm-thread-paths
10992 Maximum number of new jump thread paths to create for a finite state
10993 automaton. The default is 50.
10994
10995 @end table
10996 @end table
10997
10998 @node Preprocessor Options
10999 @section Options Controlling the Preprocessor
11000 @cindex preprocessor options
11001 @cindex options, preprocessor
11002
11003 These options control the C preprocessor, which is run on each C source
11004 file before actual compilation.
11005
11006 If you use the @option{-E} option, nothing is done except preprocessing.
11007 Some of these options make sense only together with @option{-E} because
11008 they cause the preprocessor output to be unsuitable for actual
11009 compilation.
11010
11011 @table @gcctabopt
11012 @item -Wp,@var{option}
11013 @opindex Wp
11014 You can use @option{-Wp,@var{option}} to bypass the compiler driver
11015 and pass @var{option} directly through to the preprocessor. If
11016 @var{option} contains commas, it is split into multiple options at the
11017 commas. However, many options are modified, translated or interpreted
11018 by the compiler driver before being passed to the preprocessor, and
11019 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
11020 interface is undocumented and subject to change, so whenever possible
11021 you should avoid using @option{-Wp} and let the driver handle the
11022 options instead.
11023
11024 @item -Xpreprocessor @var{option}
11025 @opindex Xpreprocessor
11026 Pass @var{option} as an option to the preprocessor. You can use this to
11027 supply system-specific preprocessor options that GCC does not
11028 recognize.
11029
11030 If you want to pass an option that takes an argument, you must use
11031 @option{-Xpreprocessor} twice, once for the option and once for the argument.
11032
11033 @item -no-integrated-cpp
11034 @opindex no-integrated-cpp
11035 Perform preprocessing as a separate pass before compilation.
11036 By default, GCC performs preprocessing as an integrated part of
11037 input tokenization and parsing.
11038 If this option is provided, the appropriate language front end
11039 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
11040 and Objective-C, respectively) is instead invoked twice,
11041 once for preprocessing only and once for actual compilation
11042 of the preprocessed input.
11043 This option may be useful in conjunction with the @option{-B} or
11044 @option{-wrapper} options to specify an alternate preprocessor or
11045 perform additional processing of the program source between
11046 normal preprocessing and compilation.
11047 @end table
11048
11049 @include cppopts.texi
11050
11051 @node Assembler Options
11052 @section Passing Options to the Assembler
11053
11054 @c prevent bad page break with this line
11055 You can pass options to the assembler.
11056
11057 @table @gcctabopt
11058 @item -Wa,@var{option}
11059 @opindex Wa
11060 Pass @var{option} as an option to the assembler. If @var{option}
11061 contains commas, it is split into multiple options at the commas.
11062
11063 @item -Xassembler @var{option}
11064 @opindex Xassembler
11065 Pass @var{option} as an option to the assembler. You can use this to
11066 supply system-specific assembler options that GCC does not
11067 recognize.
11068
11069 If you want to pass an option that takes an argument, you must use
11070 @option{-Xassembler} twice, once for the option and once for the argument.
11071
11072 @end table
11073
11074 @node Link Options
11075 @section Options for Linking
11076 @cindex link options
11077 @cindex options, linking
11078
11079 These options come into play when the compiler links object files into
11080 an executable output file. They are meaningless if the compiler is
11081 not doing a link step.
11082
11083 @table @gcctabopt
11084 @cindex file names
11085 @item @var{object-file-name}
11086 A file name that does not end in a special recognized suffix is
11087 considered to name an object file or library. (Object files are
11088 distinguished from libraries by the linker according to the file
11089 contents.) If linking is done, these object files are used as input
11090 to the linker.
11091
11092 @item -c
11093 @itemx -S
11094 @itemx -E
11095 @opindex c
11096 @opindex S
11097 @opindex E
11098 If any of these options is used, then the linker is not run, and
11099 object file names should not be used as arguments. @xref{Overall
11100 Options}.
11101
11102 @item -fuse-ld=bfd
11103 @opindex fuse-ld=bfd
11104 Use the @command{bfd} linker instead of the default linker.
11105
11106 @item -fuse-ld=gold
11107 @opindex fuse-ld=gold
11108 Use the @command{gold} linker instead of the default linker.
11109
11110 @cindex Libraries
11111 @item -l@var{library}
11112 @itemx -l @var{library}
11113 @opindex l
11114 Search the library named @var{library} when linking. (The second
11115 alternative with the library as a separate argument is only for
11116 POSIX compliance and is not recommended.)
11117
11118 It makes a difference where in the command you write this option; the
11119 linker searches and processes libraries and object files in the order they
11120 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
11121 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
11122 to functions in @samp{z}, those functions may not be loaded.
11123
11124 The linker searches a standard list of directories for the library,
11125 which is actually a file named @file{lib@var{library}.a}. The linker
11126 then uses this file as if it had been specified precisely by name.
11127
11128 The directories searched include several standard system directories
11129 plus any that you specify with @option{-L}.
11130
11131 Normally the files found this way are library files---archive files
11132 whose members are object files. The linker handles an archive file by
11133 scanning through it for members which define symbols that have so far
11134 been referenced but not defined. But if the file that is found is an
11135 ordinary object file, it is linked in the usual fashion. The only
11136 difference between using an @option{-l} option and specifying a file name
11137 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
11138 and searches several directories.
11139
11140 @item -lobjc
11141 @opindex lobjc
11142 You need this special case of the @option{-l} option in order to
11143 link an Objective-C or Objective-C++ program.
11144
11145 @item -nostartfiles
11146 @opindex nostartfiles
11147 Do not use the standard system startup files when linking.
11148 The standard system libraries are used normally, unless @option{-nostdlib}
11149 or @option{-nodefaultlibs} is used.
11150
11151 @item -nodefaultlibs
11152 @opindex nodefaultlibs
11153 Do not use the standard system libraries when linking.
11154 Only the libraries you specify are passed to the linker, and options
11155 specifying linkage of the system libraries, such as @option{-static-libgcc}
11156 or @option{-shared-libgcc}, are ignored.
11157 The standard startup files are used normally, unless @option{-nostartfiles}
11158 is used.
11159
11160 The compiler may generate calls to @code{memcmp},
11161 @code{memset}, @code{memcpy} and @code{memmove}.
11162 These entries are usually resolved by entries in
11163 libc. These entry points should be supplied through some other
11164 mechanism when this option is specified.
11165
11166 @item -nostdlib
11167 @opindex nostdlib
11168 Do not use the standard system startup files or libraries when linking.
11169 No startup files and only the libraries you specify are passed to
11170 the linker, and options specifying linkage of the system libraries, such as
11171 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
11172
11173 The compiler may generate calls to @code{memcmp}, @code{memset},
11174 @code{memcpy} and @code{memmove}.
11175 These entries are usually resolved by entries in
11176 libc. These entry points should be supplied through some other
11177 mechanism when this option is specified.
11178
11179 @cindex @option{-lgcc}, use with @option{-nostdlib}
11180 @cindex @option{-nostdlib} and unresolved references
11181 @cindex unresolved references and @option{-nostdlib}
11182 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
11183 @cindex @option{-nodefaultlibs} and unresolved references
11184 @cindex unresolved references and @option{-nodefaultlibs}
11185 One of the standard libraries bypassed by @option{-nostdlib} and
11186 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
11187 which GCC uses to overcome shortcomings of particular machines, or special
11188 needs for some languages.
11189 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
11190 Collection (GCC) Internals},
11191 for more discussion of @file{libgcc.a}.)
11192 In most cases, you need @file{libgcc.a} even when you want to avoid
11193 other standard libraries. In other words, when you specify @option{-nostdlib}
11194 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
11195 This ensures that you have no unresolved references to internal GCC
11196 library subroutines.
11197 (An example of such an internal subroutine is @code{__main}, used to ensure C++
11198 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
11199 GNU Compiler Collection (GCC) Internals}.)
11200
11201 @item -pie
11202 @opindex pie
11203 Produce a position independent executable on targets that support it.
11204 For predictable results, you must also specify the same set of options
11205 used for compilation (@option{-fpie}, @option{-fPIE},
11206 or model suboptions) when you specify this linker option.
11207
11208 @item -rdynamic
11209 @opindex rdynamic
11210 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
11211 that support it. This instructs the linker to add all symbols, not
11212 only used ones, to the dynamic symbol table. This option is needed
11213 for some uses of @code{dlopen} or to allow obtaining backtraces
11214 from within a program.
11215
11216 @item -s
11217 @opindex s
11218 Remove all symbol table and relocation information from the executable.
11219
11220 @item -static
11221 @opindex static
11222 On systems that support dynamic linking, this prevents linking with the shared
11223 libraries. On other systems, this option has no effect.
11224
11225 @item -shared
11226 @opindex shared
11227 Produce a shared object which can then be linked with other objects to
11228 form an executable. Not all systems support this option. For predictable
11229 results, you must also specify the same set of options used for compilation
11230 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
11231 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
11232 needs to build supplementary stub code for constructors to work. On
11233 multi-libbed systems, @samp{gcc -shared} must select the correct support
11234 libraries to link against. Failing to supply the correct flags may lead
11235 to subtle defects. Supplying them in cases where they are not necessary
11236 is innocuous.}
11237
11238 @item -shared-libgcc
11239 @itemx -static-libgcc
11240 @opindex shared-libgcc
11241 @opindex static-libgcc
11242 On systems that provide @file{libgcc} as a shared library, these options
11243 force the use of either the shared or static version, respectively.
11244 If no shared version of @file{libgcc} was built when the compiler was
11245 configured, these options have no effect.
11246
11247 There are several situations in which an application should use the
11248 shared @file{libgcc} instead of the static version. The most common
11249 of these is when the application wishes to throw and catch exceptions
11250 across different shared libraries. In that case, each of the libraries
11251 as well as the application itself should use the shared @file{libgcc}.
11252
11253 Therefore, the G++ and GCJ drivers automatically add
11254 @option{-shared-libgcc} whenever you build a shared library or a main
11255 executable, because C++ and Java programs typically use exceptions, so
11256 this is the right thing to do.
11257
11258 If, instead, you use the GCC driver to create shared libraries, you may
11259 find that they are not always linked with the shared @file{libgcc}.
11260 If GCC finds, at its configuration time, that you have a non-GNU linker
11261 or a GNU linker that does not support option @option{--eh-frame-hdr},
11262 it links the shared version of @file{libgcc} into shared libraries
11263 by default. Otherwise, it takes advantage of the linker and optimizes
11264 away the linking with the shared version of @file{libgcc}, linking with
11265 the static version of libgcc by default. This allows exceptions to
11266 propagate through such shared libraries, without incurring relocation
11267 costs at library load time.
11268
11269 However, if a library or main executable is supposed to throw or catch
11270 exceptions, you must link it using the G++ or GCJ driver, as appropriate
11271 for the languages used in the program, or using the option
11272 @option{-shared-libgcc}, such that it is linked with the shared
11273 @file{libgcc}.
11274
11275 @item -static-libasan
11276 @opindex static-libasan
11277 When the @option{-fsanitize=address} option is used to link a program,
11278 the GCC driver automatically links against @option{libasan}. If
11279 @file{libasan} is available as a shared library, and the @option{-static}
11280 option is not used, then this links against the shared version of
11281 @file{libasan}. The @option{-static-libasan} option directs the GCC
11282 driver to link @file{libasan} statically, without necessarily linking
11283 other libraries statically.
11284
11285 @item -static-libtsan
11286 @opindex static-libtsan
11287 When the @option{-fsanitize=thread} option is used to link a program,
11288 the GCC driver automatically links against @option{libtsan}. If
11289 @file{libtsan} is available as a shared library, and the @option{-static}
11290 option is not used, then this links against the shared version of
11291 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
11292 driver to link @file{libtsan} statically, without necessarily linking
11293 other libraries statically.
11294
11295 @item -static-liblsan
11296 @opindex static-liblsan
11297 When the @option{-fsanitize=leak} option is used to link a program,
11298 the GCC driver automatically links against @option{liblsan}. If
11299 @file{liblsan} is available as a shared library, and the @option{-static}
11300 option is not used, then this links against the shared version of
11301 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
11302 driver to link @file{liblsan} statically, without necessarily linking
11303 other libraries statically.
11304
11305 @item -static-libubsan
11306 @opindex static-libubsan
11307 When the @option{-fsanitize=undefined} option is used to link a program,
11308 the GCC driver automatically links against @option{libubsan}. If
11309 @file{libubsan} is available as a shared library, and the @option{-static}
11310 option is not used, then this links against the shared version of
11311 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
11312 driver to link @file{libubsan} statically, without necessarily linking
11313 other libraries statically.
11314
11315 @item -static-libmpx
11316 @opindex static-libmpx
11317 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
11318 used to link a program, the GCC driver automatically links against
11319 @file{libmpx}. If @file{libmpx} is available as a shared library,
11320 and the @option{-static} option is not used, then this links against
11321 the shared version of @file{libmpx}. The @option{-static-libmpx}
11322 option directs the GCC driver to link @file{libmpx} statically,
11323 without necessarily linking other libraries statically.
11324
11325 @item -static-libmpxwrappers
11326 @opindex static-libmpxwrappers
11327 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
11328 to link a program without also using @option{-fno-chkp-use-wrappers}, the
11329 GCC driver automatically links against @file{libmpxwrappers}. If
11330 @file{libmpxwrappers} is available as a shared library, and the
11331 @option{-static} option is not used, then this links against the shared
11332 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
11333 option directs the GCC driver to link @file{libmpxwrappers} statically,
11334 without necessarily linking other libraries statically.
11335
11336 @item -static-libstdc++
11337 @opindex static-libstdc++
11338 When the @command{g++} program is used to link a C++ program, it
11339 normally automatically links against @option{libstdc++}. If
11340 @file{libstdc++} is available as a shared library, and the
11341 @option{-static} option is not used, then this links against the
11342 shared version of @file{libstdc++}. That is normally fine. However, it
11343 is sometimes useful to freeze the version of @file{libstdc++} used by
11344 the program without going all the way to a fully static link. The
11345 @option{-static-libstdc++} option directs the @command{g++} driver to
11346 link @file{libstdc++} statically, without necessarily linking other
11347 libraries statically.
11348
11349 @item -symbolic
11350 @opindex symbolic
11351 Bind references to global symbols when building a shared object. Warn
11352 about any unresolved references (unless overridden by the link editor
11353 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
11354 this option.
11355
11356 @item -T @var{script}
11357 @opindex T
11358 @cindex linker script
11359 Use @var{script} as the linker script. This option is supported by most
11360 systems using the GNU linker. On some targets, such as bare-board
11361 targets without an operating system, the @option{-T} option may be required
11362 when linking to avoid references to undefined symbols.
11363
11364 @item -Xlinker @var{option}
11365 @opindex Xlinker
11366 Pass @var{option} as an option to the linker. You can use this to
11367 supply system-specific linker options that GCC does not recognize.
11368
11369 If you want to pass an option that takes a separate argument, you must use
11370 @option{-Xlinker} twice, once for the option and once for the argument.
11371 For example, to pass @option{-assert definitions}, you must write
11372 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
11373 @option{-Xlinker "-assert definitions"}, because this passes the entire
11374 string as a single argument, which is not what the linker expects.
11375
11376 When using the GNU linker, it is usually more convenient to pass
11377 arguments to linker options using the @option{@var{option}=@var{value}}
11378 syntax than as separate arguments. For example, you can specify
11379 @option{-Xlinker -Map=output.map} rather than
11380 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
11381 this syntax for command-line options.
11382
11383 @item -Wl,@var{option}
11384 @opindex Wl
11385 Pass @var{option} as an option to the linker. If @var{option} contains
11386 commas, it is split into multiple options at the commas. You can use this
11387 syntax to pass an argument to the option.
11388 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
11389 linker. When using the GNU linker, you can also get the same effect with
11390 @option{-Wl,-Map=output.map}.
11391
11392 @item -u @var{symbol}
11393 @opindex u
11394 Pretend the symbol @var{symbol} is undefined, to force linking of
11395 library modules to define it. You can use @option{-u} multiple times with
11396 different symbols to force loading of additional library modules.
11397
11398 @item -z @var{keyword}
11399 @opindex z
11400 @option{-z} is passed directly on to the linker along with the keyword
11401 @var{keyword}. See the section in the documentation of your linker for
11402 permitted values and their meanings.
11403 @end table
11404
11405 @node Directory Options
11406 @section Options for Directory Search
11407 @cindex directory options
11408 @cindex options, directory search
11409 @cindex search path
11410
11411 These options specify directories to search for header files, for
11412 libraries and for parts of the compiler:
11413
11414 @table @gcctabopt
11415 @item -I@var{dir}
11416 @opindex I
11417 Add the directory @var{dir} to the head of the list of directories to be
11418 searched for header files. This can be used to override a system header
11419 file, substituting your own version, since these directories are
11420 searched before the system header file directories. However, you should
11421 not use this option to add directories that contain vendor-supplied
11422 system header files (use @option{-isystem} for that). If you use more than
11423 one @option{-I} option, the directories are scanned in left-to-right
11424 order; the standard system directories come after.
11425
11426 If a standard system include directory, or a directory specified with
11427 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
11428 option is ignored. The directory is still searched but as a
11429 system directory at its normal position in the system include chain.
11430 This is to ensure that GCC's procedure to fix buggy system headers and
11431 the ordering for the @code{include_next} directive are not inadvertently changed.
11432 If you really need to change the search order for system directories,
11433 use the @option{-nostdinc} and/or @option{-isystem} options.
11434
11435 @item -iplugindir=@var{dir}
11436 @opindex iplugindir=
11437 Set the directory to search for plugins that are passed
11438 by @option{-fplugin=@var{name}} instead of
11439 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
11440 to be used by the user, but only passed by the driver.
11441
11442 @item -iquote@var{dir}
11443 @opindex iquote
11444 Add the directory @var{dir} to the head of the list of directories to
11445 be searched for header files only for the case of @code{#include
11446 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
11447 otherwise just like @option{-I}.
11448
11449 @item -L@var{dir}
11450 @opindex L
11451 Add directory @var{dir} to the list of directories to be searched
11452 for @option{-l}.
11453
11454 @item -B@var{prefix}
11455 @opindex B
11456 This option specifies where to find the executables, libraries,
11457 include files, and data files of the compiler itself.
11458
11459 The compiler driver program runs one or more of the subprograms
11460 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
11461 @var{prefix} as a prefix for each program it tries to run, both with and
11462 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
11463
11464 For each subprogram to be run, the compiler driver first tries the
11465 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
11466 is not specified, the driver tries two standard prefixes,
11467 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
11468 those results in a file name that is found, the unmodified program
11469 name is searched for using the directories specified in your
11470 @env{PATH} environment variable.
11471
11472 The compiler checks to see if the path provided by @option{-B}
11473 refers to a directory, and if necessary it adds a directory
11474 separator character at the end of the path.
11475
11476 @option{-B} prefixes that effectively specify directory names also apply
11477 to libraries in the linker, because the compiler translates these
11478 options into @option{-L} options for the linker. They also apply to
11479 include files in the preprocessor, because the compiler translates these
11480 options into @option{-isystem} options for the preprocessor. In this case,
11481 the compiler appends @samp{include} to the prefix.
11482
11483 The runtime support file @file{libgcc.a} can also be searched for using
11484 the @option{-B} prefix, if needed. If it is not found there, the two
11485 standard prefixes above are tried, and that is all. The file is left
11486 out of the link if it is not found by those means.
11487
11488 Another way to specify a prefix much like the @option{-B} prefix is to use
11489 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
11490 Variables}.
11491
11492 As a special kludge, if the path provided by @option{-B} is
11493 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
11494 9, then it is replaced by @file{[dir/]include}. This is to help
11495 with boot-strapping the compiler.
11496
11497 @item -specs=@var{file}
11498 @opindex specs
11499 Process @var{file} after the compiler reads in the standard @file{specs}
11500 file, in order to override the defaults which the @command{gcc} driver
11501 program uses when determining what switches to pass to @command{cc1},
11502 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
11503 @option{-specs=@var{file}} can be specified on the command line, and they
11504 are processed in order, from left to right.
11505
11506 @item --sysroot=@var{dir}
11507 @opindex sysroot
11508 Use @var{dir} as the logical root directory for headers and libraries.
11509 For example, if the compiler normally searches for headers in
11510 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
11511 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
11512
11513 If you use both this option and the @option{-isysroot} option, then
11514 the @option{--sysroot} option applies to libraries, but the
11515 @option{-isysroot} option applies to header files.
11516
11517 The GNU linker (beginning with version 2.16) has the necessary support
11518 for this option. If your linker does not support this option, the
11519 header file aspect of @option{--sysroot} still works, but the
11520 library aspect does not.
11521
11522 @item --no-sysroot-suffix
11523 @opindex no-sysroot-suffix
11524 For some targets, a suffix is added to the root directory specified
11525 with @option{--sysroot}, depending on the other options used, so that
11526 headers may for example be found in
11527 @file{@var{dir}/@var{suffix}/usr/include} instead of
11528 @file{@var{dir}/usr/include}. This option disables the addition of
11529 such a suffix.
11530
11531 @item -I-
11532 @opindex I-
11533 This option has been deprecated. Please use @option{-iquote} instead for
11534 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
11535 option.
11536 Any directories you specify with @option{-I} options before the @option{-I-}
11537 option are searched only for the case of @code{#include "@var{file}"};
11538 they are not searched for @code{#include <@var{file}>}.
11539
11540 If additional directories are specified with @option{-I} options after
11541 the @option{-I-} option, these directories are searched for all @code{#include}
11542 directives. (Ordinarily @emph{all} @option{-I} directories are used
11543 this way.)
11544
11545 In addition, the @option{-I-} option inhibits the use of the current
11546 directory (where the current input file came from) as the first search
11547 directory for @code{#include "@var{file}"}. There is no way to
11548 override this effect of @option{-I-}. With @option{-I.} you can specify
11549 searching the directory that is current when the compiler is
11550 invoked. That is not exactly the same as what the preprocessor does
11551 by default, but it is often satisfactory.
11552
11553 @option{-I-} does not inhibit the use of the standard system directories
11554 for header files. Thus, @option{-I-} and @option{-nostdinc} are
11555 independent.
11556 @end table
11557
11558 @c man end
11559
11560 @node Spec Files
11561 @section Specifying Subprocesses and the Switches to Pass to Them
11562 @cindex Spec Files
11563
11564 @command{gcc} is a driver program. It performs its job by invoking a
11565 sequence of other programs to do the work of compiling, assembling and
11566 linking. GCC interprets its command-line parameters and uses these to
11567 deduce which programs it should invoke, and which command-line options
11568 it ought to place on their command lines. This behavior is controlled
11569 by @dfn{spec strings}. In most cases there is one spec string for each
11570 program that GCC can invoke, but a few programs have multiple spec
11571 strings to control their behavior. The spec strings built into GCC can
11572 be overridden by using the @option{-specs=} command-line switch to specify
11573 a spec file.
11574
11575 @dfn{Spec files} are plaintext files that are used to construct spec
11576 strings. They consist of a sequence of directives separated by blank
11577 lines. The type of directive is determined by the first non-whitespace
11578 character on the line, which can be one of the following:
11579
11580 @table @code
11581 @item %@var{command}
11582 Issues a @var{command} to the spec file processor. The commands that can
11583 appear here are:
11584
11585 @table @code
11586 @item %include <@var{file}>
11587 @cindex @code{%include}
11588 Search for @var{file} and insert its text at the current point in the
11589 specs file.
11590
11591 @item %include_noerr <@var{file}>
11592 @cindex @code{%include_noerr}
11593 Just like @samp{%include}, but do not generate an error message if the include
11594 file cannot be found.
11595
11596 @item %rename @var{old_name} @var{new_name}
11597 @cindex @code{%rename}
11598 Rename the spec string @var{old_name} to @var{new_name}.
11599
11600 @end table
11601
11602 @item *[@var{spec_name}]:
11603 This tells the compiler to create, override or delete the named spec
11604 string. All lines after this directive up to the next directive or
11605 blank line are considered to be the text for the spec string. If this
11606 results in an empty string then the spec is deleted. (Or, if the
11607 spec did not exist, then nothing happens.) Otherwise, if the spec
11608 does not currently exist a new spec is created. If the spec does
11609 exist then its contents are overridden by the text of this
11610 directive, unless the first character of that text is the @samp{+}
11611 character, in which case the text is appended to the spec.
11612
11613 @item [@var{suffix}]:
11614 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
11615 and up to the next directive or blank line are considered to make up the
11616 spec string for the indicated suffix. When the compiler encounters an
11617 input file with the named suffix, it processes the spec string in
11618 order to work out how to compile that file. For example:
11619
11620 @smallexample
11621 .ZZ:
11622 z-compile -input %i
11623 @end smallexample
11624
11625 This says that any input file whose name ends in @samp{.ZZ} should be
11626 passed to the program @samp{z-compile}, which should be invoked with the
11627 command-line switch @option{-input} and with the result of performing the
11628 @samp{%i} substitution. (See below.)
11629
11630 As an alternative to providing a spec string, the text following a
11631 suffix directive can be one of the following:
11632
11633 @table @code
11634 @item @@@var{language}
11635 This says that the suffix is an alias for a known @var{language}. This is
11636 similar to using the @option{-x} command-line switch to GCC to specify a
11637 language explicitly. For example:
11638
11639 @smallexample
11640 .ZZ:
11641 @@c++
11642 @end smallexample
11643
11644 Says that .ZZ files are, in fact, C++ source files.
11645
11646 @item #@var{name}
11647 This causes an error messages saying:
11648
11649 @smallexample
11650 @var{name} compiler not installed on this system.
11651 @end smallexample
11652 @end table
11653
11654 GCC already has an extensive list of suffixes built into it.
11655 This directive adds an entry to the end of the list of suffixes, but
11656 since the list is searched from the end backwards, it is effectively
11657 possible to override earlier entries using this technique.
11658
11659 @end table
11660
11661 GCC has the following spec strings built into it. Spec files can
11662 override these strings or create their own. Note that individual
11663 targets can also add their own spec strings to this list.
11664
11665 @smallexample
11666 asm Options to pass to the assembler
11667 asm_final Options to pass to the assembler post-processor
11668 cpp Options to pass to the C preprocessor
11669 cc1 Options to pass to the C compiler
11670 cc1plus Options to pass to the C++ compiler
11671 endfile Object files to include at the end of the link
11672 link Options to pass to the linker
11673 lib Libraries to include on the command line to the linker
11674 libgcc Decides which GCC support library to pass to the linker
11675 linker Sets the name of the linker
11676 predefines Defines to be passed to the C preprocessor
11677 signed_char Defines to pass to CPP to say whether @code{char} is signed
11678 by default
11679 startfile Object files to include at the start of the link
11680 @end smallexample
11681
11682 Here is a small example of a spec file:
11683
11684 @smallexample
11685 %rename lib old_lib
11686
11687 *lib:
11688 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
11689 @end smallexample
11690
11691 This example renames the spec called @samp{lib} to @samp{old_lib} and
11692 then overrides the previous definition of @samp{lib} with a new one.
11693 The new definition adds in some extra command-line options before
11694 including the text of the old definition.
11695
11696 @dfn{Spec strings} are a list of command-line options to be passed to their
11697 corresponding program. In addition, the spec strings can contain
11698 @samp{%}-prefixed sequences to substitute variable text or to
11699 conditionally insert text into the command line. Using these constructs
11700 it is possible to generate quite complex command lines.
11701
11702 Here is a table of all defined @samp{%}-sequences for spec
11703 strings. Note that spaces are not generated automatically around the
11704 results of expanding these sequences. Therefore you can concatenate them
11705 together or combine them with constant text in a single argument.
11706
11707 @table @code
11708 @item %%
11709 Substitute one @samp{%} into the program name or argument.
11710
11711 @item %i
11712 Substitute the name of the input file being processed.
11713
11714 @item %b
11715 Substitute the basename of the input file being processed.
11716 This is the substring up to (and not including) the last period
11717 and not including the directory.
11718
11719 @item %B
11720 This is the same as @samp{%b}, but include the file suffix (text after
11721 the last period).
11722
11723 @item %d
11724 Marks the argument containing or following the @samp{%d} as a
11725 temporary file name, so that that file is deleted if GCC exits
11726 successfully. Unlike @samp{%g}, this contributes no text to the
11727 argument.
11728
11729 @item %g@var{suffix}
11730 Substitute a file name that has suffix @var{suffix} and is chosen
11731 once per compilation, and mark the argument in the same way as
11732 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
11733 name is now chosen in a way that is hard to predict even when previously
11734 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
11735 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
11736 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
11737 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
11738 was simply substituted with a file name chosen once per compilation,
11739 without regard to any appended suffix (which was therefore treated
11740 just like ordinary text), making such attacks more likely to succeed.
11741
11742 @item %u@var{suffix}
11743 Like @samp{%g}, but generates a new temporary file name
11744 each time it appears instead of once per compilation.
11745
11746 @item %U@var{suffix}
11747 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
11748 new one if there is no such last file name. In the absence of any
11749 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
11750 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
11751 involves the generation of two distinct file names, one
11752 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
11753 simply substituted with a file name chosen for the previous @samp{%u},
11754 without regard to any appended suffix.
11755
11756 @item %j@var{suffix}
11757 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
11758 writable, and if @option{-save-temps} is not used;
11759 otherwise, substitute the name
11760 of a temporary file, just like @samp{%u}. This temporary file is not
11761 meant for communication between processes, but rather as a junk
11762 disposal mechanism.
11763
11764 @item %|@var{suffix}
11765 @itemx %m@var{suffix}
11766 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
11767 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
11768 all. These are the two most common ways to instruct a program that it
11769 should read from standard input or write to standard output. If you
11770 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
11771 construct: see for example @file{f/lang-specs.h}.
11772
11773 @item %.@var{SUFFIX}
11774 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
11775 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
11776 terminated by the next space or %.
11777
11778 @item %w
11779 Marks the argument containing or following the @samp{%w} as the
11780 designated output file of this compilation. This puts the argument
11781 into the sequence of arguments that @samp{%o} substitutes.
11782
11783 @item %o
11784 Substitutes the names of all the output files, with spaces
11785 automatically placed around them. You should write spaces
11786 around the @samp{%o} as well or the results are undefined.
11787 @samp{%o} is for use in the specs for running the linker.
11788 Input files whose names have no recognized suffix are not compiled
11789 at all, but they are included among the output files, so they are
11790 linked.
11791
11792 @item %O
11793 Substitutes the suffix for object files. Note that this is
11794 handled specially when it immediately follows @samp{%g, %u, or %U},
11795 because of the need for those to form complete file names. The
11796 handling is such that @samp{%O} is treated exactly as if it had already
11797 been substituted, except that @samp{%g, %u, and %U} do not currently
11798 support additional @var{suffix} characters following @samp{%O} as they do
11799 following, for example, @samp{.o}.
11800
11801 @item %p
11802 Substitutes the standard macro predefinitions for the
11803 current target machine. Use this when running @command{cpp}.
11804
11805 @item %P
11806 Like @samp{%p}, but puts @samp{__} before and after the name of each
11807 predefined macro, except for macros that start with @samp{__} or with
11808 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
11809 C@.
11810
11811 @item %I
11812 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
11813 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
11814 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
11815 and @option{-imultilib} as necessary.
11816
11817 @item %s
11818 Current argument is the name of a library or startup file of some sort.
11819 Search for that file in a standard list of directories and substitute
11820 the full name found. The current working directory is included in the
11821 list of directories scanned.
11822
11823 @item %T
11824 Current argument is the name of a linker script. Search for that file
11825 in the current list of directories to scan for libraries. If the file
11826 is located insert a @option{--script} option into the command line
11827 followed by the full path name found. If the file is not found then
11828 generate an error message. Note: the current working directory is not
11829 searched.
11830
11831 @item %e@var{str}
11832 Print @var{str} as an error message. @var{str} is terminated by a newline.
11833 Use this when inconsistent options are detected.
11834
11835 @item %(@var{name})
11836 Substitute the contents of spec string @var{name} at this point.
11837
11838 @item %x@{@var{option}@}
11839 Accumulate an option for @samp{%X}.
11840
11841 @item %X
11842 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
11843 spec string.
11844
11845 @item %Y
11846 Output the accumulated assembler options specified by @option{-Wa}.
11847
11848 @item %Z
11849 Output the accumulated preprocessor options specified by @option{-Wp}.
11850
11851 @item %a
11852 Process the @code{asm} spec. This is used to compute the
11853 switches to be passed to the assembler.
11854
11855 @item %A
11856 Process the @code{asm_final} spec. This is a spec string for
11857 passing switches to an assembler post-processor, if such a program is
11858 needed.
11859
11860 @item %l
11861 Process the @code{link} spec. This is the spec for computing the
11862 command line passed to the linker. Typically it makes use of the
11863 @samp{%L %G %S %D and %E} sequences.
11864
11865 @item %D
11866 Dump out a @option{-L} option for each directory that GCC believes might
11867 contain startup files. If the target supports multilibs then the
11868 current multilib directory is prepended to each of these paths.
11869
11870 @item %L
11871 Process the @code{lib} spec. This is a spec string for deciding which
11872 libraries are included on the command line to the linker.
11873
11874 @item %G
11875 Process the @code{libgcc} spec. This is a spec string for deciding
11876 which GCC support library is included on the command line to the linker.
11877
11878 @item %S
11879 Process the @code{startfile} spec. This is a spec for deciding which
11880 object files are the first ones passed to the linker. Typically
11881 this might be a file named @file{crt0.o}.
11882
11883 @item %E
11884 Process the @code{endfile} spec. This is a spec string that specifies
11885 the last object files that are passed to the linker.
11886
11887 @item %C
11888 Process the @code{cpp} spec. This is used to construct the arguments
11889 to be passed to the C preprocessor.
11890
11891 @item %1
11892 Process the @code{cc1} spec. This is used to construct the options to be
11893 passed to the actual C compiler (@command{cc1}).
11894
11895 @item %2
11896 Process the @code{cc1plus} spec. This is used to construct the options to be
11897 passed to the actual C++ compiler (@command{cc1plus}).
11898
11899 @item %*
11900 Substitute the variable part of a matched option. See below.
11901 Note that each comma in the substituted string is replaced by
11902 a single space.
11903
11904 @item %<@code{S}
11905 Remove all occurrences of @code{-S} from the command line. Note---this
11906 command is position dependent. @samp{%} commands in the spec string
11907 before this one see @code{-S}, @samp{%} commands in the spec string
11908 after this one do not.
11909
11910 @item %:@var{function}(@var{args})
11911 Call the named function @var{function}, passing it @var{args}.
11912 @var{args} is first processed as a nested spec string, then split
11913 into an argument vector in the usual fashion. The function returns
11914 a string which is processed as if it had appeared literally as part
11915 of the current spec.
11916
11917 The following built-in spec functions are provided:
11918
11919 @table @code
11920 @item @code{getenv}
11921 The @code{getenv} spec function takes two arguments: an environment
11922 variable name and a string. If the environment variable is not
11923 defined, a fatal error is issued. Otherwise, the return value is the
11924 value of the environment variable concatenated with the string. For
11925 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
11926
11927 @smallexample
11928 %:getenv(TOPDIR /include)
11929 @end smallexample
11930
11931 expands to @file{/path/to/top/include}.
11932
11933 @item @code{if-exists}
11934 The @code{if-exists} spec function takes one argument, an absolute
11935 pathname to a file. If the file exists, @code{if-exists} returns the
11936 pathname. Here is a small example of its usage:
11937
11938 @smallexample
11939 *startfile:
11940 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
11941 @end smallexample
11942
11943 @item @code{if-exists-else}
11944 The @code{if-exists-else} spec function is similar to the @code{if-exists}
11945 spec function, except that it takes two arguments. The first argument is
11946 an absolute pathname to a file. If the file exists, @code{if-exists-else}
11947 returns the pathname. If it does not exist, it returns the second argument.
11948 This way, @code{if-exists-else} can be used to select one file or another,
11949 based on the existence of the first. Here is a small example of its usage:
11950
11951 @smallexample
11952 *startfile:
11953 crt0%O%s %:if-exists(crti%O%s) \
11954 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
11955 @end smallexample
11956
11957 @item @code{replace-outfile}
11958 The @code{replace-outfile} spec function takes two arguments. It looks for the
11959 first argument in the outfiles array and replaces it with the second argument. Here
11960 is a small example of its usage:
11961
11962 @smallexample
11963 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
11964 @end smallexample
11965
11966 @item @code{remove-outfile}
11967 The @code{remove-outfile} spec function takes one argument. It looks for the
11968 first argument in the outfiles array and removes it. Here is a small example
11969 its usage:
11970
11971 @smallexample
11972 %:remove-outfile(-lm)
11973 @end smallexample
11974
11975 @item @code{pass-through-libs}
11976 The @code{pass-through-libs} spec function takes any number of arguments. It
11977 finds any @option{-l} options and any non-options ending in @file{.a} (which it
11978 assumes are the names of linker input library archive files) and returns a
11979 result containing all the found arguments each prepended by
11980 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
11981 intended to be passed to the LTO linker plugin.
11982
11983 @smallexample
11984 %:pass-through-libs(%G %L %G)
11985 @end smallexample
11986
11987 @item @code{print-asm-header}
11988 The @code{print-asm-header} function takes no arguments and simply
11989 prints a banner like:
11990
11991 @smallexample
11992 Assembler options
11993 =================
11994
11995 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
11996 @end smallexample
11997
11998 It is used to separate compiler options from assembler options
11999 in the @option{--target-help} output.
12000 @end table
12001
12002 @item %@{@code{S}@}
12003 Substitutes the @code{-S} switch, if that switch is given to GCC@.
12004 If that switch is not specified, this substitutes nothing. Note that
12005 the leading dash is omitted when specifying this option, and it is
12006 automatically inserted if the substitution is performed. Thus the spec
12007 string @samp{%@{foo@}} matches the command-line option @option{-foo}
12008 and outputs the command-line option @option{-foo}.
12009
12010 @item %W@{@code{S}@}
12011 Like %@{@code{S}@} but mark last argument supplied within as a file to be
12012 deleted on failure.
12013
12014 @item %@{@code{S}*@}
12015 Substitutes all the switches specified to GCC whose names start
12016 with @code{-S}, but which also take an argument. This is used for
12017 switches like @option{-o}, @option{-D}, @option{-I}, etc.
12018 GCC considers @option{-o foo} as being
12019 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
12020 text, including the space. Thus two arguments are generated.
12021
12022 @item %@{@code{S}*&@code{T}*@}
12023 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
12024 (the order of @code{S} and @code{T} in the spec is not significant).
12025 There can be any number of ampersand-separated variables; for each the
12026 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
12027
12028 @item %@{@code{S}:@code{X}@}
12029 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
12030
12031 @item %@{!@code{S}:@code{X}@}
12032 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
12033
12034 @item %@{@code{S}*:@code{X}@}
12035 Substitutes @code{X} if one or more switches whose names start with
12036 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
12037 once, no matter how many such switches appeared. However, if @code{%*}
12038 appears somewhere in @code{X}, then @code{X} is substituted once
12039 for each matching switch, with the @code{%*} replaced by the part of
12040 that switch matching the @code{*}.
12041
12042 If @code{%*} appears as the last part of a spec sequence then a space
12043 is added after the end of the last substitution. If there is more
12044 text in the sequence, however, then a space is not generated. This
12045 allows the @code{%*} substitution to be used as part of a larger
12046 string. For example, a spec string like this:
12047
12048 @smallexample
12049 %@{mcu=*:--script=%*/memory.ld@}
12050 @end smallexample
12051
12052 @noindent
12053 when matching an option like @option{-mcu=newchip} produces:
12054
12055 @smallexample
12056 --script=newchip/memory.ld
12057 @end smallexample
12058
12059 @item %@{.@code{S}:@code{X}@}
12060 Substitutes @code{X}, if processing a file with suffix @code{S}.
12061
12062 @item %@{!.@code{S}:@code{X}@}
12063 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
12064
12065 @item %@{,@code{S}:@code{X}@}
12066 Substitutes @code{X}, if processing a file for language @code{S}.
12067
12068 @item %@{!,@code{S}:@code{X}@}
12069 Substitutes @code{X}, if not processing a file for language @code{S}.
12070
12071 @item %@{@code{S}|@code{P}:@code{X}@}
12072 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
12073 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
12074 @code{*} sequences as well, although they have a stronger binding than
12075 the @samp{|}. If @code{%*} appears in @code{X}, all of the
12076 alternatives must be starred, and only the first matching alternative
12077 is substituted.
12078
12079 For example, a spec string like this:
12080
12081 @smallexample
12082 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
12083 @end smallexample
12084
12085 @noindent
12086 outputs the following command-line options from the following input
12087 command-line options:
12088
12089 @smallexample
12090 fred.c -foo -baz
12091 jim.d -bar -boggle
12092 -d fred.c -foo -baz -boggle
12093 -d jim.d -bar -baz -boggle
12094 @end smallexample
12095
12096 @item %@{S:X; T:Y; :D@}
12097
12098 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
12099 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
12100 be as many clauses as you need. This may be combined with @code{.},
12101 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
12102
12103
12104 @end table
12105
12106 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
12107 construct may contain other nested @samp{%} constructs or spaces, or
12108 even newlines. They are processed as usual, as described above.
12109 Trailing white space in @code{X} is ignored. White space may also
12110 appear anywhere on the left side of the colon in these constructs,
12111 except between @code{.} or @code{*} and the corresponding word.
12112
12113 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
12114 handled specifically in these constructs. If another value of
12115 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
12116 @option{-W} switch is found later in the command line, the earlier
12117 switch value is ignored, except with @{@code{S}*@} where @code{S} is
12118 just one letter, which passes all matching options.
12119
12120 The character @samp{|} at the beginning of the predicate text is used to
12121 indicate that a command should be piped to the following command, but
12122 only if @option{-pipe} is specified.
12123
12124 It is built into GCC which switches take arguments and which do not.
12125 (You might think it would be useful to generalize this to allow each
12126 compiler's spec to say which switches take arguments. But this cannot
12127 be done in a consistent fashion. GCC cannot even decide which input
12128 files have been specified without knowing which switches take arguments,
12129 and it must know which input files to compile in order to tell which
12130 compilers to run).
12131
12132 GCC also knows implicitly that arguments starting in @option{-l} are to be
12133 treated as compiler output files, and passed to the linker in their
12134 proper position among the other output files.
12135
12136 @c man begin OPTIONS
12137
12138 @node Target Options
12139 @section Specifying Target Machine and Compiler Version
12140 @cindex target options
12141 @cindex cross compiling
12142 @cindex specifying machine version
12143 @cindex specifying compiler version and target machine
12144 @cindex compiler version, specifying
12145 @cindex target machine, specifying
12146
12147 The usual way to run GCC is to run the executable called @command{gcc}, or
12148 @command{@var{machine}-gcc} when cross-compiling, or
12149 @command{@var{machine}-gcc-@var{version}} to run a version other than the
12150 one that was installed last.
12151
12152 @node Submodel Options
12153 @section Hardware Models and Configurations
12154 @cindex submodel options
12155 @cindex specifying hardware config
12156 @cindex hardware models and configurations, specifying
12157 @cindex machine dependent options
12158
12159 Each target machine types can have its own
12160 special options, starting with @samp{-m}, to choose among various
12161 hardware models or configurations---for example, 68010 vs 68020,
12162 floating coprocessor or none. A single installed version of the
12163 compiler can compile for any model or configuration, according to the
12164 options specified.
12165
12166 Some configurations of the compiler also support additional special
12167 options, usually for compatibility with other compilers on the same
12168 platform.
12169
12170 @c This list is ordered alphanumerically by subsection name.
12171 @c It should be the same order and spelling as these options are listed
12172 @c in Machine Dependent Options
12173
12174 @menu
12175 * AArch64 Options::
12176 * Adapteva Epiphany Options::
12177 * ARC Options::
12178 * ARM Options::
12179 * AVR Options::
12180 * Blackfin Options::
12181 * C6X Options::
12182 * CRIS Options::
12183 * CR16 Options::
12184 * Darwin Options::
12185 * DEC Alpha Options::
12186 * FR30 Options::
12187 * FRV Options::
12188 * GNU/Linux Options::
12189 * H8/300 Options::
12190 * HPPA Options::
12191 * IA-64 Options::
12192 * LM32 Options::
12193 * M32C Options::
12194 * M32R/D Options::
12195 * M680x0 Options::
12196 * MCore Options::
12197 * MeP Options::
12198 * MicroBlaze Options::
12199 * MIPS Options::
12200 * MMIX Options::
12201 * MN10300 Options::
12202 * Moxie Options::
12203 * MSP430 Options::
12204 * NDS32 Options::
12205 * Nios II Options::
12206 * Nvidia PTX Options::
12207 * PDP-11 Options::
12208 * picoChip Options::
12209 * PowerPC Options::
12210 * RL78 Options::
12211 * RS/6000 and PowerPC Options::
12212 * RX Options::
12213 * S/390 and zSeries Options::
12214 * Score Options::
12215 * SH Options::
12216 * Solaris 2 Options::
12217 * SPARC Options::
12218 * SPU Options::
12219 * System V Options::
12220 * TILE-Gx Options::
12221 * TILEPro Options::
12222 * V850 Options::
12223 * VAX Options::
12224 * Visium Options::
12225 * VMS Options::
12226 * VxWorks Options::
12227 * x86 Options::
12228 * x86 Windows Options::
12229 * Xstormy16 Options::
12230 * Xtensa Options::
12231 * zSeries Options::
12232 @end menu
12233
12234 @node AArch64 Options
12235 @subsection AArch64 Options
12236 @cindex AArch64 Options
12237
12238 These options are defined for AArch64 implementations:
12239
12240 @table @gcctabopt
12241
12242 @item -mabi=@var{name}
12243 @opindex mabi
12244 Generate code for the specified data model. Permissible values
12245 are @samp{ilp32} for SysV-like data model where int, long int and pointer
12246 are 32-bit, and @samp{lp64} for SysV-like data model where int is 32-bit,
12247 but long int and pointer are 64-bit.
12248
12249 The default depends on the specific target configuration. Note that
12250 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
12251 entire program with the same ABI, and link with a compatible set of libraries.
12252
12253 @item -mbig-endian
12254 @opindex mbig-endian
12255 Generate big-endian code. This is the default when GCC is configured for an
12256 @samp{aarch64_be-*-*} target.
12257
12258 @item -mgeneral-regs-only
12259 @opindex mgeneral-regs-only
12260 Generate code which uses only the general registers.
12261
12262 @item -mlittle-endian
12263 @opindex mlittle-endian
12264 Generate little-endian code. This is the default when GCC is configured for an
12265 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
12266
12267 @item -mcmodel=tiny
12268 @opindex mcmodel=tiny
12269 Generate code for the tiny code model. The program and its statically defined
12270 symbols must be within 1GB of each other. Pointers are 64 bits. Programs can
12271 be statically or dynamically linked. This model is not fully implemented and
12272 mostly treated as @samp{small}.
12273
12274 @item -mcmodel=small
12275 @opindex mcmodel=small
12276 Generate code for the small code model. The program and its statically defined
12277 symbols must be within 4GB of each other. Pointers are 64 bits. Programs can
12278 be statically or dynamically linked. This is the default code model.
12279
12280 @item -mcmodel=large
12281 @opindex mcmodel=large
12282 Generate code for the large code model. This makes no assumptions about
12283 addresses and sizes of sections. Pointers are 64 bits. Programs can be
12284 statically linked only.
12285
12286 @item -mstrict-align
12287 @opindex mstrict-align
12288 Do not assume that unaligned memory references are handled by the system.
12289
12290 @item -momit-leaf-frame-pointer
12291 @itemx -mno-omit-leaf-frame-pointer
12292 @opindex momit-leaf-frame-pointer
12293 @opindex mno-omit-leaf-frame-pointer
12294 Omit or keep the frame pointer in leaf functions. The former behaviour is the
12295 default.
12296
12297 @item -mtls-dialect=desc
12298 @opindex mtls-dialect=desc
12299 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
12300 of TLS variables. This is the default.
12301
12302 @item -mtls-dialect=traditional
12303 @opindex mtls-dialect=traditional
12304 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
12305 of TLS variables.
12306
12307 @item -mfix-cortex-a53-835769
12308 @itemx -mno-fix-cortex-a53-835769
12309 @opindex mfix-cortex-a53-835769
12310 @opindex mno-fix-cortex-a53-835769
12311 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
12312 This involves inserting a NOP instruction between memory instructions and
12313 64-bit integer multiply-accumulate instructions.
12314
12315 @item -march=@var{name}
12316 @opindex march
12317 Specify the name of the target architecture, optionally suffixed by one or
12318 more feature modifiers. This option has the form
12319 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the
12320 only permissible value for @var{arch} is @samp{armv8-a}. The permissible
12321 values for @var{feature} are documented in the sub-section below.
12322
12323 Where conflicting feature modifiers are specified, the right-most feature is
12324 used.
12325
12326 GCC uses this name to determine what kind of instructions it can emit when
12327 generating assembly code.
12328
12329 Where @option{-march} is specified without either of @option{-mtune}
12330 or @option{-mcpu} also being specified, the code is tuned to perform
12331 well across a range of target processors implementing the target
12332 architecture.
12333
12334 @item -mtune=@var{name}
12335 @opindex mtune
12336 Specify the name of the target processor for which GCC should tune the
12337 performance of the code. Permissible values for this option are:
12338 @samp{generic}, @samp{cortex-a53}, @samp{cortex-a57},
12339 @samp{cortex-a72}, @samp{thunderx}, @samp{xgene1}.
12340
12341 Additionally, this option can specify that GCC should tune the performance
12342 of the code for a big.LITTLE system. Permissible values for this
12343 option are: @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}.
12344
12345 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
12346 are specified, the code is tuned to perform well across a range
12347 of target processors.
12348
12349 This option cannot be suffixed by feature modifiers.
12350
12351 @item -mcpu=@var{name}
12352 @opindex mcpu
12353 Specify the name of the target processor, optionally suffixed by one or more
12354 feature modifiers. This option has the form
12355 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the
12356 permissible values for @var{cpu} are the same as those available for
12357 @option{-mtune}.
12358
12359 The permissible values for @var{feature} are documented in the sub-section
12360 below.
12361
12362 Where conflicting feature modifiers are specified, the right-most feature is
12363 used.
12364
12365 GCC uses this name to determine what kind of instructions it can emit when
12366 generating assembly code (as if by @option{-march}) and to determine
12367 the target processor for which to tune for performance (as if
12368 by @option{-mtune}). Where this option is used in conjunction
12369 with @option{-march} or @option{-mtune}, those options take precedence
12370 over the appropriate part of this option.
12371 @end table
12372
12373 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
12374 @cindex @option{-march} feature modifiers
12375 @cindex @option{-mcpu} feature modifiers
12376 Feature modifiers used with @option{-march} and @option{-mcpu} can be one
12377 the following:
12378
12379 @table @samp
12380 @item crc
12381 Enable CRC extension.
12382 @item crypto
12383 Enable Crypto extension. This implies Advanced SIMD is enabled.
12384 @item fp
12385 Enable floating-point instructions.
12386 @item simd
12387 Enable Advanced SIMD instructions. This implies floating-point instructions
12388 are enabled. This is the default for all current possible values for options
12389 @option{-march} and @option{-mcpu=}.
12390 @end table
12391
12392 @node Adapteva Epiphany Options
12393 @subsection Adapteva Epiphany Options
12394
12395 These @samp{-m} options are defined for Adapteva Epiphany:
12396
12397 @table @gcctabopt
12398 @item -mhalf-reg-file
12399 @opindex mhalf-reg-file
12400 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
12401 That allows code to run on hardware variants that lack these registers.
12402
12403 @item -mprefer-short-insn-regs
12404 @opindex mprefer-short-insn-regs
12405 Preferrentially allocate registers that allow short instruction generation.
12406 This can result in increased instruction count, so this may either reduce or
12407 increase overall code size.
12408
12409 @item -mbranch-cost=@var{num}
12410 @opindex mbranch-cost
12411 Set the cost of branches to roughly @var{num} ``simple'' instructions.
12412 This cost is only a heuristic and is not guaranteed to produce
12413 consistent results across releases.
12414
12415 @item -mcmove
12416 @opindex mcmove
12417 Enable the generation of conditional moves.
12418
12419 @item -mnops=@var{num}
12420 @opindex mnops
12421 Emit @var{num} NOPs before every other generated instruction.
12422
12423 @item -mno-soft-cmpsf
12424 @opindex mno-soft-cmpsf
12425 For single-precision floating-point comparisons, emit an @code{fsub} instruction
12426 and test the flags. This is faster than a software comparison, but can
12427 get incorrect results in the presence of NaNs, or when two different small
12428 numbers are compared such that their difference is calculated as zero.
12429 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
12430 software comparisons.
12431
12432 @item -mstack-offset=@var{num}
12433 @opindex mstack-offset
12434 Set the offset between the top of the stack and the stack pointer.
12435 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
12436 can be used by leaf functions without stack allocation.
12437 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
12438 Note also that this option changes the ABI; compiling a program with a
12439 different stack offset than the libraries have been compiled with
12440 generally does not work.
12441 This option can be useful if you want to evaluate if a different stack
12442 offset would give you better code, but to actually use a different stack
12443 offset to build working programs, it is recommended to configure the
12444 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
12445
12446 @item -mno-round-nearest
12447 @opindex mno-round-nearest
12448 Make the scheduler assume that the rounding mode has been set to
12449 truncating. The default is @option{-mround-nearest}.
12450
12451 @item -mlong-calls
12452 @opindex mlong-calls
12453 If not otherwise specified by an attribute, assume all calls might be beyond
12454 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
12455 function address into a register before performing a (otherwise direct) call.
12456 This is the default.
12457
12458 @item -mshort-calls
12459 @opindex short-calls
12460 If not otherwise specified by an attribute, assume all direct calls are
12461 in the range of the @code{b} / @code{bl} instructions, so use these instructions
12462 for direct calls. The default is @option{-mlong-calls}.
12463
12464 @item -msmall16
12465 @opindex msmall16
12466 Assume addresses can be loaded as 16-bit unsigned values. This does not
12467 apply to function addresses for which @option{-mlong-calls} semantics
12468 are in effect.
12469
12470 @item -mfp-mode=@var{mode}
12471 @opindex mfp-mode
12472 Set the prevailing mode of the floating-point unit.
12473 This determines the floating-point mode that is provided and expected
12474 at function call and return time. Making this mode match the mode you
12475 predominantly need at function start can make your programs smaller and
12476 faster by avoiding unnecessary mode switches.
12477
12478 @var{mode} can be set to one the following values:
12479
12480 @table @samp
12481 @item caller
12482 Any mode at function entry is valid, and retained or restored when
12483 the function returns, and when it calls other functions.
12484 This mode is useful for compiling libraries or other compilation units
12485 you might want to incorporate into different programs with different
12486 prevailing FPU modes, and the convenience of being able to use a single
12487 object file outweighs the size and speed overhead for any extra
12488 mode switching that might be needed, compared with what would be needed
12489 with a more specific choice of prevailing FPU mode.
12490
12491 @item truncate
12492 This is the mode used for floating-point calculations with
12493 truncating (i.e.@: round towards zero) rounding mode. That includes
12494 conversion from floating point to integer.
12495
12496 @item round-nearest
12497 This is the mode used for floating-point calculations with
12498 round-to-nearest-or-even rounding mode.
12499
12500 @item int
12501 This is the mode used to perform integer calculations in the FPU, e.g.@:
12502 integer multiply, or integer multiply-and-accumulate.
12503 @end table
12504
12505 The default is @option{-mfp-mode=caller}
12506
12507 @item -mnosplit-lohi
12508 @itemx -mno-postinc
12509 @itemx -mno-postmodify
12510 @opindex mnosplit-lohi
12511 @opindex mno-postinc
12512 @opindex mno-postmodify
12513 Code generation tweaks that disable, respectively, splitting of 32-bit
12514 loads, generation of post-increment addresses, and generation of
12515 post-modify addresses. The defaults are @option{msplit-lohi},
12516 @option{-mpost-inc}, and @option{-mpost-modify}.
12517
12518 @item -mnovect-double
12519 @opindex mno-vect-double
12520 Change the preferred SIMD mode to SImode. The default is
12521 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
12522
12523 @item -max-vect-align=@var{num}
12524 @opindex max-vect-align
12525 The maximum alignment for SIMD vector mode types.
12526 @var{num} may be 4 or 8. The default is 8.
12527 Note that this is an ABI change, even though many library function
12528 interfaces are unaffected if they don't use SIMD vector modes
12529 in places that affect size and/or alignment of relevant types.
12530
12531 @item -msplit-vecmove-early
12532 @opindex msplit-vecmove-early
12533 Split vector moves into single word moves before reload. In theory this
12534 can give better register allocation, but so far the reverse seems to be
12535 generally the case.
12536
12537 @item -m1reg-@var{reg}
12538 @opindex m1reg-
12539 Specify a register to hold the constant @minus{}1, which makes loading small negative
12540 constants and certain bitmasks faster.
12541 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
12542 which specify use of that register as a fixed register,
12543 and @samp{none}, which means that no register is used for this
12544 purpose. The default is @option{-m1reg-none}.
12545
12546 @end table
12547
12548 @node ARC Options
12549 @subsection ARC Options
12550 @cindex ARC options
12551
12552 The following options control the architecture variant for which code
12553 is being compiled:
12554
12555 @c architecture variants
12556 @table @gcctabopt
12557
12558 @item -mbarrel-shifter
12559 @opindex mbarrel-shifter
12560 Generate instructions supported by barrel shifter. This is the default
12561 unless @option{-mcpu=ARC601} is in effect.
12562
12563 @item -mcpu=@var{cpu}
12564 @opindex mcpu
12565 Set architecture type, register usage, and instruction scheduling
12566 parameters for @var{cpu}. There are also shortcut alias options
12567 available for backward compatibility and convenience. Supported
12568 values for @var{cpu} are
12569
12570 @table @samp
12571 @opindex mA6
12572 @opindex mARC600
12573 @item ARC600
12574 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
12575
12576 @item ARC601
12577 @opindex mARC601
12578 Compile for ARC601. Alias: @option{-mARC601}.
12579
12580 @item ARC700
12581 @opindex mA7
12582 @opindex mARC700
12583 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
12584 This is the default when configured with @option{--with-cpu=arc700}@.
12585 @end table
12586
12587 @item -mdpfp
12588 @opindex mdpfp
12589 @itemx -mdpfp-compact
12590 @opindex mdpfp-compact
12591 FPX: Generate Double Precision FPX instructions, tuned for the compact
12592 implementation.
12593
12594 @item -mdpfp-fast
12595 @opindex mdpfp-fast
12596 FPX: Generate Double Precision FPX instructions, tuned for the fast
12597 implementation.
12598
12599 @item -mno-dpfp-lrsr
12600 @opindex mno-dpfp-lrsr
12601 Disable LR and SR instructions from using FPX extension aux registers.
12602
12603 @item -mea
12604 @opindex mea
12605 Generate Extended arithmetic instructions. Currently only
12606 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
12607 supported. This is always enabled for @option{-mcpu=ARC700}.
12608
12609 @item -mno-mpy
12610 @opindex mno-mpy
12611 Do not generate mpy instructions for ARC700.
12612
12613 @item -mmul32x16
12614 @opindex mmul32x16
12615 Generate 32x16 bit multiply and mac instructions.
12616
12617 @item -mmul64
12618 @opindex mmul64
12619 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
12620
12621 @item -mnorm
12622 @opindex mnorm
12623 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
12624 is in effect.
12625
12626 @item -mspfp
12627 @opindex mspfp
12628 @itemx -mspfp-compact
12629 @opindex mspfp-compact
12630 FPX: Generate Single Precision FPX instructions, tuned for the compact
12631 implementation.
12632
12633 @item -mspfp-fast
12634 @opindex mspfp-fast
12635 FPX: Generate Single Precision FPX instructions, tuned for the fast
12636 implementation.
12637
12638 @item -msimd
12639 @opindex msimd
12640 Enable generation of ARC SIMD instructions via target-specific
12641 builtins. Only valid for @option{-mcpu=ARC700}.
12642
12643 @item -msoft-float
12644 @opindex msoft-float
12645 This option ignored; it is provided for compatibility purposes only.
12646 Software floating point code is emitted by default, and this default
12647 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
12648 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
12649 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
12650
12651 @item -mswap
12652 @opindex mswap
12653 Generate swap instructions.
12654
12655 @end table
12656
12657 The following options are passed through to the assembler, and also
12658 define preprocessor macro symbols.
12659
12660 @c Flags used by the assembler, but for which we define preprocessor
12661 @c macro symbols as well.
12662 @table @gcctabopt
12663 @item -mdsp-packa
12664 @opindex mdsp-packa
12665 Passed down to the assembler to enable the DSP Pack A extensions.
12666 Also sets the preprocessor symbol @code{__Xdsp_packa}.
12667
12668 @item -mdvbf
12669 @opindex mdvbf
12670 Passed down to the assembler to enable the dual viterbi butterfly
12671 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
12672
12673 @c ARC700 4.10 extension instruction
12674 @item -mlock
12675 @opindex mlock
12676 Passed down to the assembler to enable the Locked Load/Store
12677 Conditional extension. Also sets the preprocessor symbol
12678 @code{__Xlock}.
12679
12680 @item -mmac-d16
12681 @opindex mmac-d16
12682 Passed down to the assembler. Also sets the preprocessor symbol
12683 @code{__Xxmac_d16}.
12684
12685 @item -mmac-24
12686 @opindex mmac-24
12687 Passed down to the assembler. Also sets the preprocessor symbol
12688 @code{__Xxmac_24}.
12689
12690 @c ARC700 4.10 extension instruction
12691 @item -mrtsc
12692 @opindex mrtsc
12693 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
12694 extension instruction. Also sets the preprocessor symbol
12695 @code{__Xrtsc}.
12696
12697 @c ARC700 4.10 extension instruction
12698 @item -mswape
12699 @opindex mswape
12700 Passed down to the assembler to enable the swap byte ordering
12701 extension instruction. Also sets the preprocessor symbol
12702 @code{__Xswape}.
12703
12704 @item -mtelephony
12705 @opindex mtelephony
12706 Passed down to the assembler to enable dual and single operand
12707 instructions for telephony. Also sets the preprocessor symbol
12708 @code{__Xtelephony}.
12709
12710 @item -mxy
12711 @opindex mxy
12712 Passed down to the assembler to enable the XY Memory extension. Also
12713 sets the preprocessor symbol @code{__Xxy}.
12714
12715 @end table
12716
12717 The following options control how the assembly code is annotated:
12718
12719 @c Assembly annotation options
12720 @table @gcctabopt
12721 @item -misize
12722 @opindex misize
12723 Annotate assembler instructions with estimated addresses.
12724
12725 @item -mannotate-align
12726 @opindex mannotate-align
12727 Explain what alignment considerations lead to the decision to make an
12728 instruction short or long.
12729
12730 @end table
12731
12732 The following options are passed through to the linker:
12733
12734 @c options passed through to the linker
12735 @table @gcctabopt
12736 @item -marclinux
12737 @opindex marclinux
12738 Passed through to the linker, to specify use of the @code{arclinux} emulation.
12739 This option is enabled by default in tool chains built for
12740 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
12741 when profiling is not requested.
12742
12743 @item -marclinux_prof
12744 @opindex marclinux_prof
12745 Passed through to the linker, to specify use of the
12746 @code{arclinux_prof} emulation. This option is enabled by default in
12747 tool chains built for @w{@code{arc-linux-uclibc}} and
12748 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
12749
12750 @end table
12751
12752 The following options control the semantics of generated code:
12753
12754 @c semantically relevant code generation options
12755 @table @gcctabopt
12756 @item -mepilogue-cfi
12757 @opindex mepilogue-cfi
12758 Enable generation of call frame information for epilogues.
12759
12760 @item -mno-epilogue-cfi
12761 @opindex mno-epilogue-cfi
12762 Disable generation of call frame information for epilogues.
12763
12764 @item -mlong-calls
12765 @opindex mlong-calls
12766 Generate call insns as register indirect calls, thus providing access
12767 to the full 32-bit address range.
12768
12769 @item -mmedium-calls
12770 @opindex mmedium-calls
12771 Don't use less than 25 bit addressing range for calls, which is the
12772 offset available for an unconditional branch-and-link
12773 instruction. Conditional execution of function calls is suppressed, to
12774 allow use of the 25-bit range, rather than the 21-bit range with
12775 conditional branch-and-link. This is the default for tool chains built
12776 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
12777
12778 @item -mno-sdata
12779 @opindex mno-sdata
12780 Do not generate sdata references. This is the default for tool chains
12781 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
12782 targets.
12783
12784 @item -mucb-mcount
12785 @opindex mucb-mcount
12786 Instrument with mcount calls as used in UCB code. I.e. do the
12787 counting in the callee, not the caller. By default ARC instrumentation
12788 counts in the caller.
12789
12790 @item -mvolatile-cache
12791 @opindex mvolatile-cache
12792 Use ordinarily cached memory accesses for volatile references. This is the
12793 default.
12794
12795 @item -mno-volatile-cache
12796 @opindex mno-volatile-cache
12797 Enable cache bypass for volatile references.
12798
12799 @end table
12800
12801 The following options fine tune code generation:
12802 @c code generation tuning options
12803 @table @gcctabopt
12804 @item -malign-call
12805 @opindex malign-call
12806 Do alignment optimizations for call instructions.
12807
12808 @item -mauto-modify-reg
12809 @opindex mauto-modify-reg
12810 Enable the use of pre/post modify with register displacement.
12811
12812 @item -mbbit-peephole
12813 @opindex mbbit-peephole
12814 Enable bbit peephole2.
12815
12816 @item -mno-brcc
12817 @opindex mno-brcc
12818 This option disables a target-specific pass in @file{arc_reorg} to
12819 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
12820 generation driven by the combiner pass.
12821
12822 @item -mcase-vector-pcrel
12823 @opindex mcase-vector-pcrel
12824 Use pc-relative switch case tables - this enables case table shortening.
12825 This is the default for @option{-Os}.
12826
12827 @item -mcompact-casesi
12828 @opindex mcompact-casesi
12829 Enable compact casesi pattern.
12830 This is the default for @option{-Os}.
12831
12832 @item -mno-cond-exec
12833 @opindex mno-cond-exec
12834 Disable ARCompact specific pass to generate conditional execution instructions.
12835 Due to delay slot scheduling and interactions between operand numbers,
12836 literal sizes, instruction lengths, and the support for conditional execution,
12837 the target-independent pass to generate conditional execution is often lacking,
12838 so the ARC port has kept a special pass around that tries to find more
12839 conditional execution generating opportunities after register allocation,
12840 branch shortening, and delay slot scheduling have been done. This pass
12841 generally, but not always, improves performance and code size, at the cost of
12842 extra compilation time, which is why there is an option to switch it off.
12843 If you have a problem with call instructions exceeding their allowable
12844 offset range because they are conditionalized, you should consider using
12845 @option{-mmedium-calls} instead.
12846
12847 @item -mearly-cbranchsi
12848 @opindex mearly-cbranchsi
12849 Enable pre-reload use of the cbranchsi pattern.
12850
12851 @item -mexpand-adddi
12852 @opindex mexpand-adddi
12853 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
12854 @code{add.f}, @code{adc} etc.
12855
12856 @item -mindexed-loads
12857 @opindex mindexed-loads
12858 Enable the use of indexed loads. This can be problematic because some
12859 optimizers then assume that indexed stores exist, which is not
12860 the case.
12861
12862 @item -mlra
12863 @opindex mlra
12864 Enable Local Register Allocation. This is still experimental for ARC,
12865 so by default the compiler uses standard reload
12866 (i.e. @option{-mno-lra}).
12867
12868 @item -mlra-priority-none
12869 @opindex mlra-priority-none
12870 Don't indicate any priority for target registers.
12871
12872 @item -mlra-priority-compact
12873 @opindex mlra-priority-compact
12874 Indicate target register priority for r0..r3 / r12..r15.
12875
12876 @item -mlra-priority-noncompact
12877 @opindex mlra-priority-noncompact
12878 Reduce target regsiter priority for r0..r3 / r12..r15.
12879
12880 @item -mno-millicode
12881 @opindex mno-millicode
12882 When optimizing for size (using @option{-Os}), prologues and epilogues
12883 that have to save or restore a large number of registers are often
12884 shortened by using call to a special function in libgcc; this is
12885 referred to as a @emph{millicode} call. As these calls can pose
12886 performance issues, and/or cause linking issues when linking in a
12887 nonstandard way, this option is provided to turn off millicode call
12888 generation.
12889
12890 @item -mmixed-code
12891 @opindex mmixed-code
12892 Tweak register allocation to help 16-bit instruction generation.
12893 This generally has the effect of decreasing the average instruction size
12894 while increasing the instruction count.
12895
12896 @item -mq-class
12897 @opindex mq-class
12898 Enable 'q' instruction alternatives.
12899 This is the default for @option{-Os}.
12900
12901 @item -mRcq
12902 @opindex mRcq
12903 Enable Rcq constraint handling - most short code generation depends on this.
12904 This is the default.
12905
12906 @item -mRcw
12907 @opindex mRcw
12908 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
12909 This is the default.
12910
12911 @item -msize-level=@var{level}
12912 @opindex msize-level
12913 Fine-tune size optimization with regards to instruction lengths and alignment.
12914 The recognized values for @var{level} are:
12915 @table @samp
12916 @item 0
12917 No size optimization. This level is deprecated and treated like @samp{1}.
12918
12919 @item 1
12920 Short instructions are used opportunistically.
12921
12922 @item 2
12923 In addition, alignment of loops and of code after barriers are dropped.
12924
12925 @item 3
12926 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
12927
12928 @end table
12929
12930 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
12931 the behavior when this is not set is equivalent to level @samp{1}.
12932
12933 @item -mtune=@var{cpu}
12934 @opindex mtune
12935 Set instruction scheduling parameters for @var{cpu}, overriding any implied
12936 by @option{-mcpu=}.
12937
12938 Supported values for @var{cpu} are
12939
12940 @table @samp
12941 @item ARC600
12942 Tune for ARC600 cpu.
12943
12944 @item ARC601
12945 Tune for ARC601 cpu.
12946
12947 @item ARC700
12948 Tune for ARC700 cpu with standard multiplier block.
12949
12950 @item ARC700-xmac
12951 Tune for ARC700 cpu with XMAC block.
12952
12953 @item ARC725D
12954 Tune for ARC725D cpu.
12955
12956 @item ARC750D
12957 Tune for ARC750D cpu.
12958
12959 @end table
12960
12961 @item -mmultcost=@var{num}
12962 @opindex mmultcost
12963 Cost to assume for a multiply instruction, with @samp{4} being equal to a
12964 normal instruction.
12965
12966 @item -munalign-prob-threshold=@var{probability}
12967 @opindex munalign-prob-threshold
12968 Set probability threshold for unaligning branches.
12969 When tuning for @samp{ARC700} and optimizing for speed, branches without
12970 filled delay slot are preferably emitted unaligned and long, unless
12971 profiling indicates that the probability for the branch to be taken
12972 is below @var{probability}. @xref{Cross-profiling}.
12973 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
12974
12975 @end table
12976
12977 The following options are maintained for backward compatibility, but
12978 are now deprecated and will be removed in a future release:
12979
12980 @c Deprecated options
12981 @table @gcctabopt
12982
12983 @item -margonaut
12984 @opindex margonaut
12985 Obsolete FPX.
12986
12987 @item -mbig-endian
12988 @opindex mbig-endian
12989 @itemx -EB
12990 @opindex EB
12991 Compile code for big endian targets. Use of these options is now
12992 deprecated. Users wanting big-endian code, should use the
12993 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
12994 building the tool chain, for which big-endian is the default.
12995
12996 @item -mlittle-endian
12997 @opindex mlittle-endian
12998 @itemx -EL
12999 @opindex EL
13000 Compile code for little endian targets. Use of these options is now
13001 deprecated. Users wanting little-endian code should use the
13002 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
13003 building the tool chain, for which little-endian is the default.
13004
13005 @item -mbarrel_shifter
13006 @opindex mbarrel_shifter
13007 Replaced by @option{-mbarrel-shifter}.
13008
13009 @item -mdpfp_compact
13010 @opindex mdpfp_compact
13011 Replaced by @option{-mdpfp-compact}.
13012
13013 @item -mdpfp_fast
13014 @opindex mdpfp_fast
13015 Replaced by @option{-mdpfp-fast}.
13016
13017 @item -mdsp_packa
13018 @opindex mdsp_packa
13019 Replaced by @option{-mdsp-packa}.
13020
13021 @item -mEA
13022 @opindex mEA
13023 Replaced by @option{-mea}.
13024
13025 @item -mmac_24
13026 @opindex mmac_24
13027 Replaced by @option{-mmac-24}.
13028
13029 @item -mmac_d16
13030 @opindex mmac_d16
13031 Replaced by @option{-mmac-d16}.
13032
13033 @item -mspfp_compact
13034 @opindex mspfp_compact
13035 Replaced by @option{-mspfp-compact}.
13036
13037 @item -mspfp_fast
13038 @opindex mspfp_fast
13039 Replaced by @option{-mspfp-fast}.
13040
13041 @item -mtune=@var{cpu}
13042 @opindex mtune
13043 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
13044 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
13045 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
13046
13047 @item -multcost=@var{num}
13048 @opindex multcost
13049 Replaced by @option{-mmultcost}.
13050
13051 @end table
13052
13053 @node ARM Options
13054 @subsection ARM Options
13055 @cindex ARM options
13056
13057 These @samp{-m} options are defined for the ARM port:
13058
13059 @table @gcctabopt
13060 @item -mabi=@var{name}
13061 @opindex mabi
13062 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
13063 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
13064
13065 @item -mapcs-frame
13066 @opindex mapcs-frame
13067 Generate a stack frame that is compliant with the ARM Procedure Call
13068 Standard for all functions, even if this is not strictly necessary for
13069 correct execution of the code. Specifying @option{-fomit-frame-pointer}
13070 with this option causes the stack frames not to be generated for
13071 leaf functions. The default is @option{-mno-apcs-frame}.
13072 This option is deprecated.
13073
13074 @item -mapcs
13075 @opindex mapcs
13076 This is a synonym for @option{-mapcs-frame} and is deprecated.
13077
13078 @ignore
13079 @c not currently implemented
13080 @item -mapcs-stack-check
13081 @opindex mapcs-stack-check
13082 Generate code to check the amount of stack space available upon entry to
13083 every function (that actually uses some stack space). If there is
13084 insufficient space available then either the function
13085 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
13086 called, depending upon the amount of stack space required. The runtime
13087 system is required to provide these functions. The default is
13088 @option{-mno-apcs-stack-check}, since this produces smaller code.
13089
13090 @c not currently implemented
13091 @item -mapcs-float
13092 @opindex mapcs-float
13093 Pass floating-point arguments using the floating-point registers. This is
13094 one of the variants of the APCS@. This option is recommended if the
13095 target hardware has a floating-point unit or if a lot of floating-point
13096 arithmetic is going to be performed by the code. The default is
13097 @option{-mno-apcs-float}, since the size of integer-only code is
13098 slightly increased if @option{-mapcs-float} is used.
13099
13100 @c not currently implemented
13101 @item -mapcs-reentrant
13102 @opindex mapcs-reentrant
13103 Generate reentrant, position-independent code. The default is
13104 @option{-mno-apcs-reentrant}.
13105 @end ignore
13106
13107 @item -mthumb-interwork
13108 @opindex mthumb-interwork
13109 Generate code that supports calling between the ARM and Thumb
13110 instruction sets. Without this option, on pre-v5 architectures, the
13111 two instruction sets cannot be reliably used inside one program. The
13112 default is @option{-mno-thumb-interwork}, since slightly larger code
13113 is generated when @option{-mthumb-interwork} is specified. In AAPCS
13114 configurations this option is meaningless.
13115
13116 @item -mno-sched-prolog
13117 @opindex mno-sched-prolog
13118 Prevent the reordering of instructions in the function prologue, or the
13119 merging of those instruction with the instructions in the function's
13120 body. This means that all functions start with a recognizable set
13121 of instructions (or in fact one of a choice from a small set of
13122 different function prologues), and this information can be used to
13123 locate the start of functions inside an executable piece of code. The
13124 default is @option{-msched-prolog}.
13125
13126 @item -mfloat-abi=@var{name}
13127 @opindex mfloat-abi
13128 Specifies which floating-point ABI to use. Permissible values
13129 are: @samp{soft}, @samp{softfp} and @samp{hard}.
13130
13131 Specifying @samp{soft} causes GCC to generate output containing
13132 library calls for floating-point operations.
13133 @samp{softfp} allows the generation of code using hardware floating-point
13134 instructions, but still uses the soft-float calling conventions.
13135 @samp{hard} allows generation of floating-point instructions
13136 and uses FPU-specific calling conventions.
13137
13138 The default depends on the specific target configuration. Note that
13139 the hard-float and soft-float ABIs are not link-compatible; you must
13140 compile your entire program with the same ABI, and link with a
13141 compatible set of libraries.
13142
13143 @item -mlittle-endian
13144 @opindex mlittle-endian
13145 Generate code for a processor running in little-endian mode. This is
13146 the default for all standard configurations.
13147
13148 @item -mbig-endian
13149 @opindex mbig-endian
13150 Generate code for a processor running in big-endian mode; the default is
13151 to compile code for a little-endian processor.
13152
13153 @item -march=@var{name}
13154 @opindex march
13155 This specifies the name of the target ARM architecture. GCC uses this
13156 name to determine what kind of instructions it can emit when generating
13157 assembly code. This option can be used in conjunction with or instead
13158 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
13159 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
13160 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
13161 @samp{armv6}, @samp{armv6j},
13162 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
13163 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m},
13164 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc},
13165 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
13166
13167 @option{-march=armv7ve} is the armv7-a architecture with virtualization
13168 extensions.
13169
13170 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
13171 architecture together with the optional CRC32 extensions.
13172
13173 @option{-march=native} causes the compiler to auto-detect the architecture
13174 of the build computer. At present, this feature is only supported on
13175 GNU/Linux, and not all architectures are recognized. If the auto-detect
13176 is unsuccessful the option has no effect.
13177
13178 @item -mtune=@var{name}
13179 @opindex mtune
13180 This option specifies the name of the target ARM processor for
13181 which GCC should tune the performance of the code.
13182 For some ARM implementations better performance can be obtained by using
13183 this option.
13184 Permissible names are: @samp{arm2}, @samp{arm250},
13185 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
13186 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
13187 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
13188 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
13189 @samp{arm720},
13190 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
13191 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
13192 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
13193 @samp{strongarm1110},
13194 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
13195 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
13196 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
13197 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
13198 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
13199 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
13200 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
13201 @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9},
13202 @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a53},
13203 @samp{cortex-a57}, @samp{cortex-a72},
13204 @samp{cortex-r4},
13205 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-m7},
13206 @samp{cortex-m4},
13207 @samp{cortex-m3},
13208 @samp{cortex-m1},
13209 @samp{cortex-m0},
13210 @samp{cortex-m0plus},
13211 @samp{cortex-m1.small-multiply},
13212 @samp{cortex-m0.small-multiply},
13213 @samp{cortex-m0plus.small-multiply},
13214 @samp{marvell-pj4},
13215 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
13216 @samp{fa526}, @samp{fa626},
13217 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
13218 @samp{xgene1}.
13219
13220 Additionally, this option can specify that GCC should tune the performance
13221 of the code for a big.LITTLE system. Permissible names are:
13222 @samp{cortex-a15.cortex-a7}, @samp{cortex-a57.cortex-a53},
13223 @samp{cortex-a72.cortex-a53}.
13224
13225 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
13226 performance for a blend of processors within architecture @var{arch}.
13227 The aim is to generate code that run well on the current most popular
13228 processors, balancing between optimizations that benefit some CPUs in the
13229 range, and avoiding performance pitfalls of other CPUs. The effects of
13230 this option may change in future GCC versions as CPU models come and go.
13231
13232 @option{-mtune=native} causes the compiler to auto-detect the CPU
13233 of the build computer. At present, this feature is only supported on
13234 GNU/Linux, and not all architectures are recognized. If the auto-detect is
13235 unsuccessful the option has no effect.
13236
13237 @item -mcpu=@var{name}
13238 @opindex mcpu
13239 This specifies the name of the target ARM processor. GCC uses this name
13240 to derive the name of the target ARM architecture (as if specified
13241 by @option{-march}) and the ARM processor type for which to tune for
13242 performance (as if specified by @option{-mtune}). Where this option
13243 is used in conjunction with @option{-march} or @option{-mtune},
13244 those options take precedence over the appropriate part of this option.
13245
13246 Permissible names for this option are the same as those for
13247 @option{-mtune}.
13248
13249 @option{-mcpu=generic-@var{arch}} is also permissible, and is
13250 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
13251 See @option{-mtune} for more information.
13252
13253 @option{-mcpu=native} causes the compiler to auto-detect the CPU
13254 of the build computer. At present, this feature is only supported on
13255 GNU/Linux, and not all architectures are recognized. If the auto-detect
13256 is unsuccessful the option has no effect.
13257
13258 @item -mfpu=@var{name}
13259 @opindex mfpu
13260 This specifies what floating-point hardware (or hardware emulation) is
13261 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
13262 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
13263 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
13264 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
13265 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
13266 @samp{fp-armv8}, @samp{neon-fp-armv8}, and @samp{crypto-neon-fp-armv8}.
13267
13268 If @option{-msoft-float} is specified this specifies the format of
13269 floating-point values.
13270
13271 If the selected floating-point hardware includes the NEON extension
13272 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
13273 operations are not generated by GCC's auto-vectorization pass unless
13274 @option{-funsafe-math-optimizations} is also specified. This is
13275 because NEON hardware does not fully implement the IEEE 754 standard for
13276 floating-point arithmetic (in particular denormal values are treated as
13277 zero), so the use of NEON instructions may lead to a loss of precision.
13278
13279 @item -mfp16-format=@var{name}
13280 @opindex mfp16-format
13281 Specify the format of the @code{__fp16} half-precision floating-point type.
13282 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
13283 the default is @samp{none}, in which case the @code{__fp16} type is not
13284 defined. @xref{Half-Precision}, for more information.
13285
13286 @item -mstructure-size-boundary=@var{n}
13287 @opindex mstructure-size-boundary
13288 The sizes of all structures and unions are rounded up to a multiple
13289 of the number of bits set by this option. Permissible values are 8, 32
13290 and 64. The default value varies for different toolchains. For the COFF
13291 targeted toolchain the default value is 8. A value of 64 is only allowed
13292 if the underlying ABI supports it.
13293
13294 Specifying a larger number can produce faster, more efficient code, but
13295 can also increase the size of the program. Different values are potentially
13296 incompatible. Code compiled with one value cannot necessarily expect to
13297 work with code or libraries compiled with another value, if they exchange
13298 information using structures or unions.
13299
13300 @item -mabort-on-noreturn
13301 @opindex mabort-on-noreturn
13302 Generate a call to the function @code{abort} at the end of a
13303 @code{noreturn} function. It is executed if the function tries to
13304 return.
13305
13306 @item -mlong-calls
13307 @itemx -mno-long-calls
13308 @opindex mlong-calls
13309 @opindex mno-long-calls
13310 Tells the compiler to perform function calls by first loading the
13311 address of the function into a register and then performing a subroutine
13312 call on this register. This switch is needed if the target function
13313 lies outside of the 64-megabyte addressing range of the offset-based
13314 version of subroutine call instruction.
13315
13316 Even if this switch is enabled, not all function calls are turned
13317 into long calls. The heuristic is that static functions, functions
13318 that have the @code{short_call} attribute, functions that are inside
13319 the scope of a @code{#pragma no_long_calls} directive, and functions whose
13320 definitions have already been compiled within the current compilation
13321 unit are not turned into long calls. The exceptions to this rule are
13322 that weak function definitions, functions with the @code{long_call}
13323 attribute or the @code{section} attribute, and functions that are within
13324 the scope of a @code{#pragma long_calls} directive are always
13325 turned into long calls.
13326
13327 This feature is not enabled by default. Specifying
13328 @option{-mno-long-calls} restores the default behavior, as does
13329 placing the function calls within the scope of a @code{#pragma
13330 long_calls_off} directive. Note these switches have no effect on how
13331 the compiler generates code to handle function calls via function
13332 pointers.
13333
13334 @item -msingle-pic-base
13335 @opindex msingle-pic-base
13336 Treat the register used for PIC addressing as read-only, rather than
13337 loading it in the prologue for each function. The runtime system is
13338 responsible for initializing this register with an appropriate value
13339 before execution begins.
13340
13341 @item -mpic-register=@var{reg}
13342 @opindex mpic-register
13343 Specify the register to be used for PIC addressing.
13344 For standard PIC base case, the default is any suitable register
13345 determined by compiler. For single PIC base case, the default is
13346 @samp{R9} if target is EABI based or stack-checking is enabled,
13347 otherwise the default is @samp{R10}.
13348
13349 @item -mpic-data-is-text-relative
13350 @opindex mpic-data-is-text-relative
13351 Assume that each data segments are relative to text segment at load time.
13352 Therefore, it permits addressing data using PC-relative operations.
13353 This option is on by default for targets other than VxWorks RTP.
13354
13355 @item -mpoke-function-name
13356 @opindex mpoke-function-name
13357 Write the name of each function into the text section, directly
13358 preceding the function prologue. The generated code is similar to this:
13359
13360 @smallexample
13361 t0
13362 .ascii "arm_poke_function_name", 0
13363 .align
13364 t1
13365 .word 0xff000000 + (t1 - t0)
13366 arm_poke_function_name
13367 mov ip, sp
13368 stmfd sp!, @{fp, ip, lr, pc@}
13369 sub fp, ip, #4
13370 @end smallexample
13371
13372 When performing a stack backtrace, code can inspect the value of
13373 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
13374 location @code{pc - 12} and the top 8 bits are set, then we know that
13375 there is a function name embedded immediately preceding this location
13376 and has length @code{((pc[-3]) & 0xff000000)}.
13377
13378 @item -mthumb
13379 @itemx -marm
13380 @opindex marm
13381 @opindex mthumb
13382
13383 Select between generating code that executes in ARM and Thumb
13384 states. The default for most configurations is to generate code
13385 that executes in ARM state, but the default can be changed by
13386 configuring GCC with the @option{--with-mode=}@var{state}
13387 configure option.
13388
13389 @item -mtpcs-frame
13390 @opindex mtpcs-frame
13391 Generate a stack frame that is compliant with the Thumb Procedure Call
13392 Standard for all non-leaf functions. (A leaf function is one that does
13393 not call any other functions.) The default is @option{-mno-tpcs-frame}.
13394
13395 @item -mtpcs-leaf-frame
13396 @opindex mtpcs-leaf-frame
13397 Generate a stack frame that is compliant with the Thumb Procedure Call
13398 Standard for all leaf functions. (A leaf function is one that does
13399 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
13400
13401 @item -mcallee-super-interworking
13402 @opindex mcallee-super-interworking
13403 Gives all externally visible functions in the file being compiled an ARM
13404 instruction set header which switches to Thumb mode before executing the
13405 rest of the function. This allows these functions to be called from
13406 non-interworking code. This option is not valid in AAPCS configurations
13407 because interworking is enabled by default.
13408
13409 @item -mcaller-super-interworking
13410 @opindex mcaller-super-interworking
13411 Allows calls via function pointers (including virtual functions) to
13412 execute correctly regardless of whether the target code has been
13413 compiled for interworking or not. There is a small overhead in the cost
13414 of executing a function pointer if this option is enabled. This option
13415 is not valid in AAPCS configurations because interworking is enabled
13416 by default.
13417
13418 @item -mtp=@var{name}
13419 @opindex mtp
13420 Specify the access model for the thread local storage pointer. The valid
13421 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
13422 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
13423 (supported in the arm6k architecture), and @samp{auto}, which uses the
13424 best available method for the selected processor. The default setting is
13425 @samp{auto}.
13426
13427 @item -mtls-dialect=@var{dialect}
13428 @opindex mtls-dialect
13429 Specify the dialect to use for accessing thread local storage. Two
13430 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
13431 @samp{gnu} dialect selects the original GNU scheme for supporting
13432 local and global dynamic TLS models. The @samp{gnu2} dialect
13433 selects the GNU descriptor scheme, which provides better performance
13434 for shared libraries. The GNU descriptor scheme is compatible with
13435 the original scheme, but does require new assembler, linker and
13436 library support. Initial and local exec TLS models are unaffected by
13437 this option and always use the original scheme.
13438
13439 @item -mword-relocations
13440 @opindex mword-relocations
13441 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
13442 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
13443 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
13444 is specified.
13445
13446 @item -mfix-cortex-m3-ldrd
13447 @opindex mfix-cortex-m3-ldrd
13448 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
13449 with overlapping destination and base registers are used. This option avoids
13450 generating these instructions. This option is enabled by default when
13451 @option{-mcpu=cortex-m3} is specified.
13452
13453 @item -munaligned-access
13454 @itemx -mno-unaligned-access
13455 @opindex munaligned-access
13456 @opindex mno-unaligned-access
13457 Enables (or disables) reading and writing of 16- and 32- bit values
13458 from addresses that are not 16- or 32- bit aligned. By default
13459 unaligned access is disabled for all pre-ARMv6 and all ARMv6-M
13460 architectures, and enabled for all other architectures. If unaligned
13461 access is not enabled then words in packed data structures are
13462 accessed a byte at a time.
13463
13464 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
13465 generated object file to either true or false, depending upon the
13466 setting of this option. If unaligned access is enabled then the
13467 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
13468 defined.
13469
13470 @item -mneon-for-64bits
13471 @opindex mneon-for-64bits
13472 Enables using Neon to handle scalar 64-bits operations. This is
13473 disabled by default since the cost of moving data from core registers
13474 to Neon is high.
13475
13476 @item -mslow-flash-data
13477 @opindex mslow-flash-data
13478 Assume loading data from flash is slower than fetching instruction.
13479 Therefore literal load is minimized for better performance.
13480 This option is only supported when compiling for ARMv7 M-profile and
13481 off by default.
13482
13483 @item -masm-syntax-unified
13484 @opindex masm-syntax-unified
13485 Assume inline assembler is using unified asm syntax. The default is
13486 currently off which implies divided syntax. Currently this option is
13487 available only for Thumb1 and has no effect on ARM state and Thumb2.
13488 However, this may change in future releases of GCC. Divided syntax
13489 should be considered deprecated.
13490
13491 @item -mrestrict-it
13492 @opindex mrestrict-it
13493 Restricts generation of IT blocks to conform to the rules of ARMv8.
13494 IT blocks can only contain a single 16-bit instruction from a select
13495 set of instructions. This option is on by default for ARMv8 Thumb mode.
13496
13497 @item -mprint-tune-info
13498 @opindex mprint-tune-info
13499 Print CPU tuning information as comment in assembler file. This is
13500 an option used only for regression testing of the compiler and not
13501 intended for ordinary use in compiling code. This option is disabled
13502 by default.
13503 @end table
13504
13505 @node AVR Options
13506 @subsection AVR Options
13507 @cindex AVR Options
13508
13509 These options are defined for AVR implementations:
13510
13511 @table @gcctabopt
13512 @item -mmcu=@var{mcu}
13513 @opindex mmcu
13514 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
13515
13516 The default for this option is@tie{}@samp{avr2}.
13517
13518 GCC supports the following AVR devices and ISAs:
13519
13520 @include avr-mmcu.texi
13521
13522 @item -maccumulate-args
13523 @opindex maccumulate-args
13524 Accumulate outgoing function arguments and acquire/release the needed
13525 stack space for outgoing function arguments once in function
13526 prologue/epilogue. Without this option, outgoing arguments are pushed
13527 before calling a function and popped afterwards.
13528
13529 Popping the arguments after the function call can be expensive on
13530 AVR so that accumulating the stack space might lead to smaller
13531 executables because arguments need not to be removed from the
13532 stack after such a function call.
13533
13534 This option can lead to reduced code size for functions that perform
13535 several calls to functions that get their arguments on the stack like
13536 calls to printf-like functions.
13537
13538 @item -mbranch-cost=@var{cost}
13539 @opindex mbranch-cost
13540 Set the branch costs for conditional branch instructions to
13541 @var{cost}. Reasonable values for @var{cost} are small, non-negative
13542 integers. The default branch cost is 0.
13543
13544 @item -mcall-prologues
13545 @opindex mcall-prologues
13546 Functions prologues/epilogues are expanded as calls to appropriate
13547 subroutines. Code size is smaller.
13548
13549 @item -mint8
13550 @opindex mint8
13551 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
13552 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
13553 and @code{long long} is 4 bytes. Please note that this option does not
13554 conform to the C standards, but it results in smaller code
13555 size.
13556
13557 @item -mn-flash=@var{num}
13558 @opindex mn-flash
13559 Assume that the flash memory has a size of
13560 @var{num} times 64@tie{}KiB.
13561
13562 @item -mno-interrupts
13563 @opindex mno-interrupts
13564 Generated code is not compatible with hardware interrupts.
13565 Code size is smaller.
13566
13567 @item -mrelax
13568 @opindex mrelax
13569 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
13570 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
13571 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
13572 the assembler's command line and the @option{--relax} option to the
13573 linker's command line.
13574
13575 Jump relaxing is performed by the linker because jump offsets are not
13576 known before code is located. Therefore, the assembler code generated by the
13577 compiler is the same, but the instructions in the executable may
13578 differ from instructions in the assembler code.
13579
13580 Relaxing must be turned on if linker stubs are needed, see the
13581 section on @code{EIND} and linker stubs below.
13582
13583 @item -mrmw
13584 @opindex mrmw
13585 Assume that the device supports the Read-Modify-Write
13586 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
13587
13588 @item -msp8
13589 @opindex msp8
13590 Treat the stack pointer register as an 8-bit register,
13591 i.e.@: assume the high byte of the stack pointer is zero.
13592 In general, you don't need to set this option by hand.
13593
13594 This option is used internally by the compiler to select and
13595 build multilibs for architectures @code{avr2} and @code{avr25}.
13596 These architectures mix devices with and without @code{SPH}.
13597 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
13598 the compiler driver adds or removes this option from the compiler
13599 proper's command line, because the compiler then knows if the device
13600 or architecture has an 8-bit stack pointer and thus no @code{SPH}
13601 register or not.
13602
13603 @item -mstrict-X
13604 @opindex mstrict-X
13605 Use address register @code{X} in a way proposed by the hardware. This means
13606 that @code{X} is only used in indirect, post-increment or
13607 pre-decrement addressing.
13608
13609 Without this option, the @code{X} register may be used in the same way
13610 as @code{Y} or @code{Z} which then is emulated by additional
13611 instructions.
13612 For example, loading a value with @code{X+const} addressing with a
13613 small non-negative @code{const < 64} to a register @var{Rn} is
13614 performed as
13615
13616 @example
13617 adiw r26, const ; X += const
13618 ld @var{Rn}, X ; @var{Rn} = *X
13619 sbiw r26, const ; X -= const
13620 @end example
13621
13622 @item -mtiny-stack
13623 @opindex mtiny-stack
13624 Only change the lower 8@tie{}bits of the stack pointer.
13625
13626 @item -nodevicelib
13627 @opindex nodevicelib
13628 Don't link against AVR-LibC's device specific library @code{libdev.a}.
13629
13630 @item -Waddr-space-convert
13631 @opindex Waddr-space-convert
13632 Warn about conversions between address spaces in the case where the
13633 resulting address space is not contained in the incoming address space.
13634 @end table
13635
13636 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
13637 @cindex @code{EIND}
13638 Pointers in the implementation are 16@tie{}bits wide.
13639 The address of a function or label is represented as word address so
13640 that indirect jumps and calls can target any code address in the
13641 range of 64@tie{}Ki words.
13642
13643 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
13644 bytes of program memory space, there is a special function register called
13645 @code{EIND} that serves as most significant part of the target address
13646 when @code{EICALL} or @code{EIJMP} instructions are used.
13647
13648 Indirect jumps and calls on these devices are handled as follows by
13649 the compiler and are subject to some limitations:
13650
13651 @itemize @bullet
13652
13653 @item
13654 The compiler never sets @code{EIND}.
13655
13656 @item
13657 The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP}
13658 instructions or might read @code{EIND} directly in order to emulate an
13659 indirect call/jump by means of a @code{RET} instruction.
13660
13661 @item
13662 The compiler assumes that @code{EIND} never changes during the startup
13663 code or during the application. In particular, @code{EIND} is not
13664 saved/restored in function or interrupt service routine
13665 prologue/epilogue.
13666
13667 @item
13668 For indirect calls to functions and computed goto, the linker
13669 generates @emph{stubs}. Stubs are jump pads sometimes also called
13670 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
13671 The stub contains a direct jump to the desired address.
13672
13673 @item
13674 Linker relaxation must be turned on so that the linker generates
13675 the stubs correctly in all situations. See the compiler option
13676 @option{-mrelax} and the linker option @option{--relax}.
13677 There are corner cases where the linker is supposed to generate stubs
13678 but aborts without relaxation and without a helpful error message.
13679
13680 @item
13681 The default linker script is arranged for code with @code{EIND = 0}.
13682 If code is supposed to work for a setup with @code{EIND != 0}, a custom
13683 linker script has to be used in order to place the sections whose
13684 name start with @code{.trampolines} into the segment where @code{EIND}
13685 points to.
13686
13687 @item
13688 The startup code from libgcc never sets @code{EIND}.
13689 Notice that startup code is a blend of code from libgcc and AVR-LibC.
13690 For the impact of AVR-LibC on @code{EIND}, see the
13691 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
13692
13693 @item
13694 It is legitimate for user-specific startup code to set up @code{EIND}
13695 early, for example by means of initialization code located in
13696 section @code{.init3}. Such code runs prior to general startup code
13697 that initializes RAM and calls constructors, but after the bit
13698 of startup code from AVR-LibC that sets @code{EIND} to the segment
13699 where the vector table is located.
13700 @example
13701 #include <avr/io.h>
13702
13703 static void
13704 __attribute__((section(".init3"),naked,used,no_instrument_function))
13705 init3_set_eind (void)
13706 @{
13707 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
13708 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
13709 @}
13710 @end example
13711
13712 @noindent
13713 The @code{__trampolines_start} symbol is defined in the linker script.
13714
13715 @item
13716 Stubs are generated automatically by the linker if
13717 the following two conditions are met:
13718 @itemize @minus
13719
13720 @item The address of a label is taken by means of the @code{gs} modifier
13721 (short for @emph{generate stubs}) like so:
13722 @example
13723 LDI r24, lo8(gs(@var{func}))
13724 LDI r25, hi8(gs(@var{func}))
13725 @end example
13726 @item The final location of that label is in a code segment
13727 @emph{outside} the segment where the stubs are located.
13728 @end itemize
13729
13730 @item
13731 The compiler emits such @code{gs} modifiers for code labels in the
13732 following situations:
13733 @itemize @minus
13734 @item Taking address of a function or code label.
13735 @item Computed goto.
13736 @item If prologue-save function is used, see @option{-mcall-prologues}
13737 command-line option.
13738 @item Switch/case dispatch tables. If you do not want such dispatch
13739 tables you can specify the @option{-fno-jump-tables} command-line option.
13740 @item C and C++ constructors/destructors called during startup/shutdown.
13741 @item If the tools hit a @code{gs()} modifier explained above.
13742 @end itemize
13743
13744 @item
13745 Jumping to non-symbolic addresses like so is @emph{not} supported:
13746
13747 @example
13748 int main (void)
13749 @{
13750 /* Call function at word address 0x2 */
13751 return ((int(*)(void)) 0x2)();
13752 @}
13753 @end example
13754
13755 Instead, a stub has to be set up, i.e.@: the function has to be called
13756 through a symbol (@code{func_4} in the example):
13757
13758 @example
13759 int main (void)
13760 @{
13761 extern int func_4 (void);
13762
13763 /* Call function at byte address 0x4 */
13764 return func_4();
13765 @}
13766 @end example
13767
13768 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
13769 Alternatively, @code{func_4} can be defined in the linker script.
13770 @end itemize
13771
13772 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
13773 @cindex @code{RAMPD}
13774 @cindex @code{RAMPX}
13775 @cindex @code{RAMPY}
13776 @cindex @code{RAMPZ}
13777 Some AVR devices support memories larger than the 64@tie{}KiB range
13778 that can be accessed with 16-bit pointers. To access memory locations
13779 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
13780 register is used as high part of the address:
13781 The @code{X}, @code{Y}, @code{Z} address register is concatenated
13782 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
13783 register, respectively, to get a wide address. Similarly,
13784 @code{RAMPD} is used together with direct addressing.
13785
13786 @itemize
13787 @item
13788 The startup code initializes the @code{RAMP} special function
13789 registers with zero.
13790
13791 @item
13792 If a @ref{AVR Named Address Spaces,named address space} other than
13793 generic or @code{__flash} is used, then @code{RAMPZ} is set
13794 as needed before the operation.
13795
13796 @item
13797 If the device supports RAM larger than 64@tie{}KiB and the compiler
13798 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
13799 is reset to zero after the operation.
13800
13801 @item
13802 If the device comes with a specific @code{RAMP} register, the ISR
13803 prologue/epilogue saves/restores that SFR and initializes it with
13804 zero in case the ISR code might (implicitly) use it.
13805
13806 @item
13807 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
13808 If you use inline assembler to read from locations outside the
13809 16-bit address range and change one of the @code{RAMP} registers,
13810 you must reset it to zero after the access.
13811
13812 @end itemize
13813
13814 @subsubsection AVR Built-in Macros
13815
13816 GCC defines several built-in macros so that the user code can test
13817 for the presence or absence of features. Almost any of the following
13818 built-in macros are deduced from device capabilities and thus
13819 triggered by the @option{-mmcu=} command-line option.
13820
13821 For even more AVR-specific built-in macros see
13822 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
13823
13824 @table @code
13825
13826 @item __AVR_ARCH__
13827 Build-in macro that resolves to a decimal number that identifies the
13828 architecture and depends on the @option{-mmcu=@var{mcu}} option.
13829 Possible values are:
13830
13831 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
13832 @code{4}, @code{5}, @code{51}, @code{6}
13833
13834 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
13835 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
13836
13837 respectively and
13838
13839 @code{100}, @code{102}, @code{104},
13840 @code{105}, @code{106}, @code{107}
13841
13842 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
13843 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
13844 If @var{mcu} specifies a device, this built-in macro is set
13845 accordingly. For example, with @option{-mmcu=atmega8} the macro is
13846 defined to @code{4}.
13847
13848 @item __AVR_@var{Device}__
13849 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
13850 the device's name. For example, @option{-mmcu=atmega8} defines the
13851 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
13852 @code{__AVR_ATtiny261A__}, etc.
13853
13854 The built-in macros' names follow
13855 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
13856 the device name as from the AVR user manual. The difference between
13857 @var{Device} in the built-in macro and @var{device} in
13858 @option{-mmcu=@var{device}} is that the latter is always lowercase.
13859
13860 If @var{device} is not a device but only a core architecture like
13861 @samp{avr51}, this macro is not defined.
13862
13863 @item __AVR_DEVICE_NAME__
13864 Setting @option{-mmcu=@var{device}} defines this built-in macro to
13865 the device's name. For example, with @option{-mmcu=atmega8} the macro
13866 is defined to @code{atmega8}.
13867
13868 If @var{device} is not a device but only a core architecture like
13869 @samp{avr51}, this macro is not defined.
13870
13871 @item __AVR_XMEGA__
13872 The device / architecture belongs to the XMEGA family of devices.
13873
13874 @item __AVR_HAVE_ELPM__
13875 The device has the the @code{ELPM} instruction.
13876
13877 @item __AVR_HAVE_ELPMX__
13878 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
13879 R@var{n},Z+} instructions.
13880
13881 @item __AVR_HAVE_MOVW__
13882 The device has the @code{MOVW} instruction to perform 16-bit
13883 register-register moves.
13884
13885 @item __AVR_HAVE_LPMX__
13886 The device has the @code{LPM R@var{n},Z} and
13887 @code{LPM R@var{n},Z+} instructions.
13888
13889 @item __AVR_HAVE_MUL__
13890 The device has a hardware multiplier.
13891
13892 @item __AVR_HAVE_JMP_CALL__
13893 The device has the @code{JMP} and @code{CALL} instructions.
13894 This is the case for devices with at least 16@tie{}KiB of program
13895 memory.
13896
13897 @item __AVR_HAVE_EIJMP_EICALL__
13898 @itemx __AVR_3_BYTE_PC__
13899 The device has the @code{EIJMP} and @code{EICALL} instructions.
13900 This is the case for devices with more than 128@tie{}KiB of program memory.
13901 This also means that the program counter
13902 (PC) is 3@tie{}bytes wide.
13903
13904 @item __AVR_2_BYTE_PC__
13905 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
13906 with up to 128@tie{}KiB of program memory.
13907
13908 @item __AVR_HAVE_8BIT_SP__
13909 @itemx __AVR_HAVE_16BIT_SP__
13910 The stack pointer (SP) register is treated as 8-bit respectively
13911 16-bit register by the compiler.
13912 The definition of these macros is affected by @option{-mtiny-stack}.
13913
13914 @item __AVR_HAVE_SPH__
13915 @itemx __AVR_SP8__
13916 The device has the SPH (high part of stack pointer) special function
13917 register or has an 8-bit stack pointer, respectively.
13918 The definition of these macros is affected by @option{-mmcu=} and
13919 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
13920 by @option{-msp8}.
13921
13922 @item __AVR_HAVE_RAMPD__
13923 @itemx __AVR_HAVE_RAMPX__
13924 @itemx __AVR_HAVE_RAMPY__
13925 @itemx __AVR_HAVE_RAMPZ__
13926 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
13927 @code{RAMPZ} special function register, respectively.
13928
13929 @item __NO_INTERRUPTS__
13930 This macro reflects the @option{-mno-interrupts} command-line option.
13931
13932 @item __AVR_ERRATA_SKIP__
13933 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
13934 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
13935 instructions because of a hardware erratum. Skip instructions are
13936 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
13937 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
13938 set.
13939
13940 @item __AVR_ISA_RMW__
13941 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
13942
13943 @item __AVR_SFR_OFFSET__=@var{offset}
13944 Instructions that can address I/O special function registers directly
13945 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
13946 address as if addressed by an instruction to access RAM like @code{LD}
13947 or @code{STS}. This offset depends on the device architecture and has
13948 to be subtracted from the RAM address in order to get the
13949 respective I/O@tie{}address.
13950
13951 @item __WITH_AVRLIBC__
13952 The compiler is configured to be used together with AVR-Libc.
13953 See the @option{--with-avrlibc} configure option.
13954
13955 @end table
13956
13957 @node Blackfin Options
13958 @subsection Blackfin Options
13959 @cindex Blackfin Options
13960
13961 @table @gcctabopt
13962 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
13963 @opindex mcpu=
13964 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
13965 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
13966 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
13967 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
13968 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
13969 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
13970 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
13971 @samp{bf561}, @samp{bf592}.
13972
13973 The optional @var{sirevision} specifies the silicon revision of the target
13974 Blackfin processor. Any workarounds available for the targeted silicon revision
13975 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
13976 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
13977 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
13978 hexadecimal digits representing the major and minor numbers in the silicon
13979 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
13980 is not defined. If @var{sirevision} is @samp{any}, the
13981 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
13982 If this optional @var{sirevision} is not used, GCC assumes the latest known
13983 silicon revision of the targeted Blackfin processor.
13984
13985 GCC defines a preprocessor macro for the specified @var{cpu}.
13986 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
13987 provided by libgloss to be linked in if @option{-msim} is not given.
13988
13989 Without this option, @samp{bf532} is used as the processor by default.
13990
13991 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
13992 only the preprocessor macro is defined.
13993
13994 @item -msim
13995 @opindex msim
13996 Specifies that the program will be run on the simulator. This causes
13997 the simulator BSP provided by libgloss to be linked in. This option
13998 has effect only for @samp{bfin-elf} toolchain.
13999 Certain other options, such as @option{-mid-shared-library} and
14000 @option{-mfdpic}, imply @option{-msim}.
14001
14002 @item -momit-leaf-frame-pointer
14003 @opindex momit-leaf-frame-pointer
14004 Don't keep the frame pointer in a register for leaf functions. This
14005 avoids the instructions to save, set up and restore frame pointers and
14006 makes an extra register available in leaf functions. The option
14007 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
14008 which might make debugging harder.
14009
14010 @item -mspecld-anomaly
14011 @opindex mspecld-anomaly
14012 When enabled, the compiler ensures that the generated code does not
14013 contain speculative loads after jump instructions. If this option is used,
14014 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
14015
14016 @item -mno-specld-anomaly
14017 @opindex mno-specld-anomaly
14018 Don't generate extra code to prevent speculative loads from occurring.
14019
14020 @item -mcsync-anomaly
14021 @opindex mcsync-anomaly
14022 When enabled, the compiler ensures that the generated code does not
14023 contain CSYNC or SSYNC instructions too soon after conditional branches.
14024 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
14025
14026 @item -mno-csync-anomaly
14027 @opindex mno-csync-anomaly
14028 Don't generate extra code to prevent CSYNC or SSYNC instructions from
14029 occurring too soon after a conditional branch.
14030
14031 @item -mlow-64k
14032 @opindex mlow-64k
14033 When enabled, the compiler is free to take advantage of the knowledge that
14034 the entire program fits into the low 64k of memory.
14035
14036 @item -mno-low-64k
14037 @opindex mno-low-64k
14038 Assume that the program is arbitrarily large. This is the default.
14039
14040 @item -mstack-check-l1
14041 @opindex mstack-check-l1
14042 Do stack checking using information placed into L1 scratchpad memory by the
14043 uClinux kernel.
14044
14045 @item -mid-shared-library
14046 @opindex mid-shared-library
14047 Generate code that supports shared libraries via the library ID method.
14048 This allows for execute in place and shared libraries in an environment
14049 without virtual memory management. This option implies @option{-fPIC}.
14050 With a @samp{bfin-elf} target, this option implies @option{-msim}.
14051
14052 @item -mno-id-shared-library
14053 @opindex mno-id-shared-library
14054 Generate code that doesn't assume ID-based shared libraries are being used.
14055 This is the default.
14056
14057 @item -mleaf-id-shared-library
14058 @opindex mleaf-id-shared-library
14059 Generate code that supports shared libraries via the library ID method,
14060 but assumes that this library or executable won't link against any other
14061 ID shared libraries. That allows the compiler to use faster code for jumps
14062 and calls.
14063
14064 @item -mno-leaf-id-shared-library
14065 @opindex mno-leaf-id-shared-library
14066 Do not assume that the code being compiled won't link against any ID shared
14067 libraries. Slower code is generated for jump and call insns.
14068
14069 @item -mshared-library-id=n
14070 @opindex mshared-library-id
14071 Specifies the identification number of the ID-based shared library being
14072 compiled. Specifying a value of 0 generates more compact code; specifying
14073 other values forces the allocation of that number to the current
14074 library but is no more space- or time-efficient than omitting this option.
14075
14076 @item -msep-data
14077 @opindex msep-data
14078 Generate code that allows the data segment to be located in a different
14079 area of memory from the text segment. This allows for execute in place in
14080 an environment without virtual memory management by eliminating relocations
14081 against the text section.
14082
14083 @item -mno-sep-data
14084 @opindex mno-sep-data
14085 Generate code that assumes that the data segment follows the text segment.
14086 This is the default.
14087
14088 @item -mlong-calls
14089 @itemx -mno-long-calls
14090 @opindex mlong-calls
14091 @opindex mno-long-calls
14092 Tells the compiler to perform function calls by first loading the
14093 address of the function into a register and then performing a subroutine
14094 call on this register. This switch is needed if the target function
14095 lies outside of the 24-bit addressing range of the offset-based
14096 version of subroutine call instruction.
14097
14098 This feature is not enabled by default. Specifying
14099 @option{-mno-long-calls} restores the default behavior. Note these
14100 switches have no effect on how the compiler generates code to handle
14101 function calls via function pointers.
14102
14103 @item -mfast-fp
14104 @opindex mfast-fp
14105 Link with the fast floating-point library. This library relaxes some of
14106 the IEEE floating-point standard's rules for checking inputs against
14107 Not-a-Number (NAN), in the interest of performance.
14108
14109 @item -minline-plt
14110 @opindex minline-plt
14111 Enable inlining of PLT entries in function calls to functions that are
14112 not known to bind locally. It has no effect without @option{-mfdpic}.
14113
14114 @item -mmulticore
14115 @opindex mmulticore
14116 Build a standalone application for multicore Blackfin processors.
14117 This option causes proper start files and link scripts supporting
14118 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
14119 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
14120
14121 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
14122 selects the one-application-per-core programming model. Without
14123 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
14124 programming model is used. In this model, the main function of Core B
14125 should be named as @code{coreb_main}.
14126
14127 If this option is not used, the single-core application programming
14128 model is used.
14129
14130 @item -mcorea
14131 @opindex mcorea
14132 Build a standalone application for Core A of BF561 when using
14133 the one-application-per-core programming model. Proper start files
14134 and link scripts are used to support Core A, and the macro
14135 @code{__BFIN_COREA} is defined.
14136 This option can only be used in conjunction with @option{-mmulticore}.
14137
14138 @item -mcoreb
14139 @opindex mcoreb
14140 Build a standalone application for Core B of BF561 when using
14141 the one-application-per-core programming model. Proper start files
14142 and link scripts are used to support Core B, and the macro
14143 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
14144 should be used instead of @code{main}.
14145 This option can only be used in conjunction with @option{-mmulticore}.
14146
14147 @item -msdram
14148 @opindex msdram
14149 Build a standalone application for SDRAM. Proper start files and
14150 link scripts are used to put the application into SDRAM, and the macro
14151 @code{__BFIN_SDRAM} is defined.
14152 The loader should initialize SDRAM before loading the application.
14153
14154 @item -micplb
14155 @opindex micplb
14156 Assume that ICPLBs are enabled at run time. This has an effect on certain
14157 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
14158 are enabled; for standalone applications the default is off.
14159 @end table
14160
14161 @node C6X Options
14162 @subsection C6X Options
14163 @cindex C6X Options
14164
14165 @table @gcctabopt
14166 @item -march=@var{name}
14167 @opindex march
14168 This specifies the name of the target architecture. GCC uses this
14169 name to determine what kind of instructions it can emit when generating
14170 assembly code. Permissible names are: @samp{c62x},
14171 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
14172
14173 @item -mbig-endian
14174 @opindex mbig-endian
14175 Generate code for a big-endian target.
14176
14177 @item -mlittle-endian
14178 @opindex mlittle-endian
14179 Generate code for a little-endian target. This is the default.
14180
14181 @item -msim
14182 @opindex msim
14183 Choose startup files and linker script suitable for the simulator.
14184
14185 @item -msdata=default
14186 @opindex msdata=default
14187 Put small global and static data in the @code{.neardata} section,
14188 which is pointed to by register @code{B14}. Put small uninitialized
14189 global and static data in the @code{.bss} section, which is adjacent
14190 to the @code{.neardata} section. Put small read-only data into the
14191 @code{.rodata} section. The corresponding sections used for large
14192 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
14193
14194 @item -msdata=all
14195 @opindex msdata=all
14196 Put all data, not just small objects, into the sections reserved for
14197 small data, and use addressing relative to the @code{B14} register to
14198 access them.
14199
14200 @item -msdata=none
14201 @opindex msdata=none
14202 Make no use of the sections reserved for small data, and use absolute
14203 addresses to access all data. Put all initialized global and static
14204 data in the @code{.fardata} section, and all uninitialized data in the
14205 @code{.far} section. Put all constant data into the @code{.const}
14206 section.
14207 @end table
14208
14209 @node CRIS Options
14210 @subsection CRIS Options
14211 @cindex CRIS Options
14212
14213 These options are defined specifically for the CRIS ports.
14214
14215 @table @gcctabopt
14216 @item -march=@var{architecture-type}
14217 @itemx -mcpu=@var{architecture-type}
14218 @opindex march
14219 @opindex mcpu
14220 Generate code for the specified architecture. The choices for
14221 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
14222 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
14223 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
14224 @samp{v10}.
14225
14226 @item -mtune=@var{architecture-type}
14227 @opindex mtune
14228 Tune to @var{architecture-type} everything applicable about the generated
14229 code, except for the ABI and the set of available instructions. The
14230 choices for @var{architecture-type} are the same as for
14231 @option{-march=@var{architecture-type}}.
14232
14233 @item -mmax-stack-frame=@var{n}
14234 @opindex mmax-stack-frame
14235 Warn when the stack frame of a function exceeds @var{n} bytes.
14236
14237 @item -metrax4
14238 @itemx -metrax100
14239 @opindex metrax4
14240 @opindex metrax100
14241 The options @option{-metrax4} and @option{-metrax100} are synonyms for
14242 @option{-march=v3} and @option{-march=v8} respectively.
14243
14244 @item -mmul-bug-workaround
14245 @itemx -mno-mul-bug-workaround
14246 @opindex mmul-bug-workaround
14247 @opindex mno-mul-bug-workaround
14248 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
14249 models where it applies. This option is active by default.
14250
14251 @item -mpdebug
14252 @opindex mpdebug
14253 Enable CRIS-specific verbose debug-related information in the assembly
14254 code. This option also has the effect of turning off the @samp{#NO_APP}
14255 formatted-code indicator to the assembler at the beginning of the
14256 assembly file.
14257
14258 @item -mcc-init
14259 @opindex mcc-init
14260 Do not use condition-code results from previous instruction; always emit
14261 compare and test instructions before use of condition codes.
14262
14263 @item -mno-side-effects
14264 @opindex mno-side-effects
14265 Do not emit instructions with side effects in addressing modes other than
14266 post-increment.
14267
14268 @item -mstack-align
14269 @itemx -mno-stack-align
14270 @itemx -mdata-align
14271 @itemx -mno-data-align
14272 @itemx -mconst-align
14273 @itemx -mno-const-align
14274 @opindex mstack-align
14275 @opindex mno-stack-align
14276 @opindex mdata-align
14277 @opindex mno-data-align
14278 @opindex mconst-align
14279 @opindex mno-const-align
14280 These options (@samp{no-} options) arrange (eliminate arrangements) for the
14281 stack frame, individual data and constants to be aligned for the maximum
14282 single data access size for the chosen CPU model. The default is to
14283 arrange for 32-bit alignment. ABI details such as structure layout are
14284 not affected by these options.
14285
14286 @item -m32-bit
14287 @itemx -m16-bit
14288 @itemx -m8-bit
14289 @opindex m32-bit
14290 @opindex m16-bit
14291 @opindex m8-bit
14292 Similar to the stack- data- and const-align options above, these options
14293 arrange for stack frame, writable data and constants to all be 32-bit,
14294 16-bit or 8-bit aligned. The default is 32-bit alignment.
14295
14296 @item -mno-prologue-epilogue
14297 @itemx -mprologue-epilogue
14298 @opindex mno-prologue-epilogue
14299 @opindex mprologue-epilogue
14300 With @option{-mno-prologue-epilogue}, the normal function prologue and
14301 epilogue which set up the stack frame are omitted and no return
14302 instructions or return sequences are generated in the code. Use this
14303 option only together with visual inspection of the compiled code: no
14304 warnings or errors are generated when call-saved registers must be saved,
14305 or storage for local variables needs to be allocated.
14306
14307 @item -mno-gotplt
14308 @itemx -mgotplt
14309 @opindex mno-gotplt
14310 @opindex mgotplt
14311 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
14312 instruction sequences that load addresses for functions from the PLT part
14313 of the GOT rather than (traditional on other architectures) calls to the
14314 PLT@. The default is @option{-mgotplt}.
14315
14316 @item -melf
14317 @opindex melf
14318 Legacy no-op option only recognized with the cris-axis-elf and
14319 cris-axis-linux-gnu targets.
14320
14321 @item -mlinux
14322 @opindex mlinux
14323 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
14324
14325 @item -sim
14326 @opindex sim
14327 This option, recognized for the cris-axis-elf, arranges
14328 to link with input-output functions from a simulator library. Code,
14329 initialized data and zero-initialized data are allocated consecutively.
14330
14331 @item -sim2
14332 @opindex sim2
14333 Like @option{-sim}, but pass linker options to locate initialized data at
14334 0x40000000 and zero-initialized data at 0x80000000.
14335 @end table
14336
14337 @node CR16 Options
14338 @subsection CR16 Options
14339 @cindex CR16 Options
14340
14341 These options are defined specifically for the CR16 ports.
14342
14343 @table @gcctabopt
14344
14345 @item -mmac
14346 @opindex mmac
14347 Enable the use of multiply-accumulate instructions. Disabled by default.
14348
14349 @item -mcr16cplus
14350 @itemx -mcr16c
14351 @opindex mcr16cplus
14352 @opindex mcr16c
14353 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
14354 is default.
14355
14356 @item -msim
14357 @opindex msim
14358 Links the library libsim.a which is in compatible with simulator. Applicable
14359 to ELF compiler only.
14360
14361 @item -mint32
14362 @opindex mint32
14363 Choose integer type as 32-bit wide.
14364
14365 @item -mbit-ops
14366 @opindex mbit-ops
14367 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
14368
14369 @item -mdata-model=@var{model}
14370 @opindex mdata-model
14371 Choose a data model. The choices for @var{model} are @samp{near},
14372 @samp{far} or @samp{medium}. @samp{medium} is default.
14373 However, @samp{far} is not valid with @option{-mcr16c}, as the
14374 CR16C architecture does not support the far data model.
14375 @end table
14376
14377 @node Darwin Options
14378 @subsection Darwin Options
14379 @cindex Darwin options
14380
14381 These options are defined for all architectures running the Darwin operating
14382 system.
14383
14384 FSF GCC on Darwin does not create ``fat'' object files; it creates
14385 an object file for the single architecture that GCC was built to
14386 target. Apple's GCC on Darwin does create ``fat'' files if multiple
14387 @option{-arch} options are used; it does so by running the compiler or
14388 linker multiple times and joining the results together with
14389 @file{lipo}.
14390
14391 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
14392 @samp{i686}) is determined by the flags that specify the ISA
14393 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
14394 @option{-force_cpusubtype_ALL} option can be used to override this.
14395
14396 The Darwin tools vary in their behavior when presented with an ISA
14397 mismatch. The assembler, @file{as}, only permits instructions to
14398 be used that are valid for the subtype of the file it is generating,
14399 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
14400 The linker for shared libraries, @file{/usr/bin/libtool}, fails
14401 and prints an error if asked to create a shared library with a less
14402 restrictive subtype than its input files (for instance, trying to put
14403 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
14404 for executables, @command{ld}, quietly gives the executable the most
14405 restrictive subtype of any of its input files.
14406
14407 @table @gcctabopt
14408 @item -F@var{dir}
14409 @opindex F
14410 Add the framework directory @var{dir} to the head of the list of
14411 directories to be searched for header files. These directories are
14412 interleaved with those specified by @option{-I} options and are
14413 scanned in a left-to-right order.
14414
14415 A framework directory is a directory with frameworks in it. A
14416 framework is a directory with a @file{Headers} and/or
14417 @file{PrivateHeaders} directory contained directly in it that ends
14418 in @file{.framework}. The name of a framework is the name of this
14419 directory excluding the @file{.framework}. Headers associated with
14420 the framework are found in one of those two directories, with
14421 @file{Headers} being searched first. A subframework is a framework
14422 directory that is in a framework's @file{Frameworks} directory.
14423 Includes of subframework headers can only appear in a header of a
14424 framework that contains the subframework, or in a sibling subframework
14425 header. Two subframeworks are siblings if they occur in the same
14426 framework. A subframework should not have the same name as a
14427 framework; a warning is issued if this is violated. Currently a
14428 subframework cannot have subframeworks; in the future, the mechanism
14429 may be extended to support this. The standard frameworks can be found
14430 in @file{/System/Library/Frameworks} and
14431 @file{/Library/Frameworks}. An example include looks like
14432 @code{#include <Framework/header.h>}, where @file{Framework} denotes
14433 the name of the framework and @file{header.h} is found in the
14434 @file{PrivateHeaders} or @file{Headers} directory.
14435
14436 @item -iframework@var{dir}
14437 @opindex iframework
14438 Like @option{-F} except the directory is a treated as a system
14439 directory. The main difference between this @option{-iframework} and
14440 @option{-F} is that with @option{-iframework} the compiler does not
14441 warn about constructs contained within header files found via
14442 @var{dir}. This option is valid only for the C family of languages.
14443
14444 @item -gused
14445 @opindex gused
14446 Emit debugging information for symbols that are used. For stabs
14447 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
14448 This is by default ON@.
14449
14450 @item -gfull
14451 @opindex gfull
14452 Emit debugging information for all symbols and types.
14453
14454 @item -mmacosx-version-min=@var{version}
14455 The earliest version of MacOS X that this executable will run on
14456 is @var{version}. Typical values of @var{version} include @code{10.1},
14457 @code{10.2}, and @code{10.3.9}.
14458
14459 If the compiler was built to use the system's headers by default,
14460 then the default for this option is the system version on which the
14461 compiler is running, otherwise the default is to make choices that
14462 are compatible with as many systems and code bases as possible.
14463
14464 @item -mkernel
14465 @opindex mkernel
14466 Enable kernel development mode. The @option{-mkernel} option sets
14467 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
14468 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
14469 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
14470 applicable. This mode also sets @option{-mno-altivec},
14471 @option{-msoft-float}, @option{-fno-builtin} and
14472 @option{-mlong-branch} for PowerPC targets.
14473
14474 @item -mone-byte-bool
14475 @opindex mone-byte-bool
14476 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
14477 By default @code{sizeof(bool)} is @code{4} when compiling for
14478 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
14479 option has no effect on x86.
14480
14481 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
14482 to generate code that is not binary compatible with code generated
14483 without that switch. Using this switch may require recompiling all
14484 other modules in a program, including system libraries. Use this
14485 switch to conform to a non-default data model.
14486
14487 @item -mfix-and-continue
14488 @itemx -ffix-and-continue
14489 @itemx -findirect-data
14490 @opindex mfix-and-continue
14491 @opindex ffix-and-continue
14492 @opindex findirect-data
14493 Generate code suitable for fast turnaround development, such as to
14494 allow GDB to dynamically load @file{.o} files into already-running
14495 programs. @option{-findirect-data} and @option{-ffix-and-continue}
14496 are provided for backwards compatibility.
14497
14498 @item -all_load
14499 @opindex all_load
14500 Loads all members of static archive libraries.
14501 See man ld(1) for more information.
14502
14503 @item -arch_errors_fatal
14504 @opindex arch_errors_fatal
14505 Cause the errors having to do with files that have the wrong architecture
14506 to be fatal.
14507
14508 @item -bind_at_load
14509 @opindex bind_at_load
14510 Causes the output file to be marked such that the dynamic linker will
14511 bind all undefined references when the file is loaded or launched.
14512
14513 @item -bundle
14514 @opindex bundle
14515 Produce a Mach-o bundle format file.
14516 See man ld(1) for more information.
14517
14518 @item -bundle_loader @var{executable}
14519 @opindex bundle_loader
14520 This option specifies the @var{executable} that will load the build
14521 output file being linked. See man ld(1) for more information.
14522
14523 @item -dynamiclib
14524 @opindex dynamiclib
14525 When passed this option, GCC produces a dynamic library instead of
14526 an executable when linking, using the Darwin @file{libtool} command.
14527
14528 @item -force_cpusubtype_ALL
14529 @opindex force_cpusubtype_ALL
14530 This causes GCC's output file to have the @samp{ALL} subtype, instead of
14531 one controlled by the @option{-mcpu} or @option{-march} option.
14532
14533 @item -allowable_client @var{client_name}
14534 @itemx -client_name
14535 @itemx -compatibility_version
14536 @itemx -current_version
14537 @itemx -dead_strip
14538 @itemx -dependency-file
14539 @itemx -dylib_file
14540 @itemx -dylinker_install_name
14541 @itemx -dynamic
14542 @itemx -exported_symbols_list
14543 @itemx -filelist
14544 @need 800
14545 @itemx -flat_namespace
14546 @itemx -force_flat_namespace
14547 @itemx -headerpad_max_install_names
14548 @itemx -image_base
14549 @itemx -init
14550 @itemx -install_name
14551 @itemx -keep_private_externs
14552 @itemx -multi_module
14553 @itemx -multiply_defined
14554 @itemx -multiply_defined_unused
14555 @need 800
14556 @itemx -noall_load
14557 @itemx -no_dead_strip_inits_and_terms
14558 @itemx -nofixprebinding
14559 @itemx -nomultidefs
14560 @itemx -noprebind
14561 @itemx -noseglinkedit
14562 @itemx -pagezero_size
14563 @itemx -prebind
14564 @itemx -prebind_all_twolevel_modules
14565 @itemx -private_bundle
14566 @need 800
14567 @itemx -read_only_relocs
14568 @itemx -sectalign
14569 @itemx -sectobjectsymbols
14570 @itemx -whyload
14571 @itemx -seg1addr
14572 @itemx -sectcreate
14573 @itemx -sectobjectsymbols
14574 @itemx -sectorder
14575 @itemx -segaddr
14576 @itemx -segs_read_only_addr
14577 @need 800
14578 @itemx -segs_read_write_addr
14579 @itemx -seg_addr_table
14580 @itemx -seg_addr_table_filename
14581 @itemx -seglinkedit
14582 @itemx -segprot
14583 @itemx -segs_read_only_addr
14584 @itemx -segs_read_write_addr
14585 @itemx -single_module
14586 @itemx -static
14587 @itemx -sub_library
14588 @need 800
14589 @itemx -sub_umbrella
14590 @itemx -twolevel_namespace
14591 @itemx -umbrella
14592 @itemx -undefined
14593 @itemx -unexported_symbols_list
14594 @itemx -weak_reference_mismatches
14595 @itemx -whatsloaded
14596 @opindex allowable_client
14597 @opindex client_name
14598 @opindex compatibility_version
14599 @opindex current_version
14600 @opindex dead_strip
14601 @opindex dependency-file
14602 @opindex dylib_file
14603 @opindex dylinker_install_name
14604 @opindex dynamic
14605 @opindex exported_symbols_list
14606 @opindex filelist
14607 @opindex flat_namespace
14608 @opindex force_flat_namespace
14609 @opindex headerpad_max_install_names
14610 @opindex image_base
14611 @opindex init
14612 @opindex install_name
14613 @opindex keep_private_externs
14614 @opindex multi_module
14615 @opindex multiply_defined
14616 @opindex multiply_defined_unused
14617 @opindex noall_load
14618 @opindex no_dead_strip_inits_and_terms
14619 @opindex nofixprebinding
14620 @opindex nomultidefs
14621 @opindex noprebind
14622 @opindex noseglinkedit
14623 @opindex pagezero_size
14624 @opindex prebind
14625 @opindex prebind_all_twolevel_modules
14626 @opindex private_bundle
14627 @opindex read_only_relocs
14628 @opindex sectalign
14629 @opindex sectobjectsymbols
14630 @opindex whyload
14631 @opindex seg1addr
14632 @opindex sectcreate
14633 @opindex sectobjectsymbols
14634 @opindex sectorder
14635 @opindex segaddr
14636 @opindex segs_read_only_addr
14637 @opindex segs_read_write_addr
14638 @opindex seg_addr_table
14639 @opindex seg_addr_table_filename
14640 @opindex seglinkedit
14641 @opindex segprot
14642 @opindex segs_read_only_addr
14643 @opindex segs_read_write_addr
14644 @opindex single_module
14645 @opindex static
14646 @opindex sub_library
14647 @opindex sub_umbrella
14648 @opindex twolevel_namespace
14649 @opindex umbrella
14650 @opindex undefined
14651 @opindex unexported_symbols_list
14652 @opindex weak_reference_mismatches
14653 @opindex whatsloaded
14654 These options are passed to the Darwin linker. The Darwin linker man page
14655 describes them in detail.
14656 @end table
14657
14658 @node DEC Alpha Options
14659 @subsection DEC Alpha Options
14660
14661 These @samp{-m} options are defined for the DEC Alpha implementations:
14662
14663 @table @gcctabopt
14664 @item -mno-soft-float
14665 @itemx -msoft-float
14666 @opindex mno-soft-float
14667 @opindex msoft-float
14668 Use (do not use) the hardware floating-point instructions for
14669 floating-point operations. When @option{-msoft-float} is specified,
14670 functions in @file{libgcc.a} are used to perform floating-point
14671 operations. Unless they are replaced by routines that emulate the
14672 floating-point operations, or compiled in such a way as to call such
14673 emulations routines, these routines issue floating-point
14674 operations. If you are compiling for an Alpha without floating-point
14675 operations, you must ensure that the library is built so as not to call
14676 them.
14677
14678 Note that Alpha implementations without floating-point operations are
14679 required to have floating-point registers.
14680
14681 @item -mfp-reg
14682 @itemx -mno-fp-regs
14683 @opindex mfp-reg
14684 @opindex mno-fp-regs
14685 Generate code that uses (does not use) the floating-point register set.
14686 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
14687 register set is not used, floating-point operands are passed in integer
14688 registers as if they were integers and floating-point results are passed
14689 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
14690 so any function with a floating-point argument or return value called by code
14691 compiled with @option{-mno-fp-regs} must also be compiled with that
14692 option.
14693
14694 A typical use of this option is building a kernel that does not use,
14695 and hence need not save and restore, any floating-point registers.
14696
14697 @item -mieee
14698 @opindex mieee
14699 The Alpha architecture implements floating-point hardware optimized for
14700 maximum performance. It is mostly compliant with the IEEE floating-point
14701 standard. However, for full compliance, software assistance is
14702 required. This option generates code fully IEEE-compliant code
14703 @emph{except} that the @var{inexact-flag} is not maintained (see below).
14704 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
14705 defined during compilation. The resulting code is less efficient but is
14706 able to correctly support denormalized numbers and exceptional IEEE
14707 values such as not-a-number and plus/minus infinity. Other Alpha
14708 compilers call this option @option{-ieee_with_no_inexact}.
14709
14710 @item -mieee-with-inexact
14711 @opindex mieee-with-inexact
14712 This is like @option{-mieee} except the generated code also maintains
14713 the IEEE @var{inexact-flag}. Turning on this option causes the
14714 generated code to implement fully-compliant IEEE math. In addition to
14715 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
14716 macro. On some Alpha implementations the resulting code may execute
14717 significantly slower than the code generated by default. Since there is
14718 very little code that depends on the @var{inexact-flag}, you should
14719 normally not specify this option. Other Alpha compilers call this
14720 option @option{-ieee_with_inexact}.
14721
14722 @item -mfp-trap-mode=@var{trap-mode}
14723 @opindex mfp-trap-mode
14724 This option controls what floating-point related traps are enabled.
14725 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
14726 The trap mode can be set to one of four values:
14727
14728 @table @samp
14729 @item n
14730 This is the default (normal) setting. The only traps that are enabled
14731 are the ones that cannot be disabled in software (e.g., division by zero
14732 trap).
14733
14734 @item u
14735 In addition to the traps enabled by @samp{n}, underflow traps are enabled
14736 as well.
14737
14738 @item su
14739 Like @samp{u}, but the instructions are marked to be safe for software
14740 completion (see Alpha architecture manual for details).
14741
14742 @item sui
14743 Like @samp{su}, but inexact traps are enabled as well.
14744 @end table
14745
14746 @item -mfp-rounding-mode=@var{rounding-mode}
14747 @opindex mfp-rounding-mode
14748 Selects the IEEE rounding mode. Other Alpha compilers call this option
14749 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
14750 of:
14751
14752 @table @samp
14753 @item n
14754 Normal IEEE rounding mode. Floating-point numbers are rounded towards
14755 the nearest machine number or towards the even machine number in case
14756 of a tie.
14757
14758 @item m
14759 Round towards minus infinity.
14760
14761 @item c
14762 Chopped rounding mode. Floating-point numbers are rounded towards zero.
14763
14764 @item d
14765 Dynamic rounding mode. A field in the floating-point control register
14766 (@var{fpcr}, see Alpha architecture reference manual) controls the
14767 rounding mode in effect. The C library initializes this register for
14768 rounding towards plus infinity. Thus, unless your program modifies the
14769 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
14770 @end table
14771
14772 @item -mtrap-precision=@var{trap-precision}
14773 @opindex mtrap-precision
14774 In the Alpha architecture, floating-point traps are imprecise. This
14775 means without software assistance it is impossible to recover from a
14776 floating trap and program execution normally needs to be terminated.
14777 GCC can generate code that can assist operating system trap handlers
14778 in determining the exact location that caused a floating-point trap.
14779 Depending on the requirements of an application, different levels of
14780 precisions can be selected:
14781
14782 @table @samp
14783 @item p
14784 Program precision. This option is the default and means a trap handler
14785 can only identify which program caused a floating-point exception.
14786
14787 @item f
14788 Function precision. The trap handler can determine the function that
14789 caused a floating-point exception.
14790
14791 @item i
14792 Instruction precision. The trap handler can determine the exact
14793 instruction that caused a floating-point exception.
14794 @end table
14795
14796 Other Alpha compilers provide the equivalent options called
14797 @option{-scope_safe} and @option{-resumption_safe}.
14798
14799 @item -mieee-conformant
14800 @opindex mieee-conformant
14801 This option marks the generated code as IEEE conformant. You must not
14802 use this option unless you also specify @option{-mtrap-precision=i} and either
14803 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
14804 is to emit the line @samp{.eflag 48} in the function prologue of the
14805 generated assembly file.
14806
14807 @item -mbuild-constants
14808 @opindex mbuild-constants
14809 Normally GCC examines a 32- or 64-bit integer constant to
14810 see if it can construct it from smaller constants in two or three
14811 instructions. If it cannot, it outputs the constant as a literal and
14812 generates code to load it from the data segment at run time.
14813
14814 Use this option to require GCC to construct @emph{all} integer constants
14815 using code, even if it takes more instructions (the maximum is six).
14816
14817 You typically use this option to build a shared library dynamic
14818 loader. Itself a shared library, it must relocate itself in memory
14819 before it can find the variables and constants in its own data segment.
14820
14821 @item -mbwx
14822 @itemx -mno-bwx
14823 @itemx -mcix
14824 @itemx -mno-cix
14825 @itemx -mfix
14826 @itemx -mno-fix
14827 @itemx -mmax
14828 @itemx -mno-max
14829 @opindex mbwx
14830 @opindex mno-bwx
14831 @opindex mcix
14832 @opindex mno-cix
14833 @opindex mfix
14834 @opindex mno-fix
14835 @opindex mmax
14836 @opindex mno-max
14837 Indicate whether GCC should generate code to use the optional BWX,
14838 CIX, FIX and MAX instruction sets. The default is to use the instruction
14839 sets supported by the CPU type specified via @option{-mcpu=} option or that
14840 of the CPU on which GCC was built if none is specified.
14841
14842 @item -mfloat-vax
14843 @itemx -mfloat-ieee
14844 @opindex mfloat-vax
14845 @opindex mfloat-ieee
14846 Generate code that uses (does not use) VAX F and G floating-point
14847 arithmetic instead of IEEE single and double precision.
14848
14849 @item -mexplicit-relocs
14850 @itemx -mno-explicit-relocs
14851 @opindex mexplicit-relocs
14852 @opindex mno-explicit-relocs
14853 Older Alpha assemblers provided no way to generate symbol relocations
14854 except via assembler macros. Use of these macros does not allow
14855 optimal instruction scheduling. GNU binutils as of version 2.12
14856 supports a new syntax that allows the compiler to explicitly mark
14857 which relocations should apply to which instructions. This option
14858 is mostly useful for debugging, as GCC detects the capabilities of
14859 the assembler when it is built and sets the default accordingly.
14860
14861 @item -msmall-data
14862 @itemx -mlarge-data
14863 @opindex msmall-data
14864 @opindex mlarge-data
14865 When @option{-mexplicit-relocs} is in effect, static data is
14866 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
14867 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
14868 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
14869 16-bit relocations off of the @code{$gp} register. This limits the
14870 size of the small data area to 64KB, but allows the variables to be
14871 directly accessed via a single instruction.
14872
14873 The default is @option{-mlarge-data}. With this option the data area
14874 is limited to just below 2GB@. Programs that require more than 2GB of
14875 data must use @code{malloc} or @code{mmap} to allocate the data in the
14876 heap instead of in the program's data segment.
14877
14878 When generating code for shared libraries, @option{-fpic} implies
14879 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
14880
14881 @item -msmall-text
14882 @itemx -mlarge-text
14883 @opindex msmall-text
14884 @opindex mlarge-text
14885 When @option{-msmall-text} is used, the compiler assumes that the
14886 code of the entire program (or shared library) fits in 4MB, and is
14887 thus reachable with a branch instruction. When @option{-msmall-data}
14888 is used, the compiler can assume that all local symbols share the
14889 same @code{$gp} value, and thus reduce the number of instructions
14890 required for a function call from 4 to 1.
14891
14892 The default is @option{-mlarge-text}.
14893
14894 @item -mcpu=@var{cpu_type}
14895 @opindex mcpu
14896 Set the instruction set and instruction scheduling parameters for
14897 machine type @var{cpu_type}. You can specify either the @samp{EV}
14898 style name or the corresponding chip number. GCC supports scheduling
14899 parameters for the EV4, EV5 and EV6 family of processors and
14900 chooses the default values for the instruction set from the processor
14901 you specify. If you do not specify a processor type, GCC defaults
14902 to the processor on which the compiler was built.
14903
14904 Supported values for @var{cpu_type} are
14905
14906 @table @samp
14907 @item ev4
14908 @itemx ev45
14909 @itemx 21064
14910 Schedules as an EV4 and has no instruction set extensions.
14911
14912 @item ev5
14913 @itemx 21164
14914 Schedules as an EV5 and has no instruction set extensions.
14915
14916 @item ev56
14917 @itemx 21164a
14918 Schedules as an EV5 and supports the BWX extension.
14919
14920 @item pca56
14921 @itemx 21164pc
14922 @itemx 21164PC
14923 Schedules as an EV5 and supports the BWX and MAX extensions.
14924
14925 @item ev6
14926 @itemx 21264
14927 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
14928
14929 @item ev67
14930 @itemx 21264a
14931 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
14932 @end table
14933
14934 Native toolchains also support the value @samp{native},
14935 which selects the best architecture option for the host processor.
14936 @option{-mcpu=native} has no effect if GCC does not recognize
14937 the processor.
14938
14939 @item -mtune=@var{cpu_type}
14940 @opindex mtune
14941 Set only the instruction scheduling parameters for machine type
14942 @var{cpu_type}. The instruction set is not changed.
14943
14944 Native toolchains also support the value @samp{native},
14945 which selects the best architecture option for the host processor.
14946 @option{-mtune=native} has no effect if GCC does not recognize
14947 the processor.
14948
14949 @item -mmemory-latency=@var{time}
14950 @opindex mmemory-latency
14951 Sets the latency the scheduler should assume for typical memory
14952 references as seen by the application. This number is highly
14953 dependent on the memory access patterns used by the application
14954 and the size of the external cache on the machine.
14955
14956 Valid options for @var{time} are
14957
14958 @table @samp
14959 @item @var{number}
14960 A decimal number representing clock cycles.
14961
14962 @item L1
14963 @itemx L2
14964 @itemx L3
14965 @itemx main
14966 The compiler contains estimates of the number of clock cycles for
14967 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
14968 (also called Dcache, Scache, and Bcache), as well as to main memory.
14969 Note that L3 is only valid for EV5.
14970
14971 @end table
14972 @end table
14973
14974 @node FR30 Options
14975 @subsection FR30 Options
14976 @cindex FR30 Options
14977
14978 These options are defined specifically for the FR30 port.
14979
14980 @table @gcctabopt
14981
14982 @item -msmall-model
14983 @opindex msmall-model
14984 Use the small address space model. This can produce smaller code, but
14985 it does assume that all symbolic values and addresses fit into a
14986 20-bit range.
14987
14988 @item -mno-lsim
14989 @opindex mno-lsim
14990 Assume that runtime support has been provided and so there is no need
14991 to include the simulator library (@file{libsim.a}) on the linker
14992 command line.
14993
14994 @end table
14995
14996 @node FRV Options
14997 @subsection FRV Options
14998 @cindex FRV Options
14999
15000 @table @gcctabopt
15001 @item -mgpr-32
15002 @opindex mgpr-32
15003
15004 Only use the first 32 general-purpose registers.
15005
15006 @item -mgpr-64
15007 @opindex mgpr-64
15008
15009 Use all 64 general-purpose registers.
15010
15011 @item -mfpr-32
15012 @opindex mfpr-32
15013
15014 Use only the first 32 floating-point registers.
15015
15016 @item -mfpr-64
15017 @opindex mfpr-64
15018
15019 Use all 64 floating-point registers.
15020
15021 @item -mhard-float
15022 @opindex mhard-float
15023
15024 Use hardware instructions for floating-point operations.
15025
15026 @item -msoft-float
15027 @opindex msoft-float
15028
15029 Use library routines for floating-point operations.
15030
15031 @item -malloc-cc
15032 @opindex malloc-cc
15033
15034 Dynamically allocate condition code registers.
15035
15036 @item -mfixed-cc
15037 @opindex mfixed-cc
15038
15039 Do not try to dynamically allocate condition code registers, only
15040 use @code{icc0} and @code{fcc0}.
15041
15042 @item -mdword
15043 @opindex mdword
15044
15045 Change ABI to use double word insns.
15046
15047 @item -mno-dword
15048 @opindex mno-dword
15049
15050 Do not use double word instructions.
15051
15052 @item -mdouble
15053 @opindex mdouble
15054
15055 Use floating-point double instructions.
15056
15057 @item -mno-double
15058 @opindex mno-double
15059
15060 Do not use floating-point double instructions.
15061
15062 @item -mmedia
15063 @opindex mmedia
15064
15065 Use media instructions.
15066
15067 @item -mno-media
15068 @opindex mno-media
15069
15070 Do not use media instructions.
15071
15072 @item -mmuladd
15073 @opindex mmuladd
15074
15075 Use multiply and add/subtract instructions.
15076
15077 @item -mno-muladd
15078 @opindex mno-muladd
15079
15080 Do not use multiply and add/subtract instructions.
15081
15082 @item -mfdpic
15083 @opindex mfdpic
15084
15085 Select the FDPIC ABI, which uses function descriptors to represent
15086 pointers to functions. Without any PIC/PIE-related options, it
15087 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
15088 assumes GOT entries and small data are within a 12-bit range from the
15089 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
15090 are computed with 32 bits.
15091 With a @samp{bfin-elf} target, this option implies @option{-msim}.
15092
15093 @item -minline-plt
15094 @opindex minline-plt
15095
15096 Enable inlining of PLT entries in function calls to functions that are
15097 not known to bind locally. It has no effect without @option{-mfdpic}.
15098 It's enabled by default if optimizing for speed and compiling for
15099 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
15100 optimization option such as @option{-O3} or above is present in the
15101 command line.
15102
15103 @item -mTLS
15104 @opindex mTLS
15105
15106 Assume a large TLS segment when generating thread-local code.
15107
15108 @item -mtls
15109 @opindex mtls
15110
15111 Do not assume a large TLS segment when generating thread-local code.
15112
15113 @item -mgprel-ro
15114 @opindex mgprel-ro
15115
15116 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
15117 that is known to be in read-only sections. It's enabled by default,
15118 except for @option{-fpic} or @option{-fpie}: even though it may help
15119 make the global offset table smaller, it trades 1 instruction for 4.
15120 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
15121 one of which may be shared by multiple symbols, and it avoids the need
15122 for a GOT entry for the referenced symbol, so it's more likely to be a
15123 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
15124
15125 @item -multilib-library-pic
15126 @opindex multilib-library-pic
15127
15128 Link with the (library, not FD) pic libraries. It's implied by
15129 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
15130 @option{-fpic} without @option{-mfdpic}. You should never have to use
15131 it explicitly.
15132
15133 @item -mlinked-fp
15134 @opindex mlinked-fp
15135
15136 Follow the EABI requirement of always creating a frame pointer whenever
15137 a stack frame is allocated. This option is enabled by default and can
15138 be disabled with @option{-mno-linked-fp}.
15139
15140 @item -mlong-calls
15141 @opindex mlong-calls
15142
15143 Use indirect addressing to call functions outside the current
15144 compilation unit. This allows the functions to be placed anywhere
15145 within the 32-bit address space.
15146
15147 @item -malign-labels
15148 @opindex malign-labels
15149
15150 Try to align labels to an 8-byte boundary by inserting NOPs into the
15151 previous packet. This option only has an effect when VLIW packing
15152 is enabled. It doesn't create new packets; it merely adds NOPs to
15153 existing ones.
15154
15155 @item -mlibrary-pic
15156 @opindex mlibrary-pic
15157
15158 Generate position-independent EABI code.
15159
15160 @item -macc-4
15161 @opindex macc-4
15162
15163 Use only the first four media accumulator registers.
15164
15165 @item -macc-8
15166 @opindex macc-8
15167
15168 Use all eight media accumulator registers.
15169
15170 @item -mpack
15171 @opindex mpack
15172
15173 Pack VLIW instructions.
15174
15175 @item -mno-pack
15176 @opindex mno-pack
15177
15178 Do not pack VLIW instructions.
15179
15180 @item -mno-eflags
15181 @opindex mno-eflags
15182
15183 Do not mark ABI switches in e_flags.
15184
15185 @item -mcond-move
15186 @opindex mcond-move
15187
15188 Enable the use of conditional-move instructions (default).
15189
15190 This switch is mainly for debugging the compiler and will likely be removed
15191 in a future version.
15192
15193 @item -mno-cond-move
15194 @opindex mno-cond-move
15195
15196 Disable the use of conditional-move instructions.
15197
15198 This switch is mainly for debugging the compiler and will likely be removed
15199 in a future version.
15200
15201 @item -mscc
15202 @opindex mscc
15203
15204 Enable the use of conditional set instructions (default).
15205
15206 This switch is mainly for debugging the compiler and will likely be removed
15207 in a future version.
15208
15209 @item -mno-scc
15210 @opindex mno-scc
15211
15212 Disable the use of conditional set instructions.
15213
15214 This switch is mainly for debugging the compiler and will likely be removed
15215 in a future version.
15216
15217 @item -mcond-exec
15218 @opindex mcond-exec
15219
15220 Enable the use of conditional execution (default).
15221
15222 This switch is mainly for debugging the compiler and will likely be removed
15223 in a future version.
15224
15225 @item -mno-cond-exec
15226 @opindex mno-cond-exec
15227
15228 Disable the use of conditional execution.
15229
15230 This switch is mainly for debugging the compiler and will likely be removed
15231 in a future version.
15232
15233 @item -mvliw-branch
15234 @opindex mvliw-branch
15235
15236 Run a pass to pack branches into VLIW instructions (default).
15237
15238 This switch is mainly for debugging the compiler and will likely be removed
15239 in a future version.
15240
15241 @item -mno-vliw-branch
15242 @opindex mno-vliw-branch
15243
15244 Do not run a pass to pack branches into VLIW instructions.
15245
15246 This switch is mainly for debugging the compiler and will likely be removed
15247 in a future version.
15248
15249 @item -mmulti-cond-exec
15250 @opindex mmulti-cond-exec
15251
15252 Enable optimization of @code{&&} and @code{||} in conditional execution
15253 (default).
15254
15255 This switch is mainly for debugging the compiler and will likely be removed
15256 in a future version.
15257
15258 @item -mno-multi-cond-exec
15259 @opindex mno-multi-cond-exec
15260
15261 Disable optimization of @code{&&} and @code{||} in conditional execution.
15262
15263 This switch is mainly for debugging the compiler and will likely be removed
15264 in a future version.
15265
15266 @item -mnested-cond-exec
15267 @opindex mnested-cond-exec
15268
15269 Enable nested conditional execution optimizations (default).
15270
15271 This switch is mainly for debugging the compiler and will likely be removed
15272 in a future version.
15273
15274 @item -mno-nested-cond-exec
15275 @opindex mno-nested-cond-exec
15276
15277 Disable nested conditional execution optimizations.
15278
15279 This switch is mainly for debugging the compiler and will likely be removed
15280 in a future version.
15281
15282 @item -moptimize-membar
15283 @opindex moptimize-membar
15284
15285 This switch removes redundant @code{membar} instructions from the
15286 compiler-generated code. It is enabled by default.
15287
15288 @item -mno-optimize-membar
15289 @opindex mno-optimize-membar
15290
15291 This switch disables the automatic removal of redundant @code{membar}
15292 instructions from the generated code.
15293
15294 @item -mtomcat-stats
15295 @opindex mtomcat-stats
15296
15297 Cause gas to print out tomcat statistics.
15298
15299 @item -mcpu=@var{cpu}
15300 @opindex mcpu
15301
15302 Select the processor type for which to generate code. Possible values are
15303 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
15304 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
15305
15306 @end table
15307
15308 @node GNU/Linux Options
15309 @subsection GNU/Linux Options
15310
15311 These @samp{-m} options are defined for GNU/Linux targets:
15312
15313 @table @gcctabopt
15314 @item -mglibc
15315 @opindex mglibc
15316 Use the GNU C library. This is the default except
15317 on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
15318
15319 @item -muclibc
15320 @opindex muclibc
15321 Use uClibc C library. This is the default on
15322 @samp{*-*-linux-*uclibc*} targets.
15323
15324 @item -mbionic
15325 @opindex mbionic
15326 Use Bionic C library. This is the default on
15327 @samp{*-*-linux-*android*} targets.
15328
15329 @item -mandroid
15330 @opindex mandroid
15331 Compile code compatible with Android platform. This is the default on
15332 @samp{*-*-linux-*android*} targets.
15333
15334 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
15335 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
15336 this option makes the GCC driver pass Android-specific options to the linker.
15337 Finally, this option causes the preprocessor macro @code{__ANDROID__}
15338 to be defined.
15339
15340 @item -tno-android-cc
15341 @opindex tno-android-cc
15342 Disable compilation effects of @option{-mandroid}, i.e., do not enable
15343 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
15344 @option{-fno-rtti} by default.
15345
15346 @item -tno-android-ld
15347 @opindex tno-android-ld
15348 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
15349 linking options to the linker.
15350
15351 @end table
15352
15353 @node H8/300 Options
15354 @subsection H8/300 Options
15355
15356 These @samp{-m} options are defined for the H8/300 implementations:
15357
15358 @table @gcctabopt
15359 @item -mrelax
15360 @opindex mrelax
15361 Shorten some address references at link time, when possible; uses the
15362 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
15363 ld, Using ld}, for a fuller description.
15364
15365 @item -mh
15366 @opindex mh
15367 Generate code for the H8/300H@.
15368
15369 @item -ms
15370 @opindex ms
15371 Generate code for the H8S@.
15372
15373 @item -mn
15374 @opindex mn
15375 Generate code for the H8S and H8/300H in the normal mode. This switch
15376 must be used either with @option{-mh} or @option{-ms}.
15377
15378 @item -ms2600
15379 @opindex ms2600
15380 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
15381
15382 @item -mexr
15383 @opindex mexr
15384 Extended registers are stored on stack before execution of function
15385 with monitor attribute. Default option is @option{-mexr}.
15386 This option is valid only for H8S targets.
15387
15388 @item -mno-exr
15389 @opindex mno-exr
15390 Extended registers are not stored on stack before execution of function
15391 with monitor attribute. Default option is @option{-mno-exr}.
15392 This option is valid only for H8S targets.
15393
15394 @item -mint32
15395 @opindex mint32
15396 Make @code{int} data 32 bits by default.
15397
15398 @item -malign-300
15399 @opindex malign-300
15400 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
15401 The default for the H8/300H and H8S is to align longs and floats on
15402 4-byte boundaries.
15403 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
15404 This option has no effect on the H8/300.
15405 @end table
15406
15407 @node HPPA Options
15408 @subsection HPPA Options
15409 @cindex HPPA Options
15410
15411 These @samp{-m} options are defined for the HPPA family of computers:
15412
15413 @table @gcctabopt
15414 @item -march=@var{architecture-type}
15415 @opindex march
15416 Generate code for the specified architecture. The choices for
15417 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
15418 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
15419 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
15420 architecture option for your machine. Code compiled for lower numbered
15421 architectures runs on higher numbered architectures, but not the
15422 other way around.
15423
15424 @item -mpa-risc-1-0
15425 @itemx -mpa-risc-1-1
15426 @itemx -mpa-risc-2-0
15427 @opindex mpa-risc-1-0
15428 @opindex mpa-risc-1-1
15429 @opindex mpa-risc-2-0
15430 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
15431
15432 @item -mjump-in-delay
15433 @opindex mjump-in-delay
15434 This option is ignored and provided for compatibility purposes only.
15435
15436 @item -mdisable-fpregs
15437 @opindex mdisable-fpregs
15438 Prevent floating-point registers from being used in any manner. This is
15439 necessary for compiling kernels that perform lazy context switching of
15440 floating-point registers. If you use this option and attempt to perform
15441 floating-point operations, the compiler aborts.
15442
15443 @item -mdisable-indexing
15444 @opindex mdisable-indexing
15445 Prevent the compiler from using indexing address modes. This avoids some
15446 rather obscure problems when compiling MIG generated code under MACH@.
15447
15448 @item -mno-space-regs
15449 @opindex mno-space-regs
15450 Generate code that assumes the target has no space registers. This allows
15451 GCC to generate faster indirect calls and use unscaled index address modes.
15452
15453 Such code is suitable for level 0 PA systems and kernels.
15454
15455 @item -mfast-indirect-calls
15456 @opindex mfast-indirect-calls
15457 Generate code that assumes calls never cross space boundaries. This
15458 allows GCC to emit code that performs faster indirect calls.
15459
15460 This option does not work in the presence of shared libraries or nested
15461 functions.
15462
15463 @item -mfixed-range=@var{register-range}
15464 @opindex mfixed-range
15465 Generate code treating the given register range as fixed registers.
15466 A fixed register is one that the register allocator cannot use. This is
15467 useful when compiling kernel code. A register range is specified as
15468 two registers separated by a dash. Multiple register ranges can be
15469 specified separated by a comma.
15470
15471 @item -mlong-load-store
15472 @opindex mlong-load-store
15473 Generate 3-instruction load and store sequences as sometimes required by
15474 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
15475 the HP compilers.
15476
15477 @item -mportable-runtime
15478 @opindex mportable-runtime
15479 Use the portable calling conventions proposed by HP for ELF systems.
15480
15481 @item -mgas
15482 @opindex mgas
15483 Enable the use of assembler directives only GAS understands.
15484
15485 @item -mschedule=@var{cpu-type}
15486 @opindex mschedule
15487 Schedule code according to the constraints for the machine type
15488 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
15489 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
15490 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
15491 proper scheduling option for your machine. The default scheduling is
15492 @samp{8000}.
15493
15494 @item -mlinker-opt
15495 @opindex mlinker-opt
15496 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
15497 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
15498 linkers in which they give bogus error messages when linking some programs.
15499
15500 @item -msoft-float
15501 @opindex msoft-float
15502 Generate output containing library calls for floating point.
15503 @strong{Warning:} the requisite libraries are not available for all HPPA
15504 targets. Normally the facilities of the machine's usual C compiler are
15505 used, but this cannot be done directly in cross-compilation. You must make
15506 your own arrangements to provide suitable library functions for
15507 cross-compilation.
15508
15509 @option{-msoft-float} changes the calling convention in the output file;
15510 therefore, it is only useful if you compile @emph{all} of a program with
15511 this option. In particular, you need to compile @file{libgcc.a}, the
15512 library that comes with GCC, with @option{-msoft-float} in order for
15513 this to work.
15514
15515 @item -msio
15516 @opindex msio
15517 Generate the predefine, @code{_SIO}, for server IO@. The default is
15518 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
15519 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
15520 options are available under HP-UX and HI-UX@.
15521
15522 @item -mgnu-ld
15523 @opindex mgnu-ld
15524 Use options specific to GNU @command{ld}.
15525 This passes @option{-shared} to @command{ld} when
15526 building a shared library. It is the default when GCC is configured,
15527 explicitly or implicitly, with the GNU linker. This option does not
15528 affect which @command{ld} is called; it only changes what parameters
15529 are passed to that @command{ld}.
15530 The @command{ld} that is called is determined by the
15531 @option{--with-ld} configure option, GCC's program search path, and
15532 finally by the user's @env{PATH}. The linker used by GCC can be printed
15533 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
15534 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
15535
15536 @item -mhp-ld
15537 @opindex mhp-ld
15538 Use options specific to HP @command{ld}.
15539 This passes @option{-b} to @command{ld} when building
15540 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
15541 links. It is the default when GCC is configured, explicitly or
15542 implicitly, with the HP linker. This option does not affect
15543 which @command{ld} is called; it only changes what parameters are passed to that
15544 @command{ld}.
15545 The @command{ld} that is called is determined by the @option{--with-ld}
15546 configure option, GCC's program search path, and finally by the user's
15547 @env{PATH}. The linker used by GCC can be printed using @samp{which
15548 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
15549 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
15550
15551 @item -mlong-calls
15552 @opindex mno-long-calls
15553 Generate code that uses long call sequences. This ensures that a call
15554 is always able to reach linker generated stubs. The default is to generate
15555 long calls only when the distance from the call site to the beginning
15556 of the function or translation unit, as the case may be, exceeds a
15557 predefined limit set by the branch type being used. The limits for
15558 normal calls are 7,600,000 and 240,000 bytes, respectively for the
15559 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
15560 240,000 bytes.
15561
15562 Distances are measured from the beginning of functions when using the
15563 @option{-ffunction-sections} option, or when using the @option{-mgas}
15564 and @option{-mno-portable-runtime} options together under HP-UX with
15565 the SOM linker.
15566
15567 It is normally not desirable to use this option as it degrades
15568 performance. However, it may be useful in large applications,
15569 particularly when partial linking is used to build the application.
15570
15571 The types of long calls used depends on the capabilities of the
15572 assembler and linker, and the type of code being generated. The
15573 impact on systems that support long absolute calls, and long pic
15574 symbol-difference or pc-relative calls should be relatively small.
15575 However, an indirect call is used on 32-bit ELF systems in pic code
15576 and it is quite long.
15577
15578 @item -munix=@var{unix-std}
15579 @opindex march
15580 Generate compiler predefines and select a startfile for the specified
15581 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
15582 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
15583 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
15584 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
15585 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
15586 and later.
15587
15588 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
15589 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
15590 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
15591 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
15592 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
15593 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
15594
15595 It is @emph{important} to note that this option changes the interfaces
15596 for various library routines. It also affects the operational behavior
15597 of the C library. Thus, @emph{extreme} care is needed in using this
15598 option.
15599
15600 Library code that is intended to operate with more than one UNIX
15601 standard must test, set and restore the variable @code{__xpg4_extended_mask}
15602 as appropriate. Most GNU software doesn't provide this capability.
15603
15604 @item -nolibdld
15605 @opindex nolibdld
15606 Suppress the generation of link options to search libdld.sl when the
15607 @option{-static} option is specified on HP-UX 10 and later.
15608
15609 @item -static
15610 @opindex static
15611 The HP-UX implementation of setlocale in libc has a dependency on
15612 libdld.sl. There isn't an archive version of libdld.sl. Thus,
15613 when the @option{-static} option is specified, special link options
15614 are needed to resolve this dependency.
15615
15616 On HP-UX 10 and later, the GCC driver adds the necessary options to
15617 link with libdld.sl when the @option{-static} option is specified.
15618 This causes the resulting binary to be dynamic. On the 64-bit port,
15619 the linkers generate dynamic binaries by default in any case. The
15620 @option{-nolibdld} option can be used to prevent the GCC driver from
15621 adding these link options.
15622
15623 @item -threads
15624 @opindex threads
15625 Add support for multithreading with the @dfn{dce thread} library
15626 under HP-UX@. This option sets flags for both the preprocessor and
15627 linker.
15628 @end table
15629
15630 @node IA-64 Options
15631 @subsection IA-64 Options
15632 @cindex IA-64 Options
15633
15634 These are the @samp{-m} options defined for the Intel IA-64 architecture.
15635
15636 @table @gcctabopt
15637 @item -mbig-endian
15638 @opindex mbig-endian
15639 Generate code for a big-endian target. This is the default for HP-UX@.
15640
15641 @item -mlittle-endian
15642 @opindex mlittle-endian
15643 Generate code for a little-endian target. This is the default for AIX5
15644 and GNU/Linux.
15645
15646 @item -mgnu-as
15647 @itemx -mno-gnu-as
15648 @opindex mgnu-as
15649 @opindex mno-gnu-as
15650 Generate (or don't) code for the GNU assembler. This is the default.
15651 @c Also, this is the default if the configure option @option{--with-gnu-as}
15652 @c is used.
15653
15654 @item -mgnu-ld
15655 @itemx -mno-gnu-ld
15656 @opindex mgnu-ld
15657 @opindex mno-gnu-ld
15658 Generate (or don't) code for the GNU linker. This is the default.
15659 @c Also, this is the default if the configure option @option{--with-gnu-ld}
15660 @c is used.
15661
15662 @item -mno-pic
15663 @opindex mno-pic
15664 Generate code that does not use a global pointer register. The result
15665 is not position independent code, and violates the IA-64 ABI@.
15666
15667 @item -mvolatile-asm-stop
15668 @itemx -mno-volatile-asm-stop
15669 @opindex mvolatile-asm-stop
15670 @opindex mno-volatile-asm-stop
15671 Generate (or don't) a stop bit immediately before and after volatile asm
15672 statements.
15673
15674 @item -mregister-names
15675 @itemx -mno-register-names
15676 @opindex mregister-names
15677 @opindex mno-register-names
15678 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
15679 the stacked registers. This may make assembler output more readable.
15680
15681 @item -mno-sdata
15682 @itemx -msdata
15683 @opindex mno-sdata
15684 @opindex msdata
15685 Disable (or enable) optimizations that use the small data section. This may
15686 be useful for working around optimizer bugs.
15687
15688 @item -mconstant-gp
15689 @opindex mconstant-gp
15690 Generate code that uses a single constant global pointer value. This is
15691 useful when compiling kernel code.
15692
15693 @item -mauto-pic
15694 @opindex mauto-pic
15695 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
15696 This is useful when compiling firmware code.
15697
15698 @item -minline-float-divide-min-latency
15699 @opindex minline-float-divide-min-latency
15700 Generate code for inline divides of floating-point values
15701 using the minimum latency algorithm.
15702
15703 @item -minline-float-divide-max-throughput
15704 @opindex minline-float-divide-max-throughput
15705 Generate code for inline divides of floating-point values
15706 using the maximum throughput algorithm.
15707
15708 @item -mno-inline-float-divide
15709 @opindex mno-inline-float-divide
15710 Do not generate inline code for divides of floating-point values.
15711
15712 @item -minline-int-divide-min-latency
15713 @opindex minline-int-divide-min-latency
15714 Generate code for inline divides of integer values
15715 using the minimum latency algorithm.
15716
15717 @item -minline-int-divide-max-throughput
15718 @opindex minline-int-divide-max-throughput
15719 Generate code for inline divides of integer values
15720 using the maximum throughput algorithm.
15721
15722 @item -mno-inline-int-divide
15723 @opindex mno-inline-int-divide
15724 Do not generate inline code for divides of integer values.
15725
15726 @item -minline-sqrt-min-latency
15727 @opindex minline-sqrt-min-latency
15728 Generate code for inline square roots
15729 using the minimum latency algorithm.
15730
15731 @item -minline-sqrt-max-throughput
15732 @opindex minline-sqrt-max-throughput
15733 Generate code for inline square roots
15734 using the maximum throughput algorithm.
15735
15736 @item -mno-inline-sqrt
15737 @opindex mno-inline-sqrt
15738 Do not generate inline code for @code{sqrt}.
15739
15740 @item -mfused-madd
15741 @itemx -mno-fused-madd
15742 @opindex mfused-madd
15743 @opindex mno-fused-madd
15744 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
15745 instructions. The default is to use these instructions.
15746
15747 @item -mno-dwarf2-asm
15748 @itemx -mdwarf2-asm
15749 @opindex mno-dwarf2-asm
15750 @opindex mdwarf2-asm
15751 Don't (or do) generate assembler code for the DWARF 2 line number debugging
15752 info. This may be useful when not using the GNU assembler.
15753
15754 @item -mearly-stop-bits
15755 @itemx -mno-early-stop-bits
15756 @opindex mearly-stop-bits
15757 @opindex mno-early-stop-bits
15758 Allow stop bits to be placed earlier than immediately preceding the
15759 instruction that triggered the stop bit. This can improve instruction
15760 scheduling, but does not always do so.
15761
15762 @item -mfixed-range=@var{register-range}
15763 @opindex mfixed-range
15764 Generate code treating the given register range as fixed registers.
15765 A fixed register is one that the register allocator cannot use. This is
15766 useful when compiling kernel code. A register range is specified as
15767 two registers separated by a dash. Multiple register ranges can be
15768 specified separated by a comma.
15769
15770 @item -mtls-size=@var{tls-size}
15771 @opindex mtls-size
15772 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
15773 64.
15774
15775 @item -mtune=@var{cpu-type}
15776 @opindex mtune
15777 Tune the instruction scheduling for a particular CPU, Valid values are
15778 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
15779 and @samp{mckinley}.
15780
15781 @item -milp32
15782 @itemx -mlp64
15783 @opindex milp32
15784 @opindex mlp64
15785 Generate code for a 32-bit or 64-bit environment.
15786 The 32-bit environment sets int, long and pointer to 32 bits.
15787 The 64-bit environment sets int to 32 bits and long and pointer
15788 to 64 bits. These are HP-UX specific flags.
15789
15790 @item -mno-sched-br-data-spec
15791 @itemx -msched-br-data-spec
15792 @opindex mno-sched-br-data-spec
15793 @opindex msched-br-data-spec
15794 (Dis/En)able data speculative scheduling before reload.
15795 This results in generation of @code{ld.a} instructions and
15796 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
15797 The default is 'disable'.
15798
15799 @item -msched-ar-data-spec
15800 @itemx -mno-sched-ar-data-spec
15801 @opindex msched-ar-data-spec
15802 @opindex mno-sched-ar-data-spec
15803 (En/Dis)able data speculative scheduling after reload.
15804 This results in generation of @code{ld.a} instructions and
15805 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
15806 The default is 'enable'.
15807
15808 @item -mno-sched-control-spec
15809 @itemx -msched-control-spec
15810 @opindex mno-sched-control-spec
15811 @opindex msched-control-spec
15812 (Dis/En)able control speculative scheduling. This feature is
15813 available only during region scheduling (i.e.@: before reload).
15814 This results in generation of the @code{ld.s} instructions and
15815 the corresponding check instructions @code{chk.s}.
15816 The default is 'disable'.
15817
15818 @item -msched-br-in-data-spec
15819 @itemx -mno-sched-br-in-data-spec
15820 @opindex msched-br-in-data-spec
15821 @opindex mno-sched-br-in-data-spec
15822 (En/Dis)able speculative scheduling of the instructions that
15823 are dependent on the data speculative loads before reload.
15824 This is effective only with @option{-msched-br-data-spec} enabled.
15825 The default is 'enable'.
15826
15827 @item -msched-ar-in-data-spec
15828 @itemx -mno-sched-ar-in-data-spec
15829 @opindex msched-ar-in-data-spec
15830 @opindex mno-sched-ar-in-data-spec
15831 (En/Dis)able speculative scheduling of the instructions that
15832 are dependent on the data speculative loads after reload.
15833 This is effective only with @option{-msched-ar-data-spec} enabled.
15834 The default is 'enable'.
15835
15836 @item -msched-in-control-spec
15837 @itemx -mno-sched-in-control-spec
15838 @opindex msched-in-control-spec
15839 @opindex mno-sched-in-control-spec
15840 (En/Dis)able speculative scheduling of the instructions that
15841 are dependent on the control speculative loads.
15842 This is effective only with @option{-msched-control-spec} enabled.
15843 The default is 'enable'.
15844
15845 @item -mno-sched-prefer-non-data-spec-insns
15846 @itemx -msched-prefer-non-data-spec-insns
15847 @opindex mno-sched-prefer-non-data-spec-insns
15848 @opindex msched-prefer-non-data-spec-insns
15849 If enabled, data-speculative instructions are chosen for schedule
15850 only if there are no other choices at the moment. This makes
15851 the use of the data speculation much more conservative.
15852 The default is 'disable'.
15853
15854 @item -mno-sched-prefer-non-control-spec-insns
15855 @itemx -msched-prefer-non-control-spec-insns
15856 @opindex mno-sched-prefer-non-control-spec-insns
15857 @opindex msched-prefer-non-control-spec-insns
15858 If enabled, control-speculative instructions are chosen for schedule
15859 only if there are no other choices at the moment. This makes
15860 the use of the control speculation much more conservative.
15861 The default is 'disable'.
15862
15863 @item -mno-sched-count-spec-in-critical-path
15864 @itemx -msched-count-spec-in-critical-path
15865 @opindex mno-sched-count-spec-in-critical-path
15866 @opindex msched-count-spec-in-critical-path
15867 If enabled, speculative dependencies are considered during
15868 computation of the instructions priorities. This makes the use of the
15869 speculation a bit more conservative.
15870 The default is 'disable'.
15871
15872 @item -msched-spec-ldc
15873 @opindex msched-spec-ldc
15874 Use a simple data speculation check. This option is on by default.
15875
15876 @item -msched-control-spec-ldc
15877 @opindex msched-spec-ldc
15878 Use a simple check for control speculation. This option is on by default.
15879
15880 @item -msched-stop-bits-after-every-cycle
15881 @opindex msched-stop-bits-after-every-cycle
15882 Place a stop bit after every cycle when scheduling. This option is on
15883 by default.
15884
15885 @item -msched-fp-mem-deps-zero-cost
15886 @opindex msched-fp-mem-deps-zero-cost
15887 Assume that floating-point stores and loads are not likely to cause a conflict
15888 when placed into the same instruction group. This option is disabled by
15889 default.
15890
15891 @item -msel-sched-dont-check-control-spec
15892 @opindex msel-sched-dont-check-control-spec
15893 Generate checks for control speculation in selective scheduling.
15894 This flag is disabled by default.
15895
15896 @item -msched-max-memory-insns=@var{max-insns}
15897 @opindex msched-max-memory-insns
15898 Limit on the number of memory insns per instruction group, giving lower
15899 priority to subsequent memory insns attempting to schedule in the same
15900 instruction group. Frequently useful to prevent cache bank conflicts.
15901 The default value is 1.
15902
15903 @item -msched-max-memory-insns-hard-limit
15904 @opindex msched-max-memory-insns-hard-limit
15905 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
15906 disallowing more than that number in an instruction group.
15907 Otherwise, the limit is ``soft'', meaning that non-memory operations
15908 are preferred when the limit is reached, but memory operations may still
15909 be scheduled.
15910
15911 @end table
15912
15913 @node LM32 Options
15914 @subsection LM32 Options
15915 @cindex LM32 options
15916
15917 These @option{-m} options are defined for the LatticeMico32 architecture:
15918
15919 @table @gcctabopt
15920 @item -mbarrel-shift-enabled
15921 @opindex mbarrel-shift-enabled
15922 Enable barrel-shift instructions.
15923
15924 @item -mdivide-enabled
15925 @opindex mdivide-enabled
15926 Enable divide and modulus instructions.
15927
15928 @item -mmultiply-enabled
15929 @opindex multiply-enabled
15930 Enable multiply instructions.
15931
15932 @item -msign-extend-enabled
15933 @opindex msign-extend-enabled
15934 Enable sign extend instructions.
15935
15936 @item -muser-enabled
15937 @opindex muser-enabled
15938 Enable user-defined instructions.
15939
15940 @end table
15941
15942 @node M32C Options
15943 @subsection M32C Options
15944 @cindex M32C options
15945
15946 @table @gcctabopt
15947 @item -mcpu=@var{name}
15948 @opindex mcpu=
15949 Select the CPU for which code is generated. @var{name} may be one of
15950 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
15951 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
15952 the M32C/80 series.
15953
15954 @item -msim
15955 @opindex msim
15956 Specifies that the program will be run on the simulator. This causes
15957 an alternate runtime library to be linked in which supports, for
15958 example, file I/O@. You must not use this option when generating
15959 programs that will run on real hardware; you must provide your own
15960 runtime library for whatever I/O functions are needed.
15961
15962 @item -memregs=@var{number}
15963 @opindex memregs=
15964 Specifies the number of memory-based pseudo-registers GCC uses
15965 during code generation. These pseudo-registers are used like real
15966 registers, so there is a tradeoff between GCC's ability to fit the
15967 code into available registers, and the performance penalty of using
15968 memory instead of registers. Note that all modules in a program must
15969 be compiled with the same value for this option. Because of that, you
15970 must not use this option with GCC's default runtime libraries.
15971
15972 @end table
15973
15974 @node M32R/D Options
15975 @subsection M32R/D Options
15976 @cindex M32R/D options
15977
15978 These @option{-m} options are defined for Renesas M32R/D architectures:
15979
15980 @table @gcctabopt
15981 @item -m32r2
15982 @opindex m32r2
15983 Generate code for the M32R/2@.
15984
15985 @item -m32rx
15986 @opindex m32rx
15987 Generate code for the M32R/X@.
15988
15989 @item -m32r
15990 @opindex m32r
15991 Generate code for the M32R@. This is the default.
15992
15993 @item -mmodel=small
15994 @opindex mmodel=small
15995 Assume all objects live in the lower 16MB of memory (so that their addresses
15996 can be loaded with the @code{ld24} instruction), and assume all subroutines
15997 are reachable with the @code{bl} instruction.
15998 This is the default.
15999
16000 The addressability of a particular object can be set with the
16001 @code{model} attribute.
16002
16003 @item -mmodel=medium
16004 @opindex mmodel=medium
16005 Assume objects may be anywhere in the 32-bit address space (the compiler
16006 generates @code{seth/add3} instructions to load their addresses), and
16007 assume all subroutines are reachable with the @code{bl} instruction.
16008
16009 @item -mmodel=large
16010 @opindex mmodel=large
16011 Assume objects may be anywhere in the 32-bit address space (the compiler
16012 generates @code{seth/add3} instructions to load their addresses), and
16013 assume subroutines may not be reachable with the @code{bl} instruction
16014 (the compiler generates the much slower @code{seth/add3/jl}
16015 instruction sequence).
16016
16017 @item -msdata=none
16018 @opindex msdata=none
16019 Disable use of the small data area. Variables are put into
16020 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
16021 @code{section} attribute has been specified).
16022 This is the default.
16023
16024 The small data area consists of sections @code{.sdata} and @code{.sbss}.
16025 Objects may be explicitly put in the small data area with the
16026 @code{section} attribute using one of these sections.
16027
16028 @item -msdata=sdata
16029 @opindex msdata=sdata
16030 Put small global and static data in the small data area, but do not
16031 generate special code to reference them.
16032
16033 @item -msdata=use
16034 @opindex msdata=use
16035 Put small global and static data in the small data area, and generate
16036 special instructions to reference them.
16037
16038 @item -G @var{num}
16039 @opindex G
16040 @cindex smaller data references
16041 Put global and static objects less than or equal to @var{num} bytes
16042 into the small data or BSS sections instead of the normal data or BSS
16043 sections. The default value of @var{num} is 8.
16044 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
16045 for this option to have any effect.
16046
16047 All modules should be compiled with the same @option{-G @var{num}} value.
16048 Compiling with different values of @var{num} may or may not work; if it
16049 doesn't the linker gives an error message---incorrect code is not
16050 generated.
16051
16052 @item -mdebug
16053 @opindex mdebug
16054 Makes the M32R-specific code in the compiler display some statistics
16055 that might help in debugging programs.
16056
16057 @item -malign-loops
16058 @opindex malign-loops
16059 Align all loops to a 32-byte boundary.
16060
16061 @item -mno-align-loops
16062 @opindex mno-align-loops
16063 Do not enforce a 32-byte alignment for loops. This is the default.
16064
16065 @item -missue-rate=@var{number}
16066 @opindex missue-rate=@var{number}
16067 Issue @var{number} instructions per cycle. @var{number} can only be 1
16068 or 2.
16069
16070 @item -mbranch-cost=@var{number}
16071 @opindex mbranch-cost=@var{number}
16072 @var{number} can only be 1 or 2. If it is 1 then branches are
16073 preferred over conditional code, if it is 2, then the opposite applies.
16074
16075 @item -mflush-trap=@var{number}
16076 @opindex mflush-trap=@var{number}
16077 Specifies the trap number to use to flush the cache. The default is
16078 12. Valid numbers are between 0 and 15 inclusive.
16079
16080 @item -mno-flush-trap
16081 @opindex mno-flush-trap
16082 Specifies that the cache cannot be flushed by using a trap.
16083
16084 @item -mflush-func=@var{name}
16085 @opindex mflush-func=@var{name}
16086 Specifies the name of the operating system function to call to flush
16087 the cache. The default is @samp{_flush_cache}, but a function call
16088 is only used if a trap is not available.
16089
16090 @item -mno-flush-func
16091 @opindex mno-flush-func
16092 Indicates that there is no OS function for flushing the cache.
16093
16094 @end table
16095
16096 @node M680x0 Options
16097 @subsection M680x0 Options
16098 @cindex M680x0 options
16099
16100 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
16101 The default settings depend on which architecture was selected when
16102 the compiler was configured; the defaults for the most common choices
16103 are given below.
16104
16105 @table @gcctabopt
16106 @item -march=@var{arch}
16107 @opindex march
16108 Generate code for a specific M680x0 or ColdFire instruction set
16109 architecture. Permissible values of @var{arch} for M680x0
16110 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
16111 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
16112 architectures are selected according to Freescale's ISA classification
16113 and the permissible values are: @samp{isaa}, @samp{isaaplus},
16114 @samp{isab} and @samp{isac}.
16115
16116 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
16117 code for a ColdFire target. The @var{arch} in this macro is one of the
16118 @option{-march} arguments given above.
16119
16120 When used together, @option{-march} and @option{-mtune} select code
16121 that runs on a family of similar processors but that is optimized
16122 for a particular microarchitecture.
16123
16124 @item -mcpu=@var{cpu}
16125 @opindex mcpu
16126 Generate code for a specific M680x0 or ColdFire processor.
16127 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
16128 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
16129 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
16130 below, which also classifies the CPUs into families:
16131
16132 @multitable @columnfractions 0.20 0.80
16133 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
16134 @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}
16135 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
16136 @item @samp{5206e} @tab @samp{5206e}
16137 @item @samp{5208} @tab @samp{5207} @samp{5208}
16138 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
16139 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
16140 @item @samp{5216} @tab @samp{5214} @samp{5216}
16141 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
16142 @item @samp{5225} @tab @samp{5224} @samp{5225}
16143 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
16144 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
16145 @item @samp{5249} @tab @samp{5249}
16146 @item @samp{5250} @tab @samp{5250}
16147 @item @samp{5271} @tab @samp{5270} @samp{5271}
16148 @item @samp{5272} @tab @samp{5272}
16149 @item @samp{5275} @tab @samp{5274} @samp{5275}
16150 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
16151 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
16152 @item @samp{5307} @tab @samp{5307}
16153 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
16154 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
16155 @item @samp{5407} @tab @samp{5407}
16156 @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}
16157 @end multitable
16158
16159 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
16160 @var{arch} is compatible with @var{cpu}. Other combinations of
16161 @option{-mcpu} and @option{-march} are rejected.
16162
16163 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
16164 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
16165 where the value of @var{family} is given by the table above.
16166
16167 @item -mtune=@var{tune}
16168 @opindex mtune
16169 Tune the code for a particular microarchitecture within the
16170 constraints set by @option{-march} and @option{-mcpu}.
16171 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
16172 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
16173 and @samp{cpu32}. The ColdFire microarchitectures
16174 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
16175
16176 You can also use @option{-mtune=68020-40} for code that needs
16177 to run relatively well on 68020, 68030 and 68040 targets.
16178 @option{-mtune=68020-60} is similar but includes 68060 targets
16179 as well. These two options select the same tuning decisions as
16180 @option{-m68020-40} and @option{-m68020-60} respectively.
16181
16182 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
16183 when tuning for 680x0 architecture @var{arch}. It also defines
16184 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
16185 option is used. If GCC is tuning for a range of architectures,
16186 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
16187 it defines the macros for every architecture in the range.
16188
16189 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
16190 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
16191 of the arguments given above.
16192
16193 @item -m68000
16194 @itemx -mc68000
16195 @opindex m68000
16196 @opindex mc68000
16197 Generate output for a 68000. This is the default
16198 when the compiler is configured for 68000-based systems.
16199 It is equivalent to @option{-march=68000}.
16200
16201 Use this option for microcontrollers with a 68000 or EC000 core,
16202 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
16203
16204 @item -m68010
16205 @opindex m68010
16206 Generate output for a 68010. This is the default
16207 when the compiler is configured for 68010-based systems.
16208 It is equivalent to @option{-march=68010}.
16209
16210 @item -m68020
16211 @itemx -mc68020
16212 @opindex m68020
16213 @opindex mc68020
16214 Generate output for a 68020. This is the default
16215 when the compiler is configured for 68020-based systems.
16216 It is equivalent to @option{-march=68020}.
16217
16218 @item -m68030
16219 @opindex m68030
16220 Generate output for a 68030. This is the default when the compiler is
16221 configured for 68030-based systems. It is equivalent to
16222 @option{-march=68030}.
16223
16224 @item -m68040
16225 @opindex m68040
16226 Generate output for a 68040. This is the default when the compiler is
16227 configured for 68040-based systems. It is equivalent to
16228 @option{-march=68040}.
16229
16230 This option inhibits the use of 68881/68882 instructions that have to be
16231 emulated by software on the 68040. Use this option if your 68040 does not
16232 have code to emulate those instructions.
16233
16234 @item -m68060
16235 @opindex m68060
16236 Generate output for a 68060. This is the default when the compiler is
16237 configured for 68060-based systems. It is equivalent to
16238 @option{-march=68060}.
16239
16240 This option inhibits the use of 68020 and 68881/68882 instructions that
16241 have to be emulated by software on the 68060. Use this option if your 68060
16242 does not have code to emulate those instructions.
16243
16244 @item -mcpu32
16245 @opindex mcpu32
16246 Generate output for a CPU32. This is the default
16247 when the compiler is configured for CPU32-based systems.
16248 It is equivalent to @option{-march=cpu32}.
16249
16250 Use this option for microcontrollers with a
16251 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
16252 68336, 68340, 68341, 68349 and 68360.
16253
16254 @item -m5200
16255 @opindex m5200
16256 Generate output for a 520X ColdFire CPU@. This is the default
16257 when the compiler is configured for 520X-based systems.
16258 It is equivalent to @option{-mcpu=5206}, and is now deprecated
16259 in favor of that option.
16260
16261 Use this option for microcontroller with a 5200 core, including
16262 the MCF5202, MCF5203, MCF5204 and MCF5206.
16263
16264 @item -m5206e
16265 @opindex m5206e
16266 Generate output for a 5206e ColdFire CPU@. The option is now
16267 deprecated in favor of the equivalent @option{-mcpu=5206e}.
16268
16269 @item -m528x
16270 @opindex m528x
16271 Generate output for a member of the ColdFire 528X family.
16272 The option is now deprecated in favor of the equivalent
16273 @option{-mcpu=528x}.
16274
16275 @item -m5307
16276 @opindex m5307
16277 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
16278 in favor of the equivalent @option{-mcpu=5307}.
16279
16280 @item -m5407
16281 @opindex m5407
16282 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
16283 in favor of the equivalent @option{-mcpu=5407}.
16284
16285 @item -mcfv4e
16286 @opindex mcfv4e
16287 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
16288 This includes use of hardware floating-point instructions.
16289 The option is equivalent to @option{-mcpu=547x}, and is now
16290 deprecated in favor of that option.
16291
16292 @item -m68020-40
16293 @opindex m68020-40
16294 Generate output for a 68040, without using any of the new instructions.
16295 This results in code that can run relatively efficiently on either a
16296 68020/68881 or a 68030 or a 68040. The generated code does use the
16297 68881 instructions that are emulated on the 68040.
16298
16299 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
16300
16301 @item -m68020-60
16302 @opindex m68020-60
16303 Generate output for a 68060, without using any of the new instructions.
16304 This results in code that can run relatively efficiently on either a
16305 68020/68881 or a 68030 or a 68040. The generated code does use the
16306 68881 instructions that are emulated on the 68060.
16307
16308 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
16309
16310 @item -mhard-float
16311 @itemx -m68881
16312 @opindex mhard-float
16313 @opindex m68881
16314 Generate floating-point instructions. This is the default for 68020
16315 and above, and for ColdFire devices that have an FPU@. It defines the
16316 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
16317 on ColdFire targets.
16318
16319 @item -msoft-float
16320 @opindex msoft-float
16321 Do not generate floating-point instructions; use library calls instead.
16322 This is the default for 68000, 68010, and 68832 targets. It is also
16323 the default for ColdFire devices that have no FPU.
16324
16325 @item -mdiv
16326 @itemx -mno-div
16327 @opindex mdiv
16328 @opindex mno-div
16329 Generate (do not generate) ColdFire hardware divide and remainder
16330 instructions. If @option{-march} is used without @option{-mcpu},
16331 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
16332 architectures. Otherwise, the default is taken from the target CPU
16333 (either the default CPU, or the one specified by @option{-mcpu}). For
16334 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
16335 @option{-mcpu=5206e}.
16336
16337 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
16338
16339 @item -mshort
16340 @opindex mshort
16341 Consider type @code{int} to be 16 bits wide, like @code{short int}.
16342 Additionally, parameters passed on the stack are also aligned to a
16343 16-bit boundary even on targets whose API mandates promotion to 32-bit.
16344
16345 @item -mno-short
16346 @opindex mno-short
16347 Do not consider type @code{int} to be 16 bits wide. This is the default.
16348
16349 @item -mnobitfield
16350 @itemx -mno-bitfield
16351 @opindex mnobitfield
16352 @opindex mno-bitfield
16353 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
16354 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
16355
16356 @item -mbitfield
16357 @opindex mbitfield
16358 Do use the bit-field instructions. The @option{-m68020} option implies
16359 @option{-mbitfield}. This is the default if you use a configuration
16360 designed for a 68020.
16361
16362 @item -mrtd
16363 @opindex mrtd
16364 Use a different function-calling convention, in which functions
16365 that take a fixed number of arguments return with the @code{rtd}
16366 instruction, which pops their arguments while returning. This
16367 saves one instruction in the caller since there is no need to pop
16368 the arguments there.
16369
16370 This calling convention is incompatible with the one normally
16371 used on Unix, so you cannot use it if you need to call libraries
16372 compiled with the Unix compiler.
16373
16374 Also, you must provide function prototypes for all functions that
16375 take variable numbers of arguments (including @code{printf});
16376 otherwise incorrect code is generated for calls to those
16377 functions.
16378
16379 In addition, seriously incorrect code results if you call a
16380 function with too many arguments. (Normally, extra arguments are
16381 harmlessly ignored.)
16382
16383 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
16384 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
16385
16386 @item -mno-rtd
16387 @opindex mno-rtd
16388 Do not use the calling conventions selected by @option{-mrtd}.
16389 This is the default.
16390
16391 @item -malign-int
16392 @itemx -mno-align-int
16393 @opindex malign-int
16394 @opindex mno-align-int
16395 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
16396 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
16397 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
16398 Aligning variables on 32-bit boundaries produces code that runs somewhat
16399 faster on processors with 32-bit busses at the expense of more memory.
16400
16401 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
16402 aligns structures containing the above types differently than
16403 most published application binary interface specifications for the m68k.
16404
16405 @item -mpcrel
16406 @opindex mpcrel
16407 Use the pc-relative addressing mode of the 68000 directly, instead of
16408 using a global offset table. At present, this option implies @option{-fpic},
16409 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
16410 not presently supported with @option{-mpcrel}, though this could be supported for
16411 68020 and higher processors.
16412
16413 @item -mno-strict-align
16414 @itemx -mstrict-align
16415 @opindex mno-strict-align
16416 @opindex mstrict-align
16417 Do not (do) assume that unaligned memory references are handled by
16418 the system.
16419
16420 @item -msep-data
16421 Generate code that allows the data segment to be located in a different
16422 area of memory from the text segment. This allows for execute-in-place in
16423 an environment without virtual memory management. This option implies
16424 @option{-fPIC}.
16425
16426 @item -mno-sep-data
16427 Generate code that assumes that the data segment follows the text segment.
16428 This is the default.
16429
16430 @item -mid-shared-library
16431 Generate code that supports shared libraries via the library ID method.
16432 This allows for execute-in-place and shared libraries in an environment
16433 without virtual memory management. This option implies @option{-fPIC}.
16434
16435 @item -mno-id-shared-library
16436 Generate code that doesn't assume ID-based shared libraries are being used.
16437 This is the default.
16438
16439 @item -mshared-library-id=n
16440 Specifies the identification number of the ID-based shared library being
16441 compiled. Specifying a value of 0 generates more compact code; specifying
16442 other values forces the allocation of that number to the current
16443 library, but is no more space- or time-efficient than omitting this option.
16444
16445 @item -mxgot
16446 @itemx -mno-xgot
16447 @opindex mxgot
16448 @opindex mno-xgot
16449 When generating position-independent code for ColdFire, generate code
16450 that works if the GOT has more than 8192 entries. This code is
16451 larger and slower than code generated without this option. On M680x0
16452 processors, this option is not needed; @option{-fPIC} suffices.
16453
16454 GCC normally uses a single instruction to load values from the GOT@.
16455 While this is relatively efficient, it only works if the GOT
16456 is smaller than about 64k. Anything larger causes the linker
16457 to report an error such as:
16458
16459 @cindex relocation truncated to fit (ColdFire)
16460 @smallexample
16461 relocation truncated to fit: R_68K_GOT16O foobar
16462 @end smallexample
16463
16464 If this happens, you should recompile your code with @option{-mxgot}.
16465 It should then work with very large GOTs. However, code generated with
16466 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
16467 the value of a global symbol.
16468
16469 Note that some linkers, including newer versions of the GNU linker,
16470 can create multiple GOTs and sort GOT entries. If you have such a linker,
16471 you should only need to use @option{-mxgot} when compiling a single
16472 object file that accesses more than 8192 GOT entries. Very few do.
16473
16474 These options have no effect unless GCC is generating
16475 position-independent code.
16476
16477 @end table
16478
16479 @node MCore Options
16480 @subsection MCore Options
16481 @cindex MCore options
16482
16483 These are the @samp{-m} options defined for the Motorola M*Core
16484 processors.
16485
16486 @table @gcctabopt
16487
16488 @item -mhardlit
16489 @itemx -mno-hardlit
16490 @opindex mhardlit
16491 @opindex mno-hardlit
16492 Inline constants into the code stream if it can be done in two
16493 instructions or less.
16494
16495 @item -mdiv
16496 @itemx -mno-div
16497 @opindex mdiv
16498 @opindex mno-div
16499 Use the divide instruction. (Enabled by default).
16500
16501 @item -mrelax-immediate
16502 @itemx -mno-relax-immediate
16503 @opindex mrelax-immediate
16504 @opindex mno-relax-immediate
16505 Allow arbitrary-sized immediates in bit operations.
16506
16507 @item -mwide-bitfields
16508 @itemx -mno-wide-bitfields
16509 @opindex mwide-bitfields
16510 @opindex mno-wide-bitfields
16511 Always treat bit-fields as @code{int}-sized.
16512
16513 @item -m4byte-functions
16514 @itemx -mno-4byte-functions
16515 @opindex m4byte-functions
16516 @opindex mno-4byte-functions
16517 Force all functions to be aligned to a 4-byte boundary.
16518
16519 @item -mcallgraph-data
16520 @itemx -mno-callgraph-data
16521 @opindex mcallgraph-data
16522 @opindex mno-callgraph-data
16523 Emit callgraph information.
16524
16525 @item -mslow-bytes
16526 @itemx -mno-slow-bytes
16527 @opindex mslow-bytes
16528 @opindex mno-slow-bytes
16529 Prefer word access when reading byte quantities.
16530
16531 @item -mlittle-endian
16532 @itemx -mbig-endian
16533 @opindex mlittle-endian
16534 @opindex mbig-endian
16535 Generate code for a little-endian target.
16536
16537 @item -m210
16538 @itemx -m340
16539 @opindex m210
16540 @opindex m340
16541 Generate code for the 210 processor.
16542
16543 @item -mno-lsim
16544 @opindex mno-lsim
16545 Assume that runtime support has been provided and so omit the
16546 simulator library (@file{libsim.a)} from the linker command line.
16547
16548 @item -mstack-increment=@var{size}
16549 @opindex mstack-increment
16550 Set the maximum amount for a single stack increment operation. Large
16551 values can increase the speed of programs that contain functions
16552 that need a large amount of stack space, but they can also trigger a
16553 segmentation fault if the stack is extended too much. The default
16554 value is 0x1000.
16555
16556 @end table
16557
16558 @node MeP Options
16559 @subsection MeP Options
16560 @cindex MeP options
16561
16562 @table @gcctabopt
16563
16564 @item -mabsdiff
16565 @opindex mabsdiff
16566 Enables the @code{abs} instruction, which is the absolute difference
16567 between two registers.
16568
16569 @item -mall-opts
16570 @opindex mall-opts
16571 Enables all the optional instructions---average, multiply, divide, bit
16572 operations, leading zero, absolute difference, min/max, clip, and
16573 saturation.
16574
16575
16576 @item -maverage
16577 @opindex maverage
16578 Enables the @code{ave} instruction, which computes the average of two
16579 registers.
16580
16581 @item -mbased=@var{n}
16582 @opindex mbased=
16583 Variables of size @var{n} bytes or smaller are placed in the
16584 @code{.based} section by default. Based variables use the @code{$tp}
16585 register as a base register, and there is a 128-byte limit to the
16586 @code{.based} section.
16587
16588 @item -mbitops
16589 @opindex mbitops
16590 Enables the bit operation instructions---bit test (@code{btstm}), set
16591 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
16592 test-and-set (@code{tas}).
16593
16594 @item -mc=@var{name}
16595 @opindex mc=
16596 Selects which section constant data is placed in. @var{name} may
16597 be @samp{tiny}, @samp{near}, or @samp{far}.
16598
16599 @item -mclip
16600 @opindex mclip
16601 Enables the @code{clip} instruction. Note that @option{-mclip} is not
16602 useful unless you also provide @option{-mminmax}.
16603
16604 @item -mconfig=@var{name}
16605 @opindex mconfig=
16606 Selects one of the built-in core configurations. Each MeP chip has
16607 one or more modules in it; each module has a core CPU and a variety of
16608 coprocessors, optional instructions, and peripherals. The
16609 @code{MeP-Integrator} tool, not part of GCC, provides these
16610 configurations through this option; using this option is the same as
16611 using all the corresponding command-line options. The default
16612 configuration is @samp{default}.
16613
16614 @item -mcop
16615 @opindex mcop
16616 Enables the coprocessor instructions. By default, this is a 32-bit
16617 coprocessor. Note that the coprocessor is normally enabled via the
16618 @option{-mconfig=} option.
16619
16620 @item -mcop32
16621 @opindex mcop32
16622 Enables the 32-bit coprocessor's instructions.
16623
16624 @item -mcop64
16625 @opindex mcop64
16626 Enables the 64-bit coprocessor's instructions.
16627
16628 @item -mivc2
16629 @opindex mivc2
16630 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
16631
16632 @item -mdc
16633 @opindex mdc
16634 Causes constant variables to be placed in the @code{.near} section.
16635
16636 @item -mdiv
16637 @opindex mdiv
16638 Enables the @code{div} and @code{divu} instructions.
16639
16640 @item -meb
16641 @opindex meb
16642 Generate big-endian code.
16643
16644 @item -mel
16645 @opindex mel
16646 Generate little-endian code.
16647
16648 @item -mio-volatile
16649 @opindex mio-volatile
16650 Tells the compiler that any variable marked with the @code{io}
16651 attribute is to be considered volatile.
16652
16653 @item -ml
16654 @opindex ml
16655 Causes variables to be assigned to the @code{.far} section by default.
16656
16657 @item -mleadz
16658 @opindex mleadz
16659 Enables the @code{leadz} (leading zero) instruction.
16660
16661 @item -mm
16662 @opindex mm
16663 Causes variables to be assigned to the @code{.near} section by default.
16664
16665 @item -mminmax
16666 @opindex mminmax
16667 Enables the @code{min} and @code{max} instructions.
16668
16669 @item -mmult
16670 @opindex mmult
16671 Enables the multiplication and multiply-accumulate instructions.
16672
16673 @item -mno-opts
16674 @opindex mno-opts
16675 Disables all the optional instructions enabled by @option{-mall-opts}.
16676
16677 @item -mrepeat
16678 @opindex mrepeat
16679 Enables the @code{repeat} and @code{erepeat} instructions, used for
16680 low-overhead looping.
16681
16682 @item -ms
16683 @opindex ms
16684 Causes all variables to default to the @code{.tiny} section. Note
16685 that there is a 65536-byte limit to this section. Accesses to these
16686 variables use the @code{%gp} base register.
16687
16688 @item -msatur
16689 @opindex msatur
16690 Enables the saturation instructions. Note that the compiler does not
16691 currently generate these itself, but this option is included for
16692 compatibility with other tools, like @code{as}.
16693
16694 @item -msdram
16695 @opindex msdram
16696 Link the SDRAM-based runtime instead of the default ROM-based runtime.
16697
16698 @item -msim
16699 @opindex msim
16700 Link the simulator run-time libraries.
16701
16702 @item -msimnovec
16703 @opindex msimnovec
16704 Link the simulator runtime libraries, excluding built-in support
16705 for reset and exception vectors and tables.
16706
16707 @item -mtf
16708 @opindex mtf
16709 Causes all functions to default to the @code{.far} section. Without
16710 this option, functions default to the @code{.near} section.
16711
16712 @item -mtiny=@var{n}
16713 @opindex mtiny=
16714 Variables that are @var{n} bytes or smaller are allocated to the
16715 @code{.tiny} section. These variables use the @code{$gp} base
16716 register. The default for this option is 4, but note that there's a
16717 65536-byte limit to the @code{.tiny} section.
16718
16719 @end table
16720
16721 @node MicroBlaze Options
16722 @subsection MicroBlaze Options
16723 @cindex MicroBlaze Options
16724
16725 @table @gcctabopt
16726
16727 @item -msoft-float
16728 @opindex msoft-float
16729 Use software emulation for floating point (default).
16730
16731 @item -mhard-float
16732 @opindex mhard-float
16733 Use hardware floating-point instructions.
16734
16735 @item -mmemcpy
16736 @opindex mmemcpy
16737 Do not optimize block moves, use @code{memcpy}.
16738
16739 @item -mno-clearbss
16740 @opindex mno-clearbss
16741 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
16742
16743 @item -mcpu=@var{cpu-type}
16744 @opindex mcpu=
16745 Use features of, and schedule code for, the given CPU.
16746 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
16747 where @var{X} is a major version, @var{YY} is the minor version, and
16748 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
16749 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
16750
16751 @item -mxl-soft-mul
16752 @opindex mxl-soft-mul
16753 Use software multiply emulation (default).
16754
16755 @item -mxl-soft-div
16756 @opindex mxl-soft-div
16757 Use software emulation for divides (default).
16758
16759 @item -mxl-barrel-shift
16760 @opindex mxl-barrel-shift
16761 Use the hardware barrel shifter.
16762
16763 @item -mxl-pattern-compare
16764 @opindex mxl-pattern-compare
16765 Use pattern compare instructions.
16766
16767 @item -msmall-divides
16768 @opindex msmall-divides
16769 Use table lookup optimization for small signed integer divisions.
16770
16771 @item -mxl-stack-check
16772 @opindex mxl-stack-check
16773 This option is deprecated. Use @option{-fstack-check} instead.
16774
16775 @item -mxl-gp-opt
16776 @opindex mxl-gp-opt
16777 Use GP-relative @code{.sdata}/@code{.sbss} sections.
16778
16779 @item -mxl-multiply-high
16780 @opindex mxl-multiply-high
16781 Use multiply high instructions for high part of 32x32 multiply.
16782
16783 @item -mxl-float-convert
16784 @opindex mxl-float-convert
16785 Use hardware floating-point conversion instructions.
16786
16787 @item -mxl-float-sqrt
16788 @opindex mxl-float-sqrt
16789 Use hardware floating-point square root instruction.
16790
16791 @item -mbig-endian
16792 @opindex mbig-endian
16793 Generate code for a big-endian target.
16794
16795 @item -mlittle-endian
16796 @opindex mlittle-endian
16797 Generate code for a little-endian target.
16798
16799 @item -mxl-reorder
16800 @opindex mxl-reorder
16801 Use reorder instructions (swap and byte reversed load/store).
16802
16803 @item -mxl-mode-@var{app-model}
16804 Select application model @var{app-model}. Valid models are
16805 @table @samp
16806 @item executable
16807 normal executable (default), uses startup code @file{crt0.o}.
16808
16809 @item xmdstub
16810 for use with Xilinx Microprocessor Debugger (XMD) based
16811 software intrusive debug agent called xmdstub. This uses startup file
16812 @file{crt1.o} and sets the start address of the program to 0x800.
16813
16814 @item bootstrap
16815 for applications that are loaded using a bootloader.
16816 This model uses startup file @file{crt2.o} which does not contain a processor
16817 reset vector handler. This is suitable for transferring control on a
16818 processor reset to the bootloader rather than the application.
16819
16820 @item novectors
16821 for applications that do not require any of the
16822 MicroBlaze vectors. This option may be useful for applications running
16823 within a monitoring application. This model uses @file{crt3.o} as a startup file.
16824 @end table
16825
16826 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
16827 @option{-mxl-mode-@var{app-model}}.
16828
16829 @end table
16830
16831 @node MIPS Options
16832 @subsection MIPS Options
16833 @cindex MIPS options
16834
16835 @table @gcctabopt
16836
16837 @item -EB
16838 @opindex EB
16839 Generate big-endian code.
16840
16841 @item -EL
16842 @opindex EL
16843 Generate little-endian code. This is the default for @samp{mips*el-*-*}
16844 configurations.
16845
16846 @item -march=@var{arch}
16847 @opindex march
16848 Generate code that runs on @var{arch}, which can be the name of a
16849 generic MIPS ISA, or the name of a particular processor.
16850 The ISA names are:
16851 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
16852 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
16853 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
16854 @samp{mips64r5} and @samp{mips64r6}.
16855 The processor names are:
16856 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
16857 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
16858 @samp{5kc}, @samp{5kf},
16859 @samp{20kc},
16860 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
16861 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
16862 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
16863 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
16864 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
16865 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
16866 @samp{m4k},
16867 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
16868 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
16869 @samp{orion},
16870 @samp{p5600},
16871 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
16872 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
16873 @samp{rm7000}, @samp{rm9000},
16874 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
16875 @samp{sb1},
16876 @samp{sr71000},
16877 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
16878 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
16879 @samp{xlr} and @samp{xlp}.
16880 The special value @samp{from-abi} selects the
16881 most compatible architecture for the selected ABI (that is,
16882 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
16883
16884 The native Linux/GNU toolchain also supports the value @samp{native},
16885 which selects the best architecture option for the host processor.
16886 @option{-march=native} has no effect if GCC does not recognize
16887 the processor.
16888
16889 In processor names, a final @samp{000} can be abbreviated as @samp{k}
16890 (for example, @option{-march=r2k}). Prefixes are optional, and
16891 @samp{vr} may be written @samp{r}.
16892
16893 Names of the form @samp{@var{n}f2_1} refer to processors with
16894 FPUs clocked at half the rate of the core, names of the form
16895 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
16896 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
16897 processors with FPUs clocked a ratio of 3:2 with respect to the core.
16898 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
16899 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
16900 accepted as synonyms for @samp{@var{n}f1_1}.
16901
16902 GCC defines two macros based on the value of this option. The first
16903 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
16904 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
16905 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
16906 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
16907 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
16908
16909 Note that the @code{_MIPS_ARCH} macro uses the processor names given
16910 above. In other words, it has the full prefix and does not
16911 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
16912 the macro names the resolved architecture (either @code{"mips1"} or
16913 @code{"mips3"}). It names the default architecture when no
16914 @option{-march} option is given.
16915
16916 @item -mtune=@var{arch}
16917 @opindex mtune
16918 Optimize for @var{arch}. Among other things, this option controls
16919 the way instructions are scheduled, and the perceived cost of arithmetic
16920 operations. The list of @var{arch} values is the same as for
16921 @option{-march}.
16922
16923 When this option is not used, GCC optimizes for the processor
16924 specified by @option{-march}. By using @option{-march} and
16925 @option{-mtune} together, it is possible to generate code that
16926 runs on a family of processors, but optimize the code for one
16927 particular member of that family.
16928
16929 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
16930 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
16931 @option{-march} ones described above.
16932
16933 @item -mips1
16934 @opindex mips1
16935 Equivalent to @option{-march=mips1}.
16936
16937 @item -mips2
16938 @opindex mips2
16939 Equivalent to @option{-march=mips2}.
16940
16941 @item -mips3
16942 @opindex mips3
16943 Equivalent to @option{-march=mips3}.
16944
16945 @item -mips4
16946 @opindex mips4
16947 Equivalent to @option{-march=mips4}.
16948
16949 @item -mips32
16950 @opindex mips32
16951 Equivalent to @option{-march=mips32}.
16952
16953 @item -mips32r3
16954 @opindex mips32r3
16955 Equivalent to @option{-march=mips32r3}.
16956
16957 @item -mips32r5
16958 @opindex mips32r5
16959 Equivalent to @option{-march=mips32r5}.
16960
16961 @item -mips32r6
16962 @opindex mips32r6
16963 Equivalent to @option{-march=mips32r6}.
16964
16965 @item -mips64
16966 @opindex mips64
16967 Equivalent to @option{-march=mips64}.
16968
16969 @item -mips64r2
16970 @opindex mips64r2
16971 Equivalent to @option{-march=mips64r2}.
16972
16973 @item -mips64r3
16974 @opindex mips64r3
16975 Equivalent to @option{-march=mips64r3}.
16976
16977 @item -mips64r5
16978 @opindex mips64r5
16979 Equivalent to @option{-march=mips64r5}.
16980
16981 @item -mips64r6
16982 @opindex mips64r6
16983 Equivalent to @option{-march=mips64r6}.
16984
16985 @item -mips16
16986 @itemx -mno-mips16
16987 @opindex mips16
16988 @opindex mno-mips16
16989 Generate (do not generate) MIPS16 code. If GCC is targeting a
16990 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
16991
16992 MIPS16 code generation can also be controlled on a per-function basis
16993 by means of @code{mips16} and @code{nomips16} attributes.
16994 @xref{Function Attributes}, for more information.
16995
16996 @item -mflip-mips16
16997 @opindex mflip-mips16
16998 Generate MIPS16 code on alternating functions. This option is provided
16999 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
17000 not intended for ordinary use in compiling user code.
17001
17002 @item -minterlink-compressed
17003 @item -mno-interlink-compressed
17004 @opindex minterlink-compressed
17005 @opindex mno-interlink-compressed
17006 Require (do not require) that code using the standard (uncompressed) MIPS ISA
17007 be link-compatible with MIPS16 and microMIPS code, and vice versa.
17008
17009 For example, code using the standard ISA encoding cannot jump directly
17010 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
17011 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
17012 knows that the target of the jump is not compressed.
17013
17014 @item -minterlink-mips16
17015 @itemx -mno-interlink-mips16
17016 @opindex minterlink-mips16
17017 @opindex mno-interlink-mips16
17018 Aliases of @option{-minterlink-compressed} and
17019 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
17020 and are retained for backwards compatibility.
17021
17022 @item -mabi=32
17023 @itemx -mabi=o64
17024 @itemx -mabi=n32
17025 @itemx -mabi=64
17026 @itemx -mabi=eabi
17027 @opindex mabi=32
17028 @opindex mabi=o64
17029 @opindex mabi=n32
17030 @opindex mabi=64
17031 @opindex mabi=eabi
17032 Generate code for the given ABI@.
17033
17034 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
17035 generates 64-bit code when you select a 64-bit architecture, but you
17036 can use @option{-mgp32} to get 32-bit code instead.
17037
17038 For information about the O64 ABI, see
17039 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
17040
17041 GCC supports a variant of the o32 ABI in which floating-point registers
17042 are 64 rather than 32 bits wide. You can select this combination with
17043 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
17044 and @code{mfhc1} instructions and is therefore only supported for
17045 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
17046
17047 The register assignments for arguments and return values remain the
17048 same, but each scalar value is passed in a single 64-bit register
17049 rather than a pair of 32-bit registers. For example, scalar
17050 floating-point values are returned in @samp{$f0} only, not a
17051 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
17052 remains the same in that the even-numbered double-precision registers
17053 are saved.
17054
17055 Two additional variants of the o32 ABI are supported to enable
17056 a transition from 32-bit to 64-bit registers. These are FPXX
17057 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
17058 The FPXX extension mandates that all code must execute correctly
17059 when run using 32-bit or 64-bit registers. The code can be interlinked
17060 with either FP32 or FP64, but not both.
17061 The FP64A extension is similar to the FP64 extension but forbids the
17062 use of odd-numbered single-precision registers. This can be used
17063 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
17064 processors and allows both FP32 and FP64A code to interlink and
17065 run in the same process without changing FPU modes.
17066
17067 @item -mabicalls
17068 @itemx -mno-abicalls
17069 @opindex mabicalls
17070 @opindex mno-abicalls
17071 Generate (do not generate) code that is suitable for SVR4-style
17072 dynamic objects. @option{-mabicalls} is the default for SVR4-based
17073 systems.
17074
17075 @item -mshared
17076 @itemx -mno-shared
17077 Generate (do not generate) code that is fully position-independent,
17078 and that can therefore be linked into shared libraries. This option
17079 only affects @option{-mabicalls}.
17080
17081 All @option{-mabicalls} code has traditionally been position-independent,
17082 regardless of options like @option{-fPIC} and @option{-fpic}. However,
17083 as an extension, the GNU toolchain allows executables to use absolute
17084 accesses for locally-binding symbols. It can also use shorter GP
17085 initialization sequences and generate direct calls to locally-defined
17086 functions. This mode is selected by @option{-mno-shared}.
17087
17088 @option{-mno-shared} depends on binutils 2.16 or higher and generates
17089 objects that can only be linked by the GNU linker. However, the option
17090 does not affect the ABI of the final executable; it only affects the ABI
17091 of relocatable objects. Using @option{-mno-shared} generally makes
17092 executables both smaller and quicker.
17093
17094 @option{-mshared} is the default.
17095
17096 @item -mplt
17097 @itemx -mno-plt
17098 @opindex mplt
17099 @opindex mno-plt
17100 Assume (do not assume) that the static and dynamic linkers
17101 support PLTs and copy relocations. This option only affects
17102 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
17103 has no effect without @option{-msym32}.
17104
17105 You can make @option{-mplt} the default by configuring
17106 GCC with @option{--with-mips-plt}. The default is
17107 @option{-mno-plt} otherwise.
17108
17109 @item -mxgot
17110 @itemx -mno-xgot
17111 @opindex mxgot
17112 @opindex mno-xgot
17113 Lift (do not lift) the usual restrictions on the size of the global
17114 offset table.
17115
17116 GCC normally uses a single instruction to load values from the GOT@.
17117 While this is relatively efficient, it only works if the GOT
17118 is smaller than about 64k. Anything larger causes the linker
17119 to report an error such as:
17120
17121 @cindex relocation truncated to fit (MIPS)
17122 @smallexample
17123 relocation truncated to fit: R_MIPS_GOT16 foobar
17124 @end smallexample
17125
17126 If this happens, you should recompile your code with @option{-mxgot}.
17127 This works with very large GOTs, although the code is also
17128 less efficient, since it takes three instructions to fetch the
17129 value of a global symbol.
17130
17131 Note that some linkers can create multiple GOTs. If you have such a
17132 linker, you should only need to use @option{-mxgot} when a single object
17133 file accesses more than 64k's worth of GOT entries. Very few do.
17134
17135 These options have no effect unless GCC is generating position
17136 independent code.
17137
17138 @item -mgp32
17139 @opindex mgp32
17140 Assume that general-purpose registers are 32 bits wide.
17141
17142 @item -mgp64
17143 @opindex mgp64
17144 Assume that general-purpose registers are 64 bits wide.
17145
17146 @item -mfp32
17147 @opindex mfp32
17148 Assume that floating-point registers are 32 bits wide.
17149
17150 @item -mfp64
17151 @opindex mfp64
17152 Assume that floating-point registers are 64 bits wide.
17153
17154 @item -mfpxx
17155 @opindex mfpxx
17156 Do not assume the width of floating-point registers.
17157
17158 @item -mhard-float
17159 @opindex mhard-float
17160 Use floating-point coprocessor instructions.
17161
17162 @item -msoft-float
17163 @opindex msoft-float
17164 Do not use floating-point coprocessor instructions. Implement
17165 floating-point calculations using library calls instead.
17166
17167 @item -mno-float
17168 @opindex mno-float
17169 Equivalent to @option{-msoft-float}, but additionally asserts that the
17170 program being compiled does not perform any floating-point operations.
17171 This option is presently supported only by some bare-metal MIPS
17172 configurations, where it may select a special set of libraries
17173 that lack all floating-point support (including, for example, the
17174 floating-point @code{printf} formats).
17175 If code compiled with @option{-mno-float} accidentally contains
17176 floating-point operations, it is likely to suffer a link-time
17177 or run-time failure.
17178
17179 @item -msingle-float
17180 @opindex msingle-float
17181 Assume that the floating-point coprocessor only supports single-precision
17182 operations.
17183
17184 @item -mdouble-float
17185 @opindex mdouble-float
17186 Assume that the floating-point coprocessor supports double-precision
17187 operations. This is the default.
17188
17189 @item -modd-spreg
17190 @itemx -mno-odd-spreg
17191 @opindex modd-spreg
17192 @opindex mno-odd-spreg
17193 Enable the use of odd-numbered single-precision floating-point registers
17194 for the o32 ABI. This is the default for processors that are known to
17195 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
17196 is set by default.
17197
17198 @item -mabs=2008
17199 @itemx -mabs=legacy
17200 @opindex mabs=2008
17201 @opindex mabs=legacy
17202 These options control the treatment of the special not-a-number (NaN)
17203 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
17204 @code{neg.@i{fmt}} machine instructions.
17205
17206 By default or when @option{-mabs=legacy} is used the legacy
17207 treatment is selected. In this case these instructions are considered
17208 arithmetic and avoided where correct operation is required and the
17209 input operand might be a NaN. A longer sequence of instructions that
17210 manipulate the sign bit of floating-point datum manually is used
17211 instead unless the @option{-ffinite-math-only} option has also been
17212 specified.
17213
17214 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
17215 this case these instructions are considered non-arithmetic and therefore
17216 operating correctly in all cases, including in particular where the
17217 input operand is a NaN. These instructions are therefore always used
17218 for the respective operations.
17219
17220 @item -mnan=2008
17221 @itemx -mnan=legacy
17222 @opindex mnan=2008
17223 @opindex mnan=legacy
17224 These options control the encoding of the special not-a-number (NaN)
17225 IEEE 754 floating-point data.
17226
17227 The @option{-mnan=legacy} option selects the legacy encoding. In this
17228 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
17229 significand field being 0, whereas signalling NaNs (sNaNs) are denoted
17230 by the first bit of their trailing significand field being 1.
17231
17232 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
17233 this case qNaNs are denoted by the first bit of their trailing
17234 significand field being 1, whereas sNaNs are denoted by the first bit of
17235 their trailing significand field being 0.
17236
17237 The default is @option{-mnan=legacy} unless GCC has been configured with
17238 @option{--with-nan=2008}.
17239
17240 @item -mllsc
17241 @itemx -mno-llsc
17242 @opindex mllsc
17243 @opindex mno-llsc
17244 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
17245 implement atomic memory built-in functions. When neither option is
17246 specified, GCC uses the instructions if the target architecture
17247 supports them.
17248
17249 @option{-mllsc} is useful if the runtime environment can emulate the
17250 instructions and @option{-mno-llsc} can be useful when compiling for
17251 nonstandard ISAs. You can make either option the default by
17252 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
17253 respectively. @option{--with-llsc} is the default for some
17254 configurations; see the installation documentation for details.
17255
17256 @item -mdsp
17257 @itemx -mno-dsp
17258 @opindex mdsp
17259 @opindex mno-dsp
17260 Use (do not use) revision 1 of the MIPS DSP ASE@.
17261 @xref{MIPS DSP Built-in Functions}. This option defines the
17262 preprocessor macro @code{__mips_dsp}. It also defines
17263 @code{__mips_dsp_rev} to 1.
17264
17265 @item -mdspr2
17266 @itemx -mno-dspr2
17267 @opindex mdspr2
17268 @opindex mno-dspr2
17269 Use (do not use) revision 2 of the MIPS DSP ASE@.
17270 @xref{MIPS DSP Built-in Functions}. This option defines the
17271 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
17272 It also defines @code{__mips_dsp_rev} to 2.
17273
17274 @item -msmartmips
17275 @itemx -mno-smartmips
17276 @opindex msmartmips
17277 @opindex mno-smartmips
17278 Use (do not use) the MIPS SmartMIPS ASE.
17279
17280 @item -mpaired-single
17281 @itemx -mno-paired-single
17282 @opindex mpaired-single
17283 @opindex mno-paired-single
17284 Use (do not use) paired-single floating-point instructions.
17285 @xref{MIPS Paired-Single Support}. This option requires
17286 hardware floating-point support to be enabled.
17287
17288 @item -mdmx
17289 @itemx -mno-mdmx
17290 @opindex mdmx
17291 @opindex mno-mdmx
17292 Use (do not use) MIPS Digital Media Extension instructions.
17293 This option can only be used when generating 64-bit code and requires
17294 hardware floating-point support to be enabled.
17295
17296 @item -mips3d
17297 @itemx -mno-mips3d
17298 @opindex mips3d
17299 @opindex mno-mips3d
17300 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
17301 The option @option{-mips3d} implies @option{-mpaired-single}.
17302
17303 @item -mmicromips
17304 @itemx -mno-micromips
17305 @opindex mmicromips
17306 @opindex mno-mmicromips
17307 Generate (do not generate) microMIPS code.
17308
17309 MicroMIPS code generation can also be controlled on a per-function basis
17310 by means of @code{micromips} and @code{nomicromips} attributes.
17311 @xref{Function Attributes}, for more information.
17312
17313 @item -mmt
17314 @itemx -mno-mt
17315 @opindex mmt
17316 @opindex mno-mt
17317 Use (do not use) MT Multithreading instructions.
17318
17319 @item -mmcu
17320 @itemx -mno-mcu
17321 @opindex mmcu
17322 @opindex mno-mcu
17323 Use (do not use) the MIPS MCU ASE instructions.
17324
17325 @item -meva
17326 @itemx -mno-eva
17327 @opindex meva
17328 @opindex mno-eva
17329 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
17330
17331 @item -mvirt
17332 @itemx -mno-virt
17333 @opindex mvirt
17334 @opindex mno-virt
17335 Use (do not use) the MIPS Virtualization Application Specific instructions.
17336
17337 @item -mxpa
17338 @itemx -mno-xpa
17339 @opindex mxpa
17340 @opindex mno-xpa
17341 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
17342
17343 @item -mlong64
17344 @opindex mlong64
17345 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
17346 an explanation of the default and the way that the pointer size is
17347 determined.
17348
17349 @item -mlong32
17350 @opindex mlong32
17351 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
17352
17353 The default size of @code{int}s, @code{long}s and pointers depends on
17354 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
17355 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
17356 32-bit @code{long}s. Pointers are the same size as @code{long}s,
17357 or the same size as integer registers, whichever is smaller.
17358
17359 @item -msym32
17360 @itemx -mno-sym32
17361 @opindex msym32
17362 @opindex mno-sym32
17363 Assume (do not assume) that all symbols have 32-bit values, regardless
17364 of the selected ABI@. This option is useful in combination with
17365 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
17366 to generate shorter and faster references to symbolic addresses.
17367
17368 @item -G @var{num}
17369 @opindex G
17370 Put definitions of externally-visible data in a small data section
17371 if that data is no bigger than @var{num} bytes. GCC can then generate
17372 more efficient accesses to the data; see @option{-mgpopt} for details.
17373
17374 The default @option{-G} option depends on the configuration.
17375
17376 @item -mlocal-sdata
17377 @itemx -mno-local-sdata
17378 @opindex mlocal-sdata
17379 @opindex mno-local-sdata
17380 Extend (do not extend) the @option{-G} behavior to local data too,
17381 such as to static variables in C@. @option{-mlocal-sdata} is the
17382 default for all configurations.
17383
17384 If the linker complains that an application is using too much small data,
17385 you might want to try rebuilding the less performance-critical parts with
17386 @option{-mno-local-sdata}. You might also want to build large
17387 libraries with @option{-mno-local-sdata}, so that the libraries leave
17388 more room for the main program.
17389
17390 @item -mextern-sdata
17391 @itemx -mno-extern-sdata
17392 @opindex mextern-sdata
17393 @opindex mno-extern-sdata
17394 Assume (do not assume) that externally-defined data is in
17395 a small data section if the size of that data is within the @option{-G} limit.
17396 @option{-mextern-sdata} is the default for all configurations.
17397
17398 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
17399 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
17400 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
17401 is placed in a small data section. If @var{Var} is defined by another
17402 module, you must either compile that module with a high-enough
17403 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
17404 definition. If @var{Var} is common, you must link the application
17405 with a high-enough @option{-G} setting.
17406
17407 The easiest way of satisfying these restrictions is to compile
17408 and link every module with the same @option{-G} option. However,
17409 you may wish to build a library that supports several different
17410 small data limits. You can do this by compiling the library with
17411 the highest supported @option{-G} setting and additionally using
17412 @option{-mno-extern-sdata} to stop the library from making assumptions
17413 about externally-defined data.
17414
17415 @item -mgpopt
17416 @itemx -mno-gpopt
17417 @opindex mgpopt
17418 @opindex mno-gpopt
17419 Use (do not use) GP-relative accesses for symbols that are known to be
17420 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
17421 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
17422 configurations.
17423
17424 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
17425 might not hold the value of @code{_gp}. For example, if the code is
17426 part of a library that might be used in a boot monitor, programs that
17427 call boot monitor routines pass an unknown value in @code{$gp}.
17428 (In such situations, the boot monitor itself is usually compiled
17429 with @option{-G0}.)
17430
17431 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
17432 @option{-mno-extern-sdata}.
17433
17434 @item -membedded-data
17435 @itemx -mno-embedded-data
17436 @opindex membedded-data
17437 @opindex mno-embedded-data
17438 Allocate variables to the read-only data section first if possible, then
17439 next in the small data section if possible, otherwise in data. This gives
17440 slightly slower code than the default, but reduces the amount of RAM required
17441 when executing, and thus may be preferred for some embedded systems.
17442
17443 @item -muninit-const-in-rodata
17444 @itemx -mno-uninit-const-in-rodata
17445 @opindex muninit-const-in-rodata
17446 @opindex mno-uninit-const-in-rodata
17447 Put uninitialized @code{const} variables in the read-only data section.
17448 This option is only meaningful in conjunction with @option{-membedded-data}.
17449
17450 @item -mcode-readable=@var{setting}
17451 @opindex mcode-readable
17452 Specify whether GCC may generate code that reads from executable sections.
17453 There are three possible settings:
17454
17455 @table @gcctabopt
17456 @item -mcode-readable=yes
17457 Instructions may freely access executable sections. This is the
17458 default setting.
17459
17460 @item -mcode-readable=pcrel
17461 MIPS16 PC-relative load instructions can access executable sections,
17462 but other instructions must not do so. This option is useful on 4KSc
17463 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
17464 It is also useful on processors that can be configured to have a dual
17465 instruction/data SRAM interface and that, like the M4K, automatically
17466 redirect PC-relative loads to the instruction RAM.
17467
17468 @item -mcode-readable=no
17469 Instructions must not access executable sections. This option can be
17470 useful on targets that are configured to have a dual instruction/data
17471 SRAM interface but that (unlike the M4K) do not automatically redirect
17472 PC-relative loads to the instruction RAM.
17473 @end table
17474
17475 @item -msplit-addresses
17476 @itemx -mno-split-addresses
17477 @opindex msplit-addresses
17478 @opindex mno-split-addresses
17479 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
17480 relocation operators. This option has been superseded by
17481 @option{-mexplicit-relocs} but is retained for backwards compatibility.
17482
17483 @item -mexplicit-relocs
17484 @itemx -mno-explicit-relocs
17485 @opindex mexplicit-relocs
17486 @opindex mno-explicit-relocs
17487 Use (do not use) assembler relocation operators when dealing with symbolic
17488 addresses. The alternative, selected by @option{-mno-explicit-relocs},
17489 is to use assembler macros instead.
17490
17491 @option{-mexplicit-relocs} is the default if GCC was configured
17492 to use an assembler that supports relocation operators.
17493
17494 @item -mcheck-zero-division
17495 @itemx -mno-check-zero-division
17496 @opindex mcheck-zero-division
17497 @opindex mno-check-zero-division
17498 Trap (do not trap) on integer division by zero.
17499
17500 The default is @option{-mcheck-zero-division}.
17501
17502 @item -mdivide-traps
17503 @itemx -mdivide-breaks
17504 @opindex mdivide-traps
17505 @opindex mdivide-breaks
17506 MIPS systems check for division by zero by generating either a
17507 conditional trap or a break instruction. Using traps results in
17508 smaller code, but is only supported on MIPS II and later. Also, some
17509 versions of the Linux kernel have a bug that prevents trap from
17510 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
17511 allow conditional traps on architectures that support them and
17512 @option{-mdivide-breaks} to force the use of breaks.
17513
17514 The default is usually @option{-mdivide-traps}, but this can be
17515 overridden at configure time using @option{--with-divide=breaks}.
17516 Divide-by-zero checks can be completely disabled using
17517 @option{-mno-check-zero-division}.
17518
17519 @item -mmemcpy
17520 @itemx -mno-memcpy
17521 @opindex mmemcpy
17522 @opindex mno-memcpy
17523 Force (do not force) the use of @code{memcpy} for non-trivial block
17524 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
17525 most constant-sized copies.
17526
17527 @item -mlong-calls
17528 @itemx -mno-long-calls
17529 @opindex mlong-calls
17530 @opindex mno-long-calls
17531 Disable (do not disable) use of the @code{jal} instruction. Calling
17532 functions using @code{jal} is more efficient but requires the caller
17533 and callee to be in the same 256 megabyte segment.
17534
17535 This option has no effect on abicalls code. The default is
17536 @option{-mno-long-calls}.
17537
17538 @item -mmad
17539 @itemx -mno-mad
17540 @opindex mmad
17541 @opindex mno-mad
17542 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
17543 instructions, as provided by the R4650 ISA@.
17544
17545 @item -mimadd
17546 @itemx -mno-imadd
17547 @opindex mimadd
17548 @opindex mno-imadd
17549 Enable (disable) use of the @code{madd} and @code{msub} integer
17550 instructions. The default is @option{-mimadd} on architectures
17551 that support @code{madd} and @code{msub} except for the 74k
17552 architecture where it was found to generate slower code.
17553
17554 @item -mfused-madd
17555 @itemx -mno-fused-madd
17556 @opindex mfused-madd
17557 @opindex mno-fused-madd
17558 Enable (disable) use of the floating-point multiply-accumulate
17559 instructions, when they are available. The default is
17560 @option{-mfused-madd}.
17561
17562 On the R8000 CPU when multiply-accumulate instructions are used,
17563 the intermediate product is calculated to infinite precision
17564 and is not subject to the FCSR Flush to Zero bit. This may be
17565 undesirable in some circumstances. On other processors the result
17566 is numerically identical to the equivalent computation using
17567 separate multiply, add, subtract and negate instructions.
17568
17569 @item -nocpp
17570 @opindex nocpp
17571 Tell the MIPS assembler to not run its preprocessor over user
17572 assembler files (with a @samp{.s} suffix) when assembling them.
17573
17574 @item -mfix-24k
17575 @item -mno-fix-24k
17576 @opindex mfix-24k
17577 @opindex mno-fix-24k
17578 Work around the 24K E48 (lost data on stores during refill) errata.
17579 The workarounds are implemented by the assembler rather than by GCC@.
17580
17581 @item -mfix-r4000
17582 @itemx -mno-fix-r4000
17583 @opindex mfix-r4000
17584 @opindex mno-fix-r4000
17585 Work around certain R4000 CPU errata:
17586 @itemize @minus
17587 @item
17588 A double-word or a variable shift may give an incorrect result if executed
17589 immediately after starting an integer division.
17590 @item
17591 A double-word or a variable shift may give an incorrect result if executed
17592 while an integer multiplication is in progress.
17593 @item
17594 An integer division may give an incorrect result if started in a delay slot
17595 of a taken branch or a jump.
17596 @end itemize
17597
17598 @item -mfix-r4400
17599 @itemx -mno-fix-r4400
17600 @opindex mfix-r4400
17601 @opindex mno-fix-r4400
17602 Work around certain R4400 CPU errata:
17603 @itemize @minus
17604 @item
17605 A double-word or a variable shift may give an incorrect result if executed
17606 immediately after starting an integer division.
17607 @end itemize
17608
17609 @item -mfix-r10000
17610 @itemx -mno-fix-r10000
17611 @opindex mfix-r10000
17612 @opindex mno-fix-r10000
17613 Work around certain R10000 errata:
17614 @itemize @minus
17615 @item
17616 @code{ll}/@code{sc} sequences may not behave atomically on revisions
17617 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
17618 @end itemize
17619
17620 This option can only be used if the target architecture supports
17621 branch-likely instructions. @option{-mfix-r10000} is the default when
17622 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
17623 otherwise.
17624
17625 @item -mfix-rm7000
17626 @itemx -mno-fix-rm7000
17627 @opindex mfix-rm7000
17628 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
17629 workarounds are implemented by the assembler rather than by GCC@.
17630
17631 @item -mfix-vr4120
17632 @itemx -mno-fix-vr4120
17633 @opindex mfix-vr4120
17634 Work around certain VR4120 errata:
17635 @itemize @minus
17636 @item
17637 @code{dmultu} does not always produce the correct result.
17638 @item
17639 @code{div} and @code{ddiv} do not always produce the correct result if one
17640 of the operands is negative.
17641 @end itemize
17642 The workarounds for the division errata rely on special functions in
17643 @file{libgcc.a}. At present, these functions are only provided by
17644 the @code{mips64vr*-elf} configurations.
17645
17646 Other VR4120 errata require a NOP to be inserted between certain pairs of
17647 instructions. These errata are handled by the assembler, not by GCC itself.
17648
17649 @item -mfix-vr4130
17650 @opindex mfix-vr4130
17651 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
17652 workarounds are implemented by the assembler rather than by GCC,
17653 although GCC avoids using @code{mflo} and @code{mfhi} if the
17654 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
17655 instructions are available instead.
17656
17657 @item -mfix-sb1
17658 @itemx -mno-fix-sb1
17659 @opindex mfix-sb1
17660 Work around certain SB-1 CPU core errata.
17661 (This flag currently works around the SB-1 revision 2
17662 ``F1'' and ``F2'' floating-point errata.)
17663
17664 @item -mr10k-cache-barrier=@var{setting}
17665 @opindex mr10k-cache-barrier
17666 Specify whether GCC should insert cache barriers to avoid the
17667 side-effects of speculation on R10K processors.
17668
17669 In common with many processors, the R10K tries to predict the outcome
17670 of a conditional branch and speculatively executes instructions from
17671 the ``taken'' branch. It later aborts these instructions if the
17672 predicted outcome is wrong. However, on the R10K, even aborted
17673 instructions can have side effects.
17674
17675 This problem only affects kernel stores and, depending on the system,
17676 kernel loads. As an example, a speculatively-executed store may load
17677 the target memory into cache and mark the cache line as dirty, even if
17678 the store itself is later aborted. If a DMA operation writes to the
17679 same area of memory before the ``dirty'' line is flushed, the cached
17680 data overwrites the DMA-ed data. See the R10K processor manual
17681 for a full description, including other potential problems.
17682
17683 One workaround is to insert cache barrier instructions before every memory
17684 access that might be speculatively executed and that might have side
17685 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
17686 controls GCC's implementation of this workaround. It assumes that
17687 aborted accesses to any byte in the following regions does not have
17688 side effects:
17689
17690 @enumerate
17691 @item
17692 the memory occupied by the current function's stack frame;
17693
17694 @item
17695 the memory occupied by an incoming stack argument;
17696
17697 @item
17698 the memory occupied by an object with a link-time-constant address.
17699 @end enumerate
17700
17701 It is the kernel's responsibility to ensure that speculative
17702 accesses to these regions are indeed safe.
17703
17704 If the input program contains a function declaration such as:
17705
17706 @smallexample
17707 void foo (void);
17708 @end smallexample
17709
17710 then the implementation of @code{foo} must allow @code{j foo} and
17711 @code{jal foo} to be executed speculatively. GCC honors this
17712 restriction for functions it compiles itself. It expects non-GCC
17713 functions (such as hand-written assembly code) to do the same.
17714
17715 The option has three forms:
17716
17717 @table @gcctabopt
17718 @item -mr10k-cache-barrier=load-store
17719 Insert a cache barrier before a load or store that might be
17720 speculatively executed and that might have side effects even
17721 if aborted.
17722
17723 @item -mr10k-cache-barrier=store
17724 Insert a cache barrier before a store that might be speculatively
17725 executed and that might have side effects even if aborted.
17726
17727 @item -mr10k-cache-barrier=none
17728 Disable the insertion of cache barriers. This is the default setting.
17729 @end table
17730
17731 @item -mflush-func=@var{func}
17732 @itemx -mno-flush-func
17733 @opindex mflush-func
17734 Specifies the function to call to flush the I and D caches, or to not
17735 call any such function. If called, the function must take the same
17736 arguments as the common @code{_flush_func}, that is, the address of the
17737 memory range for which the cache is being flushed, the size of the
17738 memory range, and the number 3 (to flush both caches). The default
17739 depends on the target GCC was configured for, but commonly is either
17740 @code{_flush_func} or @code{__cpu_flush}.
17741
17742 @item mbranch-cost=@var{num}
17743 @opindex mbranch-cost
17744 Set the cost of branches to roughly @var{num} ``simple'' instructions.
17745 This cost is only a heuristic and is not guaranteed to produce
17746 consistent results across releases. A zero cost redundantly selects
17747 the default, which is based on the @option{-mtune} setting.
17748
17749 @item -mbranch-likely
17750 @itemx -mno-branch-likely
17751 @opindex mbranch-likely
17752 @opindex mno-branch-likely
17753 Enable or disable use of Branch Likely instructions, regardless of the
17754 default for the selected architecture. By default, Branch Likely
17755 instructions may be generated if they are supported by the selected
17756 architecture. An exception is for the MIPS32 and MIPS64 architectures
17757 and processors that implement those architectures; for those, Branch
17758 Likely instructions are not be generated by default because the MIPS32
17759 and MIPS64 architectures specifically deprecate their use.
17760
17761 @item -mfp-exceptions
17762 @itemx -mno-fp-exceptions
17763 @opindex mfp-exceptions
17764 Specifies whether FP exceptions are enabled. This affects how
17765 FP instructions are scheduled for some processors.
17766 The default is that FP exceptions are
17767 enabled.
17768
17769 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
17770 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
17771 FP pipe.
17772
17773 @item -mvr4130-align
17774 @itemx -mno-vr4130-align
17775 @opindex mvr4130-align
17776 The VR4130 pipeline is two-way superscalar, but can only issue two
17777 instructions together if the first one is 8-byte aligned. When this
17778 option is enabled, GCC aligns pairs of instructions that it
17779 thinks should execute in parallel.
17780
17781 This option only has an effect when optimizing for the VR4130.
17782 It normally makes code faster, but at the expense of making it bigger.
17783 It is enabled by default at optimization level @option{-O3}.
17784
17785 @item -msynci
17786 @itemx -mno-synci
17787 @opindex msynci
17788 Enable (disable) generation of @code{synci} instructions on
17789 architectures that support it. The @code{synci} instructions (if
17790 enabled) are generated when @code{__builtin___clear_cache} is
17791 compiled.
17792
17793 This option defaults to @option{-mno-synci}, but the default can be
17794 overridden by configuring GCC with @option{--with-synci}.
17795
17796 When compiling code for single processor systems, it is generally safe
17797 to use @code{synci}. However, on many multi-core (SMP) systems, it
17798 does not invalidate the instruction caches on all cores and may lead
17799 to undefined behavior.
17800
17801 @item -mrelax-pic-calls
17802 @itemx -mno-relax-pic-calls
17803 @opindex mrelax-pic-calls
17804 Try to turn PIC calls that are normally dispatched via register
17805 @code{$25} into direct calls. This is only possible if the linker can
17806 resolve the destination at link-time and if the destination is within
17807 range for a direct call.
17808
17809 @option{-mrelax-pic-calls} is the default if GCC was configured to use
17810 an assembler and a linker that support the @code{.reloc} assembly
17811 directive and @option{-mexplicit-relocs} is in effect. With
17812 @option{-mno-explicit-relocs}, this optimization can be performed by the
17813 assembler and the linker alone without help from the compiler.
17814
17815 @item -mmcount-ra-address
17816 @itemx -mno-mcount-ra-address
17817 @opindex mmcount-ra-address
17818 @opindex mno-mcount-ra-address
17819 Emit (do not emit) code that allows @code{_mcount} to modify the
17820 calling function's return address. When enabled, this option extends
17821 the usual @code{_mcount} interface with a new @var{ra-address}
17822 parameter, which has type @code{intptr_t *} and is passed in register
17823 @code{$12}. @code{_mcount} can then modify the return address by
17824 doing both of the following:
17825 @itemize
17826 @item
17827 Returning the new address in register @code{$31}.
17828 @item
17829 Storing the new address in @code{*@var{ra-address}},
17830 if @var{ra-address} is nonnull.
17831 @end itemize
17832
17833 The default is @option{-mno-mcount-ra-address}.
17834
17835 @end table
17836
17837 @node MMIX Options
17838 @subsection MMIX Options
17839 @cindex MMIX Options
17840
17841 These options are defined for the MMIX:
17842
17843 @table @gcctabopt
17844 @item -mlibfuncs
17845 @itemx -mno-libfuncs
17846 @opindex mlibfuncs
17847 @opindex mno-libfuncs
17848 Specify that intrinsic library functions are being compiled, passing all
17849 values in registers, no matter the size.
17850
17851 @item -mepsilon
17852 @itemx -mno-epsilon
17853 @opindex mepsilon
17854 @opindex mno-epsilon
17855 Generate floating-point comparison instructions that compare with respect
17856 to the @code{rE} epsilon register.
17857
17858 @item -mabi=mmixware
17859 @itemx -mabi=gnu
17860 @opindex mabi=mmixware
17861 @opindex mabi=gnu
17862 Generate code that passes function parameters and return values that (in
17863 the called function) are seen as registers @code{$0} and up, as opposed to
17864 the GNU ABI which uses global registers @code{$231} and up.
17865
17866 @item -mzero-extend
17867 @itemx -mno-zero-extend
17868 @opindex mzero-extend
17869 @opindex mno-zero-extend
17870 When reading data from memory in sizes shorter than 64 bits, use (do not
17871 use) zero-extending load instructions by default, rather than
17872 sign-extending ones.
17873
17874 @item -mknuthdiv
17875 @itemx -mno-knuthdiv
17876 @opindex mknuthdiv
17877 @opindex mno-knuthdiv
17878 Make the result of a division yielding a remainder have the same sign as
17879 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
17880 remainder follows the sign of the dividend. Both methods are
17881 arithmetically valid, the latter being almost exclusively used.
17882
17883 @item -mtoplevel-symbols
17884 @itemx -mno-toplevel-symbols
17885 @opindex mtoplevel-symbols
17886 @opindex mno-toplevel-symbols
17887 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
17888 code can be used with the @code{PREFIX} assembly directive.
17889
17890 @item -melf
17891 @opindex melf
17892 Generate an executable in the ELF format, rather than the default
17893 @samp{mmo} format used by the @command{mmix} simulator.
17894
17895 @item -mbranch-predict
17896 @itemx -mno-branch-predict
17897 @opindex mbranch-predict
17898 @opindex mno-branch-predict
17899 Use (do not use) the probable-branch instructions, when static branch
17900 prediction indicates a probable branch.
17901
17902 @item -mbase-addresses
17903 @itemx -mno-base-addresses
17904 @opindex mbase-addresses
17905 @opindex mno-base-addresses
17906 Generate (do not generate) code that uses @emph{base addresses}. Using a
17907 base address automatically generates a request (handled by the assembler
17908 and the linker) for a constant to be set up in a global register. The
17909 register is used for one or more base address requests within the range 0
17910 to 255 from the value held in the register. The generally leads to short
17911 and fast code, but the number of different data items that can be
17912 addressed is limited. This means that a program that uses lots of static
17913 data may require @option{-mno-base-addresses}.
17914
17915 @item -msingle-exit
17916 @itemx -mno-single-exit
17917 @opindex msingle-exit
17918 @opindex mno-single-exit
17919 Force (do not force) generated code to have a single exit point in each
17920 function.
17921 @end table
17922
17923 @node MN10300 Options
17924 @subsection MN10300 Options
17925 @cindex MN10300 options
17926
17927 These @option{-m} options are defined for Matsushita MN10300 architectures:
17928
17929 @table @gcctabopt
17930 @item -mmult-bug
17931 @opindex mmult-bug
17932 Generate code to avoid bugs in the multiply instructions for the MN10300
17933 processors. This is the default.
17934
17935 @item -mno-mult-bug
17936 @opindex mno-mult-bug
17937 Do not generate code to avoid bugs in the multiply instructions for the
17938 MN10300 processors.
17939
17940 @item -mam33
17941 @opindex mam33
17942 Generate code using features specific to the AM33 processor.
17943
17944 @item -mno-am33
17945 @opindex mno-am33
17946 Do not generate code using features specific to the AM33 processor. This
17947 is the default.
17948
17949 @item -mam33-2
17950 @opindex mam33-2
17951 Generate code using features specific to the AM33/2.0 processor.
17952
17953 @item -mam34
17954 @opindex mam34
17955 Generate code using features specific to the AM34 processor.
17956
17957 @item -mtune=@var{cpu-type}
17958 @opindex mtune
17959 Use the timing characteristics of the indicated CPU type when
17960 scheduling instructions. This does not change the targeted processor
17961 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
17962 @samp{am33-2} or @samp{am34}.
17963
17964 @item -mreturn-pointer-on-d0
17965 @opindex mreturn-pointer-on-d0
17966 When generating a function that returns a pointer, return the pointer
17967 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
17968 only in @code{a0}, and attempts to call such functions without a prototype
17969 result in errors. Note that this option is on by default; use
17970 @option{-mno-return-pointer-on-d0} to disable it.
17971
17972 @item -mno-crt0
17973 @opindex mno-crt0
17974 Do not link in the C run-time initialization object file.
17975
17976 @item -mrelax
17977 @opindex mrelax
17978 Indicate to the linker that it should perform a relaxation optimization pass
17979 to shorten branches, calls and absolute memory addresses. This option only
17980 has an effect when used on the command line for the final link step.
17981
17982 This option makes symbolic debugging impossible.
17983
17984 @item -mliw
17985 @opindex mliw
17986 Allow the compiler to generate @emph{Long Instruction Word}
17987 instructions if the target is the @samp{AM33} or later. This is the
17988 default. This option defines the preprocessor macro @code{__LIW__}.
17989
17990 @item -mnoliw
17991 @opindex mnoliw
17992 Do not allow the compiler to generate @emph{Long Instruction Word}
17993 instructions. This option defines the preprocessor macro
17994 @code{__NO_LIW__}.
17995
17996 @item -msetlb
17997 @opindex msetlb
17998 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
17999 instructions if the target is the @samp{AM33} or later. This is the
18000 default. This option defines the preprocessor macro @code{__SETLB__}.
18001
18002 @item -mnosetlb
18003 @opindex mnosetlb
18004 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
18005 instructions. This option defines the preprocessor macro
18006 @code{__NO_SETLB__}.
18007
18008 @end table
18009
18010 @node Moxie Options
18011 @subsection Moxie Options
18012 @cindex Moxie Options
18013
18014 @table @gcctabopt
18015
18016 @item -meb
18017 @opindex meb
18018 Generate big-endian code. This is the default for @samp{moxie-*-*}
18019 configurations.
18020
18021 @item -mel
18022 @opindex mel
18023 Generate little-endian code.
18024
18025 @item -mmul.x
18026 @opindex mmul.x
18027 Generate mul.x and umul.x instructions. This is the default for
18028 @samp{moxiebox-*-*} configurations.
18029
18030 @item -mno-crt0
18031 @opindex mno-crt0
18032 Do not link in the C run-time initialization object file.
18033
18034 @end table
18035
18036 @node MSP430 Options
18037 @subsection MSP430 Options
18038 @cindex MSP430 Options
18039
18040 These options are defined for the MSP430:
18041
18042 @table @gcctabopt
18043
18044 @item -masm-hex
18045 @opindex masm-hex
18046 Force assembly output to always use hex constants. Normally such
18047 constants are signed decimals, but this option is available for
18048 testsuite and/or aesthetic purposes.
18049
18050 @item -mmcu=
18051 @opindex mmcu=
18052 Select the MCU to target. This is used to create a C preprocessor
18053 symbol based upon the MCU name, converted to upper case and pre- and
18054 post-fixed with @samp{__}. This in turn is used by the
18055 @file{msp430.h} header file to select an MCU-specific supplementary
18056 header file.
18057
18058 The option also sets the ISA to use. If the MCU name is one that is
18059 known to only support the 430 ISA then that is selected, otherwise the
18060 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
18061 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
18062 name selects the 430X ISA.
18063
18064 In addition an MCU-specific linker script is added to the linker
18065 command line. The script's name is the name of the MCU with
18066 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
18067 command line defines the C preprocessor symbol @code{__XXX__} and
18068 cause the linker to search for a script called @file{xxx.ld}.
18069
18070 This option is also passed on to the assembler.
18071
18072 @item -mcpu=
18073 @opindex mcpu=
18074 Specifies the ISA to use. Accepted values are @samp{msp430},
18075 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
18076 @option{-mmcu=} option should be used to select the ISA.
18077
18078 @item -msim
18079 @opindex msim
18080 Link to the simulator runtime libraries and linker script. Overrides
18081 any scripts that would be selected by the @option{-mmcu=} option.
18082
18083 @item -mlarge
18084 @opindex mlarge
18085 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
18086
18087 @item -msmall
18088 @opindex msmall
18089 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
18090
18091 @item -mrelax
18092 @opindex mrelax
18093 This option is passed to the assembler and linker, and allows the
18094 linker to perform certain optimizations that cannot be done until
18095 the final link.
18096
18097 @item mhwmult=
18098 @opindex mhwmult=
18099 Describes the type of hardware multiply supported by the target.
18100 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
18101 for the original 16-bit-only multiply supported by early MCUs.
18102 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
18103 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
18104 A value of @samp{auto} can also be given. This tells GCC to deduce
18105 the hardware multiply support based upon the MCU name provided by the
18106 @option{-mmcu} option. If no @option{-mmcu} option is specified then
18107 @samp{32bit} hardware multiply support is assumed. @samp{auto} is the
18108 default setting.
18109
18110 Hardware multiplies are normally performed by calling a library
18111 routine. This saves space in the generated code. When compiling at
18112 @option{-O3} or higher however the hardware multiplier is invoked
18113 inline. This makes for bigger, but faster code.
18114
18115 The hardware multiply routines disable interrupts whilst running and
18116 restore the previous interrupt state when they finish. This makes
18117 them safe to use inside interrupt handlers as well as in normal code.
18118
18119 @item -minrt
18120 @opindex minrt
18121 Enable the use of a minimum runtime environment - no static
18122 initializers or constructors. This is intended for memory-constrained
18123 devices. The compiler includes special symbols in some objects
18124 that tell the linker and runtime which code fragments are required.
18125
18126 @end table
18127
18128 @node NDS32 Options
18129 @subsection NDS32 Options
18130 @cindex NDS32 Options
18131
18132 These options are defined for NDS32 implementations:
18133
18134 @table @gcctabopt
18135
18136 @item -mbig-endian
18137 @opindex mbig-endian
18138 Generate code in big-endian mode.
18139
18140 @item -mlittle-endian
18141 @opindex mlittle-endian
18142 Generate code in little-endian mode.
18143
18144 @item -mreduced-regs
18145 @opindex mreduced-regs
18146 Use reduced-set registers for register allocation.
18147
18148 @item -mfull-regs
18149 @opindex mfull-regs
18150 Use full-set registers for register allocation.
18151
18152 @item -mcmov
18153 @opindex mcmov
18154 Generate conditional move instructions.
18155
18156 @item -mno-cmov
18157 @opindex mno-cmov
18158 Do not generate conditional move instructions.
18159
18160 @item -mperf-ext
18161 @opindex mperf-ext
18162 Generate performance extension instructions.
18163
18164 @item -mno-perf-ext
18165 @opindex mno-perf-ext
18166 Do not generate performance extension instructions.
18167
18168 @item -mv3push
18169 @opindex mv3push
18170 Generate v3 push25/pop25 instructions.
18171
18172 @item -mno-v3push
18173 @opindex mno-v3push
18174 Do not generate v3 push25/pop25 instructions.
18175
18176 @item -m16-bit
18177 @opindex m16-bit
18178 Generate 16-bit instructions.
18179
18180 @item -mno-16-bit
18181 @opindex mno-16-bit
18182 Do not generate 16-bit instructions.
18183
18184 @item -misr-vector-size=@var{num}
18185 @opindex misr-vector-size
18186 Specify the size of each interrupt vector, which must be 4 or 16.
18187
18188 @item -mcache-block-size=@var{num}
18189 @opindex mcache-block-size
18190 Specify the size of each cache block,
18191 which must be a power of 2 between 4 and 512.
18192
18193 @item -march=@var{arch}
18194 @opindex march
18195 Specify the name of the target architecture.
18196
18197 @item -mcmodel=@var{code-model}
18198 @opindex mcmodel
18199 Set the code model to one of
18200 @table @asis
18201 @item @samp{small}
18202 All the data and read-only data segments must be within 512KB addressing space.
18203 The text segment must be within 16MB addressing space.
18204 @item @samp{medium}
18205 The data segment must be within 512KB while the read-only data segment can be
18206 within 4GB addressing space. The text segment should be still within 16MB
18207 addressing space.
18208 @item @samp{large}
18209 All the text and data segments can be within 4GB addressing space.
18210 @end table
18211
18212 @item -mctor-dtor
18213 @opindex mctor-dtor
18214 Enable constructor/destructor feature.
18215
18216 @item -mrelax
18217 @opindex mrelax
18218 Guide linker to relax instructions.
18219
18220 @end table
18221
18222 @node Nios II Options
18223 @subsection Nios II Options
18224 @cindex Nios II options
18225 @cindex Altera Nios II options
18226
18227 These are the options defined for the Altera Nios II processor.
18228
18229 @table @gcctabopt
18230
18231 @item -G @var{num}
18232 @opindex G
18233 @cindex smaller data references
18234 Put global and static objects less than or equal to @var{num} bytes
18235 into the small data or BSS sections instead of the normal data or BSS
18236 sections. The default value of @var{num} is 8.
18237
18238 @item -mgpopt=@var{option}
18239 @item -mgpopt
18240 @itemx -mno-gpopt
18241 @opindex mgpopt
18242 @opindex mno-gpopt
18243 Generate (do not generate) GP-relative accesses. The following
18244 @var{option} names are recognized:
18245
18246 @table @samp
18247
18248 @item none
18249 Do not generate GP-relative accesses.
18250
18251 @item local
18252 Generate GP-relative accesses for small data objects that are not
18253 external or weak. Also use GP-relative addressing for objects that
18254 have been explicitly placed in a small data section via a @code{section}
18255 attribute.
18256
18257 @item global
18258 As for @samp{local}, but also generate GP-relative accesses for
18259 small data objects that are external or weak. If you use this option,
18260 you must ensure that all parts of your program (including libraries) are
18261 compiled with the same @option{-G} setting.
18262
18263 @item data
18264 Generate GP-relative accesses for all data objects in the program. If you
18265 use this option, the entire data and BSS segments
18266 of your program must fit in 64K of memory and you must use an appropriate
18267 linker script to allocate them within the addressible range of the
18268 global pointer.
18269
18270 @item all
18271 Generate GP-relative addresses for function pointers as well as data
18272 pointers. If you use this option, the entire text, data, and BSS segments
18273 of your program must fit in 64K of memory and you must use an appropriate
18274 linker script to allocate them within the addressible range of the
18275 global pointer.
18276
18277 @end table
18278
18279 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
18280 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
18281
18282 The default is @option{-mgpopt} except when @option{-fpic} or
18283 @option{-fPIC} is specified to generate position-independent code.
18284 Note that the Nios II ABI does not permit GP-relative accesses from
18285 shared libraries.
18286
18287 You may need to specify @option{-mno-gpopt} explicitly when building
18288 programs that include large amounts of small data, including large
18289 GOT data sections. In this case, the 16-bit offset for GP-relative
18290 addressing may not be large enough to allow access to the entire
18291 small data section.
18292
18293 @item -mel
18294 @itemx -meb
18295 @opindex mel
18296 @opindex meb
18297 Generate little-endian (default) or big-endian (experimental) code,
18298 respectively.
18299
18300 @item -mbypass-cache
18301 @itemx -mno-bypass-cache
18302 @opindex mno-bypass-cache
18303 @opindex mbypass-cache
18304 Force all load and store instructions to always bypass cache by
18305 using I/O variants of the instructions. The default is not to
18306 bypass the cache.
18307
18308 @item -mno-cache-volatile
18309 @itemx -mcache-volatile
18310 @opindex mcache-volatile
18311 @opindex mno-cache-volatile
18312 Volatile memory access bypass the cache using the I/O variants of
18313 the load and store instructions. The default is not to bypass the cache.
18314
18315 @item -mno-fast-sw-div
18316 @itemx -mfast-sw-div
18317 @opindex mno-fast-sw-div
18318 @opindex mfast-sw-div
18319 Do not use table-based fast divide for small numbers. The default
18320 is to use the fast divide at @option{-O3} and above.
18321
18322 @item -mno-hw-mul
18323 @itemx -mhw-mul
18324 @itemx -mno-hw-mulx
18325 @itemx -mhw-mulx
18326 @itemx -mno-hw-div
18327 @itemx -mhw-div
18328 @opindex mno-hw-mul
18329 @opindex mhw-mul
18330 @opindex mno-hw-mulx
18331 @opindex mhw-mulx
18332 @opindex mno-hw-div
18333 @opindex mhw-div
18334 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
18335 instructions by the compiler. The default is to emit @code{mul}
18336 and not emit @code{div} and @code{mulx}.
18337
18338 @item -mcustom-@var{insn}=@var{N}
18339 @itemx -mno-custom-@var{insn}
18340 @opindex mcustom-@var{insn}
18341 @opindex mno-custom-@var{insn}
18342 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
18343 custom instruction with encoding @var{N} when generating code that uses
18344 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
18345 instruction 253 for single-precision floating-point add operations instead
18346 of the default behavior of using a library call.
18347
18348 The following values of @var{insn} are supported. Except as otherwise
18349 noted, floating-point operations are expected to be implemented with
18350 normal IEEE 754 semantics and correspond directly to the C operators or the
18351 equivalent GCC built-in functions (@pxref{Other Builtins}).
18352
18353 Single-precision floating point:
18354 @table @asis
18355
18356 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
18357 Binary arithmetic operations.
18358
18359 @item @samp{fnegs}
18360 Unary negation.
18361
18362 @item @samp{fabss}
18363 Unary absolute value.
18364
18365 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
18366 Comparison operations.
18367
18368 @item @samp{fmins}, @samp{fmaxs}
18369 Floating-point minimum and maximum. These instructions are only
18370 generated if @option{-ffinite-math-only} is specified.
18371
18372 @item @samp{fsqrts}
18373 Unary square root operation.
18374
18375 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
18376 Floating-point trigonometric and exponential functions. These instructions
18377 are only generated if @option{-funsafe-math-optimizations} is also specified.
18378
18379 @end table
18380
18381 Double-precision floating point:
18382 @table @asis
18383
18384 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
18385 Binary arithmetic operations.
18386
18387 @item @samp{fnegd}
18388 Unary negation.
18389
18390 @item @samp{fabsd}
18391 Unary absolute value.
18392
18393 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
18394 Comparison operations.
18395
18396 @item @samp{fmind}, @samp{fmaxd}
18397 Double-precision minimum and maximum. These instructions are only
18398 generated if @option{-ffinite-math-only} is specified.
18399
18400 @item @samp{fsqrtd}
18401 Unary square root operation.
18402
18403 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
18404 Double-precision trigonometric and exponential functions. These instructions
18405 are only generated if @option{-funsafe-math-optimizations} is also specified.
18406
18407 @end table
18408
18409 Conversions:
18410 @table @asis
18411 @item @samp{fextsd}
18412 Conversion from single precision to double precision.
18413
18414 @item @samp{ftruncds}
18415 Conversion from double precision to single precision.
18416
18417 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
18418 Conversion from floating point to signed or unsigned integer types, with
18419 truncation towards zero.
18420
18421 @item @samp{round}
18422 Conversion from single-precision floating point to signed integer,
18423 rounding to the nearest integer and ties away from zero.
18424 This corresponds to the @code{__builtin_lroundf} function when
18425 @option{-fno-math-errno} is used.
18426
18427 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
18428 Conversion from signed or unsigned integer types to floating-point types.
18429
18430 @end table
18431
18432 In addition, all of the following transfer instructions for internal
18433 registers X and Y must be provided to use any of the double-precision
18434 floating-point instructions. Custom instructions taking two
18435 double-precision source operands expect the first operand in the
18436 64-bit register X. The other operand (or only operand of a unary
18437 operation) is given to the custom arithmetic instruction with the
18438 least significant half in source register @var{src1} and the most
18439 significant half in @var{src2}. A custom instruction that returns a
18440 double-precision result returns the most significant 32 bits in the
18441 destination register and the other half in 32-bit register Y.
18442 GCC automatically generates the necessary code sequences to write
18443 register X and/or read register Y when double-precision floating-point
18444 instructions are used.
18445
18446 @table @asis
18447
18448 @item @samp{fwrx}
18449 Write @var{src1} into the least significant half of X and @var{src2} into
18450 the most significant half of X.
18451
18452 @item @samp{fwry}
18453 Write @var{src1} into Y.
18454
18455 @item @samp{frdxhi}, @samp{frdxlo}
18456 Read the most or least (respectively) significant half of X and store it in
18457 @var{dest}.
18458
18459 @item @samp{frdy}
18460 Read the value of Y and store it into @var{dest}.
18461 @end table
18462
18463 Note that you can gain more local control over generation of Nios II custom
18464 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
18465 and @code{target("no-custom-@var{insn}")} function attributes
18466 (@pxref{Function Attributes})
18467 or pragmas (@pxref{Function Specific Option Pragmas}).
18468
18469 @item -mcustom-fpu-cfg=@var{name}
18470 @opindex mcustom-fpu-cfg
18471
18472 This option enables a predefined, named set of custom instruction encodings
18473 (see @option{-mcustom-@var{insn}} above).
18474 Currently, the following sets are defined:
18475
18476 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
18477 @gccoptlist{-mcustom-fmuls=252 @gol
18478 -mcustom-fadds=253 @gol
18479 -mcustom-fsubs=254 @gol
18480 -fsingle-precision-constant}
18481
18482 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
18483 @gccoptlist{-mcustom-fmuls=252 @gol
18484 -mcustom-fadds=253 @gol
18485 -mcustom-fsubs=254 @gol
18486 -mcustom-fdivs=255 @gol
18487 -fsingle-precision-constant}
18488
18489 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
18490 @gccoptlist{-mcustom-floatus=243 @gol
18491 -mcustom-fixsi=244 @gol
18492 -mcustom-floatis=245 @gol
18493 -mcustom-fcmpgts=246 @gol
18494 -mcustom-fcmples=249 @gol
18495 -mcustom-fcmpeqs=250 @gol
18496 -mcustom-fcmpnes=251 @gol
18497 -mcustom-fmuls=252 @gol
18498 -mcustom-fadds=253 @gol
18499 -mcustom-fsubs=254 @gol
18500 -mcustom-fdivs=255 @gol
18501 -fsingle-precision-constant}
18502
18503 Custom instruction assignments given by individual
18504 @option{-mcustom-@var{insn}=} options override those given by
18505 @option{-mcustom-fpu-cfg=}, regardless of the
18506 order of the options on the command line.
18507
18508 Note that you can gain more local control over selection of a FPU
18509 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
18510 function attribute (@pxref{Function Attributes})
18511 or pragma (@pxref{Function Specific Option Pragmas}).
18512
18513 @end table
18514
18515 These additional @samp{-m} options are available for the Altera Nios II
18516 ELF (bare-metal) target:
18517
18518 @table @gcctabopt
18519
18520 @item -mhal
18521 @opindex mhal
18522 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
18523 startup and termination code, and is typically used in conjunction with
18524 @option{-msys-crt0=} to specify the location of the alternate startup code
18525 provided by the HAL BSP.
18526
18527 @item -msmallc
18528 @opindex msmallc
18529 Link with a limited version of the C library, @option{-lsmallc}, rather than
18530 Newlib.
18531
18532 @item -msys-crt0=@var{startfile}
18533 @opindex msys-crt0
18534 @var{startfile} is the file name of the startfile (crt0) to use
18535 when linking. This option is only useful in conjunction with @option{-mhal}.
18536
18537 @item -msys-lib=@var{systemlib}
18538 @opindex msys-lib
18539 @var{systemlib} is the library name of the library that provides
18540 low-level system calls required by the C library,
18541 e.g. @code{read} and @code{write}.
18542 This option is typically used to link with a library provided by a HAL BSP.
18543
18544 @end table
18545
18546 @node Nvidia PTX Options
18547 @subsection Nvidia PTX Options
18548 @cindex Nvidia PTX options
18549 @cindex nvptx options
18550
18551 These options are defined for Nvidia PTX:
18552
18553 @table @gcctabopt
18554
18555 @item -m32
18556 @itemx -m64
18557 @opindex m32
18558 @opindex m64
18559 Generate code for 32-bit or 64-bit ABI.
18560
18561 @item -mmainkernel
18562 @opindex mmainkernel
18563 Link in code for a __main kernel. This is for stand-alone instead of
18564 offloading execution.
18565
18566 @end table
18567
18568 @node PDP-11 Options
18569 @subsection PDP-11 Options
18570 @cindex PDP-11 Options
18571
18572 These options are defined for the PDP-11:
18573
18574 @table @gcctabopt
18575 @item -mfpu
18576 @opindex mfpu
18577 Use hardware FPP floating point. This is the default. (FIS floating
18578 point on the PDP-11/40 is not supported.)
18579
18580 @item -msoft-float
18581 @opindex msoft-float
18582 Do not use hardware floating point.
18583
18584 @item -mac0
18585 @opindex mac0
18586 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
18587
18588 @item -mno-ac0
18589 @opindex mno-ac0
18590 Return floating-point results in memory. This is the default.
18591
18592 @item -m40
18593 @opindex m40
18594 Generate code for a PDP-11/40.
18595
18596 @item -m45
18597 @opindex m45
18598 Generate code for a PDP-11/45. This is the default.
18599
18600 @item -m10
18601 @opindex m10
18602 Generate code for a PDP-11/10.
18603
18604 @item -mbcopy-builtin
18605 @opindex mbcopy-builtin
18606 Use inline @code{movmemhi} patterns for copying memory. This is the
18607 default.
18608
18609 @item -mbcopy
18610 @opindex mbcopy
18611 Do not use inline @code{movmemhi} patterns for copying memory.
18612
18613 @item -mint16
18614 @itemx -mno-int32
18615 @opindex mint16
18616 @opindex mno-int32
18617 Use 16-bit @code{int}. This is the default.
18618
18619 @item -mint32
18620 @itemx -mno-int16
18621 @opindex mint32
18622 @opindex mno-int16
18623 Use 32-bit @code{int}.
18624
18625 @item -mfloat64
18626 @itemx -mno-float32
18627 @opindex mfloat64
18628 @opindex mno-float32
18629 Use 64-bit @code{float}. This is the default.
18630
18631 @item -mfloat32
18632 @itemx -mno-float64
18633 @opindex mfloat32
18634 @opindex mno-float64
18635 Use 32-bit @code{float}.
18636
18637 @item -mabshi
18638 @opindex mabshi
18639 Use @code{abshi2} pattern. This is the default.
18640
18641 @item -mno-abshi
18642 @opindex mno-abshi
18643 Do not use @code{abshi2} pattern.
18644
18645 @item -mbranch-expensive
18646 @opindex mbranch-expensive
18647 Pretend that branches are expensive. This is for experimenting with
18648 code generation only.
18649
18650 @item -mbranch-cheap
18651 @opindex mbranch-cheap
18652 Do not pretend that branches are expensive. This is the default.
18653
18654 @item -munix-asm
18655 @opindex munix-asm
18656 Use Unix assembler syntax. This is the default when configured for
18657 @samp{pdp11-*-bsd}.
18658
18659 @item -mdec-asm
18660 @opindex mdec-asm
18661 Use DEC assembler syntax. This is the default when configured for any
18662 PDP-11 target other than @samp{pdp11-*-bsd}.
18663 @end table
18664
18665 @node picoChip Options
18666 @subsection picoChip Options
18667 @cindex picoChip options
18668
18669 These @samp{-m} options are defined for picoChip implementations:
18670
18671 @table @gcctabopt
18672
18673 @item -mae=@var{ae_type}
18674 @opindex mcpu
18675 Set the instruction set, register set, and instruction scheduling
18676 parameters for array element type @var{ae_type}. Supported values
18677 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
18678
18679 @option{-mae=ANY} selects a completely generic AE type. Code
18680 generated with this option runs on any of the other AE types. The
18681 code is not as efficient as it would be if compiled for a specific
18682 AE type, and some types of operation (e.g., multiplication) do not
18683 work properly on all types of AE.
18684
18685 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
18686 for compiled code, and is the default.
18687
18688 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
18689 option may suffer from poor performance of byte (char) manipulation,
18690 since the DSP AE does not provide hardware support for byte load/stores.
18691
18692 @item -msymbol-as-address
18693 Enable the compiler to directly use a symbol name as an address in a
18694 load/store instruction, without first loading it into a
18695 register. Typically, the use of this option generates larger
18696 programs, which run faster than when the option isn't used. However, the
18697 results vary from program to program, so it is left as a user option,
18698 rather than being permanently enabled.
18699
18700 @item -mno-inefficient-warnings
18701 Disables warnings about the generation of inefficient code. These
18702 warnings can be generated, for example, when compiling code that
18703 performs byte-level memory operations on the MAC AE type. The MAC AE has
18704 no hardware support for byte-level memory operations, so all byte
18705 load/stores must be synthesized from word load/store operations. This is
18706 inefficient and a warning is generated to indicate
18707 that you should rewrite the code to avoid byte operations, or to target
18708 an AE type that has the necessary hardware support. This option disables
18709 these warnings.
18710
18711 @end table
18712
18713 @node PowerPC Options
18714 @subsection PowerPC Options
18715 @cindex PowerPC options
18716
18717 These are listed under @xref{RS/6000 and PowerPC Options}.
18718
18719 @node RL78 Options
18720 @subsection RL78 Options
18721 @cindex RL78 Options
18722
18723 @table @gcctabopt
18724
18725 @item -msim
18726 @opindex msim
18727 Links in additional target libraries to support operation within a
18728 simulator.
18729
18730 @item -mmul=none
18731 @itemx -mmul=g13
18732 @itemx -mmul=rl78
18733 @opindex mmul
18734 Specifies the type of hardware multiplication support to be used. The
18735 default is @samp{none}, which uses software multiplication functions.
18736 The @samp{g13} option is for the hardware multiply/divide peripheral
18737 only on the RL78/G13 targets. The @samp{rl78} option is for the
18738 standard hardware multiplication defined in the RL78 software manual.
18739
18740 @item -m64bit-doubles
18741 @itemx -m32bit-doubles
18742 @opindex m64bit-doubles
18743 @opindex m32bit-doubles
18744 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
18745 or 32 bits (@option{-m32bit-doubles}) in size. The default is
18746 @option{-m32bit-doubles}.
18747
18748 @end table
18749
18750 @node RS/6000 and PowerPC Options
18751 @subsection IBM RS/6000 and PowerPC Options
18752 @cindex RS/6000 and PowerPC Options
18753 @cindex IBM RS/6000 and PowerPC Options
18754
18755 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
18756 @table @gcctabopt
18757 @item -mpowerpc-gpopt
18758 @itemx -mno-powerpc-gpopt
18759 @itemx -mpowerpc-gfxopt
18760 @itemx -mno-powerpc-gfxopt
18761 @need 800
18762 @itemx -mpowerpc64
18763 @itemx -mno-powerpc64
18764 @itemx -mmfcrf
18765 @itemx -mno-mfcrf
18766 @itemx -mpopcntb
18767 @itemx -mno-popcntb
18768 @itemx -mpopcntd
18769 @itemx -mno-popcntd
18770 @itemx -mfprnd
18771 @itemx -mno-fprnd
18772 @need 800
18773 @itemx -mcmpb
18774 @itemx -mno-cmpb
18775 @itemx -mmfpgpr
18776 @itemx -mno-mfpgpr
18777 @itemx -mhard-dfp
18778 @itemx -mno-hard-dfp
18779 @opindex mpowerpc-gpopt
18780 @opindex mno-powerpc-gpopt
18781 @opindex mpowerpc-gfxopt
18782 @opindex mno-powerpc-gfxopt
18783 @opindex mpowerpc64
18784 @opindex mno-powerpc64
18785 @opindex mmfcrf
18786 @opindex mno-mfcrf
18787 @opindex mpopcntb
18788 @opindex mno-popcntb
18789 @opindex mpopcntd
18790 @opindex mno-popcntd
18791 @opindex mfprnd
18792 @opindex mno-fprnd
18793 @opindex mcmpb
18794 @opindex mno-cmpb
18795 @opindex mmfpgpr
18796 @opindex mno-mfpgpr
18797 @opindex mhard-dfp
18798 @opindex mno-hard-dfp
18799 You use these options to specify which instructions are available on the
18800 processor you are using. The default value of these options is
18801 determined when configuring GCC@. Specifying the
18802 @option{-mcpu=@var{cpu_type}} overrides the specification of these
18803 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
18804 rather than the options listed above.
18805
18806 Specifying @option{-mpowerpc-gpopt} allows
18807 GCC to use the optional PowerPC architecture instructions in the
18808 General Purpose group, including floating-point square root. Specifying
18809 @option{-mpowerpc-gfxopt} allows GCC to
18810 use the optional PowerPC architecture instructions in the Graphics
18811 group, including floating-point select.
18812
18813 The @option{-mmfcrf} option allows GCC to generate the move from
18814 condition register field instruction implemented on the POWER4
18815 processor and other processors that support the PowerPC V2.01
18816 architecture.
18817 The @option{-mpopcntb} option allows GCC to generate the popcount and
18818 double-precision FP reciprocal estimate instruction implemented on the
18819 POWER5 processor and other processors that support the PowerPC V2.02
18820 architecture.
18821 The @option{-mpopcntd} option allows GCC to generate the popcount
18822 instruction implemented on the POWER7 processor and other processors
18823 that support the PowerPC V2.06 architecture.
18824 The @option{-mfprnd} option allows GCC to generate the FP round to
18825 integer instructions implemented on the POWER5+ processor and other
18826 processors that support the PowerPC V2.03 architecture.
18827 The @option{-mcmpb} option allows GCC to generate the compare bytes
18828 instruction implemented on the POWER6 processor and other processors
18829 that support the PowerPC V2.05 architecture.
18830 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
18831 general-purpose register instructions implemented on the POWER6X
18832 processor and other processors that support the extended PowerPC V2.05
18833 architecture.
18834 The @option{-mhard-dfp} option allows GCC to generate the decimal
18835 floating-point instructions implemented on some POWER processors.
18836
18837 The @option{-mpowerpc64} option allows GCC to generate the additional
18838 64-bit instructions that are found in the full PowerPC64 architecture
18839 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
18840 @option{-mno-powerpc64}.
18841
18842 @item -mcpu=@var{cpu_type}
18843 @opindex mcpu
18844 Set architecture type, register usage, and
18845 instruction scheduling parameters for machine type @var{cpu_type}.
18846 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
18847 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
18848 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
18849 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
18850 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
18851 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
18852 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
18853 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
18854 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
18855 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, @samp{powerpc},
18856 @samp{powerpc64}, @samp{powerpc64le}, and @samp{rs64}.
18857
18858 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
18859 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
18860 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
18861 architecture machine types, with an appropriate, generic processor
18862 model assumed for scheduling purposes.
18863
18864 The other options specify a specific processor. Code generated under
18865 those options runs best on that processor, and may not run at all on
18866 others.
18867
18868 The @option{-mcpu} options automatically enable or disable the
18869 following options:
18870
18871 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
18872 -mpopcntb -mpopcntd -mpowerpc64 @gol
18873 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
18874 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
18875 -mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol
18876 -mquad-memory -mquad-memory-atomic}
18877
18878 The particular options set for any particular CPU varies between
18879 compiler versions, depending on what setting seems to produce optimal
18880 code for that CPU; it doesn't necessarily reflect the actual hardware's
18881 capabilities. If you wish to set an individual option to a particular
18882 value, you may specify it after the @option{-mcpu} option, like
18883 @option{-mcpu=970 -mno-altivec}.
18884
18885 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
18886 not enabled or disabled by the @option{-mcpu} option at present because
18887 AIX does not have full support for these options. You may still
18888 enable or disable them individually if you're sure it'll work in your
18889 environment.
18890
18891 @item -mtune=@var{cpu_type}
18892 @opindex mtune
18893 Set the instruction scheduling parameters for machine type
18894 @var{cpu_type}, but do not set the architecture type or register usage,
18895 as @option{-mcpu=@var{cpu_type}} does. The same
18896 values for @var{cpu_type} are used for @option{-mtune} as for
18897 @option{-mcpu}. If both are specified, the code generated uses the
18898 architecture and registers set by @option{-mcpu}, but the
18899 scheduling parameters set by @option{-mtune}.
18900
18901 @item -mcmodel=small
18902 @opindex mcmodel=small
18903 Generate PowerPC64 code for the small model: The TOC is limited to
18904 64k.
18905
18906 @item -mcmodel=medium
18907 @opindex mcmodel=medium
18908 Generate PowerPC64 code for the medium model: The TOC and other static
18909 data may be up to a total of 4G in size.
18910
18911 @item -mcmodel=large
18912 @opindex mcmodel=large
18913 Generate PowerPC64 code for the large model: The TOC may be up to 4G
18914 in size. Other data and code is only limited by the 64-bit address
18915 space.
18916
18917 @item -maltivec
18918 @itemx -mno-altivec
18919 @opindex maltivec
18920 @opindex mno-altivec
18921 Generate code that uses (does not use) AltiVec instructions, and also
18922 enable the use of built-in functions that allow more direct access to
18923 the AltiVec instruction set. You may also need to set
18924 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
18925 enhancements.
18926
18927 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
18928 @option{-maltivec=be}, the element order for Altivec intrinsics such
18929 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
18930 match array element order corresponding to the endianness of the
18931 target. That is, element zero identifies the leftmost element in a
18932 vector register when targeting a big-endian platform, and identifies
18933 the rightmost element in a vector register when targeting a
18934 little-endian platform.
18935
18936 @item -maltivec=be
18937 @opindex maltivec=be
18938 Generate Altivec instructions using big-endian element order,
18939 regardless of whether the target is big- or little-endian. This is
18940 the default when targeting a big-endian platform.
18941
18942 The element order is used to interpret element numbers in Altivec
18943 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
18944 @code{vec_insert}. By default, these match array element order
18945 corresponding to the endianness for the target.
18946
18947 @item -maltivec=le
18948 @opindex maltivec=le
18949 Generate Altivec instructions using little-endian element order,
18950 regardless of whether the target is big- or little-endian. This is
18951 the default when targeting a little-endian platform. This option is
18952 currently ignored when targeting a big-endian platform.
18953
18954 The element order is used to interpret element numbers in Altivec
18955 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
18956 @code{vec_insert}. By default, these match array element order
18957 corresponding to the endianness for the target.
18958
18959 @item -mvrsave
18960 @itemx -mno-vrsave
18961 @opindex mvrsave
18962 @opindex mno-vrsave
18963 Generate VRSAVE instructions when generating AltiVec code.
18964
18965 @item -mgen-cell-microcode
18966 @opindex mgen-cell-microcode
18967 Generate Cell microcode instructions.
18968
18969 @item -mwarn-cell-microcode
18970 @opindex mwarn-cell-microcode
18971 Warn when a Cell microcode instruction is emitted. An example
18972 of a Cell microcode instruction is a variable shift.
18973
18974 @item -msecure-plt
18975 @opindex msecure-plt
18976 Generate code that allows @command{ld} and @command{ld.so}
18977 to build executables and shared
18978 libraries with non-executable @code{.plt} and @code{.got} sections.
18979 This is a PowerPC
18980 32-bit SYSV ABI option.
18981
18982 @item -mbss-plt
18983 @opindex mbss-plt
18984 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
18985 fills in, and
18986 requires @code{.plt} and @code{.got}
18987 sections that are both writable and executable.
18988 This is a PowerPC 32-bit SYSV ABI option.
18989
18990 @item -misel
18991 @itemx -mno-isel
18992 @opindex misel
18993 @opindex mno-isel
18994 This switch enables or disables the generation of ISEL instructions.
18995
18996 @item -misel=@var{yes/no}
18997 This switch has been deprecated. Use @option{-misel} and
18998 @option{-mno-isel} instead.
18999
19000 @item -mspe
19001 @itemx -mno-spe
19002 @opindex mspe
19003 @opindex mno-spe
19004 This switch enables or disables the generation of SPE simd
19005 instructions.
19006
19007 @item -mpaired
19008 @itemx -mno-paired
19009 @opindex mpaired
19010 @opindex mno-paired
19011 This switch enables or disables the generation of PAIRED simd
19012 instructions.
19013
19014 @item -mspe=@var{yes/no}
19015 This option has been deprecated. Use @option{-mspe} and
19016 @option{-mno-spe} instead.
19017
19018 @item -mvsx
19019 @itemx -mno-vsx
19020 @opindex mvsx
19021 @opindex mno-vsx
19022 Generate code that uses (does not use) vector/scalar (VSX)
19023 instructions, and also enable the use of built-in functions that allow
19024 more direct access to the VSX instruction set.
19025
19026 @item -mcrypto
19027 @itemx -mno-crypto
19028 @opindex mcrypto
19029 @opindex mno-crypto
19030 Enable the use (disable) of the built-in functions that allow direct
19031 access to the cryptographic instructions that were added in version
19032 2.07 of the PowerPC ISA.
19033
19034 @item -mdirect-move
19035 @itemx -mno-direct-move
19036 @opindex mdirect-move
19037 @opindex mno-direct-move
19038 Generate code that uses (does not use) the instructions to move data
19039 between the general purpose registers and the vector/scalar (VSX)
19040 registers that were added in version 2.07 of the PowerPC ISA.
19041
19042 @item -mpower8-fusion
19043 @itemx -mno-power8-fusion
19044 @opindex mpower8-fusion
19045 @opindex mno-power8-fusion
19046 Generate code that keeps (does not keeps) some integer operations
19047 adjacent so that the instructions can be fused together on power8 and
19048 later processors.
19049
19050 @item -mpower8-vector
19051 @itemx -mno-power8-vector
19052 @opindex mpower8-vector
19053 @opindex mno-power8-vector
19054 Generate code that uses (does not use) the vector and scalar
19055 instructions that were added in version 2.07 of the PowerPC ISA. Also
19056 enable the use of built-in functions that allow more direct access to
19057 the vector instructions.
19058
19059 @item -mquad-memory
19060 @itemx -mno-quad-memory
19061 @opindex mquad-memory
19062 @opindex mno-quad-memory
19063 Generate code that uses (does not use) the non-atomic quad word memory
19064 instructions. The @option{-mquad-memory} option requires use of
19065 64-bit mode.
19066
19067 @item -mquad-memory-atomic
19068 @itemx -mno-quad-memory-atomic
19069 @opindex mquad-memory-atomic
19070 @opindex mno-quad-memory-atomic
19071 Generate code that uses (does not use) the atomic quad word memory
19072 instructions. The @option{-mquad-memory-atomic} option requires use of
19073 64-bit mode.
19074
19075 @item -mupper-regs-df
19076 @itemx -mno-upper-regs-df
19077 @opindex mupper-regs-df
19078 @opindex mno-upper-regs-df
19079 Generate code that uses (does not use) the scalar double precision
19080 instructions that target all 64 registers in the vector/scalar
19081 floating point register set that were added in version 2.06 of the
19082 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
19083 use any of the @option{-mcpu=power7}, @option{-mcpu=power8}, or
19084 @option{-mvsx} options.
19085
19086 @item -mupper-regs-sf
19087 @itemx -mno-upper-regs-sf
19088 @opindex mupper-regs-sf
19089 @opindex mno-upper-regs-sf
19090 Generate code that uses (does not use) the scalar single precision
19091 instructions that target all 64 registers in the vector/scalar
19092 floating point register set that were added in version 2.07 of the
19093 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
19094 use either of the @option{-mcpu=power8} or @option{-mpower8-vector}
19095 options.
19096
19097 @item -mupper-regs
19098 @itemx -mno-upper-regs
19099 @opindex mupper-regs
19100 @opindex mno-upper-regs
19101 Generate code that uses (does not use) the scalar
19102 instructions that target all 64 registers in the vector/scalar
19103 floating point register set, depending on the model of the machine.
19104
19105 If the @option{-mno-upper-regs} option is used, it turns off both
19106 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
19107
19108 @item -mfloat-gprs=@var{yes/single/double/no}
19109 @itemx -mfloat-gprs
19110 @opindex mfloat-gprs
19111 This switch enables or disables the generation of floating-point
19112 operations on the general-purpose registers for architectures that
19113 support it.
19114
19115 The argument @samp{yes} or @samp{single} enables the use of
19116 single-precision floating-point operations.
19117
19118 The argument @samp{double} enables the use of single and
19119 double-precision floating-point operations.
19120
19121 The argument @samp{no} disables floating-point operations on the
19122 general-purpose registers.
19123
19124 This option is currently only available on the MPC854x.
19125
19126 @item -m32
19127 @itemx -m64
19128 @opindex m32
19129 @opindex m64
19130 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
19131 targets (including GNU/Linux). The 32-bit environment sets int, long
19132 and pointer to 32 bits and generates code that runs on any PowerPC
19133 variant. The 64-bit environment sets int to 32 bits and long and
19134 pointer to 64 bits, and generates code for PowerPC64, as for
19135 @option{-mpowerpc64}.
19136
19137 @item -mfull-toc
19138 @itemx -mno-fp-in-toc
19139 @itemx -mno-sum-in-toc
19140 @itemx -mminimal-toc
19141 @opindex mfull-toc
19142 @opindex mno-fp-in-toc
19143 @opindex mno-sum-in-toc
19144 @opindex mminimal-toc
19145 Modify generation of the TOC (Table Of Contents), which is created for
19146 every executable file. The @option{-mfull-toc} option is selected by
19147 default. In that case, GCC allocates at least one TOC entry for
19148 each unique non-automatic variable reference in your program. GCC
19149 also places floating-point constants in the TOC@. However, only
19150 16,384 entries are available in the TOC@.
19151
19152 If you receive a linker error message that saying you have overflowed
19153 the available TOC space, you can reduce the amount of TOC space used
19154 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
19155 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
19156 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
19157 generate code to calculate the sum of an address and a constant at
19158 run time instead of putting that sum into the TOC@. You may specify one
19159 or both of these options. Each causes GCC to produce very slightly
19160 slower and larger code at the expense of conserving TOC space.
19161
19162 If you still run out of space in the TOC even when you specify both of
19163 these options, specify @option{-mminimal-toc} instead. This option causes
19164 GCC to make only one TOC entry for every file. When you specify this
19165 option, GCC produces code that is slower and larger but which
19166 uses extremely little TOC space. You may wish to use this option
19167 only on files that contain less frequently-executed code.
19168
19169 @item -maix64
19170 @itemx -maix32
19171 @opindex maix64
19172 @opindex maix32
19173 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
19174 @code{long} type, and the infrastructure needed to support them.
19175 Specifying @option{-maix64} implies @option{-mpowerpc64},
19176 while @option{-maix32} disables the 64-bit ABI and
19177 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
19178
19179 @item -mxl-compat
19180 @itemx -mno-xl-compat
19181 @opindex mxl-compat
19182 @opindex mno-xl-compat
19183 Produce code that conforms more closely to IBM XL compiler semantics
19184 when using AIX-compatible ABI@. Pass floating-point arguments to
19185 prototyped functions beyond the register save area (RSA) on the stack
19186 in addition to argument FPRs. Do not assume that most significant
19187 double in 128-bit long double value is properly rounded when comparing
19188 values and converting to double. Use XL symbol names for long double
19189 support routines.
19190
19191 The AIX calling convention was extended but not initially documented to
19192 handle an obscure K&R C case of calling a function that takes the
19193 address of its arguments with fewer arguments than declared. IBM XL
19194 compilers access floating-point arguments that do not fit in the
19195 RSA from the stack when a subroutine is compiled without
19196 optimization. Because always storing floating-point arguments on the
19197 stack is inefficient and rarely needed, this option is not enabled by
19198 default and only is necessary when calling subroutines compiled by IBM
19199 XL compilers without optimization.
19200
19201 @item -mpe
19202 @opindex mpe
19203 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
19204 application written to use message passing with special startup code to
19205 enable the application to run. The system must have PE installed in the
19206 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
19207 must be overridden with the @option{-specs=} option to specify the
19208 appropriate directory location. The Parallel Environment does not
19209 support threads, so the @option{-mpe} option and the @option{-pthread}
19210 option are incompatible.
19211
19212 @item -malign-natural
19213 @itemx -malign-power
19214 @opindex malign-natural
19215 @opindex malign-power
19216 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
19217 @option{-malign-natural} overrides the ABI-defined alignment of larger
19218 types, such as floating-point doubles, on their natural size-based boundary.
19219 The option @option{-malign-power} instructs GCC to follow the ABI-specified
19220 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
19221
19222 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
19223 is not supported.
19224
19225 @item -msoft-float
19226 @itemx -mhard-float
19227 @opindex msoft-float
19228 @opindex mhard-float
19229 Generate code that does not use (uses) the floating-point register set.
19230 Software floating-point emulation is provided if you use the
19231 @option{-msoft-float} option, and pass the option to GCC when linking.
19232
19233 @item -msingle-float
19234 @itemx -mdouble-float
19235 @opindex msingle-float
19236 @opindex mdouble-float
19237 Generate code for single- or double-precision floating-point operations.
19238 @option{-mdouble-float} implies @option{-msingle-float}.
19239
19240 @item -msimple-fpu
19241 @opindex msimple-fpu
19242 Do not generate @code{sqrt} and @code{div} instructions for hardware
19243 floating-point unit.
19244
19245 @item -mfpu=@var{name}
19246 @opindex mfpu
19247 Specify type of floating-point unit. Valid values for @var{name} are
19248 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
19249 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
19250 @samp{sp_full} (equivalent to @option{-msingle-float}),
19251 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
19252
19253 @item -mxilinx-fpu
19254 @opindex mxilinx-fpu
19255 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
19256
19257 @item -mmultiple
19258 @itemx -mno-multiple
19259 @opindex mmultiple
19260 @opindex mno-multiple
19261 Generate code that uses (does not use) the load multiple word
19262 instructions and the store multiple word instructions. These
19263 instructions are generated by default on POWER systems, and not
19264 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
19265 PowerPC systems, since those instructions do not work when the
19266 processor is in little-endian mode. The exceptions are PPC740 and
19267 PPC750 which permit these instructions in little-endian mode.
19268
19269 @item -mstring
19270 @itemx -mno-string
19271 @opindex mstring
19272 @opindex mno-string
19273 Generate code that uses (does not use) the load string instructions
19274 and the store string word instructions to save multiple registers and
19275 do small block moves. These instructions are generated by default on
19276 POWER systems, and not generated on PowerPC systems. Do not use
19277 @option{-mstring} on little-endian PowerPC systems, since those
19278 instructions do not work when the processor is in little-endian mode.
19279 The exceptions are PPC740 and PPC750 which permit these instructions
19280 in little-endian mode.
19281
19282 @item -mupdate
19283 @itemx -mno-update
19284 @opindex mupdate
19285 @opindex mno-update
19286 Generate code that uses (does not use) the load or store instructions
19287 that update the base register to the address of the calculated memory
19288 location. These instructions are generated by default. If you use
19289 @option{-mno-update}, there is a small window between the time that the
19290 stack pointer is updated and the address of the previous frame is
19291 stored, which means code that walks the stack frame across interrupts or
19292 signals may get corrupted data.
19293
19294 @item -mavoid-indexed-addresses
19295 @itemx -mno-avoid-indexed-addresses
19296 @opindex mavoid-indexed-addresses
19297 @opindex mno-avoid-indexed-addresses
19298 Generate code that tries to avoid (not avoid) the use of indexed load
19299 or store instructions. These instructions can incur a performance
19300 penalty on Power6 processors in certain situations, such as when
19301 stepping through large arrays that cross a 16M boundary. This option
19302 is enabled by default when targeting Power6 and disabled otherwise.
19303
19304 @item -mfused-madd
19305 @itemx -mno-fused-madd
19306 @opindex mfused-madd
19307 @opindex mno-fused-madd
19308 Generate code that uses (does not use) the floating-point multiply and
19309 accumulate instructions. These instructions are generated by default
19310 if hardware floating point is used. The machine-dependent
19311 @option{-mfused-madd} option is now mapped to the machine-independent
19312 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
19313 mapped to @option{-ffp-contract=off}.
19314
19315 @item -mmulhw
19316 @itemx -mno-mulhw
19317 @opindex mmulhw
19318 @opindex mno-mulhw
19319 Generate code that uses (does not use) the half-word multiply and
19320 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
19321 These instructions are generated by default when targeting those
19322 processors.
19323
19324 @item -mdlmzb
19325 @itemx -mno-dlmzb
19326 @opindex mdlmzb
19327 @opindex mno-dlmzb
19328 Generate code that uses (does not use) the string-search @samp{dlmzb}
19329 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
19330 generated by default when targeting those processors.
19331
19332 @item -mno-bit-align
19333 @itemx -mbit-align
19334 @opindex mno-bit-align
19335 @opindex mbit-align
19336 On System V.4 and embedded PowerPC systems do not (do) force structures
19337 and unions that contain bit-fields to be aligned to the base type of the
19338 bit-field.
19339
19340 For example, by default a structure containing nothing but 8
19341 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
19342 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
19343 the structure is aligned to a 1-byte boundary and is 1 byte in
19344 size.
19345
19346 @item -mno-strict-align
19347 @itemx -mstrict-align
19348 @opindex mno-strict-align
19349 @opindex mstrict-align
19350 On System V.4 and embedded PowerPC systems do not (do) assume that
19351 unaligned memory references are handled by the system.
19352
19353 @item -mrelocatable
19354 @itemx -mno-relocatable
19355 @opindex mrelocatable
19356 @opindex mno-relocatable
19357 Generate code that allows (does not allow) a static executable to be
19358 relocated to a different address at run time. A simple embedded
19359 PowerPC system loader should relocate the entire contents of
19360 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
19361 a table of 32-bit addresses generated by this option. For this to
19362 work, all objects linked together must be compiled with
19363 @option{-mrelocatable} or @option{-mrelocatable-lib}.
19364 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
19365
19366 @item -mrelocatable-lib
19367 @itemx -mno-relocatable-lib
19368 @opindex mrelocatable-lib
19369 @opindex mno-relocatable-lib
19370 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
19371 @code{.fixup} section to allow static executables to be relocated at
19372 run time, but @option{-mrelocatable-lib} does not use the smaller stack
19373 alignment of @option{-mrelocatable}. Objects compiled with
19374 @option{-mrelocatable-lib} may be linked with objects compiled with
19375 any combination of the @option{-mrelocatable} options.
19376
19377 @item -mno-toc
19378 @itemx -mtoc
19379 @opindex mno-toc
19380 @opindex mtoc
19381 On System V.4 and embedded PowerPC systems do not (do) assume that
19382 register 2 contains a pointer to a global area pointing to the addresses
19383 used in the program.
19384
19385 @item -mlittle
19386 @itemx -mlittle-endian
19387 @opindex mlittle
19388 @opindex mlittle-endian
19389 On System V.4 and embedded PowerPC systems compile code for the
19390 processor in little-endian mode. The @option{-mlittle-endian} option is
19391 the same as @option{-mlittle}.
19392
19393 @item -mbig
19394 @itemx -mbig-endian
19395 @opindex mbig
19396 @opindex mbig-endian
19397 On System V.4 and embedded PowerPC systems compile code for the
19398 processor in big-endian mode. The @option{-mbig-endian} option is
19399 the same as @option{-mbig}.
19400
19401 @item -mdynamic-no-pic
19402 @opindex mdynamic-no-pic
19403 On Darwin and Mac OS X systems, compile code so that it is not
19404 relocatable, but that its external references are relocatable. The
19405 resulting code is suitable for applications, but not shared
19406 libraries.
19407
19408 @item -msingle-pic-base
19409 @opindex msingle-pic-base
19410 Treat the register used for PIC addressing as read-only, rather than
19411 loading it in the prologue for each function. The runtime system is
19412 responsible for initializing this register with an appropriate value
19413 before execution begins.
19414
19415 @item -mprioritize-restricted-insns=@var{priority}
19416 @opindex mprioritize-restricted-insns
19417 This option controls the priority that is assigned to
19418 dispatch-slot restricted instructions during the second scheduling
19419 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
19420 or @samp{2} to assign no, highest, or second-highest (respectively)
19421 priority to dispatch-slot restricted
19422 instructions.
19423
19424 @item -msched-costly-dep=@var{dependence_type}
19425 @opindex msched-costly-dep
19426 This option controls which dependences are considered costly
19427 by the target during instruction scheduling. The argument
19428 @var{dependence_type} takes one of the following values:
19429
19430 @table @asis
19431 @item @samp{no}
19432 No dependence is costly.
19433
19434 @item @samp{all}
19435 All dependences are costly.
19436
19437 @item @samp{true_store_to_load}
19438 A true dependence from store to load is costly.
19439
19440 @item @samp{store_to_load}
19441 Any dependence from store to load is costly.
19442
19443 @item @var{number}
19444 Any dependence for which the latency is greater than or equal to
19445 @var{number} is costly.
19446 @end table
19447
19448 @item -minsert-sched-nops=@var{scheme}
19449 @opindex minsert-sched-nops
19450 This option controls which NOP insertion scheme is used during
19451 the second scheduling pass. The argument @var{scheme} takes one of the
19452 following values:
19453
19454 @table @asis
19455 @item @samp{no}
19456 Don't insert NOPs.
19457
19458 @item @samp{pad}
19459 Pad with NOPs any dispatch group that has vacant issue slots,
19460 according to the scheduler's grouping.
19461
19462 @item @samp{regroup_exact}
19463 Insert NOPs to force costly dependent insns into
19464 separate groups. Insert exactly as many NOPs as needed to force an insn
19465 to a new group, according to the estimated processor grouping.
19466
19467 @item @var{number}
19468 Insert NOPs to force costly dependent insns into
19469 separate groups. Insert @var{number} NOPs to force an insn to a new group.
19470 @end table
19471
19472 @item -mcall-sysv
19473 @opindex mcall-sysv
19474 On System V.4 and embedded PowerPC systems compile code using calling
19475 conventions that adhere to the March 1995 draft of the System V
19476 Application Binary Interface, PowerPC processor supplement. This is the
19477 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
19478
19479 @item -mcall-sysv-eabi
19480 @itemx -mcall-eabi
19481 @opindex mcall-sysv-eabi
19482 @opindex mcall-eabi
19483 Specify both @option{-mcall-sysv} and @option{-meabi} options.
19484
19485 @item -mcall-sysv-noeabi
19486 @opindex mcall-sysv-noeabi
19487 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
19488
19489 @item -mcall-aixdesc
19490 @opindex m
19491 On System V.4 and embedded PowerPC systems compile code for the AIX
19492 operating system.
19493
19494 @item -mcall-linux
19495 @opindex mcall-linux
19496 On System V.4 and embedded PowerPC systems compile code for the
19497 Linux-based GNU system.
19498
19499 @item -mcall-freebsd
19500 @opindex mcall-freebsd
19501 On System V.4 and embedded PowerPC systems compile code for the
19502 FreeBSD operating system.
19503
19504 @item -mcall-netbsd
19505 @opindex mcall-netbsd
19506 On System V.4 and embedded PowerPC systems compile code for the
19507 NetBSD operating system.
19508
19509 @item -mcall-openbsd
19510 @opindex mcall-netbsd
19511 On System V.4 and embedded PowerPC systems compile code for the
19512 OpenBSD operating system.
19513
19514 @item -maix-struct-return
19515 @opindex maix-struct-return
19516 Return all structures in memory (as specified by the AIX ABI)@.
19517
19518 @item -msvr4-struct-return
19519 @opindex msvr4-struct-return
19520 Return structures smaller than 8 bytes in registers (as specified by the
19521 SVR4 ABI)@.
19522
19523 @item -mabi=@var{abi-type}
19524 @opindex mabi
19525 Extend the current ABI with a particular extension, or remove such extension.
19526 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
19527 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
19528 @samp{elfv1}, @samp{elfv2}@.
19529
19530 @item -mabi=spe
19531 @opindex mabi=spe
19532 Extend the current ABI with SPE ABI extensions. This does not change
19533 the default ABI, instead it adds the SPE ABI extensions to the current
19534 ABI@.
19535
19536 @item -mabi=no-spe
19537 @opindex mabi=no-spe
19538 Disable Book-E SPE ABI extensions for the current ABI@.
19539
19540 @item -mabi=ibmlongdouble
19541 @opindex mabi=ibmlongdouble
19542 Change the current ABI to use IBM extended-precision long double.
19543 This is a PowerPC 32-bit SYSV ABI option.
19544
19545 @item -mabi=ieeelongdouble
19546 @opindex mabi=ieeelongdouble
19547 Change the current ABI to use IEEE extended-precision long double.
19548 This is a PowerPC 32-bit Linux ABI option.
19549
19550 @item -mabi=elfv1
19551 @opindex mabi=elfv1
19552 Change the current ABI to use the ELFv1 ABI.
19553 This is the default ABI for big-endian PowerPC 64-bit Linux.
19554 Overriding the default ABI requires special system support and is
19555 likely to fail in spectacular ways.
19556
19557 @item -mabi=elfv2
19558 @opindex mabi=elfv2
19559 Change the current ABI to use the ELFv2 ABI.
19560 This is the default ABI for little-endian PowerPC 64-bit Linux.
19561 Overriding the default ABI requires special system support and is
19562 likely to fail in spectacular ways.
19563
19564 @item -mprototype
19565 @itemx -mno-prototype
19566 @opindex mprototype
19567 @opindex mno-prototype
19568 On System V.4 and embedded PowerPC systems assume that all calls to
19569 variable argument functions are properly prototyped. Otherwise, the
19570 compiler must insert an instruction before every non-prototyped call to
19571 set or clear bit 6 of the condition code register (@code{CR}) to
19572 indicate whether floating-point values are passed in the floating-point
19573 registers in case the function takes variable arguments. With
19574 @option{-mprototype}, only calls to prototyped variable argument functions
19575 set or clear the bit.
19576
19577 @item -msim
19578 @opindex msim
19579 On embedded PowerPC systems, assume that the startup module is called
19580 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
19581 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
19582 configurations.
19583
19584 @item -mmvme
19585 @opindex mmvme
19586 On embedded PowerPC systems, assume that the startup module is called
19587 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
19588 @file{libc.a}.
19589
19590 @item -mads
19591 @opindex mads
19592 On embedded PowerPC systems, assume that the startup module is called
19593 @file{crt0.o} and the standard C libraries are @file{libads.a} and
19594 @file{libc.a}.
19595
19596 @item -myellowknife
19597 @opindex myellowknife
19598 On embedded PowerPC systems, assume that the startup module is called
19599 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
19600 @file{libc.a}.
19601
19602 @item -mvxworks
19603 @opindex mvxworks
19604 On System V.4 and embedded PowerPC systems, specify that you are
19605 compiling for a VxWorks system.
19606
19607 @item -memb
19608 @opindex memb
19609 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
19610 header to indicate that @samp{eabi} extended relocations are used.
19611
19612 @item -meabi
19613 @itemx -mno-eabi
19614 @opindex meabi
19615 @opindex mno-eabi
19616 On System V.4 and embedded PowerPC systems do (do not) adhere to the
19617 Embedded Applications Binary Interface (EABI), which is a set of
19618 modifications to the System V.4 specifications. Selecting @option{-meabi}
19619 means that the stack is aligned to an 8-byte boundary, a function
19620 @code{__eabi} is called from @code{main} to set up the EABI
19621 environment, and the @option{-msdata} option can use both @code{r2} and
19622 @code{r13} to point to two separate small data areas. Selecting
19623 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
19624 no EABI initialization function is called from @code{main}, and the
19625 @option{-msdata} option only uses @code{r13} to point to a single
19626 small data area. The @option{-meabi} option is on by default if you
19627 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
19628
19629 @item -msdata=eabi
19630 @opindex msdata=eabi
19631 On System V.4 and embedded PowerPC systems, put small initialized
19632 @code{const} global and static data in the @code{.sdata2} section, which
19633 is pointed to by register @code{r2}. Put small initialized
19634 non-@code{const} global and static data in the @code{.sdata} section,
19635 which is pointed to by register @code{r13}. Put small uninitialized
19636 global and static data in the @code{.sbss} section, which is adjacent to
19637 the @code{.sdata} section. The @option{-msdata=eabi} option is
19638 incompatible with the @option{-mrelocatable} option. The
19639 @option{-msdata=eabi} option also sets the @option{-memb} option.
19640
19641 @item -msdata=sysv
19642 @opindex msdata=sysv
19643 On System V.4 and embedded PowerPC systems, put small global and static
19644 data in the @code{.sdata} section, which is pointed to by register
19645 @code{r13}. Put small uninitialized global and static data in the
19646 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
19647 The @option{-msdata=sysv} option is incompatible with the
19648 @option{-mrelocatable} option.
19649
19650 @item -msdata=default
19651 @itemx -msdata
19652 @opindex msdata=default
19653 @opindex msdata
19654 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
19655 compile code the same as @option{-msdata=eabi}, otherwise compile code the
19656 same as @option{-msdata=sysv}.
19657
19658 @item -msdata=data
19659 @opindex msdata=data
19660 On System V.4 and embedded PowerPC systems, put small global
19661 data in the @code{.sdata} section. Put small uninitialized global
19662 data in the @code{.sbss} section. Do not use register @code{r13}
19663 to address small data however. This is the default behavior unless
19664 other @option{-msdata} options are used.
19665
19666 @item -msdata=none
19667 @itemx -mno-sdata
19668 @opindex msdata=none
19669 @opindex mno-sdata
19670 On embedded PowerPC systems, put all initialized global and static data
19671 in the @code{.data} section, and all uninitialized data in the
19672 @code{.bss} section.
19673
19674 @item -mblock-move-inline-limit=@var{num}
19675 @opindex mblock-move-inline-limit
19676 Inline all block moves (such as calls to @code{memcpy} or structure
19677 copies) less than or equal to @var{num} bytes. The minimum value for
19678 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
19679 targets. The default value is target-specific.
19680
19681 @item -G @var{num}
19682 @opindex G
19683 @cindex smaller data references (PowerPC)
19684 @cindex .sdata/.sdata2 references (PowerPC)
19685 On embedded PowerPC systems, put global and static items less than or
19686 equal to @var{num} bytes into the small data or BSS sections instead of
19687 the normal data or BSS section. By default, @var{num} is 8. The
19688 @option{-G @var{num}} switch is also passed to the linker.
19689 All modules should be compiled with the same @option{-G @var{num}} value.
19690
19691 @item -mregnames
19692 @itemx -mno-regnames
19693 @opindex mregnames
19694 @opindex mno-regnames
19695 On System V.4 and embedded PowerPC systems do (do not) emit register
19696 names in the assembly language output using symbolic forms.
19697
19698 @item -mlongcall
19699 @itemx -mno-longcall
19700 @opindex mlongcall
19701 @opindex mno-longcall
19702 By default assume that all calls are far away so that a longer and more
19703 expensive calling sequence is required. This is required for calls
19704 farther than 32 megabytes (33,554,432 bytes) from the current location.
19705 A short call is generated if the compiler knows
19706 the call cannot be that far away. This setting can be overridden by
19707 the @code{shortcall} function attribute, or by @code{#pragma
19708 longcall(0)}.
19709
19710 Some linkers are capable of detecting out-of-range calls and generating
19711 glue code on the fly. On these systems, long calls are unnecessary and
19712 generate slower code. As of this writing, the AIX linker can do this,
19713 as can the GNU linker for PowerPC/64. It is planned to add this feature
19714 to the GNU linker for 32-bit PowerPC systems as well.
19715
19716 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
19717 callee, L42}, plus a @dfn{branch island} (glue code). The two target
19718 addresses represent the callee and the branch island. The
19719 Darwin/PPC linker prefers the first address and generates a @code{bl
19720 callee} if the PPC @code{bl} instruction reaches the callee directly;
19721 otherwise, the linker generates @code{bl L42} to call the branch
19722 island. The branch island is appended to the body of the
19723 calling function; it computes the full 32-bit address of the callee
19724 and jumps to it.
19725
19726 On Mach-O (Darwin) systems, this option directs the compiler emit to
19727 the glue for every direct call, and the Darwin linker decides whether
19728 to use or discard it.
19729
19730 In the future, GCC may ignore all longcall specifications
19731 when the linker is known to generate glue.
19732
19733 @item -mtls-markers
19734 @itemx -mno-tls-markers
19735 @opindex mtls-markers
19736 @opindex mno-tls-markers
19737 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
19738 specifying the function argument. The relocation allows the linker to
19739 reliably associate function call with argument setup instructions for
19740 TLS optimization, which in turn allows GCC to better schedule the
19741 sequence.
19742
19743 @item -pthread
19744 @opindex pthread
19745 Adds support for multithreading with the @dfn{pthreads} library.
19746 This option sets flags for both the preprocessor and linker.
19747
19748 @item -mrecip
19749 @itemx -mno-recip
19750 @opindex mrecip
19751 This option enables use of the reciprocal estimate and
19752 reciprocal square root estimate instructions with additional
19753 Newton-Raphson steps to increase precision instead of doing a divide or
19754 square root and divide for floating-point arguments. You should use
19755 the @option{-ffast-math} option when using @option{-mrecip} (or at
19756 least @option{-funsafe-math-optimizations},
19757 @option{-finite-math-only}, @option{-freciprocal-math} and
19758 @option{-fno-trapping-math}). Note that while the throughput of the
19759 sequence is generally higher than the throughput of the non-reciprocal
19760 instruction, the precision of the sequence can be decreased by up to 2
19761 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
19762 roots.
19763
19764 @item -mrecip=@var{opt}
19765 @opindex mrecip=opt
19766 This option controls which reciprocal estimate instructions
19767 may be used. @var{opt} is a comma-separated list of options, which may
19768 be preceded by a @code{!} to invert the option:
19769
19770 @table @samp
19771
19772 @item all
19773 Enable all estimate instructions.
19774
19775 @item default
19776 Enable the default instructions, equivalent to @option{-mrecip}.
19777
19778 @item none
19779 Disable all estimate instructions, equivalent to @option{-mno-recip}.
19780
19781 @item div
19782 Enable the reciprocal approximation instructions for both
19783 single and double precision.
19784
19785 @item divf
19786 Enable the single-precision reciprocal approximation instructions.
19787
19788 @item divd
19789 Enable the double-precision reciprocal approximation instructions.
19790
19791 @item rsqrt
19792 Enable the reciprocal square root approximation instructions for both
19793 single and double precision.
19794
19795 @item rsqrtf
19796 Enable the single-precision reciprocal square root approximation instructions.
19797
19798 @item rsqrtd
19799 Enable the double-precision reciprocal square root approximation instructions.
19800
19801 @end table
19802
19803 So, for example, @option{-mrecip=all,!rsqrtd} enables
19804 all of the reciprocal estimate instructions, except for the
19805 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
19806 which handle the double-precision reciprocal square root calculations.
19807
19808 @item -mrecip-precision
19809 @itemx -mno-recip-precision
19810 @opindex mrecip-precision
19811 Assume (do not assume) that the reciprocal estimate instructions
19812 provide higher-precision estimates than is mandated by the PowerPC
19813 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
19814 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
19815 The double-precision square root estimate instructions are not generated by
19816 default on low-precision machines, since they do not provide an
19817 estimate that converges after three steps.
19818
19819 @item -mveclibabi=@var{type}
19820 @opindex mveclibabi
19821 Specifies the ABI type to use for vectorizing intrinsics using an
19822 external library. The only type supported at present is @samp{mass},
19823 which specifies to use IBM's Mathematical Acceleration Subsystem
19824 (MASS) libraries for vectorizing intrinsics using external libraries.
19825 GCC currently emits calls to @code{acosd2}, @code{acosf4},
19826 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
19827 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
19828 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
19829 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
19830 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
19831 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
19832 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
19833 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
19834 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
19835 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
19836 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
19837 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
19838 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
19839 for power7. Both @option{-ftree-vectorize} and
19840 @option{-funsafe-math-optimizations} must also be enabled. The MASS
19841 libraries must be specified at link time.
19842
19843 @item -mfriz
19844 @itemx -mno-friz
19845 @opindex mfriz
19846 Generate (do not generate) the @code{friz} instruction when the
19847 @option{-funsafe-math-optimizations} option is used to optimize
19848 rounding of floating-point values to 64-bit integer and back to floating
19849 point. The @code{friz} instruction does not return the same value if
19850 the floating-point number is too large to fit in an integer.
19851
19852 @item -mpointers-to-nested-functions
19853 @itemx -mno-pointers-to-nested-functions
19854 @opindex mpointers-to-nested-functions
19855 Generate (do not generate) code to load up the static chain register
19856 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
19857 systems where a function pointer points to a 3-word descriptor giving
19858 the function address, TOC value to be loaded in register @code{r2}, and
19859 static chain value to be loaded in register @code{r11}. The
19860 @option{-mpointers-to-nested-functions} is on by default. You cannot
19861 call through pointers to nested functions or pointers
19862 to functions compiled in other languages that use the static chain if
19863 you use @option{-mno-pointers-to-nested-functions}.
19864
19865 @item -msave-toc-indirect
19866 @itemx -mno-save-toc-indirect
19867 @opindex msave-toc-indirect
19868 Generate (do not generate) code to save the TOC value in the reserved
19869 stack location in the function prologue if the function calls through
19870 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
19871 saved in the prologue, it is saved just before the call through the
19872 pointer. The @option{-mno-save-toc-indirect} option is the default.
19873
19874 @item -mcompat-align-parm
19875 @itemx -mno-compat-align-parm
19876 @opindex mcompat-align-parm
19877 Generate (do not generate) code to pass structure parameters with a
19878 maximum alignment of 64 bits, for compatibility with older versions
19879 of GCC.
19880
19881 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
19882 structure parameter on a 128-bit boundary when that structure contained
19883 a member requiring 128-bit alignment. This is corrected in more
19884 recent versions of GCC. This option may be used to generate code
19885 that is compatible with functions compiled with older versions of
19886 GCC.
19887
19888 The @option{-mno-compat-align-parm} option is the default.
19889 @end table
19890
19891 @node RX Options
19892 @subsection RX Options
19893 @cindex RX Options
19894
19895 These command-line options are defined for RX targets:
19896
19897 @table @gcctabopt
19898 @item -m64bit-doubles
19899 @itemx -m32bit-doubles
19900 @opindex m64bit-doubles
19901 @opindex m32bit-doubles
19902 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
19903 or 32 bits (@option{-m32bit-doubles}) in size. The default is
19904 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
19905 works on 32-bit values, which is why the default is
19906 @option{-m32bit-doubles}.
19907
19908 @item -fpu
19909 @itemx -nofpu
19910 @opindex fpu
19911 @opindex nofpu
19912 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
19913 floating-point hardware. The default is enabled for the RX600
19914 series and disabled for the RX200 series.
19915
19916 Floating-point instructions are only generated for 32-bit floating-point
19917 values, however, so the FPU hardware is not used for doubles if the
19918 @option{-m64bit-doubles} option is used.
19919
19920 @emph{Note} If the @option{-fpu} option is enabled then
19921 @option{-funsafe-math-optimizations} is also enabled automatically.
19922 This is because the RX FPU instructions are themselves unsafe.
19923
19924 @item -mcpu=@var{name}
19925 @opindex mcpu
19926 Selects the type of RX CPU to be targeted. Currently three types are
19927 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
19928 the specific @samp{RX610} CPU. The default is @samp{RX600}.
19929
19930 The only difference between @samp{RX600} and @samp{RX610} is that the
19931 @samp{RX610} does not support the @code{MVTIPL} instruction.
19932
19933 The @samp{RX200} series does not have a hardware floating-point unit
19934 and so @option{-nofpu} is enabled by default when this type is
19935 selected.
19936
19937 @item -mbig-endian-data
19938 @itemx -mlittle-endian-data
19939 @opindex mbig-endian-data
19940 @opindex mlittle-endian-data
19941 Store data (but not code) in the big-endian format. The default is
19942 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
19943 format.
19944
19945 @item -msmall-data-limit=@var{N}
19946 @opindex msmall-data-limit
19947 Specifies the maximum size in bytes of global and static variables
19948 which can be placed into the small data area. Using the small data
19949 area can lead to smaller and faster code, but the size of area is
19950 limited and it is up to the programmer to ensure that the area does
19951 not overflow. Also when the small data area is used one of the RX's
19952 registers (usually @code{r13}) is reserved for use pointing to this
19953 area, so it is no longer available for use by the compiler. This
19954 could result in slower and/or larger code if variables are pushed onto
19955 the stack instead of being held in this register.
19956
19957 Note, common variables (variables that have not been initialized) and
19958 constants are not placed into the small data area as they are assigned
19959 to other sections in the output executable.
19960
19961 The default value is zero, which disables this feature. Note, this
19962 feature is not enabled by default with higher optimization levels
19963 (@option{-O2} etc) because of the potentially detrimental effects of
19964 reserving a register. It is up to the programmer to experiment and
19965 discover whether this feature is of benefit to their program. See the
19966 description of the @option{-mpid} option for a description of how the
19967 actual register to hold the small data area pointer is chosen.
19968
19969 @item -msim
19970 @itemx -mno-sim
19971 @opindex msim
19972 @opindex mno-sim
19973 Use the simulator runtime. The default is to use the libgloss
19974 board-specific runtime.
19975
19976 @item -mas100-syntax
19977 @itemx -mno-as100-syntax
19978 @opindex mas100-syntax
19979 @opindex mno-as100-syntax
19980 When generating assembler output use a syntax that is compatible with
19981 Renesas's AS100 assembler. This syntax can also be handled by the GAS
19982 assembler, but it has some restrictions so it is not generated by default.
19983
19984 @item -mmax-constant-size=@var{N}
19985 @opindex mmax-constant-size
19986 Specifies the maximum size, in bytes, of a constant that can be used as
19987 an operand in a RX instruction. Although the RX instruction set does
19988 allow constants of up to 4 bytes in length to be used in instructions,
19989 a longer value equates to a longer instruction. Thus in some
19990 circumstances it can be beneficial to restrict the size of constants
19991 that are used in instructions. Constants that are too big are instead
19992 placed into a constant pool and referenced via register indirection.
19993
19994 The value @var{N} can be between 0 and 4. A value of 0 (the default)
19995 or 4 means that constants of any size are allowed.
19996
19997 @item -mrelax
19998 @opindex mrelax
19999 Enable linker relaxation. Linker relaxation is a process whereby the
20000 linker attempts to reduce the size of a program by finding shorter
20001 versions of various instructions. Disabled by default.
20002
20003 @item -mint-register=@var{N}
20004 @opindex mint-register
20005 Specify the number of registers to reserve for fast interrupt handler
20006 functions. The value @var{N} can be between 0 and 4. A value of 1
20007 means that register @code{r13} is reserved for the exclusive use
20008 of fast interrupt handlers. A value of 2 reserves @code{r13} and
20009 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
20010 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
20011 A value of 0, the default, does not reserve any registers.
20012
20013 @item -msave-acc-in-interrupts
20014 @opindex msave-acc-in-interrupts
20015 Specifies that interrupt handler functions should preserve the
20016 accumulator register. This is only necessary if normal code might use
20017 the accumulator register, for example because it performs 64-bit
20018 multiplications. The default is to ignore the accumulator as this
20019 makes the interrupt handlers faster.
20020
20021 @item -mpid
20022 @itemx -mno-pid
20023 @opindex mpid
20024 @opindex mno-pid
20025 Enables the generation of position independent data. When enabled any
20026 access to constant data is done via an offset from a base address
20027 held in a register. This allows the location of constant data to be
20028 determined at run time without requiring the executable to be
20029 relocated, which is a benefit to embedded applications with tight
20030 memory constraints. Data that can be modified is not affected by this
20031 option.
20032
20033 Note, using this feature reserves a register, usually @code{r13}, for
20034 the constant data base address. This can result in slower and/or
20035 larger code, especially in complicated functions.
20036
20037 The actual register chosen to hold the constant data base address
20038 depends upon whether the @option{-msmall-data-limit} and/or the
20039 @option{-mint-register} command-line options are enabled. Starting
20040 with register @code{r13} and proceeding downwards, registers are
20041 allocated first to satisfy the requirements of @option{-mint-register},
20042 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
20043 is possible for the small data area register to be @code{r8} if both
20044 @option{-mint-register=4} and @option{-mpid} are specified on the
20045 command line.
20046
20047 By default this feature is not enabled. The default can be restored
20048 via the @option{-mno-pid} command-line option.
20049
20050 @item -mno-warn-multiple-fast-interrupts
20051 @itemx -mwarn-multiple-fast-interrupts
20052 @opindex mno-warn-multiple-fast-interrupts
20053 @opindex mwarn-multiple-fast-interrupts
20054 Prevents GCC from issuing a warning message if it finds more than one
20055 fast interrupt handler when it is compiling a file. The default is to
20056 issue a warning for each extra fast interrupt handler found, as the RX
20057 only supports one such interrupt.
20058
20059 @end table
20060
20061 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
20062 has special significance to the RX port when used with the
20063 @code{interrupt} function attribute. This attribute indicates a
20064 function intended to process fast interrupts. GCC ensures
20065 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
20066 and/or @code{r13} and only provided that the normal use of the
20067 corresponding registers have been restricted via the
20068 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
20069 options.
20070
20071 @node S/390 and zSeries Options
20072 @subsection S/390 and zSeries Options
20073 @cindex S/390 and zSeries Options
20074
20075 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
20076
20077 @table @gcctabopt
20078 @item -mhard-float
20079 @itemx -msoft-float
20080 @opindex mhard-float
20081 @opindex msoft-float
20082 Use (do not use) the hardware floating-point instructions and registers
20083 for floating-point operations. When @option{-msoft-float} is specified,
20084 functions in @file{libgcc.a} are used to perform floating-point
20085 operations. When @option{-mhard-float} is specified, the compiler
20086 generates IEEE floating-point instructions. This is the default.
20087
20088 @item -mhard-dfp
20089 @itemx -mno-hard-dfp
20090 @opindex mhard-dfp
20091 @opindex mno-hard-dfp
20092 Use (do not use) the hardware decimal-floating-point instructions for
20093 decimal-floating-point operations. When @option{-mno-hard-dfp} is
20094 specified, functions in @file{libgcc.a} are used to perform
20095 decimal-floating-point operations. When @option{-mhard-dfp} is
20096 specified, the compiler generates decimal-floating-point hardware
20097 instructions. This is the default for @option{-march=z9-ec} or higher.
20098
20099 @item -mlong-double-64
20100 @itemx -mlong-double-128
20101 @opindex mlong-double-64
20102 @opindex mlong-double-128
20103 These switches control the size of @code{long double} type. A size
20104 of 64 bits makes the @code{long double} type equivalent to the @code{double}
20105 type. This is the default.
20106
20107 @item -mbackchain
20108 @itemx -mno-backchain
20109 @opindex mbackchain
20110 @opindex mno-backchain
20111 Store (do not store) the address of the caller's frame as backchain pointer
20112 into the callee's stack frame.
20113 A backchain may be needed to allow debugging using tools that do not understand
20114 DWARF 2 call frame information.
20115 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
20116 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
20117 the backchain is placed into the topmost word of the 96/160 byte register
20118 save area.
20119
20120 In general, code compiled with @option{-mbackchain} is call-compatible with
20121 code compiled with @option{-mmo-backchain}; however, use of the backchain
20122 for debugging purposes usually requires that the whole binary is built with
20123 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
20124 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
20125 to build a linux kernel use @option{-msoft-float}.
20126
20127 The default is to not maintain the backchain.
20128
20129 @item -mpacked-stack
20130 @itemx -mno-packed-stack
20131 @opindex mpacked-stack
20132 @opindex mno-packed-stack
20133 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
20134 specified, the compiler uses the all fields of the 96/160 byte register save
20135 area only for their default purpose; unused fields still take up stack space.
20136 When @option{-mpacked-stack} is specified, register save slots are densely
20137 packed at the top of the register save area; unused space is reused for other
20138 purposes, allowing for more efficient use of the available stack space.
20139 However, when @option{-mbackchain} is also in effect, the topmost word of
20140 the save area is always used to store the backchain, and the return address
20141 register is always saved two words below the backchain.
20142
20143 As long as the stack frame backchain is not used, code generated with
20144 @option{-mpacked-stack} is call-compatible with code generated with
20145 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
20146 S/390 or zSeries generated code that uses the stack frame backchain at run
20147 time, not just for debugging purposes. Such code is not call-compatible
20148 with code compiled with @option{-mpacked-stack}. Also, note that the
20149 combination of @option{-mbackchain},
20150 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
20151 to build a linux kernel use @option{-msoft-float}.
20152
20153 The default is to not use the packed stack layout.
20154
20155 @item -msmall-exec
20156 @itemx -mno-small-exec
20157 @opindex msmall-exec
20158 @opindex mno-small-exec
20159 Generate (or do not generate) code using the @code{bras} instruction
20160 to do subroutine calls.
20161 This only works reliably if the total executable size does not
20162 exceed 64k. The default is to use the @code{basr} instruction instead,
20163 which does not have this limitation.
20164
20165 @item -m64
20166 @itemx -m31
20167 @opindex m64
20168 @opindex m31
20169 When @option{-m31} is specified, generate code compliant to the
20170 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
20171 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
20172 particular to generate 64-bit instructions. For the @samp{s390}
20173 targets, the default is @option{-m31}, while the @samp{s390x}
20174 targets default to @option{-m64}.
20175
20176 @item -mzarch
20177 @itemx -mesa
20178 @opindex mzarch
20179 @opindex mesa
20180 When @option{-mzarch} is specified, generate code using the
20181 instructions available on z/Architecture.
20182 When @option{-mesa} is specified, generate code using the
20183 instructions available on ESA/390. Note that @option{-mesa} is
20184 not possible with @option{-m64}.
20185 When generating code compliant to the GNU/Linux for S/390 ABI,
20186 the default is @option{-mesa}. When generating code compliant
20187 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
20188
20189 @item -mmvcle
20190 @itemx -mno-mvcle
20191 @opindex mmvcle
20192 @opindex mno-mvcle
20193 Generate (or do not generate) code using the @code{mvcle} instruction
20194 to perform block moves. When @option{-mno-mvcle} is specified,
20195 use a @code{mvc} loop instead. This is the default unless optimizing for
20196 size.
20197
20198 @item -mdebug
20199 @itemx -mno-debug
20200 @opindex mdebug
20201 @opindex mno-debug
20202 Print (or do not print) additional debug information when compiling.
20203 The default is to not print debug information.
20204
20205 @item -march=@var{cpu-type}
20206 @opindex march
20207 Generate code that runs on @var{cpu-type}, which is the name of a system
20208 representing a certain processor type. Possible values for
20209 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
20210 @samp{z9-109}, @samp{z9-ec}, @samp{z10}, @samp{z196}, and @samp{zEC12}.
20211 When generating code using the instructions available on z/Architecture,
20212 the default is @option{-march=z900}. Otherwise, the default is
20213 @option{-march=g5}.
20214
20215 @item -mtune=@var{cpu-type}
20216 @opindex mtune
20217 Tune to @var{cpu-type} everything applicable about the generated code,
20218 except for the ABI and the set of available instructions.
20219 The list of @var{cpu-type} values is the same as for @option{-march}.
20220 The default is the value used for @option{-march}.
20221
20222 @item -mtpf-trace
20223 @itemx -mno-tpf-trace
20224 @opindex mtpf-trace
20225 @opindex mno-tpf-trace
20226 Generate code that adds (does not add) in TPF OS specific branches to trace
20227 routines in the operating system. This option is off by default, even
20228 when compiling for the TPF OS@.
20229
20230 @item -mfused-madd
20231 @itemx -mno-fused-madd
20232 @opindex mfused-madd
20233 @opindex mno-fused-madd
20234 Generate code that uses (does not use) the floating-point multiply and
20235 accumulate instructions. These instructions are generated by default if
20236 hardware floating point is used.
20237
20238 @item -mwarn-framesize=@var{framesize}
20239 @opindex mwarn-framesize
20240 Emit a warning if the current function exceeds the given frame size. Because
20241 this is a compile-time check it doesn't need to be a real problem when the program
20242 runs. It is intended to identify functions that most probably cause
20243 a stack overflow. It is useful to be used in an environment with limited stack
20244 size e.g.@: the linux kernel.
20245
20246 @item -mwarn-dynamicstack
20247 @opindex mwarn-dynamicstack
20248 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
20249 arrays. This is generally a bad idea with a limited stack size.
20250
20251 @item -mstack-guard=@var{stack-guard}
20252 @itemx -mstack-size=@var{stack-size}
20253 @opindex mstack-guard
20254 @opindex mstack-size
20255 If these options are provided the S/390 back end emits additional instructions in
20256 the function prologue that trigger a trap if the stack size is @var{stack-guard}
20257 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
20258 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
20259 the frame size of the compiled function is chosen.
20260 These options are intended to be used to help debugging stack overflow problems.
20261 The additionally emitted code causes only little overhead and hence can also be
20262 used in production-like systems without greater performance degradation. The given
20263 values have to be exact powers of 2 and @var{stack-size} has to be greater than
20264 @var{stack-guard} without exceeding 64k.
20265 In order to be efficient the extra code makes the assumption that the stack starts
20266 at an address aligned to the value given by @var{stack-size}.
20267 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
20268
20269 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
20270 @opindex mhotpatch
20271 If the hotpatch option is enabled, a ``hot-patching'' function
20272 prologue is generated for all functions in the compilation unit.
20273 The funtion label is prepended with the given number of two-byte
20274 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
20275 the label, 2 * @var{post-halfwords} bytes are appended, using the
20276 largest NOP like instructions the architecture allows (maximum
20277 1000000).
20278
20279 If both arguments are zero, hotpatching is disabled.
20280
20281 This option can be overridden for individual functions with the
20282 @code{hotpatch} attribute.
20283 @end table
20284
20285 @node Score Options
20286 @subsection Score Options
20287 @cindex Score Options
20288
20289 These options are defined for Score implementations:
20290
20291 @table @gcctabopt
20292 @item -meb
20293 @opindex meb
20294 Compile code for big-endian mode. This is the default.
20295
20296 @item -mel
20297 @opindex mel
20298 Compile code for little-endian mode.
20299
20300 @item -mnhwloop
20301 @opindex mnhwloop
20302 Disable generation of @code{bcnz} instructions.
20303
20304 @item -muls
20305 @opindex muls
20306 Enable generation of unaligned load and store instructions.
20307
20308 @item -mmac
20309 @opindex mmac
20310 Enable the use of multiply-accumulate instructions. Disabled by default.
20311
20312 @item -mscore5
20313 @opindex mscore5
20314 Specify the SCORE5 as the target architecture.
20315
20316 @item -mscore5u
20317 @opindex mscore5u
20318 Specify the SCORE5U of the target architecture.
20319
20320 @item -mscore7
20321 @opindex mscore7
20322 Specify the SCORE7 as the target architecture. This is the default.
20323
20324 @item -mscore7d
20325 @opindex mscore7d
20326 Specify the SCORE7D as the target architecture.
20327 @end table
20328
20329 @node SH Options
20330 @subsection SH Options
20331
20332 These @samp{-m} options are defined for the SH implementations:
20333
20334 @table @gcctabopt
20335 @item -m1
20336 @opindex m1
20337 Generate code for the SH1.
20338
20339 @item -m2
20340 @opindex m2
20341 Generate code for the SH2.
20342
20343 @item -m2e
20344 Generate code for the SH2e.
20345
20346 @item -m2a-nofpu
20347 @opindex m2a-nofpu
20348 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
20349 that the floating-point unit is not used.
20350
20351 @item -m2a-single-only
20352 @opindex m2a-single-only
20353 Generate code for the SH2a-FPU, in such a way that no double-precision
20354 floating-point operations are used.
20355
20356 @item -m2a-single
20357 @opindex m2a-single
20358 Generate code for the SH2a-FPU assuming the floating-point unit is in
20359 single-precision mode by default.
20360
20361 @item -m2a
20362 @opindex m2a
20363 Generate code for the SH2a-FPU assuming the floating-point unit is in
20364 double-precision mode by default.
20365
20366 @item -m3
20367 @opindex m3
20368 Generate code for the SH3.
20369
20370 @item -m3e
20371 @opindex m3e
20372 Generate code for the SH3e.
20373
20374 @item -m4-nofpu
20375 @opindex m4-nofpu
20376 Generate code for the SH4 without a floating-point unit.
20377
20378 @item -m4-single-only
20379 @opindex m4-single-only
20380 Generate code for the SH4 with a floating-point unit that only
20381 supports single-precision arithmetic.
20382
20383 @item -m4-single
20384 @opindex m4-single
20385 Generate code for the SH4 assuming the floating-point unit is in
20386 single-precision mode by default.
20387
20388 @item -m4
20389 @opindex m4
20390 Generate code for the SH4.
20391
20392 @item -m4-100
20393 @opindex m4-100
20394 Generate code for SH4-100.
20395
20396 @item -m4-100-nofpu
20397 @opindex m4-100-nofpu
20398 Generate code for SH4-100 in such a way that the
20399 floating-point unit is not used.
20400
20401 @item -m4-100-single
20402 @opindex m4-100-single
20403 Generate code for SH4-100 assuming the floating-point unit is in
20404 single-precision mode by default.
20405
20406 @item -m4-100-single-only
20407 @opindex m4-100-single-only
20408 Generate code for SH4-100 in such a way that no double-precision
20409 floating-point operations are used.
20410
20411 @item -m4-200
20412 @opindex m4-200
20413 Generate code for SH4-200.
20414
20415 @item -m4-200-nofpu
20416 @opindex m4-200-nofpu
20417 Generate code for SH4-200 without in such a way that the
20418 floating-point unit is not used.
20419
20420 @item -m4-200-single
20421 @opindex m4-200-single
20422 Generate code for SH4-200 assuming the floating-point unit is in
20423 single-precision mode by default.
20424
20425 @item -m4-200-single-only
20426 @opindex m4-200-single-only
20427 Generate code for SH4-200 in such a way that no double-precision
20428 floating-point operations are used.
20429
20430 @item -m4-300
20431 @opindex m4-300
20432 Generate code for SH4-300.
20433
20434 @item -m4-300-nofpu
20435 @opindex m4-300-nofpu
20436 Generate code for SH4-300 without in such a way that the
20437 floating-point unit is not used.
20438
20439 @item -m4-300-single
20440 @opindex m4-300-single
20441 Generate code for SH4-300 in such a way that no double-precision
20442 floating-point operations are used.
20443
20444 @item -m4-300-single-only
20445 @opindex m4-300-single-only
20446 Generate code for SH4-300 in such a way that no double-precision
20447 floating-point operations are used.
20448
20449 @item -m4-340
20450 @opindex m4-340
20451 Generate code for SH4-340 (no MMU, no FPU).
20452
20453 @item -m4-500
20454 @opindex m4-500
20455 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
20456 assembler.
20457
20458 @item -m4a-nofpu
20459 @opindex m4a-nofpu
20460 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
20461 floating-point unit is not used.
20462
20463 @item -m4a-single-only
20464 @opindex m4a-single-only
20465 Generate code for the SH4a, in such a way that no double-precision
20466 floating-point operations are used.
20467
20468 @item -m4a-single
20469 @opindex m4a-single
20470 Generate code for the SH4a assuming the floating-point unit is in
20471 single-precision mode by default.
20472
20473 @item -m4a
20474 @opindex m4a
20475 Generate code for the SH4a.
20476
20477 @item -m4al
20478 @opindex m4al
20479 Same as @option{-m4a-nofpu}, except that it implicitly passes
20480 @option{-dsp} to the assembler. GCC doesn't generate any DSP
20481 instructions at the moment.
20482
20483 @item -m5-32media
20484 @opindex m5-32media
20485 Generate 32-bit code for SHmedia.
20486
20487 @item -m5-32media-nofpu
20488 @opindex m5-32media-nofpu
20489 Generate 32-bit code for SHmedia in such a way that the
20490 floating-point unit is not used.
20491
20492 @item -m5-64media
20493 @opindex m5-64media
20494 Generate 64-bit code for SHmedia.
20495
20496 @item -m5-64media-nofpu
20497 @opindex m5-64media-nofpu
20498 Generate 64-bit code for SHmedia in such a way that the
20499 floating-point unit is not used.
20500
20501 @item -m5-compact
20502 @opindex m5-compact
20503 Generate code for SHcompact.
20504
20505 @item -m5-compact-nofpu
20506 @opindex m5-compact-nofpu
20507 Generate code for SHcompact in such a way that the
20508 floating-point unit is not used.
20509
20510 @item -mb
20511 @opindex mb
20512 Compile code for the processor in big-endian mode.
20513
20514 @item -ml
20515 @opindex ml
20516 Compile code for the processor in little-endian mode.
20517
20518 @item -mdalign
20519 @opindex mdalign
20520 Align doubles at 64-bit boundaries. Note that this changes the calling
20521 conventions, and thus some functions from the standard C library do
20522 not work unless you recompile it first with @option{-mdalign}.
20523
20524 @item -mrelax
20525 @opindex mrelax
20526 Shorten some address references at link time, when possible; uses the
20527 linker option @option{-relax}.
20528
20529 @item -mbigtable
20530 @opindex mbigtable
20531 Use 32-bit offsets in @code{switch} tables. The default is to use
20532 16-bit offsets.
20533
20534 @item -mbitops
20535 @opindex mbitops
20536 Enable the use of bit manipulation instructions on SH2A.
20537
20538 @item -mfmovd
20539 @opindex mfmovd
20540 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
20541 alignment constraints.
20542
20543 @item -mrenesas
20544 @opindex mrenesas
20545 Comply with the calling conventions defined by Renesas.
20546
20547 @item -mno-renesas
20548 @opindex mno-renesas
20549 Comply with the calling conventions defined for GCC before the Renesas
20550 conventions were available. This option is the default for all
20551 targets of the SH toolchain.
20552
20553 @item -mnomacsave
20554 @opindex mnomacsave
20555 Mark the @code{MAC} register as call-clobbered, even if
20556 @option{-mrenesas} is given.
20557
20558 @item -mieee
20559 @itemx -mno-ieee
20560 @opindex mieee
20561 @opindex mno-ieee
20562 Control the IEEE compliance of floating-point comparisons, which affects the
20563 handling of cases where the result of a comparison is unordered. By default
20564 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
20565 enabled @option{-mno-ieee} is implicitly set, which results in faster
20566 floating-point greater-equal and less-equal comparisons. The implcit settings
20567 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
20568
20569 @item -minline-ic_invalidate
20570 @opindex minline-ic_invalidate
20571 Inline code to invalidate instruction cache entries after setting up
20572 nested function trampolines.
20573 This option has no effect if @option{-musermode} is in effect and the selected
20574 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
20575 instruction.
20576 If the selected code generation option does not allow the use of the @code{icbi}
20577 instruction, and @option{-musermode} is not in effect, the inlined code
20578 manipulates the instruction cache address array directly with an associative
20579 write. This not only requires privileged mode at run time, but it also
20580 fails if the cache line had been mapped via the TLB and has become unmapped.
20581
20582 @item -misize
20583 @opindex misize
20584 Dump instruction size and location in the assembly code.
20585
20586 @item -mpadstruct
20587 @opindex mpadstruct
20588 This option is deprecated. It pads structures to multiple of 4 bytes,
20589 which is incompatible with the SH ABI@.
20590
20591 @item -matomic-model=@var{model}
20592 @opindex matomic-model=@var{model}
20593 Sets the model of atomic operations and additional parameters as a comma
20594 separated list. For details on the atomic built-in functions see
20595 @ref{__atomic Builtins}. The following models and parameters are supported:
20596
20597 @table @samp
20598
20599 @item none
20600 Disable compiler generated atomic sequences and emit library calls for atomic
20601 operations. This is the default if the target is not @code{sh*-*-linux*}.
20602
20603 @item soft-gusa
20604 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
20605 built-in functions. The generated atomic sequences require additional support
20606 from the interrupt/exception handling code of the system and are only suitable
20607 for SH3* and SH4* single-core systems. This option is enabled by default when
20608 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
20609 this option also partially utilizes the hardware atomic instructions
20610 @code{movli.l} and @code{movco.l} to create more efficient code, unless
20611 @samp{strict} is specified.
20612
20613 @item soft-tcb
20614 Generate software atomic sequences that use a variable in the thread control
20615 block. This is a variation of the gUSA sequences which can also be used on
20616 SH1* and SH2* targets. The generated atomic sequences require additional
20617 support from the interrupt/exception handling code of the system and are only
20618 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
20619 parameter has to be specified as well.
20620
20621 @item soft-imask
20622 Generate software atomic sequences that temporarily disable interrupts by
20623 setting @code{SR.IMASK = 1111}. This model works only when the program runs
20624 in privileged mode and is only suitable for single-core systems. Additional
20625 support from the interrupt/exception handling code of the system is not
20626 required. This model is enabled by default when the target is
20627 @code{sh*-*-linux*} and SH1* or SH2*.
20628
20629 @item hard-llcs
20630 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
20631 instructions only. This is only available on SH4A and is suitable for
20632 multi-core systems. Since the hardware instructions support only 32 bit atomic
20633 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
20634 Code compiled with this option is also compatible with other software
20635 atomic model interrupt/exception handling systems if executed on an SH4A
20636 system. Additional support from the interrupt/exception handling code of the
20637 system is not required for this model.
20638
20639 @item gbr-offset=
20640 This parameter specifies the offset in bytes of the variable in the thread
20641 control block structure that should be used by the generated atomic sequences
20642 when the @samp{soft-tcb} model has been selected. For other models this
20643 parameter is ignored. The specified value must be an integer multiple of four
20644 and in the range 0-1020.
20645
20646 @item strict
20647 This parameter prevents mixed usage of multiple atomic models, even if they
20648 are compatible, and makes the compiler generate atomic sequences of the
20649 specified model only.
20650
20651 @end table
20652
20653 @item -mtas
20654 @opindex mtas
20655 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
20656 Notice that depending on the particular hardware and software configuration
20657 this can degrade overall performance due to the operand cache line flushes
20658 that are implied by the @code{tas.b} instruction. On multi-core SH4A
20659 processors the @code{tas.b} instruction must be used with caution since it
20660 can result in data corruption for certain cache configurations.
20661
20662 @item -mprefergot
20663 @opindex mprefergot
20664 When generating position-independent code, emit function calls using
20665 the Global Offset Table instead of the Procedure Linkage Table.
20666
20667 @item -musermode
20668 @itemx -mno-usermode
20669 @opindex musermode
20670 @opindex mno-usermode
20671 Don't allow (allow) the compiler generating privileged mode code. Specifying
20672 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
20673 inlined code would not work in user mode. @option{-musermode} is the default
20674 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
20675 @option{-musermode} has no effect, since there is no user mode.
20676
20677 @item -multcost=@var{number}
20678 @opindex multcost=@var{number}
20679 Set the cost to assume for a multiply insn.
20680
20681 @item -mdiv=@var{strategy}
20682 @opindex mdiv=@var{strategy}
20683 Set the division strategy to be used for integer division operations.
20684 For SHmedia @var{strategy} can be one of:
20685
20686 @table @samp
20687
20688 @item fp
20689 Performs the operation in floating point. This has a very high latency,
20690 but needs only a few instructions, so it might be a good choice if
20691 your code has enough easily-exploitable ILP to allow the compiler to
20692 schedule the floating-point instructions together with other instructions.
20693 Division by zero causes a floating-point exception.
20694
20695 @item inv
20696 Uses integer operations to calculate the inverse of the divisor,
20697 and then multiplies the dividend with the inverse. This strategy allows
20698 CSE and hoisting of the inverse calculation. Division by zero calculates
20699 an unspecified result, but does not trap.
20700
20701 @item inv:minlat
20702 A variant of @samp{inv} where, if no CSE or hoisting opportunities
20703 have been found, or if the entire operation has been hoisted to the same
20704 place, the last stages of the inverse calculation are intertwined with the
20705 final multiply to reduce the overall latency, at the expense of using a few
20706 more instructions, and thus offering fewer scheduling opportunities with
20707 other code.
20708
20709 @item call
20710 Calls a library function that usually implements the @samp{inv:minlat}
20711 strategy.
20712 This gives high code density for @code{m5-*media-nofpu} compilations.
20713
20714 @item call2
20715 Uses a different entry point of the same library function, where it
20716 assumes that a pointer to a lookup table has already been set up, which
20717 exposes the pointer load to CSE and code hoisting optimizations.
20718
20719 @item inv:call
20720 @itemx inv:call2
20721 @itemx inv:fp
20722 Use the @samp{inv} algorithm for initial
20723 code generation, but if the code stays unoptimized, revert to the @samp{call},
20724 @samp{call2}, or @samp{fp} strategies, respectively. Note that the
20725 potentially-trapping side effect of division by zero is carried by a
20726 separate instruction, so it is possible that all the integer instructions
20727 are hoisted out, but the marker for the side effect stays where it is.
20728 A recombination to floating-point operations or a call is not possible
20729 in that case.
20730
20731 @item inv20u
20732 @itemx inv20l
20733 Variants of the @samp{inv:minlat} strategy. In the case
20734 that the inverse calculation is not separated from the multiply, they speed
20735 up division where the dividend fits into 20 bits (plus sign where applicable)
20736 by inserting a test to skip a number of operations in this case; this test
20737 slows down the case of larger dividends. @samp{inv20u} assumes the case of a such
20738 a small dividend to be unlikely, and @samp{inv20l} assumes it to be likely.
20739
20740 @end table
20741
20742 For targets other than SHmedia @var{strategy} can be one of:
20743
20744 @table @samp
20745
20746 @item call-div1
20747 Calls a library function that uses the single-step division instruction
20748 @code{div1} to perform the operation. Division by zero calculates an
20749 unspecified result and does not trap. This is the default except for SH4,
20750 SH2A and SHcompact.
20751
20752 @item call-fp
20753 Calls a library function that performs the operation in double precision
20754 floating point. Division by zero causes a floating-point exception. This is
20755 the default for SHcompact with FPU. Specifying this for targets that do not
20756 have a double precision FPU defaults to @code{call-div1}.
20757
20758 @item call-table
20759 Calls a library function that uses a lookup table for small divisors and
20760 the @code{div1} instruction with case distinction for larger divisors. Division
20761 by zero calculates an unspecified result and does not trap. This is the default
20762 for SH4. Specifying this for targets that do not have dynamic shift
20763 instructions defaults to @code{call-div1}.
20764
20765 @end table
20766
20767 When a division strategy has not been specified the default strategy is
20768 selected based on the current target. For SH2A the default strategy is to
20769 use the @code{divs} and @code{divu} instructions instead of library function
20770 calls.
20771
20772 @item -maccumulate-outgoing-args
20773 @opindex maccumulate-outgoing-args
20774 Reserve space once for outgoing arguments in the function prologue rather
20775 than around each call. Generally beneficial for performance and size. Also
20776 needed for unwinding to avoid changing the stack frame around conditional code.
20777
20778 @item -mdivsi3_libfunc=@var{name}
20779 @opindex mdivsi3_libfunc=@var{name}
20780 Set the name of the library function used for 32-bit signed division to
20781 @var{name}.
20782 This only affects the name used in the @samp{call} and @samp{inv:call}
20783 division strategies, and the compiler still expects the same
20784 sets of input/output/clobbered registers as if this option were not present.
20785
20786 @item -mfixed-range=@var{register-range}
20787 @opindex mfixed-range
20788 Generate code treating the given register range as fixed registers.
20789 A fixed register is one that the register allocator can not use. This is
20790 useful when compiling kernel code. A register range is specified as
20791 two registers separated by a dash. Multiple register ranges can be
20792 specified separated by a comma.
20793
20794 @item -mindexed-addressing
20795 @opindex mindexed-addressing
20796 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
20797 This is only safe if the hardware and/or OS implement 32-bit wrap-around
20798 semantics for the indexed addressing mode. The architecture allows the
20799 implementation of processors with 64-bit MMU, which the OS could use to
20800 get 32-bit addressing, but since no current hardware implementation supports
20801 this or any other way to make the indexed addressing mode safe to use in
20802 the 32-bit ABI, the default is @option{-mno-indexed-addressing}.
20803
20804 @item -mgettrcost=@var{number}
20805 @opindex mgettrcost=@var{number}
20806 Set the cost assumed for the @code{gettr} instruction to @var{number}.
20807 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
20808
20809 @item -mpt-fixed
20810 @opindex mpt-fixed
20811 Assume @code{pt*} instructions won't trap. This generally generates
20812 better-scheduled code, but is unsafe on current hardware.
20813 The current architecture
20814 definition says that @code{ptabs} and @code{ptrel} trap when the target
20815 anded with 3 is 3.
20816 This has the unintentional effect of making it unsafe to schedule these
20817 instructions before a branch, or hoist them out of a loop. For example,
20818 @code{__do_global_ctors}, a part of @file{libgcc}
20819 that runs constructors at program
20820 startup, calls functions in a list which is delimited by @minus{}1. With the
20821 @option{-mpt-fixed} option, the @code{ptabs} is done before testing against @minus{}1.
20822 That means that all the constructors run a bit more quickly, but when
20823 the loop comes to the end of the list, the program crashes because @code{ptabs}
20824 loads @minus{}1 into a target register.
20825
20826 Since this option is unsafe for any
20827 hardware implementing the current architecture specification, the default
20828 is @option{-mno-pt-fixed}. Unless specified explicitly with
20829 @option{-mgettrcost}, @option{-mno-pt-fixed} also implies @option{-mgettrcost=100};
20830 this deters register allocation from using target registers for storing
20831 ordinary integers.
20832
20833 @item -minvalid-symbols
20834 @opindex minvalid-symbols
20835 Assume symbols might be invalid. Ordinary function symbols generated by
20836 the compiler are always valid to load with
20837 @code{movi}/@code{shori}/@code{ptabs} or
20838 @code{movi}/@code{shori}/@code{ptrel},
20839 but with assembler and/or linker tricks it is possible
20840 to generate symbols that cause @code{ptabs} or @code{ptrel} to trap.
20841 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
20842 It prevents cross-basic-block CSE, hoisting and most scheduling
20843 of symbol loads. The default is @option{-mno-invalid-symbols}.
20844
20845 @item -mbranch-cost=@var{num}
20846 @opindex mbranch-cost=@var{num}
20847 Assume @var{num} to be the cost for a branch instruction. Higher numbers
20848 make the compiler try to generate more branch-free code if possible.
20849 If not specified the value is selected depending on the processor type that
20850 is being compiled for.
20851
20852 @item -mzdcbranch
20853 @itemx -mno-zdcbranch
20854 @opindex mzdcbranch
20855 @opindex mno-zdcbranch
20856 Assume (do not assume) that zero displacement conditional branch instructions
20857 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
20858 compiler prefers zero displacement branch code sequences. This is
20859 enabled by default when generating code for SH4 and SH4A. It can be explicitly
20860 disabled by specifying @option{-mno-zdcbranch}.
20861
20862 @item -mcbranch-force-delay-slot
20863 @opindex mcbranch-force-delay-slot
20864 Force the usage of delay slots for conditional branches, which stuffs the delay
20865 slot with a @code{nop} if a suitable instruction can't be found. By default
20866 this option is disabled. It can be enabled to work around hardware bugs as
20867 found in the original SH7055.
20868
20869 @item -mfused-madd
20870 @itemx -mno-fused-madd
20871 @opindex mfused-madd
20872 @opindex mno-fused-madd
20873 Generate code that uses (does not use) the floating-point multiply and
20874 accumulate instructions. These instructions are generated by default
20875 if hardware floating point is used. The machine-dependent
20876 @option{-mfused-madd} option is now mapped to the machine-independent
20877 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
20878 mapped to @option{-ffp-contract=off}.
20879
20880 @item -mfsca
20881 @itemx -mno-fsca
20882 @opindex mfsca
20883 @opindex mno-fsca
20884 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
20885 and cosine approximations. The option @option{-mfsca} must be used in
20886 combination with @option{-funsafe-math-optimizations}. It is enabled by default
20887 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
20888 approximations even if @option{-funsafe-math-optimizations} is in effect.
20889
20890 @item -mfsrra
20891 @itemx -mno-fsrra
20892 @opindex mfsrra
20893 @opindex mno-fsrra
20894 Allow or disallow the compiler to emit the @code{fsrra} instruction for
20895 reciprocal square root approximations. The option @option{-mfsrra} must be used
20896 in combination with @option{-funsafe-math-optimizations} and
20897 @option{-ffinite-math-only}. It is enabled by default when generating code for
20898 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
20899 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
20900 in effect.
20901
20902 @item -mpretend-cmove
20903 @opindex mpretend-cmove
20904 Prefer zero-displacement conditional branches for conditional move instruction
20905 patterns. This can result in faster code on the SH4 processor.
20906
20907 @end table
20908
20909 @node Solaris 2 Options
20910 @subsection Solaris 2 Options
20911 @cindex Solaris 2 options
20912
20913 These @samp{-m} options are supported on Solaris 2:
20914
20915 @table @gcctabopt
20916 @item -mclear-hwcap
20917 @opindex mclear-hwcap
20918 @option{-mclear-hwcap} tells the compiler to remove the hardware
20919 capabilities generated by the Solaris assembler. This is only necessary
20920 when object files use ISA extensions not supported by the current
20921 machine, but check at runtime whether or not to use them.
20922
20923 @item -mimpure-text
20924 @opindex mimpure-text
20925 @option{-mimpure-text}, used in addition to @option{-shared}, tells
20926 the compiler to not pass @option{-z text} to the linker when linking a
20927 shared object. Using this option, you can link position-dependent
20928 code into a shared object.
20929
20930 @option{-mimpure-text} suppresses the ``relocations remain against
20931 allocatable but non-writable sections'' linker error message.
20932 However, the necessary relocations trigger copy-on-write, and the
20933 shared object is not actually shared across processes. Instead of
20934 using @option{-mimpure-text}, you should compile all source code with
20935 @option{-fpic} or @option{-fPIC}.
20936
20937 @end table
20938
20939 These switches are supported in addition to the above on Solaris 2:
20940
20941 @table @gcctabopt
20942 @item -pthreads
20943 @opindex pthreads
20944 Add support for multithreading using the POSIX threads library. This
20945 option sets flags for both the preprocessor and linker. This option does
20946 not affect the thread safety of object code produced by the compiler or
20947 that of libraries supplied with it.
20948
20949 @item -pthread
20950 @opindex pthread
20951 This is a synonym for @option{-pthreads}.
20952 @end table
20953
20954 @node SPARC Options
20955 @subsection SPARC Options
20956 @cindex SPARC options
20957
20958 These @samp{-m} options are supported on the SPARC:
20959
20960 @table @gcctabopt
20961 @item -mno-app-regs
20962 @itemx -mapp-regs
20963 @opindex mno-app-regs
20964 @opindex mapp-regs
20965 Specify @option{-mapp-regs} to generate output using the global registers
20966 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
20967 global register 1, each global register 2 through 4 is then treated as an
20968 allocable register that is clobbered by function calls. This is the default.
20969
20970 To be fully SVR4 ABI-compliant at the cost of some performance loss,
20971 specify @option{-mno-app-regs}. You should compile libraries and system
20972 software with this option.
20973
20974 @item -mflat
20975 @itemx -mno-flat
20976 @opindex mflat
20977 @opindex mno-flat
20978 With @option{-mflat}, the compiler does not generate save/restore instructions
20979 and uses a ``flat'' or single register window model. This model is compatible
20980 with the regular register window model. The local registers and the input
20981 registers (0--5) are still treated as ``call-saved'' registers and are
20982 saved on the stack as needed.
20983
20984 With @option{-mno-flat} (the default), the compiler generates save/restore
20985 instructions (except for leaf functions). This is the normal operating mode.
20986
20987 @item -mfpu
20988 @itemx -mhard-float
20989 @opindex mfpu
20990 @opindex mhard-float
20991 Generate output containing floating-point instructions. This is the
20992 default.
20993
20994 @item -mno-fpu
20995 @itemx -msoft-float
20996 @opindex mno-fpu
20997 @opindex msoft-float
20998 Generate output containing library calls for floating point.
20999 @strong{Warning:} the requisite libraries are not available for all SPARC
21000 targets. Normally the facilities of the machine's usual C compiler are
21001 used, but this cannot be done directly in cross-compilation. You must make
21002 your own arrangements to provide suitable library functions for
21003 cross-compilation. The embedded targets @samp{sparc-*-aout} and
21004 @samp{sparclite-*-*} do provide software floating-point support.
21005
21006 @option{-msoft-float} changes the calling convention in the output file;
21007 therefore, it is only useful if you compile @emph{all} of a program with
21008 this option. In particular, you need to compile @file{libgcc.a}, the
21009 library that comes with GCC, with @option{-msoft-float} in order for
21010 this to work.
21011
21012 @item -mhard-quad-float
21013 @opindex mhard-quad-float
21014 Generate output containing quad-word (long double) floating-point
21015 instructions.
21016
21017 @item -msoft-quad-float
21018 @opindex msoft-quad-float
21019 Generate output containing library calls for quad-word (long double)
21020 floating-point instructions. The functions called are those specified
21021 in the SPARC ABI@. This is the default.
21022
21023 As of this writing, there are no SPARC implementations that have hardware
21024 support for the quad-word floating-point instructions. They all invoke
21025 a trap handler for one of these instructions, and then the trap handler
21026 emulates the effect of the instruction. Because of the trap handler overhead,
21027 this is much slower than calling the ABI library routines. Thus the
21028 @option{-msoft-quad-float} option is the default.
21029
21030 @item -mno-unaligned-doubles
21031 @itemx -munaligned-doubles
21032 @opindex mno-unaligned-doubles
21033 @opindex munaligned-doubles
21034 Assume that doubles have 8-byte alignment. This is the default.
21035
21036 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
21037 alignment only if they are contained in another type, or if they have an
21038 absolute address. Otherwise, it assumes they have 4-byte alignment.
21039 Specifying this option avoids some rare compatibility problems with code
21040 generated by other compilers. It is not the default because it results
21041 in a performance loss, especially for floating-point code.
21042
21043 @item -muser-mode
21044 @itemx -mno-user-mode
21045 @opindex muser-mode
21046 @opindex mno-user-mode
21047 Do not generate code that can only run in supervisor mode. This is relevant
21048 only for the @code{casa} instruction emitted for the LEON3 processor. The
21049 default is @option{-mno-user-mode}.
21050
21051 @item -mno-faster-structs
21052 @itemx -mfaster-structs
21053 @opindex mno-faster-structs
21054 @opindex mfaster-structs
21055 With @option{-mfaster-structs}, the compiler assumes that structures
21056 should have 8-byte alignment. This enables the use of pairs of
21057 @code{ldd} and @code{std} instructions for copies in structure
21058 assignment, in place of twice as many @code{ld} and @code{st} pairs.
21059 However, the use of this changed alignment directly violates the SPARC
21060 ABI@. Thus, it's intended only for use on targets where the developer
21061 acknowledges that their resulting code is not directly in line with
21062 the rules of the ABI@.
21063
21064 @item -mcpu=@var{cpu_type}
21065 @opindex mcpu
21066 Set the instruction set, register set, and instruction scheduling parameters
21067 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
21068 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
21069 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
21070 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
21071 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
21072 @samp{niagara3} and @samp{niagara4}.
21073
21074 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
21075 which selects the best architecture option for the host processor.
21076 @option{-mcpu=native} has no effect if GCC does not recognize
21077 the processor.
21078
21079 Default instruction scheduling parameters are used for values that select
21080 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
21081 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
21082
21083 Here is a list of each supported architecture and their supported
21084 implementations.
21085
21086 @table @asis
21087 @item v7
21088 cypress, leon3v7
21089
21090 @item v8
21091 supersparc, hypersparc, leon, leon3
21092
21093 @item sparclite
21094 f930, f934, sparclite86x
21095
21096 @item sparclet
21097 tsc701
21098
21099 @item v9
21100 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
21101 @end table
21102
21103 By default (unless configured otherwise), GCC generates code for the V7
21104 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
21105 additionally optimizes it for the Cypress CY7C602 chip, as used in the
21106 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
21107 SPARCStation 1, 2, IPX etc.
21108
21109 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
21110 architecture. The only difference from V7 code is that the compiler emits
21111 the integer multiply and integer divide instructions which exist in SPARC-V8
21112 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
21113 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
21114 2000 series.
21115
21116 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
21117 the SPARC architecture. This adds the integer multiply, integer divide step
21118 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
21119 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
21120 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
21121 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
21122 MB86934 chip, which is the more recent SPARClite with FPU@.
21123
21124 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
21125 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
21126 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
21127 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
21128 optimizes it for the TEMIC SPARClet chip.
21129
21130 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
21131 architecture. This adds 64-bit integer and floating-point move instructions,
21132 3 additional floating-point condition code registers and conditional move
21133 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
21134 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
21135 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
21136 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
21137 @option{-mcpu=niagara}, the compiler additionally optimizes it for
21138 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
21139 additionally optimizes it for Sun UltraSPARC T2 chips. With
21140 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
21141 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
21142 additionally optimizes it for Sun UltraSPARC T4 chips.
21143
21144 @item -mtune=@var{cpu_type}
21145 @opindex mtune
21146 Set the instruction scheduling parameters for machine type
21147 @var{cpu_type}, but do not set the instruction set or register set that the
21148 option @option{-mcpu=@var{cpu_type}} does.
21149
21150 The same values for @option{-mcpu=@var{cpu_type}} can be used for
21151 @option{-mtune=@var{cpu_type}}, but the only useful values are those
21152 that select a particular CPU implementation. Those are @samp{cypress},
21153 @samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3},
21154 @samp{leon3v7}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{tsc701},
21155 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
21156 @samp{niagara3} and @samp{niagara4}. With native Solaris and GNU/Linux
21157 toolchains, @samp{native} can also be used.
21158
21159 @item -mv8plus
21160 @itemx -mno-v8plus
21161 @opindex mv8plus
21162 @opindex mno-v8plus
21163 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
21164 difference from the V8 ABI is that the global and out registers are
21165 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
21166 mode for all SPARC-V9 processors.
21167
21168 @item -mvis
21169 @itemx -mno-vis
21170 @opindex mvis
21171 @opindex mno-vis
21172 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
21173 Visual Instruction Set extensions. The default is @option{-mno-vis}.
21174
21175 @item -mvis2
21176 @itemx -mno-vis2
21177 @opindex mvis2
21178 @opindex mno-vis2
21179 With @option{-mvis2}, GCC generates code that takes advantage of
21180 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
21181 default is @option{-mvis2} when targeting a cpu that supports such
21182 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
21183 also sets @option{-mvis}.
21184
21185 @item -mvis3
21186 @itemx -mno-vis3
21187 @opindex mvis3
21188 @opindex mno-vis3
21189 With @option{-mvis3}, GCC generates code that takes advantage of
21190 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
21191 default is @option{-mvis3} when targeting a cpu that supports such
21192 instructions, such as niagara-3 and later. Setting @option{-mvis3}
21193 also sets @option{-mvis2} and @option{-mvis}.
21194
21195 @item -mcbcond
21196 @itemx -mno-cbcond
21197 @opindex mcbcond
21198 @opindex mno-cbcond
21199 With @option{-mcbcond}, GCC generates code that takes advantage of
21200 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
21201 The default is @option{-mcbcond} when targeting a cpu that supports such
21202 instructions, such as niagara-4 and later.
21203
21204 @item -mpopc
21205 @itemx -mno-popc
21206 @opindex mpopc
21207 @opindex mno-popc
21208 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
21209 population count instruction. The default is @option{-mpopc}
21210 when targeting a cpu that supports such instructions, such as Niagara-2 and
21211 later.
21212
21213 @item -mfmaf
21214 @itemx -mno-fmaf
21215 @opindex mfmaf
21216 @opindex mno-fmaf
21217 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
21218 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
21219 when targeting a cpu that supports such instructions, such as Niagara-3 and
21220 later.
21221
21222 @item -mfix-at697f
21223 @opindex mfix-at697f
21224 Enable the documented workaround for the single erratum of the Atmel AT697F
21225 processor (which corresponds to erratum #13 of the AT697E processor).
21226
21227 @item -mfix-ut699
21228 @opindex mfix-ut699
21229 Enable the documented workarounds for the floating-point errata and the data
21230 cache nullify errata of the UT699 processor.
21231 @end table
21232
21233 These @samp{-m} options are supported in addition to the above
21234 on SPARC-V9 processors in 64-bit environments:
21235
21236 @table @gcctabopt
21237 @item -m32
21238 @itemx -m64
21239 @opindex m32
21240 @opindex m64
21241 Generate code for a 32-bit or 64-bit environment.
21242 The 32-bit environment sets int, long and pointer to 32 bits.
21243 The 64-bit environment sets int to 32 bits and long and pointer
21244 to 64 bits.
21245
21246 @item -mcmodel=@var{which}
21247 @opindex mcmodel
21248 Set the code model to one of
21249
21250 @table @samp
21251 @item medlow
21252 The Medium/Low code model: 64-bit addresses, programs
21253 must be linked in the low 32 bits of memory. Programs can be statically
21254 or dynamically linked.
21255
21256 @item medmid
21257 The Medium/Middle code model: 64-bit addresses, programs
21258 must be linked in the low 44 bits of memory, the text and data segments must
21259 be less than 2GB in size and the data segment must be located within 2GB of
21260 the text segment.
21261
21262 @item medany
21263 The Medium/Anywhere code model: 64-bit addresses, programs
21264 may be linked anywhere in memory, the text and data segments must be less
21265 than 2GB in size and the data segment must be located within 2GB of the
21266 text segment.
21267
21268 @item embmedany
21269 The Medium/Anywhere code model for embedded systems:
21270 64-bit addresses, the text and data segments must be less than 2GB in
21271 size, both starting anywhere in memory (determined at link time). The
21272 global register %g4 points to the base of the data segment. Programs
21273 are statically linked and PIC is not supported.
21274 @end table
21275
21276 @item -mmemory-model=@var{mem-model}
21277 @opindex mmemory-model
21278 Set the memory model in force on the processor to one of
21279
21280 @table @samp
21281 @item default
21282 The default memory model for the processor and operating system.
21283
21284 @item rmo
21285 Relaxed Memory Order
21286
21287 @item pso
21288 Partial Store Order
21289
21290 @item tso
21291 Total Store Order
21292
21293 @item sc
21294 Sequential Consistency
21295 @end table
21296
21297 These memory models are formally defined in Appendix D of the Sparc V9
21298 architecture manual, as set in the processor's @code{PSTATE.MM} field.
21299
21300 @item -mstack-bias
21301 @itemx -mno-stack-bias
21302 @opindex mstack-bias
21303 @opindex mno-stack-bias
21304 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
21305 frame pointer if present, are offset by @minus{}2047 which must be added back
21306 when making stack frame references. This is the default in 64-bit mode.
21307 Otherwise, assume no such offset is present.
21308 @end table
21309
21310 @node SPU Options
21311 @subsection SPU Options
21312 @cindex SPU options
21313
21314 These @samp{-m} options are supported on the SPU:
21315
21316 @table @gcctabopt
21317 @item -mwarn-reloc
21318 @itemx -merror-reloc
21319 @opindex mwarn-reloc
21320 @opindex merror-reloc
21321
21322 The loader for SPU does not handle dynamic relocations. By default, GCC
21323 gives an error when it generates code that requires a dynamic
21324 relocation. @option{-mno-error-reloc} disables the error,
21325 @option{-mwarn-reloc} generates a warning instead.
21326
21327 @item -msafe-dma
21328 @itemx -munsafe-dma
21329 @opindex msafe-dma
21330 @opindex munsafe-dma
21331
21332 Instructions that initiate or test completion of DMA must not be
21333 reordered with respect to loads and stores of the memory that is being
21334 accessed.
21335 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
21336 memory accesses, but that can lead to inefficient code in places where the
21337 memory is known to not change. Rather than mark the memory as volatile,
21338 you can use @option{-msafe-dma} to tell the compiler to treat
21339 the DMA instructions as potentially affecting all memory.
21340
21341 @item -mbranch-hints
21342 @opindex mbranch-hints
21343
21344 By default, GCC generates a branch hint instruction to avoid
21345 pipeline stalls for always-taken or probably-taken branches. A hint
21346 is not generated closer than 8 instructions away from its branch.
21347 There is little reason to disable them, except for debugging purposes,
21348 or to make an object a little bit smaller.
21349
21350 @item -msmall-mem
21351 @itemx -mlarge-mem
21352 @opindex msmall-mem
21353 @opindex mlarge-mem
21354
21355 By default, GCC generates code assuming that addresses are never larger
21356 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
21357 a full 32-bit address.
21358
21359 @item -mstdmain
21360 @opindex mstdmain
21361
21362 By default, GCC links against startup code that assumes the SPU-style
21363 main function interface (which has an unconventional parameter list).
21364 With @option{-mstdmain}, GCC links your program against startup
21365 code that assumes a C99-style interface to @code{main}, including a
21366 local copy of @code{argv} strings.
21367
21368 @item -mfixed-range=@var{register-range}
21369 @opindex mfixed-range
21370 Generate code treating the given register range as fixed registers.
21371 A fixed register is one that the register allocator cannot use. This is
21372 useful when compiling kernel code. A register range is specified as
21373 two registers separated by a dash. Multiple register ranges can be
21374 specified separated by a comma.
21375
21376 @item -mea32
21377 @itemx -mea64
21378 @opindex mea32
21379 @opindex mea64
21380 Compile code assuming that pointers to the PPU address space accessed
21381 via the @code{__ea} named address space qualifier are either 32 or 64
21382 bits wide. The default is 32 bits. As this is an ABI-changing option,
21383 all object code in an executable must be compiled with the same setting.
21384
21385 @item -maddress-space-conversion
21386 @itemx -mno-address-space-conversion
21387 @opindex maddress-space-conversion
21388 @opindex mno-address-space-conversion
21389 Allow/disallow treating the @code{__ea} address space as superset
21390 of the generic address space. This enables explicit type casts
21391 between @code{__ea} and generic pointer as well as implicit
21392 conversions of generic pointers to @code{__ea} pointers. The
21393 default is to allow address space pointer conversions.
21394
21395 @item -mcache-size=@var{cache-size}
21396 @opindex mcache-size
21397 This option controls the version of libgcc that the compiler links to an
21398 executable and selects a software-managed cache for accessing variables
21399 in the @code{__ea} address space with a particular cache size. Possible
21400 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
21401 and @samp{128}. The default cache size is 64KB.
21402
21403 @item -matomic-updates
21404 @itemx -mno-atomic-updates
21405 @opindex matomic-updates
21406 @opindex mno-atomic-updates
21407 This option controls the version of libgcc that the compiler links to an
21408 executable and selects whether atomic updates to the software-managed
21409 cache of PPU-side variables are used. If you use atomic updates, changes
21410 to a PPU variable from SPU code using the @code{__ea} named address space
21411 qualifier do not interfere with changes to other PPU variables residing
21412 in the same cache line from PPU code. If you do not use atomic updates,
21413 such interference may occur; however, writing back cache lines is
21414 more efficient. The default behavior is to use atomic updates.
21415
21416 @item -mdual-nops
21417 @itemx -mdual-nops=@var{n}
21418 @opindex mdual-nops
21419 By default, GCC inserts nops to increase dual issue when it expects
21420 it to increase performance. @var{n} can be a value from 0 to 10. A
21421 smaller @var{n} inserts fewer nops. 10 is the default, 0 is the
21422 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
21423
21424 @item -mhint-max-nops=@var{n}
21425 @opindex mhint-max-nops
21426 Maximum number of nops to insert for a branch hint. A branch hint must
21427 be at least 8 instructions away from the branch it is affecting. GCC
21428 inserts up to @var{n} nops to enforce this, otherwise it does not
21429 generate the branch hint.
21430
21431 @item -mhint-max-distance=@var{n}
21432 @opindex mhint-max-distance
21433 The encoding of the branch hint instruction limits the hint to be within
21434 256 instructions of the branch it is affecting. By default, GCC makes
21435 sure it is within 125.
21436
21437 @item -msafe-hints
21438 @opindex msafe-hints
21439 Work around a hardware bug that causes the SPU to stall indefinitely.
21440 By default, GCC inserts the @code{hbrp} instruction to make sure
21441 this stall won't happen.
21442
21443 @end table
21444
21445 @node System V Options
21446 @subsection Options for System V
21447
21448 These additional options are available on System V Release 4 for
21449 compatibility with other compilers on those systems:
21450
21451 @table @gcctabopt
21452 @item -G
21453 @opindex G
21454 Create a shared object.
21455 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
21456
21457 @item -Qy
21458 @opindex Qy
21459 Identify the versions of each tool used by the compiler, in a
21460 @code{.ident} assembler directive in the output.
21461
21462 @item -Qn
21463 @opindex Qn
21464 Refrain from adding @code{.ident} directives to the output file (this is
21465 the default).
21466
21467 @item -YP,@var{dirs}
21468 @opindex YP
21469 Search the directories @var{dirs}, and no others, for libraries
21470 specified with @option{-l}.
21471
21472 @item -Ym,@var{dir}
21473 @opindex Ym
21474 Look in the directory @var{dir} to find the M4 preprocessor.
21475 The assembler uses this option.
21476 @c This is supposed to go with a -Yd for predefined M4 macro files, but
21477 @c the generic assembler that comes with Solaris takes just -Ym.
21478 @end table
21479
21480 @node TILE-Gx Options
21481 @subsection TILE-Gx Options
21482 @cindex TILE-Gx options
21483
21484 These @samp{-m} options are supported on the TILE-Gx:
21485
21486 @table @gcctabopt
21487 @item -mcmodel=small
21488 @opindex mcmodel=small
21489 Generate code for the small model. The distance for direct calls is
21490 limited to 500M in either direction. PC-relative addresses are 32
21491 bits. Absolute addresses support the full address range.
21492
21493 @item -mcmodel=large
21494 @opindex mcmodel=large
21495 Generate code for the large model. There is no limitation on call
21496 distance, pc-relative addresses, or absolute addresses.
21497
21498 @item -mcpu=@var{name}
21499 @opindex mcpu
21500 Selects the type of CPU to be targeted. Currently the only supported
21501 type is @samp{tilegx}.
21502
21503 @item -m32
21504 @itemx -m64
21505 @opindex m32
21506 @opindex m64
21507 Generate code for a 32-bit or 64-bit environment. The 32-bit
21508 environment sets int, long, and pointer to 32 bits. The 64-bit
21509 environment sets int to 32 bits and long and pointer to 64 bits.
21510
21511 @item -mbig-endian
21512 @itemx -mlittle-endian
21513 @opindex mbig-endian
21514 @opindex mlittle-endian
21515 Generate code in big/little endian mode, respectively.
21516 @end table
21517
21518 @node TILEPro Options
21519 @subsection TILEPro Options
21520 @cindex TILEPro options
21521
21522 These @samp{-m} options are supported on the TILEPro:
21523
21524 @table @gcctabopt
21525 @item -mcpu=@var{name}
21526 @opindex mcpu
21527 Selects the type of CPU to be targeted. Currently the only supported
21528 type is @samp{tilepro}.
21529
21530 @item -m32
21531 @opindex m32
21532 Generate code for a 32-bit environment, which sets int, long, and
21533 pointer to 32 bits. This is the only supported behavior so the flag
21534 is essentially ignored.
21535 @end table
21536
21537 @node V850 Options
21538 @subsection V850 Options
21539 @cindex V850 Options
21540
21541 These @samp{-m} options are defined for V850 implementations:
21542
21543 @table @gcctabopt
21544 @item -mlong-calls
21545 @itemx -mno-long-calls
21546 @opindex mlong-calls
21547 @opindex mno-long-calls
21548 Treat all calls as being far away (near). If calls are assumed to be
21549 far away, the compiler always loads the function's address into a
21550 register, and calls indirect through the pointer.
21551
21552 @item -mno-ep
21553 @itemx -mep
21554 @opindex mno-ep
21555 @opindex mep
21556 Do not optimize (do optimize) basic blocks that use the same index
21557 pointer 4 or more times to copy pointer into the @code{ep} register, and
21558 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
21559 option is on by default if you optimize.
21560
21561 @item -mno-prolog-function
21562 @itemx -mprolog-function
21563 @opindex mno-prolog-function
21564 @opindex mprolog-function
21565 Do not use (do use) external functions to save and restore registers
21566 at the prologue and epilogue of a function. The external functions
21567 are slower, but use less code space if more than one function saves
21568 the same number of registers. The @option{-mprolog-function} option
21569 is on by default if you optimize.
21570
21571 @item -mspace
21572 @opindex mspace
21573 Try to make the code as small as possible. At present, this just turns
21574 on the @option{-mep} and @option{-mprolog-function} options.
21575
21576 @item -mtda=@var{n}
21577 @opindex mtda
21578 Put static or global variables whose size is @var{n} bytes or less into
21579 the tiny data area that register @code{ep} points to. The tiny data
21580 area can hold up to 256 bytes in total (128 bytes for byte references).
21581
21582 @item -msda=@var{n}
21583 @opindex msda
21584 Put static or global variables whose size is @var{n} bytes or less into
21585 the small data area that register @code{gp} points to. The small data
21586 area can hold up to 64 kilobytes.
21587
21588 @item -mzda=@var{n}
21589 @opindex mzda
21590 Put static or global variables whose size is @var{n} bytes or less into
21591 the first 32 kilobytes of memory.
21592
21593 @item -mv850
21594 @opindex mv850
21595 Specify that the target processor is the V850.
21596
21597 @item -mv850e3v5
21598 @opindex mv850e3v5
21599 Specify that the target processor is the V850E3V5. The preprocessor
21600 constant @code{__v850e3v5__} is defined if this option is used.
21601
21602 @item -mv850e2v4
21603 @opindex mv850e2v4
21604 Specify that the target processor is the V850E3V5. This is an alias for
21605 the @option{-mv850e3v5} option.
21606
21607 @item -mv850e2v3
21608 @opindex mv850e2v3
21609 Specify that the target processor is the V850E2V3. The preprocessor
21610 constant @code{__v850e2v3__} is defined if this option is used.
21611
21612 @item -mv850e2
21613 @opindex mv850e2
21614 Specify that the target processor is the V850E2. The preprocessor
21615 constant @code{__v850e2__} is defined if this option is used.
21616
21617 @item -mv850e1
21618 @opindex mv850e1
21619 Specify that the target processor is the V850E1. The preprocessor
21620 constants @code{__v850e1__} and @code{__v850e__} are defined if
21621 this option is used.
21622
21623 @item -mv850es
21624 @opindex mv850es
21625 Specify that the target processor is the V850ES. This is an alias for
21626 the @option{-mv850e1} option.
21627
21628 @item -mv850e
21629 @opindex mv850e
21630 Specify that the target processor is the V850E@. The preprocessor
21631 constant @code{__v850e__} is defined if this option is used.
21632
21633 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
21634 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
21635 are defined then a default target processor is chosen and the
21636 relevant @samp{__v850*__} preprocessor constant is defined.
21637
21638 The preprocessor constants @code{__v850} and @code{__v851__} are always
21639 defined, regardless of which processor variant is the target.
21640
21641 @item -mdisable-callt
21642 @itemx -mno-disable-callt
21643 @opindex mdisable-callt
21644 @opindex mno-disable-callt
21645 This option suppresses generation of the @code{CALLT} instruction for the
21646 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
21647 architecture.
21648
21649 This option is enabled by default when the RH850 ABI is
21650 in use (see @option{-mrh850-abi}), and disabled by default when the
21651 GCC ABI is in use. If @code{CALLT} instructions are being generated
21652 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
21653
21654 @item -mrelax
21655 @itemx -mno-relax
21656 @opindex mrelax
21657 @opindex mno-relax
21658 Pass on (or do not pass on) the @option{-mrelax} command-line option
21659 to the assembler.
21660
21661 @item -mlong-jumps
21662 @itemx -mno-long-jumps
21663 @opindex mlong-jumps
21664 @opindex mno-long-jumps
21665 Disable (or re-enable) the generation of PC-relative jump instructions.
21666
21667 @item -msoft-float
21668 @itemx -mhard-float
21669 @opindex msoft-float
21670 @opindex mhard-float
21671 Disable (or re-enable) the generation of hardware floating point
21672 instructions. This option is only significant when the target
21673 architecture is @samp{V850E2V3} or higher. If hardware floating point
21674 instructions are being generated then the C preprocessor symbol
21675 @code{__FPU_OK__} is defined, otherwise the symbol
21676 @code{__NO_FPU__} is defined.
21677
21678 @item -mloop
21679 @opindex mloop
21680 Enables the use of the e3v5 LOOP instruction. The use of this
21681 instruction is not enabled by default when the e3v5 architecture is
21682 selected because its use is still experimental.
21683
21684 @item -mrh850-abi
21685 @itemx -mghs
21686 @opindex mrh850-abi
21687 @opindex mghs
21688 Enables support for the RH850 version of the V850 ABI. This is the
21689 default. With this version of the ABI the following rules apply:
21690
21691 @itemize
21692 @item
21693 Integer sized structures and unions are returned via a memory pointer
21694 rather than a register.
21695
21696 @item
21697 Large structures and unions (more than 8 bytes in size) are passed by
21698 value.
21699
21700 @item
21701 Functions are aligned to 16-bit boundaries.
21702
21703 @item
21704 The @option{-m8byte-align} command-line option is supported.
21705
21706 @item
21707 The @option{-mdisable-callt} command-line option is enabled by
21708 default. The @option{-mno-disable-callt} command-line option is not
21709 supported.
21710 @end itemize
21711
21712 When this version of the ABI is enabled the C preprocessor symbol
21713 @code{__V850_RH850_ABI__} is defined.
21714
21715 @item -mgcc-abi
21716 @opindex mgcc-abi
21717 Enables support for the old GCC version of the V850 ABI. With this
21718 version of the ABI the following rules apply:
21719
21720 @itemize
21721 @item
21722 Integer sized structures and unions are returned in register @code{r10}.
21723
21724 @item
21725 Large structures and unions (more than 8 bytes in size) are passed by
21726 reference.
21727
21728 @item
21729 Functions are aligned to 32-bit boundaries, unless optimizing for
21730 size.
21731
21732 @item
21733 The @option{-m8byte-align} command-line option is not supported.
21734
21735 @item
21736 The @option{-mdisable-callt} command-line option is supported but not
21737 enabled by default.
21738 @end itemize
21739
21740 When this version of the ABI is enabled the C preprocessor symbol
21741 @code{__V850_GCC_ABI__} is defined.
21742
21743 @item -m8byte-align
21744 @itemx -mno-8byte-align
21745 @opindex m8byte-align
21746 @opindex mno-8byte-align
21747 Enables support for @code{double} and @code{long long} types to be
21748 aligned on 8-byte boundaries. The default is to restrict the
21749 alignment of all objects to at most 4-bytes. When
21750 @option{-m8byte-align} is in effect the C preprocessor symbol
21751 @code{__V850_8BYTE_ALIGN__} is defined.
21752
21753 @item -mbig-switch
21754 @opindex mbig-switch
21755 Generate code suitable for big switch tables. Use this option only if
21756 the assembler/linker complain about out of range branches within a switch
21757 table.
21758
21759 @item -mapp-regs
21760 @opindex mapp-regs
21761 This option causes r2 and r5 to be used in the code generated by
21762 the compiler. This setting is the default.
21763
21764 @item -mno-app-regs
21765 @opindex mno-app-regs
21766 This option causes r2 and r5 to be treated as fixed registers.
21767
21768 @end table
21769
21770 @node VAX Options
21771 @subsection VAX Options
21772 @cindex VAX options
21773
21774 These @samp{-m} options are defined for the VAX:
21775
21776 @table @gcctabopt
21777 @item -munix
21778 @opindex munix
21779 Do not output certain jump instructions (@code{aobleq} and so on)
21780 that the Unix assembler for the VAX cannot handle across long
21781 ranges.
21782
21783 @item -mgnu
21784 @opindex mgnu
21785 Do output those jump instructions, on the assumption that the
21786 GNU assembler is being used.
21787
21788 @item -mg
21789 @opindex mg
21790 Output code for G-format floating-point numbers instead of D-format.
21791 @end table
21792
21793 @node Visium Options
21794 @subsection Visium Options
21795 @cindex Visium options
21796
21797 @table @gcctabopt
21798
21799 @item -mdebug
21800 @opindex mdebug
21801 A program which performs file I/O and is destined to run on an MCM target
21802 should be linked with this option. It causes the libraries libc.a and
21803 libdebug.a to be linked. The program should be run on the target under
21804 the control of the GDB remote debugging stub.
21805
21806 @item -msim
21807 @opindex msim
21808 A program which performs file I/O and is destined to run on the simulator
21809 should be linked with option. This causes libraries libc.a and libsim.a to
21810 be linked.
21811
21812 @item -mfpu
21813 @itemx -mhard-float
21814 @opindex mfpu
21815 @opindex mhard-float
21816 Generate code containing floating-point instructions. This is the
21817 default.
21818
21819 @item -mno-fpu
21820 @itemx -msoft-float
21821 @opindex mno-fpu
21822 @opindex msoft-float
21823 Generate code containing library calls for floating-point.
21824
21825 @option{-msoft-float} changes the calling convention in the output file;
21826 therefore, it is only useful if you compile @emph{all} of a program with
21827 this option. In particular, you need to compile @file{libgcc.a}, the
21828 library that comes with GCC, with @option{-msoft-float} in order for
21829 this to work.
21830
21831 @item -mcpu=@var{cpu_type}
21832 @opindex mcpu
21833 Set the instruction set, register set, and instruction scheduling parameters
21834 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
21835 @samp{mcm}, @samp{gr5} and @samp{gr6}.
21836
21837 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
21838
21839 By default (unless configured otherwise), GCC generates code for the GR5
21840 variant of the Visium architecture.
21841
21842 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
21843 architecture. The only difference from GR5 code is that the compiler will
21844 generate block move instructions.
21845
21846 @item -mtune=@var{cpu_type}
21847 @opindex mtune
21848 Set the instruction scheduling parameters for machine type @var{cpu_type},
21849 but do not set the instruction set or register set that the option
21850 @option{-mcpu=@var{cpu_type}} would.
21851
21852 @item -msv-mode
21853 @opindex msv-mode
21854 Generate code for the supervisor mode, where there are no restrictions on
21855 the access to general registers. This is the default.
21856
21857 @item -muser-mode
21858 @opindex muser-mode
21859 Generate code for the user mode, where the access to some general registers
21860 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
21861 mode; on the GR6, only registers r29 to r31 are affected.
21862 @end table
21863
21864 @node VMS Options
21865 @subsection VMS Options
21866
21867 These @samp{-m} options are defined for the VMS implementations:
21868
21869 @table @gcctabopt
21870 @item -mvms-return-codes
21871 @opindex mvms-return-codes
21872 Return VMS condition codes from @code{main}. The default is to return POSIX-style
21873 condition (e.g.@ error) codes.
21874
21875 @item -mdebug-main=@var{prefix}
21876 @opindex mdebug-main=@var{prefix}
21877 Flag the first routine whose name starts with @var{prefix} as the main
21878 routine for the debugger.
21879
21880 @item -mmalloc64
21881 @opindex mmalloc64
21882 Default to 64-bit memory allocation routines.
21883
21884 @item -mpointer-size=@var{size}
21885 @opindex mpointer-size=@var{size}
21886 Set the default size of pointers. Possible options for @var{size} are
21887 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
21888 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
21889 The later option disables @code{pragma pointer_size}.
21890 @end table
21891
21892 @node VxWorks Options
21893 @subsection VxWorks Options
21894 @cindex VxWorks Options
21895
21896 The options in this section are defined for all VxWorks targets.
21897 Options specific to the target hardware are listed with the other
21898 options for that target.
21899
21900 @table @gcctabopt
21901 @item -mrtp
21902 @opindex mrtp
21903 GCC can generate code for both VxWorks kernels and real time processes
21904 (RTPs). This option switches from the former to the latter. It also
21905 defines the preprocessor macro @code{__RTP__}.
21906
21907 @item -non-static
21908 @opindex non-static
21909 Link an RTP executable against shared libraries rather than static
21910 libraries. The options @option{-static} and @option{-shared} can
21911 also be used for RTPs (@pxref{Link Options}); @option{-static}
21912 is the default.
21913
21914 @item -Bstatic
21915 @itemx -Bdynamic
21916 @opindex Bstatic
21917 @opindex Bdynamic
21918 These options are passed down to the linker. They are defined for
21919 compatibility with Diab.
21920
21921 @item -Xbind-lazy
21922 @opindex Xbind-lazy
21923 Enable lazy binding of function calls. This option is equivalent to
21924 @option{-Wl,-z,now} and is defined for compatibility with Diab.
21925
21926 @item -Xbind-now
21927 @opindex Xbind-now
21928 Disable lazy binding of function calls. This option is the default and
21929 is defined for compatibility with Diab.
21930 @end table
21931
21932 @node x86 Options
21933 @subsection x86 Options
21934 @cindex x86 Options
21935
21936 These @samp{-m} options are defined for the x86 family of computers.
21937
21938 @table @gcctabopt
21939
21940 @item -march=@var{cpu-type}
21941 @opindex march
21942 Generate instructions for the machine type @var{cpu-type}. In contrast to
21943 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
21944 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
21945 to generate code that may not run at all on processors other than the one
21946 indicated. Specifying @option{-march=@var{cpu-type}} implies
21947 @option{-mtune=@var{cpu-type}}.
21948
21949 The choices for @var{cpu-type} are:
21950
21951 @table @samp
21952 @item native
21953 This selects the CPU to generate code for at compilation time by determining
21954 the processor type of the compiling machine. Using @option{-march=native}
21955 enables all instruction subsets supported by the local machine (hence
21956 the result might not run on different machines). Using @option{-mtune=native}
21957 produces code optimized for the local machine under the constraints
21958 of the selected instruction set.
21959
21960 @item i386
21961 Original Intel i386 CPU@.
21962
21963 @item i486
21964 Intel i486 CPU@. (No scheduling is implemented for this chip.)
21965
21966 @item i586
21967 @itemx pentium
21968 Intel Pentium CPU with no MMX support.
21969
21970 @item pentium-mmx
21971 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
21972
21973 @item pentiumpro
21974 Intel Pentium Pro CPU@.
21975
21976 @item i686
21977 When used with @option{-march}, the Pentium Pro
21978 instruction set is used, so the code runs on all i686 family chips.
21979 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
21980
21981 @item pentium2
21982 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
21983 support.
21984
21985 @item pentium3
21986 @itemx pentium3m
21987 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
21988 set support.
21989
21990 @item pentium-m
21991 Intel Pentium M; low-power version of Intel Pentium III CPU
21992 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
21993
21994 @item pentium4
21995 @itemx pentium4m
21996 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
21997
21998 @item prescott
21999 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
22000 set support.
22001
22002 @item nocona
22003 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
22004 SSE2 and SSE3 instruction set support.
22005
22006 @item core2
22007 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
22008 instruction set support.
22009
22010 @item nehalem
22011 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
22012 SSE4.1, SSE4.2 and POPCNT instruction set support.
22013
22014 @item westmere
22015 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
22016 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
22017
22018 @item sandybridge
22019 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
22020 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
22021
22022 @item ivybridge
22023 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
22024 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
22025 instruction set support.
22026
22027 @item haswell
22028 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
22029 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
22030 BMI, BMI2 and F16C instruction set support.
22031
22032 @item broadwell
22033 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
22034 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
22035 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
22036
22037 @item bonnell
22038 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
22039 instruction set support.
22040
22041 @item silvermont
22042 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
22043 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
22044
22045 @item knl
22046 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
22047 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
22048 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
22049 AVX512CD instruction set support.
22050
22051 @item k6
22052 AMD K6 CPU with MMX instruction set support.
22053
22054 @item k6-2
22055 @itemx k6-3
22056 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
22057
22058 @item athlon
22059 @itemx athlon-tbird
22060 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
22061 support.
22062
22063 @item athlon-4
22064 @itemx athlon-xp
22065 @itemx athlon-mp
22066 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
22067 instruction set support.
22068
22069 @item k8
22070 @itemx opteron
22071 @itemx athlon64
22072 @itemx athlon-fx
22073 Processors based on the AMD K8 core with x86-64 instruction set support,
22074 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
22075 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
22076 instruction set extensions.)
22077
22078 @item k8-sse3
22079 @itemx opteron-sse3
22080 @itemx athlon64-sse3
22081 Improved versions of AMD K8 cores with SSE3 instruction set support.
22082
22083 @item amdfam10
22084 @itemx barcelona
22085 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
22086 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
22087 instruction set extensions.)
22088
22089 @item bdver1
22090 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
22091 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
22092 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
22093 @item bdver2
22094 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
22095 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
22096 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
22097 extensions.)
22098 @item bdver3
22099 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
22100 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
22101 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
22102 64-bit instruction set extensions.
22103 @item bdver4
22104 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
22105 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
22106 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
22107 SSE4.2, ABM and 64-bit instruction set extensions.
22108
22109 @item btver1
22110 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
22111 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
22112 instruction set extensions.)
22113
22114 @item btver2
22115 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
22116 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
22117 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
22118
22119 @item winchip-c6
22120 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
22121 set support.
22122
22123 @item winchip2
22124 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
22125 instruction set support.
22126
22127 @item c3
22128 VIA C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is
22129 implemented for this chip.)
22130
22131 @item c3-2
22132 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
22133 (No scheduling is
22134 implemented for this chip.)
22135
22136 @item geode
22137 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
22138 @end table
22139
22140 @item -mtune=@var{cpu-type}
22141 @opindex mtune
22142 Tune to @var{cpu-type} everything applicable about the generated code, except
22143 for the ABI and the set of available instructions.
22144 While picking a specific @var{cpu-type} schedules things appropriately
22145 for that particular chip, the compiler does not generate any code that
22146 cannot run on the default machine type unless you use a
22147 @option{-march=@var{cpu-type}} option.
22148 For example, if GCC is configured for i686-pc-linux-gnu
22149 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
22150 but still runs on i686 machines.
22151
22152 The choices for @var{cpu-type} are the same as for @option{-march}.
22153 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
22154
22155 @table @samp
22156 @item generic
22157 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
22158 If you know the CPU on which your code will run, then you should use
22159 the corresponding @option{-mtune} or @option{-march} option instead of
22160 @option{-mtune=generic}. But, if you do not know exactly what CPU users
22161 of your application will have, then you should use this option.
22162
22163 As new processors are deployed in the marketplace, the behavior of this
22164 option will change. Therefore, if you upgrade to a newer version of
22165 GCC, code generation controlled by this option will change to reflect
22166 the processors
22167 that are most common at the time that version of GCC is released.
22168
22169 There is no @option{-march=generic} option because @option{-march}
22170 indicates the instruction set the compiler can use, and there is no
22171 generic instruction set applicable to all processors. In contrast,
22172 @option{-mtune} indicates the processor (or, in this case, collection of
22173 processors) for which the code is optimized.
22174
22175 @item intel
22176 Produce code optimized for the most current Intel processors, which are
22177 Haswell and Silvermont for this version of GCC. If you know the CPU
22178 on which your code will run, then you should use the corresponding
22179 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
22180 But, if you want your application performs better on both Haswell and
22181 Silvermont, then you should use this option.
22182
22183 As new Intel processors are deployed in the marketplace, the behavior of
22184 this option will change. Therefore, if you upgrade to a newer version of
22185 GCC, code generation controlled by this option will change to reflect
22186 the most current Intel processors at the time that version of GCC is
22187 released.
22188
22189 There is no @option{-march=intel} option because @option{-march} indicates
22190 the instruction set the compiler can use, and there is no common
22191 instruction set applicable to all processors. In contrast,
22192 @option{-mtune} indicates the processor (or, in this case, collection of
22193 processors) for which the code is optimized.
22194 @end table
22195
22196 @item -mcpu=@var{cpu-type}
22197 @opindex mcpu
22198 A deprecated synonym for @option{-mtune}.
22199
22200 @item -mfpmath=@var{unit}
22201 @opindex mfpmath
22202 Generate floating-point arithmetic for selected unit @var{unit}. The choices
22203 for @var{unit} are:
22204
22205 @table @samp
22206 @item 387
22207 Use the standard 387 floating-point coprocessor present on the majority of chips and
22208 emulated otherwise. Code compiled with this option runs almost everywhere.
22209 The temporary results are computed in 80-bit precision instead of the precision
22210 specified by the type, resulting in slightly different results compared to most
22211 of other chips. See @option{-ffloat-store} for more detailed description.
22212
22213 This is the default choice for x86-32 targets.
22214
22215 @item sse
22216 Use scalar floating-point instructions present in the SSE instruction set.
22217 This instruction set is supported by Pentium III and newer chips,
22218 and in the AMD line
22219 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
22220 instruction set supports only single-precision arithmetic, thus the double and
22221 extended-precision arithmetic are still done using 387. A later version, present
22222 only in Pentium 4 and AMD x86-64 chips, supports double-precision
22223 arithmetic too.
22224
22225 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
22226 or @option{-msse2} switches to enable SSE extensions and make this option
22227 effective. For the x86-64 compiler, these extensions are enabled by default.
22228
22229 The resulting code should be considerably faster in the majority of cases and avoid
22230 the numerical instability problems of 387 code, but may break some existing
22231 code that expects temporaries to be 80 bits.
22232
22233 This is the default choice for the x86-64 compiler.
22234
22235 @item sse,387
22236 @itemx sse+387
22237 @itemx both
22238 Attempt to utilize both instruction sets at once. This effectively doubles the
22239 amount of available registers, and on chips with separate execution units for
22240 387 and SSE the execution resources too. Use this option with care, as it is
22241 still experimental, because the GCC register allocator does not model separate
22242 functional units well, resulting in unstable performance.
22243 @end table
22244
22245 @item -masm=@var{dialect}
22246 @opindex masm=@var{dialect}
22247 Output assembly instructions using selected @var{dialect}. Also affects
22248 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
22249 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
22250 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
22251 not support @samp{intel}.
22252
22253 @item -mieee-fp
22254 @itemx -mno-ieee-fp
22255 @opindex mieee-fp
22256 @opindex mno-ieee-fp
22257 Control whether or not the compiler uses IEEE floating-point
22258 comparisons. These correctly handle the case where the result of a
22259 comparison is unordered.
22260
22261 @item -msoft-float
22262 @opindex msoft-float
22263 Generate output containing library calls for floating point.
22264
22265 @strong{Warning:} the requisite libraries are not part of GCC@.
22266 Normally the facilities of the machine's usual C compiler are used, but
22267 this can't be done directly in cross-compilation. You must make your
22268 own arrangements to provide suitable library functions for
22269 cross-compilation.
22270
22271 On machines where a function returns floating-point results in the 80387
22272 register stack, some floating-point opcodes may be emitted even if
22273 @option{-msoft-float} is used.
22274
22275 @item -mno-fp-ret-in-387
22276 @opindex mno-fp-ret-in-387
22277 Do not use the FPU registers for return values of functions.
22278
22279 The usual calling convention has functions return values of types
22280 @code{float} and @code{double} in an FPU register, even if there
22281 is no FPU@. The idea is that the operating system should emulate
22282 an FPU@.
22283
22284 The option @option{-mno-fp-ret-in-387} causes such values to be returned
22285 in ordinary CPU registers instead.
22286
22287 @item -mno-fancy-math-387
22288 @opindex mno-fancy-math-387
22289 Some 387 emulators do not support the @code{sin}, @code{cos} and
22290 @code{sqrt} instructions for the 387. Specify this option to avoid
22291 generating those instructions. This option is the default on FreeBSD,
22292 OpenBSD and NetBSD@. This option is overridden when @option{-march}
22293 indicates that the target CPU always has an FPU and so the
22294 instruction does not need emulation. These
22295 instructions are not generated unless you also use the
22296 @option{-funsafe-math-optimizations} switch.
22297
22298 @item -malign-double
22299 @itemx -mno-align-double
22300 @opindex malign-double
22301 @opindex mno-align-double
22302 Control whether GCC aligns @code{double}, @code{long double}, and
22303 @code{long long} variables on a two-word boundary or a one-word
22304 boundary. Aligning @code{double} variables on a two-word boundary
22305 produces code that runs somewhat faster on a Pentium at the
22306 expense of more memory.
22307
22308 On x86-64, @option{-malign-double} is enabled by default.
22309
22310 @strong{Warning:} if you use the @option{-malign-double} switch,
22311 structures containing the above types are aligned differently than
22312 the published application binary interface specifications for the x86-32
22313 and are not binary compatible with structures in code compiled
22314 without that switch.
22315
22316 @item -m96bit-long-double
22317 @itemx -m128bit-long-double
22318 @opindex m96bit-long-double
22319 @opindex m128bit-long-double
22320 These switches control the size of @code{long double} type. The x86-32
22321 application binary interface specifies the size to be 96 bits,
22322 so @option{-m96bit-long-double} is the default in 32-bit mode.
22323
22324 Modern architectures (Pentium and newer) prefer @code{long double}
22325 to be aligned to an 8- or 16-byte boundary. In arrays or structures
22326 conforming to the ABI, this is not possible. So specifying
22327 @option{-m128bit-long-double} aligns @code{long double}
22328 to a 16-byte boundary by padding the @code{long double} with an additional
22329 32-bit zero.
22330
22331 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
22332 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
22333
22334 Notice that neither of these options enable any extra precision over the x87
22335 standard of 80 bits for a @code{long double}.
22336
22337 @strong{Warning:} if you override the default value for your target ABI, this
22338 changes the size of
22339 structures and arrays containing @code{long double} variables,
22340 as well as modifying the function calling convention for functions taking
22341 @code{long double}. Hence they are not binary-compatible
22342 with code compiled without that switch.
22343
22344 @item -mlong-double-64
22345 @itemx -mlong-double-80
22346 @itemx -mlong-double-128
22347 @opindex mlong-double-64
22348 @opindex mlong-double-80
22349 @opindex mlong-double-128
22350 These switches control the size of @code{long double} type. A size
22351 of 64 bits makes the @code{long double} type equivalent to the @code{double}
22352 type. This is the default for 32-bit Bionic C library. A size
22353 of 128 bits makes the @code{long double} type equivalent to the
22354 @code{__float128} type. This is the default for 64-bit Bionic C library.
22355
22356 @strong{Warning:} if you override the default value for your target ABI, this
22357 changes the size of
22358 structures and arrays containing @code{long double} variables,
22359 as well as modifying the function calling convention for functions taking
22360 @code{long double}. Hence they are not binary-compatible
22361 with code compiled without that switch.
22362
22363 @item -malign-data=@var{type}
22364 @opindex malign-data
22365 Control how GCC aligns variables. Supported values for @var{type} are
22366 @samp{compat} uses increased alignment value compatible uses GCC 4.8
22367 and earlier, @samp{abi} uses alignment value as specified by the
22368 psABI, and @samp{cacheline} uses increased alignment value to match
22369 the cache line size. @samp{compat} is the default.
22370
22371 @item -mlarge-data-threshold=@var{threshold}
22372 @opindex mlarge-data-threshold
22373 When @option{-mcmodel=medium} is specified, data objects larger than
22374 @var{threshold} are placed in the large data section. This value must be the
22375 same across all objects linked into the binary, and defaults to 65535.
22376
22377 @item -mrtd
22378 @opindex mrtd
22379 Use a different function-calling convention, in which functions that
22380 take a fixed number of arguments return with the @code{ret @var{num}}
22381 instruction, which pops their arguments while returning. This saves one
22382 instruction in the caller since there is no need to pop the arguments
22383 there.
22384
22385 You can specify that an individual function is called with this calling
22386 sequence with the function attribute @code{stdcall}. You can also
22387 override the @option{-mrtd} option by using the function attribute
22388 @code{cdecl}. @xref{Function Attributes}.
22389
22390 @strong{Warning:} this calling convention is incompatible with the one
22391 normally used on Unix, so you cannot use it if you need to call
22392 libraries compiled with the Unix compiler.
22393
22394 Also, you must provide function prototypes for all functions that
22395 take variable numbers of arguments (including @code{printf});
22396 otherwise incorrect code is generated for calls to those
22397 functions.
22398
22399 In addition, seriously incorrect code results if you call a
22400 function with too many arguments. (Normally, extra arguments are
22401 harmlessly ignored.)
22402
22403 @item -mregparm=@var{num}
22404 @opindex mregparm
22405 Control how many registers are used to pass integer arguments. By
22406 default, no registers are used to pass arguments, and at most 3
22407 registers can be used. You can control this behavior for a specific
22408 function by using the function attribute @code{regparm}.
22409 @xref{Function Attributes}.
22410
22411 @strong{Warning:} if you use this switch, and
22412 @var{num} is nonzero, then you must build all modules with the same
22413 value, including any libraries. This includes the system libraries and
22414 startup modules.
22415
22416 @item -msseregparm
22417 @opindex msseregparm
22418 Use SSE register passing conventions for float and double arguments
22419 and return values. You can control this behavior for a specific
22420 function by using the function attribute @code{sseregparm}.
22421 @xref{Function Attributes}.
22422
22423 @strong{Warning:} if you use this switch then you must build all
22424 modules with the same value, including any libraries. This includes
22425 the system libraries and startup modules.
22426
22427 @item -mvect8-ret-in-mem
22428 @opindex mvect8-ret-in-mem
22429 Return 8-byte vectors in memory instead of MMX registers. This is the
22430 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
22431 Studio compilers until version 12. Later compiler versions (starting
22432 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
22433 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
22434 you need to remain compatible with existing code produced by those
22435 previous compiler versions or older versions of GCC@.
22436
22437 @item -mpc32
22438 @itemx -mpc64
22439 @itemx -mpc80
22440 @opindex mpc32
22441 @opindex mpc64
22442 @opindex mpc80
22443
22444 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
22445 is specified, the significands of results of floating-point operations are
22446 rounded to 24 bits (single precision); @option{-mpc64} rounds the
22447 significands of results of floating-point operations to 53 bits (double
22448 precision) and @option{-mpc80} rounds the significands of results of
22449 floating-point operations to 64 bits (extended double precision), which is
22450 the default. When this option is used, floating-point operations in higher
22451 precisions are not available to the programmer without setting the FPU
22452 control word explicitly.
22453
22454 Setting the rounding of floating-point operations to less than the default
22455 80 bits can speed some programs by 2% or more. Note that some mathematical
22456 libraries assume that extended-precision (80-bit) floating-point operations
22457 are enabled by default; routines in such libraries could suffer significant
22458 loss of accuracy, typically through so-called ``catastrophic cancellation'',
22459 when this option is used to set the precision to less than extended precision.
22460
22461 @item -mstackrealign
22462 @opindex mstackrealign
22463 Realign the stack at entry. On the x86, the @option{-mstackrealign}
22464 option generates an alternate prologue and epilogue that realigns the
22465 run-time stack if necessary. This supports mixing legacy codes that keep
22466 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
22467 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
22468 applicable to individual functions.
22469
22470 @item -mpreferred-stack-boundary=@var{num}
22471 @opindex mpreferred-stack-boundary
22472 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
22473 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
22474 the default is 4 (16 bytes or 128 bits).
22475
22476 @strong{Warning:} When generating code for the x86-64 architecture with
22477 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
22478 used to keep the stack boundary aligned to 8 byte boundary. Since
22479 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
22480 intended to be used in controlled environment where stack space is
22481 important limitation. This option leads to wrong code when functions
22482 compiled with 16 byte stack alignment (such as functions from a standard
22483 library) are called with misaligned stack. In this case, SSE
22484 instructions may lead to misaligned memory access traps. In addition,
22485 variable arguments are handled incorrectly for 16 byte aligned
22486 objects (including x87 long double and __int128), leading to wrong
22487 results. You must build all modules with
22488 @option{-mpreferred-stack-boundary=3}, including any libraries. This
22489 includes the system libraries and startup modules.
22490
22491 @item -mincoming-stack-boundary=@var{num}
22492 @opindex mincoming-stack-boundary
22493 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
22494 boundary. If @option{-mincoming-stack-boundary} is not specified,
22495 the one specified by @option{-mpreferred-stack-boundary} is used.
22496
22497 On Pentium and Pentium Pro, @code{double} and @code{long double} values
22498 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
22499 suffer significant run time performance penalties. On Pentium III, the
22500 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
22501 properly if it is not 16-byte aligned.
22502
22503 To ensure proper alignment of this values on the stack, the stack boundary
22504 must be as aligned as that required by any value stored on the stack.
22505 Further, every function must be generated such that it keeps the stack
22506 aligned. Thus calling a function compiled with a higher preferred
22507 stack boundary from a function compiled with a lower preferred stack
22508 boundary most likely misaligns the stack. It is recommended that
22509 libraries that use callbacks always use the default setting.
22510
22511 This extra alignment does consume extra stack space, and generally
22512 increases code size. Code that is sensitive to stack space usage, such
22513 as embedded systems and operating system kernels, may want to reduce the
22514 preferred alignment to @option{-mpreferred-stack-boundary=2}.
22515
22516 @need 200
22517 @item -mmmx
22518 @opindex mmmx
22519 @need 200
22520 @itemx -msse
22521 @opindex msse
22522 @need 200
22523 @itemx -msse2
22524 @need 200
22525 @itemx -msse3
22526 @need 200
22527 @itemx -mssse3
22528 @need 200
22529 @itemx -msse4
22530 @need 200
22531 @itemx -msse4a
22532 @need 200
22533 @itemx -msse4.1
22534 @need 200
22535 @itemx -msse4.2
22536 @need 200
22537 @itemx -mavx
22538 @opindex mavx
22539 @need 200
22540 @itemx -mavx2
22541 @need 200
22542 @itemx -mavx512f
22543 @need 200
22544 @itemx -mavx512pf
22545 @need 200
22546 @itemx -mavx512er
22547 @need 200
22548 @itemx -mavx512cd
22549 @need 200
22550 @itemx -msha
22551 @opindex msha
22552 @need 200
22553 @itemx -maes
22554 @opindex maes
22555 @need 200
22556 @itemx -mpclmul
22557 @opindex mpclmul
22558 @need 200
22559 @itemx -mclfushopt
22560 @opindex mclfushopt
22561 @need 200
22562 @itemx -mfsgsbase
22563 @opindex mfsgsbase
22564 @need 200
22565 @itemx -mrdrnd
22566 @opindex mrdrnd
22567 @need 200
22568 @itemx -mf16c
22569 @opindex mf16c
22570 @need 200
22571 @itemx -mfma
22572 @opindex mfma
22573 @need 200
22574 @itemx -mfma4
22575 @need 200
22576 @itemx -mno-fma4
22577 @need 200
22578 @itemx -mprefetchwt1
22579 @opindex mprefetchwt1
22580 @need 200
22581 @itemx -mxop
22582 @opindex mxop
22583 @need 200
22584 @itemx -mlwp
22585 @opindex mlwp
22586 @need 200
22587 @itemx -m3dnow
22588 @opindex m3dnow
22589 @need 200
22590 @itemx -mpopcnt
22591 @opindex mpopcnt
22592 @need 200
22593 @itemx -mabm
22594 @opindex mabm
22595 @need 200
22596 @itemx -mbmi
22597 @opindex mbmi
22598 @need 200
22599 @itemx -mbmi2
22600 @need 200
22601 @itemx -mlzcnt
22602 @opindex mlzcnt
22603 @need 200
22604 @itemx -mfxsr
22605 @opindex mfxsr
22606 @need 200
22607 @itemx -mxsave
22608 @opindex mxsave
22609 @need 200
22610 @itemx -mxsaveopt
22611 @opindex mxsaveopt
22612 @need 200
22613 @itemx -mxsavec
22614 @opindex mxsavec
22615 @need 200
22616 @itemx -mxsaves
22617 @opindex mxsaves
22618 @need 200
22619 @itemx -mrtm
22620 @opindex mrtm
22621 @need 200
22622 @itemx -mtbm
22623 @opindex mtbm
22624 @need 200
22625 @itemx -mmpx
22626 @opindex mmpx
22627 These switches enable the use of instructions in the MMX, SSE,
22628 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
22629 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
22630 BMI, BMI2, FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MPX or 3DNow!@:
22631 extended instruction sets. Each has a corresponding @option{-mno-} option
22632 to disable use of these instructions.
22633
22634 These extensions are also available as built-in functions: see
22635 @ref{x86 Built-in Functions}, for details of the functions enabled and
22636 disabled by these switches.
22637
22638 To generate SSE/SSE2 instructions automatically from floating-point
22639 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
22640
22641 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
22642 generates new AVX instructions or AVX equivalence for all SSEx instructions
22643 when needed.
22644
22645 These options enable GCC to use these extended instructions in
22646 generated code, even without @option{-mfpmath=sse}. Applications that
22647 perform run-time CPU detection must compile separate files for each
22648 supported architecture, using the appropriate flags. In particular,
22649 the file containing the CPU detection code should be compiled without
22650 these options.
22651
22652 @item -mdump-tune-features
22653 @opindex mdump-tune-features
22654 This option instructs GCC to dump the names of the x86 performance
22655 tuning features and default settings. The names can be used in
22656 @option{-mtune-ctrl=@var{feature-list}}.
22657
22658 @item -mtune-ctrl=@var{feature-list}
22659 @opindex mtune-ctrl=@var{feature-list}
22660 This option is used to do fine grain control of x86 code generation features.
22661 @var{feature-list} is a comma separated list of @var{feature} names. See also
22662 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
22663 on if it is not preceded with @samp{^}, otherwise, it is turned off.
22664 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
22665 developers. Using it may lead to code paths not covered by testing and can
22666 potentially result in compiler ICEs or runtime errors.
22667
22668 @item -mno-default
22669 @opindex mno-default
22670 This option instructs GCC to turn off all tunable features. See also
22671 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
22672
22673 @item -mcld
22674 @opindex mcld
22675 This option instructs GCC to emit a @code{cld} instruction in the prologue
22676 of functions that use string instructions. String instructions depend on
22677 the DF flag to select between autoincrement or autodecrement mode. While the
22678 ABI specifies the DF flag to be cleared on function entry, some operating
22679 systems violate this specification by not clearing the DF flag in their
22680 exception dispatchers. The exception handler can be invoked with the DF flag
22681 set, which leads to wrong direction mode when string instructions are used.
22682 This option can be enabled by default on 32-bit x86 targets by configuring
22683 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
22684 instructions can be suppressed with the @option{-mno-cld} compiler option
22685 in this case.
22686
22687 @item -mvzeroupper
22688 @opindex mvzeroupper
22689 This option instructs GCC to emit a @code{vzeroupper} instruction
22690 before a transfer of control flow out of the function to minimize
22691 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
22692 intrinsics.
22693
22694 @item -mprefer-avx128
22695 @opindex mprefer-avx128
22696 This option instructs GCC to use 128-bit AVX instructions instead of
22697 256-bit AVX instructions in the auto-vectorizer.
22698
22699 @item -mcx16
22700 @opindex mcx16
22701 This option enables GCC to generate @code{CMPXCHG16B} instructions.
22702 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
22703 (or oword) data types.
22704 This is useful for high-resolution counters that can be updated
22705 by multiple processors (or cores). This instruction is generated as part of
22706 atomic built-in functions: see @ref{__sync Builtins} or
22707 @ref{__atomic Builtins} for details.
22708
22709 @item -msahf
22710 @opindex msahf
22711 This option enables generation of @code{SAHF} instructions in 64-bit code.
22712 Early Intel Pentium 4 CPUs with Intel 64 support,
22713 prior to the introduction of Pentium 4 G1 step in December 2005,
22714 lacked the @code{LAHF} and @code{SAHF} instructions
22715 which are supported by AMD64.
22716 These are load and store instructions, respectively, for certain status flags.
22717 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
22718 @code{drem}, and @code{remainder} built-in functions;
22719 see @ref{Other Builtins} for details.
22720
22721 @item -mmovbe
22722 @opindex mmovbe
22723 This option enables use of the @code{movbe} instruction to implement
22724 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
22725
22726 @item -mcrc32
22727 @opindex mcrc32
22728 This option enables built-in functions @code{__builtin_ia32_crc32qi},
22729 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
22730 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
22731
22732 @item -mrecip
22733 @opindex mrecip
22734 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
22735 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
22736 with an additional Newton-Raphson step
22737 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
22738 (and their vectorized
22739 variants) for single-precision floating-point arguments. These instructions
22740 are generated only when @option{-funsafe-math-optimizations} is enabled
22741 together with @option{-finite-math-only} and @option{-fno-trapping-math}.
22742 Note that while the throughput of the sequence is higher than the throughput
22743 of the non-reciprocal instruction, the precision of the sequence can be
22744 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
22745
22746 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
22747 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
22748 combination), and doesn't need @option{-mrecip}.
22749
22750 Also note that GCC emits the above sequence with additional Newton-Raphson step
22751 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
22752 already with @option{-ffast-math} (or the above option combination), and
22753 doesn't need @option{-mrecip}.
22754
22755 @item -mrecip=@var{opt}
22756 @opindex mrecip=opt
22757 This option controls which reciprocal estimate instructions
22758 may be used. @var{opt} is a comma-separated list of options, which may
22759 be preceded by a @samp{!} to invert the option:
22760
22761 @table @samp
22762 @item all
22763 Enable all estimate instructions.
22764
22765 @item default
22766 Enable the default instructions, equivalent to @option{-mrecip}.
22767
22768 @item none
22769 Disable all estimate instructions, equivalent to @option{-mno-recip}.
22770
22771 @item div
22772 Enable the approximation for scalar division.
22773
22774 @item vec-div
22775 Enable the approximation for vectorized division.
22776
22777 @item sqrt
22778 Enable the approximation for scalar square root.
22779
22780 @item vec-sqrt
22781 Enable the approximation for vectorized square root.
22782 @end table
22783
22784 So, for example, @option{-mrecip=all,!sqrt} enables
22785 all of the reciprocal approximations, except for square root.
22786
22787 @item -mveclibabi=@var{type}
22788 @opindex mveclibabi
22789 Specifies the ABI type to use for vectorizing intrinsics using an
22790 external library. Supported values for @var{type} are @samp{svml}
22791 for the Intel short
22792 vector math library and @samp{acml} for the AMD math core library.
22793 To use this option, both @option{-ftree-vectorize} and
22794 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
22795 ABI-compatible library must be specified at link time.
22796
22797 GCC currently emits calls to @code{vmldExp2},
22798 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
22799 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
22800 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
22801 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
22802 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
22803 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
22804 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
22805 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
22806 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
22807 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
22808 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
22809 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
22810 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
22811 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
22812 when @option{-mveclibabi=acml} is used.
22813
22814 @item -mabi=@var{name}
22815 @opindex mabi
22816 Generate code for the specified calling convention. Permissible values
22817 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
22818 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
22819 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
22820 You can control this behavior for specific functions by
22821 using the function attributes @code{ms_abi} and @code{sysv_abi}.
22822 @xref{Function Attributes}.
22823
22824 @item -mtls-dialect=@var{type}
22825 @opindex mtls-dialect
22826 Generate code to access thread-local storage using the @samp{gnu} or
22827 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
22828 @samp{gnu2} is more efficient, but it may add compile- and run-time
22829 requirements that cannot be satisfied on all systems.
22830
22831 @item -mpush-args
22832 @itemx -mno-push-args
22833 @opindex mpush-args
22834 @opindex mno-push-args
22835 Use PUSH operations to store outgoing parameters. This method is shorter
22836 and usually equally fast as method using SUB/MOV operations and is enabled
22837 by default. In some cases disabling it may improve performance because of
22838 improved scheduling and reduced dependencies.
22839
22840 @item -maccumulate-outgoing-args
22841 @opindex maccumulate-outgoing-args
22842 If enabled, the maximum amount of space required for outgoing arguments is
22843 computed in the function prologue. This is faster on most modern CPUs
22844 because of reduced dependencies, improved scheduling and reduced stack usage
22845 when the preferred stack boundary is not equal to 2. The drawback is a notable
22846 increase in code size. This switch implies @option{-mno-push-args}.
22847
22848 @item -mthreads
22849 @opindex mthreads
22850 Support thread-safe exception handling on MinGW. Programs that rely
22851 on thread-safe exception handling must compile and link all code with the
22852 @option{-mthreads} option. When compiling, @option{-mthreads} defines
22853 @option{-D_MT}; when linking, it links in a special thread helper library
22854 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
22855
22856 @item -mno-align-stringops
22857 @opindex mno-align-stringops
22858 Do not align the destination of inlined string operations. This switch reduces
22859 code size and improves performance in case the destination is already aligned,
22860 but GCC doesn't know about it.
22861
22862 @item -minline-all-stringops
22863 @opindex minline-all-stringops
22864 By default GCC inlines string operations only when the destination is
22865 known to be aligned to least a 4-byte boundary.
22866 This enables more inlining and increases code
22867 size, but may improve performance of code that depends on fast
22868 @code{memcpy}, @code{strlen},
22869 and @code{memset} for short lengths.
22870
22871 @item -minline-stringops-dynamically
22872 @opindex minline-stringops-dynamically
22873 For string operations of unknown size, use run-time checks with
22874 inline code for small blocks and a library call for large blocks.
22875
22876 @item -mstringop-strategy=@var{alg}
22877 @opindex mstringop-strategy=@var{alg}
22878 Override the internal decision heuristic for the particular algorithm to use
22879 for inlining string operations. The allowed values for @var{alg} are:
22880
22881 @table @samp
22882 @item rep_byte
22883 @itemx rep_4byte
22884 @itemx rep_8byte
22885 Expand using i386 @code{rep} prefix of the specified size.
22886
22887 @item byte_loop
22888 @itemx loop
22889 @itemx unrolled_loop
22890 Expand into an inline loop.
22891
22892 @item libcall
22893 Always use a library call.
22894 @end table
22895
22896 @item -mmemcpy-strategy=@var{strategy}
22897 @opindex mmemcpy-strategy=@var{strategy}
22898 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
22899 should be inlined and what inline algorithm to use when the expected size
22900 of the copy operation is known. @var{strategy}
22901 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
22902 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
22903 the max byte size with which inline algorithm @var{alg} is allowed. For the last
22904 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
22905 in the list must be specified in increasing order. The minimal byte size for
22906 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
22907 preceding range.
22908
22909 @item -mmemset-strategy=@var{strategy}
22910 @opindex mmemset-strategy=@var{strategy}
22911 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
22912 @code{__builtin_memset} expansion.
22913
22914 @item -momit-leaf-frame-pointer
22915 @opindex momit-leaf-frame-pointer
22916 Don't keep the frame pointer in a register for leaf functions. This
22917 avoids the instructions to save, set up, and restore frame pointers and
22918 makes an extra register available in leaf functions. The option
22919 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
22920 which might make debugging harder.
22921
22922 @item -mtls-direct-seg-refs
22923 @itemx -mno-tls-direct-seg-refs
22924 @opindex mtls-direct-seg-refs
22925 Controls whether TLS variables may be accessed with offsets from the
22926 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
22927 or whether the thread base pointer must be added. Whether or not this
22928 is valid depends on the operating system, and whether it maps the
22929 segment to cover the entire TLS area.
22930
22931 For systems that use the GNU C Library, the default is on.
22932
22933 @item -msse2avx
22934 @itemx -mno-sse2avx
22935 @opindex msse2avx
22936 Specify that the assembler should encode SSE instructions with VEX
22937 prefix. The option @option{-mavx} turns this on by default.
22938
22939 @item -mfentry
22940 @itemx -mno-fentry
22941 @opindex mfentry
22942 If profiling is active (@option{-pg}), put the profiling
22943 counter call before the prologue.
22944 Note: On x86 architectures the attribute @code{ms_hook_prologue}
22945 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
22946
22947 @item -mrecord-mcount
22948 @itemx -mno-record-mcount
22949 @opindex mrecord-mcount
22950 If profiling is active (@option{-pg}), generate a __mcount_loc section
22951 that contains pointers to each profiling call. This is useful for
22952 automatically patching and out calls.
22953
22954 @item -mnop-mcount
22955 @itemx -mno-nop-mcount
22956 @opindex mnop-mcount
22957 If profiling is active (@option{-pg}), generate the calls to
22958 the profiling functions as nops. This is useful when they
22959 should be patched in later dynamically. This is likely only
22960 useful together with @option{-mrecord-mcount}.
22961
22962 @item -mskip-rax-setup
22963 @itemx -mno-skip-rax-setup
22964 @opindex mskip-rax-setup
22965 When generating code for the x86-64 architecture with SSE extensions
22966 disabled, @option{-skip-rax-setup} can be used to skip setting up RAX
22967 register when there are no variable arguments passed in vector registers.
22968
22969 @strong{Warning:} Since RAX register is used to avoid unnecessarily
22970 saving vector registers on stack when passing variable arguments, the
22971 impacts of this option are callees may waste some stack space,
22972 misbehave or jump to a random location. GCC 4.4 or newer don't have
22973 those issues, regardless the RAX register value.
22974
22975 @item -m8bit-idiv
22976 @itemx -mno-8bit-idiv
22977 @opindex m8bit-idiv
22978 On some processors, like Intel Atom, 8-bit unsigned integer divide is
22979 much faster than 32-bit/64-bit integer divide. This option generates a
22980 run-time check. If both dividend and divisor are within range of 0
22981 to 255, 8-bit unsigned integer divide is used instead of
22982 32-bit/64-bit integer divide.
22983
22984 @item -mavx256-split-unaligned-load
22985 @itemx -mavx256-split-unaligned-store
22986 @opindex mavx256-split-unaligned-load
22987 @opindex mavx256-split-unaligned-store
22988 Split 32-byte AVX unaligned load and store.
22989
22990 @item -mstack-protector-guard=@var{guard}
22991 @opindex mstack-protector-guard=@var{guard}
22992 Generate stack protection code using canary at @var{guard}. Supported
22993 locations are @samp{global} for global canary or @samp{tls} for per-thread
22994 canary in the TLS block (the default). This option has effect only when
22995 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
22996
22997 @end table
22998
22999 These @samp{-m} switches are supported in addition to the above
23000 on x86-64 processors in 64-bit environments.
23001
23002 @table @gcctabopt
23003 @item -m32
23004 @itemx -m64
23005 @itemx -mx32
23006 @itemx -m16
23007 @opindex m32
23008 @opindex m64
23009 @opindex mx32
23010 @opindex m16
23011 Generate code for a 16-bit, 32-bit or 64-bit environment.
23012 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
23013 to 32 bits, and
23014 generates code that runs on any i386 system.
23015
23016 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
23017 types to 64 bits, and generates code for the x86-64 architecture.
23018 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
23019 and @option{-mdynamic-no-pic} options.
23020
23021 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
23022 to 32 bits, and
23023 generates code for the x86-64 architecture.
23024
23025 The @option{-m16} option is the same as @option{-m32}, except for that
23026 it outputs the @code{.code16gcc} assembly directive at the beginning of
23027 the assembly output so that the binary can run in 16-bit mode.
23028
23029 @item -mno-red-zone
23030 @opindex mno-red-zone
23031 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
23032 by the x86-64 ABI; it is a 128-byte area beyond the location of the
23033 stack pointer that is not modified by signal or interrupt handlers
23034 and therefore can be used for temporary data without adjusting the stack
23035 pointer. The flag @option{-mno-red-zone} disables this red zone.
23036
23037 @item -mcmodel=small
23038 @opindex mcmodel=small
23039 Generate code for the small code model: the program and its symbols must
23040 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
23041 Programs can be statically or dynamically linked. This is the default
23042 code model.
23043
23044 @item -mcmodel=kernel
23045 @opindex mcmodel=kernel
23046 Generate code for the kernel code model. The kernel runs in the
23047 negative 2 GB of the address space.
23048 This model has to be used for Linux kernel code.
23049
23050 @item -mcmodel=medium
23051 @opindex mcmodel=medium
23052 Generate code for the medium model: the program is linked in the lower 2
23053 GB of the address space. Small symbols are also placed there. Symbols
23054 with sizes larger than @option{-mlarge-data-threshold} are put into
23055 large data or BSS sections and can be located above 2GB. Programs can
23056 be statically or dynamically linked.
23057
23058 @item -mcmodel=large
23059 @opindex mcmodel=large
23060 Generate code for the large model. This model makes no assumptions
23061 about addresses and sizes of sections.
23062
23063 @item -maddress-mode=long
23064 @opindex maddress-mode=long
23065 Generate code for long address mode. This is only supported for 64-bit
23066 and x32 environments. It is the default address mode for 64-bit
23067 environments.
23068
23069 @item -maddress-mode=short
23070 @opindex maddress-mode=short
23071 Generate code for short address mode. This is only supported for 32-bit
23072 and x32 environments. It is the default address mode for 32-bit and
23073 x32 environments.
23074 @end table
23075
23076 @node x86 Windows Options
23077 @subsection x86 Windows Options
23078 @cindex x86 Windows Options
23079 @cindex Windows Options for x86
23080
23081 These additional options are available for Microsoft Windows targets:
23082
23083 @table @gcctabopt
23084 @item -mconsole
23085 @opindex mconsole
23086 This option
23087 specifies that a console application is to be generated, by
23088 instructing the linker to set the PE header subsystem type
23089 required for console applications.
23090 This option is available for Cygwin and MinGW targets and is
23091 enabled by default on those targets.
23092
23093 @item -mdll
23094 @opindex mdll
23095 This option is available for Cygwin and MinGW targets. It
23096 specifies that a DLL---a dynamic link library---is to be
23097 generated, enabling the selection of the required runtime
23098 startup object and entry point.
23099
23100 @item -mnop-fun-dllimport
23101 @opindex mnop-fun-dllimport
23102 This option is available for Cygwin and MinGW targets. It
23103 specifies that the @code{dllimport} attribute should be ignored.
23104
23105 @item -mthread
23106 @opindex mthread
23107 This option is available for MinGW targets. It specifies
23108 that MinGW-specific thread support is to be used.
23109
23110 @item -municode
23111 @opindex municode
23112 This option is available for MinGW-w64 targets. It causes
23113 the @code{UNICODE} preprocessor macro to be predefined, and
23114 chooses Unicode-capable runtime startup code.
23115
23116 @item -mwin32
23117 @opindex mwin32
23118 This option is available for Cygwin and MinGW targets. It
23119 specifies that the typical Microsoft Windows predefined macros are to
23120 be set in the pre-processor, but does not influence the choice
23121 of runtime library/startup code.
23122
23123 @item -mwindows
23124 @opindex mwindows
23125 This option is available for Cygwin and MinGW targets. It
23126 specifies that a GUI application is to be generated by
23127 instructing the linker to set the PE header subsystem type
23128 appropriately.
23129
23130 @item -fno-set-stack-executable
23131 @opindex fno-set-stack-executable
23132 This option is available for MinGW targets. It specifies that
23133 the executable flag for the stack used by nested functions isn't
23134 set. This is necessary for binaries running in kernel mode of
23135 Microsoft Windows, as there the User32 API, which is used to set executable
23136 privileges, isn't available.
23137
23138 @item -fwritable-relocated-rdata
23139 @opindex fno-writable-relocated-rdata
23140 This option is available for MinGW and Cygwin targets. It specifies
23141 that relocated-data in read-only section is put into .data
23142 section. This is a necessary for older runtimes not supporting
23143 modification of .rdata sections for pseudo-relocation.
23144
23145 @item -mpe-aligned-commons
23146 @opindex mpe-aligned-commons
23147 This option is available for Cygwin and MinGW targets. It
23148 specifies that the GNU extension to the PE file format that
23149 permits the correct alignment of COMMON variables should be
23150 used when generating code. It is enabled by default if
23151 GCC detects that the target assembler found during configuration
23152 supports the feature.
23153 @end table
23154
23155 See also under @ref{x86 Options} for standard options.
23156
23157 @node Xstormy16 Options
23158 @subsection Xstormy16 Options
23159 @cindex Xstormy16 Options
23160
23161 These options are defined for Xstormy16:
23162
23163 @table @gcctabopt
23164 @item -msim
23165 @opindex msim
23166 Choose startup files and linker script suitable for the simulator.
23167 @end table
23168
23169 @node Xtensa Options
23170 @subsection Xtensa Options
23171 @cindex Xtensa Options
23172
23173 These options are supported for Xtensa targets:
23174
23175 @table @gcctabopt
23176 @item -mconst16
23177 @itemx -mno-const16
23178 @opindex mconst16
23179 @opindex mno-const16
23180 Enable or disable use of @code{CONST16} instructions for loading
23181 constant values. The @code{CONST16} instruction is currently not a
23182 standard option from Tensilica. When enabled, @code{CONST16}
23183 instructions are always used in place of the standard @code{L32R}
23184 instructions. The use of @code{CONST16} is enabled by default only if
23185 the @code{L32R} instruction is not available.
23186
23187 @item -mfused-madd
23188 @itemx -mno-fused-madd
23189 @opindex mfused-madd
23190 @opindex mno-fused-madd
23191 Enable or disable use of fused multiply/add and multiply/subtract
23192 instructions in the floating-point option. This has no effect if the
23193 floating-point option is not also enabled. Disabling fused multiply/add
23194 and multiply/subtract instructions forces the compiler to use separate
23195 instructions for the multiply and add/subtract operations. This may be
23196 desirable in some cases where strict IEEE 754-compliant results are
23197 required: the fused multiply add/subtract instructions do not round the
23198 intermediate result, thereby producing results with @emph{more} bits of
23199 precision than specified by the IEEE standard. Disabling fused multiply
23200 add/subtract instructions also ensures that the program output is not
23201 sensitive to the compiler's ability to combine multiply and add/subtract
23202 operations.
23203
23204 @item -mserialize-volatile
23205 @itemx -mno-serialize-volatile
23206 @opindex mserialize-volatile
23207 @opindex mno-serialize-volatile
23208 When this option is enabled, GCC inserts @code{MEMW} instructions before
23209 @code{volatile} memory references to guarantee sequential consistency.
23210 The default is @option{-mserialize-volatile}. Use
23211 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
23212
23213 @item -mforce-no-pic
23214 @opindex mforce-no-pic
23215 For targets, like GNU/Linux, where all user-mode Xtensa code must be
23216 position-independent code (PIC), this option disables PIC for compiling
23217 kernel code.
23218
23219 @item -mtext-section-literals
23220 @itemx -mno-text-section-literals
23221 @opindex mtext-section-literals
23222 @opindex mno-text-section-literals
23223 These options control the treatment of literal pools. The default is
23224 @option{-mno-text-section-literals}, which places literals in a separate
23225 section in the output file. This allows the literal pool to be placed
23226 in a data RAM/ROM, and it also allows the linker to combine literal
23227 pools from separate object files to remove redundant literals and
23228 improve code size. With @option{-mtext-section-literals}, the literals
23229 are interspersed in the text section in order to keep them as close as
23230 possible to their references. This may be necessary for large assembly
23231 files.
23232
23233 @item -mtarget-align
23234 @itemx -mno-target-align
23235 @opindex mtarget-align
23236 @opindex mno-target-align
23237 When this option is enabled, GCC instructs the assembler to
23238 automatically align instructions to reduce branch penalties at the
23239 expense of some code density. The assembler attempts to widen density
23240 instructions to align branch targets and the instructions following call
23241 instructions. If there are not enough preceding safe density
23242 instructions to align a target, no widening is performed. The
23243 default is @option{-mtarget-align}. These options do not affect the
23244 treatment of auto-aligned instructions like @code{LOOP}, which the
23245 assembler always aligns, either by widening density instructions or
23246 by inserting NOP instructions.
23247
23248 @item -mlongcalls
23249 @itemx -mno-longcalls
23250 @opindex mlongcalls
23251 @opindex mno-longcalls
23252 When this option is enabled, GCC instructs the assembler to translate
23253 direct calls to indirect calls unless it can determine that the target
23254 of a direct call is in the range allowed by the call instruction. This
23255 translation typically occurs for calls to functions in other source
23256 files. Specifically, the assembler translates a direct @code{CALL}
23257 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
23258 The default is @option{-mno-longcalls}. This option should be used in
23259 programs where the call target can potentially be out of range. This
23260 option is implemented in the assembler, not the compiler, so the
23261 assembly code generated by GCC still shows direct call
23262 instructions---look at the disassembled object code to see the actual
23263 instructions. Note that the assembler uses an indirect call for
23264 every cross-file call, not just those that really are out of range.
23265 @end table
23266
23267 @node zSeries Options
23268 @subsection zSeries Options
23269 @cindex zSeries options
23270
23271 These are listed under @xref{S/390 and zSeries Options}.
23272
23273 @node Code Gen Options
23274 @section Options for Code Generation Conventions
23275 @cindex code generation conventions
23276 @cindex options, code generation
23277 @cindex run-time options
23278
23279 These machine-independent options control the interface conventions
23280 used in code generation.
23281
23282 Most of them have both positive and negative forms; the negative form
23283 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
23284 one of the forms is listed---the one that is not the default. You
23285 can figure out the other form by either removing @samp{no-} or adding
23286 it.
23287
23288 @table @gcctabopt
23289 @item -fbounds-check
23290 @opindex fbounds-check
23291 For front ends that support it, generate additional code to check that
23292 indices used to access arrays are within the declared range. This is
23293 currently only supported by the Java and Fortran front ends, where
23294 this option defaults to true and false respectively.
23295
23296 @item -fstack-reuse=@var{reuse-level}
23297 @opindex fstack_reuse
23298 This option controls stack space reuse for user declared local/auto variables
23299 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
23300 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
23301 local variables and temporaries, @samp{named_vars} enables the reuse only for
23302 user defined local variables with names, and @samp{none} disables stack reuse
23303 completely. The default value is @samp{all}. The option is needed when the
23304 program extends the lifetime of a scoped local variable or a compiler generated
23305 temporary beyond the end point defined by the language. When a lifetime of
23306 a variable ends, and if the variable lives in memory, the optimizing compiler
23307 has the freedom to reuse its stack space with other temporaries or scoped
23308 local variables whose live range does not overlap with it. Legacy code extending
23309 local lifetime is likely to break with the stack reuse optimization.
23310
23311 For example,
23312
23313 @smallexample
23314 int *p;
23315 @{
23316 int local1;
23317
23318 p = &local1;
23319 local1 = 10;
23320 ....
23321 @}
23322 @{
23323 int local2;
23324 local2 = 20;
23325 ...
23326 @}
23327
23328 if (*p == 10) // out of scope use of local1
23329 @{
23330
23331 @}
23332 @end smallexample
23333
23334 Another example:
23335 @smallexample
23336
23337 struct A
23338 @{
23339 A(int k) : i(k), j(k) @{ @}
23340 int i;
23341 int j;
23342 @};
23343
23344 A *ap;
23345
23346 void foo(const A& ar)
23347 @{
23348 ap = &ar;
23349 @}
23350
23351 void bar()
23352 @{
23353 foo(A(10)); // temp object's lifetime ends when foo returns
23354
23355 @{
23356 A a(20);
23357 ....
23358 @}
23359 ap->i+= 10; // ap references out of scope temp whose space
23360 // is reused with a. What is the value of ap->i?
23361 @}
23362
23363 @end smallexample
23364
23365 The lifetime of a compiler generated temporary is well defined by the C++
23366 standard. When a lifetime of a temporary ends, and if the temporary lives
23367 in memory, the optimizing compiler has the freedom to reuse its stack
23368 space with other temporaries or scoped local variables whose live range
23369 does not overlap with it. However some of the legacy code relies on
23370 the behavior of older compilers in which temporaries' stack space is
23371 not reused, the aggressive stack reuse can lead to runtime errors. This
23372 option is used to control the temporary stack reuse optimization.
23373
23374 @item -ftrapv
23375 @opindex ftrapv
23376 This option generates traps for signed overflow on addition, subtraction,
23377 multiplication operations.
23378
23379 @item -fwrapv
23380 @opindex fwrapv
23381 This option instructs the compiler to assume that signed arithmetic
23382 overflow of addition, subtraction and multiplication wraps around
23383 using twos-complement representation. This flag enables some optimizations
23384 and disables others. This option is enabled by default for the Java
23385 front end, as required by the Java language specification.
23386
23387 @item -fexceptions
23388 @opindex fexceptions
23389 Enable exception handling. Generates extra code needed to propagate
23390 exceptions. For some targets, this implies GCC generates frame
23391 unwind information for all functions, which can produce significant data
23392 size overhead, although it does not affect execution. If you do not
23393 specify this option, GCC enables it by default for languages like
23394 C++ that normally require exception handling, and disables it for
23395 languages like C that do not normally require it. However, you may need
23396 to enable this option when compiling C code that needs to interoperate
23397 properly with exception handlers written in C++. You may also wish to
23398 disable this option if you are compiling older C++ programs that don't
23399 use exception handling.
23400
23401 @item -fnon-call-exceptions
23402 @opindex fnon-call-exceptions
23403 Generate code that allows trapping instructions to throw exceptions.
23404 Note that this requires platform-specific runtime support that does
23405 not exist everywhere. Moreover, it only allows @emph{trapping}
23406 instructions to throw exceptions, i.e.@: memory references or floating-point
23407 instructions. It does not allow exceptions to be thrown from
23408 arbitrary signal handlers such as @code{SIGALRM}.
23409
23410 @item -fdelete-dead-exceptions
23411 @opindex fdelete-dead-exceptions
23412 Consider that instructions that may throw exceptions but don't otherwise
23413 contribute to the execution of the program can be optimized away.
23414 This option is enabled by default for the Ada front end, as permitted by
23415 the Ada language specification.
23416 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
23417
23418 @item -funwind-tables
23419 @opindex funwind-tables
23420 Similar to @option{-fexceptions}, except that it just generates any needed
23421 static data, but does not affect the generated code in any other way.
23422 You normally do not need to enable this option; instead, a language processor
23423 that needs this handling enables it on your behalf.
23424
23425 @item -fasynchronous-unwind-tables
23426 @opindex fasynchronous-unwind-tables
23427 Generate unwind table in DWARF 2 format, if supported by target machine. The
23428 table is exact at each instruction boundary, so it can be used for stack
23429 unwinding from asynchronous events (such as debugger or garbage collector).
23430
23431 @item -fno-gnu-unique
23432 @opindex fno-gnu-unique
23433 On systems with recent GNU assembler and C library, the C++ compiler
23434 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
23435 of template static data members and static local variables in inline
23436 functions are unique even in the presence of @code{RTLD_LOCAL}; this
23437 is necessary to avoid problems with a library used by two different
23438 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
23439 therefore disagreeing with the other one about the binding of the
23440 symbol. But this causes @code{dlclose} to be ignored for affected
23441 DSOs; if your program relies on reinitialization of a DSO via
23442 @code{dlclose} and @code{dlopen}, you can use
23443 @option{-fno-gnu-unique}.
23444
23445 @item -fpcc-struct-return
23446 @opindex fpcc-struct-return
23447 Return ``short'' @code{struct} and @code{union} values in memory like
23448 longer ones, rather than in registers. This convention is less
23449 efficient, but it has the advantage of allowing intercallability between
23450 GCC-compiled files and files compiled with other compilers, particularly
23451 the Portable C Compiler (pcc).
23452
23453 The precise convention for returning structures in memory depends
23454 on the target configuration macros.
23455
23456 Short structures and unions are those whose size and alignment match
23457 that of some integer type.
23458
23459 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
23460 switch is not binary compatible with code compiled with the
23461 @option{-freg-struct-return} switch.
23462 Use it to conform to a non-default application binary interface.
23463
23464 @item -freg-struct-return
23465 @opindex freg-struct-return
23466 Return @code{struct} and @code{union} values in registers when possible.
23467 This is more efficient for small structures than
23468 @option{-fpcc-struct-return}.
23469
23470 If you specify neither @option{-fpcc-struct-return} nor
23471 @option{-freg-struct-return}, GCC defaults to whichever convention is
23472 standard for the target. If there is no standard convention, GCC
23473 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
23474 the principal compiler. In those cases, we can choose the standard, and
23475 we chose the more efficient register return alternative.
23476
23477 @strong{Warning:} code compiled with the @option{-freg-struct-return}
23478 switch is not binary compatible with code compiled with the
23479 @option{-fpcc-struct-return} switch.
23480 Use it to conform to a non-default application binary interface.
23481
23482 @item -fshort-enums
23483 @opindex fshort-enums
23484 Allocate to an @code{enum} type only as many bytes as it needs for the
23485 declared range of possible values. Specifically, the @code{enum} type
23486 is equivalent to the smallest integer type that has enough room.
23487
23488 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
23489 code that is not binary compatible with code generated without that switch.
23490 Use it to conform to a non-default application binary interface.
23491
23492 @item -fshort-double
23493 @opindex fshort-double
23494 Use the same size for @code{double} as for @code{float}.
23495
23496 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
23497 code that is not binary compatible with code generated without that switch.
23498 Use it to conform to a non-default application binary interface.
23499
23500 @item -fshort-wchar
23501 @opindex fshort-wchar
23502 Override the underlying type for @code{wchar_t} to be @code{short
23503 unsigned int} instead of the default for the target. This option is
23504 useful for building programs to run under WINE@.
23505
23506 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
23507 code that is not binary compatible with code generated without that switch.
23508 Use it to conform to a non-default application binary interface.
23509
23510 @item -fno-common
23511 @opindex fno-common
23512 In C code, controls the placement of uninitialized global variables.
23513 Unix C compilers have traditionally permitted multiple definitions of
23514 such variables in different compilation units by placing the variables
23515 in a common block.
23516 This is the behavior specified by @option{-fcommon}, and is the default
23517 for GCC on most targets.
23518 On the other hand, this behavior is not required by ISO C, and on some
23519 targets may carry a speed or code size penalty on variable references.
23520 The @option{-fno-common} option specifies that the compiler should place
23521 uninitialized global variables in the data section of the object file,
23522 rather than generating them as common blocks.
23523 This has the effect that if the same variable is declared
23524 (without @code{extern}) in two different compilations,
23525 you get a multiple-definition error when you link them.
23526 In this case, you must compile with @option{-fcommon} instead.
23527 Compiling with @option{-fno-common} is useful on targets for which
23528 it provides better performance, or if you wish to verify that the
23529 program will work on other systems that always treat uninitialized
23530 variable declarations this way.
23531
23532 @item -fno-ident
23533 @opindex fno-ident
23534 Ignore the @code{#ident} directive.
23535
23536 @item -finhibit-size-directive
23537 @opindex finhibit-size-directive
23538 Don't output a @code{.size} assembler directive, or anything else that
23539 would cause trouble if the function is split in the middle, and the
23540 two halves are placed at locations far apart in memory. This option is
23541 used when compiling @file{crtstuff.c}; you should not need to use it
23542 for anything else.
23543
23544 @item -fverbose-asm
23545 @opindex fverbose-asm
23546 Put extra commentary information in the generated assembly code to
23547 make it more readable. This option is generally only of use to those
23548 who actually need to read the generated assembly code (perhaps while
23549 debugging the compiler itself).
23550
23551 @option{-fno-verbose-asm}, the default, causes the
23552 extra information to be omitted and is useful when comparing two assembler
23553 files.
23554
23555 @item -frecord-gcc-switches
23556 @opindex frecord-gcc-switches
23557 This switch causes the command line used to invoke the
23558 compiler to be recorded into the object file that is being created.
23559 This switch is only implemented on some targets and the exact format
23560 of the recording is target and binary file format dependent, but it
23561 usually takes the form of a section containing ASCII text. This
23562 switch is related to the @option{-fverbose-asm} switch, but that
23563 switch only records information in the assembler output file as
23564 comments, so it never reaches the object file.
23565 See also @option{-grecord-gcc-switches} for another
23566 way of storing compiler options into the object file.
23567
23568 @item -fpic
23569 @opindex fpic
23570 @cindex global offset table
23571 @cindex PIC
23572 Generate position-independent code (PIC) suitable for use in a shared
23573 library, if supported for the target machine. Such code accesses all
23574 constant addresses through a global offset table (GOT)@. The dynamic
23575 loader resolves the GOT entries when the program starts (the dynamic
23576 loader is not part of GCC; it is part of the operating system). If
23577 the GOT size for the linked executable exceeds a machine-specific
23578 maximum size, you get an error message from the linker indicating that
23579 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
23580 instead. (These maximums are 8k on the SPARC and 32k
23581 on the m68k and RS/6000. The x86 has no such limit.)
23582
23583 Position-independent code requires special support, and therefore works
23584 only on certain machines. For the x86, GCC supports PIC for System V
23585 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
23586 position-independent.
23587
23588 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
23589 are defined to 1.
23590
23591 @item -fPIC
23592 @opindex fPIC
23593 If supported for the target machine, emit position-independent code,
23594 suitable for dynamic linking and avoiding any limit on the size of the
23595 global offset table. This option makes a difference on the m68k,
23596 PowerPC and SPARC@.
23597
23598 Position-independent code requires special support, and therefore works
23599 only on certain machines.
23600
23601 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
23602 are defined to 2.
23603
23604 @item -fpie
23605 @itemx -fPIE
23606 @opindex fpie
23607 @opindex fPIE
23608 These options are similar to @option{-fpic} and @option{-fPIC}, but
23609 generated position independent code can be only linked into executables.
23610 Usually these options are used when @option{-pie} GCC option is
23611 used during linking.
23612
23613 @option{-fpie} and @option{-fPIE} both define the macros
23614 @code{__pie__} and @code{__PIE__}. The macros have the value 1
23615 for @option{-fpie} and 2 for @option{-fPIE}.
23616
23617 @item -fno-jump-tables
23618 @opindex fno-jump-tables
23619 Do not use jump tables for switch statements even where it would be
23620 more efficient than other code generation strategies. This option is
23621 of use in conjunction with @option{-fpic} or @option{-fPIC} for
23622 building code that forms part of a dynamic linker and cannot
23623 reference the address of a jump table. On some targets, jump tables
23624 do not require a GOT and this option is not needed.
23625
23626 @item -ffixed-@var{reg}
23627 @opindex ffixed
23628 Treat the register named @var{reg} as a fixed register; generated code
23629 should never refer to it (except perhaps as a stack pointer, frame
23630 pointer or in some other fixed role).
23631
23632 @var{reg} must be the name of a register. The register names accepted
23633 are machine-specific and are defined in the @code{REGISTER_NAMES}
23634 macro in the machine description macro file.
23635
23636 This flag does not have a negative form, because it specifies a
23637 three-way choice.
23638
23639 @item -fcall-used-@var{reg}
23640 @opindex fcall-used
23641 Treat the register named @var{reg} as an allocable register that is
23642 clobbered by function calls. It may be allocated for temporaries or
23643 variables that do not live across a call. Functions compiled this way
23644 do not save and restore the register @var{reg}.
23645
23646 It is an error to use this flag with the frame pointer or stack pointer.
23647 Use of this flag for other registers that have fixed pervasive roles in
23648 the machine's execution model produces disastrous results.
23649
23650 This flag does not have a negative form, because it specifies a
23651 three-way choice.
23652
23653 @item -fcall-saved-@var{reg}
23654 @opindex fcall-saved
23655 Treat the register named @var{reg} as an allocable register saved by
23656 functions. It may be allocated even for temporaries or variables that
23657 live across a call. Functions compiled this way save and restore
23658 the register @var{reg} if they use it.
23659
23660 It is an error to use this flag with the frame pointer or stack pointer.
23661 Use of this flag for other registers that have fixed pervasive roles in
23662 the machine's execution model produces disastrous results.
23663
23664 A different sort of disaster results from the use of this flag for
23665 a register in which function values may be returned.
23666
23667 This flag does not have a negative form, because it specifies a
23668 three-way choice.
23669
23670 @item -fpack-struct[=@var{n}]
23671 @opindex fpack-struct
23672 Without a value specified, pack all structure members together without
23673 holes. When a value is specified (which must be a small power of two), pack
23674 structure members according to this value, representing the maximum
23675 alignment (that is, objects with default alignment requirements larger than
23676 this are output potentially unaligned at the next fitting location.
23677
23678 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
23679 code that is not binary compatible with code generated without that switch.
23680 Additionally, it makes the code suboptimal.
23681 Use it to conform to a non-default application binary interface.
23682
23683 @item -finstrument-functions
23684 @opindex finstrument-functions
23685 Generate instrumentation calls for entry and exit to functions. Just
23686 after function entry and just before function exit, the following
23687 profiling functions are called with the address of the current
23688 function and its call site. (On some platforms,
23689 @code{__builtin_return_address} does not work beyond the current
23690 function, so the call site information may not be available to the
23691 profiling functions otherwise.)
23692
23693 @smallexample
23694 void __cyg_profile_func_enter (void *this_fn,
23695 void *call_site);
23696 void __cyg_profile_func_exit (void *this_fn,
23697 void *call_site);
23698 @end smallexample
23699
23700 The first argument is the address of the start of the current function,
23701 which may be looked up exactly in the symbol table.
23702
23703 This instrumentation is also done for functions expanded inline in other
23704 functions. The profiling calls indicate where, conceptually, the
23705 inline function is entered and exited. This means that addressable
23706 versions of such functions must be available. If all your uses of a
23707 function are expanded inline, this may mean an additional expansion of
23708 code size. If you use @code{extern inline} in your C code, an
23709 addressable version of such functions must be provided. (This is
23710 normally the case anyway, but if you get lucky and the optimizer always
23711 expands the functions inline, you might have gotten away without
23712 providing static copies.)
23713
23714 A function may be given the attribute @code{no_instrument_function}, in
23715 which case this instrumentation is not done. This can be used, for
23716 example, for the profiling functions listed above, high-priority
23717 interrupt routines, and any functions from which the profiling functions
23718 cannot safely be called (perhaps signal handlers, if the profiling
23719 routines generate output or allocate memory).
23720
23721 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
23722 @opindex finstrument-functions-exclude-file-list
23723
23724 Set the list of functions that are excluded from instrumentation (see
23725 the description of @option{-finstrument-functions}). If the file that
23726 contains a function definition matches with one of @var{file}, then
23727 that function is not instrumented. The match is done on substrings:
23728 if the @var{file} parameter is a substring of the file name, it is
23729 considered to be a match.
23730
23731 For example:
23732
23733 @smallexample
23734 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
23735 @end smallexample
23736
23737 @noindent
23738 excludes any inline function defined in files whose pathnames
23739 contain @file{/bits/stl} or @file{include/sys}.
23740
23741 If, for some reason, you want to include letter @samp{,} in one of
23742 @var{sym}, write @samp{\,}. For example,
23743 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
23744 (note the single quote surrounding the option).
23745
23746 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
23747 @opindex finstrument-functions-exclude-function-list
23748
23749 This is similar to @option{-finstrument-functions-exclude-file-list},
23750 but this option sets the list of function names to be excluded from
23751 instrumentation. The function name to be matched is its user-visible
23752 name, such as @code{vector<int> blah(const vector<int> &)}, not the
23753 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
23754 match is done on substrings: if the @var{sym} parameter is a substring
23755 of the function name, it is considered to be a match. For C99 and C++
23756 extended identifiers, the function name must be given in UTF-8, not
23757 using universal character names.
23758
23759 @item -fstack-check
23760 @opindex fstack-check
23761 Generate code to verify that you do not go beyond the boundary of the
23762 stack. You should specify this flag if you are running in an
23763 environment with multiple threads, but you only rarely need to specify it in
23764 a single-threaded environment since stack overflow is automatically
23765 detected on nearly all systems if there is only one stack.
23766
23767 Note that this switch does not actually cause checking to be done; the
23768 operating system or the language runtime must do that. The switch causes
23769 generation of code to ensure that they see the stack being extended.
23770
23771 You can additionally specify a string parameter: @samp{no} means no
23772 checking, @samp{generic} means force the use of old-style checking,
23773 @samp{specific} means use the best checking method and is equivalent
23774 to bare @option{-fstack-check}.
23775
23776 Old-style checking is a generic mechanism that requires no specific
23777 target support in the compiler but comes with the following drawbacks:
23778
23779 @enumerate
23780 @item
23781 Modified allocation strategy for large objects: they are always
23782 allocated dynamically if their size exceeds a fixed threshold.
23783
23784 @item
23785 Fixed limit on the size of the static frame of functions: when it is
23786 topped by a particular function, stack checking is not reliable and
23787 a warning is issued by the compiler.
23788
23789 @item
23790 Inefficiency: because of both the modified allocation strategy and the
23791 generic implementation, code performance is hampered.
23792 @end enumerate
23793
23794 Note that old-style stack checking is also the fallback method for
23795 @samp{specific} if no target support has been added in the compiler.
23796
23797 @item -fstack-limit-register=@var{reg}
23798 @itemx -fstack-limit-symbol=@var{sym}
23799 @itemx -fno-stack-limit
23800 @opindex fstack-limit-register
23801 @opindex fstack-limit-symbol
23802 @opindex fno-stack-limit
23803 Generate code to ensure that the stack does not grow beyond a certain value,
23804 either the value of a register or the address of a symbol. If a larger
23805 stack is required, a signal is raised at run time. For most targets,
23806 the signal is raised before the stack overruns the boundary, so
23807 it is possible to catch the signal without taking special precautions.
23808
23809 For instance, if the stack starts at absolute address @samp{0x80000000}
23810 and grows downwards, you can use the flags
23811 @option{-fstack-limit-symbol=__stack_limit} and
23812 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
23813 of 128KB@. Note that this may only work with the GNU linker.
23814
23815 @item -fsplit-stack
23816 @opindex fsplit-stack
23817 Generate code to automatically split the stack before it overflows.
23818 The resulting program has a discontiguous stack which can only
23819 overflow if the program is unable to allocate any more memory. This
23820 is most useful when running threaded programs, as it is no longer
23821 necessary to calculate a good stack size to use for each thread. This
23822 is currently only implemented for the x86 targets running
23823 GNU/Linux.
23824
23825 When code compiled with @option{-fsplit-stack} calls code compiled
23826 without @option{-fsplit-stack}, there may not be much stack space
23827 available for the latter code to run. If compiling all code,
23828 including library code, with @option{-fsplit-stack} is not an option,
23829 then the linker can fix up these calls so that the code compiled
23830 without @option{-fsplit-stack} always has a large stack. Support for
23831 this is implemented in the gold linker in GNU binutils release 2.21
23832 and later.
23833
23834 @item -fleading-underscore
23835 @opindex fleading-underscore
23836 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
23837 change the way C symbols are represented in the object file. One use
23838 is to help link with legacy assembly code.
23839
23840 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
23841 generate code that is not binary compatible with code generated without that
23842 switch. Use it to conform to a non-default application binary interface.
23843 Not all targets provide complete support for this switch.
23844
23845 @item -ftls-model=@var{model}
23846 @opindex ftls-model
23847 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
23848 The @var{model} argument should be one of @samp{global-dynamic},
23849 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
23850 Note that the choice is subject to optimization: the compiler may use
23851 a more efficient model for symbols not visible outside of the translation
23852 unit, or if @option{-fpic} is not given on the command line.
23853
23854 The default without @option{-fpic} is @samp{initial-exec}; with
23855 @option{-fpic} the default is @samp{global-dynamic}.
23856
23857 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
23858 @opindex fvisibility
23859 Set the default ELF image symbol visibility to the specified option---all
23860 symbols are marked with this unless overridden within the code.
23861 Using this feature can very substantially improve linking and
23862 load times of shared object libraries, produce more optimized
23863 code, provide near-perfect API export and prevent symbol clashes.
23864 It is @strong{strongly} recommended that you use this in any shared objects
23865 you distribute.
23866
23867 Despite the nomenclature, @samp{default} always means public; i.e.,
23868 available to be linked against from outside the shared object.
23869 @samp{protected} and @samp{internal} are pretty useless in real-world
23870 usage so the only other commonly used option is @samp{hidden}.
23871 The default if @option{-fvisibility} isn't specified is
23872 @samp{default}, i.e., make every symbol public.
23873
23874 A good explanation of the benefits offered by ensuring ELF
23875 symbols have the correct visibility is given by ``How To Write
23876 Shared Libraries'' by Ulrich Drepper (which can be found at
23877 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
23878 solution made possible by this option to marking things hidden when
23879 the default is public is to make the default hidden and mark things
23880 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
23881 and @code{__attribute__ ((visibility("default")))} instead of
23882 @code{__declspec(dllexport)} you get almost identical semantics with
23883 identical syntax. This is a great boon to those working with
23884 cross-platform projects.
23885
23886 For those adding visibility support to existing code, you may find
23887 @code{#pragma GCC visibility} of use. This works by you enclosing
23888 the declarations you wish to set visibility for with (for example)
23889 @code{#pragma GCC visibility push(hidden)} and
23890 @code{#pragma GCC visibility pop}.
23891 Bear in mind that symbol visibility should be viewed @strong{as
23892 part of the API interface contract} and thus all new code should
23893 always specify visibility when it is not the default; i.e., declarations
23894 only for use within the local DSO should @strong{always} be marked explicitly
23895 as hidden as so to avoid PLT indirection overheads---making this
23896 abundantly clear also aids readability and self-documentation of the code.
23897 Note that due to ISO C++ specification requirements, @code{operator new} and
23898 @code{operator delete} must always be of default visibility.
23899
23900 Be aware that headers from outside your project, in particular system
23901 headers and headers from any other library you use, may not be
23902 expecting to be compiled with visibility other than the default. You
23903 may need to explicitly say @code{#pragma GCC visibility push(default)}
23904 before including any such headers.
23905
23906 @code{extern} declarations are not affected by @option{-fvisibility}, so
23907 a lot of code can be recompiled with @option{-fvisibility=hidden} with
23908 no modifications. However, this means that calls to @code{extern}
23909 functions with no explicit visibility use the PLT, so it is more
23910 effective to use @code{__attribute ((visibility))} and/or
23911 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
23912 declarations should be treated as hidden.
23913
23914 Note that @option{-fvisibility} does affect C++ vague linkage
23915 entities. This means that, for instance, an exception class that is
23916 be thrown between DSOs must be explicitly marked with default
23917 visibility so that the @samp{type_info} nodes are unified between
23918 the DSOs.
23919
23920 An overview of these techniques, their benefits and how to use them
23921 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
23922
23923 @item -fstrict-volatile-bitfields
23924 @opindex fstrict-volatile-bitfields
23925 This option should be used if accesses to volatile bit-fields (or other
23926 structure fields, although the compiler usually honors those types
23927 anyway) should use a single access of the width of the
23928 field's type, aligned to a natural alignment if possible. For
23929 example, targets with memory-mapped peripheral registers might require
23930 all such accesses to be 16 bits wide; with this flag you can
23931 declare all peripheral bit-fields as @code{unsigned short} (assuming short
23932 is 16 bits on these targets) to force GCC to use 16-bit accesses
23933 instead of, perhaps, a more efficient 32-bit access.
23934
23935 If this option is disabled, the compiler uses the most efficient
23936 instruction. In the previous example, that might be a 32-bit load
23937 instruction, even though that accesses bytes that do not contain
23938 any portion of the bit-field, or memory-mapped registers unrelated to
23939 the one being updated.
23940
23941 In some cases, such as when the @code{packed} attribute is applied to a
23942 structure field, it may not be possible to access the field with a single
23943 read or write that is correctly aligned for the target machine. In this
23944 case GCC falls back to generating multiple accesses rather than code that
23945 will fault or truncate the result at run time.
23946
23947 Note: Due to restrictions of the C/C++11 memory model, write accesses are
23948 not allowed to touch non bit-field members. It is therefore recommended
23949 to define all bits of the field's type as bit-field members.
23950
23951 The default value of this option is determined by the application binary
23952 interface for the target processor.
23953
23954 @item -fsync-libcalls
23955 @opindex fsync-libcalls
23956 This option controls whether any out-of-line instance of the @code{__sync}
23957 family of functions may be used to implement the C++11 @code{__atomic}
23958 family of functions.
23959
23960 The default value of this option is enabled, thus the only useful form
23961 of the option is @option{-fno-sync-libcalls}. This option is used in
23962 the implementation of the @file{libatomic} runtime library.
23963
23964 @end table
23965
23966 @c man end
23967
23968 @node Environment Variables
23969 @section Environment Variables Affecting GCC
23970 @cindex environment variables
23971
23972 @c man begin ENVIRONMENT
23973 This section describes several environment variables that affect how GCC
23974 operates. Some of them work by specifying directories or prefixes to use
23975 when searching for various kinds of files. Some are used to specify other
23976 aspects of the compilation environment.
23977
23978 Note that you can also specify places to search using options such as
23979 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
23980 take precedence over places specified using environment variables, which
23981 in turn take precedence over those specified by the configuration of GCC@.
23982 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
23983 GNU Compiler Collection (GCC) Internals}.
23984
23985 @table @env
23986 @item LANG
23987 @itemx LC_CTYPE
23988 @c @itemx LC_COLLATE
23989 @itemx LC_MESSAGES
23990 @c @itemx LC_MONETARY
23991 @c @itemx LC_NUMERIC
23992 @c @itemx LC_TIME
23993 @itemx LC_ALL
23994 @findex LANG
23995 @findex LC_CTYPE
23996 @c @findex LC_COLLATE
23997 @findex LC_MESSAGES
23998 @c @findex LC_MONETARY
23999 @c @findex LC_NUMERIC
24000 @c @findex LC_TIME
24001 @findex LC_ALL
24002 @cindex locale
24003 These environment variables control the way that GCC uses
24004 localization information which allows GCC to work with different
24005 national conventions. GCC inspects the locale categories
24006 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
24007 so. These locale categories can be set to any value supported by your
24008 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
24009 Kingdom encoded in UTF-8.
24010
24011 The @env{LC_CTYPE} environment variable specifies character
24012 classification. GCC uses it to determine the character boundaries in
24013 a string; this is needed for some multibyte encodings that contain quote
24014 and escape characters that are otherwise interpreted as a string
24015 end or escape.
24016
24017 The @env{LC_MESSAGES} environment variable specifies the language to
24018 use in diagnostic messages.
24019
24020 If the @env{LC_ALL} environment variable is set, it overrides the value
24021 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
24022 and @env{LC_MESSAGES} default to the value of the @env{LANG}
24023 environment variable. If none of these variables are set, GCC
24024 defaults to traditional C English behavior.
24025
24026 @item TMPDIR
24027 @findex TMPDIR
24028 If @env{TMPDIR} is set, it specifies the directory to use for temporary
24029 files. GCC uses temporary files to hold the output of one stage of
24030 compilation which is to be used as input to the next stage: for example,
24031 the output of the preprocessor, which is the input to the compiler
24032 proper.
24033
24034 @item GCC_COMPARE_DEBUG
24035 @findex GCC_COMPARE_DEBUG
24036 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
24037 @option{-fcompare-debug} to the compiler driver. See the documentation
24038 of this option for more details.
24039
24040 @item GCC_EXEC_PREFIX
24041 @findex GCC_EXEC_PREFIX
24042 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
24043 names of the subprograms executed by the compiler. No slash is added
24044 when this prefix is combined with the name of a subprogram, but you can
24045 specify a prefix that ends with a slash if you wish.
24046
24047 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
24048 an appropriate prefix to use based on the pathname it is invoked with.
24049
24050 If GCC cannot find the subprogram using the specified prefix, it
24051 tries looking in the usual places for the subprogram.
24052
24053 The default value of @env{GCC_EXEC_PREFIX} is
24054 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
24055 the installed compiler. In many cases @var{prefix} is the value
24056 of @code{prefix} when you ran the @file{configure} script.
24057
24058 Other prefixes specified with @option{-B} take precedence over this prefix.
24059
24060 This prefix is also used for finding files such as @file{crt0.o} that are
24061 used for linking.
24062
24063 In addition, the prefix is used in an unusual way in finding the
24064 directories to search for header files. For each of the standard
24065 directories whose name normally begins with @samp{/usr/local/lib/gcc}
24066 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
24067 replacing that beginning with the specified prefix to produce an
24068 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
24069 @file{foo/bar} just before it searches the standard directory
24070 @file{/usr/local/lib/bar}.
24071 If a standard directory begins with the configured
24072 @var{prefix} then the value of @var{prefix} is replaced by
24073 @env{GCC_EXEC_PREFIX} when looking for header files.
24074
24075 @item COMPILER_PATH
24076 @findex COMPILER_PATH
24077 The value of @env{COMPILER_PATH} is a colon-separated list of
24078 directories, much like @env{PATH}. GCC tries the directories thus
24079 specified when searching for subprograms, if it can't find the
24080 subprograms using @env{GCC_EXEC_PREFIX}.
24081
24082 @item LIBRARY_PATH
24083 @findex LIBRARY_PATH
24084 The value of @env{LIBRARY_PATH} is a colon-separated list of
24085 directories, much like @env{PATH}. When configured as a native compiler,
24086 GCC tries the directories thus specified when searching for special
24087 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
24088 using GCC also uses these directories when searching for ordinary
24089 libraries for the @option{-l} option (but directories specified with
24090 @option{-L} come first).
24091
24092 @item LANG
24093 @findex LANG
24094 @cindex locale definition
24095 This variable is used to pass locale information to the compiler. One way in
24096 which this information is used is to determine the character set to be used
24097 when character literals, string literals and comments are parsed in C and C++.
24098 When the compiler is configured to allow multibyte characters,
24099 the following values for @env{LANG} are recognized:
24100
24101 @table @samp
24102 @item C-JIS
24103 Recognize JIS characters.
24104 @item C-SJIS
24105 Recognize SJIS characters.
24106 @item C-EUCJP
24107 Recognize EUCJP characters.
24108 @end table
24109
24110 If @env{LANG} is not defined, or if it has some other value, then the
24111 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
24112 recognize and translate multibyte characters.
24113 @end table
24114
24115 @noindent
24116 Some additional environment variables affect the behavior of the
24117 preprocessor.
24118
24119 @include cppenv.texi
24120
24121 @c man end
24122
24123 @node Precompiled Headers
24124 @section Using Precompiled Headers
24125 @cindex precompiled headers
24126 @cindex speed of compilation
24127
24128 Often large projects have many header files that are included in every
24129 source file. The time the compiler takes to process these header files
24130 over and over again can account for nearly all of the time required to
24131 build the project. To make builds faster, GCC allows you to
24132 @dfn{precompile} a header file.
24133
24134 To create a precompiled header file, simply compile it as you would any
24135 other file, if necessary using the @option{-x} option to make the driver
24136 treat it as a C or C++ header file. You may want to use a
24137 tool like @command{make} to keep the precompiled header up-to-date when
24138 the headers it contains change.
24139
24140 A precompiled header file is searched for when @code{#include} is
24141 seen in the compilation. As it searches for the included file
24142 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
24143 compiler looks for a precompiled header in each directory just before it
24144 looks for the include file in that directory. The name searched for is
24145 the name specified in the @code{#include} with @samp{.gch} appended. If
24146 the precompiled header file can't be used, it is ignored.
24147
24148 For instance, if you have @code{#include "all.h"}, and you have
24149 @file{all.h.gch} in the same directory as @file{all.h}, then the
24150 precompiled header file is used if possible, and the original
24151 header is used otherwise.
24152
24153 Alternatively, you might decide to put the precompiled header file in a
24154 directory and use @option{-I} to ensure that directory is searched
24155 before (or instead of) the directory containing the original header.
24156 Then, if you want to check that the precompiled header file is always
24157 used, you can put a file of the same name as the original header in this
24158 directory containing an @code{#error} command.
24159
24160 This also works with @option{-include}. So yet another way to use
24161 precompiled headers, good for projects not designed with precompiled
24162 header files in mind, is to simply take most of the header files used by
24163 a project, include them from another header file, precompile that header
24164 file, and @option{-include} the precompiled header. If the header files
24165 have guards against multiple inclusion, they are skipped because
24166 they've already been included (in the precompiled header).
24167
24168 If you need to precompile the same header file for different
24169 languages, targets, or compiler options, you can instead make a
24170 @emph{directory} named like @file{all.h.gch}, and put each precompiled
24171 header in the directory, perhaps using @option{-o}. It doesn't matter
24172 what you call the files in the directory; every precompiled header in
24173 the directory is considered. The first precompiled header
24174 encountered in the directory that is valid for this compilation is
24175 used; they're searched in no particular order.
24176
24177 There are many other possibilities, limited only by your imagination,
24178 good sense, and the constraints of your build system.
24179
24180 A precompiled header file can be used only when these conditions apply:
24181
24182 @itemize
24183 @item
24184 Only one precompiled header can be used in a particular compilation.
24185
24186 @item
24187 A precompiled header can't be used once the first C token is seen. You
24188 can have preprocessor directives before a precompiled header; you cannot
24189 include a precompiled header from inside another header.
24190
24191 @item
24192 The precompiled header file must be produced for the same language as
24193 the current compilation. You can't use a C precompiled header for a C++
24194 compilation.
24195
24196 @item
24197 The precompiled header file must have been produced by the same compiler
24198 binary as the current compilation is using.
24199
24200 @item
24201 Any macros defined before the precompiled header is included must
24202 either be defined in the same way as when the precompiled header was
24203 generated, or must not affect the precompiled header, which usually
24204 means that they don't appear in the precompiled header at all.
24205
24206 The @option{-D} option is one way to define a macro before a
24207 precompiled header is included; using a @code{#define} can also do it.
24208 There are also some options that define macros implicitly, like
24209 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
24210 defined this way.
24211
24212 @item If debugging information is output when using the precompiled
24213 header, using @option{-g} or similar, the same kind of debugging information
24214 must have been output when building the precompiled header. However,
24215 a precompiled header built using @option{-g} can be used in a compilation
24216 when no debugging information is being output.
24217
24218 @item The same @option{-m} options must generally be used when building
24219 and using the precompiled header. @xref{Submodel Options},
24220 for any cases where this rule is relaxed.
24221
24222 @item Each of the following options must be the same when building and using
24223 the precompiled header:
24224
24225 @gccoptlist{-fexceptions}
24226
24227 @item
24228 Some other command-line options starting with @option{-f},
24229 @option{-p}, or @option{-O} must be defined in the same way as when
24230 the precompiled header was generated. At present, it's not clear
24231 which options are safe to change and which are not; the safest choice
24232 is to use exactly the same options when generating and using the
24233 precompiled header. The following are known to be safe:
24234
24235 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
24236 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
24237 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
24238 -pedantic-errors}
24239
24240 @end itemize
24241
24242 For all of these except the last, the compiler automatically
24243 ignores the precompiled header if the conditions aren't met. If you
24244 find an option combination that doesn't work and doesn't cause the
24245 precompiled header to be ignored, please consider filing a bug report,
24246 see @ref{Bugs}.
24247
24248 If you do use differing options when generating and using the
24249 precompiled header, the actual behavior is a mixture of the
24250 behavior for the options. For instance, if you use @option{-g} to
24251 generate the precompiled header but not when using it, you may or may
24252 not get debugging information for routines in the precompiled header.