]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
367b99bc95cbf7164ec93fbe9c34ed8738dbcc1c
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2018 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-2018 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), dbx(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 @xref{Overall Options,,Options Controlling the Kind of Output}.
76
77 Other options are passed on to one or more stages of processing. Some options
78 control the preprocessor and others the compiler itself. Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
81
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly. If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
88
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++}
98 instead. @xref{Invoking G++,,Compiling C++ Programs},
99 for information about the differences in behavior between @command{gcc}
100 and @code{g++} when compiling C++ programs.
101
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands. Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
108
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments. For the most part, the order
112 you use doesn't matter. Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified. Also,
115 the placement of the @option{-l} option is significant.
116
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}. This manual documents
122 only one of these two forms, whichever one is not the default.
123
124 @c man end
125
126 @xref{Option Index}, for an index to GCC's options.
127
128 @menu
129 * Option Summary:: Brief list of all options, without explanations.
130 * Overall Options:: Controlling the kind of output:
131 an executable, object files, assembler files,
132 or preprocessed source.
133 * Invoking G++:: Compiling C++ programs.
134 * C Dialect Options:: Controlling the variant of C language compiled.
135 * C++ Dialect Options:: Variations on C++.
136 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
137 and Objective-C++.
138 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
139 be formatted.
140 * Warning Options:: How picky should the compiler be?
141 * Debugging Options:: Producing debuggable code.
142 * Optimize Options:: How much optimization?
143 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
144 * Preprocessor Options:: Controlling header files and macro definitions.
145 Also, getting dependency information for Make.
146 * Assembler Options:: Passing options to the assembler.
147 * Link Options:: Specifying libraries and so on.
148 * Directory Options:: Where to find header files and libraries.
149 Where to find the compiler executable files.
150 * Code Gen Options:: Specifying conventions for function calls, data layout
151 and register usage.
152 * Developer Options:: Printing GCC configuration info, statistics, and
153 debugging dumps.
154 * Submodel Options:: Target-specific options, such as compiling for a
155 specific processor variant.
156 * Spec Files:: How to pass switches to sub-processes.
157 * Environment Variables:: Env vars that affect GCC.
158 * Precompiled Headers:: Compiling a header once, and using it many times.
159 @end menu
160
161 @c man begin OPTIONS
162
163 @node Option Summary
164 @section Option Summary
165
166 Here is a summary of all the options, grouped by type. Explanations are
167 in the following sections.
168
169 @table @emph
170 @item Overall Options
171 @xref{Overall Options,,Options Controlling the Kind of Output}.
172 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
173 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
174 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
175 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
176 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
177 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
178
179 @item C Language Options
180 @xref{C Dialect Options,,Options Controlling C Dialect}.
181 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
182 -fpermitted-flt-eval-methods=@var{standard} @gol
183 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
184 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
185 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
186 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
187 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
188 -fsigned-bitfields -fsigned-char @gol
189 -funsigned-bitfields -funsigned-char}
190
191 @item C++ Language Options
192 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
193 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
194 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
195 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
196 -ffriend-injection @gol
197 -fno-elide-constructors @gol
198 -fno-enforce-eh-specs @gol
199 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
200 -fno-implicit-templates @gol
201 -fno-implicit-inline-templates @gol
202 -fno-implement-inlines -fms-extensions @gol
203 -fnew-inheriting-ctors @gol
204 -fnew-ttp-matching @gol
205 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
206 -fno-optional-diags -fpermissive @gol
207 -fno-pretty-templates @gol
208 -frepo -fno-rtti -fsized-deallocation @gol
209 -ftemplate-backtrace-limit=@var{n} @gol
210 -ftemplate-depth=@var{n} @gol
211 -fno-threadsafe-statics -fuse-cxa-atexit @gol
212 -fno-weak -nostdinc++ @gol
213 -fvisibility-inlines-hidden @gol
214 -fvisibility-ms-compat @gol
215 -fext-numeric-literals @gol
216 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
217 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
218 -Wnamespaces -Wnarrowing @gol
219 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
220 -Wnon-virtual-dtor -Wreorder -Wregister @gol
221 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
222 -Wno-non-template-friend -Wold-style-cast @gol
223 -Woverloaded-virtual -Wno-pmf-conversions @gol
224 -Wsign-promo -Wvirtual-inheritance}
225
226 @item Objective-C and Objective-C++ Language Options
227 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
228 Objective-C and Objective-C++ Dialects}.
229 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
230 -fgnu-runtime -fnext-runtime @gol
231 -fno-nil-receivers @gol
232 -fobjc-abi-version=@var{n} @gol
233 -fobjc-call-cxx-cdtors @gol
234 -fobjc-direct-dispatch @gol
235 -fobjc-exceptions @gol
236 -fobjc-gc @gol
237 -fobjc-nilcheck @gol
238 -fobjc-std=objc1 @gol
239 -fno-local-ivars @gol
240 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
241 -freplace-objc-classes @gol
242 -fzero-link @gol
243 -gen-decls @gol
244 -Wassign-intercept @gol
245 -Wno-protocol -Wselector @gol
246 -Wstrict-selector-match @gol
247 -Wundeclared-selector}
248
249 @item Diagnostic Message Formatting Options
250 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
251 @gccoptlist{-fmessage-length=@var{n} @gol
252 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
253 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
254 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
255 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
256 -fdiagnostics-show-template-tree -fno-elide-type @gol
257 -fno-show-column}
258
259 @item Warning Options
260 @xref{Warning Options,,Options to Request or Suppress Warnings}.
261 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
262 -pedantic-errors @gol
263 -w -Wextra -Wall -Waddress -Waggregate-return @gol
264 -Walloc-zero -Walloc-size-larger-than=@var{n}
265 -Walloca -Walloca-larger-than=@var{n} @gol
266 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
267 -Wno-attributes -Wbool-compare -Wbool-operation @gol
268 -Wno-builtin-declaration-mismatch @gol
269 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
270 -Wc++-compat -Wc++11-compat -Wc++14-compat @gol
271 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
272 -Wchar-subscripts -Wchkp -Wcatch-value -Wcatch-value=@var{n} @gol
273 -Wclobbered -Wcomment -Wconditionally-supported @gol
274 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
275 -Wdelete-incomplete @gol
276 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
277 -Wdisabled-optimization @gol
278 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
279 -Wno-div-by-zero -Wdouble-promotion @gol
280 -Wduplicated-branches -Wduplicated-cond @gol
281 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
282 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
283 -Wfloat-equal -Wformat -Wformat=2 @gol
284 -Wno-format-contains-nul -Wno-format-extra-args @gol
285 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
286 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
287 -Wformat-y2k -Wframe-address @gol
288 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
289 -Wif-not-aligned @gol
290 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
291 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
292 -Wimplicit-function-declaration -Wimplicit-int @gol
293 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
294 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
295 -Winvalid-pch -Wlarger-than=@var{len} @gol
296 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
297 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
298 -Wmisleading-indentation -Wmissing-braces @gol
299 -Wmissing-field-initializers -Wmissing-include-dirs @gol
300 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
301 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
302 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
303 -Woverride-init-side-effects -Woverlength-strings @gol
304 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
305 -Wparentheses -Wno-pedantic-ms-format @gol
306 -Wplacement-new -Wplacement-new=@var{n} @gol
307 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
308 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
309 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
310 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
311 -Wshift-overflow -Wshift-overflow=@var{n} @gol
312 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
313 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
314 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
315 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
316 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
317 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
318 -Wstringop-overflow=@var{n} -Wstringop-truncation @gol
319 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
320 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
321 -Wmissing-format-attribute -Wsubobject-linkage @gol
322 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
323 -Wswitch-unreachable -Wsync-nand @gol
324 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
325 -Wtype-limits -Wundef @gol
326 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
327 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
328 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
329 -Wunused-parameter -Wno-unused-result @gol
330 -Wunused-value -Wunused-variable @gol
331 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
332 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
333 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
334 -Wvla -Wvla-larger-than=@var{n} -Wvolatile-register-var -Wwrite-strings @gol
335 -Wzero-as-null-pointer-constant -Whsa}
336
337 @item C and Objective-C-only Warning Options
338 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
339 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
340 -Wold-style-declaration -Wold-style-definition @gol
341 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
342 -Wdeclaration-after-statement -Wpointer-sign}
343
344 @item Debugging Options
345 @xref{Debugging Options,,Options for Debugging Your Program}.
346 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
347 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
348 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
349 -gcolumn-info -gno-column-info @gol
350 -gstatement-frontiers -gno-statement-frontiers @gol
351 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
352 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
353 -fno-eliminate-unused-debug-types @gol
354 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
355 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
356 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
357 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
358 -fvar-tracking -fvar-tracking-assignments}
359
360 @item Optimization Options
361 @xref{Optimize Options,,Options that Control Optimization}.
362 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
363 -falign-jumps[=@var{n}] @gol
364 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
365 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
366 -fauto-inc-dec -fbranch-probabilities @gol
367 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
368 -fbtr-bb-exclusive -fcaller-saves @gol
369 -fcombine-stack-adjustments -fconserve-stack @gol
370 -fcompare-elim -fcprop-registers -fcrossjumping @gol
371 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
372 -fcx-limited-range @gol
373 -fdata-sections -fdce -fdelayed-branch @gol
374 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
375 -fdevirtualize-at-ltrans -fdse @gol
376 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
377 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
378 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
379 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
380 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
381 -fif-conversion2 -findirect-inlining @gol
382 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
383 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
384 -fipa-bit-cp -fipa-vrp @gol
385 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
386 -fira-algorithm=@var{algorithm} @gol
387 -fira-region=@var{region} -fira-hoist-pressure @gol
388 -fira-loop-pressure -fno-ira-share-save-slots @gol
389 -fno-ira-share-spill-slots @gol
390 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
391 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
392 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
393 -floop-block -floop-interchange -floop-strip-mine @gol
394 -floop-unroll-and-jam -floop-nest-optimize @gol
395 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
396 -flto-partition=@var{alg} -fmerge-all-constants @gol
397 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
398 -fmove-loop-invariants -fno-branch-count-reg @gol
399 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
400 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
401 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
402 -fno-sched-spec -fno-signed-zeros @gol
403 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
404 -fomit-frame-pointer -foptimize-sibling-calls @gol
405 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
406 -fprefetch-loop-arrays @gol
407 -fprofile-correction @gol
408 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
409 -fprofile-reorder-functions @gol
410 -freciprocal-math -free -frename-registers -freorder-blocks @gol
411 -freorder-blocks-algorithm=@var{algorithm} @gol
412 -freorder-blocks-and-partition -freorder-functions @gol
413 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
414 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
415 -fsched-spec-load -fsched-spec-load-dangerous @gol
416 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
417 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
418 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
419 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
420 -fschedule-fusion @gol
421 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
422 -fselective-scheduling -fselective-scheduling2 @gol
423 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
424 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
425 -fsignaling-nans @gol
426 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
427 -fsplit-paths @gol
428 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
429 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
430 -fthread-jumps -ftracer -ftree-bit-ccp @gol
431 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
432 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
433 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
434 -ftree-loop-if-convert -ftree-loop-im @gol
435 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
436 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
437 -ftree-loop-vectorize @gol
438 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
439 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
440 -ftree-switch-conversion -ftree-tail-merge @gol
441 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
442 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
443 -funsafe-math-optimizations -funswitch-loops @gol
444 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
445 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
446 --param @var{name}=@var{value}
447 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
448
449 @item Program Instrumentation Options
450 @xref{Instrumentation Options,,Program Instrumentation Options}.
451 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
452 -fprofile-abs-path @gol
453 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
454 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
455 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
456 -fsanitize-undefined-trap-on-error -fbounds-check @gol
457 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
458 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
459 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
460 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
461 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
462 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
463 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
464 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
465 -fchkp-use-wrappers -fchkp-flexible-struct-trailing-arrays@gol
466 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
467 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
468 -fstack-protector-explicit -fstack-check @gol
469 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
470 -fno-stack-limit -fsplit-stack @gol
471 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
472 -fvtv-counts -fvtv-debug @gol
473 -finstrument-functions @gol
474 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
475 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
476
477 @item Preprocessor Options
478 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
479 @gccoptlist{-A@var{question}=@var{answer} @gol
480 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
481 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
482 -dD -dI -dM -dN -dU @gol
483 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
484 -fexec-charset=@var{charset} -fextended-identifiers @gol
485 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
486 -fno-canonical-system-headers @gol -fpch-deps -fpch-preprocess @gol
487 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
488 -fwide-exec-charset=@var{charset} -fworking-directory @gol
489 -H -imacros @var{file} -include @var{file} @gol
490 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
491 -no-integrated-cpp -P -pthread -remap @gol
492 -traditional -traditional-cpp -trigraphs @gol
493 -U@var{macro} -undef @gol
494 -Wp,@var{option} -Xpreprocessor @var{option}}
495
496 @item Assembler Options
497 @xref{Assembler Options,,Passing Options to the Assembler}.
498 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
499
500 @item Linker Options
501 @xref{Link Options,,Options for Linking}.
502 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
503 -nostartfiles -nodefaultlibs -nostdlib -pie -pthread -rdynamic @gol
504 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
505 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
506 -static-libmpx -static-libmpxwrappers @gol
507 -shared -shared-libgcc -symbolic @gol
508 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
509 -u @var{symbol} -z @var{keyword}}
510
511 @item Directory Options
512 @xref{Directory Options,,Options for Directory Search}.
513 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
514 -idirafter @var{dir} @gol
515 -imacros @var{file} -imultilib @var{dir} @gol
516 -iplugindir=@var{dir} -iprefix @var{file} @gol
517 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
518 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
519 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
520 -nostdinc -nostdinc++ --sysroot=@var{dir}}
521
522 @item Code Generation Options
523 @xref{Code Gen Options,,Options for Code Generation Conventions}.
524 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
525 -ffixed-@var{reg} -fexceptions @gol
526 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
527 -fasynchronous-unwind-tables @gol
528 -fno-gnu-unique @gol
529 -finhibit-size-directive -fno-common -fno-ident @gol
530 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
531 -fno-jump-tables @gol
532 -frecord-gcc-switches @gol
533 -freg-struct-return -fshort-enums -fshort-wchar @gol
534 -fverbose-asm -fpack-struct[=@var{n}] @gol
535 -fleading-underscore -ftls-model=@var{model} @gol
536 -fstack-reuse=@var{reuse_level} @gol
537 -ftrampolines -ftrapv -fwrapv @gol
538 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
539 -fstrict-volatile-bitfields -fsync-libcalls}
540
541 @item Developer Options
542 @xref{Developer Options,,GCC Developer Options}.
543 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
544 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
545 -fdbg-cnt=@var{counter-value-list} @gol
546 -fdisable-ipa-@var{pass_name} @gol
547 -fdisable-rtl-@var{pass_name} @gol
548 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
549 -fdisable-tree-@var{pass_name} @gol
550 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
551 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
552 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
553 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
554 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
555 -fdump-lang-all @gol
556 -fdump-lang-@var{switch} @gol
557 -fdump-lang-@var{switch}-@var{options} @gol
558 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
559 -fdump-passes @gol
560 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
561 -fdump-statistics @gol
562 -fdump-tree-all @gol
563 -fdump-tree-@var{switch} @gol
564 -fdump-tree-@var{switch}-@var{options} @gol
565 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
566 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
567 -fenable-@var{kind}-@var{pass} @gol
568 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
569 -fira-verbose=@var{n} @gol
570 -flto-report -flto-report-wpa -fmem-report-wpa @gol
571 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
572 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
573 -fprofile-report @gol
574 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
575 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
576 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
577 -fvar-tracking-assignments-toggle -gtoggle @gol
578 -print-file-name=@var{library} -print-libgcc-file-name @gol
579 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
580 -print-prog-name=@var{program} -print-search-dirs -Q @gol
581 -print-sysroot -print-sysroot-headers-suffix @gol
582 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
583
584 @item Machine-Dependent Options
585 @xref{Submodel Options,,Machine-Dependent Options}.
586 @c This list is ordered alphanumerically by subsection name.
587 @c Try and put the significant identifier (CPU or system) first,
588 @c so users have a clue at guessing where the ones they want will be.
589
590 @emph{AArch64 Options}
591 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
592 -mgeneral-regs-only @gol
593 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
594 -mstrict-align @gol
595 -momit-leaf-frame-pointer @gol
596 -mtls-dialect=desc -mtls-dialect=traditional @gol
597 -mtls-size=@var{size} @gol
598 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
599 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
600 -mpc-relative-literal-loads @gol
601 -msign-return-address=@var{scope} @gol
602 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
603 -moverride=@var{string} -mverbose-cost-dump}
604
605 @emph{Adapteva Epiphany Options}
606 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
607 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
608 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
609 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
610 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
611 -msplit-vecmove-early -m1reg-@var{reg}}
612
613 @emph{ARC Options}
614 @gccoptlist{-mbarrel-shifter -mjli-always @gol
615 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
616 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
617 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
618 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
619 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
620 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
621 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
622 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
623 -mvolatile-cache -mtp-regno=@var{regno} @gol
624 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
625 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
626 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
627 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
628 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
629 -mtune=@var{cpu} -mmultcost=@var{num} @gol
630 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
631 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16}
632
633 @emph{ARM Options}
634 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
635 -mabi=@var{name} @gol
636 -mapcs-stack-check -mno-apcs-stack-check @gol
637 -mapcs-reentrant -mno-apcs-reentrant @gol
638 -msched-prolog -mno-sched-prolog @gol
639 -mlittle-endian -mbig-endian @gol
640 -mbe8 -mbe32 @gol
641 -mfloat-abi=@var{name} @gol
642 -mfp16-format=@var{name}
643 -mthumb-interwork -mno-thumb-interwork @gol
644 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
645 -mtune=@var{name} -mprint-tune-info @gol
646 -mstructure-size-boundary=@var{n} @gol
647 -mabort-on-noreturn @gol
648 -mlong-calls -mno-long-calls @gol
649 -msingle-pic-base -mno-single-pic-base @gol
650 -mpic-register=@var{reg} @gol
651 -mnop-fun-dllimport @gol
652 -mpoke-function-name @gol
653 -mthumb -marm -mflip-thumb @gol
654 -mtpcs-frame -mtpcs-leaf-frame @gol
655 -mcaller-super-interworking -mcallee-super-interworking @gol
656 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
657 -mword-relocations @gol
658 -mfix-cortex-m3-ldrd @gol
659 -munaligned-access @gol
660 -mneon-for-64bits @gol
661 -mslow-flash-data @gol
662 -masm-syntax-unified @gol
663 -mrestrict-it @gol
664 -mverbose-cost-dump @gol
665 -mpure-code @gol
666 -mcmse}
667
668 @emph{AVR Options}
669 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
670 -mbranch-cost=@var{cost} @gol
671 -mcall-prologues -mgas-isr-prologues -mint8 @gol
672 -mn_flash=@var{size} -mno-interrupts @gol
673 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
674 -mfract-convert-truncate @gol
675 -mshort-calls -nodevicelib @gol
676 -Waddr-space-convert -Wmisspelled-isr}
677
678 @emph{Blackfin Options}
679 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
680 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
681 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
682 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
683 -mno-id-shared-library -mshared-library-id=@var{n} @gol
684 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
685 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
686 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
687 -micplb}
688
689 @emph{C6X Options}
690 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
691 -msim -msdata=@var{sdata-type}}
692
693 @emph{CRIS Options}
694 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
695 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
696 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
697 -mstack-align -mdata-align -mconst-align @gol
698 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
699 -melf -maout -melinux -mlinux -sim -sim2 @gol
700 -mmul-bug-workaround -mno-mul-bug-workaround}
701
702 @emph{CR16 Options}
703 @gccoptlist{-mmac @gol
704 -mcr16cplus -mcr16c @gol
705 -msim -mint32 -mbit-ops
706 -mdata-model=@var{model}}
707
708 @emph{Darwin Options}
709 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
710 -arch_only -bind_at_load -bundle -bundle_loader @gol
711 -client_name -compatibility_version -current_version @gol
712 -dead_strip @gol
713 -dependency-file -dylib_file -dylinker_install_name @gol
714 -dynamic -dynamiclib -exported_symbols_list @gol
715 -filelist -flat_namespace -force_cpusubtype_ALL @gol
716 -force_flat_namespace -headerpad_max_install_names @gol
717 -iframework @gol
718 -image_base -init -install_name -keep_private_externs @gol
719 -multi_module -multiply_defined -multiply_defined_unused @gol
720 -noall_load -no_dead_strip_inits_and_terms @gol
721 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
722 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
723 -private_bundle -read_only_relocs -sectalign @gol
724 -sectobjectsymbols -whyload -seg1addr @gol
725 -sectcreate -sectobjectsymbols -sectorder @gol
726 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
727 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
728 -segprot -segs_read_only_addr -segs_read_write_addr @gol
729 -single_module -static -sub_library -sub_umbrella @gol
730 -twolevel_namespace -umbrella -undefined @gol
731 -unexported_symbols_list -weak_reference_mismatches @gol
732 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
733 -mkernel -mone-byte-bool}
734
735 @emph{DEC Alpha Options}
736 @gccoptlist{-mno-fp-regs -msoft-float @gol
737 -mieee -mieee-with-inexact -mieee-conformant @gol
738 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
739 -mtrap-precision=@var{mode} -mbuild-constants @gol
740 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
741 -mbwx -mmax -mfix -mcix @gol
742 -mfloat-vax -mfloat-ieee @gol
743 -mexplicit-relocs -msmall-data -mlarge-data @gol
744 -msmall-text -mlarge-text @gol
745 -mmemory-latency=@var{time}}
746
747 @emph{FR30 Options}
748 @gccoptlist{-msmall-model -mno-lsim}
749
750 @emph{FT32 Options}
751 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
752
753 @emph{FRV Options}
754 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
755 -mhard-float -msoft-float @gol
756 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
757 -mdouble -mno-double @gol
758 -mmedia -mno-media -mmuladd -mno-muladd @gol
759 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
760 -mlinked-fp -mlong-calls -malign-labels @gol
761 -mlibrary-pic -macc-4 -macc-8 @gol
762 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
763 -moptimize-membar -mno-optimize-membar @gol
764 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
765 -mvliw-branch -mno-vliw-branch @gol
766 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
767 -mno-nested-cond-exec -mtomcat-stats @gol
768 -mTLS -mtls @gol
769 -mcpu=@var{cpu}}
770
771 @emph{GNU/Linux Options}
772 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
773 -tno-android-cc -tno-android-ld}
774
775 @emph{H8/300 Options}
776 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
777
778 @emph{HPPA Options}
779 @gccoptlist{-march=@var{architecture-type} @gol
780 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
781 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
782 -mfixed-range=@var{register-range} @gol
783 -mjump-in-delay -mlinker-opt -mlong-calls @gol
784 -mlong-load-store -mno-disable-fpregs @gol
785 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
786 -mno-jump-in-delay -mno-long-load-store @gol
787 -mno-portable-runtime -mno-soft-float @gol
788 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
789 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
790 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
791 -munix=@var{unix-std} -nolibdld -static -threads}
792
793 @emph{IA-64 Options}
794 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
795 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
796 -mconstant-gp -mauto-pic -mfused-madd @gol
797 -minline-float-divide-min-latency @gol
798 -minline-float-divide-max-throughput @gol
799 -mno-inline-float-divide @gol
800 -minline-int-divide-min-latency @gol
801 -minline-int-divide-max-throughput @gol
802 -mno-inline-int-divide @gol
803 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
804 -mno-inline-sqrt @gol
805 -mdwarf2-asm -mearly-stop-bits @gol
806 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
807 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
808 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
809 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
810 -msched-spec-ldc -msched-spec-control-ldc @gol
811 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
812 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
813 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
814 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
815
816 @emph{LM32 Options}
817 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
818 -msign-extend-enabled -muser-enabled}
819
820 @emph{M32R/D Options}
821 @gccoptlist{-m32r2 -m32rx -m32r @gol
822 -mdebug @gol
823 -malign-loops -mno-align-loops @gol
824 -missue-rate=@var{number} @gol
825 -mbranch-cost=@var{number} @gol
826 -mmodel=@var{code-size-model-type} @gol
827 -msdata=@var{sdata-type} @gol
828 -mno-flush-func -mflush-func=@var{name} @gol
829 -mno-flush-trap -mflush-trap=@var{number} @gol
830 -G @var{num}}
831
832 @emph{M32C Options}
833 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
834
835 @emph{M680x0 Options}
836 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
837 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
838 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
839 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
840 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
841 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
842 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
843 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
844 -mxgot -mno-xgot -mlong-jump-table-offsets}
845
846 @emph{MCore Options}
847 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
848 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
849 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
850 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
851 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
852
853 @emph{MeP Options}
854 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
855 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
856 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
857 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
858 -mtiny=@var{n}}
859
860 @emph{MicroBlaze Options}
861 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
862 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
863 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
864 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
865 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
866
867 @emph{MIPS Options}
868 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
869 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
870 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
871 -mips16 -mno-mips16 -mflip-mips16 @gol
872 -minterlink-compressed -mno-interlink-compressed @gol
873 -minterlink-mips16 -mno-interlink-mips16 @gol
874 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
875 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
876 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
877 -mno-float -msingle-float -mdouble-float @gol
878 -modd-spreg -mno-odd-spreg @gol
879 -mabs=@var{mode} -mnan=@var{encoding} @gol
880 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
881 -mmcu -mmno-mcu @gol
882 -meva -mno-eva @gol
883 -mvirt -mno-virt @gol
884 -mxpa -mno-xpa @gol
885 -mmicromips -mno-micromips @gol
886 -mmsa -mno-msa @gol
887 -mfpu=@var{fpu-type} @gol
888 -msmartmips -mno-smartmips @gol
889 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
890 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
891 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
892 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
893 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
894 -membedded-data -mno-embedded-data @gol
895 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
896 -mcode-readable=@var{setting} @gol
897 -msplit-addresses -mno-split-addresses @gol
898 -mexplicit-relocs -mno-explicit-relocs @gol
899 -mcheck-zero-division -mno-check-zero-division @gol
900 -mdivide-traps -mdivide-breaks @gol
901 -mload-store-pairs -mno-load-store-pairs @gol
902 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
903 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
904 -mfix-24k -mno-fix-24k @gol
905 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
906 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
907 -mfix-vr4120 -mno-fix-vr4120 @gol
908 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
909 -mflush-func=@var{func} -mno-flush-func @gol
910 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
911 -mcompact-branches=@var{policy} @gol
912 -mfp-exceptions -mno-fp-exceptions @gol
913 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
914 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
915 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
916 -mframe-header-opt -mno-frame-header-opt}
917
918 @emph{MMIX Options}
919 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
920 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
921 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
922 -mno-base-addresses -msingle-exit -mno-single-exit}
923
924 @emph{MN10300 Options}
925 @gccoptlist{-mmult-bug -mno-mult-bug @gol
926 -mno-am33 -mam33 -mam33-2 -mam34 @gol
927 -mtune=@var{cpu-type} @gol
928 -mreturn-pointer-on-d0 @gol
929 -mno-crt0 -mrelax -mliw -msetlb}
930
931 @emph{Moxie Options}
932 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
933
934 @emph{MSP430 Options}
935 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
936 -mwarn-mcu @gol
937 -mcode-region= -mdata-region= @gol
938 -msilicon-errata= -msilicon-errata-warn= @gol
939 -mhwmult= -minrt}
940
941 @emph{NDS32 Options}
942 @gccoptlist{-mbig-endian -mlittle-endian @gol
943 -mreduced-regs -mfull-regs @gol
944 -mcmov -mno-cmov @gol
945 -mext-perf -mno-ext-perf @gol
946 -mext-perf2 -mno-ext-perf2 @gol
947 -mext-string -mno-ext-string @gol
948 -mv3push -mno-v3push @gol
949 -m16bit -mno-16bit @gol
950 -misr-vector-size=@var{num} @gol
951 -mcache-block-size=@var{num} @gol
952 -march=@var{arch} @gol
953 -mcmodel=@var{code-model} @gol
954 -mctor-dtor -mrelax}
955
956 @emph{Nios II Options}
957 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
958 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
959 -mel -meb @gol
960 -mno-bypass-cache -mbypass-cache @gol
961 -mno-cache-volatile -mcache-volatile @gol
962 -mno-fast-sw-div -mfast-sw-div @gol
963 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
964 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
965 -mcustom-fpu-cfg=@var{name} @gol
966 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
967 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
968
969 @emph{Nvidia PTX Options}
970 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
971
972 @emph{PDP-11 Options}
973 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
974 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
975 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
976 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
977 -mbranch-expensive -mbranch-cheap @gol
978 -munix-asm -mdec-asm}
979
980 @emph{picoChip Options}
981 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
982 -msymbol-as-address -mno-inefficient-warnings}
983
984 @emph{PowerPC Options}
985 See RS/6000 and PowerPC Options.
986
987 @emph{PowerPC SPE Options}
988 @gccoptlist{-mcpu=@var{cpu-type} @gol
989 -mtune=@var{cpu-type} @gol
990 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol
991 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
992 -m32 -mxl-compat -mno-xl-compat @gol
993 -malign-power -malign-natural @gol
994 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
995 -msingle-float -mdouble-float @gol
996 -mupdate -mno-update @gol
997 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
998 -mstrict-align -mno-strict-align -mrelocatable @gol
999 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1000 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1001 -msingle-pic-base @gol
1002 -mprioritize-restricted-insns=@var{priority} @gol
1003 -msched-costly-dep=@var{dependence_type} @gol
1004 -minsert-sched-nops=@var{scheme} @gol
1005 -mcall-sysv -mcall-netbsd @gol
1006 -maix-struct-return -msvr4-struct-return @gol
1007 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1008 -mblock-move-inline-limit=@var{num} @gol
1009 -misel -mno-isel @gol
1010 -misel=yes -misel=no @gol
1011 -mspe -mno-spe @gol
1012 -mspe=yes -mspe=no @gol
1013 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1014 -mprototype -mno-prototype @gol
1015 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1016 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1017 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1018 -mno-recip-precision @gol
1019 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1020 -msave-toc-indirect -mno-save-toc-indirect @gol
1021 -mcompat-align-parm -mno-compat-align-parm @gol
1022 -mfloat128 -mno-float128 @gol
1023 -mgnu-attribute -mno-gnu-attribute @gol
1024 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1025 -mstack-protector-guard-offset=@var{offset}}
1026
1027 @emph{RISC-V Options}
1028 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1029 -mplt -mno-plt @gol
1030 -mabi=@var{ABI-string} @gol
1031 -mfdiv -mno-fdiv @gol
1032 -mdiv -mno-div @gol
1033 -march=@var{ISA-string} @gol
1034 -mtune=@var{processor-string} @gol
1035 -mpreferred-stack-boundary=@var{num} @gol
1036 -msmall-data-limit=@var{N-bytes} @gol
1037 -msave-restore -mno-save-restore @gol
1038 -mstrict-align -mno-strict-align @gol
1039 -mcmodel=medlow -mcmodel=medany @gol
1040 -mexplicit-relocs -mno-explicit-relocs @gol}
1041
1042 @emph{RL78 Options}
1043 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1044 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1045 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1046
1047 @emph{RS/6000 and PowerPC Options}
1048 @gccoptlist{-mcpu=@var{cpu-type} @gol
1049 -mtune=@var{cpu-type} @gol
1050 -mcmodel=@var{code-model} @gol
1051 -mpowerpc64 @gol
1052 -maltivec -mno-altivec @gol
1053 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1054 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1055 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1056 -mfprnd -mno-fprnd @gol
1057 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1058 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1059 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1060 -malign-power -malign-natural @gol
1061 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1062 -msingle-float -mdouble-float -msimple-fpu @gol
1063 -mupdate -mno-update @gol
1064 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1065 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1066 -mstrict-align -mno-strict-align -mrelocatable @gol
1067 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1068 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1069 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1070 -mprioritize-restricted-insns=@var{priority} @gol
1071 -msched-costly-dep=@var{dependence_type} @gol
1072 -minsert-sched-nops=@var{scheme} @gol
1073 -mcall-sysv -mcall-netbsd @gol
1074 -maix-struct-return -msvr4-struct-return @gol
1075 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1076 -mblock-move-inline-limit=@var{num} @gol
1077 -misel -mno-isel @gol
1078 -misel=yes -misel=no @gol
1079 -mpaired @gol
1080 -mvrsave -mno-vrsave @gol
1081 -mmulhw -mno-mulhw @gol
1082 -mdlmzb -mno-dlmzb @gol
1083 -mprototype -mno-prototype @gol
1084 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1085 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1086 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1087 -mno-recip-precision @gol
1088 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1089 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1090 -msave-toc-indirect -mno-save-toc-indirect @gol
1091 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1092 -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol
1093 -mquad-memory -mno-quad-memory @gol
1094 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1095 -mcompat-align-parm -mno-compat-align-parm @gol
1096 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1097 -mgnu-attribute -mno-gnu-attribute @gol
1098 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1099 -mstack-protector-guard-offset=@var{offset}}
1100
1101 @emph{RX Options}
1102 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1103 -mcpu=@gol
1104 -mbig-endian-data -mlittle-endian-data @gol
1105 -msmall-data @gol
1106 -msim -mno-sim@gol
1107 -mas100-syntax -mno-as100-syntax@gol
1108 -mrelax@gol
1109 -mmax-constant-size=@gol
1110 -mint-register=@gol
1111 -mpid@gol
1112 -mallow-string-insns -mno-allow-string-insns@gol
1113 -mjsr@gol
1114 -mno-warn-multiple-fast-interrupts@gol
1115 -msave-acc-in-interrupts}
1116
1117 @emph{S/390 and zSeries Options}
1118 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1119 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1120 -mlong-double-64 -mlong-double-128 @gol
1121 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1122 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1123 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1124 -mhtm -mvx -mzvector @gol
1125 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1126 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1127 -mhotpatch=@var{halfwords},@var{halfwords}}
1128
1129 @emph{Score Options}
1130 @gccoptlist{-meb -mel @gol
1131 -mnhwloop @gol
1132 -muls @gol
1133 -mmac @gol
1134 -mscore5 -mscore5u -mscore7 -mscore7d}
1135
1136 @emph{SH Options}
1137 @gccoptlist{-m1 -m2 -m2e @gol
1138 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1139 -m3 -m3e @gol
1140 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1141 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1142 -mb -ml -mdalign -mrelax @gol
1143 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1144 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1145 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1146 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1147 -maccumulate-outgoing-args @gol
1148 -matomic-model=@var{atomic-model} @gol
1149 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1150 -mcbranch-force-delay-slot @gol
1151 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1152 -mpretend-cmove -mtas}
1153
1154 @emph{Solaris 2 Options}
1155 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1156 -pthreads}
1157
1158 @emph{SPARC Options}
1159 @gccoptlist{-mcpu=@var{cpu-type} @gol
1160 -mtune=@var{cpu-type} @gol
1161 -mcmodel=@var{code-model} @gol
1162 -mmemory-model=@var{mem-model} @gol
1163 -m32 -m64 -mapp-regs -mno-app-regs @gol
1164 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1165 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1166 -mhard-quad-float -msoft-quad-float @gol
1167 -mstack-bias -mno-stack-bias @gol
1168 -mstd-struct-return -mno-std-struct-return @gol
1169 -munaligned-doubles -mno-unaligned-doubles @gol
1170 -muser-mode -mno-user-mode @gol
1171 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1172 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1173 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1174 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1175 -mpopc -mno-popc -msubxc -mno-subxc @gol
1176 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1177 -mlra -mno-lra}
1178
1179 @emph{SPU Options}
1180 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1181 -msafe-dma -munsafe-dma @gol
1182 -mbranch-hints @gol
1183 -msmall-mem -mlarge-mem -mstdmain @gol
1184 -mfixed-range=@var{register-range} @gol
1185 -mea32 -mea64 @gol
1186 -maddress-space-conversion -mno-address-space-conversion @gol
1187 -mcache-size=@var{cache-size} @gol
1188 -matomic-updates -mno-atomic-updates}
1189
1190 @emph{System V Options}
1191 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1192
1193 @emph{TILE-Gx Options}
1194 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1195 -mcmodel=@var{code-model}}
1196
1197 @emph{TILEPro Options}
1198 @gccoptlist{-mcpu=@var{cpu} -m32}
1199
1200 @emph{V850 Options}
1201 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1202 -mprolog-function -mno-prolog-function -mspace @gol
1203 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1204 -mapp-regs -mno-app-regs @gol
1205 -mdisable-callt -mno-disable-callt @gol
1206 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1207 -mv850e -mv850 -mv850e3v5 @gol
1208 -mloop @gol
1209 -mrelax @gol
1210 -mlong-jumps @gol
1211 -msoft-float @gol
1212 -mhard-float @gol
1213 -mgcc-abi @gol
1214 -mrh850-abi @gol
1215 -mbig-switch}
1216
1217 @emph{VAX Options}
1218 @gccoptlist{-mg -mgnu -munix}
1219
1220 @emph{Visium Options}
1221 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1222 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1223
1224 @emph{VMS Options}
1225 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1226 -mpointer-size=@var{size}}
1227
1228 @emph{VxWorks Options}
1229 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1230 -Xbind-lazy -Xbind-now}
1231
1232 @emph{x86 Options}
1233 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1234 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1235 -mfpmath=@var{unit} @gol
1236 -masm=@var{dialect} -mno-fancy-math-387 @gol
1237 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1238 -mno-wide-multiply -mrtd -malign-double @gol
1239 -mpreferred-stack-boundary=@var{num} @gol
1240 -mincoming-stack-boundary=@var{num} @gol
1241 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1242 -mrecip -mrecip=@var{opt} @gol
1243 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1244 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1245 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1246 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1247 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1248 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1249 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1250 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx @gol
1251 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes @gol
1252 -mcet -mibt -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1253 -mvpclmulqdq -mavx512bitalg -mavx512vpopcntdq @gol
1254 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1255 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1256 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1257 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1258 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1259 -mregparm=@var{num} -msseregparm @gol
1260 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1261 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1262 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1263 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1264 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1265 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1266 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1267 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1268 -mstack-protector-guard-reg=@var{reg} @gol
1269 -mstack-protector-guard-offset=@var{offset} @gol
1270 -mstack-protector-guard-symbol=@var{symbol} -mmitigate-rop @gol
1271 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1272 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1273 -mindirect-branch-register}
1274
1275 @emph{x86 Windows Options}
1276 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1277 -mnop-fun-dllimport -mthread @gol
1278 -municode -mwin32 -mwindows -fno-set-stack-executable}
1279
1280 @emph{Xstormy16 Options}
1281 @gccoptlist{-msim}
1282
1283 @emph{Xtensa Options}
1284 @gccoptlist{-mconst16 -mno-const16 @gol
1285 -mfused-madd -mno-fused-madd @gol
1286 -mforce-no-pic @gol
1287 -mserialize-volatile -mno-serialize-volatile @gol
1288 -mtext-section-literals -mno-text-section-literals @gol
1289 -mauto-litpools -mno-auto-litpools @gol
1290 -mtarget-align -mno-target-align @gol
1291 -mlongcalls -mno-longcalls}
1292
1293 @emph{zSeries Options}
1294 See S/390 and zSeries Options.
1295 @end table
1296
1297
1298 @node Overall Options
1299 @section Options Controlling the Kind of Output
1300
1301 Compilation can involve up to four stages: preprocessing, compilation
1302 proper, assembly and linking, always in that order. GCC is capable of
1303 preprocessing and compiling several files either into several
1304 assembler input files, or into one assembler input file; then each
1305 assembler input file produces an object file, and linking combines all
1306 the object files (those newly compiled, and those specified as input)
1307 into an executable file.
1308
1309 @cindex file name suffix
1310 For any given input file, the file name suffix determines what kind of
1311 compilation is done:
1312
1313 @table @gcctabopt
1314 @item @var{file}.c
1315 C source code that must be preprocessed.
1316
1317 @item @var{file}.i
1318 C source code that should not be preprocessed.
1319
1320 @item @var{file}.ii
1321 C++ source code that should not be preprocessed.
1322
1323 @item @var{file}.m
1324 Objective-C source code. Note that you must link with the @file{libobjc}
1325 library to make an Objective-C program work.
1326
1327 @item @var{file}.mi
1328 Objective-C source code that should not be preprocessed.
1329
1330 @item @var{file}.mm
1331 @itemx @var{file}.M
1332 Objective-C++ source code. Note that you must link with the @file{libobjc}
1333 library to make an Objective-C++ program work. Note that @samp{.M} refers
1334 to a literal capital M@.
1335
1336 @item @var{file}.mii
1337 Objective-C++ source code that should not be preprocessed.
1338
1339 @item @var{file}.h
1340 C, C++, Objective-C or Objective-C++ header file to be turned into a
1341 precompiled header (default), or C, C++ header file to be turned into an
1342 Ada spec (via the @option{-fdump-ada-spec} switch).
1343
1344 @item @var{file}.cc
1345 @itemx @var{file}.cp
1346 @itemx @var{file}.cxx
1347 @itemx @var{file}.cpp
1348 @itemx @var{file}.CPP
1349 @itemx @var{file}.c++
1350 @itemx @var{file}.C
1351 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1352 the last two letters must both be literally @samp{x}. Likewise,
1353 @samp{.C} refers to a literal capital C@.
1354
1355 @item @var{file}.mm
1356 @itemx @var{file}.M
1357 Objective-C++ source code that must be preprocessed.
1358
1359 @item @var{file}.mii
1360 Objective-C++ source code that should not be preprocessed.
1361
1362 @item @var{file}.hh
1363 @itemx @var{file}.H
1364 @itemx @var{file}.hp
1365 @itemx @var{file}.hxx
1366 @itemx @var{file}.hpp
1367 @itemx @var{file}.HPP
1368 @itemx @var{file}.h++
1369 @itemx @var{file}.tcc
1370 C++ header file to be turned into a precompiled header or Ada spec.
1371
1372 @item @var{file}.f
1373 @itemx @var{file}.for
1374 @itemx @var{file}.ftn
1375 Fixed form Fortran source code that should not be preprocessed.
1376
1377 @item @var{file}.F
1378 @itemx @var{file}.FOR
1379 @itemx @var{file}.fpp
1380 @itemx @var{file}.FPP
1381 @itemx @var{file}.FTN
1382 Fixed form Fortran source code that must be preprocessed (with the traditional
1383 preprocessor).
1384
1385 @item @var{file}.f90
1386 @itemx @var{file}.f95
1387 @itemx @var{file}.f03
1388 @itemx @var{file}.f08
1389 Free form Fortran source code that should not be preprocessed.
1390
1391 @item @var{file}.F90
1392 @itemx @var{file}.F95
1393 @itemx @var{file}.F03
1394 @itemx @var{file}.F08
1395 Free form Fortran source code that must be preprocessed (with the
1396 traditional preprocessor).
1397
1398 @item @var{file}.go
1399 Go source code.
1400
1401 @item @var{file}.brig
1402 BRIG files (binary representation of HSAIL).
1403
1404 @item @var{file}.ads
1405 Ada source code file that contains a library unit declaration (a
1406 declaration of a package, subprogram, or generic, or a generic
1407 instantiation), or a library unit renaming declaration (a package,
1408 generic, or subprogram renaming declaration). Such files are also
1409 called @dfn{specs}.
1410
1411 @item @var{file}.adb
1412 Ada source code file containing a library unit body (a subprogram or
1413 package body). Such files are also called @dfn{bodies}.
1414
1415 @c GCC also knows about some suffixes for languages not yet included:
1416 @c Pascal:
1417 @c @var{file}.p
1418 @c @var{file}.pas
1419 @c Ratfor:
1420 @c @var{file}.r
1421
1422 @item @var{file}.s
1423 Assembler code.
1424
1425 @item @var{file}.S
1426 @itemx @var{file}.sx
1427 Assembler code that must be preprocessed.
1428
1429 @item @var{other}
1430 An object file to be fed straight into linking.
1431 Any file name with no recognized suffix is treated this way.
1432 @end table
1433
1434 @opindex x
1435 You can specify the input language explicitly with the @option{-x} option:
1436
1437 @table @gcctabopt
1438 @item -x @var{language}
1439 Specify explicitly the @var{language} for the following input files
1440 (rather than letting the compiler choose a default based on the file
1441 name suffix). This option applies to all following input files until
1442 the next @option{-x} option. Possible values for @var{language} are:
1443 @smallexample
1444 c c-header cpp-output
1445 c++ c++-header c++-cpp-output
1446 objective-c objective-c-header objective-c-cpp-output
1447 objective-c++ objective-c++-header objective-c++-cpp-output
1448 assembler assembler-with-cpp
1449 ada
1450 f77 f77-cpp-input f95 f95-cpp-input
1451 go
1452 brig
1453 @end smallexample
1454
1455 @item -x none
1456 Turn off any specification of a language, so that subsequent files are
1457 handled according to their file name suffixes (as they are if @option{-x}
1458 has not been used at all).
1459 @end table
1460
1461 If you only want some of the stages of compilation, you can use
1462 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1463 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1464 @command{gcc} is to stop. Note that some combinations (for example,
1465 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1466
1467 @table @gcctabopt
1468 @item -c
1469 @opindex c
1470 Compile or assemble the source files, but do not link. The linking
1471 stage simply is not done. The ultimate output is in the form of an
1472 object file for each source file.
1473
1474 By default, the object file name for a source file is made by replacing
1475 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1476
1477 Unrecognized input files, not requiring compilation or assembly, are
1478 ignored.
1479
1480 @item -S
1481 @opindex S
1482 Stop after the stage of compilation proper; do not assemble. The output
1483 is in the form of an assembler code file for each non-assembler input
1484 file specified.
1485
1486 By default, the assembler file name for a source file is made by
1487 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1488
1489 Input files that don't require compilation are ignored.
1490
1491 @item -E
1492 @opindex E
1493 Stop after the preprocessing stage; do not run the compiler proper. The
1494 output is in the form of preprocessed source code, which is sent to the
1495 standard output.
1496
1497 Input files that don't require preprocessing are ignored.
1498
1499 @cindex output file option
1500 @item -o @var{file}
1501 @opindex o
1502 Place output in file @var{file}. This applies to whatever
1503 sort of output is being produced, whether it be an executable file,
1504 an object file, an assembler file or preprocessed C code.
1505
1506 If @option{-o} is not specified, the default is to put an executable
1507 file in @file{a.out}, the object file for
1508 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1509 assembler file in @file{@var{source}.s}, a precompiled header file in
1510 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1511 standard output.
1512
1513 @item -v
1514 @opindex v
1515 Print (on standard error output) the commands executed to run the stages
1516 of compilation. Also print the version number of the compiler driver
1517 program and of the preprocessor and the compiler proper.
1518
1519 @item -###
1520 @opindex ###
1521 Like @option{-v} except the commands are not executed and arguments
1522 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1523 This is useful for shell scripts to capture the driver-generated command lines.
1524
1525 @item --help
1526 @opindex help
1527 Print (on the standard output) a description of the command-line options
1528 understood by @command{gcc}. If the @option{-v} option is also specified
1529 then @option{--help} is also passed on to the various processes
1530 invoked by @command{gcc}, so that they can display the command-line options
1531 they accept. If the @option{-Wextra} option has also been specified
1532 (prior to the @option{--help} option), then command-line options that
1533 have no documentation associated with them are also displayed.
1534
1535 @item --target-help
1536 @opindex target-help
1537 Print (on the standard output) a description of target-specific command-line
1538 options for each tool. For some targets extra target-specific
1539 information may also be printed.
1540
1541 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1542 Print (on the standard output) a description of the command-line
1543 options understood by the compiler that fit into all specified classes
1544 and qualifiers. These are the supported classes:
1545
1546 @table @asis
1547 @item @samp{optimizers}
1548 Display all of the optimization options supported by the
1549 compiler.
1550
1551 @item @samp{warnings}
1552 Display all of the options controlling warning messages
1553 produced by the compiler.
1554
1555 @item @samp{target}
1556 Display target-specific options. Unlike the
1557 @option{--target-help} option however, target-specific options of the
1558 linker and assembler are not displayed. This is because those
1559 tools do not currently support the extended @option{--help=} syntax.
1560
1561 @item @samp{params}
1562 Display the values recognized by the @option{--param}
1563 option.
1564
1565 @item @var{language}
1566 Display the options supported for @var{language}, where
1567 @var{language} is the name of one of the languages supported in this
1568 version of GCC@.
1569
1570 @item @samp{common}
1571 Display the options that are common to all languages.
1572 @end table
1573
1574 These are the supported qualifiers:
1575
1576 @table @asis
1577 @item @samp{undocumented}
1578 Display only those options that are undocumented.
1579
1580 @item @samp{joined}
1581 Display options taking an argument that appears after an equal
1582 sign in the same continuous piece of text, such as:
1583 @samp{--help=target}.
1584
1585 @item @samp{separate}
1586 Display options taking an argument that appears as a separate word
1587 following the original option, such as: @samp{-o output-file}.
1588 @end table
1589
1590 Thus for example to display all the undocumented target-specific
1591 switches supported by the compiler, use:
1592
1593 @smallexample
1594 --help=target,undocumented
1595 @end smallexample
1596
1597 The sense of a qualifier can be inverted by prefixing it with the
1598 @samp{^} character, so for example to display all binary warning
1599 options (i.e., ones that are either on or off and that do not take an
1600 argument) that have a description, use:
1601
1602 @smallexample
1603 --help=warnings,^joined,^undocumented
1604 @end smallexample
1605
1606 The argument to @option{--help=} should not consist solely of inverted
1607 qualifiers.
1608
1609 Combining several classes is possible, although this usually
1610 restricts the output so much that there is nothing to display. One
1611 case where it does work, however, is when one of the classes is
1612 @var{target}. For example, to display all the target-specific
1613 optimization options, use:
1614
1615 @smallexample
1616 --help=target,optimizers
1617 @end smallexample
1618
1619 The @option{--help=} option can be repeated on the command line. Each
1620 successive use displays its requested class of options, skipping
1621 those that have already been displayed.
1622
1623 If the @option{-Q} option appears on the command line before the
1624 @option{--help=} option, then the descriptive text displayed by
1625 @option{--help=} is changed. Instead of describing the displayed
1626 options, an indication is given as to whether the option is enabled,
1627 disabled or set to a specific value (assuming that the compiler
1628 knows this at the point where the @option{--help=} option is used).
1629
1630 Here is a truncated example from the ARM port of @command{gcc}:
1631
1632 @smallexample
1633 % gcc -Q -mabi=2 --help=target -c
1634 The following options are target specific:
1635 -mabi= 2
1636 -mabort-on-noreturn [disabled]
1637 -mapcs [disabled]
1638 @end smallexample
1639
1640 The output is sensitive to the effects of previous command-line
1641 options, so for example it is possible to find out which optimizations
1642 are enabled at @option{-O2} by using:
1643
1644 @smallexample
1645 -Q -O2 --help=optimizers
1646 @end smallexample
1647
1648 Alternatively you can discover which binary optimizations are enabled
1649 by @option{-O3} by using:
1650
1651 @smallexample
1652 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1653 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1654 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1655 @end smallexample
1656
1657 @item --version
1658 @opindex version
1659 Display the version number and copyrights of the invoked GCC@.
1660
1661 @item -pass-exit-codes
1662 @opindex pass-exit-codes
1663 Normally the @command{gcc} program exits with the code of 1 if any
1664 phase of the compiler returns a non-success return code. If you specify
1665 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1666 the numerically highest error produced by any phase returning an error
1667 indication. The C, C++, and Fortran front ends return 4 if an internal
1668 compiler error is encountered.
1669
1670 @item -pipe
1671 @opindex pipe
1672 Use pipes rather than temporary files for communication between the
1673 various stages of compilation. This fails to work on some systems where
1674 the assembler is unable to read from a pipe; but the GNU assembler has
1675 no trouble.
1676
1677 @item -specs=@var{file}
1678 @opindex specs
1679 Process @var{file} after the compiler reads in the standard @file{specs}
1680 file, in order to override the defaults which the @command{gcc} driver
1681 program uses when determining what switches to pass to @command{cc1},
1682 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1683 @option{-specs=@var{file}} can be specified on the command line, and they
1684 are processed in order, from left to right. @xref{Spec Files}, for
1685 information about the format of the @var{file}.
1686
1687 @item -wrapper
1688 @opindex wrapper
1689 Invoke all subcommands under a wrapper program. The name of the
1690 wrapper program and its parameters are passed as a comma separated
1691 list.
1692
1693 @smallexample
1694 gcc -c t.c -wrapper gdb,--args
1695 @end smallexample
1696
1697 @noindent
1698 This invokes all subprograms of @command{gcc} under
1699 @samp{gdb --args}, thus the invocation of @command{cc1} is
1700 @samp{gdb --args cc1 @dots{}}.
1701
1702 @item -ffile-prefix-map=@var{old}=@var{new}
1703 @opindex ffile-prefix-map
1704 When compiling files residing in directory @file{@var{old}}, record
1705 any references to them in the result of the compilation as if the
1706 files resided in directory @file{@var{new}} instead. Specifying this
1707 option is equivalent to specifying all the individual
1708 @option{-f*-prefix-map} options. This can be used to make reproducible
1709 builds that are location independent. See also
1710 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1711
1712 @item -fplugin=@var{name}.so
1713 @opindex fplugin
1714 Load the plugin code in file @var{name}.so, assumed to be a
1715 shared object to be dlopen'd by the compiler. The base name of
1716 the shared object file is used to identify the plugin for the
1717 purposes of argument parsing (See
1718 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1719 Each plugin should define the callback functions specified in the
1720 Plugins API.
1721
1722 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1723 @opindex fplugin-arg
1724 Define an argument called @var{key} with a value of @var{value}
1725 for the plugin called @var{name}.
1726
1727 @item -fdump-ada-spec@r{[}-slim@r{]}
1728 @opindex fdump-ada-spec
1729 For C and C++ source and include files, generate corresponding Ada specs.
1730 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1731 GNAT User's Guide}, which provides detailed documentation on this feature.
1732
1733 @item -fada-spec-parent=@var{unit}
1734 @opindex fada-spec-parent
1735 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1736 Ada specs as child units of parent @var{unit}.
1737
1738 @item -fdump-go-spec=@var{file}
1739 @opindex fdump-go-spec
1740 For input files in any language, generate corresponding Go
1741 declarations in @var{file}. This generates Go @code{const},
1742 @code{type}, @code{var}, and @code{func} declarations which may be a
1743 useful way to start writing a Go interface to code written in some
1744 other language.
1745
1746 @include @value{srcdir}/../libiberty/at-file.texi
1747 @end table
1748
1749 @node Invoking G++
1750 @section Compiling C++ Programs
1751
1752 @cindex suffixes for C++ source
1753 @cindex C++ source file suffixes
1754 C++ source files conventionally use one of the suffixes @samp{.C},
1755 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1756 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1757 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1758 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1759 files with these names and compiles them as C++ programs even if you
1760 call the compiler the same way as for compiling C programs (usually
1761 with the name @command{gcc}).
1762
1763 @findex g++
1764 @findex c++
1765 However, the use of @command{gcc} does not add the C++ library.
1766 @command{g++} is a program that calls GCC and automatically specifies linking
1767 against the C++ library. It treats @samp{.c},
1768 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1769 files unless @option{-x} is used. This program is also useful when
1770 precompiling a C header file with a @samp{.h} extension for use in C++
1771 compilations. On many systems, @command{g++} is also installed with
1772 the name @command{c++}.
1773
1774 @cindex invoking @command{g++}
1775 When you compile C++ programs, you may specify many of the same
1776 command-line options that you use for compiling programs in any
1777 language; or command-line options meaningful for C and related
1778 languages; or options that are meaningful only for C++ programs.
1779 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1780 explanations of options for languages related to C@.
1781 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1782 explanations of options that are meaningful only for C++ programs.
1783
1784 @node C Dialect Options
1785 @section Options Controlling C Dialect
1786 @cindex dialect options
1787 @cindex language dialect options
1788 @cindex options, dialect
1789
1790 The following options control the dialect of C (or languages derived
1791 from C, such as C++, Objective-C and Objective-C++) that the compiler
1792 accepts:
1793
1794 @table @gcctabopt
1795 @cindex ANSI support
1796 @cindex ISO support
1797 @item -ansi
1798 @opindex ansi
1799 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1800 equivalent to @option{-std=c++98}.
1801
1802 This turns off certain features of GCC that are incompatible with ISO
1803 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1804 such as the @code{asm} and @code{typeof} keywords, and
1805 predefined macros such as @code{unix} and @code{vax} that identify the
1806 type of system you are using. It also enables the undesirable and
1807 rarely used ISO trigraph feature. For the C compiler,
1808 it disables recognition of C++ style @samp{//} comments as well as
1809 the @code{inline} keyword.
1810
1811 The alternate keywords @code{__asm__}, @code{__extension__},
1812 @code{__inline__} and @code{__typeof__} continue to work despite
1813 @option{-ansi}. You would not want to use them in an ISO C program, of
1814 course, but it is useful to put them in header files that might be included
1815 in compilations done with @option{-ansi}. Alternate predefined macros
1816 such as @code{__unix__} and @code{__vax__} are also available, with or
1817 without @option{-ansi}.
1818
1819 The @option{-ansi} option does not cause non-ISO programs to be
1820 rejected gratuitously. For that, @option{-Wpedantic} is required in
1821 addition to @option{-ansi}. @xref{Warning Options}.
1822
1823 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1824 option is used. Some header files may notice this macro and refrain
1825 from declaring certain functions or defining certain macros that the
1826 ISO standard doesn't call for; this is to avoid interfering with any
1827 programs that might use these names for other things.
1828
1829 Functions that are normally built in but do not have semantics
1830 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1831 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1832 built-in functions provided by GCC}, for details of the functions
1833 affected.
1834
1835 @item -std=
1836 @opindex std
1837 Determine the language standard. @xref{Standards,,Language Standards
1838 Supported by GCC}, for details of these standard versions. This option
1839 is currently only supported when compiling C or C++.
1840
1841 The compiler can accept several base standards, such as @samp{c90} or
1842 @samp{c++98}, and GNU dialects of those standards, such as
1843 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1844 compiler accepts all programs following that standard plus those
1845 using GNU extensions that do not contradict it. For example,
1846 @option{-std=c90} turns off certain features of GCC that are
1847 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1848 keywords, but not other GNU extensions that do not have a meaning in
1849 ISO C90, such as omitting the middle term of a @code{?:}
1850 expression. On the other hand, when a GNU dialect of a standard is
1851 specified, all features supported by the compiler are enabled, even when
1852 those features change the meaning of the base standard. As a result, some
1853 strict-conforming programs may be rejected. The particular standard
1854 is used by @option{-Wpedantic} to identify which features are GNU
1855 extensions given that version of the standard. For example
1856 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1857 comments, while @option{-std=gnu99 -Wpedantic} does not.
1858
1859 A value for this option must be provided; possible values are
1860
1861 @table @samp
1862 @item c90
1863 @itemx c89
1864 @itemx iso9899:1990
1865 Support all ISO C90 programs (certain GNU extensions that conflict
1866 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1867
1868 @item iso9899:199409
1869 ISO C90 as modified in amendment 1.
1870
1871 @item c99
1872 @itemx c9x
1873 @itemx iso9899:1999
1874 @itemx iso9899:199x
1875 ISO C99. This standard is substantially completely supported, modulo
1876 bugs and floating-point issues
1877 (mainly but not entirely relating to optional C99 features from
1878 Annexes F and G). See
1879 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1880 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1881
1882 @item c11
1883 @itemx c1x
1884 @itemx iso9899:2011
1885 ISO C11, the 2011 revision of the ISO C standard. This standard is
1886 substantially completely supported, modulo bugs, floating-point issues
1887 (mainly but not entirely relating to optional C11 features from
1888 Annexes F and G) and the optional Annexes K (Bounds-checking
1889 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1890
1891 @item c17
1892 @itemx c18
1893 @itemx iso9899:2017
1894 @itemx iso9899:2018
1895 ISO C17, the 2017 revision of the ISO C standard (expected to be
1896 published in 2018). This standard is
1897 same as C11 except for corrections of defects (all of which are also
1898 applied with @option{-std=c11}) and a new value of
1899 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1900
1901 @item gnu90
1902 @itemx gnu89
1903 GNU dialect of ISO C90 (including some C99 features).
1904
1905 @item gnu99
1906 @itemx gnu9x
1907 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1908
1909 @item gnu11
1910 @itemx gnu1x
1911 GNU dialect of ISO C11.
1912 The name @samp{gnu1x} is deprecated.
1913
1914 @item gnu17
1915 @itemx gnu18
1916 GNU dialect of ISO C17. This is the default for C code.
1917
1918 @item c++98
1919 @itemx c++03
1920 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1921 additional defect reports. Same as @option{-ansi} for C++ code.
1922
1923 @item gnu++98
1924 @itemx gnu++03
1925 GNU dialect of @option{-std=c++98}.
1926
1927 @item c++11
1928 @itemx c++0x
1929 The 2011 ISO C++ standard plus amendments.
1930 The name @samp{c++0x} is deprecated.
1931
1932 @item gnu++11
1933 @itemx gnu++0x
1934 GNU dialect of @option{-std=c++11}.
1935 The name @samp{gnu++0x} is deprecated.
1936
1937 @item c++14
1938 @itemx c++1y
1939 The 2014 ISO C++ standard plus amendments.
1940 The name @samp{c++1y} is deprecated.
1941
1942 @item gnu++14
1943 @itemx gnu++1y
1944 GNU dialect of @option{-std=c++14}.
1945 This is the default for C++ code.
1946 The name @samp{gnu++1y} is deprecated.
1947
1948 @item c++17
1949 @itemx c++1z
1950 The 2017 ISO C++ standard plus amendments.
1951 The name @samp{c++1z} is deprecated.
1952
1953 @item gnu++17
1954 @itemx gnu++1z
1955 GNU dialect of @option{-std=c++17}.
1956 The name @samp{gnu++1z} is deprecated.
1957
1958 @item c++2a
1959 The next revision of the ISO C++ standard, tentatively planned for
1960 2020. Support is highly experimental, and will almost certainly
1961 change in incompatible ways in future releases.
1962
1963 @item gnu++2a
1964 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
1965 and will almost certainly change in incompatible ways in future
1966 releases.
1967 @end table
1968
1969 @item -fgnu89-inline
1970 @opindex fgnu89-inline
1971 The option @option{-fgnu89-inline} tells GCC to use the traditional
1972 GNU semantics for @code{inline} functions when in C99 mode.
1973 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1974 Using this option is roughly equivalent to adding the
1975 @code{gnu_inline} function attribute to all inline functions
1976 (@pxref{Function Attributes}).
1977
1978 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1979 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1980 specifies the default behavior).
1981 This option is not supported in @option{-std=c90} or
1982 @option{-std=gnu90} mode.
1983
1984 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1985 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1986 in effect for @code{inline} functions. @xref{Common Predefined
1987 Macros,,,cpp,The C Preprocessor}.
1988
1989 @item -fpermitted-flt-eval-methods=@var{style}
1990 @opindex fpermitted-flt-eval-methods
1991 @opindex fpermitted-flt-eval-methods=c11
1992 @opindex fpermitted-flt-eval-methods=ts-18661-3
1993 ISO/IEC TS 18661-3 defines new permissible values for
1994 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
1995 a semantic type that is an interchange or extended format should be
1996 evaluated to the precision and range of that type. These new values are
1997 a superset of those permitted under C99/C11, which does not specify the
1998 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
1999 conforming to C11 may not have been written expecting the possibility of
2000 the new values.
2001
2002 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2003 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2004 or the extended set of values specified in ISO/IEC TS 18661-3.
2005
2006 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2007
2008 The default when in a standards compliant mode (@option{-std=c11} or similar)
2009 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2010 dialect (@option{-std=gnu11} or similar) is
2011 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2012
2013 @item -aux-info @var{filename}
2014 @opindex aux-info
2015 Output to the given filename prototyped declarations for all functions
2016 declared and/or defined in a translation unit, including those in header
2017 files. This option is silently ignored in any language other than C@.
2018
2019 Besides declarations, the file indicates, in comments, the origin of
2020 each declaration (source file and line), whether the declaration was
2021 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2022 @samp{O} for old, respectively, in the first character after the line
2023 number and the colon), and whether it came from a declaration or a
2024 definition (@samp{C} or @samp{F}, respectively, in the following
2025 character). In the case of function definitions, a K&R-style list of
2026 arguments followed by their declarations is also provided, inside
2027 comments, after the declaration.
2028
2029 @item -fallow-parameterless-variadic-functions
2030 @opindex fallow-parameterless-variadic-functions
2031 Accept variadic functions without named parameters.
2032
2033 Although it is possible to define such a function, this is not very
2034 useful as it is not possible to read the arguments. This is only
2035 supported for C as this construct is allowed by C++.
2036
2037 @item -fno-asm
2038 @opindex fno-asm
2039 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2040 keyword, so that code can use these words as identifiers. You can use
2041 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2042 instead. @option{-ansi} implies @option{-fno-asm}.
2043
2044 In C++, this switch only affects the @code{typeof} keyword, since
2045 @code{asm} and @code{inline} are standard keywords. You may want to
2046 use the @option{-fno-gnu-keywords} flag instead, which has the same
2047 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2048 switch only affects the @code{asm} and @code{typeof} keywords, since
2049 @code{inline} is a standard keyword in ISO C99.
2050
2051 @item -fno-builtin
2052 @itemx -fno-builtin-@var{function}
2053 @opindex fno-builtin
2054 @cindex built-in functions
2055 Don't recognize built-in functions that do not begin with
2056 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2057 functions provided by GCC}, for details of the functions affected,
2058 including those which are not built-in functions when @option{-ansi} or
2059 @option{-std} options for strict ISO C conformance are used because they
2060 do not have an ISO standard meaning.
2061
2062 GCC normally generates special code to handle certain built-in functions
2063 more efficiently; for instance, calls to @code{alloca} may become single
2064 instructions which adjust the stack directly, and calls to @code{memcpy}
2065 may become inline copy loops. The resulting code is often both smaller
2066 and faster, but since the function calls no longer appear as such, you
2067 cannot set a breakpoint on those calls, nor can you change the behavior
2068 of the functions by linking with a different library. In addition,
2069 when a function is recognized as a built-in function, GCC may use
2070 information about that function to warn about problems with calls to
2071 that function, or to generate more efficient code, even if the
2072 resulting code still contains calls to that function. For example,
2073 warnings are given with @option{-Wformat} for bad calls to
2074 @code{printf} when @code{printf} is built in and @code{strlen} is
2075 known not to modify global memory.
2076
2077 With the @option{-fno-builtin-@var{function}} option
2078 only the built-in function @var{function} is
2079 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2080 function is named that is not built-in in this version of GCC, this
2081 option is ignored. There is no corresponding
2082 @option{-fbuiltin-@var{function}} option; if you wish to enable
2083 built-in functions selectively when using @option{-fno-builtin} or
2084 @option{-ffreestanding}, you may define macros such as:
2085
2086 @smallexample
2087 #define abs(n) __builtin_abs ((n))
2088 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2089 @end smallexample
2090
2091 @item -fgimple
2092 @opindex fgimple
2093
2094 Enable parsing of function definitions marked with @code{__GIMPLE}.
2095 This is an experimental feature that allows unit testing of GIMPLE
2096 passes.
2097
2098 @item -fhosted
2099 @opindex fhosted
2100 @cindex hosted environment
2101
2102 Assert that compilation targets a hosted environment. This implies
2103 @option{-fbuiltin}. A hosted environment is one in which the
2104 entire standard library is available, and in which @code{main} has a return
2105 type of @code{int}. Examples are nearly everything except a kernel.
2106 This is equivalent to @option{-fno-freestanding}.
2107
2108 @item -ffreestanding
2109 @opindex ffreestanding
2110 @cindex hosted environment
2111
2112 Assert that compilation targets a freestanding environment. This
2113 implies @option{-fno-builtin}. A freestanding environment
2114 is one in which the standard library may not exist, and program startup may
2115 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2116 This is equivalent to @option{-fno-hosted}.
2117
2118 @xref{Standards,,Language Standards Supported by GCC}, for details of
2119 freestanding and hosted environments.
2120
2121 @item -fopenacc
2122 @opindex fopenacc
2123 @cindex OpenACC accelerator programming
2124 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2125 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2126 compiler generates accelerated code according to the OpenACC Application
2127 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2128 implies @option{-pthread}, and thus is only supported on targets that
2129 have support for @option{-pthread}.
2130
2131 @item -fopenacc-dim=@var{geom}
2132 @opindex fopenacc-dim
2133 @cindex OpenACC accelerator programming
2134 Specify default compute dimensions for parallel offload regions that do
2135 not explicitly specify. The @var{geom} value is a triple of
2136 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2137 can be omitted, to use a target-specific default value.
2138
2139 @item -fopenmp
2140 @opindex fopenmp
2141 @cindex OpenMP parallel
2142 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2143 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2144 compiler generates parallel code according to the OpenMP Application
2145 Program Interface v4.5 @w{@uref{http://www.openmp.org/}}. This option
2146 implies @option{-pthread}, and thus is only supported on targets that
2147 have support for @option{-pthread}. @option{-fopenmp} implies
2148 @option{-fopenmp-simd}.
2149
2150 @item -fopenmp-simd
2151 @opindex fopenmp-simd
2152 @cindex OpenMP SIMD
2153 @cindex SIMD
2154 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2155 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2156 are ignored.
2157
2158 @item -fgnu-tm
2159 @opindex fgnu-tm
2160 When the option @option{-fgnu-tm} is specified, the compiler
2161 generates code for the Linux variant of Intel's current Transactional
2162 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2163 an experimental feature whose interface may change in future versions
2164 of GCC, as the official specification changes. Please note that not
2165 all architectures are supported for this feature.
2166
2167 For more information on GCC's support for transactional memory,
2168 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2169 Transactional Memory Library}.
2170
2171 Note that the transactional memory feature is not supported with
2172 non-call exceptions (@option{-fnon-call-exceptions}).
2173
2174 @item -fms-extensions
2175 @opindex fms-extensions
2176 Accept some non-standard constructs used in Microsoft header files.
2177
2178 In C++ code, this allows member names in structures to be similar
2179 to previous types declarations.
2180
2181 @smallexample
2182 typedef int UOW;
2183 struct ABC @{
2184 UOW UOW;
2185 @};
2186 @end smallexample
2187
2188 Some cases of unnamed fields in structures and unions are only
2189 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2190 fields within structs/unions}, for details.
2191
2192 Note that this option is off for all targets but x86
2193 targets using ms-abi.
2194
2195 @item -fplan9-extensions
2196 @opindex fplan9-extensions
2197 Accept some non-standard constructs used in Plan 9 code.
2198
2199 This enables @option{-fms-extensions}, permits passing pointers to
2200 structures with anonymous fields to functions that expect pointers to
2201 elements of the type of the field, and permits referring to anonymous
2202 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2203 struct/union fields within structs/unions}, for details. This is only
2204 supported for C, not C++.
2205
2206 @item -fcond-mismatch
2207 @opindex fcond-mismatch
2208 Allow conditional expressions with mismatched types in the second and
2209 third arguments. The value of such an expression is void. This option
2210 is not supported for C++.
2211
2212 @item -flax-vector-conversions
2213 @opindex flax-vector-conversions
2214 Allow implicit conversions between vectors with differing numbers of
2215 elements and/or incompatible element types. This option should not be
2216 used for new code.
2217
2218 @item -funsigned-char
2219 @opindex funsigned-char
2220 Let the type @code{char} be unsigned, like @code{unsigned char}.
2221
2222 Each kind of machine has a default for what @code{char} should
2223 be. It is either like @code{unsigned char} by default or like
2224 @code{signed char} by default.
2225
2226 Ideally, a portable program should always use @code{signed char} or
2227 @code{unsigned char} when it depends on the signedness of an object.
2228 But many programs have been written to use plain @code{char} and
2229 expect it to be signed, or expect it to be unsigned, depending on the
2230 machines they were written for. This option, and its inverse, let you
2231 make such a program work with the opposite default.
2232
2233 The type @code{char} is always a distinct type from each of
2234 @code{signed char} or @code{unsigned char}, even though its behavior
2235 is always just like one of those two.
2236
2237 @item -fsigned-char
2238 @opindex fsigned-char
2239 Let the type @code{char} be signed, like @code{signed char}.
2240
2241 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2242 the negative form of @option{-funsigned-char}. Likewise, the option
2243 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2244
2245 @item -fsigned-bitfields
2246 @itemx -funsigned-bitfields
2247 @itemx -fno-signed-bitfields
2248 @itemx -fno-unsigned-bitfields
2249 @opindex fsigned-bitfields
2250 @opindex funsigned-bitfields
2251 @opindex fno-signed-bitfields
2252 @opindex fno-unsigned-bitfields
2253 These options control whether a bit-field is signed or unsigned, when the
2254 declaration does not use either @code{signed} or @code{unsigned}. By
2255 default, such a bit-field is signed, because this is consistent: the
2256 basic integer types such as @code{int} are signed types.
2257
2258 @item -fsso-struct=@var{endianness}
2259 @opindex fsso-struct
2260 Set the default scalar storage order of structures and unions to the
2261 specified endianness. The accepted values are @samp{big-endian},
2262 @samp{little-endian} and @samp{native} for the native endianness of
2263 the target (the default). This option is not supported for C++.
2264
2265 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2266 code that is not binary compatible with code generated without it if the
2267 specified endianness is not the native endianness of the target.
2268 @end table
2269
2270 @node C++ Dialect Options
2271 @section Options Controlling C++ Dialect
2272
2273 @cindex compiler options, C++
2274 @cindex C++ options, command-line
2275 @cindex options, C++
2276 This section describes the command-line options that are only meaningful
2277 for C++ programs. You can also use most of the GNU compiler options
2278 regardless of what language your program is in. For example, you
2279 might compile a file @file{firstClass.C} like this:
2280
2281 @smallexample
2282 g++ -g -fstrict-enums -O -c firstClass.C
2283 @end smallexample
2284
2285 @noindent
2286 In this example, only @option{-fstrict-enums} is an option meant
2287 only for C++ programs; you can use the other options with any
2288 language supported by GCC@.
2289
2290 Some options for compiling C programs, such as @option{-std}, are also
2291 relevant for C++ programs.
2292 @xref{C Dialect Options,,Options Controlling C Dialect}.
2293
2294 Here is a list of options that are @emph{only} for compiling C++ programs:
2295
2296 @table @gcctabopt
2297
2298 @item -fabi-version=@var{n}
2299 @opindex fabi-version
2300 Use version @var{n} of the C++ ABI@. The default is version 0.
2301
2302 Version 0 refers to the version conforming most closely to
2303 the C++ ABI specification. Therefore, the ABI obtained using version 0
2304 will change in different versions of G++ as ABI bugs are fixed.
2305
2306 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2307
2308 Version 2 is the version of the C++ ABI that first appeared in G++
2309 3.4, and was the default through G++ 4.9.
2310
2311 Version 3 corrects an error in mangling a constant address as a
2312 template argument.
2313
2314 Version 4, which first appeared in G++ 4.5, implements a standard
2315 mangling for vector types.
2316
2317 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2318 attribute const/volatile on function pointer types, decltype of a
2319 plain decl, and use of a function parameter in the declaration of
2320 another parameter.
2321
2322 Version 6, which first appeared in G++ 4.7, corrects the promotion
2323 behavior of C++11 scoped enums and the mangling of template argument
2324 packs, const/static_cast, prefix ++ and --, and a class scope function
2325 used as a template argument.
2326
2327 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2328 builtin type and corrects the mangling of lambdas in default argument
2329 scope.
2330
2331 Version 8, which first appeared in G++ 4.9, corrects the substitution
2332 behavior of function types with function-cv-qualifiers.
2333
2334 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2335 @code{nullptr_t}.
2336
2337 Version 10, which first appeared in G++ 6.1, adds mangling of
2338 attributes that affect type identity, such as ia32 calling convention
2339 attributes (e.g. @samp{stdcall}).
2340
2341 Version 11, which first appeared in G++ 7, corrects the mangling of
2342 sizeof... expressions and operator names. For multiple entities with
2343 the same name within a function, that are declared in different scopes,
2344 the mangling now changes starting with the twelfth occurrence. It also
2345 implies @option{-fnew-inheriting-ctors}.
2346
2347 See also @option{-Wabi}.
2348
2349 @item -fabi-compat-version=@var{n}
2350 @opindex fabi-compat-version
2351 On targets that support strong aliases, G++
2352 works around mangling changes by creating an alias with the correct
2353 mangled name when defining a symbol with an incorrect mangled name.
2354 This switch specifies which ABI version to use for the alias.
2355
2356 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2357 compatibility). If another ABI version is explicitly selected, this
2358 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2359 use @option{-fabi-compat-version=2}.
2360
2361 If this option is not provided but @option{-Wabi=@var{n}} is, that
2362 version is used for compatibility aliases. If this option is provided
2363 along with @option{-Wabi} (without the version), the version from this
2364 option is used for the warning.
2365
2366 @item -fno-access-control
2367 @opindex fno-access-control
2368 Turn off all access checking. This switch is mainly useful for working
2369 around bugs in the access control code.
2370
2371 @item -faligned-new
2372 @opindex faligned-new
2373 Enable support for C++17 @code{new} of types that require more
2374 alignment than @code{void* ::operator new(std::size_t)} provides. A
2375 numeric argument such as @code{-faligned-new=32} can be used to
2376 specify how much alignment (in bytes) is provided by that function,
2377 but few users will need to override the default of
2378 @code{alignof(std::max_align_t)}.
2379
2380 This flag is enabled by default for @option{-std=c++17}.
2381
2382 @item -fcheck-new
2383 @opindex fcheck-new
2384 Check that the pointer returned by @code{operator new} is non-null
2385 before attempting to modify the storage allocated. This check is
2386 normally unnecessary because the C++ standard specifies that
2387 @code{operator new} only returns @code{0} if it is declared
2388 @code{throw()}, in which case the compiler always checks the
2389 return value even without this option. In all other cases, when
2390 @code{operator new} has a non-empty exception specification, memory
2391 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2392 @samp{new (nothrow)}.
2393
2394 @item -fconcepts
2395 @opindex fconcepts
2396 Enable support for the C++ Extensions for Concepts Technical
2397 Specification, ISO 19217 (2015), which allows code like
2398
2399 @smallexample
2400 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2401 template <Addable T> T add (T a, T b) @{ return a + b; @}
2402 @end smallexample
2403
2404 @item -fconstexpr-depth=@var{n}
2405 @opindex fconstexpr-depth
2406 Set the maximum nested evaluation depth for C++11 constexpr functions
2407 to @var{n}. A limit is needed to detect endless recursion during
2408 constant expression evaluation. The minimum specified by the standard
2409 is 512.
2410
2411 @item -fconstexpr-loop-limit=@var{n}
2412 @opindex fconstexpr-loop-limit
2413 Set the maximum number of iterations for a loop in C++14 constexpr functions
2414 to @var{n}. A limit is needed to detect infinite loops during
2415 constant expression evaluation. The default is 262144 (1<<18).
2416
2417 @item -fdeduce-init-list
2418 @opindex fdeduce-init-list
2419 Enable deduction of a template type parameter as
2420 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2421
2422 @smallexample
2423 template <class T> auto forward(T t) -> decltype (realfn (t))
2424 @{
2425 return realfn (t);
2426 @}
2427
2428 void f()
2429 @{
2430 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2431 @}
2432 @end smallexample
2433
2434 This deduction was implemented as a possible extension to the
2435 originally proposed semantics for the C++11 standard, but was not part
2436 of the final standard, so it is disabled by default. This option is
2437 deprecated, and may be removed in a future version of G++.
2438
2439 @item -ffriend-injection
2440 @opindex ffriend-injection
2441 Inject friend functions into the enclosing namespace, so that they are
2442 visible outside the scope of the class in which they are declared.
2443 Friend functions were documented to work this way in the old Annotated
2444 C++ Reference Manual.
2445 However, in ISO C++ a friend function that is not declared
2446 in an enclosing scope can only be found using argument dependent
2447 lookup. GCC defaults to the standard behavior.
2448
2449 This option is for compatibility, and may be removed in a future
2450 release of G++.
2451
2452 @item -fno-elide-constructors
2453 @opindex fno-elide-constructors
2454 The C++ standard allows an implementation to omit creating a temporary
2455 that is only used to initialize another object of the same type.
2456 Specifying this option disables that optimization, and forces G++ to
2457 call the copy constructor in all cases. This option also causes G++
2458 to call trivial member functions which otherwise would be expanded inline.
2459
2460 In C++17, the compiler is required to omit these temporaries, but this
2461 option still affects trivial member functions.
2462
2463 @item -fno-enforce-eh-specs
2464 @opindex fno-enforce-eh-specs
2465 Don't generate code to check for violation of exception specifications
2466 at run time. This option violates the C++ standard, but may be useful
2467 for reducing code size in production builds, much like defining
2468 @code{NDEBUG}. This does not give user code permission to throw
2469 exceptions in violation of the exception specifications; the compiler
2470 still optimizes based on the specifications, so throwing an
2471 unexpected exception results in undefined behavior at run time.
2472
2473 @item -fextern-tls-init
2474 @itemx -fno-extern-tls-init
2475 @opindex fextern-tls-init
2476 @opindex fno-extern-tls-init
2477 The C++11 and OpenMP standards allow @code{thread_local} and
2478 @code{threadprivate} variables to have dynamic (runtime)
2479 initialization. To support this, any use of such a variable goes
2480 through a wrapper function that performs any necessary initialization.
2481 When the use and definition of the variable are in the same
2482 translation unit, this overhead can be optimized away, but when the
2483 use is in a different translation unit there is significant overhead
2484 even if the variable doesn't actually need dynamic initialization. If
2485 the programmer can be sure that no use of the variable in a
2486 non-defining TU needs to trigger dynamic initialization (either
2487 because the variable is statically initialized, or a use of the
2488 variable in the defining TU will be executed before any uses in
2489 another TU), they can avoid this overhead with the
2490 @option{-fno-extern-tls-init} option.
2491
2492 On targets that support symbol aliases, the default is
2493 @option{-fextern-tls-init}. On targets that do not support symbol
2494 aliases, the default is @option{-fno-extern-tls-init}.
2495
2496 @item -ffor-scope
2497 @itemx -fno-for-scope
2498 @opindex ffor-scope
2499 @opindex fno-for-scope
2500 If @option{-ffor-scope} is specified, the scope of variables declared in
2501 a @i{for-init-statement} is limited to the @code{for} loop itself,
2502 as specified by the C++ standard.
2503 If @option{-fno-for-scope} is specified, the scope of variables declared in
2504 a @i{for-init-statement} extends to the end of the enclosing scope,
2505 as was the case in old versions of G++, and other (traditional)
2506 implementations of C++.
2507
2508 This option is deprecated and the associated non-standard
2509 functionality will be removed.
2510
2511 @item -fno-gnu-keywords
2512 @opindex fno-gnu-keywords
2513 Do not recognize @code{typeof} as a keyword, so that code can use this
2514 word as an identifier. You can use the keyword @code{__typeof__} instead.
2515 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2516 @option{-std=c++98}, @option{-std=c++11}, etc.
2517
2518 @item -fno-implicit-templates
2519 @opindex fno-implicit-templates
2520 Never emit code for non-inline templates that are instantiated
2521 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2522 @xref{Template Instantiation}, for more information.
2523
2524 @item -fno-implicit-inline-templates
2525 @opindex fno-implicit-inline-templates
2526 Don't emit code for implicit instantiations of inline templates, either.
2527 The default is to handle inlines differently so that compiles with and
2528 without optimization need the same set of explicit instantiations.
2529
2530 @item -fno-implement-inlines
2531 @opindex fno-implement-inlines
2532 To save space, do not emit out-of-line copies of inline functions
2533 controlled by @code{#pragma implementation}. This causes linker
2534 errors if these functions are not inlined everywhere they are called.
2535
2536 @item -fms-extensions
2537 @opindex fms-extensions
2538 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2539 int and getting a pointer to member function via non-standard syntax.
2540
2541 @item -fnew-inheriting-ctors
2542 @opindex fnew-inheriting-ctors
2543 Enable the P0136 adjustment to the semantics of C++11 constructor
2544 inheritance. This is part of C++17 but also considered to be a Defect
2545 Report against C++11 and C++14. This flag is enabled by default
2546 unless @option{-fabi-version=10} or lower is specified.
2547
2548 @item -fnew-ttp-matching
2549 @opindex fnew-ttp-matching
2550 Enable the P0522 resolution to Core issue 150, template template
2551 parameters and default arguments: this allows a template with default
2552 template arguments as an argument for a template template parameter
2553 with fewer template parameters. This flag is enabled by default for
2554 @option{-std=c++17}.
2555
2556 @item -fno-nonansi-builtins
2557 @opindex fno-nonansi-builtins
2558 Disable built-in declarations of functions that are not mandated by
2559 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2560 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2561
2562 @item -fnothrow-opt
2563 @opindex fnothrow-opt
2564 Treat a @code{throw()} exception specification as if it were a
2565 @code{noexcept} specification to reduce or eliminate the text size
2566 overhead relative to a function with no exception specification. If
2567 the function has local variables of types with non-trivial
2568 destructors, the exception specification actually makes the
2569 function smaller because the EH cleanups for those variables can be
2570 optimized away. The semantic effect is that an exception thrown out of
2571 a function with such an exception specification results in a call
2572 to @code{terminate} rather than @code{unexpected}.
2573
2574 @item -fno-operator-names
2575 @opindex fno-operator-names
2576 Do not treat the operator name keywords @code{and}, @code{bitand},
2577 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2578 synonyms as keywords.
2579
2580 @item -fno-optional-diags
2581 @opindex fno-optional-diags
2582 Disable diagnostics that the standard says a compiler does not need to
2583 issue. Currently, the only such diagnostic issued by G++ is the one for
2584 a name having multiple meanings within a class.
2585
2586 @item -fpermissive
2587 @opindex fpermissive
2588 Downgrade some diagnostics about nonconformant code from errors to
2589 warnings. Thus, using @option{-fpermissive} allows some
2590 nonconforming code to compile.
2591
2592 @item -fno-pretty-templates
2593 @opindex fno-pretty-templates
2594 When an error message refers to a specialization of a function
2595 template, the compiler normally prints the signature of the
2596 template followed by the template arguments and any typedefs or
2597 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2598 rather than @code{void f(int)}) so that it's clear which template is
2599 involved. When an error message refers to a specialization of a class
2600 template, the compiler omits any template arguments that match
2601 the default template arguments for that template. If either of these
2602 behaviors make it harder to understand the error message rather than
2603 easier, you can use @option{-fno-pretty-templates} to disable them.
2604
2605 @item -frepo
2606 @opindex frepo
2607 Enable automatic template instantiation at link time. This option also
2608 implies @option{-fno-implicit-templates}. @xref{Template
2609 Instantiation}, for more information.
2610
2611 @item -fno-rtti
2612 @opindex fno-rtti
2613 Disable generation of information about every class with virtual
2614 functions for use by the C++ run-time type identification features
2615 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2616 of the language, you can save some space by using this flag. Note that
2617 exception handling uses the same information, but G++ generates it as
2618 needed. The @code{dynamic_cast} operator can still be used for casts that
2619 do not require run-time type information, i.e.@: casts to @code{void *} or to
2620 unambiguous base classes.
2621
2622 @item -fsized-deallocation
2623 @opindex fsized-deallocation
2624 Enable the built-in global declarations
2625 @smallexample
2626 void operator delete (void *, std::size_t) noexcept;
2627 void operator delete[] (void *, std::size_t) noexcept;
2628 @end smallexample
2629 as introduced in C++14. This is useful for user-defined replacement
2630 deallocation functions that, for example, use the size of the object
2631 to make deallocation faster. Enabled by default under
2632 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2633 warns about places that might want to add a definition.
2634
2635 @item -fstrict-enums
2636 @opindex fstrict-enums
2637 Allow the compiler to optimize using the assumption that a value of
2638 enumerated type can only be one of the values of the enumeration (as
2639 defined in the C++ standard; basically, a value that can be
2640 represented in the minimum number of bits needed to represent all the
2641 enumerators). This assumption may not be valid if the program uses a
2642 cast to convert an arbitrary integer value to the enumerated type.
2643
2644 @item -fstrong-eval-order
2645 @opindex fstrong-eval-order
2646 Evaluate member access, array subscripting, and shift expressions in
2647 left-to-right order, and evaluate assignment in right-to-left order,
2648 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2649 @option{-fstrong-eval-order=some} enables just the ordering of member
2650 access and shift expressions, and is the default without
2651 @option{-std=c++17}.
2652
2653 @item -ftemplate-backtrace-limit=@var{n}
2654 @opindex ftemplate-backtrace-limit
2655 Set the maximum number of template instantiation notes for a single
2656 warning or error to @var{n}. The default value is 10.
2657
2658 @item -ftemplate-depth=@var{n}
2659 @opindex ftemplate-depth
2660 Set the maximum instantiation depth for template classes to @var{n}.
2661 A limit on the template instantiation depth is needed to detect
2662 endless recursions during template class instantiation. ANSI/ISO C++
2663 conforming programs must not rely on a maximum depth greater than 17
2664 (changed to 1024 in C++11). The default value is 900, as the compiler
2665 can run out of stack space before hitting 1024 in some situations.
2666
2667 @item -fno-threadsafe-statics
2668 @opindex fno-threadsafe-statics
2669 Do not emit the extra code to use the routines specified in the C++
2670 ABI for thread-safe initialization of local statics. You can use this
2671 option to reduce code size slightly in code that doesn't need to be
2672 thread-safe.
2673
2674 @item -fuse-cxa-atexit
2675 @opindex fuse-cxa-atexit
2676 Register destructors for objects with static storage duration with the
2677 @code{__cxa_atexit} function rather than the @code{atexit} function.
2678 This option is required for fully standards-compliant handling of static
2679 destructors, but only works if your C library supports
2680 @code{__cxa_atexit}.
2681
2682 @item -fno-use-cxa-get-exception-ptr
2683 @opindex fno-use-cxa-get-exception-ptr
2684 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2685 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2686 if the runtime routine is not available.
2687
2688 @item -fvisibility-inlines-hidden
2689 @opindex fvisibility-inlines-hidden
2690 This switch declares that the user does not attempt to compare
2691 pointers to inline functions or methods where the addresses of the two functions
2692 are taken in different shared objects.
2693
2694 The effect of this is that GCC may, effectively, mark inline methods with
2695 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2696 appear in the export table of a DSO and do not require a PLT indirection
2697 when used within the DSO@. Enabling this option can have a dramatic effect
2698 on load and link times of a DSO as it massively reduces the size of the
2699 dynamic export table when the library makes heavy use of templates.
2700
2701 The behavior of this switch is not quite the same as marking the
2702 methods as hidden directly, because it does not affect static variables
2703 local to the function or cause the compiler to deduce that
2704 the function is defined in only one shared object.
2705
2706 You may mark a method as having a visibility explicitly to negate the
2707 effect of the switch for that method. For example, if you do want to
2708 compare pointers to a particular inline method, you might mark it as
2709 having default visibility. Marking the enclosing class with explicit
2710 visibility has no effect.
2711
2712 Explicitly instantiated inline methods are unaffected by this option
2713 as their linkage might otherwise cross a shared library boundary.
2714 @xref{Template Instantiation}.
2715
2716 @item -fvisibility-ms-compat
2717 @opindex fvisibility-ms-compat
2718 This flag attempts to use visibility settings to make GCC's C++
2719 linkage model compatible with that of Microsoft Visual Studio.
2720
2721 The flag makes these changes to GCC's linkage model:
2722
2723 @enumerate
2724 @item
2725 It sets the default visibility to @code{hidden}, like
2726 @option{-fvisibility=hidden}.
2727
2728 @item
2729 Types, but not their members, are not hidden by default.
2730
2731 @item
2732 The One Definition Rule is relaxed for types without explicit
2733 visibility specifications that are defined in more than one
2734 shared object: those declarations are permitted if they are
2735 permitted when this option is not used.
2736 @end enumerate
2737
2738 In new code it is better to use @option{-fvisibility=hidden} and
2739 export those classes that are intended to be externally visible.
2740 Unfortunately it is possible for code to rely, perhaps accidentally,
2741 on the Visual Studio behavior.
2742
2743 Among the consequences of these changes are that static data members
2744 of the same type with the same name but defined in different shared
2745 objects are different, so changing one does not change the other;
2746 and that pointers to function members defined in different shared
2747 objects may not compare equal. When this flag is given, it is a
2748 violation of the ODR to define types with the same name differently.
2749
2750 @item -fno-weak
2751 @opindex fno-weak
2752 Do not use weak symbol support, even if it is provided by the linker.
2753 By default, G++ uses weak symbols if they are available. This
2754 option exists only for testing, and should not be used by end-users;
2755 it results in inferior code and has no benefits. This option may
2756 be removed in a future release of G++.
2757
2758 @item -nostdinc++
2759 @opindex nostdinc++
2760 Do not search for header files in the standard directories specific to
2761 C++, but do still search the other standard directories. (This option
2762 is used when building the C++ library.)
2763 @end table
2764
2765 In addition, these optimization, warning, and code generation options
2766 have meanings only for C++ programs:
2767
2768 @table @gcctabopt
2769 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2770 @opindex Wabi
2771 @opindex Wno-abi
2772 Warn when G++ it generates code that is probably not compatible with
2773 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2774 ABI with each major release, normally @option{-Wabi} will warn only if
2775 there is a check added later in a release series for an ABI issue
2776 discovered since the initial release. @option{-Wabi} will warn about
2777 more things if an older ABI version is selected (with
2778 @option{-fabi-version=@var{n}}).
2779
2780 @option{-Wabi} can also be used with an explicit version number to
2781 warn about compatibility with a particular @option{-fabi-version}
2782 level, e.g. @option{-Wabi=2} to warn about changes relative to
2783 @option{-fabi-version=2}.
2784
2785 If an explicit version number is provided and
2786 @option{-fabi-compat-version} is not specified, the version number
2787 from this option is used for compatibility aliases. If no explicit
2788 version number is provided with this option, but
2789 @option{-fabi-compat-version} is specified, that version number is
2790 used for ABI warnings.
2791
2792 Although an effort has been made to warn about
2793 all such cases, there are probably some cases that are not warned about,
2794 even though G++ is generating incompatible code. There may also be
2795 cases where warnings are emitted even though the code that is generated
2796 is compatible.
2797
2798 You should rewrite your code to avoid these warnings if you are
2799 concerned about the fact that code generated by G++ may not be binary
2800 compatible with code generated by other compilers.
2801
2802 Known incompatibilities in @option{-fabi-version=2} (which was the
2803 default from GCC 3.4 to 4.9) include:
2804
2805 @itemize @bullet
2806
2807 @item
2808 A template with a non-type template parameter of reference type was
2809 mangled incorrectly:
2810 @smallexample
2811 extern int N;
2812 template <int &> struct S @{@};
2813 void n (S<N>) @{2@}
2814 @end smallexample
2815
2816 This was fixed in @option{-fabi-version=3}.
2817
2818 @item
2819 SIMD vector types declared using @code{__attribute ((vector_size))} were
2820 mangled in a non-standard way that does not allow for overloading of
2821 functions taking vectors of different sizes.
2822
2823 The mangling was changed in @option{-fabi-version=4}.
2824
2825 @item
2826 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2827 qualifiers, and @code{decltype} of a plain declaration was folded away.
2828
2829 These mangling issues were fixed in @option{-fabi-version=5}.
2830
2831 @item
2832 Scoped enumerators passed as arguments to a variadic function are
2833 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2834 On most targets this does not actually affect the parameter passing
2835 ABI, as there is no way to pass an argument smaller than @code{int}.
2836
2837 Also, the ABI changed the mangling of template argument packs,
2838 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2839 a class scope function used as a template argument.
2840
2841 These issues were corrected in @option{-fabi-version=6}.
2842
2843 @item
2844 Lambdas in default argument scope were mangled incorrectly, and the
2845 ABI changed the mangling of @code{nullptr_t}.
2846
2847 These issues were corrected in @option{-fabi-version=7}.
2848
2849 @item
2850 When mangling a function type with function-cv-qualifiers, the
2851 un-qualified function type was incorrectly treated as a substitution
2852 candidate.
2853
2854 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2855
2856 @item
2857 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2858 unaligned accesses. Note that this did not affect the ABI of a
2859 function with a @code{nullptr_t} parameter, as parameters have a
2860 minimum alignment.
2861
2862 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2863
2864 @item
2865 Target-specific attributes that affect the identity of a type, such as
2866 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2867 did not affect the mangled name, leading to name collisions when
2868 function pointers were used as template arguments.
2869
2870 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2871
2872 @end itemize
2873
2874 It also warns about psABI-related changes. The known psABI changes at this
2875 point include:
2876
2877 @itemize @bullet
2878
2879 @item
2880 For SysV/x86-64, unions with @code{long double} members are
2881 passed in memory as specified in psABI. For example:
2882
2883 @smallexample
2884 union U @{
2885 long double ld;
2886 int i;
2887 @};
2888 @end smallexample
2889
2890 @noindent
2891 @code{union U} is always passed in memory.
2892
2893 @end itemize
2894
2895 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2896 @opindex Wabi-tag
2897 @opindex -Wabi-tag
2898 Warn when a type with an ABI tag is used in a context that does not
2899 have that ABI tag. See @ref{C++ Attributes} for more information
2900 about ABI tags.
2901
2902 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2903 @opindex Wctor-dtor-privacy
2904 @opindex Wno-ctor-dtor-privacy
2905 Warn when a class seems unusable because all the constructors or
2906 destructors in that class are private, and it has neither friends nor
2907 public static member functions. Also warn if there are no non-private
2908 methods, and there's at least one private member function that isn't
2909 a constructor or destructor.
2910
2911 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2912 @opindex Wdelete-non-virtual-dtor
2913 @opindex Wno-delete-non-virtual-dtor
2914 Warn when @code{delete} is used to destroy an instance of a class that
2915 has virtual functions and non-virtual destructor. It is unsafe to delete
2916 an instance of a derived class through a pointer to a base class if the
2917 base class does not have a virtual destructor. This warning is enabled
2918 by @option{-Wall}.
2919
2920 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2921 @opindex Wliteral-suffix
2922 @opindex Wno-literal-suffix
2923 Warn when a string or character literal is followed by a ud-suffix which does
2924 not begin with an underscore. As a conforming extension, GCC treats such
2925 suffixes as separate preprocessing tokens in order to maintain backwards
2926 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2927 For example:
2928
2929 @smallexample
2930 #define __STDC_FORMAT_MACROS
2931 #include <inttypes.h>
2932 #include <stdio.h>
2933
2934 int main() @{
2935 int64_t i64 = 123;
2936 printf("My int64: %" PRId64"\n", i64);
2937 @}
2938 @end smallexample
2939
2940 In this case, @code{PRId64} is treated as a separate preprocessing token.
2941
2942 Additionally, warn when a user-defined literal operator is declared with
2943 a literal suffix identifier that doesn't begin with an underscore. Literal
2944 suffix identifiers that don't begin with an underscore are reserved for
2945 future standardization.
2946
2947 This warning is enabled by default.
2948
2949 @item -Wlto-type-mismatch
2950 @opindex Wlto-type-mismatch
2951 @opindex Wno-lto-type-mismatch
2952
2953 During the link-time optimization warn about type mismatches in
2954 global declarations from different compilation units.
2955 Requires @option{-flto} to be enabled. Enabled by default.
2956
2957 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
2958 @opindex Wnarrowing
2959 @opindex Wno-narrowing
2960 For C++11 and later standards, narrowing conversions are diagnosed by default,
2961 as required by the standard. A narrowing conversion from a constant produces
2962 an error, and a narrowing conversion from a non-constant produces a warning,
2963 but @option{-Wno-narrowing} suppresses the diagnostic.
2964 Note that this does not affect the meaning of well-formed code;
2965 narrowing conversions are still considered ill-formed in SFINAE contexts.
2966
2967 With @option{-Wnarrowing} in C++98, warn when a narrowing
2968 conversion prohibited by C++11 occurs within
2969 @samp{@{ @}}, e.g.
2970
2971 @smallexample
2972 int i = @{ 2.2 @}; // error: narrowing from double to int
2973 @end smallexample
2974
2975 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2976
2977 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2978 @opindex Wnoexcept
2979 @opindex Wno-noexcept
2980 Warn when a noexcept-expression evaluates to false because of a call
2981 to a function that does not have a non-throwing exception
2982 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2983 the compiler to never throw an exception.
2984
2985 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
2986 @opindex Wnoexcept-type
2987 @opindex Wno-noexcept-type
2988 Warn if the C++17 feature making @code{noexcept} part of a function
2989 type changes the mangled name of a symbol relative to C++14. Enabled
2990 by @option{-Wabi} and @option{-Wc++17-compat}.
2991
2992 As an example:
2993
2994 @smallexample
2995 template <class T> void f(T t) @{ t(); @};
2996 void g() noexcept;
2997 void h() @{ f(g); @}
2998 @end smallexample
2999
3000 @noindent
3001 In C++14, @code{f} calls calls @code{f<void(*)()>}, but in
3002 C++17 it calls @code{f<void(*)()noexcept>}.
3003
3004 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3005 @opindex Wclass-memaccess
3006 Warn when the destination of a call to a raw memory function such as
3007 @code{memset} or @code{memcpy} is an object of class type, and when writing
3008 into such an object might bypass the class non-trivial or deleted constructor
3009 or copy assignment, violate const-correctness or encapsulation, or corrupt
3010 virtual table pointers. Modifying the representation of such objects may
3011 violate invariants maintained by member functions of the class. For example,
3012 the call to @code{memset} below is undefined because it modifies a non-trivial
3013 class object and is, therefore, diagnosed. The safe way to either initialize
3014 or clear the storage of objects of such types is by using the appropriate
3015 constructor or assignment operator, if one is available.
3016 @smallexample
3017 std::string str = "abc";
3018 memset (&str, 0, sizeof str);
3019 @end smallexample
3020 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3021 Explicitly casting the pointer to the class object to @code{void *} or
3022 to a type that can be safely accessed by the raw memory function suppresses
3023 the warning.
3024
3025 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3026 @opindex Wnon-virtual-dtor
3027 @opindex Wno-non-virtual-dtor
3028 Warn when a class has virtual functions and an accessible non-virtual
3029 destructor itself or in an accessible polymorphic base class, in which
3030 case it is possible but unsafe to delete an instance of a derived
3031 class through a pointer to the class itself or base class. This
3032 warning is automatically enabled if @option{-Weffc++} is specified.
3033
3034 @item -Wregister @r{(C++ and Objective-C++ only)}
3035 @opindex Wregister
3036 @opindex Wno-register
3037 Warn on uses of the @code{register} storage class specifier, except
3038 when it is part of the GNU @ref{Explicit Register Variables} extension.
3039 The use of the @code{register} keyword as storage class specifier has
3040 been deprecated in C++11 and removed in C++17.
3041 Enabled by default with @option{-std=c++17}.
3042
3043 @item -Wreorder @r{(C++ and Objective-C++ only)}
3044 @opindex Wreorder
3045 @opindex Wno-reorder
3046 @cindex reordering, warning
3047 @cindex warning for reordering of member initializers
3048 Warn when the order of member initializers given in the code does not
3049 match the order in which they must be executed. For instance:
3050
3051 @smallexample
3052 struct A @{
3053 int i;
3054 int j;
3055 A(): j (0), i (1) @{ @}
3056 @};
3057 @end smallexample
3058
3059 @noindent
3060 The compiler rearranges the member initializers for @code{i}
3061 and @code{j} to match the declaration order of the members, emitting
3062 a warning to that effect. This warning is enabled by @option{-Wall}.
3063
3064 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3065 @opindex fext-numeric-literals
3066 @opindex fno-ext-numeric-literals
3067 Accept imaginary, fixed-point, or machine-defined
3068 literal number suffixes as GNU extensions.
3069 When this option is turned off these suffixes are treated
3070 as C++11 user-defined literal numeric suffixes.
3071 This is on by default for all pre-C++11 dialects and all GNU dialects:
3072 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3073 @option{-std=gnu++14}.
3074 This option is off by default
3075 for ISO C++11 onwards (@option{-std=c++11}, ...).
3076 @end table
3077
3078 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3079
3080 @table @gcctabopt
3081 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3082 @opindex Weffc++
3083 @opindex Wno-effc++
3084 Warn about violations of the following style guidelines from Scott Meyers'
3085 @cite{Effective C++} series of books:
3086
3087 @itemize @bullet
3088 @item
3089 Define a copy constructor and an assignment operator for classes
3090 with dynamically-allocated memory.
3091
3092 @item
3093 Prefer initialization to assignment in constructors.
3094
3095 @item
3096 Have @code{operator=} return a reference to @code{*this}.
3097
3098 @item
3099 Don't try to return a reference when you must return an object.
3100
3101 @item
3102 Distinguish between prefix and postfix forms of increment and
3103 decrement operators.
3104
3105 @item
3106 Never overload @code{&&}, @code{||}, or @code{,}.
3107
3108 @end itemize
3109
3110 This option also enables @option{-Wnon-virtual-dtor}, which is also
3111 one of the effective C++ recommendations. However, the check is
3112 extended to warn about the lack of virtual destructor in accessible
3113 non-polymorphic bases classes too.
3114
3115 When selecting this option, be aware that the standard library
3116 headers do not obey all of these guidelines; use @samp{grep -v}
3117 to filter out those warnings.
3118
3119 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3120 @opindex Wstrict-null-sentinel
3121 @opindex Wno-strict-null-sentinel
3122 Warn about the use of an uncasted @code{NULL} as sentinel. When
3123 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3124 to @code{__null}. Although it is a null pointer constant rather than a
3125 null pointer, it is guaranteed to be of the same size as a pointer.
3126 But this use is not portable across different compilers.
3127
3128 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3129 @opindex Wno-non-template-friend
3130 @opindex Wnon-template-friend
3131 Disable warnings when non-template friend functions are declared
3132 within a template. In very old versions of GCC that predate implementation
3133 of the ISO standard, declarations such as
3134 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3135 could be interpreted as a particular specialization of a template
3136 function; the warning exists to diagnose compatibility problems,
3137 and is enabled by default.
3138
3139 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3140 @opindex Wold-style-cast
3141 @opindex Wno-old-style-cast
3142 Warn if an old-style (C-style) cast to a non-void type is used within
3143 a C++ program. The new-style casts (@code{dynamic_cast},
3144 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3145 less vulnerable to unintended effects and much easier to search for.
3146
3147 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3148 @opindex Woverloaded-virtual
3149 @opindex Wno-overloaded-virtual
3150 @cindex overloaded virtual function, warning
3151 @cindex warning for overloaded virtual function
3152 Warn when a function declaration hides virtual functions from a
3153 base class. For example, in:
3154
3155 @smallexample
3156 struct A @{
3157 virtual void f();
3158 @};
3159
3160 struct B: public A @{
3161 void f(int);
3162 @};
3163 @end smallexample
3164
3165 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3166 like:
3167
3168 @smallexample
3169 B* b;
3170 b->f();
3171 @end smallexample
3172
3173 @noindent
3174 fails to compile.
3175
3176 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3177 @opindex Wno-pmf-conversions
3178 @opindex Wpmf-conversions
3179 Disable the diagnostic for converting a bound pointer to member function
3180 to a plain pointer.
3181
3182 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3183 @opindex Wsign-promo
3184 @opindex Wno-sign-promo
3185 Warn when overload resolution chooses a promotion from unsigned or
3186 enumerated type to a signed type, over a conversion to an unsigned type of
3187 the same size. Previous versions of G++ tried to preserve
3188 unsignedness, but the standard mandates the current behavior.
3189
3190 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3191 @opindex Wtemplates
3192 Warn when a primary template declaration is encountered. Some coding
3193 rules disallow templates, and this may be used to enforce that rule.
3194 The warning is inactive inside a system header file, such as the STL, so
3195 one can still use the STL. One may also instantiate or specialize
3196 templates.
3197
3198 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3199 @opindex Wmultiple-inheritance
3200 Warn when a class is defined with multiple direct base classes. Some
3201 coding rules disallow multiple inheritance, and this may be used to
3202 enforce that rule. The warning is inactive inside a system header file,
3203 such as the STL, so one can still use the STL. One may also define
3204 classes that indirectly use multiple inheritance.
3205
3206 @item -Wvirtual-inheritance
3207 @opindex Wvirtual-inheritance
3208 Warn when a class is defined with a virtual direct base class. Some
3209 coding rules disallow multiple inheritance, and this may be used to
3210 enforce that rule. The warning is inactive inside a system header file,
3211 such as the STL, so one can still use the STL. One may also define
3212 classes that indirectly use virtual inheritance.
3213
3214 @item -Wnamespaces
3215 @opindex Wnamespaces
3216 Warn when a namespace definition is opened. Some coding rules disallow
3217 namespaces, and this may be used to enforce that rule. The warning is
3218 inactive inside a system header file, such as the STL, so one can still
3219 use the STL. One may also use using directives and qualified names.
3220
3221 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3222 @opindex Wterminate
3223 @opindex Wno-terminate
3224 Disable the warning about a throw-expression that will immediately
3225 result in a call to @code{terminate}.
3226 @end table
3227
3228 @node Objective-C and Objective-C++ Dialect Options
3229 @section Options Controlling Objective-C and Objective-C++ Dialects
3230
3231 @cindex compiler options, Objective-C and Objective-C++
3232 @cindex Objective-C and Objective-C++ options, command-line
3233 @cindex options, Objective-C and Objective-C++
3234 (NOTE: This manual does not describe the Objective-C and Objective-C++
3235 languages themselves. @xref{Standards,,Language Standards
3236 Supported by GCC}, for references.)
3237
3238 This section describes the command-line options that are only meaningful
3239 for Objective-C and Objective-C++ programs. You can also use most of
3240 the language-independent GNU compiler options.
3241 For example, you might compile a file @file{some_class.m} like this:
3242
3243 @smallexample
3244 gcc -g -fgnu-runtime -O -c some_class.m
3245 @end smallexample
3246
3247 @noindent
3248 In this example, @option{-fgnu-runtime} is an option meant only for
3249 Objective-C and Objective-C++ programs; you can use the other options with
3250 any language supported by GCC@.
3251
3252 Note that since Objective-C is an extension of the C language, Objective-C
3253 compilations may also use options specific to the C front-end (e.g.,
3254 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3255 C++-specific options (e.g., @option{-Wabi}).
3256
3257 Here is a list of options that are @emph{only} for compiling Objective-C
3258 and Objective-C++ programs:
3259
3260 @table @gcctabopt
3261 @item -fconstant-string-class=@var{class-name}
3262 @opindex fconstant-string-class
3263 Use @var{class-name} as the name of the class to instantiate for each
3264 literal string specified with the syntax @code{@@"@dots{}"}. The default
3265 class name is @code{NXConstantString} if the GNU runtime is being used, and
3266 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3267 @option{-fconstant-cfstrings} option, if also present, overrides the
3268 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3269 to be laid out as constant CoreFoundation strings.
3270
3271 @item -fgnu-runtime
3272 @opindex fgnu-runtime
3273 Generate object code compatible with the standard GNU Objective-C
3274 runtime. This is the default for most types of systems.
3275
3276 @item -fnext-runtime
3277 @opindex fnext-runtime
3278 Generate output compatible with the NeXT runtime. This is the default
3279 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3280 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3281 used.
3282
3283 @item -fno-nil-receivers
3284 @opindex fno-nil-receivers
3285 Assume that all Objective-C message dispatches (@code{[receiver
3286 message:arg]}) in this translation unit ensure that the receiver is
3287 not @code{nil}. This allows for more efficient entry points in the
3288 runtime to be used. This option is only available in conjunction with
3289 the NeXT runtime and ABI version 0 or 1.
3290
3291 @item -fobjc-abi-version=@var{n}
3292 @opindex fobjc-abi-version
3293 Use version @var{n} of the Objective-C ABI for the selected runtime.
3294 This option is currently supported only for the NeXT runtime. In that
3295 case, Version 0 is the traditional (32-bit) ABI without support for
3296 properties and other Objective-C 2.0 additions. Version 1 is the
3297 traditional (32-bit) ABI with support for properties and other
3298 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3299 nothing is specified, the default is Version 0 on 32-bit target
3300 machines, and Version 2 on 64-bit target machines.
3301
3302 @item -fobjc-call-cxx-cdtors
3303 @opindex fobjc-call-cxx-cdtors
3304 For each Objective-C class, check if any of its instance variables is a
3305 C++ object with a non-trivial default constructor. If so, synthesize a
3306 special @code{- (id) .cxx_construct} instance method which runs
3307 non-trivial default constructors on any such instance variables, in order,
3308 and then return @code{self}. Similarly, check if any instance variable
3309 is a C++ object with a non-trivial destructor, and if so, synthesize a
3310 special @code{- (void) .cxx_destruct} method which runs
3311 all such default destructors, in reverse order.
3312
3313 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3314 methods thusly generated only operate on instance variables
3315 declared in the current Objective-C class, and not those inherited
3316 from superclasses. It is the responsibility of the Objective-C
3317 runtime to invoke all such methods in an object's inheritance
3318 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3319 by the runtime immediately after a new object instance is allocated;
3320 the @code{- (void) .cxx_destruct} methods are invoked immediately
3321 before the runtime deallocates an object instance.
3322
3323 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3324 support for invoking the @code{- (id) .cxx_construct} and
3325 @code{- (void) .cxx_destruct} methods.
3326
3327 @item -fobjc-direct-dispatch
3328 @opindex fobjc-direct-dispatch
3329 Allow fast jumps to the message dispatcher. On Darwin this is
3330 accomplished via the comm page.
3331
3332 @item -fobjc-exceptions
3333 @opindex fobjc-exceptions
3334 Enable syntactic support for structured exception handling in
3335 Objective-C, similar to what is offered by C++. This option
3336 is required to use the Objective-C keywords @code{@@try},
3337 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3338 @code{@@synchronized}. This option is available with both the GNU
3339 runtime and the NeXT runtime (but not available in conjunction with
3340 the NeXT runtime on Mac OS X 10.2 and earlier).
3341
3342 @item -fobjc-gc
3343 @opindex fobjc-gc
3344 Enable garbage collection (GC) in Objective-C and Objective-C++
3345 programs. This option is only available with the NeXT runtime; the
3346 GNU runtime has a different garbage collection implementation that
3347 does not require special compiler flags.
3348
3349 @item -fobjc-nilcheck
3350 @opindex fobjc-nilcheck
3351 For the NeXT runtime with version 2 of the ABI, check for a nil
3352 receiver in method invocations before doing the actual method call.
3353 This is the default and can be disabled using
3354 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3355 checked for nil in this way no matter what this flag is set to.
3356 Currently this flag does nothing when the GNU runtime, or an older
3357 version of the NeXT runtime ABI, is used.
3358
3359 @item -fobjc-std=objc1
3360 @opindex fobjc-std
3361 Conform to the language syntax of Objective-C 1.0, the language
3362 recognized by GCC 4.0. This only affects the Objective-C additions to
3363 the C/C++ language; it does not affect conformance to C/C++ standards,
3364 which is controlled by the separate C/C++ dialect option flags. When
3365 this option is used with the Objective-C or Objective-C++ compiler,
3366 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3367 This is useful if you need to make sure that your Objective-C code can
3368 be compiled with older versions of GCC@.
3369
3370 @item -freplace-objc-classes
3371 @opindex freplace-objc-classes
3372 Emit a special marker instructing @command{ld(1)} not to statically link in
3373 the resulting object file, and allow @command{dyld(1)} to load it in at
3374 run time instead. This is used in conjunction with the Fix-and-Continue
3375 debugging mode, where the object file in question may be recompiled and
3376 dynamically reloaded in the course of program execution, without the need
3377 to restart the program itself. Currently, Fix-and-Continue functionality
3378 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3379 and later.
3380
3381 @item -fzero-link
3382 @opindex fzero-link
3383 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3384 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3385 compile time) with static class references that get initialized at load time,
3386 which improves run-time performance. Specifying the @option{-fzero-link} flag
3387 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3388 to be retained. This is useful in Zero-Link debugging mode, since it allows
3389 for individual class implementations to be modified during program execution.
3390 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3391 regardless of command-line options.
3392
3393 @item -fno-local-ivars
3394 @opindex fno-local-ivars
3395 @opindex flocal-ivars
3396 By default instance variables in Objective-C can be accessed as if
3397 they were local variables from within the methods of the class they're
3398 declared in. This can lead to shadowing between instance variables
3399 and other variables declared either locally inside a class method or
3400 globally with the same name. Specifying the @option{-fno-local-ivars}
3401 flag disables this behavior thus avoiding variable shadowing issues.
3402
3403 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3404 @opindex fivar-visibility
3405 Set the default instance variable visibility to the specified option
3406 so that instance variables declared outside the scope of any access
3407 modifier directives default to the specified visibility.
3408
3409 @item -gen-decls
3410 @opindex gen-decls
3411 Dump interface declarations for all classes seen in the source file to a
3412 file named @file{@var{sourcename}.decl}.
3413
3414 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3415 @opindex Wassign-intercept
3416 @opindex Wno-assign-intercept
3417 Warn whenever an Objective-C assignment is being intercepted by the
3418 garbage collector.
3419
3420 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3421 @opindex Wno-protocol
3422 @opindex Wprotocol
3423 If a class is declared to implement a protocol, a warning is issued for
3424 every method in the protocol that is not implemented by the class. The
3425 default behavior is to issue a warning for every method not explicitly
3426 implemented in the class, even if a method implementation is inherited
3427 from the superclass. If you use the @option{-Wno-protocol} option, then
3428 methods inherited from the superclass are considered to be implemented,
3429 and no warning is issued for them.
3430
3431 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3432 @opindex Wselector
3433 @opindex Wno-selector
3434 Warn if multiple methods of different types for the same selector are
3435 found during compilation. The check is performed on the list of methods
3436 in the final stage of compilation. Additionally, a check is performed
3437 for each selector appearing in a @code{@@selector(@dots{})}
3438 expression, and a corresponding method for that selector has been found
3439 during compilation. Because these checks scan the method table only at
3440 the end of compilation, these warnings are not produced if the final
3441 stage of compilation is not reached, for example because an error is
3442 found during compilation, or because the @option{-fsyntax-only} option is
3443 being used.
3444
3445 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3446 @opindex Wstrict-selector-match
3447 @opindex Wno-strict-selector-match
3448 Warn if multiple methods with differing argument and/or return types are
3449 found for a given selector when attempting to send a message using this
3450 selector to a receiver of type @code{id} or @code{Class}. When this flag
3451 is off (which is the default behavior), the compiler omits such warnings
3452 if any differences found are confined to types that share the same size
3453 and alignment.
3454
3455 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3456 @opindex Wundeclared-selector
3457 @opindex Wno-undeclared-selector
3458 Warn if a @code{@@selector(@dots{})} expression referring to an
3459 undeclared selector is found. A selector is considered undeclared if no
3460 method with that name has been declared before the
3461 @code{@@selector(@dots{})} expression, either explicitly in an
3462 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3463 an @code{@@implementation} section. This option always performs its
3464 checks as soon as a @code{@@selector(@dots{})} expression is found,
3465 while @option{-Wselector} only performs its checks in the final stage of
3466 compilation. This also enforces the coding style convention
3467 that methods and selectors must be declared before being used.
3468
3469 @item -print-objc-runtime-info
3470 @opindex print-objc-runtime-info
3471 Generate C header describing the largest structure that is passed by
3472 value, if any.
3473
3474 @end table
3475
3476 @node Diagnostic Message Formatting Options
3477 @section Options to Control Diagnostic Messages Formatting
3478 @cindex options to control diagnostics formatting
3479 @cindex diagnostic messages
3480 @cindex message formatting
3481
3482 Traditionally, diagnostic messages have been formatted irrespective of
3483 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3484 options described below
3485 to control the formatting algorithm for diagnostic messages,
3486 e.g.@: how many characters per line, how often source location
3487 information should be reported. Note that some language front ends may not
3488 honor these options.
3489
3490 @table @gcctabopt
3491 @item -fmessage-length=@var{n}
3492 @opindex fmessage-length
3493 Try to format error messages so that they fit on lines of about
3494 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3495 done; each error message appears on a single line. This is the
3496 default for all front ends.
3497
3498 @item -fdiagnostics-show-location=once
3499 @opindex fdiagnostics-show-location
3500 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3501 reporter to emit source location information @emph{once}; that is, in
3502 case the message is too long to fit on a single physical line and has to
3503 be wrapped, the source location won't be emitted (as prefix) again,
3504 over and over, in subsequent continuation lines. This is the default
3505 behavior.
3506
3507 @item -fdiagnostics-show-location=every-line
3508 Only meaningful in line-wrapping mode. Instructs the diagnostic
3509 messages reporter to emit the same source location information (as
3510 prefix) for physical lines that result from the process of breaking
3511 a message which is too long to fit on a single line.
3512
3513 @item -fdiagnostics-color[=@var{WHEN}]
3514 @itemx -fno-diagnostics-color
3515 @opindex fdiagnostics-color
3516 @cindex highlight, color
3517 @vindex GCC_COLORS @r{environment variable}
3518 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3519 or @samp{auto}. The default depends on how the compiler has been configured,
3520 it can be any of the above @var{WHEN} options or also @samp{never}
3521 if @env{GCC_COLORS} environment variable isn't present in the environment,
3522 and @samp{auto} otherwise.
3523 @samp{auto} means to use color only when the standard error is a terminal.
3524 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3525 aliases for @option{-fdiagnostics-color=always} and
3526 @option{-fdiagnostics-color=never}, respectively.
3527
3528 The colors are defined by the environment variable @env{GCC_COLORS}.
3529 Its value is a colon-separated list of capabilities and Select Graphic
3530 Rendition (SGR) substrings. SGR commands are interpreted by the
3531 terminal or terminal emulator. (See the section in the documentation
3532 of your text terminal for permitted values and their meanings as
3533 character attributes.) These substring values are integers in decimal
3534 representation and can be concatenated with semicolons.
3535 Common values to concatenate include
3536 @samp{1} for bold,
3537 @samp{4} for underline,
3538 @samp{5} for blink,
3539 @samp{7} for inverse,
3540 @samp{39} for default foreground color,
3541 @samp{30} to @samp{37} for foreground colors,
3542 @samp{90} to @samp{97} for 16-color mode foreground colors,
3543 @samp{38;5;0} to @samp{38;5;255}
3544 for 88-color and 256-color modes foreground colors,
3545 @samp{49} for default background color,
3546 @samp{40} to @samp{47} for background colors,
3547 @samp{100} to @samp{107} for 16-color mode background colors,
3548 and @samp{48;5;0} to @samp{48;5;255}
3549 for 88-color and 256-color modes background colors.
3550
3551 The default @env{GCC_COLORS} is
3552 @smallexample
3553 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3554 quote=01:fixit-insert=32:fixit-delete=31:\
3555 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3556 type-diff=01;32
3557 @end smallexample
3558 @noindent
3559 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3560 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3561 @samp{01} is bold, and @samp{31} is red.
3562 Setting @env{GCC_COLORS} to the empty string disables colors.
3563 Supported capabilities are as follows.
3564
3565 @table @code
3566 @item error=
3567 @vindex error GCC_COLORS @r{capability}
3568 SGR substring for error: markers.
3569
3570 @item warning=
3571 @vindex warning GCC_COLORS @r{capability}
3572 SGR substring for warning: markers.
3573
3574 @item note=
3575 @vindex note GCC_COLORS @r{capability}
3576 SGR substring for note: markers.
3577
3578 @item range1=
3579 @vindex range1 GCC_COLORS @r{capability}
3580 SGR substring for first additional range.
3581
3582 @item range2=
3583 @vindex range2 GCC_COLORS @r{capability}
3584 SGR substring for second additional range.
3585
3586 @item locus=
3587 @vindex locus GCC_COLORS @r{capability}
3588 SGR substring for location information, @samp{file:line} or
3589 @samp{file:line:column} etc.
3590
3591 @item quote=
3592 @vindex quote GCC_COLORS @r{capability}
3593 SGR substring for information printed within quotes.
3594
3595 @item fixit-insert=
3596 @vindex fixit-insert GCC_COLORS @r{capability}
3597 SGR substring for fix-it hints suggesting text to
3598 be inserted or replaced.
3599
3600 @item fixit-delete=
3601 @vindex fixit-delete GCC_COLORS @r{capability}
3602 SGR substring for fix-it hints suggesting text to
3603 be deleted.
3604
3605 @item diff-filename=
3606 @vindex diff-filename GCC_COLORS @r{capability}
3607 SGR substring for filename headers within generated patches.
3608
3609 @item diff-hunk=
3610 @vindex diff-hunk GCC_COLORS @r{capability}
3611 SGR substring for the starts of hunks within generated patches.
3612
3613 @item diff-delete=
3614 @vindex diff-delete GCC_COLORS @r{capability}
3615 SGR substring for deleted lines within generated patches.
3616
3617 @item diff-insert=
3618 @vindex diff-insert GCC_COLORS @r{capability}
3619 SGR substring for inserted lines within generated patches.
3620
3621 @item type-diff=
3622 @vindex type-diff GCC_COLORS @r{capability}
3623 SGR substring for highlighting mismatching types within template
3624 arguments in the C++ frontend.
3625 @end table
3626
3627 @item -fno-diagnostics-show-option
3628 @opindex fno-diagnostics-show-option
3629 @opindex fdiagnostics-show-option
3630 By default, each diagnostic emitted includes text indicating the
3631 command-line option that directly controls the diagnostic (if such an
3632 option is known to the diagnostic machinery). Specifying the
3633 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3634
3635 @item -fno-diagnostics-show-caret
3636 @opindex fno-diagnostics-show-caret
3637 @opindex fdiagnostics-show-caret
3638 By default, each diagnostic emitted includes the original source line
3639 and a caret @samp{^} indicating the column. This option suppresses this
3640 information. The source line is truncated to @var{n} characters, if
3641 the @option{-fmessage-length=n} option is given. When the output is done
3642 to the terminal, the width is limited to the width given by the
3643 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3644
3645 @item -fdiagnostics-parseable-fixits
3646 @opindex fdiagnostics-parseable-fixits
3647 Emit fix-it hints in a machine-parseable format, suitable for consumption
3648 by IDEs. For each fix-it, a line will be printed after the relevant
3649 diagnostic, starting with the string ``fix-it:''. For example:
3650
3651 @smallexample
3652 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3653 @end smallexample
3654
3655 The location is expressed as a half-open range, expressed as a count of
3656 bytes, starting at byte 1 for the initial column. In the above example,
3657 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3658 given string:
3659
3660 @smallexample
3661 00000000011111111112222222222
3662 12345678901234567890123456789
3663 gtk_widget_showall (dlg);
3664 ^^^^^^^^^^^^^^^^^^
3665 gtk_widget_show_all
3666 @end smallexample
3667
3668 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3669 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3670 (e.g. vertical tab as ``\013'').
3671
3672 An empty replacement string indicates that the given range is to be removed.
3673 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3674 be inserted at the given position.
3675
3676 @item -fdiagnostics-generate-patch
3677 @opindex fdiagnostics-generate-patch
3678 Print fix-it hints to stderr in unified diff format, after any diagnostics
3679 are printed. For example:
3680
3681 @smallexample
3682 --- test.c
3683 +++ test.c
3684 @@ -42,5 +42,5 @@
3685
3686 void show_cb(GtkDialog *dlg)
3687 @{
3688 - gtk_widget_showall(dlg);
3689 + gtk_widget_show_all(dlg);
3690 @}
3691
3692 @end smallexample
3693
3694 The diff may or may not be colorized, following the same rules
3695 as for diagnostics (see @option{-fdiagnostics-color}).
3696
3697 @item -fdiagnostics-show-template-tree
3698 @opindex fdiagnostics-show-template-tree
3699
3700 In the C++ frontend, when printing diagnostics showing mismatching
3701 template types, such as:
3702
3703 @smallexample
3704 could not convert 'std::map<int, std::vector<double> >()'
3705 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3706 @end smallexample
3707
3708 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3709 tree-like structure showing the common and differing parts of the types,
3710 such as:
3711
3712 @smallexample
3713 map<
3714 [...],
3715 vector<
3716 [double != float]>>
3717 @end smallexample
3718
3719 The parts that differ are highlighted with color (``double'' and
3720 ``float'' in this case).
3721
3722 @item -fno-elide-type
3723 @opindex fno-elide-type
3724 @opindex felide-type
3725 By default when the C++ frontend prints diagnostics showing mismatching
3726 template types, common parts of the types are printed as ``[...]'' to
3727 simplify the error message. For example:
3728
3729 @smallexample
3730 could not convert 'std::map<int, std::vector<double> >()'
3731 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3732 @end smallexample
3733
3734 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3735 This flag also affects the output of the
3736 @option{-fdiagnostics-show-template-tree} flag.
3737
3738 @item -fno-show-column
3739 @opindex fno-show-column
3740 Do not print column numbers in diagnostics. This may be necessary if
3741 diagnostics are being scanned by a program that does not understand the
3742 column numbers, such as @command{dejagnu}.
3743
3744 @end table
3745
3746 @node Warning Options
3747 @section Options to Request or Suppress Warnings
3748 @cindex options to control warnings
3749 @cindex warning messages
3750 @cindex messages, warning
3751 @cindex suppressing warnings
3752
3753 Warnings are diagnostic messages that report constructions that
3754 are not inherently erroneous but that are risky or suggest there
3755 may have been an error.
3756
3757 The following language-independent options do not enable specific
3758 warnings but control the kinds of diagnostics produced by GCC@.
3759
3760 @table @gcctabopt
3761 @cindex syntax checking
3762 @item -fsyntax-only
3763 @opindex fsyntax-only
3764 Check the code for syntax errors, but don't do anything beyond that.
3765
3766 @item -fmax-errors=@var{n}
3767 @opindex fmax-errors
3768 Limits the maximum number of error messages to @var{n}, at which point
3769 GCC bails out rather than attempting to continue processing the source
3770 code. If @var{n} is 0 (the default), there is no limit on the number
3771 of error messages produced. If @option{-Wfatal-errors} is also
3772 specified, then @option{-Wfatal-errors} takes precedence over this
3773 option.
3774
3775 @item -w
3776 @opindex w
3777 Inhibit all warning messages.
3778
3779 @item -Werror
3780 @opindex Werror
3781 @opindex Wno-error
3782 Make all warnings into errors.
3783
3784 @item -Werror=
3785 @opindex Werror=
3786 @opindex Wno-error=
3787 Make the specified warning into an error. The specifier for a warning
3788 is appended; for example @option{-Werror=switch} turns the warnings
3789 controlled by @option{-Wswitch} into errors. This switch takes a
3790 negative form, to be used to negate @option{-Werror} for specific
3791 warnings; for example @option{-Wno-error=switch} makes
3792 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3793 is in effect.
3794
3795 The warning message for each controllable warning includes the
3796 option that controls the warning. That option can then be used with
3797 @option{-Werror=} and @option{-Wno-error=} as described above.
3798 (Printing of the option in the warning message can be disabled using the
3799 @option{-fno-diagnostics-show-option} flag.)
3800
3801 Note that specifying @option{-Werror=}@var{foo} automatically implies
3802 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3803 imply anything.
3804
3805 @item -Wfatal-errors
3806 @opindex Wfatal-errors
3807 @opindex Wno-fatal-errors
3808 This option causes the compiler to abort compilation on the first error
3809 occurred rather than trying to keep going and printing further error
3810 messages.
3811
3812 @end table
3813
3814 You can request many specific warnings with options beginning with
3815 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3816 implicit declarations. Each of these specific warning options also
3817 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3818 example, @option{-Wno-implicit}. This manual lists only one of the
3819 two forms, whichever is not the default. For further
3820 language-specific options also refer to @ref{C++ Dialect Options} and
3821 @ref{Objective-C and Objective-C++ Dialect Options}.
3822
3823 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3824 options, such as @option{-Wunused}, which may turn on further options,
3825 such as @option{-Wunused-value}. The combined effect of positive and
3826 negative forms is that more specific options have priority over less
3827 specific ones, independently of their position in the command-line. For
3828 options of the same specificity, the last one takes effect. Options
3829 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3830 as if they appeared at the end of the command-line.
3831
3832 When an unrecognized warning option is requested (e.g.,
3833 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3834 that the option is not recognized. However, if the @option{-Wno-} form
3835 is used, the behavior is slightly different: no diagnostic is
3836 produced for @option{-Wno-unknown-warning} unless other diagnostics
3837 are being produced. This allows the use of new @option{-Wno-} options
3838 with old compilers, but if something goes wrong, the compiler
3839 warns that an unrecognized option is present.
3840
3841 @table @gcctabopt
3842 @item -Wpedantic
3843 @itemx -pedantic
3844 @opindex pedantic
3845 @opindex Wpedantic
3846 Issue all the warnings demanded by strict ISO C and ISO C++;
3847 reject all programs that use forbidden extensions, and some other
3848 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3849 version of the ISO C standard specified by any @option{-std} option used.
3850
3851 Valid ISO C and ISO C++ programs should compile properly with or without
3852 this option (though a rare few require @option{-ansi} or a
3853 @option{-std} option specifying the required version of ISO C)@. However,
3854 without this option, certain GNU extensions and traditional C and C++
3855 features are supported as well. With this option, they are rejected.
3856
3857 @option{-Wpedantic} does not cause warning messages for use of the
3858 alternate keywords whose names begin and end with @samp{__}. Pedantic
3859 warnings are also disabled in the expression that follows
3860 @code{__extension__}. However, only system header files should use
3861 these escape routes; application programs should avoid them.
3862 @xref{Alternate Keywords}.
3863
3864 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3865 C conformance. They soon find that it does not do quite what they want:
3866 it finds some non-ISO practices, but not all---only those for which
3867 ISO C @emph{requires} a diagnostic, and some others for which
3868 diagnostics have been added.
3869
3870 A feature to report any failure to conform to ISO C might be useful in
3871 some instances, but would require considerable additional work and would
3872 be quite different from @option{-Wpedantic}. We don't have plans to
3873 support such a feature in the near future.
3874
3875 Where the standard specified with @option{-std} represents a GNU
3876 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3877 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3878 extended dialect is based. Warnings from @option{-Wpedantic} are given
3879 where they are required by the base standard. (It does not make sense
3880 for such warnings to be given only for features not in the specified GNU
3881 C dialect, since by definition the GNU dialects of C include all
3882 features the compiler supports with the given option, and there would be
3883 nothing to warn about.)
3884
3885 @item -pedantic-errors
3886 @opindex pedantic-errors
3887 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3888 requires a diagnostic, in some cases where there is undefined behavior
3889 at compile-time and in some other cases that do not prevent compilation
3890 of programs that are valid according to the standard. This is not
3891 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3892 by this option and not enabled by the latter and vice versa.
3893
3894 @item -Wall
3895 @opindex Wall
3896 @opindex Wno-all
3897 This enables all the warnings about constructions that some users
3898 consider questionable, and that are easy to avoid (or modify to
3899 prevent the warning), even in conjunction with macros. This also
3900 enables some language-specific warnings described in @ref{C++ Dialect
3901 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3902
3903 @option{-Wall} turns on the following warning flags:
3904
3905 @gccoptlist{-Waddress @gol
3906 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3907 -Wbool-compare @gol
3908 -Wbool-operation @gol
3909 -Wc++11-compat -Wc++14-compat @gol
3910 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
3911 -Wchar-subscripts @gol
3912 -Wcomment @gol
3913 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3914 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3915 -Wformat @gol
3916 -Wint-in-bool-context @gol
3917 -Wimplicit @r{(C and Objective-C only)} @gol
3918 -Wimplicit-int @r{(C and Objective-C only)} @gol
3919 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3920 -Winit-self @r{(only for C++)} @gol
3921 -Wlogical-not-parentheses @gol
3922 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3923 -Wmaybe-uninitialized @gol
3924 -Wmemset-elt-size @gol
3925 -Wmemset-transposed-args @gol
3926 -Wmisleading-indentation @r{(only for C/C++)} @gol
3927 -Wmissing-braces @r{(only for C/ObjC)} @gol
3928 -Wmultistatement-macros @gol
3929 -Wnarrowing @r{(only for C++)} @gol
3930 -Wnonnull @gol
3931 -Wnonnull-compare @gol
3932 -Wopenmp-simd @gol
3933 -Wparentheses @gol
3934 -Wpointer-sign @gol
3935 -Wreorder @gol
3936 -Wrestrict @gol
3937 -Wreturn-type @gol
3938 -Wsequence-point @gol
3939 -Wsign-compare @r{(only in C++)} @gol
3940 -Wsizeof-pointer-div @gol
3941 -Wsizeof-pointer-memaccess @gol
3942 -Wstrict-aliasing @gol
3943 -Wstrict-overflow=1 @gol
3944 -Wswitch @gol
3945 -Wtautological-compare @gol
3946 -Wtrigraphs @gol
3947 -Wuninitialized @gol
3948 -Wunknown-pragmas @gol
3949 -Wunused-function @gol
3950 -Wunused-label @gol
3951 -Wunused-value @gol
3952 -Wunused-variable @gol
3953 -Wvolatile-register-var @gol
3954 }
3955
3956 Note that some warning flags are not implied by @option{-Wall}. Some of
3957 them warn about constructions that users generally do not consider
3958 questionable, but which occasionally you might wish to check for;
3959 others warn about constructions that are necessary or hard to avoid in
3960 some cases, and there is no simple way to modify the code to suppress
3961 the warning. Some of them are enabled by @option{-Wextra} but many of
3962 them must be enabled individually.
3963
3964 @item -Wextra
3965 @opindex W
3966 @opindex Wextra
3967 @opindex Wno-extra
3968 This enables some extra warning flags that are not enabled by
3969 @option{-Wall}. (This option used to be called @option{-W}. The older
3970 name is still supported, but the newer name is more descriptive.)
3971
3972 @gccoptlist{-Wclobbered @gol
3973 -Wcast-function-type @gol
3974 -Wempty-body @gol
3975 -Wignored-qualifiers @gol
3976 -Wimplicit-fallthrough=3 @gol
3977 -Wmissing-field-initializers @gol
3978 -Wmissing-parameter-type @r{(C only)} @gol
3979 -Wold-style-declaration @r{(C only)} @gol
3980 -Woverride-init @gol
3981 -Wsign-compare @r{(C only)} @gol
3982 -Wtype-limits @gol
3983 -Wuninitialized @gol
3984 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3985 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3986 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3987 }
3988
3989 The option @option{-Wextra} also prints warning messages for the
3990 following cases:
3991
3992 @itemize @bullet
3993
3994 @item
3995 A pointer is compared against integer zero with @code{<}, @code{<=},
3996 @code{>}, or @code{>=}.
3997
3998 @item
3999 (C++ only) An enumerator and a non-enumerator both appear in a
4000 conditional expression.
4001
4002 @item
4003 (C++ only) Ambiguous virtual bases.
4004
4005 @item
4006 (C++ only) Subscripting an array that has been declared @code{register}.
4007
4008 @item
4009 (C++ only) Taking the address of a variable that has been declared
4010 @code{register}.
4011
4012 @item
4013 (C++ only) A base class is not initialized in the copy constructor
4014 of a derived class.
4015
4016 @end itemize
4017
4018 @item -Wchar-subscripts
4019 @opindex Wchar-subscripts
4020 @opindex Wno-char-subscripts
4021 Warn if an array subscript has type @code{char}. This is a common cause
4022 of error, as programmers often forget that this type is signed on some
4023 machines.
4024 This warning is enabled by @option{-Wall}.
4025
4026 @item -Wchkp
4027 @opindex Wchkp
4028 Warn about an invalid memory access that is found by Pointer Bounds Checker
4029 (@option{-fcheck-pointer-bounds}).
4030
4031 @item -Wno-coverage-mismatch
4032 @opindex Wno-coverage-mismatch
4033 Warn if feedback profiles do not match when using the
4034 @option{-fprofile-use} option.
4035 If a source file is changed between compiling with @option{-fprofile-gen} and
4036 with @option{-fprofile-use}, the files with the profile feedback can fail
4037 to match the source file and GCC cannot use the profile feedback
4038 information. By default, this warning is enabled and is treated as an
4039 error. @option{-Wno-coverage-mismatch} can be used to disable the
4040 warning or @option{-Wno-error=coverage-mismatch} can be used to
4041 disable the error. Disabling the error for this warning can result in
4042 poorly optimized code and is useful only in the
4043 case of very minor changes such as bug fixes to an existing code-base.
4044 Completely disabling the warning is not recommended.
4045
4046 @item -Wno-cpp
4047 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4048
4049 Suppress warning messages emitted by @code{#warning} directives.
4050
4051 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4052 @opindex Wdouble-promotion
4053 @opindex Wno-double-promotion
4054 Give a warning when a value of type @code{float} is implicitly
4055 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4056 floating-point unit implement @code{float} in hardware, but emulate
4057 @code{double} in software. On such a machine, doing computations
4058 using @code{double} values is much more expensive because of the
4059 overhead required for software emulation.
4060
4061 It is easy to accidentally do computations with @code{double} because
4062 floating-point literals are implicitly of type @code{double}. For
4063 example, in:
4064 @smallexample
4065 @group
4066 float area(float radius)
4067 @{
4068 return 3.14159 * radius * radius;
4069 @}
4070 @end group
4071 @end smallexample
4072 the compiler performs the entire computation with @code{double}
4073 because the floating-point literal is a @code{double}.
4074
4075 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4076 @opindex Wduplicate-decl-specifier
4077 @opindex Wno-duplicate-decl-specifier
4078 Warn if a declaration has duplicate @code{const}, @code{volatile},
4079 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4080 @option{-Wall}.
4081
4082 @item -Wformat
4083 @itemx -Wformat=@var{n}
4084 @opindex Wformat
4085 @opindex Wno-format
4086 @opindex ffreestanding
4087 @opindex fno-builtin
4088 @opindex Wformat=
4089 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4090 the arguments supplied have types appropriate to the format string
4091 specified, and that the conversions specified in the format string make
4092 sense. This includes standard functions, and others specified by format
4093 attributes (@pxref{Function Attributes}), in the @code{printf},
4094 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4095 not in the C standard) families (or other target-specific families).
4096 Which functions are checked without format attributes having been
4097 specified depends on the standard version selected, and such checks of
4098 functions without the attribute specified are disabled by
4099 @option{-ffreestanding} or @option{-fno-builtin}.
4100
4101 The formats are checked against the format features supported by GNU
4102 libc version 2.2. These include all ISO C90 and C99 features, as well
4103 as features from the Single Unix Specification and some BSD and GNU
4104 extensions. Other library implementations may not support all these
4105 features; GCC does not support warning about features that go beyond a
4106 particular library's limitations. However, if @option{-Wpedantic} is used
4107 with @option{-Wformat}, warnings are given about format features not
4108 in the selected standard version (but not for @code{strfmon} formats,
4109 since those are not in any version of the C standard). @xref{C Dialect
4110 Options,,Options Controlling C Dialect}.
4111
4112 @table @gcctabopt
4113 @item -Wformat=1
4114 @itemx -Wformat
4115 @opindex Wformat
4116 @opindex Wformat=1
4117 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4118 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4119 @option{-Wformat} also checks for null format arguments for several
4120 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4121 aspects of this level of format checking can be disabled by the
4122 options: @option{-Wno-format-contains-nul},
4123 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4124 @option{-Wformat} is enabled by @option{-Wall}.
4125
4126 @item -Wno-format-contains-nul
4127 @opindex Wno-format-contains-nul
4128 @opindex Wformat-contains-nul
4129 If @option{-Wformat} is specified, do not warn about format strings that
4130 contain NUL bytes.
4131
4132 @item -Wno-format-extra-args
4133 @opindex Wno-format-extra-args
4134 @opindex Wformat-extra-args
4135 If @option{-Wformat} is specified, do not warn about excess arguments to a
4136 @code{printf} or @code{scanf} format function. The C standard specifies
4137 that such arguments are ignored.
4138
4139 Where the unused arguments lie between used arguments that are
4140 specified with @samp{$} operand number specifications, normally
4141 warnings are still given, since the implementation could not know what
4142 type to pass to @code{va_arg} to skip the unused arguments. However,
4143 in the case of @code{scanf} formats, this option suppresses the
4144 warning if the unused arguments are all pointers, since the Single
4145 Unix Specification says that such unused arguments are allowed.
4146
4147 @item -Wformat-overflow
4148 @itemx -Wformat-overflow=@var{level}
4149 @opindex Wformat-overflow
4150 @opindex Wno-format-overflow
4151 Warn about calls to formatted input/output functions such as @code{sprintf}
4152 and @code{vsprintf} that might overflow the destination buffer. When the
4153 exact number of bytes written by a format directive cannot be determined
4154 at compile-time it is estimated based on heuristics that depend on the
4155 @var{level} argument and on optimization. While enabling optimization
4156 will in most cases improve the accuracy of the warning, it may also
4157 result in false positives.
4158
4159 @table @gcctabopt
4160 @item -Wformat-overflow
4161 @item -Wformat-overflow=1
4162 @opindex Wformat-overflow
4163 @opindex Wno-format-overflow
4164 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4165 employs a conservative approach that warns only about calls that most
4166 likely overflow the buffer. At this level, numeric arguments to format
4167 directives with unknown values are assumed to have the value of one, and
4168 strings of unknown length to be empty. Numeric arguments that are known
4169 to be bounded to a subrange of their type, or string arguments whose output
4170 is bounded either by their directive's precision or by a finite set of
4171 string literals, are assumed to take on the value within the range that
4172 results in the most bytes on output. For example, the call to @code{sprintf}
4173 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4174 the terminating NUL character (@code{'\0'}) appended by the function
4175 to the destination buffer will be written past its end. Increasing
4176 the size of the buffer by a single byte is sufficient to avoid the
4177 warning, though it may not be sufficient to avoid the overflow.
4178
4179 @smallexample
4180 void f (int a, int b)
4181 @{
4182 char buf [12];
4183 sprintf (buf, "a = %i, b = %i\n", a, b);
4184 @}
4185 @end smallexample
4186
4187 @item -Wformat-overflow=2
4188 Level @var{2} warns also about calls that might overflow the destination
4189 buffer given an argument of sufficient length or magnitude. At level
4190 @var{2}, unknown numeric arguments are assumed to have the minimum
4191 representable value for signed types with a precision greater than 1, and
4192 the maximum representable value otherwise. Unknown string arguments whose
4193 length cannot be assumed to be bounded either by the directive's precision,
4194 or by a finite set of string literals they may evaluate to, or the character
4195 array they may point to, are assumed to be 1 character long.
4196
4197 At level @var{2}, the call in the example above is again diagnosed, but
4198 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4199 @code{%i} directive will write some of its digits beyond the end of
4200 the destination buffer. To make the call safe regardless of the values
4201 of the two variables, the size of the destination buffer must be increased
4202 to at least 34 bytes. GCC includes the minimum size of the buffer in
4203 an informational note following the warning.
4204
4205 An alternative to increasing the size of the destination buffer is to
4206 constrain the range of formatted values. The maximum length of string
4207 arguments can be bounded by specifying the precision in the format
4208 directive. When numeric arguments of format directives can be assumed
4209 to be bounded by less than the precision of their type, choosing
4210 an appropriate length modifier to the format specifier will reduce
4211 the required buffer size. For example, if @var{a} and @var{b} in the
4212 example above can be assumed to be within the precision of
4213 the @code{short int} type then using either the @code{%hi} format
4214 directive or casting the argument to @code{short} reduces the maximum
4215 required size of the buffer to 24 bytes.
4216
4217 @smallexample
4218 void f (int a, int b)
4219 @{
4220 char buf [23];
4221 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4222 @}
4223 @end smallexample
4224 @end table
4225
4226 @item -Wno-format-zero-length
4227 @opindex Wno-format-zero-length
4228 @opindex Wformat-zero-length
4229 If @option{-Wformat} is specified, do not warn about zero-length formats.
4230 The C standard specifies that zero-length formats are allowed.
4231
4232
4233 @item -Wformat=2
4234 @opindex Wformat=2
4235 Enable @option{-Wformat} plus additional format checks. Currently
4236 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4237 -Wformat-y2k}.
4238
4239 @item -Wformat-nonliteral
4240 @opindex Wformat-nonliteral
4241 @opindex Wno-format-nonliteral
4242 If @option{-Wformat} is specified, also warn if the format string is not a
4243 string literal and so cannot be checked, unless the format function
4244 takes its format arguments as a @code{va_list}.
4245
4246 @item -Wformat-security
4247 @opindex Wformat-security
4248 @opindex Wno-format-security
4249 If @option{-Wformat} is specified, also warn about uses of format
4250 functions that represent possible security problems. At present, this
4251 warns about calls to @code{printf} and @code{scanf} functions where the
4252 format string is not a string literal and there are no format arguments,
4253 as in @code{printf (foo);}. This may be a security hole if the format
4254 string came from untrusted input and contains @samp{%n}. (This is
4255 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4256 in future warnings may be added to @option{-Wformat-security} that are not
4257 included in @option{-Wformat-nonliteral}.)
4258
4259 @item -Wformat-signedness
4260 @opindex Wformat-signedness
4261 @opindex Wno-format-signedness
4262 If @option{-Wformat} is specified, also warn if the format string
4263 requires an unsigned argument and the argument is signed and vice versa.
4264
4265 @item -Wformat-truncation
4266 @itemx -Wformat-truncation=@var{level}
4267 @opindex Wformat-truncation
4268 @opindex Wno-format-truncation
4269 Warn about calls to formatted input/output functions such as @code{snprintf}
4270 and @code{vsnprintf} that might result in output truncation. When the exact
4271 number of bytes written by a format directive cannot be determined at
4272 compile-time it is estimated based on heuristics that depend on
4273 the @var{level} argument and on optimization. While enabling optimization
4274 will in most cases improve the accuracy of the warning, it may also result
4275 in false positives. Except as noted otherwise, the option uses the same
4276 logic @option{-Wformat-overflow}.
4277
4278 @table @gcctabopt
4279 @item -Wformat-truncation
4280 @item -Wformat-truncation=1
4281 @opindex Wformat-truncation
4282 @opindex Wno-format-overflow
4283 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4284 employs a conservative approach that warns only about calls to bounded
4285 functions whose return value is unused and that will most likely result
4286 in output truncation.
4287
4288 @item -Wformat-truncation=2
4289 Level @var{2} warns also about calls to bounded functions whose return
4290 value is used and that might result in truncation given an argument of
4291 sufficient length or magnitude.
4292 @end table
4293
4294 @item -Wformat-y2k
4295 @opindex Wformat-y2k
4296 @opindex Wno-format-y2k
4297 If @option{-Wformat} is specified, also warn about @code{strftime}
4298 formats that may yield only a two-digit year.
4299 @end table
4300
4301 @item -Wnonnull
4302 @opindex Wnonnull
4303 @opindex Wno-nonnull
4304 Warn about passing a null pointer for arguments marked as
4305 requiring a non-null value by the @code{nonnull} function attribute.
4306
4307 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4308 can be disabled with the @option{-Wno-nonnull} option.
4309
4310 @item -Wnonnull-compare
4311 @opindex Wnonnull-compare
4312 @opindex Wno-nonnull-compare
4313 Warn when comparing an argument marked with the @code{nonnull}
4314 function attribute against null inside the function.
4315
4316 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4317 can be disabled with the @option{-Wno-nonnull-compare} option.
4318
4319 @item -Wnull-dereference
4320 @opindex Wnull-dereference
4321 @opindex Wno-null-dereference
4322 Warn if the compiler detects paths that trigger erroneous or
4323 undefined behavior due to dereferencing a null pointer. This option
4324 is only active when @option{-fdelete-null-pointer-checks} is active,
4325 which is enabled by optimizations in most targets. The precision of
4326 the warnings depends on the optimization options used.
4327
4328 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4329 @opindex Winit-self
4330 @opindex Wno-init-self
4331 Warn about uninitialized variables that are initialized with themselves.
4332 Note this option can only be used with the @option{-Wuninitialized} option.
4333
4334 For example, GCC warns about @code{i} being uninitialized in the
4335 following snippet only when @option{-Winit-self} has been specified:
4336 @smallexample
4337 @group
4338 int f()
4339 @{
4340 int i = i;
4341 return i;
4342 @}
4343 @end group
4344 @end smallexample
4345
4346 This warning is enabled by @option{-Wall} in C++.
4347
4348 @item -Wimplicit-int @r{(C and Objective-C only)}
4349 @opindex Wimplicit-int
4350 @opindex Wno-implicit-int
4351 Warn when a declaration does not specify a type.
4352 This warning is enabled by @option{-Wall}.
4353
4354 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4355 @opindex Wimplicit-function-declaration
4356 @opindex Wno-implicit-function-declaration
4357 Give a warning whenever a function is used before being declared. In
4358 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4359 enabled by default and it is made into an error by
4360 @option{-pedantic-errors}. This warning is also enabled by
4361 @option{-Wall}.
4362
4363 @item -Wimplicit @r{(C and Objective-C only)}
4364 @opindex Wimplicit
4365 @opindex Wno-implicit
4366 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4367 This warning is enabled by @option{-Wall}.
4368
4369 @item -Wimplicit-fallthrough
4370 @opindex Wimplicit-fallthrough
4371 @opindex Wno-implicit-fallthrough
4372 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4373 and @option{-Wno-implicit-fallthrough} is the same as
4374 @option{-Wimplicit-fallthrough=0}.
4375
4376 @item -Wimplicit-fallthrough=@var{n}
4377 @opindex Wimplicit-fallthrough=
4378 Warn when a switch case falls through. For example:
4379
4380 @smallexample
4381 @group
4382 switch (cond)
4383 @{
4384 case 1:
4385 a = 1;
4386 break;
4387 case 2:
4388 a = 2;
4389 case 3:
4390 a = 3;
4391 break;
4392 @}
4393 @end group
4394 @end smallexample
4395
4396 This warning does not warn when the last statement of a case cannot
4397 fall through, e.g. when there is a return statement or a call to function
4398 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4399 also takes into account control flow statements, such as ifs, and only
4400 warns when appropriate. E.g.@:
4401
4402 @smallexample
4403 @group
4404 switch (cond)
4405 @{
4406 case 1:
4407 if (i > 3) @{
4408 bar (5);
4409 break;
4410 @} else if (i < 1) @{
4411 bar (0);
4412 @} else
4413 return;
4414 default:
4415 @dots{}
4416 @}
4417 @end group
4418 @end smallexample
4419
4420 Since there are occasions where a switch case fall through is desirable,
4421 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4422 to be used along with a null statement to suppress this warning that
4423 would normally occur:
4424
4425 @smallexample
4426 @group
4427 switch (cond)
4428 @{
4429 case 1:
4430 bar (0);
4431 __attribute__ ((fallthrough));
4432 default:
4433 @dots{}
4434 @}
4435 @end group
4436 @end smallexample
4437
4438 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4439 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4440 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4441 Instead of these attributes, it is also possible to add a fallthrough comment
4442 to silence the warning. The whole body of the C or C++ style comment should
4443 match the given regular expressions listed below. The option argument @var{n}
4444 specifies what kind of comments are accepted:
4445
4446 @itemize @bullet
4447
4448 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4449
4450 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4451 expression, any comment is used as fallthrough comment.
4452
4453 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4454 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4455
4456 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4457 following regular expressions:
4458
4459 @itemize @bullet
4460
4461 @item @code{-fallthrough}
4462
4463 @item @code{@@fallthrough@@}
4464
4465 @item @code{lint -fallthrough[ \t]*}
4466
4467 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4468
4469 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4470
4471 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4472
4473 @end itemize
4474
4475 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4476 following regular expressions:
4477
4478 @itemize @bullet
4479
4480 @item @code{-fallthrough}
4481
4482 @item @code{@@fallthrough@@}
4483
4484 @item @code{lint -fallthrough[ \t]*}
4485
4486 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4487
4488 @end itemize
4489
4490 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4491 fallthrough comments, only attributes disable the warning.
4492
4493 @end itemize
4494
4495 The comment needs to be followed after optional whitespace and other comments
4496 by @code{case} or @code{default} keywords or by a user label that precedes some
4497 @code{case} or @code{default} label.
4498
4499 @smallexample
4500 @group
4501 switch (cond)
4502 @{
4503 case 1:
4504 bar (0);
4505 /* FALLTHRU */
4506 default:
4507 @dots{}
4508 @}
4509 @end group
4510 @end smallexample
4511
4512 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4513
4514 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4515 @opindex Wif-not-aligned
4516 @opindex Wno-if-not-aligned
4517 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4518 should be issued. This is is enabled by default.
4519 Use @option{-Wno-if-not-aligned} to disable it.
4520
4521 @item -Wignored-qualifiers @r{(C and C++ only)}
4522 @opindex Wignored-qualifiers
4523 @opindex Wno-ignored-qualifiers
4524 Warn if the return type of a function has a type qualifier
4525 such as @code{const}. For ISO C such a type qualifier has no effect,
4526 since the value returned by a function is not an lvalue.
4527 For C++, the warning is only emitted for scalar types or @code{void}.
4528 ISO C prohibits qualified @code{void} return types on function
4529 definitions, so such return types always receive a warning
4530 even without this option.
4531
4532 This warning is also enabled by @option{-Wextra}.
4533
4534 @item -Wignored-attributes @r{(C and C++ only)}
4535 @opindex Wignored-attributes
4536 @opindex Wno-ignored-attributes
4537 Warn when an attribute is ignored. This is different from the
4538 @option{-Wattributes} option in that it warns whenever the compiler decides
4539 to drop an attribute, not that the attribute is either unknown, used in a
4540 wrong place, etc. This warning is enabled by default.
4541
4542 @item -Wmain
4543 @opindex Wmain
4544 @opindex Wno-main
4545 Warn if the type of @code{main} is suspicious. @code{main} should be
4546 a function with external linkage, returning int, taking either zero
4547 arguments, two, or three arguments of appropriate types. This warning
4548 is enabled by default in C++ and is enabled by either @option{-Wall}
4549 or @option{-Wpedantic}.
4550
4551 @item -Wmisleading-indentation @r{(C and C++ only)}
4552 @opindex Wmisleading-indentation
4553 @opindex Wno-misleading-indentation
4554 Warn when the indentation of the code does not reflect the block structure.
4555 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4556 @code{for} clauses with a guarded statement that does not use braces,
4557 followed by an unguarded statement with the same indentation.
4558
4559 In the following example, the call to ``bar'' is misleadingly indented as
4560 if it were guarded by the ``if'' conditional.
4561
4562 @smallexample
4563 if (some_condition ())
4564 foo ();
4565 bar (); /* Gotcha: this is not guarded by the "if". */
4566 @end smallexample
4567
4568 In the case of mixed tabs and spaces, the warning uses the
4569 @option{-ftabstop=} option to determine if the statements line up
4570 (defaulting to 8).
4571
4572 The warning is not issued for code involving multiline preprocessor logic
4573 such as the following example.
4574
4575 @smallexample
4576 if (flagA)
4577 foo (0);
4578 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4579 if (flagB)
4580 #endif
4581 foo (1);
4582 @end smallexample
4583
4584 The warning is not issued after a @code{#line} directive, since this
4585 typically indicates autogenerated code, and no assumptions can be made
4586 about the layout of the file that the directive references.
4587
4588 This warning is enabled by @option{-Wall} in C and C++.
4589
4590 @item -Wmissing-braces
4591 @opindex Wmissing-braces
4592 @opindex Wno-missing-braces
4593 Warn if an aggregate or union initializer is not fully bracketed. In
4594 the following example, the initializer for @code{a} is not fully
4595 bracketed, but that for @code{b} is fully bracketed. This warning is
4596 enabled by @option{-Wall} in C.
4597
4598 @smallexample
4599 int a[2][2] = @{ 0, 1, 2, 3 @};
4600 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4601 @end smallexample
4602
4603 This warning is enabled by @option{-Wall}.
4604
4605 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4606 @opindex Wmissing-include-dirs
4607 @opindex Wno-missing-include-dirs
4608 Warn if a user-supplied include directory does not exist.
4609
4610 @item -Wmultistatement-macros
4611 @opindex Wmultistatement-macros
4612 @opindex Wno-multistatement-macros
4613 Warn about unsafe multiple statement macros that appear to be guarded
4614 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
4615 @code{while}, in which only the first statement is actually guarded after
4616 the macro is expanded.
4617
4618 For example:
4619
4620 @smallexample
4621 #define DOIT x++; y++
4622 if (c)
4623 DOIT;
4624 @end smallexample
4625
4626 will increment @code{y} unconditionally, not just when @code{c} holds.
4627 The can usually be fixed by wrapping the macro in a do-while loop:
4628 @smallexample
4629 #define DOIT do @{ x++; y++; @} while (0)
4630 if (c)
4631 DOIT;
4632 @end smallexample
4633
4634 This warning is enabled by @option{-Wall} in C and C++.
4635
4636 @item -Wparentheses
4637 @opindex Wparentheses
4638 @opindex Wno-parentheses
4639 Warn if parentheses are omitted in certain contexts, such
4640 as when there is an assignment in a context where a truth value
4641 is expected, or when operators are nested whose precedence people
4642 often get confused about.
4643
4644 Also warn if a comparison like @code{x<=y<=z} appears; this is
4645 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4646 interpretation from that of ordinary mathematical notation.
4647
4648 Also warn for dangerous uses of the GNU extension to
4649 @code{?:} with omitted middle operand. When the condition
4650 in the @code{?}: operator is a boolean expression, the omitted value is
4651 always 1. Often programmers expect it to be a value computed
4652 inside the conditional expression instead.
4653
4654 For C++ this also warns for some cases of unnecessary parentheses in
4655 declarations, which can indicate an attempt at a function call instead
4656 of a declaration:
4657 @smallexample
4658 @{
4659 // Declares a local variable called mymutex.
4660 std::unique_lock<std::mutex> (mymutex);
4661 // User meant std::unique_lock<std::mutex> lock (mymutex);
4662 @}
4663 @end smallexample
4664
4665 This warning is enabled by @option{-Wall}.
4666
4667 @item -Wsequence-point
4668 @opindex Wsequence-point
4669 @opindex Wno-sequence-point
4670 Warn about code that may have undefined semantics because of violations
4671 of sequence point rules in the C and C++ standards.
4672
4673 The C and C++ standards define the order in which expressions in a C/C++
4674 program are evaluated in terms of @dfn{sequence points}, which represent
4675 a partial ordering between the execution of parts of the program: those
4676 executed before the sequence point, and those executed after it. These
4677 occur after the evaluation of a full expression (one which is not part
4678 of a larger expression), after the evaluation of the first operand of a
4679 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4680 function is called (but after the evaluation of its arguments and the
4681 expression denoting the called function), and in certain other places.
4682 Other than as expressed by the sequence point rules, the order of
4683 evaluation of subexpressions of an expression is not specified. All
4684 these rules describe only a partial order rather than a total order,
4685 since, for example, if two functions are called within one expression
4686 with no sequence point between them, the order in which the functions
4687 are called is not specified. However, the standards committee have
4688 ruled that function calls do not overlap.
4689
4690 It is not specified when between sequence points modifications to the
4691 values of objects take effect. Programs whose behavior depends on this
4692 have undefined behavior; the C and C++ standards specify that ``Between
4693 the previous and next sequence point an object shall have its stored
4694 value modified at most once by the evaluation of an expression.
4695 Furthermore, the prior value shall be read only to determine the value
4696 to be stored.''. If a program breaks these rules, the results on any
4697 particular implementation are entirely unpredictable.
4698
4699 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4700 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4701 diagnosed by this option, and it may give an occasional false positive
4702 result, but in general it has been found fairly effective at detecting
4703 this sort of problem in programs.
4704
4705 The C++17 standard will define the order of evaluation of operands in
4706 more cases: in particular it requires that the right-hand side of an
4707 assignment be evaluated before the left-hand side, so the above
4708 examples are no longer undefined. But this warning will still warn
4709 about them, to help people avoid writing code that is undefined in C
4710 and earlier revisions of C++.
4711
4712 The standard is worded confusingly, therefore there is some debate
4713 over the precise meaning of the sequence point rules in subtle cases.
4714 Links to discussions of the problem, including proposed formal
4715 definitions, may be found on the GCC readings page, at
4716 @uref{http://gcc.gnu.org/@/readings.html}.
4717
4718 This warning is enabled by @option{-Wall} for C and C++.
4719
4720 @item -Wno-return-local-addr
4721 @opindex Wno-return-local-addr
4722 @opindex Wreturn-local-addr
4723 Do not warn about returning a pointer (or in C++, a reference) to a
4724 variable that goes out of scope after the function returns.
4725
4726 @item -Wreturn-type
4727 @opindex Wreturn-type
4728 @opindex Wno-return-type
4729 Warn whenever a function is defined with a return type that defaults
4730 to @code{int}. Also warn about any @code{return} statement with no
4731 return value in a function whose return type is not @code{void}
4732 (falling off the end of the function body is considered returning
4733 without a value).
4734
4735 For C only, warn about a @code{return} statement with an expression in a
4736 function whose return type is @code{void}, unless the expression type is
4737 also @code{void}. As a GNU extension, the latter case is accepted
4738 without a warning unless @option{-Wpedantic} is used.
4739
4740 For C++, a function without return type always produces a diagnostic
4741 message, even when @option{-Wno-return-type} is specified. The only
4742 exceptions are @code{main} and functions defined in system headers.
4743
4744 This warning is enabled by @option{-Wall}.
4745
4746 @item -Wshift-count-negative
4747 @opindex Wshift-count-negative
4748 @opindex Wno-shift-count-negative
4749 Warn if shift count is negative. This warning is enabled by default.
4750
4751 @item -Wshift-count-overflow
4752 @opindex Wshift-count-overflow
4753 @opindex Wno-shift-count-overflow
4754 Warn if shift count >= width of type. This warning is enabled by default.
4755
4756 @item -Wshift-negative-value
4757 @opindex Wshift-negative-value
4758 @opindex Wno-shift-negative-value
4759 Warn if left shifting a negative value. This warning is enabled by
4760 @option{-Wextra} in C99 and C++11 modes (and newer).
4761
4762 @item -Wshift-overflow
4763 @itemx -Wshift-overflow=@var{n}
4764 @opindex Wshift-overflow
4765 @opindex Wno-shift-overflow
4766 Warn about left shift overflows. This warning is enabled by
4767 default in C99 and C++11 modes (and newer).
4768
4769 @table @gcctabopt
4770 @item -Wshift-overflow=1
4771 This is the warning level of @option{-Wshift-overflow} and is enabled
4772 by default in C99 and C++11 modes (and newer). This warning level does
4773 not warn about left-shifting 1 into the sign bit. (However, in C, such
4774 an overflow is still rejected in contexts where an integer constant expression
4775 is required.)
4776
4777 @item -Wshift-overflow=2
4778 This warning level also warns about left-shifting 1 into the sign bit,
4779 unless C++14 mode is active.
4780 @end table
4781
4782 @item -Wswitch
4783 @opindex Wswitch
4784 @opindex Wno-switch
4785 Warn whenever a @code{switch} statement has an index of enumerated type
4786 and lacks a @code{case} for one or more of the named codes of that
4787 enumeration. (The presence of a @code{default} label prevents this
4788 warning.) @code{case} labels outside the enumeration range also
4789 provoke warnings when this option is used (even if there is a
4790 @code{default} label).
4791 This warning is enabled by @option{-Wall}.
4792
4793 @item -Wswitch-default
4794 @opindex Wswitch-default
4795 @opindex Wno-switch-default
4796 Warn whenever a @code{switch} statement does not have a @code{default}
4797 case.
4798
4799 @item -Wswitch-enum
4800 @opindex Wswitch-enum
4801 @opindex Wno-switch-enum
4802 Warn whenever a @code{switch} statement has an index of enumerated type
4803 and lacks a @code{case} for one or more of the named codes of that
4804 enumeration. @code{case} labels outside the enumeration range also
4805 provoke warnings when this option is used. The only difference
4806 between @option{-Wswitch} and this option is that this option gives a
4807 warning about an omitted enumeration code even if there is a
4808 @code{default} label.
4809
4810 @item -Wswitch-bool
4811 @opindex Wswitch-bool
4812 @opindex Wno-switch-bool
4813 Warn whenever a @code{switch} statement has an index of boolean type
4814 and the case values are outside the range of a boolean type.
4815 It is possible to suppress this warning by casting the controlling
4816 expression to a type other than @code{bool}. For example:
4817 @smallexample
4818 @group
4819 switch ((int) (a == 4))
4820 @{
4821 @dots{}
4822 @}
4823 @end group
4824 @end smallexample
4825 This warning is enabled by default for C and C++ programs.
4826
4827 @item -Wswitch-unreachable
4828 @opindex Wswitch-unreachable
4829 @opindex Wno-switch-unreachable
4830 Warn whenever a @code{switch} statement contains statements between the
4831 controlling expression and the first case label, which will never be
4832 executed. For example:
4833 @smallexample
4834 @group
4835 switch (cond)
4836 @{
4837 i = 15;
4838 @dots{}
4839 case 5:
4840 @dots{}
4841 @}
4842 @end group
4843 @end smallexample
4844 @option{-Wswitch-unreachable} does not warn if the statement between the
4845 controlling expression and the first case label is just a declaration:
4846 @smallexample
4847 @group
4848 switch (cond)
4849 @{
4850 int i;
4851 @dots{}
4852 case 5:
4853 i = 5;
4854 @dots{}
4855 @}
4856 @end group
4857 @end smallexample
4858 This warning is enabled by default for C and C++ programs.
4859
4860 @item -Wsync-nand @r{(C and C++ only)}
4861 @opindex Wsync-nand
4862 @opindex Wno-sync-nand
4863 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4864 built-in functions are used. These functions changed semantics in GCC 4.4.
4865
4866 @item -Wunused-but-set-parameter
4867 @opindex Wunused-but-set-parameter
4868 @opindex Wno-unused-but-set-parameter
4869 Warn whenever a function parameter is assigned to, but otherwise unused
4870 (aside from its declaration).
4871
4872 To suppress this warning use the @code{unused} attribute
4873 (@pxref{Variable Attributes}).
4874
4875 This warning is also enabled by @option{-Wunused} together with
4876 @option{-Wextra}.
4877
4878 @item -Wunused-but-set-variable
4879 @opindex Wunused-but-set-variable
4880 @opindex Wno-unused-but-set-variable
4881 Warn whenever a local variable is assigned to, but otherwise unused
4882 (aside from its declaration).
4883 This warning is enabled by @option{-Wall}.
4884
4885 To suppress this warning use the @code{unused} attribute
4886 (@pxref{Variable Attributes}).
4887
4888 This warning is also enabled by @option{-Wunused}, which is enabled
4889 by @option{-Wall}.
4890
4891 @item -Wunused-function
4892 @opindex Wunused-function
4893 @opindex Wno-unused-function
4894 Warn whenever a static function is declared but not defined or a
4895 non-inline static function is unused.
4896 This warning is enabled by @option{-Wall}.
4897
4898 @item -Wunused-label
4899 @opindex Wunused-label
4900 @opindex Wno-unused-label
4901 Warn whenever a label is declared but not used.
4902 This warning is enabled by @option{-Wall}.
4903
4904 To suppress this warning use the @code{unused} attribute
4905 (@pxref{Variable Attributes}).
4906
4907 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4908 @opindex Wunused-local-typedefs
4909 Warn when a typedef locally defined in a function is not used.
4910 This warning is enabled by @option{-Wall}.
4911
4912 @item -Wunused-parameter
4913 @opindex Wunused-parameter
4914 @opindex Wno-unused-parameter
4915 Warn whenever a function parameter is unused aside from its declaration.
4916
4917 To suppress this warning use the @code{unused} attribute
4918 (@pxref{Variable Attributes}).
4919
4920 @item -Wno-unused-result
4921 @opindex Wunused-result
4922 @opindex Wno-unused-result
4923 Do not warn if a caller of a function marked with attribute
4924 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4925 its return value. The default is @option{-Wunused-result}.
4926
4927 @item -Wunused-variable
4928 @opindex Wunused-variable
4929 @opindex Wno-unused-variable
4930 Warn whenever a local or static variable is unused aside from its
4931 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4932 but not for C++. This warning is enabled by @option{-Wall}.
4933
4934 To suppress this warning use the @code{unused} attribute
4935 (@pxref{Variable Attributes}).
4936
4937 @item -Wunused-const-variable
4938 @itemx -Wunused-const-variable=@var{n}
4939 @opindex Wunused-const-variable
4940 @opindex Wno-unused-const-variable
4941 Warn whenever a constant static variable is unused aside from its declaration.
4942 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4943 for C, but not for C++. In C this declares variable storage, but in C++ this
4944 is not an error since const variables take the place of @code{#define}s.
4945
4946 To suppress this warning use the @code{unused} attribute
4947 (@pxref{Variable Attributes}).
4948
4949 @table @gcctabopt
4950 @item -Wunused-const-variable=1
4951 This is the warning level that is enabled by @option{-Wunused-variable} for
4952 C. It warns only about unused static const variables defined in the main
4953 compilation unit, but not about static const variables declared in any
4954 header included.
4955
4956 @item -Wunused-const-variable=2
4957 This warning level also warns for unused constant static variables in
4958 headers (excluding system headers). This is the warning level of
4959 @option{-Wunused-const-variable} and must be explicitly requested since
4960 in C++ this isn't an error and in C it might be harder to clean up all
4961 headers included.
4962 @end table
4963
4964 @item -Wunused-value
4965 @opindex Wunused-value
4966 @opindex Wno-unused-value
4967 Warn whenever a statement computes a result that is explicitly not
4968 used. To suppress this warning cast the unused expression to
4969 @code{void}. This includes an expression-statement or the left-hand
4970 side of a comma expression that contains no side effects. For example,
4971 an expression such as @code{x[i,j]} causes a warning, while
4972 @code{x[(void)i,j]} does not.
4973
4974 This warning is enabled by @option{-Wall}.
4975
4976 @item -Wunused
4977 @opindex Wunused
4978 @opindex Wno-unused
4979 All the above @option{-Wunused} options combined.
4980
4981 In order to get a warning about an unused function parameter, you must
4982 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4983 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4984
4985 @item -Wuninitialized
4986 @opindex Wuninitialized
4987 @opindex Wno-uninitialized
4988 Warn if an automatic variable is used without first being initialized
4989 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4990 warn if a non-static reference or non-static @code{const} member
4991 appears in a class without constructors.
4992
4993 If you want to warn about code that uses the uninitialized value of the
4994 variable in its own initializer, use the @option{-Winit-self} option.
4995
4996 These warnings occur for individual uninitialized or clobbered
4997 elements of structure, union or array variables as well as for
4998 variables that are uninitialized or clobbered as a whole. They do
4999 not occur for variables or elements declared @code{volatile}. Because
5000 these warnings depend on optimization, the exact variables or elements
5001 for which there are warnings depends on the precise optimization
5002 options and version of GCC used.
5003
5004 Note that there may be no warning about a variable that is used only
5005 to compute a value that itself is never used, because such
5006 computations may be deleted by data flow analysis before the warnings
5007 are printed.
5008
5009 @item -Winvalid-memory-model
5010 @opindex Winvalid-memory-model
5011 @opindex Wno-invalid-memory-model
5012 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5013 and the C11 atomic generic functions with a memory consistency argument
5014 that is either invalid for the operation or outside the range of values
5015 of the @code{memory_order} enumeration. For example, since the
5016 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5017 defined for the relaxed, release, and sequentially consistent memory
5018 orders the following code is diagnosed:
5019
5020 @smallexample
5021 void store (int *i)
5022 @{
5023 __atomic_store_n (i, 0, memory_order_consume);
5024 @}
5025 @end smallexample
5026
5027 @option{-Winvalid-memory-model} is enabled by default.
5028
5029 @item -Wmaybe-uninitialized
5030 @opindex Wmaybe-uninitialized
5031 @opindex Wno-maybe-uninitialized
5032 For an automatic (i.e.@ local) variable, if there exists a path from the
5033 function entry to a use of the variable that is initialized, but there exist
5034 some other paths for which the variable is not initialized, the compiler
5035 emits a warning if it cannot prove the uninitialized paths are not
5036 executed at run time.
5037
5038 These warnings are only possible in optimizing compilation, because otherwise
5039 GCC does not keep track of the state of variables.
5040
5041 These warnings are made optional because GCC may not be able to determine when
5042 the code is correct in spite of appearing to have an error. Here is one
5043 example of how this can happen:
5044
5045 @smallexample
5046 @group
5047 @{
5048 int x;
5049 switch (y)
5050 @{
5051 case 1: x = 1;
5052 break;
5053 case 2: x = 4;
5054 break;
5055 case 3: x = 5;
5056 @}
5057 foo (x);
5058 @}
5059 @end group
5060 @end smallexample
5061
5062 @noindent
5063 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5064 always initialized, but GCC doesn't know this. To suppress the
5065 warning, you need to provide a default case with assert(0) or
5066 similar code.
5067
5068 @cindex @code{longjmp} warnings
5069 This option also warns when a non-volatile automatic variable might be
5070 changed by a call to @code{longjmp}.
5071 The compiler sees only the calls to @code{setjmp}. It cannot know
5072 where @code{longjmp} will be called; in fact, a signal handler could
5073 call it at any point in the code. As a result, you may get a warning
5074 even when there is in fact no problem because @code{longjmp} cannot
5075 in fact be called at the place that would cause a problem.
5076
5077 Some spurious warnings can be avoided if you declare all the functions
5078 you use that never return as @code{noreturn}. @xref{Function
5079 Attributes}.
5080
5081 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5082
5083 @item -Wunknown-pragmas
5084 @opindex Wunknown-pragmas
5085 @opindex Wno-unknown-pragmas
5086 @cindex warning for unknown pragmas
5087 @cindex unknown pragmas, warning
5088 @cindex pragmas, warning of unknown
5089 Warn when a @code{#pragma} directive is encountered that is not understood by
5090 GCC@. If this command-line option is used, warnings are even issued
5091 for unknown pragmas in system header files. This is not the case if
5092 the warnings are only enabled by the @option{-Wall} command-line option.
5093
5094 @item -Wno-pragmas
5095 @opindex Wno-pragmas
5096 @opindex Wpragmas
5097 Do not warn about misuses of pragmas, such as incorrect parameters,
5098 invalid syntax, or conflicts between pragmas. See also
5099 @option{-Wunknown-pragmas}.
5100
5101 @item -Wstrict-aliasing
5102 @opindex Wstrict-aliasing
5103 @opindex Wno-strict-aliasing
5104 This option is only active when @option{-fstrict-aliasing} is active.
5105 It warns about code that might break the strict aliasing rules that the
5106 compiler is using for optimization. The warning does not catch all
5107 cases, but does attempt to catch the more common pitfalls. It is
5108 included in @option{-Wall}.
5109 It is equivalent to @option{-Wstrict-aliasing=3}
5110
5111 @item -Wstrict-aliasing=n
5112 @opindex Wstrict-aliasing=n
5113 This option is only active when @option{-fstrict-aliasing} is active.
5114 It warns about code that might break the strict aliasing rules that the
5115 compiler is using for optimization.
5116 Higher levels correspond to higher accuracy (fewer false positives).
5117 Higher levels also correspond to more effort, similar to the way @option{-O}
5118 works.
5119 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5120
5121 Level 1: Most aggressive, quick, least accurate.
5122 Possibly useful when higher levels
5123 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5124 false negatives. However, it has many false positives.
5125 Warns for all pointer conversions between possibly incompatible types,
5126 even if never dereferenced. Runs in the front end only.
5127
5128 Level 2: Aggressive, quick, not too precise.
5129 May still have many false positives (not as many as level 1 though),
5130 and few false negatives (but possibly more than level 1).
5131 Unlike level 1, it only warns when an address is taken. Warns about
5132 incomplete types. Runs in the front end only.
5133
5134 Level 3 (default for @option{-Wstrict-aliasing}):
5135 Should have very few false positives and few false
5136 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5137 Takes care of the common pun+dereference pattern in the front end:
5138 @code{*(int*)&some_float}.
5139 If optimization is enabled, it also runs in the back end, where it deals
5140 with multiple statement cases using flow-sensitive points-to information.
5141 Only warns when the converted pointer is dereferenced.
5142 Does not warn about incomplete types.
5143
5144 @item -Wstrict-overflow
5145 @itemx -Wstrict-overflow=@var{n}
5146 @opindex Wstrict-overflow
5147 @opindex Wno-strict-overflow
5148 This option is only active when signed overflow is undefined.
5149 It warns about cases where the compiler optimizes based on the
5150 assumption that signed overflow does not occur. Note that it does not
5151 warn about all cases where the code might overflow: it only warns
5152 about cases where the compiler implements some optimization. Thus
5153 this warning depends on the optimization level.
5154
5155 An optimization that assumes that signed overflow does not occur is
5156 perfectly safe if the values of the variables involved are such that
5157 overflow never does, in fact, occur. Therefore this warning can
5158 easily give a false positive: a warning about code that is not
5159 actually a problem. To help focus on important issues, several
5160 warning levels are defined. No warnings are issued for the use of
5161 undefined signed overflow when estimating how many iterations a loop
5162 requires, in particular when determining whether a loop will be
5163 executed at all.
5164
5165 @table @gcctabopt
5166 @item -Wstrict-overflow=1
5167 Warn about cases that are both questionable and easy to avoid. For
5168 example the compiler simplifies
5169 @code{x + 1 > x} to @code{1}. This level of
5170 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5171 are not, and must be explicitly requested.
5172
5173 @item -Wstrict-overflow=2
5174 Also warn about other cases where a comparison is simplified to a
5175 constant. For example: @code{abs (x) >= 0}. This can only be
5176 simplified when signed integer overflow is undefined, because
5177 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5178 zero. @option{-Wstrict-overflow} (with no level) is the same as
5179 @option{-Wstrict-overflow=2}.
5180
5181 @item -Wstrict-overflow=3
5182 Also warn about other cases where a comparison is simplified. For
5183 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5184
5185 @item -Wstrict-overflow=4
5186 Also warn about other simplifications not covered by the above cases.
5187 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5188
5189 @item -Wstrict-overflow=5
5190 Also warn about cases where the compiler reduces the magnitude of a
5191 constant involved in a comparison. For example: @code{x + 2 > y} is
5192 simplified to @code{x + 1 >= y}. This is reported only at the
5193 highest warning level because this simplification applies to many
5194 comparisons, so this warning level gives a very large number of
5195 false positives.
5196 @end table
5197
5198 @item -Wstringop-overflow
5199 @itemx -Wstringop-overflow=@var{type}
5200 @opindex Wstringop-overflow
5201 @opindex Wno-stringop-overflow
5202 Warn for calls to string manipulation functions such as @code{memcpy} and
5203 @code{strcpy} that are determined to overflow the destination buffer. The
5204 optional argument is one greater than the type of Object Size Checking to
5205 perform to determine the size of the destination. @xref{Object Size Checking}.
5206 The argument is meaningful only for functions that operate on character arrays
5207 but not for raw memory functions like @code{memcpy} which always make use
5208 of Object Size type-0. The option also warns for calls that specify a size
5209 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5210 The option produces the best results with optimization enabled but can detect
5211 a small subset of simple buffer overflows even without optimization in
5212 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5213 correspond to the standard functions. In any case, the option warns about
5214 just a subset of buffer overflows detected by the corresponding overflow
5215 checking built-ins. For example, the option will issue a warning for
5216 the @code{strcpy} call below because it copies at least 5 characters
5217 (the string @code{"blue"} including the terminating NUL) into the buffer
5218 of size 4.
5219
5220 @smallexample
5221 enum Color @{ blue, purple, yellow @};
5222 const char* f (enum Color clr)
5223 @{
5224 static char buf [4];
5225 const char *str;
5226 switch (clr)
5227 @{
5228 case blue: str = "blue"; break;
5229 case purple: str = "purple"; break;
5230 case yellow: str = "yellow"; break;
5231 @}
5232
5233 return strcpy (buf, str); // warning here
5234 @}
5235 @end smallexample
5236
5237 Option @option{-Wstringop-overflow=2} is enabled by default.
5238
5239 @table @gcctabopt
5240 @item -Wstringop-overflow
5241 @item -Wstringop-overflow=1
5242 @opindex Wstringop-overflow
5243 @opindex Wno-stringop-overflow
5244 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5245 to determine the sizes of destination objects. This is the default setting
5246 of the option. At this setting the option will not warn for writes past
5247 the end of subobjects of larger objects accessed by pointers unless the
5248 size of the largest surrounding object is known. When the destination may
5249 be one of several objects it is assumed to be the largest one of them. On
5250 Linux systems, when optimization is enabled at this setting the option warns
5251 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5252 a non-zero value.
5253
5254 @item -Wstringop-overflow=2
5255 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5256 to determine the sizes of destination objects. At this setting the option
5257 will warn about overflows when writing to members of the largest complete
5258 objects whose exact size is known. It will, however, not warn for excessive
5259 writes to the same members of unknown objects referenced by pointers since
5260 they may point to arrays containing unknown numbers of elements.
5261
5262 @item -Wstringop-overflow=3
5263 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5264 to determine the sizes of destination objects. At this setting the option
5265 warns about overflowing the smallest object or data member. This is the
5266 most restrictive setting of the option that may result in warnings for safe
5267 code.
5268
5269 @item -Wstringop-overflow=4
5270 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5271 to determine the sizes of destination objects. At this setting the option
5272 will warn about overflowing any data members, and when the destination is
5273 one of several objects it uses the size of the largest of them to decide
5274 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5275 setting of the option may result in warnings for benign code.
5276 @end table
5277
5278 @item -Wstringop-truncation
5279 @opindex Wstringop-truncation
5280 @opindex Wno-stringop-truncation
5281 Warn for calls to bounded string manipulation functions such as @code{strncat},
5282 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5283 or leave the destination unchanged.
5284
5285 In the following example, the call to @code{strncat} specifies a bound that
5286 is less than the length of the source string. As a result, the copy of
5287 the source will be truncated and so the call is diagnosed. To avoid the
5288 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5289
5290 @smallexample
5291 void append (char *buf, size_t bufsize)
5292 @{
5293 strncat (buf, ".txt", 3);
5294 @}
5295 @end smallexample
5296
5297 As another example, the following call to @code{strncpy} results in copying
5298 to @code{d} just the characters preceding the terminating NUL, without
5299 appending the NUL to the end. Assuming the result of @code{strncpy} is
5300 necessarily a NUL-terminated string is a common mistake, and so the call
5301 is diagnosed. To avoid the warning when the result is not expected to be
5302 NUL-terminated, call @code{memcpy} instead.
5303
5304 @smallexample
5305 void copy (char *d, const char *s)
5306 @{
5307 strncpy (d, s, strlen (s));
5308 @}
5309 @end smallexample
5310
5311 In the following example, the call to @code{strncpy} specifies the size
5312 of the destination buffer as the bound. If the length of the source
5313 string is equal to or greater than this size the result of the copy will
5314 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5315 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5316 element of the buffer to @code{NUL}.
5317
5318 @smallexample
5319 void copy (const char *s)
5320 @{
5321 char buf[80];
5322 strncpy (buf, s, sizeof buf);
5323 @dots{}
5324 @}
5325 @end smallexample
5326
5327 In situations where a character array is intended to store a sequence
5328 of bytes with no terminating @code{NUL} such an array may be annotated
5329 with attribute @code{nonstring} to avoid this warning. Such arrays,
5330 however, are not suitable arguments to functions that expect
5331 @code{NUL}-terminated strings. To help detect accidental misuses of
5332 such arrays GCC issues warnings unless it can prove that the use is
5333 safe. @xref{Common Variable Attributes}.
5334
5335 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5336 @opindex Wsuggest-attribute=
5337 @opindex Wno-suggest-attribute=
5338 Warn for cases where adding an attribute may be beneficial. The
5339 attributes currently supported are listed below.
5340
5341 @table @gcctabopt
5342 @item -Wsuggest-attribute=pure
5343 @itemx -Wsuggest-attribute=const
5344 @itemx -Wsuggest-attribute=noreturn
5345 @itemx -Wsuggest-attribute=malloc
5346 @opindex Wsuggest-attribute=pure
5347 @opindex Wno-suggest-attribute=pure
5348 @opindex Wsuggest-attribute=const
5349 @opindex Wno-suggest-attribute=const
5350 @opindex Wsuggest-attribute=noreturn
5351 @opindex Wno-suggest-attribute=noreturn
5352 @opindex Wsuggest-attribute=malloc
5353 @opindex Wno-suggest-attribute=malloc
5354
5355 Warn about functions that might be candidates for attributes
5356 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5357 only warns for functions visible in other compilation units or (in the case of
5358 @code{pure} and @code{const}) if it cannot prove that the function returns
5359 normally. A function returns normally if it doesn't contain an infinite loop or
5360 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5361 requires option @option{-fipa-pure-const}, which is enabled by default at
5362 @option{-O} and higher. Higher optimization levels improve the accuracy
5363 of the analysis.
5364
5365 @item -Wsuggest-attribute=format
5366 @itemx -Wmissing-format-attribute
5367 @opindex Wsuggest-attribute=format
5368 @opindex Wmissing-format-attribute
5369 @opindex Wno-suggest-attribute=format
5370 @opindex Wno-missing-format-attribute
5371 @opindex Wformat
5372 @opindex Wno-format
5373
5374 Warn about function pointers that might be candidates for @code{format}
5375 attributes. Note these are only possible candidates, not absolute ones.
5376 GCC guesses that function pointers with @code{format} attributes that
5377 are used in assignment, initialization, parameter passing or return
5378 statements should have a corresponding @code{format} attribute in the
5379 resulting type. I.e.@: the left-hand side of the assignment or
5380 initialization, the type of the parameter variable, or the return type
5381 of the containing function respectively should also have a @code{format}
5382 attribute to avoid the warning.
5383
5384 GCC also warns about function definitions that might be
5385 candidates for @code{format} attributes. Again, these are only
5386 possible candidates. GCC guesses that @code{format} attributes
5387 might be appropriate for any function that calls a function like
5388 @code{vprintf} or @code{vscanf}, but this might not always be the
5389 case, and some functions for which @code{format} attributes are
5390 appropriate may not be detected.
5391
5392 @item -Wsuggest-attribute=cold
5393 @opindex Wsuggest-attribute=cold
5394 @opindex Wno-suggest-attribute=cold
5395
5396 Warn about functions that might be candidates for @code{cold} attribute. This
5397 is based on static detection and generally will only warn about functions which
5398 always leads to a call to another @code{cold} function such as wrappers of
5399 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5400 @end table
5401
5402 @item -Wsuggest-final-types
5403 @opindex Wno-suggest-final-types
5404 @opindex Wsuggest-final-types
5405 Warn about types with virtual methods where code quality would be improved
5406 if the type were declared with the C++11 @code{final} specifier,
5407 or, if possible,
5408 declared in an anonymous namespace. This allows GCC to more aggressively
5409 devirtualize the polymorphic calls. This warning is more effective with link
5410 time optimization, where the information about the class hierarchy graph is
5411 more complete.
5412
5413 @item -Wsuggest-final-methods
5414 @opindex Wno-suggest-final-methods
5415 @opindex Wsuggest-final-methods
5416 Warn about virtual methods where code quality would be improved if the method
5417 were declared with the C++11 @code{final} specifier,
5418 or, if possible, its type were
5419 declared in an anonymous namespace or with the @code{final} specifier.
5420 This warning is
5421 more effective with link-time optimization, where the information about the
5422 class hierarchy graph is more complete. It is recommended to first consider
5423 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5424 annotations.
5425
5426 @item -Wsuggest-override
5427 Warn about overriding virtual functions that are not marked with the override
5428 keyword.
5429
5430 @item -Walloc-zero
5431 @opindex Wno-alloc-zero
5432 @opindex Walloc-zero
5433 Warn about calls to allocation functions decorated with attribute
5434 @code{alloc_size} that specify zero bytes, including those to the built-in
5435 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5436 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5437 when called with a zero size differs among implementations (and in the case
5438 of @code{realloc} has been deprecated) relying on it may result in subtle
5439 portability bugs and should be avoided.
5440
5441 @item -Walloc-size-larger-than=@var{n}
5442 Warn about calls to functions decorated with attribute @code{alloc_size}
5443 that attempt to allocate objects larger than the specified number of bytes,
5444 or where the result of the size computation in an integer type with infinite
5445 precision would exceed @code{SIZE_MAX / 2}. The option argument @var{n}
5446 may end in one of the standard suffixes designating a multiple of bytes
5447 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
5448 @code{MB} and @code{MiB} for megabyte and mebibyte, and so on.
5449 @xref{Function Attributes}.
5450
5451 @item -Walloca
5452 @opindex Wno-alloca
5453 @opindex Walloca
5454 This option warns on all uses of @code{alloca} in the source.
5455
5456 @item -Walloca-larger-than=@var{n}
5457 This option warns on calls to @code{alloca} that are not bounded by a
5458 controlling predicate limiting its argument of integer type to at most
5459 @var{n} bytes, or calls to @code{alloca} where the bound is unknown.
5460 Arguments of non-integer types are considered unbounded even if they
5461 appear to be constrained to the expected range.
5462
5463 For example, a bounded case of @code{alloca} could be:
5464
5465 @smallexample
5466 void func (size_t n)
5467 @{
5468 void *p;
5469 if (n <= 1000)
5470 p = alloca (n);
5471 else
5472 p = malloc (n);
5473 f (p);
5474 @}
5475 @end smallexample
5476
5477 In the above example, passing @code{-Walloca-larger-than=1000} would not
5478 issue a warning because the call to @code{alloca} is known to be at most
5479 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5480 the compiler would emit a warning.
5481
5482 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5483 controlling predicate constraining its integer argument. For example:
5484
5485 @smallexample
5486 void func ()
5487 @{
5488 void *p = alloca (n);
5489 f (p);
5490 @}
5491 @end smallexample
5492
5493 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5494 a warning, but this time because of the lack of bounds checking.
5495
5496 Note, that even seemingly correct code involving signed integers could
5497 cause a warning:
5498
5499 @smallexample
5500 void func (signed int n)
5501 @{
5502 if (n < 500)
5503 @{
5504 p = alloca (n);
5505 f (p);
5506 @}
5507 @}
5508 @end smallexample
5509
5510 In the above example, @var{n} could be negative, causing a larger than
5511 expected argument to be implicitly cast into the @code{alloca} call.
5512
5513 This option also warns when @code{alloca} is used in a loop.
5514
5515 This warning is not enabled by @option{-Wall}, and is only active when
5516 @option{-ftree-vrp} is active (default for @option{-O2} and above).
5517
5518 See also @option{-Wvla-larger-than=@var{n}}.
5519
5520 @item -Warray-bounds
5521 @itemx -Warray-bounds=@var{n}
5522 @opindex Wno-array-bounds
5523 @opindex Warray-bounds
5524 This option is only active when @option{-ftree-vrp} is active
5525 (default for @option{-O2} and above). It warns about subscripts to arrays
5526 that are always out of bounds. This warning is enabled by @option{-Wall}.
5527
5528 @table @gcctabopt
5529 @item -Warray-bounds=1
5530 This is the warning level of @option{-Warray-bounds} and is enabled
5531 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5532
5533 @item -Warray-bounds=2
5534 This warning level also warns about out of bounds access for
5535 arrays at the end of a struct and for arrays accessed through
5536 pointers. This warning level may give a larger number of
5537 false positives and is deactivated by default.
5538 @end table
5539
5540 @item -Wattribute-alias
5541 Warn about declarations using the @code{alias} and similar attributes whose
5542 target is incompatible with the type of the alias. @xref{Function Attributes,
5543 ,Declaring Attributes of Functions}.
5544
5545 @item -Wbool-compare
5546 @opindex Wno-bool-compare
5547 @opindex Wbool-compare
5548 Warn about boolean expression compared with an integer value different from
5549 @code{true}/@code{false}. For instance, the following comparison is
5550 always false:
5551 @smallexample
5552 int n = 5;
5553 @dots{}
5554 if ((n > 1) == 2) @{ @dots{} @}
5555 @end smallexample
5556 This warning is enabled by @option{-Wall}.
5557
5558 @item -Wbool-operation
5559 @opindex Wno-bool-operation
5560 @opindex Wbool-operation
5561 Warn about suspicious operations on expressions of a boolean type. For
5562 instance, bitwise negation of a boolean is very likely a bug in the program.
5563 For C, this warning also warns about incrementing or decrementing a boolean,
5564 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5565 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
5566
5567 This warning is enabled by @option{-Wall}.
5568
5569 @item -Wduplicated-branches
5570 @opindex Wno-duplicated-branches
5571 @opindex Wduplicated-branches
5572 Warn when an if-else has identical branches. This warning detects cases like
5573 @smallexample
5574 if (p != NULL)
5575 return 0;
5576 else
5577 return 0;
5578 @end smallexample
5579 It doesn't warn when both branches contain just a null statement. This warning
5580 also warn for conditional operators:
5581 @smallexample
5582 int i = x ? *p : *p;
5583 @end smallexample
5584
5585 @item -Wduplicated-cond
5586 @opindex Wno-duplicated-cond
5587 @opindex Wduplicated-cond
5588 Warn about duplicated conditions in an if-else-if chain. For instance,
5589 warn for the following code:
5590 @smallexample
5591 if (p->q != NULL) @{ @dots{} @}
5592 else if (p->q != NULL) @{ @dots{} @}
5593 @end smallexample
5594
5595 @item -Wframe-address
5596 @opindex Wno-frame-address
5597 @opindex Wframe-address
5598 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5599 is called with an argument greater than 0. Such calls may return indeterminate
5600 values or crash the program. The warning is included in @option{-Wall}.
5601
5602 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5603 @opindex Wno-discarded-qualifiers
5604 @opindex Wdiscarded-qualifiers
5605 Do not warn if type qualifiers on pointers are being discarded.
5606 Typically, the compiler warns if a @code{const char *} variable is
5607 passed to a function that takes a @code{char *} parameter. This option
5608 can be used to suppress such a warning.
5609
5610 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5611 @opindex Wno-discarded-array-qualifiers
5612 @opindex Wdiscarded-array-qualifiers
5613 Do not warn if type qualifiers on arrays which are pointer targets
5614 are being discarded. Typically, the compiler warns if a
5615 @code{const int (*)[]} variable is passed to a function that
5616 takes a @code{int (*)[]} parameter. This option can be used to
5617 suppress such a warning.
5618
5619 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5620 @opindex Wno-incompatible-pointer-types
5621 @opindex Wincompatible-pointer-types
5622 Do not warn when there is a conversion between pointers that have incompatible
5623 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5624 which warns for pointer argument passing or assignment with different
5625 signedness.
5626
5627 @item -Wno-int-conversion @r{(C and Objective-C only)}
5628 @opindex Wno-int-conversion
5629 @opindex Wint-conversion
5630 Do not warn about incompatible integer to pointer and pointer to integer
5631 conversions. This warning is about implicit conversions; for explicit
5632 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5633 @option{-Wno-pointer-to-int-cast} may be used.
5634
5635 @item -Wno-div-by-zero
5636 @opindex Wno-div-by-zero
5637 @opindex Wdiv-by-zero
5638 Do not warn about compile-time integer division by zero. Floating-point
5639 division by zero is not warned about, as it can be a legitimate way of
5640 obtaining infinities and NaNs.
5641
5642 @item -Wsystem-headers
5643 @opindex Wsystem-headers
5644 @opindex Wno-system-headers
5645 @cindex warnings from system headers
5646 @cindex system headers, warnings from
5647 Print warning messages for constructs found in system header files.
5648 Warnings from system headers are normally suppressed, on the assumption
5649 that they usually do not indicate real problems and would only make the
5650 compiler output harder to read. Using this command-line option tells
5651 GCC to emit warnings from system headers as if they occurred in user
5652 code. However, note that using @option{-Wall} in conjunction with this
5653 option does @emph{not} warn about unknown pragmas in system
5654 headers---for that, @option{-Wunknown-pragmas} must also be used.
5655
5656 @item -Wtautological-compare
5657 @opindex Wtautological-compare
5658 @opindex Wno-tautological-compare
5659 Warn if a self-comparison always evaluates to true or false. This
5660 warning detects various mistakes such as:
5661 @smallexample
5662 int i = 1;
5663 @dots{}
5664 if (i > i) @{ @dots{} @}
5665 @end smallexample
5666
5667 This warning also warns about bitwise comparisons that always evaluate
5668 to true or false, for instance:
5669 @smallexample
5670 if ((a & 16) == 10) @{ @dots{} @}
5671 @end smallexample
5672 will always be false.
5673
5674 This warning is enabled by @option{-Wall}.
5675
5676 @item -Wtrampolines
5677 @opindex Wtrampolines
5678 @opindex Wno-trampolines
5679 Warn about trampolines generated for pointers to nested functions.
5680 A trampoline is a small piece of data or code that is created at run
5681 time on the stack when the address of a nested function is taken, and is
5682 used to call the nested function indirectly. For some targets, it is
5683 made up of data only and thus requires no special treatment. But, for
5684 most targets, it is made up of code and thus requires the stack to be
5685 made executable in order for the program to work properly.
5686
5687 @item -Wfloat-equal
5688 @opindex Wfloat-equal
5689 @opindex Wno-float-equal
5690 Warn if floating-point values are used in equality comparisons.
5691
5692 The idea behind this is that sometimes it is convenient (for the
5693 programmer) to consider floating-point values as approximations to
5694 infinitely precise real numbers. If you are doing this, then you need
5695 to compute (by analyzing the code, or in some other way) the maximum or
5696 likely maximum error that the computation introduces, and allow for it
5697 when performing comparisons (and when producing output, but that's a
5698 different problem). In particular, instead of testing for equality, you
5699 should check to see whether the two values have ranges that overlap; and
5700 this is done with the relational operators, so equality comparisons are
5701 probably mistaken.
5702
5703 @item -Wtraditional @r{(C and Objective-C only)}
5704 @opindex Wtraditional
5705 @opindex Wno-traditional
5706 Warn about certain constructs that behave differently in traditional and
5707 ISO C@. Also warn about ISO C constructs that have no traditional C
5708 equivalent, and/or problematic constructs that should be avoided.
5709
5710 @itemize @bullet
5711 @item
5712 Macro parameters that appear within string literals in the macro body.
5713 In traditional C macro replacement takes place within string literals,
5714 but in ISO C it does not.
5715
5716 @item
5717 In traditional C, some preprocessor directives did not exist.
5718 Traditional preprocessors only considered a line to be a directive
5719 if the @samp{#} appeared in column 1 on the line. Therefore
5720 @option{-Wtraditional} warns about directives that traditional C
5721 understands but ignores because the @samp{#} does not appear as the
5722 first character on the line. It also suggests you hide directives like
5723 @code{#pragma} not understood by traditional C by indenting them. Some
5724 traditional implementations do not recognize @code{#elif}, so this option
5725 suggests avoiding it altogether.
5726
5727 @item
5728 A function-like macro that appears without arguments.
5729
5730 @item
5731 The unary plus operator.
5732
5733 @item
5734 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5735 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5736 constants.) Note, these suffixes appear in macros defined in the system
5737 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5738 Use of these macros in user code might normally lead to spurious
5739 warnings, however GCC's integrated preprocessor has enough context to
5740 avoid warning in these cases.
5741
5742 @item
5743 A function declared external in one block and then used after the end of
5744 the block.
5745
5746 @item
5747 A @code{switch} statement has an operand of type @code{long}.
5748
5749 @item
5750 A non-@code{static} function declaration follows a @code{static} one.
5751 This construct is not accepted by some traditional C compilers.
5752
5753 @item
5754 The ISO type of an integer constant has a different width or
5755 signedness from its traditional type. This warning is only issued if
5756 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5757 typically represent bit patterns, are not warned about.
5758
5759 @item
5760 Usage of ISO string concatenation is detected.
5761
5762 @item
5763 Initialization of automatic aggregates.
5764
5765 @item
5766 Identifier conflicts with labels. Traditional C lacks a separate
5767 namespace for labels.
5768
5769 @item
5770 Initialization of unions. If the initializer is zero, the warning is
5771 omitted. This is done under the assumption that the zero initializer in
5772 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
5773 initializer warnings and relies on default initialization to zero in the
5774 traditional C case.
5775
5776 @item
5777 Conversions by prototypes between fixed/floating-point values and vice
5778 versa. The absence of these prototypes when compiling with traditional
5779 C causes serious problems. This is a subset of the possible
5780 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
5781
5782 @item
5783 Use of ISO C style function definitions. This warning intentionally is
5784 @emph{not} issued for prototype declarations or variadic functions
5785 because these ISO C features appear in your code when using
5786 libiberty's traditional C compatibility macros, @code{PARAMS} and
5787 @code{VPARAMS}. This warning is also bypassed for nested functions
5788 because that feature is already a GCC extension and thus not relevant to
5789 traditional C compatibility.
5790 @end itemize
5791
5792 @item -Wtraditional-conversion @r{(C and Objective-C only)}
5793 @opindex Wtraditional-conversion
5794 @opindex Wno-traditional-conversion
5795 Warn if a prototype causes a type conversion that is different from what
5796 would happen to the same argument in the absence of a prototype. This
5797 includes conversions of fixed point to floating and vice versa, and
5798 conversions changing the width or signedness of a fixed-point argument
5799 except when the same as the default promotion.
5800
5801 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
5802 @opindex Wdeclaration-after-statement
5803 @opindex Wno-declaration-after-statement
5804 Warn when a declaration is found after a statement in a block. This
5805 construct, known from C++, was introduced with ISO C99 and is by default
5806 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
5807
5808 @item -Wshadow
5809 @opindex Wshadow
5810 @opindex Wno-shadow
5811 Warn whenever a local variable or type declaration shadows another
5812 variable, parameter, type, class member (in C++), or instance variable
5813 (in Objective-C) or whenever a built-in function is shadowed. Note
5814 that in C++, the compiler warns if a local variable shadows an
5815 explicit typedef, but not if it shadows a struct/class/enum.
5816 Same as @option{-Wshadow=global}.
5817
5818 @item -Wno-shadow-ivar @r{(Objective-C only)}
5819 @opindex Wno-shadow-ivar
5820 @opindex Wshadow-ivar
5821 Do not warn whenever a local variable shadows an instance variable in an
5822 Objective-C method.
5823
5824 @item -Wshadow=global
5825 @opindex Wshadow=local
5826 The default for @option{-Wshadow}. Warns for any (global) shadowing.
5827
5828 @item -Wshadow=local
5829 @opindex Wshadow=local
5830 Warn when a local variable shadows another local variable or parameter.
5831 This warning is enabled by @option{-Wshadow=global}.
5832
5833 @item -Wshadow=compatible-local
5834 @opindex Wshadow=compatible-local
5835 Warn when a local variable shadows another local variable or parameter
5836 whose type is compatible with that of the shadowing variable. In C++,
5837 type compatibility here means the type of the shadowing variable can be
5838 converted to that of the shadowed variable. The creation of this flag
5839 (in addition to @option{-Wshadow=local}) is based on the idea that when
5840 a local variable shadows another one of incompatible type, it is most
5841 likely intentional, not a bug or typo, as shown in the following example:
5842
5843 @smallexample
5844 @group
5845 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5846 @{
5847 for (int i = 0; i < N; ++i)
5848 @{
5849 ...
5850 @}
5851 ...
5852 @}
5853 @end group
5854 @end smallexample
5855
5856 Since the two variable @code{i} in the example above have incompatible types,
5857 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
5858 Because their types are incompatible, if a programmer accidentally uses one
5859 in place of the other, type checking will catch that and emit an error or
5860 warning. So not warning (about shadowing) in this case will not lead to
5861 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
5862 possibly reduce the number of warnings triggered by intentional shadowing.
5863
5864 This warning is enabled by @option{-Wshadow=local}.
5865
5866 @item -Wlarger-than=@var{len}
5867 @opindex Wlarger-than=@var{len}
5868 @opindex Wlarger-than-@var{len}
5869 Warn whenever an object of larger than @var{len} bytes is defined.
5870
5871 @item -Wframe-larger-than=@var{len}
5872 @opindex Wframe-larger-than
5873 Warn if the size of a function frame is larger than @var{len} bytes.
5874 The computation done to determine the stack frame size is approximate
5875 and not conservative.
5876 The actual requirements may be somewhat greater than @var{len}
5877 even if you do not get a warning. In addition, any space allocated
5878 via @code{alloca}, variable-length arrays, or related constructs
5879 is not included by the compiler when determining
5880 whether or not to issue a warning.
5881
5882 @item -Wno-free-nonheap-object
5883 @opindex Wno-free-nonheap-object
5884 @opindex Wfree-nonheap-object
5885 Do not warn when attempting to free an object that was not allocated
5886 on the heap.
5887
5888 @item -Wstack-usage=@var{len}
5889 @opindex Wstack-usage
5890 Warn if the stack usage of a function might be larger than @var{len} bytes.
5891 The computation done to determine the stack usage is conservative.
5892 Any space allocated via @code{alloca}, variable-length arrays, or related
5893 constructs is included by the compiler when determining whether or not to
5894 issue a warning.
5895
5896 The message is in keeping with the output of @option{-fstack-usage}.
5897
5898 @itemize
5899 @item
5900 If the stack usage is fully static but exceeds the specified amount, it's:
5901
5902 @smallexample
5903 warning: stack usage is 1120 bytes
5904 @end smallexample
5905 @item
5906 If the stack usage is (partly) dynamic but bounded, it's:
5907
5908 @smallexample
5909 warning: stack usage might be 1648 bytes
5910 @end smallexample
5911 @item
5912 If the stack usage is (partly) dynamic and not bounded, it's:
5913
5914 @smallexample
5915 warning: stack usage might be unbounded
5916 @end smallexample
5917 @end itemize
5918
5919 @item -Wunsafe-loop-optimizations
5920 @opindex Wunsafe-loop-optimizations
5921 @opindex Wno-unsafe-loop-optimizations
5922 Warn if the loop cannot be optimized because the compiler cannot
5923 assume anything on the bounds of the loop indices. With
5924 @option{-funsafe-loop-optimizations} warn if the compiler makes
5925 such assumptions.
5926
5927 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
5928 @opindex Wno-pedantic-ms-format
5929 @opindex Wpedantic-ms-format
5930 When used in combination with @option{-Wformat}
5931 and @option{-pedantic} without GNU extensions, this option
5932 disables the warnings about non-ISO @code{printf} / @code{scanf} format
5933 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
5934 which depend on the MS runtime.
5935
5936 @item -Waligned-new
5937 @opindex Waligned-new
5938 @opindex Wno-aligned-new
5939 Warn about a new-expression of a type that requires greater alignment
5940 than the @code{alignof(std::max_align_t)} but uses an allocation
5941 function without an explicit alignment parameter. This option is
5942 enabled by @option{-Wall}.
5943
5944 Normally this only warns about global allocation functions, but
5945 @option{-Waligned-new=all} also warns about class member allocation
5946 functions.
5947
5948 @item -Wplacement-new
5949 @itemx -Wplacement-new=@var{n}
5950 @opindex Wplacement-new
5951 @opindex Wno-placement-new
5952 Warn about placement new expressions with undefined behavior, such as
5953 constructing an object in a buffer that is smaller than the type of
5954 the object. For example, the placement new expression below is diagnosed
5955 because it attempts to construct an array of 64 integers in a buffer only
5956 64 bytes large.
5957 @smallexample
5958 char buf [64];
5959 new (buf) int[64];
5960 @end smallexample
5961 This warning is enabled by default.
5962
5963 @table @gcctabopt
5964 @item -Wplacement-new=1
5965 This is the default warning level of @option{-Wplacement-new}. At this
5966 level the warning is not issued for some strictly undefined constructs that
5967 GCC allows as extensions for compatibility with legacy code. For example,
5968 the following @code{new} expression is not diagnosed at this level even
5969 though it has undefined behavior according to the C++ standard because
5970 it writes past the end of the one-element array.
5971 @smallexample
5972 struct S @{ int n, a[1]; @};
5973 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5974 new (s->a)int [32]();
5975 @end smallexample
5976
5977 @item -Wplacement-new=2
5978 At this level, in addition to diagnosing all the same constructs as at level
5979 1, a diagnostic is also issued for placement new expressions that construct
5980 an object in the last member of structure whose type is an array of a single
5981 element and whose size is less than the size of the object being constructed.
5982 While the previous example would be diagnosed, the following construct makes
5983 use of the flexible member array extension to avoid the warning at level 2.
5984 @smallexample
5985 struct S @{ int n, a[]; @};
5986 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5987 new (s->a)int [32]();
5988 @end smallexample
5989
5990 @end table
5991
5992 @item -Wpointer-arith
5993 @opindex Wpointer-arith
5994 @opindex Wno-pointer-arith
5995 Warn about anything that depends on the ``size of'' a function type or
5996 of @code{void}. GNU C assigns these types a size of 1, for
5997 convenience in calculations with @code{void *} pointers and pointers
5998 to functions. In C++, warn also when an arithmetic operation involves
5999 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6000
6001 @item -Wpointer-compare
6002 @opindex Wpointer-compare
6003 @opindex Wno-pointer-compare
6004 Warn if a pointer is compared with a zero character constant. This usually
6005 means that the pointer was meant to be dereferenced. For example:
6006
6007 @smallexample
6008 const char *p = foo ();
6009 if (p == '\0')
6010 return 42;
6011 @end smallexample
6012
6013 Note that the code above is invalid in C++11.
6014
6015 This warning is enabled by default.
6016
6017 @item -Wtype-limits
6018 @opindex Wtype-limits
6019 @opindex Wno-type-limits
6020 Warn if a comparison is always true or always false due to the limited
6021 range of the data type, but do not warn for constant expressions. For
6022 example, warn if an unsigned variable is compared against zero with
6023 @code{<} or @code{>=}. This warning is also enabled by
6024 @option{-Wextra}.
6025
6026 @include cppwarnopts.texi
6027
6028 @item -Wbad-function-cast @r{(C and Objective-C only)}
6029 @opindex Wbad-function-cast
6030 @opindex Wno-bad-function-cast
6031 Warn when a function call is cast to a non-matching type.
6032 For example, warn if a call to a function returning an integer type
6033 is cast to a pointer type.
6034
6035 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6036 @opindex Wc90-c99-compat
6037 @opindex Wno-c90-c99-compat
6038 Warn about features not present in ISO C90, but present in ISO C99.
6039 For instance, warn about use of variable length arrays, @code{long long}
6040 type, @code{bool} type, compound literals, designated initializers, and so
6041 on. This option is independent of the standards mode. Warnings are disabled
6042 in the expression that follows @code{__extension__}.
6043
6044 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6045 @opindex Wc99-c11-compat
6046 @opindex Wno-c99-c11-compat
6047 Warn about features not present in ISO C99, but present in ISO C11.
6048 For instance, warn about use of anonymous structures and unions,
6049 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6050 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6051 and so on. This option is independent of the standards mode. Warnings are
6052 disabled in the expression that follows @code{__extension__}.
6053
6054 @item -Wc++-compat @r{(C and Objective-C only)}
6055 @opindex Wc++-compat
6056 Warn about ISO C constructs that are outside of the common subset of
6057 ISO C and ISO C++, e.g.@: request for implicit conversion from
6058 @code{void *} to a pointer to non-@code{void} type.
6059
6060 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6061 @opindex Wc++11-compat
6062 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6063 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6064 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6065 enabled by @option{-Wall}.
6066
6067 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6068 @opindex Wc++14-compat
6069 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6070 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6071
6072 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6073 @opindex Wc++17-compat
6074 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6075 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6076
6077 @item -Wcast-qual
6078 @opindex Wcast-qual
6079 @opindex Wno-cast-qual
6080 Warn whenever a pointer is cast so as to remove a type qualifier from
6081 the target type. For example, warn if a @code{const char *} is cast
6082 to an ordinary @code{char *}.
6083
6084 Also warn when making a cast that introduces a type qualifier in an
6085 unsafe way. For example, casting @code{char **} to @code{const char **}
6086 is unsafe, as in this example:
6087
6088 @smallexample
6089 /* p is char ** value. */
6090 const char **q = (const char **) p;
6091 /* Assignment of readonly string to const char * is OK. */
6092 *q = "string";
6093 /* Now char** pointer points to read-only memory. */
6094 **p = 'b';
6095 @end smallexample
6096
6097 @item -Wcast-align
6098 @opindex Wcast-align
6099 @opindex Wno-cast-align
6100 Warn whenever a pointer is cast such that the required alignment of the
6101 target is increased. For example, warn if a @code{char *} is cast to
6102 an @code{int *} on machines where integers can only be accessed at
6103 two- or four-byte boundaries.
6104
6105 @item -Wcast-align=strict
6106 @opindex Wcast-align=strict
6107 Warn whenever a pointer is cast such that the required alignment of the
6108 target is increased. For example, warn if a @code{char *} is cast to
6109 an @code{int *} regardless of the target machine.
6110
6111 @item -Wcast-function-type
6112 @opindex Wcast-function-type
6113 @opindex Wno-cast-function-type
6114 Warn when a function pointer is cast to an incompatible function pointer.
6115 In a cast involving function types with a variable argument list only
6116 the types of initial arguments that are provided are considered.
6117 Any parameter of pointer-type matches any other pointer-type. Any benign
6118 differences in integral types are ignored, like @code{int} vs. @code{long}
6119 on ILP32 targets. Likewise type qualifiers are ignored. The function
6120 type @code{void (*) (void)} is special and matches everything, which can
6121 be used to suppress this warning.
6122 In a cast involving pointer to member types this warning warns whenever
6123 the type cast is changing the pointer to member type.
6124 This warning is enabled by @option{-Wextra}.
6125
6126 @item -Wwrite-strings
6127 @opindex Wwrite-strings
6128 @opindex Wno-write-strings
6129 When compiling C, give string constants the type @code{const
6130 char[@var{length}]} so that copying the address of one into a
6131 non-@code{const} @code{char *} pointer produces a warning. These
6132 warnings help you find at compile time code that can try to write
6133 into a string constant, but only if you have been very careful about
6134 using @code{const} in declarations and prototypes. Otherwise, it is
6135 just a nuisance. This is why we did not make @option{-Wall} request
6136 these warnings.
6137
6138 When compiling C++, warn about the deprecated conversion from string
6139 literals to @code{char *}. This warning is enabled by default for C++
6140 programs.
6141
6142 @item -Wcatch-value
6143 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6144 @opindex Wcatch-value
6145 @opindex Wno-catch-value
6146 Warn about catch handlers that do not catch via reference.
6147 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6148 warn about polymorphic class types that are caught by value.
6149 With @option{-Wcatch-value=2} warn about all class types that are caught
6150 by value. With @option{-Wcatch-value=3} warn about all types that are
6151 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6152
6153 @item -Wclobbered
6154 @opindex Wclobbered
6155 @opindex Wno-clobbered
6156 Warn for variables that might be changed by @code{longjmp} or
6157 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6158
6159 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6160 @opindex Wconditionally-supported
6161 @opindex Wno-conditionally-supported
6162 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6163
6164 @item -Wconversion
6165 @opindex Wconversion
6166 @opindex Wno-conversion
6167 Warn for implicit conversions that may alter a value. This includes
6168 conversions between real and integer, like @code{abs (x)} when
6169 @code{x} is @code{double}; conversions between signed and unsigned,
6170 like @code{unsigned ui = -1}; and conversions to smaller types, like
6171 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6172 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6173 changed by the conversion like in @code{abs (2.0)}. Warnings about
6174 conversions between signed and unsigned integers can be disabled by
6175 using @option{-Wno-sign-conversion}.
6176
6177 For C++, also warn for confusing overload resolution for user-defined
6178 conversions; and conversions that never use a type conversion
6179 operator: conversions to @code{void}, the same type, a base class or a
6180 reference to them. Warnings about conversions between signed and
6181 unsigned integers are disabled by default in C++ unless
6182 @option{-Wsign-conversion} is explicitly enabled.
6183
6184 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6185 @opindex Wconversion-null
6186 @opindex Wno-conversion-null
6187 Do not warn for conversions between @code{NULL} and non-pointer
6188 types. @option{-Wconversion-null} is enabled by default.
6189
6190 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6191 @opindex Wzero-as-null-pointer-constant
6192 @opindex Wno-zero-as-null-pointer-constant
6193 Warn when a literal @samp{0} is used as null pointer constant. This can
6194 be useful to facilitate the conversion to @code{nullptr} in C++11.
6195
6196 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6197 @opindex Wsubobject-linkage
6198 @opindex Wno-subobject-linkage
6199 Warn if a class type has a base or a field whose type uses the anonymous
6200 namespace or depends on a type with no linkage. If a type A depends on
6201 a type B with no or internal linkage, defining it in multiple
6202 translation units would be an ODR violation because the meaning of B
6203 is different in each translation unit. If A only appears in a single
6204 translation unit, the best way to silence the warning is to give it
6205 internal linkage by putting it in an anonymous namespace as well. The
6206 compiler doesn't give this warning for types defined in the main .C
6207 file, as those are unlikely to have multiple definitions.
6208 @option{-Wsubobject-linkage} is enabled by default.
6209
6210 @item -Wdangling-else
6211 @opindex Wdangling-else
6212 @opindex Wno-dangling-else
6213 Warn about constructions where there may be confusion to which
6214 @code{if} statement an @code{else} branch belongs. Here is an example of
6215 such a case:
6216
6217 @smallexample
6218 @group
6219 @{
6220 if (a)
6221 if (b)
6222 foo ();
6223 else
6224 bar ();
6225 @}
6226 @end group
6227 @end smallexample
6228
6229 In C/C++, every @code{else} branch belongs to the innermost possible
6230 @code{if} statement, which in this example is @code{if (b)}. This is
6231 often not what the programmer expected, as illustrated in the above
6232 example by indentation the programmer chose. When there is the
6233 potential for this confusion, GCC issues a warning when this flag
6234 is specified. To eliminate the warning, add explicit braces around
6235 the innermost @code{if} statement so there is no way the @code{else}
6236 can belong to the enclosing @code{if}. The resulting code
6237 looks like this:
6238
6239 @smallexample
6240 @group
6241 @{
6242 if (a)
6243 @{
6244 if (b)
6245 foo ();
6246 else
6247 bar ();
6248 @}
6249 @}
6250 @end group
6251 @end smallexample
6252
6253 This warning is enabled by @option{-Wparentheses}.
6254
6255 @item -Wdate-time
6256 @opindex Wdate-time
6257 @opindex Wno-date-time
6258 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6259 are encountered as they might prevent bit-wise-identical reproducible
6260 compilations.
6261
6262 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6263 @opindex Wdelete-incomplete
6264 @opindex Wno-delete-incomplete
6265 Warn when deleting a pointer to incomplete type, which may cause
6266 undefined behavior at runtime. This warning is enabled by default.
6267
6268 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6269 @opindex Wuseless-cast
6270 @opindex Wno-useless-cast
6271 Warn when an expression is casted to its own type.
6272
6273 @item -Wempty-body
6274 @opindex Wempty-body
6275 @opindex Wno-empty-body
6276 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6277 while} statement. This warning is also enabled by @option{-Wextra}.
6278
6279 @item -Wenum-compare
6280 @opindex Wenum-compare
6281 @opindex Wno-enum-compare
6282 Warn about a comparison between values of different enumerated types.
6283 In C++ enumerated type mismatches in conditional expressions are also
6284 diagnosed and the warning is enabled by default. In C this warning is
6285 enabled by @option{-Wall}.
6286
6287 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6288 @opindex Wextra-semi
6289 @opindex Wno-extra-semi
6290 Warn about redundant semicolon after in-class function definition.
6291
6292 @item -Wjump-misses-init @r{(C, Objective-C only)}
6293 @opindex Wjump-misses-init
6294 @opindex Wno-jump-misses-init
6295 Warn if a @code{goto} statement or a @code{switch} statement jumps
6296 forward across the initialization of a variable, or jumps backward to a
6297 label after the variable has been initialized. This only warns about
6298 variables that are initialized when they are declared. This warning is
6299 only supported for C and Objective-C; in C++ this sort of branch is an
6300 error in any case.
6301
6302 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6303 can be disabled with the @option{-Wno-jump-misses-init} option.
6304
6305 @item -Wsign-compare
6306 @opindex Wsign-compare
6307 @opindex Wno-sign-compare
6308 @cindex warning for comparison of signed and unsigned values
6309 @cindex comparison of signed and unsigned values, warning
6310 @cindex signed and unsigned values, comparison warning
6311 Warn when a comparison between signed and unsigned values could produce
6312 an incorrect result when the signed value is converted to unsigned.
6313 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6314 also enabled by @option{-Wextra}.
6315
6316 @item -Wsign-conversion
6317 @opindex Wsign-conversion
6318 @opindex Wno-sign-conversion
6319 Warn for implicit conversions that may change the sign of an integer
6320 value, like assigning a signed integer expression to an unsigned
6321 integer variable. An explicit cast silences the warning. In C, this
6322 option is enabled also by @option{-Wconversion}.
6323
6324 @item -Wfloat-conversion
6325 @opindex Wfloat-conversion
6326 @opindex Wno-float-conversion
6327 Warn for implicit conversions that reduce the precision of a real value.
6328 This includes conversions from real to integer, and from higher precision
6329 real to lower precision real values. This option is also enabled by
6330 @option{-Wconversion}.
6331
6332 @item -Wno-scalar-storage-order
6333 @opindex -Wno-scalar-storage-order
6334 @opindex -Wscalar-storage-order
6335 Do not warn on suspicious constructs involving reverse scalar storage order.
6336
6337 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6338 @opindex Wsized-deallocation
6339 @opindex Wno-sized-deallocation
6340 Warn about a definition of an unsized deallocation function
6341 @smallexample
6342 void operator delete (void *) noexcept;
6343 void operator delete[] (void *) noexcept;
6344 @end smallexample
6345 without a definition of the corresponding sized deallocation function
6346 @smallexample
6347 void operator delete (void *, std::size_t) noexcept;
6348 void operator delete[] (void *, std::size_t) noexcept;
6349 @end smallexample
6350 or vice versa. Enabled by @option{-Wextra} along with
6351 @option{-fsized-deallocation}.
6352
6353 @item -Wsizeof-pointer-div
6354 @opindex Wsizeof-pointer-div
6355 @opindex Wno-sizeof-pointer-div
6356 Warn for suspicious divisions of two sizeof expressions that divide
6357 the pointer size by the element size, which is the usual way to compute
6358 the array size but won't work out correctly with pointers. This warning
6359 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6360 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6361
6362 @item -Wsizeof-pointer-memaccess
6363 @opindex Wsizeof-pointer-memaccess
6364 @opindex Wno-sizeof-pointer-memaccess
6365 Warn for suspicious length parameters to certain string and memory built-in
6366 functions if the argument uses @code{sizeof}. This warning triggers for
6367 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6368 an array, but a pointer, and suggests a possible fix, or about
6369 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6370 also warns about calls to bounded string copy functions like @code{strncat}
6371 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6372 the source array. For example, in the following function the call to
6373 @code{strncat} specifies the size of the source string as the bound. That
6374 is almost certainly a mistake and so the call is diagnosed.
6375 @smallexample
6376 void make_file (const char *name)
6377 @{
6378 char path[PATH_MAX];
6379 strncpy (path, name, sizeof path - 1);
6380 strncat (path, ".text", sizeof ".text");
6381 @dots{}
6382 @}
6383 @end smallexample
6384
6385 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6386
6387 @item -Wsizeof-array-argument
6388 @opindex Wsizeof-array-argument
6389 @opindex Wno-sizeof-array-argument
6390 Warn when the @code{sizeof} operator is applied to a parameter that is
6391 declared as an array in a function definition. This warning is enabled by
6392 default for C and C++ programs.
6393
6394 @item -Wmemset-elt-size
6395 @opindex Wmemset-elt-size
6396 @opindex Wno-memset-elt-size
6397 Warn for suspicious calls to the @code{memset} built-in function, if the
6398 first argument references an array, and the third argument is a number
6399 equal to the number of elements, but not equal to the size of the array
6400 in memory. This indicates that the user has omitted a multiplication by
6401 the element size. This warning is enabled by @option{-Wall}.
6402
6403 @item -Wmemset-transposed-args
6404 @opindex Wmemset-transposed-args
6405 @opindex Wno-memset-transposed-args
6406 Warn for suspicious calls to the @code{memset} built-in function, if the
6407 second argument is not zero and the third argument is zero. This warns e.g.@
6408 about @code{memset (buf, sizeof buf, 0)} where most probably
6409 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6410 is only emitted if the third argument is literal zero. If it is some
6411 expression that is folded to zero, a cast of zero to some type, etc.,
6412 it is far less likely that the user has mistakenly exchanged the arguments
6413 and no warning is emitted. This warning is enabled by @option{-Wall}.
6414
6415 @item -Waddress
6416 @opindex Waddress
6417 @opindex Wno-address
6418 Warn about suspicious uses of memory addresses. These include using
6419 the address of a function in a conditional expression, such as
6420 @code{void func(void); if (func)}, and comparisons against the memory
6421 address of a string literal, such as @code{if (x == "abc")}. Such
6422 uses typically indicate a programmer error: the address of a function
6423 always evaluates to true, so their use in a conditional usually
6424 indicate that the programmer forgot the parentheses in a function
6425 call; and comparisons against string literals result in unspecified
6426 behavior and are not portable in C, so they usually indicate that the
6427 programmer intended to use @code{strcmp}. This warning is enabled by
6428 @option{-Wall}.
6429
6430 @item -Wlogical-op
6431 @opindex Wlogical-op
6432 @opindex Wno-logical-op
6433 Warn about suspicious uses of logical operators in expressions.
6434 This includes using logical operators in contexts where a
6435 bit-wise operator is likely to be expected. Also warns when
6436 the operands of a logical operator are the same:
6437 @smallexample
6438 extern int a;
6439 if (a < 0 && a < 0) @{ @dots{} @}
6440 @end smallexample
6441
6442 @item -Wlogical-not-parentheses
6443 @opindex Wlogical-not-parentheses
6444 @opindex Wno-logical-not-parentheses
6445 Warn about logical not used on the left hand side operand of a comparison.
6446 This option does not warn if the right operand is considered to be a boolean
6447 expression. Its purpose is to detect suspicious code like the following:
6448 @smallexample
6449 int a;
6450 @dots{}
6451 if (!a > 1) @{ @dots{} @}
6452 @end smallexample
6453
6454 It is possible to suppress the warning by wrapping the LHS into
6455 parentheses:
6456 @smallexample
6457 if ((!a) > 1) @{ @dots{} @}
6458 @end smallexample
6459
6460 This warning is enabled by @option{-Wall}.
6461
6462 @item -Waggregate-return
6463 @opindex Waggregate-return
6464 @opindex Wno-aggregate-return
6465 Warn if any functions that return structures or unions are defined or
6466 called. (In languages where you can return an array, this also elicits
6467 a warning.)
6468
6469 @item -Wno-aggressive-loop-optimizations
6470 @opindex Wno-aggressive-loop-optimizations
6471 @opindex Waggressive-loop-optimizations
6472 Warn if in a loop with constant number of iterations the compiler detects
6473 undefined behavior in some statement during one or more of the iterations.
6474
6475 @item -Wno-attributes
6476 @opindex Wno-attributes
6477 @opindex Wattributes
6478 Do not warn if an unexpected @code{__attribute__} is used, such as
6479 unrecognized attributes, function attributes applied to variables,
6480 etc. This does not stop errors for incorrect use of supported
6481 attributes.
6482
6483 @item -Wno-builtin-declaration-mismatch
6484 @opindex Wno-builtin-declaration-mismatch
6485 @opindex Wbuiltin-declaration-mismatch
6486 Warn if a built-in function is declared with the wrong signature or
6487 as non-function.
6488 This warning is enabled by default.
6489
6490 @item -Wno-builtin-macro-redefined
6491 @opindex Wno-builtin-macro-redefined
6492 @opindex Wbuiltin-macro-redefined
6493 Do not warn if certain built-in macros are redefined. This suppresses
6494 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6495 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6496
6497 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6498 @opindex Wstrict-prototypes
6499 @opindex Wno-strict-prototypes
6500 Warn if a function is declared or defined without specifying the
6501 argument types. (An old-style function definition is permitted without
6502 a warning if preceded by a declaration that specifies the argument
6503 types.)
6504
6505 @item -Wold-style-declaration @r{(C and Objective-C only)}
6506 @opindex Wold-style-declaration
6507 @opindex Wno-old-style-declaration
6508 Warn for obsolescent usages, according to the C Standard, in a
6509 declaration. For example, warn if storage-class specifiers like
6510 @code{static} are not the first things in a declaration. This warning
6511 is also enabled by @option{-Wextra}.
6512
6513 @item -Wold-style-definition @r{(C and Objective-C only)}
6514 @opindex Wold-style-definition
6515 @opindex Wno-old-style-definition
6516 Warn if an old-style function definition is used. A warning is given
6517 even if there is a previous prototype.
6518
6519 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6520 @opindex Wmissing-parameter-type
6521 @opindex Wno-missing-parameter-type
6522 A function parameter is declared without a type specifier in K&R-style
6523 functions:
6524
6525 @smallexample
6526 void foo(bar) @{ @}
6527 @end smallexample
6528
6529 This warning is also enabled by @option{-Wextra}.
6530
6531 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6532 @opindex Wmissing-prototypes
6533 @opindex Wno-missing-prototypes
6534 Warn if a global function is defined without a previous prototype
6535 declaration. This warning is issued even if the definition itself
6536 provides a prototype. Use this option to detect global functions
6537 that do not have a matching prototype declaration in a header file.
6538 This option is not valid for C++ because all function declarations
6539 provide prototypes and a non-matching declaration declares an
6540 overload rather than conflict with an earlier declaration.
6541 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6542
6543 @item -Wmissing-declarations
6544 @opindex Wmissing-declarations
6545 @opindex Wno-missing-declarations
6546 Warn if a global function is defined without a previous declaration.
6547 Do so even if the definition itself provides a prototype.
6548 Use this option to detect global functions that are not declared in
6549 header files. In C, no warnings are issued for functions with previous
6550 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6551 missing prototypes. In C++, no warnings are issued for function templates,
6552 or for inline functions, or for functions in anonymous namespaces.
6553
6554 @item -Wmissing-field-initializers
6555 @opindex Wmissing-field-initializers
6556 @opindex Wno-missing-field-initializers
6557 @opindex W
6558 @opindex Wextra
6559 @opindex Wno-extra
6560 Warn if a structure's initializer has some fields missing. For
6561 example, the following code causes such a warning, because
6562 @code{x.h} is implicitly zero:
6563
6564 @smallexample
6565 struct s @{ int f, g, h; @};
6566 struct s x = @{ 3, 4 @};
6567 @end smallexample
6568
6569 This option does not warn about designated initializers, so the following
6570 modification does not trigger a warning:
6571
6572 @smallexample
6573 struct s @{ int f, g, h; @};
6574 struct s x = @{ .f = 3, .g = 4 @};
6575 @end smallexample
6576
6577 In C this option does not warn about the universal zero initializer
6578 @samp{@{ 0 @}}:
6579
6580 @smallexample
6581 struct s @{ int f, g, h; @};
6582 struct s x = @{ 0 @};
6583 @end smallexample
6584
6585 Likewise, in C++ this option does not warn about the empty @{ @}
6586 initializer, for example:
6587
6588 @smallexample
6589 struct s @{ int f, g, h; @};
6590 s x = @{ @};
6591 @end smallexample
6592
6593 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6594 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6595
6596 @item -Wno-multichar
6597 @opindex Wno-multichar
6598 @opindex Wmultichar
6599 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6600 Usually they indicate a typo in the user's code, as they have
6601 implementation-defined values, and should not be used in portable code.
6602
6603 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6604 @opindex Wnormalized=
6605 @opindex Wnormalized
6606 @opindex Wno-normalized
6607 @cindex NFC
6608 @cindex NFKC
6609 @cindex character set, input normalization
6610 In ISO C and ISO C++, two identifiers are different if they are
6611 different sequences of characters. However, sometimes when characters
6612 outside the basic ASCII character set are used, you can have two
6613 different character sequences that look the same. To avoid confusion,
6614 the ISO 10646 standard sets out some @dfn{normalization rules} which
6615 when applied ensure that two sequences that look the same are turned into
6616 the same sequence. GCC can warn you if you are using identifiers that
6617 have not been normalized; this option controls that warning.
6618
6619 There are four levels of warning supported by GCC@. The default is
6620 @option{-Wnormalized=nfc}, which warns about any identifier that is
6621 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6622 recommended form for most uses. It is equivalent to
6623 @option{-Wnormalized}.
6624
6625 Unfortunately, there are some characters allowed in identifiers by
6626 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6627 identifiers. That is, there's no way to use these symbols in portable
6628 ISO C or C++ and have all your identifiers in NFC@.
6629 @option{-Wnormalized=id} suppresses the warning for these characters.
6630 It is hoped that future versions of the standards involved will correct
6631 this, which is why this option is not the default.
6632
6633 You can switch the warning off for all characters by writing
6634 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6635 only do this if you are using some other normalization scheme (like
6636 ``D''), because otherwise you can easily create bugs that are
6637 literally impossible to see.
6638
6639 Some characters in ISO 10646 have distinct meanings but look identical
6640 in some fonts or display methodologies, especially once formatting has
6641 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6642 LETTER N'', displays just like a regular @code{n} that has been
6643 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6644 normalization scheme to convert all these into a standard form as
6645 well, and GCC warns if your code is not in NFKC if you use
6646 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6647 about every identifier that contains the letter O because it might be
6648 confused with the digit 0, and so is not the default, but may be
6649 useful as a local coding convention if the programming environment
6650 cannot be fixed to display these characters distinctly.
6651
6652 @item -Wno-deprecated
6653 @opindex Wno-deprecated
6654 @opindex Wdeprecated
6655 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6656
6657 @item -Wno-deprecated-declarations
6658 @opindex Wno-deprecated-declarations
6659 @opindex Wdeprecated-declarations
6660 Do not warn about uses of functions (@pxref{Function Attributes}),
6661 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6662 Attributes}) marked as deprecated by using the @code{deprecated}
6663 attribute.
6664
6665 @item -Wno-overflow
6666 @opindex Wno-overflow
6667 @opindex Woverflow
6668 Do not warn about compile-time overflow in constant expressions.
6669
6670 @item -Wno-odr
6671 @opindex Wno-odr
6672 @opindex Wodr
6673 Warn about One Definition Rule violations during link-time optimization.
6674 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6675
6676 @item -Wopenmp-simd
6677 @opindex Wopenm-simd
6678 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
6679 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6680 option can be used to relax the cost model.
6681
6682 @item -Woverride-init @r{(C and Objective-C only)}
6683 @opindex Woverride-init
6684 @opindex Wno-override-init
6685 @opindex W
6686 @opindex Wextra
6687 @opindex Wno-extra
6688 Warn if an initialized field without side effects is overridden when
6689 using designated initializers (@pxref{Designated Inits, , Designated
6690 Initializers}).
6691
6692 This warning is included in @option{-Wextra}. To get other
6693 @option{-Wextra} warnings without this one, use @option{-Wextra
6694 -Wno-override-init}.
6695
6696 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6697 @opindex Woverride-init-side-effects
6698 @opindex Wno-override-init-side-effects
6699 Warn if an initialized field with side effects is overridden when
6700 using designated initializers (@pxref{Designated Inits, , Designated
6701 Initializers}). This warning is enabled by default.
6702
6703 @item -Wpacked
6704 @opindex Wpacked
6705 @opindex Wno-packed
6706 Warn if a structure is given the packed attribute, but the packed
6707 attribute has no effect on the layout or size of the structure.
6708 Such structures may be mis-aligned for little benefit. For
6709 instance, in this code, the variable @code{f.x} in @code{struct bar}
6710 is misaligned even though @code{struct bar} does not itself
6711 have the packed attribute:
6712
6713 @smallexample
6714 @group
6715 struct foo @{
6716 int x;
6717 char a, b, c, d;
6718 @} __attribute__((packed));
6719 struct bar @{
6720 char z;
6721 struct foo f;
6722 @};
6723 @end group
6724 @end smallexample
6725
6726 @item -Wpacked-bitfield-compat
6727 @opindex Wpacked-bitfield-compat
6728 @opindex Wno-packed-bitfield-compat
6729 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
6730 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
6731 the change can lead to differences in the structure layout. GCC
6732 informs you when the offset of such a field has changed in GCC 4.4.
6733 For example there is no longer a 4-bit padding between field @code{a}
6734 and @code{b} in this structure:
6735
6736 @smallexample
6737 struct foo
6738 @{
6739 char a:4;
6740 char b:8;
6741 @} __attribute__ ((packed));
6742 @end smallexample
6743
6744 This warning is enabled by default. Use
6745 @option{-Wno-packed-bitfield-compat} to disable this warning.
6746
6747 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6748 @opindex Wpacked-not-aligned
6749 @opindex Wno-packed-not-aligned
6750 Warn if a structure field with explicitly specified alignment in a
6751 packed struct or union is misaligned. For example, a warning will
6752 be issued on @code{struct S}, like, @code{warning: alignment 1 of
6753 'struct S' is less than 8}, in this code:
6754
6755 @smallexample
6756 @group
6757 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
6758 struct __attribute__ ((packed)) S @{
6759 struct S8 s8;
6760 @};
6761 @end group
6762 @end smallexample
6763
6764 This warning is enabled by @option{-Wall}.
6765
6766 @item -Wpadded
6767 @opindex Wpadded
6768 @opindex Wno-padded
6769 Warn if padding is included in a structure, either to align an element
6770 of the structure or to align the whole structure. Sometimes when this
6771 happens it is possible to rearrange the fields of the structure to
6772 reduce the padding and so make the structure smaller.
6773
6774 @item -Wredundant-decls
6775 @opindex Wredundant-decls
6776 @opindex Wno-redundant-decls
6777 Warn if anything is declared more than once in the same scope, even in
6778 cases where multiple declaration is valid and changes nothing.
6779
6780 @item -Wno-restrict
6781 @opindex Wrestrict
6782 @opindex Wno-restrict
6783 Warn when an object referenced by a @code{restrict}-qualified parameter
6784 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
6785 argument, or when copies between such objects overlap. For example,
6786 the call to the @code{strcpy} function below attempts to truncate the string
6787 by replacing its initial characters with the last four. However, because
6788 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
6789 the call is diagnosed.
6790
6791 @smallexample
6792 struct foo
6793 @{
6794 char a[] = "abcd1234";
6795 strcpy (a, a + 4);
6796 @};
6797 @end smallexample
6798 The @option{-Wrestrict} is included in @option{-Wall}.
6799
6800 @item -Wnested-externs @r{(C and Objective-C only)}
6801 @opindex Wnested-externs
6802 @opindex Wno-nested-externs
6803 Warn if an @code{extern} declaration is encountered within a function.
6804
6805 @item -Wno-inherited-variadic-ctor
6806 @opindex Winherited-variadic-ctor
6807 @opindex Wno-inherited-variadic-ctor
6808 Suppress warnings about use of C++11 inheriting constructors when the
6809 base class inherited from has a C variadic constructor; the warning is
6810 on by default because the ellipsis is not inherited.
6811
6812 @item -Winline
6813 @opindex Winline
6814 @opindex Wno-inline
6815 Warn if a function that is declared as inline cannot be inlined.
6816 Even with this option, the compiler does not warn about failures to
6817 inline functions declared in system headers.
6818
6819 The compiler uses a variety of heuristics to determine whether or not
6820 to inline a function. For example, the compiler takes into account
6821 the size of the function being inlined and the amount of inlining
6822 that has already been done in the current function. Therefore,
6823 seemingly insignificant changes in the source program can cause the
6824 warnings produced by @option{-Winline} to appear or disappear.
6825
6826 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6827 @opindex Wno-invalid-offsetof
6828 @opindex Winvalid-offsetof
6829 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6830 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6831 to a non-standard-layout type is undefined. In existing C++ implementations,
6832 however, @code{offsetof} typically gives meaningful results.
6833 This flag is for users who are aware that they are
6834 writing nonportable code and who have deliberately chosen to ignore the
6835 warning about it.
6836
6837 The restrictions on @code{offsetof} may be relaxed in a future version
6838 of the C++ standard.
6839
6840 @item -Wint-in-bool-context
6841 @opindex Wint-in-bool-context
6842 @opindex Wno-int-in-bool-context
6843 Warn for suspicious use of integer values where boolean values are expected,
6844 such as conditional expressions (?:) using non-boolean integer constants in
6845 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
6846 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
6847 for all kinds of multiplications regardless of the data type.
6848 This warning is enabled by @option{-Wall}.
6849
6850 @item -Wno-int-to-pointer-cast
6851 @opindex Wno-int-to-pointer-cast
6852 @opindex Wint-to-pointer-cast
6853 Suppress warnings from casts to pointer type of an integer of a
6854 different size. In C++, casting to a pointer type of smaller size is
6855 an error. @option{Wint-to-pointer-cast} is enabled by default.
6856
6857
6858 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
6859 @opindex Wno-pointer-to-int-cast
6860 @opindex Wpointer-to-int-cast
6861 Suppress warnings from casts from a pointer to an integer type of a
6862 different size.
6863
6864 @item -Winvalid-pch
6865 @opindex Winvalid-pch
6866 @opindex Wno-invalid-pch
6867 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
6868 the search path but cannot be used.
6869
6870 @item -Wlong-long
6871 @opindex Wlong-long
6872 @opindex Wno-long-long
6873 Warn if @code{long long} type is used. This is enabled by either
6874 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
6875 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
6876
6877 @item -Wvariadic-macros
6878 @opindex Wvariadic-macros
6879 @opindex Wno-variadic-macros
6880 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6881 alternate syntax is used in ISO C99 mode. This is enabled by either
6882 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
6883 messages, use @option{-Wno-variadic-macros}.
6884
6885 @item -Wvarargs
6886 @opindex Wvarargs
6887 @opindex Wno-varargs
6888 Warn upon questionable usage of the macros used to handle variable
6889 arguments like @code{va_start}. This is default. To inhibit the
6890 warning messages, use @option{-Wno-varargs}.
6891
6892 @item -Wvector-operation-performance
6893 @opindex Wvector-operation-performance
6894 @opindex Wno-vector-operation-performance
6895 Warn if vector operation is not implemented via SIMD capabilities of the
6896 architecture. Mainly useful for the performance tuning.
6897 Vector operation can be implemented @code{piecewise}, which means that the
6898 scalar operation is performed on every vector element;
6899 @code{in parallel}, which means that the vector operation is implemented
6900 using scalars of wider type, which normally is more performance efficient;
6901 and @code{as a single scalar}, which means that vector fits into a
6902 scalar type.
6903
6904 @item -Wno-virtual-move-assign
6905 @opindex Wvirtual-move-assign
6906 @opindex Wno-virtual-move-assign
6907 Suppress warnings about inheriting from a virtual base with a
6908 non-trivial C++11 move assignment operator. This is dangerous because
6909 if the virtual base is reachable along more than one path, it is
6910 moved multiple times, which can mean both objects end up in the
6911 moved-from state. If the move assignment operator is written to avoid
6912 moving from a moved-from object, this warning can be disabled.
6913
6914 @item -Wvla
6915 @opindex Wvla
6916 @opindex Wno-vla
6917 Warn if a variable-length array is used in the code.
6918 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
6919 the variable-length array.
6920
6921 @item -Wvla-larger-than=@var{n}
6922 If this option is used, the compiler will warn on uses of
6923 variable-length arrays where the size is either unbounded, or bounded
6924 by an argument that can be larger than @var{n} bytes. This is similar
6925 to how @option{-Walloca-larger-than=@var{n}} works, but with
6926 variable-length arrays.
6927
6928 Note that GCC may optimize small variable-length arrays of a known
6929 value into plain arrays, so this warning may not get triggered for
6930 such arrays.
6931
6932 This warning is not enabled by @option{-Wall}, and is only active when
6933 @option{-ftree-vrp} is active (default for @option{-O2} and above).
6934
6935 See also @option{-Walloca-larger-than=@var{n}}.
6936
6937 @item -Wvolatile-register-var
6938 @opindex Wvolatile-register-var
6939 @opindex Wno-volatile-register-var
6940 Warn if a register variable is declared volatile. The volatile
6941 modifier does not inhibit all optimizations that may eliminate reads
6942 and/or writes to register variables. This warning is enabled by
6943 @option{-Wall}.
6944
6945 @item -Wdisabled-optimization
6946 @opindex Wdisabled-optimization
6947 @opindex Wno-disabled-optimization
6948 Warn if a requested optimization pass is disabled. This warning does
6949 not generally indicate that there is anything wrong with your code; it
6950 merely indicates that GCC's optimizers are unable to handle the code
6951 effectively. Often, the problem is that your code is too big or too
6952 complex; GCC refuses to optimize programs when the optimization
6953 itself is likely to take inordinate amounts of time.
6954
6955 @item -Wpointer-sign @r{(C and Objective-C only)}
6956 @opindex Wpointer-sign
6957 @opindex Wno-pointer-sign
6958 Warn for pointer argument passing or assignment with different signedness.
6959 This option is only supported for C and Objective-C@. It is implied by
6960 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
6961 @option{-Wno-pointer-sign}.
6962
6963 @item -Wstack-protector
6964 @opindex Wstack-protector
6965 @opindex Wno-stack-protector
6966 This option is only active when @option{-fstack-protector} is active. It
6967 warns about functions that are not protected against stack smashing.
6968
6969 @item -Woverlength-strings
6970 @opindex Woverlength-strings
6971 @opindex Wno-overlength-strings
6972 Warn about string constants that are longer than the ``minimum
6973 maximum'' length specified in the C standard. Modern compilers
6974 generally allow string constants that are much longer than the
6975 standard's minimum limit, but very portable programs should avoid
6976 using longer strings.
6977
6978 The limit applies @emph{after} string constant concatenation, and does
6979 not count the trailing NUL@. In C90, the limit was 509 characters; in
6980 C99, it was raised to 4095. C++98 does not specify a normative
6981 minimum maximum, so we do not diagnose overlength strings in C++@.
6982
6983 This option is implied by @option{-Wpedantic}, and can be disabled with
6984 @option{-Wno-overlength-strings}.
6985
6986 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
6987 @opindex Wunsuffixed-float-constants
6988
6989 Issue a warning for any floating constant that does not have
6990 a suffix. When used together with @option{-Wsystem-headers} it
6991 warns about such constants in system header files. This can be useful
6992 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
6993 from the decimal floating-point extension to C99.
6994
6995 @item -Wno-designated-init @r{(C and Objective-C only)}
6996 Suppress warnings when a positional initializer is used to initialize
6997 a structure that has been marked with the @code{designated_init}
6998 attribute.
6999
7000 @item -Whsa
7001 Issue a warning when HSAIL cannot be emitted for the compiled function or
7002 OpenMP construct.
7003
7004 @end table
7005
7006 @node Debugging Options
7007 @section Options for Debugging Your Program
7008 @cindex options, debugging
7009 @cindex debugging information options
7010
7011 To tell GCC to emit extra information for use by a debugger, in almost
7012 all cases you need only to add @option{-g} to your other options.
7013
7014 GCC allows you to use @option{-g} with
7015 @option{-O}. The shortcuts taken by optimized code may occasionally
7016 be surprising: some variables you declared may not exist
7017 at all; flow of control may briefly move where you did not expect it;
7018 some statements may not be executed because they compute constant
7019 results or their values are already at hand; some statements may
7020 execute in different places because they have been moved out of loops.
7021 Nevertheless it is possible to debug optimized output. This makes
7022 it reasonable to use the optimizer for programs that might have bugs.
7023
7024 If you are not using some other optimization option, consider
7025 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7026 With no @option{-O} option at all, some compiler passes that collect
7027 information useful for debugging do not run at all, so that
7028 @option{-Og} may result in a better debugging experience.
7029
7030 @table @gcctabopt
7031 @item -g
7032 @opindex g
7033 Produce debugging information in the operating system's native format
7034 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7035 information.
7036
7037 On most systems that use stabs format, @option{-g} enables use of extra
7038 debugging information that only GDB can use; this extra information
7039 makes debugging work better in GDB but probably makes other debuggers
7040 crash or
7041 refuse to read the program. If you want to control for certain whether
7042 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7043 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7044
7045 @item -ggdb
7046 @opindex ggdb
7047 Produce debugging information for use by GDB@. This means to use the
7048 most expressive format available (DWARF, stabs, or the native format
7049 if neither of those are supported), including GDB extensions if at all
7050 possible.
7051
7052 @item -gdwarf
7053 @itemx -gdwarf-@var{version}
7054 @opindex gdwarf
7055 Produce debugging information in DWARF format (if that is supported).
7056 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7057 for most targets is 4. DWARF Version 5 is only experimental.
7058
7059 Note that with DWARF Version 2, some ports require and always
7060 use some non-conflicting DWARF 3 extensions in the unwind tables.
7061
7062 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7063 for maximum benefit.
7064
7065 GCC no longer supports DWARF Version 1, which is substantially
7066 different than Version 2 and later. For historical reasons, some
7067 other DWARF-related options such as
7068 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7069 in their names, but apply to all currently-supported versions of DWARF.
7070
7071 @item -gstabs
7072 @opindex gstabs
7073 Produce debugging information in stabs format (if that is supported),
7074 without GDB extensions. This is the format used by DBX on most BSD
7075 systems. On MIPS, Alpha and System V Release 4 systems this option
7076 produces stabs debugging output that is not understood by DBX@.
7077 On System V Release 4 systems this option requires the GNU assembler.
7078
7079 @item -gstabs+
7080 @opindex gstabs+
7081 Produce debugging information in stabs format (if that is supported),
7082 using GNU extensions understood only by the GNU debugger (GDB)@. The
7083 use of these extensions is likely to make other debuggers crash or
7084 refuse to read the program.
7085
7086 @item -gxcoff
7087 @opindex gxcoff
7088 Produce debugging information in XCOFF format (if that is supported).
7089 This is the format used by the DBX debugger on IBM RS/6000 systems.
7090
7091 @item -gxcoff+
7092 @opindex gxcoff+
7093 Produce debugging information in XCOFF format (if that is supported),
7094 using GNU extensions understood only by the GNU debugger (GDB)@. The
7095 use of these extensions is likely to make other debuggers crash or
7096 refuse to read the program, and may cause assemblers other than the GNU
7097 assembler (GAS) to fail with an error.
7098
7099 @item -gvms
7100 @opindex gvms
7101 Produce debugging information in Alpha/VMS debug format (if that is
7102 supported). This is the format used by DEBUG on Alpha/VMS systems.
7103
7104 @item -g@var{level}
7105 @itemx -ggdb@var{level}
7106 @itemx -gstabs@var{level}
7107 @itemx -gxcoff@var{level}
7108 @itemx -gvms@var{level}
7109 Request debugging information and also use @var{level} to specify how
7110 much information. The default level is 2.
7111
7112 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7113 @option{-g}.
7114
7115 Level 1 produces minimal information, enough for making backtraces in
7116 parts of the program that you don't plan to debug. This includes
7117 descriptions of functions and external variables, and line number
7118 tables, but no information about local variables.
7119
7120 Level 3 includes extra information, such as all the macro definitions
7121 present in the program. Some debuggers support macro expansion when
7122 you use @option{-g3}.
7123
7124 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7125 confusion with @option{-gdwarf-@var{level}}.
7126 Instead use an additional @option{-g@var{level}} option to change the
7127 debug level for DWARF.
7128
7129 @item -feliminate-unused-debug-symbols
7130 @opindex feliminate-unused-debug-symbols
7131 Produce debugging information in stabs format (if that is supported),
7132 for only symbols that are actually used.
7133
7134 @item -femit-class-debug-always
7135 @opindex femit-class-debug-always
7136 Instead of emitting debugging information for a C++ class in only one
7137 object file, emit it in all object files using the class. This option
7138 should be used only with debuggers that are unable to handle the way GCC
7139 normally emits debugging information for classes because using this
7140 option increases the size of debugging information by as much as a
7141 factor of two.
7142
7143 @item -fno-merge-debug-strings
7144 @opindex fmerge-debug-strings
7145 @opindex fno-merge-debug-strings
7146 Direct the linker to not merge together strings in the debugging
7147 information that are identical in different object files. Merging is
7148 not supported by all assemblers or linkers. Merging decreases the size
7149 of the debug information in the output file at the cost of increasing
7150 link processing time. Merging is enabled by default.
7151
7152 @item -fdebug-prefix-map=@var{old}=@var{new}
7153 @opindex fdebug-prefix-map
7154 When compiling files residing in directory @file{@var{old}}, record
7155 debugging information describing them as if the files resided in
7156 directory @file{@var{new}} instead. This can be used to replace a
7157 build-time path with an install-time path in the debug info. It can
7158 also be used to change an absolute path to a relative path by using
7159 @file{.} for @var{new}. This can give more reproducible builds, which
7160 are location independent, but may require an extra command to tell GDB
7161 where to find the source files. See also @option{-ffile-prefix-map}.
7162
7163 @item -fvar-tracking
7164 @opindex fvar-tracking
7165 Run variable tracking pass. It computes where variables are stored at each
7166 position in code. Better debugging information is then generated
7167 (if the debugging information format supports this information).
7168
7169 It is enabled by default when compiling with optimization (@option{-Os},
7170 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7171 the debug info format supports it.
7172
7173 @item -fvar-tracking-assignments
7174 @opindex fvar-tracking-assignments
7175 @opindex fno-var-tracking-assignments
7176 Annotate assignments to user variables early in the compilation and
7177 attempt to carry the annotations over throughout the compilation all the
7178 way to the end, in an attempt to improve debug information while
7179 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7180
7181 It can be enabled even if var-tracking is disabled, in which case
7182 annotations are created and maintained, but discarded at the end.
7183 By default, this flag is enabled together with @option{-fvar-tracking},
7184 except when selective scheduling is enabled.
7185
7186 @item -gsplit-dwarf
7187 @opindex gsplit-dwarf
7188 Separate as much DWARF debugging information as possible into a
7189 separate output file with the extension @file{.dwo}. This option allows
7190 the build system to avoid linking files with debug information. To
7191 be useful, this option requires a debugger capable of reading @file{.dwo}
7192 files.
7193
7194 @item -gpubnames
7195 @opindex gpubnames
7196 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7197
7198 @item -ggnu-pubnames
7199 @opindex ggnu-pubnames
7200 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7201 suitable for conversion into a GDB@ index. This option is only useful
7202 with a linker that can produce GDB@ index version 7.
7203
7204 @item -fdebug-types-section
7205 @opindex fdebug-types-section
7206 @opindex fno-debug-types-section
7207 When using DWARF Version 4 or higher, type DIEs can be put into
7208 their own @code{.debug_types} section instead of making them part of the
7209 @code{.debug_info} section. It is more efficient to put them in a separate
7210 comdat sections since the linker can then remove duplicates.
7211 But not all DWARF consumers support @code{.debug_types} sections yet
7212 and on some objects @code{.debug_types} produces larger instead of smaller
7213 debugging information.
7214
7215 @item -grecord-gcc-switches
7216 @item -gno-record-gcc-switches
7217 @opindex grecord-gcc-switches
7218 @opindex gno-record-gcc-switches
7219 This switch causes the command-line options used to invoke the
7220 compiler that may affect code generation to be appended to the
7221 DW_AT_producer attribute in DWARF debugging information. The options
7222 are concatenated with spaces separating them from each other and from
7223 the compiler version.
7224 It is enabled by default.
7225 See also @option{-frecord-gcc-switches} for another
7226 way of storing compiler options into the object file.
7227
7228 @item -gstrict-dwarf
7229 @opindex gstrict-dwarf
7230 Disallow using extensions of later DWARF standard version than selected
7231 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7232 DWARF extensions from later standard versions is allowed.
7233
7234 @item -gno-strict-dwarf
7235 @opindex gno-strict-dwarf
7236 Allow using extensions of later DWARF standard version than selected with
7237 @option{-gdwarf-@var{version}}.
7238
7239 @item -gcolumn-info
7240 @item -gno-column-info
7241 @opindex gcolumn-info
7242 @opindex gno-column-info
7243 Emit location column information into DWARF debugging information, rather
7244 than just file and line.
7245 This option is enabled by default.
7246
7247 @item -gstatement-frontiers
7248 @item -gno-statement-frontiers
7249 @opindex gstatement-frontiers
7250 @opindex gno-statement-frontiers
7251 This option causes GCC to create markers in the internal representation
7252 at the beginning of statements, and to keep them roughly in place
7253 throughout compilation, using them to guide the output of @code{is_stmt}
7254 markers in the line number table. This is enabled by default when
7255 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7256 @dots{}), and outputting DWARF 2 debug information at the normal level.
7257
7258 @item -gz@r{[}=@var{type}@r{]}
7259 @opindex gz
7260 Produce compressed debug sections in DWARF format, if that is supported.
7261 If @var{type} is not given, the default type depends on the capabilities
7262 of the assembler and linker used. @var{type} may be one of
7263 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7264 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7265 compression in traditional GNU format). If the linker doesn't support
7266 writing compressed debug sections, the option is rejected. Otherwise,
7267 if the assembler does not support them, @option{-gz} is silently ignored
7268 when producing object files.
7269
7270 @item -femit-struct-debug-baseonly
7271 @opindex femit-struct-debug-baseonly
7272 Emit debug information for struct-like types
7273 only when the base name of the compilation source file
7274 matches the base name of file in which the struct is defined.
7275
7276 This option substantially reduces the size of debugging information,
7277 but at significant potential loss in type information to the debugger.
7278 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7279 See @option{-femit-struct-debug-detailed} for more detailed control.
7280
7281 This option works only with DWARF debug output.
7282
7283 @item -femit-struct-debug-reduced
7284 @opindex femit-struct-debug-reduced
7285 Emit debug information for struct-like types
7286 only when the base name of the compilation source file
7287 matches the base name of file in which the type is defined,
7288 unless the struct is a template or defined in a system header.
7289
7290 This option significantly reduces the size of debugging information,
7291 with some potential loss in type information to the debugger.
7292 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7293 See @option{-femit-struct-debug-detailed} for more detailed control.
7294
7295 This option works only with DWARF debug output.
7296
7297 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7298 @opindex femit-struct-debug-detailed
7299 Specify the struct-like types
7300 for which the compiler generates debug information.
7301 The intent is to reduce duplicate struct debug information
7302 between different object files within the same program.
7303
7304 This option is a detailed version of
7305 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
7306 which serves for most needs.
7307
7308 A specification has the syntax@*
7309 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
7310
7311 The optional first word limits the specification to
7312 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
7313 A struct type is used directly when it is the type of a variable, member.
7314 Indirect uses arise through pointers to structs.
7315 That is, when use of an incomplete struct is valid, the use is indirect.
7316 An example is
7317 @samp{struct one direct; struct two * indirect;}.
7318
7319 The optional second word limits the specification to
7320 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
7321 Generic structs are a bit complicated to explain.
7322 For C++, these are non-explicit specializations of template classes,
7323 or non-template classes within the above.
7324 Other programming languages have generics,
7325 but @option{-femit-struct-debug-detailed} does not yet implement them.
7326
7327 The third word specifies the source files for those
7328 structs for which the compiler should emit debug information.
7329 The values @samp{none} and @samp{any} have the normal meaning.
7330 The value @samp{base} means that
7331 the base of name of the file in which the type declaration appears
7332 must match the base of the name of the main compilation file.
7333 In practice, this means that when compiling @file{foo.c}, debug information
7334 is generated for types declared in that file and @file{foo.h},
7335 but not other header files.
7336 The value @samp{sys} means those types satisfying @samp{base}
7337 or declared in system or compiler headers.
7338
7339 You may need to experiment to determine the best settings for your application.
7340
7341 The default is @option{-femit-struct-debug-detailed=all}.
7342
7343 This option works only with DWARF debug output.
7344
7345 @item -fno-dwarf2-cfi-asm
7346 @opindex fdwarf2-cfi-asm
7347 @opindex fno-dwarf2-cfi-asm
7348 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
7349 instead of using GAS @code{.cfi_*} directives.
7350
7351 @item -fno-eliminate-unused-debug-types
7352 @opindex feliminate-unused-debug-types
7353 @opindex fno-eliminate-unused-debug-types
7354 Normally, when producing DWARF output, GCC avoids producing debug symbol
7355 output for types that are nowhere used in the source file being compiled.
7356 Sometimes it is useful to have GCC emit debugging
7357 information for all types declared in a compilation
7358 unit, regardless of whether or not they are actually used
7359 in that compilation unit, for example
7360 if, in the debugger, you want to cast a value to a type that is
7361 not actually used in your program (but is declared). More often,
7362 however, this results in a significant amount of wasted space.
7363 @end table
7364
7365 @node Optimize Options
7366 @section Options That Control Optimization
7367 @cindex optimize options
7368 @cindex options, optimization
7369
7370 These options control various sorts of optimizations.
7371
7372 Without any optimization option, the compiler's goal is to reduce the
7373 cost of compilation and to make debugging produce the expected
7374 results. Statements are independent: if you stop the program with a
7375 breakpoint between statements, you can then assign a new value to any
7376 variable or change the program counter to any other statement in the
7377 function and get exactly the results you expect from the source
7378 code.
7379
7380 Turning on optimization flags makes the compiler attempt to improve
7381 the performance and/or code size at the expense of compilation time
7382 and possibly the ability to debug the program.
7383
7384 The compiler performs optimization based on the knowledge it has of the
7385 program. Compiling multiple files at once to a single output file mode allows
7386 the compiler to use information gained from all of the files when compiling
7387 each of them.
7388
7389 Not all optimizations are controlled directly by a flag. Only
7390 optimizations that have a flag are listed in this section.
7391
7392 Most optimizations are only enabled if an @option{-O} level is set on
7393 the command line. Otherwise they are disabled, even if individual
7394 optimization flags are specified.
7395
7396 Depending on the target and how GCC was configured, a slightly different
7397 set of optimizations may be enabled at each @option{-O} level than
7398 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7399 to find out the exact set of optimizations that are enabled at each level.
7400 @xref{Overall Options}, for examples.
7401
7402 @table @gcctabopt
7403 @item -O
7404 @itemx -O1
7405 @opindex O
7406 @opindex O1
7407 Optimize. Optimizing compilation takes somewhat more time, and a lot
7408 more memory for a large function.
7409
7410 With @option{-O}, the compiler tries to reduce code size and execution
7411 time, without performing any optimizations that take a great deal of
7412 compilation time.
7413
7414 @option{-O} turns on the following optimization flags:
7415 @gccoptlist{
7416 -fauto-inc-dec @gol
7417 -fbranch-count-reg @gol
7418 -fcombine-stack-adjustments @gol
7419 -fcompare-elim @gol
7420 -fcprop-registers @gol
7421 -fdce @gol
7422 -fdefer-pop @gol
7423 -fdelayed-branch @gol
7424 -fdse @gol
7425 -fforward-propagate @gol
7426 -fguess-branch-probability @gol
7427 -fif-conversion2 @gol
7428 -fif-conversion @gol
7429 -finline-functions-called-once @gol
7430 -fipa-pure-const @gol
7431 -fipa-profile @gol
7432 -fipa-reference @gol
7433 -fmerge-constants @gol
7434 -fmove-loop-invariants @gol
7435 -fomit-frame-pointer @gol
7436 -freorder-blocks @gol
7437 -fshrink-wrap @gol
7438 -fshrink-wrap-separate @gol
7439 -fsplit-wide-types @gol
7440 -fssa-backprop @gol
7441 -fssa-phiopt @gol
7442 -ftree-bit-ccp @gol
7443 -ftree-ccp @gol
7444 -ftree-ch @gol
7445 -ftree-coalesce-vars @gol
7446 -ftree-copy-prop @gol
7447 -ftree-dce @gol
7448 -ftree-dominator-opts @gol
7449 -ftree-dse @gol
7450 -ftree-forwprop @gol
7451 -ftree-fre @gol
7452 -ftree-phiprop @gol
7453 -ftree-sink @gol
7454 -ftree-slsr @gol
7455 -ftree-sra @gol
7456 -ftree-pta @gol
7457 -ftree-ter @gol
7458 -funit-at-a-time}
7459
7460 @item -O2
7461 @opindex O2
7462 Optimize even more. GCC performs nearly all supported optimizations
7463 that do not involve a space-speed tradeoff.
7464 As compared to @option{-O}, this option increases both compilation time
7465 and the performance of the generated code.
7466
7467 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7468 also turns on the following optimization flags:
7469 @gccoptlist{-fthread-jumps @gol
7470 -falign-functions -falign-jumps @gol
7471 -falign-loops -falign-labels @gol
7472 -fcaller-saves @gol
7473 -fcrossjumping @gol
7474 -fcse-follow-jumps -fcse-skip-blocks @gol
7475 -fdelete-null-pointer-checks @gol
7476 -fdevirtualize -fdevirtualize-speculatively @gol
7477 -fexpensive-optimizations @gol
7478 -fgcse -fgcse-lm @gol
7479 -fhoist-adjacent-loads @gol
7480 -finline-small-functions @gol
7481 -findirect-inlining @gol
7482 -fipa-cp @gol
7483 -fipa-bit-cp @gol
7484 -fipa-vrp @gol
7485 -fipa-sra @gol
7486 -fipa-icf @gol
7487 -fisolate-erroneous-paths-dereference @gol
7488 -flra-remat @gol
7489 -foptimize-sibling-calls @gol
7490 -foptimize-strlen @gol
7491 -fpartial-inlining @gol
7492 -fpeephole2 @gol
7493 -freorder-blocks-algorithm=stc @gol
7494 -freorder-blocks-and-partition -freorder-functions @gol
7495 -frerun-cse-after-loop @gol
7496 -fsched-interblock -fsched-spec @gol
7497 -fschedule-insns -fschedule-insns2 @gol
7498 -fstore-merging @gol
7499 -fstrict-aliasing @gol
7500 -ftree-builtin-call-dce @gol
7501 -ftree-switch-conversion -ftree-tail-merge @gol
7502 -fcode-hoisting @gol
7503 -ftree-pre @gol
7504 -ftree-vrp @gol
7505 -fipa-ra}
7506
7507 Please note the warning under @option{-fgcse} about
7508 invoking @option{-O2} on programs that use computed gotos.
7509
7510 @item -O3
7511 @opindex O3
7512 Optimize yet more. @option{-O3} turns on all optimizations specified
7513 by @option{-O2} and also turns on the following optimization flags:
7514 @gccoptlist{-finline-functions @gol
7515 -funswitch-loops @gol
7516 -fpredictive-commoning @gol
7517 -fgcse-after-reload @gol
7518 -ftree-loop-vectorize @gol
7519 -ftree-loop-distribution @gol
7520 -ftree-loop-distribute-patterns @gol
7521 -floop-interchange @gol
7522 -fsplit-paths @gol
7523 -ftree-slp-vectorize @gol
7524 -fvect-cost-model @gol
7525 -ftree-partial-pre @gol
7526 -fpeel-loops @gol
7527 -fipa-cp-clone}
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-algorithm=stc @gol
7543 -freorder-blocks-and-partition -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{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
7552 specified, and @option{-fno-protect-parens}.
7553
7554 @item -Og
7555 @opindex Og
7556 Optimize debugging experience. @option{-Og} enables optimizations
7557 that do not interfere with debugging. It should be the optimization
7558 level of choice for the standard edit-compile-debug cycle, offering
7559 a reasonable level of optimization while maintaining fast compilation
7560 and a good debugging experience.
7561 @end table
7562
7563 If you use multiple @option{-O} options, with or without level numbers,
7564 the last such option is the one that is effective.
7565
7566 Options of the form @option{-f@var{flag}} specify machine-independent
7567 flags. Most flags have both positive and negative forms; the negative
7568 form of @option{-ffoo} is @option{-fno-foo}. In the table
7569 below, only one of the forms is listed---the one you typically
7570 use. You can figure out the other form by either removing @samp{no-}
7571 or adding it.
7572
7573 The following options control specific optimizations. They are either
7574 activated by @option{-O} options or are related to ones that are. You
7575 can use the following flags in the rare cases when ``fine-tuning'' of
7576 optimizations to be performed is desired.
7577
7578 @table @gcctabopt
7579 @item -fno-defer-pop
7580 @opindex fno-defer-pop
7581 Always pop the arguments to each function call as soon as that function
7582 returns. For machines that must pop arguments after a function call,
7583 the compiler normally lets arguments accumulate on the stack for several
7584 function calls and pops them all at once.
7585
7586 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7587
7588 @item -fforward-propagate
7589 @opindex fforward-propagate
7590 Perform a forward propagation pass on RTL@. The pass tries to combine two
7591 instructions and checks if the result can be simplified. If loop unrolling
7592 is active, two passes are performed and the second is scheduled after
7593 loop unrolling.
7594
7595 This option is enabled by default at optimization levels @option{-O},
7596 @option{-O2}, @option{-O3}, @option{-Os}.
7597
7598 @item -ffp-contract=@var{style}
7599 @opindex ffp-contract
7600 @option{-ffp-contract=off} disables floating-point expression contraction.
7601 @option{-ffp-contract=fast} enables floating-point expression contraction
7602 such as forming of fused multiply-add operations if the target has
7603 native support for them.
7604 @option{-ffp-contract=on} enables floating-point expression contraction
7605 if allowed by the language standard. This is currently not implemented
7606 and treated equal to @option{-ffp-contract=off}.
7607
7608 The default is @option{-ffp-contract=fast}.
7609
7610 @item -fomit-frame-pointer
7611 @opindex fomit-frame-pointer
7612 Omit the frame pointer in functions that don't need one. This avoids the
7613 instructions to save, set up and restore the frame pointer; on many targets
7614 it also makes an extra register available.
7615
7616 On some targets this flag has no effect because the standard calling sequence
7617 always uses a frame pointer, so it cannot be omitted.
7618
7619 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
7620 is used in all functions. Several targets always omit the frame pointer in
7621 leaf functions.
7622
7623 Enabled by default at @option{-O} and higher.
7624
7625 @item -foptimize-sibling-calls
7626 @opindex foptimize-sibling-calls
7627 Optimize sibling and tail recursive calls.
7628
7629 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7630
7631 @item -foptimize-strlen
7632 @opindex foptimize-strlen
7633 Optimize various standard C string functions (e.g. @code{strlen},
7634 @code{strchr} or @code{strcpy}) and
7635 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7636
7637 Enabled at levels @option{-O2}, @option{-O3}.
7638
7639 @item -fno-inline
7640 @opindex fno-inline
7641 Do not expand any functions inline apart from those marked with
7642 the @code{always_inline} attribute. This is the default when not
7643 optimizing.
7644
7645 Single functions can be exempted from inlining by marking them
7646 with the @code{noinline} attribute.
7647
7648 @item -finline-small-functions
7649 @opindex finline-small-functions
7650 Integrate functions into their callers when their body is smaller than expected
7651 function call code (so overall size of program gets smaller). The compiler
7652 heuristically decides which functions are simple enough to be worth integrating
7653 in this way. This inlining applies to all functions, even those not declared
7654 inline.
7655
7656 Enabled at level @option{-O2}.
7657
7658 @item -findirect-inlining
7659 @opindex findirect-inlining
7660 Inline also indirect calls that are discovered to be known at compile
7661 time thanks to previous inlining. This option has any effect only
7662 when inlining itself is turned on by the @option{-finline-functions}
7663 or @option{-finline-small-functions} options.
7664
7665 Enabled at level @option{-O2}.
7666
7667 @item -finline-functions
7668 @opindex finline-functions
7669 Consider all functions for inlining, even if they are not declared inline.
7670 The compiler heuristically decides which functions are worth integrating
7671 in this way.
7672
7673 If all calls to a given function are integrated, and the function is
7674 declared @code{static}, then the function is normally not output as
7675 assembler code in its own right.
7676
7677 Enabled at level @option{-O3}.
7678
7679 @item -finline-functions-called-once
7680 @opindex finline-functions-called-once
7681 Consider all @code{static} functions called once for inlining into their
7682 caller even if they are not marked @code{inline}. If a call to a given
7683 function is integrated, then the function is not output as assembler code
7684 in its own right.
7685
7686 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7687
7688 @item -fearly-inlining
7689 @opindex fearly-inlining
7690 Inline functions marked by @code{always_inline} and functions whose body seems
7691 smaller than the function call overhead early before doing
7692 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7693 makes profiling significantly cheaper and usually inlining faster on programs
7694 having large chains of nested wrapper functions.
7695
7696 Enabled by default.
7697
7698 @item -fipa-sra
7699 @opindex fipa-sra
7700 Perform interprocedural scalar replacement of aggregates, removal of
7701 unused parameters and replacement of parameters passed by reference
7702 by parameters passed by value.
7703
7704 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7705
7706 @item -finline-limit=@var{n}
7707 @opindex finline-limit
7708 By default, GCC limits the size of functions that can be inlined. This flag
7709 allows coarse control of this limit. @var{n} is the size of functions that
7710 can be inlined in number of pseudo instructions.
7711
7712 Inlining is actually controlled by a number of parameters, which may be
7713 specified individually by using @option{--param @var{name}=@var{value}}.
7714 The @option{-finline-limit=@var{n}} option sets some of these parameters
7715 as follows:
7716
7717 @table @gcctabopt
7718 @item max-inline-insns-single
7719 is set to @var{n}/2.
7720 @item max-inline-insns-auto
7721 is set to @var{n}/2.
7722 @end table
7723
7724 See below for a documentation of the individual
7725 parameters controlling inlining and for the defaults of these parameters.
7726
7727 @emph{Note:} there may be no value to @option{-finline-limit} that results
7728 in default behavior.
7729
7730 @emph{Note:} pseudo instruction represents, in this particular context, an
7731 abstract measurement of function's size. In no way does it represent a count
7732 of assembly instructions and as such its exact meaning might change from one
7733 release to an another.
7734
7735 @item -fno-keep-inline-dllexport
7736 @opindex fno-keep-inline-dllexport
7737 This is a more fine-grained version of @option{-fkeep-inline-functions},
7738 which applies only to functions that are declared using the @code{dllexport}
7739 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
7740 Functions}.
7741
7742 @item -fkeep-inline-functions
7743 @opindex fkeep-inline-functions
7744 In C, emit @code{static} functions that are declared @code{inline}
7745 into the object file, even if the function has been inlined into all
7746 of its callers. This switch does not affect functions using the
7747 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7748 inline functions into the object file.
7749
7750 @item -fkeep-static-functions
7751 @opindex fkeep-static-functions
7752 Emit @code{static} functions into the object file, even if the function
7753 is never used.
7754
7755 @item -fkeep-static-consts
7756 @opindex fkeep-static-consts
7757 Emit variables declared @code{static const} when optimization isn't turned
7758 on, even if the variables aren't referenced.
7759
7760 GCC enables this option by default. If you want to force the compiler to
7761 check if a variable is referenced, regardless of whether or not
7762 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7763
7764 @item -fmerge-constants
7765 @opindex fmerge-constants
7766 Attempt to merge identical constants (string constants and floating-point
7767 constants) across compilation units.
7768
7769 This option is the default for optimized compilation if the assembler and
7770 linker support it. Use @option{-fno-merge-constants} to inhibit this
7771 behavior.
7772
7773 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7774
7775 @item -fmerge-all-constants
7776 @opindex fmerge-all-constants
7777 Attempt to merge identical constants and identical variables.
7778
7779 This option implies @option{-fmerge-constants}. In addition to
7780 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7781 arrays or initialized constant variables with integral or floating-point
7782 types. Languages like C or C++ require each variable, including multiple
7783 instances of the same variable in recursive calls, to have distinct locations,
7784 so using this option results in non-conforming
7785 behavior.
7786
7787 @item -fmodulo-sched
7788 @opindex fmodulo-sched
7789 Perform swing modulo scheduling immediately before the first scheduling
7790 pass. This pass looks at innermost loops and reorders their
7791 instructions by overlapping different iterations.
7792
7793 @item -fmodulo-sched-allow-regmoves
7794 @opindex fmodulo-sched-allow-regmoves
7795 Perform more aggressive SMS-based modulo scheduling with register moves
7796 allowed. By setting this flag certain anti-dependences edges are
7797 deleted, which triggers the generation of reg-moves based on the
7798 life-range analysis. This option is effective only with
7799 @option{-fmodulo-sched} enabled.
7800
7801 @item -fno-branch-count-reg
7802 @opindex fno-branch-count-reg
7803 Avoid running a pass scanning for opportunities to use ``decrement and
7804 branch'' instructions on a count register instead of generating sequences
7805 of instructions that decrement a register, compare it against zero, and
7806 then branch based upon the result. This option is only meaningful on
7807 architectures that support such instructions, which include x86, PowerPC,
7808 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
7809 doesn't remove the decrement and branch instructions from the generated
7810 instruction stream introduced by other optimization passes.
7811
7812 Enabled by default at @option{-O1} and higher.
7813
7814 The default is @option{-fbranch-count-reg}.
7815
7816 @item -fno-function-cse
7817 @opindex fno-function-cse
7818 Do not put function addresses in registers; make each instruction that
7819 calls a constant function contain the function's address explicitly.
7820
7821 This option results in less efficient code, but some strange hacks
7822 that alter the assembler output may be confused by the optimizations
7823 performed when this option is not used.
7824
7825 The default is @option{-ffunction-cse}
7826
7827 @item -fno-zero-initialized-in-bss
7828 @opindex fno-zero-initialized-in-bss
7829 If the target supports a BSS section, GCC by default puts variables that
7830 are initialized to zero into BSS@. This can save space in the resulting
7831 code.
7832
7833 This option turns off this behavior because some programs explicitly
7834 rely on variables going to the data section---e.g., so that the
7835 resulting executable can find the beginning of that section and/or make
7836 assumptions based on that.
7837
7838 The default is @option{-fzero-initialized-in-bss}.
7839
7840 @item -fthread-jumps
7841 @opindex fthread-jumps
7842 Perform optimizations that check to see if a jump branches to a
7843 location where another comparison subsumed by the first is found. If
7844 so, the first branch is redirected to either the destination of the
7845 second branch or a point immediately following it, depending on whether
7846 the condition is known to be true or false.
7847
7848 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7849
7850 @item -fsplit-wide-types
7851 @opindex fsplit-wide-types
7852 When using a type that occupies multiple registers, such as @code{long
7853 long} on a 32-bit system, split the registers apart and allocate them
7854 independently. This normally generates better code for those types,
7855 but may make debugging more difficult.
7856
7857 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7858 @option{-Os}.
7859
7860 @item -fcse-follow-jumps
7861 @opindex fcse-follow-jumps
7862 In common subexpression elimination (CSE), scan through jump instructions
7863 when the target of the jump is not reached by any other path. For
7864 example, when CSE encounters an @code{if} statement with an
7865 @code{else} clause, CSE follows the jump when the condition
7866 tested is false.
7867
7868 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7869
7870 @item -fcse-skip-blocks
7871 @opindex fcse-skip-blocks
7872 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7873 follow jumps that conditionally skip over blocks. When CSE
7874 encounters a simple @code{if} statement with no else clause,
7875 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7876 body of the @code{if}.
7877
7878 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7879
7880 @item -frerun-cse-after-loop
7881 @opindex frerun-cse-after-loop
7882 Re-run common subexpression elimination after loop optimizations are
7883 performed.
7884
7885 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7886
7887 @item -fgcse
7888 @opindex fgcse
7889 Perform a global common subexpression elimination pass.
7890 This pass also performs global constant and copy propagation.
7891
7892 @emph{Note:} When compiling a program using computed gotos, a GCC
7893 extension, you may get better run-time performance if you disable
7894 the global common subexpression elimination pass by adding
7895 @option{-fno-gcse} to the command line.
7896
7897 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7898
7899 @item -fgcse-lm
7900 @opindex fgcse-lm
7901 When @option{-fgcse-lm} is enabled, global common subexpression elimination
7902 attempts to move loads that are only killed by stores into themselves. This
7903 allows a loop containing a load/store sequence to be changed to a load outside
7904 the loop, and a copy/store within the loop.
7905
7906 Enabled by default when @option{-fgcse} is enabled.
7907
7908 @item -fgcse-sm
7909 @opindex fgcse-sm
7910 When @option{-fgcse-sm} is enabled, a store motion pass is run after
7911 global common subexpression elimination. This pass attempts to move
7912 stores out of loops. When used in conjunction with @option{-fgcse-lm},
7913 loops containing a load/store sequence can be changed to a load before
7914 the loop and a store after the loop.
7915
7916 Not enabled at any optimization level.
7917
7918 @item -fgcse-las
7919 @opindex fgcse-las
7920 When @option{-fgcse-las} is enabled, the global common subexpression
7921 elimination pass eliminates redundant loads that come after stores to the
7922 same memory location (both partial and full redundancies).
7923
7924 Not enabled at any optimization level.
7925
7926 @item -fgcse-after-reload
7927 @opindex fgcse-after-reload
7928 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7929 pass is performed after reload. The purpose of this pass is to clean up
7930 redundant spilling.
7931
7932 @item -faggressive-loop-optimizations
7933 @opindex faggressive-loop-optimizations
7934 This option tells the loop optimizer to use language constraints to
7935 derive bounds for the number of iterations of a loop. This assumes that
7936 loop code does not invoke undefined behavior by for example causing signed
7937 integer overflows or out-of-bound array accesses. The bounds for the
7938 number of iterations of a loop are used to guide loop unrolling and peeling
7939 and loop exit test optimizations.
7940 This option is enabled by default.
7941
7942 @item -funconstrained-commons
7943 @opindex funconstrained-commons
7944 This option tells the compiler that variables declared in common blocks
7945 (e.g. Fortran) may later be overridden with longer trailing arrays. This
7946 prevents certain optimizations that depend on knowing the array bounds.
7947
7948 @item -fcrossjumping
7949 @opindex fcrossjumping
7950 Perform cross-jumping transformation.
7951 This transformation unifies equivalent code and saves code size. The
7952 resulting code may or may not perform better than without cross-jumping.
7953
7954 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7955
7956 @item -fauto-inc-dec
7957 @opindex fauto-inc-dec
7958 Combine increments or decrements of addresses with memory accesses.
7959 This pass is always skipped on architectures that do not have
7960 instructions to support this. Enabled by default at @option{-O} and
7961 higher on architectures that support this.
7962
7963 @item -fdce
7964 @opindex fdce
7965 Perform dead code elimination (DCE) on RTL@.
7966 Enabled by default at @option{-O} and higher.
7967
7968 @item -fdse
7969 @opindex fdse
7970 Perform dead store elimination (DSE) on RTL@.
7971 Enabled by default at @option{-O} and higher.
7972
7973 @item -fif-conversion
7974 @opindex fif-conversion
7975 Attempt to transform conditional jumps into branch-less equivalents. This
7976 includes use of conditional moves, min, max, set flags and abs instructions, and
7977 some tricks doable by standard arithmetics. The use of conditional execution
7978 on chips where it is available is controlled by @option{-fif-conversion2}.
7979
7980 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7981
7982 @item -fif-conversion2
7983 @opindex fif-conversion2
7984 Use conditional execution (where available) to transform conditional jumps into
7985 branch-less equivalents.
7986
7987 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7988
7989 @item -fdeclone-ctor-dtor
7990 @opindex fdeclone-ctor-dtor
7991 The C++ ABI requires multiple entry points for constructors and
7992 destructors: one for a base subobject, one for a complete object, and
7993 one for a virtual destructor that calls operator delete afterwards.
7994 For a hierarchy with virtual bases, the base and complete variants are
7995 clones, which means two copies of the function. With this option, the
7996 base and complete variants are changed to be thunks that call a common
7997 implementation.
7998
7999 Enabled by @option{-Os}.
8000
8001 @item -fdelete-null-pointer-checks
8002 @opindex fdelete-null-pointer-checks
8003 Assume that programs cannot safely dereference null pointers, and that
8004 no code or data element resides at address zero.
8005 This option 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 a memory access to address zero always results in a trap, so
8010 that if a pointer is checked after it has already been dereferenced,
8011 it cannot be null.
8012
8013 Note however that in some environments this assumption is not true.
8014 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8015 for programs that depend on that behavior.
8016
8017 This option is enabled by default on most targets. On Nios II ELF, it
8018 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8019
8020 Passes that use the dataflow information
8021 are enabled independently at different optimization levels.
8022
8023 @item -fdevirtualize
8024 @opindex fdevirtualize
8025 Attempt to convert calls to virtual functions to direct calls. This
8026 is done both within a procedure and interprocedurally as part of
8027 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8028 propagation (@option{-fipa-cp}).
8029 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8030
8031 @item -fdevirtualize-speculatively
8032 @opindex fdevirtualize-speculatively
8033 Attempt to convert calls to virtual functions to speculative direct calls.
8034 Based on the analysis of the type inheritance graph, determine for a given call
8035 the set of likely targets. If the set is small, preferably of size 1, change
8036 the call into a conditional deciding between direct and indirect calls. The
8037 speculative calls enable more optimizations, such as inlining. When they seem
8038 useless after further optimization, they are converted back into original form.
8039
8040 @item -fdevirtualize-at-ltrans
8041 @opindex fdevirtualize-at-ltrans
8042 Stream extra information needed for aggressive devirtualization when running
8043 the link-time optimizer in local transformation mode.
8044 This option enables more devirtualization but
8045 significantly increases the size of streamed data. For this reason it is
8046 disabled by default.
8047
8048 @item -fexpensive-optimizations
8049 @opindex fexpensive-optimizations
8050 Perform a number of minor optimizations that are relatively expensive.
8051
8052 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8053
8054 @item -free
8055 @opindex free
8056 Attempt to remove redundant extension instructions. This is especially
8057 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8058 registers after writing to their lower 32-bit half.
8059
8060 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8061 @option{-O3}, @option{-Os}.
8062
8063 @item -fno-lifetime-dse
8064 @opindex fno-lifetime-dse
8065 In C++ the value of an object is only affected by changes within its
8066 lifetime: when the constructor begins, the object has an indeterminate
8067 value, and any changes during the lifetime of the object are dead when
8068 the object is destroyed. Normally dead store elimination will take
8069 advantage of this; if your code relies on the value of the object
8070 storage persisting beyond the lifetime of the object, you can use this
8071 flag to disable this optimization. To preserve stores before the
8072 constructor starts (e.g. because your operator new clears the object
8073 storage) but still treat the object as dead after the destructor you,
8074 can use @option{-flifetime-dse=1}. The default behavior can be
8075 explicitly selected with @option{-flifetime-dse=2}.
8076 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8077
8078 @item -flive-range-shrinkage
8079 @opindex flive-range-shrinkage
8080 Attempt to decrease register pressure through register live range
8081 shrinkage. This is helpful for fast processors with small or moderate
8082 size register sets.
8083
8084 @item -fira-algorithm=@var{algorithm}
8085 @opindex fira-algorithm
8086 Use the specified coloring algorithm for the integrated register
8087 allocator. The @var{algorithm} argument can be @samp{priority}, which
8088 specifies Chow's priority coloring, or @samp{CB}, which specifies
8089 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8090 for all architectures, but for those targets that do support it, it is
8091 the default because it generates better code.
8092
8093 @item -fira-region=@var{region}
8094 @opindex fira-region
8095 Use specified regions for the integrated register allocator. The
8096 @var{region} argument should be one of the following:
8097
8098 @table @samp
8099
8100 @item all
8101 Use all loops as register allocation regions.
8102 This can give the best results for machines with a small and/or
8103 irregular register set.
8104
8105 @item mixed
8106 Use all loops except for loops with small register pressure
8107 as the regions. This value usually gives
8108 the best results in most cases and for most architectures,
8109 and is enabled by default when compiling with optimization for speed
8110 (@option{-O}, @option{-O2}, @dots{}).
8111
8112 @item one
8113 Use all functions as a single region.
8114 This typically results in the smallest code size, and is enabled by default for
8115 @option{-Os} or @option{-O0}.
8116
8117 @end table
8118
8119 @item -fira-hoist-pressure
8120 @opindex fira-hoist-pressure
8121 Use IRA to evaluate register pressure in the code hoisting pass for
8122 decisions to hoist expressions. This option usually results in smaller
8123 code, but it can slow the compiler down.
8124
8125 This option is enabled at level @option{-Os} for all targets.
8126
8127 @item -fira-loop-pressure
8128 @opindex fira-loop-pressure
8129 Use IRA to evaluate register pressure in loops for decisions to move
8130 loop invariants. This option usually results in generation
8131 of faster and smaller code on machines with large register files (>= 32
8132 registers), but it can slow the compiler down.
8133
8134 This option is enabled at level @option{-O3} for some targets.
8135
8136 @item -fno-ira-share-save-slots
8137 @opindex fno-ira-share-save-slots
8138 Disable sharing of stack slots used for saving call-used hard
8139 registers living through a call. Each hard register gets a
8140 separate stack slot, and as a result function stack frames are
8141 larger.
8142
8143 @item -fno-ira-share-spill-slots
8144 @opindex fno-ira-share-spill-slots
8145 Disable sharing of stack slots allocated for pseudo-registers. Each
8146 pseudo-register that does not get a hard register gets a separate
8147 stack slot, and as a result function stack frames are larger.
8148
8149 @item -flra-remat
8150 @opindex flra-remat
8151 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8152 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8153 values if it is profitable.
8154
8155 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8156
8157 @item -fdelayed-branch
8158 @opindex fdelayed-branch
8159 If supported for the target machine, attempt to reorder instructions
8160 to exploit instruction slots available after delayed branch
8161 instructions.
8162
8163 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8164
8165 @item -fschedule-insns
8166 @opindex fschedule-insns
8167 If supported for the target machine, attempt to reorder instructions to
8168 eliminate execution stalls due to required data being unavailable. This
8169 helps machines that have slow floating point or memory load instructions
8170 by allowing other instructions to be issued until the result of the load
8171 or floating-point instruction is required.
8172
8173 Enabled at levels @option{-O2}, @option{-O3}.
8174
8175 @item -fschedule-insns2
8176 @opindex fschedule-insns2
8177 Similar to @option{-fschedule-insns}, but requests an additional pass of
8178 instruction scheduling after register allocation has been done. This is
8179 especially useful on machines with a relatively small number of
8180 registers and where memory load instructions take more than one cycle.
8181
8182 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8183
8184 @item -fno-sched-interblock
8185 @opindex fno-sched-interblock
8186 Don't schedule instructions across basic blocks. This is normally
8187 enabled by default when scheduling before register allocation, i.e.@:
8188 with @option{-fschedule-insns} or at @option{-O2} or higher.
8189
8190 @item -fno-sched-spec
8191 @opindex fno-sched-spec
8192 Don't allow speculative motion of non-load instructions. This is normally
8193 enabled by default when scheduling before register allocation, i.e.@:
8194 with @option{-fschedule-insns} or at @option{-O2} or higher.
8195
8196 @item -fsched-pressure
8197 @opindex fsched-pressure
8198 Enable register pressure sensitive insn scheduling before register
8199 allocation. This only makes sense when scheduling before register
8200 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8201 @option{-O2} or higher. Usage of this option can improve the
8202 generated code and decrease its size by preventing register pressure
8203 increase above the number of available hard registers and subsequent
8204 spills in register allocation.
8205
8206 @item -fsched-spec-load
8207 @opindex fsched-spec-load
8208 Allow speculative motion of some load instructions. This only makes
8209 sense when scheduling before register allocation, i.e.@: with
8210 @option{-fschedule-insns} or at @option{-O2} or higher.
8211
8212 @item -fsched-spec-load-dangerous
8213 @opindex fsched-spec-load-dangerous
8214 Allow speculative motion of more load instructions. This only makes
8215 sense when scheduling before register allocation, i.e.@: with
8216 @option{-fschedule-insns} or at @option{-O2} or higher.
8217
8218 @item -fsched-stalled-insns
8219 @itemx -fsched-stalled-insns=@var{n}
8220 @opindex fsched-stalled-insns
8221 Define how many insns (if any) can be moved prematurely from the queue
8222 of stalled insns into the ready list during the second scheduling pass.
8223 @option{-fno-sched-stalled-insns} means that no insns are moved
8224 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8225 on how many queued insns can be moved prematurely.
8226 @option{-fsched-stalled-insns} without a value is equivalent to
8227 @option{-fsched-stalled-insns=1}.
8228
8229 @item -fsched-stalled-insns-dep
8230 @itemx -fsched-stalled-insns-dep=@var{n}
8231 @opindex fsched-stalled-insns-dep
8232 Define how many insn groups (cycles) are examined for a dependency
8233 on a stalled insn that is a candidate for premature removal from the queue
8234 of stalled insns. This has an effect only during the second scheduling pass,
8235 and only if @option{-fsched-stalled-insns} is used.
8236 @option{-fno-sched-stalled-insns-dep} is equivalent to
8237 @option{-fsched-stalled-insns-dep=0}.
8238 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8239 @option{-fsched-stalled-insns-dep=1}.
8240
8241 @item -fsched2-use-superblocks
8242 @opindex fsched2-use-superblocks
8243 When scheduling after register allocation, use superblock scheduling.
8244 This allows motion across basic block boundaries,
8245 resulting in faster schedules. This option is experimental, as not all machine
8246 descriptions used by GCC model the CPU closely enough to avoid unreliable
8247 results from the algorithm.
8248
8249 This only makes sense when scheduling after register allocation, i.e.@: with
8250 @option{-fschedule-insns2} or at @option{-O2} or higher.
8251
8252 @item -fsched-group-heuristic
8253 @opindex fsched-group-heuristic
8254 Enable the group heuristic in the scheduler. This heuristic favors
8255 the instruction that belongs to a schedule group. This is enabled
8256 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8257 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8258
8259 @item -fsched-critical-path-heuristic
8260 @opindex fsched-critical-path-heuristic
8261 Enable the critical-path heuristic in the scheduler. This heuristic favors
8262 instructions on the critical path. This is enabled by default when
8263 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8264 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8265
8266 @item -fsched-spec-insn-heuristic
8267 @opindex fsched-spec-insn-heuristic
8268 Enable the speculative instruction heuristic in the scheduler. This
8269 heuristic favors speculative instructions with greater dependency weakness.
8270 This is enabled by default when scheduling is enabled, i.e.@:
8271 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8272 or at @option{-O2} or higher.
8273
8274 @item -fsched-rank-heuristic
8275 @opindex fsched-rank-heuristic
8276 Enable the rank heuristic in the scheduler. This heuristic favors
8277 the instruction belonging to a basic block with greater size or frequency.
8278 This is enabled by default when scheduling is enabled, i.e.@:
8279 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8280 at @option{-O2} or higher.
8281
8282 @item -fsched-last-insn-heuristic
8283 @opindex fsched-last-insn-heuristic
8284 Enable the last-instruction heuristic in the scheduler. This heuristic
8285 favors the instruction that is less dependent on the last instruction
8286 scheduled. This is enabled by default when scheduling is enabled,
8287 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8288 at @option{-O2} or higher.
8289
8290 @item -fsched-dep-count-heuristic
8291 @opindex fsched-dep-count-heuristic
8292 Enable the dependent-count heuristic in the scheduler. This heuristic
8293 favors the instruction that has more instructions depending on it.
8294 This is enabled by default when scheduling is enabled, i.e.@:
8295 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8296 at @option{-O2} or higher.
8297
8298 @item -freschedule-modulo-scheduled-loops
8299 @opindex freschedule-modulo-scheduled-loops
8300 Modulo scheduling is performed before traditional scheduling. If a loop
8301 is modulo scheduled, later scheduling passes may change its schedule.
8302 Use this option to control that behavior.
8303
8304 @item -fselective-scheduling
8305 @opindex fselective-scheduling
8306 Schedule instructions using selective scheduling algorithm. Selective
8307 scheduling runs instead of the first scheduler pass.
8308
8309 @item -fselective-scheduling2
8310 @opindex fselective-scheduling2
8311 Schedule instructions using selective scheduling algorithm. Selective
8312 scheduling runs instead of the second scheduler pass.
8313
8314 @item -fsel-sched-pipelining
8315 @opindex fsel-sched-pipelining
8316 Enable software pipelining of innermost loops during selective scheduling.
8317 This option has no effect unless one of @option{-fselective-scheduling} or
8318 @option{-fselective-scheduling2} is turned on.
8319
8320 @item -fsel-sched-pipelining-outer-loops
8321 @opindex fsel-sched-pipelining-outer-loops
8322 When pipelining loops during selective scheduling, also pipeline outer loops.
8323 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8324
8325 @item -fsemantic-interposition
8326 @opindex fsemantic-interposition
8327 Some object formats, like ELF, allow interposing of symbols by the
8328 dynamic linker.
8329 This means that for symbols exported from the DSO, the compiler cannot perform
8330 interprocedural propagation, inlining and other optimizations in anticipation
8331 that the function or variable in question may change. While this feature is
8332 useful, for example, to rewrite memory allocation functions by a debugging
8333 implementation, it is expensive in the terms of code quality.
8334 With @option{-fno-semantic-interposition} the compiler assumes that
8335 if interposition happens for functions the overwriting function will have
8336 precisely the same semantics (and side effects).
8337 Similarly if interposition happens
8338 for variables, the constructor of the variable will be the same. The flag
8339 has no effect for functions explicitly declared inline
8340 (where it is never allowed for interposition to change semantics)
8341 and for symbols explicitly declared weak.
8342
8343 @item -fshrink-wrap
8344 @opindex fshrink-wrap
8345 Emit function prologues only before parts of the function that need it,
8346 rather than at the top of the function. This flag is enabled by default at
8347 @option{-O} and higher.
8348
8349 @item -fshrink-wrap-separate
8350 @opindex fshrink-wrap-separate
8351 Shrink-wrap separate parts of the prologue and epilogue separately, so that
8352 those parts are only executed when needed.
8353 This option is on by default, but has no effect unless @option{-fshrink-wrap}
8354 is also turned on and the target supports this.
8355
8356 @item -fcaller-saves
8357 @opindex fcaller-saves
8358 Enable allocation of values to registers that are clobbered by
8359 function calls, by emitting extra instructions to save and restore the
8360 registers around such calls. Such allocation is done only when it
8361 seems to result in better code.
8362
8363 This option is always enabled by default on certain machines, usually
8364 those which have no call-preserved registers to use instead.
8365
8366 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8367
8368 @item -fcombine-stack-adjustments
8369 @opindex fcombine-stack-adjustments
8370 Tracks stack adjustments (pushes and pops) and stack memory references
8371 and then tries to find ways to combine them.
8372
8373 Enabled by default at @option{-O1} and higher.
8374
8375 @item -fipa-ra
8376 @opindex fipa-ra
8377 Use caller save registers for allocation if those registers are not used by
8378 any called function. In that case it is not necessary to save and restore
8379 them around calls. This is only possible if called functions are part of
8380 same compilation unit as current function and they are compiled before it.
8381
8382 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
8383 is disabled if generated code will be instrumented for profiling
8384 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
8385 exactly (this happens on targets that do not expose prologues
8386 and epilogues in RTL).
8387
8388 @item -fconserve-stack
8389 @opindex fconserve-stack
8390 Attempt to minimize stack usage. The compiler attempts to use less
8391 stack space, even if that makes the program slower. This option
8392 implies setting the @option{large-stack-frame} parameter to 100
8393 and the @option{large-stack-frame-growth} parameter to 400.
8394
8395 @item -ftree-reassoc
8396 @opindex ftree-reassoc
8397 Perform reassociation on trees. This flag is enabled by default
8398 at @option{-O} and higher.
8399
8400 @item -fcode-hoisting
8401 @opindex fcode-hoisting
8402 Perform code hoisting. Code hoisting tries to move the
8403 evaluation of expressions executed on all paths to the function exit
8404 as early as possible. This is especially useful as a code size
8405 optimization, but it often helps for code speed as well.
8406 This flag is enabled by default at @option{-O2} and higher.
8407
8408 @item -ftree-pre
8409 @opindex ftree-pre
8410 Perform partial redundancy elimination (PRE) on trees. This flag is
8411 enabled by default at @option{-O2} and @option{-O3}.
8412
8413 @item -ftree-partial-pre
8414 @opindex ftree-partial-pre
8415 Make partial redundancy elimination (PRE) more aggressive. This flag is
8416 enabled by default at @option{-O3}.
8417
8418 @item -ftree-forwprop
8419 @opindex ftree-forwprop
8420 Perform forward propagation on trees. This flag is enabled by default
8421 at @option{-O} and higher.
8422
8423 @item -ftree-fre
8424 @opindex ftree-fre
8425 Perform full redundancy elimination (FRE) on trees. The difference
8426 between FRE and PRE is that FRE only considers expressions
8427 that are computed on all paths leading to the redundant computation.
8428 This analysis is faster than PRE, though it exposes fewer redundancies.
8429 This flag is enabled by default at @option{-O} and higher.
8430
8431 @item -ftree-phiprop
8432 @opindex ftree-phiprop
8433 Perform hoisting of loads from conditional pointers on trees. This
8434 pass is enabled by default at @option{-O} and higher.
8435
8436 @item -fhoist-adjacent-loads
8437 @opindex fhoist-adjacent-loads
8438 Speculatively hoist loads from both branches of an if-then-else if the
8439 loads are from adjacent locations in the same structure and the target
8440 architecture has a conditional move instruction. This flag is enabled
8441 by default at @option{-O2} and higher.
8442
8443 @item -ftree-copy-prop
8444 @opindex ftree-copy-prop
8445 Perform copy propagation on trees. This pass eliminates unnecessary
8446 copy operations. This flag is enabled by default at @option{-O} and
8447 higher.
8448
8449 @item -fipa-pure-const
8450 @opindex fipa-pure-const
8451 Discover which functions are pure or constant.
8452 Enabled by default at @option{-O} and higher.
8453
8454 @item -fipa-reference
8455 @opindex fipa-reference
8456 Discover which static variables do not escape the
8457 compilation unit.
8458 Enabled by default at @option{-O} and higher.
8459
8460 @item -fipa-pta
8461 @opindex fipa-pta
8462 Perform interprocedural pointer analysis and interprocedural modification
8463 and reference analysis. This option can cause excessive memory and
8464 compile-time usage on large compilation units. It is not enabled by
8465 default at any optimization level.
8466
8467 @item -fipa-profile
8468 @opindex fipa-profile
8469 Perform interprocedural profile propagation. The functions called only from
8470 cold functions are marked as cold. Also functions executed once (such as
8471 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8472 functions and loop less parts of functions executed once are then optimized for
8473 size.
8474 Enabled by default at @option{-O} and higher.
8475
8476 @item -fipa-cp
8477 @opindex fipa-cp
8478 Perform interprocedural constant propagation.
8479 This optimization analyzes the program to determine when values passed
8480 to functions are constants and then optimizes accordingly.
8481 This optimization can substantially increase performance
8482 if the application has constants passed to functions.
8483 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8484
8485 @item -fipa-cp-clone
8486 @opindex fipa-cp-clone
8487 Perform function cloning to make interprocedural constant propagation stronger.
8488 When enabled, interprocedural constant propagation performs function cloning
8489 when externally visible function can be called with constant arguments.
8490 Because this optimization can create multiple copies of functions,
8491 it may significantly increase code size
8492 (see @option{--param ipcp-unit-growth=@var{value}}).
8493 This flag is enabled by default at @option{-O3}.
8494
8495 @item -fipa-bit-cp
8496 @opindex -fipa-bit-cp
8497 When enabled, perform interprocedural bitwise constant
8498 propagation. This flag is enabled by default at @option{-O2}. It
8499 requires that @option{-fipa-cp} is enabled.
8500
8501 @item -fipa-vrp
8502 @opindex -fipa-vrp
8503 When enabled, perform interprocedural propagation of value
8504 ranges. This flag is enabled by default at @option{-O2}. It requires
8505 that @option{-fipa-cp} is enabled.
8506
8507 @item -fipa-icf
8508 @opindex fipa-icf
8509 Perform Identical Code Folding for functions and read-only variables.
8510 The optimization reduces code size and may disturb unwind stacks by replacing
8511 a function by equivalent one with a different name. The optimization works
8512 more effectively with link-time optimization enabled.
8513
8514 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8515 works on different levels and thus the optimizations are not same - there are
8516 equivalences that are found only by GCC and equivalences found only by Gold.
8517
8518 This flag is enabled by default at @option{-O2} and @option{-Os}.
8519
8520 @item -fisolate-erroneous-paths-dereference
8521 @opindex fisolate-erroneous-paths-dereference
8522 Detect paths that trigger erroneous or undefined behavior due to
8523 dereferencing a null pointer. Isolate those paths from the main control
8524 flow and turn the statement with erroneous or undefined behavior into a trap.
8525 This flag is enabled by default at @option{-O2} and higher and depends on
8526 @option{-fdelete-null-pointer-checks} also being enabled.
8527
8528 @item -fisolate-erroneous-paths-attribute
8529 @opindex fisolate-erroneous-paths-attribute
8530 Detect paths that trigger erroneous or undefined behavior due a null value
8531 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8532 attribute. Isolate those paths from the main control flow and turn the
8533 statement with erroneous or undefined behavior into a trap. This is not
8534 currently enabled, but may be enabled by @option{-O2} in the future.
8535
8536 @item -ftree-sink
8537 @opindex ftree-sink
8538 Perform forward store motion on trees. This flag is
8539 enabled by default at @option{-O} and higher.
8540
8541 @item -ftree-bit-ccp
8542 @opindex ftree-bit-ccp
8543 Perform sparse conditional bit constant propagation on trees and propagate
8544 pointer alignment information.
8545 This pass only operates on local scalar variables and is enabled by default
8546 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8547
8548 @item -ftree-ccp
8549 @opindex ftree-ccp
8550 Perform sparse conditional constant propagation (CCP) on trees. This
8551 pass only operates on local scalar variables and is enabled by default
8552 at @option{-O} and higher.
8553
8554 @item -fssa-backprop
8555 @opindex fssa-backprop
8556 Propagate information about uses of a value up the definition chain
8557 in order to simplify the definitions. For example, this pass strips
8558 sign operations if the sign of a value never matters. The flag is
8559 enabled by default at @option{-O} and higher.
8560
8561 @item -fssa-phiopt
8562 @opindex fssa-phiopt
8563 Perform pattern matching on SSA PHI nodes to optimize conditional
8564 code. This pass is enabled by default at @option{-O} and higher.
8565
8566 @item -ftree-switch-conversion
8567 @opindex ftree-switch-conversion
8568 Perform conversion of simple initializations in a switch to
8569 initializations from a scalar array. This flag is enabled by default
8570 at @option{-O2} and higher.
8571
8572 @item -ftree-tail-merge
8573 @opindex ftree-tail-merge
8574 Look for identical code sequences. When found, replace one with a jump to the
8575 other. This optimization is known as tail merging or cross jumping. This flag
8576 is enabled by default at @option{-O2} and higher. The compilation time
8577 in this pass can
8578 be limited using @option{max-tail-merge-comparisons} parameter and
8579 @option{max-tail-merge-iterations} parameter.
8580
8581 @item -ftree-dce
8582 @opindex ftree-dce
8583 Perform dead code elimination (DCE) on trees. This flag is enabled by
8584 default at @option{-O} and higher.
8585
8586 @item -ftree-builtin-call-dce
8587 @opindex ftree-builtin-call-dce
8588 Perform conditional dead code elimination (DCE) for calls to built-in functions
8589 that may set @code{errno} but are otherwise side-effect free. This flag is
8590 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8591 specified.
8592
8593 @item -ftree-dominator-opts
8594 @opindex ftree-dominator-opts
8595 Perform a variety of simple scalar cleanups (constant/copy
8596 propagation, redundancy elimination, range propagation and expression
8597 simplification) based on a dominator tree traversal. This also
8598 performs jump threading (to reduce jumps to jumps). This flag is
8599 enabled by default at @option{-O} and higher.
8600
8601 @item -ftree-dse
8602 @opindex ftree-dse
8603 Perform dead store elimination (DSE) on trees. A dead store is a store into
8604 a memory location that is later overwritten by another store without
8605 any intervening loads. In this case the earlier store can be deleted. This
8606 flag is enabled by default at @option{-O} and higher.
8607
8608 @item -ftree-ch
8609 @opindex ftree-ch
8610 Perform loop header copying on trees. This is beneficial since it increases
8611 effectiveness of code motion optimizations. It also saves one jump. This flag
8612 is enabled by default at @option{-O} and higher. It is not enabled
8613 for @option{-Os}, since it usually increases code size.
8614
8615 @item -ftree-loop-optimize
8616 @opindex ftree-loop-optimize
8617 Perform loop optimizations on trees. This flag is enabled by default
8618 at @option{-O} and higher.
8619
8620 @item -ftree-loop-linear
8621 @itemx -floop-strip-mine
8622 @itemx -floop-block
8623 @opindex ftree-loop-linear
8624 @opindex floop-strip-mine
8625 @opindex floop-block
8626 Perform loop nest optimizations. Same as
8627 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8628 to be configured with @option{--with-isl} to enable the Graphite loop
8629 transformation infrastructure.
8630
8631 @item -fgraphite-identity
8632 @opindex fgraphite-identity
8633 Enable the identity transformation for graphite. For every SCoP we generate
8634 the polyhedral representation and transform it back to gimple. Using
8635 @option{-fgraphite-identity} we can check the costs or benefits of the
8636 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8637 are also performed by the code generator isl, like index splitting and
8638 dead code elimination in loops.
8639
8640 @item -floop-nest-optimize
8641 @opindex floop-nest-optimize
8642 Enable the isl based loop nest optimizer. This is a generic loop nest
8643 optimizer based on the Pluto optimization algorithms. It calculates a loop
8644 structure optimized for data-locality and parallelism. This option
8645 is experimental.
8646
8647 @item -floop-parallelize-all
8648 @opindex floop-parallelize-all
8649 Use the Graphite data dependence analysis to identify loops that can
8650 be parallelized. Parallelize all the loops that can be analyzed to
8651 not contain loop carried dependences without checking that it is
8652 profitable to parallelize the loops.
8653
8654 @item -ftree-coalesce-vars
8655 @opindex ftree-coalesce-vars
8656 While transforming the program out of the SSA representation, attempt to
8657 reduce copying by coalescing versions of different user-defined
8658 variables, instead of just compiler temporaries. This may severely
8659 limit the ability to debug an optimized program compiled with
8660 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8661 prevents SSA coalescing of user variables. This option is enabled by
8662 default if optimization is enabled, and it does very little otherwise.
8663
8664 @item -ftree-loop-if-convert
8665 @opindex ftree-loop-if-convert
8666 Attempt to transform conditional jumps in the innermost loops to
8667 branch-less equivalents. The intent is to remove control-flow from
8668 the innermost loops in order to improve the ability of the
8669 vectorization pass to handle these loops. This is enabled by default
8670 if vectorization is enabled.
8671
8672 @item -ftree-loop-distribution
8673 @opindex ftree-loop-distribution
8674 Perform loop distribution. This flag can improve cache performance on
8675 big loop bodies and allow further loop optimizations, like
8676 parallelization or vectorization, to take place. For example, the loop
8677 @smallexample
8678 DO I = 1, N
8679 A(I) = B(I) + C
8680 D(I) = E(I) * F
8681 ENDDO
8682 @end smallexample
8683 is transformed to
8684 @smallexample
8685 DO I = 1, N
8686 A(I) = B(I) + C
8687 ENDDO
8688 DO I = 1, N
8689 D(I) = E(I) * F
8690 ENDDO
8691 @end smallexample
8692
8693 @item -ftree-loop-distribute-patterns
8694 @opindex ftree-loop-distribute-patterns
8695 Perform loop distribution of patterns that can be code generated with
8696 calls to a library. This flag is enabled by default at @option{-O3}.
8697
8698 This pass distributes the initialization loops and generates a call to
8699 memset zero. For example, the loop
8700 @smallexample
8701 DO I = 1, N
8702 A(I) = 0
8703 B(I) = A(I) + I
8704 ENDDO
8705 @end smallexample
8706 is transformed to
8707 @smallexample
8708 DO I = 1, N
8709 A(I) = 0
8710 ENDDO
8711 DO I = 1, N
8712 B(I) = A(I) + I
8713 ENDDO
8714 @end smallexample
8715 and the initialization loop is transformed into a call to memset zero.
8716
8717 @item -floop-interchange
8718 @opindex floop-interchange
8719 Perform loop interchange outside of graphite. This flag can improve cache
8720 performance on loop nest and allow further loop optimizations, like
8721 vectorization, to take place. For example, the loop
8722 @smallexample
8723 for (int i = 0; i < N; i++)
8724 for (int j = 0; j < N; j++)
8725 for (int k = 0; k < N; k++)
8726 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8727 @end smallexample
8728 is transformed to
8729 @smallexample
8730 for (int i = 0; i < N; i++)
8731 for (int k = 0; k < N; k++)
8732 for (int j = 0; j < N; j++)
8733 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8734 @end smallexample
8735
8736 @item -ftree-loop-im
8737 @opindex ftree-loop-im
8738 Perform loop invariant motion on trees. This pass moves only invariants that
8739 are hard to handle at RTL level (function calls, operations that expand to
8740 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8741 operands of conditions that are invariant out of the loop, so that we can use
8742 just trivial invariantness analysis in loop unswitching. The pass also includes
8743 store motion.
8744
8745 @item -ftree-loop-ivcanon
8746 @opindex ftree-loop-ivcanon
8747 Create a canonical counter for number of iterations in loops for which
8748 determining number of iterations requires complicated analysis. Later
8749 optimizations then may determine the number easily. Useful especially
8750 in connection with unrolling.
8751
8752 @item -fivopts
8753 @opindex fivopts
8754 Perform induction variable optimizations (strength reduction, induction
8755 variable merging and induction variable elimination) on trees.
8756
8757 @item -ftree-parallelize-loops=n
8758 @opindex ftree-parallelize-loops
8759 Parallelize loops, i.e., split their iteration space to run in n threads.
8760 This is only possible for loops whose iterations are independent
8761 and can be arbitrarily reordered. The optimization is only
8762 profitable on multiprocessor machines, for loops that are CPU-intensive,
8763 rather than constrained e.g.@: by memory bandwidth. This option
8764 implies @option{-pthread}, and thus is only supported on targets
8765 that have support for @option{-pthread}.
8766
8767 @item -ftree-pta
8768 @opindex ftree-pta
8769 Perform function-local points-to analysis on trees. This flag is
8770 enabled by default at @option{-O} and higher.
8771
8772 @item -ftree-sra
8773 @opindex ftree-sra
8774 Perform scalar replacement of aggregates. This pass replaces structure
8775 references with scalars to prevent committing structures to memory too
8776 early. This flag is enabled by default at @option{-O} and higher.
8777
8778 @item -fstore-merging
8779 @opindex fstore-merging
8780 Perform merging of narrow stores to consecutive memory addresses. This pass
8781 merges contiguous stores of immediate values narrower than a word into fewer
8782 wider stores to reduce the number of instructions. This is enabled by default
8783 at @option{-O2} and higher as well as @option{-Os}.
8784
8785 @item -ftree-ter
8786 @opindex ftree-ter
8787 Perform temporary expression replacement during the SSA->normal phase. Single
8788 use/single def temporaries are replaced at their use location with their
8789 defining expression. This results in non-GIMPLE code, but gives the expanders
8790 much more complex trees to work on resulting in better RTL generation. This is
8791 enabled by default at @option{-O} and higher.
8792
8793 @item -ftree-slsr
8794 @opindex ftree-slsr
8795 Perform straight-line strength reduction on trees. This recognizes related
8796 expressions involving multiplications and replaces them by less expensive
8797 calculations when possible. This is enabled by default at @option{-O} and
8798 higher.
8799
8800 @item -ftree-vectorize
8801 @opindex ftree-vectorize
8802 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8803 and @option{-ftree-slp-vectorize} if not explicitly specified.
8804
8805 @item -ftree-loop-vectorize
8806 @opindex ftree-loop-vectorize
8807 Perform loop vectorization on trees. This flag is enabled by default at
8808 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8809
8810 @item -ftree-slp-vectorize
8811 @opindex ftree-slp-vectorize
8812 Perform basic block vectorization on trees. This flag is enabled by default at
8813 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8814
8815 @item -fvect-cost-model=@var{model}
8816 @opindex fvect-cost-model
8817 Alter the cost model used for vectorization. The @var{model} argument
8818 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
8819 With the @samp{unlimited} model the vectorized code-path is assumed
8820 to be profitable while with the @samp{dynamic} model a runtime check
8821 guards the vectorized code-path to enable it only for iteration
8822 counts that will likely execute faster than when executing the original
8823 scalar loop. The @samp{cheap} model disables vectorization of
8824 loops where doing so would be cost prohibitive for example due to
8825 required runtime checks for data dependence or alignment but otherwise
8826 is equal to the @samp{dynamic} model.
8827 The default cost model depends on other optimization flags and is
8828 either @samp{dynamic} or @samp{cheap}.
8829
8830 @item -fsimd-cost-model=@var{model}
8831 @opindex fsimd-cost-model
8832 Alter the cost model used for vectorization of loops marked with the OpenMP
8833 or Cilk Plus simd directive. The @var{model} argument should be one of
8834 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
8835 have the same meaning as described in @option{-fvect-cost-model} and by
8836 default a cost model defined with @option{-fvect-cost-model} is used.
8837
8838 @item -ftree-vrp
8839 @opindex ftree-vrp
8840 Perform Value Range Propagation on trees. This is similar to the
8841 constant propagation pass, but instead of values, ranges of values are
8842 propagated. This allows the optimizers to remove unnecessary range
8843 checks like array bound checks and null pointer checks. This is
8844 enabled by default at @option{-O2} and higher. Null pointer check
8845 elimination is only done if @option{-fdelete-null-pointer-checks} is
8846 enabled.
8847
8848 @item -fsplit-paths
8849 @opindex fsplit-paths
8850 Split paths leading to loop backedges. This can improve dead code
8851 elimination and common subexpression elimination. This is enabled by
8852 default at @option{-O2} and above.
8853
8854 @item -fsplit-ivs-in-unroller
8855 @opindex fsplit-ivs-in-unroller
8856 Enables expression of values of induction variables in later iterations
8857 of the unrolled loop using the value in the first iteration. This breaks
8858 long dependency chains, thus improving efficiency of the scheduling passes.
8859
8860 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8861 same effect. However, that is not reliable in cases where the loop body
8862 is more complicated than a single basic block. It also does not work at all
8863 on some architectures due to restrictions in the CSE pass.
8864
8865 This optimization is enabled by default.
8866
8867 @item -fvariable-expansion-in-unroller
8868 @opindex fvariable-expansion-in-unroller
8869 With this option, the compiler creates multiple copies of some
8870 local variables when unrolling a loop, which can result in superior code.
8871
8872 @item -fpartial-inlining
8873 @opindex fpartial-inlining
8874 Inline parts of functions. This option has any effect only
8875 when inlining itself is turned on by the @option{-finline-functions}
8876 or @option{-finline-small-functions} options.
8877
8878 Enabled at level @option{-O2}.
8879
8880 @item -fpredictive-commoning
8881 @opindex fpredictive-commoning
8882 Perform predictive commoning optimization, i.e., reusing computations
8883 (especially memory loads and stores) performed in previous
8884 iterations of loops.
8885
8886 This option is enabled at level @option{-O3}.
8887
8888 @item -fprefetch-loop-arrays
8889 @opindex fprefetch-loop-arrays
8890 If supported by the target machine, generate instructions to prefetch
8891 memory to improve the performance of loops that access large arrays.
8892
8893 This option may generate better or worse code; results are highly
8894 dependent on the structure of loops within the source code.
8895
8896 Disabled at level @option{-Os}.
8897
8898 @item -fno-printf-return-value
8899 @opindex fno-printf-return-value
8900 Do not substitute constants for known return value of formatted output
8901 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
8902 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
8903 transformation allows GCC to optimize or even eliminate branches based
8904 on the known return value of these functions called with arguments that
8905 are either constant, or whose values are known to be in a range that
8906 makes determining the exact return value possible. For example, when
8907 @option{-fprintf-return-value} is in effect, both the branch and the
8908 body of the @code{if} statement (but not the call to @code{snprint})
8909 can be optimized away when @code{i} is a 32-bit or smaller integer
8910 because the return value is guaranteed to be at most 8.
8911
8912 @smallexample
8913 char buf[9];
8914 if (snprintf (buf, "%08x", i) >= sizeof buf)
8915 @dots{}
8916 @end smallexample
8917
8918 The @option{-fprintf-return-value} option relies on other optimizations
8919 and yields best results with @option{-O2}. It works in tandem with the
8920 @option{-Wformat-overflow} and @option{-Wformat-truncation} options.
8921 The @option{-fprintf-return-value} option is enabled by default.
8922
8923 @item -fno-peephole
8924 @itemx -fno-peephole2
8925 @opindex fno-peephole
8926 @opindex fno-peephole2
8927 Disable any machine-specific peephole optimizations. The difference
8928 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
8929 are implemented in the compiler; some targets use one, some use the
8930 other, a few use both.
8931
8932 @option{-fpeephole} is enabled by default.
8933 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8934
8935 @item -fno-guess-branch-probability
8936 @opindex fno-guess-branch-probability
8937 Do not guess branch probabilities using heuristics.
8938
8939 GCC uses heuristics to guess branch probabilities if they are
8940 not provided by profiling feedback (@option{-fprofile-arcs}). These
8941 heuristics are based on the control flow graph. If some branch probabilities
8942 are specified by @code{__builtin_expect}, then the heuristics are
8943 used to guess branch probabilities for the rest of the control flow graph,
8944 taking the @code{__builtin_expect} info into account. The interactions
8945 between the heuristics and @code{__builtin_expect} can be complex, and in
8946 some cases, it may be useful to disable the heuristics so that the effects
8947 of @code{__builtin_expect} are easier to understand.
8948
8949 The default is @option{-fguess-branch-probability} at levels
8950 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8951
8952 @item -freorder-blocks
8953 @opindex freorder-blocks
8954 Reorder basic blocks in the compiled function in order to reduce number of
8955 taken branches and improve code locality.
8956
8957 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8958
8959 @item -freorder-blocks-algorithm=@var{algorithm}
8960 @opindex freorder-blocks-algorithm
8961 Use the specified algorithm for basic block reordering. The
8962 @var{algorithm} argument can be @samp{simple}, which does not increase
8963 code size (except sometimes due to secondary effects like alignment),
8964 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
8965 put all often executed code together, minimizing the number of branches
8966 executed by making extra copies of code.
8967
8968 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
8969 @samp{stc} at levels @option{-O2}, @option{-O3}.
8970
8971 @item -freorder-blocks-and-partition
8972 @opindex freorder-blocks-and-partition
8973 In addition to reordering basic blocks in the compiled function, in order
8974 to reduce number of taken branches, partitions hot and cold basic blocks
8975 into separate sections of the assembly and @file{.o} files, to improve
8976 paging and cache locality performance.
8977
8978 This optimization is automatically turned off in the presence of
8979 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
8980 section attribute and on any architecture that does not support named
8981 sections. When @option{-fsplit-stack} is used this option is not
8982 enabled by default (to avoid linker errors), but may be enabled
8983 explicitly (if using a working linker).
8984
8985 Enabled for x86 at levels @option{-O2}, @option{-O3}.
8986
8987 @item -freorder-functions
8988 @opindex freorder-functions
8989 Reorder functions in the object file in order to
8990 improve code locality. This is implemented by using special
8991 subsections @code{.text.hot} for most frequently executed functions and
8992 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
8993 the linker so object file format must support named sections and linker must
8994 place them in a reasonable way.
8995
8996 Also profile feedback must be available to make this option effective. See
8997 @option{-fprofile-arcs} for details.
8998
8999 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9000
9001 @item -fstrict-aliasing
9002 @opindex fstrict-aliasing
9003 Allow the compiler to assume the strictest aliasing rules applicable to
9004 the language being compiled. For C (and C++), this activates
9005 optimizations based on the type of expressions. In particular, an
9006 object of one type is assumed never to reside at the same address as an
9007 object of a different type, unless the types are almost the same. For
9008 example, an @code{unsigned int} can alias an @code{int}, but not a
9009 @code{void*} or a @code{double}. A character type may alias any other
9010 type.
9011
9012 @anchor{Type-punning}Pay special attention to code like this:
9013 @smallexample
9014 union a_union @{
9015 int i;
9016 double d;
9017 @};
9018
9019 int f() @{
9020 union a_union t;
9021 t.d = 3.0;
9022 return t.i;
9023 @}
9024 @end smallexample
9025 The practice of reading from a different union member than the one most
9026 recently written to (called ``type-punning'') is common. Even with
9027 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9028 is accessed through the union type. So, the code above works as
9029 expected. @xref{Structures unions enumerations and bit-fields
9030 implementation}. However, this code might not:
9031 @smallexample
9032 int f() @{
9033 union a_union t;
9034 int* ip;
9035 t.d = 3.0;
9036 ip = &t.i;
9037 return *ip;
9038 @}
9039 @end smallexample
9040
9041 Similarly, access by taking the address, casting the resulting pointer
9042 and dereferencing the result has undefined behavior, even if the cast
9043 uses a union type, e.g.:
9044 @smallexample
9045 int f() @{
9046 double d = 3.0;
9047 return ((union a_union *) &d)->i;
9048 @}
9049 @end smallexample
9050
9051 The @option{-fstrict-aliasing} option is enabled at levels
9052 @option{-O2}, @option{-O3}, @option{-Os}.
9053
9054 @item -falign-functions
9055 @itemx -falign-functions=@var{n}
9056 @opindex falign-functions
9057 Align the start of functions to the next power-of-two greater than
9058 @var{n}, skipping up to @var{n} bytes. For instance,
9059 @option{-falign-functions=32} aligns functions to the next 32-byte
9060 boundary, but @option{-falign-functions=24} aligns to the next
9061 32-byte boundary only if this can be done by skipping 23 bytes or less.
9062
9063 @option{-fno-align-functions} and @option{-falign-functions=1} are
9064 equivalent and mean that functions are not aligned.
9065
9066 Some assemblers only support this flag when @var{n} is a power of two;
9067 in that case, it is rounded up.
9068
9069 If @var{n} is not specified or is zero, use a machine-dependent default.
9070
9071 Enabled at levels @option{-O2}, @option{-O3}.
9072
9073 @item -flimit-function-alignment
9074 If this option is enabled, the compiler tries to avoid unnecessarily
9075 overaligning functions. It attempts to instruct the assembler to align
9076 by the amount specified by @option{-falign-functions}, but not to
9077 skip more bytes than the size of the function.
9078
9079 @item -falign-labels
9080 @itemx -falign-labels=@var{n}
9081 @opindex falign-labels
9082 Align all branch targets to a power-of-two boundary, skipping up to
9083 @var{n} bytes like @option{-falign-functions}. This option can easily
9084 make code slower, because it must insert dummy operations for when the
9085 branch target is reached in the usual flow of the code.
9086
9087 @option{-fno-align-labels} and @option{-falign-labels=1} are
9088 equivalent and mean that labels are not aligned.
9089
9090 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9091 are greater than this value, then their values are used instead.
9092
9093 If @var{n} is not specified or is zero, use a machine-dependent default
9094 which is very likely to be @samp{1}, meaning no alignment.
9095
9096 Enabled at levels @option{-O2}, @option{-O3}.
9097
9098 @item -falign-loops
9099 @itemx -falign-loops=@var{n}
9100 @opindex falign-loops
9101 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
9102 like @option{-falign-functions}. If the loops are
9103 executed many times, this makes up for any execution of the dummy
9104 operations.
9105
9106 @option{-fno-align-loops} and @option{-falign-loops=1} are
9107 equivalent and mean that loops are not aligned.
9108
9109 If @var{n} is not specified or is zero, use a machine-dependent default.
9110
9111 Enabled at levels @option{-O2}, @option{-O3}.
9112
9113 @item -falign-jumps
9114 @itemx -falign-jumps=@var{n}
9115 @opindex falign-jumps
9116 Align branch targets to a power-of-two boundary, for branch targets
9117 where the targets can only be reached by jumping, skipping up to @var{n}
9118 bytes like @option{-falign-functions}. In this case, no dummy operations
9119 need be executed.
9120
9121 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9122 equivalent and mean that loops are not aligned.
9123
9124 If @var{n} is not specified or is zero, use a machine-dependent default.
9125
9126 Enabled at levels @option{-O2}, @option{-O3}.
9127
9128 @item -funit-at-a-time
9129 @opindex funit-at-a-time
9130 This option is left for compatibility reasons. @option{-funit-at-a-time}
9131 has no effect, while @option{-fno-unit-at-a-time} implies
9132 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9133
9134 Enabled by default.
9135
9136 @item -fno-toplevel-reorder
9137 @opindex fno-toplevel-reorder
9138 Do not reorder top-level functions, variables, and @code{asm}
9139 statements. Output them in the same order that they appear in the
9140 input file. When this option is used, unreferenced static variables
9141 are not removed. This option is intended to support existing code
9142 that relies on a particular ordering. For new code, it is better to
9143 use attributes when possible.
9144
9145 Enabled at level @option{-O0}. When disabled explicitly, it also implies
9146 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
9147 targets.
9148
9149 @item -fweb
9150 @opindex fweb
9151 Constructs webs as commonly used for register allocation purposes and assign
9152 each web individual pseudo register. This allows the register allocation pass
9153 to operate on pseudos directly, but also strengthens several other optimization
9154 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9155 however, make debugging impossible, since variables no longer stay in a
9156 ``home register''.
9157
9158 Enabled by default with @option{-funroll-loops}.
9159
9160 @item -fwhole-program
9161 @opindex fwhole-program
9162 Assume that the current compilation unit represents the whole program being
9163 compiled. All public functions and variables with the exception of @code{main}
9164 and those merged by attribute @code{externally_visible} become static functions
9165 and in effect are optimized more aggressively by interprocedural optimizers.
9166
9167 This option should not be used in combination with @option{-flto}.
9168 Instead relying on a linker plugin should provide safer and more precise
9169 information.
9170
9171 @item -flto[=@var{n}]
9172 @opindex flto
9173 This option runs the standard link-time optimizer. When invoked
9174 with source code, it generates GIMPLE (one of GCC's internal
9175 representations) and writes it to special ELF sections in the object
9176 file. When the object files are linked together, all the function
9177 bodies are read from these ELF sections and instantiated as if they
9178 had been part of the same translation unit.
9179
9180 To use the link-time optimizer, @option{-flto} and optimization
9181 options should be specified at compile time and during the final link.
9182 It is recommended that you compile all the files participating in the
9183 same link with the same options and also specify those options at
9184 link time.
9185 For example:
9186
9187 @smallexample
9188 gcc -c -O2 -flto foo.c
9189 gcc -c -O2 -flto bar.c
9190 gcc -o myprog -flto -O2 foo.o bar.o
9191 @end smallexample
9192
9193 The first two invocations to GCC save a bytecode representation
9194 of GIMPLE into special ELF sections inside @file{foo.o} and
9195 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9196 @file{foo.o} and @file{bar.o}, merges the two files into a single
9197 internal image, and compiles the result as usual. Since both
9198 @file{foo.o} and @file{bar.o} are merged into a single image, this
9199 causes all the interprocedural analyses and optimizations in GCC to
9200 work across the two files as if they were a single one. This means,
9201 for example, that the inliner is able to inline functions in
9202 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9203
9204 Another (simpler) way to enable link-time optimization is:
9205
9206 @smallexample
9207 gcc -o myprog -flto -O2 foo.c bar.c
9208 @end smallexample
9209
9210 The above generates bytecode for @file{foo.c} and @file{bar.c},
9211 merges them together into a single GIMPLE representation and optimizes
9212 them as usual to produce @file{myprog}.
9213
9214 The only important thing to keep in mind is that to enable link-time
9215 optimizations you need to use the GCC driver to perform the link step.
9216 GCC then automatically performs link-time optimization if any of the
9217 objects involved were compiled with the @option{-flto} command-line option.
9218 You generally
9219 should specify the optimization options to be used for link-time
9220 optimization though GCC tries to be clever at guessing an
9221 optimization level to use from the options used at compile time
9222 if you fail to specify one at link time. You can always override
9223 the automatic decision to do link-time optimization
9224 by passing @option{-fno-lto} to the link command.
9225
9226 To make whole program optimization effective, it is necessary to make
9227 certain whole program assumptions. The compiler needs to know
9228 what functions and variables can be accessed by libraries and runtime
9229 outside of the link-time optimized unit. When supported by the linker,
9230 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9231 to the compiler about used and externally visible symbols. When
9232 the linker plugin is not available, @option{-fwhole-program} should be
9233 used to allow the compiler to make these assumptions, which leads
9234 to more aggressive optimization decisions.
9235
9236 When @option{-fuse-linker-plugin} is not enabled, when a file is
9237 compiled with @option{-flto}, the generated object file is larger than
9238 a regular object file because it contains GIMPLE bytecodes and the usual
9239 final code (see @option{-ffat-lto-objects}. This means that
9240 object files with LTO information can be linked as normal object
9241 files; if @option{-fno-lto} is passed to the linker, no
9242 interprocedural optimizations are applied. Note that when
9243 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9244 but you cannot perform a regular, non-LTO link on them.
9245
9246 Additionally, the optimization flags used to compile individual files
9247 are not necessarily related to those used at link time. For instance,
9248
9249 @smallexample
9250 gcc -c -O0 -ffat-lto-objects -flto foo.c
9251 gcc -c -O0 -ffat-lto-objects -flto bar.c
9252 gcc -o myprog -O3 foo.o bar.o
9253 @end smallexample
9254
9255 This produces individual object files with unoptimized assembler
9256 code, but the resulting binary @file{myprog} is optimized at
9257 @option{-O3}. If, instead, the final binary is generated with
9258 @option{-fno-lto}, then @file{myprog} is not optimized.
9259
9260 When producing the final binary, GCC only
9261 applies link-time optimizations to those files that contain bytecode.
9262 Therefore, you can mix and match object files and libraries with
9263 GIMPLE bytecodes and final object code. GCC automatically selects
9264 which files to optimize in LTO mode and which files to link without
9265 further processing.
9266
9267 There are some code generation flags preserved by GCC when
9268 generating bytecodes, as they need to be used during the final link
9269 stage. Generally options specified at link time override those
9270 specified at compile time.
9271
9272 If you do not specify an optimization level option @option{-O} at
9273 link time, then GCC uses the highest optimization level
9274 used when compiling the object files.
9275
9276 Currently, the following options and their settings are taken from
9277 the first object file that explicitly specifies them:
9278 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9279 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9280 and all the @option{-m} target flags.
9281
9282 Certain ABI-changing flags are required to match in all compilation units,
9283 and trying to override this at link time with a conflicting value
9284 is ignored. This includes options such as @option{-freg-struct-return}
9285 and @option{-fpcc-struct-return}.
9286
9287 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9288 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9289 are passed through to the link stage and merged conservatively for
9290 conflicting translation units. Specifically
9291 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9292 precedence; and for example @option{-ffp-contract=off} takes precedence
9293 over @option{-ffp-contract=fast}. You can override them at link time.
9294
9295 If LTO encounters objects with C linkage declared with incompatible
9296 types in separate translation units to be linked together (undefined
9297 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9298 issued. The behavior is still undefined at run time. Similar
9299 diagnostics may be raised for other languages.
9300
9301 Another feature of LTO is that it is possible to apply interprocedural
9302 optimizations on files written in different languages:
9303
9304 @smallexample
9305 gcc -c -flto foo.c
9306 g++ -c -flto bar.cc
9307 gfortran -c -flto baz.f90
9308 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9309 @end smallexample
9310
9311 Notice that the final link is done with @command{g++} to get the C++
9312 runtime libraries and @option{-lgfortran} is added to get the Fortran
9313 runtime libraries. In general, when mixing languages in LTO mode, you
9314 should use the same link command options as when mixing languages in a
9315 regular (non-LTO) compilation.
9316
9317 If object files containing GIMPLE bytecode are stored in a library archive, say
9318 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9319 are using a linker with plugin support. To create static libraries suitable
9320 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9321 and @command{ranlib};
9322 to show the symbols of object files with GIMPLE bytecode, use
9323 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9324 and @command{nm} have been compiled with plugin support. At link time, use the the
9325 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9326 the LTO optimization process:
9327
9328 @smallexample
9329 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9330 @end smallexample
9331
9332 With the linker plugin enabled, the linker extracts the needed
9333 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9334 to make them part of the aggregated GIMPLE image to be optimized.
9335
9336 If you are not using a linker with plugin support and/or do not
9337 enable the linker plugin, then the objects inside @file{libfoo.a}
9338 are extracted and linked as usual, but they do not participate
9339 in the LTO optimization process. In order to make a static library suitable
9340 for both LTO optimization and usual linkage, compile its object files with
9341 @option{-flto} @option{-ffat-lto-objects}.
9342
9343 Link-time optimizations do not require the presence of the whole program to
9344 operate. If the program does not require any symbols to be exported, it is
9345 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9346 the interprocedural optimizers to use more aggressive assumptions which may
9347 lead to improved optimization opportunities.
9348 Use of @option{-fwhole-program} is not needed when linker plugin is
9349 active (see @option{-fuse-linker-plugin}).
9350
9351 The current implementation of LTO makes no
9352 attempt to generate bytecode that is portable between different
9353 types of hosts. The bytecode files are versioned and there is a
9354 strict version check, so bytecode files generated in one version of
9355 GCC do not work with an older or newer version of GCC.
9356
9357 Link-time optimization does not work well with generation of debugging
9358 information. Combining @option{-flto} with
9359 @option{-g} is currently experimental and expected to produce unexpected
9360 results.
9361
9362 If you specify the optional @var{n}, the optimization and code
9363 generation done at link time is executed in parallel using @var{n}
9364 parallel jobs by utilizing an installed @command{make} program. The
9365 environment variable @env{MAKE} may be used to override the program
9366 used. The default value for @var{n} is 1.
9367
9368 You can also specify @option{-flto=jobserver} to use GNU make's
9369 job server mode to determine the number of parallel jobs. This
9370 is useful when the Makefile calling GCC is already executing in parallel.
9371 You must prepend a @samp{+} to the command recipe in the parent Makefile
9372 for this to work. This option likely only works if @env{MAKE} is
9373 GNU make.
9374
9375 @item -flto-partition=@var{alg}
9376 @opindex flto-partition
9377 Specify the partitioning algorithm used by the link-time optimizer.
9378 The value is either @samp{1to1} to specify a partitioning mirroring
9379 the original source files or @samp{balanced} to specify partitioning
9380 into equally sized chunks (whenever possible) or @samp{max} to create
9381 new partition for every symbol where possible. Specifying @samp{none}
9382 as an algorithm disables partitioning and streaming completely.
9383 The default value is @samp{balanced}. While @samp{1to1} can be used
9384 as an workaround for various code ordering issues, the @samp{max}
9385 partitioning is intended for internal testing only.
9386 The value @samp{one} specifies that exactly one partition should be
9387 used while the value @samp{none} bypasses partitioning and executes
9388 the link-time optimization step directly from the WPA phase.
9389
9390 @item -flto-odr-type-merging
9391 @opindex flto-odr-type-merging
9392 Enable streaming of mangled types names of C++ types and their unification
9393 at link time. This increases size of LTO object files, but enables
9394 diagnostics about One Definition Rule violations.
9395
9396 @item -flto-compression-level=@var{n}
9397 @opindex flto-compression-level
9398 This option specifies the level of compression used for intermediate
9399 language written to LTO object files, and is only meaningful in
9400 conjunction with LTO mode (@option{-flto}). Valid
9401 values are 0 (no compression) to 9 (maximum compression). Values
9402 outside this range are clamped to either 0 or 9. If the option is not
9403 given, a default balanced compression setting is used.
9404
9405 @item -fuse-linker-plugin
9406 @opindex fuse-linker-plugin
9407 Enables the use of a linker plugin during link-time optimization. This
9408 option relies on plugin support in the linker, which is available in gold
9409 or in GNU ld 2.21 or newer.
9410
9411 This option enables the extraction of object files with GIMPLE bytecode out
9412 of library archives. This improves the quality of optimization by exposing
9413 more code to the link-time optimizer. This information specifies what
9414 symbols can be accessed externally (by non-LTO object or during dynamic
9415 linking). Resulting code quality improvements on binaries (and shared
9416 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9417 See @option{-flto} for a description of the effect of this flag and how to
9418 use it.
9419
9420 This option is enabled by default when LTO support in GCC is enabled
9421 and GCC was configured for use with
9422 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9423
9424 @item -ffat-lto-objects
9425 @opindex ffat-lto-objects
9426 Fat LTO objects are object files that contain both the intermediate language
9427 and the object code. This makes them usable for both LTO linking and normal
9428 linking. This option is effective only when compiling with @option{-flto}
9429 and is ignored at link time.
9430
9431 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9432 requires the complete toolchain to be aware of LTO. It requires a linker with
9433 linker plugin support for basic functionality. Additionally,
9434 @command{nm}, @command{ar} and @command{ranlib}
9435 need to support linker plugins to allow a full-featured build environment
9436 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9437 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9438 to these tools. With non fat LTO makefiles need to be modified to use them.
9439
9440 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9441 support.
9442
9443 @item -fcompare-elim
9444 @opindex fcompare-elim
9445 After register allocation and post-register allocation instruction splitting,
9446 identify arithmetic instructions that compute processor flags similar to a
9447 comparison operation based on that arithmetic. If possible, eliminate the
9448 explicit comparison operation.
9449
9450 This pass only applies to certain targets that cannot explicitly represent
9451 the comparison operation before register allocation is complete.
9452
9453 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9454
9455 @item -fcprop-registers
9456 @opindex fcprop-registers
9457 After register allocation and post-register allocation instruction splitting,
9458 perform a copy-propagation pass to try to reduce scheduling dependencies
9459 and occasionally eliminate the copy.
9460
9461 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9462
9463 @item -fprofile-correction
9464 @opindex fprofile-correction
9465 Profiles collected using an instrumented binary for multi-threaded programs may
9466 be inconsistent due to missed counter updates. When this option is specified,
9467 GCC uses heuristics to correct or smooth out such inconsistencies. By
9468 default, GCC emits an error message when an inconsistent profile is detected.
9469
9470 @item -fprofile-use
9471 @itemx -fprofile-use=@var{path}
9472 @opindex fprofile-use
9473 Enable profile feedback-directed optimizations,
9474 and the following optimizations
9475 which are generally profitable only with profile feedback available:
9476 @option{-fbranch-probabilities}, @option{-fvpt},
9477 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9478 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9479
9480 Before you can use this option, you must first generate profiling information.
9481 @xref{Instrumentation Options}, for information about the
9482 @option{-fprofile-generate} option.
9483
9484 By default, GCC emits an error message if the feedback profiles do not
9485 match the source code. This error can be turned into a warning by using
9486 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9487 code.
9488
9489 If @var{path} is specified, GCC looks at the @var{path} to find
9490 the profile feedback data files. See @option{-fprofile-dir}.
9491
9492 @item -fauto-profile
9493 @itemx -fauto-profile=@var{path}
9494 @opindex fauto-profile
9495 Enable sampling-based feedback-directed optimizations,
9496 and the following optimizations
9497 which are generally profitable only with profile feedback available:
9498 @option{-fbranch-probabilities}, @option{-fvpt},
9499 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9500 @option{-ftree-vectorize},
9501 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9502 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9503 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9504
9505 @var{path} is the name of a file containing AutoFDO profile information.
9506 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9507
9508 Producing an AutoFDO profile data file requires running your program
9509 with the @command{perf} utility on a supported GNU/Linux target system.
9510 For more information, see @uref{https://perf.wiki.kernel.org/}.
9511
9512 E.g.
9513 @smallexample
9514 perf record -e br_inst_retired:near_taken -b -o perf.data \
9515 -- your_program
9516 @end smallexample
9517
9518 Then use the @command{create_gcov} tool to convert the raw profile data
9519 to a format that can be used by GCC.@ You must also supply the
9520 unstripped binary for your program to this tool.
9521 See @uref{https://github.com/google/autofdo}.
9522
9523 E.g.
9524 @smallexample
9525 create_gcov --binary=your_program.unstripped --profile=perf.data \
9526 --gcov=profile.afdo
9527 @end smallexample
9528 @end table
9529
9530 The following options control compiler behavior regarding floating-point
9531 arithmetic. These options trade off between speed and
9532 correctness. All must be specifically enabled.
9533
9534 @table @gcctabopt
9535 @item -ffloat-store
9536 @opindex ffloat-store
9537 Do not store floating-point variables in registers, and inhibit other
9538 options that might change whether a floating-point value is taken from a
9539 register or memory.
9540
9541 @cindex floating-point precision
9542 This option prevents undesirable excess precision on machines such as
9543 the 68000 where the floating registers (of the 68881) keep more
9544 precision than a @code{double} is supposed to have. Similarly for the
9545 x86 architecture. For most programs, the excess precision does only
9546 good, but a few programs rely on the precise definition of IEEE floating
9547 point. Use @option{-ffloat-store} for such programs, after modifying
9548 them to store all pertinent intermediate computations into variables.
9549
9550 @item -fexcess-precision=@var{style}
9551 @opindex fexcess-precision
9552 This option allows further control over excess precision on machines
9553 where floating-point operations occur in a format with more precision or
9554 range than the IEEE standard and interchange floating-point types. By
9555 default, @option{-fexcess-precision=fast} is in effect; this means that
9556 operations may be carried out in a wider precision than the types specified
9557 in the source if that would result in faster code, and it is unpredictable
9558 when rounding to the types specified in the source code takes place.
9559 When compiling C, if @option{-fexcess-precision=standard} is specified then
9560 excess precision follows the rules specified in ISO C99; in particular,
9561 both casts and assignments cause values to be rounded to their
9562 semantic types (whereas @option{-ffloat-store} only affects
9563 assignments). This option is enabled by default for C if a strict
9564 conformance option such as @option{-std=c99} is used.
9565 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
9566 regardless of whether a strict conformance option is used.
9567
9568 @opindex mfpmath
9569 @option{-fexcess-precision=standard} is not implemented for languages
9570 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
9571 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9572 semantics apply without excess precision, and in the latter, rounding
9573 is unpredictable.
9574
9575 @item -ffast-math
9576 @opindex ffast-math
9577 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9578 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9579 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
9580 @option{-fexcess-precision=fast}.
9581
9582 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9583
9584 This option is not turned on by any @option{-O} option besides
9585 @option{-Ofast} since it can result in incorrect output for programs
9586 that depend on an exact implementation of IEEE or ISO rules/specifications
9587 for math functions. It may, however, yield faster code for programs
9588 that do not require the guarantees of these specifications.
9589
9590 @item -fno-math-errno
9591 @opindex fno-math-errno
9592 Do not set @code{errno} after calling math functions that are executed
9593 with a single instruction, e.g., @code{sqrt}. A program that relies on
9594 IEEE exceptions for math error handling may want to use this flag
9595 for speed while maintaining IEEE arithmetic compatibility.
9596
9597 This option is not turned on by any @option{-O} option since
9598 it can result in incorrect output for programs that depend on
9599 an exact implementation of IEEE or ISO rules/specifications for
9600 math functions. It may, however, yield faster code for programs
9601 that do not require the guarantees of these specifications.
9602
9603 The default is @option{-fmath-errno}.
9604
9605 On Darwin systems, the math library never sets @code{errno}. There is
9606 therefore no reason for the compiler to consider the possibility that
9607 it might, and @option{-fno-math-errno} is the default.
9608
9609 @item -funsafe-math-optimizations
9610 @opindex funsafe-math-optimizations
9611
9612 Allow optimizations for floating-point arithmetic that (a) assume
9613 that arguments and results are valid and (b) may violate IEEE or
9614 ANSI standards. When used at link time, it may include libraries
9615 or startup files that change the default FPU control word or other
9616 similar optimizations.
9617
9618 This option is not turned on by any @option{-O} option since
9619 it can result in incorrect output for programs that depend on
9620 an exact implementation of IEEE or ISO rules/specifications for
9621 math functions. It may, however, yield faster code for programs
9622 that do not require the guarantees of these specifications.
9623 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9624 @option{-fassociative-math} and @option{-freciprocal-math}.
9625
9626 The default is @option{-fno-unsafe-math-optimizations}.
9627
9628 @item -fassociative-math
9629 @opindex fassociative-math
9630
9631 Allow re-association of operands in series of floating-point operations.
9632 This violates the ISO C and C++ language standard by possibly changing
9633 computation result. NOTE: re-ordering may change the sign of zero as
9634 well as ignore NaNs and inhibit or create underflow or overflow (and
9635 thus cannot be used on code that relies on rounding behavior like
9636 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9637 and thus may not be used when ordered comparisons are required.
9638 This option requires that both @option{-fno-signed-zeros} and
9639 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9640 much sense with @option{-frounding-math}. For Fortran the option
9641 is automatically enabled when both @option{-fno-signed-zeros} and
9642 @option{-fno-trapping-math} are in effect.
9643
9644 The default is @option{-fno-associative-math}.
9645
9646 @item -freciprocal-math
9647 @opindex freciprocal-math
9648
9649 Allow the reciprocal of a value to be used instead of dividing by
9650 the value if this enables optimizations. For example @code{x / y}
9651 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9652 is subject to common subexpression elimination. Note that this loses
9653 precision and increases the number of flops operating on the value.
9654
9655 The default is @option{-fno-reciprocal-math}.
9656
9657 @item -ffinite-math-only
9658 @opindex ffinite-math-only
9659 Allow optimizations for floating-point arithmetic that assume
9660 that arguments and results are not NaNs or +-Infs.
9661
9662 This option is not turned on by any @option{-O} option since
9663 it can result in incorrect output for programs that depend on
9664 an exact implementation of IEEE or ISO rules/specifications for
9665 math functions. It may, however, yield faster code for programs
9666 that do not require the guarantees of these specifications.
9667
9668 The default is @option{-fno-finite-math-only}.
9669
9670 @item -fno-signed-zeros
9671 @opindex fno-signed-zeros
9672 Allow optimizations for floating-point arithmetic that ignore the
9673 signedness of zero. IEEE arithmetic specifies the behavior of
9674 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9675 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9676 This option implies that the sign of a zero result isn't significant.
9677
9678 The default is @option{-fsigned-zeros}.
9679
9680 @item -fno-trapping-math
9681 @opindex fno-trapping-math
9682 Compile code assuming that floating-point operations cannot generate
9683 user-visible traps. These traps include division by zero, overflow,
9684 underflow, inexact result and invalid operation. This option requires
9685 that @option{-fno-signaling-nans} be in effect. Setting this option may
9686 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9687
9688 This option should never be turned on by any @option{-O} option since
9689 it can result in incorrect output for programs that depend on
9690 an exact implementation of IEEE or ISO rules/specifications for
9691 math functions.
9692
9693 The default is @option{-ftrapping-math}.
9694
9695 @item -frounding-math
9696 @opindex frounding-math
9697 Disable transformations and optimizations that assume default floating-point
9698 rounding behavior. This is round-to-zero for all floating point
9699 to integer conversions, and round-to-nearest for all other arithmetic
9700 truncations. This option should be specified for programs that change
9701 the FP rounding mode dynamically, or that may be executed with a
9702 non-default rounding mode. This option disables constant folding of
9703 floating-point expressions at compile time (which may be affected by
9704 rounding mode) and arithmetic transformations that are unsafe in the
9705 presence of sign-dependent rounding modes.
9706
9707 The default is @option{-fno-rounding-math}.
9708
9709 This option is experimental and does not currently guarantee to
9710 disable all GCC optimizations that are affected by rounding mode.
9711 Future versions of GCC may provide finer control of this setting
9712 using C99's @code{FENV_ACCESS} pragma. This command-line option
9713 will be used to specify the default state for @code{FENV_ACCESS}.
9714
9715 @item -fsignaling-nans
9716 @opindex fsignaling-nans
9717 Compile code assuming that IEEE signaling NaNs may generate user-visible
9718 traps during floating-point operations. Setting this option disables
9719 optimizations that may change the number of exceptions visible with
9720 signaling NaNs. This option implies @option{-ftrapping-math}.
9721
9722 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9723 be defined.
9724
9725 The default is @option{-fno-signaling-nans}.
9726
9727 This option is experimental and does not currently guarantee to
9728 disable all GCC optimizations that affect signaling NaN behavior.
9729
9730 @item -fno-fp-int-builtin-inexact
9731 @opindex fno-fp-int-builtin-inexact
9732 Do not allow the built-in functions @code{ceil}, @code{floor},
9733 @code{round} and @code{trunc}, and their @code{float} and @code{long
9734 double} variants, to generate code that raises the ``inexact''
9735 floating-point exception for noninteger arguments. ISO C99 and C11
9736 allow these functions to raise the ``inexact'' exception, but ISO/IEC
9737 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
9738 functions to do so.
9739
9740 The default is @option{-ffp-int-builtin-inexact}, allowing the
9741 exception to be raised. This option does nothing unless
9742 @option{-ftrapping-math} is in effect.
9743
9744 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
9745 generate a call to a library function then the ``inexact'' exception
9746 may be raised if the library implementation does not follow TS 18661.
9747
9748 @item -fsingle-precision-constant
9749 @opindex fsingle-precision-constant
9750 Treat floating-point constants as single precision instead of
9751 implicitly converting them to double-precision constants.
9752
9753 @item -fcx-limited-range
9754 @opindex fcx-limited-range
9755 When enabled, this option states that a range reduction step is not
9756 needed when performing complex division. Also, there is no checking
9757 whether the result of a complex multiplication or division is @code{NaN
9758 + I*NaN}, with an attempt to rescue the situation in that case. The
9759 default is @option{-fno-cx-limited-range}, but is enabled by
9760 @option{-ffast-math}.
9761
9762 This option controls the default setting of the ISO C99
9763 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9764 all languages.
9765
9766 @item -fcx-fortran-rules
9767 @opindex fcx-fortran-rules
9768 Complex multiplication and division follow Fortran rules. Range
9769 reduction is done as part of complex division, but there is no checking
9770 whether the result of a complex multiplication or division is @code{NaN
9771 + I*NaN}, with an attempt to rescue the situation in that case.
9772
9773 The default is @option{-fno-cx-fortran-rules}.
9774
9775 @end table
9776
9777 The following options control optimizations that may improve
9778 performance, but are not enabled by any @option{-O} options. This
9779 section includes experimental options that may produce broken code.
9780
9781 @table @gcctabopt
9782 @item -fbranch-probabilities
9783 @opindex fbranch-probabilities
9784 After running a program compiled with @option{-fprofile-arcs}
9785 (@pxref{Instrumentation Options}),
9786 you can compile it a second time using
9787 @option{-fbranch-probabilities}, to improve optimizations based on
9788 the number of times each branch was taken. When a program
9789 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9790 counts to a file called @file{@var{sourcename}.gcda} for each source
9791 file. The information in this data file is very dependent on the
9792 structure of the generated code, so you must use the same source code
9793 and the same optimization options for both compilations.
9794
9795 With @option{-fbranch-probabilities}, GCC puts a
9796 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9797 These can be used to improve optimization. Currently, they are only
9798 used in one place: in @file{reorg.c}, instead of guessing which path a
9799 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9800 exactly determine which path is taken more often.
9801
9802 @item -fprofile-values
9803 @opindex fprofile-values
9804 If combined with @option{-fprofile-arcs}, it adds code so that some
9805 data about values of expressions in the program is gathered.
9806
9807 With @option{-fbranch-probabilities}, it reads back the data gathered
9808 from profiling values of expressions for usage in optimizations.
9809
9810 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9811
9812 @item -fprofile-reorder-functions
9813 @opindex fprofile-reorder-functions
9814 Function reordering based on profile instrumentation collects
9815 first time of execution of a function and orders these functions
9816 in ascending order.
9817
9818 Enabled with @option{-fprofile-use}.
9819
9820 @item -fvpt
9821 @opindex fvpt
9822 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9823 to add code to gather information about values of expressions.
9824
9825 With @option{-fbranch-probabilities}, it reads back the data gathered
9826 and actually performs the optimizations based on them.
9827 Currently the optimizations include specialization of division operations
9828 using the knowledge about the value of the denominator.
9829
9830 @item -frename-registers
9831 @opindex frename-registers
9832 Attempt to avoid false dependencies in scheduled code by making use
9833 of registers left over after register allocation. This optimization
9834 most benefits processors with lots of registers. Depending on the
9835 debug information format adopted by the target, however, it can
9836 make debugging impossible, since variables no longer stay in
9837 a ``home register''.
9838
9839 Enabled by default with @option{-funroll-loops}.
9840
9841 @item -fschedule-fusion
9842 @opindex fschedule-fusion
9843 Performs a target dependent pass over the instruction stream to schedule
9844 instructions of same type together because target machine can execute them
9845 more efficiently if they are adjacent to each other in the instruction flow.
9846
9847 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9848
9849 @item -ftracer
9850 @opindex ftracer
9851 Perform tail duplication to enlarge superblock size. This transformation
9852 simplifies the control flow of the function allowing other optimizations to do
9853 a better job.
9854
9855 Enabled with @option{-fprofile-use}.
9856
9857 @item -funroll-loops
9858 @opindex funroll-loops
9859 Unroll loops whose number of iterations can be determined at compile time or
9860 upon entry to the loop. @option{-funroll-loops} implies
9861 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9862 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9863 a small constant number of iterations). This option makes code larger, and may
9864 or may not make it run faster.
9865
9866 Enabled with @option{-fprofile-use}.
9867
9868 @item -funroll-all-loops
9869 @opindex funroll-all-loops
9870 Unroll all loops, even if their number of iterations is uncertain when
9871 the loop is entered. This usually makes programs run more slowly.
9872 @option{-funroll-all-loops} implies the same options as
9873 @option{-funroll-loops}.
9874
9875 @item -fpeel-loops
9876 @opindex fpeel-loops
9877 Peels loops for which there is enough information that they do not
9878 roll much (from profile feedback or static analysis). It also turns on
9879 complete loop peeling (i.e.@: complete removal of loops with small constant
9880 number of iterations).
9881
9882 Enabled with @option{-O3} and/or @option{-fprofile-use}.
9883
9884 @item -fmove-loop-invariants
9885 @opindex fmove-loop-invariants
9886 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
9887 at level @option{-O1}
9888
9889 @item -fsplit-loops
9890 @opindex fsplit-loops
9891 Split a loop into two if it contains a condition that's always true
9892 for one side of the iteration space and false for the other.
9893
9894 @item -funswitch-loops
9895 @opindex funswitch-loops
9896 Move branches with loop invariant conditions out of the loop, with duplicates
9897 of the loop on both branches (modified according to result of the condition).
9898
9899 @item -floop-unroll-and-jam
9900 @opindex floop-unroll-and-jam
9901 Apply unroll and jam transformations on feasible loops. In a loop
9902 nest this unrolls the outer loop by some factor and fuses the resulting
9903 multiple inner loops.
9904
9905 @item -ffunction-sections
9906 @itemx -fdata-sections
9907 @opindex ffunction-sections
9908 @opindex fdata-sections
9909 Place each function or data item into its own section in the output
9910 file if the target supports arbitrary sections. The name of the
9911 function or the name of the data item determines the section's name
9912 in the output file.
9913
9914 Use these options on systems where the linker can perform optimizations to
9915 improve locality of reference in the instruction space. Most systems using the
9916 ELF object format have linkers with such optimizations. On AIX, the linker
9917 rearranges sections (CSECTs) based on the call graph. The performance impact
9918 varies.
9919
9920 Together with a linker garbage collection (linker @option{--gc-sections}
9921 option) these options may lead to smaller statically-linked executables (after
9922 stripping).
9923
9924 On ELF/DWARF systems these options do not degenerate the quality of the debug
9925 information. There could be issues with other object files/debug info formats.
9926
9927 Only use these options when there are significant benefits from doing so. When
9928 you specify these options, the assembler and linker create larger object and
9929 executable files and are also slower. These options affect code generation.
9930 They prevent optimizations by the compiler and assembler using relative
9931 locations inside a translation unit since the locations are unknown until
9932 link time. An example of such an optimization is relaxing calls to short call
9933 instructions.
9934
9935 @item -fbranch-target-load-optimize
9936 @opindex fbranch-target-load-optimize
9937 Perform branch target register load optimization before prologue / epilogue
9938 threading.
9939 The use of target registers can typically be exposed only during reload,
9940 thus hoisting loads out of loops and doing inter-block scheduling needs
9941 a separate optimization pass.
9942
9943 @item -fbranch-target-load-optimize2
9944 @opindex fbranch-target-load-optimize2
9945 Perform branch target register load optimization after prologue / epilogue
9946 threading.
9947
9948 @item -fbtr-bb-exclusive
9949 @opindex fbtr-bb-exclusive
9950 When performing branch target register load optimization, don't reuse
9951 branch target registers within any basic block.
9952
9953 @item -fstdarg-opt
9954 @opindex fstdarg-opt
9955 Optimize the prologue of variadic argument functions with respect to usage of
9956 those arguments.
9957
9958 @item -fsection-anchors
9959 @opindex fsection-anchors
9960 Try to reduce the number of symbolic address calculations by using
9961 shared ``anchor'' symbols to address nearby objects. This transformation
9962 can help to reduce the number of GOT entries and GOT accesses on some
9963 targets.
9964
9965 For example, the implementation of the following function @code{foo}:
9966
9967 @smallexample
9968 static int a, b, c;
9969 int foo (void) @{ return a + b + c; @}
9970 @end smallexample
9971
9972 @noindent
9973 usually calculates the addresses of all three variables, but if you
9974 compile it with @option{-fsection-anchors}, it accesses the variables
9975 from a common anchor point instead. The effect is similar to the
9976 following pseudocode (which isn't valid C):
9977
9978 @smallexample
9979 int foo (void)
9980 @{
9981 register int *xr = &x;
9982 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9983 @}
9984 @end smallexample
9985
9986 Not all targets support this option.
9987
9988 @item --param @var{name}=@var{value}
9989 @opindex param
9990 In some places, GCC uses various constants to control the amount of
9991 optimization that is done. For example, GCC does not inline functions
9992 that contain more than a certain number of instructions. You can
9993 control some of these constants on the command line using the
9994 @option{--param} option.
9995
9996 The names of specific parameters, and the meaning of the values, are
9997 tied to the internals of the compiler, and are subject to change
9998 without notice in future releases.
9999
10000 In each case, the @var{value} is an integer. The allowable choices for
10001 @var{name} are:
10002
10003 @table @gcctabopt
10004 @item predictable-branch-outcome
10005 When branch is predicted to be taken with probability lower than this threshold
10006 (in percent), then it is considered well predictable. The default is 10.
10007
10008 @item max-rtl-if-conversion-insns
10009 RTL if-conversion tries to remove conditional branches around a block and
10010 replace them with conditionally executed instructions. This parameter
10011 gives the maximum number of instructions in a block which should be
10012 considered for if-conversion. The default is 10, though the compiler will
10013 also use other heuristics to decide whether if-conversion is likely to be
10014 profitable.
10015
10016 @item max-rtl-if-conversion-predictable-cost
10017 @item max-rtl-if-conversion-unpredictable-cost
10018 RTL if-conversion will try to remove conditional branches around a block
10019 and replace them with conditionally executed instructions. These parameters
10020 give the maximum permissible cost for the sequence that would be generated
10021 by if-conversion depending on whether the branch is statically determined
10022 to be predictable or not. The units for this parameter are the same as
10023 those for the GCC internal seq_cost metric. The compiler will try to
10024 provide a reasonable default for this parameter using the BRANCH_COST
10025 target macro.
10026
10027 @item max-crossjump-edges
10028 The maximum number of incoming edges to consider for cross-jumping.
10029 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10030 the number of edges incoming to each block. Increasing values mean
10031 more aggressive optimization, making the compilation time increase with
10032 probably small improvement in executable size.
10033
10034 @item min-crossjump-insns
10035 The minimum number of instructions that must be matched at the end
10036 of two blocks before cross-jumping is performed on them. This
10037 value is ignored in the case where all instructions in the block being
10038 cross-jumped from are matched. The default value is 5.
10039
10040 @item max-grow-copy-bb-insns
10041 The maximum code size expansion factor when copying basic blocks
10042 instead of jumping. The expansion is relative to a jump instruction.
10043 The default value is 8.
10044
10045 @item max-goto-duplication-insns
10046 The maximum number of instructions to duplicate to a block that jumps
10047 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10048 passes, GCC factors computed gotos early in the compilation process,
10049 and unfactors them as late as possible. Only computed jumps at the
10050 end of a basic blocks with no more than max-goto-duplication-insns are
10051 unfactored. The default value is 8.
10052
10053 @item max-delay-slot-insn-search
10054 The maximum number of instructions to consider when looking for an
10055 instruction to fill a delay slot. If more than this arbitrary number of
10056 instructions are searched, the time savings from filling the delay slot
10057 are minimal, so stop searching. Increasing values mean more
10058 aggressive optimization, making the compilation time increase with probably
10059 small improvement in execution time.
10060
10061 @item max-delay-slot-live-search
10062 When trying to fill delay slots, the maximum number of instructions to
10063 consider when searching for a block with valid live register
10064 information. Increasing this arbitrarily chosen value means more
10065 aggressive optimization, increasing the compilation time. This parameter
10066 should be removed when the delay slot code is rewritten to maintain the
10067 control-flow graph.
10068
10069 @item max-gcse-memory
10070 The approximate maximum amount of memory that can be allocated in
10071 order to perform the global common subexpression elimination
10072 optimization. If more memory than specified is required, the
10073 optimization is not done.
10074
10075 @item max-gcse-insertion-ratio
10076 If the ratio of expression insertions to deletions is larger than this value
10077 for any expression, then RTL PRE inserts or removes the expression and thus
10078 leaves partially redundant computations in the instruction stream. The default value is 20.
10079
10080 @item max-pending-list-length
10081 The maximum number of pending dependencies scheduling allows
10082 before flushing the current state and starting over. Large functions
10083 with few branches or calls can create excessively large lists which
10084 needlessly consume memory and resources.
10085
10086 @item max-modulo-backtrack-attempts
10087 The maximum number of backtrack attempts the scheduler should make
10088 when modulo scheduling a loop. Larger values can exponentially increase
10089 compilation time.
10090
10091 @item max-inline-insns-single
10092 Several parameters control the tree inliner used in GCC@.
10093 This number sets the maximum number of instructions (counted in GCC's
10094 internal representation) in a single function that the tree inliner
10095 considers for inlining. This only affects functions declared
10096 inline and methods implemented in a class declaration (C++).
10097 The default value is 400.
10098
10099 @item max-inline-insns-auto
10100 When you use @option{-finline-functions} (included in @option{-O3}),
10101 a lot of functions that would otherwise not be considered for inlining
10102 by the compiler are investigated. To those functions, a different
10103 (more restrictive) limit compared to functions declared inline can
10104 be applied.
10105 The default value is 40.
10106
10107 @item inline-min-speedup
10108 When estimated performance improvement of caller + callee runtime exceeds this
10109 threshold (in percent), the function can be inlined regardless of the limit on
10110 @option{--param max-inline-insns-single} and @option{--param
10111 max-inline-insns-auto}.
10112
10113 @item large-function-insns
10114 The limit specifying really large functions. For functions larger than this
10115 limit after inlining, inlining is constrained by
10116 @option{--param large-function-growth}. This parameter is useful primarily
10117 to avoid extreme compilation time caused by non-linear algorithms used by the
10118 back end.
10119 The default value is 2700.
10120
10121 @item large-function-growth
10122 Specifies maximal growth of large function caused by inlining in percents.
10123 The default value is 100 which limits large function growth to 2.0 times
10124 the original size.
10125
10126 @item large-unit-insns
10127 The limit specifying large translation unit. Growth caused by inlining of
10128 units larger than this limit is limited by @option{--param inline-unit-growth}.
10129 For small units this might be too tight.
10130 For example, consider a unit consisting of function A
10131 that is inline and B that just calls A three times. If B is small relative to
10132 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10133 large units consisting of small inlineable functions, however, the overall unit
10134 growth limit is needed to avoid exponential explosion of code size. Thus for
10135 smaller units, the size is increased to @option{--param large-unit-insns}
10136 before applying @option{--param inline-unit-growth}. The default is 10000.
10137
10138 @item inline-unit-growth
10139 Specifies maximal overall growth of the compilation unit caused by inlining.
10140 The default value is 20 which limits unit growth to 1.2 times the original
10141 size. Cold functions (either marked cold via an attribute or by profile
10142 feedback) are not accounted into the unit size.
10143
10144 @item ipcp-unit-growth
10145 Specifies maximal overall growth of the compilation unit caused by
10146 interprocedural constant propagation. The default value is 10 which limits
10147 unit growth to 1.1 times the original size.
10148
10149 @item large-stack-frame
10150 The limit specifying large stack frames. While inlining the algorithm is trying
10151 to not grow past this limit too much. The default value is 256 bytes.
10152
10153 @item large-stack-frame-growth
10154 Specifies maximal growth of large stack frames caused by inlining in percents.
10155 The default value is 1000 which limits large stack frame growth to 11 times
10156 the original size.
10157
10158 @item max-inline-insns-recursive
10159 @itemx max-inline-insns-recursive-auto
10160 Specifies the maximum number of instructions an out-of-line copy of a
10161 self-recursive inline
10162 function can grow into by performing recursive inlining.
10163
10164 @option{--param max-inline-insns-recursive} applies to functions
10165 declared inline.
10166 For functions not declared inline, recursive inlining
10167 happens only when @option{-finline-functions} (included in @option{-O3}) is
10168 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
10169 default value is 450.
10170
10171 @item max-inline-recursive-depth
10172 @itemx max-inline-recursive-depth-auto
10173 Specifies the maximum recursion depth used for recursive inlining.
10174
10175 @option{--param max-inline-recursive-depth} applies to functions
10176 declared inline. For functions not declared inline, recursive inlining
10177 happens only when @option{-finline-functions} (included in @option{-O3}) is
10178 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
10179 default value is 8.
10180
10181 @item min-inline-recursive-probability
10182 Recursive inlining is profitable only for function having deep recursion
10183 in average and can hurt for function having little recursion depth by
10184 increasing the prologue size or complexity of function body to other
10185 optimizers.
10186
10187 When profile feedback is available (see @option{-fprofile-generate}) the actual
10188 recursion depth can be guessed from the probability that function recurses
10189 via a given call expression. This parameter limits inlining only to call
10190 expressions whose probability exceeds the given threshold (in percents).
10191 The default value is 10.
10192
10193 @item early-inlining-insns
10194 Specify growth that the early inliner can make. In effect it increases
10195 the amount of inlining for code having a large abstraction penalty.
10196 The default value is 14.
10197
10198 @item max-early-inliner-iterations
10199 Limit of iterations of the early inliner. This basically bounds
10200 the number of nested indirect calls the early inliner can resolve.
10201 Deeper chains are still handled by late inlining.
10202
10203 @item comdat-sharing-probability
10204 Probability (in percent) that C++ inline function with comdat visibility
10205 are shared across multiple compilation units. The default value is 20.
10206
10207 @item profile-func-internal-id
10208 A parameter to control whether to use function internal id in profile
10209 database lookup. If the value is 0, the compiler uses an id that
10210 is based on function assembler name and filename, which makes old profile
10211 data more tolerant to source changes such as function reordering etc.
10212 The default value is 0.
10213
10214 @item min-vect-loop-bound
10215 The minimum number of iterations under which loops are not vectorized
10216 when @option{-ftree-vectorize} is used. The number of iterations after
10217 vectorization needs to be greater than the value specified by this option
10218 to allow vectorization. The default value is 0.
10219
10220 @item gcse-cost-distance-ratio
10221 Scaling factor in calculation of maximum distance an expression
10222 can be moved by GCSE optimizations. This is currently supported only in the
10223 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10224 is with simple expressions, i.e., the expressions that have cost
10225 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10226 hoisting of simple expressions. The default value is 10.
10227
10228 @item gcse-unrestricted-cost
10229 Cost, roughly measured as the cost of a single typical machine
10230 instruction, at which GCSE optimizations do not constrain
10231 the distance an expression can travel. This is currently
10232 supported only in the code hoisting pass. The lesser the cost,
10233 the more aggressive code hoisting is. Specifying 0
10234 allows all expressions to travel unrestricted distances.
10235 The default value is 3.
10236
10237 @item max-hoist-depth
10238 The depth of search in the dominator tree for expressions to hoist.
10239 This is used to avoid quadratic behavior in hoisting algorithm.
10240 The value of 0 does not limit on the search, but may slow down compilation
10241 of huge functions. The default value is 30.
10242
10243 @item max-tail-merge-comparisons
10244 The maximum amount of similar bbs to compare a bb with. This is used to
10245 avoid quadratic behavior in tree tail merging. The default value is 10.
10246
10247 @item max-tail-merge-iterations
10248 The maximum amount of iterations of the pass over the function. This is used to
10249 limit compilation time in tree tail merging. The default value is 2.
10250
10251 @item store-merging-allow-unaligned
10252 Allow the store merging pass to introduce unaligned stores if it is legal to
10253 do so. The default value is 1.
10254
10255 @item max-stores-to-merge
10256 The maximum number of stores to attempt to merge into wider stores in the store
10257 merging pass. The minimum value is 2 and the default is 64.
10258
10259 @item max-unrolled-insns
10260 The maximum number of instructions that a loop may have to be unrolled.
10261 If a loop is unrolled, this parameter also determines how many times
10262 the loop code is unrolled.
10263
10264 @item max-average-unrolled-insns
10265 The maximum number of instructions biased by probabilities of their execution
10266 that a loop may have to be unrolled. If a loop is unrolled,
10267 this parameter also determines how many times the loop code is unrolled.
10268
10269 @item max-unroll-times
10270 The maximum number of unrollings of a single loop.
10271
10272 @item max-peeled-insns
10273 The maximum number of instructions that a loop may have to be peeled.
10274 If a loop is peeled, this parameter also determines how many times
10275 the loop code is peeled.
10276
10277 @item max-peel-times
10278 The maximum number of peelings of a single loop.
10279
10280 @item max-peel-branches
10281 The maximum number of branches on the hot path through the peeled sequence.
10282
10283 @item max-completely-peeled-insns
10284 The maximum number of insns of a completely peeled loop.
10285
10286 @item max-completely-peel-times
10287 The maximum number of iterations of a loop to be suitable for complete peeling.
10288
10289 @item max-completely-peel-loop-nest-depth
10290 The maximum depth of a loop nest suitable for complete peeling.
10291
10292 @item max-unswitch-insns
10293 The maximum number of insns of an unswitched loop.
10294
10295 @item max-unswitch-level
10296 The maximum number of branches unswitched in a single loop.
10297
10298 @item max-loop-headers-insns
10299 The maximum number of insns in loop header duplicated by the copy loop headers
10300 pass.
10301
10302 @item lim-expensive
10303 The minimum cost of an expensive expression in the loop invariant motion.
10304
10305 @item iv-consider-all-candidates-bound
10306 Bound on number of candidates for induction variables, below which
10307 all candidates are considered for each use in induction variable
10308 optimizations. If there are more candidates than this,
10309 only the most relevant ones are considered to avoid quadratic time complexity.
10310
10311 @item iv-max-considered-uses
10312 The induction variable optimizations give up on loops that contain more
10313 induction variable uses.
10314
10315 @item iv-always-prune-cand-set-bound
10316 If the number of candidates in the set is smaller than this value,
10317 always try to remove unnecessary ivs from the set
10318 when adding a new one.
10319
10320 @item avg-loop-niter
10321 Average number of iterations of a loop.
10322
10323 @item dse-max-object-size
10324 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10325 Larger values may result in larger compilation times.
10326
10327 @item scev-max-expr-size
10328 Bound on size of expressions used in the scalar evolutions analyzer.
10329 Large expressions slow the analyzer.
10330
10331 @item scev-max-expr-complexity
10332 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10333 Complex expressions slow the analyzer.
10334
10335 @item max-tree-if-conversion-phi-args
10336 Maximum number of arguments in a PHI supported by TREE if conversion
10337 unless the loop is marked with simd pragma.
10338
10339 @item vect-max-version-for-alignment-checks
10340 The maximum number of run-time checks that can be performed when
10341 doing loop versioning for alignment in the vectorizer.
10342
10343 @item vect-max-version-for-alias-checks
10344 The maximum number of run-time checks that can be performed when
10345 doing loop versioning for alias in the vectorizer.
10346
10347 @item vect-max-peeling-for-alignment
10348 The maximum number of loop peels to enhance access alignment
10349 for vectorizer. Value -1 means no limit.
10350
10351 @item max-iterations-to-track
10352 The maximum number of iterations of a loop the brute-force algorithm
10353 for analysis of the number of iterations of the loop tries to evaluate.
10354
10355 @item hot-bb-count-ws-permille
10356 A basic block profile count is considered hot if it contributes to
10357 the given permillage (i.e. 0...1000) of the entire profiled execution.
10358
10359 @item hot-bb-frequency-fraction
10360 Select fraction of the entry block frequency of executions of basic block in
10361 function given basic block needs to have to be considered hot.
10362
10363 @item max-predicted-iterations
10364 The maximum number of loop iterations we predict statically. This is useful
10365 in cases where a function contains a single loop with known bound and
10366 another loop with unknown bound.
10367 The known number of iterations is predicted correctly, while
10368 the unknown number of iterations average to roughly 10. This means that the
10369 loop without bounds appears artificially cold relative to the other one.
10370
10371 @item builtin-expect-probability
10372 Control the probability of the expression having the specified value. This
10373 parameter takes a percentage (i.e. 0 ... 100) as input.
10374 The default probability of 90 is obtained empirically.
10375
10376 @item align-threshold
10377
10378 Select fraction of the maximal frequency of executions of a basic block in
10379 a function to align the basic block.
10380
10381 @item align-loop-iterations
10382
10383 A loop expected to iterate at least the selected number of iterations is
10384 aligned.
10385
10386 @item tracer-dynamic-coverage
10387 @itemx tracer-dynamic-coverage-feedback
10388
10389 This value is used to limit superblock formation once the given percentage of
10390 executed instructions is covered. This limits unnecessary code size
10391 expansion.
10392
10393 The @option{tracer-dynamic-coverage-feedback} parameter
10394 is used only when profile
10395 feedback is available. The real profiles (as opposed to statically estimated
10396 ones) are much less balanced allowing the threshold to be larger value.
10397
10398 @item tracer-max-code-growth
10399 Stop tail duplication once code growth has reached given percentage. This is
10400 a rather artificial limit, as most of the duplicates are eliminated later in
10401 cross jumping, so it may be set to much higher values than is the desired code
10402 growth.
10403
10404 @item tracer-min-branch-ratio
10405
10406 Stop reverse growth when the reverse probability of best edge is less than this
10407 threshold (in percent).
10408
10409 @item tracer-min-branch-probability
10410 @itemx tracer-min-branch-probability-feedback
10411
10412 Stop forward growth if the best edge has probability lower than this
10413 threshold.
10414
10415 Similarly to @option{tracer-dynamic-coverage} two parameters are
10416 provided. @option{tracer-min-branch-probability-feedback} is used for
10417 compilation with profile feedback and @option{tracer-min-branch-probability}
10418 compilation without. The value for compilation with profile feedback
10419 needs to be more conservative (higher) in order to make tracer
10420 effective.
10421
10422 @item stack-clash-protection-guard-size
10423 Specify the size of the operating system provided stack guard as
10424 2 raised to @var{num} bytes. The default value is 12 (4096 bytes).
10425 Acceptable values are between 12 and 30. Higher values may reduce the
10426 number of explicit probes, but a value larger than the operating system
10427 provided guard will leave code vulnerable to stack clash style attacks.
10428
10429 @item stack-clash-protection-probe-interval
10430 Stack clash protection involves probing stack space as it is allocated. This
10431 param controls the maximum distance between probes into the stack as 2 raised
10432 to @var{num} bytes. Acceptable values are between 10 and 16 and defaults to
10433 12. Higher values may reduce the number of explicit probes, but a value
10434 larger than the operating system provided guard will leave code vulnerable to
10435 stack clash style attacks.
10436
10437 @item max-cse-path-length
10438
10439 The maximum number of basic blocks on path that CSE considers.
10440 The default is 10.
10441
10442 @item max-cse-insns
10443 The maximum number of instructions CSE processes before flushing.
10444 The default is 1000.
10445
10446 @item ggc-min-expand
10447
10448 GCC uses a garbage collector to manage its own memory allocation. This
10449 parameter specifies the minimum percentage by which the garbage
10450 collector's heap should be allowed to expand between collections.
10451 Tuning this may improve compilation speed; it has no effect on code
10452 generation.
10453
10454 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10455 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10456 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10457 GCC is not able to calculate RAM on a particular platform, the lower
10458 bound of 30% is used. Setting this parameter and
10459 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10460 every opportunity. This is extremely slow, but can be useful for
10461 debugging.
10462
10463 @item ggc-min-heapsize
10464
10465 Minimum size of the garbage collector's heap before it begins bothering
10466 to collect garbage. The first collection occurs after the heap expands
10467 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10468 tuning this may improve compilation speed, and has no effect on code
10469 generation.
10470
10471 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10472 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10473 with a lower bound of 4096 (four megabytes) and an upper bound of
10474 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10475 particular platform, the lower bound is used. Setting this parameter
10476 very large effectively disables garbage collection. Setting this
10477 parameter and @option{ggc-min-expand} to zero causes a full collection
10478 to occur at every opportunity.
10479
10480 @item max-reload-search-insns
10481 The maximum number of instruction reload should look backward for equivalent
10482 register. Increasing values mean more aggressive optimization, making the
10483 compilation time increase with probably slightly better performance.
10484 The default value is 100.
10485
10486 @item max-cselib-memory-locations
10487 The maximum number of memory locations cselib should take into account.
10488 Increasing values mean more aggressive optimization, making the compilation time
10489 increase with probably slightly better performance. The default value is 500.
10490
10491 @item max-sched-ready-insns
10492 The maximum number of instructions ready to be issued the scheduler should
10493 consider at any given time during the first scheduling pass. Increasing
10494 values mean more thorough searches, making the compilation time increase
10495 with probably little benefit. The default value is 100.
10496
10497 @item max-sched-region-blocks
10498 The maximum number of blocks in a region to be considered for
10499 interblock scheduling. The default value is 10.
10500
10501 @item max-pipeline-region-blocks
10502 The maximum number of blocks in a region to be considered for
10503 pipelining in the selective scheduler. The default value is 15.
10504
10505 @item max-sched-region-insns
10506 The maximum number of insns in a region to be considered for
10507 interblock scheduling. The default value is 100.
10508
10509 @item max-pipeline-region-insns
10510 The maximum number of insns in a region to be considered for
10511 pipelining in the selective scheduler. The default value is 200.
10512
10513 @item min-spec-prob
10514 The minimum probability (in percents) of reaching a source block
10515 for interblock speculative scheduling. The default value is 40.
10516
10517 @item max-sched-extend-regions-iters
10518 The maximum number of iterations through CFG to extend regions.
10519 A value of 0 (the default) disables region extensions.
10520
10521 @item max-sched-insn-conflict-delay
10522 The maximum conflict delay for an insn to be considered for speculative motion.
10523 The default value is 3.
10524
10525 @item sched-spec-prob-cutoff
10526 The minimal probability of speculation success (in percents), so that
10527 speculative insns are scheduled.
10528 The default value is 40.
10529
10530 @item sched-state-edge-prob-cutoff
10531 The minimum probability an edge must have for the scheduler to save its
10532 state across it.
10533 The default value is 10.
10534
10535 @item sched-mem-true-dep-cost
10536 Minimal distance (in CPU cycles) between store and load targeting same
10537 memory locations. The default value is 1.
10538
10539 @item selsched-max-lookahead
10540 The maximum size of the lookahead window of selective scheduling. It is a
10541 depth of search for available instructions.
10542 The default value is 50.
10543
10544 @item selsched-max-sched-times
10545 The maximum number of times that an instruction is scheduled during
10546 selective scheduling. This is the limit on the number of iterations
10547 through which the instruction may be pipelined. The default value is 2.
10548
10549 @item selsched-insns-to-rename
10550 The maximum number of best instructions in the ready list that are considered
10551 for renaming in the selective scheduler. The default value is 2.
10552
10553 @item sms-min-sc
10554 The minimum value of stage count that swing modulo scheduler
10555 generates. The default value is 2.
10556
10557 @item max-last-value-rtl
10558 The maximum size measured as number of RTLs that can be recorded in an expression
10559 in combiner for a pseudo register as last known value of that register. The default
10560 is 10000.
10561
10562 @item max-combine-insns
10563 The maximum number of instructions the RTL combiner tries to combine.
10564 The default value is 2 at @option{-Og} and 4 otherwise.
10565
10566 @item integer-share-limit
10567 Small integer constants can use a shared data structure, reducing the
10568 compiler's memory usage and increasing its speed. This sets the maximum
10569 value of a shared integer constant. The default value is 256.
10570
10571 @item ssp-buffer-size
10572 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10573 protection when @option{-fstack-protection} is used.
10574
10575 @item min-size-for-stack-sharing
10576 The minimum size of variables taking part in stack slot sharing when not
10577 optimizing. The default value is 32.
10578
10579 @item max-jump-thread-duplication-stmts
10580 Maximum number of statements allowed in a block that needs to be
10581 duplicated when threading jumps.
10582
10583 @item max-fields-for-field-sensitive
10584 Maximum number of fields in a structure treated in
10585 a field sensitive manner during pointer analysis. The default is zero
10586 for @option{-O0} and @option{-O1},
10587 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10588
10589 @item prefetch-latency
10590 Estimate on average number of instructions that are executed before
10591 prefetch finishes. The distance prefetched ahead is proportional
10592 to this constant. Increasing this number may also lead to less
10593 streams being prefetched (see @option{simultaneous-prefetches}).
10594
10595 @item simultaneous-prefetches
10596 Maximum number of prefetches that can run at the same time.
10597
10598 @item l1-cache-line-size
10599 The size of cache line in L1 cache, in bytes.
10600
10601 @item l1-cache-size
10602 The size of L1 cache, in kilobytes.
10603
10604 @item l2-cache-size
10605 The size of L2 cache, in kilobytes.
10606
10607 @item loop-interchange-max-num-stmts
10608 The maximum number of stmts in a loop to be interchanged.
10609
10610 @item loop-interchange-stride-ratio
10611 The minimum ratio between stride of two loops for interchange to be profitable.
10612
10613 @item min-insn-to-prefetch-ratio
10614 The minimum ratio between the number of instructions and the
10615 number of prefetches to enable prefetching in a loop.
10616
10617 @item prefetch-min-insn-to-mem-ratio
10618 The minimum ratio between the number of instructions and the
10619 number of memory references to enable prefetching in a loop.
10620
10621 @item use-canonical-types
10622 Whether the compiler should use the ``canonical'' type system. By
10623 default, this should always be 1, which uses a more efficient internal
10624 mechanism for comparing types in C++ and Objective-C++. However, if
10625 bugs in the canonical type system are causing compilation failures,
10626 set this value to 0 to disable canonical types.
10627
10628 @item switch-conversion-max-branch-ratio
10629 Switch initialization conversion refuses to create arrays that are
10630 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10631 branches in the switch.
10632
10633 @item max-partial-antic-length
10634 Maximum length of the partial antic set computed during the tree
10635 partial redundancy elimination optimization (@option{-ftree-pre}) when
10636 optimizing at @option{-O3} and above. For some sorts of source code
10637 the enhanced partial redundancy elimination optimization can run away,
10638 consuming all of the memory available on the host machine. This
10639 parameter sets a limit on the length of the sets that are computed,
10640 which prevents the runaway behavior. Setting a value of 0 for
10641 this parameter allows an unlimited set length.
10642
10643 @item sccvn-max-scc-size
10644 Maximum size of a strongly connected component (SCC) during SCCVN
10645 processing. If this limit is hit, SCCVN processing for the whole
10646 function is not done and optimizations depending on it are
10647 disabled. The default maximum SCC size is 10000.
10648
10649 @item sccvn-max-alias-queries-per-access
10650 Maximum number of alias-oracle queries we perform when looking for
10651 redundancies for loads and stores. If this limit is hit the search
10652 is aborted and the load or store is not considered redundant. The
10653 number of queries is algorithmically limited to the number of
10654 stores on all paths from the load to the function entry.
10655 The default maximum number of queries is 1000.
10656
10657 @item ira-max-loops-num
10658 IRA uses regional register allocation by default. If a function
10659 contains more loops than the number given by this parameter, only at most
10660 the given number of the most frequently-executed loops form regions
10661 for regional register allocation. The default value of the
10662 parameter is 100.
10663
10664 @item ira-max-conflict-table-size
10665 Although IRA uses a sophisticated algorithm to compress the conflict
10666 table, the table can still require excessive amounts of memory for
10667 huge functions. If the conflict table for a function could be more
10668 than the size in MB given by this parameter, the register allocator
10669 instead uses a faster, simpler, and lower-quality
10670 algorithm that does not require building a pseudo-register conflict table.
10671 The default value of the parameter is 2000.
10672
10673 @item ira-loop-reserved-regs
10674 IRA can be used to evaluate more accurate register pressure in loops
10675 for decisions to move loop invariants (see @option{-O3}). The number
10676 of available registers reserved for some other purposes is given
10677 by this parameter. The default value of the parameter is 2, which is
10678 the minimal number of registers needed by typical instructions.
10679 This value is the best found from numerous experiments.
10680
10681 @item lra-inheritance-ebb-probability-cutoff
10682 LRA tries to reuse values reloaded in registers in subsequent insns.
10683 This optimization is called inheritance. EBB is used as a region to
10684 do this optimization. The parameter defines a minimal fall-through
10685 edge probability in percentage used to add BB to inheritance EBB in
10686 LRA. The default value of the parameter is 40. The value was chosen
10687 from numerous runs of SPEC2000 on x86-64.
10688
10689 @item loop-invariant-max-bbs-in-loop
10690 Loop invariant motion can be very expensive, both in compilation time and
10691 in amount of needed compile-time memory, with very large loops. Loops
10692 with more basic blocks than this parameter won't have loop invariant
10693 motion optimization performed on them. The default value of the
10694 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10695
10696 @item loop-max-datarefs-for-datadeps
10697 Building data dependencies is expensive for very large loops. This
10698 parameter limits the number of data references in loops that are
10699 considered for data dependence analysis. These large loops are no
10700 handled by the optimizations using loop data dependencies.
10701 The default value is 1000.
10702
10703 @item max-vartrack-size
10704 Sets a maximum number of hash table slots to use during variable
10705 tracking dataflow analysis of any function. If this limit is exceeded
10706 with variable tracking at assignments enabled, analysis for that
10707 function is retried without it, after removing all debug insns from
10708 the function. If the limit is exceeded even without debug insns, var
10709 tracking analysis is completely disabled for the function. Setting
10710 the parameter to zero makes it unlimited.
10711
10712 @item max-vartrack-expr-depth
10713 Sets a maximum number of recursion levels when attempting to map
10714 variable names or debug temporaries to value expressions. This trades
10715 compilation time for more complete debug information. If this is set too
10716 low, value expressions that are available and could be represented in
10717 debug information may end up not being used; setting this higher may
10718 enable the compiler to find more complex debug expressions, but compile
10719 time and memory use may grow. The default is 12.
10720
10721 @item max-debug-marker-count
10722 Sets a threshold on the number of debug markers (e.g. begin stmt
10723 markers) to avoid complexity explosion at inlining or expanding to RTL.
10724 If a function has more such gimple stmts than the set limit, such stmts
10725 will be dropped from the inlined copy of a function, and from its RTL
10726 expansion. The default is 100000.
10727
10728 @item min-nondebug-insn-uid
10729 Use uids starting at this parameter for nondebug insns. The range below
10730 the parameter is reserved exclusively for debug insns created by
10731 @option{-fvar-tracking-assignments}, but debug insns may get
10732 (non-overlapping) uids above it if the reserved range is exhausted.
10733
10734 @item ipa-sra-ptr-growth-factor
10735 IPA-SRA replaces a pointer to an aggregate with one or more new
10736 parameters only when their cumulative size is less or equal to
10737 @option{ipa-sra-ptr-growth-factor} times the size of the original
10738 pointer parameter.
10739
10740 @item sra-max-scalarization-size-Ospeed
10741 @item sra-max-scalarization-size-Osize
10742 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10743 replace scalar parts of aggregates with uses of independent scalar
10744 variables. These parameters control the maximum size, in storage units,
10745 of aggregate which is considered for replacement when compiling for
10746 speed
10747 (@option{sra-max-scalarization-size-Ospeed}) or size
10748 (@option{sra-max-scalarization-size-Osize}) respectively.
10749
10750 @item tm-max-aggregate-size
10751 When making copies of thread-local variables in a transaction, this
10752 parameter specifies the size in bytes after which variables are
10753 saved with the logging functions as opposed to save/restore code
10754 sequence pairs. This option only applies when using
10755 @option{-fgnu-tm}.
10756
10757 @item graphite-max-nb-scop-params
10758 To avoid exponential effects in the Graphite loop transforms, the
10759 number of parameters in a Static Control Part (SCoP) is bounded. The
10760 default value is 10 parameters, a value of zero can be used to lift
10761 the bound. A variable whose value is unknown at compilation time and
10762 defined outside a SCoP is a parameter of the SCoP.
10763
10764 @item loop-block-tile-size
10765 Loop blocking or strip mining transforms, enabled with
10766 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10767 loop in the loop nest by a given number of iterations. The strip
10768 length can be changed using the @option{loop-block-tile-size}
10769 parameter. The default value is 51 iterations.
10770
10771 @item loop-unroll-jam-size
10772 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
10773 default value is 4.
10774
10775 @item loop-unroll-jam-depth
10776 Specify the dimension to be unrolled (counting from the most inner loop)
10777 for the @option{-floop-unroll-and-jam}. The default value is 2.
10778
10779 @item ipa-cp-value-list-size
10780 IPA-CP attempts to track all possible values and types passed to a function's
10781 parameter in order to propagate them and perform devirtualization.
10782 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10783 stores per one formal parameter of a function.
10784
10785 @item ipa-cp-eval-threshold
10786 IPA-CP calculates its own score of cloning profitability heuristics
10787 and performs those cloning opportunities with scores that exceed
10788 @option{ipa-cp-eval-threshold}.
10789
10790 @item ipa-cp-recursion-penalty
10791 Percentage penalty the recursive functions will receive when they
10792 are evaluated for cloning.
10793
10794 @item ipa-cp-single-call-penalty
10795 Percentage penalty functions containing a single call to another
10796 function will receive when they are evaluated for cloning.
10797
10798
10799 @item ipa-max-agg-items
10800 IPA-CP is also capable to propagate a number of scalar values passed
10801 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10802 number of such values per one parameter.
10803
10804 @item ipa-cp-loop-hint-bonus
10805 When IPA-CP determines that a cloning candidate would make the number
10806 of iterations of a loop known, it adds a bonus of
10807 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10808 the candidate.
10809
10810 @item ipa-cp-array-index-hint-bonus
10811 When IPA-CP determines that a cloning candidate would make the index of
10812 an array access known, it adds a bonus of
10813 @option{ipa-cp-array-index-hint-bonus} to the profitability
10814 score of the candidate.
10815
10816 @item ipa-max-aa-steps
10817 During its analysis of function bodies, IPA-CP employs alias analysis
10818 in order to track values pointed to by function parameters. In order
10819 not spend too much time analyzing huge functions, it gives up and
10820 consider all memory clobbered after examining
10821 @option{ipa-max-aa-steps} statements modifying memory.
10822
10823 @item lto-partitions
10824 Specify desired number of partitions produced during WHOPR compilation.
10825 The number of partitions should exceed the number of CPUs used for compilation.
10826 The default value is 32.
10827
10828 @item lto-min-partition
10829 Size of minimal partition for WHOPR (in estimated instructions).
10830 This prevents expenses of splitting very small programs into too many
10831 partitions.
10832
10833 @item lto-max-partition
10834 Size of max partition for WHOPR (in estimated instructions).
10835 to provide an upper bound for individual size of partition.
10836 Meant to be used only with balanced partitioning.
10837
10838 @item cxx-max-namespaces-for-diagnostic-help
10839 The maximum number of namespaces to consult for suggestions when C++
10840 name lookup fails for an identifier. The default is 1000.
10841
10842 @item sink-frequency-threshold
10843 The maximum relative execution frequency (in percents) of the target block
10844 relative to a statement's original block to allow statement sinking of a
10845 statement. Larger numbers result in more aggressive statement sinking.
10846 The default value is 75. A small positive adjustment is applied for
10847 statements with memory operands as those are even more profitable so sink.
10848
10849 @item max-stores-to-sink
10850 The maximum number of conditional store pairs that can be sunk. Set to 0
10851 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10852 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10853
10854 @item allow-store-data-races
10855 Allow optimizers to introduce new data races on stores.
10856 Set to 1 to allow, otherwise to 0. This option is enabled by default
10857 at optimization level @option{-Ofast}.
10858
10859 @item case-values-threshold
10860 The smallest number of different values for which it is best to use a
10861 jump-table instead of a tree of conditional branches. If the value is
10862 0, use the default for the machine. The default is 0.
10863
10864 @item tree-reassoc-width
10865 Set the maximum number of instructions executed in parallel in
10866 reassociated tree. This parameter overrides target dependent
10867 heuristics used by default if has non zero value.
10868
10869 @item sched-pressure-algorithm
10870 Choose between the two available implementations of
10871 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10872 and is the more likely to prevent instructions from being reordered.
10873 Algorithm 2 was designed to be a compromise between the relatively
10874 conservative approach taken by algorithm 1 and the rather aggressive
10875 approach taken by the default scheduler. It relies more heavily on
10876 having a regular register file and accurate register pressure classes.
10877 See @file{haifa-sched.c} in the GCC sources for more details.
10878
10879 The default choice depends on the target.
10880
10881 @item max-slsr-cand-scan
10882 Set the maximum number of existing candidates that are considered when
10883 seeking a basis for a new straight-line strength reduction candidate.
10884
10885 @item asan-globals
10886 Enable buffer overflow detection for global objects. This kind
10887 of protection is enabled by default if you are using
10888 @option{-fsanitize=address} option.
10889 To disable global objects protection use @option{--param asan-globals=0}.
10890
10891 @item asan-stack
10892 Enable buffer overflow detection for stack objects. This kind of
10893 protection is enabled by default when using @option{-fsanitize=address}.
10894 To disable stack protection use @option{--param asan-stack=0} option.
10895
10896 @item asan-instrument-reads
10897 Enable buffer overflow detection for memory reads. This kind of
10898 protection is enabled by default when using @option{-fsanitize=address}.
10899 To disable memory reads protection use
10900 @option{--param asan-instrument-reads=0}.
10901
10902 @item asan-instrument-writes
10903 Enable buffer overflow detection for memory writes. This kind of
10904 protection is enabled by default when using @option{-fsanitize=address}.
10905 To disable memory writes protection use
10906 @option{--param asan-instrument-writes=0} option.
10907
10908 @item asan-memintrin
10909 Enable detection for built-in functions. This kind of protection
10910 is enabled by default when using @option{-fsanitize=address}.
10911 To disable built-in functions protection use
10912 @option{--param asan-memintrin=0}.
10913
10914 @item asan-use-after-return
10915 Enable detection of use-after-return. This kind of protection
10916 is enabled by default when using the @option{-fsanitize=address} option.
10917 To disable it use @option{--param asan-use-after-return=0}.
10918
10919 Note: By default the check is disabled at run time. To enable it,
10920 add @code{detect_stack_use_after_return=1} to the environment variable
10921 @env{ASAN_OPTIONS}.
10922
10923 @item asan-instrumentation-with-call-threshold
10924 If number of memory accesses in function being instrumented
10925 is greater or equal to this number, use callbacks instead of inline checks.
10926 E.g. to disable inline code use
10927 @option{--param asan-instrumentation-with-call-threshold=0}.
10928
10929 @item use-after-scope-direct-emission-threshold
10930 If the size of a local variable in bytes is smaller or equal to this
10931 number, directly poison (or unpoison) shadow memory instead of using
10932 run-time callbacks. The default value is 256.
10933
10934 @item chkp-max-ctor-size
10935 Static constructors generated by Pointer Bounds Checker may become very
10936 large and significantly increase compile time at optimization level
10937 @option{-O1} and higher. This parameter is a maximum number of statements
10938 in a single generated constructor. Default value is 5000.
10939
10940 @item max-fsm-thread-path-insns
10941 Maximum number of instructions to copy when duplicating blocks on a
10942 finite state automaton jump thread path. The default is 100.
10943
10944 @item max-fsm-thread-length
10945 Maximum number of basic blocks on a finite state automaton jump thread
10946 path. The default is 10.
10947
10948 @item max-fsm-thread-paths
10949 Maximum number of new jump thread paths to create for a finite state
10950 automaton. The default is 50.
10951
10952 @item parloops-chunk-size
10953 Chunk size of omp schedule for loops parallelized by parloops. The default
10954 is 0.
10955
10956 @item parloops-schedule
10957 Schedule type of omp schedule for loops parallelized by parloops (static,
10958 dynamic, guided, auto, runtime). The default is static.
10959
10960 @item parloops-min-per-thread
10961 The minimum number of iterations per thread of an innermost parallelized
10962 loop for which the parallelized variant is prefered over the single threaded
10963 one. The default is 100. Note that for a parallelized loop nest the
10964 minimum number of iterations of the outermost loop per thread is two.
10965
10966 @item max-ssa-name-query-depth
10967 Maximum depth of recursion when querying properties of SSA names in things
10968 like fold routines. One level of recursion corresponds to following a
10969 use-def chain.
10970
10971 @item hsa-gen-debug-stores
10972 Enable emission of special debug stores within HSA kernels which are
10973 then read and reported by libgomp plugin. Generation of these stores
10974 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
10975 enable it.
10976
10977 @item max-speculative-devirt-maydefs
10978 The maximum number of may-defs we analyze when looking for a must-def
10979 specifying the dynamic type of an object that invokes a virtual call
10980 we may be able to devirtualize speculatively.
10981
10982 @item max-vrp-switch-assertions
10983 The maximum number of assertions to add along the default edge of a switch
10984 statement during VRP. The default is 10.
10985
10986 @item unroll-jam-min-percent
10987 The minimum percentage of memory references that must be optimized
10988 away for the unroll-and-jam transformation to be considered profitable.
10989
10990 @item unroll-jam-max-unroll
10991 The maximum number of times the outer loop should be unrolled by
10992 the unroll-and-jam transformation.
10993 @end table
10994 @end table
10995
10996 @node Instrumentation Options
10997 @section Program Instrumentation Options
10998 @cindex instrumentation options
10999 @cindex program instrumentation options
11000 @cindex run-time error checking options
11001 @cindex profiling options
11002 @cindex options, program instrumentation
11003 @cindex options, run-time error checking
11004 @cindex options, profiling
11005
11006 GCC supports a number of command-line options that control adding
11007 run-time instrumentation to the code it normally generates.
11008 For example, one purpose of instrumentation is collect profiling
11009 statistics for use in finding program hot spots, code coverage
11010 analysis, or profile-guided optimizations.
11011 Another class of program instrumentation is adding run-time checking
11012 to detect programming errors like invalid pointer
11013 dereferences or out-of-bounds array accesses, as well as deliberately
11014 hostile attacks such as stack smashing or C++ vtable hijacking.
11015 There is also a general hook which can be used to implement other
11016 forms of tracing or function-level instrumentation for debug or
11017 program analysis purposes.
11018
11019 @table @gcctabopt
11020 @cindex @command{prof}
11021 @item -p
11022 @opindex p
11023 Generate extra code to write profile information suitable for the
11024 analysis program @command{prof}. You must use this option when compiling
11025 the source files you want data about, and you must also use it when
11026 linking.
11027
11028 @cindex @command{gprof}
11029 @item -pg
11030 @opindex pg
11031 Generate extra code to write profile information suitable for the
11032 analysis program @command{gprof}. You must use this option when compiling
11033 the source files you want data about, and you must also use it when
11034 linking.
11035
11036 @item -fprofile-arcs
11037 @opindex fprofile-arcs
11038 Add code so that program flow @dfn{arcs} are instrumented. During
11039 execution the program records how many times each branch and call is
11040 executed and how many times it is taken or returns. On targets that support
11041 constructors with priority support, profiling properly handles constructors,
11042 destructors and C++ constructors (and destructors) of classes which are used
11043 as a type of a global variable.
11044
11045 When the compiled
11046 program exits it saves this data to a file called
11047 @file{@var{auxname}.gcda} for each source file. The data may be used for
11048 profile-directed optimizations (@option{-fbranch-probabilities}), or for
11049 test coverage analysis (@option{-ftest-coverage}). Each object file's
11050 @var{auxname} is generated from the name of the output file, if
11051 explicitly specified and it is not the final executable, otherwise it is
11052 the basename of the source file. In both cases any suffix is removed
11053 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
11054 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
11055 @xref{Cross-profiling}.
11056
11057 @cindex @command{gcov}
11058 @item --coverage
11059 @opindex coverage
11060
11061 This option is used to compile and link code instrumented for coverage
11062 analysis. The option is a synonym for @option{-fprofile-arcs}
11063 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
11064 linking). See the documentation for those options for more details.
11065
11066 @itemize
11067
11068 @item
11069 Compile the source files with @option{-fprofile-arcs} plus optimization
11070 and code generation options. For test coverage analysis, use the
11071 additional @option{-ftest-coverage} option. You do not need to profile
11072 every source file in a program.
11073
11074 @item
11075 Compile the source files additionally with @option{-fprofile-abs-path}
11076 to create absolute path names in the @file{.gcno} files. This allows
11077 @command{gcov} to find the correct sources in projects where compilations
11078 occur with different working directories.
11079
11080 @item
11081 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
11082 (the latter implies the former).
11083
11084 @item
11085 Run the program on a representative workload to generate the arc profile
11086 information. This may be repeated any number of times. You can run
11087 concurrent instances of your program, and provided that the file system
11088 supports locking, the data files will be correctly updated. Unless
11089 a strict ISO C dialect option is in effect, @code{fork} calls are
11090 detected and correctly handled without double counting.
11091
11092 @item
11093 For profile-directed optimizations, compile the source files again with
11094 the same optimization and code generation options plus
11095 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
11096 Control Optimization}).
11097
11098 @item
11099 For test coverage analysis, use @command{gcov} to produce human readable
11100 information from the @file{.gcno} and @file{.gcda} files. Refer to the
11101 @command{gcov} documentation for further information.
11102
11103 @end itemize
11104
11105 With @option{-fprofile-arcs}, for each function of your program GCC
11106 creates a program flow graph, then finds a spanning tree for the graph.
11107 Only arcs that are not on the spanning tree have to be instrumented: the
11108 compiler adds code to count the number of times that these arcs are
11109 executed. When an arc is the only exit or only entrance to a block, the
11110 instrumentation code can be added to the block; otherwise, a new basic
11111 block must be created to hold the instrumentation code.
11112
11113 @need 2000
11114 @item -ftest-coverage
11115 @opindex ftest-coverage
11116 Produce a notes file that the @command{gcov} code-coverage utility
11117 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
11118 show program coverage. Each source file's note file is called
11119 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
11120 above for a description of @var{auxname} and instructions on how to
11121 generate test coverage data. Coverage data matches the source files
11122 more closely if you do not optimize.
11123
11124 @item -fprofile-abs-path
11125 @opindex fprofile-abs-path
11126 Automatically convert relative source file names to absolute path names
11127 in the @file{.gcno} files. This allows @command{gcov} to find the correct
11128 sources in projects where compilations occur with different working
11129 directories.
11130
11131 @item -fprofile-dir=@var{path}
11132 @opindex fprofile-dir
11133
11134 Set the directory to search for the profile data files in to @var{path}.
11135 This option affects only the profile data generated by
11136 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
11137 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
11138 and its related options. Both absolute and relative paths can be used.
11139 By default, GCC uses the current directory as @var{path}, thus the
11140 profile data file appears in the same directory as the object file.
11141
11142 @item -fprofile-generate
11143 @itemx -fprofile-generate=@var{path}
11144 @opindex fprofile-generate
11145
11146 Enable options usually used for instrumenting application to produce
11147 profile useful for later recompilation with profile feedback based
11148 optimization. You must use @option{-fprofile-generate} both when
11149 compiling and when linking your program.
11150
11151 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
11152
11153 If @var{path} is specified, GCC looks at the @var{path} to find
11154 the profile feedback data files. See @option{-fprofile-dir}.
11155
11156 To optimize the program based on the collected profile information, use
11157 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
11158
11159 @item -fprofile-update=@var{method}
11160 @opindex fprofile-update
11161
11162 Alter the update method for an application instrumented for profile
11163 feedback based optimization. The @var{method} argument should be one of
11164 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
11165 The first one is useful for single-threaded applications,
11166 while the second one prevents profile corruption by emitting thread-safe code.
11167
11168 @strong{Warning:} When an application does not properly join all threads
11169 (or creates an detached thread), a profile file can be still corrupted.
11170
11171 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
11172 when supported by a target, or to @samp{single} otherwise. The GCC driver
11173 automatically selects @samp{prefer-atomic} when @option{-pthread}
11174 is present in the command line.
11175
11176 @item -fsanitize=address
11177 @opindex fsanitize=address
11178 Enable AddressSanitizer, a fast memory error detector.
11179 Memory access instructions are instrumented to detect
11180 out-of-bounds and use-after-free bugs.
11181 The option enables @option{-fsanitize-address-use-after-scope}.
11182 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
11183 more details. The run-time behavior can be influenced using the
11184 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
11185 the available options are shown at startup of the instrumented program. See
11186 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
11187 for a list of supported options.
11188 The option cannot be combined with @option{-fsanitize=thread}
11189 and/or @option{-fcheck-pointer-bounds}.
11190
11191 @item -fsanitize=kernel-address
11192 @opindex fsanitize=kernel-address
11193 Enable AddressSanitizer for Linux kernel.
11194 See @uref{https://github.com/google/kasan/wiki} for more details.
11195 The option cannot be combined with @option{-fcheck-pointer-bounds}.
11196
11197 @item -fsanitize=pointer-compare
11198 @opindex fsanitize=pointer-compare
11199 Instrument comparison operation (<, <=, >, >=) with pointer operands.
11200 The option must be combined with either @option{-fsanitize=kernel-address} or
11201 @option{-fsanitize=address}
11202 The option cannot be combined with @option{-fsanitize=thread}
11203 and/or @option{-fcheck-pointer-bounds}.
11204 Note: By default the check is disabled at run time. To enable it,
11205 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11206 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11207 invalid operation only when both pointers are non-null.
11208
11209 @item -fsanitize=pointer-subtract
11210 @opindex fsanitize=pointer-subtract
11211 Instrument subtraction with pointer operands.
11212 The option must be combined with either @option{-fsanitize=kernel-address} or
11213 @option{-fsanitize=address}
11214 The option cannot be combined with @option{-fsanitize=thread}
11215 and/or @option{-fcheck-pointer-bounds}.
11216 Note: By default the check is disabled at run time. To enable it,
11217 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11218 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11219 invalid operation only when both pointers are non-null.
11220
11221 @item -fsanitize=thread
11222 @opindex fsanitize=thread
11223 Enable ThreadSanitizer, a fast data race detector.
11224 Memory access instructions are instrumented to detect
11225 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
11226 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
11227 environment variable; see
11228 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
11229 supported options.
11230 The option cannot be combined with @option{-fsanitize=address},
11231 @option{-fsanitize=leak} and/or @option{-fcheck-pointer-bounds}.
11232
11233 Note that sanitized atomic builtins cannot throw exceptions when
11234 operating on invalid memory addresses with non-call exceptions
11235 (@option{-fnon-call-exceptions}).
11236
11237 @item -fsanitize=leak
11238 @opindex fsanitize=leak
11239 Enable LeakSanitizer, a memory leak detector.
11240 This option only matters for linking of executables and
11241 the executable is linked against a library that overrides @code{malloc}
11242 and other allocator functions. See
11243 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
11244 details. The run-time behavior can be influenced using the
11245 @env{LSAN_OPTIONS} environment variable.
11246 The option cannot be combined with @option{-fsanitize=thread}.
11247
11248 @item -fsanitize=undefined
11249 @opindex fsanitize=undefined
11250 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
11251 Various computations are instrumented to detect undefined behavior
11252 at runtime. Current suboptions are:
11253
11254 @table @gcctabopt
11255
11256 @item -fsanitize=shift
11257 @opindex fsanitize=shift
11258 This option enables checking that the result of a shift operation is
11259 not undefined. Note that what exactly is considered undefined differs
11260 slightly between C and C++, as well as between ISO C90 and C99, etc.
11261 This option has two suboptions, @option{-fsanitize=shift-base} and
11262 @option{-fsanitize=shift-exponent}.
11263
11264 @item -fsanitize=shift-exponent
11265 @opindex fsanitize=shift-exponent
11266 This option enables checking that the second argument of a shift operation
11267 is not negative and is smaller than the precision of the promoted first
11268 argument.
11269
11270 @item -fsanitize=shift-base
11271 @opindex fsanitize=shift-base
11272 If the second argument of a shift operation is within range, check that the
11273 result of a shift operation is not undefined. Note that what exactly is
11274 considered undefined differs slightly between C and C++, as well as between
11275 ISO C90 and C99, etc.
11276
11277 @item -fsanitize=integer-divide-by-zero
11278 @opindex fsanitize=integer-divide-by-zero
11279 Detect integer division by zero as well as @code{INT_MIN / -1} division.
11280
11281 @item -fsanitize=unreachable
11282 @opindex fsanitize=unreachable
11283 With this option, the compiler turns the @code{__builtin_unreachable}
11284 call into a diagnostics message call instead. When reaching the
11285 @code{__builtin_unreachable} call, the behavior is undefined.
11286
11287 @item -fsanitize=vla-bound
11288 @opindex fsanitize=vla-bound
11289 This option instructs the compiler to check that the size of a variable
11290 length array is positive.
11291
11292 @item -fsanitize=null
11293 @opindex fsanitize=null
11294 This option enables pointer checking. Particularly, the application
11295 built with this option turned on will issue an error message when it
11296 tries to dereference a NULL pointer, or if a reference (possibly an
11297 rvalue reference) is bound to a NULL pointer, or if a method is invoked
11298 on an object pointed by a NULL pointer.
11299
11300 @item -fsanitize=return
11301 @opindex fsanitize=return
11302 This option enables return statement checking. Programs
11303 built with this option turned on will issue an error message
11304 when the end of a non-void function is reached without actually
11305 returning a value. This option works in C++ only.
11306
11307 @item -fsanitize=signed-integer-overflow
11308 @opindex fsanitize=signed-integer-overflow
11309 This option enables signed integer overflow checking. We check that
11310 the result of @code{+}, @code{*}, and both unary and binary @code{-}
11311 does not overflow in the signed arithmetics. Note, integer promotion
11312 rules must be taken into account. That is, the following is not an
11313 overflow:
11314 @smallexample
11315 signed char a = SCHAR_MAX;
11316 a++;
11317 @end smallexample
11318
11319 @item -fsanitize=bounds
11320 @opindex fsanitize=bounds
11321 This option enables instrumentation of array bounds. Various out of bounds
11322 accesses are detected. Flexible array members, flexible array member-like
11323 arrays, and initializers of variables with static storage are not instrumented.
11324 The option cannot be combined with @option{-fcheck-pointer-bounds}.
11325
11326 @item -fsanitize=bounds-strict
11327 @opindex fsanitize=bounds-strict
11328 This option enables strict instrumentation of array bounds. Most out of bounds
11329 accesses are detected, including flexible array members and flexible array
11330 member-like arrays. Initializers of variables with static storage are not
11331 instrumented. The option cannot be combined
11332 with @option{-fcheck-pointer-bounds}.
11333
11334 @item -fsanitize=alignment
11335 @opindex fsanitize=alignment
11336
11337 This option enables checking of alignment of pointers when they are
11338 dereferenced, or when a reference is bound to insufficiently aligned target,
11339 or when a method or constructor is invoked on insufficiently aligned object.
11340
11341 @item -fsanitize=object-size
11342 @opindex fsanitize=object-size
11343 This option enables instrumentation of memory references using the
11344 @code{__builtin_object_size} function. Various out of bounds pointer
11345 accesses are detected.
11346
11347 @item -fsanitize=float-divide-by-zero
11348 @opindex fsanitize=float-divide-by-zero
11349 Detect floating-point division by zero. Unlike other similar options,
11350 @option{-fsanitize=float-divide-by-zero} is not enabled by
11351 @option{-fsanitize=undefined}, since floating-point division by zero can
11352 be a legitimate way of obtaining infinities and NaNs.
11353
11354 @item -fsanitize=float-cast-overflow
11355 @opindex fsanitize=float-cast-overflow
11356 This option enables floating-point type to integer conversion checking.
11357 We check that the result of the conversion does not overflow.
11358 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
11359 not enabled by @option{-fsanitize=undefined}.
11360 This option does not work well with @code{FE_INVALID} exceptions enabled.
11361
11362 @item -fsanitize=nonnull-attribute
11363 @opindex fsanitize=nonnull-attribute
11364
11365 This option enables instrumentation of calls, checking whether null values
11366 are not passed to arguments marked as requiring a non-null value by the
11367 @code{nonnull} function attribute.
11368
11369 @item -fsanitize=returns-nonnull-attribute
11370 @opindex fsanitize=returns-nonnull-attribute
11371
11372 This option enables instrumentation of return statements in functions
11373 marked with @code{returns_nonnull} function attribute, to detect returning
11374 of null values from such functions.
11375
11376 @item -fsanitize=bool
11377 @opindex fsanitize=bool
11378
11379 This option enables instrumentation of loads from bool. If a value other
11380 than 0/1 is loaded, a run-time error is issued.
11381
11382 @item -fsanitize=enum
11383 @opindex fsanitize=enum
11384
11385 This option enables instrumentation of loads from an enum type. If
11386 a value outside the range of values for the enum type is loaded,
11387 a run-time error is issued.
11388
11389 @item -fsanitize=vptr
11390 @opindex fsanitize=vptr
11391
11392 This option enables instrumentation of C++ member function calls, member
11393 accesses and some conversions between pointers to base and derived classes,
11394 to verify the referenced object has the correct dynamic type.
11395
11396 @item -fsanitize=pointer-overflow
11397 @opindex fsanitize=pointer-overflow
11398
11399 This option enables instrumentation of pointer arithmetics. If the pointer
11400 arithmetics overflows, a run-time error is issued.
11401
11402 @item -fsanitize=builtin
11403 @opindex fsanitize=builtin
11404
11405 This option enables instrumentation of arguments to selected builtin
11406 functions. If an invalid value is passed to such arguments, a run-time
11407 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
11408 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
11409 by this option.
11410
11411 @end table
11412
11413 While @option{-ftrapv} causes traps for signed overflows to be emitted,
11414 @option{-fsanitize=undefined} gives a diagnostic message.
11415 This currently works only for the C family of languages.
11416
11417 @item -fno-sanitize=all
11418 @opindex fno-sanitize=all
11419
11420 This option disables all previously enabled sanitizers.
11421 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
11422 together.
11423
11424 @item -fasan-shadow-offset=@var{number}
11425 @opindex fasan-shadow-offset
11426 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
11427 It is useful for experimenting with different shadow memory layouts in
11428 Kernel AddressSanitizer.
11429
11430 @item -fsanitize-sections=@var{s1},@var{s2},...
11431 @opindex fsanitize-sections
11432 Sanitize global variables in selected user-defined sections. @var{si} may
11433 contain wildcards.
11434
11435 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
11436 @opindex fsanitize-recover
11437 @opindex fno-sanitize-recover
11438 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
11439 mentioned in comma-separated list of @var{opts}. Enabling this option
11440 for a sanitizer component causes it to attempt to continue
11441 running the program as if no error happened. This means multiple
11442 runtime errors can be reported in a single program run, and the exit
11443 code of the program may indicate success even when errors
11444 have been reported. The @option{-fno-sanitize-recover=} option
11445 can be used to alter
11446 this behavior: only the first detected error is reported
11447 and program then exits with a non-zero exit code.
11448
11449 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
11450 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
11451 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
11452 @option{-fsanitize=bounds-strict},
11453 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
11454 For these sanitizers error recovery is turned on by default,
11455 except @option{-fsanitize=address}, for which this feature is experimental.
11456 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
11457 accepted, the former enables recovery for all sanitizers that support it,
11458 the latter disables recovery for all sanitizers that support it.
11459
11460 Even if a recovery mode is turned on the compiler side, it needs to be also
11461 enabled on the runtime library side, otherwise the failures are still fatal.
11462 The runtime library defaults to @code{halt_on_error=0} for
11463 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
11464 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
11465 setting the @code{halt_on_error} flag in the corresponding environment variable.
11466
11467 Syntax without an explicit @var{opts} parameter is deprecated. It is
11468 equivalent to specifying an @var{opts} list of:
11469
11470 @smallexample
11471 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11472 @end smallexample
11473
11474 @item -fsanitize-address-use-after-scope
11475 @opindex fsanitize-address-use-after-scope
11476 Enable sanitization of local variables to detect use-after-scope bugs.
11477 The option sets @option{-fstack-reuse} to @samp{none}.
11478
11479 @item -fsanitize-undefined-trap-on-error
11480 @opindex fsanitize-undefined-trap-on-error
11481 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
11482 report undefined behavior using @code{__builtin_trap} rather than
11483 a @code{libubsan} library routine. The advantage of this is that the
11484 @code{libubsan} library is not needed and is not linked in, so this
11485 is usable even in freestanding environments.
11486
11487 @item -fsanitize-coverage=trace-pc
11488 @opindex fsanitize-coverage=trace-pc
11489 Enable coverage-guided fuzzing code instrumentation.
11490 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
11491
11492 @item -fsanitize-coverage=trace-cmp
11493 @opindex fsanitize-coverage=trace-cmp
11494 Enable dataflow guided fuzzing code instrumentation.
11495 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
11496 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
11497 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
11498 variable or @code{__sanitizer_cov_trace_const_cmp1},
11499 @code{__sanitizer_cov_trace_const_cmp2},
11500 @code{__sanitizer_cov_trace_const_cmp4} or
11501 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
11502 operand constant, @code{__sanitizer_cov_trace_cmpf} or
11503 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
11504 @code{__sanitizer_cov_trace_switch} for switch statements.
11505
11506 @item -fbounds-check
11507 @opindex fbounds-check
11508 For front ends that support it, generate additional code to check that
11509 indices used to access arrays are within the declared range. This is
11510 currently only supported by the Fortran front end, where this option
11511 defaults to false.
11512
11513 @item -fcheck-pointer-bounds
11514 @opindex fcheck-pointer-bounds
11515 @opindex fno-check-pointer-bounds
11516 @cindex Pointer Bounds Checker options
11517 Enable Pointer Bounds Checker instrumentation. Each memory reference
11518 is instrumented with checks of the pointer used for memory access against
11519 bounds associated with that pointer.
11520
11521 Currently there
11522 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
11523 and @option{-mmpx} are required to enable this feature.
11524 MPX-based instrumentation requires
11525 a runtime library to enable MPX in hardware and handle bounds
11526 violation signals. By default when @option{-fcheck-pointer-bounds}
11527 and @option{-mmpx} options are used to link a program, the GCC driver
11528 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
11529 Bounds checking on calls to dynamic libraries requires a linker
11530 with @option{-z bndplt} support; if GCC was configured with a linker
11531 without support for this option (including the Gold linker and older
11532 versions of ld), a warning is given if you link with @option{-mmpx}
11533 without also specifying @option{-static}, since the overall effectiveness
11534 of the bounds checking protection is reduced.
11535 See also @option{-static-libmpxwrappers}.
11536
11537 MPX-based instrumentation
11538 may be used for debugging and also may be included in production code
11539 to increase program security. Depending on usage, you may
11540 have different requirements for the runtime library. The current version
11541 of the MPX runtime library is more oriented for use as a debugging
11542 tool. MPX runtime library usage implies @option{-lpthread}. See
11543 also @option{-static-libmpx}. The runtime library behavior can be
11544 influenced using various @env{CHKP_RT_*} environment variables. See
11545 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
11546 for more details.
11547
11548 Generated instrumentation may be controlled by various
11549 @option{-fchkp-*} options and by the @code{bnd_variable_size}
11550 structure field attribute (@pxref{Type Attributes}) and
11551 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
11552 (@pxref{Function Attributes}). GCC also provides a number of built-in
11553 functions for controlling the Pointer Bounds Checker. @xref{Pointer
11554 Bounds Checker builtins}, for more information.
11555
11556 @item -fchkp-check-incomplete-type
11557 @opindex fchkp-check-incomplete-type
11558 @opindex fno-chkp-check-incomplete-type
11559 Generate pointer bounds checks for variables with incomplete type.
11560 Enabled by default.
11561
11562 @item -fchkp-narrow-bounds
11563 @opindex fchkp-narrow-bounds
11564 @opindex fno-chkp-narrow-bounds
11565 Controls bounds used by Pointer Bounds Checker for pointers to object
11566 fields. If narrowing is enabled then field bounds are used. Otherwise
11567 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
11568 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
11569
11570 @item -fchkp-first-field-has-own-bounds
11571 @opindex fchkp-first-field-has-own-bounds
11572 @opindex fno-chkp-first-field-has-own-bounds
11573 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
11574 first field in the structure. By default a pointer to the first field has
11575 the same bounds as a pointer to the whole structure.
11576
11577 @item -fchkp-flexible-struct-trailing-arrays
11578 @opindex fchkp-flexible-struct-trailing-arrays
11579 @opindex fno-chkp-flexible-struct-trailing-arrays
11580 Forces Pointer Bounds Checker to treat all trailing arrays in structures as
11581 possibly flexible. By default only array fields with zero length or that are
11582 marked with attribute bnd_variable_size are treated as flexible.
11583
11584 @item -fchkp-narrow-to-innermost-array
11585 @opindex fchkp-narrow-to-innermost-array
11586 @opindex fno-chkp-narrow-to-innermost-array
11587 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
11588 case of nested static array access. By default this option is disabled and
11589 bounds of the outermost array are used.
11590
11591 @item -fchkp-optimize
11592 @opindex fchkp-optimize
11593 @opindex fno-chkp-optimize
11594 Enables Pointer Bounds Checker optimizations. Enabled by default at
11595 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
11596
11597 @item -fchkp-use-fast-string-functions
11598 @opindex fchkp-use-fast-string-functions
11599 @opindex fno-chkp-use-fast-string-functions
11600 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
11601 by Pointer Bounds Checker. Disabled by default.
11602
11603 @item -fchkp-use-nochk-string-functions
11604 @opindex fchkp-use-nochk-string-functions
11605 @opindex fno-chkp-use-nochk-string-functions
11606 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
11607 by Pointer Bounds Checker. Disabled by default.
11608
11609 @item -fchkp-use-static-bounds
11610 @opindex fchkp-use-static-bounds
11611 @opindex fno-chkp-use-static-bounds
11612 Allow Pointer Bounds Checker to generate static bounds holding
11613 bounds of static variables. Enabled by default.
11614
11615 @item -fchkp-use-static-const-bounds
11616 @opindex fchkp-use-static-const-bounds
11617 @opindex fno-chkp-use-static-const-bounds
11618 Use statically-initialized bounds for constant bounds instead of
11619 generating them each time they are required. By default enabled when
11620 @option{-fchkp-use-static-bounds} is enabled.
11621
11622 @item -fchkp-treat-zero-dynamic-size-as-infinite
11623 @opindex fchkp-treat-zero-dynamic-size-as-infinite
11624 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
11625 With this option, objects with incomplete type whose
11626 dynamically-obtained size is zero are treated as having infinite size
11627 instead by Pointer Bounds
11628 Checker. This option may be helpful if a program is linked with a library
11629 missing size information for some symbols. Disabled by default.
11630
11631 @item -fchkp-check-read
11632 @opindex fchkp-check-read
11633 @opindex fno-chkp-check-read
11634 Instructs Pointer Bounds Checker to generate checks for all read
11635 accesses to memory. Enabled by default.
11636
11637 @item -fchkp-check-write
11638 @opindex fchkp-check-write
11639 @opindex fno-chkp-check-write
11640 Instructs Pointer Bounds Checker to generate checks for all write
11641 accesses to memory. Enabled by default.
11642
11643 @item -fchkp-store-bounds
11644 @opindex fchkp-store-bounds
11645 @opindex fno-chkp-store-bounds
11646 Instructs Pointer Bounds Checker to generate bounds stores for
11647 pointer writes. Enabled by default.
11648
11649 @item -fchkp-instrument-calls
11650 @opindex fchkp-instrument-calls
11651 @opindex fno-chkp-instrument-calls
11652 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
11653 Enabled by default.
11654
11655 @item -fchkp-instrument-marked-only
11656 @opindex fchkp-instrument-marked-only
11657 @opindex fno-chkp-instrument-marked-only
11658 Instructs Pointer Bounds Checker to instrument only functions
11659 marked with the @code{bnd_instrument} attribute
11660 (@pxref{Function Attributes}). Disabled by default.
11661
11662 @item -fchkp-use-wrappers
11663 @opindex fchkp-use-wrappers
11664 @opindex fno-chkp-use-wrappers
11665 Allows Pointer Bounds Checker to replace calls to built-in functions
11666 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
11667 is used to link a program, the GCC driver automatically links
11668 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
11669 Enabled by default.
11670
11671 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
11672 @opindex fcf-protection
11673 Enable code instrumentation of control-flow transfers to increase
11674 program security by checking that target addresses of control-flow
11675 transfer instructions (such as indirect function call, function return,
11676 indirect jump) are valid. This prevents diverting the flow of control
11677 to an unexpected target. This is intended to protect against such
11678 threats as Return-oriented Programming (ROP), and similarly
11679 call/jmp-oriented programming (COP/JOP).
11680
11681 The value @code{branch} tells the compiler to implement checking of
11682 validity of control-flow transfer at the point of indirect branch
11683 instructions, i.e. call/jmp instructions. The value @code{return}
11684 implements checking of validity at the point of returning from a
11685 function. The value @code{full} is an alias for specifying both
11686 @code{branch} and @code{return}. The value @code{none} turns off
11687 instrumentation.
11688
11689 You can also use the @code{nocf_check} attribute to identify
11690 which functions and calls should be skipped from instrumentation
11691 (@pxref{Function Attributes}).
11692
11693 Currently the x86 GNU/Linux target provides an implementation based
11694 on Intel Control-flow Enforcement Technology (CET). Instrumentation
11695 for x86 is controlled by target-specific options @option{-mcet},
11696 @option{-mibt} and @option{-mshstk} (@pxref{x86 Options}).
11697
11698 @item -fstack-protector
11699 @opindex fstack-protector
11700 Emit extra code to check for buffer overflows, such as stack smashing
11701 attacks. This is done by adding a guard variable to functions with
11702 vulnerable objects. This includes functions that call @code{alloca}, and
11703 functions with buffers larger than 8 bytes. The guards are initialized
11704 when a function is entered and then checked when the function exits.
11705 If a guard check fails, an error message is printed and the program exits.
11706
11707 @item -fstack-protector-all
11708 @opindex fstack-protector-all
11709 Like @option{-fstack-protector} except that all functions are protected.
11710
11711 @item -fstack-protector-strong
11712 @opindex fstack-protector-strong
11713 Like @option{-fstack-protector} but includes additional functions to
11714 be protected --- those that have local array definitions, or have
11715 references to local frame addresses.
11716
11717 @item -fstack-protector-explicit
11718 @opindex fstack-protector-explicit
11719 Like @option{-fstack-protector} but only protects those functions which
11720 have the @code{stack_protect} attribute.
11721
11722 @item -fstack-check
11723 @opindex fstack-check
11724 Generate code to verify that you do not go beyond the boundary of the
11725 stack. You should specify this flag if you are running in an
11726 environment with multiple threads, but you only rarely need to specify it in
11727 a single-threaded environment since stack overflow is automatically
11728 detected on nearly all systems if there is only one stack.
11729
11730 Note that this switch does not actually cause checking to be done; the
11731 operating system or the language runtime must do that. The switch causes
11732 generation of code to ensure that they see the stack being extended.
11733
11734 You can additionally specify a string parameter: @samp{no} means no
11735 checking, @samp{generic} means force the use of old-style checking,
11736 @samp{specific} means use the best checking method and is equivalent
11737 to bare @option{-fstack-check}.
11738
11739 Old-style checking is a generic mechanism that requires no specific
11740 target support in the compiler but comes with the following drawbacks:
11741
11742 @enumerate
11743 @item
11744 Modified allocation strategy for large objects: they are always
11745 allocated dynamically if their size exceeds a fixed threshold. Note this
11746 may change the semantics of some code.
11747
11748 @item
11749 Fixed limit on the size of the static frame of functions: when it is
11750 topped by a particular function, stack checking is not reliable and
11751 a warning is issued by the compiler.
11752
11753 @item
11754 Inefficiency: because of both the modified allocation strategy and the
11755 generic implementation, code performance is hampered.
11756 @end enumerate
11757
11758 Note that old-style stack checking is also the fallback method for
11759 @samp{specific} if no target support has been added in the compiler.
11760
11761 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
11762 and stack overflows. @samp{specific} is an excellent choice when compiling
11763 Ada code. It is not generally sufficient to protect against stack-clash
11764 attacks. To protect against those you want @samp{-fstack-clash-protection}.
11765
11766 @item -fstack-clash-protection
11767 @opindex fstack-clash-protection
11768 Generate code to prevent stack clash style attacks. When this option is
11769 enabled, the compiler will only allocate one page of stack space at a time
11770 and each page is accessed immediately after allocation. Thus, it prevents
11771 allocations from jumping over any stack guard page provided by the
11772 operating system.
11773
11774 Most targets do not fully support stack clash protection. However, on
11775 those targets @option{-fstack-clash-protection} will protect dynamic stack
11776 allocations. @option{-fstack-clash-protection} may also provide limited
11777 protection for static stack allocations if the target supports
11778 @option{-fstack-check=specific}.
11779
11780 @item -fstack-limit-register=@var{reg}
11781 @itemx -fstack-limit-symbol=@var{sym}
11782 @itemx -fno-stack-limit
11783 @opindex fstack-limit-register
11784 @opindex fstack-limit-symbol
11785 @opindex fno-stack-limit
11786 Generate code to ensure that the stack does not grow beyond a certain value,
11787 either the value of a register or the address of a symbol. If a larger
11788 stack is required, a signal is raised at run time. For most targets,
11789 the signal is raised before the stack overruns the boundary, so
11790 it is possible to catch the signal without taking special precautions.
11791
11792 For instance, if the stack starts at absolute address @samp{0x80000000}
11793 and grows downwards, you can use the flags
11794 @option{-fstack-limit-symbol=__stack_limit} and
11795 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11796 of 128KB@. Note that this may only work with the GNU linker.
11797
11798 You can locally override stack limit checking by using the
11799 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11800
11801 @item -fsplit-stack
11802 @opindex fsplit-stack
11803 Generate code to automatically split the stack before it overflows.
11804 The resulting program has a discontiguous stack which can only
11805 overflow if the program is unable to allocate any more memory. This
11806 is most useful when running threaded programs, as it is no longer
11807 necessary to calculate a good stack size to use for each thread. This
11808 is currently only implemented for the x86 targets running
11809 GNU/Linux.
11810
11811 When code compiled with @option{-fsplit-stack} calls code compiled
11812 without @option{-fsplit-stack}, there may not be much stack space
11813 available for the latter code to run. If compiling all code,
11814 including library code, with @option{-fsplit-stack} is not an option,
11815 then the linker can fix up these calls so that the code compiled
11816 without @option{-fsplit-stack} always has a large stack. Support for
11817 this is implemented in the gold linker in GNU binutils release 2.21
11818 and later.
11819
11820 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
11821 @opindex fvtable-verify
11822 This option is only available when compiling C++ code.
11823 It turns on (or off, if using @option{-fvtable-verify=none}) the security
11824 feature that verifies at run time, for every virtual call, that
11825 the vtable pointer through which the call is made is valid for the type of
11826 the object, and has not been corrupted or overwritten. If an invalid vtable
11827 pointer is detected at run time, an error is reported and execution of the
11828 program is immediately halted.
11829
11830 This option causes run-time data structures to be built at program startup,
11831 which are used for verifying the vtable pointers.
11832 The options @samp{std} and @samp{preinit}
11833 control the timing of when these data structures are built. In both cases the
11834 data structures are built before execution reaches @code{main}. Using
11835 @option{-fvtable-verify=std} causes the data structures to be built after
11836 shared libraries have been loaded and initialized.
11837 @option{-fvtable-verify=preinit} causes them to be built before shared
11838 libraries have been loaded and initialized.
11839
11840 If this option appears multiple times in the command line with different
11841 values specified, @samp{none} takes highest priority over both @samp{std} and
11842 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
11843
11844 @item -fvtv-debug
11845 @opindex fvtv-debug
11846 When used in conjunction with @option{-fvtable-verify=std} or
11847 @option{-fvtable-verify=preinit}, causes debug versions of the
11848 runtime functions for the vtable verification feature to be called.
11849 This flag also causes the compiler to log information about which
11850 vtable pointers it finds for each class.
11851 This information is written to a file named @file{vtv_set_ptr_data.log}
11852 in the directory named by the environment variable @env{VTV_LOGS_DIR}
11853 if that is defined or the current working directory otherwise.
11854
11855 Note: This feature @emph{appends} data to the log file. If you want a fresh log
11856 file, be sure to delete any existing one.
11857
11858 @item -fvtv-counts
11859 @opindex fvtv-counts
11860 This is a debugging flag. When used in conjunction with
11861 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
11862 causes the compiler to keep track of the total number of virtual calls
11863 it encounters and the number of verifications it inserts. It also
11864 counts the number of calls to certain run-time library functions
11865 that it inserts and logs this information for each compilation unit.
11866 The compiler writes this information to a file named
11867 @file{vtv_count_data.log} in the directory named by the environment
11868 variable @env{VTV_LOGS_DIR} if that is defined or the current working
11869 directory otherwise. It also counts the size of the vtable pointer sets
11870 for each class, and writes this information to @file{vtv_class_set_sizes.log}
11871 in the same directory.
11872
11873 Note: This feature @emph{appends} data to the log files. To get fresh log
11874 files, be sure to delete any existing ones.
11875
11876 @item -finstrument-functions
11877 @opindex finstrument-functions
11878 Generate instrumentation calls for entry and exit to functions. Just
11879 after function entry and just before function exit, the following
11880 profiling functions are called with the address of the current
11881 function and its call site. (On some platforms,
11882 @code{__builtin_return_address} does not work beyond the current
11883 function, so the call site information may not be available to the
11884 profiling functions otherwise.)
11885
11886 @smallexample
11887 void __cyg_profile_func_enter (void *this_fn,
11888 void *call_site);
11889 void __cyg_profile_func_exit (void *this_fn,
11890 void *call_site);
11891 @end smallexample
11892
11893 The first argument is the address of the start of the current function,
11894 which may be looked up exactly in the symbol table.
11895
11896 This instrumentation is also done for functions expanded inline in other
11897 functions. The profiling calls indicate where, conceptually, the
11898 inline function is entered and exited. This means that addressable
11899 versions of such functions must be available. If all your uses of a
11900 function are expanded inline, this may mean an additional expansion of
11901 code size. If you use @code{extern inline} in your C code, an
11902 addressable version of such functions must be provided. (This is
11903 normally the case anyway, but if you get lucky and the optimizer always
11904 expands the functions inline, you might have gotten away without
11905 providing static copies.)
11906
11907 A function may be given the attribute @code{no_instrument_function}, in
11908 which case this instrumentation is not done. This can be used, for
11909 example, for the profiling functions listed above, high-priority
11910 interrupt routines, and any functions from which the profiling functions
11911 cannot safely be called (perhaps signal handlers, if the profiling
11912 routines generate output or allocate memory).
11913
11914 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
11915 @opindex finstrument-functions-exclude-file-list
11916
11917 Set the list of functions that are excluded from instrumentation (see
11918 the description of @option{-finstrument-functions}). If the file that
11919 contains a function definition matches with one of @var{file}, then
11920 that function is not instrumented. The match is done on substrings:
11921 if the @var{file} parameter is a substring of the file name, it is
11922 considered to be a match.
11923
11924 For example:
11925
11926 @smallexample
11927 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
11928 @end smallexample
11929
11930 @noindent
11931 excludes any inline function defined in files whose pathnames
11932 contain @file{/bits/stl} or @file{include/sys}.
11933
11934 If, for some reason, you want to include letter @samp{,} in one of
11935 @var{sym}, write @samp{\,}. For example,
11936 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
11937 (note the single quote surrounding the option).
11938
11939 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
11940 @opindex finstrument-functions-exclude-function-list
11941
11942 This is similar to @option{-finstrument-functions-exclude-file-list},
11943 but this option sets the list of function names to be excluded from
11944 instrumentation. The function name to be matched is its user-visible
11945 name, such as @code{vector<int> blah(const vector<int> &)}, not the
11946 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
11947 match is done on substrings: if the @var{sym} parameter is a substring
11948 of the function name, it is considered to be a match. For C99 and C++
11949 extended identifiers, the function name must be given in UTF-8, not
11950 using universal character names.
11951
11952 @item -fpatchable-function-entry=@var{N}[,@var{M}]
11953 @opindex fpatchable-function-entry
11954 Generate @var{N} NOPs right at the beginning
11955 of each function, with the function entry point before the @var{M}th NOP.
11956 If @var{M} is omitted, it defaults to @code{0} so the
11957 function entry points to the address just at the first NOP.
11958 The NOP instructions reserve extra space which can be used to patch in
11959 any desired instrumentation at run time, provided that the code segment
11960 is writable. The amount of space is controllable indirectly via
11961 the number of NOPs; the NOP instruction used corresponds to the instruction
11962 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
11963 is target-specific and may also depend on the architecture variant and/or
11964 other compilation options.
11965
11966 For run-time identification, the starting addresses of these areas,
11967 which correspond to their respective function entries minus @var{M},
11968 are additionally collected in the @code{__patchable_function_entries}
11969 section of the resulting binary.
11970
11971 Note that the value of @code{__attribute__ ((patchable_function_entry
11972 (N,M)))} takes precedence over command-line option
11973 @option{-fpatchable-function-entry=N,M}. This can be used to increase
11974 the area size or to remove it completely on a single function.
11975 If @code{N=0}, no pad location is recorded.
11976
11977 The NOP instructions are inserted at---and maybe before, depending on
11978 @var{M}---the function entry address, even before the prologue.
11979
11980 @end table
11981
11982
11983 @node Preprocessor Options
11984 @section Options Controlling the Preprocessor
11985 @cindex preprocessor options
11986 @cindex options, preprocessor
11987
11988 These options control the C preprocessor, which is run on each C source
11989 file before actual compilation.
11990
11991 If you use the @option{-E} option, nothing is done except preprocessing.
11992 Some of these options make sense only together with @option{-E} because
11993 they cause the preprocessor output to be unsuitable for actual
11994 compilation.
11995
11996 In addition to the options listed here, there are a number of options
11997 to control search paths for include files documented in
11998 @ref{Directory Options}.
11999 Options to control preprocessor diagnostics are listed in
12000 @ref{Warning Options}.
12001
12002 @table @gcctabopt
12003 @include cppopts.texi
12004
12005 @item -Wp,@var{option}
12006 @opindex Wp
12007 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12008 and pass @var{option} directly through to the preprocessor. If
12009 @var{option} contains commas, it is split into multiple options at the
12010 commas. However, many options are modified, translated or interpreted
12011 by the compiler driver before being passed to the preprocessor, and
12012 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12013 interface is undocumented and subject to change, so whenever possible
12014 you should avoid using @option{-Wp} and let the driver handle the
12015 options instead.
12016
12017 @item -Xpreprocessor @var{option}
12018 @opindex Xpreprocessor
12019 Pass @var{option} as an option to the preprocessor. You can use this to
12020 supply system-specific preprocessor options that GCC does not
12021 recognize.
12022
12023 If you want to pass an option that takes an argument, you must use
12024 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12025
12026 @item -no-integrated-cpp
12027 @opindex no-integrated-cpp
12028 Perform preprocessing as a separate pass before compilation.
12029 By default, GCC performs preprocessing as an integrated part of
12030 input tokenization and parsing.
12031 If this option is provided, the appropriate language front end
12032 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12033 and Objective-C, respectively) is instead invoked twice,
12034 once for preprocessing only and once for actual compilation
12035 of the preprocessed input.
12036 This option may be useful in conjunction with the @option{-B} or
12037 @option{-wrapper} options to specify an alternate preprocessor or
12038 perform additional processing of the program source between
12039 normal preprocessing and compilation.
12040
12041 @end table
12042
12043 @node Assembler Options
12044 @section Passing Options to the Assembler
12045
12046 @c prevent bad page break with this line
12047 You can pass options to the assembler.
12048
12049 @table @gcctabopt
12050 @item -Wa,@var{option}
12051 @opindex Wa
12052 Pass @var{option} as an option to the assembler. If @var{option}
12053 contains commas, it is split into multiple options at the commas.
12054
12055 @item -Xassembler @var{option}
12056 @opindex Xassembler
12057 Pass @var{option} as an option to the assembler. You can use this to
12058 supply system-specific assembler options that GCC does not
12059 recognize.
12060
12061 If you want to pass an option that takes an argument, you must use
12062 @option{-Xassembler} twice, once for the option and once for the argument.
12063
12064 @end table
12065
12066 @node Link Options
12067 @section Options for Linking
12068 @cindex link options
12069 @cindex options, linking
12070
12071 These options come into play when the compiler links object files into
12072 an executable output file. They are meaningless if the compiler is
12073 not doing a link step.
12074
12075 @table @gcctabopt
12076 @cindex file names
12077 @item @var{object-file-name}
12078 A file name that does not end in a special recognized suffix is
12079 considered to name an object file or library. (Object files are
12080 distinguished from libraries by the linker according to the file
12081 contents.) If linking is done, these object files are used as input
12082 to the linker.
12083
12084 @item -c
12085 @itemx -S
12086 @itemx -E
12087 @opindex c
12088 @opindex S
12089 @opindex E
12090 If any of these options is used, then the linker is not run, and
12091 object file names should not be used as arguments. @xref{Overall
12092 Options}.
12093
12094 @item -fuse-ld=bfd
12095 @opindex fuse-ld=bfd
12096 Use the @command{bfd} linker instead of the default linker.
12097
12098 @item -fuse-ld=gold
12099 @opindex fuse-ld=gold
12100 Use the @command{gold} linker instead of the default linker.
12101
12102 @cindex Libraries
12103 @item -l@var{library}
12104 @itemx -l @var{library}
12105 @opindex l
12106 Search the library named @var{library} when linking. (The second
12107 alternative with the library as a separate argument is only for
12108 POSIX compliance and is not recommended.)
12109
12110 It makes a difference where in the command you write this option; the
12111 linker searches and processes libraries and object files in the order they
12112 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
12113 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
12114 to functions in @samp{z}, those functions may not be loaded.
12115
12116 The linker searches a standard list of directories for the library,
12117 which is actually a file named @file{lib@var{library}.a}. The linker
12118 then uses this file as if it had been specified precisely by name.
12119
12120 The directories searched include several standard system directories
12121 plus any that you specify with @option{-L}.
12122
12123 Normally the files found this way are library files---archive files
12124 whose members are object files. The linker handles an archive file by
12125 scanning through it for members which define symbols that have so far
12126 been referenced but not defined. But if the file that is found is an
12127 ordinary object file, it is linked in the usual fashion. The only
12128 difference between using an @option{-l} option and specifying a file name
12129 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
12130 and searches several directories.
12131
12132 @item -lobjc
12133 @opindex lobjc
12134 You need this special case of the @option{-l} option in order to
12135 link an Objective-C or Objective-C++ program.
12136
12137 @item -nostartfiles
12138 @opindex nostartfiles
12139 Do not use the standard system startup files when linking.
12140 The standard system libraries are used normally, unless @option{-nostdlib}
12141 or @option{-nodefaultlibs} is used.
12142
12143 @item -nodefaultlibs
12144 @opindex nodefaultlibs
12145 Do not use the standard system libraries when linking.
12146 Only the libraries you specify are passed to the linker, and options
12147 specifying linkage of the system libraries, such as @option{-static-libgcc}
12148 or @option{-shared-libgcc}, are ignored.
12149 The standard startup files are used normally, unless @option{-nostartfiles}
12150 is used.
12151
12152 The compiler may generate calls to @code{memcmp},
12153 @code{memset}, @code{memcpy} and @code{memmove}.
12154 These entries are usually resolved by entries in
12155 libc. These entry points should be supplied through some other
12156 mechanism when this option is specified.
12157
12158 @item -nostdlib
12159 @opindex nostdlib
12160 Do not use the standard system startup files or libraries when linking.
12161 No startup files and only the libraries you specify are passed to
12162 the linker, and options specifying linkage of the system libraries, such as
12163 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
12164
12165 The compiler may generate calls to @code{memcmp}, @code{memset},
12166 @code{memcpy} and @code{memmove}.
12167 These entries are usually resolved by entries in
12168 libc. These entry points should be supplied through some other
12169 mechanism when this option is specified.
12170
12171 @cindex @option{-lgcc}, use with @option{-nostdlib}
12172 @cindex @option{-nostdlib} and unresolved references
12173 @cindex unresolved references and @option{-nostdlib}
12174 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
12175 @cindex @option{-nodefaultlibs} and unresolved references
12176 @cindex unresolved references and @option{-nodefaultlibs}
12177 One of the standard libraries bypassed by @option{-nostdlib} and
12178 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
12179 which GCC uses to overcome shortcomings of particular machines, or special
12180 needs for some languages.
12181 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
12182 Collection (GCC) Internals},
12183 for more discussion of @file{libgcc.a}.)
12184 In most cases, you need @file{libgcc.a} even when you want to avoid
12185 other standard libraries. In other words, when you specify @option{-nostdlib}
12186 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
12187 This ensures that you have no unresolved references to internal GCC
12188 library subroutines.
12189 (An example of such an internal subroutine is @code{__main}, used to ensure C++
12190 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
12191 GNU Compiler Collection (GCC) Internals}.)
12192
12193 @item -pie
12194 @opindex pie
12195 Produce a dynamically linked position independent executable on targets
12196 that support it. For predictable results, you must also specify the same
12197 set of options used for compilation (@option{-fpie}, @option{-fPIE},
12198 or model suboptions) when you specify this linker option.
12199
12200 @item -no-pie
12201 @opindex no-pie
12202 Don't produce a dynamically linked position independent executable.
12203
12204 @item -static-pie
12205 @opindex static-pie
12206 Produce a static position independent executable on targets that support
12207 it. A static position independent executable is similar to a static
12208 executable, but can be loaded at any address without a dynamic linker.
12209 For predictable results, you must also specify the same set of options
12210 used for compilation (@option{-fpie}, @option{-fPIE}, or model
12211 suboptions) when you specify this linker option.
12212
12213 @item -pthread
12214 @opindex pthread
12215 Link with the POSIX threads library. This option is supported on
12216 GNU/Linux targets, most other Unix derivatives, and also on
12217 x86 Cygwin and MinGW targets. On some targets this option also sets
12218 flags for the preprocessor, so it should be used consistently for both
12219 compilation and linking.
12220
12221 @item -rdynamic
12222 @opindex rdynamic
12223 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
12224 that support it. This instructs the linker to add all symbols, not
12225 only used ones, to the dynamic symbol table. This option is needed
12226 for some uses of @code{dlopen} or to allow obtaining backtraces
12227 from within a program.
12228
12229 @item -s
12230 @opindex s
12231 Remove all symbol table and relocation information from the executable.
12232
12233 @item -static
12234 @opindex static
12235 On systems that support dynamic linking, this overrides @option{-pie}
12236 and prevents linking with the shared libraries. On other systems, this
12237 option has no effect.
12238
12239 @item -shared
12240 @opindex shared
12241 Produce a shared object which can then be linked with other objects to
12242 form an executable. Not all systems support this option. For predictable
12243 results, you must also specify the same set of options used for compilation
12244 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
12245 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
12246 needs to build supplementary stub code for constructors to work. On
12247 multi-libbed systems, @samp{gcc -shared} must select the correct support
12248 libraries to link against. Failing to supply the correct flags may lead
12249 to subtle defects. Supplying them in cases where they are not necessary
12250 is innocuous.}
12251
12252 @item -shared-libgcc
12253 @itemx -static-libgcc
12254 @opindex shared-libgcc
12255 @opindex static-libgcc
12256 On systems that provide @file{libgcc} as a shared library, these options
12257 force the use of either the shared or static version, respectively.
12258 If no shared version of @file{libgcc} was built when the compiler was
12259 configured, these options have no effect.
12260
12261 There are several situations in which an application should use the
12262 shared @file{libgcc} instead of the static version. The most common
12263 of these is when the application wishes to throw and catch exceptions
12264 across different shared libraries. In that case, each of the libraries
12265 as well as the application itself should use the shared @file{libgcc}.
12266
12267 Therefore, the G++ and driver automatically adds @option{-shared-libgcc}
12268 whenever you build a shared library or a main executable, because C++
12269 programs typically use exceptions, so this is the right thing to do.
12270
12271 If, instead, you use the GCC driver to create shared libraries, you may
12272 find that they are not always linked with the shared @file{libgcc}.
12273 If GCC finds, at its configuration time, that you have a non-GNU linker
12274 or a GNU linker that does not support option @option{--eh-frame-hdr},
12275 it links the shared version of @file{libgcc} into shared libraries
12276 by default. Otherwise, it takes advantage of the linker and optimizes
12277 away the linking with the shared version of @file{libgcc}, linking with
12278 the static version of libgcc by default. This allows exceptions to
12279 propagate through such shared libraries, without incurring relocation
12280 costs at library load time.
12281
12282 However, if a library or main executable is supposed to throw or catch
12283 exceptions, you must link it using the G++ driver, as appropriate
12284 for the languages used in the program, or using the option
12285 @option{-shared-libgcc}, such that it is linked with the shared
12286 @file{libgcc}.
12287
12288 @item -static-libasan
12289 @opindex static-libasan
12290 When the @option{-fsanitize=address} option is used to link a program,
12291 the GCC driver automatically links against @option{libasan}. If
12292 @file{libasan} is available as a shared library, and the @option{-static}
12293 option is not used, then this links against the shared version of
12294 @file{libasan}. The @option{-static-libasan} option directs the GCC
12295 driver to link @file{libasan} statically, without necessarily linking
12296 other libraries statically.
12297
12298 @item -static-libtsan
12299 @opindex static-libtsan
12300 When the @option{-fsanitize=thread} option is used to link a program,
12301 the GCC driver automatically links against @option{libtsan}. If
12302 @file{libtsan} is available as a shared library, and the @option{-static}
12303 option is not used, then this links against the shared version of
12304 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
12305 driver to link @file{libtsan} statically, without necessarily linking
12306 other libraries statically.
12307
12308 @item -static-liblsan
12309 @opindex static-liblsan
12310 When the @option{-fsanitize=leak} option is used to link a program,
12311 the GCC driver automatically links against @option{liblsan}. If
12312 @file{liblsan} is available as a shared library, and the @option{-static}
12313 option is not used, then this links against the shared version of
12314 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
12315 driver to link @file{liblsan} statically, without necessarily linking
12316 other libraries statically.
12317
12318 @item -static-libubsan
12319 @opindex static-libubsan
12320 When the @option{-fsanitize=undefined} option is used to link a program,
12321 the GCC driver automatically links against @option{libubsan}. If
12322 @file{libubsan} is available as a shared library, and the @option{-static}
12323 option is not used, then this links against the shared version of
12324 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
12325 driver to link @file{libubsan} statically, without necessarily linking
12326 other libraries statically.
12327
12328 @item -static-libmpx
12329 @opindex static-libmpx
12330 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
12331 used to link a program, the GCC driver automatically links against
12332 @file{libmpx}. If @file{libmpx} is available as a shared library,
12333 and the @option{-static} option is not used, then this links against
12334 the shared version of @file{libmpx}. The @option{-static-libmpx}
12335 option directs the GCC driver to link @file{libmpx} statically,
12336 without necessarily linking other libraries statically.
12337
12338 @item -static-libmpxwrappers
12339 @opindex static-libmpxwrappers
12340 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
12341 to link a program without also using @option{-fno-chkp-use-wrappers}, the
12342 GCC driver automatically links against @file{libmpxwrappers}. If
12343 @file{libmpxwrappers} is available as a shared library, and the
12344 @option{-static} option is not used, then this links against the shared
12345 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
12346 option directs the GCC driver to link @file{libmpxwrappers} statically,
12347 without necessarily linking other libraries statically.
12348
12349 @item -static-libstdc++
12350 @opindex static-libstdc++
12351 When the @command{g++} program is used to link a C++ program, it
12352 normally automatically links against @option{libstdc++}. If
12353 @file{libstdc++} is available as a shared library, and the
12354 @option{-static} option is not used, then this links against the
12355 shared version of @file{libstdc++}. That is normally fine. However, it
12356 is sometimes useful to freeze the version of @file{libstdc++} used by
12357 the program without going all the way to a fully static link. The
12358 @option{-static-libstdc++} option directs the @command{g++} driver to
12359 link @file{libstdc++} statically, without necessarily linking other
12360 libraries statically.
12361
12362 @item -symbolic
12363 @opindex symbolic
12364 Bind references to global symbols when building a shared object. Warn
12365 about any unresolved references (unless overridden by the link editor
12366 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
12367 this option.
12368
12369 @item -T @var{script}
12370 @opindex T
12371 @cindex linker script
12372 Use @var{script} as the linker script. This option is supported by most
12373 systems using the GNU linker. On some targets, such as bare-board
12374 targets without an operating system, the @option{-T} option may be required
12375 when linking to avoid references to undefined symbols.
12376
12377 @item -Xlinker @var{option}
12378 @opindex Xlinker
12379 Pass @var{option} as an option to the linker. You can use this to
12380 supply system-specific linker options that GCC does not recognize.
12381
12382 If you want to pass an option that takes a separate argument, you must use
12383 @option{-Xlinker} twice, once for the option and once for the argument.
12384 For example, to pass @option{-assert definitions}, you must write
12385 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
12386 @option{-Xlinker "-assert definitions"}, because this passes the entire
12387 string as a single argument, which is not what the linker expects.
12388
12389 When using the GNU linker, it is usually more convenient to pass
12390 arguments to linker options using the @option{@var{option}=@var{value}}
12391 syntax than as separate arguments. For example, you can specify
12392 @option{-Xlinker -Map=output.map} rather than
12393 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
12394 this syntax for command-line options.
12395
12396 @item -Wl,@var{option}
12397 @opindex Wl
12398 Pass @var{option} as an option to the linker. If @var{option} contains
12399 commas, it is split into multiple options at the commas. You can use this
12400 syntax to pass an argument to the option.
12401 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
12402 linker. When using the GNU linker, you can also get the same effect with
12403 @option{-Wl,-Map=output.map}.
12404
12405 @item -u @var{symbol}
12406 @opindex u
12407 Pretend the symbol @var{symbol} is undefined, to force linking of
12408 library modules to define it. You can use @option{-u} multiple times with
12409 different symbols to force loading of additional library modules.
12410
12411 @item -z @var{keyword}
12412 @opindex z
12413 @option{-z} is passed directly on to the linker along with the keyword
12414 @var{keyword}. See the section in the documentation of your linker for
12415 permitted values and their meanings.
12416 @end table
12417
12418 @node Directory Options
12419 @section Options for Directory Search
12420 @cindex directory options
12421 @cindex options, directory search
12422 @cindex search path
12423
12424 These options specify directories to search for header files, for
12425 libraries and for parts of the compiler:
12426
12427 @table @gcctabopt
12428 @include cppdiropts.texi
12429
12430 @item -iplugindir=@var{dir}
12431 @opindex iplugindir=
12432 Set the directory to search for plugins that are passed
12433 by @option{-fplugin=@var{name}} instead of
12434 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
12435 to be used by the user, but only passed by the driver.
12436
12437 @item -L@var{dir}
12438 @opindex L
12439 Add directory @var{dir} to the list of directories to be searched
12440 for @option{-l}.
12441
12442 @item -B@var{prefix}
12443 @opindex B
12444 This option specifies where to find the executables, libraries,
12445 include files, and data files of the compiler itself.
12446
12447 The compiler driver program runs one or more of the subprograms
12448 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
12449 @var{prefix} as a prefix for each program it tries to run, both with and
12450 without @samp{@var{machine}/@var{version}/} for the corresponding target
12451 machine and compiler version.
12452
12453 For each subprogram to be run, the compiler driver first tries the
12454 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
12455 is not specified, the driver tries two standard prefixes,
12456 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
12457 those results in a file name that is found, the unmodified program
12458 name is searched for using the directories specified in your
12459 @env{PATH} environment variable.
12460
12461 The compiler checks to see if the path provided by @option{-B}
12462 refers to a directory, and if necessary it adds a directory
12463 separator character at the end of the path.
12464
12465 @option{-B} prefixes that effectively specify directory names also apply
12466 to libraries in the linker, because the compiler translates these
12467 options into @option{-L} options for the linker. They also apply to
12468 include files in the preprocessor, because the compiler translates these
12469 options into @option{-isystem} options for the preprocessor. In this case,
12470 the compiler appends @samp{include} to the prefix.
12471
12472 The runtime support file @file{libgcc.a} can also be searched for using
12473 the @option{-B} prefix, if needed. If it is not found there, the two
12474 standard prefixes above are tried, and that is all. The file is left
12475 out of the link if it is not found by those means.
12476
12477 Another way to specify a prefix much like the @option{-B} prefix is to use
12478 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
12479 Variables}.
12480
12481 As a special kludge, if the path provided by @option{-B} is
12482 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
12483 9, then it is replaced by @file{[dir/]include}. This is to help
12484 with boot-strapping the compiler.
12485
12486 @item -no-canonical-prefixes
12487 @opindex no-canonical-prefixes
12488 Do not expand any symbolic links, resolve references to @samp{/../}
12489 or @samp{/./}, or make the path absolute when generating a relative
12490 prefix.
12491
12492 @item --sysroot=@var{dir}
12493 @opindex sysroot
12494 Use @var{dir} as the logical root directory for headers and libraries.
12495 For example, if the compiler normally searches for headers in
12496 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
12497 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
12498
12499 If you use both this option and the @option{-isysroot} option, then
12500 the @option{--sysroot} option applies to libraries, but the
12501 @option{-isysroot} option applies to header files.
12502
12503 The GNU linker (beginning with version 2.16) has the necessary support
12504 for this option. If your linker does not support this option, the
12505 header file aspect of @option{--sysroot} still works, but the
12506 library aspect does not.
12507
12508 @item --no-sysroot-suffix
12509 @opindex no-sysroot-suffix
12510 For some targets, a suffix is added to the root directory specified
12511 with @option{--sysroot}, depending on the other options used, so that
12512 headers may for example be found in
12513 @file{@var{dir}/@var{suffix}/usr/include} instead of
12514 @file{@var{dir}/usr/include}. This option disables the addition of
12515 such a suffix.
12516
12517 @end table
12518
12519 @node Code Gen Options
12520 @section Options for Code Generation Conventions
12521 @cindex code generation conventions
12522 @cindex options, code generation
12523 @cindex run-time options
12524
12525 These machine-independent options control the interface conventions
12526 used in code generation.
12527
12528 Most of them have both positive and negative forms; the negative form
12529 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
12530 one of the forms is listed---the one that is not the default. You
12531 can figure out the other form by either removing @samp{no-} or adding
12532 it.
12533
12534 @table @gcctabopt
12535 @item -fstack-reuse=@var{reuse-level}
12536 @opindex fstack_reuse
12537 This option controls stack space reuse for user declared local/auto variables
12538 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
12539 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
12540 local variables and temporaries, @samp{named_vars} enables the reuse only for
12541 user defined local variables with names, and @samp{none} disables stack reuse
12542 completely. The default value is @samp{all}. The option is needed when the
12543 program extends the lifetime of a scoped local variable or a compiler generated
12544 temporary beyond the end point defined by the language. When a lifetime of
12545 a variable ends, and if the variable lives in memory, the optimizing compiler
12546 has the freedom to reuse its stack space with other temporaries or scoped
12547 local variables whose live range does not overlap with it. Legacy code extending
12548 local lifetime is likely to break with the stack reuse optimization.
12549
12550 For example,
12551
12552 @smallexample
12553 int *p;
12554 @{
12555 int local1;
12556
12557 p = &local1;
12558 local1 = 10;
12559 ....
12560 @}
12561 @{
12562 int local2;
12563 local2 = 20;
12564 ...
12565 @}
12566
12567 if (*p == 10) // out of scope use of local1
12568 @{
12569
12570 @}
12571 @end smallexample
12572
12573 Another example:
12574 @smallexample
12575
12576 struct A
12577 @{
12578 A(int k) : i(k), j(k) @{ @}
12579 int i;
12580 int j;
12581 @};
12582
12583 A *ap;
12584
12585 void foo(const A& ar)
12586 @{
12587 ap = &ar;
12588 @}
12589
12590 void bar()
12591 @{
12592 foo(A(10)); // temp object's lifetime ends when foo returns
12593
12594 @{
12595 A a(20);
12596 ....
12597 @}
12598 ap->i+= 10; // ap references out of scope temp whose space
12599 // is reused with a. What is the value of ap->i?
12600 @}
12601
12602 @end smallexample
12603
12604 The lifetime of a compiler generated temporary is well defined by the C++
12605 standard. When a lifetime of a temporary ends, and if the temporary lives
12606 in memory, the optimizing compiler has the freedom to reuse its stack
12607 space with other temporaries or scoped local variables whose live range
12608 does not overlap with it. However some of the legacy code relies on
12609 the behavior of older compilers in which temporaries' stack space is
12610 not reused, the aggressive stack reuse can lead to runtime errors. This
12611 option is used to control the temporary stack reuse optimization.
12612
12613 @item -ftrapv
12614 @opindex ftrapv
12615 This option generates traps for signed overflow on addition, subtraction,
12616 multiplication operations.
12617 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12618 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12619 @option{-fwrapv} being effective. Note that only active options override, so
12620 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12621 results in @option{-ftrapv} being effective.
12622
12623 @item -fwrapv
12624 @opindex fwrapv
12625 This option instructs the compiler to assume that signed arithmetic
12626 overflow of addition, subtraction and multiplication wraps around
12627 using twos-complement representation. This flag enables some optimizations
12628 and disables others.
12629 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12630 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12631 @option{-fwrapv} being effective. Note that only active options override, so
12632 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12633 results in @option{-ftrapv} being effective.
12634
12635 @item -fwrapv-pointer
12636 @opindex fwrapv-pointer
12637 This option instructs the compiler to assume that pointer arithmetic
12638 overflow on addition and subtraction wraps around using twos-complement
12639 representation. This flag disables some optimizations which assume
12640 pointer overflow is invalid.
12641
12642 @item -fstrict-overflow
12643 @opindex fstrict-overflow
12644 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
12645 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
12646
12647 @item -fexceptions
12648 @opindex fexceptions
12649 Enable exception handling. Generates extra code needed to propagate
12650 exceptions. For some targets, this implies GCC generates frame
12651 unwind information for all functions, which can produce significant data
12652 size overhead, although it does not affect execution. If you do not
12653 specify this option, GCC enables it by default for languages like
12654 C++ that normally require exception handling, and disables it for
12655 languages like C that do not normally require it. However, you may need
12656 to enable this option when compiling C code that needs to interoperate
12657 properly with exception handlers written in C++. You may also wish to
12658 disable this option if you are compiling older C++ programs that don't
12659 use exception handling.
12660
12661 @item -fnon-call-exceptions
12662 @opindex fnon-call-exceptions
12663 Generate code that allows trapping instructions to throw exceptions.
12664 Note that this requires platform-specific runtime support that does
12665 not exist everywhere. Moreover, it only allows @emph{trapping}
12666 instructions to throw exceptions, i.e.@: memory references or floating-point
12667 instructions. It does not allow exceptions to be thrown from
12668 arbitrary signal handlers such as @code{SIGALRM}.
12669
12670 @item -fdelete-dead-exceptions
12671 @opindex fdelete-dead-exceptions
12672 Consider that instructions that may throw exceptions but don't otherwise
12673 contribute to the execution of the program can be optimized away.
12674 This option is enabled by default for the Ada front end, as permitted by
12675 the Ada language specification.
12676 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
12677
12678 @item -funwind-tables
12679 @opindex funwind-tables
12680 Similar to @option{-fexceptions}, except that it just generates any needed
12681 static data, but does not affect the generated code in any other way.
12682 You normally do not need to enable this option; instead, a language processor
12683 that needs this handling enables it on your behalf.
12684
12685 @item -fasynchronous-unwind-tables
12686 @opindex fasynchronous-unwind-tables
12687 Generate unwind table in DWARF format, if supported by target machine. The
12688 table is exact at each instruction boundary, so it can be used for stack
12689 unwinding from asynchronous events (such as debugger or garbage collector).
12690
12691 @item -fno-gnu-unique
12692 @opindex fno-gnu-unique
12693 On systems with recent GNU assembler and C library, the C++ compiler
12694 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
12695 of template static data members and static local variables in inline
12696 functions are unique even in the presence of @code{RTLD_LOCAL}; this
12697 is necessary to avoid problems with a library used by two different
12698 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
12699 therefore disagreeing with the other one about the binding of the
12700 symbol. But this causes @code{dlclose} to be ignored for affected
12701 DSOs; if your program relies on reinitialization of a DSO via
12702 @code{dlclose} and @code{dlopen}, you can use
12703 @option{-fno-gnu-unique}.
12704
12705 @item -fpcc-struct-return
12706 @opindex fpcc-struct-return
12707 Return ``short'' @code{struct} and @code{union} values in memory like
12708 longer ones, rather than in registers. This convention is less
12709 efficient, but it has the advantage of allowing intercallability between
12710 GCC-compiled files and files compiled with other compilers, particularly
12711 the Portable C Compiler (pcc).
12712
12713 The precise convention for returning structures in memory depends
12714 on the target configuration macros.
12715
12716 Short structures and unions are those whose size and alignment match
12717 that of some integer type.
12718
12719 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
12720 switch is not binary compatible with code compiled with the
12721 @option{-freg-struct-return} switch.
12722 Use it to conform to a non-default application binary interface.
12723
12724 @item -freg-struct-return
12725 @opindex freg-struct-return
12726 Return @code{struct} and @code{union} values in registers when possible.
12727 This is more efficient for small structures than
12728 @option{-fpcc-struct-return}.
12729
12730 If you specify neither @option{-fpcc-struct-return} nor
12731 @option{-freg-struct-return}, GCC defaults to whichever convention is
12732 standard for the target. If there is no standard convention, GCC
12733 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
12734 the principal compiler. In those cases, we can choose the standard, and
12735 we chose the more efficient register return alternative.
12736
12737 @strong{Warning:} code compiled with the @option{-freg-struct-return}
12738 switch is not binary compatible with code compiled with the
12739 @option{-fpcc-struct-return} switch.
12740 Use it to conform to a non-default application binary interface.
12741
12742 @item -fshort-enums
12743 @opindex fshort-enums
12744 Allocate to an @code{enum} type only as many bytes as it needs for the
12745 declared range of possible values. Specifically, the @code{enum} type
12746 is equivalent to the smallest integer type that has enough room.
12747
12748 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
12749 code that is not binary compatible with code generated without that switch.
12750 Use it to conform to a non-default application binary interface.
12751
12752 @item -fshort-wchar
12753 @opindex fshort-wchar
12754 Override the underlying type for @code{wchar_t} to be @code{short
12755 unsigned int} instead of the default for the target. This option is
12756 useful for building programs to run under WINE@.
12757
12758 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
12759 code that is not binary compatible with code generated without that switch.
12760 Use it to conform to a non-default application binary interface.
12761
12762 @item -fno-common
12763 @opindex fno-common
12764 @cindex tentative definitions
12765 In C code, this option controls the placement of global variables
12766 defined without an initializer, known as @dfn{tentative definitions}
12767 in the C standard. Tentative definitions are distinct from declarations
12768 of a variable with the @code{extern} keyword, which do not allocate storage.
12769
12770 Unix C compilers have traditionally allocated storage for
12771 uninitialized global variables in a common block. This allows the
12772 linker to resolve all tentative definitions of the same variable
12773 in different compilation units to the same object, or to a non-tentative
12774 definition.
12775 This is the behavior specified by @option{-fcommon}, and is the default for
12776 GCC on most targets.
12777 On the other hand, this behavior is not required by ISO
12778 C, and on some targets may carry a speed or code size penalty on
12779 variable references.
12780
12781 The @option{-fno-common} option specifies that the compiler should instead
12782 place uninitialized global variables in the data section of the object file.
12783 This inhibits the merging of tentative definitions by the linker so
12784 you get a multiple-definition error if the same
12785 variable is defined in more than one compilation unit.
12786 Compiling with @option{-fno-common} is useful on targets for which
12787 it provides better performance, or if you wish to verify that the
12788 program will work on other systems that always treat uninitialized
12789 variable definitions this way.
12790
12791 @item -fno-ident
12792 @opindex fno-ident
12793 Ignore the @code{#ident} directive.
12794
12795 @item -finhibit-size-directive
12796 @opindex finhibit-size-directive
12797 Don't output a @code{.size} assembler directive, or anything else that
12798 would cause trouble if the function is split in the middle, and the
12799 two halves are placed at locations far apart in memory. This option is
12800 used when compiling @file{crtstuff.c}; you should not need to use it
12801 for anything else.
12802
12803 @item -fverbose-asm
12804 @opindex fverbose-asm
12805 Put extra commentary information in the generated assembly code to
12806 make it more readable. This option is generally only of use to those
12807 who actually need to read the generated assembly code (perhaps while
12808 debugging the compiler itself).
12809
12810 @option{-fno-verbose-asm}, the default, causes the
12811 extra information to be omitted and is useful when comparing two assembler
12812 files.
12813
12814 The added comments include:
12815
12816 @itemize @bullet
12817
12818 @item
12819 information on the compiler version and command-line options,
12820
12821 @item
12822 the source code lines associated with the assembly instructions,
12823 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12824
12825 @item
12826 hints on which high-level expressions correspond to
12827 the various assembly instruction operands.
12828
12829 @end itemize
12830
12831 For example, given this C source file:
12832
12833 @smallexample
12834 int test (int n)
12835 @{
12836 int i;
12837 int total = 0;
12838
12839 for (i = 0; i < n; i++)
12840 total += i * i;
12841
12842 return total;
12843 @}
12844 @end smallexample
12845
12846 compiling to (x86_64) assembly via @option{-S} and emitting the result
12847 direct to stdout via @option{-o} @option{-}
12848
12849 @smallexample
12850 gcc -S test.c -fverbose-asm -Os -o -
12851 @end smallexample
12852
12853 gives output similar to this:
12854
12855 @smallexample
12856 .file "test.c"
12857 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12858 [...snip...]
12859 # options passed:
12860 [...snip...]
12861
12862 .text
12863 .globl test
12864 .type test, @@function
12865 test:
12866 .LFB0:
12867 .cfi_startproc
12868 # test.c:4: int total = 0;
12869 xorl %eax, %eax # <retval>
12870 # test.c:6: for (i = 0; i < n; i++)
12871 xorl %edx, %edx # i
12872 .L2:
12873 # test.c:6: for (i = 0; i < n; i++)
12874 cmpl %edi, %edx # n, i
12875 jge .L5 #,
12876 # test.c:7: total += i * i;
12877 movl %edx, %ecx # i, tmp92
12878 imull %edx, %ecx # i, tmp92
12879 # test.c:6: for (i = 0; i < n; i++)
12880 incl %edx # i
12881 # test.c:7: total += i * i;
12882 addl %ecx, %eax # tmp92, <retval>
12883 jmp .L2 #
12884 .L5:
12885 # test.c:10: @}
12886 ret
12887 .cfi_endproc
12888 .LFE0:
12889 .size test, .-test
12890 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
12891 .section .note.GNU-stack,"",@@progbits
12892 @end smallexample
12893
12894 The comments are intended for humans rather than machines and hence the
12895 precise format of the comments is subject to change.
12896
12897 @item -frecord-gcc-switches
12898 @opindex frecord-gcc-switches
12899 This switch causes the command line used to invoke the
12900 compiler to be recorded into the object file that is being created.
12901 This switch is only implemented on some targets and the exact format
12902 of the recording is target and binary file format dependent, but it
12903 usually takes the form of a section containing ASCII text. This
12904 switch is related to the @option{-fverbose-asm} switch, but that
12905 switch only records information in the assembler output file as
12906 comments, so it never reaches the object file.
12907 See also @option{-grecord-gcc-switches} for another
12908 way of storing compiler options into the object file.
12909
12910 @item -fpic
12911 @opindex fpic
12912 @cindex global offset table
12913 @cindex PIC
12914 Generate position-independent code (PIC) suitable for use in a shared
12915 library, if supported for the target machine. Such code accesses all
12916 constant addresses through a global offset table (GOT)@. The dynamic
12917 loader resolves the GOT entries when the program starts (the dynamic
12918 loader is not part of GCC; it is part of the operating system). If
12919 the GOT size for the linked executable exceeds a machine-specific
12920 maximum size, you get an error message from the linker indicating that
12921 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
12922 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
12923 on the m68k and RS/6000. The x86 has no such limit.)
12924
12925 Position-independent code requires special support, and therefore works
12926 only on certain machines. For the x86, GCC supports PIC for System V
12927 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
12928 position-independent.
12929
12930 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12931 are defined to 1.
12932
12933 @item -fPIC
12934 @opindex fPIC
12935 If supported for the target machine, emit position-independent code,
12936 suitable for dynamic linking and avoiding any limit on the size of the
12937 global offset table. This option makes a difference on AArch64, m68k,
12938 PowerPC and SPARC@.
12939
12940 Position-independent code requires special support, and therefore works
12941 only on certain machines.
12942
12943 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12944 are defined to 2.
12945
12946 @item -fpie
12947 @itemx -fPIE
12948 @opindex fpie
12949 @opindex fPIE
12950 These options are similar to @option{-fpic} and @option{-fPIC}, but
12951 generated position independent code can be only linked into executables.
12952 Usually these options are used when @option{-pie} GCC option is
12953 used during linking.
12954
12955 @option{-fpie} and @option{-fPIE} both define the macros
12956 @code{__pie__} and @code{__PIE__}. The macros have the value 1
12957 for @option{-fpie} and 2 for @option{-fPIE}.
12958
12959 @item -fno-plt
12960 @opindex fno-plt
12961 Do not use the PLT for external function calls in position-independent code.
12962 Instead, load the callee address at call sites from the GOT and branch to it.
12963 This leads to more efficient code by eliminating PLT stubs and exposing
12964 GOT loads to optimizations. On architectures such as 32-bit x86 where
12965 PLT stubs expect the GOT pointer in a specific register, this gives more
12966 register allocation freedom to the compiler.
12967 Lazy binding requires use of the PLT;
12968 with @option{-fno-plt} all external symbols are resolved at load time.
12969
12970 Alternatively, the function attribute @code{noplt} can be used to avoid calls
12971 through the PLT for specific external functions.
12972
12973 In position-dependent code, a few targets also convert calls to
12974 functions that are marked to not use the PLT to use the GOT instead.
12975
12976 @item -fno-jump-tables
12977 @opindex fno-jump-tables
12978 Do not use jump tables for switch statements even where it would be
12979 more efficient than other code generation strategies. This option is
12980 of use in conjunction with @option{-fpic} or @option{-fPIC} for
12981 building code that forms part of a dynamic linker and cannot
12982 reference the address of a jump table. On some targets, jump tables
12983 do not require a GOT and this option is not needed.
12984
12985 @item -ffixed-@var{reg}
12986 @opindex ffixed
12987 Treat the register named @var{reg} as a fixed register; generated code
12988 should never refer to it (except perhaps as a stack pointer, frame
12989 pointer or in some other fixed role).
12990
12991 @var{reg} must be the name of a register. The register names accepted
12992 are machine-specific and are defined in the @code{REGISTER_NAMES}
12993 macro in the machine description macro file.
12994
12995 This flag does not have a negative form, because it specifies a
12996 three-way choice.
12997
12998 @item -fcall-used-@var{reg}
12999 @opindex fcall-used
13000 Treat the register named @var{reg} as an allocable register that is
13001 clobbered by function calls. It may be allocated for temporaries or
13002 variables that do not live across a call. Functions compiled this way
13003 do not save and restore the register @var{reg}.
13004
13005 It is an error to use this flag with the frame pointer or stack pointer.
13006 Use of this flag for other registers that have fixed pervasive roles in
13007 the machine's execution model produces disastrous results.
13008
13009 This flag does not have a negative form, because it specifies a
13010 three-way choice.
13011
13012 @item -fcall-saved-@var{reg}
13013 @opindex fcall-saved
13014 Treat the register named @var{reg} as an allocable register saved by
13015 functions. It may be allocated even for temporaries or variables that
13016 live across a call. Functions compiled this way save and restore
13017 the register @var{reg} if they use it.
13018
13019 It is an error to use this flag with the frame pointer or stack pointer.
13020 Use of this flag for other registers that have fixed pervasive roles in
13021 the machine's execution model produces disastrous results.
13022
13023 A different sort of disaster results from the use of this flag for
13024 a register in which function values may be returned.
13025
13026 This flag does not have a negative form, because it specifies a
13027 three-way choice.
13028
13029 @item -fpack-struct[=@var{n}]
13030 @opindex fpack-struct
13031 Without a value specified, pack all structure members together without
13032 holes. When a value is specified (which must be a small power of two), pack
13033 structure members according to this value, representing the maximum
13034 alignment (that is, objects with default alignment requirements larger than
13035 this are output potentially unaligned at the next fitting location.
13036
13037 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13038 code that is not binary compatible with code generated without that switch.
13039 Additionally, it makes the code suboptimal.
13040 Use it to conform to a non-default application binary interface.
13041
13042 @item -fleading-underscore
13043 @opindex fleading-underscore
13044 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13045 change the way C symbols are represented in the object file. One use
13046 is to help link with legacy assembly code.
13047
13048 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13049 generate code that is not binary compatible with code generated without that
13050 switch. Use it to conform to a non-default application binary interface.
13051 Not all targets provide complete support for this switch.
13052
13053 @item -ftls-model=@var{model}
13054 @opindex ftls-model
13055 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13056 The @var{model} argument should be one of @samp{global-dynamic},
13057 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
13058 Note that the choice is subject to optimization: the compiler may use
13059 a more efficient model for symbols not visible outside of the translation
13060 unit, or if @option{-fpic} is not given on the command line.
13061
13062 The default without @option{-fpic} is @samp{initial-exec}; with
13063 @option{-fpic} the default is @samp{global-dynamic}.
13064
13065 @item -ftrampolines
13066 @opindex ftrampolines
13067 For targets that normally need trampolines for nested functions, always
13068 generate them instead of using descriptors. Otherwise, for targets that
13069 do not need them, like for example HP-PA or IA-64, do nothing.
13070
13071 A trampoline is a small piece of code that is created at run time on the
13072 stack when the address of a nested function is taken, and is used to call
13073 the nested function indirectly. Therefore, it requires the stack to be
13074 made executable in order for the program to work properly.
13075
13076 @option{-fno-trampolines} is enabled by default on a language by language
13077 basis to let the compiler avoid generating them, if it computes that this
13078 is safe, and replace them with descriptors. Descriptors are made up of data
13079 only, but the generated code must be prepared to deal with them. As of this
13080 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13081
13082 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13083 @option{-fno-trampolines} are not binary compatible if nested functions are
13084 present. This option must therefore be used on a program-wide basis and be
13085 manipulated with extreme care.
13086
13087 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13088 @opindex fvisibility
13089 Set the default ELF image symbol visibility to the specified option---all
13090 symbols are marked with this unless overridden within the code.
13091 Using this feature can very substantially improve linking and
13092 load times of shared object libraries, produce more optimized
13093 code, provide near-perfect API export and prevent symbol clashes.
13094 It is @strong{strongly} recommended that you use this in any shared objects
13095 you distribute.
13096
13097 Despite the nomenclature, @samp{default} always means public; i.e.,
13098 available to be linked against from outside the shared object.
13099 @samp{protected} and @samp{internal} are pretty useless in real-world
13100 usage so the only other commonly used option is @samp{hidden}.
13101 The default if @option{-fvisibility} isn't specified is
13102 @samp{default}, i.e., make every symbol public.
13103
13104 A good explanation of the benefits offered by ensuring ELF
13105 symbols have the correct visibility is given by ``How To Write
13106 Shared Libraries'' by Ulrich Drepper (which can be found at
13107 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
13108 solution made possible by this option to marking things hidden when
13109 the default is public is to make the default hidden and mark things
13110 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
13111 and @code{__attribute__ ((visibility("default")))} instead of
13112 @code{__declspec(dllexport)} you get almost identical semantics with
13113 identical syntax. This is a great boon to those working with
13114 cross-platform projects.
13115
13116 For those adding visibility support to existing code, you may find
13117 @code{#pragma GCC visibility} of use. This works by you enclosing
13118 the declarations you wish to set visibility for with (for example)
13119 @code{#pragma GCC visibility push(hidden)} and
13120 @code{#pragma GCC visibility pop}.
13121 Bear in mind that symbol visibility should be viewed @strong{as
13122 part of the API interface contract} and thus all new code should
13123 always specify visibility when it is not the default; i.e., declarations
13124 only for use within the local DSO should @strong{always} be marked explicitly
13125 as hidden as so to avoid PLT indirection overheads---making this
13126 abundantly clear also aids readability and self-documentation of the code.
13127 Note that due to ISO C++ specification requirements, @code{operator new} and
13128 @code{operator delete} must always be of default visibility.
13129
13130 Be aware that headers from outside your project, in particular system
13131 headers and headers from any other library you use, may not be
13132 expecting to be compiled with visibility other than the default. You
13133 may need to explicitly say @code{#pragma GCC visibility push(default)}
13134 before including any such headers.
13135
13136 @code{extern} declarations are not affected by @option{-fvisibility}, so
13137 a lot of code can be recompiled with @option{-fvisibility=hidden} with
13138 no modifications. However, this means that calls to @code{extern}
13139 functions with no explicit visibility use the PLT, so it is more
13140 effective to use @code{__attribute ((visibility))} and/or
13141 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
13142 declarations should be treated as hidden.
13143
13144 Note that @option{-fvisibility} does affect C++ vague linkage
13145 entities. This means that, for instance, an exception class that is
13146 be thrown between DSOs must be explicitly marked with default
13147 visibility so that the @samp{type_info} nodes are unified between
13148 the DSOs.
13149
13150 An overview of these techniques, their benefits and how to use them
13151 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
13152
13153 @item -fstrict-volatile-bitfields
13154 @opindex fstrict-volatile-bitfields
13155 This option should be used if accesses to volatile bit-fields (or other
13156 structure fields, although the compiler usually honors those types
13157 anyway) should use a single access of the width of the
13158 field's type, aligned to a natural alignment if possible. For
13159 example, targets with memory-mapped peripheral registers might require
13160 all such accesses to be 16 bits wide; with this flag you can
13161 declare all peripheral bit-fields as @code{unsigned short} (assuming short
13162 is 16 bits on these targets) to force GCC to use 16-bit accesses
13163 instead of, perhaps, a more efficient 32-bit access.
13164
13165 If this option is disabled, the compiler uses the most efficient
13166 instruction. In the previous example, that might be a 32-bit load
13167 instruction, even though that accesses bytes that do not contain
13168 any portion of the bit-field, or memory-mapped registers unrelated to
13169 the one being updated.
13170
13171 In some cases, such as when the @code{packed} attribute is applied to a
13172 structure field, it may not be possible to access the field with a single
13173 read or write that is correctly aligned for the target machine. In this
13174 case GCC falls back to generating multiple accesses rather than code that
13175 will fault or truncate the result at run time.
13176
13177 Note: Due to restrictions of the C/C++11 memory model, write accesses are
13178 not allowed to touch non bit-field members. It is therefore recommended
13179 to define all bits of the field's type as bit-field members.
13180
13181 The default value of this option is determined by the application binary
13182 interface for the target processor.
13183
13184 @item -fsync-libcalls
13185 @opindex fsync-libcalls
13186 This option controls whether any out-of-line instance of the @code{__sync}
13187 family of functions may be used to implement the C++11 @code{__atomic}
13188 family of functions.
13189
13190 The default value of this option is enabled, thus the only useful form
13191 of the option is @option{-fno-sync-libcalls}. This option is used in
13192 the implementation of the @file{libatomic} runtime library.
13193
13194 @end table
13195
13196 @node Developer Options
13197 @section GCC Developer Options
13198 @cindex developer options
13199 @cindex debugging GCC
13200 @cindex debug dump options
13201 @cindex dump options
13202 @cindex compilation statistics
13203
13204 This section describes command-line options that are primarily of
13205 interest to GCC developers, including options to support compiler
13206 testing and investigation of compiler bugs and compile-time
13207 performance problems. This includes options that produce debug dumps
13208 at various points in the compilation; that print statistics such as
13209 memory use and execution time; and that print information about GCC's
13210 configuration, such as where it searches for libraries. You should
13211 rarely need to use any of these options for ordinary compilation and
13212 linking tasks.
13213
13214 @table @gcctabopt
13215
13216 @item -d@var{letters}
13217 @itemx -fdump-rtl-@var{pass}
13218 @itemx -fdump-rtl-@var{pass}=@var{filename}
13219 @opindex d
13220 @opindex fdump-rtl-@var{pass}
13221 Says to make debugging dumps during compilation at times specified by
13222 @var{letters}. This is used for debugging the RTL-based passes of the
13223 compiler. The file names for most of the dumps are made by appending
13224 a pass number and a word to the @var{dumpname}, and the files are
13225 created in the directory of the output file. In case of
13226 @option{=@var{filename}} option, the dump is output on the given file
13227 instead of the pass numbered dump files. Note that the pass number is
13228 assigned as passes are registered into the pass manager. Most passes
13229 are registered in the order that they will execute and for these passes
13230 the number corresponds to the pass execution order. However, passes
13231 registered by plugins, passes specific to compilation targets, or
13232 passes that are otherwise registered after all the other passes are
13233 numbered higher than a pass named "final", even if they are executed
13234 earlier. @var{dumpname} is generated from the name of the output
13235 file if explicitly specified and not an executable, otherwise it is
13236 the basename of the source file.
13237
13238 Some @option{-d@var{letters}} switches have different meaning when
13239 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
13240 for information about preprocessor-specific dump options.
13241
13242 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
13243 @option{-d} option @var{letters}. Here are the possible
13244 letters for use in @var{pass} and @var{letters}, and their meanings:
13245
13246 @table @gcctabopt
13247
13248 @item -fdump-rtl-alignments
13249 @opindex fdump-rtl-alignments
13250 Dump after branch alignments have been computed.
13251
13252 @item -fdump-rtl-asmcons
13253 @opindex fdump-rtl-asmcons
13254 Dump after fixing rtl statements that have unsatisfied in/out constraints.
13255
13256 @item -fdump-rtl-auto_inc_dec
13257 @opindex fdump-rtl-auto_inc_dec
13258 Dump after auto-inc-dec discovery. This pass is only run on
13259 architectures that have auto inc or auto dec instructions.
13260
13261 @item -fdump-rtl-barriers
13262 @opindex fdump-rtl-barriers
13263 Dump after cleaning up the barrier instructions.
13264
13265 @item -fdump-rtl-bbpart
13266 @opindex fdump-rtl-bbpart
13267 Dump after partitioning hot and cold basic blocks.
13268
13269 @item -fdump-rtl-bbro
13270 @opindex fdump-rtl-bbro
13271 Dump after block reordering.
13272
13273 @item -fdump-rtl-btl1
13274 @itemx -fdump-rtl-btl2
13275 @opindex fdump-rtl-btl2
13276 @opindex fdump-rtl-btl2
13277 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
13278 after the two branch
13279 target load optimization passes.
13280
13281 @item -fdump-rtl-bypass
13282 @opindex fdump-rtl-bypass
13283 Dump after jump bypassing and control flow optimizations.
13284
13285 @item -fdump-rtl-combine
13286 @opindex fdump-rtl-combine
13287 Dump after the RTL instruction combination pass.
13288
13289 @item -fdump-rtl-compgotos
13290 @opindex fdump-rtl-compgotos
13291 Dump after duplicating the computed gotos.
13292
13293 @item -fdump-rtl-ce1
13294 @itemx -fdump-rtl-ce2
13295 @itemx -fdump-rtl-ce3
13296 @opindex fdump-rtl-ce1
13297 @opindex fdump-rtl-ce2
13298 @opindex fdump-rtl-ce3
13299 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
13300 @option{-fdump-rtl-ce3} enable dumping after the three
13301 if conversion passes.
13302
13303 @item -fdump-rtl-cprop_hardreg
13304 @opindex fdump-rtl-cprop_hardreg
13305 Dump after hard register copy propagation.
13306
13307 @item -fdump-rtl-csa
13308 @opindex fdump-rtl-csa
13309 Dump after combining stack adjustments.
13310
13311 @item -fdump-rtl-cse1
13312 @itemx -fdump-rtl-cse2
13313 @opindex fdump-rtl-cse1
13314 @opindex fdump-rtl-cse2
13315 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
13316 the two common subexpression elimination passes.
13317
13318 @item -fdump-rtl-dce
13319 @opindex fdump-rtl-dce
13320 Dump after the standalone dead code elimination passes.
13321
13322 @item -fdump-rtl-dbr
13323 @opindex fdump-rtl-dbr
13324 Dump after delayed branch scheduling.
13325
13326 @item -fdump-rtl-dce1
13327 @itemx -fdump-rtl-dce2
13328 @opindex fdump-rtl-dce1
13329 @opindex fdump-rtl-dce2
13330 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
13331 the two dead store elimination passes.
13332
13333 @item -fdump-rtl-eh
13334 @opindex fdump-rtl-eh
13335 Dump after finalization of EH handling code.
13336
13337 @item -fdump-rtl-eh_ranges
13338 @opindex fdump-rtl-eh_ranges
13339 Dump after conversion of EH handling range regions.
13340
13341 @item -fdump-rtl-expand
13342 @opindex fdump-rtl-expand
13343 Dump after RTL generation.
13344
13345 @item -fdump-rtl-fwprop1
13346 @itemx -fdump-rtl-fwprop2
13347 @opindex fdump-rtl-fwprop1
13348 @opindex fdump-rtl-fwprop2
13349 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
13350 dumping after the two forward propagation passes.
13351
13352 @item -fdump-rtl-gcse1
13353 @itemx -fdump-rtl-gcse2
13354 @opindex fdump-rtl-gcse1
13355 @opindex fdump-rtl-gcse2
13356 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
13357 after global common subexpression elimination.
13358
13359 @item -fdump-rtl-init-regs
13360 @opindex fdump-rtl-init-regs
13361 Dump after the initialization of the registers.
13362
13363 @item -fdump-rtl-initvals
13364 @opindex fdump-rtl-initvals
13365 Dump after the computation of the initial value sets.
13366
13367 @item -fdump-rtl-into_cfglayout
13368 @opindex fdump-rtl-into_cfglayout
13369 Dump after converting to cfglayout mode.
13370
13371 @item -fdump-rtl-ira
13372 @opindex fdump-rtl-ira
13373 Dump after iterated register allocation.
13374
13375 @item -fdump-rtl-jump
13376 @opindex fdump-rtl-jump
13377 Dump after the second jump optimization.
13378
13379 @item -fdump-rtl-loop2
13380 @opindex fdump-rtl-loop2
13381 @option{-fdump-rtl-loop2} enables dumping after the rtl
13382 loop optimization passes.
13383
13384 @item -fdump-rtl-mach
13385 @opindex fdump-rtl-mach
13386 Dump after performing the machine dependent reorganization pass, if that
13387 pass exists.
13388
13389 @item -fdump-rtl-mode_sw
13390 @opindex fdump-rtl-mode_sw
13391 Dump after removing redundant mode switches.
13392
13393 @item -fdump-rtl-rnreg
13394 @opindex fdump-rtl-rnreg
13395 Dump after register renumbering.
13396
13397 @item -fdump-rtl-outof_cfglayout
13398 @opindex fdump-rtl-outof_cfglayout
13399 Dump after converting from cfglayout mode.
13400
13401 @item -fdump-rtl-peephole2
13402 @opindex fdump-rtl-peephole2
13403 Dump after the peephole pass.
13404
13405 @item -fdump-rtl-postreload
13406 @opindex fdump-rtl-postreload
13407 Dump after post-reload optimizations.
13408
13409 @item -fdump-rtl-pro_and_epilogue
13410 @opindex fdump-rtl-pro_and_epilogue
13411 Dump after generating the function prologues and epilogues.
13412
13413 @item -fdump-rtl-sched1
13414 @itemx -fdump-rtl-sched2
13415 @opindex fdump-rtl-sched1
13416 @opindex fdump-rtl-sched2
13417 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
13418 after the basic block scheduling passes.
13419
13420 @item -fdump-rtl-ree
13421 @opindex fdump-rtl-ree
13422 Dump after sign/zero extension elimination.
13423
13424 @item -fdump-rtl-seqabstr
13425 @opindex fdump-rtl-seqabstr
13426 Dump after common sequence discovery.
13427
13428 @item -fdump-rtl-shorten
13429 @opindex fdump-rtl-shorten
13430 Dump after shortening branches.
13431
13432 @item -fdump-rtl-sibling
13433 @opindex fdump-rtl-sibling
13434 Dump after sibling call optimizations.
13435
13436 @item -fdump-rtl-split1
13437 @itemx -fdump-rtl-split2
13438 @itemx -fdump-rtl-split3
13439 @itemx -fdump-rtl-split4
13440 @itemx -fdump-rtl-split5
13441 @opindex fdump-rtl-split1
13442 @opindex fdump-rtl-split2
13443 @opindex fdump-rtl-split3
13444 @opindex fdump-rtl-split4
13445 @opindex fdump-rtl-split5
13446 These options enable dumping after five rounds of
13447 instruction splitting.
13448
13449 @item -fdump-rtl-sms
13450 @opindex fdump-rtl-sms
13451 Dump after modulo scheduling. This pass is only run on some
13452 architectures.
13453
13454 @item -fdump-rtl-stack
13455 @opindex fdump-rtl-stack
13456 Dump after conversion from GCC's ``flat register file'' registers to the
13457 x87's stack-like registers. This pass is only run on x86 variants.
13458
13459 @item -fdump-rtl-subreg1
13460 @itemx -fdump-rtl-subreg2
13461 @opindex fdump-rtl-subreg1
13462 @opindex fdump-rtl-subreg2
13463 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
13464 the two subreg expansion passes.
13465
13466 @item -fdump-rtl-unshare
13467 @opindex fdump-rtl-unshare
13468 Dump after all rtl has been unshared.
13469
13470 @item -fdump-rtl-vartrack
13471 @opindex fdump-rtl-vartrack
13472 Dump after variable tracking.
13473
13474 @item -fdump-rtl-vregs
13475 @opindex fdump-rtl-vregs
13476 Dump after converting virtual registers to hard registers.
13477
13478 @item -fdump-rtl-web
13479 @opindex fdump-rtl-web
13480 Dump after live range splitting.
13481
13482 @item -fdump-rtl-regclass
13483 @itemx -fdump-rtl-subregs_of_mode_init
13484 @itemx -fdump-rtl-subregs_of_mode_finish
13485 @itemx -fdump-rtl-dfinit
13486 @itemx -fdump-rtl-dfinish
13487 @opindex fdump-rtl-regclass
13488 @opindex fdump-rtl-subregs_of_mode_init
13489 @opindex fdump-rtl-subregs_of_mode_finish
13490 @opindex fdump-rtl-dfinit
13491 @opindex fdump-rtl-dfinish
13492 These dumps are defined but always produce empty files.
13493
13494 @item -da
13495 @itemx -fdump-rtl-all
13496 @opindex da
13497 @opindex fdump-rtl-all
13498 Produce all the dumps listed above.
13499
13500 @item -dA
13501 @opindex dA
13502 Annotate the assembler output with miscellaneous debugging information.
13503
13504 @item -dD
13505 @opindex dD
13506 Dump all macro definitions, at the end of preprocessing, in addition to
13507 normal output.
13508
13509 @item -dH
13510 @opindex dH
13511 Produce a core dump whenever an error occurs.
13512
13513 @item -dp
13514 @opindex dp
13515 Annotate the assembler output with a comment indicating which
13516 pattern and alternative is used. The length and cost of each instruction are
13517 also printed.
13518
13519 @item -dP
13520 @opindex dP
13521 Dump the RTL in the assembler output as a comment before each instruction.
13522 Also turns on @option{-dp} annotation.
13523
13524 @item -dx
13525 @opindex dx
13526 Just generate RTL for a function instead of compiling it. Usually used
13527 with @option{-fdump-rtl-expand}.
13528 @end table
13529
13530 @item -fdump-noaddr
13531 @opindex fdump-noaddr
13532 When doing debugging dumps, suppress address output. This makes it more
13533 feasible to use diff on debugging dumps for compiler invocations with
13534 different compiler binaries and/or different
13535 text / bss / data / heap / stack / dso start locations.
13536
13537 @item -freport-bug
13538 @opindex freport-bug
13539 Collect and dump debug information into a temporary file if an
13540 internal compiler error (ICE) occurs.
13541
13542 @item -fdump-unnumbered
13543 @opindex fdump-unnumbered
13544 When doing debugging dumps, suppress instruction numbers and address output.
13545 This makes it more feasible to use diff on debugging dumps for compiler
13546 invocations with different options, in particular with and without
13547 @option{-g}.
13548
13549 @item -fdump-unnumbered-links
13550 @opindex fdump-unnumbered-links
13551 When doing debugging dumps (see @option{-d} option above), suppress
13552 instruction numbers for the links to the previous and next instructions
13553 in a sequence.
13554
13555 @item -fdump-ipa-@var{switch}
13556 @opindex fdump-ipa
13557 Control the dumping at various stages of inter-procedural analysis
13558 language tree to a file. The file name is generated by appending a
13559 switch specific suffix to the source file name, and the file is created
13560 in the same directory as the output file. The following dumps are
13561 possible:
13562
13563 @table @samp
13564 @item all
13565 Enables all inter-procedural analysis dumps.
13566
13567 @item cgraph
13568 Dumps information about call-graph optimization, unused function removal,
13569 and inlining decisions.
13570
13571 @item inline
13572 Dump after function inlining.
13573
13574 @end table
13575
13576 @item -fdump-lang-all
13577 @itemx -fdump-lang-@var{switch}
13578 @itemx -fdump-lang-@var{switch}-@var{options}
13579 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
13580 @opindex fdump-lang-all
13581 @opindex fdump-lang
13582 Control the dumping of language-specific information. The @var{options}
13583 and @var{filename} portions behave as described in the
13584 @option{-fdump-tree} option. The following @var{switch} values are
13585 accepted:
13586
13587 @table @samp
13588 @item all
13589
13590 Enable all language-specific dumps.
13591
13592 @item class
13593 Dump class hierarchy information. Virtual table information is emitted
13594 unless '@option{slim}' is specified. This option is applicable to C++ only.
13595
13596 @item raw
13597 Dump the raw internal tree data. This option is applicable to C++ only.
13598
13599 @end table
13600
13601 @item -fdump-passes
13602 @opindex fdump-passes
13603 Print on @file{stderr} the list of optimization passes that are turned
13604 on and off by the current command-line options.
13605
13606 @item -fdump-statistics-@var{option}
13607 @opindex fdump-statistics
13608 Enable and control dumping of pass statistics in a separate file. The
13609 file name is generated by appending a suffix ending in
13610 @samp{.statistics} to the source file name, and the file is created in
13611 the same directory as the output file. If the @samp{-@var{option}}
13612 form is used, @samp{-stats} causes counters to be summed over the
13613 whole compilation unit while @samp{-details} dumps every event as
13614 the passes generate them. The default with no option is to sum
13615 counters for each function compiled.
13616
13617 @item -fdump-tree-all
13618 @itemx -fdump-tree-@var{switch}
13619 @itemx -fdump-tree-@var{switch}-@var{options}
13620 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
13621 @opindex fdump-tree-all
13622 @opindex fdump-tree
13623 Control the dumping at various stages of processing the intermediate
13624 language tree to a file. The file name is generated by appending a
13625 switch-specific suffix to the source file name, and the file is
13626 created in the same directory as the output file. In case of
13627 @option{=@var{filename}} option, the dump is output on the given file
13628 instead of the auto named dump files. If the @samp{-@var{options}}
13629 form is used, @var{options} is a list of @samp{-} separated options
13630 which control the details of the dump. Not all options are applicable
13631 to all dumps; those that are not meaningful are ignored. The
13632 following options are available
13633
13634 @table @samp
13635 @item address
13636 Print the address of each node. Usually this is not meaningful as it
13637 changes according to the environment and source file. Its primary use
13638 is for tying up a dump file with a debug environment.
13639 @item asmname
13640 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
13641 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
13642 use working backward from mangled names in the assembly file.
13643 @item slim
13644 When dumping front-end intermediate representations, inhibit dumping
13645 of members of a scope or body of a function merely because that scope
13646 has been reached. Only dump such items when they are directly reachable
13647 by some other path.
13648
13649 When dumping pretty-printed trees, this option inhibits dumping the
13650 bodies of control structures.
13651
13652 When dumping RTL, print the RTL in slim (condensed) form instead of
13653 the default LISP-like representation.
13654 @item raw
13655 Print a raw representation of the tree. By default, trees are
13656 pretty-printed into a C-like representation.
13657 @item details
13658 Enable more detailed dumps (not honored by every dump option). Also
13659 include information from the optimization passes.
13660 @item stats
13661 Enable dumping various statistics about the pass (not honored by every dump
13662 option).
13663 @item blocks
13664 Enable showing basic block boundaries (disabled in raw dumps).
13665 @item graph
13666 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
13667 dump a representation of the control flow graph suitable for viewing with
13668 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
13669 the file is pretty-printed as a subgraph, so that GraphViz can render them
13670 all in a single plot.
13671
13672 This option currently only works for RTL dumps, and the RTL is always
13673 dumped in slim form.
13674 @item vops
13675 Enable showing virtual operands for every statement.
13676 @item lineno
13677 Enable showing line numbers for statements.
13678 @item uid
13679 Enable showing the unique ID (@code{DECL_UID}) for each variable.
13680 @item verbose
13681 Enable showing the tree dump for each statement.
13682 @item eh
13683 Enable showing the EH region number holding each statement.
13684 @item scev
13685 Enable showing scalar evolution analysis details.
13686 @item optimized
13687 Enable showing optimization information (only available in certain
13688 passes).
13689 @item missed
13690 Enable showing missed optimization information (only available in certain
13691 passes).
13692 @item note
13693 Enable other detailed optimization information (only available in
13694 certain passes).
13695 @item =@var{filename}
13696 Instead of an auto named dump file, output into the given file
13697 name. The file names @file{stdout} and @file{stderr} are treated
13698 specially and are considered already open standard streams. For
13699 example,
13700
13701 @smallexample
13702 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
13703 -fdump-tree-pre=/dev/stderr file.c
13704 @end smallexample
13705
13706 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
13707 output on to @file{stderr}. If two conflicting dump filenames are
13708 given for the same pass, then the latter option overrides the earlier
13709 one.
13710
13711 @item all
13712 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
13713 and @option{lineno}.
13714
13715 @item optall
13716 Turn on all optimization options, i.e., @option{optimized},
13717 @option{missed}, and @option{note}.
13718 @end table
13719
13720 To determine what tree dumps are available or find the dump for a pass
13721 of interest follow the steps below.
13722
13723 @enumerate
13724 @item
13725 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
13726 look for a code that corresponds to the pass you are interested in.
13727 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
13728 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
13729 The number at the end distinguishes distinct invocations of the same pass.
13730 @item
13731 To enable the creation of the dump file, append the pass code to
13732 the @option{-fdump-} option prefix and invoke GCC with it. For example,
13733 to enable the dump from the Early Value Range Propagation pass, invoke
13734 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
13735 specify the name of the dump file. If you don't specify one, GCC
13736 creates as described below.
13737 @item
13738 Find the pass dump in a file whose name is composed of three components
13739 separated by a period: the name of the source file GCC was invoked to
13740 compile, a numeric suffix indicating the pass number followed by the
13741 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
13742 and finally the pass code. For example, the Early VRP pass dump might
13743 be in a file named @file{myfile.c.038t.evrp} in the current working
13744 directory. Note that the numeric codes are not stable and may change
13745 from one version of GCC to another.
13746 @end enumerate
13747
13748 @item -fopt-info
13749 @itemx -fopt-info-@var{options}
13750 @itemx -fopt-info-@var{options}=@var{filename}
13751 @opindex fopt-info
13752 Controls optimization dumps from various optimization passes. If the
13753 @samp{-@var{options}} form is used, @var{options} is a list of
13754 @samp{-} separated option keywords to select the dump details and
13755 optimizations.
13756
13757 The @var{options} can be divided into two groups: options describing the
13758 verbosity of the dump, and options describing which optimizations
13759 should be included. The options from both the groups can be freely
13760 mixed as they are non-overlapping. However, in case of any conflicts,
13761 the later options override the earlier options on the command
13762 line.
13763
13764 The following options control the dump verbosity:
13765
13766 @table @samp
13767 @item optimized
13768 Print information when an optimization is successfully applied. It is
13769 up to a pass to decide which information is relevant. For example, the
13770 vectorizer passes print the source location of loops which are
13771 successfully vectorized.
13772 @item missed
13773 Print information about missed optimizations. Individual passes
13774 control which information to include in the output.
13775 @item note
13776 Print verbose information about optimizations, such as certain
13777 transformations, more detailed messages about decisions etc.
13778 @item all
13779 Print detailed optimization information. This includes
13780 @samp{optimized}, @samp{missed}, and @samp{note}.
13781 @end table
13782
13783 One or more of the following option keywords can be used to describe a
13784 group of optimizations:
13785
13786 @table @samp
13787 @item ipa
13788 Enable dumps from all interprocedural optimizations.
13789 @item loop
13790 Enable dumps from all loop optimizations.
13791 @item inline
13792 Enable dumps from all inlining optimizations.
13793 @item omp
13794 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
13795 @item vec
13796 Enable dumps from all vectorization optimizations.
13797 @item optall
13798 Enable dumps from all optimizations. This is a superset of
13799 the optimization groups listed above.
13800 @end table
13801
13802 If @var{options} is
13803 omitted, it defaults to @samp{optimized-optall}, which means to dump all
13804 info about successful optimizations from all the passes.
13805
13806 If the @var{filename} is provided, then the dumps from all the
13807 applicable optimizations are concatenated into the @var{filename}.
13808 Otherwise the dump is output onto @file{stderr}. Though multiple
13809 @option{-fopt-info} options are accepted, only one of them can include
13810 a @var{filename}. If other filenames are provided then all but the
13811 first such option are ignored.
13812
13813 Note that the output @var{filename} is overwritten
13814 in case of multiple translation units. If a combined output from
13815 multiple translation units is desired, @file{stderr} should be used
13816 instead.
13817
13818 In the following example, the optimization info is output to
13819 @file{stderr}:
13820
13821 @smallexample
13822 gcc -O3 -fopt-info
13823 @end smallexample
13824
13825 This example:
13826 @smallexample
13827 gcc -O3 -fopt-info-missed=missed.all
13828 @end smallexample
13829
13830 @noindent
13831 outputs missed optimization report from all the passes into
13832 @file{missed.all}, and this one:
13833
13834 @smallexample
13835 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13836 @end smallexample
13837
13838 @noindent
13839 prints information about missed optimization opportunities from
13840 vectorization passes on @file{stderr}.
13841 Note that @option{-fopt-info-vec-missed} is equivalent to
13842 @option{-fopt-info-missed-vec}. The order of the optimization group
13843 names and message types listed after @option{-fopt-info} does not matter.
13844
13845 As another example,
13846 @smallexample
13847 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13848 @end smallexample
13849
13850 @noindent
13851 outputs information about missed optimizations as well as
13852 optimized locations from all the inlining passes into
13853 @file{inline.txt}.
13854
13855 Finally, consider:
13856
13857 @smallexample
13858 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13859 @end smallexample
13860
13861 @noindent
13862 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
13863 in conflict since only one output file is allowed. In this case, only
13864 the first option takes effect and the subsequent options are
13865 ignored. Thus only @file{vec.miss} is produced which contains
13866 dumps from the vectorizer about missed opportunities.
13867
13868 @item -fsched-verbose=@var{n}
13869 @opindex fsched-verbose
13870 On targets that use instruction scheduling, this option controls the
13871 amount of debugging output the scheduler prints to the dump files.
13872
13873 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
13874 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
13875 For @var{n} greater than one, it also output basic block probabilities,
13876 detailed ready list information and unit/insn info. For @var{n} greater
13877 than two, it includes RTL at abort point, control-flow and regions info.
13878 And for @var{n} over four, @option{-fsched-verbose} also includes
13879 dependence info.
13880
13881
13882
13883 @item -fenable-@var{kind}-@var{pass}
13884 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
13885 @opindex fdisable-
13886 @opindex fenable-
13887
13888 This is a set of options that are used to explicitly disable/enable
13889 optimization passes. These options are intended for use for debugging GCC.
13890 Compiler users should use regular options for enabling/disabling
13891 passes instead.
13892
13893 @table @gcctabopt
13894
13895 @item -fdisable-ipa-@var{pass}
13896 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13897 statically invoked in the compiler multiple times, the pass name should be
13898 appended with a sequential number starting from 1.
13899
13900 @item -fdisable-rtl-@var{pass}
13901 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
13902 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
13903 statically invoked in the compiler multiple times, the pass name should be
13904 appended with a sequential number starting from 1. @var{range-list} is a
13905 comma-separated list of function ranges or assembler names. Each range is a number
13906 pair separated by a colon. The range is inclusive in both ends. If the range
13907 is trivial, the number pair can be simplified as a single number. If the
13908 function's call graph node's @var{uid} falls within one of the specified ranges,
13909 the @var{pass} is disabled for that function. The @var{uid} is shown in the
13910 function header of a dump file, and the pass names can be dumped by using
13911 option @option{-fdump-passes}.
13912
13913 @item -fdisable-tree-@var{pass}
13914 @itemx -fdisable-tree-@var{pass}=@var{range-list}
13915 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
13916 option arguments.
13917
13918 @item -fenable-ipa-@var{pass}
13919 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13920 statically invoked in the compiler multiple times, the pass name should be
13921 appended with a sequential number starting from 1.
13922
13923 @item -fenable-rtl-@var{pass}
13924 @itemx -fenable-rtl-@var{pass}=@var{range-list}
13925 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
13926 description and examples.
13927
13928 @item -fenable-tree-@var{pass}
13929 @itemx -fenable-tree-@var{pass}=@var{range-list}
13930 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
13931 of option arguments.
13932
13933 @end table
13934
13935 Here are some examples showing uses of these options.
13936
13937 @smallexample
13938
13939 # disable ccp1 for all functions
13940 -fdisable-tree-ccp1
13941 # disable complete unroll for function whose cgraph node uid is 1
13942 -fenable-tree-cunroll=1
13943 # disable gcse2 for functions at the following ranges [1,1],
13944 # [300,400], and [400,1000]
13945 # disable gcse2 for functions foo and foo2
13946 -fdisable-rtl-gcse2=foo,foo2
13947 # disable early inlining
13948 -fdisable-tree-einline
13949 # disable ipa inlining
13950 -fdisable-ipa-inline
13951 # enable tree full unroll
13952 -fenable-tree-unroll
13953
13954 @end smallexample
13955
13956 @item -fchecking
13957 @itemx -fchecking=@var{n}
13958 @opindex fchecking
13959 @opindex fno-checking
13960 Enable internal consistency checking. The default depends on
13961 the compiler configuration. @option{-fchecking=2} enables further
13962 internal consistency checking that might affect code generation.
13963
13964 @item -frandom-seed=@var{string}
13965 @opindex frandom-seed
13966 This option provides a seed that GCC uses in place of
13967 random numbers in generating certain symbol names
13968 that have to be different in every compiled file. It is also used to
13969 place unique stamps in coverage data files and the object files that
13970 produce them. You can use the @option{-frandom-seed} option to produce
13971 reproducibly identical object files.
13972
13973 The @var{string} can either be a number (decimal, octal or hex) or an
13974 arbitrary string (in which case it's converted to a number by
13975 computing CRC32).
13976
13977 The @var{string} should be different for every file you compile.
13978
13979 @item -save-temps
13980 @itemx -save-temps=cwd
13981 @opindex save-temps
13982 Store the usual ``temporary'' intermediate files permanently; place them
13983 in the current directory and name them based on the source file. Thus,
13984 compiling @file{foo.c} with @option{-c -save-temps} produces files
13985 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
13986 preprocessed @file{foo.i} output file even though the compiler now
13987 normally uses an integrated preprocessor.
13988
13989 When used in combination with the @option{-x} command-line option,
13990 @option{-save-temps} is sensible enough to avoid over writing an
13991 input source file with the same extension as an intermediate file.
13992 The corresponding intermediate file may be obtained by renaming the
13993 source file before using @option{-save-temps}.
13994
13995 If you invoke GCC in parallel, compiling several different source
13996 files that share a common base name in different subdirectories or the
13997 same source file compiled for multiple output destinations, it is
13998 likely that the different parallel compilers will interfere with each
13999 other, and overwrite the temporary files. For instance:
14000
14001 @smallexample
14002 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14003 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14004 @end smallexample
14005
14006 may result in @file{foo.i} and @file{foo.o} being written to
14007 simultaneously by both compilers.
14008
14009 @item -save-temps=obj
14010 @opindex save-temps=obj
14011 Store the usual ``temporary'' intermediate files permanently. If the
14012 @option{-o} option is used, the temporary files are based on the
14013 object file. If the @option{-o} option is not used, the
14014 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
14015
14016 For example:
14017
14018 @smallexample
14019 gcc -save-temps=obj -c foo.c
14020 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14021 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14022 @end smallexample
14023
14024 @noindent
14025 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
14026 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
14027 @file{dir2/yfoobar.o}.
14028
14029 @item -time@r{[}=@var{file}@r{]}
14030 @opindex time
14031 Report the CPU time taken by each subprocess in the compilation
14032 sequence. For C source files, this is the compiler proper and assembler
14033 (plus the linker if linking is done).
14034
14035 Without the specification of an output file, the output looks like this:
14036
14037 @smallexample
14038 # cc1 0.12 0.01
14039 # as 0.00 0.01
14040 @end smallexample
14041
14042 The first number on each line is the ``user time'', that is time spent
14043 executing the program itself. The second number is ``system time'',
14044 time spent executing operating system routines on behalf of the program.
14045 Both numbers are in seconds.
14046
14047 With the specification of an output file, the output is appended to the
14048 named file, and it looks like this:
14049
14050 @smallexample
14051 0.12 0.01 cc1 @var{options}
14052 0.00 0.01 as @var{options}
14053 @end smallexample
14054
14055 The ``user time'' and the ``system time'' are moved before the program
14056 name, and the options passed to the program are displayed, so that one
14057 can later tell what file was being compiled, and with which options.
14058
14059 @item -fdump-final-insns@r{[}=@var{file}@r{]}
14060 @opindex fdump-final-insns
14061 Dump the final internal representation (RTL) to @var{file}. If the
14062 optional argument is omitted (or if @var{file} is @code{.}), the name
14063 of the dump file is determined by appending @code{.gkd} to the
14064 compilation output file name.
14065
14066 @item -fcompare-debug@r{[}=@var{opts}@r{]}
14067 @opindex fcompare-debug
14068 @opindex fno-compare-debug
14069 If no error occurs during compilation, run the compiler a second time,
14070 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
14071 passed to the second compilation. Dump the final internal
14072 representation in both compilations, and print an error if they differ.
14073
14074 If the equal sign is omitted, the default @option{-gtoggle} is used.
14075
14076 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
14077 and nonzero, implicitly enables @option{-fcompare-debug}. If
14078 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
14079 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
14080 is used.
14081
14082 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
14083 is equivalent to @option{-fno-compare-debug}, which disables the dumping
14084 of the final representation and the second compilation, preventing even
14085 @env{GCC_COMPARE_DEBUG} from taking effect.
14086
14087 To verify full coverage during @option{-fcompare-debug} testing, set
14088 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
14089 which GCC rejects as an invalid option in any actual compilation
14090 (rather than preprocessing, assembly or linking). To get just a
14091 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
14092 not overridden} will do.
14093
14094 @item -fcompare-debug-second
14095 @opindex fcompare-debug-second
14096 This option is implicitly passed to the compiler for the second
14097 compilation requested by @option{-fcompare-debug}, along with options to
14098 silence warnings, and omitting other options that would cause
14099 side-effect compiler outputs to files or to the standard output. Dump
14100 files and preserved temporary files are renamed so as to contain the
14101 @code{.gk} additional extension during the second compilation, to avoid
14102 overwriting those generated by the first.
14103
14104 When this option is passed to the compiler driver, it causes the
14105 @emph{first} compilation to be skipped, which makes it useful for little
14106 other than debugging the compiler proper.
14107
14108 @item -gtoggle
14109 @opindex gtoggle
14110 Turn off generation of debug info, if leaving out this option
14111 generates it, or turn it on at level 2 otherwise. The position of this
14112 argument in the command line does not matter; it takes effect after all
14113 other options are processed, and it does so only once, no matter how
14114 many times it is given. This is mainly intended to be used with
14115 @option{-fcompare-debug}.
14116
14117 @item -fvar-tracking-assignments-toggle
14118 @opindex fvar-tracking-assignments-toggle
14119 @opindex fno-var-tracking-assignments-toggle
14120 Toggle @option{-fvar-tracking-assignments}, in the same way that
14121 @option{-gtoggle} toggles @option{-g}.
14122
14123 @item -Q
14124 @opindex Q
14125 Makes the compiler print out each function name as it is compiled, and
14126 print some statistics about each pass when it finishes.
14127
14128 @item -ftime-report
14129 @opindex ftime-report
14130 Makes the compiler print some statistics about the time consumed by each
14131 pass when it finishes.
14132
14133 @item -ftime-report-details
14134 @opindex ftime-report-details
14135 Record the time consumed by infrastructure parts separately for each pass.
14136
14137 @item -fira-verbose=@var{n}
14138 @opindex fira-verbose
14139 Control the verbosity of the dump file for the integrated register allocator.
14140 The default value is 5. If the value @var{n} is greater or equal to 10,
14141 the dump output is sent to stderr using the same format as @var{n} minus 10.
14142
14143 @item -flto-report
14144 @opindex flto-report
14145 Prints a report with internal details on the workings of the link-time
14146 optimizer. The contents of this report vary from version to version.
14147 It is meant to be useful to GCC developers when processing object
14148 files in LTO mode (via @option{-flto}).
14149
14150 Disabled by default.
14151
14152 @item -flto-report-wpa
14153 @opindex flto-report-wpa
14154 Like @option{-flto-report}, but only print for the WPA phase of Link
14155 Time Optimization.
14156
14157 @item -fmem-report
14158 @opindex fmem-report
14159 Makes the compiler print some statistics about permanent memory
14160 allocation when it finishes.
14161
14162 @item -fmem-report-wpa
14163 @opindex fmem-report-wpa
14164 Makes the compiler print some statistics about permanent memory
14165 allocation for the WPA phase only.
14166
14167 @item -fpre-ipa-mem-report
14168 @opindex fpre-ipa-mem-report
14169 @item -fpost-ipa-mem-report
14170 @opindex fpost-ipa-mem-report
14171 Makes the compiler print some statistics about permanent memory
14172 allocation before or after interprocedural optimization.
14173
14174 @item -fprofile-report
14175 @opindex fprofile-report
14176 Makes the compiler print some statistics about consistency of the
14177 (estimated) profile and effect of individual passes.
14178
14179 @item -fstack-usage
14180 @opindex fstack-usage
14181 Makes the compiler output stack usage information for the program, on a
14182 per-function basis. The filename for the dump is made by appending
14183 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
14184 the output file, if explicitly specified and it is not an executable,
14185 otherwise it is the basename of the source file. An entry is made up
14186 of three fields:
14187
14188 @itemize
14189 @item
14190 The name of the function.
14191 @item
14192 A number of bytes.
14193 @item
14194 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
14195 @end itemize
14196
14197 The qualifier @code{static} means that the function manipulates the stack
14198 statically: a fixed number of bytes are allocated for the frame on function
14199 entry and released on function exit; no stack adjustments are otherwise made
14200 in the function. The second field is this fixed number of bytes.
14201
14202 The qualifier @code{dynamic} means that the function manipulates the stack
14203 dynamically: in addition to the static allocation described above, stack
14204 adjustments are made in the body of the function, for example to push/pop
14205 arguments around function calls. If the qualifier @code{bounded} is also
14206 present, the amount of these adjustments is bounded at compile time and
14207 the second field is an upper bound of the total amount of stack used by
14208 the function. If it is not present, the amount of these adjustments is
14209 not bounded at compile time and the second field only represents the
14210 bounded part.
14211
14212 @item -fstats
14213 @opindex fstats
14214 Emit statistics about front-end processing at the end of the compilation.
14215 This option is supported only by the C++ front end, and
14216 the information is generally only useful to the G++ development team.
14217
14218 @item -fdbg-cnt-list
14219 @opindex fdbg-cnt-list
14220 Print the name and the counter upper bound for all debug counters.
14221
14222
14223 @item -fdbg-cnt=@var{counter-value-list}
14224 @opindex fdbg-cnt
14225 Set the internal debug counter upper bound. @var{counter-value-list}
14226 is a comma-separated list of @var{name}:@var{value} pairs
14227 which sets the upper bound of each debug counter @var{name} to @var{value}.
14228 All debug counters have the initial upper bound of @code{UINT_MAX};
14229 thus @code{dbg_cnt} returns true always unless the upper bound
14230 is set by this option.
14231 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
14232 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
14233
14234 @item -print-file-name=@var{library}
14235 @opindex print-file-name
14236 Print the full absolute name of the library file @var{library} that
14237 would be used when linking---and don't do anything else. With this
14238 option, GCC does not compile or link anything; it just prints the
14239 file name.
14240
14241 @item -print-multi-directory
14242 @opindex print-multi-directory
14243 Print the directory name corresponding to the multilib selected by any
14244 other switches present in the command line. This directory is supposed
14245 to exist in @env{GCC_EXEC_PREFIX}.
14246
14247 @item -print-multi-lib
14248 @opindex print-multi-lib
14249 Print the mapping from multilib directory names to compiler switches
14250 that enable them. The directory name is separated from the switches by
14251 @samp{;}, and each switch starts with an @samp{@@} instead of the
14252 @samp{-}, without spaces between multiple switches. This is supposed to
14253 ease shell processing.
14254
14255 @item -print-multi-os-directory
14256 @opindex print-multi-os-directory
14257 Print the path to OS libraries for the selected
14258 multilib, relative to some @file{lib} subdirectory. If OS libraries are
14259 present in the @file{lib} subdirectory and no multilibs are used, this is
14260 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
14261 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
14262 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
14263 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
14264
14265 @item -print-multiarch
14266 @opindex print-multiarch
14267 Print the path to OS libraries for the selected multiarch,
14268 relative to some @file{lib} subdirectory.
14269
14270 @item -print-prog-name=@var{program}
14271 @opindex print-prog-name
14272 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
14273
14274 @item -print-libgcc-file-name
14275 @opindex print-libgcc-file-name
14276 Same as @option{-print-file-name=libgcc.a}.
14277
14278 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
14279 but you do want to link with @file{libgcc.a}. You can do:
14280
14281 @smallexample
14282 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
14283 @end smallexample
14284
14285 @item -print-search-dirs
14286 @opindex print-search-dirs
14287 Print the name of the configured installation directory and a list of
14288 program and library directories @command{gcc} searches---and don't do anything else.
14289
14290 This is useful when @command{gcc} prints the error message
14291 @samp{installation problem, cannot exec cpp0: No such file or directory}.
14292 To resolve this you either need to put @file{cpp0} and the other compiler
14293 components where @command{gcc} expects to find them, or you can set the environment
14294 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
14295 Don't forget the trailing @samp{/}.
14296 @xref{Environment Variables}.
14297
14298 @item -print-sysroot
14299 @opindex print-sysroot
14300 Print the target sysroot directory that is used during
14301 compilation. This is the target sysroot specified either at configure
14302 time or using the @option{--sysroot} option, possibly with an extra
14303 suffix that depends on compilation options. If no target sysroot is
14304 specified, the option prints nothing.
14305
14306 @item -print-sysroot-headers-suffix
14307 @opindex print-sysroot-headers-suffix
14308 Print the suffix added to the target sysroot when searching for
14309 headers, or give an error if the compiler is not configured with such
14310 a suffix---and don't do anything else.
14311
14312 @item -dumpmachine
14313 @opindex dumpmachine
14314 Print the compiler's target machine (for example,
14315 @samp{i686-pc-linux-gnu})---and don't do anything else.
14316
14317 @item -dumpversion
14318 @opindex dumpversion
14319 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
14320 anything else. This is the compiler version used in filesystem paths,
14321 specs, can be depending on how the compiler has been configured just
14322 a single number (major version), two numbers separated by dot (major and
14323 minor version) or three numbers separated by dots (major, minor and patchlevel
14324 version).
14325
14326 @item -dumpfullversion
14327 @opindex dumpfullversion
14328 Print the full compiler version, always 3 numbers separated by dots,
14329 major, minor and patchlevel version.
14330
14331 @item -dumpspecs
14332 @opindex dumpspecs
14333 Print the compiler's built-in specs---and don't do anything else. (This
14334 is used when GCC itself is being built.) @xref{Spec Files}.
14335 @end table
14336
14337 @node Submodel Options
14338 @section Machine-Dependent Options
14339 @cindex submodel options
14340 @cindex specifying hardware config
14341 @cindex hardware models and configurations, specifying
14342 @cindex target-dependent options
14343 @cindex machine-dependent options
14344
14345 Each target machine supported by GCC can have its own options---for
14346 example, to allow you to compile for a particular processor variant or
14347 ABI, or to control optimizations specific to that machine. By
14348 convention, the names of machine-specific options start with
14349 @samp{-m}.
14350
14351 Some configurations of the compiler also support additional target-specific
14352 options, usually for compatibility with other compilers on the same
14353 platform.
14354
14355 @c This list is ordered alphanumerically by subsection name.
14356 @c It should be the same order and spelling as these options are listed
14357 @c in Machine Dependent Options
14358
14359 @menu
14360 * AArch64 Options::
14361 * Adapteva Epiphany Options::
14362 * ARC Options::
14363 * ARM Options::
14364 * AVR Options::
14365 * Blackfin Options::
14366 * C6X Options::
14367 * CRIS Options::
14368 * CR16 Options::
14369 * Darwin Options::
14370 * DEC Alpha Options::
14371 * FR30 Options::
14372 * FT32 Options::
14373 * FRV Options::
14374 * GNU/Linux Options::
14375 * H8/300 Options::
14376 * HPPA Options::
14377 * IA-64 Options::
14378 * LM32 Options::
14379 * M32C Options::
14380 * M32R/D Options::
14381 * M680x0 Options::
14382 * MCore Options::
14383 * MeP Options::
14384 * MicroBlaze Options::
14385 * MIPS Options::
14386 * MMIX Options::
14387 * MN10300 Options::
14388 * Moxie Options::
14389 * MSP430 Options::
14390 * NDS32 Options::
14391 * Nios II Options::
14392 * Nvidia PTX Options::
14393 * PDP-11 Options::
14394 * picoChip Options::
14395 * PowerPC Options::
14396 * PowerPC SPE Options::
14397 * RISC-V Options::
14398 * RL78 Options::
14399 * RS/6000 and PowerPC Options::
14400 * RX Options::
14401 * S/390 and zSeries Options::
14402 * Score Options::
14403 * SH Options::
14404 * Solaris 2 Options::
14405 * SPARC Options::
14406 * SPU Options::
14407 * System V Options::
14408 * TILE-Gx Options::
14409 * TILEPro Options::
14410 * V850 Options::
14411 * VAX Options::
14412 * Visium Options::
14413 * VMS Options::
14414 * VxWorks Options::
14415 * x86 Options::
14416 * x86 Windows Options::
14417 * Xstormy16 Options::
14418 * Xtensa Options::
14419 * zSeries Options::
14420 @end menu
14421
14422 @node AArch64 Options
14423 @subsection AArch64 Options
14424 @cindex AArch64 Options
14425
14426 These options are defined for AArch64 implementations:
14427
14428 @table @gcctabopt
14429
14430 @item -mabi=@var{name}
14431 @opindex mabi
14432 Generate code for the specified data model. Permissible values
14433 are @samp{ilp32} for SysV-like data model where int, long int and pointers
14434 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
14435 but long int and pointers are 64 bits.
14436
14437 The default depends on the specific target configuration. Note that
14438 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
14439 entire program with the same ABI, and link with a compatible set of libraries.
14440
14441 @item -mbig-endian
14442 @opindex mbig-endian
14443 Generate big-endian code. This is the default when GCC is configured for an
14444 @samp{aarch64_be-*-*} target.
14445
14446 @item -mgeneral-regs-only
14447 @opindex mgeneral-regs-only
14448 Generate code which uses only the general-purpose registers. This will prevent
14449 the compiler from using floating-point and Advanced SIMD registers but will not
14450 impose any restrictions on the assembler.
14451
14452 @item -mlittle-endian
14453 @opindex mlittle-endian
14454 Generate little-endian code. This is the default when GCC is configured for an
14455 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
14456
14457 @item -mcmodel=tiny
14458 @opindex mcmodel=tiny
14459 Generate code for the tiny code model. The program and its statically defined
14460 symbols must be within 1MB of each other. Programs can be statically or
14461 dynamically linked.
14462
14463 @item -mcmodel=small
14464 @opindex mcmodel=small
14465 Generate code for the small code model. The program and its statically defined
14466 symbols must be within 4GB of each other. Programs can be statically or
14467 dynamically linked. This is the default code model.
14468
14469 @item -mcmodel=large
14470 @opindex mcmodel=large
14471 Generate code for the large code model. This makes no assumptions about
14472 addresses and sizes of sections. Programs can be statically linked only.
14473
14474 @item -mstrict-align
14475 @opindex mstrict-align
14476 Avoid generating memory accesses that may not be aligned on a natural object
14477 boundary as described in the architecture specification.
14478
14479 @item -momit-leaf-frame-pointer
14480 @itemx -mno-omit-leaf-frame-pointer
14481 @opindex momit-leaf-frame-pointer
14482 @opindex mno-omit-leaf-frame-pointer
14483 Omit or keep the frame pointer in leaf functions. The former behavior is the
14484 default.
14485
14486 @item -mtls-dialect=desc
14487 @opindex mtls-dialect=desc
14488 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
14489 of TLS variables. This is the default.
14490
14491 @item -mtls-dialect=traditional
14492 @opindex mtls-dialect=traditional
14493 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
14494 of TLS variables.
14495
14496 @item -mtls-size=@var{size}
14497 @opindex mtls-size
14498 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
14499 This option requires binutils 2.26 or newer.
14500
14501 @item -mfix-cortex-a53-835769
14502 @itemx -mno-fix-cortex-a53-835769
14503 @opindex mfix-cortex-a53-835769
14504 @opindex mno-fix-cortex-a53-835769
14505 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
14506 This involves inserting a NOP instruction between memory instructions and
14507 64-bit integer multiply-accumulate instructions.
14508
14509 @item -mfix-cortex-a53-843419
14510 @itemx -mno-fix-cortex-a53-843419
14511 @opindex mfix-cortex-a53-843419
14512 @opindex mno-fix-cortex-a53-843419
14513 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
14514 This erratum workaround is made at link time and this will only pass the
14515 corresponding flag to the linker.
14516
14517 @item -mlow-precision-recip-sqrt
14518 @item -mno-low-precision-recip-sqrt
14519 @opindex mlow-precision-recip-sqrt
14520 @opindex mno-low-precision-recip-sqrt
14521 Enable or disable the reciprocal square root approximation.
14522 This option only has an effect if @option{-ffast-math} or
14523 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14524 precision of reciprocal square root results to about 16 bits for
14525 single precision and to 32 bits for double precision.
14526
14527 @item -mlow-precision-sqrt
14528 @item -mno-low-precision-sqrt
14529 @opindex -mlow-precision-sqrt
14530 @opindex -mno-low-precision-sqrt
14531 Enable or disable the square root approximation.
14532 This option only has an effect if @option{-ffast-math} or
14533 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14534 precision of square root results to about 16 bits for
14535 single precision and to 32 bits for double precision.
14536 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
14537
14538 @item -mlow-precision-div
14539 @item -mno-low-precision-div
14540 @opindex -mlow-precision-div
14541 @opindex -mno-low-precision-div
14542 Enable or disable the division approximation.
14543 This option only has an effect if @option{-ffast-math} or
14544 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14545 precision of division results to about 16 bits for
14546 single precision and to 32 bits for double precision.
14547
14548 @item -march=@var{name}
14549 @opindex march
14550 Specify the name of the target architecture and, optionally, one or
14551 more feature modifiers. This option has the form
14552 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
14553
14554 The permissible values for @var{arch} are @samp{armv8-a},
14555 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
14556 or @var{native}.
14557
14558 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
14559 support for the ARMv8.4-A architecture extensions.
14560
14561 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
14562 support for the ARMv8.3-A architecture extensions.
14563
14564 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
14565 support for the ARMv8.2-A architecture extensions.
14566
14567 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
14568 support for the ARMv8.1-A architecture extension. In particular, it
14569 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
14570
14571 The value @samp{native} is available on native AArch64 GNU/Linux and
14572 causes the compiler to pick the architecture of the host system. This
14573 option has no effect if the compiler is unable to recognize the
14574 architecture of the host system,
14575
14576 The permissible values for @var{feature} are listed in the sub-section
14577 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14578 Feature Modifiers}. Where conflicting feature modifiers are
14579 specified, the right-most feature is used.
14580
14581 GCC uses @var{name} to determine what kind of instructions it can emit
14582 when generating assembly code. If @option{-march} is specified
14583 without either of @option{-mtune} or @option{-mcpu} also being
14584 specified, the code is tuned to perform well across a range of target
14585 processors implementing the target architecture.
14586
14587 @item -mtune=@var{name}
14588 @opindex mtune
14589 Specify the name of the target processor for which GCC should tune the
14590 performance of the code. Permissible values for this option are:
14591 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
14592 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
14593 @samp{exynos-m1}, @samp{falkor}, @samp{qdf24xx}, @samp{saphira},
14594 @samp{xgene1}, @samp{vulcan}, @samp{thunderx},
14595 @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
14596 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53},
14597 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
14598 @samp{cortex-a73.cortex-a53}, @samp{cortex-a75.cortex-a55},
14599 @samp{native}.
14600
14601 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14602 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
14603 @samp{cortex-a75.cortex-a55} specify that GCC should tune for a
14604 big.LITTLE system.
14605
14606 Additionally on native AArch64 GNU/Linux systems the value
14607 @samp{native} tunes performance to the host system. This option has no effect
14608 if the compiler is unable to recognize the processor of the host system.
14609
14610 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
14611 are specified, the code is tuned to perform well across a range
14612 of target processors.
14613
14614 This option cannot be suffixed by feature modifiers.
14615
14616 @item -mcpu=@var{name}
14617 @opindex mcpu
14618 Specify the name of the target processor, optionally suffixed by one
14619 or more feature modifiers. This option has the form
14620 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
14621 the permissible values for @var{cpu} are the same as those available
14622 for @option{-mtune}. The permissible values for @var{feature} are
14623 documented in the sub-section on
14624 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14625 Feature Modifiers}. Where conflicting feature modifiers are
14626 specified, the right-most feature is used.
14627
14628 GCC uses @var{name} to determine what kind of instructions it can emit when
14629 generating assembly code (as if by @option{-march}) and to determine
14630 the target processor for which to tune for performance (as if
14631 by @option{-mtune}). Where this option is used in conjunction
14632 with @option{-march} or @option{-mtune}, those options take precedence
14633 over the appropriate part of this option.
14634
14635 @item -moverride=@var{string}
14636 @opindex moverride
14637 Override tuning decisions made by the back-end in response to a
14638 @option{-mtune=} switch. The syntax, semantics, and accepted values
14639 for @var{string} in this option are not guaranteed to be consistent
14640 across releases.
14641
14642 This option is only intended to be useful when developing GCC.
14643
14644 @item -mverbose-cost-dump
14645 @opindex mverbose-cost-dump
14646 Enable verbose cost model dumping in the debug dump files. This option is
14647 provided for use in debugging the compiler.
14648
14649 @item -mpc-relative-literal-loads
14650 @itemx -mno-pc-relative-literal-loads
14651 @opindex mpc-relative-literal-loads
14652 @opindex mno-pc-relative-literal-loads
14653 Enable or disable PC-relative literal loads. With this option literal pools are
14654 accessed using a single instruction and emitted after each function. This
14655 limits the maximum size of functions to 1MB. This is enabled by default for
14656 @option{-mcmodel=tiny}.
14657
14658 @item -msign-return-address=@var{scope}
14659 @opindex msign-return-address
14660 Select the function scope on which return address signing will be applied.
14661 Permissible values are @samp{none}, which disables return address signing,
14662 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
14663 functions, and @samp{all}, which enables pointer signing for all functions. The
14664 default value is @samp{none}.
14665
14666 @item -msve-vector-bits=@var{bits}
14667 @opindex msve-vector-bits
14668 Specify the number of bits in an SVE vector register. This option only has
14669 an effect when SVE is enabled.
14670
14671 GCC supports two forms of SVE code generation: ``vector-length
14672 agnostic'' output that works with any size of vector register and
14673 ``vector-length specific'' output that only works when the vector
14674 registers are a particular size. Replacing @var{bits} with
14675 @samp{scalable} selects vector-length agnostic output while
14676 replacing it with a number selects vector-length specific output.
14677 The possible lengths in the latter case are: 128, 256, 512, 1024
14678 and 2048. @samp{scalable} is the default.
14679
14680 At present, @samp{-msve-vector-bits=128} produces the same output
14681 as @samp{-msve-vector-bits=scalable}.
14682
14683 @end table
14684
14685 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
14686 @anchor{aarch64-feature-modifiers}
14687 @cindex @option{-march} feature modifiers
14688 @cindex @option{-mcpu} feature modifiers
14689 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
14690 the following and their inverses @option{no@var{feature}}:
14691
14692 @table @samp
14693 @item crc
14694 Enable CRC extension. This is on by default for
14695 @option{-march=armv8.1-a}.
14696 @item crypto
14697 Enable Crypto extension. This also enables Advanced SIMD and floating-point
14698 instructions.
14699 @item fp
14700 Enable floating-point instructions. This is on by default for all possible
14701 values for options @option{-march} and @option{-mcpu}.
14702 @item simd
14703 Enable Advanced SIMD instructions. This also enables floating-point
14704 instructions. This is on by default for all possible values for options
14705 @option{-march} and @option{-mcpu}.
14706 @item sve
14707 Enable Scalable Vector Extension instructions. This also enables Advanced
14708 SIMD and floating-point instructions.
14709 @item lse
14710 Enable Large System Extension instructions. This is on by default for
14711 @option{-march=armv8.1-a}.
14712 @item rdma
14713 Enable Round Double Multiply Accumulate instructions. This is on by default
14714 for @option{-march=armv8.1-a}.
14715 @item fp16
14716 Enable FP16 extension. This also enables floating-point instructions.
14717 @item fp16fml
14718 Enable FP16 fmla extension. This also enables FP16 extensions and
14719 floating-point instructions. This option is enabled by default for @option{-march=armv8.4-a}. Use of this option with architectures prior to Armv8.2-A is not supported.
14720
14721 @item rcpc
14722 Enable the RcPc extension. This does not change code generation from GCC,
14723 but is passed on to the assembler, enabling inline asm statements to use
14724 instructions from the RcPc extension.
14725 @item dotprod
14726 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
14727 @item aes
14728 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
14729 SIMD instructions.
14730 @item sha2
14731 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
14732 @item sha3
14733 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
14734 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
14735 @item sm4
14736 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
14737 Use of this option with architectures prior to Armv8.2-A is not supported.
14738
14739 @end table
14740
14741 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
14742 which implies @option{fp}.
14743 Conversely, @option{nofp} implies @option{nosimd}, which implies
14744 @option{nocrypto}, @option{noaes} and @option{nosha2}.
14745
14746 @node Adapteva Epiphany Options
14747 @subsection Adapteva Epiphany Options
14748
14749 These @samp{-m} options are defined for Adapteva Epiphany:
14750
14751 @table @gcctabopt
14752 @item -mhalf-reg-file
14753 @opindex mhalf-reg-file
14754 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
14755 That allows code to run on hardware variants that lack these registers.
14756
14757 @item -mprefer-short-insn-regs
14758 @opindex mprefer-short-insn-regs
14759 Preferentially allocate registers that allow short instruction generation.
14760 This can result in increased instruction count, so this may either reduce or
14761 increase overall code size.
14762
14763 @item -mbranch-cost=@var{num}
14764 @opindex mbranch-cost
14765 Set the cost of branches to roughly @var{num} ``simple'' instructions.
14766 This cost is only a heuristic and is not guaranteed to produce
14767 consistent results across releases.
14768
14769 @item -mcmove
14770 @opindex mcmove
14771 Enable the generation of conditional moves.
14772
14773 @item -mnops=@var{num}
14774 @opindex mnops
14775 Emit @var{num} NOPs before every other generated instruction.
14776
14777 @item -mno-soft-cmpsf
14778 @opindex mno-soft-cmpsf
14779 For single-precision floating-point comparisons, emit an @code{fsub} instruction
14780 and test the flags. This is faster than a software comparison, but can
14781 get incorrect results in the presence of NaNs, or when two different small
14782 numbers are compared such that their difference is calculated as zero.
14783 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
14784 software comparisons.
14785
14786 @item -mstack-offset=@var{num}
14787 @opindex mstack-offset
14788 Set the offset between the top of the stack and the stack pointer.
14789 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
14790 can be used by leaf functions without stack allocation.
14791 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
14792 Note also that this option changes the ABI; compiling a program with a
14793 different stack offset than the libraries have been compiled with
14794 generally does not work.
14795 This option can be useful if you want to evaluate if a different stack
14796 offset would give you better code, but to actually use a different stack
14797 offset to build working programs, it is recommended to configure the
14798 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
14799
14800 @item -mno-round-nearest
14801 @opindex mno-round-nearest
14802 Make the scheduler assume that the rounding mode has been set to
14803 truncating. The default is @option{-mround-nearest}.
14804
14805 @item -mlong-calls
14806 @opindex mlong-calls
14807 If not otherwise specified by an attribute, assume all calls might be beyond
14808 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
14809 function address into a register before performing a (otherwise direct) call.
14810 This is the default.
14811
14812 @item -mshort-calls
14813 @opindex short-calls
14814 If not otherwise specified by an attribute, assume all direct calls are
14815 in the range of the @code{b} / @code{bl} instructions, so use these instructions
14816 for direct calls. The default is @option{-mlong-calls}.
14817
14818 @item -msmall16
14819 @opindex msmall16
14820 Assume addresses can be loaded as 16-bit unsigned values. This does not
14821 apply to function addresses for which @option{-mlong-calls} semantics
14822 are in effect.
14823
14824 @item -mfp-mode=@var{mode}
14825 @opindex mfp-mode
14826 Set the prevailing mode of the floating-point unit.
14827 This determines the floating-point mode that is provided and expected
14828 at function call and return time. Making this mode match the mode you
14829 predominantly need at function start can make your programs smaller and
14830 faster by avoiding unnecessary mode switches.
14831
14832 @var{mode} can be set to one the following values:
14833
14834 @table @samp
14835 @item caller
14836 Any mode at function entry is valid, and retained or restored when
14837 the function returns, and when it calls other functions.
14838 This mode is useful for compiling libraries or other compilation units
14839 you might want to incorporate into different programs with different
14840 prevailing FPU modes, and the convenience of being able to use a single
14841 object file outweighs the size and speed overhead for any extra
14842 mode switching that might be needed, compared with what would be needed
14843 with a more specific choice of prevailing FPU mode.
14844
14845 @item truncate
14846 This is the mode used for floating-point calculations with
14847 truncating (i.e.@: round towards zero) rounding mode. That includes
14848 conversion from floating point to integer.
14849
14850 @item round-nearest
14851 This is the mode used for floating-point calculations with
14852 round-to-nearest-or-even rounding mode.
14853
14854 @item int
14855 This is the mode used to perform integer calculations in the FPU, e.g.@:
14856 integer multiply, or integer multiply-and-accumulate.
14857 @end table
14858
14859 The default is @option{-mfp-mode=caller}
14860
14861 @item -mnosplit-lohi
14862 @itemx -mno-postinc
14863 @itemx -mno-postmodify
14864 @opindex mnosplit-lohi
14865 @opindex mno-postinc
14866 @opindex mno-postmodify
14867 Code generation tweaks that disable, respectively, splitting of 32-bit
14868 loads, generation of post-increment addresses, and generation of
14869 post-modify addresses. The defaults are @option{msplit-lohi},
14870 @option{-mpost-inc}, and @option{-mpost-modify}.
14871
14872 @item -mnovect-double
14873 @opindex mno-vect-double
14874 Change the preferred SIMD mode to SImode. The default is
14875 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
14876
14877 @item -max-vect-align=@var{num}
14878 @opindex max-vect-align
14879 The maximum alignment for SIMD vector mode types.
14880 @var{num} may be 4 or 8. The default is 8.
14881 Note that this is an ABI change, even though many library function
14882 interfaces are unaffected if they don't use SIMD vector modes
14883 in places that affect size and/or alignment of relevant types.
14884
14885 @item -msplit-vecmove-early
14886 @opindex msplit-vecmove-early
14887 Split vector moves into single word moves before reload. In theory this
14888 can give better register allocation, but so far the reverse seems to be
14889 generally the case.
14890
14891 @item -m1reg-@var{reg}
14892 @opindex m1reg-
14893 Specify a register to hold the constant @minus{}1, which makes loading small negative
14894 constants and certain bitmasks faster.
14895 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
14896 which specify use of that register as a fixed register,
14897 and @samp{none}, which means that no register is used for this
14898 purpose. The default is @option{-m1reg-none}.
14899
14900 @end table
14901
14902 @node ARC Options
14903 @subsection ARC Options
14904 @cindex ARC options
14905
14906 The following options control the architecture variant for which code
14907 is being compiled:
14908
14909 @c architecture variants
14910 @table @gcctabopt
14911
14912 @item -mbarrel-shifter
14913 @opindex mbarrel-shifter
14914 Generate instructions supported by barrel shifter. This is the default
14915 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
14916
14917 @item -mjli-always
14918 @opindex mjli-alawys
14919 Force to call a function using jli_s instruction. This option is
14920 valid only for ARCv2 architecture.
14921
14922 @item -mcpu=@var{cpu}
14923 @opindex mcpu
14924 Set architecture type, register usage, and instruction scheduling
14925 parameters for @var{cpu}. There are also shortcut alias options
14926 available for backward compatibility and convenience. Supported
14927 values for @var{cpu} are
14928
14929 @table @samp
14930 @opindex mA6
14931 @opindex mARC600
14932 @item arc600
14933 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
14934
14935 @item arc601
14936 @opindex mARC601
14937 Compile for ARC601. Alias: @option{-mARC601}.
14938
14939 @item arc700
14940 @opindex mA7
14941 @opindex mARC700
14942 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
14943 This is the default when configured with @option{--with-cpu=arc700}@.
14944
14945 @item arcem
14946 Compile for ARC EM.
14947
14948 @item archs
14949 Compile for ARC HS.
14950
14951 @item em
14952 Compile for ARC EM CPU with no hardware extensions.
14953
14954 @item em4
14955 Compile for ARC EM4 CPU.
14956
14957 @item em4_dmips
14958 Compile for ARC EM4 DMIPS CPU.
14959
14960 @item em4_fpus
14961 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
14962 extension.
14963
14964 @item em4_fpuda
14965 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
14966 double assist instructions.
14967
14968 @item hs
14969 Compile for ARC HS CPU with no hardware extensions except the atomic
14970 instructions.
14971
14972 @item hs34
14973 Compile for ARC HS34 CPU.
14974
14975 @item hs38
14976 Compile for ARC HS38 CPU.
14977
14978 @item hs38_linux
14979 Compile for ARC HS38 CPU with all hardware extensions on.
14980
14981 @item arc600_norm
14982 Compile for ARC 600 CPU with @code{norm} instructions enabled.
14983
14984 @item arc600_mul32x16
14985 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
14986 instructions enabled.
14987
14988 @item arc600_mul64
14989 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
14990 instructions enabled.
14991
14992 @item arc601_norm
14993 Compile for ARC 601 CPU with @code{norm} instructions enabled.
14994
14995 @item arc601_mul32x16
14996 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
14997 instructions enabled.
14998
14999 @item arc601_mul64
15000 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
15001 instructions enabled.
15002
15003 @item nps400
15004 Compile for ARC 700 on NPS400 chip.
15005
15006 @item em_mini
15007 Compile for ARC EM minimalist configuration featuring reduced register
15008 set.
15009
15010 @end table
15011
15012 @item -mdpfp
15013 @opindex mdpfp
15014 @itemx -mdpfp-compact
15015 @opindex mdpfp-compact
15016 Generate double-precision FPX instructions, tuned for the compact
15017 implementation.
15018
15019 @item -mdpfp-fast
15020 @opindex mdpfp-fast
15021 Generate double-precision FPX instructions, tuned for the fast
15022 implementation.
15023
15024 @item -mno-dpfp-lrsr
15025 @opindex mno-dpfp-lrsr
15026 Disable @code{lr} and @code{sr} instructions from using FPX extension
15027 aux registers.
15028
15029 @item -mea
15030 @opindex mea
15031 Generate extended arithmetic instructions. Currently only
15032 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
15033 supported. This is always enabled for @option{-mcpu=ARC700}.
15034
15035 @item -mno-mpy
15036 @opindex mno-mpy
15037 Do not generate @code{mpy}-family instructions for ARC700. This option is
15038 deprecated.
15039
15040 @item -mmul32x16
15041 @opindex mmul32x16
15042 Generate 32x16-bit multiply and multiply-accumulate instructions.
15043
15044 @item -mmul64
15045 @opindex mmul64
15046 Generate @code{mul64} and @code{mulu64} instructions.
15047 Only valid for @option{-mcpu=ARC600}.
15048
15049 @item -mnorm
15050 @opindex mnorm
15051 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
15052 is in effect.
15053
15054 @item -mspfp
15055 @opindex mspfp
15056 @itemx -mspfp-compact
15057 @opindex mspfp-compact
15058 Generate single-precision FPX instructions, tuned for the compact
15059 implementation.
15060
15061 @item -mspfp-fast
15062 @opindex mspfp-fast
15063 Generate single-precision FPX instructions, tuned for the fast
15064 implementation.
15065
15066 @item -msimd
15067 @opindex msimd
15068 Enable generation of ARC SIMD instructions via target-specific
15069 builtins. Only valid for @option{-mcpu=ARC700}.
15070
15071 @item -msoft-float
15072 @opindex msoft-float
15073 This option ignored; it is provided for compatibility purposes only.
15074 Software floating-point code is emitted by default, and this default
15075 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
15076 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
15077 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
15078
15079 @item -mswap
15080 @opindex mswap
15081 Generate @code{swap} instructions.
15082
15083 @item -matomic
15084 @opindex matomic
15085 This enables use of the locked load/store conditional extension to implement
15086 atomic memory built-in functions. Not available for ARC 6xx or ARC
15087 EM cores.
15088
15089 @item -mdiv-rem
15090 @opindex mdiv-rem
15091 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
15092
15093 @item -mcode-density
15094 @opindex mcode-density
15095 Enable code density instructions for ARC EM.
15096 This option is on by default for ARC HS.
15097
15098 @item -mll64
15099 @opindex mll64
15100 Enable double load/store operations for ARC HS cores.
15101
15102 @item -mtp-regno=@var{regno}
15103 @opindex mtp-regno
15104 Specify thread pointer register number.
15105
15106 @item -mmpy-option=@var{multo}
15107 @opindex mmpy-option
15108 Compile ARCv2 code with a multiplier design option. You can specify
15109 the option using either a string or numeric value for @var{multo}.
15110 @samp{wlh1} is the default value. The recognized values are:
15111
15112 @table @samp
15113 @item 0
15114 @itemx none
15115 No multiplier available.
15116
15117 @item 1
15118 @itemx w
15119 16x16 multiplier, fully pipelined.
15120 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
15121
15122 @item 2
15123 @itemx wlh1
15124 32x32 multiplier, fully
15125 pipelined (1 stage). The following instructions are additionally
15126 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15127
15128 @item 3
15129 @itemx wlh2
15130 32x32 multiplier, fully pipelined
15131 (2 stages). The following instructions are additionally enabled: @code{mpy},
15132 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15133
15134 @item 4
15135 @itemx wlh3
15136 Two 16x16 multipliers, blocking,
15137 sequential. The following instructions are additionally enabled: @code{mpy},
15138 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15139
15140 @item 5
15141 @itemx wlh4
15142 One 16x16 multiplier, blocking,
15143 sequential. The following instructions are additionally enabled: @code{mpy},
15144 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15145
15146 @item 6
15147 @itemx wlh5
15148 One 32x4 multiplier, blocking,
15149 sequential. The following instructions are additionally enabled: @code{mpy},
15150 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15151
15152 @item 7
15153 @itemx plus_dmpy
15154 ARC HS SIMD support.
15155
15156 @item 8
15157 @itemx plus_macd
15158 ARC HS SIMD support.
15159
15160 @item 9
15161 @itemx plus_qmacw
15162 ARC HS SIMD support.
15163
15164 @end table
15165
15166 This option is only available for ARCv2 cores@.
15167
15168 @item -mfpu=@var{fpu}
15169 @opindex mfpu
15170 Enables support for specific floating-point hardware extensions for ARCv2
15171 cores. Supported values for @var{fpu} are:
15172
15173 @table @samp
15174
15175 @item fpus
15176 Enables support for single-precision floating-point hardware
15177 extensions@.
15178
15179 @item fpud
15180 Enables support for double-precision floating-point hardware
15181 extensions. The single-precision floating-point extension is also
15182 enabled. Not available for ARC EM@.
15183
15184 @item fpuda
15185 Enables support for double-precision floating-point hardware
15186 extensions using double-precision assist instructions. The single-precision
15187 floating-point extension is also enabled. This option is
15188 only available for ARC EM@.
15189
15190 @item fpuda_div
15191 Enables support for double-precision floating-point hardware
15192 extensions using double-precision assist instructions.
15193 The single-precision floating-point, square-root, and divide
15194 extensions are also enabled. This option is
15195 only available for ARC EM@.
15196
15197 @item fpuda_fma
15198 Enables support for double-precision floating-point hardware
15199 extensions using double-precision assist instructions.
15200 The single-precision floating-point and fused multiply and add
15201 hardware extensions are also enabled. This option is
15202 only available for ARC EM@.
15203
15204 @item fpuda_all
15205 Enables support for double-precision floating-point hardware
15206 extensions using double-precision assist instructions.
15207 All single-precision floating-point hardware extensions are also
15208 enabled. This option is only available for ARC EM@.
15209
15210 @item fpus_div
15211 Enables support for single-precision floating-point, square-root and divide
15212 hardware extensions@.
15213
15214 @item fpud_div
15215 Enables support for double-precision floating-point, square-root and divide
15216 hardware extensions. This option
15217 includes option @samp{fpus_div}. Not available for ARC EM@.
15218
15219 @item fpus_fma
15220 Enables support for single-precision floating-point and
15221 fused multiply and add hardware extensions@.
15222
15223 @item fpud_fma
15224 Enables support for double-precision floating-point and
15225 fused multiply and add hardware extensions. This option
15226 includes option @samp{fpus_fma}. Not available for ARC EM@.
15227
15228 @item fpus_all
15229 Enables support for all single-precision floating-point hardware
15230 extensions@.
15231
15232 @item fpud_all
15233 Enables support for all single- and double-precision floating-point
15234 hardware extensions. Not available for ARC EM@.
15235
15236 @end table
15237
15238 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
15239 @opindex mirq-ctrl-saved
15240 Specifies general-purposes registers that the processor automatically
15241 saves/restores on interrupt entry and exit. @var{register-range} is
15242 specified as two registers separated by a dash. The register range
15243 always starts with @code{r0}, the upper limit is @code{fp} register.
15244 @var{blink} and @var{lp_count} are optional. This option is only
15245 valid for ARC EM and ARC HS cores.
15246
15247 @item -mrgf-banked-regs=@var{number}
15248 @opindex mrgf-banked-regs
15249 Specifies the number of registers replicated in second register bank
15250 on entry to fast interrupt. Fast interrupts are interrupts with the
15251 highest priority level P0. These interrupts save only PC and STATUS32
15252 registers to avoid memory transactions during interrupt entry and exit
15253 sequences. Use this option when you are using fast interrupts in an
15254 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
15255
15256 @item -mlpc-width=@var{width}
15257 @opindex mlpc-width
15258 Specify the width of the @code{lp_count} register. Valid values for
15259 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
15260 fixed to 32 bits. If the width is less than 32, the compiler does not
15261 attempt to transform loops in your program to use the zero-delay loop
15262 mechanism unless it is known that the @code{lp_count} register can
15263 hold the required loop-counter value. Depending on the width
15264 specified, the compiler and run-time library might continue to use the
15265 loop mechanism for various needs. This option defines macro
15266 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
15267
15268 @item -mrf16
15269 @opindex mrf16
15270 This option instructs the compiler to generate code for a 16-entry
15271 register file. This option defines the @code{__ARC_RF16__}
15272 preprocessor macro.
15273
15274 @end table
15275
15276 The following options are passed through to the assembler, and also
15277 define preprocessor macro symbols.
15278
15279 @c Flags used by the assembler, but for which we define preprocessor
15280 @c macro symbols as well.
15281 @table @gcctabopt
15282 @item -mdsp-packa
15283 @opindex mdsp-packa
15284 Passed down to the assembler to enable the DSP Pack A extensions.
15285 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
15286 deprecated.
15287
15288 @item -mdvbf
15289 @opindex mdvbf
15290 Passed down to the assembler to enable the dual Viterbi butterfly
15291 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
15292 option is deprecated.
15293
15294 @c ARC700 4.10 extension instruction
15295 @item -mlock
15296 @opindex mlock
15297 Passed down to the assembler to enable the locked load/store
15298 conditional extension. Also sets the preprocessor symbol
15299 @code{__Xlock}.
15300
15301 @item -mmac-d16
15302 @opindex mmac-d16
15303 Passed down to the assembler. Also sets the preprocessor symbol
15304 @code{__Xxmac_d16}. This option is deprecated.
15305
15306 @item -mmac-24
15307 @opindex mmac-24
15308 Passed down to the assembler. Also sets the preprocessor symbol
15309 @code{__Xxmac_24}. This option is deprecated.
15310
15311 @c ARC700 4.10 extension instruction
15312 @item -mrtsc
15313 @opindex mrtsc
15314 Passed down to the assembler to enable the 64-bit time-stamp counter
15315 extension instruction. Also sets the preprocessor symbol
15316 @code{__Xrtsc}. This option is deprecated.
15317
15318 @c ARC700 4.10 extension instruction
15319 @item -mswape
15320 @opindex mswape
15321 Passed down to the assembler to enable the swap byte ordering
15322 extension instruction. Also sets the preprocessor symbol
15323 @code{__Xswape}.
15324
15325 @item -mtelephony
15326 @opindex mtelephony
15327 Passed down to the assembler to enable dual- and single-operand
15328 instructions for telephony. Also sets the preprocessor symbol
15329 @code{__Xtelephony}. This option is deprecated.
15330
15331 @item -mxy
15332 @opindex mxy
15333 Passed down to the assembler to enable the XY memory extension. Also
15334 sets the preprocessor symbol @code{__Xxy}.
15335
15336 @end table
15337
15338 The following options control how the assembly code is annotated:
15339
15340 @c Assembly annotation options
15341 @table @gcctabopt
15342 @item -misize
15343 @opindex misize
15344 Annotate assembler instructions with estimated addresses.
15345
15346 @item -mannotate-align
15347 @opindex mannotate-align
15348 Explain what alignment considerations lead to the decision to make an
15349 instruction short or long.
15350
15351 @end table
15352
15353 The following options are passed through to the linker:
15354
15355 @c options passed through to the linker
15356 @table @gcctabopt
15357 @item -marclinux
15358 @opindex marclinux
15359 Passed through to the linker, to specify use of the @code{arclinux} emulation.
15360 This option is enabled by default in tool chains built for
15361 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
15362 when profiling is not requested.
15363
15364 @item -marclinux_prof
15365 @opindex marclinux_prof
15366 Passed through to the linker, to specify use of the
15367 @code{arclinux_prof} emulation. This option is enabled by default in
15368 tool chains built for @w{@code{arc-linux-uclibc}} and
15369 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
15370
15371 @end table
15372
15373 The following options control the semantics of generated code:
15374
15375 @c semantically relevant code generation options
15376 @table @gcctabopt
15377 @item -mlong-calls
15378 @opindex mlong-calls
15379 Generate calls as register indirect calls, thus providing access
15380 to the full 32-bit address range.
15381
15382 @item -mmedium-calls
15383 @opindex mmedium-calls
15384 Don't use less than 25-bit addressing range for calls, which is the
15385 offset available for an unconditional branch-and-link
15386 instruction. Conditional execution of function calls is suppressed, to
15387 allow use of the 25-bit range, rather than the 21-bit range with
15388 conditional branch-and-link. This is the default for tool chains built
15389 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
15390
15391 @item -G @var{num}
15392 @opindex G
15393 Put definitions of externally-visible data in a small data section if
15394 that data is no bigger than @var{num} bytes. The default value of
15395 @var{num} is 4 for any ARC configuration, or 8 when we have double
15396 load/store operations.
15397
15398 @item -mno-sdata
15399 @opindex mno-sdata
15400 Do not generate sdata references. This is the default for tool chains
15401 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
15402 targets.
15403
15404 @item -mvolatile-cache
15405 @opindex mvolatile-cache
15406 Use ordinarily cached memory accesses for volatile references. This is the
15407 default.
15408
15409 @item -mno-volatile-cache
15410 @opindex mno-volatile-cache
15411 Enable cache bypass for volatile references.
15412
15413 @end table
15414
15415 The following options fine tune code generation:
15416 @c code generation tuning options
15417 @table @gcctabopt
15418 @item -malign-call
15419 @opindex malign-call
15420 Do alignment optimizations for call instructions.
15421
15422 @item -mauto-modify-reg
15423 @opindex mauto-modify-reg
15424 Enable the use of pre/post modify with register displacement.
15425
15426 @item -mbbit-peephole
15427 @opindex mbbit-peephole
15428 Enable bbit peephole2.
15429
15430 @item -mno-brcc
15431 @opindex mno-brcc
15432 This option disables a target-specific pass in @file{arc_reorg} to
15433 generate compare-and-branch (@code{br@var{cc}}) instructions.
15434 It has no effect on
15435 generation of these instructions driven by the combiner pass.
15436
15437 @item -mcase-vector-pcrel
15438 @opindex mcase-vector-pcrel
15439 Use PC-relative switch case tables to enable case table shortening.
15440 This is the default for @option{-Os}.
15441
15442 @item -mcompact-casesi
15443 @opindex mcompact-casesi
15444 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
15445 and only available for ARCv1 cores.
15446
15447 @item -mno-cond-exec
15448 @opindex mno-cond-exec
15449 Disable the ARCompact-specific pass to generate conditional
15450 execution instructions.
15451
15452 Due to delay slot scheduling and interactions between operand numbers,
15453 literal sizes, instruction lengths, and the support for conditional execution,
15454 the target-independent pass to generate conditional execution is often lacking,
15455 so the ARC port has kept a special pass around that tries to find more
15456 conditional execution generation opportunities after register allocation,
15457 branch shortening, and delay slot scheduling have been done. This pass
15458 generally, but not always, improves performance and code size, at the cost of
15459 extra compilation time, which is why there is an option to switch it off.
15460 If you have a problem with call instructions exceeding their allowable
15461 offset range because they are conditionalized, you should consider using
15462 @option{-mmedium-calls} instead.
15463
15464 @item -mearly-cbranchsi
15465 @opindex mearly-cbranchsi
15466 Enable pre-reload use of the @code{cbranchsi} pattern.
15467
15468 @item -mexpand-adddi
15469 @opindex mexpand-adddi
15470 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
15471 @code{add.f}, @code{adc} etc. This option is deprecated.
15472
15473 @item -mindexed-loads
15474 @opindex mindexed-loads
15475 Enable the use of indexed loads. This can be problematic because some
15476 optimizers then assume that indexed stores exist, which is not
15477 the case.
15478
15479 @item -mlra
15480 @opindex mlra
15481 Enable Local Register Allocation. This is still experimental for ARC,
15482 so by default the compiler uses standard reload
15483 (i.e. @option{-mno-lra}).
15484
15485 @item -mlra-priority-none
15486 @opindex mlra-priority-none
15487 Don't indicate any priority for target registers.
15488
15489 @item -mlra-priority-compact
15490 @opindex mlra-priority-compact
15491 Indicate target register priority for r0..r3 / r12..r15.
15492
15493 @item -mlra-priority-noncompact
15494 @opindex mlra-priority-noncompact
15495 Reduce target register priority for r0..r3 / r12..r15.
15496
15497 @item -mno-millicode
15498 @opindex mno-millicode
15499 When optimizing for size (using @option{-Os}), prologues and epilogues
15500 that have to save or restore a large number of registers are often
15501 shortened by using call to a special function in libgcc; this is
15502 referred to as a @emph{millicode} call. As these calls can pose
15503 performance issues, and/or cause linking issues when linking in a
15504 nonstandard way, this option is provided to turn off millicode call
15505 generation.
15506
15507 @item -mmixed-code
15508 @opindex mmixed-code
15509 Tweak register allocation to help 16-bit instruction generation.
15510 This generally has the effect of decreasing the average instruction size
15511 while increasing the instruction count.
15512
15513 @item -mq-class
15514 @opindex mq-class
15515 Enable @samp{q} instruction alternatives.
15516 This is the default for @option{-Os}.
15517
15518 @item -mRcq
15519 @opindex mRcq
15520 Enable @samp{Rcq} constraint handling.
15521 Most short code generation depends on this.
15522 This is the default.
15523
15524 @item -mRcw
15525 @opindex mRcw
15526 Enable @samp{Rcw} constraint handling.
15527 Most ccfsm condexec mostly depends on this.
15528 This is the default.
15529
15530 @item -msize-level=@var{level}
15531 @opindex msize-level
15532 Fine-tune size optimization with regards to instruction lengths and alignment.
15533 The recognized values for @var{level} are:
15534 @table @samp
15535 @item 0
15536 No size optimization. This level is deprecated and treated like @samp{1}.
15537
15538 @item 1
15539 Short instructions are used opportunistically.
15540
15541 @item 2
15542 In addition, alignment of loops and of code after barriers are dropped.
15543
15544 @item 3
15545 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
15546
15547 @end table
15548
15549 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
15550 the behavior when this is not set is equivalent to level @samp{1}.
15551
15552 @item -mtune=@var{cpu}
15553 @opindex mtune
15554 Set instruction scheduling parameters for @var{cpu}, overriding any implied
15555 by @option{-mcpu=}.
15556
15557 Supported values for @var{cpu} are
15558
15559 @table @samp
15560 @item ARC600
15561 Tune for ARC600 CPU.
15562
15563 @item ARC601
15564 Tune for ARC601 CPU.
15565
15566 @item ARC700
15567 Tune for ARC700 CPU with standard multiplier block.
15568
15569 @item ARC700-xmac
15570 Tune for ARC700 CPU with XMAC block.
15571
15572 @item ARC725D
15573 Tune for ARC725D CPU.
15574
15575 @item ARC750D
15576 Tune for ARC750D CPU.
15577
15578 @end table
15579
15580 @item -mmultcost=@var{num}
15581 @opindex mmultcost
15582 Cost to assume for a multiply instruction, with @samp{4} being equal to a
15583 normal instruction.
15584
15585 @item -munalign-prob-threshold=@var{probability}
15586 @opindex munalign-prob-threshold
15587 Set probability threshold for unaligning branches.
15588 When tuning for @samp{ARC700} and optimizing for speed, branches without
15589 filled delay slot are preferably emitted unaligned and long, unless
15590 profiling indicates that the probability for the branch to be taken
15591 is below @var{probability}. @xref{Cross-profiling}.
15592 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
15593
15594 @end table
15595
15596 The following options are maintained for backward compatibility, but
15597 are now deprecated and will be removed in a future release:
15598
15599 @c Deprecated options
15600 @table @gcctabopt
15601
15602 @item -margonaut
15603 @opindex margonaut
15604 Obsolete FPX.
15605
15606 @item -mbig-endian
15607 @opindex mbig-endian
15608 @itemx -EB
15609 @opindex EB
15610 Compile code for big-endian targets. Use of these options is now
15611 deprecated. Big-endian code is supported by configuring GCC to build
15612 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
15613 for which big endian is the default.
15614
15615 @item -mlittle-endian
15616 @opindex mlittle-endian
15617 @itemx -EL
15618 @opindex EL
15619 Compile code for little-endian targets. Use of these options is now
15620 deprecated. Little-endian code is supported by configuring GCC to build
15621 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
15622 for which little endian is the default.
15623
15624 @item -mbarrel_shifter
15625 @opindex mbarrel_shifter
15626 Replaced by @option{-mbarrel-shifter}.
15627
15628 @item -mdpfp_compact
15629 @opindex mdpfp_compact
15630 Replaced by @option{-mdpfp-compact}.
15631
15632 @item -mdpfp_fast
15633 @opindex mdpfp_fast
15634 Replaced by @option{-mdpfp-fast}.
15635
15636 @item -mdsp_packa
15637 @opindex mdsp_packa
15638 Replaced by @option{-mdsp-packa}.
15639
15640 @item -mEA
15641 @opindex mEA
15642 Replaced by @option{-mea}.
15643
15644 @item -mmac_24
15645 @opindex mmac_24
15646 Replaced by @option{-mmac-24}.
15647
15648 @item -mmac_d16
15649 @opindex mmac_d16
15650 Replaced by @option{-mmac-d16}.
15651
15652 @item -mspfp_compact
15653 @opindex mspfp_compact
15654 Replaced by @option{-mspfp-compact}.
15655
15656 @item -mspfp_fast
15657 @opindex mspfp_fast
15658 Replaced by @option{-mspfp-fast}.
15659
15660 @item -mtune=@var{cpu}
15661 @opindex mtune
15662 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
15663 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
15664 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
15665
15666 @item -multcost=@var{num}
15667 @opindex multcost
15668 Replaced by @option{-mmultcost}.
15669
15670 @end table
15671
15672 @node ARM Options
15673 @subsection ARM Options
15674 @cindex ARM options
15675
15676 These @samp{-m} options are defined for the ARM port:
15677
15678 @table @gcctabopt
15679 @item -mabi=@var{name}
15680 @opindex mabi
15681 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
15682 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
15683
15684 @item -mapcs-frame
15685 @opindex mapcs-frame
15686 Generate a stack frame that is compliant with the ARM Procedure Call
15687 Standard for all functions, even if this is not strictly necessary for
15688 correct execution of the code. Specifying @option{-fomit-frame-pointer}
15689 with this option causes the stack frames not to be generated for
15690 leaf functions. The default is @option{-mno-apcs-frame}.
15691 This option is deprecated.
15692
15693 @item -mapcs
15694 @opindex mapcs
15695 This is a synonym for @option{-mapcs-frame} and is deprecated.
15696
15697 @ignore
15698 @c not currently implemented
15699 @item -mapcs-stack-check
15700 @opindex mapcs-stack-check
15701 Generate code to check the amount of stack space available upon entry to
15702 every function (that actually uses some stack space). If there is
15703 insufficient space available then either the function
15704 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
15705 called, depending upon the amount of stack space required. The runtime
15706 system is required to provide these functions. The default is
15707 @option{-mno-apcs-stack-check}, since this produces smaller code.
15708
15709 @c not currently implemented
15710 @item -mapcs-reentrant
15711 @opindex mapcs-reentrant
15712 Generate reentrant, position-independent code. The default is
15713 @option{-mno-apcs-reentrant}.
15714 @end ignore
15715
15716 @item -mthumb-interwork
15717 @opindex mthumb-interwork
15718 Generate code that supports calling between the ARM and Thumb
15719 instruction sets. Without this option, on pre-v5 architectures, the
15720 two instruction sets cannot be reliably used inside one program. The
15721 default is @option{-mno-thumb-interwork}, since slightly larger code
15722 is generated when @option{-mthumb-interwork} is specified. In AAPCS
15723 configurations this option is meaningless.
15724
15725 @item -mno-sched-prolog
15726 @opindex mno-sched-prolog
15727 Prevent the reordering of instructions in the function prologue, or the
15728 merging of those instruction with the instructions in the function's
15729 body. This means that all functions start with a recognizable set
15730 of instructions (or in fact one of a choice from a small set of
15731 different function prologues), and this information can be used to
15732 locate the start of functions inside an executable piece of code. The
15733 default is @option{-msched-prolog}.
15734
15735 @item -mfloat-abi=@var{name}
15736 @opindex mfloat-abi
15737 Specifies which floating-point ABI to use. Permissible values
15738 are: @samp{soft}, @samp{softfp} and @samp{hard}.
15739
15740 Specifying @samp{soft} causes GCC to generate output containing
15741 library calls for floating-point operations.
15742 @samp{softfp} allows the generation of code using hardware floating-point
15743 instructions, but still uses the soft-float calling conventions.
15744 @samp{hard} allows generation of floating-point instructions
15745 and uses FPU-specific calling conventions.
15746
15747 The default depends on the specific target configuration. Note that
15748 the hard-float and soft-float ABIs are not link-compatible; you must
15749 compile your entire program with the same ABI, and link with a
15750 compatible set of libraries.
15751
15752 @item -mlittle-endian
15753 @opindex mlittle-endian
15754 Generate code for a processor running in little-endian mode. This is
15755 the default for all standard configurations.
15756
15757 @item -mbig-endian
15758 @opindex mbig-endian
15759 Generate code for a processor running in big-endian mode; the default is
15760 to compile code for a little-endian processor.
15761
15762 @item -mbe8
15763 @itemx -mbe32
15764 @opindex mbe8
15765 When linking a big-endian image select between BE8 and BE32 formats.
15766 The option has no effect for little-endian images and is ignored. The
15767 default is dependent on the selected target architecture. For ARMv6
15768 and later architectures the default is BE8, for older architectures
15769 the default is BE32. BE32 format has been deprecated by ARM.
15770
15771 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
15772 @opindex march
15773 This specifies the name of the target ARM architecture. GCC uses this
15774 name to determine what kind of instructions it can emit when generating
15775 assembly code. This option can be used in conjunction with or instead
15776 of the @option{-mcpu=} option.
15777
15778 Permissible names are:
15779 @samp{armv4t},
15780 @samp{armv5t}, @samp{armv5te},
15781 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
15782 @samp{armv6z}, @samp{armv6zk},
15783 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
15784 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
15785 @samp{armv8.4-a},
15786 @samp{armv7-r},
15787 @samp{armv8-r},
15788 @samp{armv6-m}, @samp{armv6s-m},
15789 @samp{armv7-m}, @samp{armv7e-m},
15790 @samp{armv8-m.base}, @samp{armv8-m.main},
15791 @samp{iwmmxt} and @samp{iwmmxt2}.
15792
15793 Additionally, the following architectures, which lack support for the
15794 Thumb execution state, are recognized but support is deprecated:
15795 @samp{armv2}, @samp{armv2a}, @samp{armv3}, @samp{armv3m},
15796 @samp{armv4}, @samp{armv5} and @samp{armv5e}.
15797
15798 Many of the architectures support extensions. These can be added by
15799 appending @samp{+@var{extension}} to the architecture name. Extension
15800 options are processed in order and capabilities accumulate. An extension
15801 will also enable any necessary base extensions
15802 upon which it depends. For example, the @samp{+crypto} extension
15803 will always enable the @samp{+simd} extension. The exception to the
15804 additive construction is for extensions that are prefixed with
15805 @samp{+no@dots{}}: these extensions disable the specified option and
15806 any other extensions that may depend on the presence of that
15807 extension.
15808
15809 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
15810 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
15811 entirely disabled by the @samp{+nofp} option that follows it.
15812
15813 Most extension names are generically named, but have an effect that is
15814 dependent upon the architecture to which it is applied. For example,
15815 the @samp{+simd} option can be applied to both @samp{armv7-a} and
15816 @samp{armv8-a} architectures, but will enable the original ARMv7-A
15817 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
15818 variant for @samp{armv8-a}.
15819
15820 The table below lists the supported extensions for each architecture.
15821 Architectures not mentioned do not support any extensions.
15822
15823 @table @samp
15824 @item armv5e
15825 @itemx armv5te
15826 @itemx armv6
15827 @itemx armv6j
15828 @itemx armv6k
15829 @itemx armv6kz
15830 @itemx armv6t2
15831 @itemx armv6z
15832 @itemx armv6zk
15833 @table @samp
15834 @item +fp
15835 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
15836 used as an alias for this extension.
15837
15838 @item +nofp
15839 Disable the floating-point instructions.
15840 @end table
15841
15842 @item armv7
15843 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
15844 @table @samp
15845 @item +fp
15846 The VFPv3 floating-point instructions, with 16 double-precision
15847 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15848 for this extension. Note that floating-point is not supported by the
15849 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
15850 ARMv7-R architectures.
15851
15852 @item +nofp
15853 Disable the floating-point instructions.
15854 @end table
15855
15856 @item armv7-a
15857 @table @samp
15858 @item +fp
15859 The VFPv3 floating-point instructions, with 16 double-precision
15860 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15861 for this extension.
15862
15863 @item +simd
15864 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
15865 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
15866 for this extension.
15867
15868 @item +vfpv3
15869 The VFPv3 floating-point instructions, with 32 double-precision
15870 registers.
15871
15872 @item +vfpv3-d16-fp16
15873 The VFPv3 floating-point instructions, with 16 double-precision
15874 registers and the half-precision floating-point conversion operations.
15875
15876 @item +vfpv3-fp16
15877 The VFPv3 floating-point instructions, with 32 double-precision
15878 registers and the half-precision floating-point conversion operations.
15879
15880 @item +vfpv4-d16
15881 The VFPv4 floating-point instructions, with 16 double-precision
15882 registers.
15883
15884 @item +vfpv4
15885 The VFPv4 floating-point instructions, with 32 double-precision
15886 registers.
15887
15888 @item +neon-fp16
15889 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
15890 the half-precision floating-point conversion operations.
15891
15892 @item +neon-vfpv4
15893 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
15894
15895 @item +nosimd
15896 Disable the Advanced SIMD instructions (does not disable floating point).
15897
15898 @item +nofp
15899 Disable the floating-point and Advanced SIMD instructions.
15900 @end table
15901
15902 @item armv7ve
15903 The extended version of the ARMv7-A architecture with support for
15904 virtualization.
15905 @table @samp
15906 @item +fp
15907 The VFPv4 floating-point instructions, with 16 double-precision registers.
15908 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
15909
15910 @item +simd
15911 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
15912 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
15913
15914 @item +vfpv3-d16
15915 The VFPv3 floating-point instructions, with 16 double-precision
15916 registers.
15917
15918 @item +vfpv3
15919 The VFPv3 floating-point instructions, with 32 double-precision
15920 registers.
15921
15922 @item +vfpv3-d16-fp16
15923 The VFPv3 floating-point instructions, with 16 double-precision
15924 registers and the half-precision floating-point conversion operations.
15925
15926 @item +vfpv3-fp16
15927 The VFPv3 floating-point instructions, with 32 double-precision
15928 registers and the half-precision floating-point conversion operations.
15929
15930 @item +vfpv4-d16
15931 The VFPv4 floating-point instructions, with 16 double-precision
15932 registers.
15933
15934 @item +vfpv4
15935 The VFPv4 floating-point instructions, with 32 double-precision
15936 registers.
15937
15938 @item +neon
15939 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
15940 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
15941
15942 @item +neon-fp16
15943 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
15944 the half-precision floating-point conversion operations.
15945
15946 @item +nosimd
15947 Disable the Advanced SIMD instructions (does not disable floating point).
15948
15949 @item +nofp
15950 Disable the floating-point and Advanced SIMD instructions.
15951 @end table
15952
15953 @item armv8-a
15954 @table @samp
15955 @item +crc
15956 The Cyclic Redundancy Check (CRC) instructions.
15957 @item +simd
15958 The ARMv8-A Advanced SIMD and floating-point instructions.
15959 @item +crypto
15960 The cryptographic instructions.
15961 @item +nocrypto
15962 Disable the cryptographic instructions.
15963 @item +nofp
15964 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15965 @end table
15966
15967 @item armv8.1-a
15968 @table @samp
15969 @item +simd
15970 The ARMv8.1-A Advanced SIMD and floating-point instructions.
15971
15972 @item +crypto
15973 The cryptographic instructions. This also enables the Advanced SIMD and
15974 floating-point instructions.
15975
15976 @item +nocrypto
15977 Disable the cryptographic instructions.
15978
15979 @item +nofp
15980 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15981 @end table
15982
15983 @item armv8.2-a
15984 @itemx armv8.3-a
15985 @table @samp
15986 @item +fp16
15987 The half-precision floating-point data processing instructions.
15988 This also enables the Advanced SIMD and floating-point instructions.
15989
15990 @item +fp16fml
15991 The half-precision floating-point fmla extension. This also enables
15992 the half-precision floating-point extension and Advanced SIMD and
15993 floating-point instructions.
15994
15995 @item +simd
15996 The ARMv8.1-A Advanced SIMD and floating-point instructions.
15997
15998 @item +crypto
15999 The cryptographic instructions. This also enables the Advanced SIMD and
16000 floating-point instructions.
16001
16002 @item +dotprod
16003 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16004
16005 @item +nocrypto
16006 Disable the cryptographic extension.
16007
16008 @item +nofp
16009 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16010 @end table
16011
16012 @item armv8.4-a
16013 @table @samp
16014 @item +fp16
16015 The half-precision floating-point data processing instructions.
16016 This also enables the Advanced SIMD and floating-point instructions as well
16017 as the Dot Product extension and the half-precision floating-point fmla
16018 extension.
16019
16020 @item +simd
16021 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
16022 Dot Product extension.
16023
16024 @item +crypto
16025 The cryptographic instructions. This also enables the Advanced SIMD and
16026 floating-point instructions as well as the Dot Product extension.
16027
16028 @item +nocrypto
16029 Disable the cryptographic extension.
16030
16031 @item +nofp
16032 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16033 @end table
16034
16035 @item armv7-r
16036 @table @samp
16037 @item +fp.sp
16038 The single-precision VFPv3 floating-point instructions. The extension
16039 @samp{+vfpv3xd} can be used as an alias for this extension.
16040
16041 @item +fp
16042 The VFPv3 floating-point instructions with 16 double-precision registers.
16043 The extension +vfpv3-d16 can be used as an alias for this extension.
16044
16045 @item +nofp
16046 Disable the floating-point extension.
16047
16048 @item +idiv
16049 The ARM-state integer division instructions.
16050
16051 @item +noidiv
16052 Disable the ARM-state integer division extension.
16053 @end table
16054
16055 @item armv7e-m
16056 @table @samp
16057 @item +fp
16058 The single-precision VFPv4 floating-point instructions.
16059
16060 @item +fpv5
16061 The single-precision FPv5 floating-point instructions.
16062
16063 @item +fp.dp
16064 The single- and double-precision FPv5 floating-point instructions.
16065
16066 @item +nofp
16067 Disable the floating-point extensions.
16068 @end table
16069
16070 @item armv8-m.main
16071 @table @samp
16072 @item +dsp
16073 The DSP instructions.
16074
16075 @item +nodsp
16076 Disable the DSP extension.
16077
16078 @item +fp
16079 The single-precision floating-point instructions.
16080
16081 @item +fp.dp
16082 The single- and double-precision floating-point instructions.
16083
16084 @item +nofp
16085 Disable the floating-point extension.
16086 @end table
16087
16088 @item armv8-r
16089 @table @samp
16090 @item +crc
16091 The Cyclic Redundancy Check (CRC) instructions.
16092 @item +fp.sp
16093 The single-precision FPv5 floating-point instructions.
16094 @item +simd
16095 The ARMv8-A Advanced SIMD and floating-point instructions.
16096 @item +crypto
16097 The cryptographic instructions.
16098 @item +nocrypto
16099 Disable the cryptographic instructions.
16100 @item +nofp
16101 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16102 @end table
16103
16104 @end table
16105
16106 @option{-march=native} causes the compiler to auto-detect the architecture
16107 of the build computer. At present, this feature is only supported on
16108 GNU/Linux, and not all architectures are recognized. If the auto-detect
16109 is unsuccessful the option has no effect.
16110
16111 @item -mtune=@var{name}
16112 @opindex mtune
16113 This option specifies the name of the target ARM processor for
16114 which GCC should tune the performance of the code.
16115 For some ARM implementations better performance can be obtained by using
16116 this option.
16117 Permissible names are: @samp{arm2}, @samp{arm250},
16118 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
16119 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
16120 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
16121 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
16122 @samp{arm720},
16123 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
16124 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
16125 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
16126 @samp{strongarm1110},
16127 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
16128 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
16129 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
16130 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
16131 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
16132 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
16133 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
16134 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
16135 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
16136 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16137 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16138 @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7},
16139 @samp{cortex-r8}, @samp{cortex-r52},
16140 @samp{cortex-m33},
16141 @samp{cortex-m23},
16142 @samp{cortex-m7},
16143 @samp{cortex-m4},
16144 @samp{cortex-m3},
16145 @samp{cortex-m1},
16146 @samp{cortex-m0},
16147 @samp{cortex-m0plus},
16148 @samp{cortex-m1.small-multiply},
16149 @samp{cortex-m0.small-multiply},
16150 @samp{cortex-m0plus.small-multiply},
16151 @samp{exynos-m1},
16152 @samp{marvell-pj4},
16153 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
16154 @samp{fa526}, @samp{fa626},
16155 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
16156 @samp{xgene1}.
16157
16158 Additionally, this option can specify that GCC should tune the performance
16159 of the code for a big.LITTLE system. Permissible names are:
16160 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
16161 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16162 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
16163 @samp{cortex-a75.cortex-a55}.
16164
16165 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
16166 performance for a blend of processors within architecture @var{arch}.
16167 The aim is to generate code that run well on the current most popular
16168 processors, balancing between optimizations that benefit some CPUs in the
16169 range, and avoiding performance pitfalls of other CPUs. The effects of
16170 this option may change in future GCC versions as CPU models come and go.
16171
16172 @option{-mtune} permits the same extension options as @option{-mcpu}, but
16173 the extension options do not affect the tuning of the generated code.
16174
16175 @option{-mtune=native} causes the compiler to auto-detect the CPU
16176 of the build computer. At present, this feature is only supported on
16177 GNU/Linux, and not all architectures are recognized. If the auto-detect is
16178 unsuccessful the option has no effect.
16179
16180 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
16181 @opindex mcpu
16182 This specifies the name of the target ARM processor. GCC uses this name
16183 to derive the name of the target ARM architecture (as if specified
16184 by @option{-march}) and the ARM processor type for which to tune for
16185 performance (as if specified by @option{-mtune}). Where this option
16186 is used in conjunction with @option{-march} or @option{-mtune},
16187 those options take precedence over the appropriate part of this option.
16188
16189 Many of the supported CPUs implement optional architectural
16190 extensions. Where this is so the architectural extensions are
16191 normally enabled by default. If implementations that lack the
16192 extension exist, then the extension syntax can be used to disable
16193 those extensions that have been omitted. For floating-point and
16194 Advanced SIMD (Neon) instructions, the settings of the options
16195 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
16196 floating-point and Advanced SIMD instructions will only be used if
16197 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
16198 @option{-mfpu} other than @samp{auto} will override the available
16199 floating-point and SIMD extension instructions.
16200
16201 For example, @samp{cortex-a9} can be found in three major
16202 configurations: integer only, with just a floating-point unit or with
16203 floating-point and Advanced SIMD. The default is to enable all the
16204 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
16205 be used to disable just the SIMD or both the SIMD and floating-point
16206 instructions respectively.
16207
16208 Permissible names for this option are the same as those for
16209 @option{-mtune}.
16210
16211 The following extension options are common to the listed CPUs:
16212
16213 @table @samp
16214 @item +nodsp
16215 Disable the DSP instructions on @samp{cortex-m33}.
16216
16217 @item +nofp
16218 Disables the floating-point instructions on @samp{arm9e},
16219 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
16220 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
16221 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
16222 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
16223 Disables the floating-point and SIMD instructions on
16224 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
16225 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
16226 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
16227 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
16228 @samp{cortex-a53} and @samp{cortex-a55}.
16229
16230 @item +nofp.dp
16231 Disables the double-precision component of the floating-point instructions
16232 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
16233
16234 @item +nosimd
16235 Disables the SIMD (but not floating-point) instructions on
16236 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
16237 and @samp{cortex-a9}.
16238
16239 @item +crypto
16240 Enables the cryptographic instructions on @samp{cortex-a32},
16241 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
16242 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
16243 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16244 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
16245 @samp{cortex-a75.cortex-a55}.
16246 @end table
16247
16248 Additionally the @samp{generic-armv7-a} pseudo target defaults to
16249 VFPv3 with 16 double-precision registers. It supports the following
16250 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
16251 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
16252 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
16253 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
16254 @option{-march=armv7-a}.
16255
16256 @option{-mcpu=generic-@var{arch}} is also permissible, and is
16257 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
16258 See @option{-mtune} for more information.
16259
16260 @option{-mcpu=native} causes the compiler to auto-detect the CPU
16261 of the build computer. At present, this feature is only supported on
16262 GNU/Linux, and not all architectures are recognized. If the auto-detect
16263 is unsuccessful the option has no effect.
16264
16265 @item -mfpu=@var{name}
16266 @opindex mfpu
16267 This specifies what floating-point hardware (or hardware emulation) is
16268 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
16269 @samp{vfpv3},
16270 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
16271 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
16272 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
16273 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
16274 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
16275 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
16276 is an alias for @samp{vfpv2}.
16277
16278 The setting @samp{auto} is the default and is special. It causes the
16279 compiler to select the floating-point and Advanced SIMD instructions
16280 based on the settings of @option{-mcpu} and @option{-march}.
16281
16282 If the selected floating-point hardware includes the NEON extension
16283 (e.g. @option{-mfpu=neon}), note that floating-point
16284 operations are not generated by GCC's auto-vectorization pass unless
16285 @option{-funsafe-math-optimizations} is also specified. This is
16286 because NEON hardware does not fully implement the IEEE 754 standard for
16287 floating-point arithmetic (in particular denormal values are treated as
16288 zero), so the use of NEON instructions may lead to a loss of precision.
16289
16290 You can also set the fpu name at function level by using the @code{target("fpu=")} function attributes (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
16291
16292 @item -mfp16-format=@var{name}
16293 @opindex mfp16-format
16294 Specify the format of the @code{__fp16} half-precision floating-point type.
16295 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
16296 the default is @samp{none}, in which case the @code{__fp16} type is not
16297 defined. @xref{Half-Precision}, for more information.
16298
16299 @item -mstructure-size-boundary=@var{n}
16300 @opindex mstructure-size-boundary
16301 The sizes of all structures and unions are rounded up to a multiple
16302 of the number of bits set by this option. Permissible values are 8, 32
16303 and 64. The default value varies for different toolchains. For the COFF
16304 targeted toolchain the default value is 8. A value of 64 is only allowed
16305 if the underlying ABI supports it.
16306
16307 Specifying a larger number can produce faster, more efficient code, but
16308 can also increase the size of the program. Different values are potentially
16309 incompatible. Code compiled with one value cannot necessarily expect to
16310 work with code or libraries compiled with another value, if they exchange
16311 information using structures or unions.
16312
16313 This option is deprecated.
16314
16315 @item -mabort-on-noreturn
16316 @opindex mabort-on-noreturn
16317 Generate a call to the function @code{abort} at the end of a
16318 @code{noreturn} function. It is executed if the function tries to
16319 return.
16320
16321 @item -mlong-calls
16322 @itemx -mno-long-calls
16323 @opindex mlong-calls
16324 @opindex mno-long-calls
16325 Tells the compiler to perform function calls by first loading the
16326 address of the function into a register and then performing a subroutine
16327 call on this register. This switch is needed if the target function
16328 lies outside of the 64-megabyte addressing range of the offset-based
16329 version of subroutine call instruction.
16330
16331 Even if this switch is enabled, not all function calls are turned
16332 into long calls. The heuristic is that static functions, functions
16333 that have the @code{short_call} attribute, functions that are inside
16334 the scope of a @code{#pragma no_long_calls} directive, and functions whose
16335 definitions have already been compiled within the current compilation
16336 unit are not turned into long calls. The exceptions to this rule are
16337 that weak function definitions, functions with the @code{long_call}
16338 attribute or the @code{section} attribute, and functions that are within
16339 the scope of a @code{#pragma long_calls} directive are always
16340 turned into long calls.
16341
16342 This feature is not enabled by default. Specifying
16343 @option{-mno-long-calls} restores the default behavior, as does
16344 placing the function calls within the scope of a @code{#pragma
16345 long_calls_off} directive. Note these switches have no effect on how
16346 the compiler generates code to handle function calls via function
16347 pointers.
16348
16349 @item -msingle-pic-base
16350 @opindex msingle-pic-base
16351 Treat the register used for PIC addressing as read-only, rather than
16352 loading it in the prologue for each function. The runtime system is
16353 responsible for initializing this register with an appropriate value
16354 before execution begins.
16355
16356 @item -mpic-register=@var{reg}
16357 @opindex mpic-register
16358 Specify the register to be used for PIC addressing.
16359 For standard PIC base case, the default is any suitable register
16360 determined by compiler. For single PIC base case, the default is
16361 @samp{R9} if target is EABI based or stack-checking is enabled,
16362 otherwise the default is @samp{R10}.
16363
16364 @item -mpic-data-is-text-relative
16365 @opindex mpic-data-is-text-relative
16366 Assume that the displacement between the text and data segments is fixed
16367 at static link time. This permits using PC-relative addressing
16368 operations to access data known to be in the data segment. For
16369 non-VxWorks RTP targets, this option is enabled by default. When
16370 disabled on such targets, it will enable @option{-msingle-pic-base} by
16371 default.
16372
16373 @item -mpoke-function-name
16374 @opindex mpoke-function-name
16375 Write the name of each function into the text section, directly
16376 preceding the function prologue. The generated code is similar to this:
16377
16378 @smallexample
16379 t0
16380 .ascii "arm_poke_function_name", 0
16381 .align
16382 t1
16383 .word 0xff000000 + (t1 - t0)
16384 arm_poke_function_name
16385 mov ip, sp
16386 stmfd sp!, @{fp, ip, lr, pc@}
16387 sub fp, ip, #4
16388 @end smallexample
16389
16390 When performing a stack backtrace, code can inspect the value of
16391 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
16392 location @code{pc - 12} and the top 8 bits are set, then we know that
16393 there is a function name embedded immediately preceding this location
16394 and has length @code{((pc[-3]) & 0xff000000)}.
16395
16396 @item -mthumb
16397 @itemx -marm
16398 @opindex marm
16399 @opindex mthumb
16400
16401 Select between generating code that executes in ARM and Thumb
16402 states. The default for most configurations is to generate code
16403 that executes in ARM state, but the default can be changed by
16404 configuring GCC with the @option{--with-mode=}@var{state}
16405 configure option.
16406
16407 You can also override the ARM and Thumb mode for each function
16408 by using the @code{target("thumb")} and @code{target("arm")} function attributes
16409 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
16410
16411 @item -mflip-thumb
16412 @opindex mflip-thumb
16413 Switch ARM/Thumb modes on alternating functions.
16414 This option is provided for regression testing of mixed Thumb/ARM code
16415 generation, and is not intended for ordinary use in compiling code.
16416
16417 @item -mtpcs-frame
16418 @opindex mtpcs-frame
16419 Generate a stack frame that is compliant with the Thumb Procedure Call
16420 Standard for all non-leaf functions. (A leaf function is one that does
16421 not call any other functions.) The default is @option{-mno-tpcs-frame}.
16422
16423 @item -mtpcs-leaf-frame
16424 @opindex mtpcs-leaf-frame
16425 Generate a stack frame that is compliant with the Thumb Procedure Call
16426 Standard for all leaf functions. (A leaf function is one that does
16427 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
16428
16429 @item -mcallee-super-interworking
16430 @opindex mcallee-super-interworking
16431 Gives all externally visible functions in the file being compiled an ARM
16432 instruction set header which switches to Thumb mode before executing the
16433 rest of the function. This allows these functions to be called from
16434 non-interworking code. This option is not valid in AAPCS configurations
16435 because interworking is enabled by default.
16436
16437 @item -mcaller-super-interworking
16438 @opindex mcaller-super-interworking
16439 Allows calls via function pointers (including virtual functions) to
16440 execute correctly regardless of whether the target code has been
16441 compiled for interworking or not. There is a small overhead in the cost
16442 of executing a function pointer if this option is enabled. This option
16443 is not valid in AAPCS configurations because interworking is enabled
16444 by default.
16445
16446 @item -mtp=@var{name}
16447 @opindex mtp
16448 Specify the access model for the thread local storage pointer. The valid
16449 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
16450 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
16451 (supported in the arm6k architecture), and @samp{auto}, which uses the
16452 best available method for the selected processor. The default setting is
16453 @samp{auto}.
16454
16455 @item -mtls-dialect=@var{dialect}
16456 @opindex mtls-dialect
16457 Specify the dialect to use for accessing thread local storage. Two
16458 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
16459 @samp{gnu} dialect selects the original GNU scheme for supporting
16460 local and global dynamic TLS models. The @samp{gnu2} dialect
16461 selects the GNU descriptor scheme, which provides better performance
16462 for shared libraries. The GNU descriptor scheme is compatible with
16463 the original scheme, but does require new assembler, linker and
16464 library support. Initial and local exec TLS models are unaffected by
16465 this option and always use the original scheme.
16466
16467 @item -mword-relocations
16468 @opindex mword-relocations
16469 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
16470 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
16471 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
16472 is specified.
16473
16474 @item -mfix-cortex-m3-ldrd
16475 @opindex mfix-cortex-m3-ldrd
16476 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
16477 with overlapping destination and base registers are used. This option avoids
16478 generating these instructions. This option is enabled by default when
16479 @option{-mcpu=cortex-m3} is specified.
16480
16481 @item -munaligned-access
16482 @itemx -mno-unaligned-access
16483 @opindex munaligned-access
16484 @opindex mno-unaligned-access
16485 Enables (or disables) reading and writing of 16- and 32- bit values
16486 from addresses that are not 16- or 32- bit aligned. By default
16487 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
16488 ARMv8-M Baseline architectures, and enabled for all other
16489 architectures. If unaligned access is not enabled then words in packed
16490 data structures are accessed a byte at a time.
16491
16492 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
16493 generated object file to either true or false, depending upon the
16494 setting of this option. If unaligned access is enabled then the
16495 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
16496 defined.
16497
16498 @item -mneon-for-64bits
16499 @opindex mneon-for-64bits
16500 Enables using Neon to handle scalar 64-bits operations. This is
16501 disabled by default since the cost of moving data from core registers
16502 to Neon is high.
16503
16504 @item -mslow-flash-data
16505 @opindex mslow-flash-data
16506 Assume loading data from flash is slower than fetching instruction.
16507 Therefore literal load is minimized for better performance.
16508 This option is only supported when compiling for ARMv7 M-profile and
16509 off by default.
16510
16511 @item -masm-syntax-unified
16512 @opindex masm-syntax-unified
16513 Assume inline assembler is using unified asm syntax. The default is
16514 currently off which implies divided syntax. This option has no impact
16515 on Thumb2. However, this may change in future releases of GCC.
16516 Divided syntax should be considered deprecated.
16517
16518 @item -mrestrict-it
16519 @opindex mrestrict-it
16520 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
16521 IT blocks can only contain a single 16-bit instruction from a select
16522 set of instructions. This option is on by default for ARMv8-A Thumb mode.
16523
16524 @item -mprint-tune-info
16525 @opindex mprint-tune-info
16526 Print CPU tuning information as comment in assembler file. This is
16527 an option used only for regression testing of the compiler and not
16528 intended for ordinary use in compiling code. This option is disabled
16529 by default.
16530
16531 @item -mverbose-cost-dump
16532 @opindex mverbose-cost-dump
16533 Enable verbose cost model dumping in the debug dump files. This option is
16534 provided for use in debugging the compiler.
16535
16536 @item -mpure-code
16537 @opindex mpure-code
16538 Do not allow constant data to be placed in code sections.
16539 Additionally, when compiling for ELF object format give all text sections the
16540 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
16541 is only available when generating non-pic code for M-profile targets with the
16542 MOVT instruction.
16543
16544 @item -mcmse
16545 @opindex mcmse
16546 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
16547 Development Tools Engineering Specification", which can be found on
16548 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
16549 @end table
16550
16551 @node AVR Options
16552 @subsection AVR Options
16553 @cindex AVR Options
16554
16555 These options are defined for AVR implementations:
16556
16557 @table @gcctabopt
16558 @item -mmcu=@var{mcu}
16559 @opindex mmcu
16560 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16561
16562 The default for this option is@tie{}@samp{avr2}.
16563
16564 GCC supports the following AVR devices and ISAs:
16565
16566 @include avr-mmcu.texi
16567
16568 @item -mabsdata
16569 @opindex mabsdata
16570
16571 Assume that all data in static storage can be accessed by LDS / STS
16572 instructions. This option has only an effect on reduced Tiny devices like
16573 ATtiny40. See also the @code{absdata}
16574 @ref{AVR Variable Attributes,variable attribute}.
16575
16576 @item -maccumulate-args
16577 @opindex maccumulate-args
16578 Accumulate outgoing function arguments and acquire/release the needed
16579 stack space for outgoing function arguments once in function
16580 prologue/epilogue. Without this option, outgoing arguments are pushed
16581 before calling a function and popped afterwards.
16582
16583 Popping the arguments after the function call can be expensive on
16584 AVR so that accumulating the stack space might lead to smaller
16585 executables because arguments need not be removed from the
16586 stack after such a function call.
16587
16588 This option can lead to reduced code size for functions that perform
16589 several calls to functions that get their arguments on the stack like
16590 calls to printf-like functions.
16591
16592 @item -mbranch-cost=@var{cost}
16593 @opindex mbranch-cost
16594 Set the branch costs for conditional branch instructions to
16595 @var{cost}. Reasonable values for @var{cost} are small, non-negative
16596 integers. The default branch cost is 0.
16597
16598 @item -mcall-prologues
16599 @opindex mcall-prologues
16600 Functions prologues/epilogues are expanded as calls to appropriate
16601 subroutines. Code size is smaller.
16602
16603 @item -mgas-isr-prologues
16604 @opindex mgas-isr-prologues
16605 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
16606 instruction supported by GNU Binutils.
16607 If this option is on, the feature can still be disabled for individual
16608 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
16609 function attribute. This feature is activated per default
16610 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
16611 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
16612
16613 @item -mint8
16614 @opindex mint8
16615 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
16616 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
16617 and @code{long long} is 4 bytes. Please note that this option does not
16618 conform to the C standards, but it results in smaller code
16619 size.
16620
16621 @item -mmain-is-OS_task
16622 @opindex mmain-is-OS_task
16623 Do not save registers in @code{main}. The effect is the same like
16624 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
16625 to @code{main}. It is activated per default if optimization is on.
16626
16627 @item -mn-flash=@var{num}
16628 @opindex mn-flash
16629 Assume that the flash memory has a size of
16630 @var{num} times 64@tie{}KiB.
16631
16632 @item -mno-interrupts
16633 @opindex mno-interrupts
16634 Generated code is not compatible with hardware interrupts.
16635 Code size is smaller.
16636
16637 @item -mrelax
16638 @opindex mrelax
16639 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
16640 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
16641 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
16642 the assembler's command line and the @option{--relax} option to the
16643 linker's command line.
16644
16645 Jump relaxing is performed by the linker because jump offsets are not
16646 known before code is located. Therefore, the assembler code generated by the
16647 compiler is the same, but the instructions in the executable may
16648 differ from instructions in the assembler code.
16649
16650 Relaxing must be turned on if linker stubs are needed, see the
16651 section on @code{EIND} and linker stubs below.
16652
16653 @item -mrmw
16654 @opindex mrmw
16655 Assume that the device supports the Read-Modify-Write
16656 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
16657
16658 @item -mshort-calls
16659 @opindex mshort-calls
16660
16661 Assume that @code{RJMP} and @code{RCALL} can target the whole
16662 program memory.
16663
16664 This option is used internally for multilib selection. It is
16665 not an optimization option, and you don't need to set it by hand.
16666
16667 @item -msp8
16668 @opindex msp8
16669 Treat the stack pointer register as an 8-bit register,
16670 i.e.@: assume the high byte of the stack pointer is zero.
16671 In general, you don't need to set this option by hand.
16672
16673 This option is used internally by the compiler to select and
16674 build multilibs for architectures @code{avr2} and @code{avr25}.
16675 These architectures mix devices with and without @code{SPH}.
16676 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
16677 the compiler driver adds or removes this option from the compiler
16678 proper's command line, because the compiler then knows if the device
16679 or architecture has an 8-bit stack pointer and thus no @code{SPH}
16680 register or not.
16681
16682 @item -mstrict-X
16683 @opindex mstrict-X
16684 Use address register @code{X} in a way proposed by the hardware. This means
16685 that @code{X} is only used in indirect, post-increment or
16686 pre-decrement addressing.
16687
16688 Without this option, the @code{X} register may be used in the same way
16689 as @code{Y} or @code{Z} which then is emulated by additional
16690 instructions.
16691 For example, loading a value with @code{X+const} addressing with a
16692 small non-negative @code{const < 64} to a register @var{Rn} is
16693 performed as
16694
16695 @example
16696 adiw r26, const ; X += const
16697 ld @var{Rn}, X ; @var{Rn} = *X
16698 sbiw r26, const ; X -= const
16699 @end example
16700
16701 @item -mtiny-stack
16702 @opindex mtiny-stack
16703 Only change the lower 8@tie{}bits of the stack pointer.
16704
16705 @item -mfract-convert-truncate
16706 @opindex mfract-convert-truncate
16707 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
16708
16709 @item -nodevicelib
16710 @opindex nodevicelib
16711 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
16712
16713 @item -Waddr-space-convert
16714 @opindex Waddr-space-convert
16715 Warn about conversions between address spaces in the case where the
16716 resulting address space is not contained in the incoming address space.
16717
16718 @item -Wmisspelled-isr
16719 @opindex Wmisspelled-isr
16720 Warn if the ISR is misspelled, i.e. without __vector prefix.
16721 Enabled by default.
16722 @end table
16723
16724 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
16725 @cindex @code{EIND}
16726 Pointers in the implementation are 16@tie{}bits wide.
16727 The address of a function or label is represented as word address so
16728 that indirect jumps and calls can target any code address in the
16729 range of 64@tie{}Ki words.
16730
16731 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
16732 bytes of program memory space, there is a special function register called
16733 @code{EIND} that serves as most significant part of the target address
16734 when @code{EICALL} or @code{EIJMP} instructions are used.
16735
16736 Indirect jumps and calls on these devices are handled as follows by
16737 the compiler and are subject to some limitations:
16738
16739 @itemize @bullet
16740
16741 @item
16742 The compiler never sets @code{EIND}.
16743
16744 @item
16745 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
16746 instructions or might read @code{EIND} directly in order to emulate an
16747 indirect call/jump by means of a @code{RET} instruction.
16748
16749 @item
16750 The compiler assumes that @code{EIND} never changes during the startup
16751 code or during the application. In particular, @code{EIND} is not
16752 saved/restored in function or interrupt service routine
16753 prologue/epilogue.
16754
16755 @item
16756 For indirect calls to functions and computed goto, the linker
16757 generates @emph{stubs}. Stubs are jump pads sometimes also called
16758 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
16759 The stub contains a direct jump to the desired address.
16760
16761 @item
16762 Linker relaxation must be turned on so that the linker generates
16763 the stubs correctly in all situations. See the compiler option
16764 @option{-mrelax} and the linker option @option{--relax}.
16765 There are corner cases where the linker is supposed to generate stubs
16766 but aborts without relaxation and without a helpful error message.
16767
16768 @item
16769 The default linker script is arranged for code with @code{EIND = 0}.
16770 If code is supposed to work for a setup with @code{EIND != 0}, a custom
16771 linker script has to be used in order to place the sections whose
16772 name start with @code{.trampolines} into the segment where @code{EIND}
16773 points to.
16774
16775 @item
16776 The startup code from libgcc never sets @code{EIND}.
16777 Notice that startup code is a blend of code from libgcc and AVR-LibC.
16778 For the impact of AVR-LibC on @code{EIND}, see the
16779 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
16780
16781 @item
16782 It is legitimate for user-specific startup code to set up @code{EIND}
16783 early, for example by means of initialization code located in
16784 section @code{.init3}. Such code runs prior to general startup code
16785 that initializes RAM and calls constructors, but after the bit
16786 of startup code from AVR-LibC that sets @code{EIND} to the segment
16787 where the vector table is located.
16788 @example
16789 #include <avr/io.h>
16790
16791 static void
16792 __attribute__((section(".init3"),naked,used,no_instrument_function))
16793 init3_set_eind (void)
16794 @{
16795 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
16796 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
16797 @}
16798 @end example
16799
16800 @noindent
16801 The @code{__trampolines_start} symbol is defined in the linker script.
16802
16803 @item
16804 Stubs are generated automatically by the linker if
16805 the following two conditions are met:
16806 @itemize @minus
16807
16808 @item The address of a label is taken by means of the @code{gs} modifier
16809 (short for @emph{generate stubs}) like so:
16810 @example
16811 LDI r24, lo8(gs(@var{func}))
16812 LDI r25, hi8(gs(@var{func}))
16813 @end example
16814 @item The final location of that label is in a code segment
16815 @emph{outside} the segment where the stubs are located.
16816 @end itemize
16817
16818 @item
16819 The compiler emits such @code{gs} modifiers for code labels in the
16820 following situations:
16821 @itemize @minus
16822 @item Taking address of a function or code label.
16823 @item Computed goto.
16824 @item If prologue-save function is used, see @option{-mcall-prologues}
16825 command-line option.
16826 @item Switch/case dispatch tables. If you do not want such dispatch
16827 tables you can specify the @option{-fno-jump-tables} command-line option.
16828 @item C and C++ constructors/destructors called during startup/shutdown.
16829 @item If the tools hit a @code{gs()} modifier explained above.
16830 @end itemize
16831
16832 @item
16833 Jumping to non-symbolic addresses like so is @emph{not} supported:
16834
16835 @example
16836 int main (void)
16837 @{
16838 /* Call function at word address 0x2 */
16839 return ((int(*)(void)) 0x2)();
16840 @}
16841 @end example
16842
16843 Instead, a stub has to be set up, i.e.@: the function has to be called
16844 through a symbol (@code{func_4} in the example):
16845
16846 @example
16847 int main (void)
16848 @{
16849 extern int func_4 (void);
16850
16851 /* Call function at byte address 0x4 */
16852 return func_4();
16853 @}
16854 @end example
16855
16856 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
16857 Alternatively, @code{func_4} can be defined in the linker script.
16858 @end itemize
16859
16860 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
16861 @cindex @code{RAMPD}
16862 @cindex @code{RAMPX}
16863 @cindex @code{RAMPY}
16864 @cindex @code{RAMPZ}
16865 Some AVR devices support memories larger than the 64@tie{}KiB range
16866 that can be accessed with 16-bit pointers. To access memory locations
16867 outside this 64@tie{}KiB range, the content of a @code{RAMP}
16868 register is used as high part of the address:
16869 The @code{X}, @code{Y}, @code{Z} address register is concatenated
16870 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
16871 register, respectively, to get a wide address. Similarly,
16872 @code{RAMPD} is used together with direct addressing.
16873
16874 @itemize
16875 @item
16876 The startup code initializes the @code{RAMP} special function
16877 registers with zero.
16878
16879 @item
16880 If a @ref{AVR Named Address Spaces,named address space} other than
16881 generic or @code{__flash} is used, then @code{RAMPZ} is set
16882 as needed before the operation.
16883
16884 @item
16885 If the device supports RAM larger than 64@tie{}KiB and the compiler
16886 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
16887 is reset to zero after the operation.
16888
16889 @item
16890 If the device comes with a specific @code{RAMP} register, the ISR
16891 prologue/epilogue saves/restores that SFR and initializes it with
16892 zero in case the ISR code might (implicitly) use it.
16893
16894 @item
16895 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
16896 If you use inline assembler to read from locations outside the
16897 16-bit address range and change one of the @code{RAMP} registers,
16898 you must reset it to zero after the access.
16899
16900 @end itemize
16901
16902 @subsubsection AVR Built-in Macros
16903
16904 GCC defines several built-in macros so that the user code can test
16905 for the presence or absence of features. Almost any of the following
16906 built-in macros are deduced from device capabilities and thus
16907 triggered by the @option{-mmcu=} command-line option.
16908
16909 For even more AVR-specific built-in macros see
16910 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
16911
16912 @table @code
16913
16914 @item __AVR_ARCH__
16915 Build-in macro that resolves to a decimal number that identifies the
16916 architecture and depends on the @option{-mmcu=@var{mcu}} option.
16917 Possible values are:
16918
16919 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
16920 @code{4}, @code{5}, @code{51}, @code{6}
16921
16922 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
16923 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
16924
16925 respectively and
16926
16927 @code{100},
16928 @code{102}, @code{103}, @code{104},
16929 @code{105}, @code{106}, @code{107}
16930
16931 for @var{mcu}=@code{avrtiny},
16932 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
16933 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
16934 If @var{mcu} specifies a device, this built-in macro is set
16935 accordingly. For example, with @option{-mmcu=atmega8} the macro is
16936 defined to @code{4}.
16937
16938 @item __AVR_@var{Device}__
16939 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
16940 the device's name. For example, @option{-mmcu=atmega8} defines the
16941 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
16942 @code{__AVR_ATtiny261A__}, etc.
16943
16944 The built-in macros' names follow
16945 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
16946 the device name as from the AVR user manual. The difference between
16947 @var{Device} in the built-in macro and @var{device} in
16948 @option{-mmcu=@var{device}} is that the latter is always lowercase.
16949
16950 If @var{device} is not a device but only a core architecture like
16951 @samp{avr51}, this macro is not defined.
16952
16953 @item __AVR_DEVICE_NAME__
16954 Setting @option{-mmcu=@var{device}} defines this built-in macro to
16955 the device's name. For example, with @option{-mmcu=atmega8} the macro
16956 is defined to @code{atmega8}.
16957
16958 If @var{device} is not a device but only a core architecture like
16959 @samp{avr51}, this macro is not defined.
16960
16961 @item __AVR_XMEGA__
16962 The device / architecture belongs to the XMEGA family of devices.
16963
16964 @item __AVR_HAVE_ELPM__
16965 The device has the @code{ELPM} instruction.
16966
16967 @item __AVR_HAVE_ELPMX__
16968 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
16969 R@var{n},Z+} instructions.
16970
16971 @item __AVR_HAVE_MOVW__
16972 The device has the @code{MOVW} instruction to perform 16-bit
16973 register-register moves.
16974
16975 @item __AVR_HAVE_LPMX__
16976 The device has the @code{LPM R@var{n},Z} and
16977 @code{LPM R@var{n},Z+} instructions.
16978
16979 @item __AVR_HAVE_MUL__
16980 The device has a hardware multiplier.
16981
16982 @item __AVR_HAVE_JMP_CALL__
16983 The device has the @code{JMP} and @code{CALL} instructions.
16984 This is the case for devices with more than 8@tie{}KiB of program
16985 memory.
16986
16987 @item __AVR_HAVE_EIJMP_EICALL__
16988 @itemx __AVR_3_BYTE_PC__
16989 The device has the @code{EIJMP} and @code{EICALL} instructions.
16990 This is the case for devices with more than 128@tie{}KiB of program memory.
16991 This also means that the program counter
16992 (PC) is 3@tie{}bytes wide.
16993
16994 @item __AVR_2_BYTE_PC__
16995 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
16996 with up to 128@tie{}KiB of program memory.
16997
16998 @item __AVR_HAVE_8BIT_SP__
16999 @itemx __AVR_HAVE_16BIT_SP__
17000 The stack pointer (SP) register is treated as 8-bit respectively
17001 16-bit register by the compiler.
17002 The definition of these macros is affected by @option{-mtiny-stack}.
17003
17004 @item __AVR_HAVE_SPH__
17005 @itemx __AVR_SP8__
17006 The device has the SPH (high part of stack pointer) special function
17007 register or has an 8-bit stack pointer, respectively.
17008 The definition of these macros is affected by @option{-mmcu=} and
17009 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
17010 by @option{-msp8}.
17011
17012 @item __AVR_HAVE_RAMPD__
17013 @itemx __AVR_HAVE_RAMPX__
17014 @itemx __AVR_HAVE_RAMPY__
17015 @itemx __AVR_HAVE_RAMPZ__
17016 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
17017 @code{RAMPZ} special function register, respectively.
17018
17019 @item __NO_INTERRUPTS__
17020 This macro reflects the @option{-mno-interrupts} command-line option.
17021
17022 @item __AVR_ERRATA_SKIP__
17023 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
17024 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17025 instructions because of a hardware erratum. Skip instructions are
17026 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
17027 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
17028 set.
17029
17030 @item __AVR_ISA_RMW__
17031 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
17032
17033 @item __AVR_SFR_OFFSET__=@var{offset}
17034 Instructions that can address I/O special function registers directly
17035 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
17036 address as if addressed by an instruction to access RAM like @code{LD}
17037 or @code{STS}. This offset depends on the device architecture and has
17038 to be subtracted from the RAM address in order to get the
17039 respective I/O@tie{}address.
17040
17041 @item __AVR_SHORT_CALLS__
17042 The @option{-mshort-calls} command line option is set.
17043
17044 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
17045 Some devices support reading from flash memory by means of @code{LD*}
17046 instructions. The flash memory is seen in the data address space
17047 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
17048 is not defined, this feature is not available. If defined,
17049 the address space is linear and there is no need to put
17050 @code{.rodata} into RAM. This is handled by the default linker
17051 description file, and is currently available for
17052 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
17053 there is no need to use address spaces like @code{__flash} or
17054 features like attribute @code{progmem} and @code{pgm_read_*}.
17055
17056 @item __WITH_AVRLIBC__
17057 The compiler is configured to be used together with AVR-Libc.
17058 See the @option{--with-avrlibc} configure option.
17059
17060 @end table
17061
17062 @node Blackfin Options
17063 @subsection Blackfin Options
17064 @cindex Blackfin Options
17065
17066 @table @gcctabopt
17067 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
17068 @opindex mcpu=
17069 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
17070 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
17071 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
17072 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
17073 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
17074 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
17075 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
17076 @samp{bf561}, @samp{bf592}.
17077
17078 The optional @var{sirevision} specifies the silicon revision of the target
17079 Blackfin processor. Any workarounds available for the targeted silicon revision
17080 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
17081 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
17082 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
17083 hexadecimal digits representing the major and minor numbers in the silicon
17084 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
17085 is not defined. If @var{sirevision} is @samp{any}, the
17086 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
17087 If this optional @var{sirevision} is not used, GCC assumes the latest known
17088 silicon revision of the targeted Blackfin processor.
17089
17090 GCC defines a preprocessor macro for the specified @var{cpu}.
17091 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
17092 provided by libgloss to be linked in if @option{-msim} is not given.
17093
17094 Without this option, @samp{bf532} is used as the processor by default.
17095
17096 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
17097 only the preprocessor macro is defined.
17098
17099 @item -msim
17100 @opindex msim
17101 Specifies that the program will be run on the simulator. This causes
17102 the simulator BSP provided by libgloss to be linked in. This option
17103 has effect only for @samp{bfin-elf} toolchain.
17104 Certain other options, such as @option{-mid-shared-library} and
17105 @option{-mfdpic}, imply @option{-msim}.
17106
17107 @item -momit-leaf-frame-pointer
17108 @opindex momit-leaf-frame-pointer
17109 Don't keep the frame pointer in a register for leaf functions. This
17110 avoids the instructions to save, set up and restore frame pointers and
17111 makes an extra register available in leaf functions.
17112
17113 @item -mspecld-anomaly
17114 @opindex mspecld-anomaly
17115 When enabled, the compiler ensures that the generated code does not
17116 contain speculative loads after jump instructions. If this option is used,
17117 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
17118
17119 @item -mno-specld-anomaly
17120 @opindex mno-specld-anomaly
17121 Don't generate extra code to prevent speculative loads from occurring.
17122
17123 @item -mcsync-anomaly
17124 @opindex mcsync-anomaly
17125 When enabled, the compiler ensures that the generated code does not
17126 contain CSYNC or SSYNC instructions too soon after conditional branches.
17127 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
17128
17129 @item -mno-csync-anomaly
17130 @opindex mno-csync-anomaly
17131 Don't generate extra code to prevent CSYNC or SSYNC instructions from
17132 occurring too soon after a conditional branch.
17133
17134 @item -mlow-64k
17135 @opindex mlow-64k
17136 When enabled, the compiler is free to take advantage of the knowledge that
17137 the entire program fits into the low 64k of memory.
17138
17139 @item -mno-low-64k
17140 @opindex mno-low-64k
17141 Assume that the program is arbitrarily large. This is the default.
17142
17143 @item -mstack-check-l1
17144 @opindex mstack-check-l1
17145 Do stack checking using information placed into L1 scratchpad memory by the
17146 uClinux kernel.
17147
17148 @item -mid-shared-library
17149 @opindex mid-shared-library
17150 Generate code that supports shared libraries via the library ID method.
17151 This allows for execute in place and shared libraries in an environment
17152 without virtual memory management. This option implies @option{-fPIC}.
17153 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17154
17155 @item -mno-id-shared-library
17156 @opindex mno-id-shared-library
17157 Generate code that doesn't assume ID-based shared libraries are being used.
17158 This is the default.
17159
17160 @item -mleaf-id-shared-library
17161 @opindex mleaf-id-shared-library
17162 Generate code that supports shared libraries via the library ID method,
17163 but assumes that this library or executable won't link against any other
17164 ID shared libraries. That allows the compiler to use faster code for jumps
17165 and calls.
17166
17167 @item -mno-leaf-id-shared-library
17168 @opindex mno-leaf-id-shared-library
17169 Do not assume that the code being compiled won't link against any ID shared
17170 libraries. Slower code is generated for jump and call insns.
17171
17172 @item -mshared-library-id=n
17173 @opindex mshared-library-id
17174 Specifies the identification number of the ID-based shared library being
17175 compiled. Specifying a value of 0 generates more compact code; specifying
17176 other values forces the allocation of that number to the current
17177 library but is no more space- or time-efficient than omitting this option.
17178
17179 @item -msep-data
17180 @opindex msep-data
17181 Generate code that allows the data segment to be located in a different
17182 area of memory from the text segment. This allows for execute in place in
17183 an environment without virtual memory management by eliminating relocations
17184 against the text section.
17185
17186 @item -mno-sep-data
17187 @opindex mno-sep-data
17188 Generate code that assumes that the data segment follows the text segment.
17189 This is the default.
17190
17191 @item -mlong-calls
17192 @itemx -mno-long-calls
17193 @opindex mlong-calls
17194 @opindex mno-long-calls
17195 Tells the compiler to perform function calls by first loading the
17196 address of the function into a register and then performing a subroutine
17197 call on this register. This switch is needed if the target function
17198 lies outside of the 24-bit addressing range of the offset-based
17199 version of subroutine call instruction.
17200
17201 This feature is not enabled by default. Specifying
17202 @option{-mno-long-calls} restores the default behavior. Note these
17203 switches have no effect on how the compiler generates code to handle
17204 function calls via function pointers.
17205
17206 @item -mfast-fp
17207 @opindex mfast-fp
17208 Link with the fast floating-point library. This library relaxes some of
17209 the IEEE floating-point standard's rules for checking inputs against
17210 Not-a-Number (NAN), in the interest of performance.
17211
17212 @item -minline-plt
17213 @opindex minline-plt
17214 Enable inlining of PLT entries in function calls to functions that are
17215 not known to bind locally. It has no effect without @option{-mfdpic}.
17216
17217 @item -mmulticore
17218 @opindex mmulticore
17219 Build a standalone application for multicore Blackfin processors.
17220 This option causes proper start files and link scripts supporting
17221 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
17222 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
17223
17224 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
17225 selects the one-application-per-core programming model. Without
17226 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
17227 programming model is used. In this model, the main function of Core B
17228 should be named as @code{coreb_main}.
17229
17230 If this option is not used, the single-core application programming
17231 model is used.
17232
17233 @item -mcorea
17234 @opindex mcorea
17235 Build a standalone application for Core A of BF561 when using
17236 the one-application-per-core programming model. Proper start files
17237 and link scripts are used to support Core A, and the macro
17238 @code{__BFIN_COREA} is defined.
17239 This option can only be used in conjunction with @option{-mmulticore}.
17240
17241 @item -mcoreb
17242 @opindex mcoreb
17243 Build a standalone application for Core B of BF561 when using
17244 the one-application-per-core programming model. Proper start files
17245 and link scripts are used to support Core B, and the macro
17246 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
17247 should be used instead of @code{main}.
17248 This option can only be used in conjunction with @option{-mmulticore}.
17249
17250 @item -msdram
17251 @opindex msdram
17252 Build a standalone application for SDRAM. Proper start files and
17253 link scripts are used to put the application into SDRAM, and the macro
17254 @code{__BFIN_SDRAM} is defined.
17255 The loader should initialize SDRAM before loading the application.
17256
17257 @item -micplb
17258 @opindex micplb
17259 Assume that ICPLBs are enabled at run time. This has an effect on certain
17260 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
17261 are enabled; for standalone applications the default is off.
17262 @end table
17263
17264 @node C6X Options
17265 @subsection C6X Options
17266 @cindex C6X Options
17267
17268 @table @gcctabopt
17269 @item -march=@var{name}
17270 @opindex march
17271 This specifies the name of the target architecture. GCC uses this
17272 name to determine what kind of instructions it can emit when generating
17273 assembly code. Permissible names are: @samp{c62x},
17274 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
17275
17276 @item -mbig-endian
17277 @opindex mbig-endian
17278 Generate code for a big-endian target.
17279
17280 @item -mlittle-endian
17281 @opindex mlittle-endian
17282 Generate code for a little-endian target. This is the default.
17283
17284 @item -msim
17285 @opindex msim
17286 Choose startup files and linker script suitable for the simulator.
17287
17288 @item -msdata=default
17289 @opindex msdata=default
17290 Put small global and static data in the @code{.neardata} section,
17291 which is pointed to by register @code{B14}. Put small uninitialized
17292 global and static data in the @code{.bss} section, which is adjacent
17293 to the @code{.neardata} section. Put small read-only data into the
17294 @code{.rodata} section. The corresponding sections used for large
17295 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
17296
17297 @item -msdata=all
17298 @opindex msdata=all
17299 Put all data, not just small objects, into the sections reserved for
17300 small data, and use addressing relative to the @code{B14} register to
17301 access them.
17302
17303 @item -msdata=none
17304 @opindex msdata=none
17305 Make no use of the sections reserved for small data, and use absolute
17306 addresses to access all data. Put all initialized global and static
17307 data in the @code{.fardata} section, and all uninitialized data in the
17308 @code{.far} section. Put all constant data into the @code{.const}
17309 section.
17310 @end table
17311
17312 @node CRIS Options
17313 @subsection CRIS Options
17314 @cindex CRIS Options
17315
17316 These options are defined specifically for the CRIS ports.
17317
17318 @table @gcctabopt
17319 @item -march=@var{architecture-type}
17320 @itemx -mcpu=@var{architecture-type}
17321 @opindex march
17322 @opindex mcpu
17323 Generate code for the specified architecture. The choices for
17324 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
17325 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
17326 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
17327 @samp{v10}.
17328
17329 @item -mtune=@var{architecture-type}
17330 @opindex mtune
17331 Tune to @var{architecture-type} everything applicable about the generated
17332 code, except for the ABI and the set of available instructions. The
17333 choices for @var{architecture-type} are the same as for
17334 @option{-march=@var{architecture-type}}.
17335
17336 @item -mmax-stack-frame=@var{n}
17337 @opindex mmax-stack-frame
17338 Warn when the stack frame of a function exceeds @var{n} bytes.
17339
17340 @item -metrax4
17341 @itemx -metrax100
17342 @opindex metrax4
17343 @opindex metrax100
17344 The options @option{-metrax4} and @option{-metrax100} are synonyms for
17345 @option{-march=v3} and @option{-march=v8} respectively.
17346
17347 @item -mmul-bug-workaround
17348 @itemx -mno-mul-bug-workaround
17349 @opindex mmul-bug-workaround
17350 @opindex mno-mul-bug-workaround
17351 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
17352 models where it applies. This option is active by default.
17353
17354 @item -mpdebug
17355 @opindex mpdebug
17356 Enable CRIS-specific verbose debug-related information in the assembly
17357 code. This option also has the effect of turning off the @samp{#NO_APP}
17358 formatted-code indicator to the assembler at the beginning of the
17359 assembly file.
17360
17361 @item -mcc-init
17362 @opindex mcc-init
17363 Do not use condition-code results from previous instruction; always emit
17364 compare and test instructions before use of condition codes.
17365
17366 @item -mno-side-effects
17367 @opindex mno-side-effects
17368 Do not emit instructions with side effects in addressing modes other than
17369 post-increment.
17370
17371 @item -mstack-align
17372 @itemx -mno-stack-align
17373 @itemx -mdata-align
17374 @itemx -mno-data-align
17375 @itemx -mconst-align
17376 @itemx -mno-const-align
17377 @opindex mstack-align
17378 @opindex mno-stack-align
17379 @opindex mdata-align
17380 @opindex mno-data-align
17381 @opindex mconst-align
17382 @opindex mno-const-align
17383 These options (@samp{no-} options) arrange (eliminate arrangements) for the
17384 stack frame, individual data and constants to be aligned for the maximum
17385 single data access size for the chosen CPU model. The default is to
17386 arrange for 32-bit alignment. ABI details such as structure layout are
17387 not affected by these options.
17388
17389 @item -m32-bit
17390 @itemx -m16-bit
17391 @itemx -m8-bit
17392 @opindex m32-bit
17393 @opindex m16-bit
17394 @opindex m8-bit
17395 Similar to the stack- data- and const-align options above, these options
17396 arrange for stack frame, writable data and constants to all be 32-bit,
17397 16-bit or 8-bit aligned. The default is 32-bit alignment.
17398
17399 @item -mno-prologue-epilogue
17400 @itemx -mprologue-epilogue
17401 @opindex mno-prologue-epilogue
17402 @opindex mprologue-epilogue
17403 With @option{-mno-prologue-epilogue}, the normal function prologue and
17404 epilogue which set up the stack frame are omitted and no return
17405 instructions or return sequences are generated in the code. Use this
17406 option only together with visual inspection of the compiled code: no
17407 warnings or errors are generated when call-saved registers must be saved,
17408 or storage for local variables needs to be allocated.
17409
17410 @item -mno-gotplt
17411 @itemx -mgotplt
17412 @opindex mno-gotplt
17413 @opindex mgotplt
17414 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
17415 instruction sequences that load addresses for functions from the PLT part
17416 of the GOT rather than (traditional on other architectures) calls to the
17417 PLT@. The default is @option{-mgotplt}.
17418
17419 @item -melf
17420 @opindex melf
17421 Legacy no-op option only recognized with the cris-axis-elf and
17422 cris-axis-linux-gnu targets.
17423
17424 @item -mlinux
17425 @opindex mlinux
17426 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
17427
17428 @item -sim
17429 @opindex sim
17430 This option, recognized for the cris-axis-elf, arranges
17431 to link with input-output functions from a simulator library. Code,
17432 initialized data and zero-initialized data are allocated consecutively.
17433
17434 @item -sim2
17435 @opindex sim2
17436 Like @option{-sim}, but pass linker options to locate initialized data at
17437 0x40000000 and zero-initialized data at 0x80000000.
17438 @end table
17439
17440 @node CR16 Options
17441 @subsection CR16 Options
17442 @cindex CR16 Options
17443
17444 These options are defined specifically for the CR16 ports.
17445
17446 @table @gcctabopt
17447
17448 @item -mmac
17449 @opindex mmac
17450 Enable the use of multiply-accumulate instructions. Disabled by default.
17451
17452 @item -mcr16cplus
17453 @itemx -mcr16c
17454 @opindex mcr16cplus
17455 @opindex mcr16c
17456 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
17457 is default.
17458
17459 @item -msim
17460 @opindex msim
17461 Links the library libsim.a which is in compatible with simulator. Applicable
17462 to ELF compiler only.
17463
17464 @item -mint32
17465 @opindex mint32
17466 Choose integer type as 32-bit wide.
17467
17468 @item -mbit-ops
17469 @opindex mbit-ops
17470 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
17471
17472 @item -mdata-model=@var{model}
17473 @opindex mdata-model
17474 Choose a data model. The choices for @var{model} are @samp{near},
17475 @samp{far} or @samp{medium}. @samp{medium} is default.
17476 However, @samp{far} is not valid with @option{-mcr16c}, as the
17477 CR16C architecture does not support the far data model.
17478 @end table
17479
17480 @node Darwin Options
17481 @subsection Darwin Options
17482 @cindex Darwin options
17483
17484 These options are defined for all architectures running the Darwin operating
17485 system.
17486
17487 FSF GCC on Darwin does not create ``fat'' object files; it creates
17488 an object file for the single architecture that GCC was built to
17489 target. Apple's GCC on Darwin does create ``fat'' files if multiple
17490 @option{-arch} options are used; it does so by running the compiler or
17491 linker multiple times and joining the results together with
17492 @file{lipo}.
17493
17494 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
17495 @samp{i686}) is determined by the flags that specify the ISA
17496 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
17497 @option{-force_cpusubtype_ALL} option can be used to override this.
17498
17499 The Darwin tools vary in their behavior when presented with an ISA
17500 mismatch. The assembler, @file{as}, only permits instructions to
17501 be used that are valid for the subtype of the file it is generating,
17502 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
17503 The linker for shared libraries, @file{/usr/bin/libtool}, fails
17504 and prints an error if asked to create a shared library with a less
17505 restrictive subtype than its input files (for instance, trying to put
17506 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
17507 for executables, @command{ld}, quietly gives the executable the most
17508 restrictive subtype of any of its input files.
17509
17510 @table @gcctabopt
17511 @item -F@var{dir}
17512 @opindex F
17513 Add the framework directory @var{dir} to the head of the list of
17514 directories to be searched for header files. These directories are
17515 interleaved with those specified by @option{-I} options and are
17516 scanned in a left-to-right order.
17517
17518 A framework directory is a directory with frameworks in it. A
17519 framework is a directory with a @file{Headers} and/or
17520 @file{PrivateHeaders} directory contained directly in it that ends
17521 in @file{.framework}. The name of a framework is the name of this
17522 directory excluding the @file{.framework}. Headers associated with
17523 the framework are found in one of those two directories, with
17524 @file{Headers} being searched first. A subframework is a framework
17525 directory that is in a framework's @file{Frameworks} directory.
17526 Includes of subframework headers can only appear in a header of a
17527 framework that contains the subframework, or in a sibling subframework
17528 header. Two subframeworks are siblings if they occur in the same
17529 framework. A subframework should not have the same name as a
17530 framework; a warning is issued if this is violated. Currently a
17531 subframework cannot have subframeworks; in the future, the mechanism
17532 may be extended to support this. The standard frameworks can be found
17533 in @file{/System/Library/Frameworks} and
17534 @file{/Library/Frameworks}. An example include looks like
17535 @code{#include <Framework/header.h>}, where @file{Framework} denotes
17536 the name of the framework and @file{header.h} is found in the
17537 @file{PrivateHeaders} or @file{Headers} directory.
17538
17539 @item -iframework@var{dir}
17540 @opindex iframework
17541 Like @option{-F} except the directory is a treated as a system
17542 directory. The main difference between this @option{-iframework} and
17543 @option{-F} is that with @option{-iframework} the compiler does not
17544 warn about constructs contained within header files found via
17545 @var{dir}. This option is valid only for the C family of languages.
17546
17547 @item -gused
17548 @opindex gused
17549 Emit debugging information for symbols that are used. For stabs
17550 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
17551 This is by default ON@.
17552
17553 @item -gfull
17554 @opindex gfull
17555 Emit debugging information for all symbols and types.
17556
17557 @item -mmacosx-version-min=@var{version}
17558 The earliest version of MacOS X that this executable will run on
17559 is @var{version}. Typical values of @var{version} include @code{10.1},
17560 @code{10.2}, and @code{10.3.9}.
17561
17562 If the compiler was built to use the system's headers by default,
17563 then the default for this option is the system version on which the
17564 compiler is running, otherwise the default is to make choices that
17565 are compatible with as many systems and code bases as possible.
17566
17567 @item -mkernel
17568 @opindex mkernel
17569 Enable kernel development mode. The @option{-mkernel} option sets
17570 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
17571 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
17572 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
17573 applicable. This mode also sets @option{-mno-altivec},
17574 @option{-msoft-float}, @option{-fno-builtin} and
17575 @option{-mlong-branch} for PowerPC targets.
17576
17577 @item -mone-byte-bool
17578 @opindex mone-byte-bool
17579 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
17580 By default @code{sizeof(bool)} is @code{4} when compiling for
17581 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
17582 option has no effect on x86.
17583
17584 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
17585 to generate code that is not binary compatible with code generated
17586 without that switch. Using this switch may require recompiling all
17587 other modules in a program, including system libraries. Use this
17588 switch to conform to a non-default data model.
17589
17590 @item -mfix-and-continue
17591 @itemx -ffix-and-continue
17592 @itemx -findirect-data
17593 @opindex mfix-and-continue
17594 @opindex ffix-and-continue
17595 @opindex findirect-data
17596 Generate code suitable for fast turnaround development, such as to
17597 allow GDB to dynamically load @file{.o} files into already-running
17598 programs. @option{-findirect-data} and @option{-ffix-and-continue}
17599 are provided for backwards compatibility.
17600
17601 @item -all_load
17602 @opindex all_load
17603 Loads all members of static archive libraries.
17604 See man ld(1) for more information.
17605
17606 @item -arch_errors_fatal
17607 @opindex arch_errors_fatal
17608 Cause the errors having to do with files that have the wrong architecture
17609 to be fatal.
17610
17611 @item -bind_at_load
17612 @opindex bind_at_load
17613 Causes the output file to be marked such that the dynamic linker will
17614 bind all undefined references when the file is loaded or launched.
17615
17616 @item -bundle
17617 @opindex bundle
17618 Produce a Mach-o bundle format file.
17619 See man ld(1) for more information.
17620
17621 @item -bundle_loader @var{executable}
17622 @opindex bundle_loader
17623 This option specifies the @var{executable} that will load the build
17624 output file being linked. See man ld(1) for more information.
17625
17626 @item -dynamiclib
17627 @opindex dynamiclib
17628 When passed this option, GCC produces a dynamic library instead of
17629 an executable when linking, using the Darwin @file{libtool} command.
17630
17631 @item -force_cpusubtype_ALL
17632 @opindex force_cpusubtype_ALL
17633 This causes GCC's output file to have the @samp{ALL} subtype, instead of
17634 one controlled by the @option{-mcpu} or @option{-march} option.
17635
17636 @item -allowable_client @var{client_name}
17637 @itemx -client_name
17638 @itemx -compatibility_version
17639 @itemx -current_version
17640 @itemx -dead_strip
17641 @itemx -dependency-file
17642 @itemx -dylib_file
17643 @itemx -dylinker_install_name
17644 @itemx -dynamic
17645 @itemx -exported_symbols_list
17646 @itemx -filelist
17647 @need 800
17648 @itemx -flat_namespace
17649 @itemx -force_flat_namespace
17650 @itemx -headerpad_max_install_names
17651 @itemx -image_base
17652 @itemx -init
17653 @itemx -install_name
17654 @itemx -keep_private_externs
17655 @itemx -multi_module
17656 @itemx -multiply_defined
17657 @itemx -multiply_defined_unused
17658 @need 800
17659 @itemx -noall_load
17660 @itemx -no_dead_strip_inits_and_terms
17661 @itemx -nofixprebinding
17662 @itemx -nomultidefs
17663 @itemx -noprebind
17664 @itemx -noseglinkedit
17665 @itemx -pagezero_size
17666 @itemx -prebind
17667 @itemx -prebind_all_twolevel_modules
17668 @itemx -private_bundle
17669 @need 800
17670 @itemx -read_only_relocs
17671 @itemx -sectalign
17672 @itemx -sectobjectsymbols
17673 @itemx -whyload
17674 @itemx -seg1addr
17675 @itemx -sectcreate
17676 @itemx -sectobjectsymbols
17677 @itemx -sectorder
17678 @itemx -segaddr
17679 @itemx -segs_read_only_addr
17680 @need 800
17681 @itemx -segs_read_write_addr
17682 @itemx -seg_addr_table
17683 @itemx -seg_addr_table_filename
17684 @itemx -seglinkedit
17685 @itemx -segprot
17686 @itemx -segs_read_only_addr
17687 @itemx -segs_read_write_addr
17688 @itemx -single_module
17689 @itemx -static
17690 @itemx -sub_library
17691 @need 800
17692 @itemx -sub_umbrella
17693 @itemx -twolevel_namespace
17694 @itemx -umbrella
17695 @itemx -undefined
17696 @itemx -unexported_symbols_list
17697 @itemx -weak_reference_mismatches
17698 @itemx -whatsloaded
17699 @opindex allowable_client
17700 @opindex client_name
17701 @opindex compatibility_version
17702 @opindex current_version
17703 @opindex dead_strip
17704 @opindex dependency-file
17705 @opindex dylib_file
17706 @opindex dylinker_install_name
17707 @opindex dynamic
17708 @opindex exported_symbols_list
17709 @opindex filelist
17710 @opindex flat_namespace
17711 @opindex force_flat_namespace
17712 @opindex headerpad_max_install_names
17713 @opindex image_base
17714 @opindex init
17715 @opindex install_name
17716 @opindex keep_private_externs
17717 @opindex multi_module
17718 @opindex multiply_defined
17719 @opindex multiply_defined_unused
17720 @opindex noall_load
17721 @opindex no_dead_strip_inits_and_terms
17722 @opindex nofixprebinding
17723 @opindex nomultidefs
17724 @opindex noprebind
17725 @opindex noseglinkedit
17726 @opindex pagezero_size
17727 @opindex prebind
17728 @opindex prebind_all_twolevel_modules
17729 @opindex private_bundle
17730 @opindex read_only_relocs
17731 @opindex sectalign
17732 @opindex sectobjectsymbols
17733 @opindex whyload
17734 @opindex seg1addr
17735 @opindex sectcreate
17736 @opindex sectobjectsymbols
17737 @opindex sectorder
17738 @opindex segaddr
17739 @opindex segs_read_only_addr
17740 @opindex segs_read_write_addr
17741 @opindex seg_addr_table
17742 @opindex seg_addr_table_filename
17743 @opindex seglinkedit
17744 @opindex segprot
17745 @opindex segs_read_only_addr
17746 @opindex segs_read_write_addr
17747 @opindex single_module
17748 @opindex static
17749 @opindex sub_library
17750 @opindex sub_umbrella
17751 @opindex twolevel_namespace
17752 @opindex umbrella
17753 @opindex undefined
17754 @opindex unexported_symbols_list
17755 @opindex weak_reference_mismatches
17756 @opindex whatsloaded
17757 These options are passed to the Darwin linker. The Darwin linker man page
17758 describes them in detail.
17759 @end table
17760
17761 @node DEC Alpha Options
17762 @subsection DEC Alpha Options
17763
17764 These @samp{-m} options are defined for the DEC Alpha implementations:
17765
17766 @table @gcctabopt
17767 @item -mno-soft-float
17768 @itemx -msoft-float
17769 @opindex mno-soft-float
17770 @opindex msoft-float
17771 Use (do not use) the hardware floating-point instructions for
17772 floating-point operations. When @option{-msoft-float} is specified,
17773 functions in @file{libgcc.a} are used to perform floating-point
17774 operations. Unless they are replaced by routines that emulate the
17775 floating-point operations, or compiled in such a way as to call such
17776 emulations routines, these routines issue floating-point
17777 operations. If you are compiling for an Alpha without floating-point
17778 operations, you must ensure that the library is built so as not to call
17779 them.
17780
17781 Note that Alpha implementations without floating-point operations are
17782 required to have floating-point registers.
17783
17784 @item -mfp-reg
17785 @itemx -mno-fp-regs
17786 @opindex mfp-reg
17787 @opindex mno-fp-regs
17788 Generate code that uses (does not use) the floating-point register set.
17789 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
17790 register set is not used, floating-point operands are passed in integer
17791 registers as if they were integers and floating-point results are passed
17792 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
17793 so any function with a floating-point argument or return value called by code
17794 compiled with @option{-mno-fp-regs} must also be compiled with that
17795 option.
17796
17797 A typical use of this option is building a kernel that does not use,
17798 and hence need not save and restore, any floating-point registers.
17799
17800 @item -mieee
17801 @opindex mieee
17802 The Alpha architecture implements floating-point hardware optimized for
17803 maximum performance. It is mostly compliant with the IEEE floating-point
17804 standard. However, for full compliance, software assistance is
17805 required. This option generates code fully IEEE-compliant code
17806 @emph{except} that the @var{inexact-flag} is not maintained (see below).
17807 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
17808 defined during compilation. The resulting code is less efficient but is
17809 able to correctly support denormalized numbers and exceptional IEEE
17810 values such as not-a-number and plus/minus infinity. Other Alpha
17811 compilers call this option @option{-ieee_with_no_inexact}.
17812
17813 @item -mieee-with-inexact
17814 @opindex mieee-with-inexact
17815 This is like @option{-mieee} except the generated code also maintains
17816 the IEEE @var{inexact-flag}. Turning on this option causes the
17817 generated code to implement fully-compliant IEEE math. In addition to
17818 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
17819 macro. On some Alpha implementations the resulting code may execute
17820 significantly slower than the code generated by default. Since there is
17821 very little code that depends on the @var{inexact-flag}, you should
17822 normally not specify this option. Other Alpha compilers call this
17823 option @option{-ieee_with_inexact}.
17824
17825 @item -mfp-trap-mode=@var{trap-mode}
17826 @opindex mfp-trap-mode
17827 This option controls what floating-point related traps are enabled.
17828 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
17829 The trap mode can be set to one of four values:
17830
17831 @table @samp
17832 @item n
17833 This is the default (normal) setting. The only traps that are enabled
17834 are the ones that cannot be disabled in software (e.g., division by zero
17835 trap).
17836
17837 @item u
17838 In addition to the traps enabled by @samp{n}, underflow traps are enabled
17839 as well.
17840
17841 @item su
17842 Like @samp{u}, but the instructions are marked to be safe for software
17843 completion (see Alpha architecture manual for details).
17844
17845 @item sui
17846 Like @samp{su}, but inexact traps are enabled as well.
17847 @end table
17848
17849 @item -mfp-rounding-mode=@var{rounding-mode}
17850 @opindex mfp-rounding-mode
17851 Selects the IEEE rounding mode. Other Alpha compilers call this option
17852 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
17853 of:
17854
17855 @table @samp
17856 @item n
17857 Normal IEEE rounding mode. Floating-point numbers are rounded towards
17858 the nearest machine number or towards the even machine number in case
17859 of a tie.
17860
17861 @item m
17862 Round towards minus infinity.
17863
17864 @item c
17865 Chopped rounding mode. Floating-point numbers are rounded towards zero.
17866
17867 @item d
17868 Dynamic rounding mode. A field in the floating-point control register
17869 (@var{fpcr}, see Alpha architecture reference manual) controls the
17870 rounding mode in effect. The C library initializes this register for
17871 rounding towards plus infinity. Thus, unless your program modifies the
17872 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
17873 @end table
17874
17875 @item -mtrap-precision=@var{trap-precision}
17876 @opindex mtrap-precision
17877 In the Alpha architecture, floating-point traps are imprecise. This
17878 means without software assistance it is impossible to recover from a
17879 floating trap and program execution normally needs to be terminated.
17880 GCC can generate code that can assist operating system trap handlers
17881 in determining the exact location that caused a floating-point trap.
17882 Depending on the requirements of an application, different levels of
17883 precisions can be selected:
17884
17885 @table @samp
17886 @item p
17887 Program precision. This option is the default and means a trap handler
17888 can only identify which program caused a floating-point exception.
17889
17890 @item f
17891 Function precision. The trap handler can determine the function that
17892 caused a floating-point exception.
17893
17894 @item i
17895 Instruction precision. The trap handler can determine the exact
17896 instruction that caused a floating-point exception.
17897 @end table
17898
17899 Other Alpha compilers provide the equivalent options called
17900 @option{-scope_safe} and @option{-resumption_safe}.
17901
17902 @item -mieee-conformant
17903 @opindex mieee-conformant
17904 This option marks the generated code as IEEE conformant. You must not
17905 use this option unless you also specify @option{-mtrap-precision=i} and either
17906 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
17907 is to emit the line @samp{.eflag 48} in the function prologue of the
17908 generated assembly file.
17909
17910 @item -mbuild-constants
17911 @opindex mbuild-constants
17912 Normally GCC examines a 32- or 64-bit integer constant to
17913 see if it can construct it from smaller constants in two or three
17914 instructions. If it cannot, it outputs the constant as a literal and
17915 generates code to load it from the data segment at run time.
17916
17917 Use this option to require GCC to construct @emph{all} integer constants
17918 using code, even if it takes more instructions (the maximum is six).
17919
17920 You typically use this option to build a shared library dynamic
17921 loader. Itself a shared library, it must relocate itself in memory
17922 before it can find the variables and constants in its own data segment.
17923
17924 @item -mbwx
17925 @itemx -mno-bwx
17926 @itemx -mcix
17927 @itemx -mno-cix
17928 @itemx -mfix
17929 @itemx -mno-fix
17930 @itemx -mmax
17931 @itemx -mno-max
17932 @opindex mbwx
17933 @opindex mno-bwx
17934 @opindex mcix
17935 @opindex mno-cix
17936 @opindex mfix
17937 @opindex mno-fix
17938 @opindex mmax
17939 @opindex mno-max
17940 Indicate whether GCC should generate code to use the optional BWX,
17941 CIX, FIX and MAX instruction sets. The default is to use the instruction
17942 sets supported by the CPU type specified via @option{-mcpu=} option or that
17943 of the CPU on which GCC was built if none is specified.
17944
17945 @item -mfloat-vax
17946 @itemx -mfloat-ieee
17947 @opindex mfloat-vax
17948 @opindex mfloat-ieee
17949 Generate code that uses (does not use) VAX F and G floating-point
17950 arithmetic instead of IEEE single and double precision.
17951
17952 @item -mexplicit-relocs
17953 @itemx -mno-explicit-relocs
17954 @opindex mexplicit-relocs
17955 @opindex mno-explicit-relocs
17956 Older Alpha assemblers provided no way to generate symbol relocations
17957 except via assembler macros. Use of these macros does not allow
17958 optimal instruction scheduling. GNU binutils as of version 2.12
17959 supports a new syntax that allows the compiler to explicitly mark
17960 which relocations should apply to which instructions. This option
17961 is mostly useful for debugging, as GCC detects the capabilities of
17962 the assembler when it is built and sets the default accordingly.
17963
17964 @item -msmall-data
17965 @itemx -mlarge-data
17966 @opindex msmall-data
17967 @opindex mlarge-data
17968 When @option{-mexplicit-relocs} is in effect, static data is
17969 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
17970 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
17971 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
17972 16-bit relocations off of the @code{$gp} register. This limits the
17973 size of the small data area to 64KB, but allows the variables to be
17974 directly accessed via a single instruction.
17975
17976 The default is @option{-mlarge-data}. With this option the data area
17977 is limited to just below 2GB@. Programs that require more than 2GB of
17978 data must use @code{malloc} or @code{mmap} to allocate the data in the
17979 heap instead of in the program's data segment.
17980
17981 When generating code for shared libraries, @option{-fpic} implies
17982 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
17983
17984 @item -msmall-text
17985 @itemx -mlarge-text
17986 @opindex msmall-text
17987 @opindex mlarge-text
17988 When @option{-msmall-text} is used, the compiler assumes that the
17989 code of the entire program (or shared library) fits in 4MB, and is
17990 thus reachable with a branch instruction. When @option{-msmall-data}
17991 is used, the compiler can assume that all local symbols share the
17992 same @code{$gp} value, and thus reduce the number of instructions
17993 required for a function call from 4 to 1.
17994
17995 The default is @option{-mlarge-text}.
17996
17997 @item -mcpu=@var{cpu_type}
17998 @opindex mcpu
17999 Set the instruction set and instruction scheduling parameters for
18000 machine type @var{cpu_type}. You can specify either the @samp{EV}
18001 style name or the corresponding chip number. GCC supports scheduling
18002 parameters for the EV4, EV5 and EV6 family of processors and
18003 chooses the default values for the instruction set from the processor
18004 you specify. If you do not specify a processor type, GCC defaults
18005 to the processor on which the compiler was built.
18006
18007 Supported values for @var{cpu_type} are
18008
18009 @table @samp
18010 @item ev4
18011 @itemx ev45
18012 @itemx 21064
18013 Schedules as an EV4 and has no instruction set extensions.
18014
18015 @item ev5
18016 @itemx 21164
18017 Schedules as an EV5 and has no instruction set extensions.
18018
18019 @item ev56
18020 @itemx 21164a
18021 Schedules as an EV5 and supports the BWX extension.
18022
18023 @item pca56
18024 @itemx 21164pc
18025 @itemx 21164PC
18026 Schedules as an EV5 and supports the BWX and MAX extensions.
18027
18028 @item ev6
18029 @itemx 21264
18030 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
18031
18032 @item ev67
18033 @itemx 21264a
18034 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
18035 @end table
18036
18037 Native toolchains also support the value @samp{native},
18038 which selects the best architecture option for the host processor.
18039 @option{-mcpu=native} has no effect if GCC does not recognize
18040 the processor.
18041
18042 @item -mtune=@var{cpu_type}
18043 @opindex mtune
18044 Set only the instruction scheduling parameters for machine type
18045 @var{cpu_type}. The instruction set is not changed.
18046
18047 Native toolchains also support the value @samp{native},
18048 which selects the best architecture option for the host processor.
18049 @option{-mtune=native} has no effect if GCC does not recognize
18050 the processor.
18051
18052 @item -mmemory-latency=@var{time}
18053 @opindex mmemory-latency
18054 Sets the latency the scheduler should assume for typical memory
18055 references as seen by the application. This number is highly
18056 dependent on the memory access patterns used by the application
18057 and the size of the external cache on the machine.
18058
18059 Valid options for @var{time} are
18060
18061 @table @samp
18062 @item @var{number}
18063 A decimal number representing clock cycles.
18064
18065 @item L1
18066 @itemx L2
18067 @itemx L3
18068 @itemx main
18069 The compiler contains estimates of the number of clock cycles for
18070 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
18071 (also called Dcache, Scache, and Bcache), as well as to main memory.
18072 Note that L3 is only valid for EV5.
18073
18074 @end table
18075 @end table
18076
18077 @node FR30 Options
18078 @subsection FR30 Options
18079 @cindex FR30 Options
18080
18081 These options are defined specifically for the FR30 port.
18082
18083 @table @gcctabopt
18084
18085 @item -msmall-model
18086 @opindex msmall-model
18087 Use the small address space model. This can produce smaller code, but
18088 it does assume that all symbolic values and addresses fit into a
18089 20-bit range.
18090
18091 @item -mno-lsim
18092 @opindex mno-lsim
18093 Assume that runtime support has been provided and so there is no need
18094 to include the simulator library (@file{libsim.a}) on the linker
18095 command line.
18096
18097 @end table
18098
18099 @node FT32 Options
18100 @subsection FT32 Options
18101 @cindex FT32 Options
18102
18103 These options are defined specifically for the FT32 port.
18104
18105 @table @gcctabopt
18106
18107 @item -msim
18108 @opindex msim
18109 Specifies that the program will be run on the simulator. This causes
18110 an alternate runtime startup and library to be linked.
18111 You must not use this option when generating programs that will run on
18112 real hardware; you must provide your own runtime library for whatever
18113 I/O functions are needed.
18114
18115 @item -mlra
18116 @opindex mlra
18117 Enable Local Register Allocation. This is still experimental for FT32,
18118 so by default the compiler uses standard reload.
18119
18120 @item -mnodiv
18121 @opindex mnodiv
18122 Do not use div and mod instructions.
18123
18124 @item -mft32b
18125 @opindex mft32b
18126 Enable use of the extended instructions of the FT32B processor.
18127
18128 @item -mcompress
18129 @opindex mcompress
18130 Compress all code using the Ft32B code compression scheme.
18131
18132 @item -mnopm
18133 @opindex mnopm
18134 Do not generate code that reads program memory.
18135
18136 @end table
18137
18138 @node FRV Options
18139 @subsection FRV Options
18140 @cindex FRV Options
18141
18142 @table @gcctabopt
18143 @item -mgpr-32
18144 @opindex mgpr-32
18145
18146 Only use the first 32 general-purpose registers.
18147
18148 @item -mgpr-64
18149 @opindex mgpr-64
18150
18151 Use all 64 general-purpose registers.
18152
18153 @item -mfpr-32
18154 @opindex mfpr-32
18155
18156 Use only the first 32 floating-point registers.
18157
18158 @item -mfpr-64
18159 @opindex mfpr-64
18160
18161 Use all 64 floating-point registers.
18162
18163 @item -mhard-float
18164 @opindex mhard-float
18165
18166 Use hardware instructions for floating-point operations.
18167
18168 @item -msoft-float
18169 @opindex msoft-float
18170
18171 Use library routines for floating-point operations.
18172
18173 @item -malloc-cc
18174 @opindex malloc-cc
18175
18176 Dynamically allocate condition code registers.
18177
18178 @item -mfixed-cc
18179 @opindex mfixed-cc
18180
18181 Do not try to dynamically allocate condition code registers, only
18182 use @code{icc0} and @code{fcc0}.
18183
18184 @item -mdword
18185 @opindex mdword
18186
18187 Change ABI to use double word insns.
18188
18189 @item -mno-dword
18190 @opindex mno-dword
18191
18192 Do not use double word instructions.
18193
18194 @item -mdouble
18195 @opindex mdouble
18196
18197 Use floating-point double instructions.
18198
18199 @item -mno-double
18200 @opindex mno-double
18201
18202 Do not use floating-point double instructions.
18203
18204 @item -mmedia
18205 @opindex mmedia
18206
18207 Use media instructions.
18208
18209 @item -mno-media
18210 @opindex mno-media
18211
18212 Do not use media instructions.
18213
18214 @item -mmuladd
18215 @opindex mmuladd
18216
18217 Use multiply and add/subtract instructions.
18218
18219 @item -mno-muladd
18220 @opindex mno-muladd
18221
18222 Do not use multiply and add/subtract instructions.
18223
18224 @item -mfdpic
18225 @opindex mfdpic
18226
18227 Select the FDPIC ABI, which uses function descriptors to represent
18228 pointers to functions. Without any PIC/PIE-related options, it
18229 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
18230 assumes GOT entries and small data are within a 12-bit range from the
18231 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
18232 are computed with 32 bits.
18233 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18234
18235 @item -minline-plt
18236 @opindex minline-plt
18237
18238 Enable inlining of PLT entries in function calls to functions that are
18239 not known to bind locally. It has no effect without @option{-mfdpic}.
18240 It's enabled by default if optimizing for speed and compiling for
18241 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
18242 optimization option such as @option{-O3} or above is present in the
18243 command line.
18244
18245 @item -mTLS
18246 @opindex mTLS
18247
18248 Assume a large TLS segment when generating thread-local code.
18249
18250 @item -mtls
18251 @opindex mtls
18252
18253 Do not assume a large TLS segment when generating thread-local code.
18254
18255 @item -mgprel-ro
18256 @opindex mgprel-ro
18257
18258 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
18259 that is known to be in read-only sections. It's enabled by default,
18260 except for @option{-fpic} or @option{-fpie}: even though it may help
18261 make the global offset table smaller, it trades 1 instruction for 4.
18262 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
18263 one of which may be shared by multiple symbols, and it avoids the need
18264 for a GOT entry for the referenced symbol, so it's more likely to be a
18265 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
18266
18267 @item -multilib-library-pic
18268 @opindex multilib-library-pic
18269
18270 Link with the (library, not FD) pic libraries. It's implied by
18271 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
18272 @option{-fpic} without @option{-mfdpic}. You should never have to use
18273 it explicitly.
18274
18275 @item -mlinked-fp
18276 @opindex mlinked-fp
18277
18278 Follow the EABI requirement of always creating a frame pointer whenever
18279 a stack frame is allocated. This option is enabled by default and can
18280 be disabled with @option{-mno-linked-fp}.
18281
18282 @item -mlong-calls
18283 @opindex mlong-calls
18284
18285 Use indirect addressing to call functions outside the current
18286 compilation unit. This allows the functions to be placed anywhere
18287 within the 32-bit address space.
18288
18289 @item -malign-labels
18290 @opindex malign-labels
18291
18292 Try to align labels to an 8-byte boundary by inserting NOPs into the
18293 previous packet. This option only has an effect when VLIW packing
18294 is enabled. It doesn't create new packets; it merely adds NOPs to
18295 existing ones.
18296
18297 @item -mlibrary-pic
18298 @opindex mlibrary-pic
18299
18300 Generate position-independent EABI code.
18301
18302 @item -macc-4
18303 @opindex macc-4
18304
18305 Use only the first four media accumulator registers.
18306
18307 @item -macc-8
18308 @opindex macc-8
18309
18310 Use all eight media accumulator registers.
18311
18312 @item -mpack
18313 @opindex mpack
18314
18315 Pack VLIW instructions.
18316
18317 @item -mno-pack
18318 @opindex mno-pack
18319
18320 Do not pack VLIW instructions.
18321
18322 @item -mno-eflags
18323 @opindex mno-eflags
18324
18325 Do not mark ABI switches in e_flags.
18326
18327 @item -mcond-move
18328 @opindex mcond-move
18329
18330 Enable the use of conditional-move instructions (default).
18331
18332 This switch is mainly for debugging the compiler and will likely be removed
18333 in a future version.
18334
18335 @item -mno-cond-move
18336 @opindex mno-cond-move
18337
18338 Disable the use of conditional-move instructions.
18339
18340 This switch is mainly for debugging the compiler and will likely be removed
18341 in a future version.
18342
18343 @item -mscc
18344 @opindex mscc
18345
18346 Enable the use of conditional set instructions (default).
18347
18348 This switch is mainly for debugging the compiler and will likely be removed
18349 in a future version.
18350
18351 @item -mno-scc
18352 @opindex mno-scc
18353
18354 Disable the use of conditional set instructions.
18355
18356 This switch is mainly for debugging the compiler and will likely be removed
18357 in a future version.
18358
18359 @item -mcond-exec
18360 @opindex mcond-exec
18361
18362 Enable the use of conditional execution (default).
18363
18364 This switch is mainly for debugging the compiler and will likely be removed
18365 in a future version.
18366
18367 @item -mno-cond-exec
18368 @opindex mno-cond-exec
18369
18370 Disable the use of conditional execution.
18371
18372 This switch is mainly for debugging the compiler and will likely be removed
18373 in a future version.
18374
18375 @item -mvliw-branch
18376 @opindex mvliw-branch
18377
18378 Run a pass to pack branches into VLIW instructions (default).
18379
18380 This switch is mainly for debugging the compiler and will likely be removed
18381 in a future version.
18382
18383 @item -mno-vliw-branch
18384 @opindex mno-vliw-branch
18385
18386 Do not run a pass to pack branches into VLIW instructions.
18387
18388 This switch is mainly for debugging the compiler and will likely be removed
18389 in a future version.
18390
18391 @item -mmulti-cond-exec
18392 @opindex mmulti-cond-exec
18393
18394 Enable optimization of @code{&&} and @code{||} in conditional execution
18395 (default).
18396
18397 This switch is mainly for debugging the compiler and will likely be removed
18398 in a future version.
18399
18400 @item -mno-multi-cond-exec
18401 @opindex mno-multi-cond-exec
18402
18403 Disable optimization of @code{&&} and @code{||} in conditional execution.
18404
18405 This switch is mainly for debugging the compiler and will likely be removed
18406 in a future version.
18407
18408 @item -mnested-cond-exec
18409 @opindex mnested-cond-exec
18410
18411 Enable nested conditional execution optimizations (default).
18412
18413 This switch is mainly for debugging the compiler and will likely be removed
18414 in a future version.
18415
18416 @item -mno-nested-cond-exec
18417 @opindex mno-nested-cond-exec
18418
18419 Disable nested conditional execution optimizations.
18420
18421 This switch is mainly for debugging the compiler and will likely be removed
18422 in a future version.
18423
18424 @item -moptimize-membar
18425 @opindex moptimize-membar
18426
18427 This switch removes redundant @code{membar} instructions from the
18428 compiler-generated code. It is enabled by default.
18429
18430 @item -mno-optimize-membar
18431 @opindex mno-optimize-membar
18432
18433 This switch disables the automatic removal of redundant @code{membar}
18434 instructions from the generated code.
18435
18436 @item -mtomcat-stats
18437 @opindex mtomcat-stats
18438
18439 Cause gas to print out tomcat statistics.
18440
18441 @item -mcpu=@var{cpu}
18442 @opindex mcpu
18443
18444 Select the processor type for which to generate code. Possible values are
18445 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
18446 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
18447
18448 @end table
18449
18450 @node GNU/Linux Options
18451 @subsection GNU/Linux Options
18452
18453 These @samp{-m} options are defined for GNU/Linux targets:
18454
18455 @table @gcctabopt
18456 @item -mglibc
18457 @opindex mglibc
18458 Use the GNU C library. This is the default except
18459 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
18460 @samp{*-*-linux-*android*} targets.
18461
18462 @item -muclibc
18463 @opindex muclibc
18464 Use uClibc C library. This is the default on
18465 @samp{*-*-linux-*uclibc*} targets.
18466
18467 @item -mmusl
18468 @opindex mmusl
18469 Use the musl C library. This is the default on
18470 @samp{*-*-linux-*musl*} targets.
18471
18472 @item -mbionic
18473 @opindex mbionic
18474 Use Bionic C library. This is the default on
18475 @samp{*-*-linux-*android*} targets.
18476
18477 @item -mandroid
18478 @opindex mandroid
18479 Compile code compatible with Android platform. This is the default on
18480 @samp{*-*-linux-*android*} targets.
18481
18482 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
18483 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
18484 this option makes the GCC driver pass Android-specific options to the linker.
18485 Finally, this option causes the preprocessor macro @code{__ANDROID__}
18486 to be defined.
18487
18488 @item -tno-android-cc
18489 @opindex tno-android-cc
18490 Disable compilation effects of @option{-mandroid}, i.e., do not enable
18491 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
18492 @option{-fno-rtti} by default.
18493
18494 @item -tno-android-ld
18495 @opindex tno-android-ld
18496 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
18497 linking options to the linker.
18498
18499 @end table
18500
18501 @node H8/300 Options
18502 @subsection H8/300 Options
18503
18504 These @samp{-m} options are defined for the H8/300 implementations:
18505
18506 @table @gcctabopt
18507 @item -mrelax
18508 @opindex mrelax
18509 Shorten some address references at link time, when possible; uses the
18510 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
18511 ld, Using ld}, for a fuller description.
18512
18513 @item -mh
18514 @opindex mh
18515 Generate code for the H8/300H@.
18516
18517 @item -ms
18518 @opindex ms
18519 Generate code for the H8S@.
18520
18521 @item -mn
18522 @opindex mn
18523 Generate code for the H8S and H8/300H in the normal mode. This switch
18524 must be used either with @option{-mh} or @option{-ms}.
18525
18526 @item -ms2600
18527 @opindex ms2600
18528 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
18529
18530 @item -mexr
18531 @opindex mexr
18532 Extended registers are stored on stack before execution of function
18533 with monitor attribute. Default option is @option{-mexr}.
18534 This option is valid only for H8S targets.
18535
18536 @item -mno-exr
18537 @opindex mno-exr
18538 Extended registers are not stored on stack before execution of function
18539 with monitor attribute. Default option is @option{-mno-exr}.
18540 This option is valid only for H8S targets.
18541
18542 @item -mint32
18543 @opindex mint32
18544 Make @code{int} data 32 bits by default.
18545
18546 @item -malign-300
18547 @opindex malign-300
18548 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
18549 The default for the H8/300H and H8S is to align longs and floats on
18550 4-byte boundaries.
18551 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
18552 This option has no effect on the H8/300.
18553 @end table
18554
18555 @node HPPA Options
18556 @subsection HPPA Options
18557 @cindex HPPA Options
18558
18559 These @samp{-m} options are defined for the HPPA family of computers:
18560
18561 @table @gcctabopt
18562 @item -march=@var{architecture-type}
18563 @opindex march
18564 Generate code for the specified architecture. The choices for
18565 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
18566 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
18567 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
18568 architecture option for your machine. Code compiled for lower numbered
18569 architectures runs on higher numbered architectures, but not the
18570 other way around.
18571
18572 @item -mpa-risc-1-0
18573 @itemx -mpa-risc-1-1
18574 @itemx -mpa-risc-2-0
18575 @opindex mpa-risc-1-0
18576 @opindex mpa-risc-1-1
18577 @opindex mpa-risc-2-0
18578 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
18579
18580 @item -mcaller-copies
18581 @opindex mcaller-copies
18582 The caller copies function arguments passed by hidden reference. This
18583 option should be used with care as it is not compatible with the default
18584 32-bit runtime. However, only aggregates larger than eight bytes are
18585 passed by hidden reference and the option provides better compatibility
18586 with OpenMP.
18587
18588 @item -mjump-in-delay
18589 @opindex mjump-in-delay
18590 This option is ignored and provided for compatibility purposes only.
18591
18592 @item -mdisable-fpregs
18593 @opindex mdisable-fpregs
18594 Prevent floating-point registers from being used in any manner. This is
18595 necessary for compiling kernels that perform lazy context switching of
18596 floating-point registers. If you use this option and attempt to perform
18597 floating-point operations, the compiler aborts.
18598
18599 @item -mdisable-indexing
18600 @opindex mdisable-indexing
18601 Prevent the compiler from using indexing address modes. This avoids some
18602 rather obscure problems when compiling MIG generated code under MACH@.
18603
18604 @item -mno-space-regs
18605 @opindex mno-space-regs
18606 Generate code that assumes the target has no space registers. This allows
18607 GCC to generate faster indirect calls and use unscaled index address modes.
18608
18609 Such code is suitable for level 0 PA systems and kernels.
18610
18611 @item -mfast-indirect-calls
18612 @opindex mfast-indirect-calls
18613 Generate code that assumes calls never cross space boundaries. This
18614 allows GCC to emit code that performs faster indirect calls.
18615
18616 This option does not work in the presence of shared libraries or nested
18617 functions.
18618
18619 @item -mfixed-range=@var{register-range}
18620 @opindex mfixed-range
18621 Generate code treating the given register range as fixed registers.
18622 A fixed register is one that the register allocator cannot use. This is
18623 useful when compiling kernel code. A register range is specified as
18624 two registers separated by a dash. Multiple register ranges can be
18625 specified separated by a comma.
18626
18627 @item -mlong-load-store
18628 @opindex mlong-load-store
18629 Generate 3-instruction load and store sequences as sometimes required by
18630 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
18631 the HP compilers.
18632
18633 @item -mportable-runtime
18634 @opindex mportable-runtime
18635 Use the portable calling conventions proposed by HP for ELF systems.
18636
18637 @item -mgas
18638 @opindex mgas
18639 Enable the use of assembler directives only GAS understands.
18640
18641 @item -mschedule=@var{cpu-type}
18642 @opindex mschedule
18643 Schedule code according to the constraints for the machine type
18644 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
18645 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
18646 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
18647 proper scheduling option for your machine. The default scheduling is
18648 @samp{8000}.
18649
18650 @item -mlinker-opt
18651 @opindex mlinker-opt
18652 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
18653 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
18654 linkers in which they give bogus error messages when linking some programs.
18655
18656 @item -msoft-float
18657 @opindex msoft-float
18658 Generate output containing library calls for floating point.
18659 @strong{Warning:} the requisite libraries are not available for all HPPA
18660 targets. Normally the facilities of the machine's usual C compiler are
18661 used, but this cannot be done directly in cross-compilation. You must make
18662 your own arrangements to provide suitable library functions for
18663 cross-compilation.
18664
18665 @option{-msoft-float} changes the calling convention in the output file;
18666 therefore, it is only useful if you compile @emph{all} of a program with
18667 this option. In particular, you need to compile @file{libgcc.a}, the
18668 library that comes with GCC, with @option{-msoft-float} in order for
18669 this to work.
18670
18671 @item -msio
18672 @opindex msio
18673 Generate the predefine, @code{_SIO}, for server IO@. The default is
18674 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
18675 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
18676 options are available under HP-UX and HI-UX@.
18677
18678 @item -mgnu-ld
18679 @opindex mgnu-ld
18680 Use options specific to GNU @command{ld}.
18681 This passes @option{-shared} to @command{ld} when
18682 building a shared library. It is the default when GCC is configured,
18683 explicitly or implicitly, with the GNU linker. This option does not
18684 affect which @command{ld} is called; it only changes what parameters
18685 are passed to that @command{ld}.
18686 The @command{ld} that is called is determined by the
18687 @option{--with-ld} configure option, GCC's program search path, and
18688 finally by the user's @env{PATH}. The linker used by GCC can be printed
18689 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
18690 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18691
18692 @item -mhp-ld
18693 @opindex mhp-ld
18694 Use options specific to HP @command{ld}.
18695 This passes @option{-b} to @command{ld} when building
18696 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
18697 links. It is the default when GCC is configured, explicitly or
18698 implicitly, with the HP linker. This option does not affect
18699 which @command{ld} is called; it only changes what parameters are passed to that
18700 @command{ld}.
18701 The @command{ld} that is called is determined by the @option{--with-ld}
18702 configure option, GCC's program search path, and finally by the user's
18703 @env{PATH}. The linker used by GCC can be printed using @samp{which
18704 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
18705 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18706
18707 @item -mlong-calls
18708 @opindex mno-long-calls
18709 Generate code that uses long call sequences. This ensures that a call
18710 is always able to reach linker generated stubs. The default is to generate
18711 long calls only when the distance from the call site to the beginning
18712 of the function or translation unit, as the case may be, exceeds a
18713 predefined limit set by the branch type being used. The limits for
18714 normal calls are 7,600,000 and 240,000 bytes, respectively for the
18715 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
18716 240,000 bytes.
18717
18718 Distances are measured from the beginning of functions when using the
18719 @option{-ffunction-sections} option, or when using the @option{-mgas}
18720 and @option{-mno-portable-runtime} options together under HP-UX with
18721 the SOM linker.
18722
18723 It is normally not desirable to use this option as it degrades
18724 performance. However, it may be useful in large applications,
18725 particularly when partial linking is used to build the application.
18726
18727 The types of long calls used depends on the capabilities of the
18728 assembler and linker, and the type of code being generated. The
18729 impact on systems that support long absolute calls, and long pic
18730 symbol-difference or pc-relative calls should be relatively small.
18731 However, an indirect call is used on 32-bit ELF systems in pic code
18732 and it is quite long.
18733
18734 @item -munix=@var{unix-std}
18735 @opindex march
18736 Generate compiler predefines and select a startfile for the specified
18737 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
18738 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
18739 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
18740 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
18741 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
18742 and later.
18743
18744 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
18745 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
18746 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
18747 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
18748 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
18749 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
18750
18751 It is @emph{important} to note that this option changes the interfaces
18752 for various library routines. It also affects the operational behavior
18753 of the C library. Thus, @emph{extreme} care is needed in using this
18754 option.
18755
18756 Library code that is intended to operate with more than one UNIX
18757 standard must test, set and restore the variable @code{__xpg4_extended_mask}
18758 as appropriate. Most GNU software doesn't provide this capability.
18759
18760 @item -nolibdld
18761 @opindex nolibdld
18762 Suppress the generation of link options to search libdld.sl when the
18763 @option{-static} option is specified on HP-UX 10 and later.
18764
18765 @item -static
18766 @opindex static
18767 The HP-UX implementation of setlocale in libc has a dependency on
18768 libdld.sl. There isn't an archive version of libdld.sl. Thus,
18769 when the @option{-static} option is specified, special link options
18770 are needed to resolve this dependency.
18771
18772 On HP-UX 10 and later, the GCC driver adds the necessary options to
18773 link with libdld.sl when the @option{-static} option is specified.
18774 This causes the resulting binary to be dynamic. On the 64-bit port,
18775 the linkers generate dynamic binaries by default in any case. The
18776 @option{-nolibdld} option can be used to prevent the GCC driver from
18777 adding these link options.
18778
18779 @item -threads
18780 @opindex threads
18781 Add support for multithreading with the @dfn{dce thread} library
18782 under HP-UX@. This option sets flags for both the preprocessor and
18783 linker.
18784 @end table
18785
18786 @node IA-64 Options
18787 @subsection IA-64 Options
18788 @cindex IA-64 Options
18789
18790 These are the @samp{-m} options defined for the Intel IA-64 architecture.
18791
18792 @table @gcctabopt
18793 @item -mbig-endian
18794 @opindex mbig-endian
18795 Generate code for a big-endian target. This is the default for HP-UX@.
18796
18797 @item -mlittle-endian
18798 @opindex mlittle-endian
18799 Generate code for a little-endian target. This is the default for AIX5
18800 and GNU/Linux.
18801
18802 @item -mgnu-as
18803 @itemx -mno-gnu-as
18804 @opindex mgnu-as
18805 @opindex mno-gnu-as
18806 Generate (or don't) code for the GNU assembler. This is the default.
18807 @c Also, this is the default if the configure option @option{--with-gnu-as}
18808 @c is used.
18809
18810 @item -mgnu-ld
18811 @itemx -mno-gnu-ld
18812 @opindex mgnu-ld
18813 @opindex mno-gnu-ld
18814 Generate (or don't) code for the GNU linker. This is the default.
18815 @c Also, this is the default if the configure option @option{--with-gnu-ld}
18816 @c is used.
18817
18818 @item -mno-pic
18819 @opindex mno-pic
18820 Generate code that does not use a global pointer register. The result
18821 is not position independent code, and violates the IA-64 ABI@.
18822
18823 @item -mvolatile-asm-stop
18824 @itemx -mno-volatile-asm-stop
18825 @opindex mvolatile-asm-stop
18826 @opindex mno-volatile-asm-stop
18827 Generate (or don't) a stop bit immediately before and after volatile asm
18828 statements.
18829
18830 @item -mregister-names
18831 @itemx -mno-register-names
18832 @opindex mregister-names
18833 @opindex mno-register-names
18834 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
18835 the stacked registers. This may make assembler output more readable.
18836
18837 @item -mno-sdata
18838 @itemx -msdata
18839 @opindex mno-sdata
18840 @opindex msdata
18841 Disable (or enable) optimizations that use the small data section. This may
18842 be useful for working around optimizer bugs.
18843
18844 @item -mconstant-gp
18845 @opindex mconstant-gp
18846 Generate code that uses a single constant global pointer value. This is
18847 useful when compiling kernel code.
18848
18849 @item -mauto-pic
18850 @opindex mauto-pic
18851 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
18852 This is useful when compiling firmware code.
18853
18854 @item -minline-float-divide-min-latency
18855 @opindex minline-float-divide-min-latency
18856 Generate code for inline divides of floating-point values
18857 using the minimum latency algorithm.
18858
18859 @item -minline-float-divide-max-throughput
18860 @opindex minline-float-divide-max-throughput
18861 Generate code for inline divides of floating-point values
18862 using the maximum throughput algorithm.
18863
18864 @item -mno-inline-float-divide
18865 @opindex mno-inline-float-divide
18866 Do not generate inline code for divides of floating-point values.
18867
18868 @item -minline-int-divide-min-latency
18869 @opindex minline-int-divide-min-latency
18870 Generate code for inline divides of integer values
18871 using the minimum latency algorithm.
18872
18873 @item -minline-int-divide-max-throughput
18874 @opindex minline-int-divide-max-throughput
18875 Generate code for inline divides of integer values
18876 using the maximum throughput algorithm.
18877
18878 @item -mno-inline-int-divide
18879 @opindex mno-inline-int-divide
18880 Do not generate inline code for divides of integer values.
18881
18882 @item -minline-sqrt-min-latency
18883 @opindex minline-sqrt-min-latency
18884 Generate code for inline square roots
18885 using the minimum latency algorithm.
18886
18887 @item -minline-sqrt-max-throughput
18888 @opindex minline-sqrt-max-throughput
18889 Generate code for inline square roots
18890 using the maximum throughput algorithm.
18891
18892 @item -mno-inline-sqrt
18893 @opindex mno-inline-sqrt
18894 Do not generate inline code for @code{sqrt}.
18895
18896 @item -mfused-madd
18897 @itemx -mno-fused-madd
18898 @opindex mfused-madd
18899 @opindex mno-fused-madd
18900 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
18901 instructions. The default is to use these instructions.
18902
18903 @item -mno-dwarf2-asm
18904 @itemx -mdwarf2-asm
18905 @opindex mno-dwarf2-asm
18906 @opindex mdwarf2-asm
18907 Don't (or do) generate assembler code for the DWARF line number debugging
18908 info. This may be useful when not using the GNU assembler.
18909
18910 @item -mearly-stop-bits
18911 @itemx -mno-early-stop-bits
18912 @opindex mearly-stop-bits
18913 @opindex mno-early-stop-bits
18914 Allow stop bits to be placed earlier than immediately preceding the
18915 instruction that triggered the stop bit. This can improve instruction
18916 scheduling, but does not always do so.
18917
18918 @item -mfixed-range=@var{register-range}
18919 @opindex mfixed-range
18920 Generate code treating the given register range as fixed registers.
18921 A fixed register is one that the register allocator cannot use. This is
18922 useful when compiling kernel code. A register range is specified as
18923 two registers separated by a dash. Multiple register ranges can be
18924 specified separated by a comma.
18925
18926 @item -mtls-size=@var{tls-size}
18927 @opindex mtls-size
18928 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
18929 64.
18930
18931 @item -mtune=@var{cpu-type}
18932 @opindex mtune
18933 Tune the instruction scheduling for a particular CPU, Valid values are
18934 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
18935 and @samp{mckinley}.
18936
18937 @item -milp32
18938 @itemx -mlp64
18939 @opindex milp32
18940 @opindex mlp64
18941 Generate code for a 32-bit or 64-bit environment.
18942 The 32-bit environment sets int, long and pointer to 32 bits.
18943 The 64-bit environment sets int to 32 bits and long and pointer
18944 to 64 bits. These are HP-UX specific flags.
18945
18946 @item -mno-sched-br-data-spec
18947 @itemx -msched-br-data-spec
18948 @opindex mno-sched-br-data-spec
18949 @opindex msched-br-data-spec
18950 (Dis/En)able data speculative scheduling before reload.
18951 This results in generation of @code{ld.a} instructions and
18952 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
18953 The default setting is disabled.
18954
18955 @item -msched-ar-data-spec
18956 @itemx -mno-sched-ar-data-spec
18957 @opindex msched-ar-data-spec
18958 @opindex mno-sched-ar-data-spec
18959 (En/Dis)able data speculative scheduling after reload.
18960 This results in generation of @code{ld.a} instructions and
18961 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
18962 The default setting is enabled.
18963
18964 @item -mno-sched-control-spec
18965 @itemx -msched-control-spec
18966 @opindex mno-sched-control-spec
18967 @opindex msched-control-spec
18968 (Dis/En)able control speculative scheduling. This feature is
18969 available only during region scheduling (i.e.@: before reload).
18970 This results in generation of the @code{ld.s} instructions and
18971 the corresponding check instructions @code{chk.s}.
18972 The default setting is disabled.
18973
18974 @item -msched-br-in-data-spec
18975 @itemx -mno-sched-br-in-data-spec
18976 @opindex msched-br-in-data-spec
18977 @opindex mno-sched-br-in-data-spec
18978 (En/Dis)able speculative scheduling of the instructions that
18979 are dependent on the data speculative loads before reload.
18980 This is effective only with @option{-msched-br-data-spec} enabled.
18981 The default setting is enabled.
18982
18983 @item -msched-ar-in-data-spec
18984 @itemx -mno-sched-ar-in-data-spec
18985 @opindex msched-ar-in-data-spec
18986 @opindex mno-sched-ar-in-data-spec
18987 (En/Dis)able speculative scheduling of the instructions that
18988 are dependent on the data speculative loads after reload.
18989 This is effective only with @option{-msched-ar-data-spec} enabled.
18990 The default setting is enabled.
18991
18992 @item -msched-in-control-spec
18993 @itemx -mno-sched-in-control-spec
18994 @opindex msched-in-control-spec
18995 @opindex mno-sched-in-control-spec
18996 (En/Dis)able speculative scheduling of the instructions that
18997 are dependent on the control speculative loads.
18998 This is effective only with @option{-msched-control-spec} enabled.
18999 The default setting is enabled.
19000
19001 @item -mno-sched-prefer-non-data-spec-insns
19002 @itemx -msched-prefer-non-data-spec-insns
19003 @opindex mno-sched-prefer-non-data-spec-insns
19004 @opindex msched-prefer-non-data-spec-insns
19005 If enabled, data-speculative instructions are chosen for schedule
19006 only if there are no other choices at the moment. This makes
19007 the use of the data speculation much more conservative.
19008 The default setting is disabled.
19009
19010 @item -mno-sched-prefer-non-control-spec-insns
19011 @itemx -msched-prefer-non-control-spec-insns
19012 @opindex mno-sched-prefer-non-control-spec-insns
19013 @opindex msched-prefer-non-control-spec-insns
19014 If enabled, control-speculative instructions are chosen for schedule
19015 only if there are no other choices at the moment. This makes
19016 the use of the control speculation much more conservative.
19017 The default setting is disabled.
19018
19019 @item -mno-sched-count-spec-in-critical-path
19020 @itemx -msched-count-spec-in-critical-path
19021 @opindex mno-sched-count-spec-in-critical-path
19022 @opindex msched-count-spec-in-critical-path
19023 If enabled, speculative dependencies are considered during
19024 computation of the instructions priorities. This makes the use of the
19025 speculation a bit more conservative.
19026 The default setting is disabled.
19027
19028 @item -msched-spec-ldc
19029 @opindex msched-spec-ldc
19030 Use a simple data speculation check. This option is on by default.
19031
19032 @item -msched-control-spec-ldc
19033 @opindex msched-spec-ldc
19034 Use a simple check for control speculation. This option is on by default.
19035
19036 @item -msched-stop-bits-after-every-cycle
19037 @opindex msched-stop-bits-after-every-cycle
19038 Place a stop bit after every cycle when scheduling. This option is on
19039 by default.
19040
19041 @item -msched-fp-mem-deps-zero-cost
19042 @opindex msched-fp-mem-deps-zero-cost
19043 Assume that floating-point stores and loads are not likely to cause a conflict
19044 when placed into the same instruction group. This option is disabled by
19045 default.
19046
19047 @item -msel-sched-dont-check-control-spec
19048 @opindex msel-sched-dont-check-control-spec
19049 Generate checks for control speculation in selective scheduling.
19050 This flag is disabled by default.
19051
19052 @item -msched-max-memory-insns=@var{max-insns}
19053 @opindex msched-max-memory-insns
19054 Limit on the number of memory insns per instruction group, giving lower
19055 priority to subsequent memory insns attempting to schedule in the same
19056 instruction group. Frequently useful to prevent cache bank conflicts.
19057 The default value is 1.
19058
19059 @item -msched-max-memory-insns-hard-limit
19060 @opindex msched-max-memory-insns-hard-limit
19061 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
19062 disallowing more than that number in an instruction group.
19063 Otherwise, the limit is ``soft'', meaning that non-memory operations
19064 are preferred when the limit is reached, but memory operations may still
19065 be scheduled.
19066
19067 @end table
19068
19069 @node LM32 Options
19070 @subsection LM32 Options
19071 @cindex LM32 options
19072
19073 These @option{-m} options are defined for the LatticeMico32 architecture:
19074
19075 @table @gcctabopt
19076 @item -mbarrel-shift-enabled
19077 @opindex mbarrel-shift-enabled
19078 Enable barrel-shift instructions.
19079
19080 @item -mdivide-enabled
19081 @opindex mdivide-enabled
19082 Enable divide and modulus instructions.
19083
19084 @item -mmultiply-enabled
19085 @opindex multiply-enabled
19086 Enable multiply instructions.
19087
19088 @item -msign-extend-enabled
19089 @opindex msign-extend-enabled
19090 Enable sign extend instructions.
19091
19092 @item -muser-enabled
19093 @opindex muser-enabled
19094 Enable user-defined instructions.
19095
19096 @end table
19097
19098 @node M32C Options
19099 @subsection M32C Options
19100 @cindex M32C options
19101
19102 @table @gcctabopt
19103 @item -mcpu=@var{name}
19104 @opindex mcpu=
19105 Select the CPU for which code is generated. @var{name} may be one of
19106 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
19107 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
19108 the M32C/80 series.
19109
19110 @item -msim
19111 @opindex msim
19112 Specifies that the program will be run on the simulator. This causes
19113 an alternate runtime library to be linked in which supports, for
19114 example, file I/O@. You must not use this option when generating
19115 programs that will run on real hardware; you must provide your own
19116 runtime library for whatever I/O functions are needed.
19117
19118 @item -memregs=@var{number}
19119 @opindex memregs=
19120 Specifies the number of memory-based pseudo-registers GCC uses
19121 during code generation. These pseudo-registers are used like real
19122 registers, so there is a tradeoff between GCC's ability to fit the
19123 code into available registers, and the performance penalty of using
19124 memory instead of registers. Note that all modules in a program must
19125 be compiled with the same value for this option. Because of that, you
19126 must not use this option with GCC's default runtime libraries.
19127
19128 @end table
19129
19130 @node M32R/D Options
19131 @subsection M32R/D Options
19132 @cindex M32R/D options
19133
19134 These @option{-m} options are defined for Renesas M32R/D architectures:
19135
19136 @table @gcctabopt
19137 @item -m32r2
19138 @opindex m32r2
19139 Generate code for the M32R/2@.
19140
19141 @item -m32rx
19142 @opindex m32rx
19143 Generate code for the M32R/X@.
19144
19145 @item -m32r
19146 @opindex m32r
19147 Generate code for the M32R@. This is the default.
19148
19149 @item -mmodel=small
19150 @opindex mmodel=small
19151 Assume all objects live in the lower 16MB of memory (so that their addresses
19152 can be loaded with the @code{ld24} instruction), and assume all subroutines
19153 are reachable with the @code{bl} instruction.
19154 This is the default.
19155
19156 The addressability of a particular object can be set with the
19157 @code{model} attribute.
19158
19159 @item -mmodel=medium
19160 @opindex mmodel=medium
19161 Assume objects may be anywhere in the 32-bit address space (the compiler
19162 generates @code{seth/add3} instructions to load their addresses), and
19163 assume all subroutines are reachable with the @code{bl} instruction.
19164
19165 @item -mmodel=large
19166 @opindex mmodel=large
19167 Assume objects may be anywhere in the 32-bit address space (the compiler
19168 generates @code{seth/add3} instructions to load their addresses), and
19169 assume subroutines may not be reachable with the @code{bl} instruction
19170 (the compiler generates the much slower @code{seth/add3/jl}
19171 instruction sequence).
19172
19173 @item -msdata=none
19174 @opindex msdata=none
19175 Disable use of the small data area. Variables are put into
19176 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
19177 @code{section} attribute has been specified).
19178 This is the default.
19179
19180 The small data area consists of sections @code{.sdata} and @code{.sbss}.
19181 Objects may be explicitly put in the small data area with the
19182 @code{section} attribute using one of these sections.
19183
19184 @item -msdata=sdata
19185 @opindex msdata=sdata
19186 Put small global and static data in the small data area, but do not
19187 generate special code to reference them.
19188
19189 @item -msdata=use
19190 @opindex msdata=use
19191 Put small global and static data in the small data area, and generate
19192 special instructions to reference them.
19193
19194 @item -G @var{num}
19195 @opindex G
19196 @cindex smaller data references
19197 Put global and static objects less than or equal to @var{num} bytes
19198 into the small data or BSS sections instead of the normal data or BSS
19199 sections. The default value of @var{num} is 8.
19200 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
19201 for this option to have any effect.
19202
19203 All modules should be compiled with the same @option{-G @var{num}} value.
19204 Compiling with different values of @var{num} may or may not work; if it
19205 doesn't the linker gives an error message---incorrect code is not
19206 generated.
19207
19208 @item -mdebug
19209 @opindex mdebug
19210 Makes the M32R-specific code in the compiler display some statistics
19211 that might help in debugging programs.
19212
19213 @item -malign-loops
19214 @opindex malign-loops
19215 Align all loops to a 32-byte boundary.
19216
19217 @item -mno-align-loops
19218 @opindex mno-align-loops
19219 Do not enforce a 32-byte alignment for loops. This is the default.
19220
19221 @item -missue-rate=@var{number}
19222 @opindex missue-rate=@var{number}
19223 Issue @var{number} instructions per cycle. @var{number} can only be 1
19224 or 2.
19225
19226 @item -mbranch-cost=@var{number}
19227 @opindex mbranch-cost=@var{number}
19228 @var{number} can only be 1 or 2. If it is 1 then branches are
19229 preferred over conditional code, if it is 2, then the opposite applies.
19230
19231 @item -mflush-trap=@var{number}
19232 @opindex mflush-trap=@var{number}
19233 Specifies the trap number to use to flush the cache. The default is
19234 12. Valid numbers are between 0 and 15 inclusive.
19235
19236 @item -mno-flush-trap
19237 @opindex mno-flush-trap
19238 Specifies that the cache cannot be flushed by using a trap.
19239
19240 @item -mflush-func=@var{name}
19241 @opindex mflush-func=@var{name}
19242 Specifies the name of the operating system function to call to flush
19243 the cache. The default is @samp{_flush_cache}, but a function call
19244 is only used if a trap is not available.
19245
19246 @item -mno-flush-func
19247 @opindex mno-flush-func
19248 Indicates that there is no OS function for flushing the cache.
19249
19250 @end table
19251
19252 @node M680x0 Options
19253 @subsection M680x0 Options
19254 @cindex M680x0 options
19255
19256 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
19257 The default settings depend on which architecture was selected when
19258 the compiler was configured; the defaults for the most common choices
19259 are given below.
19260
19261 @table @gcctabopt
19262 @item -march=@var{arch}
19263 @opindex march
19264 Generate code for a specific M680x0 or ColdFire instruction set
19265 architecture. Permissible values of @var{arch} for M680x0
19266 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
19267 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
19268 architectures are selected according to Freescale's ISA classification
19269 and the permissible values are: @samp{isaa}, @samp{isaaplus},
19270 @samp{isab} and @samp{isac}.
19271
19272 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
19273 code for a ColdFire target. The @var{arch} in this macro is one of the
19274 @option{-march} arguments given above.
19275
19276 When used together, @option{-march} and @option{-mtune} select code
19277 that runs on a family of similar processors but that is optimized
19278 for a particular microarchitecture.
19279
19280 @item -mcpu=@var{cpu}
19281 @opindex mcpu
19282 Generate code for a specific M680x0 or ColdFire processor.
19283 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
19284 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
19285 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
19286 below, which also classifies the CPUs into families:
19287
19288 @multitable @columnfractions 0.20 0.80
19289 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
19290 @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}
19291 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
19292 @item @samp{5206e} @tab @samp{5206e}
19293 @item @samp{5208} @tab @samp{5207} @samp{5208}
19294 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
19295 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
19296 @item @samp{5216} @tab @samp{5214} @samp{5216}
19297 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
19298 @item @samp{5225} @tab @samp{5224} @samp{5225}
19299 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
19300 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
19301 @item @samp{5249} @tab @samp{5249}
19302 @item @samp{5250} @tab @samp{5250}
19303 @item @samp{5271} @tab @samp{5270} @samp{5271}
19304 @item @samp{5272} @tab @samp{5272}
19305 @item @samp{5275} @tab @samp{5274} @samp{5275}
19306 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
19307 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
19308 @item @samp{5307} @tab @samp{5307}
19309 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
19310 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
19311 @item @samp{5407} @tab @samp{5407}
19312 @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}
19313 @end multitable
19314
19315 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
19316 @var{arch} is compatible with @var{cpu}. Other combinations of
19317 @option{-mcpu} and @option{-march} are rejected.
19318
19319 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
19320 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
19321 where the value of @var{family} is given by the table above.
19322
19323 @item -mtune=@var{tune}
19324 @opindex mtune
19325 Tune the code for a particular microarchitecture within the
19326 constraints set by @option{-march} and @option{-mcpu}.
19327 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
19328 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
19329 and @samp{cpu32}. The ColdFire microarchitectures
19330 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
19331
19332 You can also use @option{-mtune=68020-40} for code that needs
19333 to run relatively well on 68020, 68030 and 68040 targets.
19334 @option{-mtune=68020-60} is similar but includes 68060 targets
19335 as well. These two options select the same tuning decisions as
19336 @option{-m68020-40} and @option{-m68020-60} respectively.
19337
19338 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
19339 when tuning for 680x0 architecture @var{arch}. It also defines
19340 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
19341 option is used. If GCC is tuning for a range of architectures,
19342 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
19343 it defines the macros for every architecture in the range.
19344
19345 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
19346 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
19347 of the arguments given above.
19348
19349 @item -m68000
19350 @itemx -mc68000
19351 @opindex m68000
19352 @opindex mc68000
19353 Generate output for a 68000. This is the default
19354 when the compiler is configured for 68000-based systems.
19355 It is equivalent to @option{-march=68000}.
19356
19357 Use this option for microcontrollers with a 68000 or EC000 core,
19358 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
19359
19360 @item -m68010
19361 @opindex m68010
19362 Generate output for a 68010. This is the default
19363 when the compiler is configured for 68010-based systems.
19364 It is equivalent to @option{-march=68010}.
19365
19366 @item -m68020
19367 @itemx -mc68020
19368 @opindex m68020
19369 @opindex mc68020
19370 Generate output for a 68020. This is the default
19371 when the compiler is configured for 68020-based systems.
19372 It is equivalent to @option{-march=68020}.
19373
19374 @item -m68030
19375 @opindex m68030
19376 Generate output for a 68030. This is the default when the compiler is
19377 configured for 68030-based systems. It is equivalent to
19378 @option{-march=68030}.
19379
19380 @item -m68040
19381 @opindex m68040
19382 Generate output for a 68040. This is the default when the compiler is
19383 configured for 68040-based systems. It is equivalent to
19384 @option{-march=68040}.
19385
19386 This option inhibits the use of 68881/68882 instructions that have to be
19387 emulated by software on the 68040. Use this option if your 68040 does not
19388 have code to emulate those instructions.
19389
19390 @item -m68060
19391 @opindex m68060
19392 Generate output for a 68060. This is the default when the compiler is
19393 configured for 68060-based systems. It is equivalent to
19394 @option{-march=68060}.
19395
19396 This option inhibits the use of 68020 and 68881/68882 instructions that
19397 have to be emulated by software on the 68060. Use this option if your 68060
19398 does not have code to emulate those instructions.
19399
19400 @item -mcpu32
19401 @opindex mcpu32
19402 Generate output for a CPU32. This is the default
19403 when the compiler is configured for CPU32-based systems.
19404 It is equivalent to @option{-march=cpu32}.
19405
19406 Use this option for microcontrollers with a
19407 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
19408 68336, 68340, 68341, 68349 and 68360.
19409
19410 @item -m5200
19411 @opindex m5200
19412 Generate output for a 520X ColdFire CPU@. This is the default
19413 when the compiler is configured for 520X-based systems.
19414 It is equivalent to @option{-mcpu=5206}, and is now deprecated
19415 in favor of that option.
19416
19417 Use this option for microcontroller with a 5200 core, including
19418 the MCF5202, MCF5203, MCF5204 and MCF5206.
19419
19420 @item -m5206e
19421 @opindex m5206e
19422 Generate output for a 5206e ColdFire CPU@. The option is now
19423 deprecated in favor of the equivalent @option{-mcpu=5206e}.
19424
19425 @item -m528x
19426 @opindex m528x
19427 Generate output for a member of the ColdFire 528X family.
19428 The option is now deprecated in favor of the equivalent
19429 @option{-mcpu=528x}.
19430
19431 @item -m5307
19432 @opindex m5307
19433 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
19434 in favor of the equivalent @option{-mcpu=5307}.
19435
19436 @item -m5407
19437 @opindex m5407
19438 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
19439 in favor of the equivalent @option{-mcpu=5407}.
19440
19441 @item -mcfv4e
19442 @opindex mcfv4e
19443 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
19444 This includes use of hardware floating-point instructions.
19445 The option is equivalent to @option{-mcpu=547x}, and is now
19446 deprecated in favor of that option.
19447
19448 @item -m68020-40
19449 @opindex m68020-40
19450 Generate output for a 68040, without using any of the new instructions.
19451 This results in code that can run relatively efficiently on either a
19452 68020/68881 or a 68030 or a 68040. The generated code does use the
19453 68881 instructions that are emulated on the 68040.
19454
19455 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
19456
19457 @item -m68020-60
19458 @opindex m68020-60
19459 Generate output for a 68060, without using any of the new instructions.
19460 This results in code that can run relatively efficiently on either a
19461 68020/68881 or a 68030 or a 68040. The generated code does use the
19462 68881 instructions that are emulated on the 68060.
19463
19464 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
19465
19466 @item -mhard-float
19467 @itemx -m68881
19468 @opindex mhard-float
19469 @opindex m68881
19470 Generate floating-point instructions. This is the default for 68020
19471 and above, and for ColdFire devices that have an FPU@. It defines the
19472 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
19473 on ColdFire targets.
19474
19475 @item -msoft-float
19476 @opindex msoft-float
19477 Do not generate floating-point instructions; use library calls instead.
19478 This is the default for 68000, 68010, and 68832 targets. It is also
19479 the default for ColdFire devices that have no FPU.
19480
19481 @item -mdiv
19482 @itemx -mno-div
19483 @opindex mdiv
19484 @opindex mno-div
19485 Generate (do not generate) ColdFire hardware divide and remainder
19486 instructions. If @option{-march} is used without @option{-mcpu},
19487 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
19488 architectures. Otherwise, the default is taken from the target CPU
19489 (either the default CPU, or the one specified by @option{-mcpu}). For
19490 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
19491 @option{-mcpu=5206e}.
19492
19493 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
19494
19495 @item -mshort
19496 @opindex mshort
19497 Consider type @code{int} to be 16 bits wide, like @code{short int}.
19498 Additionally, parameters passed on the stack are also aligned to a
19499 16-bit boundary even on targets whose API mandates promotion to 32-bit.
19500
19501 @item -mno-short
19502 @opindex mno-short
19503 Do not consider type @code{int} to be 16 bits wide. This is the default.
19504
19505 @item -mnobitfield
19506 @itemx -mno-bitfield
19507 @opindex mnobitfield
19508 @opindex mno-bitfield
19509 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
19510 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
19511
19512 @item -mbitfield
19513 @opindex mbitfield
19514 Do use the bit-field instructions. The @option{-m68020} option implies
19515 @option{-mbitfield}. This is the default if you use a configuration
19516 designed for a 68020.
19517
19518 @item -mrtd
19519 @opindex mrtd
19520 Use a different function-calling convention, in which functions
19521 that take a fixed number of arguments return with the @code{rtd}
19522 instruction, which pops their arguments while returning. This
19523 saves one instruction in the caller since there is no need to pop
19524 the arguments there.
19525
19526 This calling convention is incompatible with the one normally
19527 used on Unix, so you cannot use it if you need to call libraries
19528 compiled with the Unix compiler.
19529
19530 Also, you must provide function prototypes for all functions that
19531 take variable numbers of arguments (including @code{printf});
19532 otherwise incorrect code is generated for calls to those
19533 functions.
19534
19535 In addition, seriously incorrect code results if you call a
19536 function with too many arguments. (Normally, extra arguments are
19537 harmlessly ignored.)
19538
19539 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
19540 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
19541
19542 @item -mno-rtd
19543 @opindex mno-rtd
19544 Do not use the calling conventions selected by @option{-mrtd}.
19545 This is the default.
19546
19547 @item -malign-int
19548 @itemx -mno-align-int
19549 @opindex malign-int
19550 @opindex mno-align-int
19551 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
19552 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
19553 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
19554 Aligning variables on 32-bit boundaries produces code that runs somewhat
19555 faster on processors with 32-bit busses at the expense of more memory.
19556
19557 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
19558 aligns structures containing the above types differently than
19559 most published application binary interface specifications for the m68k.
19560
19561 @item -mpcrel
19562 @opindex mpcrel
19563 Use the pc-relative addressing mode of the 68000 directly, instead of
19564 using a global offset table. At present, this option implies @option{-fpic},
19565 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
19566 not presently supported with @option{-mpcrel}, though this could be supported for
19567 68020 and higher processors.
19568
19569 @item -mno-strict-align
19570 @itemx -mstrict-align
19571 @opindex mno-strict-align
19572 @opindex mstrict-align
19573 Do not (do) assume that unaligned memory references are handled by
19574 the system.
19575
19576 @item -msep-data
19577 Generate code that allows the data segment to be located in a different
19578 area of memory from the text segment. This allows for execute-in-place in
19579 an environment without virtual memory management. This option implies
19580 @option{-fPIC}.
19581
19582 @item -mno-sep-data
19583 Generate code that assumes that the data segment follows the text segment.
19584 This is the default.
19585
19586 @item -mid-shared-library
19587 Generate code that supports shared libraries via the library ID method.
19588 This allows for execute-in-place and shared libraries in an environment
19589 without virtual memory management. This option implies @option{-fPIC}.
19590
19591 @item -mno-id-shared-library
19592 Generate code that doesn't assume ID-based shared libraries are being used.
19593 This is the default.
19594
19595 @item -mshared-library-id=n
19596 Specifies the identification number of the ID-based shared library being
19597 compiled. Specifying a value of 0 generates more compact code; specifying
19598 other values forces the allocation of that number to the current
19599 library, but is no more space- or time-efficient than omitting this option.
19600
19601 @item -mxgot
19602 @itemx -mno-xgot
19603 @opindex mxgot
19604 @opindex mno-xgot
19605 When generating position-independent code for ColdFire, generate code
19606 that works if the GOT has more than 8192 entries. This code is
19607 larger and slower than code generated without this option. On M680x0
19608 processors, this option is not needed; @option{-fPIC} suffices.
19609
19610 GCC normally uses a single instruction to load values from the GOT@.
19611 While this is relatively efficient, it only works if the GOT
19612 is smaller than about 64k. Anything larger causes the linker
19613 to report an error such as:
19614
19615 @cindex relocation truncated to fit (ColdFire)
19616 @smallexample
19617 relocation truncated to fit: R_68K_GOT16O foobar
19618 @end smallexample
19619
19620 If this happens, you should recompile your code with @option{-mxgot}.
19621 It should then work with very large GOTs. However, code generated with
19622 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
19623 the value of a global symbol.
19624
19625 Note that some linkers, including newer versions of the GNU linker,
19626 can create multiple GOTs and sort GOT entries. If you have such a linker,
19627 you should only need to use @option{-mxgot} when compiling a single
19628 object file that accesses more than 8192 GOT entries. Very few do.
19629
19630 These options have no effect unless GCC is generating
19631 position-independent code.
19632
19633 @item -mlong-jump-table-offsets
19634 @opindex mlong-jump-table-offsets
19635 Use 32-bit offsets in @code{switch} tables. The default is to use
19636 16-bit offsets.
19637
19638 @end table
19639
19640 @node MCore Options
19641 @subsection MCore Options
19642 @cindex MCore options
19643
19644 These are the @samp{-m} options defined for the Motorola M*Core
19645 processors.
19646
19647 @table @gcctabopt
19648
19649 @item -mhardlit
19650 @itemx -mno-hardlit
19651 @opindex mhardlit
19652 @opindex mno-hardlit
19653 Inline constants into the code stream if it can be done in two
19654 instructions or less.
19655
19656 @item -mdiv
19657 @itemx -mno-div
19658 @opindex mdiv
19659 @opindex mno-div
19660 Use the divide instruction. (Enabled by default).
19661
19662 @item -mrelax-immediate
19663 @itemx -mno-relax-immediate
19664 @opindex mrelax-immediate
19665 @opindex mno-relax-immediate
19666 Allow arbitrary-sized immediates in bit operations.
19667
19668 @item -mwide-bitfields
19669 @itemx -mno-wide-bitfields
19670 @opindex mwide-bitfields
19671 @opindex mno-wide-bitfields
19672 Always treat bit-fields as @code{int}-sized.
19673
19674 @item -m4byte-functions
19675 @itemx -mno-4byte-functions
19676 @opindex m4byte-functions
19677 @opindex mno-4byte-functions
19678 Force all functions to be aligned to a 4-byte boundary.
19679
19680 @item -mcallgraph-data
19681 @itemx -mno-callgraph-data
19682 @opindex mcallgraph-data
19683 @opindex mno-callgraph-data
19684 Emit callgraph information.
19685
19686 @item -mslow-bytes
19687 @itemx -mno-slow-bytes
19688 @opindex mslow-bytes
19689 @opindex mno-slow-bytes
19690 Prefer word access when reading byte quantities.
19691
19692 @item -mlittle-endian
19693 @itemx -mbig-endian
19694 @opindex mlittle-endian
19695 @opindex mbig-endian
19696 Generate code for a little-endian target.
19697
19698 @item -m210
19699 @itemx -m340
19700 @opindex m210
19701 @opindex m340
19702 Generate code for the 210 processor.
19703
19704 @item -mno-lsim
19705 @opindex mno-lsim
19706 Assume that runtime support has been provided and so omit the
19707 simulator library (@file{libsim.a)} from the linker command line.
19708
19709 @item -mstack-increment=@var{size}
19710 @opindex mstack-increment
19711 Set the maximum amount for a single stack increment operation. Large
19712 values can increase the speed of programs that contain functions
19713 that need a large amount of stack space, but they can also trigger a
19714 segmentation fault if the stack is extended too much. The default
19715 value is 0x1000.
19716
19717 @end table
19718
19719 @node MeP Options
19720 @subsection MeP Options
19721 @cindex MeP options
19722
19723 @table @gcctabopt
19724
19725 @item -mabsdiff
19726 @opindex mabsdiff
19727 Enables the @code{abs} instruction, which is the absolute difference
19728 between two registers.
19729
19730 @item -mall-opts
19731 @opindex mall-opts
19732 Enables all the optional instructions---average, multiply, divide, bit
19733 operations, leading zero, absolute difference, min/max, clip, and
19734 saturation.
19735
19736
19737 @item -maverage
19738 @opindex maverage
19739 Enables the @code{ave} instruction, which computes the average of two
19740 registers.
19741
19742 @item -mbased=@var{n}
19743 @opindex mbased=
19744 Variables of size @var{n} bytes or smaller are placed in the
19745 @code{.based} section by default. Based variables use the @code{$tp}
19746 register as a base register, and there is a 128-byte limit to the
19747 @code{.based} section.
19748
19749 @item -mbitops
19750 @opindex mbitops
19751 Enables the bit operation instructions---bit test (@code{btstm}), set
19752 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
19753 test-and-set (@code{tas}).
19754
19755 @item -mc=@var{name}
19756 @opindex mc=
19757 Selects which section constant data is placed in. @var{name} may
19758 be @samp{tiny}, @samp{near}, or @samp{far}.
19759
19760 @item -mclip
19761 @opindex mclip
19762 Enables the @code{clip} instruction. Note that @option{-mclip} is not
19763 useful unless you also provide @option{-mminmax}.
19764
19765 @item -mconfig=@var{name}
19766 @opindex mconfig=
19767 Selects one of the built-in core configurations. Each MeP chip has
19768 one or more modules in it; each module has a core CPU and a variety of
19769 coprocessors, optional instructions, and peripherals. The
19770 @code{MeP-Integrator} tool, not part of GCC, provides these
19771 configurations through this option; using this option is the same as
19772 using all the corresponding command-line options. The default
19773 configuration is @samp{default}.
19774
19775 @item -mcop
19776 @opindex mcop
19777 Enables the coprocessor instructions. By default, this is a 32-bit
19778 coprocessor. Note that the coprocessor is normally enabled via the
19779 @option{-mconfig=} option.
19780
19781 @item -mcop32
19782 @opindex mcop32
19783 Enables the 32-bit coprocessor's instructions.
19784
19785 @item -mcop64
19786 @opindex mcop64
19787 Enables the 64-bit coprocessor's instructions.
19788
19789 @item -mivc2
19790 @opindex mivc2
19791 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
19792
19793 @item -mdc
19794 @opindex mdc
19795 Causes constant variables to be placed in the @code{.near} section.
19796
19797 @item -mdiv
19798 @opindex mdiv
19799 Enables the @code{div} and @code{divu} instructions.
19800
19801 @item -meb
19802 @opindex meb
19803 Generate big-endian code.
19804
19805 @item -mel
19806 @opindex mel
19807 Generate little-endian code.
19808
19809 @item -mio-volatile
19810 @opindex mio-volatile
19811 Tells the compiler that any variable marked with the @code{io}
19812 attribute is to be considered volatile.
19813
19814 @item -ml
19815 @opindex ml
19816 Causes variables to be assigned to the @code{.far} section by default.
19817
19818 @item -mleadz
19819 @opindex mleadz
19820 Enables the @code{leadz} (leading zero) instruction.
19821
19822 @item -mm
19823 @opindex mm
19824 Causes variables to be assigned to the @code{.near} section by default.
19825
19826 @item -mminmax
19827 @opindex mminmax
19828 Enables the @code{min} and @code{max} instructions.
19829
19830 @item -mmult
19831 @opindex mmult
19832 Enables the multiplication and multiply-accumulate instructions.
19833
19834 @item -mno-opts
19835 @opindex mno-opts
19836 Disables all the optional instructions enabled by @option{-mall-opts}.
19837
19838 @item -mrepeat
19839 @opindex mrepeat
19840 Enables the @code{repeat} and @code{erepeat} instructions, used for
19841 low-overhead looping.
19842
19843 @item -ms
19844 @opindex ms
19845 Causes all variables to default to the @code{.tiny} section. Note
19846 that there is a 65536-byte limit to this section. Accesses to these
19847 variables use the @code{%gp} base register.
19848
19849 @item -msatur
19850 @opindex msatur
19851 Enables the saturation instructions. Note that the compiler does not
19852 currently generate these itself, but this option is included for
19853 compatibility with other tools, like @code{as}.
19854
19855 @item -msdram
19856 @opindex msdram
19857 Link the SDRAM-based runtime instead of the default ROM-based runtime.
19858
19859 @item -msim
19860 @opindex msim
19861 Link the simulator run-time libraries.
19862
19863 @item -msimnovec
19864 @opindex msimnovec
19865 Link the simulator runtime libraries, excluding built-in support
19866 for reset and exception vectors and tables.
19867
19868 @item -mtf
19869 @opindex mtf
19870 Causes all functions to default to the @code{.far} section. Without
19871 this option, functions default to the @code{.near} section.
19872
19873 @item -mtiny=@var{n}
19874 @opindex mtiny=
19875 Variables that are @var{n} bytes or smaller are allocated to the
19876 @code{.tiny} section. These variables use the @code{$gp} base
19877 register. The default for this option is 4, but note that there's a
19878 65536-byte limit to the @code{.tiny} section.
19879
19880 @end table
19881
19882 @node MicroBlaze Options
19883 @subsection MicroBlaze Options
19884 @cindex MicroBlaze Options
19885
19886 @table @gcctabopt
19887
19888 @item -msoft-float
19889 @opindex msoft-float
19890 Use software emulation for floating point (default).
19891
19892 @item -mhard-float
19893 @opindex mhard-float
19894 Use hardware floating-point instructions.
19895
19896 @item -mmemcpy
19897 @opindex mmemcpy
19898 Do not optimize block moves, use @code{memcpy}.
19899
19900 @item -mno-clearbss
19901 @opindex mno-clearbss
19902 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
19903
19904 @item -mcpu=@var{cpu-type}
19905 @opindex mcpu=
19906 Use features of, and schedule code for, the given CPU.
19907 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
19908 where @var{X} is a major version, @var{YY} is the minor version, and
19909 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
19910 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
19911
19912 @item -mxl-soft-mul
19913 @opindex mxl-soft-mul
19914 Use software multiply emulation (default).
19915
19916 @item -mxl-soft-div
19917 @opindex mxl-soft-div
19918 Use software emulation for divides (default).
19919
19920 @item -mxl-barrel-shift
19921 @opindex mxl-barrel-shift
19922 Use the hardware barrel shifter.
19923
19924 @item -mxl-pattern-compare
19925 @opindex mxl-pattern-compare
19926 Use pattern compare instructions.
19927
19928 @item -msmall-divides
19929 @opindex msmall-divides
19930 Use table lookup optimization for small signed integer divisions.
19931
19932 @item -mxl-stack-check
19933 @opindex mxl-stack-check
19934 This option is deprecated. Use @option{-fstack-check} instead.
19935
19936 @item -mxl-gp-opt
19937 @opindex mxl-gp-opt
19938 Use GP-relative @code{.sdata}/@code{.sbss} sections.
19939
19940 @item -mxl-multiply-high
19941 @opindex mxl-multiply-high
19942 Use multiply high instructions for high part of 32x32 multiply.
19943
19944 @item -mxl-float-convert
19945 @opindex mxl-float-convert
19946 Use hardware floating-point conversion instructions.
19947
19948 @item -mxl-float-sqrt
19949 @opindex mxl-float-sqrt
19950 Use hardware floating-point square root instruction.
19951
19952 @item -mbig-endian
19953 @opindex mbig-endian
19954 Generate code for a big-endian target.
19955
19956 @item -mlittle-endian
19957 @opindex mlittle-endian
19958 Generate code for a little-endian target.
19959
19960 @item -mxl-reorder
19961 @opindex mxl-reorder
19962 Use reorder instructions (swap and byte reversed load/store).
19963
19964 @item -mxl-mode-@var{app-model}
19965 Select application model @var{app-model}. Valid models are
19966 @table @samp
19967 @item executable
19968 normal executable (default), uses startup code @file{crt0.o}.
19969
19970 @item xmdstub
19971 for use with Xilinx Microprocessor Debugger (XMD) based
19972 software intrusive debug agent called xmdstub. This uses startup file
19973 @file{crt1.o} and sets the start address of the program to 0x800.
19974
19975 @item bootstrap
19976 for applications that are loaded using a bootloader.
19977 This model uses startup file @file{crt2.o} which does not contain a processor
19978 reset vector handler. This is suitable for transferring control on a
19979 processor reset to the bootloader rather than the application.
19980
19981 @item novectors
19982 for applications that do not require any of the
19983 MicroBlaze vectors. This option may be useful for applications running
19984 within a monitoring application. This model uses @file{crt3.o} as a startup file.
19985 @end table
19986
19987 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
19988 @option{-mxl-mode-@var{app-model}}.
19989
19990 @end table
19991
19992 @node MIPS Options
19993 @subsection MIPS Options
19994 @cindex MIPS options
19995
19996 @table @gcctabopt
19997
19998 @item -EB
19999 @opindex EB
20000 Generate big-endian code.
20001
20002 @item -EL
20003 @opindex EL
20004 Generate little-endian code. This is the default for @samp{mips*el-*-*}
20005 configurations.
20006
20007 @item -march=@var{arch}
20008 @opindex march
20009 Generate code that runs on @var{arch}, which can be the name of a
20010 generic MIPS ISA, or the name of a particular processor.
20011 The ISA names are:
20012 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
20013 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
20014 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
20015 @samp{mips64r5} and @samp{mips64r6}.
20016 The processor names are:
20017 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
20018 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
20019 @samp{5kc}, @samp{5kf},
20020 @samp{20kc},
20021 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
20022 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
20023 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
20024 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
20025 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
20026 @samp{i6400},
20027 @samp{interaptiv},
20028 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
20029 @samp{m4k},
20030 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
20031 @samp{m5100}, @samp{m5101},
20032 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
20033 @samp{orion},
20034 @samp{p5600},
20035 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
20036 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
20037 @samp{rm7000}, @samp{rm9000},
20038 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
20039 @samp{sb1},
20040 @samp{sr71000},
20041 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
20042 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
20043 @samp{xlr} and @samp{xlp}.
20044 The special value @samp{from-abi} selects the
20045 most compatible architecture for the selected ABI (that is,
20046 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
20047
20048 The native Linux/GNU toolchain also supports the value @samp{native},
20049 which selects the best architecture option for the host processor.
20050 @option{-march=native} has no effect if GCC does not recognize
20051 the processor.
20052
20053 In processor names, a final @samp{000} can be abbreviated as @samp{k}
20054 (for example, @option{-march=r2k}). Prefixes are optional, and
20055 @samp{vr} may be written @samp{r}.
20056
20057 Names of the form @samp{@var{n}f2_1} refer to processors with
20058 FPUs clocked at half the rate of the core, names of the form
20059 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
20060 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
20061 processors with FPUs clocked a ratio of 3:2 with respect to the core.
20062 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
20063 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
20064 accepted as synonyms for @samp{@var{n}f1_1}.
20065
20066 GCC defines two macros based on the value of this option. The first
20067 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
20068 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
20069 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
20070 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
20071 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
20072
20073 Note that the @code{_MIPS_ARCH} macro uses the processor names given
20074 above. In other words, it has the full prefix and does not
20075 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
20076 the macro names the resolved architecture (either @code{"mips1"} or
20077 @code{"mips3"}). It names the default architecture when no
20078 @option{-march} option is given.
20079
20080 @item -mtune=@var{arch}
20081 @opindex mtune
20082 Optimize for @var{arch}. Among other things, this option controls
20083 the way instructions are scheduled, and the perceived cost of arithmetic
20084 operations. The list of @var{arch} values is the same as for
20085 @option{-march}.
20086
20087 When this option is not used, GCC optimizes for the processor
20088 specified by @option{-march}. By using @option{-march} and
20089 @option{-mtune} together, it is possible to generate code that
20090 runs on a family of processors, but optimize the code for one
20091 particular member of that family.
20092
20093 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
20094 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
20095 @option{-march} ones described above.
20096
20097 @item -mips1
20098 @opindex mips1
20099 Equivalent to @option{-march=mips1}.
20100
20101 @item -mips2
20102 @opindex mips2
20103 Equivalent to @option{-march=mips2}.
20104
20105 @item -mips3
20106 @opindex mips3
20107 Equivalent to @option{-march=mips3}.
20108
20109 @item -mips4
20110 @opindex mips4
20111 Equivalent to @option{-march=mips4}.
20112
20113 @item -mips32
20114 @opindex mips32
20115 Equivalent to @option{-march=mips32}.
20116
20117 @item -mips32r3
20118 @opindex mips32r3
20119 Equivalent to @option{-march=mips32r3}.
20120
20121 @item -mips32r5
20122 @opindex mips32r5
20123 Equivalent to @option{-march=mips32r5}.
20124
20125 @item -mips32r6
20126 @opindex mips32r6
20127 Equivalent to @option{-march=mips32r6}.
20128
20129 @item -mips64
20130 @opindex mips64
20131 Equivalent to @option{-march=mips64}.
20132
20133 @item -mips64r2
20134 @opindex mips64r2
20135 Equivalent to @option{-march=mips64r2}.
20136
20137 @item -mips64r3
20138 @opindex mips64r3
20139 Equivalent to @option{-march=mips64r3}.
20140
20141 @item -mips64r5
20142 @opindex mips64r5
20143 Equivalent to @option{-march=mips64r5}.
20144
20145 @item -mips64r6
20146 @opindex mips64r6
20147 Equivalent to @option{-march=mips64r6}.
20148
20149 @item -mips16
20150 @itemx -mno-mips16
20151 @opindex mips16
20152 @opindex mno-mips16
20153 Generate (do not generate) MIPS16 code. If GCC is targeting a
20154 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
20155
20156 MIPS16 code generation can also be controlled on a per-function basis
20157 by means of @code{mips16} and @code{nomips16} attributes.
20158 @xref{Function Attributes}, for more information.
20159
20160 @item -mflip-mips16
20161 @opindex mflip-mips16
20162 Generate MIPS16 code on alternating functions. This option is provided
20163 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
20164 not intended for ordinary use in compiling user code.
20165
20166 @item -minterlink-compressed
20167 @item -mno-interlink-compressed
20168 @opindex minterlink-compressed
20169 @opindex mno-interlink-compressed
20170 Require (do not require) that code using the standard (uncompressed) MIPS ISA
20171 be link-compatible with MIPS16 and microMIPS code, and vice versa.
20172
20173 For example, code using the standard ISA encoding cannot jump directly
20174 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
20175 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
20176 knows that the target of the jump is not compressed.
20177
20178 @item -minterlink-mips16
20179 @itemx -mno-interlink-mips16
20180 @opindex minterlink-mips16
20181 @opindex mno-interlink-mips16
20182 Aliases of @option{-minterlink-compressed} and
20183 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
20184 and are retained for backwards compatibility.
20185
20186 @item -mabi=32
20187 @itemx -mabi=o64
20188 @itemx -mabi=n32
20189 @itemx -mabi=64
20190 @itemx -mabi=eabi
20191 @opindex mabi=32
20192 @opindex mabi=o64
20193 @opindex mabi=n32
20194 @opindex mabi=64
20195 @opindex mabi=eabi
20196 Generate code for the given ABI@.
20197
20198 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
20199 generates 64-bit code when you select a 64-bit architecture, but you
20200 can use @option{-mgp32} to get 32-bit code instead.
20201
20202 For information about the O64 ABI, see
20203 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
20204
20205 GCC supports a variant of the o32 ABI in which floating-point registers
20206 are 64 rather than 32 bits wide. You can select this combination with
20207 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
20208 and @code{mfhc1} instructions and is therefore only supported for
20209 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
20210
20211 The register assignments for arguments and return values remain the
20212 same, but each scalar value is passed in a single 64-bit register
20213 rather than a pair of 32-bit registers. For example, scalar
20214 floating-point values are returned in @samp{$f0} only, not a
20215 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
20216 remains the same in that the even-numbered double-precision registers
20217 are saved.
20218
20219 Two additional variants of the o32 ABI are supported to enable
20220 a transition from 32-bit to 64-bit registers. These are FPXX
20221 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
20222 The FPXX extension mandates that all code must execute correctly
20223 when run using 32-bit or 64-bit registers. The code can be interlinked
20224 with either FP32 or FP64, but not both.
20225 The FP64A extension is similar to the FP64 extension but forbids the
20226 use of odd-numbered single-precision registers. This can be used
20227 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
20228 processors and allows both FP32 and FP64A code to interlink and
20229 run in the same process without changing FPU modes.
20230
20231 @item -mabicalls
20232 @itemx -mno-abicalls
20233 @opindex mabicalls
20234 @opindex mno-abicalls
20235 Generate (do not generate) code that is suitable for SVR4-style
20236 dynamic objects. @option{-mabicalls} is the default for SVR4-based
20237 systems.
20238
20239 @item -mshared
20240 @itemx -mno-shared
20241 Generate (do not generate) code that is fully position-independent,
20242 and that can therefore be linked into shared libraries. This option
20243 only affects @option{-mabicalls}.
20244
20245 All @option{-mabicalls} code has traditionally been position-independent,
20246 regardless of options like @option{-fPIC} and @option{-fpic}. However,
20247 as an extension, the GNU toolchain allows executables to use absolute
20248 accesses for locally-binding symbols. It can also use shorter GP
20249 initialization sequences and generate direct calls to locally-defined
20250 functions. This mode is selected by @option{-mno-shared}.
20251
20252 @option{-mno-shared} depends on binutils 2.16 or higher and generates
20253 objects that can only be linked by the GNU linker. However, the option
20254 does not affect the ABI of the final executable; it only affects the ABI
20255 of relocatable objects. Using @option{-mno-shared} generally makes
20256 executables both smaller and quicker.
20257
20258 @option{-mshared} is the default.
20259
20260 @item -mplt
20261 @itemx -mno-plt
20262 @opindex mplt
20263 @opindex mno-plt
20264 Assume (do not assume) that the static and dynamic linkers
20265 support PLTs and copy relocations. This option only affects
20266 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
20267 has no effect without @option{-msym32}.
20268
20269 You can make @option{-mplt} the default by configuring
20270 GCC with @option{--with-mips-plt}. The default is
20271 @option{-mno-plt} otherwise.
20272
20273 @item -mxgot
20274 @itemx -mno-xgot
20275 @opindex mxgot
20276 @opindex mno-xgot
20277 Lift (do not lift) the usual restrictions on the size of the global
20278 offset table.
20279
20280 GCC normally uses a single instruction to load values from the GOT@.
20281 While this is relatively efficient, it only works if the GOT
20282 is smaller than about 64k. Anything larger causes the linker
20283 to report an error such as:
20284
20285 @cindex relocation truncated to fit (MIPS)
20286 @smallexample
20287 relocation truncated to fit: R_MIPS_GOT16 foobar
20288 @end smallexample
20289
20290 If this happens, you should recompile your code with @option{-mxgot}.
20291 This works with very large GOTs, although the code is also
20292 less efficient, since it takes three instructions to fetch the
20293 value of a global symbol.
20294
20295 Note that some linkers can create multiple GOTs. If you have such a
20296 linker, you should only need to use @option{-mxgot} when a single object
20297 file accesses more than 64k's worth of GOT entries. Very few do.
20298
20299 These options have no effect unless GCC is generating position
20300 independent code.
20301
20302 @item -mgp32
20303 @opindex mgp32
20304 Assume that general-purpose registers are 32 bits wide.
20305
20306 @item -mgp64
20307 @opindex mgp64
20308 Assume that general-purpose registers are 64 bits wide.
20309
20310 @item -mfp32
20311 @opindex mfp32
20312 Assume that floating-point registers are 32 bits wide.
20313
20314 @item -mfp64
20315 @opindex mfp64
20316 Assume that floating-point registers are 64 bits wide.
20317
20318 @item -mfpxx
20319 @opindex mfpxx
20320 Do not assume the width of floating-point registers.
20321
20322 @item -mhard-float
20323 @opindex mhard-float
20324 Use floating-point coprocessor instructions.
20325
20326 @item -msoft-float
20327 @opindex msoft-float
20328 Do not use floating-point coprocessor instructions. Implement
20329 floating-point calculations using library calls instead.
20330
20331 @item -mno-float
20332 @opindex mno-float
20333 Equivalent to @option{-msoft-float}, but additionally asserts that the
20334 program being compiled does not perform any floating-point operations.
20335 This option is presently supported only by some bare-metal MIPS
20336 configurations, where it may select a special set of libraries
20337 that lack all floating-point support (including, for example, the
20338 floating-point @code{printf} formats).
20339 If code compiled with @option{-mno-float} accidentally contains
20340 floating-point operations, it is likely to suffer a link-time
20341 or run-time failure.
20342
20343 @item -msingle-float
20344 @opindex msingle-float
20345 Assume that the floating-point coprocessor only supports single-precision
20346 operations.
20347
20348 @item -mdouble-float
20349 @opindex mdouble-float
20350 Assume that the floating-point coprocessor supports double-precision
20351 operations. This is the default.
20352
20353 @item -modd-spreg
20354 @itemx -mno-odd-spreg
20355 @opindex modd-spreg
20356 @opindex mno-odd-spreg
20357 Enable the use of odd-numbered single-precision floating-point registers
20358 for the o32 ABI. This is the default for processors that are known to
20359 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
20360 is set by default.
20361
20362 @item -mabs=2008
20363 @itemx -mabs=legacy
20364 @opindex mabs=2008
20365 @opindex mabs=legacy
20366 These options control the treatment of the special not-a-number (NaN)
20367 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
20368 @code{neg.@i{fmt}} machine instructions.
20369
20370 By default or when @option{-mabs=legacy} is used the legacy
20371 treatment is selected. In this case these instructions are considered
20372 arithmetic and avoided where correct operation is required and the
20373 input operand might be a NaN. A longer sequence of instructions that
20374 manipulate the sign bit of floating-point datum manually is used
20375 instead unless the @option{-ffinite-math-only} option has also been
20376 specified.
20377
20378 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
20379 this case these instructions are considered non-arithmetic and therefore
20380 operating correctly in all cases, including in particular where the
20381 input operand is a NaN. These instructions are therefore always used
20382 for the respective operations.
20383
20384 @item -mnan=2008
20385 @itemx -mnan=legacy
20386 @opindex mnan=2008
20387 @opindex mnan=legacy
20388 These options control the encoding of the special not-a-number (NaN)
20389 IEEE 754 floating-point data.
20390
20391 The @option{-mnan=legacy} option selects the legacy encoding. In this
20392 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
20393 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
20394 by the first bit of their trailing significand field being 1.
20395
20396 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
20397 this case qNaNs are denoted by the first bit of their trailing
20398 significand field being 1, whereas sNaNs are denoted by the first bit of
20399 their trailing significand field being 0.
20400
20401 The default is @option{-mnan=legacy} unless GCC has been configured with
20402 @option{--with-nan=2008}.
20403
20404 @item -mllsc
20405 @itemx -mno-llsc
20406 @opindex mllsc
20407 @opindex mno-llsc
20408 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
20409 implement atomic memory built-in functions. When neither option is
20410 specified, GCC uses the instructions if the target architecture
20411 supports them.
20412
20413 @option{-mllsc} is useful if the runtime environment can emulate the
20414 instructions and @option{-mno-llsc} can be useful when compiling for
20415 nonstandard ISAs. You can make either option the default by
20416 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
20417 respectively. @option{--with-llsc} is the default for some
20418 configurations; see the installation documentation for details.
20419
20420 @item -mdsp
20421 @itemx -mno-dsp
20422 @opindex mdsp
20423 @opindex mno-dsp
20424 Use (do not use) revision 1 of the MIPS DSP ASE@.
20425 @xref{MIPS DSP Built-in Functions}. This option defines the
20426 preprocessor macro @code{__mips_dsp}. It also defines
20427 @code{__mips_dsp_rev} to 1.
20428
20429 @item -mdspr2
20430 @itemx -mno-dspr2
20431 @opindex mdspr2
20432 @opindex mno-dspr2
20433 Use (do not use) revision 2 of the MIPS DSP ASE@.
20434 @xref{MIPS DSP Built-in Functions}. This option defines the
20435 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
20436 It also defines @code{__mips_dsp_rev} to 2.
20437
20438 @item -msmartmips
20439 @itemx -mno-smartmips
20440 @opindex msmartmips
20441 @opindex mno-smartmips
20442 Use (do not use) the MIPS SmartMIPS ASE.
20443
20444 @item -mpaired-single
20445 @itemx -mno-paired-single
20446 @opindex mpaired-single
20447 @opindex mno-paired-single
20448 Use (do not use) paired-single floating-point instructions.
20449 @xref{MIPS Paired-Single Support}. This option requires
20450 hardware floating-point support to be enabled.
20451
20452 @item -mdmx
20453 @itemx -mno-mdmx
20454 @opindex mdmx
20455 @opindex mno-mdmx
20456 Use (do not use) MIPS Digital Media Extension instructions.
20457 This option can only be used when generating 64-bit code and requires
20458 hardware floating-point support to be enabled.
20459
20460 @item -mips3d
20461 @itemx -mno-mips3d
20462 @opindex mips3d
20463 @opindex mno-mips3d
20464 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
20465 The option @option{-mips3d} implies @option{-mpaired-single}.
20466
20467 @item -mmicromips
20468 @itemx -mno-micromips
20469 @opindex mmicromips
20470 @opindex mno-mmicromips
20471 Generate (do not generate) microMIPS code.
20472
20473 MicroMIPS code generation can also be controlled on a per-function basis
20474 by means of @code{micromips} and @code{nomicromips} attributes.
20475 @xref{Function Attributes}, for more information.
20476
20477 @item -mmt
20478 @itemx -mno-mt
20479 @opindex mmt
20480 @opindex mno-mt
20481 Use (do not use) MT Multithreading instructions.
20482
20483 @item -mmcu
20484 @itemx -mno-mcu
20485 @opindex mmcu
20486 @opindex mno-mcu
20487 Use (do not use) the MIPS MCU ASE instructions.
20488
20489 @item -meva
20490 @itemx -mno-eva
20491 @opindex meva
20492 @opindex mno-eva
20493 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
20494
20495 @item -mvirt
20496 @itemx -mno-virt
20497 @opindex mvirt
20498 @opindex mno-virt
20499 Use (do not use) the MIPS Virtualization (VZ) instructions.
20500
20501 @item -mxpa
20502 @itemx -mno-xpa
20503 @opindex mxpa
20504 @opindex mno-xpa
20505 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
20506
20507 @item -mlong64
20508 @opindex mlong64
20509 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
20510 an explanation of the default and the way that the pointer size is
20511 determined.
20512
20513 @item -mlong32
20514 @opindex mlong32
20515 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
20516
20517 The default size of @code{int}s, @code{long}s and pointers depends on
20518 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
20519 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
20520 32-bit @code{long}s. Pointers are the same size as @code{long}s,
20521 or the same size as integer registers, whichever is smaller.
20522
20523 @item -msym32
20524 @itemx -mno-sym32
20525 @opindex msym32
20526 @opindex mno-sym32
20527 Assume (do not assume) that all symbols have 32-bit values, regardless
20528 of the selected ABI@. This option is useful in combination with
20529 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
20530 to generate shorter and faster references to symbolic addresses.
20531
20532 @item -G @var{num}
20533 @opindex G
20534 Put definitions of externally-visible data in a small data section
20535 if that data is no bigger than @var{num} bytes. GCC can then generate
20536 more efficient accesses to the data; see @option{-mgpopt} for details.
20537
20538 The default @option{-G} option depends on the configuration.
20539
20540 @item -mlocal-sdata
20541 @itemx -mno-local-sdata
20542 @opindex mlocal-sdata
20543 @opindex mno-local-sdata
20544 Extend (do not extend) the @option{-G} behavior to local data too,
20545 such as to static variables in C@. @option{-mlocal-sdata} is the
20546 default for all configurations.
20547
20548 If the linker complains that an application is using too much small data,
20549 you might want to try rebuilding the less performance-critical parts with
20550 @option{-mno-local-sdata}. You might also want to build large
20551 libraries with @option{-mno-local-sdata}, so that the libraries leave
20552 more room for the main program.
20553
20554 @item -mextern-sdata
20555 @itemx -mno-extern-sdata
20556 @opindex mextern-sdata
20557 @opindex mno-extern-sdata
20558 Assume (do not assume) that externally-defined data is in
20559 a small data section if the size of that data is within the @option{-G} limit.
20560 @option{-mextern-sdata} is the default for all configurations.
20561
20562 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
20563 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
20564 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
20565 is placed in a small data section. If @var{Var} is defined by another
20566 module, you must either compile that module with a high-enough
20567 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
20568 definition. If @var{Var} is common, you must link the application
20569 with a high-enough @option{-G} setting.
20570
20571 The easiest way of satisfying these restrictions is to compile
20572 and link every module with the same @option{-G} option. However,
20573 you may wish to build a library that supports several different
20574 small data limits. You can do this by compiling the library with
20575 the highest supported @option{-G} setting and additionally using
20576 @option{-mno-extern-sdata} to stop the library from making assumptions
20577 about externally-defined data.
20578
20579 @item -mgpopt
20580 @itemx -mno-gpopt
20581 @opindex mgpopt
20582 @opindex mno-gpopt
20583 Use (do not use) GP-relative accesses for symbols that are known to be
20584 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
20585 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
20586 configurations.
20587
20588 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
20589 might not hold the value of @code{_gp}. For example, if the code is
20590 part of a library that might be used in a boot monitor, programs that
20591 call boot monitor routines pass an unknown value in @code{$gp}.
20592 (In such situations, the boot monitor itself is usually compiled
20593 with @option{-G0}.)
20594
20595 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
20596 @option{-mno-extern-sdata}.
20597
20598 @item -membedded-data
20599 @itemx -mno-embedded-data
20600 @opindex membedded-data
20601 @opindex mno-embedded-data
20602 Allocate variables to the read-only data section first if possible, then
20603 next in the small data section if possible, otherwise in data. This gives
20604 slightly slower code than the default, but reduces the amount of RAM required
20605 when executing, and thus may be preferred for some embedded systems.
20606
20607 @item -muninit-const-in-rodata
20608 @itemx -mno-uninit-const-in-rodata
20609 @opindex muninit-const-in-rodata
20610 @opindex mno-uninit-const-in-rodata
20611 Put uninitialized @code{const} variables in the read-only data section.
20612 This option is only meaningful in conjunction with @option{-membedded-data}.
20613
20614 @item -mcode-readable=@var{setting}
20615 @opindex mcode-readable
20616 Specify whether GCC may generate code that reads from executable sections.
20617 There are three possible settings:
20618
20619 @table @gcctabopt
20620 @item -mcode-readable=yes
20621 Instructions may freely access executable sections. This is the
20622 default setting.
20623
20624 @item -mcode-readable=pcrel
20625 MIPS16 PC-relative load instructions can access executable sections,
20626 but other instructions must not do so. This option is useful on 4KSc
20627 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
20628 It is also useful on processors that can be configured to have a dual
20629 instruction/data SRAM interface and that, like the M4K, automatically
20630 redirect PC-relative loads to the instruction RAM.
20631
20632 @item -mcode-readable=no
20633 Instructions must not access executable sections. This option can be
20634 useful on targets that are configured to have a dual instruction/data
20635 SRAM interface but that (unlike the M4K) do not automatically redirect
20636 PC-relative loads to the instruction RAM.
20637 @end table
20638
20639 @item -msplit-addresses
20640 @itemx -mno-split-addresses
20641 @opindex msplit-addresses
20642 @opindex mno-split-addresses
20643 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
20644 relocation operators. This option has been superseded by
20645 @option{-mexplicit-relocs} but is retained for backwards compatibility.
20646
20647 @item -mexplicit-relocs
20648 @itemx -mno-explicit-relocs
20649 @opindex mexplicit-relocs
20650 @opindex mno-explicit-relocs
20651 Use (do not use) assembler relocation operators when dealing with symbolic
20652 addresses. The alternative, selected by @option{-mno-explicit-relocs},
20653 is to use assembler macros instead.
20654
20655 @option{-mexplicit-relocs} is the default if GCC was configured
20656 to use an assembler that supports relocation operators.
20657
20658 @item -mcheck-zero-division
20659 @itemx -mno-check-zero-division
20660 @opindex mcheck-zero-division
20661 @opindex mno-check-zero-division
20662 Trap (do not trap) on integer division by zero.
20663
20664 The default is @option{-mcheck-zero-division}.
20665
20666 @item -mdivide-traps
20667 @itemx -mdivide-breaks
20668 @opindex mdivide-traps
20669 @opindex mdivide-breaks
20670 MIPS systems check for division by zero by generating either a
20671 conditional trap or a break instruction. Using traps results in
20672 smaller code, but is only supported on MIPS II and later. Also, some
20673 versions of the Linux kernel have a bug that prevents trap from
20674 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
20675 allow conditional traps on architectures that support them and
20676 @option{-mdivide-breaks} to force the use of breaks.
20677
20678 The default is usually @option{-mdivide-traps}, but this can be
20679 overridden at configure time using @option{--with-divide=breaks}.
20680 Divide-by-zero checks can be completely disabled using
20681 @option{-mno-check-zero-division}.
20682
20683 @item -mload-store-pairs
20684 @itemx -mno-load-store-pairs
20685 @opindex mload-store-pairs
20686 @opindex mno-load-store-pairs
20687 Enable (disable) an optimization that pairs consecutive load or store
20688 instructions to enable load/store bonding. This option is enabled by
20689 default but only takes effect when the selected architecture is known
20690 to support bonding.
20691
20692 @item -mmemcpy
20693 @itemx -mno-memcpy
20694 @opindex mmemcpy
20695 @opindex mno-memcpy
20696 Force (do not force) the use of @code{memcpy} for non-trivial block
20697 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
20698 most constant-sized copies.
20699
20700 @item -mlong-calls
20701 @itemx -mno-long-calls
20702 @opindex mlong-calls
20703 @opindex mno-long-calls
20704 Disable (do not disable) use of the @code{jal} instruction. Calling
20705 functions using @code{jal} is more efficient but requires the caller
20706 and callee to be in the same 256 megabyte segment.
20707
20708 This option has no effect on abicalls code. The default is
20709 @option{-mno-long-calls}.
20710
20711 @item -mmad
20712 @itemx -mno-mad
20713 @opindex mmad
20714 @opindex mno-mad
20715 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
20716 instructions, as provided by the R4650 ISA@.
20717
20718 @item -mimadd
20719 @itemx -mno-imadd
20720 @opindex mimadd
20721 @opindex mno-imadd
20722 Enable (disable) use of the @code{madd} and @code{msub} integer
20723 instructions. The default is @option{-mimadd} on architectures
20724 that support @code{madd} and @code{msub} except for the 74k
20725 architecture where it was found to generate slower code.
20726
20727 @item -mfused-madd
20728 @itemx -mno-fused-madd
20729 @opindex mfused-madd
20730 @opindex mno-fused-madd
20731 Enable (disable) use of the floating-point multiply-accumulate
20732 instructions, when they are available. The default is
20733 @option{-mfused-madd}.
20734
20735 On the R8000 CPU when multiply-accumulate instructions are used,
20736 the intermediate product is calculated to infinite precision
20737 and is not subject to the FCSR Flush to Zero bit. This may be
20738 undesirable in some circumstances. On other processors the result
20739 is numerically identical to the equivalent computation using
20740 separate multiply, add, subtract and negate instructions.
20741
20742 @item -nocpp
20743 @opindex nocpp
20744 Tell the MIPS assembler to not run its preprocessor over user
20745 assembler files (with a @samp{.s} suffix) when assembling them.
20746
20747 @item -mfix-24k
20748 @item -mno-fix-24k
20749 @opindex mfix-24k
20750 @opindex mno-fix-24k
20751 Work around the 24K E48 (lost data on stores during refill) errata.
20752 The workarounds are implemented by the assembler rather than by GCC@.
20753
20754 @item -mfix-r4000
20755 @itemx -mno-fix-r4000
20756 @opindex mfix-r4000
20757 @opindex mno-fix-r4000
20758 Work around certain R4000 CPU errata:
20759 @itemize @minus
20760 @item
20761 A double-word or a variable shift may give an incorrect result if executed
20762 immediately after starting an integer division.
20763 @item
20764 A double-word or a variable shift may give an incorrect result if executed
20765 while an integer multiplication is in progress.
20766 @item
20767 An integer division may give an incorrect result if started in a delay slot
20768 of a taken branch or a jump.
20769 @end itemize
20770
20771 @item -mfix-r4400
20772 @itemx -mno-fix-r4400
20773 @opindex mfix-r4400
20774 @opindex mno-fix-r4400
20775 Work around certain R4400 CPU errata:
20776 @itemize @minus
20777 @item
20778 A double-word or a variable shift may give an incorrect result if executed
20779 immediately after starting an integer division.
20780 @end itemize
20781
20782 @item -mfix-r10000
20783 @itemx -mno-fix-r10000
20784 @opindex mfix-r10000
20785 @opindex mno-fix-r10000
20786 Work around certain R10000 errata:
20787 @itemize @minus
20788 @item
20789 @code{ll}/@code{sc} sequences may not behave atomically on revisions
20790 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
20791 @end itemize
20792
20793 This option can only be used if the target architecture supports
20794 branch-likely instructions. @option{-mfix-r10000} is the default when
20795 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
20796 otherwise.
20797
20798 @item -mfix-rm7000
20799 @itemx -mno-fix-rm7000
20800 @opindex mfix-rm7000
20801 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
20802 workarounds are implemented by the assembler rather than by GCC@.
20803
20804 @item -mfix-vr4120
20805 @itemx -mno-fix-vr4120
20806 @opindex mfix-vr4120
20807 Work around certain VR4120 errata:
20808 @itemize @minus
20809 @item
20810 @code{dmultu} does not always produce the correct result.
20811 @item
20812 @code{div} and @code{ddiv} do not always produce the correct result if one
20813 of the operands is negative.
20814 @end itemize
20815 The workarounds for the division errata rely on special functions in
20816 @file{libgcc.a}. At present, these functions are only provided by
20817 the @code{mips64vr*-elf} configurations.
20818
20819 Other VR4120 errata require a NOP to be inserted between certain pairs of
20820 instructions. These errata are handled by the assembler, not by GCC itself.
20821
20822 @item -mfix-vr4130
20823 @opindex mfix-vr4130
20824 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
20825 workarounds are implemented by the assembler rather than by GCC,
20826 although GCC avoids using @code{mflo} and @code{mfhi} if the
20827 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
20828 instructions are available instead.
20829
20830 @item -mfix-sb1
20831 @itemx -mno-fix-sb1
20832 @opindex mfix-sb1
20833 Work around certain SB-1 CPU core errata.
20834 (This flag currently works around the SB-1 revision 2
20835 ``F1'' and ``F2'' floating-point errata.)
20836
20837 @item -mr10k-cache-barrier=@var{setting}
20838 @opindex mr10k-cache-barrier
20839 Specify whether GCC should insert cache barriers to avoid the
20840 side-effects of speculation on R10K processors.
20841
20842 In common with many processors, the R10K tries to predict the outcome
20843 of a conditional branch and speculatively executes instructions from
20844 the ``taken'' branch. It later aborts these instructions if the
20845 predicted outcome is wrong. However, on the R10K, even aborted
20846 instructions can have side effects.
20847
20848 This problem only affects kernel stores and, depending on the system,
20849 kernel loads. As an example, a speculatively-executed store may load
20850 the target memory into cache and mark the cache line as dirty, even if
20851 the store itself is later aborted. If a DMA operation writes to the
20852 same area of memory before the ``dirty'' line is flushed, the cached
20853 data overwrites the DMA-ed data. See the R10K processor manual
20854 for a full description, including other potential problems.
20855
20856 One workaround is to insert cache barrier instructions before every memory
20857 access that might be speculatively executed and that might have side
20858 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
20859 controls GCC's implementation of this workaround. It assumes that
20860 aborted accesses to any byte in the following regions does not have
20861 side effects:
20862
20863 @enumerate
20864 @item
20865 the memory occupied by the current function's stack frame;
20866
20867 @item
20868 the memory occupied by an incoming stack argument;
20869
20870 @item
20871 the memory occupied by an object with a link-time-constant address.
20872 @end enumerate
20873
20874 It is the kernel's responsibility to ensure that speculative
20875 accesses to these regions are indeed safe.
20876
20877 If the input program contains a function declaration such as:
20878
20879 @smallexample
20880 void foo (void);
20881 @end smallexample
20882
20883 then the implementation of @code{foo} must allow @code{j foo} and
20884 @code{jal foo} to be executed speculatively. GCC honors this
20885 restriction for functions it compiles itself. It expects non-GCC
20886 functions (such as hand-written assembly code) to do the same.
20887
20888 The option has three forms:
20889
20890 @table @gcctabopt
20891 @item -mr10k-cache-barrier=load-store
20892 Insert a cache barrier before a load or store that might be
20893 speculatively executed and that might have side effects even
20894 if aborted.
20895
20896 @item -mr10k-cache-barrier=store
20897 Insert a cache barrier before a store that might be speculatively
20898 executed and that might have side effects even if aborted.
20899
20900 @item -mr10k-cache-barrier=none
20901 Disable the insertion of cache barriers. This is the default setting.
20902 @end table
20903
20904 @item -mflush-func=@var{func}
20905 @itemx -mno-flush-func
20906 @opindex mflush-func
20907 Specifies the function to call to flush the I and D caches, or to not
20908 call any such function. If called, the function must take the same
20909 arguments as the common @code{_flush_func}, that is, the address of the
20910 memory range for which the cache is being flushed, the size of the
20911 memory range, and the number 3 (to flush both caches). The default
20912 depends on the target GCC was configured for, but commonly is either
20913 @code{_flush_func} or @code{__cpu_flush}.
20914
20915 @item mbranch-cost=@var{num}
20916 @opindex mbranch-cost
20917 Set the cost of branches to roughly @var{num} ``simple'' instructions.
20918 This cost is only a heuristic and is not guaranteed to produce
20919 consistent results across releases. A zero cost redundantly selects
20920 the default, which is based on the @option{-mtune} setting.
20921
20922 @item -mbranch-likely
20923 @itemx -mno-branch-likely
20924 @opindex mbranch-likely
20925 @opindex mno-branch-likely
20926 Enable or disable use of Branch Likely instructions, regardless of the
20927 default for the selected architecture. By default, Branch Likely
20928 instructions may be generated if they are supported by the selected
20929 architecture. An exception is for the MIPS32 and MIPS64 architectures
20930 and processors that implement those architectures; for those, Branch
20931 Likely instructions are not be generated by default because the MIPS32
20932 and MIPS64 architectures specifically deprecate their use.
20933
20934 @item -mcompact-branches=never
20935 @itemx -mcompact-branches=optimal
20936 @itemx -mcompact-branches=always
20937 @opindex mcompact-branches=never
20938 @opindex mcompact-branches=optimal
20939 @opindex mcompact-branches=always
20940 These options control which form of branches will be generated. The
20941 default is @option{-mcompact-branches=optimal}.
20942
20943 The @option{-mcompact-branches=never} option ensures that compact branch
20944 instructions will never be generated.
20945
20946 The @option{-mcompact-branches=always} option ensures that a compact
20947 branch instruction will be generated if available. If a compact branch
20948 instruction is not available, a delay slot form of the branch will be
20949 used instead.
20950
20951 This option is supported from MIPS Release 6 onwards.
20952
20953 The @option{-mcompact-branches=optimal} option will cause a delay slot
20954 branch to be used if one is available in the current ISA and the delay
20955 slot is successfully filled. If the delay slot is not filled, a compact
20956 branch will be chosen if one is available.
20957
20958 @item -mfp-exceptions
20959 @itemx -mno-fp-exceptions
20960 @opindex mfp-exceptions
20961 Specifies whether FP exceptions are enabled. This affects how
20962 FP instructions are scheduled for some processors.
20963 The default is that FP exceptions are
20964 enabled.
20965
20966 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
20967 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
20968 FP pipe.
20969
20970 @item -mvr4130-align
20971 @itemx -mno-vr4130-align
20972 @opindex mvr4130-align
20973 The VR4130 pipeline is two-way superscalar, but can only issue two
20974 instructions together if the first one is 8-byte aligned. When this
20975 option is enabled, GCC aligns pairs of instructions that it
20976 thinks should execute in parallel.
20977
20978 This option only has an effect when optimizing for the VR4130.
20979 It normally makes code faster, but at the expense of making it bigger.
20980 It is enabled by default at optimization level @option{-O3}.
20981
20982 @item -msynci
20983 @itemx -mno-synci
20984 @opindex msynci
20985 Enable (disable) generation of @code{synci} instructions on
20986 architectures that support it. The @code{synci} instructions (if
20987 enabled) are generated when @code{__builtin___clear_cache} is
20988 compiled.
20989
20990 This option defaults to @option{-mno-synci}, but the default can be
20991 overridden by configuring GCC with @option{--with-synci}.
20992
20993 When compiling code for single processor systems, it is generally safe
20994 to use @code{synci}. However, on many multi-core (SMP) systems, it
20995 does not invalidate the instruction caches on all cores and may lead
20996 to undefined behavior.
20997
20998 @item -mrelax-pic-calls
20999 @itemx -mno-relax-pic-calls
21000 @opindex mrelax-pic-calls
21001 Try to turn PIC calls that are normally dispatched via register
21002 @code{$25} into direct calls. This is only possible if the linker can
21003 resolve the destination at link time and if the destination is within
21004 range for a direct call.
21005
21006 @option{-mrelax-pic-calls} is the default if GCC was configured to use
21007 an assembler and a linker that support the @code{.reloc} assembly
21008 directive and @option{-mexplicit-relocs} is in effect. With
21009 @option{-mno-explicit-relocs}, this optimization can be performed by the
21010 assembler and the linker alone without help from the compiler.
21011
21012 @item -mmcount-ra-address
21013 @itemx -mno-mcount-ra-address
21014 @opindex mmcount-ra-address
21015 @opindex mno-mcount-ra-address
21016 Emit (do not emit) code that allows @code{_mcount} to modify the
21017 calling function's return address. When enabled, this option extends
21018 the usual @code{_mcount} interface with a new @var{ra-address}
21019 parameter, which has type @code{intptr_t *} and is passed in register
21020 @code{$12}. @code{_mcount} can then modify the return address by
21021 doing both of the following:
21022 @itemize
21023 @item
21024 Returning the new address in register @code{$31}.
21025 @item
21026 Storing the new address in @code{*@var{ra-address}},
21027 if @var{ra-address} is nonnull.
21028 @end itemize
21029
21030 The default is @option{-mno-mcount-ra-address}.
21031
21032 @item -mframe-header-opt
21033 @itemx -mno-frame-header-opt
21034 @opindex mframe-header-opt
21035 Enable (disable) frame header optimization in the o32 ABI. When using the
21036 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
21037 function to write out register arguments. When enabled, this optimization
21038 will suppress the allocation of the frame header if it can be determined that
21039 it is unused.
21040
21041 This optimization is off by default at all optimization levels.
21042
21043 @item -mlxc1-sxc1
21044 @itemx -mno-lxc1-sxc1
21045 @opindex mlxc1-sxc1
21046 When applicable, enable (disable) the generation of @code{lwxc1},
21047 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
21048
21049 @item -mmadd4
21050 @itemx -mno-madd4
21051 @opindex mmadd4
21052 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
21053 @code{madd.d} and related instructions. Enabled by default.
21054
21055 @end table
21056
21057 @node MMIX Options
21058 @subsection MMIX Options
21059 @cindex MMIX Options
21060
21061 These options are defined for the MMIX:
21062
21063 @table @gcctabopt
21064 @item -mlibfuncs
21065 @itemx -mno-libfuncs
21066 @opindex mlibfuncs
21067 @opindex mno-libfuncs
21068 Specify that intrinsic library functions are being compiled, passing all
21069 values in registers, no matter the size.
21070
21071 @item -mepsilon
21072 @itemx -mno-epsilon
21073 @opindex mepsilon
21074 @opindex mno-epsilon
21075 Generate floating-point comparison instructions that compare with respect
21076 to the @code{rE} epsilon register.
21077
21078 @item -mabi=mmixware
21079 @itemx -mabi=gnu
21080 @opindex mabi=mmixware
21081 @opindex mabi=gnu
21082 Generate code that passes function parameters and return values that (in
21083 the called function) are seen as registers @code{$0} and up, as opposed to
21084 the GNU ABI which uses global registers @code{$231} and up.
21085
21086 @item -mzero-extend
21087 @itemx -mno-zero-extend
21088 @opindex mzero-extend
21089 @opindex mno-zero-extend
21090 When reading data from memory in sizes shorter than 64 bits, use (do not
21091 use) zero-extending load instructions by default, rather than
21092 sign-extending ones.
21093
21094 @item -mknuthdiv
21095 @itemx -mno-knuthdiv
21096 @opindex mknuthdiv
21097 @opindex mno-knuthdiv
21098 Make the result of a division yielding a remainder have the same sign as
21099 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
21100 remainder follows the sign of the dividend. Both methods are
21101 arithmetically valid, the latter being almost exclusively used.
21102
21103 @item -mtoplevel-symbols
21104 @itemx -mno-toplevel-symbols
21105 @opindex mtoplevel-symbols
21106 @opindex mno-toplevel-symbols
21107 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
21108 code can be used with the @code{PREFIX} assembly directive.
21109
21110 @item -melf
21111 @opindex melf
21112 Generate an executable in the ELF format, rather than the default
21113 @samp{mmo} format used by the @command{mmix} simulator.
21114
21115 @item -mbranch-predict
21116 @itemx -mno-branch-predict
21117 @opindex mbranch-predict
21118 @opindex mno-branch-predict
21119 Use (do not use) the probable-branch instructions, when static branch
21120 prediction indicates a probable branch.
21121
21122 @item -mbase-addresses
21123 @itemx -mno-base-addresses
21124 @opindex mbase-addresses
21125 @opindex mno-base-addresses
21126 Generate (do not generate) code that uses @emph{base addresses}. Using a
21127 base address automatically generates a request (handled by the assembler
21128 and the linker) for a constant to be set up in a global register. The
21129 register is used for one or more base address requests within the range 0
21130 to 255 from the value held in the register. The generally leads to short
21131 and fast code, but the number of different data items that can be
21132 addressed is limited. This means that a program that uses lots of static
21133 data may require @option{-mno-base-addresses}.
21134
21135 @item -msingle-exit
21136 @itemx -mno-single-exit
21137 @opindex msingle-exit
21138 @opindex mno-single-exit
21139 Force (do not force) generated code to have a single exit point in each
21140 function.
21141 @end table
21142
21143 @node MN10300 Options
21144 @subsection MN10300 Options
21145 @cindex MN10300 options
21146
21147 These @option{-m} options are defined for Matsushita MN10300 architectures:
21148
21149 @table @gcctabopt
21150 @item -mmult-bug
21151 @opindex mmult-bug
21152 Generate code to avoid bugs in the multiply instructions for the MN10300
21153 processors. This is the default.
21154
21155 @item -mno-mult-bug
21156 @opindex mno-mult-bug
21157 Do not generate code to avoid bugs in the multiply instructions for the
21158 MN10300 processors.
21159
21160 @item -mam33
21161 @opindex mam33
21162 Generate code using features specific to the AM33 processor.
21163
21164 @item -mno-am33
21165 @opindex mno-am33
21166 Do not generate code using features specific to the AM33 processor. This
21167 is the default.
21168
21169 @item -mam33-2
21170 @opindex mam33-2
21171 Generate code using features specific to the AM33/2.0 processor.
21172
21173 @item -mam34
21174 @opindex mam34
21175 Generate code using features specific to the AM34 processor.
21176
21177 @item -mtune=@var{cpu-type}
21178 @opindex mtune
21179 Use the timing characteristics of the indicated CPU type when
21180 scheduling instructions. This does not change the targeted processor
21181 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
21182 @samp{am33-2} or @samp{am34}.
21183
21184 @item -mreturn-pointer-on-d0
21185 @opindex mreturn-pointer-on-d0
21186 When generating a function that returns a pointer, return the pointer
21187 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
21188 only in @code{a0}, and attempts to call such functions without a prototype
21189 result in errors. Note that this option is on by default; use
21190 @option{-mno-return-pointer-on-d0} to disable it.
21191
21192 @item -mno-crt0
21193 @opindex mno-crt0
21194 Do not link in the C run-time initialization object file.
21195
21196 @item -mrelax
21197 @opindex mrelax
21198 Indicate to the linker that it should perform a relaxation optimization pass
21199 to shorten branches, calls and absolute memory addresses. This option only
21200 has an effect when used on the command line for the final link step.
21201
21202 This option makes symbolic debugging impossible.
21203
21204 @item -mliw
21205 @opindex mliw
21206 Allow the compiler to generate @emph{Long Instruction Word}
21207 instructions if the target is the @samp{AM33} or later. This is the
21208 default. This option defines the preprocessor macro @code{__LIW__}.
21209
21210 @item -mnoliw
21211 @opindex mnoliw
21212 Do not allow the compiler to generate @emph{Long Instruction Word}
21213 instructions. This option defines the preprocessor macro
21214 @code{__NO_LIW__}.
21215
21216 @item -msetlb
21217 @opindex msetlb
21218 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
21219 instructions if the target is the @samp{AM33} or later. This is the
21220 default. This option defines the preprocessor macro @code{__SETLB__}.
21221
21222 @item -mnosetlb
21223 @opindex mnosetlb
21224 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
21225 instructions. This option defines the preprocessor macro
21226 @code{__NO_SETLB__}.
21227
21228 @end table
21229
21230 @node Moxie Options
21231 @subsection Moxie Options
21232 @cindex Moxie Options
21233
21234 @table @gcctabopt
21235
21236 @item -meb
21237 @opindex meb
21238 Generate big-endian code. This is the default for @samp{moxie-*-*}
21239 configurations.
21240
21241 @item -mel
21242 @opindex mel
21243 Generate little-endian code.
21244
21245 @item -mmul.x
21246 @opindex mmul.x
21247 Generate mul.x and umul.x instructions. This is the default for
21248 @samp{moxiebox-*-*} configurations.
21249
21250 @item -mno-crt0
21251 @opindex mno-crt0
21252 Do not link in the C run-time initialization object file.
21253
21254 @end table
21255
21256 @node MSP430 Options
21257 @subsection MSP430 Options
21258 @cindex MSP430 Options
21259
21260 These options are defined for the MSP430:
21261
21262 @table @gcctabopt
21263
21264 @item -masm-hex
21265 @opindex masm-hex
21266 Force assembly output to always use hex constants. Normally such
21267 constants are signed decimals, but this option is available for
21268 testsuite and/or aesthetic purposes.
21269
21270 @item -mmcu=
21271 @opindex mmcu=
21272 Select the MCU to target. This is used to create a C preprocessor
21273 symbol based upon the MCU name, converted to upper case and pre- and
21274 post-fixed with @samp{__}. This in turn is used by the
21275 @file{msp430.h} header file to select an MCU-specific supplementary
21276 header file.
21277
21278 The option also sets the ISA to use. If the MCU name is one that is
21279 known to only support the 430 ISA then that is selected, otherwise the
21280 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
21281 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
21282 name selects the 430X ISA.
21283
21284 In addition an MCU-specific linker script is added to the linker
21285 command line. The script's name is the name of the MCU with
21286 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
21287 command line defines the C preprocessor symbol @code{__XXX__} and
21288 cause the linker to search for a script called @file{xxx.ld}.
21289
21290 This option is also passed on to the assembler.
21291
21292 @item -mwarn-mcu
21293 @itemx -mno-warn-mcu
21294 @opindex mwarn-mcu
21295 @opindex mno-warn-mcu
21296 This option enables or disables warnings about conflicts between the
21297 MCU name specified by the @option{-mmcu} option and the ISA set by the
21298 @option{-mcpu} option and/or the hardware multiply support set by the
21299 @option{-mhwmult} option. It also toggles warnings about unrecognized
21300 MCU names. This option is on by default.
21301
21302 @item -mcpu=
21303 @opindex mcpu=
21304 Specifies the ISA to use. Accepted values are @samp{msp430},
21305 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
21306 @option{-mmcu=} option should be used to select the ISA.
21307
21308 @item -msim
21309 @opindex msim
21310 Link to the simulator runtime libraries and linker script. Overrides
21311 any scripts that would be selected by the @option{-mmcu=} option.
21312
21313 @item -mlarge
21314 @opindex mlarge
21315 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
21316
21317 @item -msmall
21318 @opindex msmall
21319 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
21320
21321 @item -mrelax
21322 @opindex mrelax
21323 This option is passed to the assembler and linker, and allows the
21324 linker to perform certain optimizations that cannot be done until
21325 the final link.
21326
21327 @item mhwmult=
21328 @opindex mhwmult=
21329 Describes the type of hardware multiply supported by the target.
21330 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
21331 for the original 16-bit-only multiply supported by early MCUs.
21332 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
21333 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
21334 A value of @samp{auto} can also be given. This tells GCC to deduce
21335 the hardware multiply support based upon the MCU name provided by the
21336 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
21337 the MCU name is not recognized then no hardware multiply support is
21338 assumed. @code{auto} is the default setting.
21339
21340 Hardware multiplies are normally performed by calling a library
21341 routine. This saves space in the generated code. When compiling at
21342 @option{-O3} or higher however the hardware multiplier is invoked
21343 inline. This makes for bigger, but faster code.
21344
21345 The hardware multiply routines disable interrupts whilst running and
21346 restore the previous interrupt state when they finish. This makes
21347 them safe to use inside interrupt handlers as well as in normal code.
21348
21349 @item -minrt
21350 @opindex minrt
21351 Enable the use of a minimum runtime environment - no static
21352 initializers or constructors. This is intended for memory-constrained
21353 devices. The compiler includes special symbols in some objects
21354 that tell the linker and runtime which code fragments are required.
21355
21356 @item -mcode-region=
21357 @itemx -mdata-region=
21358 @opindex mcode-region
21359 @opindex mdata-region
21360 These options tell the compiler where to place functions and data that
21361 do not have one of the @code{lower}, @code{upper}, @code{either} or
21362 @code{section} attributes. Possible values are @code{lower},
21363 @code{upper}, @code{either} or @code{any}. The first three behave
21364 like the corresponding attribute. The fourth possible value -
21365 @code{any} - is the default. It leaves placement entirely up to the
21366 linker script and how it assigns the standard sections
21367 (@code{.text}, @code{.data}, etc) to the memory regions.
21368
21369 @item -msilicon-errata=
21370 @opindex msilicon-errata
21371 This option passes on a request to assembler to enable the fixes for
21372 the named silicon errata.
21373
21374 @item -msilicon-errata-warn=
21375 @opindex msilicon-errata-warn
21376 This option passes on a request to the assembler to enable warning
21377 messages when a silicon errata might need to be applied.
21378
21379 @end table
21380
21381 @node NDS32 Options
21382 @subsection NDS32 Options
21383 @cindex NDS32 Options
21384
21385 These options are defined for NDS32 implementations:
21386
21387 @table @gcctabopt
21388
21389 @item -mbig-endian
21390 @opindex mbig-endian
21391 Generate code in big-endian mode.
21392
21393 @item -mlittle-endian
21394 @opindex mlittle-endian
21395 Generate code in little-endian mode.
21396
21397 @item -mreduced-regs
21398 @opindex mreduced-regs
21399 Use reduced-set registers for register allocation.
21400
21401 @item -mfull-regs
21402 @opindex mfull-regs
21403 Use full-set registers for register allocation.
21404
21405 @item -mcmov
21406 @opindex mcmov
21407 Generate conditional move instructions.
21408
21409 @item -mno-cmov
21410 @opindex mno-cmov
21411 Do not generate conditional move instructions.
21412
21413 @item -mext-perf
21414 @opindex mperf-ext
21415 Generate performance extension instructions.
21416
21417 @item -mno-ext-perf
21418 @opindex mno-perf-ext
21419 Do not generate performance extension instructions.
21420
21421 @item -mext-perf2
21422 @opindex mperf-ext
21423 Generate performance extension 2 instructions.
21424
21425 @item -mno-ext-perf2
21426 @opindex mno-perf-ext
21427 Do not generate performance extension 2 instructions.
21428
21429 @item -mext-string
21430 @opindex mperf-ext
21431 Generate string extension instructions.
21432
21433 @item -mno-ext-string
21434 @opindex mno-perf-ext
21435 Do not generate string extension instructions.
21436
21437 @item -mv3push
21438 @opindex mv3push
21439 Generate v3 push25/pop25 instructions.
21440
21441 @item -mno-v3push
21442 @opindex mno-v3push
21443 Do not generate v3 push25/pop25 instructions.
21444
21445 @item -m16-bit
21446 @opindex m16-bit
21447 Generate 16-bit instructions.
21448
21449 @item -mno-16-bit
21450 @opindex mno-16-bit
21451 Do not generate 16-bit instructions.
21452
21453 @item -misr-vector-size=@var{num}
21454 @opindex misr-vector-size
21455 Specify the size of each interrupt vector, which must be 4 or 16.
21456
21457 @item -mcache-block-size=@var{num}
21458 @opindex mcache-block-size
21459 Specify the size of each cache block,
21460 which must be a power of 2 between 4 and 512.
21461
21462 @item -march=@var{arch}
21463 @opindex march
21464 Specify the name of the target architecture.
21465
21466 @item -mcmodel=@var{code-model}
21467 @opindex mcmodel
21468 Set the code model to one of
21469 @table @asis
21470 @item @samp{small}
21471 All the data and read-only data segments must be within 512KB addressing space.
21472 The text segment must be within 16MB addressing space.
21473 @item @samp{medium}
21474 The data segment must be within 512KB while the read-only data segment can be
21475 within 4GB addressing space. The text segment should be still within 16MB
21476 addressing space.
21477 @item @samp{large}
21478 All the text and data segments can be within 4GB addressing space.
21479 @end table
21480
21481 @item -mctor-dtor
21482 @opindex mctor-dtor
21483 Enable constructor/destructor feature.
21484
21485 @item -mrelax
21486 @opindex mrelax
21487 Guide linker to relax instructions.
21488
21489 @end table
21490
21491 @node Nios II Options
21492 @subsection Nios II Options
21493 @cindex Nios II options
21494 @cindex Altera Nios II options
21495
21496 These are the options defined for the Altera Nios II processor.
21497
21498 @table @gcctabopt
21499
21500 @item -G @var{num}
21501 @opindex G
21502 @cindex smaller data references
21503 Put global and static objects less than or equal to @var{num} bytes
21504 into the small data or BSS sections instead of the normal data or BSS
21505 sections. The default value of @var{num} is 8.
21506
21507 @item -mgpopt=@var{option}
21508 @item -mgpopt
21509 @itemx -mno-gpopt
21510 @opindex mgpopt
21511 @opindex mno-gpopt
21512 Generate (do not generate) GP-relative accesses. The following
21513 @var{option} names are recognized:
21514
21515 @table @samp
21516
21517 @item none
21518 Do not generate GP-relative accesses.
21519
21520 @item local
21521 Generate GP-relative accesses for small data objects that are not
21522 external, weak, or uninitialized common symbols.
21523 Also use GP-relative addressing for objects that
21524 have been explicitly placed in a small data section via a @code{section}
21525 attribute.
21526
21527 @item global
21528 As for @samp{local}, but also generate GP-relative accesses for
21529 small data objects that are external, weak, or common. If you use this option,
21530 you must ensure that all parts of your program (including libraries) are
21531 compiled with the same @option{-G} setting.
21532
21533 @item data
21534 Generate GP-relative accesses for all data objects in the program. If you
21535 use this option, the entire data and BSS segments
21536 of your program must fit in 64K of memory and you must use an appropriate
21537 linker script to allocate them within the addressable range of the
21538 global pointer.
21539
21540 @item all
21541 Generate GP-relative addresses for function pointers as well as data
21542 pointers. If you use this option, the entire text, data, and BSS segments
21543 of your program must fit in 64K of memory and you must use an appropriate
21544 linker script to allocate them within the addressable range of the
21545 global pointer.
21546
21547 @end table
21548
21549 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
21550 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
21551
21552 The default is @option{-mgpopt} except when @option{-fpic} or
21553 @option{-fPIC} is specified to generate position-independent code.
21554 Note that the Nios II ABI does not permit GP-relative accesses from
21555 shared libraries.
21556
21557 You may need to specify @option{-mno-gpopt} explicitly when building
21558 programs that include large amounts of small data, including large
21559 GOT data sections. In this case, the 16-bit offset for GP-relative
21560 addressing may not be large enough to allow access to the entire
21561 small data section.
21562
21563 @item -mgprel-sec=@var{regexp}
21564 @opindex mgprel-sec
21565 This option specifies additional section names that can be accessed via
21566 GP-relative addressing. It is most useful in conjunction with
21567 @code{section} attributes on variable declarations
21568 (@pxref{Common Variable Attributes}) and a custom linker script.
21569 The @var{regexp} is a POSIX Extended Regular Expression.
21570
21571 This option does not affect the behavior of the @option{-G} option, and
21572 and the specified sections are in addition to the standard @code{.sdata}
21573 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
21574
21575 @item -mr0rel-sec=@var{regexp}
21576 @opindex mr0rel-sec
21577 This option specifies names of sections that can be accessed via a
21578 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
21579 of the 32-bit address space. It is most useful in conjunction with
21580 @code{section} attributes on variable declarations
21581 (@pxref{Common Variable Attributes}) and a custom linker script.
21582 The @var{regexp} is a POSIX Extended Regular Expression.
21583
21584 In contrast to the use of GP-relative addressing for small data,
21585 zero-based addressing is never generated by default and there are no
21586 conventional section names used in standard linker scripts for sections
21587 in the low or high areas of memory.
21588
21589 @item -mel
21590 @itemx -meb
21591 @opindex mel
21592 @opindex meb
21593 Generate little-endian (default) or big-endian (experimental) code,
21594 respectively.
21595
21596 @item -march=@var{arch}
21597 @opindex march
21598 This specifies the name of the target Nios II architecture. GCC uses this
21599 name to determine what kind of instructions it can emit when generating
21600 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
21601
21602 The preprocessor macro @code{__nios2_arch__} is available to programs,
21603 with value 1 or 2, indicating the targeted ISA level.
21604
21605 @item -mbypass-cache
21606 @itemx -mno-bypass-cache
21607 @opindex mno-bypass-cache
21608 @opindex mbypass-cache
21609 Force all load and store instructions to always bypass cache by
21610 using I/O variants of the instructions. The default is not to
21611 bypass the cache.
21612
21613 @item -mno-cache-volatile
21614 @itemx -mcache-volatile
21615 @opindex mcache-volatile
21616 @opindex mno-cache-volatile
21617 Volatile memory access bypass the cache using the I/O variants of
21618 the load and store instructions. The default is not to bypass the cache.
21619
21620 @item -mno-fast-sw-div
21621 @itemx -mfast-sw-div
21622 @opindex mno-fast-sw-div
21623 @opindex mfast-sw-div
21624 Do not use table-based fast divide for small numbers. The default
21625 is to use the fast divide at @option{-O3} and above.
21626
21627 @item -mno-hw-mul
21628 @itemx -mhw-mul
21629 @itemx -mno-hw-mulx
21630 @itemx -mhw-mulx
21631 @itemx -mno-hw-div
21632 @itemx -mhw-div
21633 @opindex mno-hw-mul
21634 @opindex mhw-mul
21635 @opindex mno-hw-mulx
21636 @opindex mhw-mulx
21637 @opindex mno-hw-div
21638 @opindex mhw-div
21639 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
21640 instructions by the compiler. The default is to emit @code{mul}
21641 and not emit @code{div} and @code{mulx}.
21642
21643 @item -mbmx
21644 @itemx -mno-bmx
21645 @itemx -mcdx
21646 @itemx -mno-cdx
21647 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
21648 CDX (code density) instructions. Enabling these instructions also
21649 requires @option{-march=r2}. Since these instructions are optional
21650 extensions to the R2 architecture, the default is not to emit them.
21651
21652 @item -mcustom-@var{insn}=@var{N}
21653 @itemx -mno-custom-@var{insn}
21654 @opindex mcustom-@var{insn}
21655 @opindex mno-custom-@var{insn}
21656 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
21657 custom instruction with encoding @var{N} when generating code that uses
21658 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
21659 instruction 253 for single-precision floating-point add operations instead
21660 of the default behavior of using a library call.
21661
21662 The following values of @var{insn} are supported. Except as otherwise
21663 noted, floating-point operations are expected to be implemented with
21664 normal IEEE 754 semantics and correspond directly to the C operators or the
21665 equivalent GCC built-in functions (@pxref{Other Builtins}).
21666
21667 Single-precision floating point:
21668 @table @asis
21669
21670 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
21671 Binary arithmetic operations.
21672
21673 @item @samp{fnegs}
21674 Unary negation.
21675
21676 @item @samp{fabss}
21677 Unary absolute value.
21678
21679 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
21680 Comparison operations.
21681
21682 @item @samp{fmins}, @samp{fmaxs}
21683 Floating-point minimum and maximum. These instructions are only
21684 generated if @option{-ffinite-math-only} is specified.
21685
21686 @item @samp{fsqrts}
21687 Unary square root operation.
21688
21689 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
21690 Floating-point trigonometric and exponential functions. These instructions
21691 are only generated if @option{-funsafe-math-optimizations} is also specified.
21692
21693 @end table
21694
21695 Double-precision floating point:
21696 @table @asis
21697
21698 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
21699 Binary arithmetic operations.
21700
21701 @item @samp{fnegd}
21702 Unary negation.
21703
21704 @item @samp{fabsd}
21705 Unary absolute value.
21706
21707 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
21708 Comparison operations.
21709
21710 @item @samp{fmind}, @samp{fmaxd}
21711 Double-precision minimum and maximum. These instructions are only
21712 generated if @option{-ffinite-math-only} is specified.
21713
21714 @item @samp{fsqrtd}
21715 Unary square root operation.
21716
21717 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
21718 Double-precision trigonometric and exponential functions. These instructions
21719 are only generated if @option{-funsafe-math-optimizations} is also specified.
21720
21721 @end table
21722
21723 Conversions:
21724 @table @asis
21725 @item @samp{fextsd}
21726 Conversion from single precision to double precision.
21727
21728 @item @samp{ftruncds}
21729 Conversion from double precision to single precision.
21730
21731 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
21732 Conversion from floating point to signed or unsigned integer types, with
21733 truncation towards zero.
21734
21735 @item @samp{round}
21736 Conversion from single-precision floating point to signed integer,
21737 rounding to the nearest integer and ties away from zero.
21738 This corresponds to the @code{__builtin_lroundf} function when
21739 @option{-fno-math-errno} is used.
21740
21741 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
21742 Conversion from signed or unsigned integer types to floating-point types.
21743
21744 @end table
21745
21746 In addition, all of the following transfer instructions for internal
21747 registers X and Y must be provided to use any of the double-precision
21748 floating-point instructions. Custom instructions taking two
21749 double-precision source operands expect the first operand in the
21750 64-bit register X. The other operand (or only operand of a unary
21751 operation) is given to the custom arithmetic instruction with the
21752 least significant half in source register @var{src1} and the most
21753 significant half in @var{src2}. A custom instruction that returns a
21754 double-precision result returns the most significant 32 bits in the
21755 destination register and the other half in 32-bit register Y.
21756 GCC automatically generates the necessary code sequences to write
21757 register X and/or read register Y when double-precision floating-point
21758 instructions are used.
21759
21760 @table @asis
21761
21762 @item @samp{fwrx}
21763 Write @var{src1} into the least significant half of X and @var{src2} into
21764 the most significant half of X.
21765
21766 @item @samp{fwry}
21767 Write @var{src1} into Y.
21768
21769 @item @samp{frdxhi}, @samp{frdxlo}
21770 Read the most or least (respectively) significant half of X and store it in
21771 @var{dest}.
21772
21773 @item @samp{frdy}
21774 Read the value of Y and store it into @var{dest}.
21775 @end table
21776
21777 Note that you can gain more local control over generation of Nios II custom
21778 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
21779 and @code{target("no-custom-@var{insn}")} function attributes
21780 (@pxref{Function Attributes})
21781 or pragmas (@pxref{Function Specific Option Pragmas}).
21782
21783 @item -mcustom-fpu-cfg=@var{name}
21784 @opindex mcustom-fpu-cfg
21785
21786 This option enables a predefined, named set of custom instruction encodings
21787 (see @option{-mcustom-@var{insn}} above).
21788 Currently, the following sets are defined:
21789
21790 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
21791 @gccoptlist{-mcustom-fmuls=252 @gol
21792 -mcustom-fadds=253 @gol
21793 -mcustom-fsubs=254 @gol
21794 -fsingle-precision-constant}
21795
21796 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
21797 @gccoptlist{-mcustom-fmuls=252 @gol
21798 -mcustom-fadds=253 @gol
21799 -mcustom-fsubs=254 @gol
21800 -mcustom-fdivs=255 @gol
21801 -fsingle-precision-constant}
21802
21803 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
21804 @gccoptlist{-mcustom-floatus=243 @gol
21805 -mcustom-fixsi=244 @gol
21806 -mcustom-floatis=245 @gol
21807 -mcustom-fcmpgts=246 @gol
21808 -mcustom-fcmples=249 @gol
21809 -mcustom-fcmpeqs=250 @gol
21810 -mcustom-fcmpnes=251 @gol
21811 -mcustom-fmuls=252 @gol
21812 -mcustom-fadds=253 @gol
21813 -mcustom-fsubs=254 @gol
21814 -mcustom-fdivs=255 @gol
21815 -fsingle-precision-constant}
21816
21817 Custom instruction assignments given by individual
21818 @option{-mcustom-@var{insn}=} options override those given by
21819 @option{-mcustom-fpu-cfg=}, regardless of the
21820 order of the options on the command line.
21821
21822 Note that you can gain more local control over selection of a FPU
21823 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
21824 function attribute (@pxref{Function Attributes})
21825 or pragma (@pxref{Function Specific Option Pragmas}).
21826
21827 @end table
21828
21829 These additional @samp{-m} options are available for the Altera Nios II
21830 ELF (bare-metal) target:
21831
21832 @table @gcctabopt
21833
21834 @item -mhal
21835 @opindex mhal
21836 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
21837 startup and termination code, and is typically used in conjunction with
21838 @option{-msys-crt0=} to specify the location of the alternate startup code
21839 provided by the HAL BSP.
21840
21841 @item -msmallc
21842 @opindex msmallc
21843 Link with a limited version of the C library, @option{-lsmallc}, rather than
21844 Newlib.
21845
21846 @item -msys-crt0=@var{startfile}
21847 @opindex msys-crt0
21848 @var{startfile} is the file name of the startfile (crt0) to use
21849 when linking. This option is only useful in conjunction with @option{-mhal}.
21850
21851 @item -msys-lib=@var{systemlib}
21852 @opindex msys-lib
21853 @var{systemlib} is the library name of the library that provides
21854 low-level system calls required by the C library,
21855 e.g. @code{read} and @code{write}.
21856 This option is typically used to link with a library provided by a HAL BSP.
21857
21858 @end table
21859
21860 @node Nvidia PTX Options
21861 @subsection Nvidia PTX Options
21862 @cindex Nvidia PTX options
21863 @cindex nvptx options
21864
21865 These options are defined for Nvidia PTX:
21866
21867 @table @gcctabopt
21868
21869 @item -m32
21870 @itemx -m64
21871 @opindex m32
21872 @opindex m64
21873 Generate code for 32-bit or 64-bit ABI.
21874
21875 @item -mmainkernel
21876 @opindex mmainkernel
21877 Link in code for a __main kernel. This is for stand-alone instead of
21878 offloading execution.
21879
21880 @item -moptimize
21881 @opindex moptimize
21882 Apply partitioned execution optimizations. This is the default when any
21883 level of optimization is selected.
21884
21885 @item -msoft-stack
21886 @opindex msoft-stack
21887 Generate code that does not use @code{.local} memory
21888 directly for stack storage. Instead, a per-warp stack pointer is
21889 maintained explicitly. This enables variable-length stack allocation (with
21890 variable-length arrays or @code{alloca}), and when global memory is used for
21891 underlying storage, makes it possible to access automatic variables from other
21892 threads, or with atomic instructions. This code generation variant is used
21893 for OpenMP offloading, but the option is exposed on its own for the purpose
21894 of testing the compiler; to generate code suitable for linking into programs
21895 using OpenMP offloading, use option @option{-mgomp}.
21896
21897 @item -muniform-simt
21898 @opindex muniform-simt
21899 Switch to code generation variant that allows to execute all threads in each
21900 warp, while maintaining memory state and side effects as if only one thread
21901 in each warp was active outside of OpenMP SIMD regions. All atomic operations
21902 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
21903 current lane index equals the master lane index), and the register being
21904 assigned is copied via a shuffle instruction from the master lane. Outside of
21905 SIMD regions lane 0 is the master; inside, each thread sees itself as the
21906 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
21907 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
21908 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
21909 with current lane index to compute the master lane index.
21910
21911 @item -mgomp
21912 @opindex mgomp
21913 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
21914 @option{-muniform-simt} options, and selects corresponding multilib variant.
21915
21916 @end table
21917
21918 @node PDP-11 Options
21919 @subsection PDP-11 Options
21920 @cindex PDP-11 Options
21921
21922 These options are defined for the PDP-11:
21923
21924 @table @gcctabopt
21925 @item -mfpu
21926 @opindex mfpu
21927 Use hardware FPP floating point. This is the default. (FIS floating
21928 point on the PDP-11/40 is not supported.)
21929
21930 @item -msoft-float
21931 @opindex msoft-float
21932 Do not use hardware floating point.
21933
21934 @item -mac0
21935 @opindex mac0
21936 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
21937
21938 @item -mno-ac0
21939 @opindex mno-ac0
21940 Return floating-point results in memory. This is the default.
21941
21942 @item -m40
21943 @opindex m40
21944 Generate code for a PDP-11/40.
21945
21946 @item -m45
21947 @opindex m45
21948 Generate code for a PDP-11/45. This is the default.
21949
21950 @item -m10
21951 @opindex m10
21952 Generate code for a PDP-11/10.
21953
21954 @item -mbcopy-builtin
21955 @opindex mbcopy-builtin
21956 Use inline @code{movmemhi} patterns for copying memory. This is the
21957 default.
21958
21959 @item -mbcopy
21960 @opindex mbcopy
21961 Do not use inline @code{movmemhi} patterns for copying memory.
21962
21963 @item -mint16
21964 @itemx -mno-int32
21965 @opindex mint16
21966 @opindex mno-int32
21967 Use 16-bit @code{int}. This is the default.
21968
21969 @item -mint32
21970 @itemx -mno-int16
21971 @opindex mint32
21972 @opindex mno-int16
21973 Use 32-bit @code{int}.
21974
21975 @item -mfloat64
21976 @itemx -mno-float32
21977 @opindex mfloat64
21978 @opindex mno-float32
21979 Use 64-bit @code{float}. This is the default.
21980
21981 @item -mfloat32
21982 @itemx -mno-float64
21983 @opindex mfloat32
21984 @opindex mno-float64
21985 Use 32-bit @code{float}.
21986
21987 @item -mabshi
21988 @opindex mabshi
21989 Use @code{abshi2} pattern. This is the default.
21990
21991 @item -mno-abshi
21992 @opindex mno-abshi
21993 Do not use @code{abshi2} pattern.
21994
21995 @item -mbranch-expensive
21996 @opindex mbranch-expensive
21997 Pretend that branches are expensive. This is for experimenting with
21998 code generation only.
21999
22000 @item -mbranch-cheap
22001 @opindex mbranch-cheap
22002 Do not pretend that branches are expensive. This is the default.
22003
22004 @item -munix-asm
22005 @opindex munix-asm
22006 Use Unix assembler syntax. This is the default when configured for
22007 @samp{pdp11-*-bsd}.
22008
22009 @item -mdec-asm
22010 @opindex mdec-asm
22011 Use DEC assembler syntax. This is the default when configured for any
22012 PDP-11 target other than @samp{pdp11-*-bsd}.
22013 @end table
22014
22015 @node picoChip Options
22016 @subsection picoChip Options
22017 @cindex picoChip options
22018
22019 These @samp{-m} options are defined for picoChip implementations:
22020
22021 @table @gcctabopt
22022
22023 @item -mae=@var{ae_type}
22024 @opindex mcpu
22025 Set the instruction set, register set, and instruction scheduling
22026 parameters for array element type @var{ae_type}. Supported values
22027 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
22028
22029 @option{-mae=ANY} selects a completely generic AE type. Code
22030 generated with this option runs on any of the other AE types. The
22031 code is not as efficient as it would be if compiled for a specific
22032 AE type, and some types of operation (e.g., multiplication) do not
22033 work properly on all types of AE.
22034
22035 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
22036 for compiled code, and is the default.
22037
22038 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
22039 option may suffer from poor performance of byte (char) manipulation,
22040 since the DSP AE does not provide hardware support for byte load/stores.
22041
22042 @item -msymbol-as-address
22043 Enable the compiler to directly use a symbol name as an address in a
22044 load/store instruction, without first loading it into a
22045 register. Typically, the use of this option generates larger
22046 programs, which run faster than when the option isn't used. However, the
22047 results vary from program to program, so it is left as a user option,
22048 rather than being permanently enabled.
22049
22050 @item -mno-inefficient-warnings
22051 Disables warnings about the generation of inefficient code. These
22052 warnings can be generated, for example, when compiling code that
22053 performs byte-level memory operations on the MAC AE type. The MAC AE has
22054 no hardware support for byte-level memory operations, so all byte
22055 load/stores must be synthesized from word load/store operations. This is
22056 inefficient and a warning is generated to indicate
22057 that you should rewrite the code to avoid byte operations, or to target
22058 an AE type that has the necessary hardware support. This option disables
22059 these warnings.
22060
22061 @end table
22062
22063 @node PowerPC Options
22064 @subsection PowerPC Options
22065 @cindex PowerPC options
22066
22067 These are listed under @xref{RS/6000 and PowerPC Options}.
22068
22069 @node PowerPC SPE Options
22070 @subsection PowerPC SPE Options
22071 @cindex PowerPC SPE options
22072
22073 These @samp{-m} options are defined for PowerPC SPE:
22074 @table @gcctabopt
22075 @item -mmfcrf
22076 @itemx -mno-mfcrf
22077 @itemx -mpopcntb
22078 @itemx -mno-popcntb
22079 @opindex mmfcrf
22080 @opindex mno-mfcrf
22081 @opindex mpopcntb
22082 @opindex mno-popcntb
22083 You use these options to specify which instructions are available on the
22084 processor you are using. The default value of these options is
22085 determined when configuring GCC@. Specifying the
22086 @option{-mcpu=@var{cpu_type}} overrides the specification of these
22087 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
22088 rather than the options listed above.
22089
22090 The @option{-mmfcrf} option allows GCC to generate the move from
22091 condition register field instruction implemented on the POWER4
22092 processor and other processors that support the PowerPC V2.01
22093 architecture.
22094 The @option{-mpopcntb} option allows GCC to generate the popcount and
22095 double-precision FP reciprocal estimate instruction implemented on the
22096 POWER5 processor and other processors that support the PowerPC V2.02
22097 architecture.
22098
22099 @item -mcpu=@var{cpu_type}
22100 @opindex mcpu
22101 Set architecture type, register usage, and
22102 instruction scheduling parameters for machine type @var{cpu_type}.
22103 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
22104 and @samp{native}.
22105
22106 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
22107 endian), with an appropriate, generic processor model assumed for
22108 scheduling purposes.
22109
22110 Specifying @samp{native} as cpu type detects and selects the
22111 architecture option that corresponds to the host processor of the
22112 system performing the compilation.
22113 @option{-mcpu=native} has no effect if GCC does not recognize the
22114 processor.
22115
22116 The other options specify a specific processor. Code generated under
22117 those options runs best on that processor, and may not run at all on
22118 others.
22119
22120 The @option{-mcpu} options automatically enable or disable the
22121 following options:
22122
22123 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
22124 -mpopcntb -mpopcntd @gol
22125 -msingle-float -mdouble-float @gol
22126 -mfloat128}
22127
22128 The particular options set for any particular CPU varies between
22129 compiler versions, depending on what setting seems to produce optimal
22130 code for that CPU; it doesn't necessarily reflect the actual hardware's
22131 capabilities. If you wish to set an individual option to a particular
22132 value, you may specify it after the @option{-mcpu} option, like
22133 @option{-mcpu=8548}.
22134
22135 @item -mtune=@var{cpu_type}
22136 @opindex mtune
22137 Set the instruction scheduling parameters for machine type
22138 @var{cpu_type}, but do not set the architecture type or register usage,
22139 as @option{-mcpu=@var{cpu_type}} does. The same
22140 values for @var{cpu_type} are used for @option{-mtune} as for
22141 @option{-mcpu}. If both are specified, the code generated uses the
22142 architecture and registers set by @option{-mcpu}, but the
22143 scheduling parameters set by @option{-mtune}.
22144
22145 @item -msecure-plt
22146 @opindex msecure-plt
22147 Generate code that allows @command{ld} and @command{ld.so}
22148 to build executables and shared
22149 libraries with non-executable @code{.plt} and @code{.got} sections.
22150 This is a PowerPC
22151 32-bit SYSV ABI option.
22152
22153 @item -mbss-plt
22154 @opindex mbss-plt
22155 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
22156 fills in, and
22157 requires @code{.plt} and @code{.got}
22158 sections that are both writable and executable.
22159 This is a PowerPC 32-bit SYSV ABI option.
22160
22161 @item -misel
22162 @itemx -mno-isel
22163 @opindex misel
22164 @opindex mno-isel
22165 This switch enables or disables the generation of ISEL instructions.
22166
22167 @item -misel=@var{yes/no}
22168 This switch has been deprecated. Use @option{-misel} and
22169 @option{-mno-isel} instead.
22170
22171 @item -mspe
22172 @itemx -mno-spe
22173 @opindex mspe
22174 @opindex mno-spe
22175 This switch enables or disables the generation of SPE simd
22176 instructions.
22177
22178 @item -mspe=@var{yes/no}
22179 This option has been deprecated. Use @option{-mspe} and
22180 @option{-mno-spe} instead.
22181
22182 @item -mfloat128
22183 @itemx -mno-float128
22184 @opindex mfloat128
22185 @opindex mno-float128
22186 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
22187 and use either software emulation for IEEE 128-bit floating point or
22188 hardware instructions.
22189
22190 @item -mfloat-gprs=@var{yes/single/double/no}
22191 @itemx -mfloat-gprs
22192 @opindex mfloat-gprs
22193 This switch enables or disables the generation of floating-point
22194 operations on the general-purpose registers for architectures that
22195 support it.
22196
22197 The argument @samp{yes} or @samp{single} enables the use of
22198 single-precision floating-point operations.
22199
22200 The argument @samp{double} enables the use of single and
22201 double-precision floating-point operations.
22202
22203 The argument @samp{no} disables floating-point operations on the
22204 general-purpose registers.
22205
22206 This option is currently only available on the MPC854x.
22207
22208 @item -mfull-toc
22209 @itemx -mno-fp-in-toc
22210 @itemx -mno-sum-in-toc
22211 @itemx -mminimal-toc
22212 @opindex mfull-toc
22213 @opindex mno-fp-in-toc
22214 @opindex mno-sum-in-toc
22215 @opindex mminimal-toc
22216 Modify generation of the TOC (Table Of Contents), which is created for
22217 every executable file. The @option{-mfull-toc} option is selected by
22218 default. In that case, GCC allocates at least one TOC entry for
22219 each unique non-automatic variable reference in your program. GCC
22220 also places floating-point constants in the TOC@. However, only
22221 16,384 entries are available in the TOC@.
22222
22223 If you receive a linker error message that saying you have overflowed
22224 the available TOC space, you can reduce the amount of TOC space used
22225 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
22226 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
22227 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
22228 generate code to calculate the sum of an address and a constant at
22229 run time instead of putting that sum into the TOC@. You may specify one
22230 or both of these options. Each causes GCC to produce very slightly
22231 slower and larger code at the expense of conserving TOC space.
22232
22233 If you still run out of space in the TOC even when you specify both of
22234 these options, specify @option{-mminimal-toc} instead. This option causes
22235 GCC to make only one TOC entry for every file. When you specify this
22236 option, GCC produces code that is slower and larger but which
22237 uses extremely little TOC space. You may wish to use this option
22238 only on files that contain less frequently-executed code.
22239
22240 @item -maix32
22241 @opindex maix32
22242 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
22243
22244 @item -mxl-compat
22245 @itemx -mno-xl-compat
22246 @opindex mxl-compat
22247 @opindex mno-xl-compat
22248 Produce code that conforms more closely to IBM XL compiler semantics
22249 when using AIX-compatible ABI@. Pass floating-point arguments to
22250 prototyped functions beyond the register save area (RSA) on the stack
22251 in addition to argument FPRs. Do not assume that most significant
22252 double in 128-bit long double value is properly rounded when comparing
22253 values and converting to double. Use XL symbol names for long double
22254 support routines.
22255
22256 The AIX calling convention was extended but not initially documented to
22257 handle an obscure K&R C case of calling a function that takes the
22258 address of its arguments with fewer arguments than declared. IBM XL
22259 compilers access floating-point arguments that do not fit in the
22260 RSA from the stack when a subroutine is compiled without
22261 optimization. Because always storing floating-point arguments on the
22262 stack is inefficient and rarely needed, this option is not enabled by
22263 default and only is necessary when calling subroutines compiled by IBM
22264 XL compilers without optimization.
22265
22266 @item -malign-natural
22267 @itemx -malign-power
22268 @opindex malign-natural
22269 @opindex malign-power
22270 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22271 @option{-malign-natural} overrides the ABI-defined alignment of larger
22272 types, such as floating-point doubles, on their natural size-based boundary.
22273 The option @option{-malign-power} instructs GCC to follow the ABI-specified
22274 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
22275
22276 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
22277 is not supported.
22278
22279 @item -msoft-float
22280 @itemx -mhard-float
22281 @opindex msoft-float
22282 @opindex mhard-float
22283 Generate code that does not use (uses) the floating-point register set.
22284 Software floating-point emulation is provided if you use the
22285 @option{-msoft-float} option, and pass the option to GCC when linking.
22286
22287 @item -msingle-float
22288 @itemx -mdouble-float
22289 @opindex msingle-float
22290 @opindex mdouble-float
22291 Generate code for single- or double-precision floating-point operations.
22292 @option{-mdouble-float} implies @option{-msingle-float}.
22293
22294 @item -mmultiple
22295 @itemx -mno-multiple
22296 @opindex mmultiple
22297 @opindex mno-multiple
22298 Generate code that uses (does not use) the load multiple word
22299 instructions and the store multiple word instructions. These
22300 instructions are generated by default on POWER systems, and not
22301 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
22302 PowerPC systems, since those instructions do not work when the
22303 processor is in little-endian mode. The exceptions are PPC740 and
22304 PPC750 which permit these instructions in little-endian mode.
22305
22306 @item -mupdate
22307 @itemx -mno-update
22308 @opindex mupdate
22309 @opindex mno-update
22310 Generate code that uses (does not use) the load or store instructions
22311 that update the base register to the address of the calculated memory
22312 location. These instructions are generated by default. If you use
22313 @option{-mno-update}, there is a small window between the time that the
22314 stack pointer is updated and the address of the previous frame is
22315 stored, which means code that walks the stack frame across interrupts or
22316 signals may get corrupted data.
22317
22318 @item -mavoid-indexed-addresses
22319 @itemx -mno-avoid-indexed-addresses
22320 @opindex mavoid-indexed-addresses
22321 @opindex mno-avoid-indexed-addresses
22322 Generate code that tries to avoid (not avoid) the use of indexed load
22323 or store instructions. These instructions can incur a performance
22324 penalty on Power6 processors in certain situations, such as when
22325 stepping through large arrays that cross a 16M boundary. This option
22326 is enabled by default when targeting Power6 and disabled otherwise.
22327
22328 @item -mfused-madd
22329 @itemx -mno-fused-madd
22330 @opindex mfused-madd
22331 @opindex mno-fused-madd
22332 Generate code that uses (does not use) the floating-point multiply and
22333 accumulate instructions. These instructions are generated by default
22334 if hardware floating point is used. The machine-dependent
22335 @option{-mfused-madd} option is now mapped to the machine-independent
22336 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22337 mapped to @option{-ffp-contract=off}.
22338
22339 @item -mno-strict-align
22340 @itemx -mstrict-align
22341 @opindex mno-strict-align
22342 @opindex mstrict-align
22343 On System V.4 and embedded PowerPC systems do not (do) assume that
22344 unaligned memory references are handled by the system.
22345
22346 @item -mrelocatable
22347 @itemx -mno-relocatable
22348 @opindex mrelocatable
22349 @opindex mno-relocatable
22350 Generate code that allows (does not allow) a static executable to be
22351 relocated to a different address at run time. A simple embedded
22352 PowerPC system loader should relocate the entire contents of
22353 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
22354 a table of 32-bit addresses generated by this option. For this to
22355 work, all objects linked together must be compiled with
22356 @option{-mrelocatable} or @option{-mrelocatable-lib}.
22357 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
22358
22359 @item -mrelocatable-lib
22360 @itemx -mno-relocatable-lib
22361 @opindex mrelocatable-lib
22362 @opindex mno-relocatable-lib
22363 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
22364 @code{.fixup} section to allow static executables to be relocated at
22365 run time, but @option{-mrelocatable-lib} does not use the smaller stack
22366 alignment of @option{-mrelocatable}. Objects compiled with
22367 @option{-mrelocatable-lib} may be linked with objects compiled with
22368 any combination of the @option{-mrelocatable} options.
22369
22370 @item -mno-toc
22371 @itemx -mtoc
22372 @opindex mno-toc
22373 @opindex mtoc
22374 On System V.4 and embedded PowerPC systems do not (do) assume that
22375 register 2 contains a pointer to a global area pointing to the addresses
22376 used in the program.
22377
22378 @item -mlittle
22379 @itemx -mlittle-endian
22380 @opindex mlittle
22381 @opindex mlittle-endian
22382 On System V.4 and embedded PowerPC systems compile code for the
22383 processor in little-endian mode. The @option{-mlittle-endian} option is
22384 the same as @option{-mlittle}.
22385
22386 @item -mbig
22387 @itemx -mbig-endian
22388 @opindex mbig
22389 @opindex mbig-endian
22390 On System V.4 and embedded PowerPC systems compile code for the
22391 processor in big-endian mode. The @option{-mbig-endian} option is
22392 the same as @option{-mbig}.
22393
22394 @item -mdynamic-no-pic
22395 @opindex mdynamic-no-pic
22396 On Darwin and Mac OS X systems, compile code so that it is not
22397 relocatable, but that its external references are relocatable. The
22398 resulting code is suitable for applications, but not shared
22399 libraries.
22400
22401 @item -msingle-pic-base
22402 @opindex msingle-pic-base
22403 Treat the register used for PIC addressing as read-only, rather than
22404 loading it in the prologue for each function. The runtime system is
22405 responsible for initializing this register with an appropriate value
22406 before execution begins.
22407
22408 @item -mprioritize-restricted-insns=@var{priority}
22409 @opindex mprioritize-restricted-insns
22410 This option controls the priority that is assigned to
22411 dispatch-slot restricted instructions during the second scheduling
22412 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
22413 or @samp{2} to assign no, highest, or second-highest (respectively)
22414 priority to dispatch-slot restricted
22415 instructions.
22416
22417 @item -msched-costly-dep=@var{dependence_type}
22418 @opindex msched-costly-dep
22419 This option controls which dependences are considered costly
22420 by the target during instruction scheduling. The argument
22421 @var{dependence_type} takes one of the following values:
22422
22423 @table @asis
22424 @item @samp{no}
22425 No dependence is costly.
22426
22427 @item @samp{all}
22428 All dependences are costly.
22429
22430 @item @samp{true_store_to_load}
22431 A true dependence from store to load is costly.
22432
22433 @item @samp{store_to_load}
22434 Any dependence from store to load is costly.
22435
22436 @item @var{number}
22437 Any dependence for which the latency is greater than or equal to
22438 @var{number} is costly.
22439 @end table
22440
22441 @item -minsert-sched-nops=@var{scheme}
22442 @opindex minsert-sched-nops
22443 This option controls which NOP insertion scheme is used during
22444 the second scheduling pass. The argument @var{scheme} takes one of the
22445 following values:
22446
22447 @table @asis
22448 @item @samp{no}
22449 Don't insert NOPs.
22450
22451 @item @samp{pad}
22452 Pad with NOPs any dispatch group that has vacant issue slots,
22453 according to the scheduler's grouping.
22454
22455 @item @samp{regroup_exact}
22456 Insert NOPs to force costly dependent insns into
22457 separate groups. Insert exactly as many NOPs as needed to force an insn
22458 to a new group, according to the estimated processor grouping.
22459
22460 @item @var{number}
22461 Insert NOPs to force costly dependent insns into
22462 separate groups. Insert @var{number} NOPs to force an insn to a new group.
22463 @end table
22464
22465 @item -mcall-sysv
22466 @opindex mcall-sysv
22467 On System V.4 and embedded PowerPC systems compile code using calling
22468 conventions that adhere to the March 1995 draft of the System V
22469 Application Binary Interface, PowerPC processor supplement. This is the
22470 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
22471
22472 @item -mcall-sysv-eabi
22473 @itemx -mcall-eabi
22474 @opindex mcall-sysv-eabi
22475 @opindex mcall-eabi
22476 Specify both @option{-mcall-sysv} and @option{-meabi} options.
22477
22478 @item -mcall-sysv-noeabi
22479 @opindex mcall-sysv-noeabi
22480 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
22481
22482 @item -mcall-aixdesc
22483 @opindex m
22484 On System V.4 and embedded PowerPC systems compile code for the AIX
22485 operating system.
22486
22487 @item -mcall-linux
22488 @opindex mcall-linux
22489 On System V.4 and embedded PowerPC systems compile code for the
22490 Linux-based GNU system.
22491
22492 @item -mcall-freebsd
22493 @opindex mcall-freebsd
22494 On System V.4 and embedded PowerPC systems compile code for the
22495 FreeBSD operating system.
22496
22497 @item -mcall-netbsd
22498 @opindex mcall-netbsd
22499 On System V.4 and embedded PowerPC systems compile code for the
22500 NetBSD operating system.
22501
22502 @item -mcall-openbsd
22503 @opindex mcall-netbsd
22504 On System V.4 and embedded PowerPC systems compile code for the
22505 OpenBSD operating system.
22506
22507 @item -maix-struct-return
22508 @opindex maix-struct-return
22509 Return all structures in memory (as specified by the AIX ABI)@.
22510
22511 @item -msvr4-struct-return
22512 @opindex msvr4-struct-return
22513 Return structures smaller than 8 bytes in registers (as specified by the
22514 SVR4 ABI)@.
22515
22516 @item -mabi=@var{abi-type}
22517 @opindex mabi
22518 Extend the current ABI with a particular extension, or remove such extension.
22519 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
22520 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
22521 @samp{elfv1}, @samp{elfv2}@.
22522
22523 @item -mabi=spe
22524 @opindex mabi=spe
22525 Extend the current ABI with SPE ABI extensions. This does not change
22526 the default ABI, instead it adds the SPE ABI extensions to the current
22527 ABI@.
22528
22529 @item -mabi=no-spe
22530 @opindex mabi=no-spe
22531 Disable Book-E SPE ABI extensions for the current ABI@.
22532
22533 @item -mabi=ibmlongdouble
22534 @opindex mabi=ibmlongdouble
22535 Change the current ABI to use IBM extended-precision long double.
22536 This is not likely to work if your system defaults to using IEEE
22537 extended-precision long double. If you change the long double type
22538 from IEEE extended-precision, the compiler will issue a warning unless
22539 you use the @option{-Wno-psabi} option.
22540
22541 @item -mabi=ieeelongdouble
22542 @opindex mabi=ieeelongdouble
22543 Change the current ABI to use IEEE extended-precision long double.
22544 This is not likely to work if your system defaults to using IBM
22545 extended-precision long double. If you change the long double type
22546 from IBM extended-precision, the compiler will issue a warning unless
22547 you use the @option{-Wno-psabi} option.
22548
22549 @item -mabi=elfv1
22550 @opindex mabi=elfv1
22551 Change the current ABI to use the ELFv1 ABI.
22552 This is the default ABI for big-endian PowerPC 64-bit Linux.
22553 Overriding the default ABI requires special system support and is
22554 likely to fail in spectacular ways.
22555
22556 @item -mabi=elfv2
22557 @opindex mabi=elfv2
22558 Change the current ABI to use the ELFv2 ABI.
22559 This is the default ABI for little-endian PowerPC 64-bit Linux.
22560 Overriding the default ABI requires special system support and is
22561 likely to fail in spectacular ways.
22562
22563 @item -mgnu-attribute
22564 @itemx -mno-gnu-attribute
22565 @opindex mgnu-attribute
22566 @opindex mno-gnu-attribute
22567 Emit .gnu_attribute assembly directives to set tag/value pairs in a
22568 .gnu.attributes section that specify ABI variations in function
22569 parameters or return values.
22570
22571 @item -mprototype
22572 @itemx -mno-prototype
22573 @opindex mprototype
22574 @opindex mno-prototype
22575 On System V.4 and embedded PowerPC systems assume that all calls to
22576 variable argument functions are properly prototyped. Otherwise, the
22577 compiler must insert an instruction before every non-prototyped call to
22578 set or clear bit 6 of the condition code register (@code{CR}) to
22579 indicate whether floating-point values are passed in the floating-point
22580 registers in case the function takes variable arguments. With
22581 @option{-mprototype}, only calls to prototyped variable argument functions
22582 set or clear the bit.
22583
22584 @item -msim
22585 @opindex msim
22586 On embedded PowerPC systems, assume that the startup module is called
22587 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
22588 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
22589 configurations.
22590
22591 @item -mmvme
22592 @opindex mmvme
22593 On embedded PowerPC systems, assume that the startup module is called
22594 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
22595 @file{libc.a}.
22596
22597 @item -mads
22598 @opindex mads
22599 On embedded PowerPC systems, assume that the startup module is called
22600 @file{crt0.o} and the standard C libraries are @file{libads.a} and
22601 @file{libc.a}.
22602
22603 @item -myellowknife
22604 @opindex myellowknife
22605 On embedded PowerPC systems, assume that the startup module is called
22606 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
22607 @file{libc.a}.
22608
22609 @item -mvxworks
22610 @opindex mvxworks
22611 On System V.4 and embedded PowerPC systems, specify that you are
22612 compiling for a VxWorks system.
22613
22614 @item -memb
22615 @opindex memb
22616 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
22617 header to indicate that @samp{eabi} extended relocations are used.
22618
22619 @item -meabi
22620 @itemx -mno-eabi
22621 @opindex meabi
22622 @opindex mno-eabi
22623 On System V.4 and embedded PowerPC systems do (do not) adhere to the
22624 Embedded Applications Binary Interface (EABI), which is a set of
22625 modifications to the System V.4 specifications. Selecting @option{-meabi}
22626 means that the stack is aligned to an 8-byte boundary, a function
22627 @code{__eabi} is called from @code{main} to set up the EABI
22628 environment, and the @option{-msdata} option can use both @code{r2} and
22629 @code{r13} to point to two separate small data areas. Selecting
22630 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
22631 no EABI initialization function is called from @code{main}, and the
22632 @option{-msdata} option only uses @code{r13} to point to a single
22633 small data area. The @option{-meabi} option is on by default if you
22634 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
22635
22636 @item -msdata=eabi
22637 @opindex msdata=eabi
22638 On System V.4 and embedded PowerPC systems, put small initialized
22639 @code{const} global and static data in the @code{.sdata2} section, which
22640 is pointed to by register @code{r2}. Put small initialized
22641 non-@code{const} global and static data in the @code{.sdata} section,
22642 which is pointed to by register @code{r13}. Put small uninitialized
22643 global and static data in the @code{.sbss} section, which is adjacent to
22644 the @code{.sdata} section. The @option{-msdata=eabi} option is
22645 incompatible with the @option{-mrelocatable} option. The
22646 @option{-msdata=eabi} option also sets the @option{-memb} option.
22647
22648 @item -msdata=sysv
22649 @opindex msdata=sysv
22650 On System V.4 and embedded PowerPC systems, put small global and static
22651 data in the @code{.sdata} section, which is pointed to by register
22652 @code{r13}. Put small uninitialized global and static data in the
22653 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
22654 The @option{-msdata=sysv} option is incompatible with the
22655 @option{-mrelocatable} option.
22656
22657 @item -msdata=default
22658 @itemx -msdata
22659 @opindex msdata=default
22660 @opindex msdata
22661 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
22662 compile code the same as @option{-msdata=eabi}, otherwise compile code the
22663 same as @option{-msdata=sysv}.
22664
22665 @item -msdata=data
22666 @opindex msdata=data
22667 On System V.4 and embedded PowerPC systems, put small global
22668 data in the @code{.sdata} section. Put small uninitialized global
22669 data in the @code{.sbss} section. Do not use register @code{r13}
22670 to address small data however. This is the default behavior unless
22671 other @option{-msdata} options are used.
22672
22673 @item -msdata=none
22674 @itemx -mno-sdata
22675 @opindex msdata=none
22676 @opindex mno-sdata
22677 On embedded PowerPC systems, put all initialized global and static data
22678 in the @code{.data} section, and all uninitialized data in the
22679 @code{.bss} section.
22680
22681 @item -mblock-move-inline-limit=@var{num}
22682 @opindex mblock-move-inline-limit
22683 Inline all block moves (such as calls to @code{memcpy} or structure
22684 copies) less than or equal to @var{num} bytes. The minimum value for
22685 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
22686 targets. The default value is target-specific.
22687
22688 @item -G @var{num}
22689 @opindex G
22690 @cindex smaller data references (PowerPC)
22691 @cindex .sdata/.sdata2 references (PowerPC)
22692 On embedded PowerPC systems, put global and static items less than or
22693 equal to @var{num} bytes into the small data or BSS sections instead of
22694 the normal data or BSS section. By default, @var{num} is 8. The
22695 @option{-G @var{num}} switch is also passed to the linker.
22696 All modules should be compiled with the same @option{-G @var{num}} value.
22697
22698 @item -mregnames
22699 @itemx -mno-regnames
22700 @opindex mregnames
22701 @opindex mno-regnames
22702 On System V.4 and embedded PowerPC systems do (do not) emit register
22703 names in the assembly language output using symbolic forms.
22704
22705 @item -mlongcall
22706 @itemx -mno-longcall
22707 @opindex mlongcall
22708 @opindex mno-longcall
22709 By default assume that all calls are far away so that a longer and more
22710 expensive calling sequence is required. This is required for calls
22711 farther than 32 megabytes (33,554,432 bytes) from the current location.
22712 A short call is generated if the compiler knows
22713 the call cannot be that far away. This setting can be overridden by
22714 the @code{shortcall} function attribute, or by @code{#pragma
22715 longcall(0)}.
22716
22717 Some linkers are capable of detecting out-of-range calls and generating
22718 glue code on the fly. On these systems, long calls are unnecessary and
22719 generate slower code. As of this writing, the AIX linker can do this,
22720 as can the GNU linker for PowerPC/64. It is planned to add this feature
22721 to the GNU linker for 32-bit PowerPC systems as well.
22722
22723 In the future, GCC may ignore all longcall specifications
22724 when the linker is known to generate glue.
22725
22726 @item -mtls-markers
22727 @itemx -mno-tls-markers
22728 @opindex mtls-markers
22729 @opindex mno-tls-markers
22730 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
22731 specifying the function argument. The relocation allows the linker to
22732 reliably associate function call with argument setup instructions for
22733 TLS optimization, which in turn allows GCC to better schedule the
22734 sequence.
22735
22736 @item -mrecip
22737 @itemx -mno-recip
22738 @opindex mrecip
22739 This option enables use of the reciprocal estimate and
22740 reciprocal square root estimate instructions with additional
22741 Newton-Raphson steps to increase precision instead of doing a divide or
22742 square root and divide for floating-point arguments. You should use
22743 the @option{-ffast-math} option when using @option{-mrecip} (or at
22744 least @option{-funsafe-math-optimizations},
22745 @option{-ffinite-math-only}, @option{-freciprocal-math} and
22746 @option{-fno-trapping-math}). Note that while the throughput of the
22747 sequence is generally higher than the throughput of the non-reciprocal
22748 instruction, the precision of the sequence can be decreased by up to 2
22749 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
22750 roots.
22751
22752 @item -mrecip=@var{opt}
22753 @opindex mrecip=opt
22754 This option controls which reciprocal estimate instructions
22755 may be used. @var{opt} is a comma-separated list of options, which may
22756 be preceded by a @code{!} to invert the option:
22757
22758 @table @samp
22759
22760 @item all
22761 Enable all estimate instructions.
22762
22763 @item default
22764 Enable the default instructions, equivalent to @option{-mrecip}.
22765
22766 @item none
22767 Disable all estimate instructions, equivalent to @option{-mno-recip}.
22768
22769 @item div
22770 Enable the reciprocal approximation instructions for both
22771 single and double precision.
22772
22773 @item divf
22774 Enable the single-precision reciprocal approximation instructions.
22775
22776 @item divd
22777 Enable the double-precision reciprocal approximation instructions.
22778
22779 @item rsqrt
22780 Enable the reciprocal square root approximation instructions for both
22781 single and double precision.
22782
22783 @item rsqrtf
22784 Enable the single-precision reciprocal square root approximation instructions.
22785
22786 @item rsqrtd
22787 Enable the double-precision reciprocal square root approximation instructions.
22788
22789 @end table
22790
22791 So, for example, @option{-mrecip=all,!rsqrtd} enables
22792 all of the reciprocal estimate instructions, except for the
22793 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
22794 which handle the double-precision reciprocal square root calculations.
22795
22796 @item -mrecip-precision
22797 @itemx -mno-recip-precision
22798 @opindex mrecip-precision
22799 Assume (do not assume) that the reciprocal estimate instructions
22800 provide higher-precision estimates than is mandated by the PowerPC
22801 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
22802 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
22803 The double-precision square root estimate instructions are not generated by
22804 default on low-precision machines, since they do not provide an
22805 estimate that converges after three steps.
22806
22807 @item -mpointers-to-nested-functions
22808 @itemx -mno-pointers-to-nested-functions
22809 @opindex mpointers-to-nested-functions
22810 Generate (do not generate) code to load up the static chain register
22811 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
22812 systems where a function pointer points to a 3-word descriptor giving
22813 the function address, TOC value to be loaded in register @code{r2}, and
22814 static chain value to be loaded in register @code{r11}. The
22815 @option{-mpointers-to-nested-functions} is on by default. You cannot
22816 call through pointers to nested functions or pointers
22817 to functions compiled in other languages that use the static chain if
22818 you use @option{-mno-pointers-to-nested-functions}.
22819
22820 @item -msave-toc-indirect
22821 @itemx -mno-save-toc-indirect
22822 @opindex msave-toc-indirect
22823 Generate (do not generate) code to save the TOC value in the reserved
22824 stack location in the function prologue if the function calls through
22825 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
22826 saved in the prologue, it is saved just before the call through the
22827 pointer. The @option{-mno-save-toc-indirect} option is the default.
22828
22829 @item -mcompat-align-parm
22830 @itemx -mno-compat-align-parm
22831 @opindex mcompat-align-parm
22832 Generate (do not generate) code to pass structure parameters with a
22833 maximum alignment of 64 bits, for compatibility with older versions
22834 of GCC.
22835
22836 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
22837 structure parameter on a 128-bit boundary when that structure contained
22838 a member requiring 128-bit alignment. This is corrected in more
22839 recent versions of GCC. This option may be used to generate code
22840 that is compatible with functions compiled with older versions of
22841 GCC.
22842
22843 The @option{-mno-compat-align-parm} option is the default.
22844
22845 @item -mstack-protector-guard=@var{guard}
22846 @itemx -mstack-protector-guard-reg=@var{reg}
22847 @itemx -mstack-protector-guard-offset=@var{offset}
22848 @itemx -mstack-protector-guard-symbol=@var{symbol}
22849 @opindex mstack-protector-guard
22850 @opindex mstack-protector-guard-reg
22851 @opindex mstack-protector-guard-offset
22852 @opindex mstack-protector-guard-symbol
22853 Generate stack protection code using canary at @var{guard}. Supported
22854 locations are @samp{global} for global canary or @samp{tls} for per-thread
22855 canary in the TLS block (the default with GNU libc version 2.4 or later).
22856
22857 With the latter choice the options
22858 @option{-mstack-protector-guard-reg=@var{reg}} and
22859 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
22860 which register to use as base register for reading the canary, and from what
22861 offset from that base register. The default for those is as specified in the
22862 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
22863 the offset with a symbol reference to a canary in the TLS block.
22864 @end table
22865
22866
22867 @node RISC-V Options
22868 @subsection RISC-V Options
22869 @cindex RISC-V Options
22870
22871 These command-line options are defined for RISC-V targets:
22872
22873 @table @gcctabopt
22874 @item -mbranch-cost=@var{n}
22875 @opindex mbranch-cost
22876 Set the cost of branches to roughly @var{n} instructions.
22877
22878 @item -mplt
22879 @itemx -mno-plt
22880 @opindex plt
22881 When generating PIC code, do or don't allow the use of PLTs. Ignored for
22882 non-PIC. The default is @option{-mplt}.
22883
22884 @item -mabi=@var{ABI-string}
22885 @opindex mabi
22886 Specify integer and floating-point calling convention. @var{ABI-string}
22887 contains two parts: the size of integer types and the registers used for
22888 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
22889 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
22890 32-bit), and that floating-point values up to 64 bits wide are passed in F
22891 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
22892 allows the compiler to generate code that uses the F and D extensions but only
22893 allows floating-point values up to 32 bits long to be passed in registers; or
22894 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
22895 passed in registers.
22896
22897 The default for this argument is system dependent, users who want a specific
22898 calling convention should specify one explicitly. The valid calling
22899 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
22900 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
22901 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
22902 invalid because the ABI requires 64-bit values be passed in F registers, but F
22903 registers are only 32 bits wide.
22904
22905 @item -mfdiv
22906 @itemx -mno-fdiv
22907 @opindex mfdiv
22908 Do or don't use hardware floating-point divide and square root instructions.
22909 This requires the F or D extensions for floating-point registers. The default
22910 is to use them if the specified architecture has these instructions.
22911
22912 @item -mdiv
22913 @itemx -mno-div
22914 @opindex mdiv
22915 Do or don't use hardware instructions for integer division. This requires the
22916 M extension. The default is to use them if the specified architecture has
22917 these instructions.
22918
22919 @item -march=@var{ISA-string}
22920 @opindex march
22921 Generate code for given RISC-V ISA (e.g.@ @samp{rv64im}). ISA strings must be
22922 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, and @samp{rv32imaf}.
22923
22924 @item -mtune=@var{processor-string}
22925 @opindex mtune
22926 Optimize the output for the given processor, specified by microarchitecture
22927 name.
22928
22929 @item -mpreferred-stack-boundary=@var{num}
22930 @opindex mpreferred-stack-boundary
22931 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
22932 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
22933 the default is 4 (16 bytes or 128-bits).
22934
22935 @strong{Warning:} If you use this switch, then you must build all modules with
22936 the same value, including any libraries. This includes the system libraries
22937 and startup modules.
22938
22939 @item -msmall-data-limit=@var{n}
22940 @opindex msmall-data-limit
22941 Put global and static data smaller than @var{n} bytes into a special section
22942 (on some targets).
22943
22944 @item -msave-restore
22945 @itemx -mno-save-restore
22946 @opindex msave-restore
22947 Do or don't use smaller but slower prologue and epilogue code that uses
22948 library function calls. The default is to use fast inline prologues and
22949 epilogues.
22950
22951 @item -mstrict-align
22952 @itemx -mno-strict-align
22953 @opindex mstrict-align
22954 Do not or do generate unaligned memory accesses. The default is set depending
22955 on whether the processor we are optimizing for supports fast unaligned access
22956 or not.
22957
22958 @item -mcmodel=medlow
22959 @opindex mcmodel=medlow
22960 Generate code for the medium-low code model. The program and its statically
22961 defined symbols must lie within a single 2 GiB address range and must lie
22962 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
22963 statically or dynamically linked. This is the default code model.
22964
22965 @item -mcmodel=medany
22966 @opindex mcmodel=medany
22967 Generate code for the medium-any code model. The program and its statically
22968 defined symbols must be within any single 2 GiB address range. Programs can be
22969 statically or dynamically linked.
22970
22971 @item -mexplicit-relocs
22972 @itemx -mno-exlicit-relocs
22973 Use or do not use assembler relocation operators when dealing with symbolic
22974 addresses. The alternative is to use assembler macros instead, which may
22975 limit optimization.
22976
22977 @end table
22978
22979 @node RL78 Options
22980 @subsection RL78 Options
22981 @cindex RL78 Options
22982
22983 @table @gcctabopt
22984
22985 @item -msim
22986 @opindex msim
22987 Links in additional target libraries to support operation within a
22988 simulator.
22989
22990 @item -mmul=none
22991 @itemx -mmul=g10
22992 @itemx -mmul=g13
22993 @itemx -mmul=g14
22994 @itemx -mmul=rl78
22995 @opindex mmul
22996 Specifies the type of hardware multiplication and division support to
22997 be used. The simplest is @code{none}, which uses software for both
22998 multiplication and division. This is the default. The @code{g13}
22999 value is for the hardware multiply/divide peripheral found on the
23000 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23001 the multiplication and division instructions supported by the RL78/G14
23002 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
23003 the value @code{mg10} is an alias for @code{none}.
23004
23005 In addition a C preprocessor macro is defined, based upon the setting
23006 of this option. Possible values are: @code{__RL78_MUL_NONE__},
23007 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23008
23009 @item -mcpu=g10
23010 @itemx -mcpu=g13
23011 @itemx -mcpu=g14
23012 @itemx -mcpu=rl78
23013 @opindex mcpu
23014 Specifies the RL78 core to target. The default is the G14 core, also
23015 known as an S3 core or just RL78. The G13 or S2 core does not have
23016 multiply or divide instructions, instead it uses a hardware peripheral
23017 for these operations. The G10 or S1 core does not have register
23018 banks, so it uses a different calling convention.
23019
23020 If this option is set it also selects the type of hardware multiply
23021 support to use, unless this is overridden by an explicit
23022 @option{-mmul=none} option on the command line. Thus specifying
23023 @option{-mcpu=g13} enables the use of the G13 hardware multiply
23024 peripheral and specifying @option{-mcpu=g10} disables the use of
23025 hardware multiplications altogether.
23026
23027 Note, although the RL78/G14 core is the default target, specifying
23028 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23029 change the behavior of the toolchain since it also enables G14
23030 hardware multiply support. If these options are not specified on the
23031 command line then software multiplication routines will be used even
23032 though the code targets the RL78 core. This is for backwards
23033 compatibility with older toolchains which did not have hardware
23034 multiply and divide support.
23035
23036 In addition a C preprocessor macro is defined, based upon the setting
23037 of this option. Possible values are: @code{__RL78_G10__},
23038 @code{__RL78_G13__} or @code{__RL78_G14__}.
23039
23040 @item -mg10
23041 @itemx -mg13
23042 @itemx -mg14
23043 @itemx -mrl78
23044 @opindex mg10
23045 @opindex mg13
23046 @opindex mg14
23047 @opindex mrl78
23048 These are aliases for the corresponding @option{-mcpu=} option. They
23049 are provided for backwards compatibility.
23050
23051 @item -mallregs
23052 @opindex mallregs
23053 Allow the compiler to use all of the available registers. By default
23054 registers @code{r24..r31} are reserved for use in interrupt handlers.
23055 With this option enabled these registers can be used in ordinary
23056 functions as well.
23057
23058 @item -m64bit-doubles
23059 @itemx -m32bit-doubles
23060 @opindex m64bit-doubles
23061 @opindex m32bit-doubles
23062 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23063 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23064 @option{-m32bit-doubles}.
23065
23066 @item -msave-mduc-in-interrupts
23067 @item -mno-save-mduc-in-interrupts
23068 @opindex msave-mduc-in-interrupts
23069 @opindex mno-save-mduc-in-interrupts
23070 Specifies that interrupt handler functions should preserve the
23071 MDUC registers. This is only necessary if normal code might use
23072 the MDUC registers, for example because it performs multiplication
23073 and division operations. The default is to ignore the MDUC registers
23074 as this makes the interrupt handlers faster. The target option -mg13
23075 needs to be passed for this to work as this feature is only available
23076 on the G13 target (S2 core). The MDUC registers will only be saved
23077 if the interrupt handler performs a multiplication or division
23078 operation or it calls another function.
23079
23080 @end table
23081
23082 @node RS/6000 and PowerPC Options
23083 @subsection IBM RS/6000 and PowerPC Options
23084 @cindex RS/6000 and PowerPC Options
23085 @cindex IBM RS/6000 and PowerPC Options
23086
23087 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
23088 @table @gcctabopt
23089 @item -mpowerpc-gpopt
23090 @itemx -mno-powerpc-gpopt
23091 @itemx -mpowerpc-gfxopt
23092 @itemx -mno-powerpc-gfxopt
23093 @need 800
23094 @itemx -mpowerpc64
23095 @itemx -mno-powerpc64
23096 @itemx -mmfcrf
23097 @itemx -mno-mfcrf
23098 @itemx -mpopcntb
23099 @itemx -mno-popcntb
23100 @itemx -mpopcntd
23101 @itemx -mno-popcntd
23102 @itemx -mfprnd
23103 @itemx -mno-fprnd
23104 @need 800
23105 @itemx -mcmpb
23106 @itemx -mno-cmpb
23107 @itemx -mmfpgpr
23108 @itemx -mno-mfpgpr
23109 @itemx -mhard-dfp
23110 @itemx -mno-hard-dfp
23111 @opindex mpowerpc-gpopt
23112 @opindex mno-powerpc-gpopt
23113 @opindex mpowerpc-gfxopt
23114 @opindex mno-powerpc-gfxopt
23115 @opindex mpowerpc64
23116 @opindex mno-powerpc64
23117 @opindex mmfcrf
23118 @opindex mno-mfcrf
23119 @opindex mpopcntb
23120 @opindex mno-popcntb
23121 @opindex mpopcntd
23122 @opindex mno-popcntd
23123 @opindex mfprnd
23124 @opindex mno-fprnd
23125 @opindex mcmpb
23126 @opindex mno-cmpb
23127 @opindex mmfpgpr
23128 @opindex mno-mfpgpr
23129 @opindex mhard-dfp
23130 @opindex mno-hard-dfp
23131 You use these options to specify which instructions are available on the
23132 processor you are using. The default value of these options is
23133 determined when configuring GCC@. Specifying the
23134 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23135 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23136 rather than the options listed above.
23137
23138 Specifying @option{-mpowerpc-gpopt} allows
23139 GCC to use the optional PowerPC architecture instructions in the
23140 General Purpose group, including floating-point square root. Specifying
23141 @option{-mpowerpc-gfxopt} allows GCC to
23142 use the optional PowerPC architecture instructions in the Graphics
23143 group, including floating-point select.
23144
23145 The @option{-mmfcrf} option allows GCC to generate the move from
23146 condition register field instruction implemented on the POWER4
23147 processor and other processors that support the PowerPC V2.01
23148 architecture.
23149 The @option{-mpopcntb} option allows GCC to generate the popcount and
23150 double-precision FP reciprocal estimate instruction implemented on the
23151 POWER5 processor and other processors that support the PowerPC V2.02
23152 architecture.
23153 The @option{-mpopcntd} option allows GCC to generate the popcount
23154 instruction implemented on the POWER7 processor and other processors
23155 that support the PowerPC V2.06 architecture.
23156 The @option{-mfprnd} option allows GCC to generate the FP round to
23157 integer instructions implemented on the POWER5+ processor and other
23158 processors that support the PowerPC V2.03 architecture.
23159 The @option{-mcmpb} option allows GCC to generate the compare bytes
23160 instruction implemented on the POWER6 processor and other processors
23161 that support the PowerPC V2.05 architecture.
23162 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
23163 general-purpose register instructions implemented on the POWER6X
23164 processor and other processors that support the extended PowerPC V2.05
23165 architecture.
23166 The @option{-mhard-dfp} option allows GCC to generate the decimal
23167 floating-point instructions implemented on some POWER processors.
23168
23169 The @option{-mpowerpc64} option allows GCC to generate the additional
23170 64-bit instructions that are found in the full PowerPC64 architecture
23171 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23172 @option{-mno-powerpc64}.
23173
23174 @item -mcpu=@var{cpu_type}
23175 @opindex mcpu
23176 Set architecture type, register usage, and
23177 instruction scheduling parameters for machine type @var{cpu_type}.
23178 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
23179 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
23180 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
23181 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
23182 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
23183 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
23184 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
23185 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
23186 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
23187 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
23188 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
23189 @samp{rs64}, and @samp{native}.
23190
23191 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
23192 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
23193 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
23194 architecture machine types, with an appropriate, generic processor
23195 model assumed for scheduling purposes.
23196
23197 Specifying @samp{native} as cpu type detects and selects the
23198 architecture option that corresponds to the host processor of the
23199 system performing the compilation.
23200 @option{-mcpu=native} has no effect if GCC does not recognize the
23201 processor.
23202
23203 The other options specify a specific processor. Code generated under
23204 those options runs best on that processor, and may not run at all on
23205 others.
23206
23207 The @option{-mcpu} options automatically enable or disable the
23208 following options:
23209
23210 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
23211 -mpopcntb -mpopcntd -mpowerpc64 @gol
23212 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
23213 -msimple-fpu -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
23214 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
23215 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
23216
23217 The particular options set for any particular CPU varies between
23218 compiler versions, depending on what setting seems to produce optimal
23219 code for that CPU; it doesn't necessarily reflect the actual hardware's
23220 capabilities. If you wish to set an individual option to a particular
23221 value, you may specify it after the @option{-mcpu} option, like
23222 @option{-mcpu=970 -mno-altivec}.
23223
23224 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
23225 not enabled or disabled by the @option{-mcpu} option at present because
23226 AIX does not have full support for these options. You may still
23227 enable or disable them individually if you're sure it'll work in your
23228 environment.
23229
23230 @item -mtune=@var{cpu_type}
23231 @opindex mtune
23232 Set the instruction scheduling parameters for machine type
23233 @var{cpu_type}, but do not set the architecture type or register usage,
23234 as @option{-mcpu=@var{cpu_type}} does. The same
23235 values for @var{cpu_type} are used for @option{-mtune} as for
23236 @option{-mcpu}. If both are specified, the code generated uses the
23237 architecture and registers set by @option{-mcpu}, but the
23238 scheduling parameters set by @option{-mtune}.
23239
23240 @item -mcmodel=small
23241 @opindex mcmodel=small
23242 Generate PowerPC64 code for the small model: The TOC is limited to
23243 64k.
23244
23245 @item -mcmodel=medium
23246 @opindex mcmodel=medium
23247 Generate PowerPC64 code for the medium model: The TOC and other static
23248 data may be up to a total of 4G in size. This is the default for 64-bit
23249 Linux.
23250
23251 @item -mcmodel=large
23252 @opindex mcmodel=large
23253 Generate PowerPC64 code for the large model: The TOC may be up to 4G
23254 in size. Other data and code is only limited by the 64-bit address
23255 space.
23256
23257 @item -maltivec
23258 @itemx -mno-altivec
23259 @opindex maltivec
23260 @opindex mno-altivec
23261 Generate code that uses (does not use) AltiVec instructions, and also
23262 enable the use of built-in functions that allow more direct access to
23263 the AltiVec instruction set. You may also need to set
23264 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
23265 enhancements.
23266
23267 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
23268 @option{-maltivec=be}, the element order for AltiVec intrinsics such
23269 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
23270 match array element order corresponding to the endianness of the
23271 target. That is, element zero identifies the leftmost element in a
23272 vector register when targeting a big-endian platform, and identifies
23273 the rightmost element in a vector register when targeting a
23274 little-endian platform.
23275
23276 @item -maltivec=be
23277 @opindex maltivec=be
23278 Generate AltiVec instructions using big-endian element order,
23279 regardless of whether the target is big- or little-endian. This is
23280 the default when targeting a big-endian platform.
23281
23282 The element order is used to interpret element numbers in AltiVec
23283 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23284 @code{vec_insert}. By default, these match array element order
23285 corresponding to the endianness for the target.
23286
23287 @item -maltivec=le
23288 @opindex maltivec=le
23289 Generate AltiVec instructions using little-endian element order,
23290 regardless of whether the target is big- or little-endian. This is
23291 the default when targeting a little-endian platform. This option is
23292 currently ignored when targeting a big-endian platform.
23293
23294 The element order is used to interpret element numbers in AltiVec
23295 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23296 @code{vec_insert}. By default, these match array element order
23297 corresponding to the endianness for the target.
23298
23299 @item -mvrsave
23300 @itemx -mno-vrsave
23301 @opindex mvrsave
23302 @opindex mno-vrsave
23303 Generate VRSAVE instructions when generating AltiVec code.
23304
23305 @item -msecure-plt
23306 @opindex msecure-plt
23307 Generate code that allows @command{ld} and @command{ld.so}
23308 to build executables and shared
23309 libraries with non-executable @code{.plt} and @code{.got} sections.
23310 This is a PowerPC
23311 32-bit SYSV ABI option.
23312
23313 @item -mbss-plt
23314 @opindex mbss-plt
23315 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23316 fills in, and
23317 requires @code{.plt} and @code{.got}
23318 sections that are both writable and executable.
23319 This is a PowerPC 32-bit SYSV ABI option.
23320
23321 @item -misel
23322 @itemx -mno-isel
23323 @opindex misel
23324 @opindex mno-isel
23325 This switch enables or disables the generation of ISEL instructions.
23326
23327 @item -misel=@var{yes/no}
23328 This switch has been deprecated. Use @option{-misel} and
23329 @option{-mno-isel} instead.
23330
23331 @item -mpaired
23332 @itemx -mno-paired
23333 @opindex mpaired
23334 @opindex mno-paired
23335 This switch enables or disables the generation of PAIRED simd
23336 instructions.
23337
23338 @item -mvsx
23339 @itemx -mno-vsx
23340 @opindex mvsx
23341 @opindex mno-vsx
23342 Generate code that uses (does not use) vector/scalar (VSX)
23343 instructions, and also enable the use of built-in functions that allow
23344 more direct access to the VSX instruction set.
23345
23346 @item -mcrypto
23347 @itemx -mno-crypto
23348 @opindex mcrypto
23349 @opindex mno-crypto
23350 Enable the use (disable) of the built-in functions that allow direct
23351 access to the cryptographic instructions that were added in version
23352 2.07 of the PowerPC ISA.
23353
23354 @item -mdirect-move
23355 @itemx -mno-direct-move
23356 @opindex mdirect-move
23357 @opindex mno-direct-move
23358 Generate code that uses (does not use) the instructions to move data
23359 between the general purpose registers and the vector/scalar (VSX)
23360 registers that were added in version 2.07 of the PowerPC ISA.
23361
23362 @item -mhtm
23363 @itemx -mno-htm
23364 @opindex mhtm
23365 @opindex mno-htm
23366 Enable (disable) the use of the built-in functions that allow direct
23367 access to the Hardware Transactional Memory (HTM) instructions that
23368 were added in version 2.07 of the PowerPC ISA.
23369
23370 @item -mpower8-fusion
23371 @itemx -mno-power8-fusion
23372 @opindex mpower8-fusion
23373 @opindex mno-power8-fusion
23374 Generate code that keeps (does not keeps) some integer operations
23375 adjacent so that the instructions can be fused together on power8 and
23376 later processors.
23377
23378 @item -mpower8-vector
23379 @itemx -mno-power8-vector
23380 @opindex mpower8-vector
23381 @opindex mno-power8-vector
23382 Generate code that uses (does not use) the vector and scalar
23383 instructions that were added in version 2.07 of the PowerPC ISA. Also
23384 enable the use of built-in functions that allow more direct access to
23385 the vector instructions.
23386
23387 @item -mquad-memory
23388 @itemx -mno-quad-memory
23389 @opindex mquad-memory
23390 @opindex mno-quad-memory
23391 Generate code that uses (does not use) the non-atomic quad word memory
23392 instructions. The @option{-mquad-memory} option requires use of
23393 64-bit mode.
23394
23395 @item -mquad-memory-atomic
23396 @itemx -mno-quad-memory-atomic
23397 @opindex mquad-memory-atomic
23398 @opindex mno-quad-memory-atomic
23399 Generate code that uses (does not use) the atomic quad word memory
23400 instructions. The @option{-mquad-memory-atomic} option requires use of
23401 64-bit mode.
23402
23403 @item -mfloat128
23404 @itemx -mno-float128
23405 @opindex mfloat128
23406 @opindex mno-float128
23407 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
23408 and use either software emulation for IEEE 128-bit floating point or
23409 hardware instructions.
23410
23411 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
23412 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
23413 use the IEEE 128-bit floating point support. The IEEE 128-bit
23414 floating point support only works on PowerPC Linux systems.
23415
23416 The default for @option{-mfloat128} is enabled on PowerPC Linux
23417 systems using the VSX instruction set, and disabled on other systems.
23418
23419 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
23420 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
23421 point support will also enable the generation of ISA 3.0 IEEE 128-bit
23422 floating point instructions. Otherwise, if you do not specify to
23423 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
23424 system, IEEE 128-bit floating point will be done with software
23425 emulation.
23426
23427 @item -mfloat128-hardware
23428 @itemx -mno-float128-hardware
23429 @opindex mfloat128-hardware
23430 @opindex mno-float128-hardware
23431 Enable/disable using ISA 3.0 hardware instructions to support the
23432 @var{__float128} data type.
23433
23434 The default for @option{-mfloat128-hardware} is enabled on PowerPC
23435 Linux systems using the ISA 3.0 instruction set, and disabled on other
23436 systems.
23437
23438 @item -m32
23439 @itemx -m64
23440 @opindex m32
23441 @opindex m64
23442 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
23443 targets (including GNU/Linux). The 32-bit environment sets int, long
23444 and pointer to 32 bits and generates code that runs on any PowerPC
23445 variant. The 64-bit environment sets int to 32 bits and long and
23446 pointer to 64 bits, and generates code for PowerPC64, as for
23447 @option{-mpowerpc64}.
23448
23449 @item -mfull-toc
23450 @itemx -mno-fp-in-toc
23451 @itemx -mno-sum-in-toc
23452 @itemx -mminimal-toc
23453 @opindex mfull-toc
23454 @opindex mno-fp-in-toc
23455 @opindex mno-sum-in-toc
23456 @opindex mminimal-toc
23457 Modify generation of the TOC (Table Of Contents), which is created for
23458 every executable file. The @option{-mfull-toc} option is selected by
23459 default. In that case, GCC allocates at least one TOC entry for
23460 each unique non-automatic variable reference in your program. GCC
23461 also places floating-point constants in the TOC@. However, only
23462 16,384 entries are available in the TOC@.
23463
23464 If you receive a linker error message that saying you have overflowed
23465 the available TOC space, you can reduce the amount of TOC space used
23466 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
23467 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
23468 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
23469 generate code to calculate the sum of an address and a constant at
23470 run time instead of putting that sum into the TOC@. You may specify one
23471 or both of these options. Each causes GCC to produce very slightly
23472 slower and larger code at the expense of conserving TOC space.
23473
23474 If you still run out of space in the TOC even when you specify both of
23475 these options, specify @option{-mminimal-toc} instead. This option causes
23476 GCC to make only one TOC entry for every file. When you specify this
23477 option, GCC produces code that is slower and larger but which
23478 uses extremely little TOC space. You may wish to use this option
23479 only on files that contain less frequently-executed code.
23480
23481 @item -maix64
23482 @itemx -maix32
23483 @opindex maix64
23484 @opindex maix32
23485 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
23486 @code{long} type, and the infrastructure needed to support them.
23487 Specifying @option{-maix64} implies @option{-mpowerpc64},
23488 while @option{-maix32} disables the 64-bit ABI and
23489 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
23490
23491 @item -mxl-compat
23492 @itemx -mno-xl-compat
23493 @opindex mxl-compat
23494 @opindex mno-xl-compat
23495 Produce code that conforms more closely to IBM XL compiler semantics
23496 when using AIX-compatible ABI@. Pass floating-point arguments to
23497 prototyped functions beyond the register save area (RSA) on the stack
23498 in addition to argument FPRs. Do not assume that most significant
23499 double in 128-bit long double value is properly rounded when comparing
23500 values and converting to double. Use XL symbol names for long double
23501 support routines.
23502
23503 The AIX calling convention was extended but not initially documented to
23504 handle an obscure K&R C case of calling a function that takes the
23505 address of its arguments with fewer arguments than declared. IBM XL
23506 compilers access floating-point arguments that do not fit in the
23507 RSA from the stack when a subroutine is compiled without
23508 optimization. Because always storing floating-point arguments on the
23509 stack is inefficient and rarely needed, this option is not enabled by
23510 default and only is necessary when calling subroutines compiled by IBM
23511 XL compilers without optimization.
23512
23513 @item -mpe
23514 @opindex mpe
23515 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
23516 application written to use message passing with special startup code to
23517 enable the application to run. The system must have PE installed in the
23518 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
23519 must be overridden with the @option{-specs=} option to specify the
23520 appropriate directory location. The Parallel Environment does not
23521 support threads, so the @option{-mpe} option and the @option{-pthread}
23522 option are incompatible.
23523
23524 @item -malign-natural
23525 @itemx -malign-power
23526 @opindex malign-natural
23527 @opindex malign-power
23528 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23529 @option{-malign-natural} overrides the ABI-defined alignment of larger
23530 types, such as floating-point doubles, on their natural size-based boundary.
23531 The option @option{-malign-power} instructs GCC to follow the ABI-specified
23532 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
23533
23534 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
23535 is not supported.
23536
23537 @item -msoft-float
23538 @itemx -mhard-float
23539 @opindex msoft-float
23540 @opindex mhard-float
23541 Generate code that does not use (uses) the floating-point register set.
23542 Software floating-point emulation is provided if you use the
23543 @option{-msoft-float} option, and pass the option to GCC when linking.
23544
23545 @item -msingle-float
23546 @itemx -mdouble-float
23547 @opindex msingle-float
23548 @opindex mdouble-float
23549 Generate code for single- or double-precision floating-point operations.
23550 @option{-mdouble-float} implies @option{-msingle-float}.
23551
23552 @item -msimple-fpu
23553 @opindex msimple-fpu
23554 Do not generate @code{sqrt} and @code{div} instructions for hardware
23555 floating-point unit.
23556
23557 @item -mfpu=@var{name}
23558 @opindex mfpu
23559 Specify type of floating-point unit. Valid values for @var{name} are
23560 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
23561 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
23562 @samp{sp_full} (equivalent to @option{-msingle-float}),
23563 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
23564
23565 @item -mxilinx-fpu
23566 @opindex mxilinx-fpu
23567 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
23568
23569 @item -mmultiple
23570 @itemx -mno-multiple
23571 @opindex mmultiple
23572 @opindex mno-multiple
23573 Generate code that uses (does not use) the load multiple word
23574 instructions and the store multiple word instructions. These
23575 instructions are generated by default on POWER systems, and not
23576 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
23577 PowerPC systems, since those instructions do not work when the
23578 processor is in little-endian mode. The exceptions are PPC740 and
23579 PPC750 which permit these instructions in little-endian mode.
23580
23581 @item -mupdate
23582 @itemx -mno-update
23583 @opindex mupdate
23584 @opindex mno-update
23585 Generate code that uses (does not use) the load or store instructions
23586 that update the base register to the address of the calculated memory
23587 location. These instructions are generated by default. If you use
23588 @option{-mno-update}, there is a small window between the time that the
23589 stack pointer is updated and the address of the previous frame is
23590 stored, which means code that walks the stack frame across interrupts or
23591 signals may get corrupted data.
23592
23593 @item -mavoid-indexed-addresses
23594 @itemx -mno-avoid-indexed-addresses
23595 @opindex mavoid-indexed-addresses
23596 @opindex mno-avoid-indexed-addresses
23597 Generate code that tries to avoid (not avoid) the use of indexed load
23598 or store instructions. These instructions can incur a performance
23599 penalty on Power6 processors in certain situations, such as when
23600 stepping through large arrays that cross a 16M boundary. This option
23601 is enabled by default when targeting Power6 and disabled otherwise.
23602
23603 @item -mfused-madd
23604 @itemx -mno-fused-madd
23605 @opindex mfused-madd
23606 @opindex mno-fused-madd
23607 Generate code that uses (does not use) the floating-point multiply and
23608 accumulate instructions. These instructions are generated by default
23609 if hardware floating point is used. The machine-dependent
23610 @option{-mfused-madd} option is now mapped to the machine-independent
23611 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23612 mapped to @option{-ffp-contract=off}.
23613
23614 @item -mmulhw
23615 @itemx -mno-mulhw
23616 @opindex mmulhw
23617 @opindex mno-mulhw
23618 Generate code that uses (does not use) the half-word multiply and
23619 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
23620 These instructions are generated by default when targeting those
23621 processors.
23622
23623 @item -mdlmzb
23624 @itemx -mno-dlmzb
23625 @opindex mdlmzb
23626 @opindex mno-dlmzb
23627 Generate code that uses (does not use) the string-search @samp{dlmzb}
23628 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
23629 generated by default when targeting those processors.
23630
23631 @item -mno-bit-align
23632 @itemx -mbit-align
23633 @opindex mno-bit-align
23634 @opindex mbit-align
23635 On System V.4 and embedded PowerPC systems do not (do) force structures
23636 and unions that contain bit-fields to be aligned to the base type of the
23637 bit-field.
23638
23639 For example, by default a structure containing nothing but 8
23640 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
23641 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
23642 the structure is aligned to a 1-byte boundary and is 1 byte in
23643 size.
23644
23645 @item -mno-strict-align
23646 @itemx -mstrict-align
23647 @opindex mno-strict-align
23648 @opindex mstrict-align
23649 On System V.4 and embedded PowerPC systems do not (do) assume that
23650 unaligned memory references are handled by the system.
23651
23652 @item -mrelocatable
23653 @itemx -mno-relocatable
23654 @opindex mrelocatable
23655 @opindex mno-relocatable
23656 Generate code that allows (does not allow) a static executable to be
23657 relocated to a different address at run time. A simple embedded
23658 PowerPC system loader should relocate the entire contents of
23659 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
23660 a table of 32-bit addresses generated by this option. For this to
23661 work, all objects linked together must be compiled with
23662 @option{-mrelocatable} or @option{-mrelocatable-lib}.
23663 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
23664
23665 @item -mrelocatable-lib
23666 @itemx -mno-relocatable-lib
23667 @opindex mrelocatable-lib
23668 @opindex mno-relocatable-lib
23669 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
23670 @code{.fixup} section to allow static executables to be relocated at
23671 run time, but @option{-mrelocatable-lib} does not use the smaller stack
23672 alignment of @option{-mrelocatable}. Objects compiled with
23673 @option{-mrelocatable-lib} may be linked with objects compiled with
23674 any combination of the @option{-mrelocatable} options.
23675
23676 @item -mno-toc
23677 @itemx -mtoc
23678 @opindex mno-toc
23679 @opindex mtoc
23680 On System V.4 and embedded PowerPC systems do not (do) assume that
23681 register 2 contains a pointer to a global area pointing to the addresses
23682 used in the program.
23683
23684 @item -mlittle
23685 @itemx -mlittle-endian
23686 @opindex mlittle
23687 @opindex mlittle-endian
23688 On System V.4 and embedded PowerPC systems compile code for the
23689 processor in little-endian mode. The @option{-mlittle-endian} option is
23690 the same as @option{-mlittle}.
23691
23692 @item -mbig
23693 @itemx -mbig-endian
23694 @opindex mbig
23695 @opindex mbig-endian
23696 On System V.4 and embedded PowerPC systems compile code for the
23697 processor in big-endian mode. The @option{-mbig-endian} option is
23698 the same as @option{-mbig}.
23699
23700 @item -mdynamic-no-pic
23701 @opindex mdynamic-no-pic
23702 On Darwin and Mac OS X systems, compile code so that it is not
23703 relocatable, but that its external references are relocatable. The
23704 resulting code is suitable for applications, but not shared
23705 libraries.
23706
23707 @item -msingle-pic-base
23708 @opindex msingle-pic-base
23709 Treat the register used for PIC addressing as read-only, rather than
23710 loading it in the prologue for each function. The runtime system is
23711 responsible for initializing this register with an appropriate value
23712 before execution begins.
23713
23714 @item -mprioritize-restricted-insns=@var{priority}
23715 @opindex mprioritize-restricted-insns
23716 This option controls the priority that is assigned to
23717 dispatch-slot restricted instructions during the second scheduling
23718 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23719 or @samp{2} to assign no, highest, or second-highest (respectively)
23720 priority to dispatch-slot restricted
23721 instructions.
23722
23723 @item -msched-costly-dep=@var{dependence_type}
23724 @opindex msched-costly-dep
23725 This option controls which dependences are considered costly
23726 by the target during instruction scheduling. The argument
23727 @var{dependence_type} takes one of the following values:
23728
23729 @table @asis
23730 @item @samp{no}
23731 No dependence is costly.
23732
23733 @item @samp{all}
23734 All dependences are costly.
23735
23736 @item @samp{true_store_to_load}
23737 A true dependence from store to load is costly.
23738
23739 @item @samp{store_to_load}
23740 Any dependence from store to load is costly.
23741
23742 @item @var{number}
23743 Any dependence for which the latency is greater than or equal to
23744 @var{number} is costly.
23745 @end table
23746
23747 @item -minsert-sched-nops=@var{scheme}
23748 @opindex minsert-sched-nops
23749 This option controls which NOP insertion scheme is used during
23750 the second scheduling pass. The argument @var{scheme} takes one of the
23751 following values:
23752
23753 @table @asis
23754 @item @samp{no}
23755 Don't insert NOPs.
23756
23757 @item @samp{pad}
23758 Pad with NOPs any dispatch group that has vacant issue slots,
23759 according to the scheduler's grouping.
23760
23761 @item @samp{regroup_exact}
23762 Insert NOPs to force costly dependent insns into
23763 separate groups. Insert exactly as many NOPs as needed to force an insn
23764 to a new group, according to the estimated processor grouping.
23765
23766 @item @var{number}
23767 Insert NOPs to force costly dependent insns into
23768 separate groups. Insert @var{number} NOPs to force an insn to a new group.
23769 @end table
23770
23771 @item -mcall-sysv
23772 @opindex mcall-sysv
23773 On System V.4 and embedded PowerPC systems compile code using calling
23774 conventions that adhere to the March 1995 draft of the System V
23775 Application Binary Interface, PowerPC processor supplement. This is the
23776 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
23777
23778 @item -mcall-sysv-eabi
23779 @itemx -mcall-eabi
23780 @opindex mcall-sysv-eabi
23781 @opindex mcall-eabi
23782 Specify both @option{-mcall-sysv} and @option{-meabi} options.
23783
23784 @item -mcall-sysv-noeabi
23785 @opindex mcall-sysv-noeabi
23786 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
23787
23788 @item -mcall-aixdesc
23789 @opindex m
23790 On System V.4 and embedded PowerPC systems compile code for the AIX
23791 operating system.
23792
23793 @item -mcall-linux
23794 @opindex mcall-linux
23795 On System V.4 and embedded PowerPC systems compile code for the
23796 Linux-based GNU system.
23797
23798 @item -mcall-freebsd
23799 @opindex mcall-freebsd
23800 On System V.4 and embedded PowerPC systems compile code for the
23801 FreeBSD operating system.
23802
23803 @item -mcall-netbsd
23804 @opindex mcall-netbsd
23805 On System V.4 and embedded PowerPC systems compile code for the
23806 NetBSD operating system.
23807
23808 @item -mcall-openbsd
23809 @opindex mcall-netbsd
23810 On System V.4 and embedded PowerPC systems compile code for the
23811 OpenBSD operating system.
23812
23813 @item -maix-struct-return
23814 @opindex maix-struct-return
23815 Return all structures in memory (as specified by the AIX ABI)@.
23816
23817 @item -msvr4-struct-return
23818 @opindex msvr4-struct-return
23819 Return structures smaller than 8 bytes in registers (as specified by the
23820 SVR4 ABI)@.
23821
23822 @item -mabi=@var{abi-type}
23823 @opindex mabi
23824 Extend the current ABI with a particular extension, or remove such extension.
23825 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
23826 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
23827 @samp{elfv1}, @samp{elfv2}@.
23828
23829 @item -mabi=spe
23830 @opindex mabi=spe
23831 Extend the current ABI with SPE ABI extensions. This does not change
23832 the default ABI, instead it adds the SPE ABI extensions to the current
23833 ABI@.
23834
23835 @item -mabi=no-spe
23836 @opindex mabi=no-spe
23837 Disable Book-E SPE ABI extensions for the current ABI@.
23838
23839 @item -mabi=ibmlongdouble
23840 @opindex mabi=ibmlongdouble
23841 Change the current ABI to use IBM extended-precision long double.
23842 This is not likely to work if your system defaults to using IEEE
23843 extended-precision long double. If you change the long double type
23844 from IEEE extended-precision, the compiler will issue a warning unless
23845 you use the @option{-Wno-psabi} option.
23846
23847 @item -mabi=ieeelongdouble
23848 @opindex mabi=ieeelongdouble
23849 Change the current ABI to use IEEE extended-precision long double.
23850 This is not likely to work if your system defaults to using IBM
23851 extended-precision long double. If you change the long double type
23852 from IBM extended-precision, the compiler will issue a warning unless
23853 you use the @option{-Wno-psabi} option.
23854
23855 @item -mabi=elfv1
23856 @opindex mabi=elfv1
23857 Change the current ABI to use the ELFv1 ABI.
23858 This is the default ABI for big-endian PowerPC 64-bit Linux.
23859 Overriding the default ABI requires special system support and is
23860 likely to fail in spectacular ways.
23861
23862 @item -mabi=elfv2
23863 @opindex mabi=elfv2
23864 Change the current ABI to use the ELFv2 ABI.
23865 This is the default ABI for little-endian PowerPC 64-bit Linux.
23866 Overriding the default ABI requires special system support and is
23867 likely to fail in spectacular ways.
23868
23869 @item -mgnu-attribute
23870 @itemx -mno-gnu-attribute
23871 @opindex mgnu-attribute
23872 @opindex mno-gnu-attribute
23873 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23874 .gnu.attributes section that specify ABI variations in function
23875 parameters or return values.
23876
23877 @item -mprototype
23878 @itemx -mno-prototype
23879 @opindex mprototype
23880 @opindex mno-prototype
23881 On System V.4 and embedded PowerPC systems assume that all calls to
23882 variable argument functions are properly prototyped. Otherwise, the
23883 compiler must insert an instruction before every non-prototyped call to
23884 set or clear bit 6 of the condition code register (@code{CR}) to
23885 indicate whether floating-point values are passed in the floating-point
23886 registers in case the function takes variable arguments. With
23887 @option{-mprototype}, only calls to prototyped variable argument functions
23888 set or clear the bit.
23889
23890 @item -msim
23891 @opindex msim
23892 On embedded PowerPC systems, assume that the startup module is called
23893 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
23894 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
23895 configurations.
23896
23897 @item -mmvme
23898 @opindex mmvme
23899 On embedded PowerPC systems, assume that the startup module is called
23900 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
23901 @file{libc.a}.
23902
23903 @item -mads
23904 @opindex mads
23905 On embedded PowerPC systems, assume that the startup module is called
23906 @file{crt0.o} and the standard C libraries are @file{libads.a} and
23907 @file{libc.a}.
23908
23909 @item -myellowknife
23910 @opindex myellowknife
23911 On embedded PowerPC systems, assume that the startup module is called
23912 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
23913 @file{libc.a}.
23914
23915 @item -mvxworks
23916 @opindex mvxworks
23917 On System V.4 and embedded PowerPC systems, specify that you are
23918 compiling for a VxWorks system.
23919
23920 @item -memb
23921 @opindex memb
23922 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
23923 header to indicate that @samp{eabi} extended relocations are used.
23924
23925 @item -meabi
23926 @itemx -mno-eabi
23927 @opindex meabi
23928 @opindex mno-eabi
23929 On System V.4 and embedded PowerPC systems do (do not) adhere to the
23930 Embedded Applications Binary Interface (EABI), which is a set of
23931 modifications to the System V.4 specifications. Selecting @option{-meabi}
23932 means that the stack is aligned to an 8-byte boundary, a function
23933 @code{__eabi} is called from @code{main} to set up the EABI
23934 environment, and the @option{-msdata} option can use both @code{r2} and
23935 @code{r13} to point to two separate small data areas. Selecting
23936 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
23937 no EABI initialization function is called from @code{main}, and the
23938 @option{-msdata} option only uses @code{r13} to point to a single
23939 small data area. The @option{-meabi} option is on by default if you
23940 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
23941
23942 @item -msdata=eabi
23943 @opindex msdata=eabi
23944 On System V.4 and embedded PowerPC systems, put small initialized
23945 @code{const} global and static data in the @code{.sdata2} section, which
23946 is pointed to by register @code{r2}. Put small initialized
23947 non-@code{const} global and static data in the @code{.sdata} section,
23948 which is pointed to by register @code{r13}. Put small uninitialized
23949 global and static data in the @code{.sbss} section, which is adjacent to
23950 the @code{.sdata} section. The @option{-msdata=eabi} option is
23951 incompatible with the @option{-mrelocatable} option. The
23952 @option{-msdata=eabi} option also sets the @option{-memb} option.
23953
23954 @item -msdata=sysv
23955 @opindex msdata=sysv
23956 On System V.4 and embedded PowerPC systems, put small global and static
23957 data in the @code{.sdata} section, which is pointed to by register
23958 @code{r13}. Put small uninitialized global and static data in the
23959 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
23960 The @option{-msdata=sysv} option is incompatible with the
23961 @option{-mrelocatable} option.
23962
23963 @item -msdata=default
23964 @itemx -msdata
23965 @opindex msdata=default
23966 @opindex msdata
23967 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
23968 compile code the same as @option{-msdata=eabi}, otherwise compile code the
23969 same as @option{-msdata=sysv}.
23970
23971 @item -msdata=data
23972 @opindex msdata=data
23973 On System V.4 and embedded PowerPC systems, put small global
23974 data in the @code{.sdata} section. Put small uninitialized global
23975 data in the @code{.sbss} section. Do not use register @code{r13}
23976 to address small data however. This is the default behavior unless
23977 other @option{-msdata} options are used.
23978
23979 @item -msdata=none
23980 @itemx -mno-sdata
23981 @opindex msdata=none
23982 @opindex mno-sdata
23983 On embedded PowerPC systems, put all initialized global and static data
23984 in the @code{.data} section, and all uninitialized data in the
23985 @code{.bss} section.
23986
23987 @item -mblock-move-inline-limit=@var{num}
23988 @opindex mblock-move-inline-limit
23989 Inline all block moves (such as calls to @code{memcpy} or structure
23990 copies) less than or equal to @var{num} bytes. The minimum value for
23991 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
23992 targets. The default value is target-specific.
23993
23994 @item -G @var{num}
23995 @opindex G
23996 @cindex smaller data references (PowerPC)
23997 @cindex .sdata/.sdata2 references (PowerPC)
23998 On embedded PowerPC systems, put global and static items less than or
23999 equal to @var{num} bytes into the small data or BSS sections instead of
24000 the normal data or BSS section. By default, @var{num} is 8. The
24001 @option{-G @var{num}} switch is also passed to the linker.
24002 All modules should be compiled with the same @option{-G @var{num}} value.
24003
24004 @item -mregnames
24005 @itemx -mno-regnames
24006 @opindex mregnames
24007 @opindex mno-regnames
24008 On System V.4 and embedded PowerPC systems do (do not) emit register
24009 names in the assembly language output using symbolic forms.
24010
24011 @item -mlongcall
24012 @itemx -mno-longcall
24013 @opindex mlongcall
24014 @opindex mno-longcall
24015 By default assume that all calls are far away so that a longer and more
24016 expensive calling sequence is required. This is required for calls
24017 farther than 32 megabytes (33,554,432 bytes) from the current location.
24018 A short call is generated if the compiler knows
24019 the call cannot be that far away. This setting can be overridden by
24020 the @code{shortcall} function attribute, or by @code{#pragma
24021 longcall(0)}.
24022
24023 Some linkers are capable of detecting out-of-range calls and generating
24024 glue code on the fly. On these systems, long calls are unnecessary and
24025 generate slower code. As of this writing, the AIX linker can do this,
24026 as can the GNU linker for PowerPC/64. It is planned to add this feature
24027 to the GNU linker for 32-bit PowerPC systems as well.
24028
24029 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24030 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24031 addresses represent the callee and the branch island. The
24032 Darwin/PPC linker prefers the first address and generates a @code{bl
24033 callee} if the PPC @code{bl} instruction reaches the callee directly;
24034 otherwise, the linker generates @code{bl L42} to call the branch
24035 island. The branch island is appended to the body of the
24036 calling function; it computes the full 32-bit address of the callee
24037 and jumps to it.
24038
24039 On Mach-O (Darwin) systems, this option directs the compiler emit to
24040 the glue for every direct call, and the Darwin linker decides whether
24041 to use or discard it.
24042
24043 In the future, GCC may ignore all longcall specifications
24044 when the linker is known to generate glue.
24045
24046 @item -mtls-markers
24047 @itemx -mno-tls-markers
24048 @opindex mtls-markers
24049 @opindex mno-tls-markers
24050 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24051 specifying the function argument. The relocation allows the linker to
24052 reliably associate function call with argument setup instructions for
24053 TLS optimization, which in turn allows GCC to better schedule the
24054 sequence.
24055
24056 @item -mrecip
24057 @itemx -mno-recip
24058 @opindex mrecip
24059 This option enables use of the reciprocal estimate and
24060 reciprocal square root estimate instructions with additional
24061 Newton-Raphson steps to increase precision instead of doing a divide or
24062 square root and divide for floating-point arguments. You should use
24063 the @option{-ffast-math} option when using @option{-mrecip} (or at
24064 least @option{-funsafe-math-optimizations},
24065 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24066 @option{-fno-trapping-math}). Note that while the throughput of the
24067 sequence is generally higher than the throughput of the non-reciprocal
24068 instruction, the precision of the sequence can be decreased by up to 2
24069 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24070 roots.
24071
24072 @item -mrecip=@var{opt}
24073 @opindex mrecip=opt
24074 This option controls which reciprocal estimate instructions
24075 may be used. @var{opt} is a comma-separated list of options, which may
24076 be preceded by a @code{!} to invert the option:
24077
24078 @table @samp
24079
24080 @item all
24081 Enable all estimate instructions.
24082
24083 @item default
24084 Enable the default instructions, equivalent to @option{-mrecip}.
24085
24086 @item none
24087 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24088
24089 @item div
24090 Enable the reciprocal approximation instructions for both
24091 single and double precision.
24092
24093 @item divf
24094 Enable the single-precision reciprocal approximation instructions.
24095
24096 @item divd
24097 Enable the double-precision reciprocal approximation instructions.
24098
24099 @item rsqrt
24100 Enable the reciprocal square root approximation instructions for both
24101 single and double precision.
24102
24103 @item rsqrtf
24104 Enable the single-precision reciprocal square root approximation instructions.
24105
24106 @item rsqrtd
24107 Enable the double-precision reciprocal square root approximation instructions.
24108
24109 @end table
24110
24111 So, for example, @option{-mrecip=all,!rsqrtd} enables
24112 all of the reciprocal estimate instructions, except for the
24113 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24114 which handle the double-precision reciprocal square root calculations.
24115
24116 @item -mrecip-precision
24117 @itemx -mno-recip-precision
24118 @opindex mrecip-precision
24119 Assume (do not assume) that the reciprocal estimate instructions
24120 provide higher-precision estimates than is mandated by the PowerPC
24121 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24122 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24123 The double-precision square root estimate instructions are not generated by
24124 default on low-precision machines, since they do not provide an
24125 estimate that converges after three steps.
24126
24127 @item -mveclibabi=@var{type}
24128 @opindex mveclibabi
24129 Specifies the ABI type to use for vectorizing intrinsics using an
24130 external library. The only type supported at present is @samp{mass},
24131 which specifies to use IBM's Mathematical Acceleration Subsystem
24132 (MASS) libraries for vectorizing intrinsics using external libraries.
24133 GCC currently emits calls to @code{acosd2}, @code{acosf4},
24134 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
24135 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
24136 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
24137 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
24138 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
24139 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
24140 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
24141 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
24142 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
24143 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
24144 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
24145 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
24146 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
24147 for power7. Both @option{-ftree-vectorize} and
24148 @option{-funsafe-math-optimizations} must also be enabled. The MASS
24149 libraries must be specified at link time.
24150
24151 @item -mfriz
24152 @itemx -mno-friz
24153 @opindex mfriz
24154 Generate (do not generate) the @code{friz} instruction when the
24155 @option{-funsafe-math-optimizations} option is used to optimize
24156 rounding of floating-point values to 64-bit integer and back to floating
24157 point. The @code{friz} instruction does not return the same value if
24158 the floating-point number is too large to fit in an integer.
24159
24160 @item -mpointers-to-nested-functions
24161 @itemx -mno-pointers-to-nested-functions
24162 @opindex mpointers-to-nested-functions
24163 Generate (do not generate) code to load up the static chain register
24164 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24165 systems where a function pointer points to a 3-word descriptor giving
24166 the function address, TOC value to be loaded in register @code{r2}, and
24167 static chain value to be loaded in register @code{r11}. The
24168 @option{-mpointers-to-nested-functions} is on by default. You cannot
24169 call through pointers to nested functions or pointers
24170 to functions compiled in other languages that use the static chain if
24171 you use @option{-mno-pointers-to-nested-functions}.
24172
24173 @item -msave-toc-indirect
24174 @itemx -mno-save-toc-indirect
24175 @opindex msave-toc-indirect
24176 Generate (do not generate) code to save the TOC value in the reserved
24177 stack location in the function prologue if the function calls through
24178 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24179 saved in the prologue, it is saved just before the call through the
24180 pointer. The @option{-mno-save-toc-indirect} option is the default.
24181
24182 @item -mcompat-align-parm
24183 @itemx -mno-compat-align-parm
24184 @opindex mcompat-align-parm
24185 Generate (do not generate) code to pass structure parameters with a
24186 maximum alignment of 64 bits, for compatibility with older versions
24187 of GCC.
24188
24189 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24190 structure parameter on a 128-bit boundary when that structure contained
24191 a member requiring 128-bit alignment. This is corrected in more
24192 recent versions of GCC. This option may be used to generate code
24193 that is compatible with functions compiled with older versions of
24194 GCC.
24195
24196 The @option{-mno-compat-align-parm} option is the default.
24197
24198 @item -mstack-protector-guard=@var{guard}
24199 @itemx -mstack-protector-guard-reg=@var{reg}
24200 @itemx -mstack-protector-guard-offset=@var{offset}
24201 @itemx -mstack-protector-guard-symbol=@var{symbol}
24202 @opindex mstack-protector-guard
24203 @opindex mstack-protector-guard-reg
24204 @opindex mstack-protector-guard-offset
24205 @opindex mstack-protector-guard-symbol
24206 Generate stack protection code using canary at @var{guard}. Supported
24207 locations are @samp{global} for global canary or @samp{tls} for per-thread
24208 canary in the TLS block (the default with GNU libc version 2.4 or later).
24209
24210 With the latter choice the options
24211 @option{-mstack-protector-guard-reg=@var{reg}} and
24212 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
24213 which register to use as base register for reading the canary, and from what
24214 offset from that base register. The default for those is as specified in the
24215 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
24216 the offset with a symbol reference to a canary in the TLS block.
24217 @end table
24218
24219 @node RX Options
24220 @subsection RX Options
24221 @cindex RX Options
24222
24223 These command-line options are defined for RX targets:
24224
24225 @table @gcctabopt
24226 @item -m64bit-doubles
24227 @itemx -m32bit-doubles
24228 @opindex m64bit-doubles
24229 @opindex m32bit-doubles
24230 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24231 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24232 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
24233 works on 32-bit values, which is why the default is
24234 @option{-m32bit-doubles}.
24235
24236 @item -fpu
24237 @itemx -nofpu
24238 @opindex fpu
24239 @opindex nofpu
24240 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
24241 floating-point hardware. The default is enabled for the RX600
24242 series and disabled for the RX200 series.
24243
24244 Floating-point instructions are only generated for 32-bit floating-point
24245 values, however, so the FPU hardware is not used for doubles if the
24246 @option{-m64bit-doubles} option is used.
24247
24248 @emph{Note} If the @option{-fpu} option is enabled then
24249 @option{-funsafe-math-optimizations} is also enabled automatically.
24250 This is because the RX FPU instructions are themselves unsafe.
24251
24252 @item -mcpu=@var{name}
24253 @opindex mcpu
24254 Selects the type of RX CPU to be targeted. Currently three types are
24255 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
24256 the specific @samp{RX610} CPU. The default is @samp{RX600}.
24257
24258 The only difference between @samp{RX600} and @samp{RX610} is that the
24259 @samp{RX610} does not support the @code{MVTIPL} instruction.
24260
24261 The @samp{RX200} series does not have a hardware floating-point unit
24262 and so @option{-nofpu} is enabled by default when this type is
24263 selected.
24264
24265 @item -mbig-endian-data
24266 @itemx -mlittle-endian-data
24267 @opindex mbig-endian-data
24268 @opindex mlittle-endian-data
24269 Store data (but not code) in the big-endian format. The default is
24270 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
24271 format.
24272
24273 @item -msmall-data-limit=@var{N}
24274 @opindex msmall-data-limit
24275 Specifies the maximum size in bytes of global and static variables
24276 which can be placed into the small data area. Using the small data
24277 area can lead to smaller and faster code, but the size of area is
24278 limited and it is up to the programmer to ensure that the area does
24279 not overflow. Also when the small data area is used one of the RX's
24280 registers (usually @code{r13}) is reserved for use pointing to this
24281 area, so it is no longer available for use by the compiler. This
24282 could result in slower and/or larger code if variables are pushed onto
24283 the stack instead of being held in this register.
24284
24285 Note, common variables (variables that have not been initialized) and
24286 constants are not placed into the small data area as they are assigned
24287 to other sections in the output executable.
24288
24289 The default value is zero, which disables this feature. Note, this
24290 feature is not enabled by default with higher optimization levels
24291 (@option{-O2} etc) because of the potentially detrimental effects of
24292 reserving a register. It is up to the programmer to experiment and
24293 discover whether this feature is of benefit to their program. See the
24294 description of the @option{-mpid} option for a description of how the
24295 actual register to hold the small data area pointer is chosen.
24296
24297 @item -msim
24298 @itemx -mno-sim
24299 @opindex msim
24300 @opindex mno-sim
24301 Use the simulator runtime. The default is to use the libgloss
24302 board-specific runtime.
24303
24304 @item -mas100-syntax
24305 @itemx -mno-as100-syntax
24306 @opindex mas100-syntax
24307 @opindex mno-as100-syntax
24308 When generating assembler output use a syntax that is compatible with
24309 Renesas's AS100 assembler. This syntax can also be handled by the GAS
24310 assembler, but it has some restrictions so it is not generated by default.
24311
24312 @item -mmax-constant-size=@var{N}
24313 @opindex mmax-constant-size
24314 Specifies the maximum size, in bytes, of a constant that can be used as
24315 an operand in a RX instruction. Although the RX instruction set does
24316 allow constants of up to 4 bytes in length to be used in instructions,
24317 a longer value equates to a longer instruction. Thus in some
24318 circumstances it can be beneficial to restrict the size of constants
24319 that are used in instructions. Constants that are too big are instead
24320 placed into a constant pool and referenced via register indirection.
24321
24322 The value @var{N} can be between 0 and 4. A value of 0 (the default)
24323 or 4 means that constants of any size are allowed.
24324
24325 @item -mrelax
24326 @opindex mrelax
24327 Enable linker relaxation. Linker relaxation is a process whereby the
24328 linker attempts to reduce the size of a program by finding shorter
24329 versions of various instructions. Disabled by default.
24330
24331 @item -mint-register=@var{N}
24332 @opindex mint-register
24333 Specify the number of registers to reserve for fast interrupt handler
24334 functions. The value @var{N} can be between 0 and 4. A value of 1
24335 means that register @code{r13} is reserved for the exclusive use
24336 of fast interrupt handlers. A value of 2 reserves @code{r13} and
24337 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
24338 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
24339 A value of 0, the default, does not reserve any registers.
24340
24341 @item -msave-acc-in-interrupts
24342 @opindex msave-acc-in-interrupts
24343 Specifies that interrupt handler functions should preserve the
24344 accumulator register. This is only necessary if normal code might use
24345 the accumulator register, for example because it performs 64-bit
24346 multiplications. The default is to ignore the accumulator as this
24347 makes the interrupt handlers faster.
24348
24349 @item -mpid
24350 @itemx -mno-pid
24351 @opindex mpid
24352 @opindex mno-pid
24353 Enables the generation of position independent data. When enabled any
24354 access to constant data is done via an offset from a base address
24355 held in a register. This allows the location of constant data to be
24356 determined at run time without requiring the executable to be
24357 relocated, which is a benefit to embedded applications with tight
24358 memory constraints. Data that can be modified is not affected by this
24359 option.
24360
24361 Note, using this feature reserves a register, usually @code{r13}, for
24362 the constant data base address. This can result in slower and/or
24363 larger code, especially in complicated functions.
24364
24365 The actual register chosen to hold the constant data base address
24366 depends upon whether the @option{-msmall-data-limit} and/or the
24367 @option{-mint-register} command-line options are enabled. Starting
24368 with register @code{r13} and proceeding downwards, registers are
24369 allocated first to satisfy the requirements of @option{-mint-register},
24370 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
24371 is possible for the small data area register to be @code{r8} if both
24372 @option{-mint-register=4} and @option{-mpid} are specified on the
24373 command line.
24374
24375 By default this feature is not enabled. The default can be restored
24376 via the @option{-mno-pid} command-line option.
24377
24378 @item -mno-warn-multiple-fast-interrupts
24379 @itemx -mwarn-multiple-fast-interrupts
24380 @opindex mno-warn-multiple-fast-interrupts
24381 @opindex mwarn-multiple-fast-interrupts
24382 Prevents GCC from issuing a warning message if it finds more than one
24383 fast interrupt handler when it is compiling a file. The default is to
24384 issue a warning for each extra fast interrupt handler found, as the RX
24385 only supports one such interrupt.
24386
24387 @item -mallow-string-insns
24388 @itemx -mno-allow-string-insns
24389 @opindex mallow-string-insns
24390 @opindex mno-allow-string-insns
24391 Enables or disables the use of the string manipulation instructions
24392 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
24393 @code{SWHILE} and also the @code{RMPA} instruction. These
24394 instructions may prefetch data, which is not safe to do if accessing
24395 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
24396 for more information).
24397
24398 The default is to allow these instructions, but it is not possible for
24399 GCC to reliably detect all circumstances where a string instruction
24400 might be used to access an I/O register, so their use cannot be
24401 disabled automatically. Instead it is reliant upon the programmer to
24402 use the @option{-mno-allow-string-insns} option if their program
24403 accesses I/O space.
24404
24405 When the instructions are enabled GCC defines the C preprocessor
24406 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
24407 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
24408
24409 @item -mjsr
24410 @itemx -mno-jsr
24411 @opindex mjsr
24412 @opindex mno-jsr
24413 Use only (or not only) @code{JSR} instructions to access functions.
24414 This option can be used when code size exceeds the range of @code{BSR}
24415 instructions. Note that @option{-mno-jsr} does not mean to not use
24416 @code{JSR} but instead means that any type of branch may be used.
24417 @end table
24418
24419 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
24420 has special significance to the RX port when used with the
24421 @code{interrupt} function attribute. This attribute indicates a
24422 function intended to process fast interrupts. GCC ensures
24423 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
24424 and/or @code{r13} and only provided that the normal use of the
24425 corresponding registers have been restricted via the
24426 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
24427 options.
24428
24429 @node S/390 and zSeries Options
24430 @subsection S/390 and zSeries Options
24431 @cindex S/390 and zSeries Options
24432
24433 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
24434
24435 @table @gcctabopt
24436 @item -mhard-float
24437 @itemx -msoft-float
24438 @opindex mhard-float
24439 @opindex msoft-float
24440 Use (do not use) the hardware floating-point instructions and registers
24441 for floating-point operations. When @option{-msoft-float} is specified,
24442 functions in @file{libgcc.a} are used to perform floating-point
24443 operations. When @option{-mhard-float} is specified, the compiler
24444 generates IEEE floating-point instructions. This is the default.
24445
24446 @item -mhard-dfp
24447 @itemx -mno-hard-dfp
24448 @opindex mhard-dfp
24449 @opindex mno-hard-dfp
24450 Use (do not use) the hardware decimal-floating-point instructions for
24451 decimal-floating-point operations. When @option{-mno-hard-dfp} is
24452 specified, functions in @file{libgcc.a} are used to perform
24453 decimal-floating-point operations. When @option{-mhard-dfp} is
24454 specified, the compiler generates decimal-floating-point hardware
24455 instructions. This is the default for @option{-march=z9-ec} or higher.
24456
24457 @item -mlong-double-64
24458 @itemx -mlong-double-128
24459 @opindex mlong-double-64
24460 @opindex mlong-double-128
24461 These switches control the size of @code{long double} type. A size
24462 of 64 bits makes the @code{long double} type equivalent to the @code{double}
24463 type. This is the default.
24464
24465 @item -mbackchain
24466 @itemx -mno-backchain
24467 @opindex mbackchain
24468 @opindex mno-backchain
24469 Store (do not store) the address of the caller's frame as backchain pointer
24470 into the callee's stack frame.
24471 A backchain may be needed to allow debugging using tools that do not understand
24472 DWARF call frame information.
24473 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
24474 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
24475 the backchain is placed into the topmost word of the 96/160 byte register
24476 save area.
24477
24478 In general, code compiled with @option{-mbackchain} is call-compatible with
24479 code compiled with @option{-mmo-backchain}; however, use of the backchain
24480 for debugging purposes usually requires that the whole binary is built with
24481 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
24482 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
24483 to build a linux kernel use @option{-msoft-float}.
24484
24485 The default is to not maintain the backchain.
24486
24487 @item -mpacked-stack
24488 @itemx -mno-packed-stack
24489 @opindex mpacked-stack
24490 @opindex mno-packed-stack
24491 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
24492 specified, the compiler uses the all fields of the 96/160 byte register save
24493 area only for their default purpose; unused fields still take up stack space.
24494 When @option{-mpacked-stack} is specified, register save slots are densely
24495 packed at the top of the register save area; unused space is reused for other
24496 purposes, allowing for more efficient use of the available stack space.
24497 However, when @option{-mbackchain} is also in effect, the topmost word of
24498 the save area is always used to store the backchain, and the return address
24499 register is always saved two words below the backchain.
24500
24501 As long as the stack frame backchain is not used, code generated with
24502 @option{-mpacked-stack} is call-compatible with code generated with
24503 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
24504 S/390 or zSeries generated code that uses the stack frame backchain at run
24505 time, not just for debugging purposes. Such code is not call-compatible
24506 with code compiled with @option{-mpacked-stack}. Also, note that the
24507 combination of @option{-mbackchain},
24508 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
24509 to build a linux kernel use @option{-msoft-float}.
24510
24511 The default is to not use the packed stack layout.
24512
24513 @item -msmall-exec
24514 @itemx -mno-small-exec
24515 @opindex msmall-exec
24516 @opindex mno-small-exec
24517 Generate (or do not generate) code using the @code{bras} instruction
24518 to do subroutine calls.
24519 This only works reliably if the total executable size does not
24520 exceed 64k. The default is to use the @code{basr} instruction instead,
24521 which does not have this limitation.
24522
24523 @item -m64
24524 @itemx -m31
24525 @opindex m64
24526 @opindex m31
24527 When @option{-m31} is specified, generate code compliant to the
24528 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
24529 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
24530 particular to generate 64-bit instructions. For the @samp{s390}
24531 targets, the default is @option{-m31}, while the @samp{s390x}
24532 targets default to @option{-m64}.
24533
24534 @item -mzarch
24535 @itemx -mesa
24536 @opindex mzarch
24537 @opindex mesa
24538 When @option{-mzarch} is specified, generate code using the
24539 instructions available on z/Architecture.
24540 When @option{-mesa} is specified, generate code using the
24541 instructions available on ESA/390. Note that @option{-mesa} is
24542 not possible with @option{-m64}.
24543 When generating code compliant to the GNU/Linux for S/390 ABI,
24544 the default is @option{-mesa}. When generating code compliant
24545 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
24546
24547 @item -mhtm
24548 @itemx -mno-htm
24549 @opindex mhtm
24550 @opindex mno-htm
24551 The @option{-mhtm} option enables a set of builtins making use of
24552 instructions available with the transactional execution facility
24553 introduced with the IBM zEnterprise EC12 machine generation
24554 @ref{S/390 System z Built-in Functions}.
24555 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
24556
24557 @item -mvx
24558 @itemx -mno-vx
24559 @opindex mvx
24560 @opindex mno-vx
24561 When @option{-mvx} is specified, generate code using the instructions
24562 available with the vector extension facility introduced with the IBM
24563 z13 machine generation.
24564 This option changes the ABI for some vector type values with regard to
24565 alignment and calling conventions. In case vector type values are
24566 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
24567 command will be added to mark the resulting binary with the ABI used.
24568 @option{-mvx} is enabled by default when using @option{-march=z13}.
24569
24570 @item -mzvector
24571 @itemx -mno-zvector
24572 @opindex mzvector
24573 @opindex mno-zvector
24574 The @option{-mzvector} option enables vector language extensions and
24575 builtins using instructions available with the vector extension
24576 facility introduced with the IBM z13 machine generation.
24577 This option adds support for @samp{vector} to be used as a keyword to
24578 define vector type variables and arguments. @samp{vector} is only
24579 available when GNU extensions are enabled. It will not be expanded
24580 when requesting strict standard compliance e.g. with @option{-std=c99}.
24581 In addition to the GCC low-level builtins @option{-mzvector} enables
24582 a set of builtins added for compatibility with AltiVec-style
24583 implementations like Power and Cell. In order to make use of these
24584 builtins the header file @file{vecintrin.h} needs to be included.
24585 @option{-mzvector} is disabled by default.
24586
24587 @item -mmvcle
24588 @itemx -mno-mvcle
24589 @opindex mmvcle
24590 @opindex mno-mvcle
24591 Generate (or do not generate) code using the @code{mvcle} instruction
24592 to perform block moves. When @option{-mno-mvcle} is specified,
24593 use a @code{mvc} loop instead. This is the default unless optimizing for
24594 size.
24595
24596 @item -mdebug
24597 @itemx -mno-debug
24598 @opindex mdebug
24599 @opindex mno-debug
24600 Print (or do not print) additional debug information when compiling.
24601 The default is to not print debug information.
24602
24603 @item -march=@var{cpu-type}
24604 @opindex march
24605 Generate code that runs on @var{cpu-type}, which is the name of a
24606 system representing a certain processor type. Possible values for
24607 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
24608 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
24609 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
24610 @samp{native}.
24611
24612 The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and
24613 @samp{g6} are deprecated and will be removed with future releases.
24614
24615 Specifying @samp{native} as cpu type can be used to select the best
24616 architecture option for the host processor.
24617 @option{-march=native} has no effect if GCC does not recognize the
24618 processor.
24619
24620 @item -mtune=@var{cpu-type}
24621 @opindex mtune
24622 Tune to @var{cpu-type} everything applicable about the generated code,
24623 except for the ABI and the set of available instructions.
24624 The list of @var{cpu-type} values is the same as for @option{-march}.
24625 The default is the value used for @option{-march}.
24626
24627 @item -mtpf-trace
24628 @itemx -mno-tpf-trace
24629 @opindex mtpf-trace
24630 @opindex mno-tpf-trace
24631 Generate code that adds (does not add) in TPF OS specific branches to trace
24632 routines in the operating system. This option is off by default, even
24633 when compiling for the TPF OS@.
24634
24635 @item -mfused-madd
24636 @itemx -mno-fused-madd
24637 @opindex mfused-madd
24638 @opindex mno-fused-madd
24639 Generate code that uses (does not use) the floating-point multiply and
24640 accumulate instructions. These instructions are generated by default if
24641 hardware floating point is used.
24642
24643 @item -mwarn-framesize=@var{framesize}
24644 @opindex mwarn-framesize
24645 Emit a warning if the current function exceeds the given frame size. Because
24646 this is a compile-time check it doesn't need to be a real problem when the program
24647 runs. It is intended to identify functions that most probably cause
24648 a stack overflow. It is useful to be used in an environment with limited stack
24649 size e.g.@: the linux kernel.
24650
24651 @item -mwarn-dynamicstack
24652 @opindex mwarn-dynamicstack
24653 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
24654 arrays. This is generally a bad idea with a limited stack size.
24655
24656 @item -mstack-guard=@var{stack-guard}
24657 @itemx -mstack-size=@var{stack-size}
24658 @opindex mstack-guard
24659 @opindex mstack-size
24660 If these options are provided the S/390 back end emits additional instructions in
24661 the function prologue that trigger a trap if the stack size is @var{stack-guard}
24662 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
24663 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
24664 the frame size of the compiled function is chosen.
24665 These options are intended to be used to help debugging stack overflow problems.
24666 The additionally emitted code causes only little overhead and hence can also be
24667 used in production-like systems without greater performance degradation. The given
24668 values have to be exact powers of 2 and @var{stack-size} has to be greater than
24669 @var{stack-guard} without exceeding 64k.
24670 In order to be efficient the extra code makes the assumption that the stack starts
24671 at an address aligned to the value given by @var{stack-size}.
24672 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
24673
24674 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
24675 @opindex mhotpatch
24676 If the hotpatch option is enabled, a ``hot-patching'' function
24677 prologue is generated for all functions in the compilation unit.
24678 The funtion label is prepended with the given number of two-byte
24679 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
24680 the label, 2 * @var{post-halfwords} bytes are appended, using the
24681 largest NOP like instructions the architecture allows (maximum
24682 1000000).
24683
24684 If both arguments are zero, hotpatching is disabled.
24685
24686 This option can be overridden for individual functions with the
24687 @code{hotpatch} attribute.
24688 @end table
24689
24690 @node Score Options
24691 @subsection Score Options
24692 @cindex Score Options
24693
24694 These options are defined for Score implementations:
24695
24696 @table @gcctabopt
24697 @item -meb
24698 @opindex meb
24699 Compile code for big-endian mode. This is the default.
24700
24701 @item -mel
24702 @opindex mel
24703 Compile code for little-endian mode.
24704
24705 @item -mnhwloop
24706 @opindex mnhwloop
24707 Disable generation of @code{bcnz} instructions.
24708
24709 @item -muls
24710 @opindex muls
24711 Enable generation of unaligned load and store instructions.
24712
24713 @item -mmac
24714 @opindex mmac
24715 Enable the use of multiply-accumulate instructions. Disabled by default.
24716
24717 @item -mscore5
24718 @opindex mscore5
24719 Specify the SCORE5 as the target architecture.
24720
24721 @item -mscore5u
24722 @opindex mscore5u
24723 Specify the SCORE5U of the target architecture.
24724
24725 @item -mscore7
24726 @opindex mscore7
24727 Specify the SCORE7 as the target architecture. This is the default.
24728
24729 @item -mscore7d
24730 @opindex mscore7d
24731 Specify the SCORE7D as the target architecture.
24732 @end table
24733
24734 @node SH Options
24735 @subsection SH Options
24736
24737 These @samp{-m} options are defined for the SH implementations:
24738
24739 @table @gcctabopt
24740 @item -m1
24741 @opindex m1
24742 Generate code for the SH1.
24743
24744 @item -m2
24745 @opindex m2
24746 Generate code for the SH2.
24747
24748 @item -m2e
24749 Generate code for the SH2e.
24750
24751 @item -m2a-nofpu
24752 @opindex m2a-nofpu
24753 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
24754 that the floating-point unit is not used.
24755
24756 @item -m2a-single-only
24757 @opindex m2a-single-only
24758 Generate code for the SH2a-FPU, in such a way that no double-precision
24759 floating-point operations are used.
24760
24761 @item -m2a-single
24762 @opindex m2a-single
24763 Generate code for the SH2a-FPU assuming the floating-point unit is in
24764 single-precision mode by default.
24765
24766 @item -m2a
24767 @opindex m2a
24768 Generate code for the SH2a-FPU assuming the floating-point unit is in
24769 double-precision mode by default.
24770
24771 @item -m3
24772 @opindex m3
24773 Generate code for the SH3.
24774
24775 @item -m3e
24776 @opindex m3e
24777 Generate code for the SH3e.
24778
24779 @item -m4-nofpu
24780 @opindex m4-nofpu
24781 Generate code for the SH4 without a floating-point unit.
24782
24783 @item -m4-single-only
24784 @opindex m4-single-only
24785 Generate code for the SH4 with a floating-point unit that only
24786 supports single-precision arithmetic.
24787
24788 @item -m4-single
24789 @opindex m4-single
24790 Generate code for the SH4 assuming the floating-point unit is in
24791 single-precision mode by default.
24792
24793 @item -m4
24794 @opindex m4
24795 Generate code for the SH4.
24796
24797 @item -m4-100
24798 @opindex m4-100
24799 Generate code for SH4-100.
24800
24801 @item -m4-100-nofpu
24802 @opindex m4-100-nofpu
24803 Generate code for SH4-100 in such a way that the
24804 floating-point unit is not used.
24805
24806 @item -m4-100-single
24807 @opindex m4-100-single
24808 Generate code for SH4-100 assuming the floating-point unit is in
24809 single-precision mode by default.
24810
24811 @item -m4-100-single-only
24812 @opindex m4-100-single-only
24813 Generate code for SH4-100 in such a way that no double-precision
24814 floating-point operations are used.
24815
24816 @item -m4-200
24817 @opindex m4-200
24818 Generate code for SH4-200.
24819
24820 @item -m4-200-nofpu
24821 @opindex m4-200-nofpu
24822 Generate code for SH4-200 without in such a way that the
24823 floating-point unit is not used.
24824
24825 @item -m4-200-single
24826 @opindex m4-200-single
24827 Generate code for SH4-200 assuming the floating-point unit is in
24828 single-precision mode by default.
24829
24830 @item -m4-200-single-only
24831 @opindex m4-200-single-only
24832 Generate code for SH4-200 in such a way that no double-precision
24833 floating-point operations are used.
24834
24835 @item -m4-300
24836 @opindex m4-300
24837 Generate code for SH4-300.
24838
24839 @item -m4-300-nofpu
24840 @opindex m4-300-nofpu
24841 Generate code for SH4-300 without in such a way that the
24842 floating-point unit is not used.
24843
24844 @item -m4-300-single
24845 @opindex m4-300-single
24846 Generate code for SH4-300 in such a way that no double-precision
24847 floating-point operations are used.
24848
24849 @item -m4-300-single-only
24850 @opindex m4-300-single-only
24851 Generate code for SH4-300 in such a way that no double-precision
24852 floating-point operations are used.
24853
24854 @item -m4-340
24855 @opindex m4-340
24856 Generate code for SH4-340 (no MMU, no FPU).
24857
24858 @item -m4-500
24859 @opindex m4-500
24860 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
24861 assembler.
24862
24863 @item -m4a-nofpu
24864 @opindex m4a-nofpu
24865 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
24866 floating-point unit is not used.
24867
24868 @item -m4a-single-only
24869 @opindex m4a-single-only
24870 Generate code for the SH4a, in such a way that no double-precision
24871 floating-point operations are used.
24872
24873 @item -m4a-single
24874 @opindex m4a-single
24875 Generate code for the SH4a assuming the floating-point unit is in
24876 single-precision mode by default.
24877
24878 @item -m4a
24879 @opindex m4a
24880 Generate code for the SH4a.
24881
24882 @item -m4al
24883 @opindex m4al
24884 Same as @option{-m4a-nofpu}, except that it implicitly passes
24885 @option{-dsp} to the assembler. GCC doesn't generate any DSP
24886 instructions at the moment.
24887
24888 @item -mb
24889 @opindex mb
24890 Compile code for the processor in big-endian mode.
24891
24892 @item -ml
24893 @opindex ml
24894 Compile code for the processor in little-endian mode.
24895
24896 @item -mdalign
24897 @opindex mdalign
24898 Align doubles at 64-bit boundaries. Note that this changes the calling
24899 conventions, and thus some functions from the standard C library do
24900 not work unless you recompile it first with @option{-mdalign}.
24901
24902 @item -mrelax
24903 @opindex mrelax
24904 Shorten some address references at link time, when possible; uses the
24905 linker option @option{-relax}.
24906
24907 @item -mbigtable
24908 @opindex mbigtable
24909 Use 32-bit offsets in @code{switch} tables. The default is to use
24910 16-bit offsets.
24911
24912 @item -mbitops
24913 @opindex mbitops
24914 Enable the use of bit manipulation instructions on SH2A.
24915
24916 @item -mfmovd
24917 @opindex mfmovd
24918 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
24919 alignment constraints.
24920
24921 @item -mrenesas
24922 @opindex mrenesas
24923 Comply with the calling conventions defined by Renesas.
24924
24925 @item -mno-renesas
24926 @opindex mno-renesas
24927 Comply with the calling conventions defined for GCC before the Renesas
24928 conventions were available. This option is the default for all
24929 targets of the SH toolchain.
24930
24931 @item -mnomacsave
24932 @opindex mnomacsave
24933 Mark the @code{MAC} register as call-clobbered, even if
24934 @option{-mrenesas} is given.
24935
24936 @item -mieee
24937 @itemx -mno-ieee
24938 @opindex mieee
24939 @opindex mno-ieee
24940 Control the IEEE compliance of floating-point comparisons, which affects the
24941 handling of cases where the result of a comparison is unordered. By default
24942 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
24943 enabled @option{-mno-ieee} is implicitly set, which results in faster
24944 floating-point greater-equal and less-equal comparisons. The implicit settings
24945 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
24946
24947 @item -minline-ic_invalidate
24948 @opindex minline-ic_invalidate
24949 Inline code to invalidate instruction cache entries after setting up
24950 nested function trampolines.
24951 This option has no effect if @option{-musermode} is in effect and the selected
24952 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
24953 instruction.
24954 If the selected code generation option does not allow the use of the @code{icbi}
24955 instruction, and @option{-musermode} is not in effect, the inlined code
24956 manipulates the instruction cache address array directly with an associative
24957 write. This not only requires privileged mode at run time, but it also
24958 fails if the cache line had been mapped via the TLB and has become unmapped.
24959
24960 @item -misize
24961 @opindex misize
24962 Dump instruction size and location in the assembly code.
24963
24964 @item -mpadstruct
24965 @opindex mpadstruct
24966 This option is deprecated. It pads structures to multiple of 4 bytes,
24967 which is incompatible with the SH ABI@.
24968
24969 @item -matomic-model=@var{model}
24970 @opindex matomic-model=@var{model}
24971 Sets the model of atomic operations and additional parameters as a comma
24972 separated list. For details on the atomic built-in functions see
24973 @ref{__atomic Builtins}. The following models and parameters are supported:
24974
24975 @table @samp
24976
24977 @item none
24978 Disable compiler generated atomic sequences and emit library calls for atomic
24979 operations. This is the default if the target is not @code{sh*-*-linux*}.
24980
24981 @item soft-gusa
24982 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
24983 built-in functions. The generated atomic sequences require additional support
24984 from the interrupt/exception handling code of the system and are only suitable
24985 for SH3* and SH4* single-core systems. This option is enabled by default when
24986 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
24987 this option also partially utilizes the hardware atomic instructions
24988 @code{movli.l} and @code{movco.l} to create more efficient code, unless
24989 @samp{strict} is specified.
24990
24991 @item soft-tcb
24992 Generate software atomic sequences that use a variable in the thread control
24993 block. This is a variation of the gUSA sequences which can also be used on
24994 SH1* and SH2* targets. The generated atomic sequences require additional
24995 support from the interrupt/exception handling code of the system and are only
24996 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
24997 parameter has to be specified as well.
24998
24999 @item soft-imask
25000 Generate software atomic sequences that temporarily disable interrupts by
25001 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25002 in privileged mode and is only suitable for single-core systems. Additional
25003 support from the interrupt/exception handling code of the system is not
25004 required. This model is enabled by default when the target is
25005 @code{sh*-*-linux*} and SH1* or SH2*.
25006
25007 @item hard-llcs
25008 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25009 instructions only. This is only available on SH4A and is suitable for
25010 multi-core systems. Since the hardware instructions support only 32 bit atomic
25011 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25012 Code compiled with this option is also compatible with other software
25013 atomic model interrupt/exception handling systems if executed on an SH4A
25014 system. Additional support from the interrupt/exception handling code of the
25015 system is not required for this model.
25016
25017 @item gbr-offset=
25018 This parameter specifies the offset in bytes of the variable in the thread
25019 control block structure that should be used by the generated atomic sequences
25020 when the @samp{soft-tcb} model has been selected. For other models this
25021 parameter is ignored. The specified value must be an integer multiple of four
25022 and in the range 0-1020.
25023
25024 @item strict
25025 This parameter prevents mixed usage of multiple atomic models, even if they
25026 are compatible, and makes the compiler generate atomic sequences of the
25027 specified model only.
25028
25029 @end table
25030
25031 @item -mtas
25032 @opindex mtas
25033 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25034 Notice that depending on the particular hardware and software configuration
25035 this can degrade overall performance due to the operand cache line flushes
25036 that are implied by the @code{tas.b} instruction. On multi-core SH4A
25037 processors the @code{tas.b} instruction must be used with caution since it
25038 can result in data corruption for certain cache configurations.
25039
25040 @item -mprefergot
25041 @opindex mprefergot
25042 When generating position-independent code, emit function calls using
25043 the Global Offset Table instead of the Procedure Linkage Table.
25044
25045 @item -musermode
25046 @itemx -mno-usermode
25047 @opindex musermode
25048 @opindex mno-usermode
25049 Don't allow (allow) the compiler generating privileged mode code. Specifying
25050 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25051 inlined code would not work in user mode. @option{-musermode} is the default
25052 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
25053 @option{-musermode} has no effect, since there is no user mode.
25054
25055 @item -multcost=@var{number}
25056 @opindex multcost=@var{number}
25057 Set the cost to assume for a multiply insn.
25058
25059 @item -mdiv=@var{strategy}
25060 @opindex mdiv=@var{strategy}
25061 Set the division strategy to be used for integer division operations.
25062 @var{strategy} can be one of:
25063
25064 @table @samp
25065
25066 @item call-div1
25067 Calls a library function that uses the single-step division instruction
25068 @code{div1} to perform the operation. Division by zero calculates an
25069 unspecified result and does not trap. This is the default except for SH4,
25070 SH2A and SHcompact.
25071
25072 @item call-fp
25073 Calls a library function that performs the operation in double precision
25074 floating point. Division by zero causes a floating-point exception. This is
25075 the default for SHcompact with FPU. Specifying this for targets that do not
25076 have a double precision FPU defaults to @code{call-div1}.
25077
25078 @item call-table
25079 Calls a library function that uses a lookup table for small divisors and
25080 the @code{div1} instruction with case distinction for larger divisors. Division
25081 by zero calculates an unspecified result and does not trap. This is the default
25082 for SH4. Specifying this for targets that do not have dynamic shift
25083 instructions defaults to @code{call-div1}.
25084
25085 @end table
25086
25087 When a division strategy has not been specified the default strategy is
25088 selected based on the current target. For SH2A the default strategy is to
25089 use the @code{divs} and @code{divu} instructions instead of library function
25090 calls.
25091
25092 @item -maccumulate-outgoing-args
25093 @opindex maccumulate-outgoing-args
25094 Reserve space once for outgoing arguments in the function prologue rather
25095 than around each call. Generally beneficial for performance and size. Also
25096 needed for unwinding to avoid changing the stack frame around conditional code.
25097
25098 @item -mdivsi3_libfunc=@var{name}
25099 @opindex mdivsi3_libfunc=@var{name}
25100 Set the name of the library function used for 32-bit signed division to
25101 @var{name}.
25102 This only affects the name used in the @samp{call} division strategies, and
25103 the compiler still expects the same sets of input/output/clobbered registers as
25104 if this option were not present.
25105
25106 @item -mfixed-range=@var{register-range}
25107 @opindex mfixed-range
25108 Generate code treating the given register range as fixed registers.
25109 A fixed register is one that the register allocator can not use. This is
25110 useful when compiling kernel code. A register range is specified as
25111 two registers separated by a dash. Multiple register ranges can be
25112 specified separated by a comma.
25113
25114 @item -mbranch-cost=@var{num}
25115 @opindex mbranch-cost=@var{num}
25116 Assume @var{num} to be the cost for a branch instruction. Higher numbers
25117 make the compiler try to generate more branch-free code if possible.
25118 If not specified the value is selected depending on the processor type that
25119 is being compiled for.
25120
25121 @item -mzdcbranch
25122 @itemx -mno-zdcbranch
25123 @opindex mzdcbranch
25124 @opindex mno-zdcbranch
25125 Assume (do not assume) that zero displacement conditional branch instructions
25126 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
25127 compiler prefers zero displacement branch code sequences. This is
25128 enabled by default when generating code for SH4 and SH4A. It can be explicitly
25129 disabled by specifying @option{-mno-zdcbranch}.
25130
25131 @item -mcbranch-force-delay-slot
25132 @opindex mcbranch-force-delay-slot
25133 Force the usage of delay slots for conditional branches, which stuffs the delay
25134 slot with a @code{nop} if a suitable instruction cannot be found. By default
25135 this option is disabled. It can be enabled to work around hardware bugs as
25136 found in the original SH7055.
25137
25138 @item -mfused-madd
25139 @itemx -mno-fused-madd
25140 @opindex mfused-madd
25141 @opindex mno-fused-madd
25142 Generate code that uses (does not use) the floating-point multiply and
25143 accumulate instructions. These instructions are generated by default
25144 if hardware floating point is used. The machine-dependent
25145 @option{-mfused-madd} option is now mapped to the machine-independent
25146 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25147 mapped to @option{-ffp-contract=off}.
25148
25149 @item -mfsca
25150 @itemx -mno-fsca
25151 @opindex mfsca
25152 @opindex mno-fsca
25153 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
25154 and cosine approximations. The option @option{-mfsca} must be used in
25155 combination with @option{-funsafe-math-optimizations}. It is enabled by default
25156 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
25157 approximations even if @option{-funsafe-math-optimizations} is in effect.
25158
25159 @item -mfsrra
25160 @itemx -mno-fsrra
25161 @opindex mfsrra
25162 @opindex mno-fsrra
25163 Allow or disallow the compiler to emit the @code{fsrra} instruction for
25164 reciprocal square root approximations. The option @option{-mfsrra} must be used
25165 in combination with @option{-funsafe-math-optimizations} and
25166 @option{-ffinite-math-only}. It is enabled by default when generating code for
25167 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
25168 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
25169 in effect.
25170
25171 @item -mpretend-cmove
25172 @opindex mpretend-cmove
25173 Prefer zero-displacement conditional branches for conditional move instruction
25174 patterns. This can result in faster code on the SH4 processor.
25175
25176 @item -mfdpic
25177 @opindex fdpic
25178 Generate code using the FDPIC ABI.
25179
25180 @end table
25181
25182 @node Solaris 2 Options
25183 @subsection Solaris 2 Options
25184 @cindex Solaris 2 options
25185
25186 These @samp{-m} options are supported on Solaris 2:
25187
25188 @table @gcctabopt
25189 @item -mclear-hwcap
25190 @opindex mclear-hwcap
25191 @option{-mclear-hwcap} tells the compiler to remove the hardware
25192 capabilities generated by the Solaris assembler. This is only necessary
25193 when object files use ISA extensions not supported by the current
25194 machine, but check at runtime whether or not to use them.
25195
25196 @item -mimpure-text
25197 @opindex mimpure-text
25198 @option{-mimpure-text}, used in addition to @option{-shared}, tells
25199 the compiler to not pass @option{-z text} to the linker when linking a
25200 shared object. Using this option, you can link position-dependent
25201 code into a shared object.
25202
25203 @option{-mimpure-text} suppresses the ``relocations remain against
25204 allocatable but non-writable sections'' linker error message.
25205 However, the necessary relocations trigger copy-on-write, and the
25206 shared object is not actually shared across processes. Instead of
25207 using @option{-mimpure-text}, you should compile all source code with
25208 @option{-fpic} or @option{-fPIC}.
25209
25210 @end table
25211
25212 These switches are supported in addition to the above on Solaris 2:
25213
25214 @table @gcctabopt
25215 @item -pthreads
25216 @opindex pthreads
25217 This is a synonym for @option{-pthread}.
25218 @end table
25219
25220 @node SPARC Options
25221 @subsection SPARC Options
25222 @cindex SPARC options
25223
25224 These @samp{-m} options are supported on the SPARC:
25225
25226 @table @gcctabopt
25227 @item -mno-app-regs
25228 @itemx -mapp-regs
25229 @opindex mno-app-regs
25230 @opindex mapp-regs
25231 Specify @option{-mapp-regs} to generate output using the global registers
25232 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
25233 global register 1, each global register 2 through 4 is then treated as an
25234 allocable register that is clobbered by function calls. This is the default.
25235
25236 To be fully SVR4 ABI-compliant at the cost of some performance loss,
25237 specify @option{-mno-app-regs}. You should compile libraries and system
25238 software with this option.
25239
25240 @item -mflat
25241 @itemx -mno-flat
25242 @opindex mflat
25243 @opindex mno-flat
25244 With @option{-mflat}, the compiler does not generate save/restore instructions
25245 and uses a ``flat'' or single register window model. This model is compatible
25246 with the regular register window model. The local registers and the input
25247 registers (0--5) are still treated as ``call-saved'' registers and are
25248 saved on the stack as needed.
25249
25250 With @option{-mno-flat} (the default), the compiler generates save/restore
25251 instructions (except for leaf functions). This is the normal operating mode.
25252
25253 @item -mfpu
25254 @itemx -mhard-float
25255 @opindex mfpu
25256 @opindex mhard-float
25257 Generate output containing floating-point instructions. This is the
25258 default.
25259
25260 @item -mno-fpu
25261 @itemx -msoft-float
25262 @opindex mno-fpu
25263 @opindex msoft-float
25264 Generate output containing library calls for floating point.
25265 @strong{Warning:} the requisite libraries are not available for all SPARC
25266 targets. Normally the facilities of the machine's usual C compiler are
25267 used, but this cannot be done directly in cross-compilation. You must make
25268 your own arrangements to provide suitable library functions for
25269 cross-compilation. The embedded targets @samp{sparc-*-aout} and
25270 @samp{sparclite-*-*} do provide software floating-point support.
25271
25272 @option{-msoft-float} changes the calling convention in the output file;
25273 therefore, it is only useful if you compile @emph{all} of a program with
25274 this option. In particular, you need to compile @file{libgcc.a}, the
25275 library that comes with GCC, with @option{-msoft-float} in order for
25276 this to work.
25277
25278 @item -mhard-quad-float
25279 @opindex mhard-quad-float
25280 Generate output containing quad-word (long double) floating-point
25281 instructions.
25282
25283 @item -msoft-quad-float
25284 @opindex msoft-quad-float
25285 Generate output containing library calls for quad-word (long double)
25286 floating-point instructions. The functions called are those specified
25287 in the SPARC ABI@. This is the default.
25288
25289 As of this writing, there are no SPARC implementations that have hardware
25290 support for the quad-word floating-point instructions. They all invoke
25291 a trap handler for one of these instructions, and then the trap handler
25292 emulates the effect of the instruction. Because of the trap handler overhead,
25293 this is much slower than calling the ABI library routines. Thus the
25294 @option{-msoft-quad-float} option is the default.
25295
25296 @item -mno-unaligned-doubles
25297 @itemx -munaligned-doubles
25298 @opindex mno-unaligned-doubles
25299 @opindex munaligned-doubles
25300 Assume that doubles have 8-byte alignment. This is the default.
25301
25302 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
25303 alignment only if they are contained in another type, or if they have an
25304 absolute address. Otherwise, it assumes they have 4-byte alignment.
25305 Specifying this option avoids some rare compatibility problems with code
25306 generated by other compilers. It is not the default because it results
25307 in a performance loss, especially for floating-point code.
25308
25309 @item -muser-mode
25310 @itemx -mno-user-mode
25311 @opindex muser-mode
25312 @opindex mno-user-mode
25313 Do not generate code that can only run in supervisor mode. This is relevant
25314 only for the @code{casa} instruction emitted for the LEON3 processor. This
25315 is the default.
25316
25317 @item -mfaster-structs
25318 @itemx -mno-faster-structs
25319 @opindex mfaster-structs
25320 @opindex mno-faster-structs
25321 With @option{-mfaster-structs}, the compiler assumes that structures
25322 should have 8-byte alignment. This enables the use of pairs of
25323 @code{ldd} and @code{std} instructions for copies in structure
25324 assignment, in place of twice as many @code{ld} and @code{st} pairs.
25325 However, the use of this changed alignment directly violates the SPARC
25326 ABI@. Thus, it's intended only for use on targets where the developer
25327 acknowledges that their resulting code is not directly in line with
25328 the rules of the ABI@.
25329
25330 @item -mstd-struct-return
25331 @itemx -mno-std-struct-return
25332 @opindex mstd-struct-return
25333 @opindex mno-std-struct-return
25334 With @option{-mstd-struct-return}, the compiler generates checking code
25335 in functions returning structures or unions to detect size mismatches
25336 between the two sides of function calls, as per the 32-bit ABI@.
25337
25338 The default is @option{-mno-std-struct-return}. This option has no effect
25339 in 64-bit mode.
25340
25341 @item -mlra
25342 @itemx -mno-lra
25343 @opindex mlra
25344 @opindex mno-lra
25345 Enable Local Register Allocation. This is the default for SPARC since GCC 7
25346 so @option{-mno-lra} needs to be passed to get old Reload.
25347
25348 @item -mcpu=@var{cpu_type}
25349 @opindex mcpu
25350 Set the instruction set, register set, and instruction scheduling parameters
25351 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
25352 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
25353 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
25354 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
25355 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
25356 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
25357
25358 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
25359 which selects the best architecture option for the host processor.
25360 @option{-mcpu=native} has no effect if GCC does not recognize
25361 the processor.
25362
25363 Default instruction scheduling parameters are used for values that select
25364 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
25365 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
25366
25367 Here is a list of each supported architecture and their supported
25368 implementations.
25369
25370 @table @asis
25371 @item v7
25372 cypress, leon3v7
25373
25374 @item v8
25375 supersparc, hypersparc, leon, leon3
25376
25377 @item sparclite
25378 f930, f934, sparclite86x
25379
25380 @item sparclet
25381 tsc701
25382
25383 @item v9
25384 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
25385 niagara7, m8
25386 @end table
25387
25388 By default (unless configured otherwise), GCC generates code for the V7
25389 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
25390 additionally optimizes it for the Cypress CY7C602 chip, as used in the
25391 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
25392 SPARCStation 1, 2, IPX etc.
25393
25394 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
25395 architecture. The only difference from V7 code is that the compiler emits
25396 the integer multiply and integer divide instructions which exist in SPARC-V8
25397 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
25398 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
25399 2000 series.
25400
25401 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
25402 the SPARC architecture. This adds the integer multiply, integer divide step
25403 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
25404 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
25405 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
25406 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
25407 MB86934 chip, which is the more recent SPARClite with FPU@.
25408
25409 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
25410 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
25411 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
25412 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
25413 optimizes it for the TEMIC SPARClet chip.
25414
25415 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
25416 architecture. This adds 64-bit integer and floating-point move instructions,
25417 3 additional floating-point condition code registers and conditional move
25418 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
25419 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
25420 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
25421 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
25422 @option{-mcpu=niagara}, the compiler additionally optimizes it for
25423 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
25424 additionally optimizes it for Sun UltraSPARC T2 chips. With
25425 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
25426 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
25427 additionally optimizes it for Sun UltraSPARC T4 chips. With
25428 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
25429 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
25430 additionally optimizes it for Oracle M8 chips.
25431
25432 @item -mtune=@var{cpu_type}
25433 @opindex mtune
25434 Set the instruction scheduling parameters for machine type
25435 @var{cpu_type}, but do not set the instruction set or register set that the
25436 option @option{-mcpu=@var{cpu_type}} does.
25437
25438 The same values for @option{-mcpu=@var{cpu_type}} can be used for
25439 @option{-mtune=@var{cpu_type}}, but the only useful values are those
25440 that select a particular CPU implementation. Those are
25441 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
25442 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
25443 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
25444 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
25445 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
25446 and GNU/Linux toolchains, @samp{native} can also be used.
25447
25448 @item -mv8plus
25449 @itemx -mno-v8plus
25450 @opindex mv8plus
25451 @opindex mno-v8plus
25452 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
25453 difference from the V8 ABI is that the global and out registers are
25454 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
25455 mode for all SPARC-V9 processors.
25456
25457 @item -mvis
25458 @itemx -mno-vis
25459 @opindex mvis
25460 @opindex mno-vis
25461 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
25462 Visual Instruction Set extensions. The default is @option{-mno-vis}.
25463
25464 @item -mvis2
25465 @itemx -mno-vis2
25466 @opindex mvis2
25467 @opindex mno-vis2
25468 With @option{-mvis2}, GCC generates code that takes advantage of
25469 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
25470 default is @option{-mvis2} when targeting a cpu that supports such
25471 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
25472 also sets @option{-mvis}.
25473
25474 @item -mvis3
25475 @itemx -mno-vis3
25476 @opindex mvis3
25477 @opindex mno-vis3
25478 With @option{-mvis3}, GCC generates code that takes advantage of
25479 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
25480 default is @option{-mvis3} when targeting a cpu that supports such
25481 instructions, such as niagara-3 and later. Setting @option{-mvis3}
25482 also sets @option{-mvis2} and @option{-mvis}.
25483
25484 @item -mvis4
25485 @itemx -mno-vis4
25486 @opindex mvis4
25487 @opindex mno-vis4
25488 With @option{-mvis4}, GCC generates code that takes advantage of
25489 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
25490 default is @option{-mvis4} when targeting a cpu that supports such
25491 instructions, such as niagara-7 and later. Setting @option{-mvis4}
25492 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
25493
25494 @item -mvis4b
25495 @itemx -mno-vis4b
25496 @opindex mvis4b
25497 @opindex mno-vis4b
25498 With @option{-mvis4b}, GCC generates code that takes advantage of
25499 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
25500 the additional VIS instructions introduced in the Oracle SPARC
25501 Architecture 2017. The default is @option{-mvis4b} when targeting a
25502 cpu that supports such instructions, such as m8 and later. Setting
25503 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
25504 @option{-mvis2} and @option{-mvis}.
25505
25506 @item -mcbcond
25507 @itemx -mno-cbcond
25508 @opindex mcbcond
25509 @opindex mno-cbcond
25510 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
25511 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
25512 when targeting a CPU that supports such instructions, such as Niagara-4 and
25513 later.
25514
25515 @item -mfmaf
25516 @itemx -mno-fmaf
25517 @opindex mfmaf
25518 @opindex mno-fmaf
25519 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
25520 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
25521 when targeting a CPU that supports such instructions, such as Niagara-3 and
25522 later.
25523
25524 @item -mfsmuld
25525 @itemx -mno-fsmuld
25526 @opindex mfsmuld
25527 @opindex mno-fsmuld
25528 With @option{-mfsmuld}, GCC generates code that takes advantage of the
25529 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
25530 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
25531 or V9 with FPU except @option{-mcpu=leon}.
25532
25533 @item -mpopc
25534 @itemx -mno-popc
25535 @opindex mpopc
25536 @opindex mno-popc
25537 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
25538 Population Count instruction. The default is @option{-mpopc}
25539 when targeting a CPU that supports such an instruction, such as Niagara-2 and
25540 later.
25541
25542 @item -msubxc
25543 @itemx -mno-subxc
25544 @opindex msubxc
25545 @opindex mno-subxc
25546 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
25547 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
25548 when targeting a CPU that supports such an instruction, such as Niagara-7 and
25549 later.
25550
25551 @item -mfix-at697f
25552 @opindex mfix-at697f
25553 Enable the documented workaround for the single erratum of the Atmel AT697F
25554 processor (which corresponds to erratum #13 of the AT697E processor).
25555
25556 @item -mfix-ut699
25557 @opindex mfix-ut699
25558 Enable the documented workarounds for the floating-point errata and the data
25559 cache nullify errata of the UT699 processor.
25560
25561 @item -mfix-ut700
25562 @opindex mfix-ut700
25563 Enable the documented workaround for the back-to-back store errata of
25564 the UT699E/UT700 processor.
25565
25566 @item -mfix-gr712rc
25567 @opindex mfix-gr712rc
25568 Enable the documented workaround for the back-to-back store errata of
25569 the GR712RC processor.
25570 @end table
25571
25572 These @samp{-m} options are supported in addition to the above
25573 on SPARC-V9 processors in 64-bit environments:
25574
25575 @table @gcctabopt
25576 @item -m32
25577 @itemx -m64
25578 @opindex m32
25579 @opindex m64
25580 Generate code for a 32-bit or 64-bit environment.
25581 The 32-bit environment sets int, long and pointer to 32 bits.
25582 The 64-bit environment sets int to 32 bits and long and pointer
25583 to 64 bits.
25584
25585 @item -mcmodel=@var{which}
25586 @opindex mcmodel
25587 Set the code model to one of
25588
25589 @table @samp
25590 @item medlow
25591 The Medium/Low code model: 64-bit addresses, programs
25592 must be linked in the low 32 bits of memory. Programs can be statically
25593 or dynamically linked.
25594
25595 @item medmid
25596 The Medium/Middle code model: 64-bit addresses, programs
25597 must be linked in the low 44 bits of memory, the text and data segments must
25598 be less than 2GB in size and the data segment must be located within 2GB of
25599 the text segment.
25600
25601 @item medany
25602 The Medium/Anywhere code model: 64-bit addresses, programs
25603 may be linked anywhere in memory, the text and data segments must be less
25604 than 2GB in size and the data segment must be located within 2GB of the
25605 text segment.
25606
25607 @item embmedany
25608 The Medium/Anywhere code model for embedded systems:
25609 64-bit addresses, the text and data segments must be less than 2GB in
25610 size, both starting anywhere in memory (determined at link time). The
25611 global register %g4 points to the base of the data segment. Programs
25612 are statically linked and PIC is not supported.
25613 @end table
25614
25615 @item -mmemory-model=@var{mem-model}
25616 @opindex mmemory-model
25617 Set the memory model in force on the processor to one of
25618
25619 @table @samp
25620 @item default
25621 The default memory model for the processor and operating system.
25622
25623 @item rmo
25624 Relaxed Memory Order
25625
25626 @item pso
25627 Partial Store Order
25628
25629 @item tso
25630 Total Store Order
25631
25632 @item sc
25633 Sequential Consistency
25634 @end table
25635
25636 These memory models are formally defined in Appendix D of the SPARC-V9
25637 architecture manual, as set in the processor's @code{PSTATE.MM} field.
25638
25639 @item -mstack-bias
25640 @itemx -mno-stack-bias
25641 @opindex mstack-bias
25642 @opindex mno-stack-bias
25643 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
25644 frame pointer if present, are offset by @minus{}2047 which must be added back
25645 when making stack frame references. This is the default in 64-bit mode.
25646 Otherwise, assume no such offset is present.
25647 @end table
25648
25649 @node SPU Options
25650 @subsection SPU Options
25651 @cindex SPU options
25652
25653 These @samp{-m} options are supported on the SPU:
25654
25655 @table @gcctabopt
25656 @item -mwarn-reloc
25657 @itemx -merror-reloc
25658 @opindex mwarn-reloc
25659 @opindex merror-reloc
25660
25661 The loader for SPU does not handle dynamic relocations. By default, GCC
25662 gives an error when it generates code that requires a dynamic
25663 relocation. @option{-mno-error-reloc} disables the error,
25664 @option{-mwarn-reloc} generates a warning instead.
25665
25666 @item -msafe-dma
25667 @itemx -munsafe-dma
25668 @opindex msafe-dma
25669 @opindex munsafe-dma
25670
25671 Instructions that initiate or test completion of DMA must not be
25672 reordered with respect to loads and stores of the memory that is being
25673 accessed.
25674 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
25675 memory accesses, but that can lead to inefficient code in places where the
25676 memory is known to not change. Rather than mark the memory as volatile,
25677 you can use @option{-msafe-dma} to tell the compiler to treat
25678 the DMA instructions as potentially affecting all memory.
25679
25680 @item -mbranch-hints
25681 @opindex mbranch-hints
25682
25683 By default, GCC generates a branch hint instruction to avoid
25684 pipeline stalls for always-taken or probably-taken branches. A hint
25685 is not generated closer than 8 instructions away from its branch.
25686 There is little reason to disable them, except for debugging purposes,
25687 or to make an object a little bit smaller.
25688
25689 @item -msmall-mem
25690 @itemx -mlarge-mem
25691 @opindex msmall-mem
25692 @opindex mlarge-mem
25693
25694 By default, GCC generates code assuming that addresses are never larger
25695 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
25696 a full 32-bit address.
25697
25698 @item -mstdmain
25699 @opindex mstdmain
25700
25701 By default, GCC links against startup code that assumes the SPU-style
25702 main function interface (which has an unconventional parameter list).
25703 With @option{-mstdmain}, GCC links your program against startup
25704 code that assumes a C99-style interface to @code{main}, including a
25705 local copy of @code{argv} strings.
25706
25707 @item -mfixed-range=@var{register-range}
25708 @opindex mfixed-range
25709 Generate code treating the given register range as fixed registers.
25710 A fixed register is one that the register allocator cannot use. This is
25711 useful when compiling kernel code. A register range is specified as
25712 two registers separated by a dash. Multiple register ranges can be
25713 specified separated by a comma.
25714
25715 @item -mea32
25716 @itemx -mea64
25717 @opindex mea32
25718 @opindex mea64
25719 Compile code assuming that pointers to the PPU address space accessed
25720 via the @code{__ea} named address space qualifier are either 32 or 64
25721 bits wide. The default is 32 bits. As this is an ABI-changing option,
25722 all object code in an executable must be compiled with the same setting.
25723
25724 @item -maddress-space-conversion
25725 @itemx -mno-address-space-conversion
25726 @opindex maddress-space-conversion
25727 @opindex mno-address-space-conversion
25728 Allow/disallow treating the @code{__ea} address space as superset
25729 of the generic address space. This enables explicit type casts
25730 between @code{__ea} and generic pointer as well as implicit
25731 conversions of generic pointers to @code{__ea} pointers. The
25732 default is to allow address space pointer conversions.
25733
25734 @item -mcache-size=@var{cache-size}
25735 @opindex mcache-size
25736 This option controls the version of libgcc that the compiler links to an
25737 executable and selects a software-managed cache for accessing variables
25738 in the @code{__ea} address space with a particular cache size. Possible
25739 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
25740 and @samp{128}. The default cache size is 64KB.
25741
25742 @item -matomic-updates
25743 @itemx -mno-atomic-updates
25744 @opindex matomic-updates
25745 @opindex mno-atomic-updates
25746 This option controls the version of libgcc that the compiler links to an
25747 executable and selects whether atomic updates to the software-managed
25748 cache of PPU-side variables are used. If you use atomic updates, changes
25749 to a PPU variable from SPU code using the @code{__ea} named address space
25750 qualifier do not interfere with changes to other PPU variables residing
25751 in the same cache line from PPU code. If you do not use atomic updates,
25752 such interference may occur; however, writing back cache lines is
25753 more efficient. The default behavior is to use atomic updates.
25754
25755 @item -mdual-nops
25756 @itemx -mdual-nops=@var{n}
25757 @opindex mdual-nops
25758 By default, GCC inserts NOPs to increase dual issue when it expects
25759 it to increase performance. @var{n} can be a value from 0 to 10. A
25760 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
25761 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
25762
25763 @item -mhint-max-nops=@var{n}
25764 @opindex mhint-max-nops
25765 Maximum number of NOPs to insert for a branch hint. A branch hint must
25766 be at least 8 instructions away from the branch it is affecting. GCC
25767 inserts up to @var{n} NOPs to enforce this, otherwise it does not
25768 generate the branch hint.
25769
25770 @item -mhint-max-distance=@var{n}
25771 @opindex mhint-max-distance
25772 The encoding of the branch hint instruction limits the hint to be within
25773 256 instructions of the branch it is affecting. By default, GCC makes
25774 sure it is within 125.
25775
25776 @item -msafe-hints
25777 @opindex msafe-hints
25778 Work around a hardware bug that causes the SPU to stall indefinitely.
25779 By default, GCC inserts the @code{hbrp} instruction to make sure
25780 this stall won't happen.
25781
25782 @end table
25783
25784 @node System V Options
25785 @subsection Options for System V
25786
25787 These additional options are available on System V Release 4 for
25788 compatibility with other compilers on those systems:
25789
25790 @table @gcctabopt
25791 @item -G
25792 @opindex G
25793 Create a shared object.
25794 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
25795
25796 @item -Qy
25797 @opindex Qy
25798 Identify the versions of each tool used by the compiler, in a
25799 @code{.ident} assembler directive in the output.
25800
25801 @item -Qn
25802 @opindex Qn
25803 Refrain from adding @code{.ident} directives to the output file (this is
25804 the default).
25805
25806 @item -YP,@var{dirs}
25807 @opindex YP
25808 Search the directories @var{dirs}, and no others, for libraries
25809 specified with @option{-l}.
25810
25811 @item -Ym,@var{dir}
25812 @opindex Ym
25813 Look in the directory @var{dir} to find the M4 preprocessor.
25814 The assembler uses this option.
25815 @c This is supposed to go with a -Yd for predefined M4 macro files, but
25816 @c the generic assembler that comes with Solaris takes just -Ym.
25817 @end table
25818
25819 @node TILE-Gx Options
25820 @subsection TILE-Gx Options
25821 @cindex TILE-Gx options
25822
25823 These @samp{-m} options are supported on the TILE-Gx:
25824
25825 @table @gcctabopt
25826 @item -mcmodel=small
25827 @opindex mcmodel=small
25828 Generate code for the small model. The distance for direct calls is
25829 limited to 500M in either direction. PC-relative addresses are 32
25830 bits. Absolute addresses support the full address range.
25831
25832 @item -mcmodel=large
25833 @opindex mcmodel=large
25834 Generate code for the large model. There is no limitation on call
25835 distance, pc-relative addresses, or absolute addresses.
25836
25837 @item -mcpu=@var{name}
25838 @opindex mcpu
25839 Selects the type of CPU to be targeted. Currently the only supported
25840 type is @samp{tilegx}.
25841
25842 @item -m32
25843 @itemx -m64
25844 @opindex m32
25845 @opindex m64
25846 Generate code for a 32-bit or 64-bit environment. The 32-bit
25847 environment sets int, long, and pointer to 32 bits. The 64-bit
25848 environment sets int to 32 bits and long and pointer to 64 bits.
25849
25850 @item -mbig-endian
25851 @itemx -mlittle-endian
25852 @opindex mbig-endian
25853 @opindex mlittle-endian
25854 Generate code in big/little endian mode, respectively.
25855 @end table
25856
25857 @node TILEPro Options
25858 @subsection TILEPro Options
25859 @cindex TILEPro options
25860
25861 These @samp{-m} options are supported on the TILEPro:
25862
25863 @table @gcctabopt
25864 @item -mcpu=@var{name}
25865 @opindex mcpu
25866 Selects the type of CPU to be targeted. Currently the only supported
25867 type is @samp{tilepro}.
25868
25869 @item -m32
25870 @opindex m32
25871 Generate code for a 32-bit environment, which sets int, long, and
25872 pointer to 32 bits. This is the only supported behavior so the flag
25873 is essentially ignored.
25874 @end table
25875
25876 @node V850 Options
25877 @subsection V850 Options
25878 @cindex V850 Options
25879
25880 These @samp{-m} options are defined for V850 implementations:
25881
25882 @table @gcctabopt
25883 @item -mlong-calls
25884 @itemx -mno-long-calls
25885 @opindex mlong-calls
25886 @opindex mno-long-calls
25887 Treat all calls as being far away (near). If calls are assumed to be
25888 far away, the compiler always loads the function's address into a
25889 register, and calls indirect through the pointer.
25890
25891 @item -mno-ep
25892 @itemx -mep
25893 @opindex mno-ep
25894 @opindex mep
25895 Do not optimize (do optimize) basic blocks that use the same index
25896 pointer 4 or more times to copy pointer into the @code{ep} register, and
25897 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
25898 option is on by default if you optimize.
25899
25900 @item -mno-prolog-function
25901 @itemx -mprolog-function
25902 @opindex mno-prolog-function
25903 @opindex mprolog-function
25904 Do not use (do use) external functions to save and restore registers
25905 at the prologue and epilogue of a function. The external functions
25906 are slower, but use less code space if more than one function saves
25907 the same number of registers. The @option{-mprolog-function} option
25908 is on by default if you optimize.
25909
25910 @item -mspace
25911 @opindex mspace
25912 Try to make the code as small as possible. At present, this just turns
25913 on the @option{-mep} and @option{-mprolog-function} options.
25914
25915 @item -mtda=@var{n}
25916 @opindex mtda
25917 Put static or global variables whose size is @var{n} bytes or less into
25918 the tiny data area that register @code{ep} points to. The tiny data
25919 area can hold up to 256 bytes in total (128 bytes for byte references).
25920
25921 @item -msda=@var{n}
25922 @opindex msda
25923 Put static or global variables whose size is @var{n} bytes or less into
25924 the small data area that register @code{gp} points to. The small data
25925 area can hold up to 64 kilobytes.
25926
25927 @item -mzda=@var{n}
25928 @opindex mzda
25929 Put static or global variables whose size is @var{n} bytes or less into
25930 the first 32 kilobytes of memory.
25931
25932 @item -mv850
25933 @opindex mv850
25934 Specify that the target processor is the V850.
25935
25936 @item -mv850e3v5
25937 @opindex mv850e3v5
25938 Specify that the target processor is the V850E3V5. The preprocessor
25939 constant @code{__v850e3v5__} is defined if this option is used.
25940
25941 @item -mv850e2v4
25942 @opindex mv850e2v4
25943 Specify that the target processor is the V850E3V5. This is an alias for
25944 the @option{-mv850e3v5} option.
25945
25946 @item -mv850e2v3
25947 @opindex mv850e2v3
25948 Specify that the target processor is the V850E2V3. The preprocessor
25949 constant @code{__v850e2v3__} is defined if this option is used.
25950
25951 @item -mv850e2
25952 @opindex mv850e2
25953 Specify that the target processor is the V850E2. The preprocessor
25954 constant @code{__v850e2__} is defined if this option is used.
25955
25956 @item -mv850e1
25957 @opindex mv850e1
25958 Specify that the target processor is the V850E1. The preprocessor
25959 constants @code{__v850e1__} and @code{__v850e__} are defined if
25960 this option is used.
25961
25962 @item -mv850es
25963 @opindex mv850es
25964 Specify that the target processor is the V850ES. This is an alias for
25965 the @option{-mv850e1} option.
25966
25967 @item -mv850e
25968 @opindex mv850e
25969 Specify that the target processor is the V850E@. The preprocessor
25970 constant @code{__v850e__} is defined if this option is used.
25971
25972 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
25973 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
25974 are defined then a default target processor is chosen and the
25975 relevant @samp{__v850*__} preprocessor constant is defined.
25976
25977 The preprocessor constants @code{__v850} and @code{__v851__} are always
25978 defined, regardless of which processor variant is the target.
25979
25980 @item -mdisable-callt
25981 @itemx -mno-disable-callt
25982 @opindex mdisable-callt
25983 @opindex mno-disable-callt
25984 This option suppresses generation of the @code{CALLT} instruction for the
25985 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
25986 architecture.
25987
25988 This option is enabled by default when the RH850 ABI is
25989 in use (see @option{-mrh850-abi}), and disabled by default when the
25990 GCC ABI is in use. If @code{CALLT} instructions are being generated
25991 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
25992
25993 @item -mrelax
25994 @itemx -mno-relax
25995 @opindex mrelax
25996 @opindex mno-relax
25997 Pass on (or do not pass on) the @option{-mrelax} command-line option
25998 to the assembler.
25999
26000 @item -mlong-jumps
26001 @itemx -mno-long-jumps
26002 @opindex mlong-jumps
26003 @opindex mno-long-jumps
26004 Disable (or re-enable) the generation of PC-relative jump instructions.
26005
26006 @item -msoft-float
26007 @itemx -mhard-float
26008 @opindex msoft-float
26009 @opindex mhard-float
26010 Disable (or re-enable) the generation of hardware floating point
26011 instructions. This option is only significant when the target
26012 architecture is @samp{V850E2V3} or higher. If hardware floating point
26013 instructions are being generated then the C preprocessor symbol
26014 @code{__FPU_OK__} is defined, otherwise the symbol
26015 @code{__NO_FPU__} is defined.
26016
26017 @item -mloop
26018 @opindex mloop
26019 Enables the use of the e3v5 LOOP instruction. The use of this
26020 instruction is not enabled by default when the e3v5 architecture is
26021 selected because its use is still experimental.
26022
26023 @item -mrh850-abi
26024 @itemx -mghs
26025 @opindex mrh850-abi
26026 @opindex mghs
26027 Enables support for the RH850 version of the V850 ABI. This is the
26028 default. With this version of the ABI the following rules apply:
26029
26030 @itemize
26031 @item
26032 Integer sized structures and unions are returned via a memory pointer
26033 rather than a register.
26034
26035 @item
26036 Large structures and unions (more than 8 bytes in size) are passed by
26037 value.
26038
26039 @item
26040 Functions are aligned to 16-bit boundaries.
26041
26042 @item
26043 The @option{-m8byte-align} command-line option is supported.
26044
26045 @item
26046 The @option{-mdisable-callt} command-line option is enabled by
26047 default. The @option{-mno-disable-callt} command-line option is not
26048 supported.
26049 @end itemize
26050
26051 When this version of the ABI is enabled the C preprocessor symbol
26052 @code{__V850_RH850_ABI__} is defined.
26053
26054 @item -mgcc-abi
26055 @opindex mgcc-abi
26056 Enables support for the old GCC version of the V850 ABI. With this
26057 version of the ABI the following rules apply:
26058
26059 @itemize
26060 @item
26061 Integer sized structures and unions are returned in register @code{r10}.
26062
26063 @item
26064 Large structures and unions (more than 8 bytes in size) are passed by
26065 reference.
26066
26067 @item
26068 Functions are aligned to 32-bit boundaries, unless optimizing for
26069 size.
26070
26071 @item
26072 The @option{-m8byte-align} command-line option is not supported.
26073
26074 @item
26075 The @option{-mdisable-callt} command-line option is supported but not
26076 enabled by default.
26077 @end itemize
26078
26079 When this version of the ABI is enabled the C preprocessor symbol
26080 @code{__V850_GCC_ABI__} is defined.
26081
26082 @item -m8byte-align
26083 @itemx -mno-8byte-align
26084 @opindex m8byte-align
26085 @opindex mno-8byte-align
26086 Enables support for @code{double} and @code{long long} types to be
26087 aligned on 8-byte boundaries. The default is to restrict the
26088 alignment of all objects to at most 4-bytes. When
26089 @option{-m8byte-align} is in effect the C preprocessor symbol
26090 @code{__V850_8BYTE_ALIGN__} is defined.
26091
26092 @item -mbig-switch
26093 @opindex mbig-switch
26094 Generate code suitable for big switch tables. Use this option only if
26095 the assembler/linker complain about out of range branches within a switch
26096 table.
26097
26098 @item -mapp-regs
26099 @opindex mapp-regs
26100 This option causes r2 and r5 to be used in the code generated by
26101 the compiler. This setting is the default.
26102
26103 @item -mno-app-regs
26104 @opindex mno-app-regs
26105 This option causes r2 and r5 to be treated as fixed registers.
26106
26107 @end table
26108
26109 @node VAX Options
26110 @subsection VAX Options
26111 @cindex VAX options
26112
26113 These @samp{-m} options are defined for the VAX:
26114
26115 @table @gcctabopt
26116 @item -munix
26117 @opindex munix
26118 Do not output certain jump instructions (@code{aobleq} and so on)
26119 that the Unix assembler for the VAX cannot handle across long
26120 ranges.
26121
26122 @item -mgnu
26123 @opindex mgnu
26124 Do output those jump instructions, on the assumption that the
26125 GNU assembler is being used.
26126
26127 @item -mg
26128 @opindex mg
26129 Output code for G-format floating-point numbers instead of D-format.
26130 @end table
26131
26132 @node Visium Options
26133 @subsection Visium Options
26134 @cindex Visium options
26135
26136 @table @gcctabopt
26137
26138 @item -mdebug
26139 @opindex mdebug
26140 A program which performs file I/O and is destined to run on an MCM target
26141 should be linked with this option. It causes the libraries libc.a and
26142 libdebug.a to be linked. The program should be run on the target under
26143 the control of the GDB remote debugging stub.
26144
26145 @item -msim
26146 @opindex msim
26147 A program which performs file I/O and is destined to run on the simulator
26148 should be linked with option. This causes libraries libc.a and libsim.a to
26149 be linked.
26150
26151 @item -mfpu
26152 @itemx -mhard-float
26153 @opindex mfpu
26154 @opindex mhard-float
26155 Generate code containing floating-point instructions. This is the
26156 default.
26157
26158 @item -mno-fpu
26159 @itemx -msoft-float
26160 @opindex mno-fpu
26161 @opindex msoft-float
26162 Generate code containing library calls for floating-point.
26163
26164 @option{-msoft-float} changes the calling convention in the output file;
26165 therefore, it is only useful if you compile @emph{all} of a program with
26166 this option. In particular, you need to compile @file{libgcc.a}, the
26167 library that comes with GCC, with @option{-msoft-float} in order for
26168 this to work.
26169
26170 @item -mcpu=@var{cpu_type}
26171 @opindex mcpu
26172 Set the instruction set, register set, and instruction scheduling parameters
26173 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26174 @samp{mcm}, @samp{gr5} and @samp{gr6}.
26175
26176 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
26177
26178 By default (unless configured otherwise), GCC generates code for the GR5
26179 variant of the Visium architecture.
26180
26181 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
26182 architecture. The only difference from GR5 code is that the compiler will
26183 generate block move instructions.
26184
26185 @item -mtune=@var{cpu_type}
26186 @opindex mtune
26187 Set the instruction scheduling parameters for machine type @var{cpu_type},
26188 but do not set the instruction set or register set that the option
26189 @option{-mcpu=@var{cpu_type}} would.
26190
26191 @item -msv-mode
26192 @opindex msv-mode
26193 Generate code for the supervisor mode, where there are no restrictions on
26194 the access to general registers. This is the default.
26195
26196 @item -muser-mode
26197 @opindex muser-mode
26198 Generate code for the user mode, where the access to some general registers
26199 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
26200 mode; on the GR6, only registers r29 to r31 are affected.
26201 @end table
26202
26203 @node VMS Options
26204 @subsection VMS Options
26205
26206 These @samp{-m} options are defined for the VMS implementations:
26207
26208 @table @gcctabopt
26209 @item -mvms-return-codes
26210 @opindex mvms-return-codes
26211 Return VMS condition codes from @code{main}. The default is to return POSIX-style
26212 condition (e.g.@ error) codes.
26213
26214 @item -mdebug-main=@var{prefix}
26215 @opindex mdebug-main=@var{prefix}
26216 Flag the first routine whose name starts with @var{prefix} as the main
26217 routine for the debugger.
26218
26219 @item -mmalloc64
26220 @opindex mmalloc64
26221 Default to 64-bit memory allocation routines.
26222
26223 @item -mpointer-size=@var{size}
26224 @opindex mpointer-size=@var{size}
26225 Set the default size of pointers. Possible options for @var{size} are
26226 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
26227 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
26228 The later option disables @code{pragma pointer_size}.
26229 @end table
26230
26231 @node VxWorks Options
26232 @subsection VxWorks Options
26233 @cindex VxWorks Options
26234
26235 The options in this section are defined for all VxWorks targets.
26236 Options specific to the target hardware are listed with the other
26237 options for that target.
26238
26239 @table @gcctabopt
26240 @item -mrtp
26241 @opindex mrtp
26242 GCC can generate code for both VxWorks kernels and real time processes
26243 (RTPs). This option switches from the former to the latter. It also
26244 defines the preprocessor macro @code{__RTP__}.
26245
26246 @item -non-static
26247 @opindex non-static
26248 Link an RTP executable against shared libraries rather than static
26249 libraries. The options @option{-static} and @option{-shared} can
26250 also be used for RTPs (@pxref{Link Options}); @option{-static}
26251 is the default.
26252
26253 @item -Bstatic
26254 @itemx -Bdynamic
26255 @opindex Bstatic
26256 @opindex Bdynamic
26257 These options are passed down to the linker. They are defined for
26258 compatibility with Diab.
26259
26260 @item -Xbind-lazy
26261 @opindex Xbind-lazy
26262 Enable lazy binding of function calls. This option is equivalent to
26263 @option{-Wl,-z,now} and is defined for compatibility with Diab.
26264
26265 @item -Xbind-now
26266 @opindex Xbind-now
26267 Disable lazy binding of function calls. This option is the default and
26268 is defined for compatibility with Diab.
26269 @end table
26270
26271 @node x86 Options
26272 @subsection x86 Options
26273 @cindex x86 Options
26274
26275 These @samp{-m} options are defined for the x86 family of computers.
26276
26277 @table @gcctabopt
26278
26279 @item -march=@var{cpu-type}
26280 @opindex march
26281 Generate instructions for the machine type @var{cpu-type}. In contrast to
26282 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26283 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26284 to generate code that may not run at all on processors other than the one
26285 indicated. Specifying @option{-march=@var{cpu-type}} implies
26286 @option{-mtune=@var{cpu-type}}.
26287
26288 The choices for @var{cpu-type} are:
26289
26290 @table @samp
26291 @item native
26292 This selects the CPU to generate code for at compilation time by determining
26293 the processor type of the compiling machine. Using @option{-march=native}
26294 enables all instruction subsets supported by the local machine (hence
26295 the result might not run on different machines). Using @option{-mtune=native}
26296 produces code optimized for the local machine under the constraints
26297 of the selected instruction set.
26298
26299 @item i386
26300 Original Intel i386 CPU@.
26301
26302 @item i486
26303 Intel i486 CPU@. (No scheduling is implemented for this chip.)
26304
26305 @item i586
26306 @itemx pentium
26307 Intel Pentium CPU with no MMX support.
26308
26309 @item lakemont
26310 Intel Lakemont MCU, based on Intel Pentium CPU.
26311
26312 @item pentium-mmx
26313 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
26314
26315 @item pentiumpro
26316 Intel Pentium Pro CPU@.
26317
26318 @item i686
26319 When used with @option{-march}, the Pentium Pro
26320 instruction set is used, so the code runs on all i686 family chips.
26321 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
26322
26323 @item pentium2
26324 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
26325 support.
26326
26327 @item pentium3
26328 @itemx pentium3m
26329 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
26330 set support.
26331
26332 @item pentium-m
26333 Intel Pentium M; low-power version of Intel Pentium III CPU
26334 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
26335
26336 @item pentium4
26337 @itemx pentium4m
26338 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
26339
26340 @item prescott
26341 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
26342 set support.
26343
26344 @item nocona
26345 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
26346 SSE2 and SSE3 instruction set support.
26347
26348 @item core2
26349 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
26350 instruction set support.
26351
26352 @item nehalem
26353 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26354 SSE4.1, SSE4.2 and POPCNT instruction set support.
26355
26356 @item westmere
26357 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26358 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
26359
26360 @item sandybridge
26361 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26362 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
26363
26364 @item ivybridge
26365 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26366 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
26367 instruction set support.
26368
26369 @item haswell
26370 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26371 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26372 BMI, BMI2 and F16C instruction set support.
26373
26374 @item broadwell
26375 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26376 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26377 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
26378
26379 @item skylake
26380 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26381 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26382 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
26383 XSAVES instruction set support.
26384
26385 @item bonnell
26386 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
26387 instruction set support.
26388
26389 @item silvermont
26390 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26391 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
26392
26393 @item knl
26394 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26395 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26396 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
26397 AVX512CD instruction set support.
26398
26399 @item knm
26400 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26401 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26402 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
26403 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
26404
26405 @item skylake-avx512
26406 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26407 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26408 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
26409 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
26410
26411 @item cannonlake
26412 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26413 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26414 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26415 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26416 AVX512IFMA, SHA, CLWB and UMIP instruction set support.
26417
26418 @item Icelake
26419 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26420 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26421 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26422 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26423 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
26424 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
26425
26426 @item k6
26427 AMD K6 CPU with MMX instruction set support.
26428
26429 @item k6-2
26430 @itemx k6-3
26431 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
26432
26433 @item athlon
26434 @itemx athlon-tbird
26435 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
26436 support.
26437
26438 @item athlon-4
26439 @itemx athlon-xp
26440 @itemx athlon-mp
26441 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
26442 instruction set support.
26443
26444 @item k8
26445 @itemx opteron
26446 @itemx athlon64
26447 @itemx athlon-fx
26448 Processors based on the AMD K8 core with x86-64 instruction set support,
26449 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
26450 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
26451 instruction set extensions.)
26452
26453 @item k8-sse3
26454 @itemx opteron-sse3
26455 @itemx athlon64-sse3
26456 Improved versions of AMD K8 cores with SSE3 instruction set support.
26457
26458 @item amdfam10
26459 @itemx barcelona
26460 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
26461 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
26462 instruction set extensions.)
26463
26464 @item bdver1
26465 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
26466 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
26467 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
26468 @item bdver2
26469 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26470 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
26471 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
26472 extensions.)
26473 @item bdver3
26474 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26475 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
26476 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
26477 64-bit instruction set extensions.
26478 @item bdver4
26479 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26480 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
26481 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
26482 SSE4.2, ABM and 64-bit instruction set extensions.
26483
26484 @item znver1
26485 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
26486 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
26487 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
26488 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
26489 instruction set extensions.
26490
26491 @item btver1
26492 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
26493 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
26494 instruction set extensions.)
26495
26496 @item btver2
26497 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
26498 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
26499 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
26500
26501 @item winchip-c6
26502 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
26503 set support.
26504
26505 @item winchip2
26506 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
26507 instruction set support.
26508
26509 @item c3
26510 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
26511 (No scheduling is implemented for this chip.)
26512
26513 @item c3-2
26514 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
26515 (No scheduling is implemented for this chip.)
26516
26517 @item c7
26518 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
26519 (No scheduling is implemented for this chip.)
26520
26521 @item samuel-2
26522 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
26523 (No scheduling is implemented for this chip.)
26524
26525 @item nehemiah
26526 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
26527 (No scheduling is implemented for this chip.)
26528
26529 @item esther
26530 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
26531 (No scheduling is implemented for this chip.)
26532
26533 @item eden-x2
26534 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
26535 (No scheduling is implemented for this chip.)
26536
26537 @item eden-x4
26538 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
26539 AVX and AVX2 instruction set support.
26540 (No scheduling is implemented for this chip.)
26541
26542 @item nano
26543 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26544 instruction set support.
26545 (No scheduling is implemented for this chip.)
26546
26547 @item nano-1000
26548 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26549 instruction set support.
26550 (No scheduling is implemented for this chip.)
26551
26552 @item nano-2000
26553 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26554 instruction set support.
26555 (No scheduling is implemented for this chip.)
26556
26557 @item nano-3000
26558 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26559 instruction set support.
26560 (No scheduling is implemented for this chip.)
26561
26562 @item nano-x2
26563 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26564 instruction set support.
26565 (No scheduling is implemented for this chip.)
26566
26567 @item nano-x4
26568 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26569 instruction set support.
26570 (No scheduling is implemented for this chip.)
26571
26572 @item geode
26573 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
26574 @end table
26575
26576 @item -mtune=@var{cpu-type}
26577 @opindex mtune
26578 Tune to @var{cpu-type} everything applicable about the generated code, except
26579 for the ABI and the set of available instructions.
26580 While picking a specific @var{cpu-type} schedules things appropriately
26581 for that particular chip, the compiler does not generate any code that
26582 cannot run on the default machine type unless you use a
26583 @option{-march=@var{cpu-type}} option.
26584 For example, if GCC is configured for i686-pc-linux-gnu
26585 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
26586 but still runs on i686 machines.
26587
26588 The choices for @var{cpu-type} are the same as for @option{-march}.
26589 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
26590
26591 @table @samp
26592 @item generic
26593 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
26594 If you know the CPU on which your code will run, then you should use
26595 the corresponding @option{-mtune} or @option{-march} option instead of
26596 @option{-mtune=generic}. But, if you do not know exactly what CPU users
26597 of your application will have, then you should use this option.
26598
26599 As new processors are deployed in the marketplace, the behavior of this
26600 option will change. Therefore, if you upgrade to a newer version of
26601 GCC, code generation controlled by this option will change to reflect
26602 the processors
26603 that are most common at the time that version of GCC is released.
26604
26605 There is no @option{-march=generic} option because @option{-march}
26606 indicates the instruction set the compiler can use, and there is no
26607 generic instruction set applicable to all processors. In contrast,
26608 @option{-mtune} indicates the processor (or, in this case, collection of
26609 processors) for which the code is optimized.
26610
26611 @item intel
26612 Produce code optimized for the most current Intel processors, which are
26613 Haswell and Silvermont for this version of GCC. If you know the CPU
26614 on which your code will run, then you should use the corresponding
26615 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
26616 But, if you want your application performs better on both Haswell and
26617 Silvermont, then you should use this option.
26618
26619 As new Intel processors are deployed in the marketplace, the behavior of
26620 this option will change. Therefore, if you upgrade to a newer version of
26621 GCC, code generation controlled by this option will change to reflect
26622 the most current Intel processors at the time that version of GCC is
26623 released.
26624
26625 There is no @option{-march=intel} option because @option{-march} indicates
26626 the instruction set the compiler can use, and there is no common
26627 instruction set applicable to all processors. In contrast,
26628 @option{-mtune} indicates the processor (or, in this case, collection of
26629 processors) for which the code is optimized.
26630 @end table
26631
26632 @item -mcpu=@var{cpu-type}
26633 @opindex mcpu
26634 A deprecated synonym for @option{-mtune}.
26635
26636 @item -mfpmath=@var{unit}
26637 @opindex mfpmath
26638 Generate floating-point arithmetic for selected unit @var{unit}. The choices
26639 for @var{unit} are:
26640
26641 @table @samp
26642 @item 387
26643 Use the standard 387 floating-point coprocessor present on the majority of chips and
26644 emulated otherwise. Code compiled with this option runs almost everywhere.
26645 The temporary results are computed in 80-bit precision instead of the precision
26646 specified by the type, resulting in slightly different results compared to most
26647 of other chips. See @option{-ffloat-store} for more detailed description.
26648
26649 This is the default choice for non-Darwin x86-32 targets.
26650
26651 @item sse
26652 Use scalar floating-point instructions present in the SSE instruction set.
26653 This instruction set is supported by Pentium III and newer chips,
26654 and in the AMD line
26655 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
26656 instruction set supports only single-precision arithmetic, thus the double and
26657 extended-precision arithmetic are still done using 387. A later version, present
26658 only in Pentium 4 and AMD x86-64 chips, supports double-precision
26659 arithmetic too.
26660
26661 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
26662 or @option{-msse2} switches to enable SSE extensions and make this option
26663 effective. For the x86-64 compiler, these extensions are enabled by default.
26664
26665 The resulting code should be considerably faster in the majority of cases and avoid
26666 the numerical instability problems of 387 code, but may break some existing
26667 code that expects temporaries to be 80 bits.
26668
26669 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
26670 and the default choice for x86-32 targets with the SSE2 instruction set
26671 when @option{-ffast-math} is enabled.
26672
26673 @item sse,387
26674 @itemx sse+387
26675 @itemx both
26676 Attempt to utilize both instruction sets at once. This effectively doubles the
26677 amount of available registers, and on chips with separate execution units for
26678 387 and SSE the execution resources too. Use this option with care, as it is
26679 still experimental, because the GCC register allocator does not model separate
26680 functional units well, resulting in unstable performance.
26681 @end table
26682
26683 @item -masm=@var{dialect}
26684 @opindex masm=@var{dialect}
26685 Output assembly instructions using selected @var{dialect}. Also affects
26686 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
26687 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
26688 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
26689 not support @samp{intel}.
26690
26691 @item -mieee-fp
26692 @itemx -mno-ieee-fp
26693 @opindex mieee-fp
26694 @opindex mno-ieee-fp
26695 Control whether or not the compiler uses IEEE floating-point
26696 comparisons. These correctly handle the case where the result of a
26697 comparison is unordered.
26698
26699 @item -m80387
26700 @item -mhard-float
26701 @opindex 80387
26702 @opindex mhard-float
26703 Generate output containing 80387 instructions for floating point.
26704
26705 @item -mno-80387
26706 @item -msoft-float
26707 @opindex no-80387
26708 @opindex msoft-float
26709 Generate output containing library calls for floating point.
26710
26711 @strong{Warning:} the requisite libraries are not part of GCC@.
26712 Normally the facilities of the machine's usual C compiler are used, but
26713 this cannot be done directly in cross-compilation. You must make your
26714 own arrangements to provide suitable library functions for
26715 cross-compilation.
26716
26717 On machines where a function returns floating-point results in the 80387
26718 register stack, some floating-point opcodes may be emitted even if
26719 @option{-msoft-float} is used.
26720
26721 @item -mno-fp-ret-in-387
26722 @opindex mno-fp-ret-in-387
26723 Do not use the FPU registers for return values of functions.
26724
26725 The usual calling convention has functions return values of types
26726 @code{float} and @code{double} in an FPU register, even if there
26727 is no FPU@. The idea is that the operating system should emulate
26728 an FPU@.
26729
26730 The option @option{-mno-fp-ret-in-387} causes such values to be returned
26731 in ordinary CPU registers instead.
26732
26733 @item -mno-fancy-math-387
26734 @opindex mno-fancy-math-387
26735 Some 387 emulators do not support the @code{sin}, @code{cos} and
26736 @code{sqrt} instructions for the 387. Specify this option to avoid
26737 generating those instructions. This option is the default on
26738 OpenBSD and NetBSD@. This option is overridden when @option{-march}
26739 indicates that the target CPU always has an FPU and so the
26740 instruction does not need emulation. These
26741 instructions are not generated unless you also use the
26742 @option{-funsafe-math-optimizations} switch.
26743
26744 @item -malign-double
26745 @itemx -mno-align-double
26746 @opindex malign-double
26747 @opindex mno-align-double
26748 Control whether GCC aligns @code{double}, @code{long double}, and
26749 @code{long long} variables on a two-word boundary or a one-word
26750 boundary. Aligning @code{double} variables on a two-word boundary
26751 produces code that runs somewhat faster on a Pentium at the
26752 expense of more memory.
26753
26754 On x86-64, @option{-malign-double} is enabled by default.
26755
26756 @strong{Warning:} if you use the @option{-malign-double} switch,
26757 structures containing the above types are aligned differently than
26758 the published application binary interface specifications for the x86-32
26759 and are not binary compatible with structures in code compiled
26760 without that switch.
26761
26762 @item -m96bit-long-double
26763 @itemx -m128bit-long-double
26764 @opindex m96bit-long-double
26765 @opindex m128bit-long-double
26766 These switches control the size of @code{long double} type. The x86-32
26767 application binary interface specifies the size to be 96 bits,
26768 so @option{-m96bit-long-double} is the default in 32-bit mode.
26769
26770 Modern architectures (Pentium and newer) prefer @code{long double}
26771 to be aligned to an 8- or 16-byte boundary. In arrays or structures
26772 conforming to the ABI, this is not possible. So specifying
26773 @option{-m128bit-long-double} aligns @code{long double}
26774 to a 16-byte boundary by padding the @code{long double} with an additional
26775 32-bit zero.
26776
26777 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
26778 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
26779
26780 Notice that neither of these options enable any extra precision over the x87
26781 standard of 80 bits for a @code{long double}.
26782
26783 @strong{Warning:} if you override the default value for your target ABI, this
26784 changes the size of
26785 structures and arrays containing @code{long double} variables,
26786 as well as modifying the function calling convention for functions taking
26787 @code{long double}. Hence they are not binary-compatible
26788 with code compiled without that switch.
26789
26790 @item -mlong-double-64
26791 @itemx -mlong-double-80
26792 @itemx -mlong-double-128
26793 @opindex mlong-double-64
26794 @opindex mlong-double-80
26795 @opindex mlong-double-128
26796 These switches control the size of @code{long double} type. A size
26797 of 64 bits makes the @code{long double} type equivalent to the @code{double}
26798 type. This is the default for 32-bit Bionic C library. A size
26799 of 128 bits makes the @code{long double} type equivalent to the
26800 @code{__float128} type. This is the default for 64-bit Bionic C library.
26801
26802 @strong{Warning:} if you override the default value for your target ABI, this
26803 changes the size of
26804 structures and arrays containing @code{long double} variables,
26805 as well as modifying the function calling convention for functions taking
26806 @code{long double}. Hence they are not binary-compatible
26807 with code compiled without that switch.
26808
26809 @item -malign-data=@var{type}
26810 @opindex malign-data
26811 Control how GCC aligns variables. Supported values for @var{type} are
26812 @samp{compat} uses increased alignment value compatible uses GCC 4.8
26813 and earlier, @samp{abi} uses alignment value as specified by the
26814 psABI, and @samp{cacheline} uses increased alignment value to match
26815 the cache line size. @samp{compat} is the default.
26816
26817 @item -mlarge-data-threshold=@var{threshold}
26818 @opindex mlarge-data-threshold
26819 When @option{-mcmodel=medium} is specified, data objects larger than
26820 @var{threshold} are placed in the large data section. This value must be the
26821 same across all objects linked into the binary, and defaults to 65535.
26822
26823 @item -mrtd
26824 @opindex mrtd
26825 Use a different function-calling convention, in which functions that
26826 take a fixed number of arguments return with the @code{ret @var{num}}
26827 instruction, which pops their arguments while returning. This saves one
26828 instruction in the caller since there is no need to pop the arguments
26829 there.
26830
26831 You can specify that an individual function is called with this calling
26832 sequence with the function attribute @code{stdcall}. You can also
26833 override the @option{-mrtd} option by using the function attribute
26834 @code{cdecl}. @xref{Function Attributes}.
26835
26836 @strong{Warning:} this calling convention is incompatible with the one
26837 normally used on Unix, so you cannot use it if you need to call
26838 libraries compiled with the Unix compiler.
26839
26840 Also, you must provide function prototypes for all functions that
26841 take variable numbers of arguments (including @code{printf});
26842 otherwise incorrect code is generated for calls to those
26843 functions.
26844
26845 In addition, seriously incorrect code results if you call a
26846 function with too many arguments. (Normally, extra arguments are
26847 harmlessly ignored.)
26848
26849 @item -mregparm=@var{num}
26850 @opindex mregparm
26851 Control how many registers are used to pass integer arguments. By
26852 default, no registers are used to pass arguments, and at most 3
26853 registers can be used. You can control this behavior for a specific
26854 function by using the function attribute @code{regparm}.
26855 @xref{Function Attributes}.
26856
26857 @strong{Warning:} if you use this switch, and
26858 @var{num} is nonzero, then you must build all modules with the same
26859 value, including any libraries. This includes the system libraries and
26860 startup modules.
26861
26862 @item -msseregparm
26863 @opindex msseregparm
26864 Use SSE register passing conventions for float and double arguments
26865 and return values. You can control this behavior for a specific
26866 function by using the function attribute @code{sseregparm}.
26867 @xref{Function Attributes}.
26868
26869 @strong{Warning:} if you use this switch then you must build all
26870 modules with the same value, including any libraries. This includes
26871 the system libraries and startup modules.
26872
26873 @item -mvect8-ret-in-mem
26874 @opindex mvect8-ret-in-mem
26875 Return 8-byte vectors in memory instead of MMX registers. This is the
26876 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
26877 Studio compilers until version 12. Later compiler versions (starting
26878 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
26879 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
26880 you need to remain compatible with existing code produced by those
26881 previous compiler versions or older versions of GCC@.
26882
26883 @item -mpc32
26884 @itemx -mpc64
26885 @itemx -mpc80
26886 @opindex mpc32
26887 @opindex mpc64
26888 @opindex mpc80
26889
26890 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
26891 is specified, the significands of results of floating-point operations are
26892 rounded to 24 bits (single precision); @option{-mpc64} rounds the
26893 significands of results of floating-point operations to 53 bits (double
26894 precision) and @option{-mpc80} rounds the significands of results of
26895 floating-point operations to 64 bits (extended double precision), which is
26896 the default. When this option is used, floating-point operations in higher
26897 precisions are not available to the programmer without setting the FPU
26898 control word explicitly.
26899
26900 Setting the rounding of floating-point operations to less than the default
26901 80 bits can speed some programs by 2% or more. Note that some mathematical
26902 libraries assume that extended-precision (80-bit) floating-point operations
26903 are enabled by default; routines in such libraries could suffer significant
26904 loss of accuracy, typically through so-called ``catastrophic cancellation'',
26905 when this option is used to set the precision to less than extended precision.
26906
26907 @item -mstackrealign
26908 @opindex mstackrealign
26909 Realign the stack at entry. On the x86, the @option{-mstackrealign}
26910 option generates an alternate prologue and epilogue that realigns the
26911 run-time stack if necessary. This supports mixing legacy codes that keep
26912 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
26913 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
26914 applicable to individual functions.
26915
26916 @item -mpreferred-stack-boundary=@var{num}
26917 @opindex mpreferred-stack-boundary
26918 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
26919 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
26920 the default is 4 (16 bytes or 128 bits).
26921
26922 @strong{Warning:} When generating code for the x86-64 architecture with
26923 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
26924 used to keep the stack boundary aligned to 8 byte boundary. Since
26925 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
26926 intended to be used in controlled environment where stack space is
26927 important limitation. This option leads to wrong code when functions
26928 compiled with 16 byte stack alignment (such as functions from a standard
26929 library) are called with misaligned stack. In this case, SSE
26930 instructions may lead to misaligned memory access traps. In addition,
26931 variable arguments are handled incorrectly for 16 byte aligned
26932 objects (including x87 long double and __int128), leading to wrong
26933 results. You must build all modules with
26934 @option{-mpreferred-stack-boundary=3}, including any libraries. This
26935 includes the system libraries and startup modules.
26936
26937 @item -mincoming-stack-boundary=@var{num}
26938 @opindex mincoming-stack-boundary
26939 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
26940 boundary. If @option{-mincoming-stack-boundary} is not specified,
26941 the one specified by @option{-mpreferred-stack-boundary} is used.
26942
26943 On Pentium and Pentium Pro, @code{double} and @code{long double} values
26944 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
26945 suffer significant run time performance penalties. On Pentium III, the
26946 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
26947 properly if it is not 16-byte aligned.
26948
26949 To ensure proper alignment of this values on the stack, the stack boundary
26950 must be as aligned as that required by any value stored on the stack.
26951 Further, every function must be generated such that it keeps the stack
26952 aligned. Thus calling a function compiled with a higher preferred
26953 stack boundary from a function compiled with a lower preferred stack
26954 boundary most likely misaligns the stack. It is recommended that
26955 libraries that use callbacks always use the default setting.
26956
26957 This extra alignment does consume extra stack space, and generally
26958 increases code size. Code that is sensitive to stack space usage, such
26959 as embedded systems and operating system kernels, may want to reduce the
26960 preferred alignment to @option{-mpreferred-stack-boundary=2}.
26961
26962 @need 200
26963 @item -mmmx
26964 @opindex mmmx
26965 @need 200
26966 @itemx -msse
26967 @opindex msse
26968 @need 200
26969 @itemx -msse2
26970 @opindex msse2
26971 @need 200
26972 @itemx -msse3
26973 @opindex msse3
26974 @need 200
26975 @itemx -mssse3
26976 @opindex mssse3
26977 @need 200
26978 @itemx -msse4
26979 @opindex msse4
26980 @need 200
26981 @itemx -msse4a
26982 @opindex msse4a
26983 @need 200
26984 @itemx -msse4.1
26985 @opindex msse4.1
26986 @need 200
26987 @itemx -msse4.2
26988 @opindex msse4.2
26989 @need 200
26990 @itemx -mavx
26991 @opindex mavx
26992 @need 200
26993 @itemx -mavx2
26994 @opindex mavx2
26995 @need 200
26996 @itemx -mavx512f
26997 @opindex mavx512f
26998 @need 200
26999 @itemx -mavx512pf
27000 @opindex mavx512pf
27001 @need 200
27002 @itemx -mavx512er
27003 @opindex mavx512er
27004 @need 200
27005 @itemx -mavx512cd
27006 @opindex mavx512cd
27007 @need 200
27008 @itemx -mavx512vl
27009 @opindex mavx512vl
27010 @need 200
27011 @itemx -mavx512bw
27012 @opindex mavx512bw
27013 @need 200
27014 @itemx -mavx512dq
27015 @opindex mavx512dq
27016 @need 200
27017 @itemx -mavx512ifma
27018 @opindex mavx512ifma
27019 @need 200
27020 @itemx -mavx512vbmi
27021 @opindex mavx512vbmi
27022 @need 200
27023 @itemx -msha
27024 @opindex msha
27025 @need 200
27026 @itemx -maes
27027 @opindex maes
27028 @need 200
27029 @itemx -mpclmul
27030 @opindex mpclmul
27031 @need 200
27032 @itemx -mclfushopt
27033 @opindex mclfushopt
27034 @need 200
27035 @itemx -mfsgsbase
27036 @opindex mfsgsbase
27037 @need 200
27038 @itemx -mrdrnd
27039 @opindex mrdrnd
27040 @need 200
27041 @itemx -mf16c
27042 @opindex mf16c
27043 @need 200
27044 @itemx -mfma
27045 @opindex mfma
27046 @need 200
27047 @itemx -mfma4
27048 @opindex mfma4
27049 @need 200
27050 @itemx -mprefetchwt1
27051 @opindex mprefetchwt1
27052 @need 200
27053 @itemx -mxop
27054 @opindex mxop
27055 @need 200
27056 @itemx -mlwp
27057 @opindex mlwp
27058 @need 200
27059 @itemx -m3dnow
27060 @opindex m3dnow
27061 @need 200
27062 @itemx -m3dnowa
27063 @opindex m3dnowa
27064 @need 200
27065 @itemx -mpopcnt
27066 @opindex mpopcnt
27067 @need 200
27068 @itemx -mabm
27069 @opindex mabm
27070 @need 200
27071 @itemx -mbmi
27072 @opindex mbmi
27073 @need 200
27074 @itemx -mbmi2
27075 @need 200
27076 @itemx -mlzcnt
27077 @opindex mlzcnt
27078 @need 200
27079 @itemx -mfxsr
27080 @opindex mfxsr
27081 @need 200
27082 @itemx -mxsave
27083 @opindex mxsave
27084 @need 200
27085 @itemx -mxsaveopt
27086 @opindex mxsaveopt
27087 @need 200
27088 @itemx -mxsavec
27089 @opindex mxsavec
27090 @need 200
27091 @itemx -mxsaves
27092 @opindex mxsaves
27093 @need 200
27094 @itemx -mrtm
27095 @opindex mrtm
27096 @need 200
27097 @itemx -mtbm
27098 @opindex mtbm
27099 @need 200
27100 @itemx -mmpx
27101 @opindex mmpx
27102 @need 200
27103 @itemx -mmwaitx
27104 @opindex mmwaitx
27105 @need 200
27106 @itemx -mclzero
27107 @opindex mclzero
27108 @need 200
27109 @itemx -mpku
27110 @opindex mpku
27111 @need 200
27112 @itemx -mcet
27113 @opindex mcet
27114 @need 200
27115 @itemx -mavx512vbmi2
27116 @opindex mavx512vbmi2
27117 @need 200
27118 @itemx -mgfni
27119 @opindex mgfni
27120 @need 200
27121 @itemx -mvaes
27122 @opindex mvaes
27123 @need 200
27124 @itemx -mvpclmulqdq
27125 @opindex mvpclmulqdq
27126 @need 200
27127 @itemx -mavx512bitalg
27128 @opindex mavx512bitalg
27129 @need 200
27130 @itemx -mavx512vpopcntdq
27131 @opindex mavx512vpopcntdq
27132 These switches enable the use of instructions in the MMX, SSE,
27133 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27134 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
27135 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES,
27136 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
27137 GFNI, VPCLMULQDQ, AVX512BITALG, AVX512VPOPCNTDQ3DNow!@: or enhanced 3DNow!@:
27138 extended instruction sets.
27139 Each has a corresponding @option{-mno-} option to disable use of these
27140 instructions.
27141
27142 These extensions are also available as built-in functions: see
27143 @ref{x86 Built-in Functions}, for details of the functions enabled and
27144 disabled by these switches.
27145
27146 To generate SSE/SSE2 instructions automatically from floating-point
27147 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
27148
27149 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
27150 generates new AVX instructions or AVX equivalence for all SSEx instructions
27151 when needed.
27152
27153 These options enable GCC to use these extended instructions in
27154 generated code, even without @option{-mfpmath=sse}. Applications that
27155 perform run-time CPU detection must compile separate files for each
27156 supported architecture, using the appropriate flags. In particular,
27157 the file containing the CPU detection code should be compiled without
27158 these options.
27159
27160 The @option{-mcet} option turns on the @option{-mibt} and @option{-mshstk}
27161 options. The @option{-mibt} option enables indirect branch tracking support
27162 and the @option{-mshstk} option enables shadow stack support from
27163 Intel Control-flow Enforcement Technology (CET). The compiler also provides
27164 a number of built-in functions for fine-grained control in a CET-based
27165 application. See @xref{x86 Built-in Functions}, for more information.
27166
27167 @item -mdump-tune-features
27168 @opindex mdump-tune-features
27169 This option instructs GCC to dump the names of the x86 performance
27170 tuning features and default settings. The names can be used in
27171 @option{-mtune-ctrl=@var{feature-list}}.
27172
27173 @item -mtune-ctrl=@var{feature-list}
27174 @opindex mtune-ctrl=@var{feature-list}
27175 This option is used to do fine grain control of x86 code generation features.
27176 @var{feature-list} is a comma separated list of @var{feature} names. See also
27177 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
27178 on if it is not preceded with @samp{^}, otherwise, it is turned off.
27179 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
27180 developers. Using it may lead to code paths not covered by testing and can
27181 potentially result in compiler ICEs or runtime errors.
27182
27183 @item -mno-default
27184 @opindex mno-default
27185 This option instructs GCC to turn off all tunable features. See also
27186 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
27187
27188 @item -mcld
27189 @opindex mcld
27190 This option instructs GCC to emit a @code{cld} instruction in the prologue
27191 of functions that use string instructions. String instructions depend on
27192 the DF flag to select between autoincrement or autodecrement mode. While the
27193 ABI specifies the DF flag to be cleared on function entry, some operating
27194 systems violate this specification by not clearing the DF flag in their
27195 exception dispatchers. The exception handler can be invoked with the DF flag
27196 set, which leads to wrong direction mode when string instructions are used.
27197 This option can be enabled by default on 32-bit x86 targets by configuring
27198 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
27199 instructions can be suppressed with the @option{-mno-cld} compiler option
27200 in this case.
27201
27202 @item -mvzeroupper
27203 @opindex mvzeroupper
27204 This option instructs GCC to emit a @code{vzeroupper} instruction
27205 before a transfer of control flow out of the function to minimize
27206 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
27207 intrinsics.
27208
27209 @item -mprefer-avx128
27210 @opindex mprefer-avx128
27211 This option instructs GCC to use 128-bit AVX instructions instead of
27212 256-bit AVX instructions in the auto-vectorizer.
27213
27214 @item -mprefer-vector-width=@var{opt}
27215 @opindex mprefer-vector-width
27216 This option instructs GCC to use @var{opt}-bit vector width in instructions
27217 instead of default on the selected platform.
27218
27219 @table @samp
27220 @item none
27221 No extra limitations applied to GCC other than defined by the selected platform.
27222
27223 @item 128
27224 Prefer 128-bit vector width for instructions.
27225
27226 @item 256
27227 Prefer 256-bit vector width for instructions.
27228
27229 @item 512
27230 Prefer 512-bit vector width for instructions.
27231 @end table
27232
27233 @item -mcx16
27234 @opindex mcx16
27235 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
27236 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
27237 objects. This is useful for atomic updates of data structures exceeding one
27238 machine word in size. The compiler uses this instruction to implement
27239 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
27240 128-bit integers, a library call is always used.
27241
27242 @item -msahf
27243 @opindex msahf
27244 This option enables generation of @code{SAHF} instructions in 64-bit code.
27245 Early Intel Pentium 4 CPUs with Intel 64 support,
27246 prior to the introduction of Pentium 4 G1 step in December 2005,
27247 lacked the @code{LAHF} and @code{SAHF} instructions
27248 which are supported by AMD64.
27249 These are load and store instructions, respectively, for certain status flags.
27250 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
27251 @code{drem}, and @code{remainder} built-in functions;
27252 see @ref{Other Builtins} for details.
27253
27254 @item -mmovbe
27255 @opindex mmovbe
27256 This option enables use of the @code{movbe} instruction to implement
27257 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
27258
27259 @item -mibt
27260 @opindex mibt
27261 This option tells the compiler to use indirect branch tracking support
27262 (for indirect calls and jumps) from x86 Control-flow Enforcement
27263 Technology (CET). The option has effect only if the
27264 @option{-fcf-protection=full} or @option{-fcf-protection=branch} option
27265 is specified. The option @option{-mibt} is on by default when the
27266 @code{-mcet} option is specified.
27267
27268 @item -mshstk
27269 @opindex mshstk
27270 This option tells the compiler to use shadow stack support (return
27271 address tracking) from x86 Control-flow Enforcement Technology (CET).
27272 The option has effect only if the @option{-fcf-protection=full} or
27273 @option{-fcf-protection=return} option is specified. The option
27274 @option{-mshstk} is on by default when the @option{-mcet} option is
27275 specified.
27276
27277 @item -mcrc32
27278 @opindex mcrc32
27279 This option enables built-in functions @code{__builtin_ia32_crc32qi},
27280 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
27281 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
27282
27283 @item -mrecip
27284 @opindex mrecip
27285 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
27286 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
27287 with an additional Newton-Raphson step
27288 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
27289 (and their vectorized
27290 variants) for single-precision floating-point arguments. These instructions
27291 are generated only when @option{-funsafe-math-optimizations} is enabled
27292 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
27293 Note that while the throughput of the sequence is higher than the throughput
27294 of the non-reciprocal instruction, the precision of the sequence can be
27295 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
27296
27297 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
27298 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
27299 combination), and doesn't need @option{-mrecip}.
27300
27301 Also note that GCC emits the above sequence with additional Newton-Raphson step
27302 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
27303 already with @option{-ffast-math} (or the above option combination), and
27304 doesn't need @option{-mrecip}.
27305
27306 @item -mrecip=@var{opt}
27307 @opindex mrecip=opt
27308 This option controls which reciprocal estimate instructions
27309 may be used. @var{opt} is a comma-separated list of options, which may
27310 be preceded by a @samp{!} to invert the option:
27311
27312 @table @samp
27313 @item all
27314 Enable all estimate instructions.
27315
27316 @item default
27317 Enable the default instructions, equivalent to @option{-mrecip}.
27318
27319 @item none
27320 Disable all estimate instructions, equivalent to @option{-mno-recip}.
27321
27322 @item div
27323 Enable the approximation for scalar division.
27324
27325 @item vec-div
27326 Enable the approximation for vectorized division.
27327
27328 @item sqrt
27329 Enable the approximation for scalar square root.
27330
27331 @item vec-sqrt
27332 Enable the approximation for vectorized square root.
27333 @end table
27334
27335 So, for example, @option{-mrecip=all,!sqrt} enables
27336 all of the reciprocal approximations, except for square root.
27337
27338 @item -mveclibabi=@var{type}
27339 @opindex mveclibabi
27340 Specifies the ABI type to use for vectorizing intrinsics using an
27341 external library. Supported values for @var{type} are @samp{svml}
27342 for the Intel short
27343 vector math library and @samp{acml} for the AMD math core library.
27344 To use this option, both @option{-ftree-vectorize} and
27345 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
27346 ABI-compatible library must be specified at link time.
27347
27348 GCC currently emits calls to @code{vmldExp2},
27349 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
27350 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
27351 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
27352 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
27353 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
27354 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
27355 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
27356 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
27357 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
27358 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
27359 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
27360 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
27361 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
27362 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
27363 when @option{-mveclibabi=acml} is used.
27364
27365 @item -mabi=@var{name}
27366 @opindex mabi
27367 Generate code for the specified calling convention. Permissible values
27368 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
27369 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
27370 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
27371 You can control this behavior for specific functions by
27372 using the function attributes @code{ms_abi} and @code{sysv_abi}.
27373 @xref{Function Attributes}.
27374
27375 @item -mforce-indirect-call
27376 @opindex mforce-indirect-call
27377 Force all calls to functions to be indirect. This is useful
27378 when using Intel Processor Trace where it generates more precise timing
27379 information for function calls.
27380
27381 @item -mcall-ms2sysv-xlogues
27382 @opindex mcall-ms2sysv-xlogues
27383 @opindex mno-call-ms2sysv-xlogues
27384 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
27385 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
27386 default, the code for saving and restoring these registers is emitted inline,
27387 resulting in fairly lengthy prologues and epilogues. Using
27388 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
27389 use stubs in the static portion of libgcc to perform these saves and restores,
27390 thus reducing function size at the cost of a few extra instructions.
27391
27392 @item -mtls-dialect=@var{type}
27393 @opindex mtls-dialect
27394 Generate code to access thread-local storage using the @samp{gnu} or
27395 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
27396 @samp{gnu2} is more efficient, but it may add compile- and run-time
27397 requirements that cannot be satisfied on all systems.
27398
27399 @item -mpush-args
27400 @itemx -mno-push-args
27401 @opindex mpush-args
27402 @opindex mno-push-args
27403 Use PUSH operations to store outgoing parameters. This method is shorter
27404 and usually equally fast as method using SUB/MOV operations and is enabled
27405 by default. In some cases disabling it may improve performance because of
27406 improved scheduling and reduced dependencies.
27407
27408 @item -maccumulate-outgoing-args
27409 @opindex maccumulate-outgoing-args
27410 If enabled, the maximum amount of space required for outgoing arguments is
27411 computed in the function prologue. This is faster on most modern CPUs
27412 because of reduced dependencies, improved scheduling and reduced stack usage
27413 when the preferred stack boundary is not equal to 2. The drawback is a notable
27414 increase in code size. This switch implies @option{-mno-push-args}.
27415
27416 @item -mthreads
27417 @opindex mthreads
27418 Support thread-safe exception handling on MinGW. Programs that rely
27419 on thread-safe exception handling must compile and link all code with the
27420 @option{-mthreads} option. When compiling, @option{-mthreads} defines
27421 @option{-D_MT}; when linking, it links in a special thread helper library
27422 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
27423
27424 @item -mms-bitfields
27425 @itemx -mno-ms-bitfields
27426 @opindex mms-bitfields
27427 @opindex mno-ms-bitfields
27428
27429 Enable/disable bit-field layout compatible with the native Microsoft
27430 Windows compiler.
27431
27432 If @code{packed} is used on a structure, or if bit-fields are used,
27433 it may be that the Microsoft ABI lays out the structure differently
27434 than the way GCC normally does. Particularly when moving packed
27435 data between functions compiled with GCC and the native Microsoft compiler
27436 (either via function call or as data in a file), it may be necessary to access
27437 either format.
27438
27439 This option is enabled by default for Microsoft Windows
27440 targets. This behavior can also be controlled locally by use of variable
27441 or type attributes. For more information, see @ref{x86 Variable Attributes}
27442 and @ref{x86 Type Attributes}.
27443
27444 The Microsoft structure layout algorithm is fairly simple with the exception
27445 of the bit-field packing.
27446 The padding and alignment of members of structures and whether a bit-field
27447 can straddle a storage-unit boundary are determine by these rules:
27448
27449 @enumerate
27450 @item Structure members are stored sequentially in the order in which they are
27451 declared: the first member has the lowest memory address and the last member
27452 the highest.
27453
27454 @item Every data object has an alignment requirement. The alignment requirement
27455 for all data except structures, unions, and arrays is either the size of the
27456 object or the current packing size (specified with either the
27457 @code{aligned} attribute or the @code{pack} pragma),
27458 whichever is less. For structures, unions, and arrays,
27459 the alignment requirement is the largest alignment requirement of its members.
27460 Every object is allocated an offset so that:
27461
27462 @smallexample
27463 offset % alignment_requirement == 0
27464 @end smallexample
27465
27466 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
27467 unit if the integral types are the same size and if the next bit-field fits
27468 into the current allocation unit without crossing the boundary imposed by the
27469 common alignment requirements of the bit-fields.
27470 @end enumerate
27471
27472 MSVC interprets zero-length bit-fields in the following ways:
27473
27474 @enumerate
27475 @item If a zero-length bit-field is inserted between two bit-fields that
27476 are normally coalesced, the bit-fields are not coalesced.
27477
27478 For example:
27479
27480 @smallexample
27481 struct
27482 @{
27483 unsigned long bf_1 : 12;
27484 unsigned long : 0;
27485 unsigned long bf_2 : 12;
27486 @} t1;
27487 @end smallexample
27488
27489 @noindent
27490 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
27491 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
27492
27493 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
27494 alignment of the zero-length bit-field is greater than the member that follows it,
27495 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
27496
27497 For example:
27498
27499 @smallexample
27500 struct
27501 @{
27502 char foo : 4;
27503 short : 0;
27504 char bar;
27505 @} t2;
27506
27507 struct
27508 @{
27509 char foo : 4;
27510 short : 0;
27511 double bar;
27512 @} t3;
27513 @end smallexample
27514
27515 @noindent
27516 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
27517 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
27518 bit-field does not affect the alignment of @code{bar} or, as a result, the size
27519 of the structure.
27520
27521 Taking this into account, it is important to note the following:
27522
27523 @enumerate
27524 @item If a zero-length bit-field follows a normal bit-field, the type of the
27525 zero-length bit-field may affect the alignment of the structure as whole. For
27526 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
27527 normal bit-field, and is of type short.
27528
27529 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
27530 still affect the alignment of the structure:
27531
27532 @smallexample
27533 struct
27534 @{
27535 char foo : 6;
27536 long : 0;
27537 @} t4;
27538 @end smallexample
27539
27540 @noindent
27541 Here, @code{t4} takes up 4 bytes.
27542 @end enumerate
27543
27544 @item Zero-length bit-fields following non-bit-field members are ignored:
27545
27546 @smallexample
27547 struct
27548 @{
27549 char foo;
27550 long : 0;
27551 char bar;
27552 @} t5;
27553 @end smallexample
27554
27555 @noindent
27556 Here, @code{t5} takes up 2 bytes.
27557 @end enumerate
27558
27559
27560 @item -mno-align-stringops
27561 @opindex mno-align-stringops
27562 Do not align the destination of inlined string operations. This switch reduces
27563 code size and improves performance in case the destination is already aligned,
27564 but GCC doesn't know about it.
27565
27566 @item -minline-all-stringops
27567 @opindex minline-all-stringops
27568 By default GCC inlines string operations only when the destination is
27569 known to be aligned to least a 4-byte boundary.
27570 This enables more inlining and increases code
27571 size, but may improve performance of code that depends on fast
27572 @code{memcpy}, @code{strlen},
27573 and @code{memset} for short lengths.
27574
27575 @item -minline-stringops-dynamically
27576 @opindex minline-stringops-dynamically
27577 For string operations of unknown size, use run-time checks with
27578 inline code for small blocks and a library call for large blocks.
27579
27580 @item -mstringop-strategy=@var{alg}
27581 @opindex mstringop-strategy=@var{alg}
27582 Override the internal decision heuristic for the particular algorithm to use
27583 for inlining string operations. The allowed values for @var{alg} are:
27584
27585 @table @samp
27586 @item rep_byte
27587 @itemx rep_4byte
27588 @itemx rep_8byte
27589 Expand using i386 @code{rep} prefix of the specified size.
27590
27591 @item byte_loop
27592 @itemx loop
27593 @itemx unrolled_loop
27594 Expand into an inline loop.
27595
27596 @item libcall
27597 Always use a library call.
27598 @end table
27599
27600 @item -mmemcpy-strategy=@var{strategy}
27601 @opindex mmemcpy-strategy=@var{strategy}
27602 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
27603 should be inlined and what inline algorithm to use when the expected size
27604 of the copy operation is known. @var{strategy}
27605 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
27606 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
27607 the max byte size with which inline algorithm @var{alg} is allowed. For the last
27608 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
27609 in the list must be specified in increasing order. The minimal byte size for
27610 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
27611 preceding range.
27612
27613 @item -mmemset-strategy=@var{strategy}
27614 @opindex mmemset-strategy=@var{strategy}
27615 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
27616 @code{__builtin_memset} expansion.
27617
27618 @item -momit-leaf-frame-pointer
27619 @opindex momit-leaf-frame-pointer
27620 Don't keep the frame pointer in a register for leaf functions. This
27621 avoids the instructions to save, set up, and restore frame pointers and
27622 makes an extra register available in leaf functions. The option
27623 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
27624 which might make debugging harder.
27625
27626 @item -mtls-direct-seg-refs
27627 @itemx -mno-tls-direct-seg-refs
27628 @opindex mtls-direct-seg-refs
27629 Controls whether TLS variables may be accessed with offsets from the
27630 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
27631 or whether the thread base pointer must be added. Whether or not this
27632 is valid depends on the operating system, and whether it maps the
27633 segment to cover the entire TLS area.
27634
27635 For systems that use the GNU C Library, the default is on.
27636
27637 @item -msse2avx
27638 @itemx -mno-sse2avx
27639 @opindex msse2avx
27640 Specify that the assembler should encode SSE instructions with VEX
27641 prefix. The option @option{-mavx} turns this on by default.
27642
27643 @item -mfentry
27644 @itemx -mno-fentry
27645 @opindex mfentry
27646 If profiling is active (@option{-pg}), put the profiling
27647 counter call before the prologue.
27648 Note: On x86 architectures the attribute @code{ms_hook_prologue}
27649 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
27650
27651 @item -mrecord-mcount
27652 @itemx -mno-record-mcount
27653 @opindex mrecord-mcount
27654 If profiling is active (@option{-pg}), generate a __mcount_loc section
27655 that contains pointers to each profiling call. This is useful for
27656 automatically patching and out calls.
27657
27658 @item -mnop-mcount
27659 @itemx -mno-nop-mcount
27660 @opindex mnop-mcount
27661 If profiling is active (@option{-pg}), generate the calls to
27662 the profiling functions as NOPs. This is useful when they
27663 should be patched in later dynamically. This is likely only
27664 useful together with @option{-mrecord-mcount}.
27665
27666 @item -mskip-rax-setup
27667 @itemx -mno-skip-rax-setup
27668 @opindex mskip-rax-setup
27669 When generating code for the x86-64 architecture with SSE extensions
27670 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
27671 register when there are no variable arguments passed in vector registers.
27672
27673 @strong{Warning:} Since RAX register is used to avoid unnecessarily
27674 saving vector registers on stack when passing variable arguments, the
27675 impacts of this option are callees may waste some stack space,
27676 misbehave or jump to a random location. GCC 4.4 or newer don't have
27677 those issues, regardless the RAX register value.
27678
27679 @item -m8bit-idiv
27680 @itemx -mno-8bit-idiv
27681 @opindex m8bit-idiv
27682 On some processors, like Intel Atom, 8-bit unsigned integer divide is
27683 much faster than 32-bit/64-bit integer divide. This option generates a
27684 run-time check. If both dividend and divisor are within range of 0
27685 to 255, 8-bit unsigned integer divide is used instead of
27686 32-bit/64-bit integer divide.
27687
27688 @item -mavx256-split-unaligned-load
27689 @itemx -mavx256-split-unaligned-store
27690 @opindex mavx256-split-unaligned-load
27691 @opindex mavx256-split-unaligned-store
27692 Split 32-byte AVX unaligned load and store.
27693
27694 @item -mstack-protector-guard=@var{guard}
27695 @itemx -mstack-protector-guard-reg=@var{reg}
27696 @itemx -mstack-protector-guard-offset=@var{offset}
27697 @opindex mstack-protector-guard
27698 @opindex mstack-protector-guard-reg
27699 @opindex mstack-protector-guard-offset
27700 Generate stack protection code using canary at @var{guard}. Supported
27701 locations are @samp{global} for global canary or @samp{tls} for per-thread
27702 canary in the TLS block (the default). This option has effect only when
27703 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
27704
27705 With the latter choice the options
27706 @option{-mstack-protector-guard-reg=@var{reg}} and
27707 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
27708 which segment register (@code{%fs} or @code{%gs}) to use as base register
27709 for reading the canary, and from what offset from that base register.
27710 The default for those is as specified in the relevant ABI.
27711
27712 @item -mmitigate-rop
27713 @opindex mmitigate-rop
27714 Try to avoid generating code sequences that contain unintended return
27715 opcodes, to mitigate against certain forms of attack. At the moment,
27716 this option is limited in what it can do and should not be relied
27717 on to provide serious protection.
27718
27719 @item -mgeneral-regs-only
27720 @opindex mgeneral-regs-only
27721 Generate code that uses only the general-purpose registers. This
27722 prevents the compiler from using floating-point, vector, mask and bound
27723 registers.
27724
27725 @item -mindirect-branch=@var{choice}
27726 @opindex -mindirect-branch
27727 Convert indirect call and jump with @var{choice}. The default is
27728 @samp{keep}, which keeps indirect call and jump unmodified.
27729 @samp{thunk} converts indirect call and jump to call and return thunk.
27730 @samp{thunk-inline} converts indirect call and jump to inlined call
27731 and return thunk. @samp{thunk-extern} converts indirect call and jump
27732 to external call and return thunk provided in a separate object file.
27733 You can control this behavior for a specific function by using the
27734 function attribute @code{indirect_branch}. @xref{Function Attributes}.
27735
27736 Note that @option{-mcmodel=large} is incompatible with
27737 @option{-mindirect-branch=thunk} nor
27738 @option{-mindirect-branch=thunk-extern} since the thunk function may
27739 not be reachable in large code model.
27740
27741 @item -mfunction-return=@var{choice}
27742 @opindex -mfunction-return
27743 Convert function return with @var{choice}. The default is @samp{keep},
27744 which keeps function return unmodified. @samp{thunk} converts function
27745 return to call and return thunk. @samp{thunk-inline} converts function
27746 return to inlined call and return thunk. @samp{thunk-extern} converts
27747 function return to external call and return thunk provided in a separate
27748 object file. You can control this behavior for a specific function by
27749 using the function attribute @code{function_return}.
27750 @xref{Function Attributes}.
27751
27752 Note that @option{-mcmodel=large} is incompatible with
27753 @option{-mfunction-return=thunk} nor
27754 @option{-mfunction-return=thunk-extern} since the thunk function may
27755 not be reachable in large code model.
27756
27757
27758 @item -mindirect-branch-register
27759 @opindex -mindirect-branch-register
27760 Force indirect call and jump via register.
27761
27762 @end table
27763
27764 These @samp{-m} switches are supported in addition to the above
27765 on x86-64 processors in 64-bit environments.
27766
27767 @table @gcctabopt
27768 @item -m32
27769 @itemx -m64
27770 @itemx -mx32
27771 @itemx -m16
27772 @itemx -miamcu
27773 @opindex m32
27774 @opindex m64
27775 @opindex mx32
27776 @opindex m16
27777 @opindex miamcu
27778 Generate code for a 16-bit, 32-bit or 64-bit environment.
27779 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
27780 to 32 bits, and
27781 generates code that runs on any i386 system.
27782
27783 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
27784 types to 64 bits, and generates code for the x86-64 architecture.
27785 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
27786 and @option{-mdynamic-no-pic} options.
27787
27788 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
27789 to 32 bits, and
27790 generates code for the x86-64 architecture.
27791
27792 The @option{-m16} option is the same as @option{-m32}, except for that
27793 it outputs the @code{.code16gcc} assembly directive at the beginning of
27794 the assembly output so that the binary can run in 16-bit mode.
27795
27796 The @option{-miamcu} option generates code which conforms to Intel MCU
27797 psABI. It requires the @option{-m32} option to be turned on.
27798
27799 @item -mno-red-zone
27800 @opindex mno-red-zone
27801 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
27802 by the x86-64 ABI; it is a 128-byte area beyond the location of the
27803 stack pointer that is not modified by signal or interrupt handlers
27804 and therefore can be used for temporary data without adjusting the stack
27805 pointer. The flag @option{-mno-red-zone} disables this red zone.
27806
27807 @item -mcmodel=small
27808 @opindex mcmodel=small
27809 Generate code for the small code model: the program and its symbols must
27810 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
27811 Programs can be statically or dynamically linked. This is the default
27812 code model.
27813
27814 @item -mcmodel=kernel
27815 @opindex mcmodel=kernel
27816 Generate code for the kernel code model. The kernel runs in the
27817 negative 2 GB of the address space.
27818 This model has to be used for Linux kernel code.
27819
27820 @item -mcmodel=medium
27821 @opindex mcmodel=medium
27822 Generate code for the medium model: the program is linked in the lower 2
27823 GB of the address space. Small symbols are also placed there. Symbols
27824 with sizes larger than @option{-mlarge-data-threshold} are put into
27825 large data or BSS sections and can be located above 2GB. Programs can
27826 be statically or dynamically linked.
27827
27828 @item -mcmodel=large
27829 @opindex mcmodel=large
27830 Generate code for the large model. This model makes no assumptions
27831 about addresses and sizes of sections.
27832
27833 @item -maddress-mode=long
27834 @opindex maddress-mode=long
27835 Generate code for long address mode. This is only supported for 64-bit
27836 and x32 environments. It is the default address mode for 64-bit
27837 environments.
27838
27839 @item -maddress-mode=short
27840 @opindex maddress-mode=short
27841 Generate code for short address mode. This is only supported for 32-bit
27842 and x32 environments. It is the default address mode for 32-bit and
27843 x32 environments.
27844 @end table
27845
27846 @node x86 Windows Options
27847 @subsection x86 Windows Options
27848 @cindex x86 Windows Options
27849 @cindex Windows Options for x86
27850
27851 These additional options are available for Microsoft Windows targets:
27852
27853 @table @gcctabopt
27854 @item -mconsole
27855 @opindex mconsole
27856 This option
27857 specifies that a console application is to be generated, by
27858 instructing the linker to set the PE header subsystem type
27859 required for console applications.
27860 This option is available for Cygwin and MinGW targets and is
27861 enabled by default on those targets.
27862
27863 @item -mdll
27864 @opindex mdll
27865 This option is available for Cygwin and MinGW targets. It
27866 specifies that a DLL---a dynamic link library---is to be
27867 generated, enabling the selection of the required runtime
27868 startup object and entry point.
27869
27870 @item -mnop-fun-dllimport
27871 @opindex mnop-fun-dllimport
27872 This option is available for Cygwin and MinGW targets. It
27873 specifies that the @code{dllimport} attribute should be ignored.
27874
27875 @item -mthread
27876 @opindex mthread
27877 This option is available for MinGW targets. It specifies
27878 that MinGW-specific thread support is to be used.
27879
27880 @item -municode
27881 @opindex municode
27882 This option is available for MinGW-w64 targets. It causes
27883 the @code{UNICODE} preprocessor macro to be predefined, and
27884 chooses Unicode-capable runtime startup code.
27885
27886 @item -mwin32
27887 @opindex mwin32
27888 This option is available for Cygwin and MinGW targets. It
27889 specifies that the typical Microsoft Windows predefined macros are to
27890 be set in the pre-processor, but does not influence the choice
27891 of runtime library/startup code.
27892
27893 @item -mwindows
27894 @opindex mwindows
27895 This option is available for Cygwin and MinGW targets. It
27896 specifies that a GUI application is to be generated by
27897 instructing the linker to set the PE header subsystem type
27898 appropriately.
27899
27900 @item -fno-set-stack-executable
27901 @opindex fno-set-stack-executable
27902 This option is available for MinGW targets. It specifies that
27903 the executable flag for the stack used by nested functions isn't
27904 set. This is necessary for binaries running in kernel mode of
27905 Microsoft Windows, as there the User32 API, which is used to set executable
27906 privileges, isn't available.
27907
27908 @item -fwritable-relocated-rdata
27909 @opindex fno-writable-relocated-rdata
27910 This option is available for MinGW and Cygwin targets. It specifies
27911 that relocated-data in read-only section is put into the @code{.data}
27912 section. This is a necessary for older runtimes not supporting
27913 modification of @code{.rdata} sections for pseudo-relocation.
27914
27915 @item -mpe-aligned-commons
27916 @opindex mpe-aligned-commons
27917 This option is available for Cygwin and MinGW targets. It
27918 specifies that the GNU extension to the PE file format that
27919 permits the correct alignment of COMMON variables should be
27920 used when generating code. It is enabled by default if
27921 GCC detects that the target assembler found during configuration
27922 supports the feature.
27923 @end table
27924
27925 See also under @ref{x86 Options} for standard options.
27926
27927 @node Xstormy16 Options
27928 @subsection Xstormy16 Options
27929 @cindex Xstormy16 Options
27930
27931 These options are defined for Xstormy16:
27932
27933 @table @gcctabopt
27934 @item -msim
27935 @opindex msim
27936 Choose startup files and linker script suitable for the simulator.
27937 @end table
27938
27939 @node Xtensa Options
27940 @subsection Xtensa Options
27941 @cindex Xtensa Options
27942
27943 These options are supported for Xtensa targets:
27944
27945 @table @gcctabopt
27946 @item -mconst16
27947 @itemx -mno-const16
27948 @opindex mconst16
27949 @opindex mno-const16
27950 Enable or disable use of @code{CONST16} instructions for loading
27951 constant values. The @code{CONST16} instruction is currently not a
27952 standard option from Tensilica. When enabled, @code{CONST16}
27953 instructions are always used in place of the standard @code{L32R}
27954 instructions. The use of @code{CONST16} is enabled by default only if
27955 the @code{L32R} instruction is not available.
27956
27957 @item -mfused-madd
27958 @itemx -mno-fused-madd
27959 @opindex mfused-madd
27960 @opindex mno-fused-madd
27961 Enable or disable use of fused multiply/add and multiply/subtract
27962 instructions in the floating-point option. This has no effect if the
27963 floating-point option is not also enabled. Disabling fused multiply/add
27964 and multiply/subtract instructions forces the compiler to use separate
27965 instructions for the multiply and add/subtract operations. This may be
27966 desirable in some cases where strict IEEE 754-compliant results are
27967 required: the fused multiply add/subtract instructions do not round the
27968 intermediate result, thereby producing results with @emph{more} bits of
27969 precision than specified by the IEEE standard. Disabling fused multiply
27970 add/subtract instructions also ensures that the program output is not
27971 sensitive to the compiler's ability to combine multiply and add/subtract
27972 operations.
27973
27974 @item -mserialize-volatile
27975 @itemx -mno-serialize-volatile
27976 @opindex mserialize-volatile
27977 @opindex mno-serialize-volatile
27978 When this option is enabled, GCC inserts @code{MEMW} instructions before
27979 @code{volatile} memory references to guarantee sequential consistency.
27980 The default is @option{-mserialize-volatile}. Use
27981 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
27982
27983 @item -mforce-no-pic
27984 @opindex mforce-no-pic
27985 For targets, like GNU/Linux, where all user-mode Xtensa code must be
27986 position-independent code (PIC), this option disables PIC for compiling
27987 kernel code.
27988
27989 @item -mtext-section-literals
27990 @itemx -mno-text-section-literals
27991 @opindex mtext-section-literals
27992 @opindex mno-text-section-literals
27993 These options control the treatment of literal pools. The default is
27994 @option{-mno-text-section-literals}, which places literals in a separate
27995 section in the output file. This allows the literal pool to be placed
27996 in a data RAM/ROM, and it also allows the linker to combine literal
27997 pools from separate object files to remove redundant literals and
27998 improve code size. With @option{-mtext-section-literals}, the literals
27999 are interspersed in the text section in order to keep them as close as
28000 possible to their references. This may be necessary for large assembly
28001 files. Literals for each function are placed right before that function.
28002
28003 @item -mauto-litpools
28004 @itemx -mno-auto-litpools
28005 @opindex mauto-litpools
28006 @opindex mno-auto-litpools
28007 These options control the treatment of literal pools. The default is
28008 @option{-mno-auto-litpools}, which places literals in a separate
28009 section in the output file unless @option{-mtext-section-literals} is
28010 used. With @option{-mauto-litpools} the literals are interspersed in
28011 the text section by the assembler. Compiler does not produce explicit
28012 @code{.literal} directives and loads literals into registers with
28013 @code{MOVI} instructions instead of @code{L32R} to let the assembler
28014 do relaxation and place literals as necessary. This option allows
28015 assembler to create several literal pools per function and assemble
28016 very big functions, which may not be possible with
28017 @option{-mtext-section-literals}.
28018
28019 @item -mtarget-align
28020 @itemx -mno-target-align
28021 @opindex mtarget-align
28022 @opindex mno-target-align
28023 When this option is enabled, GCC instructs the assembler to
28024 automatically align instructions to reduce branch penalties at the
28025 expense of some code density. The assembler attempts to widen density
28026 instructions to align branch targets and the instructions following call
28027 instructions. If there are not enough preceding safe density
28028 instructions to align a target, no widening is performed. The
28029 default is @option{-mtarget-align}. These options do not affect the
28030 treatment of auto-aligned instructions like @code{LOOP}, which the
28031 assembler always aligns, either by widening density instructions or
28032 by inserting NOP instructions.
28033
28034 @item -mlongcalls
28035 @itemx -mno-longcalls
28036 @opindex mlongcalls
28037 @opindex mno-longcalls
28038 When this option is enabled, GCC instructs the assembler to translate
28039 direct calls to indirect calls unless it can determine that the target
28040 of a direct call is in the range allowed by the call instruction. This
28041 translation typically occurs for calls to functions in other source
28042 files. Specifically, the assembler translates a direct @code{CALL}
28043 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
28044 The default is @option{-mno-longcalls}. This option should be used in
28045 programs where the call target can potentially be out of range. This
28046 option is implemented in the assembler, not the compiler, so the
28047 assembly code generated by GCC still shows direct call
28048 instructions---look at the disassembled object code to see the actual
28049 instructions. Note that the assembler uses an indirect call for
28050 every cross-file call, not just those that really are out of range.
28051 @end table
28052
28053 @node zSeries Options
28054 @subsection zSeries Options
28055 @cindex zSeries options
28056
28057 These are listed under @xref{S/390 and zSeries Options}.
28058
28059
28060 @c man end
28061
28062 @node Spec Files
28063 @section Specifying Subprocesses and the Switches to Pass to Them
28064 @cindex Spec Files
28065
28066 @command{gcc} is a driver program. It performs its job by invoking a
28067 sequence of other programs to do the work of compiling, assembling and
28068 linking. GCC interprets its command-line parameters and uses these to
28069 deduce which programs it should invoke, and which command-line options
28070 it ought to place on their command lines. This behavior is controlled
28071 by @dfn{spec strings}. In most cases there is one spec string for each
28072 program that GCC can invoke, but a few programs have multiple spec
28073 strings to control their behavior. The spec strings built into GCC can
28074 be overridden by using the @option{-specs=} command-line switch to specify
28075 a spec file.
28076
28077 @dfn{Spec files} are plain-text files that are used to construct spec
28078 strings. They consist of a sequence of directives separated by blank
28079 lines. The type of directive is determined by the first non-whitespace
28080 character on the line, which can be one of the following:
28081
28082 @table @code
28083 @item %@var{command}
28084 Issues a @var{command} to the spec file processor. The commands that can
28085 appear here are:
28086
28087 @table @code
28088 @item %include <@var{file}>
28089 @cindex @code{%include}
28090 Search for @var{file} and insert its text at the current point in the
28091 specs file.
28092
28093 @item %include_noerr <@var{file}>
28094 @cindex @code{%include_noerr}
28095 Just like @samp{%include}, but do not generate an error message if the include
28096 file cannot be found.
28097
28098 @item %rename @var{old_name} @var{new_name}
28099 @cindex @code{%rename}
28100 Rename the spec string @var{old_name} to @var{new_name}.
28101
28102 @end table
28103
28104 @item *[@var{spec_name}]:
28105 This tells the compiler to create, override or delete the named spec
28106 string. All lines after this directive up to the next directive or
28107 blank line are considered to be the text for the spec string. If this
28108 results in an empty string then the spec is deleted. (Or, if the
28109 spec did not exist, then nothing happens.) Otherwise, if the spec
28110 does not currently exist a new spec is created. If the spec does
28111 exist then its contents are overridden by the text of this
28112 directive, unless the first character of that text is the @samp{+}
28113 character, in which case the text is appended to the spec.
28114
28115 @item [@var{suffix}]:
28116 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
28117 and up to the next directive or blank line are considered to make up the
28118 spec string for the indicated suffix. When the compiler encounters an
28119 input file with the named suffix, it processes the spec string in
28120 order to work out how to compile that file. For example:
28121
28122 @smallexample
28123 .ZZ:
28124 z-compile -input %i
28125 @end smallexample
28126
28127 This says that any input file whose name ends in @samp{.ZZ} should be
28128 passed to the program @samp{z-compile}, which should be invoked with the
28129 command-line switch @option{-input} and with the result of performing the
28130 @samp{%i} substitution. (See below.)
28131
28132 As an alternative to providing a spec string, the text following a
28133 suffix directive can be one of the following:
28134
28135 @table @code
28136 @item @@@var{language}
28137 This says that the suffix is an alias for a known @var{language}. This is
28138 similar to using the @option{-x} command-line switch to GCC to specify a
28139 language explicitly. For example:
28140
28141 @smallexample
28142 .ZZ:
28143 @@c++
28144 @end smallexample
28145
28146 Says that .ZZ files are, in fact, C++ source files.
28147
28148 @item #@var{name}
28149 This causes an error messages saying:
28150
28151 @smallexample
28152 @var{name} compiler not installed on this system.
28153 @end smallexample
28154 @end table
28155
28156 GCC already has an extensive list of suffixes built into it.
28157 This directive adds an entry to the end of the list of suffixes, but
28158 since the list is searched from the end backwards, it is effectively
28159 possible to override earlier entries using this technique.
28160
28161 @end table
28162
28163 GCC has the following spec strings built into it. Spec files can
28164 override these strings or create their own. Note that individual
28165 targets can also add their own spec strings to this list.
28166
28167 @smallexample
28168 asm Options to pass to the assembler
28169 asm_final Options to pass to the assembler post-processor
28170 cpp Options to pass to the C preprocessor
28171 cc1 Options to pass to the C compiler
28172 cc1plus Options to pass to the C++ compiler
28173 endfile Object files to include at the end of the link
28174 link Options to pass to the linker
28175 lib Libraries to include on the command line to the linker
28176 libgcc Decides which GCC support library to pass to the linker
28177 linker Sets the name of the linker
28178 predefines Defines to be passed to the C preprocessor
28179 signed_char Defines to pass to CPP to say whether @code{char} is signed
28180 by default
28181 startfile Object files to include at the start of the link
28182 @end smallexample
28183
28184 Here is a small example of a spec file:
28185
28186 @smallexample
28187 %rename lib old_lib
28188
28189 *lib:
28190 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
28191 @end smallexample
28192
28193 This example renames the spec called @samp{lib} to @samp{old_lib} and
28194 then overrides the previous definition of @samp{lib} with a new one.
28195 The new definition adds in some extra command-line options before
28196 including the text of the old definition.
28197
28198 @dfn{Spec strings} are a list of command-line options to be passed to their
28199 corresponding program. In addition, the spec strings can contain
28200 @samp{%}-prefixed sequences to substitute variable text or to
28201 conditionally insert text into the command line. Using these constructs
28202 it is possible to generate quite complex command lines.
28203
28204 Here is a table of all defined @samp{%}-sequences for spec
28205 strings. Note that spaces are not generated automatically around the
28206 results of expanding these sequences. Therefore you can concatenate them
28207 together or combine them with constant text in a single argument.
28208
28209 @table @code
28210 @item %%
28211 Substitute one @samp{%} into the program name or argument.
28212
28213 @item %i
28214 Substitute the name of the input file being processed.
28215
28216 @item %b
28217 Substitute the basename of the input file being processed.
28218 This is the substring up to (and not including) the last period
28219 and not including the directory.
28220
28221 @item %B
28222 This is the same as @samp{%b}, but include the file suffix (text after
28223 the last period).
28224
28225 @item %d
28226 Marks the argument containing or following the @samp{%d} as a
28227 temporary file name, so that that file is deleted if GCC exits
28228 successfully. Unlike @samp{%g}, this contributes no text to the
28229 argument.
28230
28231 @item %g@var{suffix}
28232 Substitute a file name that has suffix @var{suffix} and is chosen
28233 once per compilation, and mark the argument in the same way as
28234 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
28235 name is now chosen in a way that is hard to predict even when previously
28236 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
28237 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
28238 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
28239 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
28240 was simply substituted with a file name chosen once per compilation,
28241 without regard to any appended suffix (which was therefore treated
28242 just like ordinary text), making such attacks more likely to succeed.
28243
28244 @item %u@var{suffix}
28245 Like @samp{%g}, but generates a new temporary file name
28246 each time it appears instead of once per compilation.
28247
28248 @item %U@var{suffix}
28249 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
28250 new one if there is no such last file name. In the absence of any
28251 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
28252 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
28253 involves the generation of two distinct file names, one
28254 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
28255 simply substituted with a file name chosen for the previous @samp{%u},
28256 without regard to any appended suffix.
28257
28258 @item %j@var{suffix}
28259 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
28260 writable, and if @option{-save-temps} is not used;
28261 otherwise, substitute the name
28262 of a temporary file, just like @samp{%u}. This temporary file is not
28263 meant for communication between processes, but rather as a junk
28264 disposal mechanism.
28265
28266 @item %|@var{suffix}
28267 @itemx %m@var{suffix}
28268 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
28269 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
28270 all. These are the two most common ways to instruct a program that it
28271 should read from standard input or write to standard output. If you
28272 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
28273 construct: see for example @file{f/lang-specs.h}.
28274
28275 @item %.@var{SUFFIX}
28276 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
28277 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
28278 terminated by the next space or %.
28279
28280 @item %w
28281 Marks the argument containing or following the @samp{%w} as the
28282 designated output file of this compilation. This puts the argument
28283 into the sequence of arguments that @samp{%o} substitutes.
28284
28285 @item %o
28286 Substitutes the names of all the output files, with spaces
28287 automatically placed around them. You should write spaces
28288 around the @samp{%o} as well or the results are undefined.
28289 @samp{%o} is for use in the specs for running the linker.
28290 Input files whose names have no recognized suffix are not compiled
28291 at all, but they are included among the output files, so they are
28292 linked.
28293
28294 @item %O
28295 Substitutes the suffix for object files. Note that this is
28296 handled specially when it immediately follows @samp{%g, %u, or %U},
28297 because of the need for those to form complete file names. The
28298 handling is such that @samp{%O} is treated exactly as if it had already
28299 been substituted, except that @samp{%g, %u, and %U} do not currently
28300 support additional @var{suffix} characters following @samp{%O} as they do
28301 following, for example, @samp{.o}.
28302
28303 @item %p
28304 Substitutes the standard macro predefinitions for the
28305 current target machine. Use this when running @command{cpp}.
28306
28307 @item %P
28308 Like @samp{%p}, but puts @samp{__} before and after the name of each
28309 predefined macro, except for macros that start with @samp{__} or with
28310 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
28311 C@.
28312
28313 @item %I
28314 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
28315 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
28316 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
28317 and @option{-imultilib} as necessary.
28318
28319 @item %s
28320 Current argument is the name of a library or startup file of some sort.
28321 Search for that file in a standard list of directories and substitute
28322 the full name found. The current working directory is included in the
28323 list of directories scanned.
28324
28325 @item %T
28326 Current argument is the name of a linker script. Search for that file
28327 in the current list of directories to scan for libraries. If the file
28328 is located insert a @option{--script} option into the command line
28329 followed by the full path name found. If the file is not found then
28330 generate an error message. Note: the current working directory is not
28331 searched.
28332
28333 @item %e@var{str}
28334 Print @var{str} as an error message. @var{str} is terminated by a newline.
28335 Use this when inconsistent options are detected.
28336
28337 @item %(@var{name})
28338 Substitute the contents of spec string @var{name} at this point.
28339
28340 @item %x@{@var{option}@}
28341 Accumulate an option for @samp{%X}.
28342
28343 @item %X
28344 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
28345 spec string.
28346
28347 @item %Y
28348 Output the accumulated assembler options specified by @option{-Wa}.
28349
28350 @item %Z
28351 Output the accumulated preprocessor options specified by @option{-Wp}.
28352
28353 @item %a
28354 Process the @code{asm} spec. This is used to compute the
28355 switches to be passed to the assembler.
28356
28357 @item %A
28358 Process the @code{asm_final} spec. This is a spec string for
28359 passing switches to an assembler post-processor, if such a program is
28360 needed.
28361
28362 @item %l
28363 Process the @code{link} spec. This is the spec for computing the
28364 command line passed to the linker. Typically it makes use of the
28365 @samp{%L %G %S %D and %E} sequences.
28366
28367 @item %D
28368 Dump out a @option{-L} option for each directory that GCC believes might
28369 contain startup files. If the target supports multilibs then the
28370 current multilib directory is prepended to each of these paths.
28371
28372 @item %L
28373 Process the @code{lib} spec. This is a spec string for deciding which
28374 libraries are included on the command line to the linker.
28375
28376 @item %G
28377 Process the @code{libgcc} spec. This is a spec string for deciding
28378 which GCC support library is included on the command line to the linker.
28379
28380 @item %S
28381 Process the @code{startfile} spec. This is a spec for deciding which
28382 object files are the first ones passed to the linker. Typically
28383 this might be a file named @file{crt0.o}.
28384
28385 @item %E
28386 Process the @code{endfile} spec. This is a spec string that specifies
28387 the last object files that are passed to the linker.
28388
28389 @item %C
28390 Process the @code{cpp} spec. This is used to construct the arguments
28391 to be passed to the C preprocessor.
28392
28393 @item %1
28394 Process the @code{cc1} spec. This is used to construct the options to be
28395 passed to the actual C compiler (@command{cc1}).
28396
28397 @item %2
28398 Process the @code{cc1plus} spec. This is used to construct the options to be
28399 passed to the actual C++ compiler (@command{cc1plus}).
28400
28401 @item %*
28402 Substitute the variable part of a matched option. See below.
28403 Note that each comma in the substituted string is replaced by
28404 a single space.
28405
28406 @item %<S
28407 Remove all occurrences of @code{-S} from the command line. Note---this
28408 command is position dependent. @samp{%} commands in the spec string
28409 before this one see @code{-S}, @samp{%} commands in the spec string
28410 after this one do not.
28411
28412 @item %:@var{function}(@var{args})
28413 Call the named function @var{function}, passing it @var{args}.
28414 @var{args} is first processed as a nested spec string, then split
28415 into an argument vector in the usual fashion. The function returns
28416 a string which is processed as if it had appeared literally as part
28417 of the current spec.
28418
28419 The following built-in spec functions are provided:
28420
28421 @table @code
28422 @item @code{getenv}
28423 The @code{getenv} spec function takes two arguments: an environment
28424 variable name and a string. If the environment variable is not
28425 defined, a fatal error is issued. Otherwise, the return value is the
28426 value of the environment variable concatenated with the string. For
28427 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
28428
28429 @smallexample
28430 %:getenv(TOPDIR /include)
28431 @end smallexample
28432
28433 expands to @file{/path/to/top/include}.
28434
28435 @item @code{if-exists}
28436 The @code{if-exists} spec function takes one argument, an absolute
28437 pathname to a file. If the file exists, @code{if-exists} returns the
28438 pathname. Here is a small example of its usage:
28439
28440 @smallexample
28441 *startfile:
28442 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
28443 @end smallexample
28444
28445 @item @code{if-exists-else}
28446 The @code{if-exists-else} spec function is similar to the @code{if-exists}
28447 spec function, except that it takes two arguments. The first argument is
28448 an absolute pathname to a file. If the file exists, @code{if-exists-else}
28449 returns the pathname. If it does not exist, it returns the second argument.
28450 This way, @code{if-exists-else} can be used to select one file or another,
28451 based on the existence of the first. Here is a small example of its usage:
28452
28453 @smallexample
28454 *startfile:
28455 crt0%O%s %:if-exists(crti%O%s) \
28456 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
28457 @end smallexample
28458
28459 @item @code{replace-outfile}
28460 The @code{replace-outfile} spec function takes two arguments. It looks for the
28461 first argument in the outfiles array and replaces it with the second argument. Here
28462 is a small example of its usage:
28463
28464 @smallexample
28465 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
28466 @end smallexample
28467
28468 @item @code{remove-outfile}
28469 The @code{remove-outfile} spec function takes one argument. It looks for the
28470 first argument in the outfiles array and removes it. Here is a small example
28471 its usage:
28472
28473 @smallexample
28474 %:remove-outfile(-lm)
28475 @end smallexample
28476
28477 @item @code{pass-through-libs}
28478 The @code{pass-through-libs} spec function takes any number of arguments. It
28479 finds any @option{-l} options and any non-options ending in @file{.a} (which it
28480 assumes are the names of linker input library archive files) and returns a
28481 result containing all the found arguments each prepended by
28482 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
28483 intended to be passed to the LTO linker plugin.
28484
28485 @smallexample
28486 %:pass-through-libs(%G %L %G)
28487 @end smallexample
28488
28489 @item @code{print-asm-header}
28490 The @code{print-asm-header} function takes no arguments and simply
28491 prints a banner like:
28492
28493 @smallexample
28494 Assembler options
28495 =================
28496
28497 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
28498 @end smallexample
28499
28500 It is used to separate compiler options from assembler options
28501 in the @option{--target-help} output.
28502 @end table
28503
28504 @item %@{S@}
28505 Substitutes the @code{-S} switch, if that switch is given to GCC@.
28506 If that switch is not specified, this substitutes nothing. Note that
28507 the leading dash is omitted when specifying this option, and it is
28508 automatically inserted if the substitution is performed. Thus the spec
28509 string @samp{%@{foo@}} matches the command-line option @option{-foo}
28510 and outputs the command-line option @option{-foo}.
28511
28512 @item %W@{S@}
28513 Like %@{@code{S}@} but mark last argument supplied within as a file to be
28514 deleted on failure.
28515
28516 @item %@{S*@}
28517 Substitutes all the switches specified to GCC whose names start
28518 with @code{-S}, but which also take an argument. This is used for
28519 switches like @option{-o}, @option{-D}, @option{-I}, etc.
28520 GCC considers @option{-o foo} as being
28521 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
28522 text, including the space. Thus two arguments are generated.
28523
28524 @item %@{S*&T*@}
28525 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
28526 (the order of @code{S} and @code{T} in the spec is not significant).
28527 There can be any number of ampersand-separated variables; for each the
28528 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
28529
28530 @item %@{S:X@}
28531 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
28532
28533 @item %@{!S:X@}
28534 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
28535
28536 @item %@{S*:X@}
28537 Substitutes @code{X} if one or more switches whose names start with
28538 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
28539 once, no matter how many such switches appeared. However, if @code{%*}
28540 appears somewhere in @code{X}, then @code{X} is substituted once
28541 for each matching switch, with the @code{%*} replaced by the part of
28542 that switch matching the @code{*}.
28543
28544 If @code{%*} appears as the last part of a spec sequence then a space
28545 is added after the end of the last substitution. If there is more
28546 text in the sequence, however, then a space is not generated. This
28547 allows the @code{%*} substitution to be used as part of a larger
28548 string. For example, a spec string like this:
28549
28550 @smallexample
28551 %@{mcu=*:--script=%*/memory.ld@}
28552 @end smallexample
28553
28554 @noindent
28555 when matching an option like @option{-mcu=newchip} produces:
28556
28557 @smallexample
28558 --script=newchip/memory.ld
28559 @end smallexample
28560
28561 @item %@{.S:X@}
28562 Substitutes @code{X}, if processing a file with suffix @code{S}.
28563
28564 @item %@{!.S:X@}
28565 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
28566
28567 @item %@{,S:X@}
28568 Substitutes @code{X}, if processing a file for language @code{S}.
28569
28570 @item %@{!,S:X@}
28571 Substitutes @code{X}, if not processing a file for language @code{S}.
28572
28573 @item %@{S|P:X@}
28574 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
28575 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
28576 @code{*} sequences as well, although they have a stronger binding than
28577 the @samp{|}. If @code{%*} appears in @code{X}, all of the
28578 alternatives must be starred, and only the first matching alternative
28579 is substituted.
28580
28581 For example, a spec string like this:
28582
28583 @smallexample
28584 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
28585 @end smallexample
28586
28587 @noindent
28588 outputs the following command-line options from the following input
28589 command-line options:
28590
28591 @smallexample
28592 fred.c -foo -baz
28593 jim.d -bar -boggle
28594 -d fred.c -foo -baz -boggle
28595 -d jim.d -bar -baz -boggle
28596 @end smallexample
28597
28598 @item %@{S:X; T:Y; :D@}
28599
28600 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
28601 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
28602 be as many clauses as you need. This may be combined with @code{.},
28603 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
28604
28605
28606 @end table
28607
28608 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
28609 or similar construct can use a backslash to ignore the special meaning
28610 of the character following it, thus allowing literal matching of a
28611 character that is otherwise specially treated. For example,
28612 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
28613 @option{-std=iso9899:1999} option is given.
28614
28615 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
28616 construct may contain other nested @samp{%} constructs or spaces, or
28617 even newlines. They are processed as usual, as described above.
28618 Trailing white space in @code{X} is ignored. White space may also
28619 appear anywhere on the left side of the colon in these constructs,
28620 except between @code{.} or @code{*} and the corresponding word.
28621
28622 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
28623 handled specifically in these constructs. If another value of
28624 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
28625 @option{-W} switch is found later in the command line, the earlier
28626 switch value is ignored, except with @{@code{S}*@} where @code{S} is
28627 just one letter, which passes all matching options.
28628
28629 The character @samp{|} at the beginning of the predicate text is used to
28630 indicate that a command should be piped to the following command, but
28631 only if @option{-pipe} is specified.
28632
28633 It is built into GCC which switches take arguments and which do not.
28634 (You might think it would be useful to generalize this to allow each
28635 compiler's spec to say which switches take arguments. But this cannot
28636 be done in a consistent fashion. GCC cannot even decide which input
28637 files have been specified without knowing which switches take arguments,
28638 and it must know which input files to compile in order to tell which
28639 compilers to run).
28640
28641 GCC also knows implicitly that arguments starting in @option{-l} are to be
28642 treated as compiler output files, and passed to the linker in their
28643 proper position among the other output files.
28644
28645 @node Environment Variables
28646 @section Environment Variables Affecting GCC
28647 @cindex environment variables
28648
28649 @c man begin ENVIRONMENT
28650 This section describes several environment variables that affect how GCC
28651 operates. Some of them work by specifying directories or prefixes to use
28652 when searching for various kinds of files. Some are used to specify other
28653 aspects of the compilation environment.
28654
28655 Note that you can also specify places to search using options such as
28656 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
28657 take precedence over places specified using environment variables, which
28658 in turn take precedence over those specified by the configuration of GCC@.
28659 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
28660 GNU Compiler Collection (GCC) Internals}.
28661
28662 @table @env
28663 @item LANG
28664 @itemx LC_CTYPE
28665 @c @itemx LC_COLLATE
28666 @itemx LC_MESSAGES
28667 @c @itemx LC_MONETARY
28668 @c @itemx LC_NUMERIC
28669 @c @itemx LC_TIME
28670 @itemx LC_ALL
28671 @findex LANG
28672 @findex LC_CTYPE
28673 @c @findex LC_COLLATE
28674 @findex LC_MESSAGES
28675 @c @findex LC_MONETARY
28676 @c @findex LC_NUMERIC
28677 @c @findex LC_TIME
28678 @findex LC_ALL
28679 @cindex locale
28680 These environment variables control the way that GCC uses
28681 localization information which allows GCC to work with different
28682 national conventions. GCC inspects the locale categories
28683 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
28684 so. These locale categories can be set to any value supported by your
28685 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
28686 Kingdom encoded in UTF-8.
28687
28688 The @env{LC_CTYPE} environment variable specifies character
28689 classification. GCC uses it to determine the character boundaries in
28690 a string; this is needed for some multibyte encodings that contain quote
28691 and escape characters that are otherwise interpreted as a string
28692 end or escape.
28693
28694 The @env{LC_MESSAGES} environment variable specifies the language to
28695 use in diagnostic messages.
28696
28697 If the @env{LC_ALL} environment variable is set, it overrides the value
28698 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
28699 and @env{LC_MESSAGES} default to the value of the @env{LANG}
28700 environment variable. If none of these variables are set, GCC
28701 defaults to traditional C English behavior.
28702
28703 @item TMPDIR
28704 @findex TMPDIR
28705 If @env{TMPDIR} is set, it specifies the directory to use for temporary
28706 files. GCC uses temporary files to hold the output of one stage of
28707 compilation which is to be used as input to the next stage: for example,
28708 the output of the preprocessor, which is the input to the compiler
28709 proper.
28710
28711 @item GCC_COMPARE_DEBUG
28712 @findex GCC_COMPARE_DEBUG
28713 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
28714 @option{-fcompare-debug} to the compiler driver. See the documentation
28715 of this option for more details.
28716
28717 @item GCC_EXEC_PREFIX
28718 @findex GCC_EXEC_PREFIX
28719 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
28720 names of the subprograms executed by the compiler. No slash is added
28721 when this prefix is combined with the name of a subprogram, but you can
28722 specify a prefix that ends with a slash if you wish.
28723
28724 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
28725 an appropriate prefix to use based on the pathname it is invoked with.
28726
28727 If GCC cannot find the subprogram using the specified prefix, it
28728 tries looking in the usual places for the subprogram.
28729
28730 The default value of @env{GCC_EXEC_PREFIX} is
28731 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
28732 the installed compiler. In many cases @var{prefix} is the value
28733 of @code{prefix} when you ran the @file{configure} script.
28734
28735 Other prefixes specified with @option{-B} take precedence over this prefix.
28736
28737 This prefix is also used for finding files such as @file{crt0.o} that are
28738 used for linking.
28739
28740 In addition, the prefix is used in an unusual way in finding the
28741 directories to search for header files. For each of the standard
28742 directories whose name normally begins with @samp{/usr/local/lib/gcc}
28743 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
28744 replacing that beginning with the specified prefix to produce an
28745 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
28746 @file{foo/bar} just before it searches the standard directory
28747 @file{/usr/local/lib/bar}.
28748 If a standard directory begins with the configured
28749 @var{prefix} then the value of @var{prefix} is replaced by
28750 @env{GCC_EXEC_PREFIX} when looking for header files.
28751
28752 @item COMPILER_PATH
28753 @findex COMPILER_PATH
28754 The value of @env{COMPILER_PATH} is a colon-separated list of
28755 directories, much like @env{PATH}. GCC tries the directories thus
28756 specified when searching for subprograms, if it cannot find the
28757 subprograms using @env{GCC_EXEC_PREFIX}.
28758
28759 @item LIBRARY_PATH
28760 @findex LIBRARY_PATH
28761 The value of @env{LIBRARY_PATH} is a colon-separated list of
28762 directories, much like @env{PATH}. When configured as a native compiler,
28763 GCC tries the directories thus specified when searching for special
28764 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
28765 using GCC also uses these directories when searching for ordinary
28766 libraries for the @option{-l} option (but directories specified with
28767 @option{-L} come first).
28768
28769 @item LANG
28770 @findex LANG
28771 @cindex locale definition
28772 This variable is used to pass locale information to the compiler. One way in
28773 which this information is used is to determine the character set to be used
28774 when character literals, string literals and comments are parsed in C and C++.
28775 When the compiler is configured to allow multibyte characters,
28776 the following values for @env{LANG} are recognized:
28777
28778 @table @samp
28779 @item C-JIS
28780 Recognize JIS characters.
28781 @item C-SJIS
28782 Recognize SJIS characters.
28783 @item C-EUCJP
28784 Recognize EUCJP characters.
28785 @end table
28786
28787 If @env{LANG} is not defined, or if it has some other value, then the
28788 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
28789 recognize and translate multibyte characters.
28790 @end table
28791
28792 @noindent
28793 Some additional environment variables affect the behavior of the
28794 preprocessor.
28795
28796 @include cppenv.texi
28797
28798 @c man end
28799
28800 @node Precompiled Headers
28801 @section Using Precompiled Headers
28802 @cindex precompiled headers
28803 @cindex speed of compilation
28804
28805 Often large projects have many header files that are included in every
28806 source file. The time the compiler takes to process these header files
28807 over and over again can account for nearly all of the time required to
28808 build the project. To make builds faster, GCC allows you to
28809 @dfn{precompile} a header file.
28810
28811 To create a precompiled header file, simply compile it as you would any
28812 other file, if necessary using the @option{-x} option to make the driver
28813 treat it as a C or C++ header file. You may want to use a
28814 tool like @command{make} to keep the precompiled header up-to-date when
28815 the headers it contains change.
28816
28817 A precompiled header file is searched for when @code{#include} is
28818 seen in the compilation. As it searches for the included file
28819 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
28820 compiler looks for a precompiled header in each directory just before it
28821 looks for the include file in that directory. The name searched for is
28822 the name specified in the @code{#include} with @samp{.gch} appended. If
28823 the precompiled header file cannot be used, it is ignored.
28824
28825 For instance, if you have @code{#include "all.h"}, and you have
28826 @file{all.h.gch} in the same directory as @file{all.h}, then the
28827 precompiled header file is used if possible, and the original
28828 header is used otherwise.
28829
28830 Alternatively, you might decide to put the precompiled header file in a
28831 directory and use @option{-I} to ensure that directory is searched
28832 before (or instead of) the directory containing the original header.
28833 Then, if you want to check that the precompiled header file is always
28834 used, you can put a file of the same name as the original header in this
28835 directory containing an @code{#error} command.
28836
28837 This also works with @option{-include}. So yet another way to use
28838 precompiled headers, good for projects not designed with precompiled
28839 header files in mind, is to simply take most of the header files used by
28840 a project, include them from another header file, precompile that header
28841 file, and @option{-include} the precompiled header. If the header files
28842 have guards against multiple inclusion, they are skipped because
28843 they've already been included (in the precompiled header).
28844
28845 If you need to precompile the same header file for different
28846 languages, targets, or compiler options, you can instead make a
28847 @emph{directory} named like @file{all.h.gch}, and put each precompiled
28848 header in the directory, perhaps using @option{-o}. It doesn't matter
28849 what you call the files in the directory; every precompiled header in
28850 the directory is considered. The first precompiled header
28851 encountered in the directory that is valid for this compilation is
28852 used; they're searched in no particular order.
28853
28854 There are many other possibilities, limited only by your imagination,
28855 good sense, and the constraints of your build system.
28856
28857 A precompiled header file can be used only when these conditions apply:
28858
28859 @itemize
28860 @item
28861 Only one precompiled header can be used in a particular compilation.
28862
28863 @item
28864 A precompiled header cannot be used once the first C token is seen. You
28865 can have preprocessor directives before a precompiled header; you cannot
28866 include a precompiled header from inside another header.
28867
28868 @item
28869 The precompiled header file must be produced for the same language as
28870 the current compilation. You cannot use a C precompiled header for a C++
28871 compilation.
28872
28873 @item
28874 The precompiled header file must have been produced by the same compiler
28875 binary as the current compilation is using.
28876
28877 @item
28878 Any macros defined before the precompiled header is included must
28879 either be defined in the same way as when the precompiled header was
28880 generated, or must not affect the precompiled header, which usually
28881 means that they don't appear in the precompiled header at all.
28882
28883 The @option{-D} option is one way to define a macro before a
28884 precompiled header is included; using a @code{#define} can also do it.
28885 There are also some options that define macros implicitly, like
28886 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
28887 defined this way.
28888
28889 @item If debugging information is output when using the precompiled
28890 header, using @option{-g} or similar, the same kind of debugging information
28891 must have been output when building the precompiled header. However,
28892 a precompiled header built using @option{-g} can be used in a compilation
28893 when no debugging information is being output.
28894
28895 @item The same @option{-m} options must generally be used when building
28896 and using the precompiled header. @xref{Submodel Options},
28897 for any cases where this rule is relaxed.
28898
28899 @item Each of the following options must be the same when building and using
28900 the precompiled header:
28901
28902 @gccoptlist{-fexceptions}
28903
28904 @item
28905 Some other command-line options starting with @option{-f},
28906 @option{-p}, or @option{-O} must be defined in the same way as when
28907 the precompiled header was generated. At present, it's not clear
28908 which options are safe to change and which are not; the safest choice
28909 is to use exactly the same options when generating and using the
28910 precompiled header. The following are known to be safe:
28911
28912 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
28913 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
28914 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
28915 -pedantic-errors}
28916
28917 @end itemize
28918
28919 For all of these except the last, the compiler automatically
28920 ignores the precompiled header if the conditions aren't met. If you
28921 find an option combination that doesn't work and doesn't cause the
28922 precompiled header to be ignored, please consider filing a bug report,
28923 see @ref{Bugs}.
28924
28925 If you do use differing options when generating and using the
28926 precompiled header, the actual behavior is a mixture of the
28927 behavior for the options. For instance, if you use @option{-g} to
28928 generate the precompiled header but not when using it, you may or may
28929 not get debugging information for routines in the precompiled header.