]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
[ARC] Reimplement ZOL support.
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2017 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-2017 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included in the gfdl(7) man page.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43 Only the most useful options are listed here; see below for the
44 remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
75 @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} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
176 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
177
178 @item C Language Options
179 @xref{C Dialect Options,,Options Controlling C Dialect}.
180 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
181 -fpermitted-flt-eval-methods=@var{standard} @gol
182 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
183 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
184 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
185 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
186 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
187 -fsigned-bitfields -fsigned-char @gol
188 -funsigned-bitfields -funsigned-char}
189
190 @item C++ Language Options
191 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
192 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
193 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
194 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
195 -ffriend-injection @gol
196 -fno-elide-constructors @gol
197 -fno-enforce-eh-specs @gol
198 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
199 -fno-implicit-templates @gol
200 -fno-implicit-inline-templates @gol
201 -fno-implement-inlines -fms-extensions @gol
202 -fnew-inheriting-ctors @gol
203 -fnew-ttp-matching @gol
204 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
205 -fno-optional-diags -fpermissive @gol
206 -fno-pretty-templates @gol
207 -frepo -fno-rtti -fsized-deallocation @gol
208 -ftemplate-backtrace-limit=@var{n} @gol
209 -ftemplate-depth=@var{n} @gol
210 -fno-threadsafe-statics -fuse-cxa-atexit @gol
211 -fno-weak -nostdinc++ @gol
212 -fvisibility-inlines-hidden @gol
213 -fvisibility-ms-compat @gol
214 -fext-numeric-literals @gol
215 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
216 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
217 -Wnamespaces -Wnarrowing @gol
218 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
219 -Wnon-virtual-dtor -Wreorder -Wregister @gol
220 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
221 -Wno-non-template-friend -Wold-style-cast @gol
222 -Woverloaded-virtual -Wno-pmf-conversions @gol
223 -Wsign-promo -Wvirtual-inheritance}
224
225 @item Objective-C and Objective-C++ Language Options
226 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
227 Objective-C and Objective-C++ Dialects}.
228 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
229 -fgnu-runtime -fnext-runtime @gol
230 -fno-nil-receivers @gol
231 -fobjc-abi-version=@var{n} @gol
232 -fobjc-call-cxx-cdtors @gol
233 -fobjc-direct-dispatch @gol
234 -fobjc-exceptions @gol
235 -fobjc-gc @gol
236 -fobjc-nilcheck @gol
237 -fobjc-std=objc1 @gol
238 -fno-local-ivars @gol
239 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
240 -freplace-objc-classes @gol
241 -fzero-link @gol
242 -gen-decls @gol
243 -Wassign-intercept @gol
244 -Wno-protocol -Wselector @gol
245 -Wstrict-selector-match @gol
246 -Wundeclared-selector}
247
248 @item Diagnostic Message Formatting Options
249 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
250 @gccoptlist{-fmessage-length=@var{n} @gol
251 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
252 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
253 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
254 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
255 -fdiagnostics-show-template-tree -fno-elide-type @gol
256 -fno-show-column}
257
258 @item Warning Options
259 @xref{Warning Options,,Options to Request or Suppress Warnings}.
260 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
261 -pedantic-errors @gol
262 -w -Wextra -Wall -Waddress -Waggregate-return @gol
263 -Walloc-zero -Walloc-size-larger-than=@var{n}
264 -Walloca -Walloca-larger-than=@var{n} @gol
265 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
266 -Wno-attributes -Wbool-compare -Wbool-operation @gol
267 -Wno-builtin-declaration-mismatch @gol
268 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
269 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
270 -Wchar-subscripts -Wchkp -Wcatch-value -Wcatch-value=@var{n} @gol
271 -Wclobbered -Wcomment -Wconditionally-supported @gol
272 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
273 -Wdelete-incomplete @gol
274 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
275 -Wdisabled-optimization @gol
276 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
277 -Wno-div-by-zero -Wdouble-promotion @gol
278 -Wduplicated-branches -Wduplicated-cond @gol
279 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
280 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
281 -Wfloat-equal -Wformat -Wformat=2 @gol
282 -Wno-format-contains-nul -Wno-format-extra-args @gol
283 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
284 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
285 -Wformat-y2k -Wframe-address @gol
286 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
287 -Wif-not-aligned @gol
288 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
289 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
290 -Wimplicit-function-declaration -Wimplicit-int @gol
291 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
292 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
293 -Winvalid-pch -Wlarger-than=@var{len} @gol
294 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
295 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
296 -Wmisleading-indentation -Wmissing-braces @gol
297 -Wmissing-field-initializers -Wmissing-include-dirs @gol
298 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
299 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
300 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
301 -Woverride-init-side-effects -Woverlength-strings @gol
302 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
303 -Wparentheses -Wno-pedantic-ms-format @gol
304 -Wplacement-new -Wplacement-new=@var{n} @gol
305 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
306 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
307 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
308 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
309 -Wshift-overflow -Wshift-overflow=@var{n} @gol
310 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
311 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
312 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
313 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
314 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
315 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
316 -Wstringop-overflow=@var{n} @gol
317 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
318 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
319 -Wmissing-format-attribute -Wsubobject-linkage @gol
320 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
321 -Wswitch-unreachable -Wsync-nand @gol
322 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
323 -Wtype-limits -Wundef @gol
324 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
325 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
326 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
327 -Wunused-parameter -Wno-unused-result @gol
328 -Wunused-value -Wunused-variable @gol
329 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
330 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
331 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
332 -Wvla -Wvla-larger-than=@var{n} -Wvolatile-register-var -Wwrite-strings @gol
333 -Wzero-as-null-pointer-constant -Whsa}
334
335 @item C and Objective-C-only Warning Options
336 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
337 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
338 -Wold-style-declaration -Wold-style-definition @gol
339 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
340 -Wdeclaration-after-statement -Wpointer-sign}
341
342 @item Debugging Options
343 @xref{Debugging Options,,Options for Debugging Your Program}.
344 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
345 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
346 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
347 -gcolumn-info -gno-column-info @gol
348 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
349 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
350 -fno-eliminate-unused-debug-types @gol
351 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
352 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
353 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
354 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
355 -fvar-tracking -fvar-tracking-assignments}
356
357 @item Optimization Options
358 @xref{Optimize Options,,Options that Control Optimization}.
359 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
360 -falign-jumps[=@var{n}] @gol
361 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
362 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
363 -fauto-inc-dec -fbranch-probabilities @gol
364 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
365 -fbtr-bb-exclusive -fcaller-saves @gol
366 -fcombine-stack-adjustments -fconserve-stack @gol
367 -fcompare-elim -fcprop-registers -fcrossjumping @gol
368 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
369 -fcx-limited-range @gol
370 -fdata-sections -fdce -fdelayed-branch @gol
371 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
372 -fdevirtualize-at-ltrans -fdse @gol
373 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
374 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
375 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
376 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
377 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
378 -fif-conversion2 -findirect-inlining @gol
379 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
380 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
381 -fipa-bit-cp -fipa-vrp @gol
382 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
383 -fira-algorithm=@var{algorithm} @gol
384 -fira-region=@var{region} -fira-hoist-pressure @gol
385 -fira-loop-pressure -fno-ira-share-save-slots @gol
386 -fno-ira-share-spill-slots @gol
387 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
388 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
389 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
390 -floop-block -floop-interchange -floop-strip-mine @gol
391 -floop-unroll-and-jam -floop-nest-optimize @gol
392 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
393 -flto-partition=@var{alg} -fmerge-all-constants @gol
394 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
395 -fmove-loop-invariants -fno-branch-count-reg @gol
396 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
397 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
398 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
399 -fno-sched-spec -fno-signed-zeros @gol
400 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
401 -fomit-frame-pointer -foptimize-sibling-calls @gol
402 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
403 -fprefetch-loop-arrays @gol
404 -fprofile-correction @gol
405 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
406 -fprofile-reorder-functions @gol
407 -freciprocal-math -free -frename-registers -freorder-blocks @gol
408 -freorder-blocks-algorithm=@var{algorithm} @gol
409 -freorder-blocks-and-partition -freorder-functions @gol
410 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
411 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
412 -fsched-spec-load -fsched-spec-load-dangerous @gol
413 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
414 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
415 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
416 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
417 -fschedule-fusion @gol
418 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
419 -fselective-scheduling -fselective-scheduling2 @gol
420 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
421 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
422 -fsignaling-nans @gol
423 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
424 -fsplit-paths @gol
425 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
426 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
427 -fthread-jumps -ftracer -ftree-bit-ccp @gol
428 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
429 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
430 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
431 -ftree-loop-if-convert -ftree-loop-im @gol
432 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
433 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
434 -ftree-loop-vectorize @gol
435 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
436 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
437 -ftree-switch-conversion -ftree-tail-merge @gol
438 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
439 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
440 -funsafe-math-optimizations -funswitch-loops @gol
441 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
442 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
443 --param @var{name}=@var{value}
444 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
445
446 @item Program Instrumentation Options
447 @xref{Instrumentation Options,,Program Instrumentation Options}.
448 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
449 -fprofile-abs-path @gol
450 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
451 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
452 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
453 -fsanitize-undefined-trap-on-error -fbounds-check @gol
454 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
455 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
456 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
457 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
458 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
459 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
460 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
461 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
462 -fchkp-use-wrappers -fchkp-flexible-struct-trailing-arrays@gol
463 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
464 -fstack-protector-explicit -fstack-check @gol
465 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
466 -fno-stack-limit -fsplit-stack @gol
467 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
468 -fvtv-counts -fvtv-debug @gol
469 -finstrument-functions @gol
470 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
471 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
472
473 @item Preprocessor Options
474 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
475 @gccoptlist{-A@var{question}=@var{answer} @gol
476 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
477 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
478 -dD -dI -dM -dN -dU @gol
479 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
480 -fexec-charset=@var{charset} -fextended-identifiers @gol
481 -finput-charset=@var{charset} -fno-canonical-system-headers @gol
482 -fpch-deps -fpch-preprocess -fpreprocessed @gol
483 -ftabstop=@var{width} -ftrack-macro-expansion @gol
484 -fwide-exec-charset=@var{charset} -fworking-directory @gol
485 -H -imacros @var{file} -include @var{file} @gol
486 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
487 -no-integrated-cpp -P -pthread -remap @gol
488 -traditional -traditional-cpp -trigraphs @gol
489 -U@var{macro} -undef @gol
490 -Wp,@var{option} -Xpreprocessor @var{option}}
491
492 @item Assembler Options
493 @xref{Assembler Options,,Passing Options to the Assembler}.
494 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
495
496 @item Linker Options
497 @xref{Link Options,,Options for Linking}.
498 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
499 -nostartfiles -nodefaultlibs -nostdlib -pie -pthread -rdynamic @gol
500 -s -static -static-libgcc -static-libstdc++ @gol
501 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
502 -static-libmpx -static-libmpxwrappers @gol
503 -shared -shared-libgcc -symbolic @gol
504 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
505 -u @var{symbol} -z @var{keyword}}
506
507 @item Directory Options
508 @xref{Directory Options,,Options for Directory Search}.
509 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
510 -idirafter @var{dir} @gol
511 -imacros @var{file} -imultilib @var{dir} @gol
512 -iplugindir=@var{dir} -iprefix @var{file} @gol
513 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
514 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
515 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
516 -nostdinc -nostdinc++ --sysroot=@var{dir}}
517
518 @item Code Generation Options
519 @xref{Code Gen Options,,Options for Code Generation Conventions}.
520 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
521 -ffixed-@var{reg} -fexceptions @gol
522 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
523 -fasynchronous-unwind-tables @gol
524 -fno-gnu-unique @gol
525 -finhibit-size-directive -fno-common -fno-ident @gol
526 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
527 -fno-jump-tables @gol
528 -frecord-gcc-switches @gol
529 -freg-struct-return -fshort-enums -fshort-wchar @gol
530 -fverbose-asm -fpack-struct[=@var{n}] @gol
531 -fleading-underscore -ftls-model=@var{model} @gol
532 -fstack-reuse=@var{reuse_level} @gol
533 -ftrampolines -ftrapv -fwrapv @gol
534 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
535 -fstrict-volatile-bitfields -fsync-libcalls}
536
537 @item Developer Options
538 @xref{Developer Options,,GCC Developer Options}.
539 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
540 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
541 -fdbg-cnt=@var{counter-value-list} @gol
542 -fdisable-ipa-@var{pass_name} @gol
543 -fdisable-rtl-@var{pass_name} @gol
544 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
545 -fdisable-tree-@var{pass_name} @gol
546 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
547 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
548 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
549 -fdump-final-insns@r{[}=@var{file}@r{]}
550 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
551 -fdump-lang-all @gol
552 -fdump-lang-@var{switch} @gol
553 -fdump-lang-@var{switch}-@var{options} @gol
554 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
555 -fdump-passes @gol
556 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
557 -fdump-statistics @gol
558 -fdump-tree-all @gol
559 -fdump-tree-@var{switch} @gol
560 -fdump-tree-@var{switch}-@var{options} @gol
561 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
562 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
563 -fenable-@var{kind}-@var{pass} @gol
564 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
565 -fira-verbose=@var{n} @gol
566 -flto-report -flto-report-wpa -fmem-report-wpa @gol
567 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
568 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
569 -fprofile-report @gol
570 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
571 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
572 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
573 -fvar-tracking-assignments-toggle -gtoggle @gol
574 -print-file-name=@var{library} -print-libgcc-file-name @gol
575 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
576 -print-prog-name=@var{program} -print-search-dirs -Q @gol
577 -print-sysroot -print-sysroot-headers-suffix @gol
578 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
579
580 @item Machine-Dependent Options
581 @xref{Submodel Options,,Machine-Dependent Options}.
582 @c This list is ordered alphanumerically by subsection name.
583 @c Try and put the significant identifier (CPU or system) first,
584 @c so users have a clue at guessing where the ones they want will be.
585
586 @emph{AArch64 Options}
587 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
588 -mgeneral-regs-only @gol
589 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
590 -mstrict-align @gol
591 -momit-leaf-frame-pointer @gol
592 -mtls-dialect=desc -mtls-dialect=traditional @gol
593 -mtls-size=@var{size} @gol
594 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
595 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
596 -mpc-relative-literal-loads @gol
597 -msign-return-address=@var{scope} @gol
598 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} -moverride=@var{string}}
599
600 @emph{Adapteva Epiphany Options}
601 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
602 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
603 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
604 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
605 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
606 -msplit-vecmove-early -m1reg-@var{reg}}
607
608 @emph{ARC Options}
609 @gccoptlist{-mbarrel-shifter @gol
610 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
611 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
612 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
613 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
614 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
615 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
616 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
617 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
618 -mvolatile-cache -mtp-regno=@var{regno} @gol
619 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
620 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
621 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
622 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
623 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
624 -mtune=@var{cpu} -mmultcost=@var{num} @gol
625 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
626 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
627
628 @emph{ARM Options}
629 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
630 -mabi=@var{name} @gol
631 -mapcs-stack-check -mno-apcs-stack-check @gol
632 -mapcs-reentrant -mno-apcs-reentrant @gol
633 -msched-prolog -mno-sched-prolog @gol
634 -mlittle-endian -mbig-endian @gol
635 -mbe8 -mbe32 @gol
636 -mfloat-abi=@var{name} @gol
637 -mfp16-format=@var{name}
638 -mthumb-interwork -mno-thumb-interwork @gol
639 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
640 -mtune=@var{name} -mprint-tune-info @gol
641 -mstructure-size-boundary=@var{n} @gol
642 -mabort-on-noreturn @gol
643 -mlong-calls -mno-long-calls @gol
644 -msingle-pic-base -mno-single-pic-base @gol
645 -mpic-register=@var{reg} @gol
646 -mnop-fun-dllimport @gol
647 -mpoke-function-name @gol
648 -mthumb -marm @gol
649 -mtpcs-frame -mtpcs-leaf-frame @gol
650 -mcaller-super-interworking -mcallee-super-interworking @gol
651 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
652 -mword-relocations @gol
653 -mfix-cortex-m3-ldrd @gol
654 -munaligned-access @gol
655 -mneon-for-64bits @gol
656 -mslow-flash-data @gol
657 -masm-syntax-unified @gol
658 -mrestrict-it @gol
659 -mpure-code @gol
660 -mcmse}
661
662 @emph{AVR Options}
663 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
664 -mbranch-cost=@var{cost} @gol
665 -mcall-prologues -mgas-isr-prologues -mint8 @gol
666 -mn_flash=@var{size} -mno-interrupts @gol
667 -mrelax -mrmw -mstrict-X -mtiny-stack -mfract-convert-truncate @gol
668 -mshort-calls -nodevicelib @gol
669 -Waddr-space-convert -Wmisspelled-isr}
670
671 @emph{Blackfin Options}
672 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
673 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
674 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
675 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
676 -mno-id-shared-library -mshared-library-id=@var{n} @gol
677 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
678 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
679 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
680 -micplb}
681
682 @emph{C6X Options}
683 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
684 -msim -msdata=@var{sdata-type}}
685
686 @emph{CRIS Options}
687 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
688 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
689 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
690 -mstack-align -mdata-align -mconst-align @gol
691 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
692 -melf -maout -melinux -mlinux -sim -sim2 @gol
693 -mmul-bug-workaround -mno-mul-bug-workaround}
694
695 @emph{CR16 Options}
696 @gccoptlist{-mmac @gol
697 -mcr16cplus -mcr16c @gol
698 -msim -mint32 -mbit-ops
699 -mdata-model=@var{model}}
700
701 @emph{Darwin Options}
702 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
703 -arch_only -bind_at_load -bundle -bundle_loader @gol
704 -client_name -compatibility_version -current_version @gol
705 -dead_strip @gol
706 -dependency-file -dylib_file -dylinker_install_name @gol
707 -dynamic -dynamiclib -exported_symbols_list @gol
708 -filelist -flat_namespace -force_cpusubtype_ALL @gol
709 -force_flat_namespace -headerpad_max_install_names @gol
710 -iframework @gol
711 -image_base -init -install_name -keep_private_externs @gol
712 -multi_module -multiply_defined -multiply_defined_unused @gol
713 -noall_load -no_dead_strip_inits_and_terms @gol
714 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
715 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
716 -private_bundle -read_only_relocs -sectalign @gol
717 -sectobjectsymbols -whyload -seg1addr @gol
718 -sectcreate -sectobjectsymbols -sectorder @gol
719 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
720 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
721 -segprot -segs_read_only_addr -segs_read_write_addr @gol
722 -single_module -static -sub_library -sub_umbrella @gol
723 -twolevel_namespace -umbrella -undefined @gol
724 -unexported_symbols_list -weak_reference_mismatches @gol
725 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
726 -mkernel -mone-byte-bool}
727
728 @emph{DEC Alpha Options}
729 @gccoptlist{-mno-fp-regs -msoft-float @gol
730 -mieee -mieee-with-inexact -mieee-conformant @gol
731 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
732 -mtrap-precision=@var{mode} -mbuild-constants @gol
733 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
734 -mbwx -mmax -mfix -mcix @gol
735 -mfloat-vax -mfloat-ieee @gol
736 -mexplicit-relocs -msmall-data -mlarge-data @gol
737 -msmall-text -mlarge-text @gol
738 -mmemory-latency=@var{time}}
739
740 @emph{FR30 Options}
741 @gccoptlist{-msmall-model -mno-lsim}
742
743 @emph{FT32 Options}
744 @gccoptlist{-msim -mlra -mnodiv}
745
746 @emph{FRV Options}
747 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
748 -mhard-float -msoft-float @gol
749 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
750 -mdouble -mno-double @gol
751 -mmedia -mno-media -mmuladd -mno-muladd @gol
752 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
753 -mlinked-fp -mlong-calls -malign-labels @gol
754 -mlibrary-pic -macc-4 -macc-8 @gol
755 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
756 -moptimize-membar -mno-optimize-membar @gol
757 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
758 -mvliw-branch -mno-vliw-branch @gol
759 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
760 -mno-nested-cond-exec -mtomcat-stats @gol
761 -mTLS -mtls @gol
762 -mcpu=@var{cpu}}
763
764 @emph{GNU/Linux Options}
765 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
766 -tno-android-cc -tno-android-ld}
767
768 @emph{H8/300 Options}
769 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
770
771 @emph{HPPA Options}
772 @gccoptlist{-march=@var{architecture-type} @gol
773 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
774 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
775 -mfixed-range=@var{register-range} @gol
776 -mjump-in-delay -mlinker-opt -mlong-calls @gol
777 -mlong-load-store -mno-disable-fpregs @gol
778 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
779 -mno-jump-in-delay -mno-long-load-store @gol
780 -mno-portable-runtime -mno-soft-float @gol
781 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
782 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
783 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
784 -munix=@var{unix-std} -nolibdld -static -threads}
785
786 @emph{IA-64 Options}
787 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
788 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
789 -mconstant-gp -mauto-pic -mfused-madd @gol
790 -minline-float-divide-min-latency @gol
791 -minline-float-divide-max-throughput @gol
792 -mno-inline-float-divide @gol
793 -minline-int-divide-min-latency @gol
794 -minline-int-divide-max-throughput @gol
795 -mno-inline-int-divide @gol
796 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
797 -mno-inline-sqrt @gol
798 -mdwarf2-asm -mearly-stop-bits @gol
799 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
800 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
801 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
802 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
803 -msched-spec-ldc -msched-spec-control-ldc @gol
804 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
805 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
806 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
807 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
808
809 @emph{LM32 Options}
810 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
811 -msign-extend-enabled -muser-enabled}
812
813 @emph{M32R/D Options}
814 @gccoptlist{-m32r2 -m32rx -m32r @gol
815 -mdebug @gol
816 -malign-loops -mno-align-loops @gol
817 -missue-rate=@var{number} @gol
818 -mbranch-cost=@var{number} @gol
819 -mmodel=@var{code-size-model-type} @gol
820 -msdata=@var{sdata-type} @gol
821 -mno-flush-func -mflush-func=@var{name} @gol
822 -mno-flush-trap -mflush-trap=@var{number} @gol
823 -G @var{num}}
824
825 @emph{M32C Options}
826 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
827
828 @emph{M680x0 Options}
829 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
830 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
831 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
832 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
833 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
834 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
835 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
836 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
837 -mxgot -mno-xgot -mlong-jump-table-offsets}
838
839 @emph{MCore Options}
840 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
841 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
842 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
843 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
844 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
845
846 @emph{MeP Options}
847 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
848 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
849 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
850 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
851 -mtiny=@var{n}}
852
853 @emph{MicroBlaze Options}
854 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
855 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
856 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
857 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
858 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
859
860 @emph{MIPS Options}
861 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
862 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
863 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
864 -mips16 -mno-mips16 -mflip-mips16 @gol
865 -minterlink-compressed -mno-interlink-compressed @gol
866 -minterlink-mips16 -mno-interlink-mips16 @gol
867 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
868 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
869 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
870 -mno-float -msingle-float -mdouble-float @gol
871 -modd-spreg -mno-odd-spreg @gol
872 -mabs=@var{mode} -mnan=@var{encoding} @gol
873 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
874 -mmcu -mmno-mcu @gol
875 -meva -mno-eva @gol
876 -mvirt -mno-virt @gol
877 -mxpa -mno-xpa @gol
878 -mmicromips -mno-micromips @gol
879 -mmsa -mno-msa @gol
880 -mfpu=@var{fpu-type} @gol
881 -msmartmips -mno-smartmips @gol
882 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
883 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
884 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
885 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
886 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
887 -membedded-data -mno-embedded-data @gol
888 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
889 -mcode-readable=@var{setting} @gol
890 -msplit-addresses -mno-split-addresses @gol
891 -mexplicit-relocs -mno-explicit-relocs @gol
892 -mcheck-zero-division -mno-check-zero-division @gol
893 -mdivide-traps -mdivide-breaks @gol
894 -mload-store-pairs -mno-load-store-pairs @gol
895 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
896 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
897 -mfix-24k -mno-fix-24k @gol
898 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
899 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
900 -mfix-vr4120 -mno-fix-vr4120 @gol
901 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
902 -mflush-func=@var{func} -mno-flush-func @gol
903 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
904 -mcompact-branches=@var{policy} @gol
905 -mfp-exceptions -mno-fp-exceptions @gol
906 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
907 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
908 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
909 -mframe-header-opt -mno-frame-header-opt}
910
911 @emph{MMIX Options}
912 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
913 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
914 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
915 -mno-base-addresses -msingle-exit -mno-single-exit}
916
917 @emph{MN10300 Options}
918 @gccoptlist{-mmult-bug -mno-mult-bug @gol
919 -mno-am33 -mam33 -mam33-2 -mam34 @gol
920 -mtune=@var{cpu-type} @gol
921 -mreturn-pointer-on-d0 @gol
922 -mno-crt0 -mrelax -mliw -msetlb}
923
924 @emph{Moxie Options}
925 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
926
927 @emph{MSP430 Options}
928 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
929 -mwarn-mcu @gol
930 -mcode-region= -mdata-region= @gol
931 -msilicon-errata= -msilicon-errata-warn= @gol
932 -mhwmult= -minrt}
933
934 @emph{NDS32 Options}
935 @gccoptlist{-mbig-endian -mlittle-endian @gol
936 -mreduced-regs -mfull-regs @gol
937 -mcmov -mno-cmov @gol
938 -mperf-ext -mno-perf-ext @gol
939 -mv3push -mno-v3push @gol
940 -m16bit -mno-16bit @gol
941 -misr-vector-size=@var{num} @gol
942 -mcache-block-size=@var{num} @gol
943 -march=@var{arch} @gol
944 -mcmodel=@var{code-model} @gol
945 -mctor-dtor -mrelax}
946
947 @emph{Nios II Options}
948 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
949 -mel -meb @gol
950 -mno-bypass-cache -mbypass-cache @gol
951 -mno-cache-volatile -mcache-volatile @gol
952 -mno-fast-sw-div -mfast-sw-div @gol
953 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
954 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
955 -mcustom-fpu-cfg=@var{name} @gol
956 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
957 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
958
959 @emph{Nvidia PTX Options}
960 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
961
962 @emph{PDP-11 Options}
963 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
964 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
965 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
966 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
967 -mbranch-expensive -mbranch-cheap @gol
968 -munix-asm -mdec-asm}
969
970 @emph{picoChip Options}
971 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
972 -msymbol-as-address -mno-inefficient-warnings}
973
974 @emph{PowerPC Options}
975 See RS/6000 and PowerPC Options.
976
977 @emph{RISC-V Options}
978 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
979 -mmemcpy -mno-memcpy @gol
980 -mplt -mno-plt @gol
981 -mabi=@var{ABI-string} @gol
982 -mfdiv -mno-fdiv @gol
983 -mdiv -mno-div @gol
984 -march=@var{ISA-string} @gol
985 -mtune=@var{processor-string} @gol
986 -msmall-data-limit=@var{N-bytes} @gol
987 -msave-restore -mno-save-restore @gol
988 -mstrict-align -mno-strict-align @gol
989 -mcmodel=@var{code-model} @gol
990 -mexplicit-relocs -mno-explicit-relocs @gol}
991
992 @emph{RL78 Options}
993 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
994 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
995 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
996
997 @emph{RS/6000 and PowerPC Options}
998 @gccoptlist{-mcpu=@var{cpu-type} @gol
999 -mtune=@var{cpu-type} @gol
1000 -mcmodel=@var{code-model} @gol
1001 -mpowerpc64 @gol
1002 -maltivec -mno-altivec @gol
1003 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1004 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1005 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1006 -mfprnd -mno-fprnd @gol
1007 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1008 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1009 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1010 -malign-power -malign-natural @gol
1011 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1012 -msingle-float -mdouble-float -msimple-fpu @gol
1013 -mstring -mno-string -mupdate -mno-update @gol
1014 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1015 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1016 -mstrict-align -mno-strict-align -mrelocatable @gol
1017 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1018 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1019 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1020 -mprioritize-restricted-insns=@var{priority} @gol
1021 -msched-costly-dep=@var{dependence_type} @gol
1022 -minsert-sched-nops=@var{scheme} @gol
1023 -mcall-sysv -mcall-netbsd @gol
1024 -maix-struct-return -msvr4-struct-return @gol
1025 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1026 -mblock-move-inline-limit=@var{num} @gol
1027 -misel -mno-isel @gol
1028 -misel=yes -misel=no @gol
1029 -mspe -mno-spe @gol
1030 -mspe=yes -mspe=no @gol
1031 -mpaired @gol
1032 -mvrsave -mno-vrsave @gol
1033 -mmulhw -mno-mulhw @gol
1034 -mdlmzb -mno-dlmzb @gol
1035 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1036 -mprototype -mno-prototype @gol
1037 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1038 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1039 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1040 -mno-recip-precision @gol
1041 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1042 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1043 -msave-toc-indirect -mno-save-toc-indirect @gol
1044 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1045 -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol
1046 -mquad-memory -mno-quad-memory @gol
1047 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1048 -mcompat-align-parm -mno-compat-align-parm @gol
1049 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1050 -mgnu-attribute -mno-gnu-attribute @gol
1051 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1052 -mstack-protector-guard-offset=@var{offset}}
1053
1054 @emph{RX Options}
1055 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1056 -mcpu=@gol
1057 -mbig-endian-data -mlittle-endian-data @gol
1058 -msmall-data @gol
1059 -msim -mno-sim@gol
1060 -mas100-syntax -mno-as100-syntax@gol
1061 -mrelax@gol
1062 -mmax-constant-size=@gol
1063 -mint-register=@gol
1064 -mpid@gol
1065 -mallow-string-insns -mno-allow-string-insns@gol
1066 -mjsr@gol
1067 -mno-warn-multiple-fast-interrupts@gol
1068 -msave-acc-in-interrupts}
1069
1070 @emph{S/390 and zSeries Options}
1071 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1072 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1073 -mlong-double-64 -mlong-double-128 @gol
1074 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1075 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1076 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1077 -mhtm -mvx -mzvector @gol
1078 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1079 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1080 -mhotpatch=@var{halfwords},@var{halfwords}}
1081
1082 @emph{Score Options}
1083 @gccoptlist{-meb -mel @gol
1084 -mnhwloop @gol
1085 -muls @gol
1086 -mmac @gol
1087 -mscore5 -mscore5u -mscore7 -mscore7d}
1088
1089 @emph{SH Options}
1090 @gccoptlist{-m1 -m2 -m2e @gol
1091 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1092 -m3 -m3e @gol
1093 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1094 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1095 -mb -ml -mdalign -mrelax @gol
1096 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1097 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1098 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1099 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1100 -maccumulate-outgoing-args @gol
1101 -matomic-model=@var{atomic-model} @gol
1102 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1103 -mcbranch-force-delay-slot @gol
1104 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1105 -mpretend-cmove -mtas}
1106
1107 @emph{Solaris 2 Options}
1108 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1109 -pthreads}
1110
1111 @emph{SPARC Options}
1112 @gccoptlist{-mcpu=@var{cpu-type} @gol
1113 -mtune=@var{cpu-type} @gol
1114 -mcmodel=@var{code-model} @gol
1115 -mmemory-model=@var{mem-model} @gol
1116 -m32 -m64 -mapp-regs -mno-app-regs @gol
1117 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1118 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1119 -mhard-quad-float -msoft-quad-float @gol
1120 -mstack-bias -mno-stack-bias @gol
1121 -mstd-struct-return -mno-std-struct-return @gol
1122 -munaligned-doubles -mno-unaligned-doubles @gol
1123 -muser-mode -mno-user-mode @gol
1124 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1125 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1126 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1127 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1128 -mpopc -mno-popc -msubxc -mno-subxc @gol
1129 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1130 -mlra -mno-lra}
1131
1132 @emph{SPU Options}
1133 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1134 -msafe-dma -munsafe-dma @gol
1135 -mbranch-hints @gol
1136 -msmall-mem -mlarge-mem -mstdmain @gol
1137 -mfixed-range=@var{register-range} @gol
1138 -mea32 -mea64 @gol
1139 -maddress-space-conversion -mno-address-space-conversion @gol
1140 -mcache-size=@var{cache-size} @gol
1141 -matomic-updates -mno-atomic-updates}
1142
1143 @emph{System V Options}
1144 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1145
1146 @emph{TILE-Gx Options}
1147 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1148 -mcmodel=@var{code-model}}
1149
1150 @emph{TILEPro Options}
1151 @gccoptlist{-mcpu=@var{cpu} -m32}
1152
1153 @emph{V850 Options}
1154 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1155 -mprolog-function -mno-prolog-function -mspace @gol
1156 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1157 -mapp-regs -mno-app-regs @gol
1158 -mdisable-callt -mno-disable-callt @gol
1159 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1160 -mv850e -mv850 -mv850e3v5 @gol
1161 -mloop @gol
1162 -mrelax @gol
1163 -mlong-jumps @gol
1164 -msoft-float @gol
1165 -mhard-float @gol
1166 -mgcc-abi @gol
1167 -mrh850-abi @gol
1168 -mbig-switch}
1169
1170 @emph{VAX Options}
1171 @gccoptlist{-mg -mgnu -munix}
1172
1173 @emph{Visium Options}
1174 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1175 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1176
1177 @emph{VMS Options}
1178 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1179 -mpointer-size=@var{size}}
1180
1181 @emph{VxWorks Options}
1182 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1183 -Xbind-lazy -Xbind-now}
1184
1185 @emph{x86 Options}
1186 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1187 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1188 -mfpmath=@var{unit} @gol
1189 -masm=@var{dialect} -mno-fancy-math-387 @gol
1190 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1191 -mno-wide-multiply -mrtd -malign-double @gol
1192 -mpreferred-stack-boundary=@var{num} @gol
1193 -mincoming-stack-boundary=@var{num} @gol
1194 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1195 -mrecip -mrecip=@var{opt} @gol
1196 -mvzeroupper -mprefer-avx128 @gol
1197 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1198 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1199 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1200 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1201 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1202 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1203 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx @gol
1204 -mmwaitx -mclzero -mpku -mthreads @gol
1205 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1206 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1207 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1208 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1209 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1210 -mregparm=@var{num} -msseregparm @gol
1211 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1212 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1213 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1214 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1215 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1216 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1217 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1218 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1219 -mstack-protector-guard-reg=@var{reg} @gol
1220 -mstack-protector-guard-offset=@var{offset} @gol
1221 -mstack-protector-guard-symbol=@var{symbol} -mmitigate-rop @gol
1222 -mgeneral-regs-only -mcall-ms2sysv-xlogues}
1223
1224 @emph{x86 Windows Options}
1225 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1226 -mnop-fun-dllimport -mthread @gol
1227 -municode -mwin32 -mwindows -fno-set-stack-executable}
1228
1229 @emph{Xstormy16 Options}
1230 @gccoptlist{-msim}
1231
1232 @emph{Xtensa Options}
1233 @gccoptlist{-mconst16 -mno-const16 @gol
1234 -mfused-madd -mno-fused-madd @gol
1235 -mforce-no-pic @gol
1236 -mserialize-volatile -mno-serialize-volatile @gol
1237 -mtext-section-literals -mno-text-section-literals @gol
1238 -mauto-litpools -mno-auto-litpools @gol
1239 -mtarget-align -mno-target-align @gol
1240 -mlongcalls -mno-longcalls}
1241
1242 @emph{zSeries Options}
1243 See S/390 and zSeries Options.
1244 @end table
1245
1246
1247 @node Overall Options
1248 @section Options Controlling the Kind of Output
1249
1250 Compilation can involve up to four stages: preprocessing, compilation
1251 proper, assembly and linking, always in that order. GCC is capable of
1252 preprocessing and compiling several files either into several
1253 assembler input files, or into one assembler input file; then each
1254 assembler input file produces an object file, and linking combines all
1255 the object files (those newly compiled, and those specified as input)
1256 into an executable file.
1257
1258 @cindex file name suffix
1259 For any given input file, the file name suffix determines what kind of
1260 compilation is done:
1261
1262 @table @gcctabopt
1263 @item @var{file}.c
1264 C source code that must be preprocessed.
1265
1266 @item @var{file}.i
1267 C source code that should not be preprocessed.
1268
1269 @item @var{file}.ii
1270 C++ source code that should not be preprocessed.
1271
1272 @item @var{file}.m
1273 Objective-C source code. Note that you must link with the @file{libobjc}
1274 library to make an Objective-C program work.
1275
1276 @item @var{file}.mi
1277 Objective-C source code that should not be preprocessed.
1278
1279 @item @var{file}.mm
1280 @itemx @var{file}.M
1281 Objective-C++ source code. Note that you must link with the @file{libobjc}
1282 library to make an Objective-C++ program work. Note that @samp{.M} refers
1283 to a literal capital M@.
1284
1285 @item @var{file}.mii
1286 Objective-C++ source code that should not be preprocessed.
1287
1288 @item @var{file}.h
1289 C, C++, Objective-C or Objective-C++ header file to be turned into a
1290 precompiled header (default), or C, C++ header file to be turned into an
1291 Ada spec (via the @option{-fdump-ada-spec} switch).
1292
1293 @item @var{file}.cc
1294 @itemx @var{file}.cp
1295 @itemx @var{file}.cxx
1296 @itemx @var{file}.cpp
1297 @itemx @var{file}.CPP
1298 @itemx @var{file}.c++
1299 @itemx @var{file}.C
1300 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1301 the last two letters must both be literally @samp{x}. Likewise,
1302 @samp{.C} refers to a literal capital C@.
1303
1304 @item @var{file}.mm
1305 @itemx @var{file}.M
1306 Objective-C++ source code that must be preprocessed.
1307
1308 @item @var{file}.mii
1309 Objective-C++ source code that should not be preprocessed.
1310
1311 @item @var{file}.hh
1312 @itemx @var{file}.H
1313 @itemx @var{file}.hp
1314 @itemx @var{file}.hxx
1315 @itemx @var{file}.hpp
1316 @itemx @var{file}.HPP
1317 @itemx @var{file}.h++
1318 @itemx @var{file}.tcc
1319 C++ header file to be turned into a precompiled header or Ada spec.
1320
1321 @item @var{file}.f
1322 @itemx @var{file}.for
1323 @itemx @var{file}.ftn
1324 Fixed form Fortran source code that should not be preprocessed.
1325
1326 @item @var{file}.F
1327 @itemx @var{file}.FOR
1328 @itemx @var{file}.fpp
1329 @itemx @var{file}.FPP
1330 @itemx @var{file}.FTN
1331 Fixed form Fortran source code that must be preprocessed (with the traditional
1332 preprocessor).
1333
1334 @item @var{file}.f90
1335 @itemx @var{file}.f95
1336 @itemx @var{file}.f03
1337 @itemx @var{file}.f08
1338 Free form Fortran source code that should not be preprocessed.
1339
1340 @item @var{file}.F90
1341 @itemx @var{file}.F95
1342 @itemx @var{file}.F03
1343 @itemx @var{file}.F08
1344 Free form Fortran source code that must be preprocessed (with the
1345 traditional preprocessor).
1346
1347 @item @var{file}.go
1348 Go source code.
1349
1350 @item @var{file}.brig
1351 BRIG files (binary representation of HSAIL).
1352
1353 @item @var{file}.ads
1354 Ada source code file that contains a library unit declaration (a
1355 declaration of a package, subprogram, or generic, or a generic
1356 instantiation), or a library unit renaming declaration (a package,
1357 generic, or subprogram renaming declaration). Such files are also
1358 called @dfn{specs}.
1359
1360 @item @var{file}.adb
1361 Ada source code file containing a library unit body (a subprogram or
1362 package body). Such files are also called @dfn{bodies}.
1363
1364 @c GCC also knows about some suffixes for languages not yet included:
1365 @c Pascal:
1366 @c @var{file}.p
1367 @c @var{file}.pas
1368 @c Ratfor:
1369 @c @var{file}.r
1370
1371 @item @var{file}.s
1372 Assembler code.
1373
1374 @item @var{file}.S
1375 @itemx @var{file}.sx
1376 Assembler code that must be preprocessed.
1377
1378 @item @var{other}
1379 An object file to be fed straight into linking.
1380 Any file name with no recognized suffix is treated this way.
1381 @end table
1382
1383 @opindex x
1384 You can specify the input language explicitly with the @option{-x} option:
1385
1386 @table @gcctabopt
1387 @item -x @var{language}
1388 Specify explicitly the @var{language} for the following input files
1389 (rather than letting the compiler choose a default based on the file
1390 name suffix). This option applies to all following input files until
1391 the next @option{-x} option. Possible values for @var{language} are:
1392 @smallexample
1393 c c-header cpp-output
1394 c++ c++-header c++-cpp-output
1395 objective-c objective-c-header objective-c-cpp-output
1396 objective-c++ objective-c++-header objective-c++-cpp-output
1397 assembler assembler-with-cpp
1398 ada
1399 f77 f77-cpp-input f95 f95-cpp-input
1400 go
1401 brig
1402 @end smallexample
1403
1404 @item -x none
1405 Turn off any specification of a language, so that subsequent files are
1406 handled according to their file name suffixes (as they are if @option{-x}
1407 has not been used at all).
1408 @end table
1409
1410 If you only want some of the stages of compilation, you can use
1411 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1412 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1413 @command{gcc} is to stop. Note that some combinations (for example,
1414 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1415
1416 @table @gcctabopt
1417 @item -c
1418 @opindex c
1419 Compile or assemble the source files, but do not link. The linking
1420 stage simply is not done. The ultimate output is in the form of an
1421 object file for each source file.
1422
1423 By default, the object file name for a source file is made by replacing
1424 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1425
1426 Unrecognized input files, not requiring compilation or assembly, are
1427 ignored.
1428
1429 @item -S
1430 @opindex S
1431 Stop after the stage of compilation proper; do not assemble. The output
1432 is in the form of an assembler code file for each non-assembler input
1433 file specified.
1434
1435 By default, the assembler file name for a source file is made by
1436 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1437
1438 Input files that don't require compilation are ignored.
1439
1440 @item -E
1441 @opindex E
1442 Stop after the preprocessing stage; do not run the compiler proper. The
1443 output is in the form of preprocessed source code, which is sent to the
1444 standard output.
1445
1446 Input files that don't require preprocessing are ignored.
1447
1448 @cindex output file option
1449 @item -o @var{file}
1450 @opindex o
1451 Place output in file @var{file}. This applies to whatever
1452 sort of output is being produced, whether it be an executable file,
1453 an object file, an assembler file or preprocessed C code.
1454
1455 If @option{-o} is not specified, the default is to put an executable
1456 file in @file{a.out}, the object file for
1457 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1458 assembler file in @file{@var{source}.s}, a precompiled header file in
1459 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1460 standard output.
1461
1462 @item -v
1463 @opindex v
1464 Print (on standard error output) the commands executed to run the stages
1465 of compilation. Also print the version number of the compiler driver
1466 program and of the preprocessor and the compiler proper.
1467
1468 @item -###
1469 @opindex ###
1470 Like @option{-v} except the commands are not executed and arguments
1471 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1472 This is useful for shell scripts to capture the driver-generated command lines.
1473
1474 @item --help
1475 @opindex help
1476 Print (on the standard output) a description of the command-line options
1477 understood by @command{gcc}. If the @option{-v} option is also specified
1478 then @option{--help} is also passed on to the various processes
1479 invoked by @command{gcc}, so that they can display the command-line options
1480 they accept. If the @option{-Wextra} option has also been specified
1481 (prior to the @option{--help} option), then command-line options that
1482 have no documentation associated with them are also displayed.
1483
1484 @item --target-help
1485 @opindex target-help
1486 Print (on the standard output) a description of target-specific command-line
1487 options for each tool. For some targets extra target-specific
1488 information may also be printed.
1489
1490 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1491 Print (on the standard output) a description of the command-line
1492 options understood by the compiler that fit into all specified classes
1493 and qualifiers. These are the supported classes:
1494
1495 @table @asis
1496 @item @samp{optimizers}
1497 Display all of the optimization options supported by the
1498 compiler.
1499
1500 @item @samp{warnings}
1501 Display all of the options controlling warning messages
1502 produced by the compiler.
1503
1504 @item @samp{target}
1505 Display target-specific options. Unlike the
1506 @option{--target-help} option however, target-specific options of the
1507 linker and assembler are not displayed. This is because those
1508 tools do not currently support the extended @option{--help=} syntax.
1509
1510 @item @samp{params}
1511 Display the values recognized by the @option{--param}
1512 option.
1513
1514 @item @var{language}
1515 Display the options supported for @var{language}, where
1516 @var{language} is the name of one of the languages supported in this
1517 version of GCC@.
1518
1519 @item @samp{common}
1520 Display the options that are common to all languages.
1521 @end table
1522
1523 These are the supported qualifiers:
1524
1525 @table @asis
1526 @item @samp{undocumented}
1527 Display only those options that are undocumented.
1528
1529 @item @samp{joined}
1530 Display options taking an argument that appears after an equal
1531 sign in the same continuous piece of text, such as:
1532 @samp{--help=target}.
1533
1534 @item @samp{separate}
1535 Display options taking an argument that appears as a separate word
1536 following the original option, such as: @samp{-o output-file}.
1537 @end table
1538
1539 Thus for example to display all the undocumented target-specific
1540 switches supported by the compiler, use:
1541
1542 @smallexample
1543 --help=target,undocumented
1544 @end smallexample
1545
1546 The sense of a qualifier can be inverted by prefixing it with the
1547 @samp{^} character, so for example to display all binary warning
1548 options (i.e., ones that are either on or off and that do not take an
1549 argument) that have a description, use:
1550
1551 @smallexample
1552 --help=warnings,^joined,^undocumented
1553 @end smallexample
1554
1555 The argument to @option{--help=} should not consist solely of inverted
1556 qualifiers.
1557
1558 Combining several classes is possible, although this usually
1559 restricts the output so much that there is nothing to display. One
1560 case where it does work, however, is when one of the classes is
1561 @var{target}. For example, to display all the target-specific
1562 optimization options, use:
1563
1564 @smallexample
1565 --help=target,optimizers
1566 @end smallexample
1567
1568 The @option{--help=} option can be repeated on the command line. Each
1569 successive use displays its requested class of options, skipping
1570 those that have already been displayed.
1571
1572 If the @option{-Q} option appears on the command line before the
1573 @option{--help=} option, then the descriptive text displayed by
1574 @option{--help=} is changed. Instead of describing the displayed
1575 options, an indication is given as to whether the option is enabled,
1576 disabled or set to a specific value (assuming that the compiler
1577 knows this at the point where the @option{--help=} option is used).
1578
1579 Here is a truncated example from the ARM port of @command{gcc}:
1580
1581 @smallexample
1582 % gcc -Q -mabi=2 --help=target -c
1583 The following options are target specific:
1584 -mabi= 2
1585 -mabort-on-noreturn [disabled]
1586 -mapcs [disabled]
1587 @end smallexample
1588
1589 The output is sensitive to the effects of previous command-line
1590 options, so for example it is possible to find out which optimizations
1591 are enabled at @option{-O2} by using:
1592
1593 @smallexample
1594 -Q -O2 --help=optimizers
1595 @end smallexample
1596
1597 Alternatively you can discover which binary optimizations are enabled
1598 by @option{-O3} by using:
1599
1600 @smallexample
1601 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1602 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1603 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1604 @end smallexample
1605
1606 @item --version
1607 @opindex version
1608 Display the version number and copyrights of the invoked GCC@.
1609
1610 @item -pass-exit-codes
1611 @opindex pass-exit-codes
1612 Normally the @command{gcc} program exits with the code of 1 if any
1613 phase of the compiler returns a non-success return code. If you specify
1614 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1615 the numerically highest error produced by any phase returning an error
1616 indication. The C, C++, and Fortran front ends return 4 if an internal
1617 compiler error is encountered.
1618
1619 @item -pipe
1620 @opindex pipe
1621 Use pipes rather than temporary files for communication between the
1622 various stages of compilation. This fails to work on some systems where
1623 the assembler is unable to read from a pipe; but the GNU assembler has
1624 no trouble.
1625
1626 @item -specs=@var{file}
1627 @opindex specs
1628 Process @var{file} after the compiler reads in the standard @file{specs}
1629 file, in order to override the defaults which the @command{gcc} driver
1630 program uses when determining what switches to pass to @command{cc1},
1631 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1632 @option{-specs=@var{file}} can be specified on the command line, and they
1633 are processed in order, from left to right. @xref{Spec Files}, for
1634 information about the format of the @var{file}.
1635
1636 @item -wrapper
1637 @opindex wrapper
1638 Invoke all subcommands under a wrapper program. The name of the
1639 wrapper program and its parameters are passed as a comma separated
1640 list.
1641
1642 @smallexample
1643 gcc -c t.c -wrapper gdb,--args
1644 @end smallexample
1645
1646 @noindent
1647 This invokes all subprograms of @command{gcc} under
1648 @samp{gdb --args}, thus the invocation of @command{cc1} is
1649 @samp{gdb --args cc1 @dots{}}.
1650
1651 @item -fplugin=@var{name}.so
1652 @opindex fplugin
1653 Load the plugin code in file @var{name}.so, assumed to be a
1654 shared object to be dlopen'd by the compiler. The base name of
1655 the shared object file is used to identify the plugin for the
1656 purposes of argument parsing (See
1657 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1658 Each plugin should define the callback functions specified in the
1659 Plugins API.
1660
1661 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1662 @opindex fplugin-arg
1663 Define an argument called @var{key} with a value of @var{value}
1664 for the plugin called @var{name}.
1665
1666 @item -fdump-ada-spec@r{[}-slim@r{]}
1667 @opindex fdump-ada-spec
1668 For C and C++ source and include files, generate corresponding Ada specs.
1669 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1670 GNAT User's Guide}, which provides detailed documentation on this feature.
1671
1672 @item -fada-spec-parent=@var{unit}
1673 @opindex fada-spec-parent
1674 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1675 Ada specs as child units of parent @var{unit}.
1676
1677 @item -fdump-go-spec=@var{file}
1678 @opindex fdump-go-spec
1679 For input files in any language, generate corresponding Go
1680 declarations in @var{file}. This generates Go @code{const},
1681 @code{type}, @code{var}, and @code{func} declarations which may be a
1682 useful way to start writing a Go interface to code written in some
1683 other language.
1684
1685 @include @value{srcdir}/../libiberty/at-file.texi
1686 @end table
1687
1688 @node Invoking G++
1689 @section Compiling C++ Programs
1690
1691 @cindex suffixes for C++ source
1692 @cindex C++ source file suffixes
1693 C++ source files conventionally use one of the suffixes @samp{.C},
1694 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1695 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1696 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1697 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1698 files with these names and compiles them as C++ programs even if you
1699 call the compiler the same way as for compiling C programs (usually
1700 with the name @command{gcc}).
1701
1702 @findex g++
1703 @findex c++
1704 However, the use of @command{gcc} does not add the C++ library.
1705 @command{g++} is a program that calls GCC and automatically specifies linking
1706 against the C++ library. It treats @samp{.c},
1707 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1708 files unless @option{-x} is used. This program is also useful when
1709 precompiling a C header file with a @samp{.h} extension for use in C++
1710 compilations. On many systems, @command{g++} is also installed with
1711 the name @command{c++}.
1712
1713 @cindex invoking @command{g++}
1714 When you compile C++ programs, you may specify many of the same
1715 command-line options that you use for compiling programs in any
1716 language; or command-line options meaningful for C and related
1717 languages; or options that are meaningful only for C++ programs.
1718 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1719 explanations of options for languages related to C@.
1720 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1721 explanations of options that are meaningful only for C++ programs.
1722
1723 @node C Dialect Options
1724 @section Options Controlling C Dialect
1725 @cindex dialect options
1726 @cindex language dialect options
1727 @cindex options, dialect
1728
1729 The following options control the dialect of C (or languages derived
1730 from C, such as C++, Objective-C and Objective-C++) that the compiler
1731 accepts:
1732
1733 @table @gcctabopt
1734 @cindex ANSI support
1735 @cindex ISO support
1736 @item -ansi
1737 @opindex ansi
1738 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1739 equivalent to @option{-std=c++98}.
1740
1741 This turns off certain features of GCC that are incompatible with ISO
1742 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1743 such as the @code{asm} and @code{typeof} keywords, and
1744 predefined macros such as @code{unix} and @code{vax} that identify the
1745 type of system you are using. It also enables the undesirable and
1746 rarely used ISO trigraph feature. For the C compiler,
1747 it disables recognition of C++ style @samp{//} comments as well as
1748 the @code{inline} keyword.
1749
1750 The alternate keywords @code{__asm__}, @code{__extension__},
1751 @code{__inline__} and @code{__typeof__} continue to work despite
1752 @option{-ansi}. You would not want to use them in an ISO C program, of
1753 course, but it is useful to put them in header files that might be included
1754 in compilations done with @option{-ansi}. Alternate predefined macros
1755 such as @code{__unix__} and @code{__vax__} are also available, with or
1756 without @option{-ansi}.
1757
1758 The @option{-ansi} option does not cause non-ISO programs to be
1759 rejected gratuitously. For that, @option{-Wpedantic} is required in
1760 addition to @option{-ansi}. @xref{Warning Options}.
1761
1762 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1763 option is used. Some header files may notice this macro and refrain
1764 from declaring certain functions or defining certain macros that the
1765 ISO standard doesn't call for; this is to avoid interfering with any
1766 programs that might use these names for other things.
1767
1768 Functions that are normally built in but do not have semantics
1769 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1770 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1771 built-in functions provided by GCC}, for details of the functions
1772 affected.
1773
1774 @item -std=
1775 @opindex std
1776 Determine the language standard. @xref{Standards,,Language Standards
1777 Supported by GCC}, for details of these standard versions. This option
1778 is currently only supported when compiling C or C++.
1779
1780 The compiler can accept several base standards, such as @samp{c90} or
1781 @samp{c++98}, and GNU dialects of those standards, such as
1782 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1783 compiler accepts all programs following that standard plus those
1784 using GNU extensions that do not contradict it. For example,
1785 @option{-std=c90} turns off certain features of GCC that are
1786 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1787 keywords, but not other GNU extensions that do not have a meaning in
1788 ISO C90, such as omitting the middle term of a @code{?:}
1789 expression. On the other hand, when a GNU dialect of a standard is
1790 specified, all features supported by the compiler are enabled, even when
1791 those features change the meaning of the base standard. As a result, some
1792 strict-conforming programs may be rejected. The particular standard
1793 is used by @option{-Wpedantic} to identify which features are GNU
1794 extensions given that version of the standard. For example
1795 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1796 comments, while @option{-std=gnu99 -Wpedantic} does not.
1797
1798 A value for this option must be provided; possible values are
1799
1800 @table @samp
1801 @item c90
1802 @itemx c89
1803 @itemx iso9899:1990
1804 Support all ISO C90 programs (certain GNU extensions that conflict
1805 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1806
1807 @item iso9899:199409
1808 ISO C90 as modified in amendment 1.
1809
1810 @item c99
1811 @itemx c9x
1812 @itemx iso9899:1999
1813 @itemx iso9899:199x
1814 ISO C99. This standard is substantially completely supported, modulo
1815 bugs and floating-point issues
1816 (mainly but not entirely relating to optional C99 features from
1817 Annexes F and G). See
1818 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1819 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1820
1821 @item c11
1822 @itemx c1x
1823 @itemx iso9899:2011
1824 ISO C11, the 2011 revision of the ISO C standard. This standard is
1825 substantially completely supported, modulo bugs, floating-point issues
1826 (mainly but not entirely relating to optional C11 features from
1827 Annexes F and G) and the optional Annexes K (Bounds-checking
1828 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1829
1830 @item gnu90
1831 @itemx gnu89
1832 GNU dialect of ISO C90 (including some C99 features).
1833
1834 @item gnu99
1835 @itemx gnu9x
1836 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1837
1838 @item gnu11
1839 @itemx gnu1x
1840 GNU dialect of ISO C11. This is the default for C code.
1841 The name @samp{gnu1x} is deprecated.
1842
1843 @item c++98
1844 @itemx c++03
1845 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1846 additional defect reports. Same as @option{-ansi} for C++ code.
1847
1848 @item gnu++98
1849 @itemx gnu++03
1850 GNU dialect of @option{-std=c++98}.
1851
1852 @item c++11
1853 @itemx c++0x
1854 The 2011 ISO C++ standard plus amendments.
1855 The name @samp{c++0x} is deprecated.
1856
1857 @item gnu++11
1858 @itemx gnu++0x
1859 GNU dialect of @option{-std=c++11}.
1860 The name @samp{gnu++0x} is deprecated.
1861
1862 @item c++14
1863 @itemx c++1y
1864 The 2014 ISO C++ standard plus amendments.
1865 The name @samp{c++1y} is deprecated.
1866
1867 @item gnu++14
1868 @itemx gnu++1y
1869 GNU dialect of @option{-std=c++14}.
1870 This is the default for C++ code.
1871 The name @samp{gnu++1y} is deprecated.
1872
1873 @item c++1z
1874 The next revision of the ISO C++ standard, tentatively planned for
1875 2017. Support is highly experimental, and will almost certainly
1876 change in incompatible ways in future releases.
1877
1878 @item gnu++1z
1879 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1880 and will almost certainly change in incompatible ways in future
1881 releases.
1882 @end table
1883
1884 @item -fgnu89-inline
1885 @opindex fgnu89-inline
1886 The option @option{-fgnu89-inline} tells GCC to use the traditional
1887 GNU semantics for @code{inline} functions when in C99 mode.
1888 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1889 Using this option is roughly equivalent to adding the
1890 @code{gnu_inline} function attribute to all inline functions
1891 (@pxref{Function Attributes}).
1892
1893 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1894 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1895 specifies the default behavior).
1896 This option is not supported in @option{-std=c90} or
1897 @option{-std=gnu90} mode.
1898
1899 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1900 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1901 in effect for @code{inline} functions. @xref{Common Predefined
1902 Macros,,,cpp,The C Preprocessor}.
1903
1904 @item -fpermitted-flt-eval-methods=@var{style}
1905 @opindex fpermitted-flt-eval-methods
1906 @opindex fpermitted-flt-eval-methods=c11
1907 @opindex fpermitted-flt-eval-methods=ts-18661-3
1908 ISO/IEC TS 18661-3 defines new permissible values for
1909 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
1910 a semantic type that is an interchange or extended format should be
1911 evaluated to the precision and range of that type. These new values are
1912 a superset of those permitted under C99/C11, which does not specify the
1913 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
1914 conforming to C11 may not have been written expecting the possibility of
1915 the new values.
1916
1917 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
1918 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
1919 or the extended set of values specified in ISO/IEC TS 18661-3.
1920
1921 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
1922
1923 The default when in a standards compliant mode (@option{-std=c11} or similar)
1924 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
1925 dialect (@option{-std=gnu11} or similar) is
1926 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
1927
1928 @item -aux-info @var{filename}
1929 @opindex aux-info
1930 Output to the given filename prototyped declarations for all functions
1931 declared and/or defined in a translation unit, including those in header
1932 files. This option is silently ignored in any language other than C@.
1933
1934 Besides declarations, the file indicates, in comments, the origin of
1935 each declaration (source file and line), whether the declaration was
1936 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1937 @samp{O} for old, respectively, in the first character after the line
1938 number and the colon), and whether it came from a declaration or a
1939 definition (@samp{C} or @samp{F}, respectively, in the following
1940 character). In the case of function definitions, a K&R-style list of
1941 arguments followed by their declarations is also provided, inside
1942 comments, after the declaration.
1943
1944 @item -fallow-parameterless-variadic-functions
1945 @opindex fallow-parameterless-variadic-functions
1946 Accept variadic functions without named parameters.
1947
1948 Although it is possible to define such a function, this is not very
1949 useful as it is not possible to read the arguments. This is only
1950 supported for C as this construct is allowed by C++.
1951
1952 @item -fno-asm
1953 @opindex fno-asm
1954 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1955 keyword, so that code can use these words as identifiers. You can use
1956 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1957 instead. @option{-ansi} implies @option{-fno-asm}.
1958
1959 In C++, this switch only affects the @code{typeof} keyword, since
1960 @code{asm} and @code{inline} are standard keywords. You may want to
1961 use the @option{-fno-gnu-keywords} flag instead, which has the same
1962 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1963 switch only affects the @code{asm} and @code{typeof} keywords, since
1964 @code{inline} is a standard keyword in ISO C99.
1965
1966 @item -fno-builtin
1967 @itemx -fno-builtin-@var{function}
1968 @opindex fno-builtin
1969 @cindex built-in functions
1970 Don't recognize built-in functions that do not begin with
1971 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1972 functions provided by GCC}, for details of the functions affected,
1973 including those which are not built-in functions when @option{-ansi} or
1974 @option{-std} options for strict ISO C conformance are used because they
1975 do not have an ISO standard meaning.
1976
1977 GCC normally generates special code to handle certain built-in functions
1978 more efficiently; for instance, calls to @code{alloca} may become single
1979 instructions which adjust the stack directly, and calls to @code{memcpy}
1980 may become inline copy loops. The resulting code is often both smaller
1981 and faster, but since the function calls no longer appear as such, you
1982 cannot set a breakpoint on those calls, nor can you change the behavior
1983 of the functions by linking with a different library. In addition,
1984 when a function is recognized as a built-in function, GCC may use
1985 information about that function to warn about problems with calls to
1986 that function, or to generate more efficient code, even if the
1987 resulting code still contains calls to that function. For example,
1988 warnings are given with @option{-Wformat} for bad calls to
1989 @code{printf} when @code{printf} is built in and @code{strlen} is
1990 known not to modify global memory.
1991
1992 With the @option{-fno-builtin-@var{function}} option
1993 only the built-in function @var{function} is
1994 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1995 function is named that is not built-in in this version of GCC, this
1996 option is ignored. There is no corresponding
1997 @option{-fbuiltin-@var{function}} option; if you wish to enable
1998 built-in functions selectively when using @option{-fno-builtin} or
1999 @option{-ffreestanding}, you may define macros such as:
2000
2001 @smallexample
2002 #define abs(n) __builtin_abs ((n))
2003 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2004 @end smallexample
2005
2006 @item -fgimple
2007 @opindex fgimple
2008
2009 Enable parsing of function definitions marked with @code{__GIMPLE}.
2010 This is an experimental feature that allows unit testing of GIMPLE
2011 passes.
2012
2013 @item -fhosted
2014 @opindex fhosted
2015 @cindex hosted environment
2016
2017 Assert that compilation targets a hosted environment. This implies
2018 @option{-fbuiltin}. A hosted environment is one in which the
2019 entire standard library is available, and in which @code{main} has a return
2020 type of @code{int}. Examples are nearly everything except a kernel.
2021 This is equivalent to @option{-fno-freestanding}.
2022
2023 @item -ffreestanding
2024 @opindex ffreestanding
2025 @cindex hosted environment
2026
2027 Assert that compilation targets a freestanding environment. This
2028 implies @option{-fno-builtin}. A freestanding environment
2029 is one in which the standard library may not exist, and program startup may
2030 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2031 This is equivalent to @option{-fno-hosted}.
2032
2033 @xref{Standards,,Language Standards Supported by GCC}, for details of
2034 freestanding and hosted environments.
2035
2036 @item -fopenacc
2037 @opindex fopenacc
2038 @cindex OpenACC accelerator programming
2039 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2040 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2041 compiler generates accelerated code according to the OpenACC Application
2042 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
2043 implies @option{-pthread}, and thus is only supported on targets that
2044 have support for @option{-pthread}.
2045
2046 @item -fopenacc-dim=@var{geom}
2047 @opindex fopenacc-dim
2048 @cindex OpenACC accelerator programming
2049 Specify default compute dimensions for parallel offload regions that do
2050 not explicitly specify. The @var{geom} value is a triple of
2051 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2052 can be omitted, to use a target-specific default value.
2053
2054 @item -fopenmp
2055 @opindex fopenmp
2056 @cindex OpenMP parallel
2057 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2058 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2059 compiler generates parallel code according to the OpenMP Application
2060 Program Interface v4.5 @w{@uref{http://www.openmp.org/}}. This option
2061 implies @option{-pthread}, and thus is only supported on targets that
2062 have support for @option{-pthread}. @option{-fopenmp} implies
2063 @option{-fopenmp-simd}.
2064
2065 @item -fopenmp-simd
2066 @opindex fopenmp-simd
2067 @cindex OpenMP SIMD
2068 @cindex SIMD
2069 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2070 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2071 are ignored.
2072
2073 @item -fcilkplus
2074 @opindex fcilkplus
2075 @cindex Enable Cilk Plus
2076 Enable the usage of Cilk Plus language extension features for C/C++.
2077 When the option @option{-fcilkplus} is specified, enable the usage of
2078 the Cilk Plus Language extension features for C/C++. The present
2079 implementation follows ABI version 1.2. This is an experimental
2080 feature that is only partially complete, and whose interface may
2081 change in future versions of GCC as the official specification
2082 changes. Currently, all features but @code{_Cilk_for} have been
2083 implemented.
2084
2085 @item -fgnu-tm
2086 @opindex fgnu-tm
2087 When the option @option{-fgnu-tm} is specified, the compiler
2088 generates code for the Linux variant of Intel's current Transactional
2089 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2090 an experimental feature whose interface may change in future versions
2091 of GCC, as the official specification changes. Please note that not
2092 all architectures are supported for this feature.
2093
2094 For more information on GCC's support for transactional memory,
2095 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2096 Transactional Memory Library}.
2097
2098 Note that the transactional memory feature is not supported with
2099 non-call exceptions (@option{-fnon-call-exceptions}).
2100
2101 @item -fms-extensions
2102 @opindex fms-extensions
2103 Accept some non-standard constructs used in Microsoft header files.
2104
2105 In C++ code, this allows member names in structures to be similar
2106 to previous types declarations.
2107
2108 @smallexample
2109 typedef int UOW;
2110 struct ABC @{
2111 UOW UOW;
2112 @};
2113 @end smallexample
2114
2115 Some cases of unnamed fields in structures and unions are only
2116 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2117 fields within structs/unions}, for details.
2118
2119 Note that this option is off for all targets but x86
2120 targets using ms-abi.
2121
2122 @item -fplan9-extensions
2123 @opindex fplan9-extensions
2124 Accept some non-standard constructs used in Plan 9 code.
2125
2126 This enables @option{-fms-extensions}, permits passing pointers to
2127 structures with anonymous fields to functions that expect pointers to
2128 elements of the type of the field, and permits referring to anonymous
2129 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2130 struct/union fields within structs/unions}, for details. This is only
2131 supported for C, not C++.
2132
2133 @item -fcond-mismatch
2134 @opindex fcond-mismatch
2135 Allow conditional expressions with mismatched types in the second and
2136 third arguments. The value of such an expression is void. This option
2137 is not supported for C++.
2138
2139 @item -flax-vector-conversions
2140 @opindex flax-vector-conversions
2141 Allow implicit conversions between vectors with differing numbers of
2142 elements and/or incompatible element types. This option should not be
2143 used for new code.
2144
2145 @item -funsigned-char
2146 @opindex funsigned-char
2147 Let the type @code{char} be unsigned, like @code{unsigned char}.
2148
2149 Each kind of machine has a default for what @code{char} should
2150 be. It is either like @code{unsigned char} by default or like
2151 @code{signed char} by default.
2152
2153 Ideally, a portable program should always use @code{signed char} or
2154 @code{unsigned char} when it depends on the signedness of an object.
2155 But many programs have been written to use plain @code{char} and
2156 expect it to be signed, or expect it to be unsigned, depending on the
2157 machines they were written for. This option, and its inverse, let you
2158 make such a program work with the opposite default.
2159
2160 The type @code{char} is always a distinct type from each of
2161 @code{signed char} or @code{unsigned char}, even though its behavior
2162 is always just like one of those two.
2163
2164 @item -fsigned-char
2165 @opindex fsigned-char
2166 Let the type @code{char} be signed, like @code{signed char}.
2167
2168 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2169 the negative form of @option{-funsigned-char}. Likewise, the option
2170 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2171
2172 @item -fsigned-bitfields
2173 @itemx -funsigned-bitfields
2174 @itemx -fno-signed-bitfields
2175 @itemx -fno-unsigned-bitfields
2176 @opindex fsigned-bitfields
2177 @opindex funsigned-bitfields
2178 @opindex fno-signed-bitfields
2179 @opindex fno-unsigned-bitfields
2180 These options control whether a bit-field is signed or unsigned, when the
2181 declaration does not use either @code{signed} or @code{unsigned}. By
2182 default, such a bit-field is signed, because this is consistent: the
2183 basic integer types such as @code{int} are signed types.
2184
2185 @item -fsso-struct=@var{endianness}
2186 @opindex fsso-struct
2187 Set the default scalar storage order of structures and unions to the
2188 specified endianness. The accepted values are @samp{big-endian},
2189 @samp{little-endian} and @samp{native} for the native endianness of
2190 the target (the default). This option is not supported for C++.
2191
2192 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2193 code that is not binary compatible with code generated without it if the
2194 specified endianness is not the native endianness of the target.
2195 @end table
2196
2197 @node C++ Dialect Options
2198 @section Options Controlling C++ Dialect
2199
2200 @cindex compiler options, C++
2201 @cindex C++ options, command-line
2202 @cindex options, C++
2203 This section describes the command-line options that are only meaningful
2204 for C++ programs. You can also use most of the GNU compiler options
2205 regardless of what language your program is in. For example, you
2206 might compile a file @file{firstClass.C} like this:
2207
2208 @smallexample
2209 g++ -g -fstrict-enums -O -c firstClass.C
2210 @end smallexample
2211
2212 @noindent
2213 In this example, only @option{-fstrict-enums} is an option meant
2214 only for C++ programs; you can use the other options with any
2215 language supported by GCC@.
2216
2217 Some options for compiling C programs, such as @option{-std}, are also
2218 relevant for C++ programs.
2219 @xref{C Dialect Options,,Options Controlling C Dialect}.
2220
2221 Here is a list of options that are @emph{only} for compiling C++ programs:
2222
2223 @table @gcctabopt
2224
2225 @item -fabi-version=@var{n}
2226 @opindex fabi-version
2227 Use version @var{n} of the C++ ABI@. The default is version 0.
2228
2229 Version 0 refers to the version conforming most closely to
2230 the C++ ABI specification. Therefore, the ABI obtained using version 0
2231 will change in different versions of G++ as ABI bugs are fixed.
2232
2233 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2234
2235 Version 2 is the version of the C++ ABI that first appeared in G++
2236 3.4, and was the default through G++ 4.9.
2237
2238 Version 3 corrects an error in mangling a constant address as a
2239 template argument.
2240
2241 Version 4, which first appeared in G++ 4.5, implements a standard
2242 mangling for vector types.
2243
2244 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2245 attribute const/volatile on function pointer types, decltype of a
2246 plain decl, and use of a function parameter in the declaration of
2247 another parameter.
2248
2249 Version 6, which first appeared in G++ 4.7, corrects the promotion
2250 behavior of C++11 scoped enums and the mangling of template argument
2251 packs, const/static_cast, prefix ++ and --, and a class scope function
2252 used as a template argument.
2253
2254 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2255 builtin type and corrects the mangling of lambdas in default argument
2256 scope.
2257
2258 Version 8, which first appeared in G++ 4.9, corrects the substitution
2259 behavior of function types with function-cv-qualifiers.
2260
2261 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2262 @code{nullptr_t}.
2263
2264 Version 10, which first appeared in G++ 6.1, adds mangling of
2265 attributes that affect type identity, such as ia32 calling convention
2266 attributes (e.g. @samp{stdcall}).
2267
2268 Version 11, which first appeared in G++ 7, corrects the mangling of
2269 sizeof... expressions and operator names. For multiple entities with
2270 the same name within a function, that are declared in different scopes,
2271 the mangling now changes starting with the twelfth occurrence. It also
2272 implies @option{-fnew-inheriting-ctors}.
2273
2274 See also @option{-Wabi}.
2275
2276 @item -fabi-compat-version=@var{n}
2277 @opindex fabi-compat-version
2278 On targets that support strong aliases, G++
2279 works around mangling changes by creating an alias with the correct
2280 mangled name when defining a symbol with an incorrect mangled name.
2281 This switch specifies which ABI version to use for the alias.
2282
2283 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2284 compatibility). If another ABI version is explicitly selected, this
2285 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2286 use @option{-fabi-compat-version=2}.
2287
2288 If this option is not provided but @option{-Wabi=@var{n}} is, that
2289 version is used for compatibility aliases. If this option is provided
2290 along with @option{-Wabi} (without the version), the version from this
2291 option is used for the warning.
2292
2293 @item -fno-access-control
2294 @opindex fno-access-control
2295 Turn off all access checking. This switch is mainly useful for working
2296 around bugs in the access control code.
2297
2298 @item -faligned-new
2299 @opindex faligned-new
2300 Enable support for C++17 @code{new} of types that require more
2301 alignment than @code{void* ::operator new(std::size_t)} provides. A
2302 numeric argument such as @code{-faligned-new=32} can be used to
2303 specify how much alignment (in bytes) is provided by that function,
2304 but few users will need to override the default of
2305 @code{alignof(std::max_align_t)}.
2306
2307 This flag is enabled by default for @option{-std=c++1z}.
2308
2309 @item -fcheck-new
2310 @opindex fcheck-new
2311 Check that the pointer returned by @code{operator new} is non-null
2312 before attempting to modify the storage allocated. This check is
2313 normally unnecessary because the C++ standard specifies that
2314 @code{operator new} only returns @code{0} if it is declared
2315 @code{throw()}, in which case the compiler always checks the
2316 return value even without this option. In all other cases, when
2317 @code{operator new} has a non-empty exception specification, memory
2318 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2319 @samp{new (nothrow)}.
2320
2321 @item -fconcepts
2322 @opindex fconcepts
2323 Enable support for the C++ Extensions for Concepts Technical
2324 Specification, ISO 19217 (2015), which allows code like
2325
2326 @smallexample
2327 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2328 template <Addable T> T add (T a, T b) @{ return a + b; @}
2329 @end smallexample
2330
2331 @item -fconstexpr-depth=@var{n}
2332 @opindex fconstexpr-depth
2333 Set the maximum nested evaluation depth for C++11 constexpr functions
2334 to @var{n}. A limit is needed to detect endless recursion during
2335 constant expression evaluation. The minimum specified by the standard
2336 is 512.
2337
2338 @item -fconstexpr-loop-limit=@var{n}
2339 @opindex fconstexpr-loop-limit
2340 Set the maximum number of iterations for a loop in C++14 constexpr functions
2341 to @var{n}. A limit is needed to detect infinite loops during
2342 constant expression evaluation. The default is 262144 (1<<18).
2343
2344 @item -fdeduce-init-list
2345 @opindex fdeduce-init-list
2346 Enable deduction of a template type parameter as
2347 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2348
2349 @smallexample
2350 template <class T> auto forward(T t) -> decltype (realfn (t))
2351 @{
2352 return realfn (t);
2353 @}
2354
2355 void f()
2356 @{
2357 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2358 @}
2359 @end smallexample
2360
2361 This deduction was implemented as a possible extension to the
2362 originally proposed semantics for the C++11 standard, but was not part
2363 of the final standard, so it is disabled by default. This option is
2364 deprecated, and may be removed in a future version of G++.
2365
2366 @item -ffriend-injection
2367 @opindex ffriend-injection
2368 Inject friend functions into the enclosing namespace, so that they are
2369 visible outside the scope of the class in which they are declared.
2370 Friend functions were documented to work this way in the old Annotated
2371 C++ Reference Manual.
2372 However, in ISO C++ a friend function that is not declared
2373 in an enclosing scope can only be found using argument dependent
2374 lookup. GCC defaults to the standard behavior.
2375
2376 This option is for compatibility, and may be removed in a future
2377 release of G++.
2378
2379 @item -fno-elide-constructors
2380 @opindex fno-elide-constructors
2381 The C++ standard allows an implementation to omit creating a temporary
2382 that is only used to initialize another object of the same type.
2383 Specifying this option disables that optimization, and forces G++ to
2384 call the copy constructor in all cases. This option also causes G++
2385 to call trivial member functions which otherwise would be expanded inline.
2386
2387 In C++17, the compiler is required to omit these temporaries, but this
2388 option still affects trivial member functions.
2389
2390 @item -fno-enforce-eh-specs
2391 @opindex fno-enforce-eh-specs
2392 Don't generate code to check for violation of exception specifications
2393 at run time. This option violates the C++ standard, but may be useful
2394 for reducing code size in production builds, much like defining
2395 @code{NDEBUG}. This does not give user code permission to throw
2396 exceptions in violation of the exception specifications; the compiler
2397 still optimizes based on the specifications, so throwing an
2398 unexpected exception results in undefined behavior at run time.
2399
2400 @item -fextern-tls-init
2401 @itemx -fno-extern-tls-init
2402 @opindex fextern-tls-init
2403 @opindex fno-extern-tls-init
2404 The C++11 and OpenMP standards allow @code{thread_local} and
2405 @code{threadprivate} variables to have dynamic (runtime)
2406 initialization. To support this, any use of such a variable goes
2407 through a wrapper function that performs any necessary initialization.
2408 When the use and definition of the variable are in the same
2409 translation unit, this overhead can be optimized away, but when the
2410 use is in a different translation unit there is significant overhead
2411 even if the variable doesn't actually need dynamic initialization. If
2412 the programmer can be sure that no use of the variable in a
2413 non-defining TU needs to trigger dynamic initialization (either
2414 because the variable is statically initialized, or a use of the
2415 variable in the defining TU will be executed before any uses in
2416 another TU), they can avoid this overhead with the
2417 @option{-fno-extern-tls-init} option.
2418
2419 On targets that support symbol aliases, the default is
2420 @option{-fextern-tls-init}. On targets that do not support symbol
2421 aliases, the default is @option{-fno-extern-tls-init}.
2422
2423 @item -ffor-scope
2424 @itemx -fno-for-scope
2425 @opindex ffor-scope
2426 @opindex fno-for-scope
2427 If @option{-ffor-scope} is specified, the scope of variables declared in
2428 a @i{for-init-statement} is limited to the @code{for} loop itself,
2429 as specified by the C++ standard.
2430 If @option{-fno-for-scope} is specified, the scope of variables declared in
2431 a @i{for-init-statement} extends to the end of the enclosing scope,
2432 as was the case in old versions of G++, and other (traditional)
2433 implementations of C++.
2434
2435 If neither flag is given, the default is to follow the standard,
2436 but to allow and give a warning for old-style code that would
2437 otherwise be invalid, or have different behavior.
2438
2439 @item -fno-gnu-keywords
2440 @opindex fno-gnu-keywords
2441 Do not recognize @code{typeof} as a keyword, so that code can use this
2442 word as an identifier. You can use the keyword @code{__typeof__} instead.
2443 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2444 @option{-std=c++98}, @option{-std=c++11}, etc.
2445
2446 @item -fno-implicit-templates
2447 @opindex fno-implicit-templates
2448 Never emit code for non-inline templates that are instantiated
2449 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2450 @xref{Template Instantiation}, for more information.
2451
2452 @item -fno-implicit-inline-templates
2453 @opindex fno-implicit-inline-templates
2454 Don't emit code for implicit instantiations of inline templates, either.
2455 The default is to handle inlines differently so that compiles with and
2456 without optimization need the same set of explicit instantiations.
2457
2458 @item -fno-implement-inlines
2459 @opindex fno-implement-inlines
2460 To save space, do not emit out-of-line copies of inline functions
2461 controlled by @code{#pragma implementation}. This causes linker
2462 errors if these functions are not inlined everywhere they are called.
2463
2464 @item -fms-extensions
2465 @opindex fms-extensions
2466 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2467 int and getting a pointer to member function via non-standard syntax.
2468
2469 @item -fnew-inheriting-ctors
2470 @opindex fnew-inheriting-ctors
2471 Enable the P0136 adjustment to the semantics of C++11 constructor
2472 inheritance. This is part of C++17 but also considered to be a Defect
2473 Report against C++11 and C++14. This flag is enabled by default
2474 unless @option{-fabi-version=10} or lower is specified.
2475
2476 @item -fnew-ttp-matching
2477 @opindex fnew-ttp-matching
2478 Enable the P0522 resolution to Core issue 150, template template
2479 parameters and default arguments: this allows a template with default
2480 template arguments as an argument for a template template parameter
2481 with fewer template parameters. This flag is enabled by default for
2482 @option{-std=c++1z}.
2483
2484 @item -fno-nonansi-builtins
2485 @opindex fno-nonansi-builtins
2486 Disable built-in declarations of functions that are not mandated by
2487 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2488 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2489
2490 @item -fnothrow-opt
2491 @opindex fnothrow-opt
2492 Treat a @code{throw()} exception specification as if it were a
2493 @code{noexcept} specification to reduce or eliminate the text size
2494 overhead relative to a function with no exception specification. If
2495 the function has local variables of types with non-trivial
2496 destructors, the exception specification actually makes the
2497 function smaller because the EH cleanups for those variables can be
2498 optimized away. The semantic effect is that an exception thrown out of
2499 a function with such an exception specification results in a call
2500 to @code{terminate} rather than @code{unexpected}.
2501
2502 @item -fno-operator-names
2503 @opindex fno-operator-names
2504 Do not treat the operator name keywords @code{and}, @code{bitand},
2505 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2506 synonyms as keywords.
2507
2508 @item -fno-optional-diags
2509 @opindex fno-optional-diags
2510 Disable diagnostics that the standard says a compiler does not need to
2511 issue. Currently, the only such diagnostic issued by G++ is the one for
2512 a name having multiple meanings within a class.
2513
2514 @item -fpermissive
2515 @opindex fpermissive
2516 Downgrade some diagnostics about nonconformant code from errors to
2517 warnings. Thus, using @option{-fpermissive} allows some
2518 nonconforming code to compile.
2519
2520 @item -fno-pretty-templates
2521 @opindex fno-pretty-templates
2522 When an error message refers to a specialization of a function
2523 template, the compiler normally prints the signature of the
2524 template followed by the template arguments and any typedefs or
2525 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2526 rather than @code{void f(int)}) so that it's clear which template is
2527 involved. When an error message refers to a specialization of a class
2528 template, the compiler omits any template arguments that match
2529 the default template arguments for that template. If either of these
2530 behaviors make it harder to understand the error message rather than
2531 easier, you can use @option{-fno-pretty-templates} to disable them.
2532
2533 @item -frepo
2534 @opindex frepo
2535 Enable automatic template instantiation at link time. This option also
2536 implies @option{-fno-implicit-templates}. @xref{Template
2537 Instantiation}, for more information.
2538
2539 @item -fno-rtti
2540 @opindex fno-rtti
2541 Disable generation of information about every class with virtual
2542 functions for use by the C++ run-time type identification features
2543 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2544 of the language, you can save some space by using this flag. Note that
2545 exception handling uses the same information, but G++ generates it as
2546 needed. The @code{dynamic_cast} operator can still be used for casts that
2547 do not require run-time type information, i.e.@: casts to @code{void *} or to
2548 unambiguous base classes.
2549
2550 @item -fsized-deallocation
2551 @opindex fsized-deallocation
2552 Enable the built-in global declarations
2553 @smallexample
2554 void operator delete (void *, std::size_t) noexcept;
2555 void operator delete[] (void *, std::size_t) noexcept;
2556 @end smallexample
2557 as introduced in C++14. This is useful for user-defined replacement
2558 deallocation functions that, for example, use the size of the object
2559 to make deallocation faster. Enabled by default under
2560 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2561 warns about places that might want to add a definition.
2562
2563 @item -fstrict-enums
2564 @opindex fstrict-enums
2565 Allow the compiler to optimize using the assumption that a value of
2566 enumerated type can only be one of the values of the enumeration (as
2567 defined in the C++ standard; basically, a value that can be
2568 represented in the minimum number of bits needed to represent all the
2569 enumerators). This assumption may not be valid if the program uses a
2570 cast to convert an arbitrary integer value to the enumerated type.
2571
2572 @item -fstrong-eval-order
2573 @opindex fstrong-eval-order
2574 Evaluate member access, array subscripting, and shift expressions in
2575 left-to-right order, and evaluate assignment in right-to-left order,
2576 as adopted for C++17. Enabled by default with @option{-std=c++1z}.
2577 @option{-fstrong-eval-order=some} enables just the ordering of member
2578 access and shift expressions, and is the default without
2579 @option{-std=c++1z}.
2580
2581 @item -ftemplate-backtrace-limit=@var{n}
2582 @opindex ftemplate-backtrace-limit
2583 Set the maximum number of template instantiation notes for a single
2584 warning or error to @var{n}. The default value is 10.
2585
2586 @item -ftemplate-depth=@var{n}
2587 @opindex ftemplate-depth
2588 Set the maximum instantiation depth for template classes to @var{n}.
2589 A limit on the template instantiation depth is needed to detect
2590 endless recursions during template class instantiation. ANSI/ISO C++
2591 conforming programs must not rely on a maximum depth greater than 17
2592 (changed to 1024 in C++11). The default value is 900, as the compiler
2593 can run out of stack space before hitting 1024 in some situations.
2594
2595 @item -fno-threadsafe-statics
2596 @opindex fno-threadsafe-statics
2597 Do not emit the extra code to use the routines specified in the C++
2598 ABI for thread-safe initialization of local statics. You can use this
2599 option to reduce code size slightly in code that doesn't need to be
2600 thread-safe.
2601
2602 @item -fuse-cxa-atexit
2603 @opindex fuse-cxa-atexit
2604 Register destructors for objects with static storage duration with the
2605 @code{__cxa_atexit} function rather than the @code{atexit} function.
2606 This option is required for fully standards-compliant handling of static
2607 destructors, but only works if your C library supports
2608 @code{__cxa_atexit}.
2609
2610 @item -fno-use-cxa-get-exception-ptr
2611 @opindex fno-use-cxa-get-exception-ptr
2612 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2613 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2614 if the runtime routine is not available.
2615
2616 @item -fvisibility-inlines-hidden
2617 @opindex fvisibility-inlines-hidden
2618 This switch declares that the user does not attempt to compare
2619 pointers to inline functions or methods where the addresses of the two functions
2620 are taken in different shared objects.
2621
2622 The effect of this is that GCC may, effectively, mark inline methods with
2623 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2624 appear in the export table of a DSO and do not require a PLT indirection
2625 when used within the DSO@. Enabling this option can have a dramatic effect
2626 on load and link times of a DSO as it massively reduces the size of the
2627 dynamic export table when the library makes heavy use of templates.
2628
2629 The behavior of this switch is not quite the same as marking the
2630 methods as hidden directly, because it does not affect static variables
2631 local to the function or cause the compiler to deduce that
2632 the function is defined in only one shared object.
2633
2634 You may mark a method as having a visibility explicitly to negate the
2635 effect of the switch for that method. For example, if you do want to
2636 compare pointers to a particular inline method, you might mark it as
2637 having default visibility. Marking the enclosing class with explicit
2638 visibility has no effect.
2639
2640 Explicitly instantiated inline methods are unaffected by this option
2641 as their linkage might otherwise cross a shared library boundary.
2642 @xref{Template Instantiation}.
2643
2644 @item -fvisibility-ms-compat
2645 @opindex fvisibility-ms-compat
2646 This flag attempts to use visibility settings to make GCC's C++
2647 linkage model compatible with that of Microsoft Visual Studio.
2648
2649 The flag makes these changes to GCC's linkage model:
2650
2651 @enumerate
2652 @item
2653 It sets the default visibility to @code{hidden}, like
2654 @option{-fvisibility=hidden}.
2655
2656 @item
2657 Types, but not their members, are not hidden by default.
2658
2659 @item
2660 The One Definition Rule is relaxed for types without explicit
2661 visibility specifications that are defined in more than one
2662 shared object: those declarations are permitted if they are
2663 permitted when this option is not used.
2664 @end enumerate
2665
2666 In new code it is better to use @option{-fvisibility=hidden} and
2667 export those classes that are intended to be externally visible.
2668 Unfortunately it is possible for code to rely, perhaps accidentally,
2669 on the Visual Studio behavior.
2670
2671 Among the consequences of these changes are that static data members
2672 of the same type with the same name but defined in different shared
2673 objects are different, so changing one does not change the other;
2674 and that pointers to function members defined in different shared
2675 objects may not compare equal. When this flag is given, it is a
2676 violation of the ODR to define types with the same name differently.
2677
2678 @item -fno-weak
2679 @opindex fno-weak
2680 Do not use weak symbol support, even if it is provided by the linker.
2681 By default, G++ uses weak symbols if they are available. This
2682 option exists only for testing, and should not be used by end-users;
2683 it results in inferior code and has no benefits. This option may
2684 be removed in a future release of G++.
2685
2686 @item -nostdinc++
2687 @opindex nostdinc++
2688 Do not search for header files in the standard directories specific to
2689 C++, but do still search the other standard directories. (This option
2690 is used when building the C++ library.)
2691 @end table
2692
2693 In addition, these optimization, warning, and code generation options
2694 have meanings only for C++ programs:
2695
2696 @table @gcctabopt
2697 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2698 @opindex Wabi
2699 @opindex Wno-abi
2700 Warn when G++ it generates code that is probably not compatible with
2701 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2702 ABI with each major release, normally @option{-Wabi} will warn only if
2703 there is a check added later in a release series for an ABI issue
2704 discovered since the initial release. @option{-Wabi} will warn about
2705 more things if an older ABI version is selected (with
2706 @option{-fabi-version=@var{n}}).
2707
2708 @option{-Wabi} can also be used with an explicit version number to
2709 warn about compatibility with a particular @option{-fabi-version}
2710 level, e.g. @option{-Wabi=2} to warn about changes relative to
2711 @option{-fabi-version=2}.
2712
2713 If an explicit version number is provided and
2714 @option{-fabi-compat-version} is not specified, the version number
2715 from this option is used for compatibility aliases. If no explicit
2716 version number is provided with this option, but
2717 @option{-fabi-compat-version} is specified, that version number is
2718 used for ABI warnings.
2719
2720 Although an effort has been made to warn about
2721 all such cases, there are probably some cases that are not warned about,
2722 even though G++ is generating incompatible code. There may also be
2723 cases where warnings are emitted even though the code that is generated
2724 is compatible.
2725
2726 You should rewrite your code to avoid these warnings if you are
2727 concerned about the fact that code generated by G++ may not be binary
2728 compatible with code generated by other compilers.
2729
2730 Known incompatibilities in @option{-fabi-version=2} (which was the
2731 default from GCC 3.4 to 4.9) include:
2732
2733 @itemize @bullet
2734
2735 @item
2736 A template with a non-type template parameter of reference type was
2737 mangled incorrectly:
2738 @smallexample
2739 extern int N;
2740 template <int &> struct S @{@};
2741 void n (S<N>) @{2@}
2742 @end smallexample
2743
2744 This was fixed in @option{-fabi-version=3}.
2745
2746 @item
2747 SIMD vector types declared using @code{__attribute ((vector_size))} were
2748 mangled in a non-standard way that does not allow for overloading of
2749 functions taking vectors of different sizes.
2750
2751 The mangling was changed in @option{-fabi-version=4}.
2752
2753 @item
2754 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2755 qualifiers, and @code{decltype} of a plain declaration was folded away.
2756
2757 These mangling issues were fixed in @option{-fabi-version=5}.
2758
2759 @item
2760 Scoped enumerators passed as arguments to a variadic function are
2761 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2762 On most targets this does not actually affect the parameter passing
2763 ABI, as there is no way to pass an argument smaller than @code{int}.
2764
2765 Also, the ABI changed the mangling of template argument packs,
2766 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2767 a class scope function used as a template argument.
2768
2769 These issues were corrected in @option{-fabi-version=6}.
2770
2771 @item
2772 Lambdas in default argument scope were mangled incorrectly, and the
2773 ABI changed the mangling of @code{nullptr_t}.
2774
2775 These issues were corrected in @option{-fabi-version=7}.
2776
2777 @item
2778 When mangling a function type with function-cv-qualifiers, the
2779 un-qualified function type was incorrectly treated as a substitution
2780 candidate.
2781
2782 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2783
2784 @item
2785 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2786 unaligned accesses. Note that this did not affect the ABI of a
2787 function with a @code{nullptr_t} parameter, as parameters have a
2788 minimum alignment.
2789
2790 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2791
2792 @item
2793 Target-specific attributes that affect the identity of a type, such as
2794 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2795 did not affect the mangled name, leading to name collisions when
2796 function pointers were used as template arguments.
2797
2798 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2799
2800 @end itemize
2801
2802 It also warns about psABI-related changes. The known psABI changes at this
2803 point include:
2804
2805 @itemize @bullet
2806
2807 @item
2808 For SysV/x86-64, unions with @code{long double} members are
2809 passed in memory as specified in psABI. For example:
2810
2811 @smallexample
2812 union U @{
2813 long double ld;
2814 int i;
2815 @};
2816 @end smallexample
2817
2818 @noindent
2819 @code{union U} is always passed in memory.
2820
2821 @end itemize
2822
2823 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2824 @opindex Wabi-tag
2825 @opindex -Wabi-tag
2826 Warn when a type with an ABI tag is used in a context that does not
2827 have that ABI tag. See @ref{C++ Attributes} for more information
2828 about ABI tags.
2829
2830 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2831 @opindex Wctor-dtor-privacy
2832 @opindex Wno-ctor-dtor-privacy
2833 Warn when a class seems unusable because all the constructors or
2834 destructors in that class are private, and it has neither friends nor
2835 public static member functions. Also warn if there are no non-private
2836 methods, and there's at least one private member function that isn't
2837 a constructor or destructor.
2838
2839 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2840 @opindex Wdelete-non-virtual-dtor
2841 @opindex Wno-delete-non-virtual-dtor
2842 Warn when @code{delete} is used to destroy an instance of a class that
2843 has virtual functions and non-virtual destructor. It is unsafe to delete
2844 an instance of a derived class through a pointer to a base class if the
2845 base class does not have a virtual destructor. This warning is enabled
2846 by @option{-Wall}.
2847
2848 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2849 @opindex Wliteral-suffix
2850 @opindex Wno-literal-suffix
2851 Warn when a string or character literal is followed by a ud-suffix which does
2852 not begin with an underscore. As a conforming extension, GCC treats such
2853 suffixes as separate preprocessing tokens in order to maintain backwards
2854 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2855 For example:
2856
2857 @smallexample
2858 #define __STDC_FORMAT_MACROS
2859 #include <inttypes.h>
2860 #include <stdio.h>
2861
2862 int main() @{
2863 int64_t i64 = 123;
2864 printf("My int64: %" PRId64"\n", i64);
2865 @}
2866 @end smallexample
2867
2868 In this case, @code{PRId64} is treated as a separate preprocessing token.
2869
2870 Additionally, warn when a user-defined literal operator is declared with
2871 a literal suffix identifier that doesn't begin with an underscore. Literal
2872 suffix identifiers that don't begin with an underscore are reserved for
2873 future standardization.
2874
2875 This warning is enabled by default.
2876
2877 @item -Wlto-type-mismatch
2878 @opindex Wlto-type-mismatch
2879 @opindex Wno-lto-type-mismatch
2880
2881 During the link-time optimization warn about type mismatches in
2882 global declarations from different compilation units.
2883 Requires @option{-flto} to be enabled. Enabled by default.
2884
2885 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
2886 @opindex Wnarrowing
2887 @opindex Wno-narrowing
2888 For C++11 and later standards, narrowing conversions are diagnosed by default,
2889 as required by the standard. A narrowing conversion from a constant produces
2890 an error, and a narrowing conversion from a non-constant produces a warning,
2891 but @option{-Wno-narrowing} suppresses the diagnostic.
2892 Note that this does not affect the meaning of well-formed code;
2893 narrowing conversions are still considered ill-formed in SFINAE contexts.
2894
2895 With @option{-Wnarrowing} in C++98, warn when a narrowing
2896 conversion prohibited by C++11 occurs within
2897 @samp{@{ @}}, e.g.
2898
2899 @smallexample
2900 int i = @{ 2.2 @}; // error: narrowing from double to int
2901 @end smallexample
2902
2903 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2904
2905 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2906 @opindex Wnoexcept
2907 @opindex Wno-noexcept
2908 Warn when a noexcept-expression evaluates to false because of a call
2909 to a function that does not have a non-throwing exception
2910 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2911 the compiler to never throw an exception.
2912
2913 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
2914 @opindex Wnoexcept-type
2915 @opindex Wno-noexcept-type
2916 Warn if the C++1z feature making @code{noexcept} part of a function
2917 type changes the mangled name of a symbol relative to C++14. Enabled
2918 by @option{-Wabi} and @option{-Wc++1z-compat}.
2919
2920 @smallexample
2921 template <class T> void f(T t) @{ t(); @};
2922 void g() noexcept;
2923 void h() @{ f(g); @} // in C++14 calls f<void(*)()>, in C++1z calls f<void(*)()noexcept>
2924 @end smallexample
2925
2926 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
2927 @opindex Wclass-memaccess
2928 Warn when the destination of a call to a raw memory function such as
2929 @code{memset} or @code{memcpy} is an object of class type writing into which
2930 might bypass the class non-trivial or deleted constructor or copy assignment,
2931 violate const-correctness or encapsulation, or corrupt the virtual table.
2932 Modifying the representation of such objects may violate invariants maintained
2933 by member functions of the class. For example, the call to @code{memset}
2934 below is undefined becase it modifies a non-trivial class object and is,
2935 therefore, diagnosed. The safe way to either initialize or clear the storage
2936 of objects of such types is by using the appropriate constructor or assignment
2937 operator, if one is available.
2938 @smallexample
2939 std::string str = "abc";
2940 memset (&str, 0, 3);
2941 @end smallexample
2942 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
2943
2944 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2945 @opindex Wnon-virtual-dtor
2946 @opindex Wno-non-virtual-dtor
2947 Warn when a class has virtual functions and an accessible non-virtual
2948 destructor itself or in an accessible polymorphic base class, in which
2949 case it is possible but unsafe to delete an instance of a derived
2950 class through a pointer to the class itself or base class. This
2951 warning is automatically enabled if @option{-Weffc++} is specified.
2952
2953 @item -Wregister @r{(C++ and Objective-C++ only)}
2954 @opindex Wregister
2955 @opindex Wno-register
2956 Warn on uses of the @code{register} storage class specifier, except
2957 when it is part of the GNU @ref{Explicit Register Variables} extension.
2958 The use of the @code{register} keyword as storage class specifier has
2959 been deprecated in C++11 and removed in C++17.
2960 Enabled by default with @option{-std=c++1z}.
2961
2962 @item -Wreorder @r{(C++ and Objective-C++ only)}
2963 @opindex Wreorder
2964 @opindex Wno-reorder
2965 @cindex reordering, warning
2966 @cindex warning for reordering of member initializers
2967 Warn when the order of member initializers given in the code does not
2968 match the order in which they must be executed. For instance:
2969
2970 @smallexample
2971 struct A @{
2972 int i;
2973 int j;
2974 A(): j (0), i (1) @{ @}
2975 @};
2976 @end smallexample
2977
2978 @noindent
2979 The compiler rearranges the member initializers for @code{i}
2980 and @code{j} to match the declaration order of the members, emitting
2981 a warning to that effect. This warning is enabled by @option{-Wall}.
2982
2983 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2984 @opindex fext-numeric-literals
2985 @opindex fno-ext-numeric-literals
2986 Accept imaginary, fixed-point, or machine-defined
2987 literal number suffixes as GNU extensions.
2988 When this option is turned off these suffixes are treated
2989 as C++11 user-defined literal numeric suffixes.
2990 This is on by default for all pre-C++11 dialects and all GNU dialects:
2991 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2992 @option{-std=gnu++14}.
2993 This option is off by default
2994 for ISO C++11 onwards (@option{-std=c++11}, ...).
2995 @end table
2996
2997 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2998
2999 @table @gcctabopt
3000 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3001 @opindex Weffc++
3002 @opindex Wno-effc++
3003 Warn about violations of the following style guidelines from Scott Meyers'
3004 @cite{Effective C++} series of books:
3005
3006 @itemize @bullet
3007 @item
3008 Define a copy constructor and an assignment operator for classes
3009 with dynamically-allocated memory.
3010
3011 @item
3012 Prefer initialization to assignment in constructors.
3013
3014 @item
3015 Have @code{operator=} return a reference to @code{*this}.
3016
3017 @item
3018 Don't try to return a reference when you must return an object.
3019
3020 @item
3021 Distinguish between prefix and postfix forms of increment and
3022 decrement operators.
3023
3024 @item
3025 Never overload @code{&&}, @code{||}, or @code{,}.
3026
3027 @end itemize
3028
3029 This option also enables @option{-Wnon-virtual-dtor}, which is also
3030 one of the effective C++ recommendations. However, the check is
3031 extended to warn about the lack of virtual destructor in accessible
3032 non-polymorphic bases classes too.
3033
3034 When selecting this option, be aware that the standard library
3035 headers do not obey all of these guidelines; use @samp{grep -v}
3036 to filter out those warnings.
3037
3038 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3039 @opindex Wstrict-null-sentinel
3040 @opindex Wno-strict-null-sentinel
3041 Warn about the use of an uncasted @code{NULL} as sentinel. When
3042 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3043 to @code{__null}. Although it is a null pointer constant rather than a
3044 null pointer, it is guaranteed to be of the same size as a pointer.
3045 But this use is not portable across different compilers.
3046
3047 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3048 @opindex Wno-non-template-friend
3049 @opindex Wnon-template-friend
3050 Disable warnings when non-template friend functions are declared
3051 within a template. In very old versions of GCC that predate implementation
3052 of the ISO standard, declarations such as
3053 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3054 could be interpreted as a particular specialization of a template
3055 function; the warning exists to diagnose compatibility problems,
3056 and is enabled by default.
3057
3058 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3059 @opindex Wold-style-cast
3060 @opindex Wno-old-style-cast
3061 Warn if an old-style (C-style) cast to a non-void type is used within
3062 a C++ program. The new-style casts (@code{dynamic_cast},
3063 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3064 less vulnerable to unintended effects and much easier to search for.
3065
3066 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3067 @opindex Woverloaded-virtual
3068 @opindex Wno-overloaded-virtual
3069 @cindex overloaded virtual function, warning
3070 @cindex warning for overloaded virtual function
3071 Warn when a function declaration hides virtual functions from a
3072 base class. For example, in:
3073
3074 @smallexample
3075 struct A @{
3076 virtual void f();
3077 @};
3078
3079 struct B: public A @{
3080 void f(int);
3081 @};
3082 @end smallexample
3083
3084 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3085 like:
3086
3087 @smallexample
3088 B* b;
3089 b->f();
3090 @end smallexample
3091
3092 @noindent
3093 fails to compile.
3094
3095 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3096 @opindex Wno-pmf-conversions
3097 @opindex Wpmf-conversions
3098 Disable the diagnostic for converting a bound pointer to member function
3099 to a plain pointer.
3100
3101 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3102 @opindex Wsign-promo
3103 @opindex Wno-sign-promo
3104 Warn when overload resolution chooses a promotion from unsigned or
3105 enumerated type to a signed type, over a conversion to an unsigned type of
3106 the same size. Previous versions of G++ tried to preserve
3107 unsignedness, but the standard mandates the current behavior.
3108
3109 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3110 @opindex Wtemplates
3111 Warn when a primary template declaration is encountered. Some coding
3112 rules disallow templates, and this may be used to enforce that rule.
3113 The warning is inactive inside a system header file, such as the STL, so
3114 one can still use the STL. One may also instantiate or specialize
3115 templates.
3116
3117 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3118 @opindex Wmultiple-inheritance
3119 Warn when a class is defined with multiple direct base classes. Some
3120 coding rules disallow multiple inheritance, and this may be used to
3121 enforce that rule. The warning is inactive inside a system header file,
3122 such as the STL, so one can still use the STL. One may also define
3123 classes that indirectly use multiple inheritance.
3124
3125 @item -Wvirtual-inheritance
3126 @opindex Wvirtual-inheritance
3127 Warn when a class is defined with a virtual direct base class. Some
3128 coding rules disallow multiple inheritance, and this may be used to
3129 enforce that rule. The warning is inactive inside a system header file,
3130 such as the STL, so one can still use the STL. One may also define
3131 classes that indirectly use virtual inheritance.
3132
3133 @item -Wnamespaces
3134 @opindex Wnamespaces
3135 Warn when a namespace definition is opened. Some coding rules disallow
3136 namespaces, and this may be used to enforce that rule. The warning is
3137 inactive inside a system header file, such as the STL, so one can still
3138 use the STL. One may also use using directives and qualified names.
3139
3140 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3141 @opindex Wterminate
3142 @opindex Wno-terminate
3143 Disable the warning about a throw-expression that will immediately
3144 result in a call to @code{terminate}.
3145 @end table
3146
3147 @node Objective-C and Objective-C++ Dialect Options
3148 @section Options Controlling Objective-C and Objective-C++ Dialects
3149
3150 @cindex compiler options, Objective-C and Objective-C++
3151 @cindex Objective-C and Objective-C++ options, command-line
3152 @cindex options, Objective-C and Objective-C++
3153 (NOTE: This manual does not describe the Objective-C and Objective-C++
3154 languages themselves. @xref{Standards,,Language Standards
3155 Supported by GCC}, for references.)
3156
3157 This section describes the command-line options that are only meaningful
3158 for Objective-C and Objective-C++ programs. You can also use most of
3159 the language-independent GNU compiler options.
3160 For example, you might compile a file @file{some_class.m} like this:
3161
3162 @smallexample
3163 gcc -g -fgnu-runtime -O -c some_class.m
3164 @end smallexample
3165
3166 @noindent
3167 In this example, @option{-fgnu-runtime} is an option meant only for
3168 Objective-C and Objective-C++ programs; you can use the other options with
3169 any language supported by GCC@.
3170
3171 Note that since Objective-C is an extension of the C language, Objective-C
3172 compilations may also use options specific to the C front-end (e.g.,
3173 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3174 C++-specific options (e.g., @option{-Wabi}).
3175
3176 Here is a list of options that are @emph{only} for compiling Objective-C
3177 and Objective-C++ programs:
3178
3179 @table @gcctabopt
3180 @item -fconstant-string-class=@var{class-name}
3181 @opindex fconstant-string-class
3182 Use @var{class-name} as the name of the class to instantiate for each
3183 literal string specified with the syntax @code{@@"@dots{}"}. The default
3184 class name is @code{NXConstantString} if the GNU runtime is being used, and
3185 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3186 @option{-fconstant-cfstrings} option, if also present, overrides the
3187 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3188 to be laid out as constant CoreFoundation strings.
3189
3190 @item -fgnu-runtime
3191 @opindex fgnu-runtime
3192 Generate object code compatible with the standard GNU Objective-C
3193 runtime. This is the default for most types of systems.
3194
3195 @item -fnext-runtime
3196 @opindex fnext-runtime
3197 Generate output compatible with the NeXT runtime. This is the default
3198 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3199 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3200 used.
3201
3202 @item -fno-nil-receivers
3203 @opindex fno-nil-receivers
3204 Assume that all Objective-C message dispatches (@code{[receiver
3205 message:arg]}) in this translation unit ensure that the receiver is
3206 not @code{nil}. This allows for more efficient entry points in the
3207 runtime to be used. This option is only available in conjunction with
3208 the NeXT runtime and ABI version 0 or 1.
3209
3210 @item -fobjc-abi-version=@var{n}
3211 @opindex fobjc-abi-version
3212 Use version @var{n} of the Objective-C ABI for the selected runtime.
3213 This option is currently supported only for the NeXT runtime. In that
3214 case, Version 0 is the traditional (32-bit) ABI without support for
3215 properties and other Objective-C 2.0 additions. Version 1 is the
3216 traditional (32-bit) ABI with support for properties and other
3217 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3218 nothing is specified, the default is Version 0 on 32-bit target
3219 machines, and Version 2 on 64-bit target machines.
3220
3221 @item -fobjc-call-cxx-cdtors
3222 @opindex fobjc-call-cxx-cdtors
3223 For each Objective-C class, check if any of its instance variables is a
3224 C++ object with a non-trivial default constructor. If so, synthesize a
3225 special @code{- (id) .cxx_construct} instance method which runs
3226 non-trivial default constructors on any such instance variables, in order,
3227 and then return @code{self}. Similarly, check if any instance variable
3228 is a C++ object with a non-trivial destructor, and if so, synthesize a
3229 special @code{- (void) .cxx_destruct} method which runs
3230 all such default destructors, in reverse order.
3231
3232 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3233 methods thusly generated only operate on instance variables
3234 declared in the current Objective-C class, and not those inherited
3235 from superclasses. It is the responsibility of the Objective-C
3236 runtime to invoke all such methods in an object's inheritance
3237 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3238 by the runtime immediately after a new object instance is allocated;
3239 the @code{- (void) .cxx_destruct} methods are invoked immediately
3240 before the runtime deallocates an object instance.
3241
3242 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3243 support for invoking the @code{- (id) .cxx_construct} and
3244 @code{- (void) .cxx_destruct} methods.
3245
3246 @item -fobjc-direct-dispatch
3247 @opindex fobjc-direct-dispatch
3248 Allow fast jumps to the message dispatcher. On Darwin this is
3249 accomplished via the comm page.
3250
3251 @item -fobjc-exceptions
3252 @opindex fobjc-exceptions
3253 Enable syntactic support for structured exception handling in
3254 Objective-C, similar to what is offered by C++. This option
3255 is required to use the Objective-C keywords @code{@@try},
3256 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3257 @code{@@synchronized}. This option is available with both the GNU
3258 runtime and the NeXT runtime (but not available in conjunction with
3259 the NeXT runtime on Mac OS X 10.2 and earlier).
3260
3261 @item -fobjc-gc
3262 @opindex fobjc-gc
3263 Enable garbage collection (GC) in Objective-C and Objective-C++
3264 programs. This option is only available with the NeXT runtime; the
3265 GNU runtime has a different garbage collection implementation that
3266 does not require special compiler flags.
3267
3268 @item -fobjc-nilcheck
3269 @opindex fobjc-nilcheck
3270 For the NeXT runtime with version 2 of the ABI, check for a nil
3271 receiver in method invocations before doing the actual method call.
3272 This is the default and can be disabled using
3273 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3274 checked for nil in this way no matter what this flag is set to.
3275 Currently this flag does nothing when the GNU runtime, or an older
3276 version of the NeXT runtime ABI, is used.
3277
3278 @item -fobjc-std=objc1
3279 @opindex fobjc-std
3280 Conform to the language syntax of Objective-C 1.0, the language
3281 recognized by GCC 4.0. This only affects the Objective-C additions to
3282 the C/C++ language; it does not affect conformance to C/C++ standards,
3283 which is controlled by the separate C/C++ dialect option flags. When
3284 this option is used with the Objective-C or Objective-C++ compiler,
3285 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3286 This is useful if you need to make sure that your Objective-C code can
3287 be compiled with older versions of GCC@.
3288
3289 @item -freplace-objc-classes
3290 @opindex freplace-objc-classes
3291 Emit a special marker instructing @command{ld(1)} not to statically link in
3292 the resulting object file, and allow @command{dyld(1)} to load it in at
3293 run time instead. This is used in conjunction with the Fix-and-Continue
3294 debugging mode, where the object file in question may be recompiled and
3295 dynamically reloaded in the course of program execution, without the need
3296 to restart the program itself. Currently, Fix-and-Continue functionality
3297 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3298 and later.
3299
3300 @item -fzero-link
3301 @opindex fzero-link
3302 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3303 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3304 compile time) with static class references that get initialized at load time,
3305 which improves run-time performance. Specifying the @option{-fzero-link} flag
3306 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3307 to be retained. This is useful in Zero-Link debugging mode, since it allows
3308 for individual class implementations to be modified during program execution.
3309 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3310 regardless of command-line options.
3311
3312 @item -fno-local-ivars
3313 @opindex fno-local-ivars
3314 @opindex flocal-ivars
3315 By default instance variables in Objective-C can be accessed as if
3316 they were local variables from within the methods of the class they're
3317 declared in. This can lead to shadowing between instance variables
3318 and other variables declared either locally inside a class method or
3319 globally with the same name. Specifying the @option{-fno-local-ivars}
3320 flag disables this behavior thus avoiding variable shadowing issues.
3321
3322 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3323 @opindex fivar-visibility
3324 Set the default instance variable visibility to the specified option
3325 so that instance variables declared outside the scope of any access
3326 modifier directives default to the specified visibility.
3327
3328 @item -gen-decls
3329 @opindex gen-decls
3330 Dump interface declarations for all classes seen in the source file to a
3331 file named @file{@var{sourcename}.decl}.
3332
3333 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3334 @opindex Wassign-intercept
3335 @opindex Wno-assign-intercept
3336 Warn whenever an Objective-C assignment is being intercepted by the
3337 garbage collector.
3338
3339 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3340 @opindex Wno-protocol
3341 @opindex Wprotocol
3342 If a class is declared to implement a protocol, a warning is issued for
3343 every method in the protocol that is not implemented by the class. The
3344 default behavior is to issue a warning for every method not explicitly
3345 implemented in the class, even if a method implementation is inherited
3346 from the superclass. If you use the @option{-Wno-protocol} option, then
3347 methods inherited from the superclass are considered to be implemented,
3348 and no warning is issued for them.
3349
3350 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3351 @opindex Wselector
3352 @opindex Wno-selector
3353 Warn if multiple methods of different types for the same selector are
3354 found during compilation. The check is performed on the list of methods
3355 in the final stage of compilation. Additionally, a check is performed
3356 for each selector appearing in a @code{@@selector(@dots{})}
3357 expression, and a corresponding method for that selector has been found
3358 during compilation. Because these checks scan the method table only at
3359 the end of compilation, these warnings are not produced if the final
3360 stage of compilation is not reached, for example because an error is
3361 found during compilation, or because the @option{-fsyntax-only} option is
3362 being used.
3363
3364 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3365 @opindex Wstrict-selector-match
3366 @opindex Wno-strict-selector-match
3367 Warn if multiple methods with differing argument and/or return types are
3368 found for a given selector when attempting to send a message using this
3369 selector to a receiver of type @code{id} or @code{Class}. When this flag
3370 is off (which is the default behavior), the compiler omits such warnings
3371 if any differences found are confined to types that share the same size
3372 and alignment.
3373
3374 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3375 @opindex Wundeclared-selector
3376 @opindex Wno-undeclared-selector
3377 Warn if a @code{@@selector(@dots{})} expression referring to an
3378 undeclared selector is found. A selector is considered undeclared if no
3379 method with that name has been declared before the
3380 @code{@@selector(@dots{})} expression, either explicitly in an
3381 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3382 an @code{@@implementation} section. This option always performs its
3383 checks as soon as a @code{@@selector(@dots{})} expression is found,
3384 while @option{-Wselector} only performs its checks in the final stage of
3385 compilation. This also enforces the coding style convention
3386 that methods and selectors must be declared before being used.
3387
3388 @item -print-objc-runtime-info
3389 @opindex print-objc-runtime-info
3390 Generate C header describing the largest structure that is passed by
3391 value, if any.
3392
3393 @end table
3394
3395 @node Diagnostic Message Formatting Options
3396 @section Options to Control Diagnostic Messages Formatting
3397 @cindex options to control diagnostics formatting
3398 @cindex diagnostic messages
3399 @cindex message formatting
3400
3401 Traditionally, diagnostic messages have been formatted irrespective of
3402 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3403 options described below
3404 to control the formatting algorithm for diagnostic messages,
3405 e.g.@: how many characters per line, how often source location
3406 information should be reported. Note that some language front ends may not
3407 honor these options.
3408
3409 @table @gcctabopt
3410 @item -fmessage-length=@var{n}
3411 @opindex fmessage-length
3412 Try to format error messages so that they fit on lines of about
3413 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3414 done; each error message appears on a single line. This is the
3415 default for all front ends.
3416
3417 @item -fdiagnostics-show-location=once
3418 @opindex fdiagnostics-show-location
3419 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3420 reporter to emit source location information @emph{once}; that is, in
3421 case the message is too long to fit on a single physical line and has to
3422 be wrapped, the source location won't be emitted (as prefix) again,
3423 over and over, in subsequent continuation lines. This is the default
3424 behavior.
3425
3426 @item -fdiagnostics-show-location=every-line
3427 Only meaningful in line-wrapping mode. Instructs the diagnostic
3428 messages reporter to emit the same source location information (as
3429 prefix) for physical lines that result from the process of breaking
3430 a message which is too long to fit on a single line.
3431
3432 @item -fdiagnostics-color[=@var{WHEN}]
3433 @itemx -fno-diagnostics-color
3434 @opindex fdiagnostics-color
3435 @cindex highlight, color
3436 @vindex GCC_COLORS @r{environment variable}
3437 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3438 or @samp{auto}. The default depends on how the compiler has been configured,
3439 it can be any of the above @var{WHEN} options or also @samp{never}
3440 if @env{GCC_COLORS} environment variable isn't present in the environment,
3441 and @samp{auto} otherwise.
3442 @samp{auto} means to use color only when the standard error is a terminal.
3443 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3444 aliases for @option{-fdiagnostics-color=always} and
3445 @option{-fdiagnostics-color=never}, respectively.
3446
3447 The colors are defined by the environment variable @env{GCC_COLORS}.
3448 Its value is a colon-separated list of capabilities and Select Graphic
3449 Rendition (SGR) substrings. SGR commands are interpreted by the
3450 terminal or terminal emulator. (See the section in the documentation
3451 of your text terminal for permitted values and their meanings as
3452 character attributes.) These substring values are integers in decimal
3453 representation and can be concatenated with semicolons.
3454 Common values to concatenate include
3455 @samp{1} for bold,
3456 @samp{4} for underline,
3457 @samp{5} for blink,
3458 @samp{7} for inverse,
3459 @samp{39} for default foreground color,
3460 @samp{30} to @samp{37} for foreground colors,
3461 @samp{90} to @samp{97} for 16-color mode foreground colors,
3462 @samp{38;5;0} to @samp{38;5;255}
3463 for 88-color and 256-color modes foreground colors,
3464 @samp{49} for default background color,
3465 @samp{40} to @samp{47} for background colors,
3466 @samp{100} to @samp{107} for 16-color mode background colors,
3467 and @samp{48;5;0} to @samp{48;5;255}
3468 for 88-color and 256-color modes background colors.
3469
3470 The default @env{GCC_COLORS} is
3471 @smallexample
3472 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3473 quote=01:fixit-insert=32:fixit-delete=31:\
3474 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3475 type-diff=01;32
3476 @end smallexample
3477 @noindent
3478 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3479 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3480 @samp{01} is bold, and @samp{31} is red.
3481 Setting @env{GCC_COLORS} to the empty string disables colors.
3482 Supported capabilities are as follows.
3483
3484 @table @code
3485 @item error=
3486 @vindex error GCC_COLORS @r{capability}
3487 SGR substring for error: markers.
3488
3489 @item warning=
3490 @vindex warning GCC_COLORS @r{capability}
3491 SGR substring for warning: markers.
3492
3493 @item note=
3494 @vindex note GCC_COLORS @r{capability}
3495 SGR substring for note: markers.
3496
3497 @item range1=
3498 @vindex range1 GCC_COLORS @r{capability}
3499 SGR substring for first additional range.
3500
3501 @item range2=
3502 @vindex range2 GCC_COLORS @r{capability}
3503 SGR substring for second additional range.
3504
3505 @item locus=
3506 @vindex locus GCC_COLORS @r{capability}
3507 SGR substring for location information, @samp{file:line} or
3508 @samp{file:line:column} etc.
3509
3510 @item quote=
3511 @vindex quote GCC_COLORS @r{capability}
3512 SGR substring for information printed within quotes.
3513
3514 @item fixit-insert=
3515 @vindex fixit-insert GCC_COLORS @r{capability}
3516 SGR substring for fix-it hints suggesting text to
3517 be inserted or replaced.
3518
3519 @item fixit-delete=
3520 @vindex fixit-delete GCC_COLORS @r{capability}
3521 SGR substring for fix-it hints suggesting text to
3522 be deleted.
3523
3524 @item diff-filename=
3525 @vindex diff-filename GCC_COLORS @r{capability}
3526 SGR substring for filename headers within generated patches.
3527
3528 @item diff-hunk=
3529 @vindex diff-hunk GCC_COLORS @r{capability}
3530 SGR substring for the starts of hunks within generated patches.
3531
3532 @item diff-delete=
3533 @vindex diff-delete GCC_COLORS @r{capability}
3534 SGR substring for deleted lines within generated patches.
3535
3536 @item diff-insert=
3537 @vindex diff-insert GCC_COLORS @r{capability}
3538 SGR substring for inserted lines within generated patches.
3539
3540 @item type-diff=
3541 @vindex type-diff GCC_COLORS @r{capability}
3542 SGR substring for highlighting mismatching types within template
3543 arguments in the C++ frontend.
3544 @end table
3545
3546 @item -fno-diagnostics-show-option
3547 @opindex fno-diagnostics-show-option
3548 @opindex fdiagnostics-show-option
3549 By default, each diagnostic emitted includes text indicating the
3550 command-line option that directly controls the diagnostic (if such an
3551 option is known to the diagnostic machinery). Specifying the
3552 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3553
3554 @item -fno-diagnostics-show-caret
3555 @opindex fno-diagnostics-show-caret
3556 @opindex fdiagnostics-show-caret
3557 By default, each diagnostic emitted includes the original source line
3558 and a caret @samp{^} indicating the column. This option suppresses this
3559 information. The source line is truncated to @var{n} characters, if
3560 the @option{-fmessage-length=n} option is given. When the output is done
3561 to the terminal, the width is limited to the width given by the
3562 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3563
3564 @item -fdiagnostics-parseable-fixits
3565 @opindex fdiagnostics-parseable-fixits
3566 Emit fix-it hints in a machine-parseable format, suitable for consumption
3567 by IDEs. For each fix-it, a line will be printed after the relevant
3568 diagnostic, starting with the string ``fix-it:''. For example:
3569
3570 @smallexample
3571 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3572 @end smallexample
3573
3574 The location is expressed as a half-open range, expressed as a count of
3575 bytes, starting at byte 1 for the initial column. In the above example,
3576 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3577 given string:
3578
3579 @smallexample
3580 00000000011111111112222222222
3581 12345678901234567890123456789
3582 gtk_widget_showall (dlg);
3583 ^^^^^^^^^^^^^^^^^^
3584 gtk_widget_show_all
3585 @end smallexample
3586
3587 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3588 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3589 (e.g. vertical tab as ``\013'').
3590
3591 An empty replacement string indicates that the given range is to be removed.
3592 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3593 be inserted at the given position.
3594
3595 @item -fdiagnostics-generate-patch
3596 @opindex fdiagnostics-generate-patch
3597 Print fix-it hints to stderr in unified diff format, after any diagnostics
3598 are printed. For example:
3599
3600 @smallexample
3601 --- test.c
3602 +++ test.c
3603 @@ -42,5 +42,5 @@
3604
3605 void show_cb(GtkDialog *dlg)
3606 @{
3607 - gtk_widget_showall(dlg);
3608 + gtk_widget_show_all(dlg);
3609 @}
3610
3611 @end smallexample
3612
3613 The diff may or may not be colorized, following the same rules
3614 as for diagnostics (see @option{-fdiagnostics-color}).
3615
3616 @item -fdiagnostics-show-template-tree
3617 @opindex fdiagnostics-show-template-tree
3618
3619 In the C++ frontend, when printing diagnostics showing mismatching
3620 template types, such as:
3621
3622 @smallexample
3623 could not convert 'std::map<int, std::vector<double> >()'
3624 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3625 @end smallexample
3626
3627 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3628 tree-like structure showing the common and differing parts of the types,
3629 such as:
3630
3631 @smallexample
3632 map<
3633 [...],
3634 vector<
3635 [double != float]>>
3636 @end smallexample
3637
3638 The parts that differ are highlighted with color (``double'' and
3639 ``float'' in this case).
3640
3641 @item -fno-elide-type
3642 @opindex fno-elide-type
3643 @opindex felide-type
3644 By default when the C++ frontend prints diagnostics showing mismatching
3645 template types, common parts of the types are printed as ``[...]'' to
3646 simplify the error message. For example:
3647
3648 @smallexample
3649 could not convert 'std::map<int, std::vector<double> >()'
3650 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3651 @end smallexample
3652
3653 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3654 This flag also affects the output of the
3655 @option{-fdiagnostics-show-template-tree} flag.
3656
3657 @item -fno-show-column
3658 @opindex fno-show-column
3659 Do not print column numbers in diagnostics. This may be necessary if
3660 diagnostics are being scanned by a program that does not understand the
3661 column numbers, such as @command{dejagnu}.
3662
3663 @end table
3664
3665 @node Warning Options
3666 @section Options to Request or Suppress Warnings
3667 @cindex options to control warnings
3668 @cindex warning messages
3669 @cindex messages, warning
3670 @cindex suppressing warnings
3671
3672 Warnings are diagnostic messages that report constructions that
3673 are not inherently erroneous but that are risky or suggest there
3674 may have been an error.
3675
3676 The following language-independent options do not enable specific
3677 warnings but control the kinds of diagnostics produced by GCC@.
3678
3679 @table @gcctabopt
3680 @cindex syntax checking
3681 @item -fsyntax-only
3682 @opindex fsyntax-only
3683 Check the code for syntax errors, but don't do anything beyond that.
3684
3685 @item -fmax-errors=@var{n}
3686 @opindex fmax-errors
3687 Limits the maximum number of error messages to @var{n}, at which point
3688 GCC bails out rather than attempting to continue processing the source
3689 code. If @var{n} is 0 (the default), there is no limit on the number
3690 of error messages produced. If @option{-Wfatal-errors} is also
3691 specified, then @option{-Wfatal-errors} takes precedence over this
3692 option.
3693
3694 @item -w
3695 @opindex w
3696 Inhibit all warning messages.
3697
3698 @item -Werror
3699 @opindex Werror
3700 @opindex Wno-error
3701 Make all warnings into errors.
3702
3703 @item -Werror=
3704 @opindex Werror=
3705 @opindex Wno-error=
3706 Make the specified warning into an error. The specifier for a warning
3707 is appended; for example @option{-Werror=switch} turns the warnings
3708 controlled by @option{-Wswitch} into errors. This switch takes a
3709 negative form, to be used to negate @option{-Werror} for specific
3710 warnings; for example @option{-Wno-error=switch} makes
3711 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3712 is in effect.
3713
3714 The warning message for each controllable warning includes the
3715 option that controls the warning. That option can then be used with
3716 @option{-Werror=} and @option{-Wno-error=} as described above.
3717 (Printing of the option in the warning message can be disabled using the
3718 @option{-fno-diagnostics-show-option} flag.)
3719
3720 Note that specifying @option{-Werror=}@var{foo} automatically implies
3721 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3722 imply anything.
3723
3724 @item -Wfatal-errors
3725 @opindex Wfatal-errors
3726 @opindex Wno-fatal-errors
3727 This option causes the compiler to abort compilation on the first error
3728 occurred rather than trying to keep going and printing further error
3729 messages.
3730
3731 @end table
3732
3733 You can request many specific warnings with options beginning with
3734 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3735 implicit declarations. Each of these specific warning options also
3736 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3737 example, @option{-Wno-implicit}. This manual lists only one of the
3738 two forms, whichever is not the default. For further
3739 language-specific options also refer to @ref{C++ Dialect Options} and
3740 @ref{Objective-C and Objective-C++ Dialect Options}.
3741
3742 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3743 options, such as @option{-Wunused}, which may turn on further options,
3744 such as @option{-Wunused-value}. The combined effect of positive and
3745 negative forms is that more specific options have priority over less
3746 specific ones, independently of their position in the command-line. For
3747 options of the same specificity, the last one takes effect. Options
3748 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3749 as if they appeared at the end of the command-line.
3750
3751 When an unrecognized warning option is requested (e.g.,
3752 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3753 that the option is not recognized. However, if the @option{-Wno-} form
3754 is used, the behavior is slightly different: no diagnostic is
3755 produced for @option{-Wno-unknown-warning} unless other diagnostics
3756 are being produced. This allows the use of new @option{-Wno-} options
3757 with old compilers, but if something goes wrong, the compiler
3758 warns that an unrecognized option is present.
3759
3760 @table @gcctabopt
3761 @item -Wpedantic
3762 @itemx -pedantic
3763 @opindex pedantic
3764 @opindex Wpedantic
3765 Issue all the warnings demanded by strict ISO C and ISO C++;
3766 reject all programs that use forbidden extensions, and some other
3767 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3768 version of the ISO C standard specified by any @option{-std} option used.
3769
3770 Valid ISO C and ISO C++ programs should compile properly with or without
3771 this option (though a rare few require @option{-ansi} or a
3772 @option{-std} option specifying the required version of ISO C)@. However,
3773 without this option, certain GNU extensions and traditional C and C++
3774 features are supported as well. With this option, they are rejected.
3775
3776 @option{-Wpedantic} does not cause warning messages for use of the
3777 alternate keywords whose names begin and end with @samp{__}. Pedantic
3778 warnings are also disabled in the expression that follows
3779 @code{__extension__}. However, only system header files should use
3780 these escape routes; application programs should avoid them.
3781 @xref{Alternate Keywords}.
3782
3783 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3784 C conformance. They soon find that it does not do quite what they want:
3785 it finds some non-ISO practices, but not all---only those for which
3786 ISO C @emph{requires} a diagnostic, and some others for which
3787 diagnostics have been added.
3788
3789 A feature to report any failure to conform to ISO C might be useful in
3790 some instances, but would require considerable additional work and would
3791 be quite different from @option{-Wpedantic}. We don't have plans to
3792 support such a feature in the near future.
3793
3794 Where the standard specified with @option{-std} represents a GNU
3795 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3796 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3797 extended dialect is based. Warnings from @option{-Wpedantic} are given
3798 where they are required by the base standard. (It does not make sense
3799 for such warnings to be given only for features not in the specified GNU
3800 C dialect, since by definition the GNU dialects of C include all
3801 features the compiler supports with the given option, and there would be
3802 nothing to warn about.)
3803
3804 @item -pedantic-errors
3805 @opindex pedantic-errors
3806 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3807 requires a diagnostic, in some cases where there is undefined behavior
3808 at compile-time and in some other cases that do not prevent compilation
3809 of programs that are valid according to the standard. This is not
3810 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3811 by this option and not enabled by the latter and vice versa.
3812
3813 @item -Wall
3814 @opindex Wall
3815 @opindex Wno-all
3816 This enables all the warnings about constructions that some users
3817 consider questionable, and that are easy to avoid (or modify to
3818 prevent the warning), even in conjunction with macros. This also
3819 enables some language-specific warnings described in @ref{C++ Dialect
3820 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3821
3822 @option{-Wall} turns on the following warning flags:
3823
3824 @gccoptlist{-Waddress @gol
3825 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3826 -Wbool-compare @gol
3827 -Wbool-operation @gol
3828 -Wc++11-compat -Wc++14-compat @gol
3829 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
3830 -Wchar-subscripts @gol
3831 -Wcomment @gol
3832 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3833 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3834 -Wformat @gol
3835 -Wint-in-bool-context @gol
3836 -Wimplicit @r{(C and Objective-C only)} @gol
3837 -Wimplicit-int @r{(C and Objective-C only)} @gol
3838 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3839 -Winit-self @r{(only for C++)} @gol
3840 -Wlogical-not-parentheses @gol
3841 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3842 -Wmaybe-uninitialized @gol
3843 -Wmemset-elt-size @gol
3844 -Wmemset-transposed-args @gol
3845 -Wmisleading-indentation @r{(only for C/C++)} @gol
3846 -Wmissing-braces @r{(only for C/ObjC)} @gol
3847 -Wmultistatement-macros @gol
3848 -Wnarrowing @r{(only for C++)} @gol
3849 -Wnonnull @gol
3850 -Wnonnull-compare @gol
3851 -Wopenmp-simd @gol
3852 -Wparentheses @gol
3853 -Wpointer-sign @gol
3854 -Wreorder @gol
3855 -Wreturn-type @gol
3856 -Wsequence-point @gol
3857 -Wsign-compare @r{(only in C++)} @gol
3858 -Wsizeof-pointer-div @gol
3859 -Wsizeof-pointer-memaccess @gol
3860 -Wstrict-aliasing @gol
3861 -Wstrict-overflow=1 @gol
3862 -Wswitch @gol
3863 -Wtautological-compare @gol
3864 -Wtrigraphs @gol
3865 -Wuninitialized @gol
3866 -Wunknown-pragmas @gol
3867 -Wunused-function @gol
3868 -Wunused-label @gol
3869 -Wunused-value @gol
3870 -Wunused-variable @gol
3871 -Wvolatile-register-var @gol
3872 }
3873
3874 Note that some warning flags are not implied by @option{-Wall}. Some of
3875 them warn about constructions that users generally do not consider
3876 questionable, but which occasionally you might wish to check for;
3877 others warn about constructions that are necessary or hard to avoid in
3878 some cases, and there is no simple way to modify the code to suppress
3879 the warning. Some of them are enabled by @option{-Wextra} but many of
3880 them must be enabled individually.
3881
3882 @item -Wextra
3883 @opindex W
3884 @opindex Wextra
3885 @opindex Wno-extra
3886 This enables some extra warning flags that are not enabled by
3887 @option{-Wall}. (This option used to be called @option{-W}. The older
3888 name is still supported, but the newer name is more descriptive.)
3889
3890 @gccoptlist{-Wclobbered @gol
3891 -Wempty-body @gol
3892 -Wignored-qualifiers @gol
3893 -Wimplicit-fallthrough=3 @gol
3894 -Wmissing-field-initializers @gol
3895 -Wmissing-parameter-type @r{(C only)} @gol
3896 -Wold-style-declaration @r{(C only)} @gol
3897 -Woverride-init @gol
3898 -Wsign-compare @r{(C only)} @gol
3899 -Wtype-limits @gol
3900 -Wuninitialized @gol
3901 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3902 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3903 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3904 }
3905
3906 The option @option{-Wextra} also prints warning messages for the
3907 following cases:
3908
3909 @itemize @bullet
3910
3911 @item
3912 A pointer is compared against integer zero with @code{<}, @code{<=},
3913 @code{>}, or @code{>=}.
3914
3915 @item
3916 (C++ only) An enumerator and a non-enumerator both appear in a
3917 conditional expression.
3918
3919 @item
3920 (C++ only) Ambiguous virtual bases.
3921
3922 @item
3923 (C++ only) Subscripting an array that has been declared @code{register}.
3924
3925 @item
3926 (C++ only) Taking the address of a variable that has been declared
3927 @code{register}.
3928
3929 @item
3930 (C++ only) A base class is not initialized in the copy constructor
3931 of a derived class.
3932
3933 @end itemize
3934
3935 @item -Wchar-subscripts
3936 @opindex Wchar-subscripts
3937 @opindex Wno-char-subscripts
3938 Warn if an array subscript has type @code{char}. This is a common cause
3939 of error, as programmers often forget that this type is signed on some
3940 machines.
3941 This warning is enabled by @option{-Wall}.
3942
3943 @item -Wchkp
3944 @opindex Wchkp
3945 Warn about an invalid memory access that is found by Pointer Bounds Checker
3946 (@option{-fcheck-pointer-bounds}).
3947
3948 @item -Wno-coverage-mismatch
3949 @opindex Wno-coverage-mismatch
3950 Warn if feedback profiles do not match when using the
3951 @option{-fprofile-use} option.
3952 If a source file is changed between compiling with @option{-fprofile-gen} and
3953 with @option{-fprofile-use}, the files with the profile feedback can fail
3954 to match the source file and GCC cannot use the profile feedback
3955 information. By default, this warning is enabled and is treated as an
3956 error. @option{-Wno-coverage-mismatch} can be used to disable the
3957 warning or @option{-Wno-error=coverage-mismatch} can be used to
3958 disable the error. Disabling the error for this warning can result in
3959 poorly optimized code and is useful only in the
3960 case of very minor changes such as bug fixes to an existing code-base.
3961 Completely disabling the warning is not recommended.
3962
3963 @item -Wno-cpp
3964 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3965
3966 Suppress warning messages emitted by @code{#warning} directives.
3967
3968 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3969 @opindex Wdouble-promotion
3970 @opindex Wno-double-promotion
3971 Give a warning when a value of type @code{float} is implicitly
3972 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3973 floating-point unit implement @code{float} in hardware, but emulate
3974 @code{double} in software. On such a machine, doing computations
3975 using @code{double} values is much more expensive because of the
3976 overhead required for software emulation.
3977
3978 It is easy to accidentally do computations with @code{double} because
3979 floating-point literals are implicitly of type @code{double}. For
3980 example, in:
3981 @smallexample
3982 @group
3983 float area(float radius)
3984 @{
3985 return 3.14159 * radius * radius;
3986 @}
3987 @end group
3988 @end smallexample
3989 the compiler performs the entire computation with @code{double}
3990 because the floating-point literal is a @code{double}.
3991
3992 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
3993 @opindex Wduplicate-decl-specifier
3994 @opindex Wno-duplicate-decl-specifier
3995 Warn if a declaration has duplicate @code{const}, @code{volatile},
3996 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
3997 @option{-Wall}.
3998
3999 @item -Wformat
4000 @itemx -Wformat=@var{n}
4001 @opindex Wformat
4002 @opindex Wno-format
4003 @opindex ffreestanding
4004 @opindex fno-builtin
4005 @opindex Wformat=
4006 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4007 the arguments supplied have types appropriate to the format string
4008 specified, and that the conversions specified in the format string make
4009 sense. This includes standard functions, and others specified by format
4010 attributes (@pxref{Function Attributes}), in the @code{printf},
4011 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4012 not in the C standard) families (or other target-specific families).
4013 Which functions are checked without format attributes having been
4014 specified depends on the standard version selected, and such checks of
4015 functions without the attribute specified are disabled by
4016 @option{-ffreestanding} or @option{-fno-builtin}.
4017
4018 The formats are checked against the format features supported by GNU
4019 libc version 2.2. These include all ISO C90 and C99 features, as well
4020 as features from the Single Unix Specification and some BSD and GNU
4021 extensions. Other library implementations may not support all these
4022 features; GCC does not support warning about features that go beyond a
4023 particular library's limitations. However, if @option{-Wpedantic} is used
4024 with @option{-Wformat}, warnings are given about format features not
4025 in the selected standard version (but not for @code{strfmon} formats,
4026 since those are not in any version of the C standard). @xref{C Dialect
4027 Options,,Options Controlling C Dialect}.
4028
4029 @table @gcctabopt
4030 @item -Wformat=1
4031 @itemx -Wformat
4032 @opindex Wformat
4033 @opindex Wformat=1
4034 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4035 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4036 @option{-Wformat} also checks for null format arguments for several
4037 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4038 aspects of this level of format checking can be disabled by the
4039 options: @option{-Wno-format-contains-nul},
4040 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4041 @option{-Wformat} is enabled by @option{-Wall}.
4042
4043 @item -Wno-format-contains-nul
4044 @opindex Wno-format-contains-nul
4045 @opindex Wformat-contains-nul
4046 If @option{-Wformat} is specified, do not warn about format strings that
4047 contain NUL bytes.
4048
4049 @item -Wno-format-extra-args
4050 @opindex Wno-format-extra-args
4051 @opindex Wformat-extra-args
4052 If @option{-Wformat} is specified, do not warn about excess arguments to a
4053 @code{printf} or @code{scanf} format function. The C standard specifies
4054 that such arguments are ignored.
4055
4056 Where the unused arguments lie between used arguments that are
4057 specified with @samp{$} operand number specifications, normally
4058 warnings are still given, since the implementation could not know what
4059 type to pass to @code{va_arg} to skip the unused arguments. However,
4060 in the case of @code{scanf} formats, this option suppresses the
4061 warning if the unused arguments are all pointers, since the Single
4062 Unix Specification says that such unused arguments are allowed.
4063
4064 @item -Wformat-overflow
4065 @itemx -Wformat-overflow=@var{level}
4066 @opindex Wformat-overflow
4067 @opindex Wno-format-overflow
4068 Warn about calls to formatted input/output functions such as @code{sprintf}
4069 and @code{vsprintf} that might overflow the destination buffer. When the
4070 exact number of bytes written by a format directive cannot be determined
4071 at compile-time it is estimated based on heuristics that depend on the
4072 @var{level} argument and on optimization. While enabling optimization
4073 will in most cases improve the accuracy of the warning, it may also
4074 result in false positives.
4075
4076 @table @gcctabopt
4077 @item -Wformat-overflow
4078 @item -Wformat-overflow=1
4079 @opindex Wformat-overflow
4080 @opindex Wno-format-overflow
4081 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4082 employs a conservative approach that warns only about calls that most
4083 likely overflow the buffer. At this level, numeric arguments to format
4084 directives with unknown values are assumed to have the value of one, and
4085 strings of unknown length to be empty. Numeric arguments that are known
4086 to be bounded to a subrange of their type, or string arguments whose output
4087 is bounded either by their directive's precision or by a finite set of
4088 string literals, are assumed to take on the value within the range that
4089 results in the most bytes on output. For example, the call to @code{sprintf}
4090 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4091 the terminating NUL character (@code{'\0'}) appended by the function
4092 to the destination buffer will be written past its end. Increasing
4093 the size of the buffer by a single byte is sufficient to avoid the
4094 warning, though it may not be sufficient to avoid the overflow.
4095
4096 @smallexample
4097 void f (int a, int b)
4098 @{
4099 char buf [12];
4100 sprintf (buf, "a = %i, b = %i\n", a, b);
4101 @}
4102 @end smallexample
4103
4104 @item -Wformat-overflow=2
4105 Level @var{2} warns also about calls that might overflow the destination
4106 buffer given an argument of sufficient length or magnitude. At level
4107 @var{2}, unknown numeric arguments are assumed to have the minimum
4108 representable value for signed types with a precision greater than 1, and
4109 the maximum representable value otherwise. Unknown string arguments whose
4110 length cannot be assumed to be bounded either by the directive's precision,
4111 or by a finite set of string literals they may evaluate to, or the character
4112 array they may point to, are assumed to be 1 character long.
4113
4114 At level @var{2}, the call in the example above is again diagnosed, but
4115 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4116 @code{%i} directive will write some of its digits beyond the end of
4117 the destination buffer. To make the call safe regardless of the values
4118 of the two variables, the size of the destination buffer must be increased
4119 to at least 34 bytes. GCC includes the minimum size of the buffer in
4120 an informational note following the warning.
4121
4122 An alternative to increasing the size of the destination buffer is to
4123 constrain the range of formatted values. The maximum length of string
4124 arguments can be bounded by specifying the precision in the format
4125 directive. When numeric arguments of format directives can be assumed
4126 to be bounded by less than the precision of their type, choosing
4127 an appropriate length modifier to the format specifier will reduce
4128 the required buffer size. For example, if @var{a} and @var{b} in the
4129 example above can be assumed to be within the precision of
4130 the @code{short int} type then using either the @code{%hi} format
4131 directive or casting the argument to @code{short} reduces the maximum
4132 required size of the buffer to 24 bytes.
4133
4134 @smallexample
4135 void f (int a, int b)
4136 @{
4137 char buf [23];
4138 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4139 @}
4140 @end smallexample
4141 @end table
4142
4143 @item -Wno-format-zero-length
4144 @opindex Wno-format-zero-length
4145 @opindex Wformat-zero-length
4146 If @option{-Wformat} is specified, do not warn about zero-length formats.
4147 The C standard specifies that zero-length formats are allowed.
4148
4149
4150 @item -Wformat=2
4151 @opindex Wformat=2
4152 Enable @option{-Wformat} plus additional format checks. Currently
4153 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4154 -Wformat-y2k}.
4155
4156 @item -Wformat-nonliteral
4157 @opindex Wformat-nonliteral
4158 @opindex Wno-format-nonliteral
4159 If @option{-Wformat} is specified, also warn if the format string is not a
4160 string literal and so cannot be checked, unless the format function
4161 takes its format arguments as a @code{va_list}.
4162
4163 @item -Wformat-security
4164 @opindex Wformat-security
4165 @opindex Wno-format-security
4166 If @option{-Wformat} is specified, also warn about uses of format
4167 functions that represent possible security problems. At present, this
4168 warns about calls to @code{printf} and @code{scanf} functions where the
4169 format string is not a string literal and there are no format arguments,
4170 as in @code{printf (foo);}. This may be a security hole if the format
4171 string came from untrusted input and contains @samp{%n}. (This is
4172 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4173 in future warnings may be added to @option{-Wformat-security} that are not
4174 included in @option{-Wformat-nonliteral}.)
4175
4176 @item -Wformat-signedness
4177 @opindex Wformat-signedness
4178 @opindex Wno-format-signedness
4179 If @option{-Wformat} is specified, also warn if the format string
4180 requires an unsigned argument and the argument is signed and vice versa.
4181
4182 @item -Wformat-truncation
4183 @itemx -Wformat-truncation=@var{level}
4184 @opindex Wformat-truncation
4185 @opindex Wno-format-truncation
4186 Warn about calls to formatted input/output functions such as @code{snprintf}
4187 and @code{vsnprintf} that might result in output truncation. When the exact
4188 number of bytes written by a format directive cannot be determined at
4189 compile-time it is estimated based on heuristics that depend on
4190 the @var{level} argument and on optimization. While enabling optimization
4191 will in most cases improve the accuracy of the warning, it may also result
4192 in false positives. Except as noted otherwise, the option uses the same
4193 logic @option{-Wformat-overflow}.
4194
4195 @table @gcctabopt
4196 @item -Wformat-truncation
4197 @item -Wformat-truncation=1
4198 @opindex Wformat-truncation
4199 @opindex Wno-format-overflow
4200 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4201 employs a conservative approach that warns only about calls to bounded
4202 functions whose return value is unused and that will most likely result
4203 in output truncation.
4204
4205 @item -Wformat-truncation=2
4206 Level @var{2} warns also about calls to bounded functions whose return
4207 value is used and that might result in truncation given an argument of
4208 sufficient length or magnitude.
4209 @end table
4210
4211 @item -Wformat-y2k
4212 @opindex Wformat-y2k
4213 @opindex Wno-format-y2k
4214 If @option{-Wformat} is specified, also warn about @code{strftime}
4215 formats that may yield only a two-digit year.
4216 @end table
4217
4218 @item -Wnonnull
4219 @opindex Wnonnull
4220 @opindex Wno-nonnull
4221 Warn about passing a null pointer for arguments marked as
4222 requiring a non-null value by the @code{nonnull} function attribute.
4223
4224 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4225 can be disabled with the @option{-Wno-nonnull} option.
4226
4227 @item -Wnonnull-compare
4228 @opindex Wnonnull-compare
4229 @opindex Wno-nonnull-compare
4230 Warn when comparing an argument marked with the @code{nonnull}
4231 function attribute against null inside the function.
4232
4233 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4234 can be disabled with the @option{-Wno-nonnull-compare} option.
4235
4236 @item -Wnull-dereference
4237 @opindex Wnull-dereference
4238 @opindex Wno-null-dereference
4239 Warn if the compiler detects paths that trigger erroneous or
4240 undefined behavior due to dereferencing a null pointer. This option
4241 is only active when @option{-fdelete-null-pointer-checks} is active,
4242 which is enabled by optimizations in most targets. The precision of
4243 the warnings depends on the optimization options used.
4244
4245 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4246 @opindex Winit-self
4247 @opindex Wno-init-self
4248 Warn about uninitialized variables that are initialized with themselves.
4249 Note this option can only be used with the @option{-Wuninitialized} option.
4250
4251 For example, GCC warns about @code{i} being uninitialized in the
4252 following snippet only when @option{-Winit-self} has been specified:
4253 @smallexample
4254 @group
4255 int f()
4256 @{
4257 int i = i;
4258 return i;
4259 @}
4260 @end group
4261 @end smallexample
4262
4263 This warning is enabled by @option{-Wall} in C++.
4264
4265 @item -Wimplicit-int @r{(C and Objective-C only)}
4266 @opindex Wimplicit-int
4267 @opindex Wno-implicit-int
4268 Warn when a declaration does not specify a type.
4269 This warning is enabled by @option{-Wall}.
4270
4271 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4272 @opindex Wimplicit-function-declaration
4273 @opindex Wno-implicit-function-declaration
4274 Give a warning whenever a function is used before being declared. In
4275 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4276 enabled by default and it is made into an error by
4277 @option{-pedantic-errors}. This warning is also enabled by
4278 @option{-Wall}.
4279
4280 @item -Wimplicit @r{(C and Objective-C only)}
4281 @opindex Wimplicit
4282 @opindex Wno-implicit
4283 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4284 This warning is enabled by @option{-Wall}.
4285
4286 @item -Wimplicit-fallthrough
4287 @opindex Wimplicit-fallthrough
4288 @opindex Wno-implicit-fallthrough
4289 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4290 and @option{-Wno-implicit-fallthrough} is the same as
4291 @option{-Wimplicit-fallthrough=0}.
4292
4293 @item -Wimplicit-fallthrough=@var{n}
4294 @opindex Wimplicit-fallthrough=
4295 Warn when a switch case falls through. For example:
4296
4297 @smallexample
4298 @group
4299 switch (cond)
4300 @{
4301 case 1:
4302 a = 1;
4303 break;
4304 case 2:
4305 a = 2;
4306 case 3:
4307 a = 3;
4308 break;
4309 @}
4310 @end group
4311 @end smallexample
4312
4313 This warning does not warn when the last statement of a case cannot
4314 fall through, e.g. when there is a return statement or a call to function
4315 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4316 also takes into account control flow statements, such as ifs, and only
4317 warns when appropriate. E.g.@:
4318
4319 @smallexample
4320 @group
4321 switch (cond)
4322 @{
4323 case 1:
4324 if (i > 3) @{
4325 bar (5);
4326 break;
4327 @} else if (i < 1) @{
4328 bar (0);
4329 @} else
4330 return;
4331 default:
4332 @dots{}
4333 @}
4334 @end group
4335 @end smallexample
4336
4337 Since there are occasions where a switch case fall through is desirable,
4338 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4339 to be used along with a null statement to suppress this warning that
4340 would normally occur:
4341
4342 @smallexample
4343 @group
4344 switch (cond)
4345 @{
4346 case 1:
4347 bar (0);
4348 __attribute__ ((fallthrough));
4349 default:
4350 @dots{}
4351 @}
4352 @end group
4353 @end smallexample
4354
4355 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4356 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4357 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4358 Instead of these attributes, it is also possible to add a fallthrough comment
4359 to silence the warning. The whole body of the C or C++ style comment should
4360 match the given regular expressions listed below. The option argument @var{n}
4361 specifies what kind of comments are accepted:
4362
4363 @itemize @bullet
4364
4365 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4366
4367 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4368 expression, any comment is used as fallthrough comment.
4369
4370 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4371 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4372
4373 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4374 following regular expressions:
4375
4376 @itemize @bullet
4377
4378 @item @code{-fallthrough}
4379
4380 @item @code{@@fallthrough@@}
4381
4382 @item @code{lint -fallthrough[ \t]*}
4383
4384 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4385
4386 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4387
4388 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4389
4390 @end itemize
4391
4392 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4393 following regular expressions:
4394
4395 @itemize @bullet
4396
4397 @item @code{-fallthrough}
4398
4399 @item @code{@@fallthrough@@}
4400
4401 @item @code{lint -fallthrough[ \t]*}
4402
4403 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4404
4405 @end itemize
4406
4407 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4408 fallthrough comments, only attributes disable the warning.
4409
4410 @end itemize
4411
4412 The comment needs to be followed after optional whitespace and other comments
4413 by @code{case} or @code{default} keywords or by a user label that precedes some
4414 @code{case} or @code{default} label.
4415
4416 @smallexample
4417 @group
4418 switch (cond)
4419 @{
4420 case 1:
4421 bar (0);
4422 /* FALLTHRU */
4423 default:
4424 @dots{}
4425 @}
4426 @end group
4427 @end smallexample
4428
4429 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4430
4431 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4432 @opindex Wif-not-aligned
4433 @opindex Wno-if-not-aligned
4434 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4435 should be issued. This is is enabled by default.
4436 Use @option{-Wno-if-not-aligned} to disable it.
4437
4438 @item -Wignored-qualifiers @r{(C and C++ only)}
4439 @opindex Wignored-qualifiers
4440 @opindex Wno-ignored-qualifiers
4441 Warn if the return type of a function has a type qualifier
4442 such as @code{const}. For ISO C such a type qualifier has no effect,
4443 since the value returned by a function is not an lvalue.
4444 For C++, the warning is only emitted for scalar types or @code{void}.
4445 ISO C prohibits qualified @code{void} return types on function
4446 definitions, so such return types always receive a warning
4447 even without this option.
4448
4449 This warning is also enabled by @option{-Wextra}.
4450
4451 @item -Wignored-attributes @r{(C and C++ only)}
4452 @opindex Wignored-attributes
4453 @opindex Wno-ignored-attributes
4454 Warn when an attribute is ignored. This is different from the
4455 @option{-Wattributes} option in that it warns whenever the compiler decides
4456 to drop an attribute, not that the attribute is either unknown, used in a
4457 wrong place, etc. This warning is enabled by default.
4458
4459 @item -Wmain
4460 @opindex Wmain
4461 @opindex Wno-main
4462 Warn if the type of @code{main} is suspicious. @code{main} should be
4463 a function with external linkage, returning int, taking either zero
4464 arguments, two, or three arguments of appropriate types. This warning
4465 is enabled by default in C++ and is enabled by either @option{-Wall}
4466 or @option{-Wpedantic}.
4467
4468 @item -Wmisleading-indentation @r{(C and C++ only)}
4469 @opindex Wmisleading-indentation
4470 @opindex Wno-misleading-indentation
4471 Warn when the indentation of the code does not reflect the block structure.
4472 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4473 @code{for} clauses with a guarded statement that does not use braces,
4474 followed by an unguarded statement with the same indentation.
4475
4476 In the following example, the call to ``bar'' is misleadingly indented as
4477 if it were guarded by the ``if'' conditional.
4478
4479 @smallexample
4480 if (some_condition ())
4481 foo ();
4482 bar (); /* Gotcha: this is not guarded by the "if". */
4483 @end smallexample
4484
4485 In the case of mixed tabs and spaces, the warning uses the
4486 @option{-ftabstop=} option to determine if the statements line up
4487 (defaulting to 8).
4488
4489 The warning is not issued for code involving multiline preprocessor logic
4490 such as the following example.
4491
4492 @smallexample
4493 if (flagA)
4494 foo (0);
4495 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4496 if (flagB)
4497 #endif
4498 foo (1);
4499 @end smallexample
4500
4501 The warning is not issued after a @code{#line} directive, since this
4502 typically indicates autogenerated code, and no assumptions can be made
4503 about the layout of the file that the directive references.
4504
4505 This warning is enabled by @option{-Wall} in C and C++.
4506
4507 @item -Wmissing-braces
4508 @opindex Wmissing-braces
4509 @opindex Wno-missing-braces
4510 Warn if an aggregate or union initializer is not fully bracketed. In
4511 the following example, the initializer for @code{a} is not fully
4512 bracketed, but that for @code{b} is fully bracketed. This warning is
4513 enabled by @option{-Wall} in C.
4514
4515 @smallexample
4516 int a[2][2] = @{ 0, 1, 2, 3 @};
4517 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4518 @end smallexample
4519
4520 This warning is enabled by @option{-Wall}.
4521
4522 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4523 @opindex Wmissing-include-dirs
4524 @opindex Wno-missing-include-dirs
4525 Warn if a user-supplied include directory does not exist.
4526
4527 @item -Wmultistatement-macros
4528 @opindex Wmultistatement-macros
4529 @opindex Wno-multistatement-macros
4530 Warn about unsafe multiple statement macros that appear to be guarded
4531 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
4532 @code{while}, in which only the first statement is actually guarded after
4533 the macro is expanded.
4534
4535 For example:
4536
4537 @smallexample
4538 #define DOIT x++; y++
4539 if (c)
4540 DOIT;
4541 @end smallexample
4542
4543 will increment @code{y} unconditionally, not just when @code{c} holds.
4544 The can usually be fixed by wrapping the macro in a do-while loop:
4545 @smallexample
4546 #define DOIT do @{ x++; y++; @} while (0)
4547 if (c)
4548 DOIT;
4549 @end smallexample
4550
4551 This warning is enabled by @option{-Wall} in C and C++.
4552
4553 @item -Wparentheses
4554 @opindex Wparentheses
4555 @opindex Wno-parentheses
4556 Warn if parentheses are omitted in certain contexts, such
4557 as when there is an assignment in a context where a truth value
4558 is expected, or when operators are nested whose precedence people
4559 often get confused about.
4560
4561 Also warn if a comparison like @code{x<=y<=z} appears; this is
4562 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4563 interpretation from that of ordinary mathematical notation.
4564
4565 Also warn for dangerous uses of the GNU extension to
4566 @code{?:} with omitted middle operand. When the condition
4567 in the @code{?}: operator is a boolean expression, the omitted value is
4568 always 1. Often programmers expect it to be a value computed
4569 inside the conditional expression instead.
4570
4571 This warning is enabled by @option{-Wall}.
4572
4573 @item -Wsequence-point
4574 @opindex Wsequence-point
4575 @opindex Wno-sequence-point
4576 Warn about code that may have undefined semantics because of violations
4577 of sequence point rules in the C and C++ standards.
4578
4579 The C and C++ standards define the order in which expressions in a C/C++
4580 program are evaluated in terms of @dfn{sequence points}, which represent
4581 a partial ordering between the execution of parts of the program: those
4582 executed before the sequence point, and those executed after it. These
4583 occur after the evaluation of a full expression (one which is not part
4584 of a larger expression), after the evaluation of the first operand of a
4585 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4586 function is called (but after the evaluation of its arguments and the
4587 expression denoting the called function), and in certain other places.
4588 Other than as expressed by the sequence point rules, the order of
4589 evaluation of subexpressions of an expression is not specified. All
4590 these rules describe only a partial order rather than a total order,
4591 since, for example, if two functions are called within one expression
4592 with no sequence point between them, the order in which the functions
4593 are called is not specified. However, the standards committee have
4594 ruled that function calls do not overlap.
4595
4596 It is not specified when between sequence points modifications to the
4597 values of objects take effect. Programs whose behavior depends on this
4598 have undefined behavior; the C and C++ standards specify that ``Between
4599 the previous and next sequence point an object shall have its stored
4600 value modified at most once by the evaluation of an expression.
4601 Furthermore, the prior value shall be read only to determine the value
4602 to be stored.''. If a program breaks these rules, the results on any
4603 particular implementation are entirely unpredictable.
4604
4605 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4606 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4607 diagnosed by this option, and it may give an occasional false positive
4608 result, but in general it has been found fairly effective at detecting
4609 this sort of problem in programs.
4610
4611 The C++17 standard will define the order of evaluation of operands in
4612 more cases: in particular it requires that the right-hand side of an
4613 assignment be evaluated before the left-hand side, so the above
4614 examples are no longer undefined. But this warning will still warn
4615 about them, to help people avoid writing code that is undefined in C
4616 and earlier revisions of C++.
4617
4618 The standard is worded confusingly, therefore there is some debate
4619 over the precise meaning of the sequence point rules in subtle cases.
4620 Links to discussions of the problem, including proposed formal
4621 definitions, may be found on the GCC readings page, at
4622 @uref{http://gcc.gnu.org/@/readings.html}.
4623
4624 This warning is enabled by @option{-Wall} for C and C++.
4625
4626 @item -Wno-return-local-addr
4627 @opindex Wno-return-local-addr
4628 @opindex Wreturn-local-addr
4629 Do not warn about returning a pointer (or in C++, a reference) to a
4630 variable that goes out of scope after the function returns.
4631
4632 @item -Wreturn-type
4633 @opindex Wreturn-type
4634 @opindex Wno-return-type
4635 Warn whenever a function is defined with a return type that defaults
4636 to @code{int}. Also warn about any @code{return} statement with no
4637 return value in a function whose return type is not @code{void}
4638 (falling off the end of the function body is considered returning
4639 without a value).
4640
4641 For C only, warn about a @code{return} statement with an expression in a
4642 function whose return type is @code{void}, unless the expression type is
4643 also @code{void}. As a GNU extension, the latter case is accepted
4644 without a warning unless @option{-Wpedantic} is used.
4645
4646 For C++, a function without return type always produces a diagnostic
4647 message, even when @option{-Wno-return-type} is specified. The only
4648 exceptions are @code{main} and functions defined in system headers.
4649
4650 This warning is enabled by @option{-Wall}.
4651
4652 @item -Wshift-count-negative
4653 @opindex Wshift-count-negative
4654 @opindex Wno-shift-count-negative
4655 Warn if shift count is negative. This warning is enabled by default.
4656
4657 @item -Wshift-count-overflow
4658 @opindex Wshift-count-overflow
4659 @opindex Wno-shift-count-overflow
4660 Warn if shift count >= width of type. This warning is enabled by default.
4661
4662 @item -Wshift-negative-value
4663 @opindex Wshift-negative-value
4664 @opindex Wno-shift-negative-value
4665 Warn if left shifting a negative value. This warning is enabled by
4666 @option{-Wextra} in C99 and C++11 modes (and newer).
4667
4668 @item -Wshift-overflow
4669 @itemx -Wshift-overflow=@var{n}
4670 @opindex Wshift-overflow
4671 @opindex Wno-shift-overflow
4672 Warn about left shift overflows. This warning is enabled by
4673 default in C99 and C++11 modes (and newer).
4674
4675 @table @gcctabopt
4676 @item -Wshift-overflow=1
4677 This is the warning level of @option{-Wshift-overflow} and is enabled
4678 by default in C99 and C++11 modes (and newer). This warning level does
4679 not warn about left-shifting 1 into the sign bit. (However, in C, such
4680 an overflow is still rejected in contexts where an integer constant expression
4681 is required.)
4682
4683 @item -Wshift-overflow=2
4684 This warning level also warns about left-shifting 1 into the sign bit,
4685 unless C++14 mode is active.
4686 @end table
4687
4688 @item -Wswitch
4689 @opindex Wswitch
4690 @opindex Wno-switch
4691 Warn whenever a @code{switch} statement has an index of enumerated type
4692 and lacks a @code{case} for one or more of the named codes of that
4693 enumeration. (The presence of a @code{default} label prevents this
4694 warning.) @code{case} labels outside the enumeration range also
4695 provoke warnings when this option is used (even if there is a
4696 @code{default} label).
4697 This warning is enabled by @option{-Wall}.
4698
4699 @item -Wswitch-default
4700 @opindex Wswitch-default
4701 @opindex Wno-switch-default
4702 Warn whenever a @code{switch} statement does not have a @code{default}
4703 case.
4704
4705 @item -Wswitch-enum
4706 @opindex Wswitch-enum
4707 @opindex Wno-switch-enum
4708 Warn whenever a @code{switch} statement has an index of enumerated type
4709 and lacks a @code{case} for one or more of the named codes of that
4710 enumeration. @code{case} labels outside the enumeration range also
4711 provoke warnings when this option is used. The only difference
4712 between @option{-Wswitch} and this option is that this option gives a
4713 warning about an omitted enumeration code even if there is a
4714 @code{default} label.
4715
4716 @item -Wswitch-bool
4717 @opindex Wswitch-bool
4718 @opindex Wno-switch-bool
4719 Warn whenever a @code{switch} statement has an index of boolean type
4720 and the case values are outside the range of a boolean type.
4721 It is possible to suppress this warning by casting the controlling
4722 expression to a type other than @code{bool}. For example:
4723 @smallexample
4724 @group
4725 switch ((int) (a == 4))
4726 @{
4727 @dots{}
4728 @}
4729 @end group
4730 @end smallexample
4731 This warning is enabled by default for C and C++ programs.
4732
4733 @item -Wswitch-unreachable
4734 @opindex Wswitch-unreachable
4735 @opindex Wno-switch-unreachable
4736 Warn whenever a @code{switch} statement contains statements between the
4737 controlling expression and the first case label, which will never be
4738 executed. For example:
4739 @smallexample
4740 @group
4741 switch (cond)
4742 @{
4743 i = 15;
4744 @dots{}
4745 case 5:
4746 @dots{}
4747 @}
4748 @end group
4749 @end smallexample
4750 @option{-Wswitch-unreachable} does not warn if the statement between the
4751 controlling expression and the first case label is just a declaration:
4752 @smallexample
4753 @group
4754 switch (cond)
4755 @{
4756 int i;
4757 @dots{}
4758 case 5:
4759 i = 5;
4760 @dots{}
4761 @}
4762 @end group
4763 @end smallexample
4764 This warning is enabled by default for C and C++ programs.
4765
4766 @item -Wsync-nand @r{(C and C++ only)}
4767 @opindex Wsync-nand
4768 @opindex Wno-sync-nand
4769 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4770 built-in functions are used. These functions changed semantics in GCC 4.4.
4771
4772 @item -Wunused-but-set-parameter
4773 @opindex Wunused-but-set-parameter
4774 @opindex Wno-unused-but-set-parameter
4775 Warn whenever a function parameter is assigned to, but otherwise unused
4776 (aside from its declaration).
4777
4778 To suppress this warning use the @code{unused} attribute
4779 (@pxref{Variable Attributes}).
4780
4781 This warning is also enabled by @option{-Wunused} together with
4782 @option{-Wextra}.
4783
4784 @item -Wunused-but-set-variable
4785 @opindex Wunused-but-set-variable
4786 @opindex Wno-unused-but-set-variable
4787 Warn whenever a local variable is assigned to, but otherwise unused
4788 (aside from its declaration).
4789 This warning is enabled by @option{-Wall}.
4790
4791 To suppress this warning use the @code{unused} attribute
4792 (@pxref{Variable Attributes}).
4793
4794 This warning is also enabled by @option{-Wunused}, which is enabled
4795 by @option{-Wall}.
4796
4797 @item -Wunused-function
4798 @opindex Wunused-function
4799 @opindex Wno-unused-function
4800 Warn whenever a static function is declared but not defined or a
4801 non-inline static function is unused.
4802 This warning is enabled by @option{-Wall}.
4803
4804 @item -Wunused-label
4805 @opindex Wunused-label
4806 @opindex Wno-unused-label
4807 Warn whenever a label is declared but not used.
4808 This warning is enabled by @option{-Wall}.
4809
4810 To suppress this warning use the @code{unused} attribute
4811 (@pxref{Variable Attributes}).
4812
4813 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4814 @opindex Wunused-local-typedefs
4815 Warn when a typedef locally defined in a function is not used.
4816 This warning is enabled by @option{-Wall}.
4817
4818 @item -Wunused-parameter
4819 @opindex Wunused-parameter
4820 @opindex Wno-unused-parameter
4821 Warn whenever a function parameter is unused aside from its declaration.
4822
4823 To suppress this warning use the @code{unused} attribute
4824 (@pxref{Variable Attributes}).
4825
4826 @item -Wno-unused-result
4827 @opindex Wunused-result
4828 @opindex Wno-unused-result
4829 Do not warn if a caller of a function marked with attribute
4830 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4831 its return value. The default is @option{-Wunused-result}.
4832
4833 @item -Wunused-variable
4834 @opindex Wunused-variable
4835 @opindex Wno-unused-variable
4836 Warn whenever a local or static variable is unused aside from its
4837 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4838 but not for C++. This warning is enabled by @option{-Wall}.
4839
4840 To suppress this warning use the @code{unused} attribute
4841 (@pxref{Variable Attributes}).
4842
4843 @item -Wunused-const-variable
4844 @itemx -Wunused-const-variable=@var{n}
4845 @opindex Wunused-const-variable
4846 @opindex Wno-unused-const-variable
4847 Warn whenever a constant static variable is unused aside from its declaration.
4848 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4849 for C, but not for C++. In C this declares variable storage, but in C++ this
4850 is not an error since const variables take the place of @code{#define}s.
4851
4852 To suppress this warning use the @code{unused} attribute
4853 (@pxref{Variable Attributes}).
4854
4855 @table @gcctabopt
4856 @item -Wunused-const-variable=1
4857 This is the warning level that is enabled by @option{-Wunused-variable} for
4858 C. It warns only about unused static const variables defined in the main
4859 compilation unit, but not about static const variables declared in any
4860 header included.
4861
4862 @item -Wunused-const-variable=2
4863 This warning level also warns for unused constant static variables in
4864 headers (excluding system headers). This is the warning level of
4865 @option{-Wunused-const-variable} and must be explicitly requested since
4866 in C++ this isn't an error and in C it might be harder to clean up all
4867 headers included.
4868 @end table
4869
4870 @item -Wunused-value
4871 @opindex Wunused-value
4872 @opindex Wno-unused-value
4873 Warn whenever a statement computes a result that is explicitly not
4874 used. To suppress this warning cast the unused expression to
4875 @code{void}. This includes an expression-statement or the left-hand
4876 side of a comma expression that contains no side effects. For example,
4877 an expression such as @code{x[i,j]} causes a warning, while
4878 @code{x[(void)i,j]} does not.
4879
4880 This warning is enabled by @option{-Wall}.
4881
4882 @item -Wunused
4883 @opindex Wunused
4884 @opindex Wno-unused
4885 All the above @option{-Wunused} options combined.
4886
4887 In order to get a warning about an unused function parameter, you must
4888 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4889 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4890
4891 @item -Wuninitialized
4892 @opindex Wuninitialized
4893 @opindex Wno-uninitialized
4894 Warn if an automatic variable is used without first being initialized
4895 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4896 warn if a non-static reference or non-static @code{const} member
4897 appears in a class without constructors.
4898
4899 If you want to warn about code that uses the uninitialized value of the
4900 variable in its own initializer, use the @option{-Winit-self} option.
4901
4902 These warnings occur for individual uninitialized or clobbered
4903 elements of structure, union or array variables as well as for
4904 variables that are uninitialized or clobbered as a whole. They do
4905 not occur for variables or elements declared @code{volatile}. Because
4906 these warnings depend on optimization, the exact variables or elements
4907 for which there are warnings depends on the precise optimization
4908 options and version of GCC used.
4909
4910 Note that there may be no warning about a variable that is used only
4911 to compute a value that itself is never used, because such
4912 computations may be deleted by data flow analysis before the warnings
4913 are printed.
4914
4915 @item -Winvalid-memory-model
4916 @opindex Winvalid-memory-model
4917 @opindex Wno-invalid-memory-model
4918 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4919 and the C11 atomic generic functions with a memory consistency argument
4920 that is either invalid for the operation or outside the range of values
4921 of the @code{memory_order} enumeration. For example, since the
4922 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4923 defined for the relaxed, release, and sequentially consistent memory
4924 orders the following code is diagnosed:
4925
4926 @smallexample
4927 void store (int *i)
4928 @{
4929 __atomic_store_n (i, 0, memory_order_consume);
4930 @}
4931 @end smallexample
4932
4933 @option{-Winvalid-memory-model} is enabled by default.
4934
4935 @item -Wmaybe-uninitialized
4936 @opindex Wmaybe-uninitialized
4937 @opindex Wno-maybe-uninitialized
4938 For an automatic variable, if there exists a path from the function
4939 entry to a use of the variable that is initialized, but there exist
4940 some other paths for which the variable is not initialized, the compiler
4941 emits a warning if it cannot prove the uninitialized paths are not
4942 executed at run time. These warnings are made optional because GCC is
4943 not smart enough to see all the reasons why the code might be correct
4944 in spite of appearing to have an error. Here is one example of how
4945 this can happen:
4946
4947 @smallexample
4948 @group
4949 @{
4950 int x;
4951 switch (y)
4952 @{
4953 case 1: x = 1;
4954 break;
4955 case 2: x = 4;
4956 break;
4957 case 3: x = 5;
4958 @}
4959 foo (x);
4960 @}
4961 @end group
4962 @end smallexample
4963
4964 @noindent
4965 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4966 always initialized, but GCC doesn't know this. To suppress the
4967 warning, you need to provide a default case with assert(0) or
4968 similar code.
4969
4970 @cindex @code{longjmp} warnings
4971 This option also warns when a non-volatile automatic variable might be
4972 changed by a call to @code{longjmp}. These warnings as well are possible
4973 only in optimizing compilation.
4974
4975 The compiler sees only the calls to @code{setjmp}. It cannot know
4976 where @code{longjmp} will be called; in fact, a signal handler could
4977 call it at any point in the code. As a result, you may get a warning
4978 even when there is in fact no problem because @code{longjmp} cannot
4979 in fact be called at the place that would cause a problem.
4980
4981 Some spurious warnings can be avoided if you declare all the functions
4982 you use that never return as @code{noreturn}. @xref{Function
4983 Attributes}.
4984
4985 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4986
4987 @item -Wunknown-pragmas
4988 @opindex Wunknown-pragmas
4989 @opindex Wno-unknown-pragmas
4990 @cindex warning for unknown pragmas
4991 @cindex unknown pragmas, warning
4992 @cindex pragmas, warning of unknown
4993 Warn when a @code{#pragma} directive is encountered that is not understood by
4994 GCC@. If this command-line option is used, warnings are even issued
4995 for unknown pragmas in system header files. This is not the case if
4996 the warnings are only enabled by the @option{-Wall} command-line option.
4997
4998 @item -Wno-pragmas
4999 @opindex Wno-pragmas
5000 @opindex Wpragmas
5001 Do not warn about misuses of pragmas, such as incorrect parameters,
5002 invalid syntax, or conflicts between pragmas. See also
5003 @option{-Wunknown-pragmas}.
5004
5005 @item -Wstrict-aliasing
5006 @opindex Wstrict-aliasing
5007 @opindex Wno-strict-aliasing
5008 This option is only active when @option{-fstrict-aliasing} is active.
5009 It warns about code that might break the strict aliasing rules that the
5010 compiler is using for optimization. The warning does not catch all
5011 cases, but does attempt to catch the more common pitfalls. It is
5012 included in @option{-Wall}.
5013 It is equivalent to @option{-Wstrict-aliasing=3}
5014
5015 @item -Wstrict-aliasing=n
5016 @opindex Wstrict-aliasing=n
5017 This option is only active when @option{-fstrict-aliasing} is active.
5018 It warns about code that might break the strict aliasing rules that the
5019 compiler is using for optimization.
5020 Higher levels correspond to higher accuracy (fewer false positives).
5021 Higher levels also correspond to more effort, similar to the way @option{-O}
5022 works.
5023 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5024
5025 Level 1: Most aggressive, quick, least accurate.
5026 Possibly useful when higher levels
5027 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5028 false negatives. However, it has many false positives.
5029 Warns for all pointer conversions between possibly incompatible types,
5030 even if never dereferenced. Runs in the front end only.
5031
5032 Level 2: Aggressive, quick, not too precise.
5033 May still have many false positives (not as many as level 1 though),
5034 and few false negatives (but possibly more than level 1).
5035 Unlike level 1, it only warns when an address is taken. Warns about
5036 incomplete types. Runs in the front end only.
5037
5038 Level 3 (default for @option{-Wstrict-aliasing}):
5039 Should have very few false positives and few false
5040 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5041 Takes care of the common pun+dereference pattern in the front end:
5042 @code{*(int*)&some_float}.
5043 If optimization is enabled, it also runs in the back end, where it deals
5044 with multiple statement cases using flow-sensitive points-to information.
5045 Only warns when the converted pointer is dereferenced.
5046 Does not warn about incomplete types.
5047
5048 @item -Wstrict-overflow
5049 @itemx -Wstrict-overflow=@var{n}
5050 @opindex Wstrict-overflow
5051 @opindex Wno-strict-overflow
5052 This option is only active when signed overflow is undefined.
5053 It warns about cases where the compiler optimizes based on the
5054 assumption that signed overflow does not occur. Note that it does not
5055 warn about all cases where the code might overflow: it only warns
5056 about cases where the compiler implements some optimization. Thus
5057 this warning depends on the optimization level.
5058
5059 An optimization that assumes that signed overflow does not occur is
5060 perfectly safe if the values of the variables involved are such that
5061 overflow never does, in fact, occur. Therefore this warning can
5062 easily give a false positive: a warning about code that is not
5063 actually a problem. To help focus on important issues, several
5064 warning levels are defined. No warnings are issued for the use of
5065 undefined signed overflow when estimating how many iterations a loop
5066 requires, in particular when determining whether a loop will be
5067 executed at all.
5068
5069 @table @gcctabopt
5070 @item -Wstrict-overflow=1
5071 Warn about cases that are both questionable and easy to avoid. For
5072 example the compiler simplifies
5073 @code{x + 1 > x} to @code{1}. This level of
5074 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5075 are not, and must be explicitly requested.
5076
5077 @item -Wstrict-overflow=2
5078 Also warn about other cases where a comparison is simplified to a
5079 constant. For example: @code{abs (x) >= 0}. This can only be
5080 simplified when signed integer overflow is undefined, because
5081 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5082 zero. @option{-Wstrict-overflow} (with no level) is the same as
5083 @option{-Wstrict-overflow=2}.
5084
5085 @item -Wstrict-overflow=3
5086 Also warn about other cases where a comparison is simplified. For
5087 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5088
5089 @item -Wstrict-overflow=4
5090 Also warn about other simplifications not covered by the above cases.
5091 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5092
5093 @item -Wstrict-overflow=5
5094 Also warn about cases where the compiler reduces the magnitude of a
5095 constant involved in a comparison. For example: @code{x + 2 > y} is
5096 simplified to @code{x + 1 >= y}. This is reported only at the
5097 highest warning level because this simplification applies to many
5098 comparisons, so this warning level gives a very large number of
5099 false positives.
5100 @end table
5101
5102 @item -Wstringop-overflow
5103 @itemx -Wstringop-overflow=@var{type}
5104 @opindex Wstringop-overflow
5105 @opindex Wno-stringop-overflow
5106 Warn for calls to string manipulation functions such as @code{memcpy} and
5107 @code{strcpy} that are determined to overflow the destination buffer. The
5108 optional argument is one greater than the type of Object Size Checking to
5109 perform to determine the size of the destination. @xref{Object Size Checking}.
5110 The argument is meaningful only for functions that operate on character arrays
5111 but not for raw memory functions like @code{memcpy} which always make use
5112 of Object Size type-0. The option also warns for calls that specify a size
5113 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5114 The option produces the best results with optimization enabled but can detect
5115 a small subset of simple buffer overflows even without optimization in
5116 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5117 correspond to the standard functions. In any case, the option warns about
5118 just a subset of buffer overflows detected by the corresponding overflow
5119 checking built-ins. For example, the option will issue a warning for
5120 the @code{strcpy} call below because it copies at least 5 characters
5121 (the string @code{"blue"} including the terminating NUL) into the buffer
5122 of size 4.
5123
5124 @smallexample
5125 enum Color @{ blue, purple, yellow @};
5126 const char* f (enum Color clr)
5127 @{
5128 static char buf [4];
5129 const char *str;
5130 switch (clr)
5131 @{
5132 case blue: str = "blue"; break;
5133 case purple: str = "purple"; break;
5134 case yellow: str = "yellow"; break;
5135 @}
5136
5137 return strcpy (buf, str); // warning here
5138 @}
5139 @end smallexample
5140
5141 Option @option{-Wstringop-overflow=2} is enabled by default.
5142
5143 @table @gcctabopt
5144 @item -Wstringop-overflow
5145 @item -Wstringop-overflow=1
5146 @opindex Wstringop-overflow
5147 @opindex Wno-stringop-overflow
5148 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5149 to determine the sizes of destination objects. This is the default setting
5150 of the option. At this setting the option will not warn for writes past
5151 the end of subobjects of larger objects accessed by pointers unless the
5152 size of the largest surrounding object is known. When the destination may
5153 be one of several objects it is assumed to be the largest one of them. On
5154 Linux systems, when optimization is enabled at this setting the option warns
5155 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5156 a non-zero value.
5157
5158 @item -Wstringop-overflow=2
5159 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5160 to determine the sizes of destination objects. At this setting the option
5161 will warn about overflows when writing to members of the largest complete
5162 objects whose exact size is known. It will, however, not warn for excessive
5163 writes to the same members of unknown objects referenced by pointers since
5164 they may point to arrays containing unknown numbers of elements.
5165
5166 @item -Wstringop-overflow=3
5167 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5168 to determine the sizes of destination objects. At this setting the option
5169 warns about overflowing the smallest object or data member. This is the
5170 most restrictive setting of the option that may result in warnings for safe
5171 code.
5172
5173 @item -Wstringop-overflow=4
5174 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5175 to determine the sizes of destination objects. At this setting the option
5176 will warn about overflowing any data members, and when the destination is
5177 one of several objects it uses the size of the largest of them to decide
5178 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5179 setting of the option may result in warnings for benign code.
5180 @end table
5181
5182 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
5183 @opindex Wsuggest-attribute=
5184 @opindex Wno-suggest-attribute=
5185 Warn for cases where adding an attribute may be beneficial. The
5186 attributes currently supported are listed below.
5187
5188 @table @gcctabopt
5189 @item -Wsuggest-attribute=pure
5190 @itemx -Wsuggest-attribute=const
5191 @itemx -Wsuggest-attribute=noreturn
5192 @opindex Wsuggest-attribute=pure
5193 @opindex Wno-suggest-attribute=pure
5194 @opindex Wsuggest-attribute=const
5195 @opindex Wno-suggest-attribute=const
5196 @opindex Wsuggest-attribute=noreturn
5197 @opindex Wno-suggest-attribute=noreturn
5198
5199 Warn about functions that might be candidates for attributes
5200 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
5201 functions visible in other compilation units or (in the case of @code{pure} and
5202 @code{const}) if it cannot prove that the function returns normally. A function
5203 returns normally if it doesn't contain an infinite loop or return abnormally
5204 by throwing, calling @code{abort} or trapping. This analysis requires option
5205 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
5206 higher. Higher optimization levels improve the accuracy of the analysis.
5207
5208 @item -Wsuggest-attribute=format
5209 @itemx -Wmissing-format-attribute
5210 @opindex Wsuggest-attribute=format
5211 @opindex Wmissing-format-attribute
5212 @opindex Wno-suggest-attribute=format
5213 @opindex Wno-missing-format-attribute
5214 @opindex Wformat
5215 @opindex Wno-format
5216
5217 Warn about function pointers that might be candidates for @code{format}
5218 attributes. Note these are only possible candidates, not absolute ones.
5219 GCC guesses that function pointers with @code{format} attributes that
5220 are used in assignment, initialization, parameter passing or return
5221 statements should have a corresponding @code{format} attribute in the
5222 resulting type. I.e.@: the left-hand side of the assignment or
5223 initialization, the type of the parameter variable, or the return type
5224 of the containing function respectively should also have a @code{format}
5225 attribute to avoid the warning.
5226
5227 GCC also warns about function definitions that might be
5228 candidates for @code{format} attributes. Again, these are only
5229 possible candidates. GCC guesses that @code{format} attributes
5230 might be appropriate for any function that calls a function like
5231 @code{vprintf} or @code{vscanf}, but this might not always be the
5232 case, and some functions for which @code{format} attributes are
5233 appropriate may not be detected.
5234 @end table
5235
5236 @item -Wsuggest-final-types
5237 @opindex Wno-suggest-final-types
5238 @opindex Wsuggest-final-types
5239 Warn about types with virtual methods where code quality would be improved
5240 if the type were declared with the C++11 @code{final} specifier,
5241 or, if possible,
5242 declared in an anonymous namespace. This allows GCC to more aggressively
5243 devirtualize the polymorphic calls. This warning is more effective with link
5244 time optimization, where the information about the class hierarchy graph is
5245 more complete.
5246
5247 @item -Wsuggest-final-methods
5248 @opindex Wno-suggest-final-methods
5249 @opindex Wsuggest-final-methods
5250 Warn about virtual methods where code quality would be improved if the method
5251 were declared with the C++11 @code{final} specifier,
5252 or, if possible, its type were
5253 declared in an anonymous namespace or with the @code{final} specifier.
5254 This warning is
5255 more effective with link-time optimization, where the information about the
5256 class hierarchy graph is more complete. It is recommended to first consider
5257 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5258 annotations.
5259
5260 @item -Wsuggest-override
5261 Warn about overriding virtual functions that are not marked with the override
5262 keyword.
5263
5264 @item -Walloc-zero
5265 @opindex Wno-alloc-zero
5266 @opindex Walloc-zero
5267 Warn about calls to allocation functions decorated with attribute
5268 @code{alloc_size} that specify zero bytes, including those to the built-in
5269 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5270 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5271 when called with a zero size differs among implementations (and in the case
5272 of @code{realloc} has been deprecated) relying on it may result in subtle
5273 portability bugs and should be avoided.
5274
5275 @item -Walloc-size-larger-than=@var{n}
5276 Warn about calls to functions decorated with attribute @code{alloc_size}
5277 that attempt to allocate objects larger than the specified number of bytes,
5278 or where the result of the size computation in an integer type with infinite
5279 precision would exceed @code{SIZE_MAX / 2}. The option argument @var{n}
5280 may end in one of the standard suffixes designating a multiple of bytes
5281 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
5282 @code{MB} and @code{MiB} for megabyte and mebibyte, and so on.
5283 @xref{Function Attributes}.
5284
5285 @item -Walloca
5286 @opindex Wno-alloca
5287 @opindex Walloca
5288 This option warns on all uses of @code{alloca} in the source.
5289
5290 @item -Walloca-larger-than=@var{n}
5291 This option warns on calls to @code{alloca} that are not bounded by a
5292 controlling predicate limiting its argument of integer type to at most
5293 @var{n} bytes, or calls to @code{alloca} where the bound is unknown.
5294 Arguments of non-integer types are considered unbounded even if they
5295 appear to be constrained to the expected range.
5296
5297 For example, a bounded case of @code{alloca} could be:
5298
5299 @smallexample
5300 void func (size_t n)
5301 @{
5302 void *p;
5303 if (n <= 1000)
5304 p = alloca (n);
5305 else
5306 p = malloc (n);
5307 f (p);
5308 @}
5309 @end smallexample
5310
5311 In the above example, passing @code{-Walloca-larger-than=1000} would not
5312 issue a warning because the call to @code{alloca} is known to be at most
5313 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5314 the compiler would emit a warning.
5315
5316 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5317 controlling predicate constraining its integer argument. For example:
5318
5319 @smallexample
5320 void func ()
5321 @{
5322 void *p = alloca (n);
5323 f (p);
5324 @}
5325 @end smallexample
5326
5327 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5328 a warning, but this time because of the lack of bounds checking.
5329
5330 Note, that even seemingly correct code involving signed integers could
5331 cause a warning:
5332
5333 @smallexample
5334 void func (signed int n)
5335 @{
5336 if (n < 500)
5337 @{
5338 p = alloca (n);
5339 f (p);
5340 @}
5341 @}
5342 @end smallexample
5343
5344 In the above example, @var{n} could be negative, causing a larger than
5345 expected argument to be implicitly cast into the @code{alloca} call.
5346
5347 This option also warns when @code{alloca} is used in a loop.
5348
5349 This warning is not enabled by @option{-Wall}, and is only active when
5350 @option{-ftree-vrp} is active (default for @option{-O2} and above).
5351
5352 See also @option{-Wvla-larger-than=@var{n}}.
5353
5354 @item -Warray-bounds
5355 @itemx -Warray-bounds=@var{n}
5356 @opindex Wno-array-bounds
5357 @opindex Warray-bounds
5358 This option is only active when @option{-ftree-vrp} is active
5359 (default for @option{-O2} and above). It warns about subscripts to arrays
5360 that are always out of bounds. This warning is enabled by @option{-Wall}.
5361
5362 @table @gcctabopt
5363 @item -Warray-bounds=1
5364 This is the warning level of @option{-Warray-bounds} and is enabled
5365 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5366
5367 @item -Warray-bounds=2
5368 This warning level also warns about out of bounds access for
5369 arrays at the end of a struct and for arrays accessed through
5370 pointers. This warning level may give a larger number of
5371 false positives and is deactivated by default.
5372 @end table
5373
5374 @item -Wbool-compare
5375 @opindex Wno-bool-compare
5376 @opindex Wbool-compare
5377 Warn about boolean expression compared with an integer value different from
5378 @code{true}/@code{false}. For instance, the following comparison is
5379 always false:
5380 @smallexample
5381 int n = 5;
5382 @dots{}
5383 if ((n > 1) == 2) @{ @dots{} @}
5384 @end smallexample
5385 This warning is enabled by @option{-Wall}.
5386
5387 @item -Wbool-operation
5388 @opindex Wno-bool-operation
5389 @opindex Wbool-operation
5390 Warn about suspicious operations on expressions of a boolean type. For
5391 instance, bitwise negation of a boolean is very likely a bug in the program.
5392 For C, this warning also warns about incrementing or decrementing a boolean,
5393 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5394 Incrementing a boolean is invalid in C++1z, and deprecated otherwise.)
5395
5396 This warning is enabled by @option{-Wall}.
5397
5398 @item -Wduplicated-branches
5399 @opindex Wno-duplicated-branches
5400 @opindex Wduplicated-branches
5401 Warn when an if-else has identical branches. This warning detects cases like
5402 @smallexample
5403 if (p != NULL)
5404 return 0;
5405 else
5406 return 0;
5407 @end smallexample
5408 It doesn't warn when both branches contain just a null statement. This warning
5409 also warn for conditional operators:
5410 @smallexample
5411 int i = x ? *p : *p;
5412 @end smallexample
5413
5414 @item -Wduplicated-cond
5415 @opindex Wno-duplicated-cond
5416 @opindex Wduplicated-cond
5417 Warn about duplicated conditions in an if-else-if chain. For instance,
5418 warn for the following code:
5419 @smallexample
5420 if (p->q != NULL) @{ @dots{} @}
5421 else if (p->q != NULL) @{ @dots{} @}
5422 @end smallexample
5423
5424 @item -Wframe-address
5425 @opindex Wno-frame-address
5426 @opindex Wframe-address
5427 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5428 is called with an argument greater than 0. Such calls may return indeterminate
5429 values or crash the program. The warning is included in @option{-Wall}.
5430
5431 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5432 @opindex Wno-discarded-qualifiers
5433 @opindex Wdiscarded-qualifiers
5434 Do not warn if type qualifiers on pointers are being discarded.
5435 Typically, the compiler warns if a @code{const char *} variable is
5436 passed to a function that takes a @code{char *} parameter. This option
5437 can be used to suppress such a warning.
5438
5439 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5440 @opindex Wno-discarded-array-qualifiers
5441 @opindex Wdiscarded-array-qualifiers
5442 Do not warn if type qualifiers on arrays which are pointer targets
5443 are being discarded. Typically, the compiler warns if a
5444 @code{const int (*)[]} variable is passed to a function that
5445 takes a @code{int (*)[]} parameter. This option can be used to
5446 suppress such a warning.
5447
5448 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5449 @opindex Wno-incompatible-pointer-types
5450 @opindex Wincompatible-pointer-types
5451 Do not warn when there is a conversion between pointers that have incompatible
5452 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5453 which warns for pointer argument passing or assignment with different
5454 signedness.
5455
5456 @item -Wno-int-conversion @r{(C and Objective-C only)}
5457 @opindex Wno-int-conversion
5458 @opindex Wint-conversion
5459 Do not warn about incompatible integer to pointer and pointer to integer
5460 conversions. This warning is about implicit conversions; for explicit
5461 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5462 @option{-Wno-pointer-to-int-cast} may be used.
5463
5464 @item -Wno-div-by-zero
5465 @opindex Wno-div-by-zero
5466 @opindex Wdiv-by-zero
5467 Do not warn about compile-time integer division by zero. Floating-point
5468 division by zero is not warned about, as it can be a legitimate way of
5469 obtaining infinities and NaNs.
5470
5471 @item -Wsystem-headers
5472 @opindex Wsystem-headers
5473 @opindex Wno-system-headers
5474 @cindex warnings from system headers
5475 @cindex system headers, warnings from
5476 Print warning messages for constructs found in system header files.
5477 Warnings from system headers are normally suppressed, on the assumption
5478 that they usually do not indicate real problems and would only make the
5479 compiler output harder to read. Using this command-line option tells
5480 GCC to emit warnings from system headers as if they occurred in user
5481 code. However, note that using @option{-Wall} in conjunction with this
5482 option does @emph{not} warn about unknown pragmas in system
5483 headers---for that, @option{-Wunknown-pragmas} must also be used.
5484
5485 @item -Wtautological-compare
5486 @opindex Wtautological-compare
5487 @opindex Wno-tautological-compare
5488 Warn if a self-comparison always evaluates to true or false. This
5489 warning detects various mistakes such as:
5490 @smallexample
5491 int i = 1;
5492 @dots{}
5493 if (i > i) @{ @dots{} @}
5494 @end smallexample
5495 This warning is enabled by @option{-Wall}.
5496
5497 @item -Wtrampolines
5498 @opindex Wtrampolines
5499 @opindex Wno-trampolines
5500 Warn about trampolines generated for pointers to nested functions.
5501 A trampoline is a small piece of data or code that is created at run
5502 time on the stack when the address of a nested function is taken, and is
5503 used to call the nested function indirectly. For some targets, it is
5504 made up of data only and thus requires no special treatment. But, for
5505 most targets, it is made up of code and thus requires the stack to be
5506 made executable in order for the program to work properly.
5507
5508 @item -Wfloat-equal
5509 @opindex Wfloat-equal
5510 @opindex Wno-float-equal
5511 Warn if floating-point values are used in equality comparisons.
5512
5513 The idea behind this is that sometimes it is convenient (for the
5514 programmer) to consider floating-point values as approximations to
5515 infinitely precise real numbers. If you are doing this, then you need
5516 to compute (by analyzing the code, or in some other way) the maximum or
5517 likely maximum error that the computation introduces, and allow for it
5518 when performing comparisons (and when producing output, but that's a
5519 different problem). In particular, instead of testing for equality, you
5520 should check to see whether the two values have ranges that overlap; and
5521 this is done with the relational operators, so equality comparisons are
5522 probably mistaken.
5523
5524 @item -Wtraditional @r{(C and Objective-C only)}
5525 @opindex Wtraditional
5526 @opindex Wno-traditional
5527 Warn about certain constructs that behave differently in traditional and
5528 ISO C@. Also warn about ISO C constructs that have no traditional C
5529 equivalent, and/or problematic constructs that should be avoided.
5530
5531 @itemize @bullet
5532 @item
5533 Macro parameters that appear within string literals in the macro body.
5534 In traditional C macro replacement takes place within string literals,
5535 but in ISO C it does not.
5536
5537 @item
5538 In traditional C, some preprocessor directives did not exist.
5539 Traditional preprocessors only considered a line to be a directive
5540 if the @samp{#} appeared in column 1 on the line. Therefore
5541 @option{-Wtraditional} warns about directives that traditional C
5542 understands but ignores because the @samp{#} does not appear as the
5543 first character on the line. It also suggests you hide directives like
5544 @code{#pragma} not understood by traditional C by indenting them. Some
5545 traditional implementations do not recognize @code{#elif}, so this option
5546 suggests avoiding it altogether.
5547
5548 @item
5549 A function-like macro that appears without arguments.
5550
5551 @item
5552 The unary plus operator.
5553
5554 @item
5555 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5556 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5557 constants.) Note, these suffixes appear in macros defined in the system
5558 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5559 Use of these macros in user code might normally lead to spurious
5560 warnings, however GCC's integrated preprocessor has enough context to
5561 avoid warning in these cases.
5562
5563 @item
5564 A function declared external in one block and then used after the end of
5565 the block.
5566
5567 @item
5568 A @code{switch} statement has an operand of type @code{long}.
5569
5570 @item
5571 A non-@code{static} function declaration follows a @code{static} one.
5572 This construct is not accepted by some traditional C compilers.
5573
5574 @item
5575 The ISO type of an integer constant has a different width or
5576 signedness from its traditional type. This warning is only issued if
5577 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5578 typically represent bit patterns, are not warned about.
5579
5580 @item
5581 Usage of ISO string concatenation is detected.
5582
5583 @item
5584 Initialization of automatic aggregates.
5585
5586 @item
5587 Identifier conflicts with labels. Traditional C lacks a separate
5588 namespace for labels.
5589
5590 @item
5591 Initialization of unions. If the initializer is zero, the warning is
5592 omitted. This is done under the assumption that the zero initializer in
5593 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
5594 initializer warnings and relies on default initialization to zero in the
5595 traditional C case.
5596
5597 @item
5598 Conversions by prototypes between fixed/floating-point values and vice
5599 versa. The absence of these prototypes when compiling with traditional
5600 C causes serious problems. This is a subset of the possible
5601 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
5602
5603 @item
5604 Use of ISO C style function definitions. This warning intentionally is
5605 @emph{not} issued for prototype declarations or variadic functions
5606 because these ISO C features appear in your code when using
5607 libiberty's traditional C compatibility macros, @code{PARAMS} and
5608 @code{VPARAMS}. This warning is also bypassed for nested functions
5609 because that feature is already a GCC extension and thus not relevant to
5610 traditional C compatibility.
5611 @end itemize
5612
5613 @item -Wtraditional-conversion @r{(C and Objective-C only)}
5614 @opindex Wtraditional-conversion
5615 @opindex Wno-traditional-conversion
5616 Warn if a prototype causes a type conversion that is different from what
5617 would happen to the same argument in the absence of a prototype. This
5618 includes conversions of fixed point to floating and vice versa, and
5619 conversions changing the width or signedness of a fixed-point argument
5620 except when the same as the default promotion.
5621
5622 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
5623 @opindex Wdeclaration-after-statement
5624 @opindex Wno-declaration-after-statement
5625 Warn when a declaration is found after a statement in a block. This
5626 construct, known from C++, was introduced with ISO C99 and is by default
5627 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
5628
5629 @item -Wshadow
5630 @opindex Wshadow
5631 @opindex Wno-shadow
5632 Warn whenever a local variable or type declaration shadows another
5633 variable, parameter, type, class member (in C++), or instance variable
5634 (in Objective-C) or whenever a built-in function is shadowed. Note
5635 that in C++, the compiler warns if a local variable shadows an
5636 explicit typedef, but not if it shadows a struct/class/enum.
5637 Same as @option{-Wshadow=global}.
5638
5639 @item -Wno-shadow-ivar @r{(Objective-C only)}
5640 @opindex Wno-shadow-ivar
5641 @opindex Wshadow-ivar
5642 Do not warn whenever a local variable shadows an instance variable in an
5643 Objective-C method.
5644
5645 @item -Wshadow=global
5646 @opindex Wshadow=local
5647 The default for @option{-Wshadow}. Warns for any (global) shadowing.
5648
5649 @item -Wshadow=local
5650 @opindex Wshadow=local
5651 Warn when a local variable shadows another local variable or parameter.
5652 This warning is enabled by @option{-Wshadow=global}.
5653
5654 @item -Wshadow=compatible-local
5655 @opindex Wshadow=compatible-local
5656 Warn when a local variable shadows another local variable or parameter
5657 whose type is compatible with that of the shadowing variable. In C++,
5658 type compatibility here means the type of the shadowing variable can be
5659 converted to that of the shadowed variable. The creation of this flag
5660 (in addition to @option{-Wshadow=local}) is based on the idea that when
5661 a local variable shadows another one of incompatible type, it is most
5662 likely intentional, not a bug or typo, as shown in the following example:
5663
5664 @smallexample
5665 @group
5666 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5667 @{
5668 for (int i = 0; i < N; ++i)
5669 @{
5670 ...
5671 @}
5672 ...
5673 @}
5674 @end group
5675 @end smallexample
5676
5677 Since the two variable @code{i} in the example above have incompatible types,
5678 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
5679 Because their types are incompatible, if a programmer accidentally uses one
5680 in place of the other, type checking will catch that and emit an error or
5681 warning. So not warning (about shadowing) in this case will not lead to
5682 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
5683 possibly reduce the number of warnings triggered by intentional shadowing.
5684
5685 This warning is enabled by @option{-Wshadow=local}.
5686
5687 @item -Wlarger-than=@var{len}
5688 @opindex Wlarger-than=@var{len}
5689 @opindex Wlarger-than-@var{len}
5690 Warn whenever an object of larger than @var{len} bytes is defined.
5691
5692 @item -Wframe-larger-than=@var{len}
5693 @opindex Wframe-larger-than
5694 Warn if the size of a function frame is larger than @var{len} bytes.
5695 The computation done to determine the stack frame size is approximate
5696 and not conservative.
5697 The actual requirements may be somewhat greater than @var{len}
5698 even if you do not get a warning. In addition, any space allocated
5699 via @code{alloca}, variable-length arrays, or related constructs
5700 is not included by the compiler when determining
5701 whether or not to issue a warning.
5702
5703 @item -Wno-free-nonheap-object
5704 @opindex Wno-free-nonheap-object
5705 @opindex Wfree-nonheap-object
5706 Do not warn when attempting to free an object that was not allocated
5707 on the heap.
5708
5709 @item -Wstack-usage=@var{len}
5710 @opindex Wstack-usage
5711 Warn if the stack usage of a function might be larger than @var{len} bytes.
5712 The computation done to determine the stack usage is conservative.
5713 Any space allocated via @code{alloca}, variable-length arrays, or related
5714 constructs is included by the compiler when determining whether or not to
5715 issue a warning.
5716
5717 The message is in keeping with the output of @option{-fstack-usage}.
5718
5719 @itemize
5720 @item
5721 If the stack usage is fully static but exceeds the specified amount, it's:
5722
5723 @smallexample
5724 warning: stack usage is 1120 bytes
5725 @end smallexample
5726 @item
5727 If the stack usage is (partly) dynamic but bounded, it's:
5728
5729 @smallexample
5730 warning: stack usage might be 1648 bytes
5731 @end smallexample
5732 @item
5733 If the stack usage is (partly) dynamic and not bounded, it's:
5734
5735 @smallexample
5736 warning: stack usage might be unbounded
5737 @end smallexample
5738 @end itemize
5739
5740 @item -Wunsafe-loop-optimizations
5741 @opindex Wunsafe-loop-optimizations
5742 @opindex Wno-unsafe-loop-optimizations
5743 Warn if the loop cannot be optimized because the compiler cannot
5744 assume anything on the bounds of the loop indices. With
5745 @option{-funsafe-loop-optimizations} warn if the compiler makes
5746 such assumptions.
5747
5748 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
5749 @opindex Wno-pedantic-ms-format
5750 @opindex Wpedantic-ms-format
5751 When used in combination with @option{-Wformat}
5752 and @option{-pedantic} without GNU extensions, this option
5753 disables the warnings about non-ISO @code{printf} / @code{scanf} format
5754 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
5755 which depend on the MS runtime.
5756
5757 @item -Waligned-new
5758 @opindex Waligned-new
5759 @opindex Wno-aligned-new
5760 Warn about a new-expression of a type that requires greater alignment
5761 than the @code{alignof(std::max_align_t)} but uses an allocation
5762 function without an explicit alignment parameter. This option is
5763 enabled by @option{-Wall}.
5764
5765 Normally this only warns about global allocation functions, but
5766 @option{-Waligned-new=all} also warns about class member allocation
5767 functions.
5768
5769 @item -Wplacement-new
5770 @itemx -Wplacement-new=@var{n}
5771 @opindex Wplacement-new
5772 @opindex Wno-placement-new
5773 Warn about placement new expressions with undefined behavior, such as
5774 constructing an object in a buffer that is smaller than the type of
5775 the object. For example, the placement new expression below is diagnosed
5776 because it attempts to construct an array of 64 integers in a buffer only
5777 64 bytes large.
5778 @smallexample
5779 char buf [64];
5780 new (buf) int[64];
5781 @end smallexample
5782 This warning is enabled by default.
5783
5784 @table @gcctabopt
5785 @item -Wplacement-new=1
5786 This is the default warning level of @option{-Wplacement-new}. At this
5787 level the warning is not issued for some strictly undefined constructs that
5788 GCC allows as extensions for compatibility with legacy code. For example,
5789 the following @code{new} expression is not diagnosed at this level even
5790 though it has undefined behavior according to the C++ standard because
5791 it writes past the end of the one-element array.
5792 @smallexample
5793 struct S @{ int n, a[1]; @};
5794 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5795 new (s->a)int [32]();
5796 @end smallexample
5797
5798 @item -Wplacement-new=2
5799 At this level, in addition to diagnosing all the same constructs as at level
5800 1, a diagnostic is also issued for placement new expressions that construct
5801 an object in the last member of structure whose type is an array of a single
5802 element and whose size is less than the size of the object being constructed.
5803 While the previous example would be diagnosed, the following construct makes
5804 use of the flexible member array extension to avoid the warning at level 2.
5805 @smallexample
5806 struct S @{ int n, a[]; @};
5807 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5808 new (s->a)int [32]();
5809 @end smallexample
5810
5811 @end table
5812
5813 @item -Wpointer-arith
5814 @opindex Wpointer-arith
5815 @opindex Wno-pointer-arith
5816 Warn about anything that depends on the ``size of'' a function type or
5817 of @code{void}. GNU C assigns these types a size of 1, for
5818 convenience in calculations with @code{void *} pointers and pointers
5819 to functions. In C++, warn also when an arithmetic operation involves
5820 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
5821
5822 @item -Wpointer-compare
5823 @opindex Wpointer-compare
5824 @opindex Wno-pointer-compare
5825 Warn if a pointer is compared with a zero character constant. This usually
5826 means that the pointer was meant to be dereferenced. For example:
5827
5828 @smallexample
5829 const char *p = foo ();
5830 if (p == '\0')
5831 return 42;
5832 @end smallexample
5833
5834 Note that the code above is invalid in C++11.
5835
5836 This warning is enabled by default.
5837
5838 @item -Wtype-limits
5839 @opindex Wtype-limits
5840 @opindex Wno-type-limits
5841 Warn if a comparison is always true or always false due to the limited
5842 range of the data type, but do not warn for constant expressions. For
5843 example, warn if an unsigned variable is compared against zero with
5844 @code{<} or @code{>=}. This warning is also enabled by
5845 @option{-Wextra}.
5846
5847 @include cppwarnopts.texi
5848
5849 @item -Wbad-function-cast @r{(C and Objective-C only)}
5850 @opindex Wbad-function-cast
5851 @opindex Wno-bad-function-cast
5852 Warn when a function call is cast to a non-matching type.
5853 For example, warn if a call to a function returning an integer type
5854 is cast to a pointer type.
5855
5856 @item -Wc90-c99-compat @r{(C and Objective-C only)}
5857 @opindex Wc90-c99-compat
5858 @opindex Wno-c90-c99-compat
5859 Warn about features not present in ISO C90, but present in ISO C99.
5860 For instance, warn about use of variable length arrays, @code{long long}
5861 type, @code{bool} type, compound literals, designated initializers, and so
5862 on. This option is independent of the standards mode. Warnings are disabled
5863 in the expression that follows @code{__extension__}.
5864
5865 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5866 @opindex Wc99-c11-compat
5867 @opindex Wno-c99-c11-compat
5868 Warn about features not present in ISO C99, but present in ISO C11.
5869 For instance, warn about use of anonymous structures and unions,
5870 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5871 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5872 and so on. This option is independent of the standards mode. Warnings are
5873 disabled in the expression that follows @code{__extension__}.
5874
5875 @item -Wc++-compat @r{(C and Objective-C only)}
5876 @opindex Wc++-compat
5877 Warn about ISO C constructs that are outside of the common subset of
5878 ISO C and ISO C++, e.g.@: request for implicit conversion from
5879 @code{void *} to a pointer to non-@code{void} type.
5880
5881 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5882 @opindex Wc++11-compat
5883 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5884 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5885 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5886 enabled by @option{-Wall}.
5887
5888 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5889 @opindex Wc++14-compat
5890 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5891 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5892
5893 @item -Wc++1z-compat @r{(C++ and Objective-C++ only)}
5894 @opindex Wc++1z-compat
5895 Warn about C++ constructs whose meaning differs between ISO C++ 2014
5896 and the forthoming ISO C++ 2017(?). This warning is enabled by @option{-Wall}.
5897
5898 @item -Wcast-qual
5899 @opindex Wcast-qual
5900 @opindex Wno-cast-qual
5901 Warn whenever a pointer is cast so as to remove a type qualifier from
5902 the target type. For example, warn if a @code{const char *} is cast
5903 to an ordinary @code{char *}.
5904
5905 Also warn when making a cast that introduces a type qualifier in an
5906 unsafe way. For example, casting @code{char **} to @code{const char **}
5907 is unsafe, as in this example:
5908
5909 @smallexample
5910 /* p is char ** value. */
5911 const char **q = (const char **) p;
5912 /* Assignment of readonly string to const char * is OK. */
5913 *q = "string";
5914 /* Now char** pointer points to read-only memory. */
5915 **p = 'b';
5916 @end smallexample
5917
5918 @item -Wcast-align
5919 @opindex Wcast-align
5920 @opindex Wno-cast-align
5921 Warn whenever a pointer is cast such that the required alignment of the
5922 target is increased. For example, warn if a @code{char *} is cast to
5923 an @code{int *} on machines where integers can only be accessed at
5924 two- or four-byte boundaries.
5925
5926 @item -Wwrite-strings
5927 @opindex Wwrite-strings
5928 @opindex Wno-write-strings
5929 When compiling C, give string constants the type @code{const
5930 char[@var{length}]} so that copying the address of one into a
5931 non-@code{const} @code{char *} pointer produces a warning. These
5932 warnings help you find at compile time code that can try to write
5933 into a string constant, but only if you have been very careful about
5934 using @code{const} in declarations and prototypes. Otherwise, it is
5935 just a nuisance. This is why we did not make @option{-Wall} request
5936 these warnings.
5937
5938 When compiling C++, warn about the deprecated conversion from string
5939 literals to @code{char *}. This warning is enabled by default for C++
5940 programs.
5941
5942 @item -Wcatch-value
5943 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
5944 @opindex Wcatch-value
5945 @opindex Wno-catch-value
5946 Warn about catch handlers that do not catch via reference.
5947 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
5948 warn about polymorphic class types that are caught by value.
5949 With @option{-Wcatch-value=2} warn about all class types that are caught
5950 by value. With @option{-Wcatch-value=3} warn about all types that are
5951 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
5952
5953 @item -Wclobbered
5954 @opindex Wclobbered
5955 @opindex Wno-clobbered
5956 Warn for variables that might be changed by @code{longjmp} or
5957 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5958
5959 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5960 @opindex Wconditionally-supported
5961 @opindex Wno-conditionally-supported
5962 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5963
5964 @item -Wconversion
5965 @opindex Wconversion
5966 @opindex Wno-conversion
5967 Warn for implicit conversions that may alter a value. This includes
5968 conversions between real and integer, like @code{abs (x)} when
5969 @code{x} is @code{double}; conversions between signed and unsigned,
5970 like @code{unsigned ui = -1}; and conversions to smaller types, like
5971 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5972 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5973 changed by the conversion like in @code{abs (2.0)}. Warnings about
5974 conversions between signed and unsigned integers can be disabled by
5975 using @option{-Wno-sign-conversion}.
5976
5977 For C++, also warn for confusing overload resolution for user-defined
5978 conversions; and conversions that never use a type conversion
5979 operator: conversions to @code{void}, the same type, a base class or a
5980 reference to them. Warnings about conversions between signed and
5981 unsigned integers are disabled by default in C++ unless
5982 @option{-Wsign-conversion} is explicitly enabled.
5983
5984 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5985 @opindex Wconversion-null
5986 @opindex Wno-conversion-null
5987 Do not warn for conversions between @code{NULL} and non-pointer
5988 types. @option{-Wconversion-null} is enabled by default.
5989
5990 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5991 @opindex Wzero-as-null-pointer-constant
5992 @opindex Wno-zero-as-null-pointer-constant
5993 Warn when a literal @samp{0} is used as null pointer constant. This can
5994 be useful to facilitate the conversion to @code{nullptr} in C++11.
5995
5996 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5997 @opindex Wsubobject-linkage
5998 @opindex Wno-subobject-linkage
5999 Warn if a class type has a base or a field whose type uses the anonymous
6000 namespace or depends on a type with no linkage. If a type A depends on
6001 a type B with no or internal linkage, defining it in multiple
6002 translation units would be an ODR violation because the meaning of B
6003 is different in each translation unit. If A only appears in a single
6004 translation unit, the best way to silence the warning is to give it
6005 internal linkage by putting it in an anonymous namespace as well. The
6006 compiler doesn't give this warning for types defined in the main .C
6007 file, as those are unlikely to have multiple definitions.
6008 @option{-Wsubobject-linkage} is enabled by default.
6009
6010 @item -Wdangling-else
6011 @opindex Wdangling-else
6012 @opindex Wno-dangling-else
6013 Warn about constructions where there may be confusion to which
6014 @code{if} statement an @code{else} branch belongs. Here is an example of
6015 such a case:
6016
6017 @smallexample
6018 @group
6019 @{
6020 if (a)
6021 if (b)
6022 foo ();
6023 else
6024 bar ();
6025 @}
6026 @end group
6027 @end smallexample
6028
6029 In C/C++, every @code{else} branch belongs to the innermost possible
6030 @code{if} statement, which in this example is @code{if (b)}. This is
6031 often not what the programmer expected, as illustrated in the above
6032 example by indentation the programmer chose. When there is the
6033 potential for this confusion, GCC issues a warning when this flag
6034 is specified. To eliminate the warning, add explicit braces around
6035 the innermost @code{if} statement so there is no way the @code{else}
6036 can belong to the enclosing @code{if}. The resulting code
6037 looks like this:
6038
6039 @smallexample
6040 @group
6041 @{
6042 if (a)
6043 @{
6044 if (b)
6045 foo ();
6046 else
6047 bar ();
6048 @}
6049 @}
6050 @end group
6051 @end smallexample
6052
6053 This warning is enabled by @option{-Wparentheses}.
6054
6055 @item -Wdate-time
6056 @opindex Wdate-time
6057 @opindex Wno-date-time
6058 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6059 are encountered as they might prevent bit-wise-identical reproducible
6060 compilations.
6061
6062 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6063 @opindex Wdelete-incomplete
6064 @opindex Wno-delete-incomplete
6065 Warn when deleting a pointer to incomplete type, which may cause
6066 undefined behavior at runtime. This warning is enabled by default.
6067
6068 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6069 @opindex Wuseless-cast
6070 @opindex Wno-useless-cast
6071 Warn when an expression is casted to its own type.
6072
6073 @item -Wempty-body
6074 @opindex Wempty-body
6075 @opindex Wno-empty-body
6076 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6077 while} statement. This warning is also enabled by @option{-Wextra}.
6078
6079 @item -Wenum-compare
6080 @opindex Wenum-compare
6081 @opindex Wno-enum-compare
6082 Warn about a comparison between values of different enumerated types.
6083 In C++ enumerated type mismatches in conditional expressions are also
6084 diagnosed and the warning is enabled by default. In C this warning is
6085 enabled by @option{-Wall}.
6086
6087 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6088 @opindex Wextra-semi
6089 @opindex Wno-extra-semi
6090 Warn about redundant semicolon after in-class function definition.
6091
6092 @item -Wjump-misses-init @r{(C, Objective-C only)}
6093 @opindex Wjump-misses-init
6094 @opindex Wno-jump-misses-init
6095 Warn if a @code{goto} statement or a @code{switch} statement jumps
6096 forward across the initialization of a variable, or jumps backward to a
6097 label after the variable has been initialized. This only warns about
6098 variables that are initialized when they are declared. This warning is
6099 only supported for C and Objective-C; in C++ this sort of branch is an
6100 error in any case.
6101
6102 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6103 can be disabled with the @option{-Wno-jump-misses-init} option.
6104
6105 @item -Wsign-compare
6106 @opindex Wsign-compare
6107 @opindex Wno-sign-compare
6108 @cindex warning for comparison of signed and unsigned values
6109 @cindex comparison of signed and unsigned values, warning
6110 @cindex signed and unsigned values, comparison warning
6111 Warn when a comparison between signed and unsigned values could produce
6112 an incorrect result when the signed value is converted to unsigned.
6113 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6114 also enabled by @option{-Wextra}.
6115
6116 @item -Wsign-conversion
6117 @opindex Wsign-conversion
6118 @opindex Wno-sign-conversion
6119 Warn for implicit conversions that may change the sign of an integer
6120 value, like assigning a signed integer expression to an unsigned
6121 integer variable. An explicit cast silences the warning. In C, this
6122 option is enabled also by @option{-Wconversion}.
6123
6124 @item -Wfloat-conversion
6125 @opindex Wfloat-conversion
6126 @opindex Wno-float-conversion
6127 Warn for implicit conversions that reduce the precision of a real value.
6128 This includes conversions from real to integer, and from higher precision
6129 real to lower precision real values. This option is also enabled by
6130 @option{-Wconversion}.
6131
6132 @item -Wno-scalar-storage-order
6133 @opindex -Wno-scalar-storage-order
6134 @opindex -Wscalar-storage-order
6135 Do not warn on suspicious constructs involving reverse scalar storage order.
6136
6137 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6138 @opindex Wsized-deallocation
6139 @opindex Wno-sized-deallocation
6140 Warn about a definition of an unsized deallocation function
6141 @smallexample
6142 void operator delete (void *) noexcept;
6143 void operator delete[] (void *) noexcept;
6144 @end smallexample
6145 without a definition of the corresponding sized deallocation function
6146 @smallexample
6147 void operator delete (void *, std::size_t) noexcept;
6148 void operator delete[] (void *, std::size_t) noexcept;
6149 @end smallexample
6150 or vice versa. Enabled by @option{-Wextra} along with
6151 @option{-fsized-deallocation}.
6152
6153 @item -Wsizeof-pointer-div
6154 @opindex Wsizeof-pointer-div
6155 @opindex Wno-sizeof-pointer-div
6156 Warn for suspicious divisions of two sizeof expressions that divide
6157 the pointer size by the element size, which is the usual way to compute
6158 the array size but won't work out correctly with pointers. This warning
6159 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6160 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6161
6162 @item -Wsizeof-pointer-memaccess
6163 @opindex Wsizeof-pointer-memaccess
6164 @opindex Wno-sizeof-pointer-memaccess
6165 Warn for suspicious length parameters to certain string and memory built-in
6166 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
6167 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
6168 but a pointer, and suggests a possible fix, or about
6169 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
6170 @option{-Wall}.
6171
6172 @item -Wsizeof-array-argument
6173 @opindex Wsizeof-array-argument
6174 @opindex Wno-sizeof-array-argument
6175 Warn when the @code{sizeof} operator is applied to a parameter that is
6176 declared as an array in a function definition. This warning is enabled by
6177 default for C and C++ programs.
6178
6179 @item -Wmemset-elt-size
6180 @opindex Wmemset-elt-size
6181 @opindex Wno-memset-elt-size
6182 Warn for suspicious calls to the @code{memset} built-in function, if the
6183 first argument references an array, and the third argument is a number
6184 equal to the number of elements, but not equal to the size of the array
6185 in memory. This indicates that the user has omitted a multiplication by
6186 the element size. This warning is enabled by @option{-Wall}.
6187
6188 @item -Wmemset-transposed-args
6189 @opindex Wmemset-transposed-args
6190 @opindex Wno-memset-transposed-args
6191 Warn for suspicious calls to the @code{memset} built-in function, if the
6192 second argument is not zero and the third argument is zero. This warns e.g.@
6193 about @code{memset (buf, sizeof buf, 0)} where most probably
6194 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6195 is only emitted if the third argument is literal zero. If it is some
6196 expression that is folded to zero, a cast of zero to some type, etc.,
6197 it is far less likely that the user has mistakenly exchanged the arguments
6198 and no warning is emitted. This warning is enabled by @option{-Wall}.
6199
6200 @item -Waddress
6201 @opindex Waddress
6202 @opindex Wno-address
6203 Warn about suspicious uses of memory addresses. These include using
6204 the address of a function in a conditional expression, such as
6205 @code{void func(void); if (func)}, and comparisons against the memory
6206 address of a string literal, such as @code{if (x == "abc")}. Such
6207 uses typically indicate a programmer error: the address of a function
6208 always evaluates to true, so their use in a conditional usually
6209 indicate that the programmer forgot the parentheses in a function
6210 call; and comparisons against string literals result in unspecified
6211 behavior and are not portable in C, so they usually indicate that the
6212 programmer intended to use @code{strcmp}. This warning is enabled by
6213 @option{-Wall}.
6214
6215 @item -Wlogical-op
6216 @opindex Wlogical-op
6217 @opindex Wno-logical-op
6218 Warn about suspicious uses of logical operators in expressions.
6219 This includes using logical operators in contexts where a
6220 bit-wise operator is likely to be expected. Also warns when
6221 the operands of a logical operator are the same:
6222 @smallexample
6223 extern int a;
6224 if (a < 0 && a < 0) @{ @dots{} @}
6225 @end smallexample
6226
6227 @item -Wlogical-not-parentheses
6228 @opindex Wlogical-not-parentheses
6229 @opindex Wno-logical-not-parentheses
6230 Warn about logical not used on the left hand side operand of a comparison.
6231 This option does not warn if the right operand is considered to be a boolean
6232 expression. Its purpose is to detect suspicious code like the following:
6233 @smallexample
6234 int a;
6235 @dots{}
6236 if (!a > 1) @{ @dots{} @}
6237 @end smallexample
6238
6239 It is possible to suppress the warning by wrapping the LHS into
6240 parentheses:
6241 @smallexample
6242 if ((!a) > 1) @{ @dots{} @}
6243 @end smallexample
6244
6245 This warning is enabled by @option{-Wall}.
6246
6247 @item -Waggregate-return
6248 @opindex Waggregate-return
6249 @opindex Wno-aggregate-return
6250 Warn if any functions that return structures or unions are defined or
6251 called. (In languages where you can return an array, this also elicits
6252 a warning.)
6253
6254 @item -Wno-aggressive-loop-optimizations
6255 @opindex Wno-aggressive-loop-optimizations
6256 @opindex Waggressive-loop-optimizations
6257 Warn if in a loop with constant number of iterations the compiler detects
6258 undefined behavior in some statement during one or more of the iterations.
6259
6260 @item -Wno-attributes
6261 @opindex Wno-attributes
6262 @opindex Wattributes
6263 Do not warn if an unexpected @code{__attribute__} is used, such as
6264 unrecognized attributes, function attributes applied to variables,
6265 etc. This does not stop errors for incorrect use of supported
6266 attributes.
6267
6268 @item -Wno-builtin-declaration-mismatch
6269 @opindex Wno-builtin-declaration-mismatch
6270 @opindex Wbuiltin-declaration-mismatch
6271 Warn if a built-in function is declared with the wrong signature.
6272 This warning is enabled by default.
6273
6274 @item -Wno-builtin-macro-redefined
6275 @opindex Wno-builtin-macro-redefined
6276 @opindex Wbuiltin-macro-redefined
6277 Do not warn if certain built-in macros are redefined. This suppresses
6278 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6279 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6280
6281 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6282 @opindex Wstrict-prototypes
6283 @opindex Wno-strict-prototypes
6284 Warn if a function is declared or defined without specifying the
6285 argument types. (An old-style function definition is permitted without
6286 a warning if preceded by a declaration that specifies the argument
6287 types.)
6288
6289 @item -Wold-style-declaration @r{(C and Objective-C only)}
6290 @opindex Wold-style-declaration
6291 @opindex Wno-old-style-declaration
6292 Warn for obsolescent usages, according to the C Standard, in a
6293 declaration. For example, warn if storage-class specifiers like
6294 @code{static} are not the first things in a declaration. This warning
6295 is also enabled by @option{-Wextra}.
6296
6297 @item -Wold-style-definition @r{(C and Objective-C only)}
6298 @opindex Wold-style-definition
6299 @opindex Wno-old-style-definition
6300 Warn if an old-style function definition is used. A warning is given
6301 even if there is a previous prototype.
6302
6303 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6304 @opindex Wmissing-parameter-type
6305 @opindex Wno-missing-parameter-type
6306 A function parameter is declared without a type specifier in K&R-style
6307 functions:
6308
6309 @smallexample
6310 void foo(bar) @{ @}
6311 @end smallexample
6312
6313 This warning is also enabled by @option{-Wextra}.
6314
6315 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6316 @opindex Wmissing-prototypes
6317 @opindex Wno-missing-prototypes
6318 Warn if a global function is defined without a previous prototype
6319 declaration. This warning is issued even if the definition itself
6320 provides a prototype. Use this option to detect global functions
6321 that do not have a matching prototype declaration in a header file.
6322 This option is not valid for C++ because all function declarations
6323 provide prototypes and a non-matching declaration declares an
6324 overload rather than conflict with an earlier declaration.
6325 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6326
6327 @item -Wmissing-declarations
6328 @opindex Wmissing-declarations
6329 @opindex Wno-missing-declarations
6330 Warn if a global function is defined without a previous declaration.
6331 Do so even if the definition itself provides a prototype.
6332 Use this option to detect global functions that are not declared in
6333 header files. In C, no warnings are issued for functions with previous
6334 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6335 missing prototypes. In C++, no warnings are issued for function templates,
6336 or for inline functions, or for functions in anonymous namespaces.
6337
6338 @item -Wmissing-field-initializers
6339 @opindex Wmissing-field-initializers
6340 @opindex Wno-missing-field-initializers
6341 @opindex W
6342 @opindex Wextra
6343 @opindex Wno-extra
6344 Warn if a structure's initializer has some fields missing. For
6345 example, the following code causes such a warning, because
6346 @code{x.h} is implicitly zero:
6347
6348 @smallexample
6349 struct s @{ int f, g, h; @};
6350 struct s x = @{ 3, 4 @};
6351 @end smallexample
6352
6353 This option does not warn about designated initializers, so the following
6354 modification does not trigger a warning:
6355
6356 @smallexample
6357 struct s @{ int f, g, h; @};
6358 struct s x = @{ .f = 3, .g = 4 @};
6359 @end smallexample
6360
6361 In C this option does not warn about the universal zero initializer
6362 @samp{@{ 0 @}}:
6363
6364 @smallexample
6365 struct s @{ int f, g, h; @};
6366 struct s x = @{ 0 @};
6367 @end smallexample
6368
6369 Likewise, in C++ this option does not warn about the empty @{ @}
6370 initializer, for example:
6371
6372 @smallexample
6373 struct s @{ int f, g, h; @};
6374 s x = @{ @};
6375 @end smallexample
6376
6377 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6378 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6379
6380 @item -Wno-multichar
6381 @opindex Wno-multichar
6382 @opindex Wmultichar
6383 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6384 Usually they indicate a typo in the user's code, as they have
6385 implementation-defined values, and should not be used in portable code.
6386
6387 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6388 @opindex Wnormalized=
6389 @opindex Wnormalized
6390 @opindex Wno-normalized
6391 @cindex NFC
6392 @cindex NFKC
6393 @cindex character set, input normalization
6394 In ISO C and ISO C++, two identifiers are different if they are
6395 different sequences of characters. However, sometimes when characters
6396 outside the basic ASCII character set are used, you can have two
6397 different character sequences that look the same. To avoid confusion,
6398 the ISO 10646 standard sets out some @dfn{normalization rules} which
6399 when applied ensure that two sequences that look the same are turned into
6400 the same sequence. GCC can warn you if you are using identifiers that
6401 have not been normalized; this option controls that warning.
6402
6403 There are four levels of warning supported by GCC@. The default is
6404 @option{-Wnormalized=nfc}, which warns about any identifier that is
6405 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6406 recommended form for most uses. It is equivalent to
6407 @option{-Wnormalized}.
6408
6409 Unfortunately, there are some characters allowed in identifiers by
6410 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6411 identifiers. That is, there's no way to use these symbols in portable
6412 ISO C or C++ and have all your identifiers in NFC@.
6413 @option{-Wnormalized=id} suppresses the warning for these characters.
6414 It is hoped that future versions of the standards involved will correct
6415 this, which is why this option is not the default.
6416
6417 You can switch the warning off for all characters by writing
6418 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6419 only do this if you are using some other normalization scheme (like
6420 ``D''), because otherwise you can easily create bugs that are
6421 literally impossible to see.
6422
6423 Some characters in ISO 10646 have distinct meanings but look identical
6424 in some fonts or display methodologies, especially once formatting has
6425 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6426 LETTER N'', displays just like a regular @code{n} that has been
6427 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6428 normalization scheme to convert all these into a standard form as
6429 well, and GCC warns if your code is not in NFKC if you use
6430 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6431 about every identifier that contains the letter O because it might be
6432 confused with the digit 0, and so is not the default, but may be
6433 useful as a local coding convention if the programming environment
6434 cannot be fixed to display these characters distinctly.
6435
6436 @item -Wno-deprecated
6437 @opindex Wno-deprecated
6438 @opindex Wdeprecated
6439 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6440
6441 @item -Wno-deprecated-declarations
6442 @opindex Wno-deprecated-declarations
6443 @opindex Wdeprecated-declarations
6444 Do not warn about uses of functions (@pxref{Function Attributes}),
6445 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6446 Attributes}) marked as deprecated by using the @code{deprecated}
6447 attribute.
6448
6449 @item -Wno-overflow
6450 @opindex Wno-overflow
6451 @opindex Woverflow
6452 Do not warn about compile-time overflow in constant expressions.
6453
6454 @item -Wno-odr
6455 @opindex Wno-odr
6456 @opindex Wodr
6457 Warn about One Definition Rule violations during link-time optimization.
6458 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6459
6460 @item -Wopenmp-simd
6461 @opindex Wopenm-simd
6462 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
6463 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6464 option can be used to relax the cost model.
6465
6466 @item -Woverride-init @r{(C and Objective-C only)}
6467 @opindex Woverride-init
6468 @opindex Wno-override-init
6469 @opindex W
6470 @opindex Wextra
6471 @opindex Wno-extra
6472 Warn if an initialized field without side effects is overridden when
6473 using designated initializers (@pxref{Designated Inits, , Designated
6474 Initializers}).
6475
6476 This warning is included in @option{-Wextra}. To get other
6477 @option{-Wextra} warnings without this one, use @option{-Wextra
6478 -Wno-override-init}.
6479
6480 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6481 @opindex Woverride-init-side-effects
6482 @opindex Wno-override-init-side-effects
6483 Warn if an initialized field with side effects is overridden when
6484 using designated initializers (@pxref{Designated Inits, , Designated
6485 Initializers}). This warning is enabled by default.
6486
6487 @item -Wpacked
6488 @opindex Wpacked
6489 @opindex Wno-packed
6490 Warn if a structure is given the packed attribute, but the packed
6491 attribute has no effect on the layout or size of the structure.
6492 Such structures may be mis-aligned for little benefit. For
6493 instance, in this code, the variable @code{f.x} in @code{struct bar}
6494 is misaligned even though @code{struct bar} does not itself
6495 have the packed attribute:
6496
6497 @smallexample
6498 @group
6499 struct foo @{
6500 int x;
6501 char a, b, c, d;
6502 @} __attribute__((packed));
6503 struct bar @{
6504 char z;
6505 struct foo f;
6506 @};
6507 @end group
6508 @end smallexample
6509
6510 @item -Wpacked-bitfield-compat
6511 @opindex Wpacked-bitfield-compat
6512 @opindex Wno-packed-bitfield-compat
6513 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
6514 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
6515 the change can lead to differences in the structure layout. GCC
6516 informs you when the offset of such a field has changed in GCC 4.4.
6517 For example there is no longer a 4-bit padding between field @code{a}
6518 and @code{b} in this structure:
6519
6520 @smallexample
6521 struct foo
6522 @{
6523 char a:4;
6524 char b:8;
6525 @} __attribute__ ((packed));
6526 @end smallexample
6527
6528 This warning is enabled by default. Use
6529 @option{-Wno-packed-bitfield-compat} to disable this warning.
6530
6531 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6532 @opindex Wpacked-not-aligned
6533 @opindex Wno-packed-not-aligned
6534 Warn if a structure field with explicitly specified alignment in a
6535 packed struct or union is misaligned. For example, a warning will
6536 be issued on @code{struct S}, like, @code{warning: alignment 1 of
6537 'struct S' is less than 8}, in this code:
6538
6539 @smallexample
6540 @group
6541 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
6542 struct __attribute__ ((packed)) S @{
6543 struct S8 s8;
6544 @};
6545 @end group
6546 @end smallexample
6547
6548 This warning is enabled by @option{-Wall}.
6549
6550 @item -Wpadded
6551 @opindex Wpadded
6552 @opindex Wno-padded
6553 Warn if padding is included in a structure, either to align an element
6554 of the structure or to align the whole structure. Sometimes when this
6555 happens it is possible to rearrange the fields of the structure to
6556 reduce the padding and so make the structure smaller.
6557
6558 @item -Wredundant-decls
6559 @opindex Wredundant-decls
6560 @opindex Wno-redundant-decls
6561 Warn if anything is declared more than once in the same scope, even in
6562 cases where multiple declaration is valid and changes nothing.
6563
6564 @item -Wrestrict
6565 @opindex Wrestrict
6566 @opindex Wno-restrict
6567 Warn when an argument passed to a restrict-qualified parameter
6568 aliases with another argument.
6569
6570 @item -Wnested-externs @r{(C and Objective-C only)}
6571 @opindex Wnested-externs
6572 @opindex Wno-nested-externs
6573 Warn if an @code{extern} declaration is encountered within a function.
6574
6575 @item -Wno-inherited-variadic-ctor
6576 @opindex Winherited-variadic-ctor
6577 @opindex Wno-inherited-variadic-ctor
6578 Suppress warnings about use of C++11 inheriting constructors when the
6579 base class inherited from has a C variadic constructor; the warning is
6580 on by default because the ellipsis is not inherited.
6581
6582 @item -Winline
6583 @opindex Winline
6584 @opindex Wno-inline
6585 Warn if a function that is declared as inline cannot be inlined.
6586 Even with this option, the compiler does not warn about failures to
6587 inline functions declared in system headers.
6588
6589 The compiler uses a variety of heuristics to determine whether or not
6590 to inline a function. For example, the compiler takes into account
6591 the size of the function being inlined and the amount of inlining
6592 that has already been done in the current function. Therefore,
6593 seemingly insignificant changes in the source program can cause the
6594 warnings produced by @option{-Winline} to appear or disappear.
6595
6596 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6597 @opindex Wno-invalid-offsetof
6598 @opindex Winvalid-offsetof
6599 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6600 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6601 to a non-standard-layout type is undefined. In existing C++ implementations,
6602 however, @code{offsetof} typically gives meaningful results.
6603 This flag is for users who are aware that they are
6604 writing nonportable code and who have deliberately chosen to ignore the
6605 warning about it.
6606
6607 The restrictions on @code{offsetof} may be relaxed in a future version
6608 of the C++ standard.
6609
6610 @item -Wint-in-bool-context
6611 @opindex Wint-in-bool-context
6612 @opindex Wno-int-in-bool-context
6613 Warn for suspicious use of integer values where boolean values are expected,
6614 such as conditional expressions (?:) using non-boolean integer constants in
6615 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
6616 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
6617 for all kinds of multiplications regardless of the data type.
6618 This warning is enabled by @option{-Wall}.
6619
6620 @item -Wno-int-to-pointer-cast
6621 @opindex Wno-int-to-pointer-cast
6622 @opindex Wint-to-pointer-cast
6623 Suppress warnings from casts to pointer type of an integer of a
6624 different size. In C++, casting to a pointer type of smaller size is
6625 an error. @option{Wint-to-pointer-cast} is enabled by default.
6626
6627
6628 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
6629 @opindex Wno-pointer-to-int-cast
6630 @opindex Wpointer-to-int-cast
6631 Suppress warnings from casts from a pointer to an integer type of a
6632 different size.
6633
6634 @item -Winvalid-pch
6635 @opindex Winvalid-pch
6636 @opindex Wno-invalid-pch
6637 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
6638 the search path but cannot be used.
6639
6640 @item -Wlong-long
6641 @opindex Wlong-long
6642 @opindex Wno-long-long
6643 Warn if @code{long long} type is used. This is enabled by either
6644 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
6645 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
6646
6647 @item -Wvariadic-macros
6648 @opindex Wvariadic-macros
6649 @opindex Wno-variadic-macros
6650 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6651 alternate syntax is used in ISO C99 mode. This is enabled by either
6652 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
6653 messages, use @option{-Wno-variadic-macros}.
6654
6655 @item -Wvarargs
6656 @opindex Wvarargs
6657 @opindex Wno-varargs
6658 Warn upon questionable usage of the macros used to handle variable
6659 arguments like @code{va_start}. This is default. To inhibit the
6660 warning messages, use @option{-Wno-varargs}.
6661
6662 @item -Wvector-operation-performance
6663 @opindex Wvector-operation-performance
6664 @opindex Wno-vector-operation-performance
6665 Warn if vector operation is not implemented via SIMD capabilities of the
6666 architecture. Mainly useful for the performance tuning.
6667 Vector operation can be implemented @code{piecewise}, which means that the
6668 scalar operation is performed on every vector element;
6669 @code{in parallel}, which means that the vector operation is implemented
6670 using scalars of wider type, which normally is more performance efficient;
6671 and @code{as a single scalar}, which means that vector fits into a
6672 scalar type.
6673
6674 @item -Wno-virtual-move-assign
6675 @opindex Wvirtual-move-assign
6676 @opindex Wno-virtual-move-assign
6677 Suppress warnings about inheriting from a virtual base with a
6678 non-trivial C++11 move assignment operator. This is dangerous because
6679 if the virtual base is reachable along more than one path, it is
6680 moved multiple times, which can mean both objects end up in the
6681 moved-from state. If the move assignment operator is written to avoid
6682 moving from a moved-from object, this warning can be disabled.
6683
6684 @item -Wvla
6685 @opindex Wvla
6686 @opindex Wno-vla
6687 Warn if a variable-length array is used in the code.
6688 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
6689 the variable-length array.
6690
6691 @item -Wvla-larger-than=@var{n}
6692 If this option is used, the compiler will warn on uses of
6693 variable-length arrays where the size is either unbounded, or bounded
6694 by an argument that can be larger than @var{n} bytes. This is similar
6695 to how @option{-Walloca-larger-than=@var{n}} works, but with
6696 variable-length arrays.
6697
6698 Note that GCC may optimize small variable-length arrays of a known
6699 value into plain arrays, so this warning may not get triggered for
6700 such arrays.
6701
6702 This warning is not enabled by @option{-Wall}, and is only active when
6703 @option{-ftree-vrp} is active (default for @option{-O2} and above).
6704
6705 See also @option{-Walloca-larger-than=@var{n}}.
6706
6707 @item -Wvolatile-register-var
6708 @opindex Wvolatile-register-var
6709 @opindex Wno-volatile-register-var
6710 Warn if a register variable is declared volatile. The volatile
6711 modifier does not inhibit all optimizations that may eliminate reads
6712 and/or writes to register variables. This warning is enabled by
6713 @option{-Wall}.
6714
6715 @item -Wdisabled-optimization
6716 @opindex Wdisabled-optimization
6717 @opindex Wno-disabled-optimization
6718 Warn if a requested optimization pass is disabled. This warning does
6719 not generally indicate that there is anything wrong with your code; it
6720 merely indicates that GCC's optimizers are unable to handle the code
6721 effectively. Often, the problem is that your code is too big or too
6722 complex; GCC refuses to optimize programs when the optimization
6723 itself is likely to take inordinate amounts of time.
6724
6725 @item -Wpointer-sign @r{(C and Objective-C only)}
6726 @opindex Wpointer-sign
6727 @opindex Wno-pointer-sign
6728 Warn for pointer argument passing or assignment with different signedness.
6729 This option is only supported for C and Objective-C@. It is implied by
6730 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
6731 @option{-Wno-pointer-sign}.
6732
6733 @item -Wstack-protector
6734 @opindex Wstack-protector
6735 @opindex Wno-stack-protector
6736 This option is only active when @option{-fstack-protector} is active. It
6737 warns about functions that are not protected against stack smashing.
6738
6739 @item -Woverlength-strings
6740 @opindex Woverlength-strings
6741 @opindex Wno-overlength-strings
6742 Warn about string constants that are longer than the ``minimum
6743 maximum'' length specified in the C standard. Modern compilers
6744 generally allow string constants that are much longer than the
6745 standard's minimum limit, but very portable programs should avoid
6746 using longer strings.
6747
6748 The limit applies @emph{after} string constant concatenation, and does
6749 not count the trailing NUL@. In C90, the limit was 509 characters; in
6750 C99, it was raised to 4095. C++98 does not specify a normative
6751 minimum maximum, so we do not diagnose overlength strings in C++@.
6752
6753 This option is implied by @option{-Wpedantic}, and can be disabled with
6754 @option{-Wno-overlength-strings}.
6755
6756 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
6757 @opindex Wunsuffixed-float-constants
6758
6759 Issue a warning for any floating constant that does not have
6760 a suffix. When used together with @option{-Wsystem-headers} it
6761 warns about such constants in system header files. This can be useful
6762 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
6763 from the decimal floating-point extension to C99.
6764
6765 @item -Wno-designated-init @r{(C and Objective-C only)}
6766 Suppress warnings when a positional initializer is used to initialize
6767 a structure that has been marked with the @code{designated_init}
6768 attribute.
6769
6770 @item -Whsa
6771 Issue a warning when HSAIL cannot be emitted for the compiled function or
6772 OpenMP construct.
6773
6774 @end table
6775
6776 @node Debugging Options
6777 @section Options for Debugging Your Program
6778 @cindex options, debugging
6779 @cindex debugging information options
6780
6781 To tell GCC to emit extra information for use by a debugger, in almost
6782 all cases you need only to add @option{-g} to your other options.
6783
6784 GCC allows you to use @option{-g} with
6785 @option{-O}. The shortcuts taken by optimized code may occasionally
6786 be surprising: some variables you declared may not exist
6787 at all; flow of control may briefly move where you did not expect it;
6788 some statements may not be executed because they compute constant
6789 results or their values are already at hand; some statements may
6790 execute in different places because they have been moved out of loops.
6791 Nevertheless it is possible to debug optimized output. This makes
6792 it reasonable to use the optimizer for programs that might have bugs.
6793
6794 If you are not using some other optimization option, consider
6795 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
6796 With no @option{-O} option at all, some compiler passes that collect
6797 information useful for debugging do not run at all, so that
6798 @option{-Og} may result in a better debugging experience.
6799
6800 @table @gcctabopt
6801 @item -g
6802 @opindex g
6803 Produce debugging information in the operating system's native format
6804 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
6805 information.
6806
6807 On most systems that use stabs format, @option{-g} enables use of extra
6808 debugging information that only GDB can use; this extra information
6809 makes debugging work better in GDB but probably makes other debuggers
6810 crash or
6811 refuse to read the program. If you want to control for certain whether
6812 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
6813 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
6814
6815 @item -ggdb
6816 @opindex ggdb
6817 Produce debugging information for use by GDB@. This means to use the
6818 most expressive format available (DWARF, stabs, or the native format
6819 if neither of those are supported), including GDB extensions if at all
6820 possible.
6821
6822 @item -gdwarf
6823 @itemx -gdwarf-@var{version}
6824 @opindex gdwarf
6825 Produce debugging information in DWARF format (if that is supported).
6826 The value of @var{version} may be either 2, 3, 4 or 5; the default version
6827 for most targets is 4. DWARF Version 5 is only experimental.
6828
6829 Note that with DWARF Version 2, some ports require and always
6830 use some non-conflicting DWARF 3 extensions in the unwind tables.
6831
6832 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
6833 for maximum benefit.
6834
6835 GCC no longer supports DWARF Version 1, which is substantially
6836 different than Version 2 and later. For historical reasons, some
6837 other DWARF-related options such as
6838 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
6839 in their names, but apply to all currently-supported versions of DWARF.
6840
6841 @item -gstabs
6842 @opindex gstabs
6843 Produce debugging information in stabs format (if that is supported),
6844 without GDB extensions. This is the format used by DBX on most BSD
6845 systems. On MIPS, Alpha and System V Release 4 systems this option
6846 produces stabs debugging output that is not understood by DBX or SDB@.
6847 On System V Release 4 systems this option requires the GNU assembler.
6848
6849 @item -gstabs+
6850 @opindex gstabs+
6851 Produce debugging information in stabs format (if that is supported),
6852 using GNU extensions understood only by the GNU debugger (GDB)@. The
6853 use of these extensions is likely to make other debuggers crash or
6854 refuse to read the program.
6855
6856 @item -gcoff
6857 @opindex gcoff
6858 Produce debugging information in COFF format (if that is supported).
6859 This is the format used by SDB on most System V systems prior to
6860 System V Release 4.
6861
6862 @item -gxcoff
6863 @opindex gxcoff
6864 Produce debugging information in XCOFF format (if that is supported).
6865 This is the format used by the DBX debugger on IBM RS/6000 systems.
6866
6867 @item -gxcoff+
6868 @opindex gxcoff+
6869 Produce debugging information in XCOFF format (if that is supported),
6870 using GNU extensions understood only by the GNU debugger (GDB)@. The
6871 use of these extensions is likely to make other debuggers crash or
6872 refuse to read the program, and may cause assemblers other than the GNU
6873 assembler (GAS) to fail with an error.
6874
6875 @item -gvms
6876 @opindex gvms
6877 Produce debugging information in Alpha/VMS debug format (if that is
6878 supported). This is the format used by DEBUG on Alpha/VMS systems.
6879
6880 @item -g@var{level}
6881 @itemx -ggdb@var{level}
6882 @itemx -gstabs@var{level}
6883 @itemx -gcoff@var{level}
6884 @itemx -gxcoff@var{level}
6885 @itemx -gvms@var{level}
6886 Request debugging information and also use @var{level} to specify how
6887 much information. The default level is 2.
6888
6889 Level 0 produces no debug information at all. Thus, @option{-g0} negates
6890 @option{-g}.
6891
6892 Level 1 produces minimal information, enough for making backtraces in
6893 parts of the program that you don't plan to debug. This includes
6894 descriptions of functions and external variables, and line number
6895 tables, but no information about local variables.
6896
6897 Level 3 includes extra information, such as all the macro definitions
6898 present in the program. Some debuggers support macro expansion when
6899 you use @option{-g3}.
6900
6901 @option{-gdwarf} does not accept a concatenated debug level, to avoid
6902 confusion with @option{-gdwarf-@var{level}}.
6903 Instead use an additional @option{-g@var{level}} option to change the
6904 debug level for DWARF.
6905
6906 @item -feliminate-unused-debug-symbols
6907 @opindex feliminate-unused-debug-symbols
6908 Produce debugging information in stabs format (if that is supported),
6909 for only symbols that are actually used.
6910
6911 @item -femit-class-debug-always
6912 @opindex femit-class-debug-always
6913 Instead of emitting debugging information for a C++ class in only one
6914 object file, emit it in all object files using the class. This option
6915 should be used only with debuggers that are unable to handle the way GCC
6916 normally emits debugging information for classes because using this
6917 option increases the size of debugging information by as much as a
6918 factor of two.
6919
6920 @item -fno-merge-debug-strings
6921 @opindex fmerge-debug-strings
6922 @opindex fno-merge-debug-strings
6923 Direct the linker to not merge together strings in the debugging
6924 information that are identical in different object files. Merging is
6925 not supported by all assemblers or linkers. Merging decreases the size
6926 of the debug information in the output file at the cost of increasing
6927 link processing time. Merging is enabled by default.
6928
6929 @item -fdebug-prefix-map=@var{old}=@var{new}
6930 @opindex fdebug-prefix-map
6931 When compiling files in directory @file{@var{old}}, record debugging
6932 information describing them as in @file{@var{new}} instead.
6933
6934 @item -fvar-tracking
6935 @opindex fvar-tracking
6936 Run variable tracking pass. It computes where variables are stored at each
6937 position in code. Better debugging information is then generated
6938 (if the debugging information format supports this information).
6939
6940 It is enabled by default when compiling with optimization (@option{-Os},
6941 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6942 the debug info format supports it.
6943
6944 @item -fvar-tracking-assignments
6945 @opindex fvar-tracking-assignments
6946 @opindex fno-var-tracking-assignments
6947 Annotate assignments to user variables early in the compilation and
6948 attempt to carry the annotations over throughout the compilation all the
6949 way to the end, in an attempt to improve debug information while
6950 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6951
6952 It can be enabled even if var-tracking is disabled, in which case
6953 annotations are created and maintained, but discarded at the end.
6954 By default, this flag is enabled together with @option{-fvar-tracking},
6955 except when selective scheduling is enabled.
6956
6957 @item -gsplit-dwarf
6958 @opindex gsplit-dwarf
6959 Separate as much DWARF debugging information as possible into a
6960 separate output file with the extension @file{.dwo}. This option allows
6961 the build system to avoid linking files with debug information. To
6962 be useful, this option requires a debugger capable of reading @file{.dwo}
6963 files.
6964
6965 @item -gpubnames
6966 @opindex gpubnames
6967 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
6968
6969 @item -ggnu-pubnames
6970 @opindex ggnu-pubnames
6971 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
6972 suitable for conversion into a GDB@ index. This option is only useful
6973 with a linker that can produce GDB@ index version 7.
6974
6975 @item -fdebug-types-section
6976 @opindex fdebug-types-section
6977 @opindex fno-debug-types-section
6978 When using DWARF Version 4 or higher, type DIEs can be put into
6979 their own @code{.debug_types} section instead of making them part of the
6980 @code{.debug_info} section. It is more efficient to put them in a separate
6981 comdat sections since the linker can then remove duplicates.
6982 But not all DWARF consumers support @code{.debug_types} sections yet
6983 and on some objects @code{.debug_types} produces larger instead of smaller
6984 debugging information.
6985
6986 @item -grecord-gcc-switches
6987 @item -gno-record-gcc-switches
6988 @opindex grecord-gcc-switches
6989 @opindex gno-record-gcc-switches
6990 This switch causes the command-line options used to invoke the
6991 compiler that may affect code generation to be appended to the
6992 DW_AT_producer attribute in DWARF debugging information. The options
6993 are concatenated with spaces separating them from each other and from
6994 the compiler version.
6995 It is enabled by default.
6996 See also @option{-frecord-gcc-switches} for another
6997 way of storing compiler options into the object file.
6998
6999 @item -gstrict-dwarf
7000 @opindex gstrict-dwarf
7001 Disallow using extensions of later DWARF standard version than selected
7002 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7003 DWARF extensions from later standard versions is allowed.
7004
7005 @item -gno-strict-dwarf
7006 @opindex gno-strict-dwarf
7007 Allow using extensions of later DWARF standard version than selected with
7008 @option{-gdwarf-@var{version}}.
7009
7010 @item -gcolumn-info
7011 @item -gno-column-info
7012 @opindex gcolumn-info
7013 @opindex gno-column-info
7014 Emit location column information into DWARF debugging information, rather
7015 than just file and line.
7016 This option is disabled by default.
7017
7018 @item -gz@r{[}=@var{type}@r{]}
7019 @opindex gz
7020 Produce compressed debug sections in DWARF format, if that is supported.
7021 If @var{type} is not given, the default type depends on the capabilities
7022 of the assembler and linker used. @var{type} may be one of
7023 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7024 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7025 compression in traditional GNU format). If the linker doesn't support
7026 writing compressed debug sections, the option is rejected. Otherwise,
7027 if the assembler does not support them, @option{-gz} is silently ignored
7028 when producing object files.
7029
7030 @item -femit-struct-debug-baseonly
7031 @opindex femit-struct-debug-baseonly
7032 Emit debug information for struct-like types
7033 only when the base name of the compilation source file
7034 matches the base name of file in which the struct is defined.
7035
7036 This option substantially reduces the size of debugging information,
7037 but at significant potential loss in type information to the debugger.
7038 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7039 See @option{-femit-struct-debug-detailed} for more detailed control.
7040
7041 This option works only with DWARF debug output.
7042
7043 @item -femit-struct-debug-reduced
7044 @opindex femit-struct-debug-reduced
7045 Emit debug information for struct-like types
7046 only when the base name of the compilation source file
7047 matches the base name of file in which the type is defined,
7048 unless the struct is a template or defined in a system header.
7049
7050 This option significantly reduces the size of debugging information,
7051 with some potential loss in type information to the debugger.
7052 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7053 See @option{-femit-struct-debug-detailed} for more detailed control.
7054
7055 This option works only with DWARF debug output.
7056
7057 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7058 @opindex femit-struct-debug-detailed
7059 Specify the struct-like types
7060 for which the compiler generates debug information.
7061 The intent is to reduce duplicate struct debug information
7062 between different object files within the same program.
7063
7064 This option is a detailed version of
7065 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
7066 which serves for most needs.
7067
7068 A specification has the syntax@*
7069 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
7070
7071 The optional first word limits the specification to
7072 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
7073 A struct type is used directly when it is the type of a variable, member.
7074 Indirect uses arise through pointers to structs.
7075 That is, when use of an incomplete struct is valid, the use is indirect.
7076 An example is
7077 @samp{struct one direct; struct two * indirect;}.
7078
7079 The optional second word limits the specification to
7080 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
7081 Generic structs are a bit complicated to explain.
7082 For C++, these are non-explicit specializations of template classes,
7083 or non-template classes within the above.
7084 Other programming languages have generics,
7085 but @option{-femit-struct-debug-detailed} does not yet implement them.
7086
7087 The third word specifies the source files for those
7088 structs for which the compiler should emit debug information.
7089 The values @samp{none} and @samp{any} have the normal meaning.
7090 The value @samp{base} means that
7091 the base of name of the file in which the type declaration appears
7092 must match the base of the name of the main compilation file.
7093 In practice, this means that when compiling @file{foo.c}, debug information
7094 is generated for types declared in that file and @file{foo.h},
7095 but not other header files.
7096 The value @samp{sys} means those types satisfying @samp{base}
7097 or declared in system or compiler headers.
7098
7099 You may need to experiment to determine the best settings for your application.
7100
7101 The default is @option{-femit-struct-debug-detailed=all}.
7102
7103 This option works only with DWARF debug output.
7104
7105 @item -fno-dwarf2-cfi-asm
7106 @opindex fdwarf2-cfi-asm
7107 @opindex fno-dwarf2-cfi-asm
7108 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
7109 instead of using GAS @code{.cfi_*} directives.
7110
7111 @item -fno-eliminate-unused-debug-types
7112 @opindex feliminate-unused-debug-types
7113 @opindex fno-eliminate-unused-debug-types
7114 Normally, when producing DWARF output, GCC avoids producing debug symbol
7115 output for types that are nowhere used in the source file being compiled.
7116 Sometimes it is useful to have GCC emit debugging
7117 information for all types declared in a compilation
7118 unit, regardless of whether or not they are actually used
7119 in that compilation unit, for example
7120 if, in the debugger, you want to cast a value to a type that is
7121 not actually used in your program (but is declared). More often,
7122 however, this results in a significant amount of wasted space.
7123 @end table
7124
7125 @node Optimize Options
7126 @section Options That Control Optimization
7127 @cindex optimize options
7128 @cindex options, optimization
7129
7130 These options control various sorts of optimizations.
7131
7132 Without any optimization option, the compiler's goal is to reduce the
7133 cost of compilation and to make debugging produce the expected
7134 results. Statements are independent: if you stop the program with a
7135 breakpoint between statements, you can then assign a new value to any
7136 variable or change the program counter to any other statement in the
7137 function and get exactly the results you expect from the source
7138 code.
7139
7140 Turning on optimization flags makes the compiler attempt to improve
7141 the performance and/or code size at the expense of compilation time
7142 and possibly the ability to debug the program.
7143
7144 The compiler performs optimization based on the knowledge it has of the
7145 program. Compiling multiple files at once to a single output file mode allows
7146 the compiler to use information gained from all of the files when compiling
7147 each of them.
7148
7149 Not all optimizations are controlled directly by a flag. Only
7150 optimizations that have a flag are listed in this section.
7151
7152 Most optimizations are only enabled if an @option{-O} level is set on
7153 the command line. Otherwise they are disabled, even if individual
7154 optimization flags are specified.
7155
7156 Depending on the target and how GCC was configured, a slightly different
7157 set of optimizations may be enabled at each @option{-O} level than
7158 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7159 to find out the exact set of optimizations that are enabled at each level.
7160 @xref{Overall Options}, for examples.
7161
7162 @table @gcctabopt
7163 @item -O
7164 @itemx -O1
7165 @opindex O
7166 @opindex O1
7167 Optimize. Optimizing compilation takes somewhat more time, and a lot
7168 more memory for a large function.
7169
7170 With @option{-O}, the compiler tries to reduce code size and execution
7171 time, without performing any optimizations that take a great deal of
7172 compilation time.
7173
7174 @option{-O} turns on the following optimization flags:
7175 @gccoptlist{
7176 -fauto-inc-dec @gol
7177 -fbranch-count-reg @gol
7178 -fcombine-stack-adjustments @gol
7179 -fcompare-elim @gol
7180 -fcprop-registers @gol
7181 -fdce @gol
7182 -fdefer-pop @gol
7183 -fdelayed-branch @gol
7184 -fdse @gol
7185 -fforward-propagate @gol
7186 -fguess-branch-probability @gol
7187 -fif-conversion2 @gol
7188 -fif-conversion @gol
7189 -finline-functions-called-once @gol
7190 -fipa-pure-const @gol
7191 -fipa-profile @gol
7192 -fipa-reference @gol
7193 -fmerge-constants @gol
7194 -fmove-loop-invariants @gol
7195 -freorder-blocks @gol
7196 -fshrink-wrap @gol
7197 -fshrink-wrap-separate @gol
7198 -fsplit-wide-types @gol
7199 -fssa-backprop @gol
7200 -fssa-phiopt @gol
7201 -ftree-bit-ccp @gol
7202 -ftree-ccp @gol
7203 -ftree-ch @gol
7204 -ftree-coalesce-vars @gol
7205 -ftree-copy-prop @gol
7206 -ftree-dce @gol
7207 -ftree-dominator-opts @gol
7208 -ftree-dse @gol
7209 -ftree-forwprop @gol
7210 -ftree-fre @gol
7211 -ftree-phiprop @gol
7212 -ftree-sink @gol
7213 -ftree-slsr @gol
7214 -ftree-sra @gol
7215 -ftree-pta @gol
7216 -ftree-ter @gol
7217 -funit-at-a-time}
7218
7219 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
7220 where doing so does not interfere with debugging.
7221
7222 @item -O2
7223 @opindex O2
7224 Optimize even more. GCC performs nearly all supported optimizations
7225 that do not involve a space-speed tradeoff.
7226 As compared to @option{-O}, this option increases both compilation time
7227 and the performance of the generated code.
7228
7229 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7230 also turns on the following optimization flags:
7231 @gccoptlist{-fthread-jumps @gol
7232 -falign-functions -falign-jumps @gol
7233 -falign-loops -falign-labels @gol
7234 -fcaller-saves @gol
7235 -fcrossjumping @gol
7236 -fcse-follow-jumps -fcse-skip-blocks @gol
7237 -fdelete-null-pointer-checks @gol
7238 -fdevirtualize -fdevirtualize-speculatively @gol
7239 -fexpensive-optimizations @gol
7240 -fgcse -fgcse-lm @gol
7241 -fhoist-adjacent-loads @gol
7242 -finline-small-functions @gol
7243 -findirect-inlining @gol
7244 -fipa-cp @gol
7245 -fipa-bit-cp @gol
7246 -fipa-vrp @gol
7247 -fipa-sra @gol
7248 -fipa-icf @gol
7249 -fisolate-erroneous-paths-dereference @gol
7250 -flra-remat @gol
7251 -foptimize-sibling-calls @gol
7252 -foptimize-strlen @gol
7253 -fpartial-inlining @gol
7254 -fpeephole2 @gol
7255 -freorder-blocks-algorithm=stc @gol
7256 -freorder-blocks-and-partition -freorder-functions @gol
7257 -frerun-cse-after-loop @gol
7258 -fsched-interblock -fsched-spec @gol
7259 -fschedule-insns -fschedule-insns2 @gol
7260 -fstore-merging @gol
7261 -fstrict-aliasing @gol
7262 -ftree-builtin-call-dce @gol
7263 -ftree-switch-conversion -ftree-tail-merge @gol
7264 -fcode-hoisting @gol
7265 -ftree-pre @gol
7266 -ftree-vrp @gol
7267 -fipa-ra}
7268
7269 Please note the warning under @option{-fgcse} about
7270 invoking @option{-O2} on programs that use computed gotos.
7271
7272 @item -O3
7273 @opindex O3
7274 Optimize yet more. @option{-O3} turns on all optimizations specified
7275 by @option{-O2} and also turns on the following optimization flags:
7276 @gccoptlist{-finline-functions @gol
7277 -funswitch-loops @gol
7278 -fpredictive-commoning @gol
7279 -fgcse-after-reload @gol
7280 -ftree-loop-vectorize @gol
7281 -ftree-loop-distribution @gol
7282 -ftree-loop-distribute-patterns @gol
7283 -fsplit-paths @gol
7284 -ftree-slp-vectorize @gol
7285 -fvect-cost-model @gol
7286 -ftree-partial-pre @gol
7287 -fpeel-loops @gol
7288 -fipa-cp-clone}
7289
7290 @item -O0
7291 @opindex O0
7292 Reduce compilation time and make debugging produce the expected
7293 results. This is the default.
7294
7295 @item -Os
7296 @opindex Os
7297 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7298 do not typically increase code size. It also performs further
7299 optimizations designed to reduce code size.
7300
7301 @option{-Os} disables the following optimization flags:
7302 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7303 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
7304 -freorder-blocks-and-partition -fprefetch-loop-arrays}
7305
7306 @item -Ofast
7307 @opindex Ofast
7308 Disregard strict standards compliance. @option{-Ofast} enables all
7309 @option{-O3} optimizations. It also enables optimizations that are not
7310 valid for all standard-compliant programs.
7311 It turns on @option{-ffast-math} and the Fortran-specific
7312 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
7313 specified, and @option{-fno-protect-parens}.
7314
7315 @item -Og
7316 @opindex Og
7317 Optimize debugging experience. @option{-Og} enables optimizations
7318 that do not interfere with debugging. It should be the optimization
7319 level of choice for the standard edit-compile-debug cycle, offering
7320 a reasonable level of optimization while maintaining fast compilation
7321 and a good debugging experience.
7322 @end table
7323
7324 If you use multiple @option{-O} options, with or without level numbers,
7325 the last such option is the one that is effective.
7326
7327 Options of the form @option{-f@var{flag}} specify machine-independent
7328 flags. Most flags have both positive and negative forms; the negative
7329 form of @option{-ffoo} is @option{-fno-foo}. In the table
7330 below, only one of the forms is listed---the one you typically
7331 use. You can figure out the other form by either removing @samp{no-}
7332 or adding it.
7333
7334 The following options control specific optimizations. They are either
7335 activated by @option{-O} options or are related to ones that are. You
7336 can use the following flags in the rare cases when ``fine-tuning'' of
7337 optimizations to be performed is desired.
7338
7339 @table @gcctabopt
7340 @item -fno-defer-pop
7341 @opindex fno-defer-pop
7342 Always pop the arguments to each function call as soon as that function
7343 returns. For machines that must pop arguments after a function call,
7344 the compiler normally lets arguments accumulate on the stack for several
7345 function calls and pops them all at once.
7346
7347 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7348
7349 @item -fforward-propagate
7350 @opindex fforward-propagate
7351 Perform a forward propagation pass on RTL@. The pass tries to combine two
7352 instructions and checks if the result can be simplified. If loop unrolling
7353 is active, two passes are performed and the second is scheduled after
7354 loop unrolling.
7355
7356 This option is enabled by default at optimization levels @option{-O},
7357 @option{-O2}, @option{-O3}, @option{-Os}.
7358
7359 @item -ffp-contract=@var{style}
7360 @opindex ffp-contract
7361 @option{-ffp-contract=off} disables floating-point expression contraction.
7362 @option{-ffp-contract=fast} enables floating-point expression contraction
7363 such as forming of fused multiply-add operations if the target has
7364 native support for them.
7365 @option{-ffp-contract=on} enables floating-point expression contraction
7366 if allowed by the language standard. This is currently not implemented
7367 and treated equal to @option{-ffp-contract=off}.
7368
7369 The default is @option{-ffp-contract=fast}.
7370
7371 @item -fomit-frame-pointer
7372 @opindex fomit-frame-pointer
7373 Don't keep the frame pointer in a register for functions that
7374 don't need one. This avoids the instructions to save, set up and
7375 restore frame pointers; it also makes an extra register available
7376 in many functions. @strong{It also makes debugging impossible on
7377 some machines.}
7378
7379 On some machines, such as the VAX, this flag has no effect, because
7380 the standard calling sequence automatically handles the frame pointer
7381 and nothing is saved by pretending it doesn't exist. The
7382 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
7383 whether a target machine supports this flag. @xref{Registers,,Register
7384 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
7385
7386 The default setting (when not optimizing for
7387 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
7388 @option{-fomit-frame-pointer}. You can configure GCC with the
7389 @option{--enable-frame-pointer} configure option to change the default.
7390
7391 Note that @option{-fno-omit-frame-pointer} doesn't force a new stack
7392 frame for all functions if it isn't otherwise needed, and hence doesn't
7393 guarantee a new frame pointer for all functions.
7394
7395 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7396
7397 @item -foptimize-sibling-calls
7398 @opindex foptimize-sibling-calls
7399 Optimize sibling and tail recursive calls.
7400
7401 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7402
7403 @item -foptimize-strlen
7404 @opindex foptimize-strlen
7405 Optimize various standard C string functions (e.g. @code{strlen},
7406 @code{strchr} or @code{strcpy}) and
7407 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7408
7409 Enabled at levels @option{-O2}, @option{-O3}.
7410
7411 @item -fno-inline
7412 @opindex fno-inline
7413 Do not expand any functions inline apart from those marked with
7414 the @code{always_inline} attribute. This is the default when not
7415 optimizing.
7416
7417 Single functions can be exempted from inlining by marking them
7418 with the @code{noinline} attribute.
7419
7420 @item -finline-small-functions
7421 @opindex finline-small-functions
7422 Integrate functions into their callers when their body is smaller than expected
7423 function call code (so overall size of program gets smaller). The compiler
7424 heuristically decides which functions are simple enough to be worth integrating
7425 in this way. This inlining applies to all functions, even those not declared
7426 inline.
7427
7428 Enabled at level @option{-O2}.
7429
7430 @item -findirect-inlining
7431 @opindex findirect-inlining
7432 Inline also indirect calls that are discovered to be known at compile
7433 time thanks to previous inlining. This option has any effect only
7434 when inlining itself is turned on by the @option{-finline-functions}
7435 or @option{-finline-small-functions} options.
7436
7437 Enabled at level @option{-O2}.
7438
7439 @item -finline-functions
7440 @opindex finline-functions
7441 Consider all functions for inlining, even if they are not declared inline.
7442 The compiler heuristically decides which functions are worth integrating
7443 in this way.
7444
7445 If all calls to a given function are integrated, and the function is
7446 declared @code{static}, then the function is normally not output as
7447 assembler code in its own right.
7448
7449 Enabled at level @option{-O3}.
7450
7451 @item -finline-functions-called-once
7452 @opindex finline-functions-called-once
7453 Consider all @code{static} functions called once for inlining into their
7454 caller even if they are not marked @code{inline}. If a call to a given
7455 function is integrated, then the function is not output as assembler code
7456 in its own right.
7457
7458 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7459
7460 @item -fearly-inlining
7461 @opindex fearly-inlining
7462 Inline functions marked by @code{always_inline} and functions whose body seems
7463 smaller than the function call overhead early before doing
7464 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7465 makes profiling significantly cheaper and usually inlining faster on programs
7466 having large chains of nested wrapper functions.
7467
7468 Enabled by default.
7469
7470 @item -fipa-sra
7471 @opindex fipa-sra
7472 Perform interprocedural scalar replacement of aggregates, removal of
7473 unused parameters and replacement of parameters passed by reference
7474 by parameters passed by value.
7475
7476 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7477
7478 @item -finline-limit=@var{n}
7479 @opindex finline-limit
7480 By default, GCC limits the size of functions that can be inlined. This flag
7481 allows coarse control of this limit. @var{n} is the size of functions that
7482 can be inlined in number of pseudo instructions.
7483
7484 Inlining is actually controlled by a number of parameters, which may be
7485 specified individually by using @option{--param @var{name}=@var{value}}.
7486 The @option{-finline-limit=@var{n}} option sets some of these parameters
7487 as follows:
7488
7489 @table @gcctabopt
7490 @item max-inline-insns-single
7491 is set to @var{n}/2.
7492 @item max-inline-insns-auto
7493 is set to @var{n}/2.
7494 @end table
7495
7496 See below for a documentation of the individual
7497 parameters controlling inlining and for the defaults of these parameters.
7498
7499 @emph{Note:} there may be no value to @option{-finline-limit} that results
7500 in default behavior.
7501
7502 @emph{Note:} pseudo instruction represents, in this particular context, an
7503 abstract measurement of function's size. In no way does it represent a count
7504 of assembly instructions and as such its exact meaning might change from one
7505 release to an another.
7506
7507 @item -fno-keep-inline-dllexport
7508 @opindex fno-keep-inline-dllexport
7509 This is a more fine-grained version of @option{-fkeep-inline-functions},
7510 which applies only to functions that are declared using the @code{dllexport}
7511 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
7512 Functions}.
7513
7514 @item -fkeep-inline-functions
7515 @opindex fkeep-inline-functions
7516 In C, emit @code{static} functions that are declared @code{inline}
7517 into the object file, even if the function has been inlined into all
7518 of its callers. This switch does not affect functions using the
7519 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7520 inline functions into the object file.
7521
7522 @item -fkeep-static-functions
7523 @opindex fkeep-static-functions
7524 Emit @code{static} functions into the object file, even if the function
7525 is never used.
7526
7527 @item -fkeep-static-consts
7528 @opindex fkeep-static-consts
7529 Emit variables declared @code{static const} when optimization isn't turned
7530 on, even if the variables aren't referenced.
7531
7532 GCC enables this option by default. If you want to force the compiler to
7533 check if a variable is referenced, regardless of whether or not
7534 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7535
7536 @item -fmerge-constants
7537 @opindex fmerge-constants
7538 Attempt to merge identical constants (string constants and floating-point
7539 constants) across compilation units.
7540
7541 This option is the default for optimized compilation if the assembler and
7542 linker support it. Use @option{-fno-merge-constants} to inhibit this
7543 behavior.
7544
7545 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7546
7547 @item -fmerge-all-constants
7548 @opindex fmerge-all-constants
7549 Attempt to merge identical constants and identical variables.
7550
7551 This option implies @option{-fmerge-constants}. In addition to
7552 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7553 arrays or initialized constant variables with integral or floating-point
7554 types. Languages like C or C++ require each variable, including multiple
7555 instances of the same variable in recursive calls, to have distinct locations,
7556 so using this option results in non-conforming
7557 behavior.
7558
7559 @item -fmodulo-sched
7560 @opindex fmodulo-sched
7561 Perform swing modulo scheduling immediately before the first scheduling
7562 pass. This pass looks at innermost loops and reorders their
7563 instructions by overlapping different iterations.
7564
7565 @item -fmodulo-sched-allow-regmoves
7566 @opindex fmodulo-sched-allow-regmoves
7567 Perform more aggressive SMS-based modulo scheduling with register moves
7568 allowed. By setting this flag certain anti-dependences edges are
7569 deleted, which triggers the generation of reg-moves based on the
7570 life-range analysis. This option is effective only with
7571 @option{-fmodulo-sched} enabled.
7572
7573 @item -fno-branch-count-reg
7574 @opindex fno-branch-count-reg
7575 Avoid running a pass scanning for opportunities to use ``decrement and
7576 branch'' instructions on a count register instead of generating sequences
7577 of instructions that decrement a register, compare it against zero, and
7578 then branch based upon the result. This option is only meaningful on
7579 architectures that support such instructions, which include x86, PowerPC,
7580 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
7581 doesn't remove the decrement and branch instructions from the generated
7582 instruction stream introduced by other optimization passes.
7583
7584 Enabled by default at @option{-O1} and higher.
7585
7586 The default is @option{-fbranch-count-reg}.
7587
7588 @item -fno-function-cse
7589 @opindex fno-function-cse
7590 Do not put function addresses in registers; make each instruction that
7591 calls a constant function contain the function's address explicitly.
7592
7593 This option results in less efficient code, but some strange hacks
7594 that alter the assembler output may be confused by the optimizations
7595 performed when this option is not used.
7596
7597 The default is @option{-ffunction-cse}
7598
7599 @item -fno-zero-initialized-in-bss
7600 @opindex fno-zero-initialized-in-bss
7601 If the target supports a BSS section, GCC by default puts variables that
7602 are initialized to zero into BSS@. This can save space in the resulting
7603 code.
7604
7605 This option turns off this behavior because some programs explicitly
7606 rely on variables going to the data section---e.g., so that the
7607 resulting executable can find the beginning of that section and/or make
7608 assumptions based on that.
7609
7610 The default is @option{-fzero-initialized-in-bss}.
7611
7612 @item -fthread-jumps
7613 @opindex fthread-jumps
7614 Perform optimizations that check to see if a jump branches to a
7615 location where another comparison subsumed by the first is found. If
7616 so, the first branch is redirected to either the destination of the
7617 second branch or a point immediately following it, depending on whether
7618 the condition is known to be true or false.
7619
7620 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7621
7622 @item -fsplit-wide-types
7623 @opindex fsplit-wide-types
7624 When using a type that occupies multiple registers, such as @code{long
7625 long} on a 32-bit system, split the registers apart and allocate them
7626 independently. This normally generates better code for those types,
7627 but may make debugging more difficult.
7628
7629 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7630 @option{-Os}.
7631
7632 @item -fcse-follow-jumps
7633 @opindex fcse-follow-jumps
7634 In common subexpression elimination (CSE), scan through jump instructions
7635 when the target of the jump is not reached by any other path. For
7636 example, when CSE encounters an @code{if} statement with an
7637 @code{else} clause, CSE follows the jump when the condition
7638 tested is false.
7639
7640 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7641
7642 @item -fcse-skip-blocks
7643 @opindex fcse-skip-blocks
7644 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7645 follow jumps that conditionally skip over blocks. When CSE
7646 encounters a simple @code{if} statement with no else clause,
7647 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7648 body of the @code{if}.
7649
7650 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7651
7652 @item -frerun-cse-after-loop
7653 @opindex frerun-cse-after-loop
7654 Re-run common subexpression elimination after loop optimizations are
7655 performed.
7656
7657 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7658
7659 @item -fgcse
7660 @opindex fgcse
7661 Perform a global common subexpression elimination pass.
7662 This pass also performs global constant and copy propagation.
7663
7664 @emph{Note:} When compiling a program using computed gotos, a GCC
7665 extension, you may get better run-time performance if you disable
7666 the global common subexpression elimination pass by adding
7667 @option{-fno-gcse} to the command line.
7668
7669 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7670
7671 @item -fgcse-lm
7672 @opindex fgcse-lm
7673 When @option{-fgcse-lm} is enabled, global common subexpression elimination
7674 attempts to move loads that are only killed by stores into themselves. This
7675 allows a loop containing a load/store sequence to be changed to a load outside
7676 the loop, and a copy/store within the loop.
7677
7678 Enabled by default when @option{-fgcse} is enabled.
7679
7680 @item -fgcse-sm
7681 @opindex fgcse-sm
7682 When @option{-fgcse-sm} is enabled, a store motion pass is run after
7683 global common subexpression elimination. This pass attempts to move
7684 stores out of loops. When used in conjunction with @option{-fgcse-lm},
7685 loops containing a load/store sequence can be changed to a load before
7686 the loop and a store after the loop.
7687
7688 Not enabled at any optimization level.
7689
7690 @item -fgcse-las
7691 @opindex fgcse-las
7692 When @option{-fgcse-las} is enabled, the global common subexpression
7693 elimination pass eliminates redundant loads that come after stores to the
7694 same memory location (both partial and full redundancies).
7695
7696 Not enabled at any optimization level.
7697
7698 @item -fgcse-after-reload
7699 @opindex fgcse-after-reload
7700 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7701 pass is performed after reload. The purpose of this pass is to clean up
7702 redundant spilling.
7703
7704 @item -faggressive-loop-optimizations
7705 @opindex faggressive-loop-optimizations
7706 This option tells the loop optimizer to use language constraints to
7707 derive bounds for the number of iterations of a loop. This assumes that
7708 loop code does not invoke undefined behavior by for example causing signed
7709 integer overflows or out-of-bound array accesses. The bounds for the
7710 number of iterations of a loop are used to guide loop unrolling and peeling
7711 and loop exit test optimizations.
7712 This option is enabled by default.
7713
7714 @item -funconstrained-commons
7715 @opindex funconstrained-commons
7716 This option tells the compiler that variables declared in common blocks
7717 (e.g. Fortran) may later be overridden with longer trailing arrays. This
7718 prevents certain optimizations that depend on knowing the array bounds.
7719
7720 @item -fcrossjumping
7721 @opindex fcrossjumping
7722 Perform cross-jumping transformation.
7723 This transformation unifies equivalent code and saves code size. The
7724 resulting code may or may not perform better than without cross-jumping.
7725
7726 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7727
7728 @item -fauto-inc-dec
7729 @opindex fauto-inc-dec
7730 Combine increments or decrements of addresses with memory accesses.
7731 This pass is always skipped on architectures that do not have
7732 instructions to support this. Enabled by default at @option{-O} and
7733 higher on architectures that support this.
7734
7735 @item -fdce
7736 @opindex fdce
7737 Perform dead code elimination (DCE) on RTL@.
7738 Enabled by default at @option{-O} and higher.
7739
7740 @item -fdse
7741 @opindex fdse
7742 Perform dead store elimination (DSE) on RTL@.
7743 Enabled by default at @option{-O} and higher.
7744
7745 @item -fif-conversion
7746 @opindex fif-conversion
7747 Attempt to transform conditional jumps into branch-less equivalents. This
7748 includes use of conditional moves, min, max, set flags and abs instructions, and
7749 some tricks doable by standard arithmetics. The use of conditional execution
7750 on chips where it is available is controlled by @option{-fif-conversion2}.
7751
7752 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7753
7754 @item -fif-conversion2
7755 @opindex fif-conversion2
7756 Use conditional execution (where available) to transform conditional jumps into
7757 branch-less equivalents.
7758
7759 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7760
7761 @item -fdeclone-ctor-dtor
7762 @opindex fdeclone-ctor-dtor
7763 The C++ ABI requires multiple entry points for constructors and
7764 destructors: one for a base subobject, one for a complete object, and
7765 one for a virtual destructor that calls operator delete afterwards.
7766 For a hierarchy with virtual bases, the base and complete variants are
7767 clones, which means two copies of the function. With this option, the
7768 base and complete variants are changed to be thunks that call a common
7769 implementation.
7770
7771 Enabled by @option{-Os}.
7772
7773 @item -fdelete-null-pointer-checks
7774 @opindex fdelete-null-pointer-checks
7775 Assume that programs cannot safely dereference null pointers, and that
7776 no code or data element resides at address zero.
7777 This option enables simple constant
7778 folding optimizations at all optimization levels. In addition, other
7779 optimization passes in GCC use this flag to control global dataflow
7780 analyses that eliminate useless checks for null pointers; these assume
7781 that a memory access to address zero always results in a trap, so
7782 that if a pointer is checked after it has already been dereferenced,
7783 it cannot be null.
7784
7785 Note however that in some environments this assumption is not true.
7786 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
7787 for programs that depend on that behavior.
7788
7789 This option is enabled by default on most targets. On Nios II ELF, it
7790 defaults to off. On AVR and CR16, this option is completely disabled.
7791
7792 Passes that use the dataflow information
7793 are enabled independently at different optimization levels.
7794
7795 @item -fdevirtualize
7796 @opindex fdevirtualize
7797 Attempt to convert calls to virtual functions to direct calls. This
7798 is done both within a procedure and interprocedurally as part of
7799 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
7800 propagation (@option{-fipa-cp}).
7801 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7802
7803 @item -fdevirtualize-speculatively
7804 @opindex fdevirtualize-speculatively
7805 Attempt to convert calls to virtual functions to speculative direct calls.
7806 Based on the analysis of the type inheritance graph, determine for a given call
7807 the set of likely targets. If the set is small, preferably of size 1, change
7808 the call into a conditional deciding between direct and indirect calls. The
7809 speculative calls enable more optimizations, such as inlining. When they seem
7810 useless after further optimization, they are converted back into original form.
7811
7812 @item -fdevirtualize-at-ltrans
7813 @opindex fdevirtualize-at-ltrans
7814 Stream extra information needed for aggressive devirtualization when running
7815 the link-time optimizer in local transformation mode.
7816 This option enables more devirtualization but
7817 significantly increases the size of streamed data. For this reason it is
7818 disabled by default.
7819
7820 @item -fexpensive-optimizations
7821 @opindex fexpensive-optimizations
7822 Perform a number of minor optimizations that are relatively expensive.
7823
7824 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7825
7826 @item -free
7827 @opindex free
7828 Attempt to remove redundant extension instructions. This is especially
7829 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
7830 registers after writing to their lower 32-bit half.
7831
7832 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
7833 @option{-O3}, @option{-Os}.
7834
7835 @item -fno-lifetime-dse
7836 @opindex fno-lifetime-dse
7837 In C++ the value of an object is only affected by changes within its
7838 lifetime: when the constructor begins, the object has an indeterminate
7839 value, and any changes during the lifetime of the object are dead when
7840 the object is destroyed. Normally dead store elimination will take
7841 advantage of this; if your code relies on the value of the object
7842 storage persisting beyond the lifetime of the object, you can use this
7843 flag to disable this optimization. To preserve stores before the
7844 constructor starts (e.g. because your operator new clears the object
7845 storage) but still treat the object as dead after the destructor you,
7846 can use @option{-flifetime-dse=1}. The default behavior can be
7847 explicitly selected with @option{-flifetime-dse=2}.
7848 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
7849
7850 @item -flive-range-shrinkage
7851 @opindex flive-range-shrinkage
7852 Attempt to decrease register pressure through register live range
7853 shrinkage. This is helpful for fast processors with small or moderate
7854 size register sets.
7855
7856 @item -fira-algorithm=@var{algorithm}
7857 @opindex fira-algorithm
7858 Use the specified coloring algorithm for the integrated register
7859 allocator. The @var{algorithm} argument can be @samp{priority}, which
7860 specifies Chow's priority coloring, or @samp{CB}, which specifies
7861 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
7862 for all architectures, but for those targets that do support it, it is
7863 the default because it generates better code.
7864
7865 @item -fira-region=@var{region}
7866 @opindex fira-region
7867 Use specified regions for the integrated register allocator. The
7868 @var{region} argument should be one of the following:
7869
7870 @table @samp
7871
7872 @item all
7873 Use all loops as register allocation regions.
7874 This can give the best results for machines with a small and/or
7875 irregular register set.
7876
7877 @item mixed
7878 Use all loops except for loops with small register pressure
7879 as the regions. This value usually gives
7880 the best results in most cases and for most architectures,
7881 and is enabled by default when compiling with optimization for speed
7882 (@option{-O}, @option{-O2}, @dots{}).
7883
7884 @item one
7885 Use all functions as a single region.
7886 This typically results in the smallest code size, and is enabled by default for
7887 @option{-Os} or @option{-O0}.
7888
7889 @end table
7890
7891 @item -fira-hoist-pressure
7892 @opindex fira-hoist-pressure
7893 Use IRA to evaluate register pressure in the code hoisting pass for
7894 decisions to hoist expressions. This option usually results in smaller
7895 code, but it can slow the compiler down.
7896
7897 This option is enabled at level @option{-Os} for all targets.
7898
7899 @item -fira-loop-pressure
7900 @opindex fira-loop-pressure
7901 Use IRA to evaluate register pressure in loops for decisions to move
7902 loop invariants. This option usually results in generation
7903 of faster and smaller code on machines with large register files (>= 32
7904 registers), but it can slow the compiler down.
7905
7906 This option is enabled at level @option{-O3} for some targets.
7907
7908 @item -fno-ira-share-save-slots
7909 @opindex fno-ira-share-save-slots
7910 Disable sharing of stack slots used for saving call-used hard
7911 registers living through a call. Each hard register gets a
7912 separate stack slot, and as a result function stack frames are
7913 larger.
7914
7915 @item -fno-ira-share-spill-slots
7916 @opindex fno-ira-share-spill-slots
7917 Disable sharing of stack slots allocated for pseudo-registers. Each
7918 pseudo-register that does not get a hard register gets a separate
7919 stack slot, and as a result function stack frames are larger.
7920
7921 @item -flra-remat
7922 @opindex flra-remat
7923 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7924 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7925 values if it is profitable.
7926
7927 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7928
7929 @item -fdelayed-branch
7930 @opindex fdelayed-branch
7931 If supported for the target machine, attempt to reorder instructions
7932 to exploit instruction slots available after delayed branch
7933 instructions.
7934
7935 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7936
7937 @item -fschedule-insns
7938 @opindex fschedule-insns
7939 If supported for the target machine, attempt to reorder instructions to
7940 eliminate execution stalls due to required data being unavailable. This
7941 helps machines that have slow floating point or memory load instructions
7942 by allowing other instructions to be issued until the result of the load
7943 or floating-point instruction is required.
7944
7945 Enabled at levels @option{-O2}, @option{-O3}.
7946
7947 @item -fschedule-insns2
7948 @opindex fschedule-insns2
7949 Similar to @option{-fschedule-insns}, but requests an additional pass of
7950 instruction scheduling after register allocation has been done. This is
7951 especially useful on machines with a relatively small number of
7952 registers and where memory load instructions take more than one cycle.
7953
7954 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7955
7956 @item -fno-sched-interblock
7957 @opindex fno-sched-interblock
7958 Don't schedule instructions across basic blocks. This is normally
7959 enabled by default when scheduling before register allocation, i.e.@:
7960 with @option{-fschedule-insns} or at @option{-O2} or higher.
7961
7962 @item -fno-sched-spec
7963 @opindex fno-sched-spec
7964 Don't allow speculative motion of non-load instructions. This is normally
7965 enabled by default when scheduling before register allocation, i.e.@:
7966 with @option{-fschedule-insns} or at @option{-O2} or higher.
7967
7968 @item -fsched-pressure
7969 @opindex fsched-pressure
7970 Enable register pressure sensitive insn scheduling before register
7971 allocation. This only makes sense when scheduling before register
7972 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7973 @option{-O2} or higher. Usage of this option can improve the
7974 generated code and decrease its size by preventing register pressure
7975 increase above the number of available hard registers and subsequent
7976 spills in register allocation.
7977
7978 @item -fsched-spec-load
7979 @opindex fsched-spec-load
7980 Allow speculative motion of some load instructions. This only makes
7981 sense when scheduling before register allocation, i.e.@: with
7982 @option{-fschedule-insns} or at @option{-O2} or higher.
7983
7984 @item -fsched-spec-load-dangerous
7985 @opindex fsched-spec-load-dangerous
7986 Allow speculative motion of more load instructions. This only makes
7987 sense when scheduling before register allocation, i.e.@: with
7988 @option{-fschedule-insns} or at @option{-O2} or higher.
7989
7990 @item -fsched-stalled-insns
7991 @itemx -fsched-stalled-insns=@var{n}
7992 @opindex fsched-stalled-insns
7993 Define how many insns (if any) can be moved prematurely from the queue
7994 of stalled insns into the ready list during the second scheduling pass.
7995 @option{-fno-sched-stalled-insns} means that no insns are moved
7996 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7997 on how many queued insns can be moved prematurely.
7998 @option{-fsched-stalled-insns} without a value is equivalent to
7999 @option{-fsched-stalled-insns=1}.
8000
8001 @item -fsched-stalled-insns-dep
8002 @itemx -fsched-stalled-insns-dep=@var{n}
8003 @opindex fsched-stalled-insns-dep
8004 Define how many insn groups (cycles) are examined for a dependency
8005 on a stalled insn that is a candidate for premature removal from the queue
8006 of stalled insns. This has an effect only during the second scheduling pass,
8007 and only if @option{-fsched-stalled-insns} is used.
8008 @option{-fno-sched-stalled-insns-dep} is equivalent to
8009 @option{-fsched-stalled-insns-dep=0}.
8010 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8011 @option{-fsched-stalled-insns-dep=1}.
8012
8013 @item -fsched2-use-superblocks
8014 @opindex fsched2-use-superblocks
8015 When scheduling after register allocation, use superblock scheduling.
8016 This allows motion across basic block boundaries,
8017 resulting in faster schedules. This option is experimental, as not all machine
8018 descriptions used by GCC model the CPU closely enough to avoid unreliable
8019 results from the algorithm.
8020
8021 This only makes sense when scheduling after register allocation, i.e.@: with
8022 @option{-fschedule-insns2} or at @option{-O2} or higher.
8023
8024 @item -fsched-group-heuristic
8025 @opindex fsched-group-heuristic
8026 Enable the group heuristic in the scheduler. This heuristic favors
8027 the instruction that belongs to a schedule group. This is enabled
8028 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8029 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8030
8031 @item -fsched-critical-path-heuristic
8032 @opindex fsched-critical-path-heuristic
8033 Enable the critical-path heuristic in the scheduler. This heuristic favors
8034 instructions on the critical path. This is enabled by default when
8035 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8036 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8037
8038 @item -fsched-spec-insn-heuristic
8039 @opindex fsched-spec-insn-heuristic
8040 Enable the speculative instruction heuristic in the scheduler. This
8041 heuristic favors speculative instructions with greater dependency weakness.
8042 This is enabled by default when scheduling is enabled, i.e.@:
8043 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8044 or at @option{-O2} or higher.
8045
8046 @item -fsched-rank-heuristic
8047 @opindex fsched-rank-heuristic
8048 Enable the rank heuristic in the scheduler. This heuristic favors
8049 the instruction belonging to a basic block with greater size or frequency.
8050 This is enabled by default when scheduling is enabled, i.e.@:
8051 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8052 at @option{-O2} or higher.
8053
8054 @item -fsched-last-insn-heuristic
8055 @opindex fsched-last-insn-heuristic
8056 Enable the last-instruction heuristic in the scheduler. This heuristic
8057 favors the instruction that is less dependent on the last instruction
8058 scheduled. This is enabled by default when scheduling is enabled,
8059 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8060 at @option{-O2} or higher.
8061
8062 @item -fsched-dep-count-heuristic
8063 @opindex fsched-dep-count-heuristic
8064 Enable the dependent-count heuristic in the scheduler. This heuristic
8065 favors the instruction that has more instructions depending on it.
8066 This is enabled by default when scheduling is enabled, i.e.@:
8067 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8068 at @option{-O2} or higher.
8069
8070 @item -freschedule-modulo-scheduled-loops
8071 @opindex freschedule-modulo-scheduled-loops
8072 Modulo scheduling is performed before traditional scheduling. If a loop
8073 is modulo scheduled, later scheduling passes may change its schedule.
8074 Use this option to control that behavior.
8075
8076 @item -fselective-scheduling
8077 @opindex fselective-scheduling
8078 Schedule instructions using selective scheduling algorithm. Selective
8079 scheduling runs instead of the first scheduler pass.
8080
8081 @item -fselective-scheduling2
8082 @opindex fselective-scheduling2
8083 Schedule instructions using selective scheduling algorithm. Selective
8084 scheduling runs instead of the second scheduler pass.
8085
8086 @item -fsel-sched-pipelining
8087 @opindex fsel-sched-pipelining
8088 Enable software pipelining of innermost loops during selective scheduling.
8089 This option has no effect unless one of @option{-fselective-scheduling} or
8090 @option{-fselective-scheduling2} is turned on.
8091
8092 @item -fsel-sched-pipelining-outer-loops
8093 @opindex fsel-sched-pipelining-outer-loops
8094 When pipelining loops during selective scheduling, also pipeline outer loops.
8095 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8096
8097 @item -fsemantic-interposition
8098 @opindex fsemantic-interposition
8099 Some object formats, like ELF, allow interposing of symbols by the
8100 dynamic linker.
8101 This means that for symbols exported from the DSO, the compiler cannot perform
8102 interprocedural propagation, inlining and other optimizations in anticipation
8103 that the function or variable in question may change. While this feature is
8104 useful, for example, to rewrite memory allocation functions by a debugging
8105 implementation, it is expensive in the terms of code quality.
8106 With @option{-fno-semantic-interposition} the compiler assumes that
8107 if interposition happens for functions the overwriting function will have
8108 precisely the same semantics (and side effects).
8109 Similarly if interposition happens
8110 for variables, the constructor of the variable will be the same. The flag
8111 has no effect for functions explicitly declared inline
8112 (where it is never allowed for interposition to change semantics)
8113 and for symbols explicitly declared weak.
8114
8115 @item -fshrink-wrap
8116 @opindex fshrink-wrap
8117 Emit function prologues only before parts of the function that need it,
8118 rather than at the top of the function. This flag is enabled by default at
8119 @option{-O} and higher.
8120
8121 @item -fshrink-wrap-separate
8122 @opindex fshrink-wrap-separate
8123 Shrink-wrap separate parts of the prologue and epilogue separately, so that
8124 those parts are only executed when needed.
8125 This option is on by default, but has no effect unless @option{-fshrink-wrap}
8126 is also turned on and the target supports this.
8127
8128 @item -fcaller-saves
8129 @opindex fcaller-saves
8130 Enable allocation of values to registers that are clobbered by
8131 function calls, by emitting extra instructions to save and restore the
8132 registers around such calls. Such allocation is done only when it
8133 seems to result in better code.
8134
8135 This option is always enabled by default on certain machines, usually
8136 those which have no call-preserved registers to use instead.
8137
8138 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8139
8140 @item -fcombine-stack-adjustments
8141 @opindex fcombine-stack-adjustments
8142 Tracks stack adjustments (pushes and pops) and stack memory references
8143 and then tries to find ways to combine them.
8144
8145 Enabled by default at @option{-O1} and higher.
8146
8147 @item -fipa-ra
8148 @opindex fipa-ra
8149 Use caller save registers for allocation if those registers are not used by
8150 any called function. In that case it is not necessary to save and restore
8151 them around calls. This is only possible if called functions are part of
8152 same compilation unit as current function and they are compiled before it.
8153
8154 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
8155 is disabled if generated code will be instrumented for profiling
8156 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
8157 exactly (this happens on targets that do not expose prologues
8158 and epilogues in RTL).
8159
8160 @item -fconserve-stack
8161 @opindex fconserve-stack
8162 Attempt to minimize stack usage. The compiler attempts to use less
8163 stack space, even if that makes the program slower. This option
8164 implies setting the @option{large-stack-frame} parameter to 100
8165 and the @option{large-stack-frame-growth} parameter to 400.
8166
8167 @item -ftree-reassoc
8168 @opindex ftree-reassoc
8169 Perform reassociation on trees. This flag is enabled by default
8170 at @option{-O} and higher.
8171
8172 @item -fcode-hoisting
8173 @opindex fcode-hoisting
8174 Perform code hoisting. Code hoisting tries to move the
8175 evaluation of expressions executed on all paths to the function exit
8176 as early as possible. This is especially useful as a code size
8177 optimization, but it often helps for code speed as well.
8178 This flag is enabled by default at @option{-O2} and higher.
8179
8180 @item -ftree-pre
8181 @opindex ftree-pre
8182 Perform partial redundancy elimination (PRE) on trees. This flag is
8183 enabled by default at @option{-O2} and @option{-O3}.
8184
8185 @item -ftree-partial-pre
8186 @opindex ftree-partial-pre
8187 Make partial redundancy elimination (PRE) more aggressive. This flag is
8188 enabled by default at @option{-O3}.
8189
8190 @item -ftree-forwprop
8191 @opindex ftree-forwprop
8192 Perform forward propagation on trees. This flag is enabled by default
8193 at @option{-O} and higher.
8194
8195 @item -ftree-fre
8196 @opindex ftree-fre
8197 Perform full redundancy elimination (FRE) on trees. The difference
8198 between FRE and PRE is that FRE only considers expressions
8199 that are computed on all paths leading to the redundant computation.
8200 This analysis is faster than PRE, though it exposes fewer redundancies.
8201 This flag is enabled by default at @option{-O} and higher.
8202
8203 @item -ftree-phiprop
8204 @opindex ftree-phiprop
8205 Perform hoisting of loads from conditional pointers on trees. This
8206 pass is enabled by default at @option{-O} and higher.
8207
8208 @item -fhoist-adjacent-loads
8209 @opindex fhoist-adjacent-loads
8210 Speculatively hoist loads from both branches of an if-then-else if the
8211 loads are from adjacent locations in the same structure and the target
8212 architecture has a conditional move instruction. This flag is enabled
8213 by default at @option{-O2} and higher.
8214
8215 @item -ftree-copy-prop
8216 @opindex ftree-copy-prop
8217 Perform copy propagation on trees. This pass eliminates unnecessary
8218 copy operations. This flag is enabled by default at @option{-O} and
8219 higher.
8220
8221 @item -fipa-pure-const
8222 @opindex fipa-pure-const
8223 Discover which functions are pure or constant.
8224 Enabled by default at @option{-O} and higher.
8225
8226 @item -fipa-reference
8227 @opindex fipa-reference
8228 Discover which static variables do not escape the
8229 compilation unit.
8230 Enabled by default at @option{-O} and higher.
8231
8232 @item -fipa-pta
8233 @opindex fipa-pta
8234 Perform interprocedural pointer analysis and interprocedural modification
8235 and reference analysis. This option can cause excessive memory and
8236 compile-time usage on large compilation units. It is not enabled by
8237 default at any optimization level.
8238
8239 @item -fipa-profile
8240 @opindex fipa-profile
8241 Perform interprocedural profile propagation. The functions called only from
8242 cold functions are marked as cold. Also functions executed once (such as
8243 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8244 functions and loop less parts of functions executed once are then optimized for
8245 size.
8246 Enabled by default at @option{-O} and higher.
8247
8248 @item -fipa-cp
8249 @opindex fipa-cp
8250 Perform interprocedural constant propagation.
8251 This optimization analyzes the program to determine when values passed
8252 to functions are constants and then optimizes accordingly.
8253 This optimization can substantially increase performance
8254 if the application has constants passed to functions.
8255 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8256
8257 @item -fipa-cp-clone
8258 @opindex fipa-cp-clone
8259 Perform function cloning to make interprocedural constant propagation stronger.
8260 When enabled, interprocedural constant propagation performs function cloning
8261 when externally visible function can be called with constant arguments.
8262 Because this optimization can create multiple copies of functions,
8263 it may significantly increase code size
8264 (see @option{--param ipcp-unit-growth=@var{value}}).
8265 This flag is enabled by default at @option{-O3}.
8266
8267 @item -fipa-bit-cp
8268 @opindex -fipa-bit-cp
8269 When enabled, perform interprocedural bitwise constant
8270 propagation. This flag is enabled by default at @option{-O2}. It
8271 requires that @option{-fipa-cp} is enabled.
8272
8273 @item -fipa-vrp
8274 @opindex -fipa-vrp
8275 When enabled, perform interprocedural propagation of value
8276 ranges. This flag is enabled by default at @option{-O2}. It requires
8277 that @option{-fipa-cp} is enabled.
8278
8279 @item -fipa-icf
8280 @opindex fipa-icf
8281 Perform Identical Code Folding for functions and read-only variables.
8282 The optimization reduces code size and may disturb unwind stacks by replacing
8283 a function by equivalent one with a different name. The optimization works
8284 more effectively with link-time optimization enabled.
8285
8286 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8287 works on different levels and thus the optimizations are not same - there are
8288 equivalences that are found only by GCC and equivalences found only by Gold.
8289
8290 This flag is enabled by default at @option{-O2} and @option{-Os}.
8291
8292 @item -fisolate-erroneous-paths-dereference
8293 @opindex fisolate-erroneous-paths-dereference
8294 Detect paths that trigger erroneous or undefined behavior due to
8295 dereferencing a null pointer. Isolate those paths from the main control
8296 flow and turn the statement with erroneous or undefined behavior into a trap.
8297 This flag is enabled by default at @option{-O2} and higher and depends on
8298 @option{-fdelete-null-pointer-checks} also being enabled.
8299
8300 @item -fisolate-erroneous-paths-attribute
8301 @opindex fisolate-erroneous-paths-attribute
8302 Detect paths that trigger erroneous or undefined behavior due a null value
8303 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8304 attribute. Isolate those paths from the main control flow and turn the
8305 statement with erroneous or undefined behavior into a trap. This is not
8306 currently enabled, but may be enabled by @option{-O2} in the future.
8307
8308 @item -ftree-sink
8309 @opindex ftree-sink
8310 Perform forward store motion on trees. This flag is
8311 enabled by default at @option{-O} and higher.
8312
8313 @item -ftree-bit-ccp
8314 @opindex ftree-bit-ccp
8315 Perform sparse conditional bit constant propagation on trees and propagate
8316 pointer alignment information.
8317 This pass only operates on local scalar variables and is enabled by default
8318 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8319
8320 @item -ftree-ccp
8321 @opindex ftree-ccp
8322 Perform sparse conditional constant propagation (CCP) on trees. This
8323 pass only operates on local scalar variables and is enabled by default
8324 at @option{-O} and higher.
8325
8326 @item -fssa-backprop
8327 @opindex fssa-backprop
8328 Propagate information about uses of a value up the definition chain
8329 in order to simplify the definitions. For example, this pass strips
8330 sign operations if the sign of a value never matters. The flag is
8331 enabled by default at @option{-O} and higher.
8332
8333 @item -fssa-phiopt
8334 @opindex fssa-phiopt
8335 Perform pattern matching on SSA PHI nodes to optimize conditional
8336 code. This pass is enabled by default at @option{-O} and higher.
8337
8338 @item -ftree-switch-conversion
8339 @opindex ftree-switch-conversion
8340 Perform conversion of simple initializations in a switch to
8341 initializations from a scalar array. This flag is enabled by default
8342 at @option{-O2} and higher.
8343
8344 @item -ftree-tail-merge
8345 @opindex ftree-tail-merge
8346 Look for identical code sequences. When found, replace one with a jump to the
8347 other. This optimization is known as tail merging or cross jumping. This flag
8348 is enabled by default at @option{-O2} and higher. The compilation time
8349 in this pass can
8350 be limited using @option{max-tail-merge-comparisons} parameter and
8351 @option{max-tail-merge-iterations} parameter.
8352
8353 @item -ftree-dce
8354 @opindex ftree-dce
8355 Perform dead code elimination (DCE) on trees. This flag is enabled by
8356 default at @option{-O} and higher.
8357
8358 @item -ftree-builtin-call-dce
8359 @opindex ftree-builtin-call-dce
8360 Perform conditional dead code elimination (DCE) for calls to built-in functions
8361 that may set @code{errno} but are otherwise side-effect free. This flag is
8362 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8363 specified.
8364
8365 @item -ftree-dominator-opts
8366 @opindex ftree-dominator-opts
8367 Perform a variety of simple scalar cleanups (constant/copy
8368 propagation, redundancy elimination, range propagation and expression
8369 simplification) based on a dominator tree traversal. This also
8370 performs jump threading (to reduce jumps to jumps). This flag is
8371 enabled by default at @option{-O} and higher.
8372
8373 @item -ftree-dse
8374 @opindex ftree-dse
8375 Perform dead store elimination (DSE) on trees. A dead store is a store into
8376 a memory location that is later overwritten by another store without
8377 any intervening loads. In this case the earlier store can be deleted. This
8378 flag is enabled by default at @option{-O} and higher.
8379
8380 @item -ftree-ch
8381 @opindex ftree-ch
8382 Perform loop header copying on trees. This is beneficial since it increases
8383 effectiveness of code motion optimizations. It also saves one jump. This flag
8384 is enabled by default at @option{-O} and higher. It is not enabled
8385 for @option{-Os}, since it usually increases code size.
8386
8387 @item -ftree-loop-optimize
8388 @opindex ftree-loop-optimize
8389 Perform loop optimizations on trees. This flag is enabled by default
8390 at @option{-O} and higher.
8391
8392 @item -ftree-loop-linear
8393 @itemx -floop-interchange
8394 @itemx -floop-strip-mine
8395 @itemx -floop-block
8396 @itemx -floop-unroll-and-jam
8397 @opindex ftree-loop-linear
8398 @opindex floop-interchange
8399 @opindex floop-strip-mine
8400 @opindex floop-block
8401 @opindex floop-unroll-and-jam
8402 Perform loop nest optimizations. Same as
8403 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8404 to be configured with @option{--with-isl} to enable the Graphite loop
8405 transformation infrastructure.
8406
8407 @item -fgraphite-identity
8408 @opindex fgraphite-identity
8409 Enable the identity transformation for graphite. For every SCoP we generate
8410 the polyhedral representation and transform it back to gimple. Using
8411 @option{-fgraphite-identity} we can check the costs or benefits of the
8412 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8413 are also performed by the code generator isl, like index splitting and
8414 dead code elimination in loops.
8415
8416 @item -floop-nest-optimize
8417 @opindex floop-nest-optimize
8418 Enable the isl based loop nest optimizer. This is a generic loop nest
8419 optimizer based on the Pluto optimization algorithms. It calculates a loop
8420 structure optimized for data-locality and parallelism. This option
8421 is experimental.
8422
8423 @item -floop-parallelize-all
8424 @opindex floop-parallelize-all
8425 Use the Graphite data dependence analysis to identify loops that can
8426 be parallelized. Parallelize all the loops that can be analyzed to
8427 not contain loop carried dependences without checking that it is
8428 profitable to parallelize the loops.
8429
8430 @item -ftree-coalesce-vars
8431 @opindex ftree-coalesce-vars
8432 While transforming the program out of the SSA representation, attempt to
8433 reduce copying by coalescing versions of different user-defined
8434 variables, instead of just compiler temporaries. This may severely
8435 limit the ability to debug an optimized program compiled with
8436 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8437 prevents SSA coalescing of user variables. This option is enabled by
8438 default if optimization is enabled, and it does very little otherwise.
8439
8440 @item -ftree-loop-if-convert
8441 @opindex ftree-loop-if-convert
8442 Attempt to transform conditional jumps in the innermost loops to
8443 branch-less equivalents. The intent is to remove control-flow from
8444 the innermost loops in order to improve the ability of the
8445 vectorization pass to handle these loops. This is enabled by default
8446 if vectorization is enabled.
8447
8448 @item -ftree-loop-distribution
8449 @opindex ftree-loop-distribution
8450 Perform loop distribution. This flag can improve cache performance on
8451 big loop bodies and allow further loop optimizations, like
8452 parallelization or vectorization, to take place. For example, the loop
8453 @smallexample
8454 DO I = 1, N
8455 A(I) = B(I) + C
8456 D(I) = E(I) * F
8457 ENDDO
8458 @end smallexample
8459 is transformed to
8460 @smallexample
8461 DO I = 1, N
8462 A(I) = B(I) + C
8463 ENDDO
8464 DO I = 1, N
8465 D(I) = E(I) * F
8466 ENDDO
8467 @end smallexample
8468
8469 @item -ftree-loop-distribute-patterns
8470 @opindex ftree-loop-distribute-patterns
8471 Perform loop distribution of patterns that can be code generated with
8472 calls to a library. This flag is enabled by default at @option{-O3}.
8473
8474 This pass distributes the initialization loops and generates a call to
8475 memset zero. For example, the loop
8476 @smallexample
8477 DO I = 1, N
8478 A(I) = 0
8479 B(I) = A(I) + I
8480 ENDDO
8481 @end smallexample
8482 is transformed to
8483 @smallexample
8484 DO I = 1, N
8485 A(I) = 0
8486 ENDDO
8487 DO I = 1, N
8488 B(I) = A(I) + I
8489 ENDDO
8490 @end smallexample
8491 and the initialization loop is transformed into a call to memset zero.
8492
8493 @item -ftree-loop-im
8494 @opindex ftree-loop-im
8495 Perform loop invariant motion on trees. This pass moves only invariants that
8496 are hard to handle at RTL level (function calls, operations that expand to
8497 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8498 operands of conditions that are invariant out of the loop, so that we can use
8499 just trivial invariantness analysis in loop unswitching. The pass also includes
8500 store motion.
8501
8502 @item -ftree-loop-ivcanon
8503 @opindex ftree-loop-ivcanon
8504 Create a canonical counter for number of iterations in loops for which
8505 determining number of iterations requires complicated analysis. Later
8506 optimizations then may determine the number easily. Useful especially
8507 in connection with unrolling.
8508
8509 @item -fivopts
8510 @opindex fivopts
8511 Perform induction variable optimizations (strength reduction, induction
8512 variable merging and induction variable elimination) on trees.
8513
8514 @item -ftree-parallelize-loops=n
8515 @opindex ftree-parallelize-loops
8516 Parallelize loops, i.e., split their iteration space to run in n threads.
8517 This is only possible for loops whose iterations are independent
8518 and can be arbitrarily reordered. The optimization is only
8519 profitable on multiprocessor machines, for loops that are CPU-intensive,
8520 rather than constrained e.g.@: by memory bandwidth. This option
8521 implies @option{-pthread}, and thus is only supported on targets
8522 that have support for @option{-pthread}.
8523
8524 @item -ftree-pta
8525 @opindex ftree-pta
8526 Perform function-local points-to analysis on trees. This flag is
8527 enabled by default at @option{-O} and higher.
8528
8529 @item -ftree-sra
8530 @opindex ftree-sra
8531 Perform scalar replacement of aggregates. This pass replaces structure
8532 references with scalars to prevent committing structures to memory too
8533 early. This flag is enabled by default at @option{-O} and higher.
8534
8535 @item -fstore-merging
8536 @opindex fstore-merging
8537 Perform merging of narrow stores to consecutive memory addresses. This pass
8538 merges contiguous stores of immediate values narrower than a word into fewer
8539 wider stores to reduce the number of instructions. This is enabled by default
8540 at @option{-O2} and higher as well as @option{-Os}.
8541
8542 @item -ftree-ter
8543 @opindex ftree-ter
8544 Perform temporary expression replacement during the SSA->normal phase. Single
8545 use/single def temporaries are replaced at their use location with their
8546 defining expression. This results in non-GIMPLE code, but gives the expanders
8547 much more complex trees to work on resulting in better RTL generation. This is
8548 enabled by default at @option{-O} and higher.
8549
8550 @item -ftree-slsr
8551 @opindex ftree-slsr
8552 Perform straight-line strength reduction on trees. This recognizes related
8553 expressions involving multiplications and replaces them by less expensive
8554 calculations when possible. This is enabled by default at @option{-O} and
8555 higher.
8556
8557 @item -ftree-vectorize
8558 @opindex ftree-vectorize
8559 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8560 and @option{-ftree-slp-vectorize} if not explicitly specified.
8561
8562 @item -ftree-loop-vectorize
8563 @opindex ftree-loop-vectorize
8564 Perform loop vectorization on trees. This flag is enabled by default at
8565 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8566
8567 @item -ftree-slp-vectorize
8568 @opindex ftree-slp-vectorize
8569 Perform basic block vectorization on trees. This flag is enabled by default at
8570 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8571
8572 @item -fvect-cost-model=@var{model}
8573 @opindex fvect-cost-model
8574 Alter the cost model used for vectorization. The @var{model} argument
8575 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
8576 With the @samp{unlimited} model the vectorized code-path is assumed
8577 to be profitable while with the @samp{dynamic} model a runtime check
8578 guards the vectorized code-path to enable it only for iteration
8579 counts that will likely execute faster than when executing the original
8580 scalar loop. The @samp{cheap} model disables vectorization of
8581 loops where doing so would be cost prohibitive for example due to
8582 required runtime checks for data dependence or alignment but otherwise
8583 is equal to the @samp{dynamic} model.
8584 The default cost model depends on other optimization flags and is
8585 either @samp{dynamic} or @samp{cheap}.
8586
8587 @item -fsimd-cost-model=@var{model}
8588 @opindex fsimd-cost-model
8589 Alter the cost model used for vectorization of loops marked with the OpenMP
8590 or Cilk Plus simd directive. The @var{model} argument should be one of
8591 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
8592 have the same meaning as described in @option{-fvect-cost-model} and by
8593 default a cost model defined with @option{-fvect-cost-model} is used.
8594
8595 @item -ftree-vrp
8596 @opindex ftree-vrp
8597 Perform Value Range Propagation on trees. This is similar to the
8598 constant propagation pass, but instead of values, ranges of values are
8599 propagated. This allows the optimizers to remove unnecessary range
8600 checks like array bound checks and null pointer checks. This is
8601 enabled by default at @option{-O2} and higher. Null pointer check
8602 elimination is only done if @option{-fdelete-null-pointer-checks} is
8603 enabled.
8604
8605 @item -fsplit-paths
8606 @opindex fsplit-paths
8607 Split paths leading to loop backedges. This can improve dead code
8608 elimination and common subexpression elimination. This is enabled by
8609 default at @option{-O2} and above.
8610
8611 @item -fsplit-ivs-in-unroller
8612 @opindex fsplit-ivs-in-unroller
8613 Enables expression of values of induction variables in later iterations
8614 of the unrolled loop using the value in the first iteration. This breaks
8615 long dependency chains, thus improving efficiency of the scheduling passes.
8616
8617 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8618 same effect. However, that is not reliable in cases where the loop body
8619 is more complicated than a single basic block. It also does not work at all
8620 on some architectures due to restrictions in the CSE pass.
8621
8622 This optimization is enabled by default.
8623
8624 @item -fvariable-expansion-in-unroller
8625 @opindex fvariable-expansion-in-unroller
8626 With this option, the compiler creates multiple copies of some
8627 local variables when unrolling a loop, which can result in superior code.
8628
8629 @item -fpartial-inlining
8630 @opindex fpartial-inlining
8631 Inline parts of functions. This option has any effect only
8632 when inlining itself is turned on by the @option{-finline-functions}
8633 or @option{-finline-small-functions} options.
8634
8635 Enabled at level @option{-O2}.
8636
8637 @item -fpredictive-commoning
8638 @opindex fpredictive-commoning
8639 Perform predictive commoning optimization, i.e., reusing computations
8640 (especially memory loads and stores) performed in previous
8641 iterations of loops.
8642
8643 This option is enabled at level @option{-O3}.
8644
8645 @item -fprefetch-loop-arrays
8646 @opindex fprefetch-loop-arrays
8647 If supported by the target machine, generate instructions to prefetch
8648 memory to improve the performance of loops that access large arrays.
8649
8650 This option may generate better or worse code; results are highly
8651 dependent on the structure of loops within the source code.
8652
8653 Disabled at level @option{-Os}.
8654
8655 @item -fno-printf-return-value
8656 @opindex fno-printf-return-value
8657 Do not substitute constants for known return value of formatted output
8658 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
8659 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
8660 transformation allows GCC to optimize or even eliminate branches based
8661 on the known return value of these functions called with arguments that
8662 are either constant, or whose values are known to be in a range that
8663 makes determining the exact return value possible. For example, when
8664 @option{-fprintf-return-value} is in effect, both the branch and the
8665 body of the @code{if} statement (but not the call to @code{snprint})
8666 can be optimized away when @code{i} is a 32-bit or smaller integer
8667 because the return value is guaranteed to be at most 8.
8668
8669 @smallexample
8670 char buf[9];
8671 if (snprintf (buf, "%08x", i) >= sizeof buf)
8672 @dots{}
8673 @end smallexample
8674
8675 The @option{-fprintf-return-value} option relies on other optimizations
8676 and yields best results with @option{-O2}. It works in tandem with the
8677 @option{-Wformat-overflow} and @option{-Wformat-truncation} options.
8678 The @option{-fprintf-return-value} option is enabled by default.
8679
8680 @item -fno-peephole
8681 @itemx -fno-peephole2
8682 @opindex fno-peephole
8683 @opindex fno-peephole2
8684 Disable any machine-specific peephole optimizations. The difference
8685 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
8686 are implemented in the compiler; some targets use one, some use the
8687 other, a few use both.
8688
8689 @option{-fpeephole} is enabled by default.
8690 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8691
8692 @item -fno-guess-branch-probability
8693 @opindex fno-guess-branch-probability
8694 Do not guess branch probabilities using heuristics.
8695
8696 GCC uses heuristics to guess branch probabilities if they are
8697 not provided by profiling feedback (@option{-fprofile-arcs}). These
8698 heuristics are based on the control flow graph. If some branch probabilities
8699 are specified by @code{__builtin_expect}, then the heuristics are
8700 used to guess branch probabilities for the rest of the control flow graph,
8701 taking the @code{__builtin_expect} info into account. The interactions
8702 between the heuristics and @code{__builtin_expect} can be complex, and in
8703 some cases, it may be useful to disable the heuristics so that the effects
8704 of @code{__builtin_expect} are easier to understand.
8705
8706 The default is @option{-fguess-branch-probability} at levels
8707 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8708
8709 @item -freorder-blocks
8710 @opindex freorder-blocks
8711 Reorder basic blocks in the compiled function in order to reduce number of
8712 taken branches and improve code locality.
8713
8714 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8715
8716 @item -freorder-blocks-algorithm=@var{algorithm}
8717 @opindex freorder-blocks-algorithm
8718 Use the specified algorithm for basic block reordering. The
8719 @var{algorithm} argument can be @samp{simple}, which does not increase
8720 code size (except sometimes due to secondary effects like alignment),
8721 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
8722 put all often executed code together, minimizing the number of branches
8723 executed by making extra copies of code.
8724
8725 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
8726 @samp{stc} at levels @option{-O2}, @option{-O3}.
8727
8728 @item -freorder-blocks-and-partition
8729 @opindex freorder-blocks-and-partition
8730 In addition to reordering basic blocks in the compiled function, in order
8731 to reduce number of taken branches, partitions hot and cold basic blocks
8732 into separate sections of the assembly and @file{.o} files, to improve
8733 paging and cache locality performance.
8734
8735 This optimization is automatically turned off in the presence of
8736 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
8737 section attribute and on any architecture that does not support named
8738 sections. When @option{-fsplit-stack} is used this option is not
8739 enabled by default (to avoid linker errors), but may be enabled
8740 explicitly (if using a working linker).
8741
8742 Enabled for x86 at levels @option{-O2}, @option{-O3}.
8743
8744 @item -freorder-functions
8745 @opindex freorder-functions
8746 Reorder functions in the object file in order to
8747 improve code locality. This is implemented by using special
8748 subsections @code{.text.hot} for most frequently executed functions and
8749 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
8750 the linker so object file format must support named sections and linker must
8751 place them in a reasonable way.
8752
8753 Also profile feedback must be available to make this option effective. See
8754 @option{-fprofile-arcs} for details.
8755
8756 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8757
8758 @item -fstrict-aliasing
8759 @opindex fstrict-aliasing
8760 Allow the compiler to assume the strictest aliasing rules applicable to
8761 the language being compiled. For C (and C++), this activates
8762 optimizations based on the type of expressions. In particular, an
8763 object of one type is assumed never to reside at the same address as an
8764 object of a different type, unless the types are almost the same. For
8765 example, an @code{unsigned int} can alias an @code{int}, but not a
8766 @code{void*} or a @code{double}. A character type may alias any other
8767 type.
8768
8769 @anchor{Type-punning}Pay special attention to code like this:
8770 @smallexample
8771 union a_union @{
8772 int i;
8773 double d;
8774 @};
8775
8776 int f() @{
8777 union a_union t;
8778 t.d = 3.0;
8779 return t.i;
8780 @}
8781 @end smallexample
8782 The practice of reading from a different union member than the one most
8783 recently written to (called ``type-punning'') is common. Even with
8784 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
8785 is accessed through the union type. So, the code above works as
8786 expected. @xref{Structures unions enumerations and bit-fields
8787 implementation}. However, this code might not:
8788 @smallexample
8789 int f() @{
8790 union a_union t;
8791 int* ip;
8792 t.d = 3.0;
8793 ip = &t.i;
8794 return *ip;
8795 @}
8796 @end smallexample
8797
8798 Similarly, access by taking the address, casting the resulting pointer
8799 and dereferencing the result has undefined behavior, even if the cast
8800 uses a union type, e.g.:
8801 @smallexample
8802 int f() @{
8803 double d = 3.0;
8804 return ((union a_union *) &d)->i;
8805 @}
8806 @end smallexample
8807
8808 The @option{-fstrict-aliasing} option is enabled at levels
8809 @option{-O2}, @option{-O3}, @option{-Os}.
8810
8811 @item -falign-functions
8812 @itemx -falign-functions=@var{n}
8813 @opindex falign-functions
8814 Align the start of functions to the next power-of-two greater than
8815 @var{n}, skipping up to @var{n} bytes. For instance,
8816 @option{-falign-functions=32} aligns functions to the next 32-byte
8817 boundary, but @option{-falign-functions=24} aligns to the next
8818 32-byte boundary only if this can be done by skipping 23 bytes or less.
8819
8820 @option{-fno-align-functions} and @option{-falign-functions=1} are
8821 equivalent and mean that functions are not aligned.
8822
8823 Some assemblers only support this flag when @var{n} is a power of two;
8824 in that case, it is rounded up.
8825
8826 If @var{n} is not specified or is zero, use a machine-dependent default.
8827
8828 Enabled at levels @option{-O2}, @option{-O3}.
8829
8830 @item -flimit-function-alignment
8831 If this option is enabled, the compiler tries to avoid unnecessarily
8832 overaligning functions. It attempts to instruct the assembler to align
8833 by the amount specified by @option{-falign-functions}, but not to
8834 skip more bytes than the size of the function.
8835
8836 @item -falign-labels
8837 @itemx -falign-labels=@var{n}
8838 @opindex falign-labels
8839 Align all branch targets to a power-of-two boundary, skipping up to
8840 @var{n} bytes like @option{-falign-functions}. This option can easily
8841 make code slower, because it must insert dummy operations for when the
8842 branch target is reached in the usual flow of the code.
8843
8844 @option{-fno-align-labels} and @option{-falign-labels=1} are
8845 equivalent and mean that labels are not aligned.
8846
8847 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8848 are greater than this value, then their values are used instead.
8849
8850 If @var{n} is not specified or is zero, use a machine-dependent default
8851 which is very likely to be @samp{1}, meaning no alignment.
8852
8853 Enabled at levels @option{-O2}, @option{-O3}.
8854
8855 @item -falign-loops
8856 @itemx -falign-loops=@var{n}
8857 @opindex falign-loops
8858 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8859 like @option{-falign-functions}. If the loops are
8860 executed many times, this makes up for any execution of the dummy
8861 operations.
8862
8863 @option{-fno-align-loops} and @option{-falign-loops=1} are
8864 equivalent and mean that loops are not aligned.
8865
8866 If @var{n} is not specified or is zero, use a machine-dependent default.
8867
8868 Enabled at levels @option{-O2}, @option{-O3}.
8869
8870 @item -falign-jumps
8871 @itemx -falign-jumps=@var{n}
8872 @opindex falign-jumps
8873 Align branch targets to a power-of-two boundary, for branch targets
8874 where the targets can only be reached by jumping, skipping up to @var{n}
8875 bytes like @option{-falign-functions}. In this case, no dummy operations
8876 need be executed.
8877
8878 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
8879 equivalent and mean that loops are not aligned.
8880
8881 If @var{n} is not specified or is zero, use a machine-dependent default.
8882
8883 Enabled at levels @option{-O2}, @option{-O3}.
8884
8885 @item -funit-at-a-time
8886 @opindex funit-at-a-time
8887 This option is left for compatibility reasons. @option{-funit-at-a-time}
8888 has no effect, while @option{-fno-unit-at-a-time} implies
8889 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8890
8891 Enabled by default.
8892
8893 @item -fno-toplevel-reorder
8894 @opindex fno-toplevel-reorder
8895 Do not reorder top-level functions, variables, and @code{asm}
8896 statements. Output them in the same order that they appear in the
8897 input file. When this option is used, unreferenced static variables
8898 are not removed. This option is intended to support existing code
8899 that relies on a particular ordering. For new code, it is better to
8900 use attributes when possible.
8901
8902 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8903 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8904 targets.
8905
8906 @item -fweb
8907 @opindex fweb
8908 Constructs webs as commonly used for register allocation purposes and assign
8909 each web individual pseudo register. This allows the register allocation pass
8910 to operate on pseudos directly, but also strengthens several other optimization
8911 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8912 however, make debugging impossible, since variables no longer stay in a
8913 ``home register''.
8914
8915 Enabled by default with @option{-funroll-loops}.
8916
8917 @item -fwhole-program
8918 @opindex fwhole-program
8919 Assume that the current compilation unit represents the whole program being
8920 compiled. All public functions and variables with the exception of @code{main}
8921 and those merged by attribute @code{externally_visible} become static functions
8922 and in effect are optimized more aggressively by interprocedural optimizers.
8923
8924 This option should not be used in combination with @option{-flto}.
8925 Instead relying on a linker plugin should provide safer and more precise
8926 information.
8927
8928 @item -flto[=@var{n}]
8929 @opindex flto
8930 This option runs the standard link-time optimizer. When invoked
8931 with source code, it generates GIMPLE (one of GCC's internal
8932 representations) and writes it to special ELF sections in the object
8933 file. When the object files are linked together, all the function
8934 bodies are read from these ELF sections and instantiated as if they
8935 had been part of the same translation unit.
8936
8937 To use the link-time optimizer, @option{-flto} and optimization
8938 options should be specified at compile time and during the final link.
8939 It is recommended that you compile all the files participating in the
8940 same link with the same options and also specify those options at
8941 link time.
8942 For example:
8943
8944 @smallexample
8945 gcc -c -O2 -flto foo.c
8946 gcc -c -O2 -flto bar.c
8947 gcc -o myprog -flto -O2 foo.o bar.o
8948 @end smallexample
8949
8950 The first two invocations to GCC save a bytecode representation
8951 of GIMPLE into special ELF sections inside @file{foo.o} and
8952 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8953 @file{foo.o} and @file{bar.o}, merges the two files into a single
8954 internal image, and compiles the result as usual. Since both
8955 @file{foo.o} and @file{bar.o} are merged into a single image, this
8956 causes all the interprocedural analyses and optimizations in GCC to
8957 work across the two files as if they were a single one. This means,
8958 for example, that the inliner is able to inline functions in
8959 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8960
8961 Another (simpler) way to enable link-time optimization is:
8962
8963 @smallexample
8964 gcc -o myprog -flto -O2 foo.c bar.c
8965 @end smallexample
8966
8967 The above generates bytecode for @file{foo.c} and @file{bar.c},
8968 merges them together into a single GIMPLE representation and optimizes
8969 them as usual to produce @file{myprog}.
8970
8971 The only important thing to keep in mind is that to enable link-time
8972 optimizations you need to use the GCC driver to perform the link step.
8973 GCC then automatically performs link-time optimization if any of the
8974 objects involved were compiled with the @option{-flto} command-line option.
8975 You generally
8976 should specify the optimization options to be used for link-time
8977 optimization though GCC tries to be clever at guessing an
8978 optimization level to use from the options used at compile time
8979 if you fail to specify one at link time. You can always override
8980 the automatic decision to do link-time optimization
8981 by passing @option{-fno-lto} to the link command.
8982
8983 To make whole program optimization effective, it is necessary to make
8984 certain whole program assumptions. The compiler needs to know
8985 what functions and variables can be accessed by libraries and runtime
8986 outside of the link-time optimized unit. When supported by the linker,
8987 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8988 to the compiler about used and externally visible symbols. When
8989 the linker plugin is not available, @option{-fwhole-program} should be
8990 used to allow the compiler to make these assumptions, which leads
8991 to more aggressive optimization decisions.
8992
8993 When @option{-fuse-linker-plugin} is not enabled, when a file is
8994 compiled with @option{-flto}, the generated object file is larger than
8995 a regular object file because it contains GIMPLE bytecodes and the usual
8996 final code (see @option{-ffat-lto-objects}. This means that
8997 object files with LTO information can be linked as normal object
8998 files; if @option{-fno-lto} is passed to the linker, no
8999 interprocedural optimizations are applied. Note that when
9000 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9001 but you cannot perform a regular, non-LTO link on them.
9002
9003 Additionally, the optimization flags used to compile individual files
9004 are not necessarily related to those used at link time. For instance,
9005
9006 @smallexample
9007 gcc -c -O0 -ffat-lto-objects -flto foo.c
9008 gcc -c -O0 -ffat-lto-objects -flto bar.c
9009 gcc -o myprog -O3 foo.o bar.o
9010 @end smallexample
9011
9012 This produces individual object files with unoptimized assembler
9013 code, but the resulting binary @file{myprog} is optimized at
9014 @option{-O3}. If, instead, the final binary is generated with
9015 @option{-fno-lto}, then @file{myprog} is not optimized.
9016
9017 When producing the final binary, GCC only
9018 applies link-time optimizations to those files that contain bytecode.
9019 Therefore, you can mix and match object files and libraries with
9020 GIMPLE bytecodes and final object code. GCC automatically selects
9021 which files to optimize in LTO mode and which files to link without
9022 further processing.
9023
9024 There are some code generation flags preserved by GCC when
9025 generating bytecodes, as they need to be used during the final link
9026 stage. Generally options specified at link time override those
9027 specified at compile time.
9028
9029 If you do not specify an optimization level option @option{-O} at
9030 link time, then GCC uses the highest optimization level
9031 used when compiling the object files.
9032
9033 Currently, the following options and their settings are taken from
9034 the first object file that explicitly specifies them:
9035 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9036 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9037 and all the @option{-m} target flags.
9038
9039 Certain ABI-changing flags are required to match in all compilation units,
9040 and trying to override this at link time with a conflicting value
9041 is ignored. This includes options such as @option{-freg-struct-return}
9042 and @option{-fpcc-struct-return}.
9043
9044 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9045 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9046 are passed through to the link stage and merged conservatively for
9047 conflicting translation units. Specifically
9048 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9049 precedence; and for example @option{-ffp-contract=off} takes precedence
9050 over @option{-ffp-contract=fast}. You can override them at link time.
9051
9052 If LTO encounters objects with C linkage declared with incompatible
9053 types in separate translation units to be linked together (undefined
9054 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9055 issued. The behavior is still undefined at run time. Similar
9056 diagnostics may be raised for other languages.
9057
9058 Another feature of LTO is that it is possible to apply interprocedural
9059 optimizations on files written in different languages:
9060
9061 @smallexample
9062 gcc -c -flto foo.c
9063 g++ -c -flto bar.cc
9064 gfortran -c -flto baz.f90
9065 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9066 @end smallexample
9067
9068 Notice that the final link is done with @command{g++} to get the C++
9069 runtime libraries and @option{-lgfortran} is added to get the Fortran
9070 runtime libraries. In general, when mixing languages in LTO mode, you
9071 should use the same link command options as when mixing languages in a
9072 regular (non-LTO) compilation.
9073
9074 If object files containing GIMPLE bytecode are stored in a library archive, say
9075 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9076 are using a linker with plugin support. To create static libraries suitable
9077 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9078 and @command{ranlib};
9079 to show the symbols of object files with GIMPLE bytecode, use
9080 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9081 and @command{nm} have been compiled with plugin support. At link time, use the the
9082 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9083 the LTO optimization process:
9084
9085 @smallexample
9086 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9087 @end smallexample
9088
9089 With the linker plugin enabled, the linker extracts the needed
9090 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9091 to make them part of the aggregated GIMPLE image to be optimized.
9092
9093 If you are not using a linker with plugin support and/or do not
9094 enable the linker plugin, then the objects inside @file{libfoo.a}
9095 are extracted and linked as usual, but they do not participate
9096 in the LTO optimization process. In order to make a static library suitable
9097 for both LTO optimization and usual linkage, compile its object files with
9098 @option{-flto} @option{-ffat-lto-objects}.
9099
9100 Link-time optimizations do not require the presence of the whole program to
9101 operate. If the program does not require any symbols to be exported, it is
9102 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9103 the interprocedural optimizers to use more aggressive assumptions which may
9104 lead to improved optimization opportunities.
9105 Use of @option{-fwhole-program} is not needed when linker plugin is
9106 active (see @option{-fuse-linker-plugin}).
9107
9108 The current implementation of LTO makes no
9109 attempt to generate bytecode that is portable between different
9110 types of hosts. The bytecode files are versioned and there is a
9111 strict version check, so bytecode files generated in one version of
9112 GCC do not work with an older or newer version of GCC.
9113
9114 Link-time optimization does not work well with generation of debugging
9115 information. Combining @option{-flto} with
9116 @option{-g} is currently experimental and expected to produce unexpected
9117 results.
9118
9119 If you specify the optional @var{n}, the optimization and code
9120 generation done at link time is executed in parallel using @var{n}
9121 parallel jobs by utilizing an installed @command{make} program. The
9122 environment variable @env{MAKE} may be used to override the program
9123 used. The default value for @var{n} is 1.
9124
9125 You can also specify @option{-flto=jobserver} to use GNU make's
9126 job server mode to determine the number of parallel jobs. This
9127 is useful when the Makefile calling GCC is already executing in parallel.
9128 You must prepend a @samp{+} to the command recipe in the parent Makefile
9129 for this to work. This option likely only works if @env{MAKE} is
9130 GNU make.
9131
9132 @item -flto-partition=@var{alg}
9133 @opindex flto-partition
9134 Specify the partitioning algorithm used by the link-time optimizer.
9135 The value is either @samp{1to1} to specify a partitioning mirroring
9136 the original source files or @samp{balanced} to specify partitioning
9137 into equally sized chunks (whenever possible) or @samp{max} to create
9138 new partition for every symbol where possible. Specifying @samp{none}
9139 as an algorithm disables partitioning and streaming completely.
9140 The default value is @samp{balanced}. While @samp{1to1} can be used
9141 as an workaround for various code ordering issues, the @samp{max}
9142 partitioning is intended for internal testing only.
9143 The value @samp{one} specifies that exactly one partition should be
9144 used while the value @samp{none} bypasses partitioning and executes
9145 the link-time optimization step directly from the WPA phase.
9146
9147 @item -flto-odr-type-merging
9148 @opindex flto-odr-type-merging
9149 Enable streaming of mangled types names of C++ types and their unification
9150 at link time. This increases size of LTO object files, but enables
9151 diagnostics about One Definition Rule violations.
9152
9153 @item -flto-compression-level=@var{n}
9154 @opindex flto-compression-level
9155 This option specifies the level of compression used for intermediate
9156 language written to LTO object files, and is only meaningful in
9157 conjunction with LTO mode (@option{-flto}). Valid
9158 values are 0 (no compression) to 9 (maximum compression). Values
9159 outside this range are clamped to either 0 or 9. If the option is not
9160 given, a default balanced compression setting is used.
9161
9162 @item -fuse-linker-plugin
9163 @opindex fuse-linker-plugin
9164 Enables the use of a linker plugin during link-time optimization. This
9165 option relies on plugin support in the linker, which is available in gold
9166 or in GNU ld 2.21 or newer.
9167
9168 This option enables the extraction of object files with GIMPLE bytecode out
9169 of library archives. This improves the quality of optimization by exposing
9170 more code to the link-time optimizer. This information specifies what
9171 symbols can be accessed externally (by non-LTO object or during dynamic
9172 linking). Resulting code quality improvements on binaries (and shared
9173 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9174 See @option{-flto} for a description of the effect of this flag and how to
9175 use it.
9176
9177 This option is enabled by default when LTO support in GCC is enabled
9178 and GCC was configured for use with
9179 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9180
9181 @item -ffat-lto-objects
9182 @opindex ffat-lto-objects
9183 Fat LTO objects are object files that contain both the intermediate language
9184 and the object code. This makes them usable for both LTO linking and normal
9185 linking. This option is effective only when compiling with @option{-flto}
9186 and is ignored at link time.
9187
9188 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9189 requires the complete toolchain to be aware of LTO. It requires a linker with
9190 linker plugin support for basic functionality. Additionally,
9191 @command{nm}, @command{ar} and @command{ranlib}
9192 need to support linker plugins to allow a full-featured build environment
9193 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9194 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9195 to these tools. With non fat LTO makefiles need to be modified to use them.
9196
9197 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9198 support.
9199
9200 @item -fcompare-elim
9201 @opindex fcompare-elim
9202 After register allocation and post-register allocation instruction splitting,
9203 identify arithmetic instructions that compute processor flags similar to a
9204 comparison operation based on that arithmetic. If possible, eliminate the
9205 explicit comparison operation.
9206
9207 This pass only applies to certain targets that cannot explicitly represent
9208 the comparison operation before register allocation is complete.
9209
9210 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9211
9212 @item -fcprop-registers
9213 @opindex fcprop-registers
9214 After register allocation and post-register allocation instruction splitting,
9215 perform a copy-propagation pass to try to reduce scheduling dependencies
9216 and occasionally eliminate the copy.
9217
9218 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9219
9220 @item -fprofile-correction
9221 @opindex fprofile-correction
9222 Profiles collected using an instrumented binary for multi-threaded programs may
9223 be inconsistent due to missed counter updates. When this option is specified,
9224 GCC uses heuristics to correct or smooth out such inconsistencies. By
9225 default, GCC emits an error message when an inconsistent profile is detected.
9226
9227 @item -fprofile-use
9228 @itemx -fprofile-use=@var{path}
9229 @opindex fprofile-use
9230 Enable profile feedback-directed optimizations,
9231 and the following optimizations
9232 which are generally profitable only with profile feedback available:
9233 @option{-fbranch-probabilities}, @option{-fvpt},
9234 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9235 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9236
9237 Before you can use this option, you must first generate profiling information.
9238 @xref{Instrumentation Options}, for information about the
9239 @option{-fprofile-generate} option.
9240
9241 By default, GCC emits an error message if the feedback profiles do not
9242 match the source code. This error can be turned into a warning by using
9243 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9244 code.
9245
9246 If @var{path} is specified, GCC looks at the @var{path} to find
9247 the profile feedback data files. See @option{-fprofile-dir}.
9248
9249 @item -fauto-profile
9250 @itemx -fauto-profile=@var{path}
9251 @opindex fauto-profile
9252 Enable sampling-based feedback-directed optimizations,
9253 and the following optimizations
9254 which are generally profitable only with profile feedback available:
9255 @option{-fbranch-probabilities}, @option{-fvpt},
9256 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9257 @option{-ftree-vectorize},
9258 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9259 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9260 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9261
9262 @var{path} is the name of a file containing AutoFDO profile information.
9263 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9264
9265 Producing an AutoFDO profile data file requires running your program
9266 with the @command{perf} utility on a supported GNU/Linux target system.
9267 For more information, see @uref{https://perf.wiki.kernel.org/}.
9268
9269 E.g.
9270 @smallexample
9271 perf record -e br_inst_retired:near_taken -b -o perf.data \
9272 -- your_program
9273 @end smallexample
9274
9275 Then use the @command{create_gcov} tool to convert the raw profile data
9276 to a format that can be used by GCC.@ You must also supply the
9277 unstripped binary for your program to this tool.
9278 See @uref{https://github.com/google/autofdo}.
9279
9280 E.g.
9281 @smallexample
9282 create_gcov --binary=your_program.unstripped --profile=perf.data \
9283 --gcov=profile.afdo
9284 @end smallexample
9285 @end table
9286
9287 The following options control compiler behavior regarding floating-point
9288 arithmetic. These options trade off between speed and
9289 correctness. All must be specifically enabled.
9290
9291 @table @gcctabopt
9292 @item -ffloat-store
9293 @opindex ffloat-store
9294 Do not store floating-point variables in registers, and inhibit other
9295 options that might change whether a floating-point value is taken from a
9296 register or memory.
9297
9298 @cindex floating-point precision
9299 This option prevents undesirable excess precision on machines such as
9300 the 68000 where the floating registers (of the 68881) keep more
9301 precision than a @code{double} is supposed to have. Similarly for the
9302 x86 architecture. For most programs, the excess precision does only
9303 good, but a few programs rely on the precise definition of IEEE floating
9304 point. Use @option{-ffloat-store} for such programs, after modifying
9305 them to store all pertinent intermediate computations into variables.
9306
9307 @item -fexcess-precision=@var{style}
9308 @opindex fexcess-precision
9309 This option allows further control over excess precision on machines
9310 where floating-point operations occur in a format with more precision or
9311 range than the IEEE standard and interchange floating-point types. By
9312 default, @option{-fexcess-precision=fast} is in effect; this means that
9313 operations may be carried out in a wider precision than the types specified
9314 in the source if that would result in faster code, and it is unpredictable
9315 when rounding to the types specified in the source code takes place.
9316 When compiling C, if @option{-fexcess-precision=standard} is specified then
9317 excess precision follows the rules specified in ISO C99; in particular,
9318 both casts and assignments cause values to be rounded to their
9319 semantic types (whereas @option{-ffloat-store} only affects
9320 assignments). This option is enabled by default for C if a strict
9321 conformance option such as @option{-std=c99} is used.
9322 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
9323 regardless of whether a strict conformance option is used.
9324
9325 @opindex mfpmath
9326 @option{-fexcess-precision=standard} is not implemented for languages
9327 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
9328 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9329 semantics apply without excess precision, and in the latter, rounding
9330 is unpredictable.
9331
9332 @item -ffast-math
9333 @opindex ffast-math
9334 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9335 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9336 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
9337 @option{-fexcess-precision=fast}.
9338
9339 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9340
9341 This option is not turned on by any @option{-O} option besides
9342 @option{-Ofast} since it can result in incorrect output for programs
9343 that depend on an exact implementation of IEEE or ISO rules/specifications
9344 for math functions. It may, however, yield faster code for programs
9345 that do not require the guarantees of these specifications.
9346
9347 @item -fno-math-errno
9348 @opindex fno-math-errno
9349 Do not set @code{errno} after calling math functions that are executed
9350 with a single instruction, e.g., @code{sqrt}. A program that relies on
9351 IEEE exceptions for math error handling may want to use this flag
9352 for speed while maintaining IEEE arithmetic compatibility.
9353
9354 This option is not turned on by any @option{-O} option since
9355 it can result in incorrect output for programs that depend on
9356 an exact implementation of IEEE or ISO rules/specifications for
9357 math functions. It may, however, yield faster code for programs
9358 that do not require the guarantees of these specifications.
9359
9360 The default is @option{-fmath-errno}.
9361
9362 On Darwin systems, the math library never sets @code{errno}. There is
9363 therefore no reason for the compiler to consider the possibility that
9364 it might, and @option{-fno-math-errno} is the default.
9365
9366 @item -funsafe-math-optimizations
9367 @opindex funsafe-math-optimizations
9368
9369 Allow optimizations for floating-point arithmetic that (a) assume
9370 that arguments and results are valid and (b) may violate IEEE or
9371 ANSI standards. When used at link time, it may include libraries
9372 or startup files that change the default FPU control word or other
9373 similar optimizations.
9374
9375 This option is not turned on by any @option{-O} option since
9376 it can result in incorrect output for programs that depend on
9377 an exact implementation of IEEE or ISO rules/specifications for
9378 math functions. It may, however, yield faster code for programs
9379 that do not require the guarantees of these specifications.
9380 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9381 @option{-fassociative-math} and @option{-freciprocal-math}.
9382
9383 The default is @option{-fno-unsafe-math-optimizations}.
9384
9385 @item -fassociative-math
9386 @opindex fassociative-math
9387
9388 Allow re-association of operands in series of floating-point operations.
9389 This violates the ISO C and C++ language standard by possibly changing
9390 computation result. NOTE: re-ordering may change the sign of zero as
9391 well as ignore NaNs and inhibit or create underflow or overflow (and
9392 thus cannot be used on code that relies on rounding behavior like
9393 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9394 and thus may not be used when ordered comparisons are required.
9395 This option requires that both @option{-fno-signed-zeros} and
9396 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9397 much sense with @option{-frounding-math}. For Fortran the option
9398 is automatically enabled when both @option{-fno-signed-zeros} and
9399 @option{-fno-trapping-math} are in effect.
9400
9401 The default is @option{-fno-associative-math}.
9402
9403 @item -freciprocal-math
9404 @opindex freciprocal-math
9405
9406 Allow the reciprocal of a value to be used instead of dividing by
9407 the value if this enables optimizations. For example @code{x / y}
9408 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9409 is subject to common subexpression elimination. Note that this loses
9410 precision and increases the number of flops operating on the value.
9411
9412 The default is @option{-fno-reciprocal-math}.
9413
9414 @item -ffinite-math-only
9415 @opindex ffinite-math-only
9416 Allow optimizations for floating-point arithmetic that assume
9417 that arguments and results are not NaNs or +-Infs.
9418
9419 This option is not turned on by any @option{-O} option since
9420 it can result in incorrect output for programs that depend on
9421 an exact implementation of IEEE or ISO rules/specifications for
9422 math functions. It may, however, yield faster code for programs
9423 that do not require the guarantees of these specifications.
9424
9425 The default is @option{-fno-finite-math-only}.
9426
9427 @item -fno-signed-zeros
9428 @opindex fno-signed-zeros
9429 Allow optimizations for floating-point arithmetic that ignore the
9430 signedness of zero. IEEE arithmetic specifies the behavior of
9431 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9432 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9433 This option implies that the sign of a zero result isn't significant.
9434
9435 The default is @option{-fsigned-zeros}.
9436
9437 @item -fno-trapping-math
9438 @opindex fno-trapping-math
9439 Compile code assuming that floating-point operations cannot generate
9440 user-visible traps. These traps include division by zero, overflow,
9441 underflow, inexact result and invalid operation. This option requires
9442 that @option{-fno-signaling-nans} be in effect. Setting this option may
9443 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9444
9445 This option should never be turned on by any @option{-O} option since
9446 it can result in incorrect output for programs that depend on
9447 an exact implementation of IEEE or ISO rules/specifications for
9448 math functions.
9449
9450 The default is @option{-ftrapping-math}.
9451
9452 @item -frounding-math
9453 @opindex frounding-math
9454 Disable transformations and optimizations that assume default floating-point
9455 rounding behavior. This is round-to-zero for all floating point
9456 to integer conversions, and round-to-nearest for all other arithmetic
9457 truncations. This option should be specified for programs that change
9458 the FP rounding mode dynamically, or that may be executed with a
9459 non-default rounding mode. This option disables constant folding of
9460 floating-point expressions at compile time (which may be affected by
9461 rounding mode) and arithmetic transformations that are unsafe in the
9462 presence of sign-dependent rounding modes.
9463
9464 The default is @option{-fno-rounding-math}.
9465
9466 This option is experimental and does not currently guarantee to
9467 disable all GCC optimizations that are affected by rounding mode.
9468 Future versions of GCC may provide finer control of this setting
9469 using C99's @code{FENV_ACCESS} pragma. This command-line option
9470 will be used to specify the default state for @code{FENV_ACCESS}.
9471
9472 @item -fsignaling-nans
9473 @opindex fsignaling-nans
9474 Compile code assuming that IEEE signaling NaNs may generate user-visible
9475 traps during floating-point operations. Setting this option disables
9476 optimizations that may change the number of exceptions visible with
9477 signaling NaNs. This option implies @option{-ftrapping-math}.
9478
9479 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9480 be defined.
9481
9482 The default is @option{-fno-signaling-nans}.
9483
9484 This option is experimental and does not currently guarantee to
9485 disable all GCC optimizations that affect signaling NaN behavior.
9486
9487 @item -fno-fp-int-builtin-inexact
9488 @opindex fno-fp-int-builtin-inexact
9489 Do not allow the built-in functions @code{ceil}, @code{floor},
9490 @code{round} and @code{trunc}, and their @code{float} and @code{long
9491 double} variants, to generate code that raises the ``inexact''
9492 floating-point exception for noninteger arguments. ISO C99 and C11
9493 allow these functions to raise the ``inexact'' exception, but ISO/IEC
9494 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
9495 functions to do so.
9496
9497 The default is @option{-ffp-int-builtin-inexact}, allowing the
9498 exception to be raised. This option does nothing unless
9499 @option{-ftrapping-math} is in effect.
9500
9501 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
9502 generate a call to a library function then the ``inexact'' exception
9503 may be raised if the library implementation does not follow TS 18661.
9504
9505 @item -fsingle-precision-constant
9506 @opindex fsingle-precision-constant
9507 Treat floating-point constants as single precision instead of
9508 implicitly converting them to double-precision constants.
9509
9510 @item -fcx-limited-range
9511 @opindex fcx-limited-range
9512 When enabled, this option states that a range reduction step is not
9513 needed when performing complex division. Also, there is no checking
9514 whether the result of a complex multiplication or division is @code{NaN
9515 + I*NaN}, with an attempt to rescue the situation in that case. The
9516 default is @option{-fno-cx-limited-range}, but is enabled by
9517 @option{-ffast-math}.
9518
9519 This option controls the default setting of the ISO C99
9520 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9521 all languages.
9522
9523 @item -fcx-fortran-rules
9524 @opindex fcx-fortran-rules
9525 Complex multiplication and division follow Fortran rules. Range
9526 reduction is done as part of complex division, but there is no checking
9527 whether the result of a complex multiplication or division is @code{NaN
9528 + I*NaN}, with an attempt to rescue the situation in that case.
9529
9530 The default is @option{-fno-cx-fortran-rules}.
9531
9532 @end table
9533
9534 The following options control optimizations that may improve
9535 performance, but are not enabled by any @option{-O} options. This
9536 section includes experimental options that may produce broken code.
9537
9538 @table @gcctabopt
9539 @item -fbranch-probabilities
9540 @opindex fbranch-probabilities
9541 After running a program compiled with @option{-fprofile-arcs}
9542 (@pxref{Instrumentation Options}),
9543 you can compile it a second time using
9544 @option{-fbranch-probabilities}, to improve optimizations based on
9545 the number of times each branch was taken. When a program
9546 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9547 counts to a file called @file{@var{sourcename}.gcda} for each source
9548 file. The information in this data file is very dependent on the
9549 structure of the generated code, so you must use the same source code
9550 and the same optimization options for both compilations.
9551
9552 With @option{-fbranch-probabilities}, GCC puts a
9553 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9554 These can be used to improve optimization. Currently, they are only
9555 used in one place: in @file{reorg.c}, instead of guessing which path a
9556 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9557 exactly determine which path is taken more often.
9558
9559 @item -fprofile-values
9560 @opindex fprofile-values
9561 If combined with @option{-fprofile-arcs}, it adds code so that some
9562 data about values of expressions in the program is gathered.
9563
9564 With @option{-fbranch-probabilities}, it reads back the data gathered
9565 from profiling values of expressions for usage in optimizations.
9566
9567 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9568
9569 @item -fprofile-reorder-functions
9570 @opindex fprofile-reorder-functions
9571 Function reordering based on profile instrumentation collects
9572 first time of execution of a function and orders these functions
9573 in ascending order.
9574
9575 Enabled with @option{-fprofile-use}.
9576
9577 @item -fvpt
9578 @opindex fvpt
9579 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9580 to add code to gather information about values of expressions.
9581
9582 With @option{-fbranch-probabilities}, it reads back the data gathered
9583 and actually performs the optimizations based on them.
9584 Currently the optimizations include specialization of division operations
9585 using the knowledge about the value of the denominator.
9586
9587 @item -frename-registers
9588 @opindex frename-registers
9589 Attempt to avoid false dependencies in scheduled code by making use
9590 of registers left over after register allocation. This optimization
9591 most benefits processors with lots of registers. Depending on the
9592 debug information format adopted by the target, however, it can
9593 make debugging impossible, since variables no longer stay in
9594 a ``home register''.
9595
9596 Enabled by default with @option{-funroll-loops}.
9597
9598 @item -fschedule-fusion
9599 @opindex fschedule-fusion
9600 Performs a target dependent pass over the instruction stream to schedule
9601 instructions of same type together because target machine can execute them
9602 more efficiently if they are adjacent to each other in the instruction flow.
9603
9604 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9605
9606 @item -ftracer
9607 @opindex ftracer
9608 Perform tail duplication to enlarge superblock size. This transformation
9609 simplifies the control flow of the function allowing other optimizations to do
9610 a better job.
9611
9612 Enabled with @option{-fprofile-use}.
9613
9614 @item -funroll-loops
9615 @opindex funroll-loops
9616 Unroll loops whose number of iterations can be determined at compile time or
9617 upon entry to the loop. @option{-funroll-loops} implies
9618 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9619 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9620 a small constant number of iterations). This option makes code larger, and may
9621 or may not make it run faster.
9622
9623 Enabled with @option{-fprofile-use}.
9624
9625 @item -funroll-all-loops
9626 @opindex funroll-all-loops
9627 Unroll all loops, even if their number of iterations is uncertain when
9628 the loop is entered. This usually makes programs run more slowly.
9629 @option{-funroll-all-loops} implies the same options as
9630 @option{-funroll-loops}.
9631
9632 @item -fpeel-loops
9633 @opindex fpeel-loops
9634 Peels loops for which there is enough information that they do not
9635 roll much (from profile feedback or static analysis). It also turns on
9636 complete loop peeling (i.e.@: complete removal of loops with small constant
9637 number of iterations).
9638
9639 Enabled with @option{-O3} and/or @option{-fprofile-use}.
9640
9641 @item -fmove-loop-invariants
9642 @opindex fmove-loop-invariants
9643 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
9644 at level @option{-O1}
9645
9646 @item -fsplit-loops
9647 @opindex fsplit-loops
9648 Split a loop into two if it contains a condition that's always true
9649 for one side of the iteration space and false for the other.
9650
9651 @item -funswitch-loops
9652 @opindex funswitch-loops
9653 Move branches with loop invariant conditions out of the loop, with duplicates
9654 of the loop on both branches (modified according to result of the condition).
9655
9656 @item -ffunction-sections
9657 @itemx -fdata-sections
9658 @opindex ffunction-sections
9659 @opindex fdata-sections
9660 Place each function or data item into its own section in the output
9661 file if the target supports arbitrary sections. The name of the
9662 function or the name of the data item determines the section's name
9663 in the output file.
9664
9665 Use these options on systems where the linker can perform optimizations
9666 to improve locality of reference in the instruction space. Most systems
9667 using the ELF object format and SPARC processors running Solaris 2 have
9668 linkers with such optimizations. AIX may have these optimizations in
9669 the future.
9670
9671 Only use these options when there are significant benefits from doing
9672 so. When you specify these options, the assembler and linker
9673 create larger object and executable files and are also slower.
9674 You cannot use @command{gprof} on all systems if you
9675 specify this option, and you may have problems with debugging if
9676 you specify both this option and @option{-g}.
9677
9678 @item -fbranch-target-load-optimize
9679 @opindex fbranch-target-load-optimize
9680 Perform branch target register load optimization before prologue / epilogue
9681 threading.
9682 The use of target registers can typically be exposed only during reload,
9683 thus hoisting loads out of loops and doing inter-block scheduling needs
9684 a separate optimization pass.
9685
9686 @item -fbranch-target-load-optimize2
9687 @opindex fbranch-target-load-optimize2
9688 Perform branch target register load optimization after prologue / epilogue
9689 threading.
9690
9691 @item -fbtr-bb-exclusive
9692 @opindex fbtr-bb-exclusive
9693 When performing branch target register load optimization, don't reuse
9694 branch target registers within any basic block.
9695
9696 @item -fstdarg-opt
9697 @opindex fstdarg-opt
9698 Optimize the prologue of variadic argument functions with respect to usage of
9699 those arguments.
9700
9701 @item -fsection-anchors
9702 @opindex fsection-anchors
9703 Try to reduce the number of symbolic address calculations by using
9704 shared ``anchor'' symbols to address nearby objects. This transformation
9705 can help to reduce the number of GOT entries and GOT accesses on some
9706 targets.
9707
9708 For example, the implementation of the following function @code{foo}:
9709
9710 @smallexample
9711 static int a, b, c;
9712 int foo (void) @{ return a + b + c; @}
9713 @end smallexample
9714
9715 @noindent
9716 usually calculates the addresses of all three variables, but if you
9717 compile it with @option{-fsection-anchors}, it accesses the variables
9718 from a common anchor point instead. The effect is similar to the
9719 following pseudocode (which isn't valid C):
9720
9721 @smallexample
9722 int foo (void)
9723 @{
9724 register int *xr = &x;
9725 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9726 @}
9727 @end smallexample
9728
9729 Not all targets support this option.
9730
9731 @item --param @var{name}=@var{value}
9732 @opindex param
9733 In some places, GCC uses various constants to control the amount of
9734 optimization that is done. For example, GCC does not inline functions
9735 that contain more than a certain number of instructions. You can
9736 control some of these constants on the command line using the
9737 @option{--param} option.
9738
9739 The names of specific parameters, and the meaning of the values, are
9740 tied to the internals of the compiler, and are subject to change
9741 without notice in future releases.
9742
9743 In each case, the @var{value} is an integer. The allowable choices for
9744 @var{name} are:
9745
9746 @table @gcctabopt
9747 @item predictable-branch-outcome
9748 When branch is predicted to be taken with probability lower than this threshold
9749 (in percent), then it is considered well predictable. The default is 10.
9750
9751 @item max-rtl-if-conversion-insns
9752 RTL if-conversion tries to remove conditional branches around a block and
9753 replace them with conditionally executed instructions. This parameter
9754 gives the maximum number of instructions in a block which should be
9755 considered for if-conversion. The default is 10, though the compiler will
9756 also use other heuristics to decide whether if-conversion is likely to be
9757 profitable.
9758
9759 @item max-rtl-if-conversion-predictable-cost
9760 @item max-rtl-if-conversion-unpredictable-cost
9761 RTL if-conversion will try to remove conditional branches around a block
9762 and replace them with conditionally executed instructions. These parameters
9763 give the maximum permissible cost for the sequence that would be generated
9764 by if-conversion depending on whether the branch is statically determined
9765 to be predictable or not. The units for this parameter are the same as
9766 those for the GCC internal seq_cost metric. The compiler will try to
9767 provide a reasonable default for this parameter using the BRANCH_COST
9768 target macro.
9769
9770 @item max-crossjump-edges
9771 The maximum number of incoming edges to consider for cross-jumping.
9772 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
9773 the number of edges incoming to each block. Increasing values mean
9774 more aggressive optimization, making the compilation time increase with
9775 probably small improvement in executable size.
9776
9777 @item min-crossjump-insns
9778 The minimum number of instructions that must be matched at the end
9779 of two blocks before cross-jumping is performed on them. This
9780 value is ignored in the case where all instructions in the block being
9781 cross-jumped from are matched. The default value is 5.
9782
9783 @item max-grow-copy-bb-insns
9784 The maximum code size expansion factor when copying basic blocks
9785 instead of jumping. The expansion is relative to a jump instruction.
9786 The default value is 8.
9787
9788 @item max-goto-duplication-insns
9789 The maximum number of instructions to duplicate to a block that jumps
9790 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
9791 passes, GCC factors computed gotos early in the compilation process,
9792 and unfactors them as late as possible. Only computed jumps at the
9793 end of a basic blocks with no more than max-goto-duplication-insns are
9794 unfactored. The default value is 8.
9795
9796 @item max-delay-slot-insn-search
9797 The maximum number of instructions to consider when looking for an
9798 instruction to fill a delay slot. If more than this arbitrary number of
9799 instructions are searched, the time savings from filling the delay slot
9800 are minimal, so stop searching. Increasing values mean more
9801 aggressive optimization, making the compilation time increase with probably
9802 small improvement in execution time.
9803
9804 @item max-delay-slot-live-search
9805 When trying to fill delay slots, the maximum number of instructions to
9806 consider when searching for a block with valid live register
9807 information. Increasing this arbitrarily chosen value means more
9808 aggressive optimization, increasing the compilation time. This parameter
9809 should be removed when the delay slot code is rewritten to maintain the
9810 control-flow graph.
9811
9812 @item max-gcse-memory
9813 The approximate maximum amount of memory that can be allocated in
9814 order to perform the global common subexpression elimination
9815 optimization. If more memory than specified is required, the
9816 optimization is not done.
9817
9818 @item max-gcse-insertion-ratio
9819 If the ratio of expression insertions to deletions is larger than this value
9820 for any expression, then RTL PRE inserts or removes the expression and thus
9821 leaves partially redundant computations in the instruction stream. The default value is 20.
9822
9823 @item max-pending-list-length
9824 The maximum number of pending dependencies scheduling allows
9825 before flushing the current state and starting over. Large functions
9826 with few branches or calls can create excessively large lists which
9827 needlessly consume memory and resources.
9828
9829 @item max-modulo-backtrack-attempts
9830 The maximum number of backtrack attempts the scheduler should make
9831 when modulo scheduling a loop. Larger values can exponentially increase
9832 compilation time.
9833
9834 @item max-inline-insns-single
9835 Several parameters control the tree inliner used in GCC@.
9836 This number sets the maximum number of instructions (counted in GCC's
9837 internal representation) in a single function that the tree inliner
9838 considers for inlining. This only affects functions declared
9839 inline and methods implemented in a class declaration (C++).
9840 The default value is 400.
9841
9842 @item max-inline-insns-auto
9843 When you use @option{-finline-functions} (included in @option{-O3}),
9844 a lot of functions that would otherwise not be considered for inlining
9845 by the compiler are investigated. To those functions, a different
9846 (more restrictive) limit compared to functions declared inline can
9847 be applied.
9848 The default value is 40.
9849
9850 @item inline-min-speedup
9851 When estimated performance improvement of caller + callee runtime exceeds this
9852 threshold (in percent), the function can be inlined regardless of the limit on
9853 @option{--param max-inline-insns-single} and @option{--param
9854 max-inline-insns-auto}.
9855
9856 @item large-function-insns
9857 The limit specifying really large functions. For functions larger than this
9858 limit after inlining, inlining is constrained by
9859 @option{--param large-function-growth}. This parameter is useful primarily
9860 to avoid extreme compilation time caused by non-linear algorithms used by the
9861 back end.
9862 The default value is 2700.
9863
9864 @item large-function-growth
9865 Specifies maximal growth of large function caused by inlining in percents.
9866 The default value is 100 which limits large function growth to 2.0 times
9867 the original size.
9868
9869 @item large-unit-insns
9870 The limit specifying large translation unit. Growth caused by inlining of
9871 units larger than this limit is limited by @option{--param inline-unit-growth}.
9872 For small units this might be too tight.
9873 For example, consider a unit consisting of function A
9874 that is inline and B that just calls A three times. If B is small relative to
9875 A, the growth of unit is 300\% and yet such inlining is very sane. For very
9876 large units consisting of small inlineable functions, however, the overall unit
9877 growth limit is needed to avoid exponential explosion of code size. Thus for
9878 smaller units, the size is increased to @option{--param large-unit-insns}
9879 before applying @option{--param inline-unit-growth}. The default is 10000.
9880
9881 @item inline-unit-growth
9882 Specifies maximal overall growth of the compilation unit caused by inlining.
9883 The default value is 20 which limits unit growth to 1.2 times the original
9884 size. Cold functions (either marked cold via an attribute or by profile
9885 feedback) are not accounted into the unit size.
9886
9887 @item ipcp-unit-growth
9888 Specifies maximal overall growth of the compilation unit caused by
9889 interprocedural constant propagation. The default value is 10 which limits
9890 unit growth to 1.1 times the original size.
9891
9892 @item large-stack-frame
9893 The limit specifying large stack frames. While inlining the algorithm is trying
9894 to not grow past this limit too much. The default value is 256 bytes.
9895
9896 @item large-stack-frame-growth
9897 Specifies maximal growth of large stack frames caused by inlining in percents.
9898 The default value is 1000 which limits large stack frame growth to 11 times
9899 the original size.
9900
9901 @item max-inline-insns-recursive
9902 @itemx max-inline-insns-recursive-auto
9903 Specifies the maximum number of instructions an out-of-line copy of a
9904 self-recursive inline
9905 function can grow into by performing recursive inlining.
9906
9907 @option{--param max-inline-insns-recursive} applies to functions
9908 declared inline.
9909 For functions not declared inline, recursive inlining
9910 happens only when @option{-finline-functions} (included in @option{-O3}) is
9911 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
9912 default value is 450.
9913
9914 @item max-inline-recursive-depth
9915 @itemx max-inline-recursive-depth-auto
9916 Specifies the maximum recursion depth used for recursive inlining.
9917
9918 @option{--param max-inline-recursive-depth} applies to functions
9919 declared inline. For functions not declared inline, recursive inlining
9920 happens only when @option{-finline-functions} (included in @option{-O3}) is
9921 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
9922 default value is 8.
9923
9924 @item min-inline-recursive-probability
9925 Recursive inlining is profitable only for function having deep recursion
9926 in average and can hurt for function having little recursion depth by
9927 increasing the prologue size or complexity of function body to other
9928 optimizers.
9929
9930 When profile feedback is available (see @option{-fprofile-generate}) the actual
9931 recursion depth can be guessed from the probability that function recurses
9932 via a given call expression. This parameter limits inlining only to call
9933 expressions whose probability exceeds the given threshold (in percents).
9934 The default value is 10.
9935
9936 @item early-inlining-insns
9937 Specify growth that the early inliner can make. In effect it increases
9938 the amount of inlining for code having a large abstraction penalty.
9939 The default value is 14.
9940
9941 @item max-early-inliner-iterations
9942 Limit of iterations of the early inliner. This basically bounds
9943 the number of nested indirect calls the early inliner can resolve.
9944 Deeper chains are still handled by late inlining.
9945
9946 @item comdat-sharing-probability
9947 Probability (in percent) that C++ inline function with comdat visibility
9948 are shared across multiple compilation units. The default value is 20.
9949
9950 @item profile-func-internal-id
9951 A parameter to control whether to use function internal id in profile
9952 database lookup. If the value is 0, the compiler uses an id that
9953 is based on function assembler name and filename, which makes old profile
9954 data more tolerant to source changes such as function reordering etc.
9955 The default value is 0.
9956
9957 @item min-vect-loop-bound
9958 The minimum number of iterations under which loops are not vectorized
9959 when @option{-ftree-vectorize} is used. The number of iterations after
9960 vectorization needs to be greater than the value specified by this option
9961 to allow vectorization. The default value is 0.
9962
9963 @item gcse-cost-distance-ratio
9964 Scaling factor in calculation of maximum distance an expression
9965 can be moved by GCSE optimizations. This is currently supported only in the
9966 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9967 is with simple expressions, i.e., the expressions that have cost
9968 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9969 hoisting of simple expressions. The default value is 10.
9970
9971 @item gcse-unrestricted-cost
9972 Cost, roughly measured as the cost of a single typical machine
9973 instruction, at which GCSE optimizations do not constrain
9974 the distance an expression can travel. This is currently
9975 supported only in the code hoisting pass. The lesser the cost,
9976 the more aggressive code hoisting is. Specifying 0
9977 allows all expressions to travel unrestricted distances.
9978 The default value is 3.
9979
9980 @item max-hoist-depth
9981 The depth of search in the dominator tree for expressions to hoist.
9982 This is used to avoid quadratic behavior in hoisting algorithm.
9983 The value of 0 does not limit on the search, but may slow down compilation
9984 of huge functions. The default value is 30.
9985
9986 @item max-tail-merge-comparisons
9987 The maximum amount of similar bbs to compare a bb with. This is used to
9988 avoid quadratic behavior in tree tail merging. The default value is 10.
9989
9990 @item max-tail-merge-iterations
9991 The maximum amount of iterations of the pass over the function. This is used to
9992 limit compilation time in tree tail merging. The default value is 2.
9993
9994 @item store-merging-allow-unaligned
9995 Allow the store merging pass to introduce unaligned stores if it is legal to
9996 do so. The default value is 1.
9997
9998 @item max-stores-to-merge
9999 The maximum number of stores to attempt to merge into wider stores in the store
10000 merging pass. The minimum value is 2 and the default is 64.
10001
10002 @item max-unrolled-insns
10003 The maximum number of instructions that a loop may have to be unrolled.
10004 If a loop is unrolled, this parameter also determines how many times
10005 the loop code is unrolled.
10006
10007 @item max-average-unrolled-insns
10008 The maximum number of instructions biased by probabilities of their execution
10009 that a loop may have to be unrolled. If a loop is unrolled,
10010 this parameter also determines how many times the loop code is unrolled.
10011
10012 @item max-unroll-times
10013 The maximum number of unrollings of a single loop.
10014
10015 @item max-peeled-insns
10016 The maximum number of instructions that a loop may have to be peeled.
10017 If a loop is peeled, this parameter also determines how many times
10018 the loop code is peeled.
10019
10020 @item max-peel-times
10021 The maximum number of peelings of a single loop.
10022
10023 @item max-peel-branches
10024 The maximum number of branches on the hot path through the peeled sequence.
10025
10026 @item max-completely-peeled-insns
10027 The maximum number of insns of a completely peeled loop.
10028
10029 @item max-completely-peel-times
10030 The maximum number of iterations of a loop to be suitable for complete peeling.
10031
10032 @item max-completely-peel-loop-nest-depth
10033 The maximum depth of a loop nest suitable for complete peeling.
10034
10035 @item max-unswitch-insns
10036 The maximum number of insns of an unswitched loop.
10037
10038 @item max-unswitch-level
10039 The maximum number of branches unswitched in a single loop.
10040
10041 @item max-loop-headers-insns
10042 The maximum number of insns in loop header duplicated by the copy loop headers
10043 pass.
10044
10045 @item lim-expensive
10046 The minimum cost of an expensive expression in the loop invariant motion.
10047
10048 @item iv-consider-all-candidates-bound
10049 Bound on number of candidates for induction variables, below which
10050 all candidates are considered for each use in induction variable
10051 optimizations. If there are more candidates than this,
10052 only the most relevant ones are considered to avoid quadratic time complexity.
10053
10054 @item iv-max-considered-uses
10055 The induction variable optimizations give up on loops that contain more
10056 induction variable uses.
10057
10058 @item iv-always-prune-cand-set-bound
10059 If the number of candidates in the set is smaller than this value,
10060 always try to remove unnecessary ivs from the set
10061 when adding a new one.
10062
10063 @item avg-loop-niter
10064 Average number of iterations of a loop.
10065
10066 @item dse-max-object-size
10067 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10068 Larger values may result in larger compilation times.
10069
10070 @item scev-max-expr-size
10071 Bound on size of expressions used in the scalar evolutions analyzer.
10072 Large expressions slow the analyzer.
10073
10074 @item scev-max-expr-complexity
10075 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10076 Complex expressions slow the analyzer.
10077
10078 @item max-tree-if-conversion-phi-args
10079 Maximum number of arguments in a PHI supported by TREE if conversion
10080 unless the loop is marked with simd pragma.
10081
10082 @item vect-max-version-for-alignment-checks
10083 The maximum number of run-time checks that can be performed when
10084 doing loop versioning for alignment in the vectorizer.
10085
10086 @item vect-max-version-for-alias-checks
10087 The maximum number of run-time checks that can be performed when
10088 doing loop versioning for alias in the vectorizer.
10089
10090 @item vect-max-peeling-for-alignment
10091 The maximum number of loop peels to enhance access alignment
10092 for vectorizer. Value -1 means no limit.
10093
10094 @item max-iterations-to-track
10095 The maximum number of iterations of a loop the brute-force algorithm
10096 for analysis of the number of iterations of the loop tries to evaluate.
10097
10098 @item hot-bb-count-ws-permille
10099 A basic block profile count is considered hot if it contributes to
10100 the given permillage (i.e. 0...1000) of the entire profiled execution.
10101
10102 @item hot-bb-frequency-fraction
10103 Select fraction of the entry block frequency of executions of basic block in
10104 function given basic block needs to have to be considered hot.
10105
10106 @item max-predicted-iterations
10107 The maximum number of loop iterations we predict statically. This is useful
10108 in cases where a function contains a single loop with known bound and
10109 another loop with unknown bound.
10110 The known number of iterations is predicted correctly, while
10111 the unknown number of iterations average to roughly 10. This means that the
10112 loop without bounds appears artificially cold relative to the other one.
10113
10114 @item builtin-expect-probability
10115 Control the probability of the expression having the specified value. This
10116 parameter takes a percentage (i.e. 0 ... 100) as input.
10117 The default probability of 90 is obtained empirically.
10118
10119 @item align-threshold
10120
10121 Select fraction of the maximal frequency of executions of a basic block in
10122 a function to align the basic block.
10123
10124 @item align-loop-iterations
10125
10126 A loop expected to iterate at least the selected number of iterations is
10127 aligned.
10128
10129 @item tracer-dynamic-coverage
10130 @itemx tracer-dynamic-coverage-feedback
10131
10132 This value is used to limit superblock formation once the given percentage of
10133 executed instructions is covered. This limits unnecessary code size
10134 expansion.
10135
10136 The @option{tracer-dynamic-coverage-feedback} parameter
10137 is used only when profile
10138 feedback is available. The real profiles (as opposed to statically estimated
10139 ones) are much less balanced allowing the threshold to be larger value.
10140
10141 @item tracer-max-code-growth
10142 Stop tail duplication once code growth has reached given percentage. This is
10143 a rather artificial limit, as most of the duplicates are eliminated later in
10144 cross jumping, so it may be set to much higher values than is the desired code
10145 growth.
10146
10147 @item tracer-min-branch-ratio
10148
10149 Stop reverse growth when the reverse probability of best edge is less than this
10150 threshold (in percent).
10151
10152 @item tracer-min-branch-probability
10153 @itemx tracer-min-branch-probability-feedback
10154
10155 Stop forward growth if the best edge has probability lower than this
10156 threshold.
10157
10158 Similarly to @option{tracer-dynamic-coverage} two parameters are
10159 provided. @option{tracer-min-branch-probability-feedback} is used for
10160 compilation with profile feedback and @option{tracer-min-branch-probability}
10161 compilation without. The value for compilation with profile feedback
10162 needs to be more conservative (higher) in order to make tracer
10163 effective.
10164
10165 @item max-cse-path-length
10166
10167 The maximum number of basic blocks on path that CSE considers.
10168 The default is 10.
10169
10170 @item max-cse-insns
10171 The maximum number of instructions CSE processes before flushing.
10172 The default is 1000.
10173
10174 @item ggc-min-expand
10175
10176 GCC uses a garbage collector to manage its own memory allocation. This
10177 parameter specifies the minimum percentage by which the garbage
10178 collector's heap should be allowed to expand between collections.
10179 Tuning this may improve compilation speed; it has no effect on code
10180 generation.
10181
10182 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10183 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10184 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10185 GCC is not able to calculate RAM on a particular platform, the lower
10186 bound of 30% is used. Setting this parameter and
10187 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10188 every opportunity. This is extremely slow, but can be useful for
10189 debugging.
10190
10191 @item ggc-min-heapsize
10192
10193 Minimum size of the garbage collector's heap before it begins bothering
10194 to collect garbage. The first collection occurs after the heap expands
10195 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10196 tuning this may improve compilation speed, and has no effect on code
10197 generation.
10198
10199 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10200 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10201 with a lower bound of 4096 (four megabytes) and an upper bound of
10202 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10203 particular platform, the lower bound is used. Setting this parameter
10204 very large effectively disables garbage collection. Setting this
10205 parameter and @option{ggc-min-expand} to zero causes a full collection
10206 to occur at every opportunity.
10207
10208 @item max-reload-search-insns
10209 The maximum number of instruction reload should look backward for equivalent
10210 register. Increasing values mean more aggressive optimization, making the
10211 compilation time increase with probably slightly better performance.
10212 The default value is 100.
10213
10214 @item max-cselib-memory-locations
10215 The maximum number of memory locations cselib should take into account.
10216 Increasing values mean more aggressive optimization, making the compilation time
10217 increase with probably slightly better performance. The default value is 500.
10218
10219 @item max-sched-ready-insns
10220 The maximum number of instructions ready to be issued the scheduler should
10221 consider at any given time during the first scheduling pass. Increasing
10222 values mean more thorough searches, making the compilation time increase
10223 with probably little benefit. The default value is 100.
10224
10225 @item max-sched-region-blocks
10226 The maximum number of blocks in a region to be considered for
10227 interblock scheduling. The default value is 10.
10228
10229 @item max-pipeline-region-blocks
10230 The maximum number of blocks in a region to be considered for
10231 pipelining in the selective scheduler. The default value is 15.
10232
10233 @item max-sched-region-insns
10234 The maximum number of insns in a region to be considered for
10235 interblock scheduling. The default value is 100.
10236
10237 @item max-pipeline-region-insns
10238 The maximum number of insns in a region to be considered for
10239 pipelining in the selective scheduler. The default value is 200.
10240
10241 @item min-spec-prob
10242 The minimum probability (in percents) of reaching a source block
10243 for interblock speculative scheduling. The default value is 40.
10244
10245 @item max-sched-extend-regions-iters
10246 The maximum number of iterations through CFG to extend regions.
10247 A value of 0 (the default) disables region extensions.
10248
10249 @item max-sched-insn-conflict-delay
10250 The maximum conflict delay for an insn to be considered for speculative motion.
10251 The default value is 3.
10252
10253 @item sched-spec-prob-cutoff
10254 The minimal probability of speculation success (in percents), so that
10255 speculative insns are scheduled.
10256 The default value is 40.
10257
10258 @item sched-state-edge-prob-cutoff
10259 The minimum probability an edge must have for the scheduler to save its
10260 state across it.
10261 The default value is 10.
10262
10263 @item sched-mem-true-dep-cost
10264 Minimal distance (in CPU cycles) between store and load targeting same
10265 memory locations. The default value is 1.
10266
10267 @item selsched-max-lookahead
10268 The maximum size of the lookahead window of selective scheduling. It is a
10269 depth of search for available instructions.
10270 The default value is 50.
10271
10272 @item selsched-max-sched-times
10273 The maximum number of times that an instruction is scheduled during
10274 selective scheduling. This is the limit on the number of iterations
10275 through which the instruction may be pipelined. The default value is 2.
10276
10277 @item selsched-insns-to-rename
10278 The maximum number of best instructions in the ready list that are considered
10279 for renaming in the selective scheduler. The default value is 2.
10280
10281 @item sms-min-sc
10282 The minimum value of stage count that swing modulo scheduler
10283 generates. The default value is 2.
10284
10285 @item max-last-value-rtl
10286 The maximum size measured as number of RTLs that can be recorded in an expression
10287 in combiner for a pseudo register as last known value of that register. The default
10288 is 10000.
10289
10290 @item max-combine-insns
10291 The maximum number of instructions the RTL combiner tries to combine.
10292 The default value is 2 at @option{-Og} and 4 otherwise.
10293
10294 @item integer-share-limit
10295 Small integer constants can use a shared data structure, reducing the
10296 compiler's memory usage and increasing its speed. This sets the maximum
10297 value of a shared integer constant. The default value is 256.
10298
10299 @item ssp-buffer-size
10300 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10301 protection when @option{-fstack-protection} is used.
10302
10303 @item min-size-for-stack-sharing
10304 The minimum size of variables taking part in stack slot sharing when not
10305 optimizing. The default value is 32.
10306
10307 @item max-jump-thread-duplication-stmts
10308 Maximum number of statements allowed in a block that needs to be
10309 duplicated when threading jumps.
10310
10311 @item max-fields-for-field-sensitive
10312 Maximum number of fields in a structure treated in
10313 a field sensitive manner during pointer analysis. The default is zero
10314 for @option{-O0} and @option{-O1},
10315 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10316
10317 @item prefetch-latency
10318 Estimate on average number of instructions that are executed before
10319 prefetch finishes. The distance prefetched ahead is proportional
10320 to this constant. Increasing this number may also lead to less
10321 streams being prefetched (see @option{simultaneous-prefetches}).
10322
10323 @item simultaneous-prefetches
10324 Maximum number of prefetches that can run at the same time.
10325
10326 @item l1-cache-line-size
10327 The size of cache line in L1 cache, in bytes.
10328
10329 @item l1-cache-size
10330 The size of L1 cache, in kilobytes.
10331
10332 @item l2-cache-size
10333 The size of L2 cache, in kilobytes.
10334
10335 @item min-insn-to-prefetch-ratio
10336 The minimum ratio between the number of instructions and the
10337 number of prefetches to enable prefetching in a loop.
10338
10339 @item prefetch-min-insn-to-mem-ratio
10340 The minimum ratio between the number of instructions and the
10341 number of memory references to enable prefetching in a loop.
10342
10343 @item use-canonical-types
10344 Whether the compiler should use the ``canonical'' type system. By
10345 default, this should always be 1, which uses a more efficient internal
10346 mechanism for comparing types in C++ and Objective-C++. However, if
10347 bugs in the canonical type system are causing compilation failures,
10348 set this value to 0 to disable canonical types.
10349
10350 @item switch-conversion-max-branch-ratio
10351 Switch initialization conversion refuses to create arrays that are
10352 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10353 branches in the switch.
10354
10355 @item max-partial-antic-length
10356 Maximum length of the partial antic set computed during the tree
10357 partial redundancy elimination optimization (@option{-ftree-pre}) when
10358 optimizing at @option{-O3} and above. For some sorts of source code
10359 the enhanced partial redundancy elimination optimization can run away,
10360 consuming all of the memory available on the host machine. This
10361 parameter sets a limit on the length of the sets that are computed,
10362 which prevents the runaway behavior. Setting a value of 0 for
10363 this parameter allows an unlimited set length.
10364
10365 @item sccvn-max-scc-size
10366 Maximum size of a strongly connected component (SCC) during SCCVN
10367 processing. If this limit is hit, SCCVN processing for the whole
10368 function is not done and optimizations depending on it are
10369 disabled. The default maximum SCC size is 10000.
10370
10371 @item sccvn-max-alias-queries-per-access
10372 Maximum number of alias-oracle queries we perform when looking for
10373 redundancies for loads and stores. If this limit is hit the search
10374 is aborted and the load or store is not considered redundant. The
10375 number of queries is algorithmically limited to the number of
10376 stores on all paths from the load to the function entry.
10377 The default maximum number of queries is 1000.
10378
10379 @item ira-max-loops-num
10380 IRA uses regional register allocation by default. If a function
10381 contains more loops than the number given by this parameter, only at most
10382 the given number of the most frequently-executed loops form regions
10383 for regional register allocation. The default value of the
10384 parameter is 100.
10385
10386 @item ira-max-conflict-table-size
10387 Although IRA uses a sophisticated algorithm to compress the conflict
10388 table, the table can still require excessive amounts of memory for
10389 huge functions. If the conflict table for a function could be more
10390 than the size in MB given by this parameter, the register allocator
10391 instead uses a faster, simpler, and lower-quality
10392 algorithm that does not require building a pseudo-register conflict table.
10393 The default value of the parameter is 2000.
10394
10395 @item ira-loop-reserved-regs
10396 IRA can be used to evaluate more accurate register pressure in loops
10397 for decisions to move loop invariants (see @option{-O3}). The number
10398 of available registers reserved for some other purposes is given
10399 by this parameter. The default value of the parameter is 2, which is
10400 the minimal number of registers needed by typical instructions.
10401 This value is the best found from numerous experiments.
10402
10403 @item lra-inheritance-ebb-probability-cutoff
10404 LRA tries to reuse values reloaded in registers in subsequent insns.
10405 This optimization is called inheritance. EBB is used as a region to
10406 do this optimization. The parameter defines a minimal fall-through
10407 edge probability in percentage used to add BB to inheritance EBB in
10408 LRA. The default value of the parameter is 40. The value was chosen
10409 from numerous runs of SPEC2000 on x86-64.
10410
10411 @item loop-invariant-max-bbs-in-loop
10412 Loop invariant motion can be very expensive, both in compilation time and
10413 in amount of needed compile-time memory, with very large loops. Loops
10414 with more basic blocks than this parameter won't have loop invariant
10415 motion optimization performed on them. The default value of the
10416 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10417
10418 @item loop-max-datarefs-for-datadeps
10419 Building data dependencies is expensive for very large loops. This
10420 parameter limits the number of data references in loops that are
10421 considered for data dependence analysis. These large loops are no
10422 handled by the optimizations using loop data dependencies.
10423 The default value is 1000.
10424
10425 @item max-vartrack-size
10426 Sets a maximum number of hash table slots to use during variable
10427 tracking dataflow analysis of any function. If this limit is exceeded
10428 with variable tracking at assignments enabled, analysis for that
10429 function is retried without it, after removing all debug insns from
10430 the function. If the limit is exceeded even without debug insns, var
10431 tracking analysis is completely disabled for the function. Setting
10432 the parameter to zero makes it unlimited.
10433
10434 @item max-vartrack-expr-depth
10435 Sets a maximum number of recursion levels when attempting to map
10436 variable names or debug temporaries to value expressions. This trades
10437 compilation time for more complete debug information. If this is set too
10438 low, value expressions that are available and could be represented in
10439 debug information may end up not being used; setting this higher may
10440 enable the compiler to find more complex debug expressions, but compile
10441 time and memory use may grow. The default is 12.
10442
10443 @item min-nondebug-insn-uid
10444 Use uids starting at this parameter for nondebug insns. The range below
10445 the parameter is reserved exclusively for debug insns created by
10446 @option{-fvar-tracking-assignments}, but debug insns may get
10447 (non-overlapping) uids above it if the reserved range is exhausted.
10448
10449 @item ipa-sra-ptr-growth-factor
10450 IPA-SRA replaces a pointer to an aggregate with one or more new
10451 parameters only when their cumulative size is less or equal to
10452 @option{ipa-sra-ptr-growth-factor} times the size of the original
10453 pointer parameter.
10454
10455 @item sra-max-scalarization-size-Ospeed
10456 @item sra-max-scalarization-size-Osize
10457 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10458 replace scalar parts of aggregates with uses of independent scalar
10459 variables. These parameters control the maximum size, in storage units,
10460 of aggregate which is considered for replacement when compiling for
10461 speed
10462 (@option{sra-max-scalarization-size-Ospeed}) or size
10463 (@option{sra-max-scalarization-size-Osize}) respectively.
10464
10465 @item tm-max-aggregate-size
10466 When making copies of thread-local variables in a transaction, this
10467 parameter specifies the size in bytes after which variables are
10468 saved with the logging functions as opposed to save/restore code
10469 sequence pairs. This option only applies when using
10470 @option{-fgnu-tm}.
10471
10472 @item graphite-max-nb-scop-params
10473 To avoid exponential effects in the Graphite loop transforms, the
10474 number of parameters in a Static Control Part (SCoP) is bounded. The
10475 default value is 10 parameters. A variable whose value is unknown at
10476 compilation time and defined outside a SCoP is a parameter of the SCoP.
10477
10478 @item graphite-max-bbs-per-function
10479 To avoid exponential effects in the detection of SCoPs, the size of
10480 the functions analyzed by Graphite is bounded. The default value is
10481 100 basic blocks.
10482
10483 @item loop-block-tile-size
10484 Loop blocking or strip mining transforms, enabled with
10485 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10486 loop in the loop nest by a given number of iterations. The strip
10487 length can be changed using the @option{loop-block-tile-size}
10488 parameter. The default value is 51 iterations.
10489
10490 @item loop-unroll-jam-size
10491 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
10492 default value is 4.
10493
10494 @item loop-unroll-jam-depth
10495 Specify the dimension to be unrolled (counting from the most inner loop)
10496 for the @option{-floop-unroll-and-jam}. The default value is 2.
10497
10498 @item ipa-cp-value-list-size
10499 IPA-CP attempts to track all possible values and types passed to a function's
10500 parameter in order to propagate them and perform devirtualization.
10501 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10502 stores per one formal parameter of a function.
10503
10504 @item ipa-cp-eval-threshold
10505 IPA-CP calculates its own score of cloning profitability heuristics
10506 and performs those cloning opportunities with scores that exceed
10507 @option{ipa-cp-eval-threshold}.
10508
10509 @item ipa-cp-recursion-penalty
10510 Percentage penalty the recursive functions will receive when they
10511 are evaluated for cloning.
10512
10513 @item ipa-cp-single-call-penalty
10514 Percentage penalty functions containing a single call to another
10515 function will receive when they are evaluated for cloning.
10516
10517
10518 @item ipa-max-agg-items
10519 IPA-CP is also capable to propagate a number of scalar values passed
10520 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10521 number of such values per one parameter.
10522
10523 @item ipa-cp-loop-hint-bonus
10524 When IPA-CP determines that a cloning candidate would make the number
10525 of iterations of a loop known, it adds a bonus of
10526 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10527 the candidate.
10528
10529 @item ipa-cp-array-index-hint-bonus
10530 When IPA-CP determines that a cloning candidate would make the index of
10531 an array access known, it adds a bonus of
10532 @option{ipa-cp-array-index-hint-bonus} to the profitability
10533 score of the candidate.
10534
10535 @item ipa-max-aa-steps
10536 During its analysis of function bodies, IPA-CP employs alias analysis
10537 in order to track values pointed to by function parameters. In order
10538 not spend too much time analyzing huge functions, it gives up and
10539 consider all memory clobbered after examining
10540 @option{ipa-max-aa-steps} statements modifying memory.
10541
10542 @item lto-partitions
10543 Specify desired number of partitions produced during WHOPR compilation.
10544 The number of partitions should exceed the number of CPUs used for compilation.
10545 The default value is 32.
10546
10547 @item lto-min-partition
10548 Size of minimal partition for WHOPR (in estimated instructions).
10549 This prevents expenses of splitting very small programs into too many
10550 partitions.
10551
10552 @item lto-max-partition
10553 Size of max partition for WHOPR (in estimated instructions).
10554 to provide an upper bound for individual size of partition.
10555 Meant to be used only with balanced partitioning.
10556
10557 @item cxx-max-namespaces-for-diagnostic-help
10558 The maximum number of namespaces to consult for suggestions when C++
10559 name lookup fails for an identifier. The default is 1000.
10560
10561 @item sink-frequency-threshold
10562 The maximum relative execution frequency (in percents) of the target block
10563 relative to a statement's original block to allow statement sinking of a
10564 statement. Larger numbers result in more aggressive statement sinking.
10565 The default value is 75. A small positive adjustment is applied for
10566 statements with memory operands as those are even more profitable so sink.
10567
10568 @item max-stores-to-sink
10569 The maximum number of conditional store pairs that can be sunk. Set to 0
10570 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10571 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10572
10573 @item allow-store-data-races
10574 Allow optimizers to introduce new data races on stores.
10575 Set to 1 to allow, otherwise to 0. This option is enabled by default
10576 at optimization level @option{-Ofast}.
10577
10578 @item case-values-threshold
10579 The smallest number of different values for which it is best to use a
10580 jump-table instead of a tree of conditional branches. If the value is
10581 0, use the default for the machine. The default is 0.
10582
10583 @item tree-reassoc-width
10584 Set the maximum number of instructions executed in parallel in
10585 reassociated tree. This parameter overrides target dependent
10586 heuristics used by default if has non zero value.
10587
10588 @item sched-pressure-algorithm
10589 Choose between the two available implementations of
10590 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10591 and is the more likely to prevent instructions from being reordered.
10592 Algorithm 2 was designed to be a compromise between the relatively
10593 conservative approach taken by algorithm 1 and the rather aggressive
10594 approach taken by the default scheduler. It relies more heavily on
10595 having a regular register file and accurate register pressure classes.
10596 See @file{haifa-sched.c} in the GCC sources for more details.
10597
10598 The default choice depends on the target.
10599
10600 @item max-slsr-cand-scan
10601 Set the maximum number of existing candidates that are considered when
10602 seeking a basis for a new straight-line strength reduction candidate.
10603
10604 @item asan-globals
10605 Enable buffer overflow detection for global objects. This kind
10606 of protection is enabled by default if you are using
10607 @option{-fsanitize=address} option.
10608 To disable global objects protection use @option{--param asan-globals=0}.
10609
10610 @item asan-stack
10611 Enable buffer overflow detection for stack objects. This kind of
10612 protection is enabled by default when using @option{-fsanitize=address}.
10613 To disable stack protection use @option{--param asan-stack=0} option.
10614
10615 @item asan-instrument-reads
10616 Enable buffer overflow detection for memory reads. This kind of
10617 protection is enabled by default when using @option{-fsanitize=address}.
10618 To disable memory reads protection use
10619 @option{--param asan-instrument-reads=0}.
10620
10621 @item asan-instrument-writes
10622 Enable buffer overflow detection for memory writes. This kind of
10623 protection is enabled by default when using @option{-fsanitize=address}.
10624 To disable memory writes protection use
10625 @option{--param asan-instrument-writes=0} option.
10626
10627 @item asan-memintrin
10628 Enable detection for built-in functions. This kind of protection
10629 is enabled by default when using @option{-fsanitize=address}.
10630 To disable built-in functions protection use
10631 @option{--param asan-memintrin=0}.
10632
10633 @item asan-use-after-return
10634 Enable detection of use-after-return. This kind of protection
10635 is enabled by default when using the @option{-fsanitize=address} option.
10636 To disable it use @option{--param asan-use-after-return=0}.
10637
10638 Note: By default the check is disabled at run time. To enable it,
10639 add @code{detect_stack_use_after_return=1} to the environment variable
10640 @env{ASAN_OPTIONS}.
10641
10642 @item asan-instrumentation-with-call-threshold
10643 If number of memory accesses in function being instrumented
10644 is greater or equal to this number, use callbacks instead of inline checks.
10645 E.g. to disable inline code use
10646 @option{--param asan-instrumentation-with-call-threshold=0}.
10647
10648 @item use-after-scope-direct-emission-threshold
10649 If the size of a local variable in bytes is smaller or equal to this
10650 number, directly poison (or unpoison) shadow memory instead of using
10651 run-time callbacks. The default value is 256.
10652
10653 @item chkp-max-ctor-size
10654 Static constructors generated by Pointer Bounds Checker may become very
10655 large and significantly increase compile time at optimization level
10656 @option{-O1} and higher. This parameter is a maximum number of statements
10657 in a single generated constructor. Default value is 5000.
10658
10659 @item max-fsm-thread-path-insns
10660 Maximum number of instructions to copy when duplicating blocks on a
10661 finite state automaton jump thread path. The default is 100.
10662
10663 @item max-fsm-thread-length
10664 Maximum number of basic blocks on a finite state automaton jump thread
10665 path. The default is 10.
10666
10667 @item max-fsm-thread-paths
10668 Maximum number of new jump thread paths to create for a finite state
10669 automaton. The default is 50.
10670
10671 @item parloops-chunk-size
10672 Chunk size of omp schedule for loops parallelized by parloops. The default
10673 is 0.
10674
10675 @item parloops-schedule
10676 Schedule type of omp schedule for loops parallelized by parloops (static,
10677 dynamic, guided, auto, runtime). The default is static.
10678
10679 @item max-ssa-name-query-depth
10680 Maximum depth of recursion when querying properties of SSA names in things
10681 like fold routines. One level of recursion corresponds to following a
10682 use-def chain.
10683
10684 @item hsa-gen-debug-stores
10685 Enable emission of special debug stores within HSA kernels which are
10686 then read and reported by libgomp plugin. Generation of these stores
10687 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
10688 enable it.
10689
10690 @item max-speculative-devirt-maydefs
10691 The maximum number of may-defs we analyze when looking for a must-def
10692 specifying the dynamic type of an object that invokes a virtual call
10693 we may be able to devirtualize speculatively.
10694
10695 @item max-vrp-switch-assertions
10696 The maximum number of assertions to add along the default edge of a switch
10697 statement during VRP. The default is 10.
10698 @end table
10699 @end table
10700
10701 @node Instrumentation Options
10702 @section Program Instrumentation Options
10703 @cindex instrumentation options
10704 @cindex program instrumentation options
10705 @cindex run-time error checking options
10706 @cindex profiling options
10707 @cindex options, program instrumentation
10708 @cindex options, run-time error checking
10709 @cindex options, profiling
10710
10711 GCC supports a number of command-line options that control adding
10712 run-time instrumentation to the code it normally generates.
10713 For example, one purpose of instrumentation is collect profiling
10714 statistics for use in finding program hot spots, code coverage
10715 analysis, or profile-guided optimizations.
10716 Another class of program instrumentation is adding run-time checking
10717 to detect programming errors like invalid pointer
10718 dereferences or out-of-bounds array accesses, as well as deliberately
10719 hostile attacks such as stack smashing or C++ vtable hijacking.
10720 There is also a general hook which can be used to implement other
10721 forms of tracing or function-level instrumentation for debug or
10722 program analysis purposes.
10723
10724 @table @gcctabopt
10725 @cindex @command{prof}
10726 @item -p
10727 @opindex p
10728 Generate extra code to write profile information suitable for the
10729 analysis program @command{prof}. You must use this option when compiling
10730 the source files you want data about, and you must also use it when
10731 linking.
10732
10733 @cindex @command{gprof}
10734 @item -pg
10735 @opindex pg
10736 Generate extra code to write profile information suitable for the
10737 analysis program @command{gprof}. You must use this option when compiling
10738 the source files you want data about, and you must also use it when
10739 linking.
10740
10741 @item -fprofile-arcs
10742 @opindex fprofile-arcs
10743 Add code so that program flow @dfn{arcs} are instrumented. During
10744 execution the program records how many times each branch and call is
10745 executed and how many times it is taken or returns. On targets that support
10746 constructors with priority support, profiling properly handles constructors,
10747 destructors and C++ constructors (and destructors) of classes which are used
10748 as a type of a global variable.
10749
10750 When the compiled
10751 program exits it saves this data to a file called
10752 @file{@var{auxname}.gcda} for each source file. The data may be used for
10753 profile-directed optimizations (@option{-fbranch-probabilities}), or for
10754 test coverage analysis (@option{-ftest-coverage}). Each object file's
10755 @var{auxname} is generated from the name of the output file, if
10756 explicitly specified and it is not the final executable, otherwise it is
10757 the basename of the source file. In both cases any suffix is removed
10758 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
10759 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
10760 @xref{Cross-profiling}.
10761
10762 @cindex @command{gcov}
10763 @item --coverage
10764 @opindex coverage
10765
10766 This option is used to compile and link code instrumented for coverage
10767 analysis. The option is a synonym for @option{-fprofile-arcs}
10768 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
10769 linking). See the documentation for those options for more details.
10770
10771 @itemize
10772
10773 @item
10774 Compile the source files with @option{-fprofile-arcs} plus optimization
10775 and code generation options. For test coverage analysis, use the
10776 additional @option{-ftest-coverage} option. You do not need to profile
10777 every source file in a program.
10778
10779 @item
10780 Compile the source files additionally with @option{-fprofile-abs-path}
10781 to create absolute path names in the @file{.gcno} files. This allows
10782 @command{gcov} to find the correct sources in projects where compilations
10783 occur with different working directories.
10784
10785 @item
10786 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
10787 (the latter implies the former).
10788
10789 @item
10790 Run the program on a representative workload to generate the arc profile
10791 information. This may be repeated any number of times. You can run
10792 concurrent instances of your program, and provided that the file system
10793 supports locking, the data files will be correctly updated. Also
10794 @code{fork} calls are detected and correctly handled (double counting
10795 will not happen).
10796
10797 @item
10798 For profile-directed optimizations, compile the source files again with
10799 the same optimization and code generation options plus
10800 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
10801 Control Optimization}).
10802
10803 @item
10804 For test coverage analysis, use @command{gcov} to produce human readable
10805 information from the @file{.gcno} and @file{.gcda} files. Refer to the
10806 @command{gcov} documentation for further information.
10807
10808 @end itemize
10809
10810 With @option{-fprofile-arcs}, for each function of your program GCC
10811 creates a program flow graph, then finds a spanning tree for the graph.
10812 Only arcs that are not on the spanning tree have to be instrumented: the
10813 compiler adds code to count the number of times that these arcs are
10814 executed. When an arc is the only exit or only entrance to a block, the
10815 instrumentation code can be added to the block; otherwise, a new basic
10816 block must be created to hold the instrumentation code.
10817
10818 @need 2000
10819 @item -ftest-coverage
10820 @opindex ftest-coverage
10821 Produce a notes file that the @command{gcov} code-coverage utility
10822 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
10823 show program coverage. Each source file's note file is called
10824 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
10825 above for a description of @var{auxname} and instructions on how to
10826 generate test coverage data. Coverage data matches the source files
10827 more closely if you do not optimize.
10828
10829 @item -fprofile-abs-path
10830 @opindex fprofile-abs-path
10831 Automatically convert relative source file names to absolute path names
10832 in the @file{.gcno} files. This allows @command{gcov} to find the correct
10833 sources in projects where compilations occur with different working
10834 directories.
10835
10836 @item -fprofile-dir=@var{path}
10837 @opindex fprofile-dir
10838
10839 Set the directory to search for the profile data files in to @var{path}.
10840 This option affects only the profile data generated by
10841 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
10842 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
10843 and its related options. Both absolute and relative paths can be used.
10844 By default, GCC uses the current directory as @var{path}, thus the
10845 profile data file appears in the same directory as the object file.
10846
10847 @item -fprofile-generate
10848 @itemx -fprofile-generate=@var{path}
10849 @opindex fprofile-generate
10850
10851 Enable options usually used for instrumenting application to produce
10852 profile useful for later recompilation with profile feedback based
10853 optimization. You must use @option{-fprofile-generate} both when
10854 compiling and when linking your program.
10855
10856 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
10857
10858 If @var{path} is specified, GCC looks at the @var{path} to find
10859 the profile feedback data files. See @option{-fprofile-dir}.
10860
10861 To optimize the program based on the collected profile information, use
10862 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
10863
10864 @item -fprofile-update=@var{method}
10865 @opindex fprofile-update
10866
10867 Alter the update method for an application instrumented for profile
10868 feedback based optimization. The @var{method} argument should be one of
10869 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
10870 The first one is useful for single-threaded applications,
10871 while the second one prevents profile corruption by emitting thread-safe code.
10872
10873 @strong{Warning:} When an application does not properly join all threads
10874 (or creates an detached thread), a profile file can be still corrupted.
10875
10876 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
10877 when supported by a target, or to @samp{single} otherwise. The GCC driver
10878 automatically selects @samp{prefer-atomic} when @option{-pthread}
10879 is present in the command line.
10880
10881 @item -fsanitize=address
10882 @opindex fsanitize=address
10883 Enable AddressSanitizer, a fast memory error detector.
10884 Memory access instructions are instrumented to detect
10885 out-of-bounds and use-after-free bugs.
10886 The option enables @option{-fsanitize-address-use-after-scope}.
10887 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
10888 more details. The run-time behavior can be influenced using the
10889 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
10890 the available options are shown at startup of the instrumented program. See
10891 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
10892 for a list of supported options.
10893 The option cannot be combined with @option{-fsanitize=thread}
10894 and/or @option{-fcheck-pointer-bounds}.
10895
10896 @item -fsanitize=kernel-address
10897 @opindex fsanitize=kernel-address
10898 Enable AddressSanitizer for Linux kernel.
10899 See @uref{https://github.com/google/kasan/wiki} for more details.
10900 The option cannot be combined with @option{-fcheck-pointer-bounds}.
10901
10902 @item -fsanitize=thread
10903 @opindex fsanitize=thread
10904 Enable ThreadSanitizer, a fast data race detector.
10905 Memory access instructions are instrumented to detect
10906 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
10907 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
10908 environment variable; see
10909 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
10910 supported options.
10911 The option cannot be combined with @option{-fsanitize=address},
10912 @option{-fsanitize=leak} and/or @option{-fcheck-pointer-bounds}.
10913
10914 Note that sanitized atomic builtins cannot throw exceptions when
10915 operating on invalid memory addresses with non-call exceptions
10916 (@option{-fnon-call-exceptions}).
10917
10918 @item -fsanitize=leak
10919 @opindex fsanitize=leak
10920 Enable LeakSanitizer, a memory leak detector.
10921 This option only matters for linking of executables and
10922 the executable is linked against a library that overrides @code{malloc}
10923 and other allocator functions. See
10924 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
10925 details. The run-time behavior can be influenced using the
10926 @env{LSAN_OPTIONS} environment variable.
10927 The option cannot be combined with @option{-fsanitize=thread}.
10928
10929 @item -fsanitize=undefined
10930 @opindex fsanitize=undefined
10931 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
10932 Various computations are instrumented to detect undefined behavior
10933 at runtime. Current suboptions are:
10934
10935 @table @gcctabopt
10936
10937 @item -fsanitize=shift
10938 @opindex fsanitize=shift
10939 This option enables checking that the result of a shift operation is
10940 not undefined. Note that what exactly is considered undefined differs
10941 slightly between C and C++, as well as between ISO C90 and C99, etc.
10942 This option has two suboptions, @option{-fsanitize=shift-base} and
10943 @option{-fsanitize=shift-exponent}.
10944
10945 @item -fsanitize=shift-exponent
10946 @opindex fsanitize=shift-exponent
10947 This option enables checking that the second argument of a shift operation
10948 is not negative and is smaller than the precision of the promoted first
10949 argument.
10950
10951 @item -fsanitize=shift-base
10952 @opindex fsanitize=shift-base
10953 If the second argument of a shift operation is within range, check that the
10954 result of a shift operation is not undefined. Note that what exactly is
10955 considered undefined differs slightly between C and C++, as well as between
10956 ISO C90 and C99, etc.
10957
10958 @item -fsanitize=integer-divide-by-zero
10959 @opindex fsanitize=integer-divide-by-zero
10960 Detect integer division by zero as well as @code{INT_MIN / -1} division.
10961
10962 @item -fsanitize=unreachable
10963 @opindex fsanitize=unreachable
10964 With this option, the compiler turns the @code{__builtin_unreachable}
10965 call into a diagnostics message call instead. When reaching the
10966 @code{__builtin_unreachable} call, the behavior is undefined.
10967
10968 @item -fsanitize=vla-bound
10969 @opindex fsanitize=vla-bound
10970 This option instructs the compiler to check that the size of a variable
10971 length array is positive.
10972
10973 @item -fsanitize=null
10974 @opindex fsanitize=null
10975 This option enables pointer checking. Particularly, the application
10976 built with this option turned on will issue an error message when it
10977 tries to dereference a NULL pointer, or if a reference (possibly an
10978 rvalue reference) is bound to a NULL pointer, or if a method is invoked
10979 on an object pointed by a NULL pointer.
10980
10981 @item -fsanitize=return
10982 @opindex fsanitize=return
10983 This option enables return statement checking. Programs
10984 built with this option turned on will issue an error message
10985 when the end of a non-void function is reached without actually
10986 returning a value. This option works in C++ only.
10987
10988 @item -fsanitize=signed-integer-overflow
10989 @opindex fsanitize=signed-integer-overflow
10990 This option enables signed integer overflow checking. We check that
10991 the result of @code{+}, @code{*}, and both unary and binary @code{-}
10992 does not overflow in the signed arithmetics. Note, integer promotion
10993 rules must be taken into account. That is, the following is not an
10994 overflow:
10995 @smallexample
10996 signed char a = SCHAR_MAX;
10997 a++;
10998 @end smallexample
10999
11000 @item -fsanitize=bounds
11001 @opindex fsanitize=bounds
11002 This option enables instrumentation of array bounds. Various out of bounds
11003 accesses are detected. Flexible array members, flexible array member-like
11004 arrays, and initializers of variables with static storage are not instrumented.
11005 The option cannot be combined with @option{-fcheck-pointer-bounds}.
11006
11007 @item -fsanitize=bounds-strict
11008 @opindex fsanitize=bounds-strict
11009 This option enables strict instrumentation of array bounds. Most out of bounds
11010 accesses are detected, including flexible array members and flexible array
11011 member-like arrays. Initializers of variables with static storage are not
11012 instrumented. The option cannot be combined
11013 with @option{-fcheck-pointer-bounds}.
11014
11015 @item -fsanitize=alignment
11016 @opindex fsanitize=alignment
11017
11018 This option enables checking of alignment of pointers when they are
11019 dereferenced, or when a reference is bound to insufficiently aligned target,
11020 or when a method or constructor is invoked on insufficiently aligned object.
11021
11022 @item -fsanitize=object-size
11023 @opindex fsanitize=object-size
11024 This option enables instrumentation of memory references using the
11025 @code{__builtin_object_size} function. Various out of bounds pointer
11026 accesses are detected.
11027
11028 @item -fsanitize=float-divide-by-zero
11029 @opindex fsanitize=float-divide-by-zero
11030 Detect floating-point division by zero. Unlike other similar options,
11031 @option{-fsanitize=float-divide-by-zero} is not enabled by
11032 @option{-fsanitize=undefined}, since floating-point division by zero can
11033 be a legitimate way of obtaining infinities and NaNs.
11034
11035 @item -fsanitize=float-cast-overflow
11036 @opindex fsanitize=float-cast-overflow
11037 This option enables floating-point type to integer conversion checking.
11038 We check that the result of the conversion does not overflow.
11039 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
11040 not enabled by @option{-fsanitize=undefined}.
11041 This option does not work well with @code{FE_INVALID} exceptions enabled.
11042
11043 @item -fsanitize=nonnull-attribute
11044 @opindex fsanitize=nonnull-attribute
11045
11046 This option enables instrumentation of calls, checking whether null values
11047 are not passed to arguments marked as requiring a non-null value by the
11048 @code{nonnull} function attribute.
11049
11050 @item -fsanitize=returns-nonnull-attribute
11051 @opindex fsanitize=returns-nonnull-attribute
11052
11053 This option enables instrumentation of return statements in functions
11054 marked with @code{returns_nonnull} function attribute, to detect returning
11055 of null values from such functions.
11056
11057 @item -fsanitize=bool
11058 @opindex fsanitize=bool
11059
11060 This option enables instrumentation of loads from bool. If a value other
11061 than 0/1 is loaded, a run-time error is issued.
11062
11063 @item -fsanitize=enum
11064 @opindex fsanitize=enum
11065
11066 This option enables instrumentation of loads from an enum type. If
11067 a value outside the range of values for the enum type is loaded,
11068 a run-time error is issued.
11069
11070 @item -fsanitize=vptr
11071 @opindex fsanitize=vptr
11072
11073 This option enables instrumentation of C++ member function calls, member
11074 accesses and some conversions between pointers to base and derived classes,
11075 to verify the referenced object has the correct dynamic type.
11076
11077 @end table
11078
11079 While @option{-ftrapv} causes traps for signed overflows to be emitted,
11080 @option{-fsanitize=undefined} gives a diagnostic message.
11081 This currently works only for the C family of languages.
11082
11083 @item -fno-sanitize=all
11084 @opindex fno-sanitize=all
11085
11086 This option disables all previously enabled sanitizers.
11087 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
11088 together.
11089
11090 @item -fasan-shadow-offset=@var{number}
11091 @opindex fasan-shadow-offset
11092 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
11093 It is useful for experimenting with different shadow memory layouts in
11094 Kernel AddressSanitizer.
11095
11096 @item -fsanitize-sections=@var{s1},@var{s2},...
11097 @opindex fsanitize-sections
11098 Sanitize global variables in selected user-defined sections. @var{si} may
11099 contain wildcards.
11100
11101 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
11102 @opindex fsanitize-recover
11103 @opindex fno-sanitize-recover
11104 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
11105 mentioned in comma-separated list of @var{opts}. Enabling this option
11106 for a sanitizer component causes it to attempt to continue
11107 running the program as if no error happened. This means multiple
11108 runtime errors can be reported in a single program run, and the exit
11109 code of the program may indicate success even when errors
11110 have been reported. The @option{-fno-sanitize-recover=} option
11111 can be used to alter
11112 this behavior: only the first detected error is reported
11113 and program then exits with a non-zero exit code.
11114
11115 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
11116 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
11117 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
11118 @option{-fsanitize=bounds-strict},
11119 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
11120 For these sanitizers error recovery is turned on by default,
11121 except @option{-fsanitize=address}, for which this feature is experimental.
11122 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
11123 accepted, the former enables recovery for all sanitizers that support it,
11124 the latter disables recovery for all sanitizers that support it.
11125
11126 Even if a recovery mode is turned on the compiler side, it needs to be also
11127 enabled on the runtime library side, otherwise the failures are still fatal.
11128 The runtime library defaults to @code{halt_on_error=0} for
11129 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
11130 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
11131 setting the @code{halt_on_error} flag in the corresponding environment variable.
11132
11133 Syntax without an explicit @var{opts} parameter is deprecated. It is
11134 equivalent to specifying an @var{opts} list of:
11135
11136 @smallexample
11137 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11138 @end smallexample
11139
11140 @item -fsanitize-address-use-after-scope
11141 @opindex fsanitize-address-use-after-scope
11142 Enable sanitization of local variables to detect use-after-scope bugs.
11143 The option sets @option{-fstack-reuse} to @samp{none}.
11144
11145 @item -fsanitize-undefined-trap-on-error
11146 @opindex fsanitize-undefined-trap-on-error
11147 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
11148 report undefined behavior using @code{__builtin_trap} rather than
11149 a @code{libubsan} library routine. The advantage of this is that the
11150 @code{libubsan} library is not needed and is not linked in, so this
11151 is usable even in freestanding environments.
11152
11153 @item -fsanitize-coverage=trace-pc
11154 @opindex fsanitize-coverage=trace-pc
11155 Enable coverage-guided fuzzing code instrumentation.
11156 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
11157
11158 @item -fbounds-check
11159 @opindex fbounds-check
11160 For front ends that support it, generate additional code to check that
11161 indices used to access arrays are within the declared range. This is
11162 currently only supported by the Fortran front end, where this option
11163 defaults to false.
11164
11165 @item -fcheck-pointer-bounds
11166 @opindex fcheck-pointer-bounds
11167 @opindex fno-check-pointer-bounds
11168 @cindex Pointer Bounds Checker options
11169 Enable Pointer Bounds Checker instrumentation. Each memory reference
11170 is instrumented with checks of the pointer used for memory access against
11171 bounds associated with that pointer.
11172
11173 Currently there
11174 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
11175 and @option{-mmpx} are required to enable this feature.
11176 MPX-based instrumentation requires
11177 a runtime library to enable MPX in hardware and handle bounds
11178 violation signals. By default when @option{-fcheck-pointer-bounds}
11179 and @option{-mmpx} options are used to link a program, the GCC driver
11180 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
11181 Bounds checking on calls to dynamic libraries requires a linker
11182 with @option{-z bndplt} support; if GCC was configured with a linker
11183 without support for this option (including the Gold linker and older
11184 versions of ld), a warning is given if you link with @option{-mmpx}
11185 without also specifying @option{-static}, since the overall effectiveness
11186 of the bounds checking protection is reduced.
11187 See also @option{-static-libmpxwrappers}.
11188
11189 MPX-based instrumentation
11190 may be used for debugging and also may be included in production code
11191 to increase program security. Depending on usage, you may
11192 have different requirements for the runtime library. The current version
11193 of the MPX runtime library is more oriented for use as a debugging
11194 tool. MPX runtime library usage implies @option{-lpthread}. See
11195 also @option{-static-libmpx}. The runtime library behavior can be
11196 influenced using various @env{CHKP_RT_*} environment variables. See
11197 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
11198 for more details.
11199
11200 Generated instrumentation may be controlled by various
11201 @option{-fchkp-*} options and by the @code{bnd_variable_size}
11202 structure field attribute (@pxref{Type Attributes}) and
11203 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
11204 (@pxref{Function Attributes}). GCC also provides a number of built-in
11205 functions for controlling the Pointer Bounds Checker. @xref{Pointer
11206 Bounds Checker builtins}, for more information.
11207
11208 @item -fchkp-check-incomplete-type
11209 @opindex fchkp-check-incomplete-type
11210 @opindex fno-chkp-check-incomplete-type
11211 Generate pointer bounds checks for variables with incomplete type.
11212 Enabled by default.
11213
11214 @item -fchkp-narrow-bounds
11215 @opindex fchkp-narrow-bounds
11216 @opindex fno-chkp-narrow-bounds
11217 Controls bounds used by Pointer Bounds Checker for pointers to object
11218 fields. If narrowing is enabled then field bounds are used. Otherwise
11219 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
11220 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
11221
11222 @item -fchkp-first-field-has-own-bounds
11223 @opindex fchkp-first-field-has-own-bounds
11224 @opindex fno-chkp-first-field-has-own-bounds
11225 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
11226 first field in the structure. By default a pointer to the first field has
11227 the same bounds as a pointer to the whole structure.
11228
11229 @item -fchkp-flexible-struct-trailing-arrays
11230 @opindex fchkp-flexible-struct-trailing-arrays
11231 @opindex fno-chkp-flexible-struct-trailing-arrays
11232 Forces Pointer Bounds Checker to treat all trailing arrays in structures as
11233 possibly flexible. By default only array fields with zero length or that are
11234 marked with attribute bnd_variable_size are treated as flexible.
11235
11236 @item -fchkp-narrow-to-innermost-array
11237 @opindex fchkp-narrow-to-innermost-array
11238 @opindex fno-chkp-narrow-to-innermost-array
11239 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
11240 case of nested static array access. By default this option is disabled and
11241 bounds of the outermost array are used.
11242
11243 @item -fchkp-optimize
11244 @opindex fchkp-optimize
11245 @opindex fno-chkp-optimize
11246 Enables Pointer Bounds Checker optimizations. Enabled by default at
11247 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
11248
11249 @item -fchkp-use-fast-string-functions
11250 @opindex fchkp-use-fast-string-functions
11251 @opindex fno-chkp-use-fast-string-functions
11252 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
11253 by Pointer Bounds Checker. Disabled by default.
11254
11255 @item -fchkp-use-nochk-string-functions
11256 @opindex fchkp-use-nochk-string-functions
11257 @opindex fno-chkp-use-nochk-string-functions
11258 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
11259 by Pointer Bounds Checker. Disabled by default.
11260
11261 @item -fchkp-use-static-bounds
11262 @opindex fchkp-use-static-bounds
11263 @opindex fno-chkp-use-static-bounds
11264 Allow Pointer Bounds Checker to generate static bounds holding
11265 bounds of static variables. Enabled by default.
11266
11267 @item -fchkp-use-static-const-bounds
11268 @opindex fchkp-use-static-const-bounds
11269 @opindex fno-chkp-use-static-const-bounds
11270 Use statically-initialized bounds for constant bounds instead of
11271 generating them each time they are required. By default enabled when
11272 @option{-fchkp-use-static-bounds} is enabled.
11273
11274 @item -fchkp-treat-zero-dynamic-size-as-infinite
11275 @opindex fchkp-treat-zero-dynamic-size-as-infinite
11276 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
11277 With this option, objects with incomplete type whose
11278 dynamically-obtained size is zero are treated as having infinite size
11279 instead by Pointer Bounds
11280 Checker. This option may be helpful if a program is linked with a library
11281 missing size information for some symbols. Disabled by default.
11282
11283 @item -fchkp-check-read
11284 @opindex fchkp-check-read
11285 @opindex fno-chkp-check-read
11286 Instructs Pointer Bounds Checker to generate checks for all read
11287 accesses to memory. Enabled by default.
11288
11289 @item -fchkp-check-write
11290 @opindex fchkp-check-write
11291 @opindex fno-chkp-check-write
11292 Instructs Pointer Bounds Checker to generate checks for all write
11293 accesses to memory. Enabled by default.
11294
11295 @item -fchkp-store-bounds
11296 @opindex fchkp-store-bounds
11297 @opindex fno-chkp-store-bounds
11298 Instructs Pointer Bounds Checker to generate bounds stores for
11299 pointer writes. Enabled by default.
11300
11301 @item -fchkp-instrument-calls
11302 @opindex fchkp-instrument-calls
11303 @opindex fno-chkp-instrument-calls
11304 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
11305 Enabled by default.
11306
11307 @item -fchkp-instrument-marked-only
11308 @opindex fchkp-instrument-marked-only
11309 @opindex fno-chkp-instrument-marked-only
11310 Instructs Pointer Bounds Checker to instrument only functions
11311 marked with the @code{bnd_instrument} attribute
11312 (@pxref{Function Attributes}). Disabled by default.
11313
11314 @item -fchkp-use-wrappers
11315 @opindex fchkp-use-wrappers
11316 @opindex fno-chkp-use-wrappers
11317 Allows Pointer Bounds Checker to replace calls to built-in functions
11318 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
11319 is used to link a program, the GCC driver automatically links
11320 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
11321 Enabled by default.
11322
11323 @item -fstack-protector
11324 @opindex fstack-protector
11325 Emit extra code to check for buffer overflows, such as stack smashing
11326 attacks. This is done by adding a guard variable to functions with
11327 vulnerable objects. This includes functions that call @code{alloca}, and
11328 functions with buffers larger than 8 bytes. The guards are initialized
11329 when a function is entered and then checked when the function exits.
11330 If a guard check fails, an error message is printed and the program exits.
11331
11332 @item -fstack-protector-all
11333 @opindex fstack-protector-all
11334 Like @option{-fstack-protector} except that all functions are protected.
11335
11336 @item -fstack-protector-strong
11337 @opindex fstack-protector-strong
11338 Like @option{-fstack-protector} but includes additional functions to
11339 be protected --- those that have local array definitions, or have
11340 references to local frame addresses.
11341
11342 @item -fstack-protector-explicit
11343 @opindex fstack-protector-explicit
11344 Like @option{-fstack-protector} but only protects those functions which
11345 have the @code{stack_protect} attribute.
11346
11347 @item -fstack-check
11348 @opindex fstack-check
11349 Generate code to verify that you do not go beyond the boundary of the
11350 stack. You should specify this flag if you are running in an
11351 environment with multiple threads, but you only rarely need to specify it in
11352 a single-threaded environment since stack overflow is automatically
11353 detected on nearly all systems if there is only one stack.
11354
11355 Note that this switch does not actually cause checking to be done; the
11356 operating system or the language runtime must do that. The switch causes
11357 generation of code to ensure that they see the stack being extended.
11358
11359 You can additionally specify a string parameter: @samp{no} means no
11360 checking, @samp{generic} means force the use of old-style checking,
11361 @samp{specific} means use the best checking method and is equivalent
11362 to bare @option{-fstack-check}.
11363
11364 Old-style checking is a generic mechanism that requires no specific
11365 target support in the compiler but comes with the following drawbacks:
11366
11367 @enumerate
11368 @item
11369 Modified allocation strategy for large objects: they are always
11370 allocated dynamically if their size exceeds a fixed threshold.
11371
11372 @item
11373 Fixed limit on the size of the static frame of functions: when it is
11374 topped by a particular function, stack checking is not reliable and
11375 a warning is issued by the compiler.
11376
11377 @item
11378 Inefficiency: because of both the modified allocation strategy and the
11379 generic implementation, code performance is hampered.
11380 @end enumerate
11381
11382 Note that old-style stack checking is also the fallback method for
11383 @samp{specific} if no target support has been added in the compiler.
11384
11385 @item -fstack-limit-register=@var{reg}
11386 @itemx -fstack-limit-symbol=@var{sym}
11387 @itemx -fno-stack-limit
11388 @opindex fstack-limit-register
11389 @opindex fstack-limit-symbol
11390 @opindex fno-stack-limit
11391 Generate code to ensure that the stack does not grow beyond a certain value,
11392 either the value of a register or the address of a symbol. If a larger
11393 stack is required, a signal is raised at run time. For most targets,
11394 the signal is raised before the stack overruns the boundary, so
11395 it is possible to catch the signal without taking special precautions.
11396
11397 For instance, if the stack starts at absolute address @samp{0x80000000}
11398 and grows downwards, you can use the flags
11399 @option{-fstack-limit-symbol=__stack_limit} and
11400 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11401 of 128KB@. Note that this may only work with the GNU linker.
11402
11403 You can locally override stack limit checking by using the
11404 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11405
11406 @item -fsplit-stack
11407 @opindex fsplit-stack
11408 Generate code to automatically split the stack before it overflows.
11409 The resulting program has a discontiguous stack which can only
11410 overflow if the program is unable to allocate any more memory. This
11411 is most useful when running threaded programs, as it is no longer
11412 necessary to calculate a good stack size to use for each thread. This
11413 is currently only implemented for the x86 targets running
11414 GNU/Linux.
11415
11416 When code compiled with @option{-fsplit-stack} calls code compiled
11417 without @option{-fsplit-stack}, there may not be much stack space
11418 available for the latter code to run. If compiling all code,
11419 including library code, with @option{-fsplit-stack} is not an option,
11420 then the linker can fix up these calls so that the code compiled
11421 without @option{-fsplit-stack} always has a large stack. Support for
11422 this is implemented in the gold linker in GNU binutils release 2.21
11423 and later.
11424
11425 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
11426 @opindex fvtable-verify
11427 This option is only available when compiling C++ code.
11428 It turns on (or off, if using @option{-fvtable-verify=none}) the security
11429 feature that verifies at run time, for every virtual call, that
11430 the vtable pointer through which the call is made is valid for the type of
11431 the object, and has not been corrupted or overwritten. If an invalid vtable
11432 pointer is detected at run time, an error is reported and execution of the
11433 program is immediately halted.
11434
11435 This option causes run-time data structures to be built at program startup,
11436 which are used for verifying the vtable pointers.
11437 The options @samp{std} and @samp{preinit}
11438 control the timing of when these data structures are built. In both cases the
11439 data structures are built before execution reaches @code{main}. Using
11440 @option{-fvtable-verify=std} causes the data structures to be built after
11441 shared libraries have been loaded and initialized.
11442 @option{-fvtable-verify=preinit} causes them to be built before shared
11443 libraries have been loaded and initialized.
11444
11445 If this option appears multiple times in the command line with different
11446 values specified, @samp{none} takes highest priority over both @samp{std} and
11447 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
11448
11449 @item -fvtv-debug
11450 @opindex fvtv-debug
11451 When used in conjunction with @option{-fvtable-verify=std} or
11452 @option{-fvtable-verify=preinit}, causes debug versions of the
11453 runtime functions for the vtable verification feature to be called.
11454 This flag also causes the compiler to log information about which
11455 vtable pointers it finds for each class.
11456 This information is written to a file named @file{vtv_set_ptr_data.log}
11457 in the directory named by the environment variable @env{VTV_LOGS_DIR}
11458 if that is defined or the current working directory otherwise.
11459
11460 Note: This feature @emph{appends} data to the log file. If you want a fresh log
11461 file, be sure to delete any existing one.
11462
11463 @item -fvtv-counts
11464 @opindex fvtv-counts
11465 This is a debugging flag. When used in conjunction with
11466 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
11467 causes the compiler to keep track of the total number of virtual calls
11468 it encounters and the number of verifications it inserts. It also
11469 counts the number of calls to certain run-time library functions
11470 that it inserts and logs this information for each compilation unit.
11471 The compiler writes this information to a file named
11472 @file{vtv_count_data.log} in the directory named by the environment
11473 variable @env{VTV_LOGS_DIR} if that is defined or the current working
11474 directory otherwise. It also counts the size of the vtable pointer sets
11475 for each class, and writes this information to @file{vtv_class_set_sizes.log}
11476 in the same directory.
11477
11478 Note: This feature @emph{appends} data to the log files. To get fresh log
11479 files, be sure to delete any existing ones.
11480
11481 @item -finstrument-functions
11482 @opindex finstrument-functions
11483 Generate instrumentation calls for entry and exit to functions. Just
11484 after function entry and just before function exit, the following
11485 profiling functions are called with the address of the current
11486 function and its call site. (On some platforms,
11487 @code{__builtin_return_address} does not work beyond the current
11488 function, so the call site information may not be available to the
11489 profiling functions otherwise.)
11490
11491 @smallexample
11492 void __cyg_profile_func_enter (void *this_fn,
11493 void *call_site);
11494 void __cyg_profile_func_exit (void *this_fn,
11495 void *call_site);
11496 @end smallexample
11497
11498 The first argument is the address of the start of the current function,
11499 which may be looked up exactly in the symbol table.
11500
11501 This instrumentation is also done for functions expanded inline in other
11502 functions. The profiling calls indicate where, conceptually, the
11503 inline function is entered and exited. This means that addressable
11504 versions of such functions must be available. If all your uses of a
11505 function are expanded inline, this may mean an additional expansion of
11506 code size. If you use @code{extern inline} in your C code, an
11507 addressable version of such functions must be provided. (This is
11508 normally the case anyway, but if you get lucky and the optimizer always
11509 expands the functions inline, you might have gotten away without
11510 providing static copies.)
11511
11512 A function may be given the attribute @code{no_instrument_function}, in
11513 which case this instrumentation is not done. This can be used, for
11514 example, for the profiling functions listed above, high-priority
11515 interrupt routines, and any functions from which the profiling functions
11516 cannot safely be called (perhaps signal handlers, if the profiling
11517 routines generate output or allocate memory).
11518
11519 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
11520 @opindex finstrument-functions-exclude-file-list
11521
11522 Set the list of functions that are excluded from instrumentation (see
11523 the description of @option{-finstrument-functions}). If the file that
11524 contains a function definition matches with one of @var{file}, then
11525 that function is not instrumented. The match is done on substrings:
11526 if the @var{file} parameter is a substring of the file name, it is
11527 considered to be a match.
11528
11529 For example:
11530
11531 @smallexample
11532 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
11533 @end smallexample
11534
11535 @noindent
11536 excludes any inline function defined in files whose pathnames
11537 contain @file{/bits/stl} or @file{include/sys}.
11538
11539 If, for some reason, you want to include letter @samp{,} in one of
11540 @var{sym}, write @samp{\,}. For example,
11541 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
11542 (note the single quote surrounding the option).
11543
11544 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
11545 @opindex finstrument-functions-exclude-function-list
11546
11547 This is similar to @option{-finstrument-functions-exclude-file-list},
11548 but this option sets the list of function names to be excluded from
11549 instrumentation. The function name to be matched is its user-visible
11550 name, such as @code{vector<int> blah(const vector<int> &)}, not the
11551 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
11552 match is done on substrings: if the @var{sym} parameter is a substring
11553 of the function name, it is considered to be a match. For C99 and C++
11554 extended identifiers, the function name must be given in UTF-8, not
11555 using universal character names.
11556
11557 @item -fpatchable-function-entry=@var{N}[,@var{M}]
11558 @opindex fpatchable-function-entry
11559 Generate @var{N} NOPs right at the beginning
11560 of each function, with the function entry point before the @var{M}th NOP.
11561 If @var{M} is omitted, it defaults to @code{0} so the
11562 function entry points to the address just at the first NOP.
11563 The NOP instructions reserve extra space which can be used to patch in
11564 any desired instrumentation at run time, provided that the code segment
11565 is writable. The amount of space is controllable indirectly via
11566 the number of NOPs; the NOP instruction used corresponds to the instruction
11567 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
11568 is target-specific and may also depend on the architecture variant and/or
11569 other compilation options.
11570
11571 For run-time identification, the starting addresses of these areas,
11572 which correspond to their respective function entries minus @var{M},
11573 are additionally collected in the @code{__patchable_function_entries}
11574 section of the resulting binary.
11575
11576 Note that the value of @code{__attribute__ ((patchable_function_entry
11577 (N,M)))} takes precedence over command-line option
11578 @option{-fpatchable-function-entry=N,M}. This can be used to increase
11579 the area size or to remove it completely on a single function.
11580 If @code{N=0}, no pad location is recorded.
11581
11582 The NOP instructions are inserted at---and maybe before, depending on
11583 @var{M}---the function entry address, even before the prologue.
11584
11585 @end table
11586
11587
11588 @node Preprocessor Options
11589 @section Options Controlling the Preprocessor
11590 @cindex preprocessor options
11591 @cindex options, preprocessor
11592
11593 These options control the C preprocessor, which is run on each C source
11594 file before actual compilation.
11595
11596 If you use the @option{-E} option, nothing is done except preprocessing.
11597 Some of these options make sense only together with @option{-E} because
11598 they cause the preprocessor output to be unsuitable for actual
11599 compilation.
11600
11601 In addition to the options listed here, there are a number of options
11602 to control search paths for include files documented in
11603 @ref{Directory Options}.
11604 Options to control preprocessor diagnostics are listed in
11605 @ref{Warning Options}.
11606
11607 @table @gcctabopt
11608 @include cppopts.texi
11609
11610 @item -Wp,@var{option}
11611 @opindex Wp
11612 You can use @option{-Wp,@var{option}} to bypass the compiler driver
11613 and pass @var{option} directly through to the preprocessor. If
11614 @var{option} contains commas, it is split into multiple options at the
11615 commas. However, many options are modified, translated or interpreted
11616 by the compiler driver before being passed to the preprocessor, and
11617 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
11618 interface is undocumented and subject to change, so whenever possible
11619 you should avoid using @option{-Wp} and let the driver handle the
11620 options instead.
11621
11622 @item -Xpreprocessor @var{option}
11623 @opindex Xpreprocessor
11624 Pass @var{option} as an option to the preprocessor. You can use this to
11625 supply system-specific preprocessor options that GCC does not
11626 recognize.
11627
11628 If you want to pass an option that takes an argument, you must use
11629 @option{-Xpreprocessor} twice, once for the option and once for the argument.
11630
11631 @item -no-integrated-cpp
11632 @opindex no-integrated-cpp
11633 Perform preprocessing as a separate pass before compilation.
11634 By default, GCC performs preprocessing as an integrated part of
11635 input tokenization and parsing.
11636 If this option is provided, the appropriate language front end
11637 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
11638 and Objective-C, respectively) is instead invoked twice,
11639 once for preprocessing only and once for actual compilation
11640 of the preprocessed input.
11641 This option may be useful in conjunction with the @option{-B} or
11642 @option{-wrapper} options to specify an alternate preprocessor or
11643 perform additional processing of the program source between
11644 normal preprocessing and compilation.
11645
11646 @end table
11647
11648 @node Assembler Options
11649 @section Passing Options to the Assembler
11650
11651 @c prevent bad page break with this line
11652 You can pass options to the assembler.
11653
11654 @table @gcctabopt
11655 @item -Wa,@var{option}
11656 @opindex Wa
11657 Pass @var{option} as an option to the assembler. If @var{option}
11658 contains commas, it is split into multiple options at the commas.
11659
11660 @item -Xassembler @var{option}
11661 @opindex Xassembler
11662 Pass @var{option} as an option to the assembler. You can use this to
11663 supply system-specific assembler options that GCC does not
11664 recognize.
11665
11666 If you want to pass an option that takes an argument, you must use
11667 @option{-Xassembler} twice, once for the option and once for the argument.
11668
11669 @end table
11670
11671 @node Link Options
11672 @section Options for Linking
11673 @cindex link options
11674 @cindex options, linking
11675
11676 These options come into play when the compiler links object files into
11677 an executable output file. They are meaningless if the compiler is
11678 not doing a link step.
11679
11680 @table @gcctabopt
11681 @cindex file names
11682 @item @var{object-file-name}
11683 A file name that does not end in a special recognized suffix is
11684 considered to name an object file or library. (Object files are
11685 distinguished from libraries by the linker according to the file
11686 contents.) If linking is done, these object files are used as input
11687 to the linker.
11688
11689 @item -c
11690 @itemx -S
11691 @itemx -E
11692 @opindex c
11693 @opindex S
11694 @opindex E
11695 If any of these options is used, then the linker is not run, and
11696 object file names should not be used as arguments. @xref{Overall
11697 Options}.
11698
11699 @item -fuse-ld=bfd
11700 @opindex fuse-ld=bfd
11701 Use the @command{bfd} linker instead of the default linker.
11702
11703 @item -fuse-ld=gold
11704 @opindex fuse-ld=gold
11705 Use the @command{gold} linker instead of the default linker.
11706
11707 @cindex Libraries
11708 @item -l@var{library}
11709 @itemx -l @var{library}
11710 @opindex l
11711 Search the library named @var{library} when linking. (The second
11712 alternative with the library as a separate argument is only for
11713 POSIX compliance and is not recommended.)
11714
11715 It makes a difference where in the command you write this option; the
11716 linker searches and processes libraries and object files in the order they
11717 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
11718 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
11719 to functions in @samp{z}, those functions may not be loaded.
11720
11721 The linker searches a standard list of directories for the library,
11722 which is actually a file named @file{lib@var{library}.a}. The linker
11723 then uses this file as if it had been specified precisely by name.
11724
11725 The directories searched include several standard system directories
11726 plus any that you specify with @option{-L}.
11727
11728 Normally the files found this way are library files---archive files
11729 whose members are object files. The linker handles an archive file by
11730 scanning through it for members which define symbols that have so far
11731 been referenced but not defined. But if the file that is found is an
11732 ordinary object file, it is linked in the usual fashion. The only
11733 difference between using an @option{-l} option and specifying a file name
11734 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
11735 and searches several directories.
11736
11737 @item -lobjc
11738 @opindex lobjc
11739 You need this special case of the @option{-l} option in order to
11740 link an Objective-C or Objective-C++ program.
11741
11742 @item -nostartfiles
11743 @opindex nostartfiles
11744 Do not use the standard system startup files when linking.
11745 The standard system libraries are used normally, unless @option{-nostdlib}
11746 or @option{-nodefaultlibs} is used.
11747
11748 @item -nodefaultlibs
11749 @opindex nodefaultlibs
11750 Do not use the standard system libraries when linking.
11751 Only the libraries you specify are passed to the linker, and options
11752 specifying linkage of the system libraries, such as @option{-static-libgcc}
11753 or @option{-shared-libgcc}, are ignored.
11754 The standard startup files are used normally, unless @option{-nostartfiles}
11755 is used.
11756
11757 The compiler may generate calls to @code{memcmp},
11758 @code{memset}, @code{memcpy} and @code{memmove}.
11759 These entries are usually resolved by entries in
11760 libc. These entry points should be supplied through some other
11761 mechanism when this option is specified.
11762
11763 @item -nostdlib
11764 @opindex nostdlib
11765 Do not use the standard system startup files or libraries when linking.
11766 No startup files and only the libraries you specify are passed to
11767 the linker, and options specifying linkage of the system libraries, such as
11768 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
11769
11770 The compiler may generate calls to @code{memcmp}, @code{memset},
11771 @code{memcpy} and @code{memmove}.
11772 These entries are usually resolved by entries in
11773 libc. These entry points should be supplied through some other
11774 mechanism when this option is specified.
11775
11776 @cindex @option{-lgcc}, use with @option{-nostdlib}
11777 @cindex @option{-nostdlib} and unresolved references
11778 @cindex unresolved references and @option{-nostdlib}
11779 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
11780 @cindex @option{-nodefaultlibs} and unresolved references
11781 @cindex unresolved references and @option{-nodefaultlibs}
11782 One of the standard libraries bypassed by @option{-nostdlib} and
11783 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
11784 which GCC uses to overcome shortcomings of particular machines, or special
11785 needs for some languages.
11786 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
11787 Collection (GCC) Internals},
11788 for more discussion of @file{libgcc.a}.)
11789 In most cases, you need @file{libgcc.a} even when you want to avoid
11790 other standard libraries. In other words, when you specify @option{-nostdlib}
11791 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
11792 This ensures that you have no unresolved references to internal GCC
11793 library subroutines.
11794 (An example of such an internal subroutine is @code{__main}, used to ensure C++
11795 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
11796 GNU Compiler Collection (GCC) Internals}.)
11797
11798 @item -pie
11799 @opindex pie
11800 Produce a position independent executable on targets that support it.
11801 For predictable results, you must also specify the same set of options
11802 used for compilation (@option{-fpie}, @option{-fPIE},
11803 or model suboptions) when you specify this linker option.
11804
11805 @item -no-pie
11806 @opindex no-pie
11807 Don't produce a position independent executable.
11808
11809 @item -pthread
11810 @opindex pthread
11811 Link with the POSIX threads library. This option is supported on
11812 GNU/Linux targets, most other Unix derivatives, and also on
11813 x86 Cygwin and MinGW targets. On some targets this option also sets
11814 flags for the preprocessor, so it should be used consistently for both
11815 compilation and linking.
11816
11817 @item -rdynamic
11818 @opindex rdynamic
11819 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
11820 that support it. This instructs the linker to add all symbols, not
11821 only used ones, to the dynamic symbol table. This option is needed
11822 for some uses of @code{dlopen} or to allow obtaining backtraces
11823 from within a program.
11824
11825 @item -s
11826 @opindex s
11827 Remove all symbol table and relocation information from the executable.
11828
11829 @item -static
11830 @opindex static
11831 On systems that support dynamic linking, this prevents linking with the shared
11832 libraries. On other systems, this option has no effect.
11833
11834 @item -shared
11835 @opindex shared
11836 Produce a shared object which can then be linked with other objects to
11837 form an executable. Not all systems support this option. For predictable
11838 results, you must also specify the same set of options used for compilation
11839 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
11840 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
11841 needs to build supplementary stub code for constructors to work. On
11842 multi-libbed systems, @samp{gcc -shared} must select the correct support
11843 libraries to link against. Failing to supply the correct flags may lead
11844 to subtle defects. Supplying them in cases where they are not necessary
11845 is innocuous.}
11846
11847 @item -shared-libgcc
11848 @itemx -static-libgcc
11849 @opindex shared-libgcc
11850 @opindex static-libgcc
11851 On systems that provide @file{libgcc} as a shared library, these options
11852 force the use of either the shared or static version, respectively.
11853 If no shared version of @file{libgcc} was built when the compiler was
11854 configured, these options have no effect.
11855
11856 There are several situations in which an application should use the
11857 shared @file{libgcc} instead of the static version. The most common
11858 of these is when the application wishes to throw and catch exceptions
11859 across different shared libraries. In that case, each of the libraries
11860 as well as the application itself should use the shared @file{libgcc}.
11861
11862 Therefore, the G++ and driver automatically adds @option{-shared-libgcc}
11863 whenever you build a shared library or a main executable, because C++
11864 programs typically use exceptions, so this is the right thing to do.
11865
11866 If, instead, you use the GCC driver to create shared libraries, you may
11867 find that they are not always linked with the shared @file{libgcc}.
11868 If GCC finds, at its configuration time, that you have a non-GNU linker
11869 or a GNU linker that does not support option @option{--eh-frame-hdr},
11870 it links the shared version of @file{libgcc} into shared libraries
11871 by default. Otherwise, it takes advantage of the linker and optimizes
11872 away the linking with the shared version of @file{libgcc}, linking with
11873 the static version of libgcc by default. This allows exceptions to
11874 propagate through such shared libraries, without incurring relocation
11875 costs at library load time.
11876
11877 However, if a library or main executable is supposed to throw or catch
11878 exceptions, you must link it using the G++ driver, as appropriate
11879 for the languages used in the program, or using the option
11880 @option{-shared-libgcc}, such that it is linked with the shared
11881 @file{libgcc}.
11882
11883 @item -static-libasan
11884 @opindex static-libasan
11885 When the @option{-fsanitize=address} option is used to link a program,
11886 the GCC driver automatically links against @option{libasan}. If
11887 @file{libasan} is available as a shared library, and the @option{-static}
11888 option is not used, then this links against the shared version of
11889 @file{libasan}. The @option{-static-libasan} option directs the GCC
11890 driver to link @file{libasan} statically, without necessarily linking
11891 other libraries statically.
11892
11893 @item -static-libtsan
11894 @opindex static-libtsan
11895 When the @option{-fsanitize=thread} option is used to link a program,
11896 the GCC driver automatically links against @option{libtsan}. If
11897 @file{libtsan} is available as a shared library, and the @option{-static}
11898 option is not used, then this links against the shared version of
11899 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
11900 driver to link @file{libtsan} statically, without necessarily linking
11901 other libraries statically.
11902
11903 @item -static-liblsan
11904 @opindex static-liblsan
11905 When the @option{-fsanitize=leak} option is used to link a program,
11906 the GCC driver automatically links against @option{liblsan}. If
11907 @file{liblsan} is available as a shared library, and the @option{-static}
11908 option is not used, then this links against the shared version of
11909 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
11910 driver to link @file{liblsan} statically, without necessarily linking
11911 other libraries statically.
11912
11913 @item -static-libubsan
11914 @opindex static-libubsan
11915 When the @option{-fsanitize=undefined} option is used to link a program,
11916 the GCC driver automatically links against @option{libubsan}. If
11917 @file{libubsan} is available as a shared library, and the @option{-static}
11918 option is not used, then this links against the shared version of
11919 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
11920 driver to link @file{libubsan} statically, without necessarily linking
11921 other libraries statically.
11922
11923 @item -static-libmpx
11924 @opindex static-libmpx
11925 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
11926 used to link a program, the GCC driver automatically links against
11927 @file{libmpx}. If @file{libmpx} is available as a shared library,
11928 and the @option{-static} option is not used, then this links against
11929 the shared version of @file{libmpx}. The @option{-static-libmpx}
11930 option directs the GCC driver to link @file{libmpx} statically,
11931 without necessarily linking other libraries statically.
11932
11933 @item -static-libmpxwrappers
11934 @opindex static-libmpxwrappers
11935 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
11936 to link a program without also using @option{-fno-chkp-use-wrappers}, the
11937 GCC driver automatically links against @file{libmpxwrappers}. If
11938 @file{libmpxwrappers} is available as a shared library, and the
11939 @option{-static} option is not used, then this links against the shared
11940 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
11941 option directs the GCC driver to link @file{libmpxwrappers} statically,
11942 without necessarily linking other libraries statically.
11943
11944 @item -static-libstdc++
11945 @opindex static-libstdc++
11946 When the @command{g++} program is used to link a C++ program, it
11947 normally automatically links against @option{libstdc++}. If
11948 @file{libstdc++} is available as a shared library, and the
11949 @option{-static} option is not used, then this links against the
11950 shared version of @file{libstdc++}. That is normally fine. However, it
11951 is sometimes useful to freeze the version of @file{libstdc++} used by
11952 the program without going all the way to a fully static link. The
11953 @option{-static-libstdc++} option directs the @command{g++} driver to
11954 link @file{libstdc++} statically, without necessarily linking other
11955 libraries statically.
11956
11957 @item -symbolic
11958 @opindex symbolic
11959 Bind references to global symbols when building a shared object. Warn
11960 about any unresolved references (unless overridden by the link editor
11961 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
11962 this option.
11963
11964 @item -T @var{script}
11965 @opindex T
11966 @cindex linker script
11967 Use @var{script} as the linker script. This option is supported by most
11968 systems using the GNU linker. On some targets, such as bare-board
11969 targets without an operating system, the @option{-T} option may be required
11970 when linking to avoid references to undefined symbols.
11971
11972 @item -Xlinker @var{option}
11973 @opindex Xlinker
11974 Pass @var{option} as an option to the linker. You can use this to
11975 supply system-specific linker options that GCC does not recognize.
11976
11977 If you want to pass an option that takes a separate argument, you must use
11978 @option{-Xlinker} twice, once for the option and once for the argument.
11979 For example, to pass @option{-assert definitions}, you must write
11980 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
11981 @option{-Xlinker "-assert definitions"}, because this passes the entire
11982 string as a single argument, which is not what the linker expects.
11983
11984 When using the GNU linker, it is usually more convenient to pass
11985 arguments to linker options using the @option{@var{option}=@var{value}}
11986 syntax than as separate arguments. For example, you can specify
11987 @option{-Xlinker -Map=output.map} rather than
11988 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
11989 this syntax for command-line options.
11990
11991 @item -Wl,@var{option}
11992 @opindex Wl
11993 Pass @var{option} as an option to the linker. If @var{option} contains
11994 commas, it is split into multiple options at the commas. You can use this
11995 syntax to pass an argument to the option.
11996 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
11997 linker. When using the GNU linker, you can also get the same effect with
11998 @option{-Wl,-Map=output.map}.
11999
12000 @item -u @var{symbol}
12001 @opindex u
12002 Pretend the symbol @var{symbol} is undefined, to force linking of
12003 library modules to define it. You can use @option{-u} multiple times with
12004 different symbols to force loading of additional library modules.
12005
12006 @item -z @var{keyword}
12007 @opindex z
12008 @option{-z} is passed directly on to the linker along with the keyword
12009 @var{keyword}. See the section in the documentation of your linker for
12010 permitted values and their meanings.
12011 @end table
12012
12013 @node Directory Options
12014 @section Options for Directory Search
12015 @cindex directory options
12016 @cindex options, directory search
12017 @cindex search path
12018
12019 These options specify directories to search for header files, for
12020 libraries and for parts of the compiler:
12021
12022 @table @gcctabopt
12023 @include cppdiropts.texi
12024
12025 @item -iplugindir=@var{dir}
12026 @opindex iplugindir=
12027 Set the directory to search for plugins that are passed
12028 by @option{-fplugin=@var{name}} instead of
12029 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
12030 to be used by the user, but only passed by the driver.
12031
12032 @item -L@var{dir}
12033 @opindex L
12034 Add directory @var{dir} to the list of directories to be searched
12035 for @option{-l}.
12036
12037 @item -B@var{prefix}
12038 @opindex B
12039 This option specifies where to find the executables, libraries,
12040 include files, and data files of the compiler itself.
12041
12042 The compiler driver program runs one or more of the subprograms
12043 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
12044 @var{prefix} as a prefix for each program it tries to run, both with and
12045 without @samp{@var{machine}/@var{version}/} for the corresponding target
12046 machine and compiler version.
12047
12048 For each subprogram to be run, the compiler driver first tries the
12049 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
12050 is not specified, the driver tries two standard prefixes,
12051 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
12052 those results in a file name that is found, the unmodified program
12053 name is searched for using the directories specified in your
12054 @env{PATH} environment variable.
12055
12056 The compiler checks to see if the path provided by @option{-B}
12057 refers to a directory, and if necessary it adds a directory
12058 separator character at the end of the path.
12059
12060 @option{-B} prefixes that effectively specify directory names also apply
12061 to libraries in the linker, because the compiler translates these
12062 options into @option{-L} options for the linker. They also apply to
12063 include files in the preprocessor, because the compiler translates these
12064 options into @option{-isystem} options for the preprocessor. In this case,
12065 the compiler appends @samp{include} to the prefix.
12066
12067 The runtime support file @file{libgcc.a} can also be searched for using
12068 the @option{-B} prefix, if needed. If it is not found there, the two
12069 standard prefixes above are tried, and that is all. The file is left
12070 out of the link if it is not found by those means.
12071
12072 Another way to specify a prefix much like the @option{-B} prefix is to use
12073 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
12074 Variables}.
12075
12076 As a special kludge, if the path provided by @option{-B} is
12077 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
12078 9, then it is replaced by @file{[dir/]include}. This is to help
12079 with boot-strapping the compiler.
12080
12081 @item -no-canonical-prefixes
12082 @opindex no-canonical-prefixes
12083 Do not expand any symbolic links, resolve references to @samp{/../}
12084 or @samp{/./}, or make the path absolute when generating a relative
12085 prefix.
12086
12087 @item --sysroot=@var{dir}
12088 @opindex sysroot
12089 Use @var{dir} as the logical root directory for headers and libraries.
12090 For example, if the compiler normally searches for headers in
12091 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
12092 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
12093
12094 If you use both this option and the @option{-isysroot} option, then
12095 the @option{--sysroot} option applies to libraries, but the
12096 @option{-isysroot} option applies to header files.
12097
12098 The GNU linker (beginning with version 2.16) has the necessary support
12099 for this option. If your linker does not support this option, the
12100 header file aspect of @option{--sysroot} still works, but the
12101 library aspect does not.
12102
12103 @item --no-sysroot-suffix
12104 @opindex no-sysroot-suffix
12105 For some targets, a suffix is added to the root directory specified
12106 with @option{--sysroot}, depending on the other options used, so that
12107 headers may for example be found in
12108 @file{@var{dir}/@var{suffix}/usr/include} instead of
12109 @file{@var{dir}/usr/include}. This option disables the addition of
12110 such a suffix.
12111
12112 @end table
12113
12114 @node Code Gen Options
12115 @section Options for Code Generation Conventions
12116 @cindex code generation conventions
12117 @cindex options, code generation
12118 @cindex run-time options
12119
12120 These machine-independent options control the interface conventions
12121 used in code generation.
12122
12123 Most of them have both positive and negative forms; the negative form
12124 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
12125 one of the forms is listed---the one that is not the default. You
12126 can figure out the other form by either removing @samp{no-} or adding
12127 it.
12128
12129 @table @gcctabopt
12130 @item -fstack-reuse=@var{reuse-level}
12131 @opindex fstack_reuse
12132 This option controls stack space reuse for user declared local/auto variables
12133 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
12134 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
12135 local variables and temporaries, @samp{named_vars} enables the reuse only for
12136 user defined local variables with names, and @samp{none} disables stack reuse
12137 completely. The default value is @samp{all}. The option is needed when the
12138 program extends the lifetime of a scoped local variable or a compiler generated
12139 temporary beyond the end point defined by the language. When a lifetime of
12140 a variable ends, and if the variable lives in memory, the optimizing compiler
12141 has the freedom to reuse its stack space with other temporaries or scoped
12142 local variables whose live range does not overlap with it. Legacy code extending
12143 local lifetime is likely to break with the stack reuse optimization.
12144
12145 For example,
12146
12147 @smallexample
12148 int *p;
12149 @{
12150 int local1;
12151
12152 p = &local1;
12153 local1 = 10;
12154 ....
12155 @}
12156 @{
12157 int local2;
12158 local2 = 20;
12159 ...
12160 @}
12161
12162 if (*p == 10) // out of scope use of local1
12163 @{
12164
12165 @}
12166 @end smallexample
12167
12168 Another example:
12169 @smallexample
12170
12171 struct A
12172 @{
12173 A(int k) : i(k), j(k) @{ @}
12174 int i;
12175 int j;
12176 @};
12177
12178 A *ap;
12179
12180 void foo(const A& ar)
12181 @{
12182 ap = &ar;
12183 @}
12184
12185 void bar()
12186 @{
12187 foo(A(10)); // temp object's lifetime ends when foo returns
12188
12189 @{
12190 A a(20);
12191 ....
12192 @}
12193 ap->i+= 10; // ap references out of scope temp whose space
12194 // is reused with a. What is the value of ap->i?
12195 @}
12196
12197 @end smallexample
12198
12199 The lifetime of a compiler generated temporary is well defined by the C++
12200 standard. When a lifetime of a temporary ends, and if the temporary lives
12201 in memory, the optimizing compiler has the freedom to reuse its stack
12202 space with other temporaries or scoped local variables whose live range
12203 does not overlap with it. However some of the legacy code relies on
12204 the behavior of older compilers in which temporaries' stack space is
12205 not reused, the aggressive stack reuse can lead to runtime errors. This
12206 option is used to control the temporary stack reuse optimization.
12207
12208 @item -ftrapv
12209 @opindex ftrapv
12210 This option generates traps for signed overflow on addition, subtraction,
12211 multiplication operations.
12212 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12213 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12214 @option{-fwrapv} being effective. Note that only active options override, so
12215 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12216 results in @option{-ftrapv} being effective.
12217
12218 @item -fwrapv
12219 @opindex fwrapv
12220 This option instructs the compiler to assume that signed arithmetic
12221 overflow of addition, subtraction and multiplication wraps around
12222 using twos-complement representation. This flag enables some optimizations
12223 and disables others.
12224 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12225 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12226 @option{-fwrapv} being effective. Note that only active options override, so
12227 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12228 results in @option{-ftrapv} being effective.
12229
12230 @item -fexceptions
12231 @opindex fexceptions
12232 Enable exception handling. Generates extra code needed to propagate
12233 exceptions. For some targets, this implies GCC generates frame
12234 unwind information for all functions, which can produce significant data
12235 size overhead, although it does not affect execution. If you do not
12236 specify this option, GCC enables it by default for languages like
12237 C++ that normally require exception handling, and disables it for
12238 languages like C that do not normally require it. However, you may need
12239 to enable this option when compiling C code that needs to interoperate
12240 properly with exception handlers written in C++. You may also wish to
12241 disable this option if you are compiling older C++ programs that don't
12242 use exception handling.
12243
12244 @item -fnon-call-exceptions
12245 @opindex fnon-call-exceptions
12246 Generate code that allows trapping instructions to throw exceptions.
12247 Note that this requires platform-specific runtime support that does
12248 not exist everywhere. Moreover, it only allows @emph{trapping}
12249 instructions to throw exceptions, i.e.@: memory references or floating-point
12250 instructions. It does not allow exceptions to be thrown from
12251 arbitrary signal handlers such as @code{SIGALRM}.
12252
12253 @item -fdelete-dead-exceptions
12254 @opindex fdelete-dead-exceptions
12255 Consider that instructions that may throw exceptions but don't otherwise
12256 contribute to the execution of the program can be optimized away.
12257 This option is enabled by default for the Ada front end, as permitted by
12258 the Ada language specification.
12259 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
12260
12261 @item -funwind-tables
12262 @opindex funwind-tables
12263 Similar to @option{-fexceptions}, except that it just generates any needed
12264 static data, but does not affect the generated code in any other way.
12265 You normally do not need to enable this option; instead, a language processor
12266 that needs this handling enables it on your behalf.
12267
12268 @item -fasynchronous-unwind-tables
12269 @opindex fasynchronous-unwind-tables
12270 Generate unwind table in DWARF format, if supported by target machine. The
12271 table is exact at each instruction boundary, so it can be used for stack
12272 unwinding from asynchronous events (such as debugger or garbage collector).
12273
12274 @item -fno-gnu-unique
12275 @opindex fno-gnu-unique
12276 On systems with recent GNU assembler and C library, the C++ compiler
12277 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
12278 of template static data members and static local variables in inline
12279 functions are unique even in the presence of @code{RTLD_LOCAL}; this
12280 is necessary to avoid problems with a library used by two different
12281 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
12282 therefore disagreeing with the other one about the binding of the
12283 symbol. But this causes @code{dlclose} to be ignored for affected
12284 DSOs; if your program relies on reinitialization of a DSO via
12285 @code{dlclose} and @code{dlopen}, you can use
12286 @option{-fno-gnu-unique}.
12287
12288 @item -fpcc-struct-return
12289 @opindex fpcc-struct-return
12290 Return ``short'' @code{struct} and @code{union} values in memory like
12291 longer ones, rather than in registers. This convention is less
12292 efficient, but it has the advantage of allowing intercallability between
12293 GCC-compiled files and files compiled with other compilers, particularly
12294 the Portable C Compiler (pcc).
12295
12296 The precise convention for returning structures in memory depends
12297 on the target configuration macros.
12298
12299 Short structures and unions are those whose size and alignment match
12300 that of some integer type.
12301
12302 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
12303 switch is not binary compatible with code compiled with the
12304 @option{-freg-struct-return} switch.
12305 Use it to conform to a non-default application binary interface.
12306
12307 @item -freg-struct-return
12308 @opindex freg-struct-return
12309 Return @code{struct} and @code{union} values in registers when possible.
12310 This is more efficient for small structures than
12311 @option{-fpcc-struct-return}.
12312
12313 If you specify neither @option{-fpcc-struct-return} nor
12314 @option{-freg-struct-return}, GCC defaults to whichever convention is
12315 standard for the target. If there is no standard convention, GCC
12316 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
12317 the principal compiler. In those cases, we can choose the standard, and
12318 we chose the more efficient register return alternative.
12319
12320 @strong{Warning:} code compiled with the @option{-freg-struct-return}
12321 switch is not binary compatible with code compiled with the
12322 @option{-fpcc-struct-return} switch.
12323 Use it to conform to a non-default application binary interface.
12324
12325 @item -fshort-enums
12326 @opindex fshort-enums
12327 Allocate to an @code{enum} type only as many bytes as it needs for the
12328 declared range of possible values. Specifically, the @code{enum} type
12329 is equivalent to the smallest integer type that has enough room.
12330
12331 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
12332 code that is not binary compatible with code generated without that switch.
12333 Use it to conform to a non-default application binary interface.
12334
12335 @item -fshort-wchar
12336 @opindex fshort-wchar
12337 Override the underlying type for @code{wchar_t} to be @code{short
12338 unsigned int} instead of the default for the target. This option is
12339 useful for building programs to run under WINE@.
12340
12341 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
12342 code that is not binary compatible with code generated without that switch.
12343 Use it to conform to a non-default application binary interface.
12344
12345 @item -fno-common
12346 @opindex fno-common
12347 @cindex tentative definitions
12348 In C code, this option controls the placement of global variables
12349 defined without an initializer, known as @dfn{tentative definitions}
12350 in the C standard. Tentative definitions are distinct from declarations
12351 of a variable with the @code{extern} keyword, which do not allocate storage.
12352
12353 Unix C compilers have traditionally allocated storage for
12354 uninitialized global variables in a common block. This allows the
12355 linker to resolve all tentative definitions of the same variable
12356 in different compilation units to the same object, or to a non-tentative
12357 definition.
12358 This is the behavior specified by @option{-fcommon}, and is the default for
12359 GCC on most targets.
12360 On the other hand, this behavior is not required by ISO
12361 C, and on some targets may carry a speed or code size penalty on
12362 variable references.
12363
12364 The @option{-fno-common} option specifies that the compiler should instead
12365 place uninitialized global variables in the data section of the object file.
12366 This inhibits the merging of tentative definitions by the linker so
12367 you get a multiple-definition error if the same
12368 variable is defined in more than one compilation unit.
12369 Compiling with @option{-fno-common} is useful on targets for which
12370 it provides better performance, or if you wish to verify that the
12371 program will work on other systems that always treat uninitialized
12372 variable definitions this way.
12373
12374 @item -fno-ident
12375 @opindex fno-ident
12376 Ignore the @code{#ident} directive.
12377
12378 @item -finhibit-size-directive
12379 @opindex finhibit-size-directive
12380 Don't output a @code{.size} assembler directive, or anything else that
12381 would cause trouble if the function is split in the middle, and the
12382 two halves are placed at locations far apart in memory. This option is
12383 used when compiling @file{crtstuff.c}; you should not need to use it
12384 for anything else.
12385
12386 @item -fverbose-asm
12387 @opindex fverbose-asm
12388 Put extra commentary information in the generated assembly code to
12389 make it more readable. This option is generally only of use to those
12390 who actually need to read the generated assembly code (perhaps while
12391 debugging the compiler itself).
12392
12393 @option{-fno-verbose-asm}, the default, causes the
12394 extra information to be omitted and is useful when comparing two assembler
12395 files.
12396
12397 The added comments include:
12398
12399 @itemize @bullet
12400
12401 @item
12402 information on the compiler version and command-line options,
12403
12404 @item
12405 the source code lines associated with the assembly instructions,
12406 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12407
12408 @item
12409 hints on which high-level expressions correspond to
12410 the various assembly instruction operands.
12411
12412 @end itemize
12413
12414 For example, given this C source file:
12415
12416 @smallexample
12417 int test (int n)
12418 @{
12419 int i;
12420 int total = 0;
12421
12422 for (i = 0; i < n; i++)
12423 total += i * i;
12424
12425 return total;
12426 @}
12427 @end smallexample
12428
12429 compiling to (x86_64) assembly via @option{-S} and emitting the result
12430 direct to stdout via @option{-o} @option{-}
12431
12432 @smallexample
12433 gcc -S test.c -fverbose-asm -Os -o -
12434 @end smallexample
12435
12436 gives output similar to this:
12437
12438 @smallexample
12439 .file "test.c"
12440 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12441 [...snip...]
12442 # options passed:
12443 [...snip...]
12444
12445 .text
12446 .globl test
12447 .type test, @@function
12448 test:
12449 .LFB0:
12450 .cfi_startproc
12451 # test.c:4: int total = 0;
12452 xorl %eax, %eax # <retval>
12453 # test.c:6: for (i = 0; i < n; i++)
12454 xorl %edx, %edx # i
12455 .L2:
12456 # test.c:6: for (i = 0; i < n; i++)
12457 cmpl %edi, %edx # n, i
12458 jge .L5 #,
12459 # test.c:7: total += i * i;
12460 movl %edx, %ecx # i, tmp92
12461 imull %edx, %ecx # i, tmp92
12462 # test.c:6: for (i = 0; i < n; i++)
12463 incl %edx # i
12464 # test.c:7: total += i * i;
12465 addl %ecx, %eax # tmp92, <retval>
12466 jmp .L2 #
12467 .L5:
12468 # test.c:10: @}
12469 ret
12470 .cfi_endproc
12471 .LFE0:
12472 .size test, .-test
12473 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
12474 .section .note.GNU-stack,"",@@progbits
12475 @end smallexample
12476
12477 The comments are intended for humans rather than machines and hence the
12478 precise format of the comments is subject to change.
12479
12480 @item -frecord-gcc-switches
12481 @opindex frecord-gcc-switches
12482 This switch causes the command line used to invoke the
12483 compiler to be recorded into the object file that is being created.
12484 This switch is only implemented on some targets and the exact format
12485 of the recording is target and binary file format dependent, but it
12486 usually takes the form of a section containing ASCII text. This
12487 switch is related to the @option{-fverbose-asm} switch, but that
12488 switch only records information in the assembler output file as
12489 comments, so it never reaches the object file.
12490 See also @option{-grecord-gcc-switches} for another
12491 way of storing compiler options into the object file.
12492
12493 @item -fpic
12494 @opindex fpic
12495 @cindex global offset table
12496 @cindex PIC
12497 Generate position-independent code (PIC) suitable for use in a shared
12498 library, if supported for the target machine. Such code accesses all
12499 constant addresses through a global offset table (GOT)@. The dynamic
12500 loader resolves the GOT entries when the program starts (the dynamic
12501 loader is not part of GCC; it is part of the operating system). If
12502 the GOT size for the linked executable exceeds a machine-specific
12503 maximum size, you get an error message from the linker indicating that
12504 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
12505 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
12506 on the m68k and RS/6000. The x86 has no such limit.)
12507
12508 Position-independent code requires special support, and therefore works
12509 only on certain machines. For the x86, GCC supports PIC for System V
12510 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
12511 position-independent.
12512
12513 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12514 are defined to 1.
12515
12516 @item -fPIC
12517 @opindex fPIC
12518 If supported for the target machine, emit position-independent code,
12519 suitable for dynamic linking and avoiding any limit on the size of the
12520 global offset table. This option makes a difference on AArch64, m68k,
12521 PowerPC and SPARC@.
12522
12523 Position-independent code requires special support, and therefore works
12524 only on certain machines.
12525
12526 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12527 are defined to 2.
12528
12529 @item -fpie
12530 @itemx -fPIE
12531 @opindex fpie
12532 @opindex fPIE
12533 These options are similar to @option{-fpic} and @option{-fPIC}, but
12534 generated position independent code can be only linked into executables.
12535 Usually these options are used when @option{-pie} GCC option is
12536 used during linking.
12537
12538 @option{-fpie} and @option{-fPIE} both define the macros
12539 @code{__pie__} and @code{__PIE__}. The macros have the value 1
12540 for @option{-fpie} and 2 for @option{-fPIE}.
12541
12542 @item -fno-plt
12543 @opindex fno-plt
12544 Do not use the PLT for external function calls in position-independent code.
12545 Instead, load the callee address at call sites from the GOT and branch to it.
12546 This leads to more efficient code by eliminating PLT stubs and exposing
12547 GOT loads to optimizations. On architectures such as 32-bit x86 where
12548 PLT stubs expect the GOT pointer in a specific register, this gives more
12549 register allocation freedom to the compiler.
12550 Lazy binding requires use of the PLT;
12551 with @option{-fno-plt} all external symbols are resolved at load time.
12552
12553 Alternatively, the function attribute @code{noplt} can be used to avoid calls
12554 through the PLT for specific external functions.
12555
12556 In position-dependent code, a few targets also convert calls to
12557 functions that are marked to not use the PLT to use the GOT instead.
12558
12559 @item -fno-jump-tables
12560 @opindex fno-jump-tables
12561 Do not use jump tables for switch statements even where it would be
12562 more efficient than other code generation strategies. This option is
12563 of use in conjunction with @option{-fpic} or @option{-fPIC} for
12564 building code that forms part of a dynamic linker and cannot
12565 reference the address of a jump table. On some targets, jump tables
12566 do not require a GOT and this option is not needed.
12567
12568 @item -ffixed-@var{reg}
12569 @opindex ffixed
12570 Treat the register named @var{reg} as a fixed register; generated code
12571 should never refer to it (except perhaps as a stack pointer, frame
12572 pointer or in some other fixed role).
12573
12574 @var{reg} must be the name of a register. The register names accepted
12575 are machine-specific and are defined in the @code{REGISTER_NAMES}
12576 macro in the machine description macro file.
12577
12578 This flag does not have a negative form, because it specifies a
12579 three-way choice.
12580
12581 @item -fcall-used-@var{reg}
12582 @opindex fcall-used
12583 Treat the register named @var{reg} as an allocable register that is
12584 clobbered by function calls. It may be allocated for temporaries or
12585 variables that do not live across a call. Functions compiled this way
12586 do not save and restore the register @var{reg}.
12587
12588 It is an error to use this flag with the frame pointer or stack pointer.
12589 Use of this flag for other registers that have fixed pervasive roles in
12590 the machine's execution model produces disastrous results.
12591
12592 This flag does not have a negative form, because it specifies a
12593 three-way choice.
12594
12595 @item -fcall-saved-@var{reg}
12596 @opindex fcall-saved
12597 Treat the register named @var{reg} as an allocable register saved by
12598 functions. It may be allocated even for temporaries or variables that
12599 live across a call. Functions compiled this way save and restore
12600 the register @var{reg} if they use it.
12601
12602 It is an error to use this flag with the frame pointer or stack pointer.
12603 Use of this flag for other registers that have fixed pervasive roles in
12604 the machine's execution model produces disastrous results.
12605
12606 A different sort of disaster results from the use of this flag for
12607 a register in which function values may be returned.
12608
12609 This flag does not have a negative form, because it specifies a
12610 three-way choice.
12611
12612 @item -fpack-struct[=@var{n}]
12613 @opindex fpack-struct
12614 Without a value specified, pack all structure members together without
12615 holes. When a value is specified (which must be a small power of two), pack
12616 structure members according to this value, representing the maximum
12617 alignment (that is, objects with default alignment requirements larger than
12618 this are output potentially unaligned at the next fitting location.
12619
12620 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
12621 code that is not binary compatible with code generated without that switch.
12622 Additionally, it makes the code suboptimal.
12623 Use it to conform to a non-default application binary interface.
12624
12625 @item -fleading-underscore
12626 @opindex fleading-underscore
12627 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
12628 change the way C symbols are represented in the object file. One use
12629 is to help link with legacy assembly code.
12630
12631 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
12632 generate code that is not binary compatible with code generated without that
12633 switch. Use it to conform to a non-default application binary interface.
12634 Not all targets provide complete support for this switch.
12635
12636 @item -ftls-model=@var{model}
12637 @opindex ftls-model
12638 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
12639 The @var{model} argument should be one of @samp{global-dynamic},
12640 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
12641 Note that the choice is subject to optimization: the compiler may use
12642 a more efficient model for symbols not visible outside of the translation
12643 unit, or if @option{-fpic} is not given on the command line.
12644
12645 The default without @option{-fpic} is @samp{initial-exec}; with
12646 @option{-fpic} the default is @samp{global-dynamic}.
12647
12648 @item -ftrampolines
12649 @opindex ftrampolines
12650 For targets that normally need trampolines for nested functions, always
12651 generate them instead of using descriptors. Otherwise, for targets that
12652 do not need them, like for example HP-PA or IA-64, do nothing.
12653
12654 A trampoline is a small piece of code that is created at run time on the
12655 stack when the address of a nested function is taken, and is used to call
12656 the nested function indirectly. Therefore, it requires the stack to be
12657 made executable in order for the program to work properly.
12658
12659 @option{-fno-trampolines} is enabled by default on a language by language
12660 basis to let the compiler avoid generating them, if it computes that this
12661 is safe, and replace them with descriptors. Descriptors are made up of data
12662 only, but the generated code must be prepared to deal with them. As of this
12663 writing, @option{-fno-trampolines} is enabled by default only for Ada.
12664
12665 Moreover, code compiled with @option{-ftrampolines} and code compiled with
12666 @option{-fno-trampolines} are not binary compatible if nested functions are
12667 present. This option must therefore be used on a program-wide basis and be
12668 manipulated with extreme care.
12669
12670 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
12671 @opindex fvisibility
12672 Set the default ELF image symbol visibility to the specified option---all
12673 symbols are marked with this unless overridden within the code.
12674 Using this feature can very substantially improve linking and
12675 load times of shared object libraries, produce more optimized
12676 code, provide near-perfect API export and prevent symbol clashes.
12677 It is @strong{strongly} recommended that you use this in any shared objects
12678 you distribute.
12679
12680 Despite the nomenclature, @samp{default} always means public; i.e.,
12681 available to be linked against from outside the shared object.
12682 @samp{protected} and @samp{internal} are pretty useless in real-world
12683 usage so the only other commonly used option is @samp{hidden}.
12684 The default if @option{-fvisibility} isn't specified is
12685 @samp{default}, i.e., make every symbol public.
12686
12687 A good explanation of the benefits offered by ensuring ELF
12688 symbols have the correct visibility is given by ``How To Write
12689 Shared Libraries'' by Ulrich Drepper (which can be found at
12690 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
12691 solution made possible by this option to marking things hidden when
12692 the default is public is to make the default hidden and mark things
12693 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
12694 and @code{__attribute__ ((visibility("default")))} instead of
12695 @code{__declspec(dllexport)} you get almost identical semantics with
12696 identical syntax. This is a great boon to those working with
12697 cross-platform projects.
12698
12699 For those adding visibility support to existing code, you may find
12700 @code{#pragma GCC visibility} of use. This works by you enclosing
12701 the declarations you wish to set visibility for with (for example)
12702 @code{#pragma GCC visibility push(hidden)} and
12703 @code{#pragma GCC visibility pop}.
12704 Bear in mind that symbol visibility should be viewed @strong{as
12705 part of the API interface contract} and thus all new code should
12706 always specify visibility when it is not the default; i.e., declarations
12707 only for use within the local DSO should @strong{always} be marked explicitly
12708 as hidden as so to avoid PLT indirection overheads---making this
12709 abundantly clear also aids readability and self-documentation of the code.
12710 Note that due to ISO C++ specification requirements, @code{operator new} and
12711 @code{operator delete} must always be of default visibility.
12712
12713 Be aware that headers from outside your project, in particular system
12714 headers and headers from any other library you use, may not be
12715 expecting to be compiled with visibility other than the default. You
12716 may need to explicitly say @code{#pragma GCC visibility push(default)}
12717 before including any such headers.
12718
12719 @code{extern} declarations are not affected by @option{-fvisibility}, so
12720 a lot of code can be recompiled with @option{-fvisibility=hidden} with
12721 no modifications. However, this means that calls to @code{extern}
12722 functions with no explicit visibility use the PLT, so it is more
12723 effective to use @code{__attribute ((visibility))} and/or
12724 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
12725 declarations should be treated as hidden.
12726
12727 Note that @option{-fvisibility} does affect C++ vague linkage
12728 entities. This means that, for instance, an exception class that is
12729 be thrown between DSOs must be explicitly marked with default
12730 visibility so that the @samp{type_info} nodes are unified between
12731 the DSOs.
12732
12733 An overview of these techniques, their benefits and how to use them
12734 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
12735
12736 @item -fstrict-volatile-bitfields
12737 @opindex fstrict-volatile-bitfields
12738 This option should be used if accesses to volatile bit-fields (or other
12739 structure fields, although the compiler usually honors those types
12740 anyway) should use a single access of the width of the
12741 field's type, aligned to a natural alignment if possible. For
12742 example, targets with memory-mapped peripheral registers might require
12743 all such accesses to be 16 bits wide; with this flag you can
12744 declare all peripheral bit-fields as @code{unsigned short} (assuming short
12745 is 16 bits on these targets) to force GCC to use 16-bit accesses
12746 instead of, perhaps, a more efficient 32-bit access.
12747
12748 If this option is disabled, the compiler uses the most efficient
12749 instruction. In the previous example, that might be a 32-bit load
12750 instruction, even though that accesses bytes that do not contain
12751 any portion of the bit-field, or memory-mapped registers unrelated to
12752 the one being updated.
12753
12754 In some cases, such as when the @code{packed} attribute is applied to a
12755 structure field, it may not be possible to access the field with a single
12756 read or write that is correctly aligned for the target machine. In this
12757 case GCC falls back to generating multiple accesses rather than code that
12758 will fault or truncate the result at run time.
12759
12760 Note: Due to restrictions of the C/C++11 memory model, write accesses are
12761 not allowed to touch non bit-field members. It is therefore recommended
12762 to define all bits of the field's type as bit-field members.
12763
12764 The default value of this option is determined by the application binary
12765 interface for the target processor.
12766
12767 @item -fsync-libcalls
12768 @opindex fsync-libcalls
12769 This option controls whether any out-of-line instance of the @code{__sync}
12770 family of functions may be used to implement the C++11 @code{__atomic}
12771 family of functions.
12772
12773 The default value of this option is enabled, thus the only useful form
12774 of the option is @option{-fno-sync-libcalls}. This option is used in
12775 the implementation of the @file{libatomic} runtime library.
12776
12777 @end table
12778
12779 @node Developer Options
12780 @section GCC Developer Options
12781 @cindex developer options
12782 @cindex debugging GCC
12783 @cindex debug dump options
12784 @cindex dump options
12785 @cindex compilation statistics
12786
12787 This section describes command-line options that are primarily of
12788 interest to GCC developers, including options to support compiler
12789 testing and investigation of compiler bugs and compile-time
12790 performance problems. This includes options that produce debug dumps
12791 at various points in the compilation; that print statistics such as
12792 memory use and execution time; and that print information about GCC's
12793 configuration, such as where it searches for libraries. You should
12794 rarely need to use any of these options for ordinary compilation and
12795 linking tasks.
12796
12797 @table @gcctabopt
12798
12799 @item -d@var{letters}
12800 @itemx -fdump-rtl-@var{pass}
12801 @itemx -fdump-rtl-@var{pass}=@var{filename}
12802 @opindex d
12803 @opindex fdump-rtl-@var{pass}
12804 Says to make debugging dumps during compilation at times specified by
12805 @var{letters}. This is used for debugging the RTL-based passes of the
12806 compiler. The file names for most of the dumps are made by appending
12807 a pass number and a word to the @var{dumpname}, and the files are
12808 created in the directory of the output file. In case of
12809 @option{=@var{filename}} option, the dump is output on the given file
12810 instead of the pass numbered dump files. Note that the pass number is
12811 assigned as passes are registered into the pass manager. Most passes
12812 are registered in the order that they will execute and for these passes
12813 the number corresponds to the pass execution order. However, passes
12814 registered by plugins, passes specific to compilation targets, or
12815 passes that are otherwise registered after all the other passes are
12816 numbered higher than a pass named "final", even if they are executed
12817 earlier. @var{dumpname} is generated from the name of the output
12818 file if explicitly specified and not an executable, otherwise it is
12819 the basename of the source file.
12820
12821 Some @option{-d@var{letters}} switches have different meaning when
12822 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
12823 for information about preprocessor-specific dump options.
12824
12825 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
12826 @option{-d} option @var{letters}. Here are the possible
12827 letters for use in @var{pass} and @var{letters}, and their meanings:
12828
12829 @table @gcctabopt
12830
12831 @item -fdump-rtl-alignments
12832 @opindex fdump-rtl-alignments
12833 Dump after branch alignments have been computed.
12834
12835 @item -fdump-rtl-asmcons
12836 @opindex fdump-rtl-asmcons
12837 Dump after fixing rtl statements that have unsatisfied in/out constraints.
12838
12839 @item -fdump-rtl-auto_inc_dec
12840 @opindex fdump-rtl-auto_inc_dec
12841 Dump after auto-inc-dec discovery. This pass is only run on
12842 architectures that have auto inc or auto dec instructions.
12843
12844 @item -fdump-rtl-barriers
12845 @opindex fdump-rtl-barriers
12846 Dump after cleaning up the barrier instructions.
12847
12848 @item -fdump-rtl-bbpart
12849 @opindex fdump-rtl-bbpart
12850 Dump after partitioning hot and cold basic blocks.
12851
12852 @item -fdump-rtl-bbro
12853 @opindex fdump-rtl-bbro
12854 Dump after block reordering.
12855
12856 @item -fdump-rtl-btl1
12857 @itemx -fdump-rtl-btl2
12858 @opindex fdump-rtl-btl2
12859 @opindex fdump-rtl-btl2
12860 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
12861 after the two branch
12862 target load optimization passes.
12863
12864 @item -fdump-rtl-bypass
12865 @opindex fdump-rtl-bypass
12866 Dump after jump bypassing and control flow optimizations.
12867
12868 @item -fdump-rtl-combine
12869 @opindex fdump-rtl-combine
12870 Dump after the RTL instruction combination pass.
12871
12872 @item -fdump-rtl-compgotos
12873 @opindex fdump-rtl-compgotos
12874 Dump after duplicating the computed gotos.
12875
12876 @item -fdump-rtl-ce1
12877 @itemx -fdump-rtl-ce2
12878 @itemx -fdump-rtl-ce3
12879 @opindex fdump-rtl-ce1
12880 @opindex fdump-rtl-ce2
12881 @opindex fdump-rtl-ce3
12882 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
12883 @option{-fdump-rtl-ce3} enable dumping after the three
12884 if conversion passes.
12885
12886 @item -fdump-rtl-cprop_hardreg
12887 @opindex fdump-rtl-cprop_hardreg
12888 Dump after hard register copy propagation.
12889
12890 @item -fdump-rtl-csa
12891 @opindex fdump-rtl-csa
12892 Dump after combining stack adjustments.
12893
12894 @item -fdump-rtl-cse1
12895 @itemx -fdump-rtl-cse2
12896 @opindex fdump-rtl-cse1
12897 @opindex fdump-rtl-cse2
12898 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
12899 the two common subexpression elimination passes.
12900
12901 @item -fdump-rtl-dce
12902 @opindex fdump-rtl-dce
12903 Dump after the standalone dead code elimination passes.
12904
12905 @item -fdump-rtl-dbr
12906 @opindex fdump-rtl-dbr
12907 Dump after delayed branch scheduling.
12908
12909 @item -fdump-rtl-dce1
12910 @itemx -fdump-rtl-dce2
12911 @opindex fdump-rtl-dce1
12912 @opindex fdump-rtl-dce2
12913 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
12914 the two dead store elimination passes.
12915
12916 @item -fdump-rtl-eh
12917 @opindex fdump-rtl-eh
12918 Dump after finalization of EH handling code.
12919
12920 @item -fdump-rtl-eh_ranges
12921 @opindex fdump-rtl-eh_ranges
12922 Dump after conversion of EH handling range regions.
12923
12924 @item -fdump-rtl-expand
12925 @opindex fdump-rtl-expand
12926 Dump after RTL generation.
12927
12928 @item -fdump-rtl-fwprop1
12929 @itemx -fdump-rtl-fwprop2
12930 @opindex fdump-rtl-fwprop1
12931 @opindex fdump-rtl-fwprop2
12932 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
12933 dumping after the two forward propagation passes.
12934
12935 @item -fdump-rtl-gcse1
12936 @itemx -fdump-rtl-gcse2
12937 @opindex fdump-rtl-gcse1
12938 @opindex fdump-rtl-gcse2
12939 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
12940 after global common subexpression elimination.
12941
12942 @item -fdump-rtl-init-regs
12943 @opindex fdump-rtl-init-regs
12944 Dump after the initialization of the registers.
12945
12946 @item -fdump-rtl-initvals
12947 @opindex fdump-rtl-initvals
12948 Dump after the computation of the initial value sets.
12949
12950 @item -fdump-rtl-into_cfglayout
12951 @opindex fdump-rtl-into_cfglayout
12952 Dump after converting to cfglayout mode.
12953
12954 @item -fdump-rtl-ira
12955 @opindex fdump-rtl-ira
12956 Dump after iterated register allocation.
12957
12958 @item -fdump-rtl-jump
12959 @opindex fdump-rtl-jump
12960 Dump after the second jump optimization.
12961
12962 @item -fdump-rtl-loop2
12963 @opindex fdump-rtl-loop2
12964 @option{-fdump-rtl-loop2} enables dumping after the rtl
12965 loop optimization passes.
12966
12967 @item -fdump-rtl-mach
12968 @opindex fdump-rtl-mach
12969 Dump after performing the machine dependent reorganization pass, if that
12970 pass exists.
12971
12972 @item -fdump-rtl-mode_sw
12973 @opindex fdump-rtl-mode_sw
12974 Dump after removing redundant mode switches.
12975
12976 @item -fdump-rtl-rnreg
12977 @opindex fdump-rtl-rnreg
12978 Dump after register renumbering.
12979
12980 @item -fdump-rtl-outof_cfglayout
12981 @opindex fdump-rtl-outof_cfglayout
12982 Dump after converting from cfglayout mode.
12983
12984 @item -fdump-rtl-peephole2
12985 @opindex fdump-rtl-peephole2
12986 Dump after the peephole pass.
12987
12988 @item -fdump-rtl-postreload
12989 @opindex fdump-rtl-postreload
12990 Dump after post-reload optimizations.
12991
12992 @item -fdump-rtl-pro_and_epilogue
12993 @opindex fdump-rtl-pro_and_epilogue
12994 Dump after generating the function prologues and epilogues.
12995
12996 @item -fdump-rtl-sched1
12997 @itemx -fdump-rtl-sched2
12998 @opindex fdump-rtl-sched1
12999 @opindex fdump-rtl-sched2
13000 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
13001 after the basic block scheduling passes.
13002
13003 @item -fdump-rtl-ree
13004 @opindex fdump-rtl-ree
13005 Dump after sign/zero extension elimination.
13006
13007 @item -fdump-rtl-seqabstr
13008 @opindex fdump-rtl-seqabstr
13009 Dump after common sequence discovery.
13010
13011 @item -fdump-rtl-shorten
13012 @opindex fdump-rtl-shorten
13013 Dump after shortening branches.
13014
13015 @item -fdump-rtl-sibling
13016 @opindex fdump-rtl-sibling
13017 Dump after sibling call optimizations.
13018
13019 @item -fdump-rtl-split1
13020 @itemx -fdump-rtl-split2
13021 @itemx -fdump-rtl-split3
13022 @itemx -fdump-rtl-split4
13023 @itemx -fdump-rtl-split5
13024 @opindex fdump-rtl-split1
13025 @opindex fdump-rtl-split2
13026 @opindex fdump-rtl-split3
13027 @opindex fdump-rtl-split4
13028 @opindex fdump-rtl-split5
13029 These options enable dumping after five rounds of
13030 instruction splitting.
13031
13032 @item -fdump-rtl-sms
13033 @opindex fdump-rtl-sms
13034 Dump after modulo scheduling. This pass is only run on some
13035 architectures.
13036
13037 @item -fdump-rtl-stack
13038 @opindex fdump-rtl-stack
13039 Dump after conversion from GCC's ``flat register file'' registers to the
13040 x87's stack-like registers. This pass is only run on x86 variants.
13041
13042 @item -fdump-rtl-subreg1
13043 @itemx -fdump-rtl-subreg2
13044 @opindex fdump-rtl-subreg1
13045 @opindex fdump-rtl-subreg2
13046 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
13047 the two subreg expansion passes.
13048
13049 @item -fdump-rtl-unshare
13050 @opindex fdump-rtl-unshare
13051 Dump after all rtl has been unshared.
13052
13053 @item -fdump-rtl-vartrack
13054 @opindex fdump-rtl-vartrack
13055 Dump after variable tracking.
13056
13057 @item -fdump-rtl-vregs
13058 @opindex fdump-rtl-vregs
13059 Dump after converting virtual registers to hard registers.
13060
13061 @item -fdump-rtl-web
13062 @opindex fdump-rtl-web
13063 Dump after live range splitting.
13064
13065 @item -fdump-rtl-regclass
13066 @itemx -fdump-rtl-subregs_of_mode_init
13067 @itemx -fdump-rtl-subregs_of_mode_finish
13068 @itemx -fdump-rtl-dfinit
13069 @itemx -fdump-rtl-dfinish
13070 @opindex fdump-rtl-regclass
13071 @opindex fdump-rtl-subregs_of_mode_init
13072 @opindex fdump-rtl-subregs_of_mode_finish
13073 @opindex fdump-rtl-dfinit
13074 @opindex fdump-rtl-dfinish
13075 These dumps are defined but always produce empty files.
13076
13077 @item -da
13078 @itemx -fdump-rtl-all
13079 @opindex da
13080 @opindex fdump-rtl-all
13081 Produce all the dumps listed above.
13082
13083 @item -dA
13084 @opindex dA
13085 Annotate the assembler output with miscellaneous debugging information.
13086
13087 @item -dD
13088 @opindex dD
13089 Dump all macro definitions, at the end of preprocessing, in addition to
13090 normal output.
13091
13092 @item -dH
13093 @opindex dH
13094 Produce a core dump whenever an error occurs.
13095
13096 @item -dp
13097 @opindex dp
13098 Annotate the assembler output with a comment indicating which
13099 pattern and alternative is used. The length of each instruction is
13100 also printed.
13101
13102 @item -dP
13103 @opindex dP
13104 Dump the RTL in the assembler output as a comment before each instruction.
13105 Also turns on @option{-dp} annotation.
13106
13107 @item -dx
13108 @opindex dx
13109 Just generate RTL for a function instead of compiling it. Usually used
13110 with @option{-fdump-rtl-expand}.
13111 @end table
13112
13113 @item -fdump-noaddr
13114 @opindex fdump-noaddr
13115 When doing debugging dumps, suppress address output. This makes it more
13116 feasible to use diff on debugging dumps for compiler invocations with
13117 different compiler binaries and/or different
13118 text / bss / data / heap / stack / dso start locations.
13119
13120 @item -freport-bug
13121 @opindex freport-bug
13122 Collect and dump debug information into a temporary file if an
13123 internal compiler error (ICE) occurs.
13124
13125 @item -fdump-unnumbered
13126 @opindex fdump-unnumbered
13127 When doing debugging dumps, suppress instruction numbers and address output.
13128 This makes it more feasible to use diff on debugging dumps for compiler
13129 invocations with different options, in particular with and without
13130 @option{-g}.
13131
13132 @item -fdump-unnumbered-links
13133 @opindex fdump-unnumbered-links
13134 When doing debugging dumps (see @option{-d} option above), suppress
13135 instruction numbers for the links to the previous and next instructions
13136 in a sequence.
13137
13138 @item -fdump-ipa-@var{switch}
13139 @opindex fdump-ipa
13140 Control the dumping at various stages of inter-procedural analysis
13141 language tree to a file. The file name is generated by appending a
13142 switch specific suffix to the source file name, and the file is created
13143 in the same directory as the output file. The following dumps are
13144 possible:
13145
13146 @table @samp
13147 @item all
13148 Enables all inter-procedural analysis dumps.
13149
13150 @item cgraph
13151 Dumps information about call-graph optimization, unused function removal,
13152 and inlining decisions.
13153
13154 @item inline
13155 Dump after function inlining.
13156
13157 @end table
13158
13159 @item -fdump-lang-all
13160 @itemx -fdump-lang-@var{switch}
13161 @itemx -fdump-lang-@var{switch}-@var{options}
13162 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
13163 @opindex fdump-lang-all
13164 @opindex fdump-lang
13165 Control the dumping of language-specific information. The @var{options}
13166 and @var{filename} portions behave as described in the
13167 @option{-fdump-tree} option. The following @var{switch} values are
13168 accepted:
13169
13170 @table @samp
13171 @item all
13172
13173 Enable all language-specific dumps.
13174
13175 @item class
13176 Dump class hierarchy information. Virtual table information is emitted
13177 unless '@option{slim}' is specified. This option is applicable to C++ only.
13178
13179 @item raw
13180 Dump the raw internal tree data. This option is applicable to C++ only.
13181
13182 @end table
13183
13184 @item -fdump-passes
13185 @opindex fdump-passes
13186 Print on @file{stderr} the list of optimization passes that are turned
13187 on and off by the current command-line options.
13188
13189 @item -fdump-statistics-@var{option}
13190 @opindex fdump-statistics
13191 Enable and control dumping of pass statistics in a separate file. The
13192 file name is generated by appending a suffix ending in
13193 @samp{.statistics} to the source file name, and the file is created in
13194 the same directory as the output file. If the @samp{-@var{option}}
13195 form is used, @samp{-stats} causes counters to be summed over the
13196 whole compilation unit while @samp{-details} dumps every event as
13197 the passes generate them. The default with no option is to sum
13198 counters for each function compiled.
13199
13200 @item -fdump-tree-all
13201 @itemx -fdump-tree-@var{switch}
13202 @itemx -fdump-tree-@var{switch}-@var{options}
13203 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
13204 @opindex fdump-tree-all
13205 @opindex fdump-tree
13206 Control the dumping at various stages of processing the intermediate
13207 language tree to a file. The file name is generated by appending a
13208 switch-specific suffix to the source file name, and the file is
13209 created in the same directory as the output file. In case of
13210 @option{=@var{filename}} option, the dump is output on the given file
13211 instead of the auto named dump files. If the @samp{-@var{options}}
13212 form is used, @var{options} is a list of @samp{-} separated options
13213 which control the details of the dump. Not all options are applicable
13214 to all dumps; those that are not meaningful are ignored. The
13215 following options are available
13216
13217 @table @samp
13218 @item address
13219 Print the address of each node. Usually this is not meaningful as it
13220 changes according to the environment and source file. Its primary use
13221 is for tying up a dump file with a debug environment.
13222 @item asmname
13223 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
13224 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
13225 use working backward from mangled names in the assembly file.
13226 @item slim
13227 When dumping front-end intermediate representations, inhibit dumping
13228 of members of a scope or body of a function merely because that scope
13229 has been reached. Only dump such items when they are directly reachable
13230 by some other path.
13231
13232 When dumping pretty-printed trees, this option inhibits dumping the
13233 bodies of control structures.
13234
13235 When dumping RTL, print the RTL in slim (condensed) form instead of
13236 the default LISP-like representation.
13237 @item raw
13238 Print a raw representation of the tree. By default, trees are
13239 pretty-printed into a C-like representation.
13240 @item details
13241 Enable more detailed dumps (not honored by every dump option). Also
13242 include information from the optimization passes.
13243 @item stats
13244 Enable dumping various statistics about the pass (not honored by every dump
13245 option).
13246 @item blocks
13247 Enable showing basic block boundaries (disabled in raw dumps).
13248 @item graph
13249 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
13250 dump a representation of the control flow graph suitable for viewing with
13251 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
13252 the file is pretty-printed as a subgraph, so that GraphViz can render them
13253 all in a single plot.
13254
13255 This option currently only works for RTL dumps, and the RTL is always
13256 dumped in slim form.
13257 @item vops
13258 Enable showing virtual operands for every statement.
13259 @item lineno
13260 Enable showing line numbers for statements.
13261 @item uid
13262 Enable showing the unique ID (@code{DECL_UID}) for each variable.
13263 @item verbose
13264 Enable showing the tree dump for each statement.
13265 @item eh
13266 Enable showing the EH region number holding each statement.
13267 @item scev
13268 Enable showing scalar evolution analysis details.
13269 @item optimized
13270 Enable showing optimization information (only available in certain
13271 passes).
13272 @item missed
13273 Enable showing missed optimization information (only available in certain
13274 passes).
13275 @item note
13276 Enable other detailed optimization information (only available in
13277 certain passes).
13278 @item =@var{filename}
13279 Instead of an auto named dump file, output into the given file
13280 name. The file names @file{stdout} and @file{stderr} are treated
13281 specially and are considered already open standard streams. For
13282 example,
13283
13284 @smallexample
13285 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
13286 -fdump-tree-pre=/dev/stderr file.c
13287 @end smallexample
13288
13289 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
13290 output on to @file{stderr}. If two conflicting dump filenames are
13291 given for the same pass, then the latter option overrides the earlier
13292 one.
13293
13294 @item all
13295 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
13296 and @option{lineno}.
13297
13298 @item optall
13299 Turn on all optimization options, i.e., @option{optimized},
13300 @option{missed}, and @option{note}.
13301 @end table
13302
13303 To determine what tree dumps are available or find the dump for a pass
13304 of interest follow the steps below.
13305
13306 @enumerate
13307 @item
13308 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
13309 look for a code that corresponds to the pass you are interested in.
13310 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
13311 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
13312 The number at the end distinguishes distinct invocations of the same pass.
13313 @item
13314 To enable the creation of the dump file, append the pass code to
13315 the @option{-fdump-} option prefix and invoke GCC with it. For example,
13316 to enable the dump from the Early Value Range Propagation pass, invoke
13317 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
13318 specify the name of the dump file. If you don't specify one, GCC
13319 creates as described below.
13320 @item
13321 Find the pass dump in a file whose name is composed of three components
13322 separated by a period: the name of the source file GCC was invoked to
13323 compile, a numeric suffix indicating the pass number followed by the
13324 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
13325 and finally the pass code. For example, the Early VRP pass dump might
13326 be in a file named @file{myfile.c.038t.evrp} in the current working
13327 directory. Note that the numeric codes are not stable and may change
13328 from one version of GCC to another.
13329 @end enumerate
13330
13331 @item -fopt-info
13332 @itemx -fopt-info-@var{options}
13333 @itemx -fopt-info-@var{options}=@var{filename}
13334 @opindex fopt-info
13335 Controls optimization dumps from various optimization passes. If the
13336 @samp{-@var{options}} form is used, @var{options} is a list of
13337 @samp{-} separated option keywords to select the dump details and
13338 optimizations.
13339
13340 The @var{options} can be divided into two groups: options describing the
13341 verbosity of the dump, and options describing which optimizations
13342 should be included. The options from both the groups can be freely
13343 mixed as they are non-overlapping. However, in case of any conflicts,
13344 the later options override the earlier options on the command
13345 line.
13346
13347 The following options control the dump verbosity:
13348
13349 @table @samp
13350 @item optimized
13351 Print information when an optimization is successfully applied. It is
13352 up to a pass to decide which information is relevant. For example, the
13353 vectorizer passes print the source location of loops which are
13354 successfully vectorized.
13355 @item missed
13356 Print information about missed optimizations. Individual passes
13357 control which information to include in the output.
13358 @item note
13359 Print verbose information about optimizations, such as certain
13360 transformations, more detailed messages about decisions etc.
13361 @item all
13362 Print detailed optimization information. This includes
13363 @samp{optimized}, @samp{missed}, and @samp{note}.
13364 @end table
13365
13366 One or more of the following option keywords can be used to describe a
13367 group of optimizations:
13368
13369 @table @samp
13370 @item ipa
13371 Enable dumps from all interprocedural optimizations.
13372 @item loop
13373 Enable dumps from all loop optimizations.
13374 @item inline
13375 Enable dumps from all inlining optimizations.
13376 @item omp
13377 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
13378 @item vec
13379 Enable dumps from all vectorization optimizations.
13380 @item optall
13381 Enable dumps from all optimizations. This is a superset of
13382 the optimization groups listed above.
13383 @end table
13384
13385 If @var{options} is
13386 omitted, it defaults to @samp{optimized-optall}, which means to dump all
13387 info about successful optimizations from all the passes.
13388
13389 If the @var{filename} is provided, then the dumps from all the
13390 applicable optimizations are concatenated into the @var{filename}.
13391 Otherwise the dump is output onto @file{stderr}. Though multiple
13392 @option{-fopt-info} options are accepted, only one of them can include
13393 a @var{filename}. If other filenames are provided then all but the
13394 first such option are ignored.
13395
13396 Note that the output @var{filename} is overwritten
13397 in case of multiple translation units. If a combined output from
13398 multiple translation units is desired, @file{stderr} should be used
13399 instead.
13400
13401 In the following example, the optimization info is output to
13402 @file{stderr}:
13403
13404 @smallexample
13405 gcc -O3 -fopt-info
13406 @end smallexample
13407
13408 This example:
13409 @smallexample
13410 gcc -O3 -fopt-info-missed=missed.all
13411 @end smallexample
13412
13413 @noindent
13414 outputs missed optimization report from all the passes into
13415 @file{missed.all}, and this one:
13416
13417 @smallexample
13418 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13419 @end smallexample
13420
13421 @noindent
13422 prints information about missed optimization opportunities from
13423 vectorization passes on @file{stderr}.
13424 Note that @option{-fopt-info-vec-missed} is equivalent to
13425 @option{-fopt-info-missed-vec}. The order of the optimization group
13426 names and message types listed after @option{-fopt-info} does not matter.
13427
13428 As another example,
13429 @smallexample
13430 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13431 @end smallexample
13432
13433 @noindent
13434 outputs information about missed optimizations as well as
13435 optimized locations from all the inlining passes into
13436 @file{inline.txt}.
13437
13438 Finally, consider:
13439
13440 @smallexample
13441 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13442 @end smallexample
13443
13444 @noindent
13445 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
13446 in conflict since only one output file is allowed. In this case, only
13447 the first option takes effect and the subsequent options are
13448 ignored. Thus only @file{vec.miss} is produced which contains
13449 dumps from the vectorizer about missed opportunities.
13450
13451 @item -fsched-verbose=@var{n}
13452 @opindex fsched-verbose
13453 On targets that use instruction scheduling, this option controls the
13454 amount of debugging output the scheduler prints to the dump files.
13455
13456 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
13457 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
13458 For @var{n} greater than one, it also output basic block probabilities,
13459 detailed ready list information and unit/insn info. For @var{n} greater
13460 than two, it includes RTL at abort point, control-flow and regions info.
13461 And for @var{n} over four, @option{-fsched-verbose} also includes
13462 dependence info.
13463
13464
13465
13466 @item -fenable-@var{kind}-@var{pass}
13467 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
13468 @opindex fdisable-
13469 @opindex fenable-
13470
13471 This is a set of options that are used to explicitly disable/enable
13472 optimization passes. These options are intended for use for debugging GCC.
13473 Compiler users should use regular options for enabling/disabling
13474 passes instead.
13475
13476 @table @gcctabopt
13477
13478 @item -fdisable-ipa-@var{pass}
13479 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13480 statically invoked in the compiler multiple times, the pass name should be
13481 appended with a sequential number starting from 1.
13482
13483 @item -fdisable-rtl-@var{pass}
13484 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
13485 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
13486 statically invoked in the compiler multiple times, the pass name should be
13487 appended with a sequential number starting from 1. @var{range-list} is a
13488 comma-separated list of function ranges or assembler names. Each range is a number
13489 pair separated by a colon. The range is inclusive in both ends. If the range
13490 is trivial, the number pair can be simplified as a single number. If the
13491 function's call graph node's @var{uid} falls within one of the specified ranges,
13492 the @var{pass} is disabled for that function. The @var{uid} is shown in the
13493 function header of a dump file, and the pass names can be dumped by using
13494 option @option{-fdump-passes}.
13495
13496 @item -fdisable-tree-@var{pass}
13497 @itemx -fdisable-tree-@var{pass}=@var{range-list}
13498 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
13499 option arguments.
13500
13501 @item -fenable-ipa-@var{pass}
13502 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13503 statically invoked in the compiler multiple times, the pass name should be
13504 appended with a sequential number starting from 1.
13505
13506 @item -fenable-rtl-@var{pass}
13507 @itemx -fenable-rtl-@var{pass}=@var{range-list}
13508 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
13509 description and examples.
13510
13511 @item -fenable-tree-@var{pass}
13512 @itemx -fenable-tree-@var{pass}=@var{range-list}
13513 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
13514 of option arguments.
13515
13516 @end table
13517
13518 Here are some examples showing uses of these options.
13519
13520 @smallexample
13521
13522 # disable ccp1 for all functions
13523 -fdisable-tree-ccp1
13524 # disable complete unroll for function whose cgraph node uid is 1
13525 -fenable-tree-cunroll=1
13526 # disable gcse2 for functions at the following ranges [1,1],
13527 # [300,400], and [400,1000]
13528 # disable gcse2 for functions foo and foo2
13529 -fdisable-rtl-gcse2=foo,foo2
13530 # disable early inlining
13531 -fdisable-tree-einline
13532 # disable ipa inlining
13533 -fdisable-ipa-inline
13534 # enable tree full unroll
13535 -fenable-tree-unroll
13536
13537 @end smallexample
13538
13539 @item -fchecking
13540 @itemx -fchecking=@var{n}
13541 @opindex fchecking
13542 @opindex fno-checking
13543 Enable internal consistency checking. The default depends on
13544 the compiler configuration. @option{-fchecking=2} enables further
13545 internal consistency checking that might affect code generation.
13546
13547 @item -frandom-seed=@var{string}
13548 @opindex frandom-seed
13549 This option provides a seed that GCC uses in place of
13550 random numbers in generating certain symbol names
13551 that have to be different in every compiled file. It is also used to
13552 place unique stamps in coverage data files and the object files that
13553 produce them. You can use the @option{-frandom-seed} option to produce
13554 reproducibly identical object files.
13555
13556 The @var{string} can either be a number (decimal, octal or hex) or an
13557 arbitrary string (in which case it's converted to a number by
13558 computing CRC32).
13559
13560 The @var{string} should be different for every file you compile.
13561
13562 @item -save-temps
13563 @itemx -save-temps=cwd
13564 @opindex save-temps
13565 Store the usual ``temporary'' intermediate files permanently; place them
13566 in the current directory and name them based on the source file. Thus,
13567 compiling @file{foo.c} with @option{-c -save-temps} produces files
13568 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
13569 preprocessed @file{foo.i} output file even though the compiler now
13570 normally uses an integrated preprocessor.
13571
13572 When used in combination with the @option{-x} command-line option,
13573 @option{-save-temps} is sensible enough to avoid over writing an
13574 input source file with the same extension as an intermediate file.
13575 The corresponding intermediate file may be obtained by renaming the
13576 source file before using @option{-save-temps}.
13577
13578 If you invoke GCC in parallel, compiling several different source
13579 files that share a common base name in different subdirectories or the
13580 same source file compiled for multiple output destinations, it is
13581 likely that the different parallel compilers will interfere with each
13582 other, and overwrite the temporary files. For instance:
13583
13584 @smallexample
13585 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
13586 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
13587 @end smallexample
13588
13589 may result in @file{foo.i} and @file{foo.o} being written to
13590 simultaneously by both compilers.
13591
13592 @item -save-temps=obj
13593 @opindex save-temps=obj
13594 Store the usual ``temporary'' intermediate files permanently. If the
13595 @option{-o} option is used, the temporary files are based on the
13596 object file. If the @option{-o} option is not used, the
13597 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
13598
13599 For example:
13600
13601 @smallexample
13602 gcc -save-temps=obj -c foo.c
13603 gcc -save-temps=obj -c bar.c -o dir/xbar.o
13604 gcc -save-temps=obj foobar.c -o dir2/yfoobar
13605 @end smallexample
13606
13607 @noindent
13608 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
13609 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
13610 @file{dir2/yfoobar.o}.
13611
13612 @item -time@r{[}=@var{file}@r{]}
13613 @opindex time
13614 Report the CPU time taken by each subprocess in the compilation
13615 sequence. For C source files, this is the compiler proper and assembler
13616 (plus the linker if linking is done).
13617
13618 Without the specification of an output file, the output looks like this:
13619
13620 @smallexample
13621 # cc1 0.12 0.01
13622 # as 0.00 0.01
13623 @end smallexample
13624
13625 The first number on each line is the ``user time'', that is time spent
13626 executing the program itself. The second number is ``system time'',
13627 time spent executing operating system routines on behalf of the program.
13628 Both numbers are in seconds.
13629
13630 With the specification of an output file, the output is appended to the
13631 named file, and it looks like this:
13632
13633 @smallexample
13634 0.12 0.01 cc1 @var{options}
13635 0.00 0.01 as @var{options}
13636 @end smallexample
13637
13638 The ``user time'' and the ``system time'' are moved before the program
13639 name, and the options passed to the program are displayed, so that one
13640 can later tell what file was being compiled, and with which options.
13641
13642 @item -fdump-final-insns@r{[}=@var{file}@r{]}
13643 @opindex fdump-final-insns
13644 Dump the final internal representation (RTL) to @var{file}. If the
13645 optional argument is omitted (or if @var{file} is @code{.}), the name
13646 of the dump file is determined by appending @code{.gkd} to the
13647 compilation output file name.
13648
13649 @item -fcompare-debug@r{[}=@var{opts}@r{]}
13650 @opindex fcompare-debug
13651 @opindex fno-compare-debug
13652 If no error occurs during compilation, run the compiler a second time,
13653 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
13654 passed to the second compilation. Dump the final internal
13655 representation in both compilations, and print an error if they differ.
13656
13657 If the equal sign is omitted, the default @option{-gtoggle} is used.
13658
13659 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
13660 and nonzero, implicitly enables @option{-fcompare-debug}. If
13661 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
13662 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
13663 is used.
13664
13665 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
13666 is equivalent to @option{-fno-compare-debug}, which disables the dumping
13667 of the final representation and the second compilation, preventing even
13668 @env{GCC_COMPARE_DEBUG} from taking effect.
13669
13670 To verify full coverage during @option{-fcompare-debug} testing, set
13671 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
13672 which GCC rejects as an invalid option in any actual compilation
13673 (rather than preprocessing, assembly or linking). To get just a
13674 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
13675 not overridden} will do.
13676
13677 @item -fcompare-debug-second
13678 @opindex fcompare-debug-second
13679 This option is implicitly passed to the compiler for the second
13680 compilation requested by @option{-fcompare-debug}, along with options to
13681 silence warnings, and omitting other options that would cause
13682 side-effect compiler outputs to files or to the standard output. Dump
13683 files and preserved temporary files are renamed so as to contain the
13684 @code{.gk} additional extension during the second compilation, to avoid
13685 overwriting those generated by the first.
13686
13687 When this option is passed to the compiler driver, it causes the
13688 @emph{first} compilation to be skipped, which makes it useful for little
13689 other than debugging the compiler proper.
13690
13691 @item -gtoggle
13692 @opindex gtoggle
13693 Turn off generation of debug info, if leaving out this option
13694 generates it, or turn it on at level 2 otherwise. The position of this
13695 argument in the command line does not matter; it takes effect after all
13696 other options are processed, and it does so only once, no matter how
13697 many times it is given. This is mainly intended to be used with
13698 @option{-fcompare-debug}.
13699
13700 @item -fvar-tracking-assignments-toggle
13701 @opindex fvar-tracking-assignments-toggle
13702 @opindex fno-var-tracking-assignments-toggle
13703 Toggle @option{-fvar-tracking-assignments}, in the same way that
13704 @option{-gtoggle} toggles @option{-g}.
13705
13706 @item -Q
13707 @opindex Q
13708 Makes the compiler print out each function name as it is compiled, and
13709 print some statistics about each pass when it finishes.
13710
13711 @item -ftime-report
13712 @opindex ftime-report
13713 Makes the compiler print some statistics about the time consumed by each
13714 pass when it finishes.
13715
13716 @item -ftime-report-details
13717 @opindex ftime-report-details
13718 Record the time consumed by infrastructure parts separately for each pass.
13719
13720 @item -fira-verbose=@var{n}
13721 @opindex fira-verbose
13722 Control the verbosity of the dump file for the integrated register allocator.
13723 The default value is 5. If the value @var{n} is greater or equal to 10,
13724 the dump output is sent to stderr using the same format as @var{n} minus 10.
13725
13726 @item -flto-report
13727 @opindex flto-report
13728 Prints a report with internal details on the workings of the link-time
13729 optimizer. The contents of this report vary from version to version.
13730 It is meant to be useful to GCC developers when processing object
13731 files in LTO mode (via @option{-flto}).
13732
13733 Disabled by default.
13734
13735 @item -flto-report-wpa
13736 @opindex flto-report-wpa
13737 Like @option{-flto-report}, but only print for the WPA phase of Link
13738 Time Optimization.
13739
13740 @item -fmem-report
13741 @opindex fmem-report
13742 Makes the compiler print some statistics about permanent memory
13743 allocation when it finishes.
13744
13745 @item -fmem-report-wpa
13746 @opindex fmem-report-wpa
13747 Makes the compiler print some statistics about permanent memory
13748 allocation for the WPA phase only.
13749
13750 @item -fpre-ipa-mem-report
13751 @opindex fpre-ipa-mem-report
13752 @item -fpost-ipa-mem-report
13753 @opindex fpost-ipa-mem-report
13754 Makes the compiler print some statistics about permanent memory
13755 allocation before or after interprocedural optimization.
13756
13757 @item -fprofile-report
13758 @opindex fprofile-report
13759 Makes the compiler print some statistics about consistency of the
13760 (estimated) profile and effect of individual passes.
13761
13762 @item -fstack-usage
13763 @opindex fstack-usage
13764 Makes the compiler output stack usage information for the program, on a
13765 per-function basis. The filename for the dump is made by appending
13766 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
13767 the output file, if explicitly specified and it is not an executable,
13768 otherwise it is the basename of the source file. An entry is made up
13769 of three fields:
13770
13771 @itemize
13772 @item
13773 The name of the function.
13774 @item
13775 A number of bytes.
13776 @item
13777 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
13778 @end itemize
13779
13780 The qualifier @code{static} means that the function manipulates the stack
13781 statically: a fixed number of bytes are allocated for the frame on function
13782 entry and released on function exit; no stack adjustments are otherwise made
13783 in the function. The second field is this fixed number of bytes.
13784
13785 The qualifier @code{dynamic} means that the function manipulates the stack
13786 dynamically: in addition to the static allocation described above, stack
13787 adjustments are made in the body of the function, for example to push/pop
13788 arguments around function calls. If the qualifier @code{bounded} is also
13789 present, the amount of these adjustments is bounded at compile time and
13790 the second field is an upper bound of the total amount of stack used by
13791 the function. If it is not present, the amount of these adjustments is
13792 not bounded at compile time and the second field only represents the
13793 bounded part.
13794
13795 @item -fstats
13796 @opindex fstats
13797 Emit statistics about front-end processing at the end of the compilation.
13798 This option is supported only by the C++ front end, and
13799 the information is generally only useful to the G++ development team.
13800
13801 @item -fdbg-cnt-list
13802 @opindex fdbg-cnt-list
13803 Print the name and the counter upper bound for all debug counters.
13804
13805
13806 @item -fdbg-cnt=@var{counter-value-list}
13807 @opindex fdbg-cnt
13808 Set the internal debug counter upper bound. @var{counter-value-list}
13809 is a comma-separated list of @var{name}:@var{value} pairs
13810 which sets the upper bound of each debug counter @var{name} to @var{value}.
13811 All debug counters have the initial upper bound of @code{UINT_MAX};
13812 thus @code{dbg_cnt} returns true always unless the upper bound
13813 is set by this option.
13814 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
13815 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
13816
13817 @item -print-file-name=@var{library}
13818 @opindex print-file-name
13819 Print the full absolute name of the library file @var{library} that
13820 would be used when linking---and don't do anything else. With this
13821 option, GCC does not compile or link anything; it just prints the
13822 file name.
13823
13824 @item -print-multi-directory
13825 @opindex print-multi-directory
13826 Print the directory name corresponding to the multilib selected by any
13827 other switches present in the command line. This directory is supposed
13828 to exist in @env{GCC_EXEC_PREFIX}.
13829
13830 @item -print-multi-lib
13831 @opindex print-multi-lib
13832 Print the mapping from multilib directory names to compiler switches
13833 that enable them. The directory name is separated from the switches by
13834 @samp{;}, and each switch starts with an @samp{@@} instead of the
13835 @samp{-}, without spaces between multiple switches. This is supposed to
13836 ease shell processing.
13837
13838 @item -print-multi-os-directory
13839 @opindex print-multi-os-directory
13840 Print the path to OS libraries for the selected
13841 multilib, relative to some @file{lib} subdirectory. If OS libraries are
13842 present in the @file{lib} subdirectory and no multilibs are used, this is
13843 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
13844 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
13845 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
13846 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
13847
13848 @item -print-multiarch
13849 @opindex print-multiarch
13850 Print the path to OS libraries for the selected multiarch,
13851 relative to some @file{lib} subdirectory.
13852
13853 @item -print-prog-name=@var{program}
13854 @opindex print-prog-name
13855 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
13856
13857 @item -print-libgcc-file-name
13858 @opindex print-libgcc-file-name
13859 Same as @option{-print-file-name=libgcc.a}.
13860
13861 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
13862 but you do want to link with @file{libgcc.a}. You can do:
13863
13864 @smallexample
13865 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
13866 @end smallexample
13867
13868 @item -print-search-dirs
13869 @opindex print-search-dirs
13870 Print the name of the configured installation directory and a list of
13871 program and library directories @command{gcc} searches---and don't do anything else.
13872
13873 This is useful when @command{gcc} prints the error message
13874 @samp{installation problem, cannot exec cpp0: No such file or directory}.
13875 To resolve this you either need to put @file{cpp0} and the other compiler
13876 components where @command{gcc} expects to find them, or you can set the environment
13877 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
13878 Don't forget the trailing @samp{/}.
13879 @xref{Environment Variables}.
13880
13881 @item -print-sysroot
13882 @opindex print-sysroot
13883 Print the target sysroot directory that is used during
13884 compilation. This is the target sysroot specified either at configure
13885 time or using the @option{--sysroot} option, possibly with an extra
13886 suffix that depends on compilation options. If no target sysroot is
13887 specified, the option prints nothing.
13888
13889 @item -print-sysroot-headers-suffix
13890 @opindex print-sysroot-headers-suffix
13891 Print the suffix added to the target sysroot when searching for
13892 headers, or give an error if the compiler is not configured with such
13893 a suffix---and don't do anything else.
13894
13895 @item -dumpmachine
13896 @opindex dumpmachine
13897 Print the compiler's target machine (for example,
13898 @samp{i686-pc-linux-gnu})---and don't do anything else.
13899
13900 @item -dumpversion
13901 @opindex dumpversion
13902 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
13903 anything else. This is the compiler version used in filesystem paths,
13904 specs, can be depending on how the compiler has been configured just
13905 a single number (major version), two numbers separated by dot (major and
13906 minor version) or three numbers separated by dots (major, minor and patchlevel
13907 version).
13908
13909 @item -dumpfullversion
13910 @opindex dumpfullversion
13911 Print the full compiler version, always 3 numbers separated by dots,
13912 major, minor and patchlevel version.
13913
13914 @item -dumpspecs
13915 @opindex dumpspecs
13916 Print the compiler's built-in specs---and don't do anything else. (This
13917 is used when GCC itself is being built.) @xref{Spec Files}.
13918 @end table
13919
13920 @node Submodel Options
13921 @section Machine-Dependent Options
13922 @cindex submodel options
13923 @cindex specifying hardware config
13924 @cindex hardware models and configurations, specifying
13925 @cindex target-dependent options
13926 @cindex machine-dependent options
13927
13928 Each target machine supported by GCC can have its own options---for
13929 example, to allow you to compile for a particular processor variant or
13930 ABI, or to control optimizations specific to that machine. By
13931 convention, the names of machine-specific options start with
13932 @samp{-m}.
13933
13934 Some configurations of the compiler also support additional target-specific
13935 options, usually for compatibility with other compilers on the same
13936 platform.
13937
13938 @c This list is ordered alphanumerically by subsection name.
13939 @c It should be the same order and spelling as these options are listed
13940 @c in Machine Dependent Options
13941
13942 @menu
13943 * AArch64 Options::
13944 * Adapteva Epiphany Options::
13945 * ARC Options::
13946 * ARM Options::
13947 * AVR Options::
13948 * Blackfin Options::
13949 * C6X Options::
13950 * CRIS Options::
13951 * CR16 Options::
13952 * Darwin Options::
13953 * DEC Alpha Options::
13954 * FR30 Options::
13955 * FT32 Options::
13956 * FRV Options::
13957 * GNU/Linux Options::
13958 * H8/300 Options::
13959 * HPPA Options::
13960 * IA-64 Options::
13961 * LM32 Options::
13962 * M32C Options::
13963 * M32R/D Options::
13964 * M680x0 Options::
13965 * MCore Options::
13966 * MeP Options::
13967 * MicroBlaze Options::
13968 * MIPS Options::
13969 * MMIX Options::
13970 * MN10300 Options::
13971 * Moxie Options::
13972 * MSP430 Options::
13973 * NDS32 Options::
13974 * Nios II Options::
13975 * Nvidia PTX Options::
13976 * PDP-11 Options::
13977 * picoChip Options::
13978 * PowerPC Options::
13979 * RISC-V Options::
13980 * RL78 Options::
13981 * RS/6000 and PowerPC Options::
13982 * RX Options::
13983 * S/390 and zSeries Options::
13984 * Score Options::
13985 * SH Options::
13986 * Solaris 2 Options::
13987 * SPARC Options::
13988 * SPU Options::
13989 * System V Options::
13990 * TILE-Gx Options::
13991 * TILEPro Options::
13992 * V850 Options::
13993 * VAX Options::
13994 * Visium Options::
13995 * VMS Options::
13996 * VxWorks Options::
13997 * x86 Options::
13998 * x86 Windows Options::
13999 * Xstormy16 Options::
14000 * Xtensa Options::
14001 * zSeries Options::
14002 @end menu
14003
14004 @node AArch64 Options
14005 @subsection AArch64 Options
14006 @cindex AArch64 Options
14007
14008 These options are defined for AArch64 implementations:
14009
14010 @table @gcctabopt
14011
14012 @item -mabi=@var{name}
14013 @opindex mabi
14014 Generate code for the specified data model. Permissible values
14015 are @samp{ilp32} for SysV-like data model where int, long int and pointers
14016 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
14017 but long int and pointers are 64 bits.
14018
14019 The default depends on the specific target configuration. Note that
14020 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
14021 entire program with the same ABI, and link with a compatible set of libraries.
14022
14023 @item -mbig-endian
14024 @opindex mbig-endian
14025 Generate big-endian code. This is the default when GCC is configured for an
14026 @samp{aarch64_be-*-*} target.
14027
14028 @item -mgeneral-regs-only
14029 @opindex mgeneral-regs-only
14030 Generate code which uses only the general-purpose registers. This will prevent
14031 the compiler from using floating-point and Advanced SIMD registers but will not
14032 impose any restrictions on the assembler.
14033
14034 @item -mlittle-endian
14035 @opindex mlittle-endian
14036 Generate little-endian code. This is the default when GCC is configured for an
14037 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
14038
14039 @item -mcmodel=tiny
14040 @opindex mcmodel=tiny
14041 Generate code for the tiny code model. The program and its statically defined
14042 symbols must be within 1MB of each other. Programs can be statically or
14043 dynamically linked.
14044
14045 @item -mcmodel=small
14046 @opindex mcmodel=small
14047 Generate code for the small code model. The program and its statically defined
14048 symbols must be within 4GB of each other. Programs can be statically or
14049 dynamically linked. This is the default code model.
14050
14051 @item -mcmodel=large
14052 @opindex mcmodel=large
14053 Generate code for the large code model. This makes no assumptions about
14054 addresses and sizes of sections. Programs can be statically linked only.
14055
14056 @item -mstrict-align
14057 @opindex mstrict-align
14058 Avoid generating memory accesses that may not be aligned on a natural object
14059 boundary as described in the architecture specification.
14060
14061 @item -momit-leaf-frame-pointer
14062 @itemx -mno-omit-leaf-frame-pointer
14063 @opindex momit-leaf-frame-pointer
14064 @opindex mno-omit-leaf-frame-pointer
14065 Omit or keep the frame pointer in leaf functions. The former behavior is the
14066 default.
14067
14068 @item -mtls-dialect=desc
14069 @opindex mtls-dialect=desc
14070 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
14071 of TLS variables. This is the default.
14072
14073 @item -mtls-dialect=traditional
14074 @opindex mtls-dialect=traditional
14075 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
14076 of TLS variables.
14077
14078 @item -mtls-size=@var{size}
14079 @opindex mtls-size
14080 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
14081 This option requires binutils 2.26 or newer.
14082
14083 @item -mfix-cortex-a53-835769
14084 @itemx -mno-fix-cortex-a53-835769
14085 @opindex mfix-cortex-a53-835769
14086 @opindex mno-fix-cortex-a53-835769
14087 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
14088 This involves inserting a NOP instruction between memory instructions and
14089 64-bit integer multiply-accumulate instructions.
14090
14091 @item -mfix-cortex-a53-843419
14092 @itemx -mno-fix-cortex-a53-843419
14093 @opindex mfix-cortex-a53-843419
14094 @opindex mno-fix-cortex-a53-843419
14095 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
14096 This erratum workaround is made at link time and this will only pass the
14097 corresponding flag to the linker.
14098
14099 @item -mlow-precision-recip-sqrt
14100 @item -mno-low-precision-recip-sqrt
14101 @opindex mlow-precision-recip-sqrt
14102 @opindex mno-low-precision-recip-sqrt
14103 Enable or disable the reciprocal square root approximation.
14104 This option only has an effect if @option{-ffast-math} or
14105 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14106 precision of reciprocal square root results to about 16 bits for
14107 single precision and to 32 bits for double precision.
14108
14109 @item -mlow-precision-sqrt
14110 @item -mno-low-precision-sqrt
14111 @opindex -mlow-precision-sqrt
14112 @opindex -mno-low-precision-sqrt
14113 Enable or disable the square root approximation.
14114 This option only has an effect if @option{-ffast-math} or
14115 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14116 precision of square root results to about 16 bits for
14117 single precision and to 32 bits for double precision.
14118 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
14119
14120 @item -mlow-precision-div
14121 @item -mno-low-precision-div
14122 @opindex -mlow-precision-div
14123 @opindex -mno-low-precision-div
14124 Enable or disable the division approximation.
14125 This option only has an effect if @option{-ffast-math} or
14126 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14127 precision of division results to about 16 bits for
14128 single precision and to 32 bits for double precision.
14129
14130 @item -march=@var{name}
14131 @opindex march
14132 Specify the name of the target architecture and, optionally, one or
14133 more feature modifiers. This option has the form
14134 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
14135
14136 The permissible values for @var{arch} are @samp{armv8-a},
14137 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @var{native}.
14138
14139 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
14140 support for the ARMv8.3-A architecture extensions.
14141
14142 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
14143 support for the ARMv8.2-A architecture extensions.
14144
14145 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
14146 support for the ARMv8.1-A architecture extension. In particular, it
14147 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
14148
14149 The value @samp{native} is available on native AArch64 GNU/Linux and
14150 causes the compiler to pick the architecture of the host system. This
14151 option has no effect if the compiler is unable to recognize the
14152 architecture of the host system,
14153
14154 The permissible values for @var{feature} are listed in the sub-section
14155 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14156 Feature Modifiers}. Where conflicting feature modifiers are
14157 specified, the right-most feature is used.
14158
14159 GCC uses @var{name} to determine what kind of instructions it can emit
14160 when generating assembly code. If @option{-march} is specified
14161 without either of @option{-mtune} or @option{-mcpu} also being
14162 specified, the code is tuned to perform well across a range of target
14163 processors implementing the target architecture.
14164
14165 @item -mtune=@var{name}
14166 @opindex mtune
14167 Specify the name of the target processor for which GCC should tune the
14168 performance of the code. Permissible values for this option are:
14169 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
14170 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
14171 @samp{exynos-m1}, @samp{falkor}, @samp{qdf24xx},
14172 @samp{xgene1}, @samp{vulcan}, @samp{thunderx},
14173 @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
14174 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53},
14175 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
14176 @samp{cortex-a73.cortex-a53}, @samp{cortex-a75.cortex-a55},
14177 @samp{native}.
14178
14179 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14180 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
14181 @samp{cortex-a75.cortex-a55} specify that GCC should tune for a
14182 big.LITTLE system.
14183
14184 Additionally on native AArch64 GNU/Linux systems the value
14185 @samp{native} tunes performance to the host system. This option has no effect
14186 if the compiler is unable to recognize the processor of the host system.
14187
14188 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
14189 are specified, the code is tuned to perform well across a range
14190 of target processors.
14191
14192 This option cannot be suffixed by feature modifiers.
14193
14194 @item -mcpu=@var{name}
14195 @opindex mcpu
14196 Specify the name of the target processor, optionally suffixed by one
14197 or more feature modifiers. This option has the form
14198 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
14199 the permissible values for @var{cpu} are the same as those available
14200 for @option{-mtune}. The permissible values for @var{feature} are
14201 documented in the sub-section on
14202 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14203 Feature Modifiers}. Where conflicting feature modifiers are
14204 specified, the right-most feature is used.
14205
14206 GCC uses @var{name} to determine what kind of instructions it can emit when
14207 generating assembly code (as if by @option{-march}) and to determine
14208 the target processor for which to tune for performance (as if
14209 by @option{-mtune}). Where this option is used in conjunction
14210 with @option{-march} or @option{-mtune}, those options take precedence
14211 over the appropriate part of this option.
14212
14213 @item -moverride=@var{string}
14214 @opindex moverride
14215 Override tuning decisions made by the back-end in response to a
14216 @option{-mtune=} switch. The syntax, semantics, and accepted values
14217 for @var{string} in this option are not guaranteed to be consistent
14218 across releases.
14219
14220 This option is only intended to be useful when developing GCC.
14221
14222 @item -mpc-relative-literal-loads
14223 @itemx -mno-pc-relative-literal-loads
14224 @opindex mpc-relative-literal-loads
14225 @opindex mno-pc-relative-literal-loads
14226 Enable or disable PC-relative literal loads. With this option literal pools are
14227 accessed using a single instruction and emitted after each function. This
14228 limits the maximum size of functions to 1MB. This is enabled by default for
14229 @option{-mcmodel=tiny}.
14230
14231 @item -msign-return-address=@var{scope}
14232 @opindex msign-return-address
14233 Select the function scope on which return address signing will be applied.
14234 Permissible values are @samp{none}, which disables return address signing,
14235 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
14236 functions, and @samp{all}, which enables pointer signing for all functions. The
14237 default value is @samp{none}.
14238
14239 @end table
14240
14241 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
14242 @anchor{aarch64-feature-modifiers}
14243 @cindex @option{-march} feature modifiers
14244 @cindex @option{-mcpu} feature modifiers
14245 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
14246 the following and their inverses @option{no@var{feature}}:
14247
14248 @table @samp
14249 @item crc
14250 Enable CRC extension. This is on by default for
14251 @option{-march=armv8.1-a}.
14252 @item crypto
14253 Enable Crypto extension. This also enables Advanced SIMD and floating-point
14254 instructions.
14255 @item fp
14256 Enable floating-point instructions. This is on by default for all possible
14257 values for options @option{-march} and @option{-mcpu}.
14258 @item simd
14259 Enable Advanced SIMD instructions. This also enables floating-point
14260 instructions. This is on by default for all possible values for options
14261 @option{-march} and @option{-mcpu}.
14262 @item lse
14263 Enable Large System Extension instructions. This is on by default for
14264 @option{-march=armv8.1-a}.
14265 @item rdma
14266 Enable Round Double Multiply Accumulate instructions. This is on by default
14267 for @option{-march=armv8.1-a}.
14268 @item fp16
14269 Enable FP16 extension. This also enables floating-point instructions.
14270 @item rcpc
14271 Enable the RcPc extension. This does not change code generation from GCC,
14272 but is passed on to the assembler, enabling inline asm statements to use
14273 instructions from the RcPc extension.
14274
14275 @end table
14276
14277 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
14278 Conversely, @option{nofp} implies @option{nosimd}, which implies
14279 @option{nocrypto}.
14280
14281 @node Adapteva Epiphany Options
14282 @subsection Adapteva Epiphany Options
14283
14284 These @samp{-m} options are defined for Adapteva Epiphany:
14285
14286 @table @gcctabopt
14287 @item -mhalf-reg-file
14288 @opindex mhalf-reg-file
14289 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
14290 That allows code to run on hardware variants that lack these registers.
14291
14292 @item -mprefer-short-insn-regs
14293 @opindex mprefer-short-insn-regs
14294 Preferentially allocate registers that allow short instruction generation.
14295 This can result in increased instruction count, so this may either reduce or
14296 increase overall code size.
14297
14298 @item -mbranch-cost=@var{num}
14299 @opindex mbranch-cost
14300 Set the cost of branches to roughly @var{num} ``simple'' instructions.
14301 This cost is only a heuristic and is not guaranteed to produce
14302 consistent results across releases.
14303
14304 @item -mcmove
14305 @opindex mcmove
14306 Enable the generation of conditional moves.
14307
14308 @item -mnops=@var{num}
14309 @opindex mnops
14310 Emit @var{num} NOPs before every other generated instruction.
14311
14312 @item -mno-soft-cmpsf
14313 @opindex mno-soft-cmpsf
14314 For single-precision floating-point comparisons, emit an @code{fsub} instruction
14315 and test the flags. This is faster than a software comparison, but can
14316 get incorrect results in the presence of NaNs, or when two different small
14317 numbers are compared such that their difference is calculated as zero.
14318 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
14319 software comparisons.
14320
14321 @item -mstack-offset=@var{num}
14322 @opindex mstack-offset
14323 Set the offset between the top of the stack and the stack pointer.
14324 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
14325 can be used by leaf functions without stack allocation.
14326 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
14327 Note also that this option changes the ABI; compiling a program with a
14328 different stack offset than the libraries have been compiled with
14329 generally does not work.
14330 This option can be useful if you want to evaluate if a different stack
14331 offset would give you better code, but to actually use a different stack
14332 offset to build working programs, it is recommended to configure the
14333 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
14334
14335 @item -mno-round-nearest
14336 @opindex mno-round-nearest
14337 Make the scheduler assume that the rounding mode has been set to
14338 truncating. The default is @option{-mround-nearest}.
14339
14340 @item -mlong-calls
14341 @opindex mlong-calls
14342 If not otherwise specified by an attribute, assume all calls might be beyond
14343 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
14344 function address into a register before performing a (otherwise direct) call.
14345 This is the default.
14346
14347 @item -mshort-calls
14348 @opindex short-calls
14349 If not otherwise specified by an attribute, assume all direct calls are
14350 in the range of the @code{b} / @code{bl} instructions, so use these instructions
14351 for direct calls. The default is @option{-mlong-calls}.
14352
14353 @item -msmall16
14354 @opindex msmall16
14355 Assume addresses can be loaded as 16-bit unsigned values. This does not
14356 apply to function addresses for which @option{-mlong-calls} semantics
14357 are in effect.
14358
14359 @item -mfp-mode=@var{mode}
14360 @opindex mfp-mode
14361 Set the prevailing mode of the floating-point unit.
14362 This determines the floating-point mode that is provided and expected
14363 at function call and return time. Making this mode match the mode you
14364 predominantly need at function start can make your programs smaller and
14365 faster by avoiding unnecessary mode switches.
14366
14367 @var{mode} can be set to one the following values:
14368
14369 @table @samp
14370 @item caller
14371 Any mode at function entry is valid, and retained or restored when
14372 the function returns, and when it calls other functions.
14373 This mode is useful for compiling libraries or other compilation units
14374 you might want to incorporate into different programs with different
14375 prevailing FPU modes, and the convenience of being able to use a single
14376 object file outweighs the size and speed overhead for any extra
14377 mode switching that might be needed, compared with what would be needed
14378 with a more specific choice of prevailing FPU mode.
14379
14380 @item truncate
14381 This is the mode used for floating-point calculations with
14382 truncating (i.e.@: round towards zero) rounding mode. That includes
14383 conversion from floating point to integer.
14384
14385 @item round-nearest
14386 This is the mode used for floating-point calculations with
14387 round-to-nearest-or-even rounding mode.
14388
14389 @item int
14390 This is the mode used to perform integer calculations in the FPU, e.g.@:
14391 integer multiply, or integer multiply-and-accumulate.
14392 @end table
14393
14394 The default is @option{-mfp-mode=caller}
14395
14396 @item -mnosplit-lohi
14397 @itemx -mno-postinc
14398 @itemx -mno-postmodify
14399 @opindex mnosplit-lohi
14400 @opindex mno-postinc
14401 @opindex mno-postmodify
14402 Code generation tweaks that disable, respectively, splitting of 32-bit
14403 loads, generation of post-increment addresses, and generation of
14404 post-modify addresses. The defaults are @option{msplit-lohi},
14405 @option{-mpost-inc}, and @option{-mpost-modify}.
14406
14407 @item -mnovect-double
14408 @opindex mno-vect-double
14409 Change the preferred SIMD mode to SImode. The default is
14410 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
14411
14412 @item -max-vect-align=@var{num}
14413 @opindex max-vect-align
14414 The maximum alignment for SIMD vector mode types.
14415 @var{num} may be 4 or 8. The default is 8.
14416 Note that this is an ABI change, even though many library function
14417 interfaces are unaffected if they don't use SIMD vector modes
14418 in places that affect size and/or alignment of relevant types.
14419
14420 @item -msplit-vecmove-early
14421 @opindex msplit-vecmove-early
14422 Split vector moves into single word moves before reload. In theory this
14423 can give better register allocation, but so far the reverse seems to be
14424 generally the case.
14425
14426 @item -m1reg-@var{reg}
14427 @opindex m1reg-
14428 Specify a register to hold the constant @minus{}1, which makes loading small negative
14429 constants and certain bitmasks faster.
14430 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
14431 which specify use of that register as a fixed register,
14432 and @samp{none}, which means that no register is used for this
14433 purpose. The default is @option{-m1reg-none}.
14434
14435 @end table
14436
14437 @node ARC Options
14438 @subsection ARC Options
14439 @cindex ARC options
14440
14441 The following options control the architecture variant for which code
14442 is being compiled:
14443
14444 @c architecture variants
14445 @table @gcctabopt
14446
14447 @item -mbarrel-shifter
14448 @opindex mbarrel-shifter
14449 Generate instructions supported by barrel shifter. This is the default
14450 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
14451
14452 @item -mcpu=@var{cpu}
14453 @opindex mcpu
14454 Set architecture type, register usage, and instruction scheduling
14455 parameters for @var{cpu}. There are also shortcut alias options
14456 available for backward compatibility and convenience. Supported
14457 values for @var{cpu} are
14458
14459 @table @samp
14460 @opindex mA6
14461 @opindex mARC600
14462 @item arc600
14463 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
14464
14465 @item arc601
14466 @opindex mARC601
14467 Compile for ARC601. Alias: @option{-mARC601}.
14468
14469 @item arc700
14470 @opindex mA7
14471 @opindex mARC700
14472 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
14473 This is the default when configured with @option{--with-cpu=arc700}@.
14474
14475 @item arcem
14476 Compile for ARC EM.
14477
14478 @item archs
14479 Compile for ARC HS.
14480
14481 @item em
14482 Compile for ARC EM CPU with no hardware extensions.
14483
14484 @item em4
14485 Compile for ARC EM4 CPU.
14486
14487 @item em4_dmips
14488 Compile for ARC EM4 DMIPS CPU.
14489
14490 @item em4_fpus
14491 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
14492 extension.
14493
14494 @item em4_fpuda
14495 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
14496 double assist instructions.
14497
14498 @item hs
14499 Compile for ARC HS CPU with no hardware extensions except the atomic
14500 instructions.
14501
14502 @item hs34
14503 Compile for ARC HS34 CPU.
14504
14505 @item hs38
14506 Compile for ARC HS38 CPU.
14507
14508 @item hs38_linux
14509 Compile for ARC HS38 CPU with all hardware extensions on.
14510
14511 @item arc600_norm
14512 Compile for ARC 600 CPU with @code{norm} instructions enabled.
14513
14514 @item arc600_mul32x16
14515 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
14516 instructions enabled.
14517
14518 @item arc600_mul64
14519 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
14520 instructions enabled.
14521
14522 @item arc601_norm
14523 Compile for ARC 601 CPU with @code{norm} instructions enabled.
14524
14525 @item arc601_mul32x16
14526 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
14527 instructions enabled.
14528
14529 @item arc601_mul64
14530 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
14531 instructions enabled.
14532
14533 @item nps400
14534 Compile for ARC 700 on NPS400 chip.
14535
14536 @end table
14537
14538 @item -mdpfp
14539 @opindex mdpfp
14540 @itemx -mdpfp-compact
14541 @opindex mdpfp-compact
14542 Generate double-precision FPX instructions, tuned for the compact
14543 implementation.
14544
14545 @item -mdpfp-fast
14546 @opindex mdpfp-fast
14547 Generate double-precision FPX instructions, tuned for the fast
14548 implementation.
14549
14550 @item -mno-dpfp-lrsr
14551 @opindex mno-dpfp-lrsr
14552 Disable @code{lr} and @code{sr} instructions from using FPX extension
14553 aux registers.
14554
14555 @item -mea
14556 @opindex mea
14557 Generate extended arithmetic instructions. Currently only
14558 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
14559 supported. This is always enabled for @option{-mcpu=ARC700}.
14560
14561 @item -mno-mpy
14562 @opindex mno-mpy
14563 Do not generate @code{mpy}-family instructions for ARC700. This option is
14564 deprecated.
14565
14566 @item -mmul32x16
14567 @opindex mmul32x16
14568 Generate 32x16-bit multiply and multiply-accumulate instructions.
14569
14570 @item -mmul64
14571 @opindex mmul64
14572 Generate @code{mul64} and @code{mulu64} instructions.
14573 Only valid for @option{-mcpu=ARC600}.
14574
14575 @item -mnorm
14576 @opindex mnorm
14577 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
14578 is in effect.
14579
14580 @item -mspfp
14581 @opindex mspfp
14582 @itemx -mspfp-compact
14583 @opindex mspfp-compact
14584 Generate single-precision FPX instructions, tuned for the compact
14585 implementation.
14586
14587 @item -mspfp-fast
14588 @opindex mspfp-fast
14589 Generate single-precision FPX instructions, tuned for the fast
14590 implementation.
14591
14592 @item -msimd
14593 @opindex msimd
14594 Enable generation of ARC SIMD instructions via target-specific
14595 builtins. Only valid for @option{-mcpu=ARC700}.
14596
14597 @item -msoft-float
14598 @opindex msoft-float
14599 This option ignored; it is provided for compatibility purposes only.
14600 Software floating-point code is emitted by default, and this default
14601 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
14602 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
14603 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
14604
14605 @item -mswap
14606 @opindex mswap
14607 Generate @code{swap} instructions.
14608
14609 @item -matomic
14610 @opindex matomic
14611 This enables use of the locked load/store conditional extension to implement
14612 atomic memory built-in functions. Not available for ARC 6xx or ARC
14613 EM cores.
14614
14615 @item -mdiv-rem
14616 @opindex mdiv-rem
14617 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
14618
14619 @item -mcode-density
14620 @opindex mcode-density
14621 Enable code density instructions for ARC EM.
14622 This option is on by default for ARC HS.
14623
14624 @item -mll64
14625 @opindex mll64
14626 Enable double load/store operations for ARC HS cores.
14627
14628 @item -mtp-regno=@var{regno}
14629 @opindex mtp-regno
14630 Specify thread pointer register number.
14631
14632 @item -mmpy-option=@var{multo}
14633 @opindex mmpy-option
14634 Compile ARCv2 code with a multiplier design option. You can specify
14635 the option using either a string or numeric value for @var{multo}.
14636 @samp{wlh1} is the default value. The recognized values are:
14637
14638 @table @samp
14639 @item 0
14640 @itemx none
14641 No multiplier available.
14642
14643 @item 1
14644 @itemx w
14645 16x16 multiplier, fully pipelined.
14646 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
14647
14648 @item 2
14649 @itemx wlh1
14650 32x32 multiplier, fully
14651 pipelined (1 stage). The following instructions are additionally
14652 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14653
14654 @item 3
14655 @itemx wlh2
14656 32x32 multiplier, fully pipelined
14657 (2 stages). The following instructions are additionally enabled: @code{mpy},
14658 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14659
14660 @item 4
14661 @itemx wlh3
14662 Two 16x16 multipliers, blocking,
14663 sequential. The following instructions are additionally enabled: @code{mpy},
14664 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14665
14666 @item 5
14667 @itemx wlh4
14668 One 16x16 multiplier, blocking,
14669 sequential. The following instructions are additionally enabled: @code{mpy},
14670 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14671
14672 @item 6
14673 @itemx wlh5
14674 One 32x4 multiplier, blocking,
14675 sequential. The following instructions are additionally enabled: @code{mpy},
14676 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14677
14678 @item 7
14679 @itemx plus_dmpy
14680 ARC HS SIMD support.
14681
14682 @item 8
14683 @itemx plus_macd
14684 ARC HS SIMD support.
14685
14686 @item 9
14687 @itemx plus_qmacw
14688 ARC HS SIMD support.
14689
14690 @end table
14691
14692 This option is only available for ARCv2 cores@.
14693
14694 @item -mfpu=@var{fpu}
14695 @opindex mfpu
14696 Enables support for specific floating-point hardware extensions for ARCv2
14697 cores. Supported values for @var{fpu} are:
14698
14699 @table @samp
14700
14701 @item fpus
14702 Enables support for single-precision floating-point hardware
14703 extensions@.
14704
14705 @item fpud
14706 Enables support for double-precision floating-point hardware
14707 extensions. The single-precision floating-point extension is also
14708 enabled. Not available for ARC EM@.
14709
14710 @item fpuda
14711 Enables support for double-precision floating-point hardware
14712 extensions using double-precision assist instructions. The single-precision
14713 floating-point extension is also enabled. This option is
14714 only available for ARC EM@.
14715
14716 @item fpuda_div
14717 Enables support for double-precision floating-point hardware
14718 extensions using double-precision assist instructions.
14719 The single-precision floating-point, square-root, and divide
14720 extensions are also enabled. This option is
14721 only available for ARC EM@.
14722
14723 @item fpuda_fma
14724 Enables support for double-precision floating-point hardware
14725 extensions using double-precision assist instructions.
14726 The single-precision floating-point and fused multiply and add
14727 hardware extensions are also enabled. This option is
14728 only available for ARC EM@.
14729
14730 @item fpuda_all
14731 Enables support for double-precision floating-point hardware
14732 extensions using double-precision assist instructions.
14733 All single-precision floating-point hardware extensions are also
14734 enabled. This option is only available for ARC EM@.
14735
14736 @item fpus_div
14737 Enables support for single-precision floating-point, square-root and divide
14738 hardware extensions@.
14739
14740 @item fpud_div
14741 Enables support for double-precision floating-point, square-root and divide
14742 hardware extensions. This option
14743 includes option @samp{fpus_div}. Not available for ARC EM@.
14744
14745 @item fpus_fma
14746 Enables support for single-precision floating-point and
14747 fused multiply and add hardware extensions@.
14748
14749 @item fpud_fma
14750 Enables support for double-precision floating-point and
14751 fused multiply and add hardware extensions. This option
14752 includes option @samp{fpus_fma}. Not available for ARC EM@.
14753
14754 @item fpus_all
14755 Enables support for all single-precision floating-point hardware
14756 extensions@.
14757
14758 @item fpud_all
14759 Enables support for all single- and double-precision floating-point
14760 hardware extensions. Not available for ARC EM@.
14761
14762 @end table
14763
14764 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
14765 @opindex mirq-ctrl-saved
14766 Specifies general-purposes registers that the processor automatically
14767 saves/restores on interrupt entry and exit. @var{register-range} is
14768 specified as two registers separated by a dash. The register range
14769 always starts with @code{r0}, the upper limit is @code{fp} register.
14770 @var{blink} and @var{lp_count} are optional. This option is only
14771 valid for ARC EM and ARC HS cores.
14772
14773 @item -mrgf-banked-regs=@var{number}
14774 @opindex mrgf-banked-regs
14775 Specifies the number of registers replicated in second register bank
14776 on entry to fast interrupt. Fast interrupts are interrupts with the
14777 highest priority level P0. These interrupts save only PC and STATUS32
14778 registers to avoid memory transactions during interrupt entry and exit
14779 sequences. Use this option when you are using fast interrupts in an
14780 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
14781
14782 @item -mlpc-width=@var{width}
14783 @opindex mlpc-width
14784 Specify the width of the @code{lp_count} register. Valid values for
14785 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
14786 fixed to 32 bits. If the width is less than 32, the compiler does not
14787 attempt to transform loops in your program to use the zero-delay loop
14788 mechanism unless it is known that the @code{lp_count} register can
14789 hold the required loop-counter value. Depending on the width
14790 specified, the compiler and run-time library might continue to use the
14791 loop mechanism for various needs. This option defines macro
14792 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
14793
14794 @end table
14795
14796 The following options are passed through to the assembler, and also
14797 define preprocessor macro symbols.
14798
14799 @c Flags used by the assembler, but for which we define preprocessor
14800 @c macro symbols as well.
14801 @table @gcctabopt
14802 @item -mdsp-packa
14803 @opindex mdsp-packa
14804 Passed down to the assembler to enable the DSP Pack A extensions.
14805 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
14806 deprecated.
14807
14808 @item -mdvbf
14809 @opindex mdvbf
14810 Passed down to the assembler to enable the dual Viterbi butterfly
14811 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
14812 option is deprecated.
14813
14814 @c ARC700 4.10 extension instruction
14815 @item -mlock
14816 @opindex mlock
14817 Passed down to the assembler to enable the locked load/store
14818 conditional extension. Also sets the preprocessor symbol
14819 @code{__Xlock}.
14820
14821 @item -mmac-d16
14822 @opindex mmac-d16
14823 Passed down to the assembler. Also sets the preprocessor symbol
14824 @code{__Xxmac_d16}. This option is deprecated.
14825
14826 @item -mmac-24
14827 @opindex mmac-24
14828 Passed down to the assembler. Also sets the preprocessor symbol
14829 @code{__Xxmac_24}. This option is deprecated.
14830
14831 @c ARC700 4.10 extension instruction
14832 @item -mrtsc
14833 @opindex mrtsc
14834 Passed down to the assembler to enable the 64-bit time-stamp counter
14835 extension instruction. Also sets the preprocessor symbol
14836 @code{__Xrtsc}. This option is deprecated.
14837
14838 @c ARC700 4.10 extension instruction
14839 @item -mswape
14840 @opindex mswape
14841 Passed down to the assembler to enable the swap byte ordering
14842 extension instruction. Also sets the preprocessor symbol
14843 @code{__Xswape}.
14844
14845 @item -mtelephony
14846 @opindex mtelephony
14847 Passed down to the assembler to enable dual- and single-operand
14848 instructions for telephony. Also sets the preprocessor symbol
14849 @code{__Xtelephony}. This option is deprecated.
14850
14851 @item -mxy
14852 @opindex mxy
14853 Passed down to the assembler to enable the XY memory extension. Also
14854 sets the preprocessor symbol @code{__Xxy}.
14855
14856 @end table
14857
14858 The following options control how the assembly code is annotated:
14859
14860 @c Assembly annotation options
14861 @table @gcctabopt
14862 @item -misize
14863 @opindex misize
14864 Annotate assembler instructions with estimated addresses.
14865
14866 @item -mannotate-align
14867 @opindex mannotate-align
14868 Explain what alignment considerations lead to the decision to make an
14869 instruction short or long.
14870
14871 @end table
14872
14873 The following options are passed through to the linker:
14874
14875 @c options passed through to the linker
14876 @table @gcctabopt
14877 @item -marclinux
14878 @opindex marclinux
14879 Passed through to the linker, to specify use of the @code{arclinux} emulation.
14880 This option is enabled by default in tool chains built for
14881 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
14882 when profiling is not requested.
14883
14884 @item -marclinux_prof
14885 @opindex marclinux_prof
14886 Passed through to the linker, to specify use of the
14887 @code{arclinux_prof} emulation. This option is enabled by default in
14888 tool chains built for @w{@code{arc-linux-uclibc}} and
14889 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
14890
14891 @end table
14892
14893 The following options control the semantics of generated code:
14894
14895 @c semantically relevant code generation options
14896 @table @gcctabopt
14897 @item -mlong-calls
14898 @opindex mlong-calls
14899 Generate calls as register indirect calls, thus providing access
14900 to the full 32-bit address range.
14901
14902 @item -mmedium-calls
14903 @opindex mmedium-calls
14904 Don't use less than 25-bit addressing range for calls, which is the
14905 offset available for an unconditional branch-and-link
14906 instruction. Conditional execution of function calls is suppressed, to
14907 allow use of the 25-bit range, rather than the 21-bit range with
14908 conditional branch-and-link. This is the default for tool chains built
14909 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
14910
14911 @item -G @var{num}
14912 @opindex G
14913 Put definitions of externally-visible data in a small data section if
14914 that data is no bigger than @var{num} bytes. The default value of
14915 @var{num} is 4 for any ARC configuration, or 8 when we have double
14916 load/store operations.
14917
14918 @item -mno-sdata
14919 @opindex mno-sdata
14920 Do not generate sdata references. This is the default for tool chains
14921 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
14922 targets.
14923
14924 @item -mvolatile-cache
14925 @opindex mvolatile-cache
14926 Use ordinarily cached memory accesses for volatile references. This is the
14927 default.
14928
14929 @item -mno-volatile-cache
14930 @opindex mno-volatile-cache
14931 Enable cache bypass for volatile references.
14932
14933 @end table
14934
14935 The following options fine tune code generation:
14936 @c code generation tuning options
14937 @table @gcctabopt
14938 @item -malign-call
14939 @opindex malign-call
14940 Do alignment optimizations for call instructions.
14941
14942 @item -mauto-modify-reg
14943 @opindex mauto-modify-reg
14944 Enable the use of pre/post modify with register displacement.
14945
14946 @item -mbbit-peephole
14947 @opindex mbbit-peephole
14948 Enable bbit peephole2.
14949
14950 @item -mno-brcc
14951 @opindex mno-brcc
14952 This option disables a target-specific pass in @file{arc_reorg} to
14953 generate compare-and-branch (@code{br@var{cc}}) instructions.
14954 It has no effect on
14955 generation of these instructions driven by the combiner pass.
14956
14957 @item -mcase-vector-pcrel
14958 @opindex mcase-vector-pcrel
14959 Use PC-relative switch case tables to enable case table shortening.
14960 This is the default for @option{-Os}.
14961
14962 @item -mcompact-casesi
14963 @opindex mcompact-casesi
14964 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
14965 and only available for ARCv1 cores.
14966
14967 @item -mno-cond-exec
14968 @opindex mno-cond-exec
14969 Disable the ARCompact-specific pass to generate conditional
14970 execution instructions.
14971
14972 Due to delay slot scheduling and interactions between operand numbers,
14973 literal sizes, instruction lengths, and the support for conditional execution,
14974 the target-independent pass to generate conditional execution is often lacking,
14975 so the ARC port has kept a special pass around that tries to find more
14976 conditional execution generation opportunities after register allocation,
14977 branch shortening, and delay slot scheduling have been done. This pass
14978 generally, but not always, improves performance and code size, at the cost of
14979 extra compilation time, which is why there is an option to switch it off.
14980 If you have a problem with call instructions exceeding their allowable
14981 offset range because they are conditionalized, you should consider using
14982 @option{-mmedium-calls} instead.
14983
14984 @item -mearly-cbranchsi
14985 @opindex mearly-cbranchsi
14986 Enable pre-reload use of the @code{cbranchsi} pattern.
14987
14988 @item -mexpand-adddi
14989 @opindex mexpand-adddi
14990 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
14991 @code{add.f}, @code{adc} etc. This option is deprecated.
14992
14993 @item -mindexed-loads
14994 @opindex mindexed-loads
14995 Enable the use of indexed loads. This can be problematic because some
14996 optimizers then assume that indexed stores exist, which is not
14997 the case.
14998
14999 @opindex mlra
15000 Enable Local Register Allocation. This is still experimental for ARC,
15001 so by default the compiler uses standard reload
15002 (i.e. @option{-mno-lra}).
15003
15004 @item -mlra-priority-none
15005 @opindex mlra-priority-none
15006 Don't indicate any priority for target registers.
15007
15008 @item -mlra-priority-compact
15009 @opindex mlra-priority-compact
15010 Indicate target register priority for r0..r3 / r12..r15.
15011
15012 @item -mlra-priority-noncompact
15013 @opindex mlra-priority-noncompact
15014 Reduce target register priority for r0..r3 / r12..r15.
15015
15016 @item -mno-millicode
15017 @opindex mno-millicode
15018 When optimizing for size (using @option{-Os}), prologues and epilogues
15019 that have to save or restore a large number of registers are often
15020 shortened by using call to a special function in libgcc; this is
15021 referred to as a @emph{millicode} call. As these calls can pose
15022 performance issues, and/or cause linking issues when linking in a
15023 nonstandard way, this option is provided to turn off millicode call
15024 generation.
15025
15026 @item -mmixed-code
15027 @opindex mmixed-code
15028 Tweak register allocation to help 16-bit instruction generation.
15029 This generally has the effect of decreasing the average instruction size
15030 while increasing the instruction count.
15031
15032 @item -mq-class
15033 @opindex mq-class
15034 Enable @samp{q} instruction alternatives.
15035 This is the default for @option{-Os}.
15036
15037 @item -mRcq
15038 @opindex mRcq
15039 Enable @samp{Rcq} constraint handling.
15040 Most short code generation depends on this.
15041 This is the default.
15042
15043 @item -mRcw
15044 @opindex mRcw
15045 Enable @samp{Rcw} constraint handling.
15046 Most ccfsm condexec mostly depends on this.
15047 This is the default.
15048
15049 @item -msize-level=@var{level}
15050 @opindex msize-level
15051 Fine-tune size optimization with regards to instruction lengths and alignment.
15052 The recognized values for @var{level} are:
15053 @table @samp
15054 @item 0
15055 No size optimization. This level is deprecated and treated like @samp{1}.
15056
15057 @item 1
15058 Short instructions are used opportunistically.
15059
15060 @item 2
15061 In addition, alignment of loops and of code after barriers are dropped.
15062
15063 @item 3
15064 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
15065
15066 @end table
15067
15068 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
15069 the behavior when this is not set is equivalent to level @samp{1}.
15070
15071 @item -mtune=@var{cpu}
15072 @opindex mtune
15073 Set instruction scheduling parameters for @var{cpu}, overriding any implied
15074 by @option{-mcpu=}.
15075
15076 Supported values for @var{cpu} are
15077
15078 @table @samp
15079 @item ARC600
15080 Tune for ARC600 CPU.
15081
15082 @item ARC601
15083 Tune for ARC601 CPU.
15084
15085 @item ARC700
15086 Tune for ARC700 CPU with standard multiplier block.
15087
15088 @item ARC700-xmac
15089 Tune for ARC700 CPU with XMAC block.
15090
15091 @item ARC725D
15092 Tune for ARC725D CPU.
15093
15094 @item ARC750D
15095 Tune for ARC750D CPU.
15096
15097 @end table
15098
15099 @item -mmultcost=@var{num}
15100 @opindex mmultcost
15101 Cost to assume for a multiply instruction, with @samp{4} being equal to a
15102 normal instruction.
15103
15104 @item -munalign-prob-threshold=@var{probability}
15105 @opindex munalign-prob-threshold
15106 Set probability threshold for unaligning branches.
15107 When tuning for @samp{ARC700} and optimizing for speed, branches without
15108 filled delay slot are preferably emitted unaligned and long, unless
15109 profiling indicates that the probability for the branch to be taken
15110 is below @var{probability}. @xref{Cross-profiling}.
15111 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
15112
15113 @end table
15114
15115 The following options are maintained for backward compatibility, but
15116 are now deprecated and will be removed in a future release:
15117
15118 @c Deprecated options
15119 @table @gcctabopt
15120
15121 @item -margonaut
15122 @opindex margonaut
15123 Obsolete FPX.
15124
15125 @item -mbig-endian
15126 @opindex mbig-endian
15127 @itemx -EB
15128 @opindex EB
15129 Compile code for big-endian targets. Use of these options is now
15130 deprecated. Big-endian code is supported by configuring GCC to build
15131 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
15132 for which big endian is the default.
15133
15134 @item -mlittle-endian
15135 @opindex mlittle-endian
15136 @itemx -EL
15137 @opindex EL
15138 Compile code for little-endian targets. Use of these options is now
15139 deprecated. Little-endian code is supported by configuring GCC to build
15140 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
15141 for which little endian is the default.
15142
15143 @item -mbarrel_shifter
15144 @opindex mbarrel_shifter
15145 Replaced by @option{-mbarrel-shifter}.
15146
15147 @item -mdpfp_compact
15148 @opindex mdpfp_compact
15149 Replaced by @option{-mdpfp-compact}.
15150
15151 @item -mdpfp_fast
15152 @opindex mdpfp_fast
15153 Replaced by @option{-mdpfp-fast}.
15154
15155 @item -mdsp_packa
15156 @opindex mdsp_packa
15157 Replaced by @option{-mdsp-packa}.
15158
15159 @item -mEA
15160 @opindex mEA
15161 Replaced by @option{-mea}.
15162
15163 @item -mmac_24
15164 @opindex mmac_24
15165 Replaced by @option{-mmac-24}.
15166
15167 @item -mmac_d16
15168 @opindex mmac_d16
15169 Replaced by @option{-mmac-d16}.
15170
15171 @item -mspfp_compact
15172 @opindex mspfp_compact
15173 Replaced by @option{-mspfp-compact}.
15174
15175 @item -mspfp_fast
15176 @opindex mspfp_fast
15177 Replaced by @option{-mspfp-fast}.
15178
15179 @item -mtune=@var{cpu}
15180 @opindex mtune
15181 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
15182 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
15183 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
15184
15185 @item -multcost=@var{num}
15186 @opindex multcost
15187 Replaced by @option{-mmultcost}.
15188
15189 @end table
15190
15191 @node ARM Options
15192 @subsection ARM Options
15193 @cindex ARM options
15194
15195 These @samp{-m} options are defined for the ARM port:
15196
15197 @table @gcctabopt
15198 @item -mabi=@var{name}
15199 @opindex mabi
15200 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
15201 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
15202
15203 @item -mapcs-frame
15204 @opindex mapcs-frame
15205 Generate a stack frame that is compliant with the ARM Procedure Call
15206 Standard for all functions, even if this is not strictly necessary for
15207 correct execution of the code. Specifying @option{-fomit-frame-pointer}
15208 with this option causes the stack frames not to be generated for
15209 leaf functions. The default is @option{-mno-apcs-frame}.
15210 This option is deprecated.
15211
15212 @item -mapcs
15213 @opindex mapcs
15214 This is a synonym for @option{-mapcs-frame} and is deprecated.
15215
15216 @ignore
15217 @c not currently implemented
15218 @item -mapcs-stack-check
15219 @opindex mapcs-stack-check
15220 Generate code to check the amount of stack space available upon entry to
15221 every function (that actually uses some stack space). If there is
15222 insufficient space available then either the function
15223 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
15224 called, depending upon the amount of stack space required. The runtime
15225 system is required to provide these functions. The default is
15226 @option{-mno-apcs-stack-check}, since this produces smaller code.
15227
15228 @c not currently implemented
15229 @item -mapcs-reentrant
15230 @opindex mapcs-reentrant
15231 Generate reentrant, position-independent code. The default is
15232 @option{-mno-apcs-reentrant}.
15233 @end ignore
15234
15235 @item -mthumb-interwork
15236 @opindex mthumb-interwork
15237 Generate code that supports calling between the ARM and Thumb
15238 instruction sets. Without this option, on pre-v5 architectures, the
15239 two instruction sets cannot be reliably used inside one program. The
15240 default is @option{-mno-thumb-interwork}, since slightly larger code
15241 is generated when @option{-mthumb-interwork} is specified. In AAPCS
15242 configurations this option is meaningless.
15243
15244 @item -mno-sched-prolog
15245 @opindex mno-sched-prolog
15246 Prevent the reordering of instructions in the function prologue, or the
15247 merging of those instruction with the instructions in the function's
15248 body. This means that all functions start with a recognizable set
15249 of instructions (or in fact one of a choice from a small set of
15250 different function prologues), and this information can be used to
15251 locate the start of functions inside an executable piece of code. The
15252 default is @option{-msched-prolog}.
15253
15254 @item -mfloat-abi=@var{name}
15255 @opindex mfloat-abi
15256 Specifies which floating-point ABI to use. Permissible values
15257 are: @samp{soft}, @samp{softfp} and @samp{hard}.
15258
15259 Specifying @samp{soft} causes GCC to generate output containing
15260 library calls for floating-point operations.
15261 @samp{softfp} allows the generation of code using hardware floating-point
15262 instructions, but still uses the soft-float calling conventions.
15263 @samp{hard} allows generation of floating-point instructions
15264 and uses FPU-specific calling conventions.
15265
15266 The default depends on the specific target configuration. Note that
15267 the hard-float and soft-float ABIs are not link-compatible; you must
15268 compile your entire program with the same ABI, and link with a
15269 compatible set of libraries.
15270
15271 @item -mlittle-endian
15272 @opindex mlittle-endian
15273 Generate code for a processor running in little-endian mode. This is
15274 the default for all standard configurations.
15275
15276 @item -mbig-endian
15277 @opindex mbig-endian
15278 Generate code for a processor running in big-endian mode; the default is
15279 to compile code for a little-endian processor.
15280
15281 @item -mbe8
15282 @itemx -mbe32
15283 @opindex mbe8
15284 When linking a big-endian image select between BE8 and BE32 formats.
15285 The option has no effect for little-endian images and is ignored. The
15286 default is dependent on the selected target architecture. For ARMv6
15287 and later architectures the default is BE8, for older architectures
15288 the default is BE32. BE32 format has been deprecated by ARM.
15289
15290 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
15291 @opindex march
15292 This specifies the name of the target ARM architecture. GCC uses this
15293 name to determine what kind of instructions it can emit when generating
15294 assembly code. This option can be used in conjunction with or instead
15295 of the @option{-mcpu=} option.
15296
15297 Permissible names are:
15298 @samp{armv4t},
15299 @samp{armv5t}, @samp{armv5te},
15300 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
15301 @samp{armv6z}, @samp{armv6zk},
15302 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
15303 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a},
15304 @samp{armv7-r},
15305 @samp{armv8-r},
15306 @samp{armv6-m}, @samp{armv6s-m},
15307 @samp{armv7-m}, @samp{armv7e-m},
15308 @samp{armv8-m.base}, @samp{armv8-m.main},
15309 @samp{iwmmxt} and @samp{iwmmxt2}.
15310
15311 Additionally, the following architectures, which lack support for the
15312 Thumb exection state, are recognized but support is deprecated:
15313 @samp{armv2}, @samp{armv2a}, @samp{armv3}, @samp{armv3m},
15314 @samp{armv4}, @samp{armv5} and @samp{armv5e}.
15315
15316 Many of the architectures support extensions. These can be added by
15317 appending @samp{+@var{extension}} to the architecture name. Extension
15318 options are processed in order and capabilities accumulate. An extension
15319 will also enable any necessary base extensions
15320 upon which it depends. For example, the @samp{+crypto} extension
15321 will always enable the @samp{+simd} extension. The exception to the
15322 additive construction is for extensions that are prefixed with
15323 @samp{+no@dots{}}: these extensions disable the specified option and
15324 any other extensions that may depend on the presence of that
15325 extension.
15326
15327 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
15328 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
15329 entirely disabled by the @samp{+nofp} option that follows it.
15330
15331 Most extension names are generically named, but have an effect that is
15332 dependent upon the architecture to which it is applied. For example,
15333 the @samp{+simd} option can be applied to both @samp{armv7-a} and
15334 @samp{armv8-a} architectures, but will enable the original ARMv7
15335 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-a
15336 variant for @samp{armv8-a}.
15337
15338 The table below lists the supported extensions for each architecture.
15339 Architectures not mentioned do not support any extensions.
15340
15341 @table @samp
15342 @item armv5e
15343 @itemx armv5te
15344 @itemx armv6
15345 @itemx armv6j
15346 @itemx armv6k
15347 @itemx armv6kz
15348 @itemx armv6t2
15349 @itemx armv6z
15350 @itemx armv6zk
15351 @table @samp
15352 @item +fp
15353 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
15354 used as an alias for this extension.
15355
15356 @item +nofp
15357 Disable the floating-point instructions.
15358 @end table
15359
15360 @item armv7
15361 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
15362 @table @samp
15363 @item +fp
15364 The VFPv3 floating-point instructions, with 16 double-precision
15365 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15366 for this extension. Note that floating-point is not supported by the
15367 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
15368 ARMv7-R architectures.
15369
15370 @item +nofp
15371 Disable the floating-point instructions.
15372 @end table
15373
15374 @item armv7-a
15375 @table @samp
15376 @item +fp
15377 The VFPv3 floating-point instructions, with 16 double-precision
15378 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15379 for this extension.
15380
15381 @item +simd
15382 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
15383 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
15384 for this extension.
15385
15386 @item +vfpv3
15387 The VFPv3 floating-point instructions, with 32 double-precision
15388 registers.
15389
15390 @item +vfpv3-d16-fp16
15391 The VFPv3 floating-point instructions, with 16 double-precision
15392 registers and the half-precision floating-point conversion operations.
15393
15394 @item +vfpv3-fp16
15395 The VFPv3 floating-point instructions, with 32 double-precision
15396 registers and the half-precision floating-point conversion operations.
15397
15398 @item +vfpv4-d16
15399 The VFPv4 floating-point instructions, with 16 double-precision
15400 registers.
15401
15402 @item +vfpv4
15403 The VFPv4 floating-point instructions, with 32 double-precision
15404 registers.
15405
15406 @item +neon-fp16
15407 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
15408 the half-precision floating-point conversion operations.
15409
15410 @item +neon-vfpv4
15411 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
15412
15413 @item +nosimd
15414 Disable the Advanced SIMD instructions (does not disable floating point).
15415
15416 @item +nofp
15417 Disable the floating-point and Advanced SIMD instructions.
15418 @end table
15419
15420 @item armv7ve
15421 The extended version of the ARMv7-A architecture with support for
15422 virtualization.
15423 @table @samp
15424 @item +fp
15425 The VFPv4 floating-point instructions, with 16 double-precision registers.
15426 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
15427
15428 @item +simd
15429 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
15430 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
15431
15432 @item +vfpv3-d16
15433 The VFPv3 floating-point instructions, with 16 double-precision
15434 registers.
15435
15436 @item +vfpv3
15437 The VFPv3 floating-point instructions, with 32 double-precision
15438 registers.
15439
15440 @item +vfpv3-d16-fp16
15441 The VFPv3 floating-point instructions, with 16 double-precision
15442 registers and the half-precision floating-point conversion operations.
15443
15444 @item +vfpv3-fp16
15445 The VFPv3 floating-point instructions, with 32 double-precision
15446 registers and the half-precision floating-point conversion operations.
15447
15448 @item +vfpv4-d16
15449 The VFPv4 floating-point instructions, with 16 double-precision
15450 registers.
15451
15452 @item +vfpv4
15453 The VFPv4 floating-point instructions, with 32 double-precision
15454 registers.
15455
15456 @item +neon
15457 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
15458 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
15459
15460 @item +neon-fp16
15461 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
15462 the half-precision floating-point conversion operations.
15463
15464 @item +nosimd
15465 Disable the Advanced SIMD instructions (does not disable floating point).
15466
15467 @item +nofp
15468 Disable the floating-point and Advanced SIMD instructions.
15469 @end table
15470
15471 @item armv8-a
15472 @table @samp
15473 @item +crc
15474 The Cyclic Redundancy Check (CRC) instructions.
15475 @item +simd
15476 The ARMv8 Advanced SIMD and floating-point instructions.
15477 @item +crypto
15478 The cryptographic instructions.
15479 @item +nocrypto
15480 Disable the cryptographic isntructions.
15481 @item +nofp
15482 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15483 @end table
15484
15485 @item armv8.1-a
15486 @table @samp
15487 @item +simd
15488 The ARMv8.1 Advanced SIMD and floating-point instructions.
15489
15490 @item +crypto
15491 The cryptographic instructions. This also enables the Advanced SIMD and
15492 floating-point instructions.
15493
15494 @item +nocrypto
15495 Disable the cryptographic isntructions.
15496
15497 @item +nofp
15498 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15499 @end table
15500
15501 @item armv8.2-a
15502 @table @samp
15503 @item +fp16
15504 The half-precision floating-point data processing instructions.
15505 This also enables the Advanced SIMD and floating-point instructions.
15506
15507 @item +simd
15508 The ARMv8.1 Advanced SIMD and floating-point instructions.
15509
15510 @item +crypto
15511 The cryptographic instructions. This also enables the Advanced SIMD and
15512 floating-point instructions.
15513
15514 @item +nocrypto
15515 Disable the cryptographic extension.
15516
15517 @item +nofp
15518 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15519 @end table
15520
15521 @item armv7-r
15522 @table @samp
15523 @item +fp.sp
15524 The single-precision VFPv3 floating-point instructions. The extension
15525 @samp{+vfpv3xd} can be used as an alias for this extension.
15526
15527 @item +fp
15528 The VFPv3 floating-point instructions with 16 double-precision registers.
15529 The extension +vfpv3-d16 can be used as an alias for this extension.
15530
15531 @item +nofp
15532 Disable the floating-point extension.
15533
15534 @item +idiv
15535 The ARM-state integer division instructions.
15536
15537 @item +noidiv
15538 Disable the ARM-state integer division extension.
15539 @end table
15540
15541 @item armv7e-m
15542 @table @samp
15543 @item +fp
15544 The single-precision VFPv4 floating-point instructions.
15545
15546 @item +fpv5
15547 The single-precision FPv5 floating-point instructions.
15548
15549 @item +fp.dp
15550 The single- and double-precision FPv5 floating-point instructions.
15551
15552 @item +nofp
15553 Disable the floating-point extensions.
15554 @end table
15555
15556 @item armv8-m.main
15557 @table @samp
15558 @item +dsp
15559 The DSP instructions.
15560
15561 @item +nodsp
15562 Disable the DSP extension.
15563
15564 @item +fp
15565 The single-precision floating-point instructions.
15566
15567 @item +fp.dp
15568 The single- and double-precision floating-point instructions.
15569
15570 @item +nofp
15571 Disable the floating-point extension.
15572 @end table
15573
15574 @item armv8-r
15575 @table @samp
15576 @item +crc
15577 The Cyclic Redundancy Check (CRC) instructions.
15578 @item +fp.sp
15579 The single-precision FPv5 floating-point instructions.
15580 @item +simd
15581 The ARMv8 Advanced SIMD and floating-point instructions.
15582 @item +crypto
15583 The cryptographic instructions.
15584 @item +nocrypto
15585 Disable the cryptographic isntructions.
15586 @item +nofp
15587 Disable the floating-point, Advanced SIMD and cryptographic instructions.
15588 @end table
15589
15590 @end table
15591
15592 @option{-march=native} causes the compiler to auto-detect the architecture
15593 of the build computer. At present, this feature is only supported on
15594 GNU/Linux, and not all architectures are recognized. If the auto-detect
15595 is unsuccessful the option has no effect.
15596
15597 @item -mtune=@var{name}
15598 @opindex mtune
15599 This option specifies the name of the target ARM processor for
15600 which GCC should tune the performance of the code.
15601 For some ARM implementations better performance can be obtained by using
15602 this option.
15603 Permissible names are: @samp{arm2}, @samp{arm250},
15604 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
15605 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
15606 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
15607 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
15608 @samp{arm720},
15609 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
15610 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
15611 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
15612 @samp{strongarm1110},
15613 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
15614 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
15615 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
15616 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
15617 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
15618 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
15619 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
15620 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
15621 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
15622 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15623 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15624 @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7},
15625 @samp{cortex-r8}, @samp{cortex-r52},
15626 @samp{cortex-m33},
15627 @samp{cortex-m23},
15628 @samp{cortex-m7},
15629 @samp{cortex-m4},
15630 @samp{cortex-m3},
15631 @samp{cortex-m1},
15632 @samp{cortex-m0},
15633 @samp{cortex-m0plus},
15634 @samp{cortex-m1.small-multiply},
15635 @samp{cortex-m0.small-multiply},
15636 @samp{cortex-m0plus.small-multiply},
15637 @samp{exynos-m1},
15638 @samp{marvell-pj4},
15639 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
15640 @samp{fa526}, @samp{fa626},
15641 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
15642 @samp{xgene1}.
15643
15644 Additionally, this option can specify that GCC should tune the performance
15645 of the code for a big.LITTLE system. Permissible names are:
15646 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
15647 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15648 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
15649 @samp{cortex-a75.cortex-a55}.
15650
15651 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
15652 performance for a blend of processors within architecture @var{arch}.
15653 The aim is to generate code that run well on the current most popular
15654 processors, balancing between optimizations that benefit some CPUs in the
15655 range, and avoiding performance pitfalls of other CPUs. The effects of
15656 this option may change in future GCC versions as CPU models come and go.
15657
15658 @option{-mtune} permits the same extension options as @option{-mcpu}, but
15659 the extension options do not affect the tuning of the generated code.
15660
15661 @option{-mtune=native} causes the compiler to auto-detect the CPU
15662 of the build computer. At present, this feature is only supported on
15663 GNU/Linux, and not all architectures are recognized. If the auto-detect is
15664 unsuccessful the option has no effect.
15665
15666 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
15667 @opindex mcpu
15668 This specifies the name of the target ARM processor. GCC uses this name
15669 to derive the name of the target ARM architecture (as if specified
15670 by @option{-march}) and the ARM processor type for which to tune for
15671 performance (as if specified by @option{-mtune}). Where this option
15672 is used in conjunction with @option{-march} or @option{-mtune},
15673 those options take precedence over the appropriate part of this option.
15674
15675 Many of the supported CPUs implement optional architectural
15676 extensions. Where this is so the architectural extensions are
15677 normally enabled by default. If implementations that lack the
15678 extension exist, then the extension syntax can be used to disable
15679 those extensions that have been omitted. For floating-point and
15680 Advanced SIMD (Neon) instructions, the settings of the options
15681 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
15682 floating-point and Advanced SIMD instructions will only be used if
15683 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
15684 @option{-mfpu} other than @samp{auto} will override the available
15685 floating-point and SIMD extension instructions.
15686
15687 For example, @samp{cortex-a9} can be found in three major
15688 configurations: integer only, with just a floating-point unit or with
15689 floating-point and Advanced SIMD. The default is to enable all the
15690 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
15691 be used to disable just the SIMD or both the SIMD and floating-point
15692 instructions respectively.
15693
15694 Permissible names for this option are the same as those for
15695 @option{-mtune}.
15696
15697 The following extension options are common to the listed CPUs:
15698
15699 @table @samp
15700 @item +nofp
15701 Disables the floating-point instructions on @samp{arm9e},
15702 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
15703 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
15704 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
15705 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
15706 Disables the floating-point and SIMD instructions on
15707 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
15708 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
15709 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
15710 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
15711 @samp{cortex-a53} and @samp{cortex-a55}.
15712
15713 @item +nofp.dp
15714 Disables the double-precision component of the floating-point instructions
15715 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
15716
15717 @item +nosimd
15718 Disables the SIMD (but not floating-point) instructions on
15719 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
15720 and @samp{cortex-a9}.
15721
15722 @item +crypto
15723 Enables the cryptographic instructions on @samp{cortex-a32},
15724 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
15725 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
15726 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15727 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
15728 @samp{cortex-a75.cortex-a55}.
15729 @end table
15730
15731 Additionally the @samp{generic-armv7-a} pseudo target defaults to
15732 VFPv3 with 16 double-precision registers. It supports the following
15733 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
15734 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
15735 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
15736 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
15737 @option{-march=armv7-a}.
15738
15739 @option{-mcpu=generic-@var{arch}} is also permissible, and is
15740 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
15741 See @option{-mtune} for more information.
15742
15743 @option{-mcpu=native} causes the compiler to auto-detect the CPU
15744 of the build computer. At present, this feature is only supported on
15745 GNU/Linux, and not all architectures are recognized. If the auto-detect
15746 is unsuccessful the option has no effect.
15747
15748 @item -mfpu=@var{name}
15749 @opindex mfpu
15750 This specifies what floating-point hardware (or hardware emulation) is
15751 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
15752 @samp{vfpv3},
15753 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
15754 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
15755 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
15756 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
15757 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
15758 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
15759 is an alias for @samp{vfpv2}.
15760
15761 The setting @samp{auto} is the default and is special. It causes the
15762 compiler to select the floating-point and Advanced SIMD instructions
15763 based on the settings of @option{-mcpu} and @option{-march}.
15764
15765 If the selected floating-point hardware includes the NEON extension
15766 (e.g. @option{-mfpu=neon}), note that floating-point
15767 operations are not generated by GCC's auto-vectorization pass unless
15768 @option{-funsafe-math-optimizations} is also specified. This is
15769 because NEON hardware does not fully implement the IEEE 754 standard for
15770 floating-point arithmetic (in particular denormal values are treated as
15771 zero), so the use of NEON instructions may lead to a loss of precision.
15772
15773 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}).
15774
15775 @item -mfp16-format=@var{name}
15776 @opindex mfp16-format
15777 Specify the format of the @code{__fp16} half-precision floating-point type.
15778 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
15779 the default is @samp{none}, in which case the @code{__fp16} type is not
15780 defined. @xref{Half-Precision}, for more information.
15781
15782 @item -mstructure-size-boundary=@var{n}
15783 @opindex mstructure-size-boundary
15784 The sizes of all structures and unions are rounded up to a multiple
15785 of the number of bits set by this option. Permissible values are 8, 32
15786 and 64. The default value varies for different toolchains. For the COFF
15787 targeted toolchain the default value is 8. A value of 64 is only allowed
15788 if the underlying ABI supports it.
15789
15790 Specifying a larger number can produce faster, more efficient code, but
15791 can also increase the size of the program. Different values are potentially
15792 incompatible. Code compiled with one value cannot necessarily expect to
15793 work with code or libraries compiled with another value, if they exchange
15794 information using structures or unions.
15795
15796 This option is deprecated.
15797
15798 @item -mabort-on-noreturn
15799 @opindex mabort-on-noreturn
15800 Generate a call to the function @code{abort} at the end of a
15801 @code{noreturn} function. It is executed if the function tries to
15802 return.
15803
15804 @item -mlong-calls
15805 @itemx -mno-long-calls
15806 @opindex mlong-calls
15807 @opindex mno-long-calls
15808 Tells the compiler to perform function calls by first loading the
15809 address of the function into a register and then performing a subroutine
15810 call on this register. This switch is needed if the target function
15811 lies outside of the 64-megabyte addressing range of the offset-based
15812 version of subroutine call instruction.
15813
15814 Even if this switch is enabled, not all function calls are turned
15815 into long calls. The heuristic is that static functions, functions
15816 that have the @code{short_call} attribute, functions that are inside
15817 the scope of a @code{#pragma no_long_calls} directive, and functions whose
15818 definitions have already been compiled within the current compilation
15819 unit are not turned into long calls. The exceptions to this rule are
15820 that weak function definitions, functions with the @code{long_call}
15821 attribute or the @code{section} attribute, and functions that are within
15822 the scope of a @code{#pragma long_calls} directive are always
15823 turned into long calls.
15824
15825 This feature is not enabled by default. Specifying
15826 @option{-mno-long-calls} restores the default behavior, as does
15827 placing the function calls within the scope of a @code{#pragma
15828 long_calls_off} directive. Note these switches have no effect on how
15829 the compiler generates code to handle function calls via function
15830 pointers.
15831
15832 @item -msingle-pic-base
15833 @opindex msingle-pic-base
15834 Treat the register used for PIC addressing as read-only, rather than
15835 loading it in the prologue for each function. The runtime system is
15836 responsible for initializing this register with an appropriate value
15837 before execution begins.
15838
15839 @item -mpic-register=@var{reg}
15840 @opindex mpic-register
15841 Specify the register to be used for PIC addressing.
15842 For standard PIC base case, the default is any suitable register
15843 determined by compiler. For single PIC base case, the default is
15844 @samp{R9} if target is EABI based or stack-checking is enabled,
15845 otherwise the default is @samp{R10}.
15846
15847 @item -mpic-data-is-text-relative
15848 @opindex mpic-data-is-text-relative
15849 Assume that the displacement between the text and data segments is fixed
15850 at static link time. This permits using PC-relative addressing
15851 operations to access data known to be in the data segment. For
15852 non-VxWorks RTP targets, this option is enabled by default. When
15853 disabled on such targets, it will enable @option{-msingle-pic-base} by
15854 default.
15855
15856 @item -mpoke-function-name
15857 @opindex mpoke-function-name
15858 Write the name of each function into the text section, directly
15859 preceding the function prologue. The generated code is similar to this:
15860
15861 @smallexample
15862 t0
15863 .ascii "arm_poke_function_name", 0
15864 .align
15865 t1
15866 .word 0xff000000 + (t1 - t0)
15867 arm_poke_function_name
15868 mov ip, sp
15869 stmfd sp!, @{fp, ip, lr, pc@}
15870 sub fp, ip, #4
15871 @end smallexample
15872
15873 When performing a stack backtrace, code can inspect the value of
15874 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
15875 location @code{pc - 12} and the top 8 bits are set, then we know that
15876 there is a function name embedded immediately preceding this location
15877 and has length @code{((pc[-3]) & 0xff000000)}.
15878
15879 @item -mthumb
15880 @itemx -marm
15881 @opindex marm
15882 @opindex mthumb
15883
15884 Select between generating code that executes in ARM and Thumb
15885 states. The default for most configurations is to generate code
15886 that executes in ARM state, but the default can be changed by
15887 configuring GCC with the @option{--with-mode=}@var{state}
15888 configure option.
15889
15890 You can also override the ARM and Thumb mode for each function
15891 by using the @code{target("thumb")} and @code{target("arm")} function attributes
15892 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
15893
15894 @item -mtpcs-frame
15895 @opindex mtpcs-frame
15896 Generate a stack frame that is compliant with the Thumb Procedure Call
15897 Standard for all non-leaf functions. (A leaf function is one that does
15898 not call any other functions.) The default is @option{-mno-tpcs-frame}.
15899
15900 @item -mtpcs-leaf-frame
15901 @opindex mtpcs-leaf-frame
15902 Generate a stack frame that is compliant with the Thumb Procedure Call
15903 Standard for all leaf functions. (A leaf function is one that does
15904 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
15905
15906 @item -mcallee-super-interworking
15907 @opindex mcallee-super-interworking
15908 Gives all externally visible functions in the file being compiled an ARM
15909 instruction set header which switches to Thumb mode before executing the
15910 rest of the function. This allows these functions to be called from
15911 non-interworking code. This option is not valid in AAPCS configurations
15912 because interworking is enabled by default.
15913
15914 @item -mcaller-super-interworking
15915 @opindex mcaller-super-interworking
15916 Allows calls via function pointers (including virtual functions) to
15917 execute correctly regardless of whether the target code has been
15918 compiled for interworking or not. There is a small overhead in the cost
15919 of executing a function pointer if this option is enabled. This option
15920 is not valid in AAPCS configurations because interworking is enabled
15921 by default.
15922
15923 @item -mtp=@var{name}
15924 @opindex mtp
15925 Specify the access model for the thread local storage pointer. The valid
15926 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
15927 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
15928 (supported in the arm6k architecture), and @samp{auto}, which uses the
15929 best available method for the selected processor. The default setting is
15930 @samp{auto}.
15931
15932 @item -mtls-dialect=@var{dialect}
15933 @opindex mtls-dialect
15934 Specify the dialect to use for accessing thread local storage. Two
15935 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
15936 @samp{gnu} dialect selects the original GNU scheme for supporting
15937 local and global dynamic TLS models. The @samp{gnu2} dialect
15938 selects the GNU descriptor scheme, which provides better performance
15939 for shared libraries. The GNU descriptor scheme is compatible with
15940 the original scheme, but does require new assembler, linker and
15941 library support. Initial and local exec TLS models are unaffected by
15942 this option and always use the original scheme.
15943
15944 @item -mword-relocations
15945 @opindex mword-relocations
15946 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
15947 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
15948 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
15949 is specified.
15950
15951 @item -mfix-cortex-m3-ldrd
15952 @opindex mfix-cortex-m3-ldrd
15953 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
15954 with overlapping destination and base registers are used. This option avoids
15955 generating these instructions. This option is enabled by default when
15956 @option{-mcpu=cortex-m3} is specified.
15957
15958 @item -munaligned-access
15959 @itemx -mno-unaligned-access
15960 @opindex munaligned-access
15961 @opindex mno-unaligned-access
15962 Enables (or disables) reading and writing of 16- and 32- bit values
15963 from addresses that are not 16- or 32- bit aligned. By default
15964 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
15965 ARMv8-M Baseline architectures, and enabled for all other
15966 architectures. If unaligned access is not enabled then words in packed
15967 data structures are accessed a byte at a time.
15968
15969 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
15970 generated object file to either true or false, depending upon the
15971 setting of this option. If unaligned access is enabled then the
15972 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
15973 defined.
15974
15975 @item -mneon-for-64bits
15976 @opindex mneon-for-64bits
15977 Enables using Neon to handle scalar 64-bits operations. This is
15978 disabled by default since the cost of moving data from core registers
15979 to Neon is high.
15980
15981 @item -mslow-flash-data
15982 @opindex mslow-flash-data
15983 Assume loading data from flash is slower than fetching instruction.
15984 Therefore literal load is minimized for better performance.
15985 This option is only supported when compiling for ARMv7 M-profile and
15986 off by default.
15987
15988 @item -masm-syntax-unified
15989 @opindex masm-syntax-unified
15990 Assume inline assembler is using unified asm syntax. The default is
15991 currently off which implies divided syntax. This option has no impact
15992 on Thumb2. However, this may change in future releases of GCC.
15993 Divided syntax should be considered deprecated.
15994
15995 @item -mrestrict-it
15996 @opindex mrestrict-it
15997 Restricts generation of IT blocks to conform to the rules of ARMv8.
15998 IT blocks can only contain a single 16-bit instruction from a select
15999 set of instructions. This option is on by default for ARMv8 Thumb mode.
16000
16001 @item -mprint-tune-info
16002 @opindex mprint-tune-info
16003 Print CPU tuning information as comment in assembler file. This is
16004 an option used only for regression testing of the compiler and not
16005 intended for ordinary use in compiling code. This option is disabled
16006 by default.
16007
16008 @item -mpure-code
16009 @opindex mpure-code
16010 Do not allow constant data to be placed in code sections.
16011 Additionally, when compiling for ELF object format give all text sections the
16012 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
16013 is only available when generating non-pic code for M-profile targets with the
16014 MOVT instruction.
16015
16016 @item -mcmse
16017 @opindex mcmse
16018 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
16019 Development Tools Engineering Specification", which can be found on
16020 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
16021 @end table
16022
16023 @node AVR Options
16024 @subsection AVR Options
16025 @cindex AVR Options
16026
16027 These options are defined for AVR implementations:
16028
16029 @table @gcctabopt
16030 @item -mmcu=@var{mcu}
16031 @opindex mmcu
16032 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16033
16034 The default for this option is@tie{}@samp{avr2}.
16035
16036 GCC supports the following AVR devices and ISAs:
16037
16038 @include avr-mmcu.texi
16039
16040 @item -mabsdata
16041 @opindex mabsdata
16042
16043 Assume that all data in static storage can be accessed by LDS / STS
16044 instructions. This option has only an effect on reduced Tiny devices like
16045 ATtiny40. See also the @code{absdata}
16046 @ref{AVR Variable Attributes,variable attribute}.
16047
16048 @item -maccumulate-args
16049 @opindex maccumulate-args
16050 Accumulate outgoing function arguments and acquire/release the needed
16051 stack space for outgoing function arguments once in function
16052 prologue/epilogue. Without this option, outgoing arguments are pushed
16053 before calling a function and popped afterwards.
16054
16055 Popping the arguments after the function call can be expensive on
16056 AVR so that accumulating the stack space might lead to smaller
16057 executables because arguments need not be removed from the
16058 stack after such a function call.
16059
16060 This option can lead to reduced code size for functions that perform
16061 several calls to functions that get their arguments on the stack like
16062 calls to printf-like functions.
16063
16064 @item -mbranch-cost=@var{cost}
16065 @opindex mbranch-cost
16066 Set the branch costs for conditional branch instructions to
16067 @var{cost}. Reasonable values for @var{cost} are small, non-negative
16068 integers. The default branch cost is 0.
16069
16070 @item -mcall-prologues
16071 @opindex mcall-prologues
16072 Functions prologues/epilogues are expanded as calls to appropriate
16073 subroutines. Code size is smaller.
16074
16075 @item -mgas-isr-prologues
16076 @opindex mgas-isr-prologues
16077 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
16078 instruction supported by GNU Binutils.
16079 If this option is on, the feature can still be disabled for individual
16080 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
16081 function attribute. This feature is activated per default
16082 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
16083 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
16084
16085 @item -mint8
16086 @opindex mint8
16087 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
16088 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
16089 and @code{long long} is 4 bytes. Please note that this option does not
16090 conform to the C standards, but it results in smaller code
16091 size.
16092
16093 @item -mn-flash=@var{num}
16094 @opindex mn-flash
16095 Assume that the flash memory has a size of
16096 @var{num} times 64@tie{}KiB.
16097
16098 @item -mno-interrupts
16099 @opindex mno-interrupts
16100 Generated code is not compatible with hardware interrupts.
16101 Code size is smaller.
16102
16103 @item -mrelax
16104 @opindex mrelax
16105 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
16106 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
16107 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
16108 the assembler's command line and the @option{--relax} option to the
16109 linker's command line.
16110
16111 Jump relaxing is performed by the linker because jump offsets are not
16112 known before code is located. Therefore, the assembler code generated by the
16113 compiler is the same, but the instructions in the executable may
16114 differ from instructions in the assembler code.
16115
16116 Relaxing must be turned on if linker stubs are needed, see the
16117 section on @code{EIND} and linker stubs below.
16118
16119 @item -mrmw
16120 @opindex mrmw
16121 Assume that the device supports the Read-Modify-Write
16122 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
16123
16124 @item -mshort-calls
16125 @opindex mshort-calls
16126
16127 Assume that @code{RJMP} and @code{RCALL} can target the whole
16128 program memory.
16129
16130 This option is used internally for multilib selection. It is
16131 not an optimization option, and you don't need to set it by hand.
16132
16133 @item -msp8
16134 @opindex msp8
16135 Treat the stack pointer register as an 8-bit register,
16136 i.e.@: assume the high byte of the stack pointer is zero.
16137 In general, you don't need to set this option by hand.
16138
16139 This option is used internally by the compiler to select and
16140 build multilibs for architectures @code{avr2} and @code{avr25}.
16141 These architectures mix devices with and without @code{SPH}.
16142 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
16143 the compiler driver adds or removes this option from the compiler
16144 proper's command line, because the compiler then knows if the device
16145 or architecture has an 8-bit stack pointer and thus no @code{SPH}
16146 register or not.
16147
16148 @item -mstrict-X
16149 @opindex mstrict-X
16150 Use address register @code{X} in a way proposed by the hardware. This means
16151 that @code{X} is only used in indirect, post-increment or
16152 pre-decrement addressing.
16153
16154 Without this option, the @code{X} register may be used in the same way
16155 as @code{Y} or @code{Z} which then is emulated by additional
16156 instructions.
16157 For example, loading a value with @code{X+const} addressing with a
16158 small non-negative @code{const < 64} to a register @var{Rn} is
16159 performed as
16160
16161 @example
16162 adiw r26, const ; X += const
16163 ld @var{Rn}, X ; @var{Rn} = *X
16164 sbiw r26, const ; X -= const
16165 @end example
16166
16167 @item -mtiny-stack
16168 @opindex mtiny-stack
16169 Only change the lower 8@tie{}bits of the stack pointer.
16170
16171 @item -mfract-convert-truncate
16172 @opindex mfract-convert-truncate
16173 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
16174
16175 @item -nodevicelib
16176 @opindex nodevicelib
16177 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
16178
16179 @item -Waddr-space-convert
16180 @opindex Waddr-space-convert
16181 Warn about conversions between address spaces in the case where the
16182 resulting address space is not contained in the incoming address space.
16183
16184 @item -Wmisspelled-isr
16185 @opindex Wmisspelled-isr
16186 Warn if the ISR is misspelled, i.e. without __vector prefix.
16187 Enabled by default.
16188 @end table
16189
16190 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
16191 @cindex @code{EIND}
16192 Pointers in the implementation are 16@tie{}bits wide.
16193 The address of a function or label is represented as word address so
16194 that indirect jumps and calls can target any code address in the
16195 range of 64@tie{}Ki words.
16196
16197 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
16198 bytes of program memory space, there is a special function register called
16199 @code{EIND} that serves as most significant part of the target address
16200 when @code{EICALL} or @code{EIJMP} instructions are used.
16201
16202 Indirect jumps and calls on these devices are handled as follows by
16203 the compiler and are subject to some limitations:
16204
16205 @itemize @bullet
16206
16207 @item
16208 The compiler never sets @code{EIND}.
16209
16210 @item
16211 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
16212 instructions or might read @code{EIND} directly in order to emulate an
16213 indirect call/jump by means of a @code{RET} instruction.
16214
16215 @item
16216 The compiler assumes that @code{EIND} never changes during the startup
16217 code or during the application. In particular, @code{EIND} is not
16218 saved/restored in function or interrupt service routine
16219 prologue/epilogue.
16220
16221 @item
16222 For indirect calls to functions and computed goto, the linker
16223 generates @emph{stubs}. Stubs are jump pads sometimes also called
16224 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
16225 The stub contains a direct jump to the desired address.
16226
16227 @item
16228 Linker relaxation must be turned on so that the linker generates
16229 the stubs correctly in all situations. See the compiler option
16230 @option{-mrelax} and the linker option @option{--relax}.
16231 There are corner cases where the linker is supposed to generate stubs
16232 but aborts without relaxation and without a helpful error message.
16233
16234 @item
16235 The default linker script is arranged for code with @code{EIND = 0}.
16236 If code is supposed to work for a setup with @code{EIND != 0}, a custom
16237 linker script has to be used in order to place the sections whose
16238 name start with @code{.trampolines} into the segment where @code{EIND}
16239 points to.
16240
16241 @item
16242 The startup code from libgcc never sets @code{EIND}.
16243 Notice that startup code is a blend of code from libgcc and AVR-LibC.
16244 For the impact of AVR-LibC on @code{EIND}, see the
16245 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
16246
16247 @item
16248 It is legitimate for user-specific startup code to set up @code{EIND}
16249 early, for example by means of initialization code located in
16250 section @code{.init3}. Such code runs prior to general startup code
16251 that initializes RAM and calls constructors, but after the bit
16252 of startup code from AVR-LibC that sets @code{EIND} to the segment
16253 where the vector table is located.
16254 @example
16255 #include <avr/io.h>
16256
16257 static void
16258 __attribute__((section(".init3"),naked,used,no_instrument_function))
16259 init3_set_eind (void)
16260 @{
16261 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
16262 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
16263 @}
16264 @end example
16265
16266 @noindent
16267 The @code{__trampolines_start} symbol is defined in the linker script.
16268
16269 @item
16270 Stubs are generated automatically by the linker if
16271 the following two conditions are met:
16272 @itemize @minus
16273
16274 @item The address of a label is taken by means of the @code{gs} modifier
16275 (short for @emph{generate stubs}) like so:
16276 @example
16277 LDI r24, lo8(gs(@var{func}))
16278 LDI r25, hi8(gs(@var{func}))
16279 @end example
16280 @item The final location of that label is in a code segment
16281 @emph{outside} the segment where the stubs are located.
16282 @end itemize
16283
16284 @item
16285 The compiler emits such @code{gs} modifiers for code labels in the
16286 following situations:
16287 @itemize @minus
16288 @item Taking address of a function or code label.
16289 @item Computed goto.
16290 @item If prologue-save function is used, see @option{-mcall-prologues}
16291 command-line option.
16292 @item Switch/case dispatch tables. If you do not want such dispatch
16293 tables you can specify the @option{-fno-jump-tables} command-line option.
16294 @item C and C++ constructors/destructors called during startup/shutdown.
16295 @item If the tools hit a @code{gs()} modifier explained above.
16296 @end itemize
16297
16298 @item
16299 Jumping to non-symbolic addresses like so is @emph{not} supported:
16300
16301 @example
16302 int main (void)
16303 @{
16304 /* Call function at word address 0x2 */
16305 return ((int(*)(void)) 0x2)();
16306 @}
16307 @end example
16308
16309 Instead, a stub has to be set up, i.e.@: the function has to be called
16310 through a symbol (@code{func_4} in the example):
16311
16312 @example
16313 int main (void)
16314 @{
16315 extern int func_4 (void);
16316
16317 /* Call function at byte address 0x4 */
16318 return func_4();
16319 @}
16320 @end example
16321
16322 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
16323 Alternatively, @code{func_4} can be defined in the linker script.
16324 @end itemize
16325
16326 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
16327 @cindex @code{RAMPD}
16328 @cindex @code{RAMPX}
16329 @cindex @code{RAMPY}
16330 @cindex @code{RAMPZ}
16331 Some AVR devices support memories larger than the 64@tie{}KiB range
16332 that can be accessed with 16-bit pointers. To access memory locations
16333 outside this 64@tie{}KiB range, the content of a @code{RAMP}
16334 register is used as high part of the address:
16335 The @code{X}, @code{Y}, @code{Z} address register is concatenated
16336 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
16337 register, respectively, to get a wide address. Similarly,
16338 @code{RAMPD} is used together with direct addressing.
16339
16340 @itemize
16341 @item
16342 The startup code initializes the @code{RAMP} special function
16343 registers with zero.
16344
16345 @item
16346 If a @ref{AVR Named Address Spaces,named address space} other than
16347 generic or @code{__flash} is used, then @code{RAMPZ} is set
16348 as needed before the operation.
16349
16350 @item
16351 If the device supports RAM larger than 64@tie{}KiB and the compiler
16352 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
16353 is reset to zero after the operation.
16354
16355 @item
16356 If the device comes with a specific @code{RAMP} register, the ISR
16357 prologue/epilogue saves/restores that SFR and initializes it with
16358 zero in case the ISR code might (implicitly) use it.
16359
16360 @item
16361 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
16362 If you use inline assembler to read from locations outside the
16363 16-bit address range and change one of the @code{RAMP} registers,
16364 you must reset it to zero after the access.
16365
16366 @end itemize
16367
16368 @subsubsection AVR Built-in Macros
16369
16370 GCC defines several built-in macros so that the user code can test
16371 for the presence or absence of features. Almost any of the following
16372 built-in macros are deduced from device capabilities and thus
16373 triggered by the @option{-mmcu=} command-line option.
16374
16375 For even more AVR-specific built-in macros see
16376 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
16377
16378 @table @code
16379
16380 @item __AVR_ARCH__
16381 Build-in macro that resolves to a decimal number that identifies the
16382 architecture and depends on the @option{-mmcu=@var{mcu}} option.
16383 Possible values are:
16384
16385 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
16386 @code{4}, @code{5}, @code{51}, @code{6}
16387
16388 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
16389 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
16390
16391 respectively and
16392
16393 @code{100},
16394 @code{102}, @code{103}, @code{104},
16395 @code{105}, @code{106}, @code{107}
16396
16397 for @var{mcu}=@code{avrtiny},
16398 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
16399 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
16400 If @var{mcu} specifies a device, this built-in macro is set
16401 accordingly. For example, with @option{-mmcu=atmega8} the macro is
16402 defined to @code{4}.
16403
16404 @item __AVR_@var{Device}__
16405 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
16406 the device's name. For example, @option{-mmcu=atmega8} defines the
16407 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
16408 @code{__AVR_ATtiny261A__}, etc.
16409
16410 The built-in macros' names follow
16411 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
16412 the device name as from the AVR user manual. The difference between
16413 @var{Device} in the built-in macro and @var{device} in
16414 @option{-mmcu=@var{device}} is that the latter is always lowercase.
16415
16416 If @var{device} is not a device but only a core architecture like
16417 @samp{avr51}, this macro is not defined.
16418
16419 @item __AVR_DEVICE_NAME__
16420 Setting @option{-mmcu=@var{device}} defines this built-in macro to
16421 the device's name. For example, with @option{-mmcu=atmega8} the macro
16422 is defined to @code{atmega8}.
16423
16424 If @var{device} is not a device but only a core architecture like
16425 @samp{avr51}, this macro is not defined.
16426
16427 @item __AVR_XMEGA__
16428 The device / architecture belongs to the XMEGA family of devices.
16429
16430 @item __AVR_HAVE_ELPM__
16431 The device has the @code{ELPM} instruction.
16432
16433 @item __AVR_HAVE_ELPMX__
16434 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
16435 R@var{n},Z+} instructions.
16436
16437 @item __AVR_HAVE_MOVW__
16438 The device has the @code{MOVW} instruction to perform 16-bit
16439 register-register moves.
16440
16441 @item __AVR_HAVE_LPMX__
16442 The device has the @code{LPM R@var{n},Z} and
16443 @code{LPM R@var{n},Z+} instructions.
16444
16445 @item __AVR_HAVE_MUL__
16446 The device has a hardware multiplier.
16447
16448 @item __AVR_HAVE_JMP_CALL__
16449 The device has the @code{JMP} and @code{CALL} instructions.
16450 This is the case for devices with more than 8@tie{}KiB of program
16451 memory.
16452
16453 @item __AVR_HAVE_EIJMP_EICALL__
16454 @itemx __AVR_3_BYTE_PC__
16455 The device has the @code{EIJMP} and @code{EICALL} instructions.
16456 This is the case for devices with more than 128@tie{}KiB of program memory.
16457 This also means that the program counter
16458 (PC) is 3@tie{}bytes wide.
16459
16460 @item __AVR_2_BYTE_PC__
16461 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
16462 with up to 128@tie{}KiB of program memory.
16463
16464 @item __AVR_HAVE_8BIT_SP__
16465 @itemx __AVR_HAVE_16BIT_SP__
16466 The stack pointer (SP) register is treated as 8-bit respectively
16467 16-bit register by the compiler.
16468 The definition of these macros is affected by @option{-mtiny-stack}.
16469
16470 @item __AVR_HAVE_SPH__
16471 @itemx __AVR_SP8__
16472 The device has the SPH (high part of stack pointer) special function
16473 register or has an 8-bit stack pointer, respectively.
16474 The definition of these macros is affected by @option{-mmcu=} and
16475 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
16476 by @option{-msp8}.
16477
16478 @item __AVR_HAVE_RAMPD__
16479 @itemx __AVR_HAVE_RAMPX__
16480 @itemx __AVR_HAVE_RAMPY__
16481 @itemx __AVR_HAVE_RAMPZ__
16482 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
16483 @code{RAMPZ} special function register, respectively.
16484
16485 @item __NO_INTERRUPTS__
16486 This macro reflects the @option{-mno-interrupts} command-line option.
16487
16488 @item __AVR_ERRATA_SKIP__
16489 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
16490 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
16491 instructions because of a hardware erratum. Skip instructions are
16492 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
16493 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
16494 set.
16495
16496 @item __AVR_ISA_RMW__
16497 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
16498
16499 @item __AVR_SFR_OFFSET__=@var{offset}
16500 Instructions that can address I/O special function registers directly
16501 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
16502 address as if addressed by an instruction to access RAM like @code{LD}
16503 or @code{STS}. This offset depends on the device architecture and has
16504 to be subtracted from the RAM address in order to get the
16505 respective I/O@tie{}address.
16506
16507 @item __AVR_SHORT_CALLS__
16508 The @option{-mshort-calls} command line option is set.
16509
16510 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
16511 Some devices support reading from flash memory by means of @code{LD*}
16512 instructions. The flash memory is seen in the data address space
16513 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
16514 is not defined, this feature is not available. If defined,
16515 the address space is linear and there is no need to put
16516 @code{.rodata} into RAM. This is handled by the default linker
16517 description file, and is currently available for
16518 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
16519 there is no need to use address spaces like @code{__flash} or
16520 features like attribute @code{progmem} and @code{pgm_read_*}.
16521
16522 @item __WITH_AVRLIBC__
16523 The compiler is configured to be used together with AVR-Libc.
16524 See the @option{--with-avrlibc} configure option.
16525
16526 @end table
16527
16528 @node Blackfin Options
16529 @subsection Blackfin Options
16530 @cindex Blackfin Options
16531
16532 @table @gcctabopt
16533 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
16534 @opindex mcpu=
16535 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
16536 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
16537 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
16538 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
16539 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
16540 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
16541 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
16542 @samp{bf561}, @samp{bf592}.
16543
16544 The optional @var{sirevision} specifies the silicon revision of the target
16545 Blackfin processor. Any workarounds available for the targeted silicon revision
16546 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
16547 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
16548 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
16549 hexadecimal digits representing the major and minor numbers in the silicon
16550 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
16551 is not defined. If @var{sirevision} is @samp{any}, the
16552 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
16553 If this optional @var{sirevision} is not used, GCC assumes the latest known
16554 silicon revision of the targeted Blackfin processor.
16555
16556 GCC defines a preprocessor macro for the specified @var{cpu}.
16557 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
16558 provided by libgloss to be linked in if @option{-msim} is not given.
16559
16560 Without this option, @samp{bf532} is used as the processor by default.
16561
16562 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
16563 only the preprocessor macro is defined.
16564
16565 @item -msim
16566 @opindex msim
16567 Specifies that the program will be run on the simulator. This causes
16568 the simulator BSP provided by libgloss to be linked in. This option
16569 has effect only for @samp{bfin-elf} toolchain.
16570 Certain other options, such as @option{-mid-shared-library} and
16571 @option{-mfdpic}, imply @option{-msim}.
16572
16573 @item -momit-leaf-frame-pointer
16574 @opindex momit-leaf-frame-pointer
16575 Don't keep the frame pointer in a register for leaf functions. This
16576 avoids the instructions to save, set up and restore frame pointers and
16577 makes an extra register available in leaf functions. The option
16578 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
16579 which might make debugging harder.
16580
16581 @item -mspecld-anomaly
16582 @opindex mspecld-anomaly
16583 When enabled, the compiler ensures that the generated code does not
16584 contain speculative loads after jump instructions. If this option is used,
16585 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
16586
16587 @item -mno-specld-anomaly
16588 @opindex mno-specld-anomaly
16589 Don't generate extra code to prevent speculative loads from occurring.
16590
16591 @item -mcsync-anomaly
16592 @opindex mcsync-anomaly
16593 When enabled, the compiler ensures that the generated code does not
16594 contain CSYNC or SSYNC instructions too soon after conditional branches.
16595 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
16596
16597 @item -mno-csync-anomaly
16598 @opindex mno-csync-anomaly
16599 Don't generate extra code to prevent CSYNC or SSYNC instructions from
16600 occurring too soon after a conditional branch.
16601
16602 @item -mlow-64k
16603 @opindex mlow-64k
16604 When enabled, the compiler is free to take advantage of the knowledge that
16605 the entire program fits into the low 64k of memory.
16606
16607 @item -mno-low-64k
16608 @opindex mno-low-64k
16609 Assume that the program is arbitrarily large. This is the default.
16610
16611 @item -mstack-check-l1
16612 @opindex mstack-check-l1
16613 Do stack checking using information placed into L1 scratchpad memory by the
16614 uClinux kernel.
16615
16616 @item -mid-shared-library
16617 @opindex mid-shared-library
16618 Generate code that supports shared libraries via the library ID method.
16619 This allows for execute in place and shared libraries in an environment
16620 without virtual memory management. This option implies @option{-fPIC}.
16621 With a @samp{bfin-elf} target, this option implies @option{-msim}.
16622
16623 @item -mno-id-shared-library
16624 @opindex mno-id-shared-library
16625 Generate code that doesn't assume ID-based shared libraries are being used.
16626 This is the default.
16627
16628 @item -mleaf-id-shared-library
16629 @opindex mleaf-id-shared-library
16630 Generate code that supports shared libraries via the library ID method,
16631 but assumes that this library or executable won't link against any other
16632 ID shared libraries. That allows the compiler to use faster code for jumps
16633 and calls.
16634
16635 @item -mno-leaf-id-shared-library
16636 @opindex mno-leaf-id-shared-library
16637 Do not assume that the code being compiled won't link against any ID shared
16638 libraries. Slower code is generated for jump and call insns.
16639
16640 @item -mshared-library-id=n
16641 @opindex mshared-library-id
16642 Specifies the identification number of the ID-based shared library being
16643 compiled. Specifying a value of 0 generates more compact code; specifying
16644 other values forces the allocation of that number to the current
16645 library but is no more space- or time-efficient than omitting this option.
16646
16647 @item -msep-data
16648 @opindex msep-data
16649 Generate code that allows the data segment to be located in a different
16650 area of memory from the text segment. This allows for execute in place in
16651 an environment without virtual memory management by eliminating relocations
16652 against the text section.
16653
16654 @item -mno-sep-data
16655 @opindex mno-sep-data
16656 Generate code that assumes that the data segment follows the text segment.
16657 This is the default.
16658
16659 @item -mlong-calls
16660 @itemx -mno-long-calls
16661 @opindex mlong-calls
16662 @opindex mno-long-calls
16663 Tells the compiler to perform function calls by first loading the
16664 address of the function into a register and then performing a subroutine
16665 call on this register. This switch is needed if the target function
16666 lies outside of the 24-bit addressing range of the offset-based
16667 version of subroutine call instruction.
16668
16669 This feature is not enabled by default. Specifying
16670 @option{-mno-long-calls} restores the default behavior. Note these
16671 switches have no effect on how the compiler generates code to handle
16672 function calls via function pointers.
16673
16674 @item -mfast-fp
16675 @opindex mfast-fp
16676 Link with the fast floating-point library. This library relaxes some of
16677 the IEEE floating-point standard's rules for checking inputs against
16678 Not-a-Number (NAN), in the interest of performance.
16679
16680 @item -minline-plt
16681 @opindex minline-plt
16682 Enable inlining of PLT entries in function calls to functions that are
16683 not known to bind locally. It has no effect without @option{-mfdpic}.
16684
16685 @item -mmulticore
16686 @opindex mmulticore
16687 Build a standalone application for multicore Blackfin processors.
16688 This option causes proper start files and link scripts supporting
16689 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
16690 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
16691
16692 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
16693 selects the one-application-per-core programming model. Without
16694 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
16695 programming model is used. In this model, the main function of Core B
16696 should be named as @code{coreb_main}.
16697
16698 If this option is not used, the single-core application programming
16699 model is used.
16700
16701 @item -mcorea
16702 @opindex mcorea
16703 Build a standalone application for Core A of BF561 when using
16704 the one-application-per-core programming model. Proper start files
16705 and link scripts are used to support Core A, and the macro
16706 @code{__BFIN_COREA} is defined.
16707 This option can only be used in conjunction with @option{-mmulticore}.
16708
16709 @item -mcoreb
16710 @opindex mcoreb
16711 Build a standalone application for Core B of BF561 when using
16712 the one-application-per-core programming model. Proper start files
16713 and link scripts are used to support Core B, and the macro
16714 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
16715 should be used instead of @code{main}.
16716 This option can only be used in conjunction with @option{-mmulticore}.
16717
16718 @item -msdram
16719 @opindex msdram
16720 Build a standalone application for SDRAM. Proper start files and
16721 link scripts are used to put the application into SDRAM, and the macro
16722 @code{__BFIN_SDRAM} is defined.
16723 The loader should initialize SDRAM before loading the application.
16724
16725 @item -micplb
16726 @opindex micplb
16727 Assume that ICPLBs are enabled at run time. This has an effect on certain
16728 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
16729 are enabled; for standalone applications the default is off.
16730 @end table
16731
16732 @node C6X Options
16733 @subsection C6X Options
16734 @cindex C6X Options
16735
16736 @table @gcctabopt
16737 @item -march=@var{name}
16738 @opindex march
16739 This specifies the name of the target architecture. GCC uses this
16740 name to determine what kind of instructions it can emit when generating
16741 assembly code. Permissible names are: @samp{c62x},
16742 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
16743
16744 @item -mbig-endian
16745 @opindex mbig-endian
16746 Generate code for a big-endian target.
16747
16748 @item -mlittle-endian
16749 @opindex mlittle-endian
16750 Generate code for a little-endian target. This is the default.
16751
16752 @item -msim
16753 @opindex msim
16754 Choose startup files and linker script suitable for the simulator.
16755
16756 @item -msdata=default
16757 @opindex msdata=default
16758 Put small global and static data in the @code{.neardata} section,
16759 which is pointed to by register @code{B14}. Put small uninitialized
16760 global and static data in the @code{.bss} section, which is adjacent
16761 to the @code{.neardata} section. Put small read-only data into the
16762 @code{.rodata} section. The corresponding sections used for large
16763 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
16764
16765 @item -msdata=all
16766 @opindex msdata=all
16767 Put all data, not just small objects, into the sections reserved for
16768 small data, and use addressing relative to the @code{B14} register to
16769 access them.
16770
16771 @item -msdata=none
16772 @opindex msdata=none
16773 Make no use of the sections reserved for small data, and use absolute
16774 addresses to access all data. Put all initialized global and static
16775 data in the @code{.fardata} section, and all uninitialized data in the
16776 @code{.far} section. Put all constant data into the @code{.const}
16777 section.
16778 @end table
16779
16780 @node CRIS Options
16781 @subsection CRIS Options
16782 @cindex CRIS Options
16783
16784 These options are defined specifically for the CRIS ports.
16785
16786 @table @gcctabopt
16787 @item -march=@var{architecture-type}
16788 @itemx -mcpu=@var{architecture-type}
16789 @opindex march
16790 @opindex mcpu
16791 Generate code for the specified architecture. The choices for
16792 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
16793 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
16794 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
16795 @samp{v10}.
16796
16797 @item -mtune=@var{architecture-type}
16798 @opindex mtune
16799 Tune to @var{architecture-type} everything applicable about the generated
16800 code, except for the ABI and the set of available instructions. The
16801 choices for @var{architecture-type} are the same as for
16802 @option{-march=@var{architecture-type}}.
16803
16804 @item -mmax-stack-frame=@var{n}
16805 @opindex mmax-stack-frame
16806 Warn when the stack frame of a function exceeds @var{n} bytes.
16807
16808 @item -metrax4
16809 @itemx -metrax100
16810 @opindex metrax4
16811 @opindex metrax100
16812 The options @option{-metrax4} and @option{-metrax100} are synonyms for
16813 @option{-march=v3} and @option{-march=v8} respectively.
16814
16815 @item -mmul-bug-workaround
16816 @itemx -mno-mul-bug-workaround
16817 @opindex mmul-bug-workaround
16818 @opindex mno-mul-bug-workaround
16819 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
16820 models where it applies. This option is active by default.
16821
16822 @item -mpdebug
16823 @opindex mpdebug
16824 Enable CRIS-specific verbose debug-related information in the assembly
16825 code. This option also has the effect of turning off the @samp{#NO_APP}
16826 formatted-code indicator to the assembler at the beginning of the
16827 assembly file.
16828
16829 @item -mcc-init
16830 @opindex mcc-init
16831 Do not use condition-code results from previous instruction; always emit
16832 compare and test instructions before use of condition codes.
16833
16834 @item -mno-side-effects
16835 @opindex mno-side-effects
16836 Do not emit instructions with side effects in addressing modes other than
16837 post-increment.
16838
16839 @item -mstack-align
16840 @itemx -mno-stack-align
16841 @itemx -mdata-align
16842 @itemx -mno-data-align
16843 @itemx -mconst-align
16844 @itemx -mno-const-align
16845 @opindex mstack-align
16846 @opindex mno-stack-align
16847 @opindex mdata-align
16848 @opindex mno-data-align
16849 @opindex mconst-align
16850 @opindex mno-const-align
16851 These options (@samp{no-} options) arrange (eliminate arrangements) for the
16852 stack frame, individual data and constants to be aligned for the maximum
16853 single data access size for the chosen CPU model. The default is to
16854 arrange for 32-bit alignment. ABI details such as structure layout are
16855 not affected by these options.
16856
16857 @item -m32-bit
16858 @itemx -m16-bit
16859 @itemx -m8-bit
16860 @opindex m32-bit
16861 @opindex m16-bit
16862 @opindex m8-bit
16863 Similar to the stack- data- and const-align options above, these options
16864 arrange for stack frame, writable data and constants to all be 32-bit,
16865 16-bit or 8-bit aligned. The default is 32-bit alignment.
16866
16867 @item -mno-prologue-epilogue
16868 @itemx -mprologue-epilogue
16869 @opindex mno-prologue-epilogue
16870 @opindex mprologue-epilogue
16871 With @option{-mno-prologue-epilogue}, the normal function prologue and
16872 epilogue which set up the stack frame are omitted and no return
16873 instructions or return sequences are generated in the code. Use this
16874 option only together with visual inspection of the compiled code: no
16875 warnings or errors are generated when call-saved registers must be saved,
16876 or storage for local variables needs to be allocated.
16877
16878 @item -mno-gotplt
16879 @itemx -mgotplt
16880 @opindex mno-gotplt
16881 @opindex mgotplt
16882 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
16883 instruction sequences that load addresses for functions from the PLT part
16884 of the GOT rather than (traditional on other architectures) calls to the
16885 PLT@. The default is @option{-mgotplt}.
16886
16887 @item -melf
16888 @opindex melf
16889 Legacy no-op option only recognized with the cris-axis-elf and
16890 cris-axis-linux-gnu targets.
16891
16892 @item -mlinux
16893 @opindex mlinux
16894 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
16895
16896 @item -sim
16897 @opindex sim
16898 This option, recognized for the cris-axis-elf, arranges
16899 to link with input-output functions from a simulator library. Code,
16900 initialized data and zero-initialized data are allocated consecutively.
16901
16902 @item -sim2
16903 @opindex sim2
16904 Like @option{-sim}, but pass linker options to locate initialized data at
16905 0x40000000 and zero-initialized data at 0x80000000.
16906 @end table
16907
16908 @node CR16 Options
16909 @subsection CR16 Options
16910 @cindex CR16 Options
16911
16912 These options are defined specifically for the CR16 ports.
16913
16914 @table @gcctabopt
16915
16916 @item -mmac
16917 @opindex mmac
16918 Enable the use of multiply-accumulate instructions. Disabled by default.
16919
16920 @item -mcr16cplus
16921 @itemx -mcr16c
16922 @opindex mcr16cplus
16923 @opindex mcr16c
16924 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
16925 is default.
16926
16927 @item -msim
16928 @opindex msim
16929 Links the library libsim.a which is in compatible with simulator. Applicable
16930 to ELF compiler only.
16931
16932 @item -mint32
16933 @opindex mint32
16934 Choose integer type as 32-bit wide.
16935
16936 @item -mbit-ops
16937 @opindex mbit-ops
16938 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
16939
16940 @item -mdata-model=@var{model}
16941 @opindex mdata-model
16942 Choose a data model. The choices for @var{model} are @samp{near},
16943 @samp{far} or @samp{medium}. @samp{medium} is default.
16944 However, @samp{far} is not valid with @option{-mcr16c}, as the
16945 CR16C architecture does not support the far data model.
16946 @end table
16947
16948 @node Darwin Options
16949 @subsection Darwin Options
16950 @cindex Darwin options
16951
16952 These options are defined for all architectures running the Darwin operating
16953 system.
16954
16955 FSF GCC on Darwin does not create ``fat'' object files; it creates
16956 an object file for the single architecture that GCC was built to
16957 target. Apple's GCC on Darwin does create ``fat'' files if multiple
16958 @option{-arch} options are used; it does so by running the compiler or
16959 linker multiple times and joining the results together with
16960 @file{lipo}.
16961
16962 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
16963 @samp{i686}) is determined by the flags that specify the ISA
16964 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
16965 @option{-force_cpusubtype_ALL} option can be used to override this.
16966
16967 The Darwin tools vary in their behavior when presented with an ISA
16968 mismatch. The assembler, @file{as}, only permits instructions to
16969 be used that are valid for the subtype of the file it is generating,
16970 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
16971 The linker for shared libraries, @file{/usr/bin/libtool}, fails
16972 and prints an error if asked to create a shared library with a less
16973 restrictive subtype than its input files (for instance, trying to put
16974 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
16975 for executables, @command{ld}, quietly gives the executable the most
16976 restrictive subtype of any of its input files.
16977
16978 @table @gcctabopt
16979 @item -F@var{dir}
16980 @opindex F
16981 Add the framework directory @var{dir} to the head of the list of
16982 directories to be searched for header files. These directories are
16983 interleaved with those specified by @option{-I} options and are
16984 scanned in a left-to-right order.
16985
16986 A framework directory is a directory with frameworks in it. A
16987 framework is a directory with a @file{Headers} and/or
16988 @file{PrivateHeaders} directory contained directly in it that ends
16989 in @file{.framework}. The name of a framework is the name of this
16990 directory excluding the @file{.framework}. Headers associated with
16991 the framework are found in one of those two directories, with
16992 @file{Headers} being searched first. A subframework is a framework
16993 directory that is in a framework's @file{Frameworks} directory.
16994 Includes of subframework headers can only appear in a header of a
16995 framework that contains the subframework, or in a sibling subframework
16996 header. Two subframeworks are siblings if they occur in the same
16997 framework. A subframework should not have the same name as a
16998 framework; a warning is issued if this is violated. Currently a
16999 subframework cannot have subframeworks; in the future, the mechanism
17000 may be extended to support this. The standard frameworks can be found
17001 in @file{/System/Library/Frameworks} and
17002 @file{/Library/Frameworks}. An example include looks like
17003 @code{#include <Framework/header.h>}, where @file{Framework} denotes
17004 the name of the framework and @file{header.h} is found in the
17005 @file{PrivateHeaders} or @file{Headers} directory.
17006
17007 @item -iframework@var{dir}
17008 @opindex iframework
17009 Like @option{-F} except the directory is a treated as a system
17010 directory. The main difference between this @option{-iframework} and
17011 @option{-F} is that with @option{-iframework} the compiler does not
17012 warn about constructs contained within header files found via
17013 @var{dir}. This option is valid only for the C family of languages.
17014
17015 @item -gused
17016 @opindex gused
17017 Emit debugging information for symbols that are used. For stabs
17018 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
17019 This is by default ON@.
17020
17021 @item -gfull
17022 @opindex gfull
17023 Emit debugging information for all symbols and types.
17024
17025 @item -mmacosx-version-min=@var{version}
17026 The earliest version of MacOS X that this executable will run on
17027 is @var{version}. Typical values of @var{version} include @code{10.1},
17028 @code{10.2}, and @code{10.3.9}.
17029
17030 If the compiler was built to use the system's headers by default,
17031 then the default for this option is the system version on which the
17032 compiler is running, otherwise the default is to make choices that
17033 are compatible with as many systems and code bases as possible.
17034
17035 @item -mkernel
17036 @opindex mkernel
17037 Enable kernel development mode. The @option{-mkernel} option sets
17038 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
17039 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
17040 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
17041 applicable. This mode also sets @option{-mno-altivec},
17042 @option{-msoft-float}, @option{-fno-builtin} and
17043 @option{-mlong-branch} for PowerPC targets.
17044
17045 @item -mone-byte-bool
17046 @opindex mone-byte-bool
17047 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
17048 By default @code{sizeof(bool)} is @code{4} when compiling for
17049 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
17050 option has no effect on x86.
17051
17052 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
17053 to generate code that is not binary compatible with code generated
17054 without that switch. Using this switch may require recompiling all
17055 other modules in a program, including system libraries. Use this
17056 switch to conform to a non-default data model.
17057
17058 @item -mfix-and-continue
17059 @itemx -ffix-and-continue
17060 @itemx -findirect-data
17061 @opindex mfix-and-continue
17062 @opindex ffix-and-continue
17063 @opindex findirect-data
17064 Generate code suitable for fast turnaround development, such as to
17065 allow GDB to dynamically load @file{.o} files into already-running
17066 programs. @option{-findirect-data} and @option{-ffix-and-continue}
17067 are provided for backwards compatibility.
17068
17069 @item -all_load
17070 @opindex all_load
17071 Loads all members of static archive libraries.
17072 See man ld(1) for more information.
17073
17074 @item -arch_errors_fatal
17075 @opindex arch_errors_fatal
17076 Cause the errors having to do with files that have the wrong architecture
17077 to be fatal.
17078
17079 @item -bind_at_load
17080 @opindex bind_at_load
17081 Causes the output file to be marked such that the dynamic linker will
17082 bind all undefined references when the file is loaded or launched.
17083
17084 @item -bundle
17085 @opindex bundle
17086 Produce a Mach-o bundle format file.
17087 See man ld(1) for more information.
17088
17089 @item -bundle_loader @var{executable}
17090 @opindex bundle_loader
17091 This option specifies the @var{executable} that will load the build
17092 output file being linked. See man ld(1) for more information.
17093
17094 @item -dynamiclib
17095 @opindex dynamiclib
17096 When passed this option, GCC produces a dynamic library instead of
17097 an executable when linking, using the Darwin @file{libtool} command.
17098
17099 @item -force_cpusubtype_ALL
17100 @opindex force_cpusubtype_ALL
17101 This causes GCC's output file to have the @samp{ALL} subtype, instead of
17102 one controlled by the @option{-mcpu} or @option{-march} option.
17103
17104 @item -allowable_client @var{client_name}
17105 @itemx -client_name
17106 @itemx -compatibility_version
17107 @itemx -current_version
17108 @itemx -dead_strip
17109 @itemx -dependency-file
17110 @itemx -dylib_file
17111 @itemx -dylinker_install_name
17112 @itemx -dynamic
17113 @itemx -exported_symbols_list
17114 @itemx -filelist
17115 @need 800
17116 @itemx -flat_namespace
17117 @itemx -force_flat_namespace
17118 @itemx -headerpad_max_install_names
17119 @itemx -image_base
17120 @itemx -init
17121 @itemx -install_name
17122 @itemx -keep_private_externs
17123 @itemx -multi_module
17124 @itemx -multiply_defined
17125 @itemx -multiply_defined_unused
17126 @need 800
17127 @itemx -noall_load
17128 @itemx -no_dead_strip_inits_and_terms
17129 @itemx -nofixprebinding
17130 @itemx -nomultidefs
17131 @itemx -noprebind
17132 @itemx -noseglinkedit
17133 @itemx -pagezero_size
17134 @itemx -prebind
17135 @itemx -prebind_all_twolevel_modules
17136 @itemx -private_bundle
17137 @need 800
17138 @itemx -read_only_relocs
17139 @itemx -sectalign
17140 @itemx -sectobjectsymbols
17141 @itemx -whyload
17142 @itemx -seg1addr
17143 @itemx -sectcreate
17144 @itemx -sectobjectsymbols
17145 @itemx -sectorder
17146 @itemx -segaddr
17147 @itemx -segs_read_only_addr
17148 @need 800
17149 @itemx -segs_read_write_addr
17150 @itemx -seg_addr_table
17151 @itemx -seg_addr_table_filename
17152 @itemx -seglinkedit
17153 @itemx -segprot
17154 @itemx -segs_read_only_addr
17155 @itemx -segs_read_write_addr
17156 @itemx -single_module
17157 @itemx -static
17158 @itemx -sub_library
17159 @need 800
17160 @itemx -sub_umbrella
17161 @itemx -twolevel_namespace
17162 @itemx -umbrella
17163 @itemx -undefined
17164 @itemx -unexported_symbols_list
17165 @itemx -weak_reference_mismatches
17166 @itemx -whatsloaded
17167 @opindex allowable_client
17168 @opindex client_name
17169 @opindex compatibility_version
17170 @opindex current_version
17171 @opindex dead_strip
17172 @opindex dependency-file
17173 @opindex dylib_file
17174 @opindex dylinker_install_name
17175 @opindex dynamic
17176 @opindex exported_symbols_list
17177 @opindex filelist
17178 @opindex flat_namespace
17179 @opindex force_flat_namespace
17180 @opindex headerpad_max_install_names
17181 @opindex image_base
17182 @opindex init
17183 @opindex install_name
17184 @opindex keep_private_externs
17185 @opindex multi_module
17186 @opindex multiply_defined
17187 @opindex multiply_defined_unused
17188 @opindex noall_load
17189 @opindex no_dead_strip_inits_and_terms
17190 @opindex nofixprebinding
17191 @opindex nomultidefs
17192 @opindex noprebind
17193 @opindex noseglinkedit
17194 @opindex pagezero_size
17195 @opindex prebind
17196 @opindex prebind_all_twolevel_modules
17197 @opindex private_bundle
17198 @opindex read_only_relocs
17199 @opindex sectalign
17200 @opindex sectobjectsymbols
17201 @opindex whyload
17202 @opindex seg1addr
17203 @opindex sectcreate
17204 @opindex sectobjectsymbols
17205 @opindex sectorder
17206 @opindex segaddr
17207 @opindex segs_read_only_addr
17208 @opindex segs_read_write_addr
17209 @opindex seg_addr_table
17210 @opindex seg_addr_table_filename
17211 @opindex seglinkedit
17212 @opindex segprot
17213 @opindex segs_read_only_addr
17214 @opindex segs_read_write_addr
17215 @opindex single_module
17216 @opindex static
17217 @opindex sub_library
17218 @opindex sub_umbrella
17219 @opindex twolevel_namespace
17220 @opindex umbrella
17221 @opindex undefined
17222 @opindex unexported_symbols_list
17223 @opindex weak_reference_mismatches
17224 @opindex whatsloaded
17225 These options are passed to the Darwin linker. The Darwin linker man page
17226 describes them in detail.
17227 @end table
17228
17229 @node DEC Alpha Options
17230 @subsection DEC Alpha Options
17231
17232 These @samp{-m} options are defined for the DEC Alpha implementations:
17233
17234 @table @gcctabopt
17235 @item -mno-soft-float
17236 @itemx -msoft-float
17237 @opindex mno-soft-float
17238 @opindex msoft-float
17239 Use (do not use) the hardware floating-point instructions for
17240 floating-point operations. When @option{-msoft-float} is specified,
17241 functions in @file{libgcc.a} are used to perform floating-point
17242 operations. Unless they are replaced by routines that emulate the
17243 floating-point operations, or compiled in such a way as to call such
17244 emulations routines, these routines issue floating-point
17245 operations. If you are compiling for an Alpha without floating-point
17246 operations, you must ensure that the library is built so as not to call
17247 them.
17248
17249 Note that Alpha implementations without floating-point operations are
17250 required to have floating-point registers.
17251
17252 @item -mfp-reg
17253 @itemx -mno-fp-regs
17254 @opindex mfp-reg
17255 @opindex mno-fp-regs
17256 Generate code that uses (does not use) the floating-point register set.
17257 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
17258 register set is not used, floating-point operands are passed in integer
17259 registers as if they were integers and floating-point results are passed
17260 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
17261 so any function with a floating-point argument or return value called by code
17262 compiled with @option{-mno-fp-regs} must also be compiled with that
17263 option.
17264
17265 A typical use of this option is building a kernel that does not use,
17266 and hence need not save and restore, any floating-point registers.
17267
17268 @item -mieee
17269 @opindex mieee
17270 The Alpha architecture implements floating-point hardware optimized for
17271 maximum performance. It is mostly compliant with the IEEE floating-point
17272 standard. However, for full compliance, software assistance is
17273 required. This option generates code fully IEEE-compliant code
17274 @emph{except} that the @var{inexact-flag} is not maintained (see below).
17275 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
17276 defined during compilation. The resulting code is less efficient but is
17277 able to correctly support denormalized numbers and exceptional IEEE
17278 values such as not-a-number and plus/minus infinity. Other Alpha
17279 compilers call this option @option{-ieee_with_no_inexact}.
17280
17281 @item -mieee-with-inexact
17282 @opindex mieee-with-inexact
17283 This is like @option{-mieee} except the generated code also maintains
17284 the IEEE @var{inexact-flag}. Turning on this option causes the
17285 generated code to implement fully-compliant IEEE math. In addition to
17286 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
17287 macro. On some Alpha implementations the resulting code may execute
17288 significantly slower than the code generated by default. Since there is
17289 very little code that depends on the @var{inexact-flag}, you should
17290 normally not specify this option. Other Alpha compilers call this
17291 option @option{-ieee_with_inexact}.
17292
17293 @item -mfp-trap-mode=@var{trap-mode}
17294 @opindex mfp-trap-mode
17295 This option controls what floating-point related traps are enabled.
17296 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
17297 The trap mode can be set to one of four values:
17298
17299 @table @samp
17300 @item n
17301 This is the default (normal) setting. The only traps that are enabled
17302 are the ones that cannot be disabled in software (e.g., division by zero
17303 trap).
17304
17305 @item u
17306 In addition to the traps enabled by @samp{n}, underflow traps are enabled
17307 as well.
17308
17309 @item su
17310 Like @samp{u}, but the instructions are marked to be safe for software
17311 completion (see Alpha architecture manual for details).
17312
17313 @item sui
17314 Like @samp{su}, but inexact traps are enabled as well.
17315 @end table
17316
17317 @item -mfp-rounding-mode=@var{rounding-mode}
17318 @opindex mfp-rounding-mode
17319 Selects the IEEE rounding mode. Other Alpha compilers call this option
17320 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
17321 of:
17322
17323 @table @samp
17324 @item n
17325 Normal IEEE rounding mode. Floating-point numbers are rounded towards
17326 the nearest machine number or towards the even machine number in case
17327 of a tie.
17328
17329 @item m
17330 Round towards minus infinity.
17331
17332 @item c
17333 Chopped rounding mode. Floating-point numbers are rounded towards zero.
17334
17335 @item d
17336 Dynamic rounding mode. A field in the floating-point control register
17337 (@var{fpcr}, see Alpha architecture reference manual) controls the
17338 rounding mode in effect. The C library initializes this register for
17339 rounding towards plus infinity. Thus, unless your program modifies the
17340 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
17341 @end table
17342
17343 @item -mtrap-precision=@var{trap-precision}
17344 @opindex mtrap-precision
17345 In the Alpha architecture, floating-point traps are imprecise. This
17346 means without software assistance it is impossible to recover from a
17347 floating trap and program execution normally needs to be terminated.
17348 GCC can generate code that can assist operating system trap handlers
17349 in determining the exact location that caused a floating-point trap.
17350 Depending on the requirements of an application, different levels of
17351 precisions can be selected:
17352
17353 @table @samp
17354 @item p
17355 Program precision. This option is the default and means a trap handler
17356 can only identify which program caused a floating-point exception.
17357
17358 @item f
17359 Function precision. The trap handler can determine the function that
17360 caused a floating-point exception.
17361
17362 @item i
17363 Instruction precision. The trap handler can determine the exact
17364 instruction that caused a floating-point exception.
17365 @end table
17366
17367 Other Alpha compilers provide the equivalent options called
17368 @option{-scope_safe} and @option{-resumption_safe}.
17369
17370 @item -mieee-conformant
17371 @opindex mieee-conformant
17372 This option marks the generated code as IEEE conformant. You must not
17373 use this option unless you also specify @option{-mtrap-precision=i} and either
17374 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
17375 is to emit the line @samp{.eflag 48} in the function prologue of the
17376 generated assembly file.
17377
17378 @item -mbuild-constants
17379 @opindex mbuild-constants
17380 Normally GCC examines a 32- or 64-bit integer constant to
17381 see if it can construct it from smaller constants in two or three
17382 instructions. If it cannot, it outputs the constant as a literal and
17383 generates code to load it from the data segment at run time.
17384
17385 Use this option to require GCC to construct @emph{all} integer constants
17386 using code, even if it takes more instructions (the maximum is six).
17387
17388 You typically use this option to build a shared library dynamic
17389 loader. Itself a shared library, it must relocate itself in memory
17390 before it can find the variables and constants in its own data segment.
17391
17392 @item -mbwx
17393 @itemx -mno-bwx
17394 @itemx -mcix
17395 @itemx -mno-cix
17396 @itemx -mfix
17397 @itemx -mno-fix
17398 @itemx -mmax
17399 @itemx -mno-max
17400 @opindex mbwx
17401 @opindex mno-bwx
17402 @opindex mcix
17403 @opindex mno-cix
17404 @opindex mfix
17405 @opindex mno-fix
17406 @opindex mmax
17407 @opindex mno-max
17408 Indicate whether GCC should generate code to use the optional BWX,
17409 CIX, FIX and MAX instruction sets. The default is to use the instruction
17410 sets supported by the CPU type specified via @option{-mcpu=} option or that
17411 of the CPU on which GCC was built if none is specified.
17412
17413 @item -mfloat-vax
17414 @itemx -mfloat-ieee
17415 @opindex mfloat-vax
17416 @opindex mfloat-ieee
17417 Generate code that uses (does not use) VAX F and G floating-point
17418 arithmetic instead of IEEE single and double precision.
17419
17420 @item -mexplicit-relocs
17421 @itemx -mno-explicit-relocs
17422 @opindex mexplicit-relocs
17423 @opindex mno-explicit-relocs
17424 Older Alpha assemblers provided no way to generate symbol relocations
17425 except via assembler macros. Use of these macros does not allow
17426 optimal instruction scheduling. GNU binutils as of version 2.12
17427 supports a new syntax that allows the compiler to explicitly mark
17428 which relocations should apply to which instructions. This option
17429 is mostly useful for debugging, as GCC detects the capabilities of
17430 the assembler when it is built and sets the default accordingly.
17431
17432 @item -msmall-data
17433 @itemx -mlarge-data
17434 @opindex msmall-data
17435 @opindex mlarge-data
17436 When @option{-mexplicit-relocs} is in effect, static data is
17437 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
17438 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
17439 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
17440 16-bit relocations off of the @code{$gp} register. This limits the
17441 size of the small data area to 64KB, but allows the variables to be
17442 directly accessed via a single instruction.
17443
17444 The default is @option{-mlarge-data}. With this option the data area
17445 is limited to just below 2GB@. Programs that require more than 2GB of
17446 data must use @code{malloc} or @code{mmap} to allocate the data in the
17447 heap instead of in the program's data segment.
17448
17449 When generating code for shared libraries, @option{-fpic} implies
17450 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
17451
17452 @item -msmall-text
17453 @itemx -mlarge-text
17454 @opindex msmall-text
17455 @opindex mlarge-text
17456 When @option{-msmall-text} is used, the compiler assumes that the
17457 code of the entire program (or shared library) fits in 4MB, and is
17458 thus reachable with a branch instruction. When @option{-msmall-data}
17459 is used, the compiler can assume that all local symbols share the
17460 same @code{$gp} value, and thus reduce the number of instructions
17461 required for a function call from 4 to 1.
17462
17463 The default is @option{-mlarge-text}.
17464
17465 @item -mcpu=@var{cpu_type}
17466 @opindex mcpu
17467 Set the instruction set and instruction scheduling parameters for
17468 machine type @var{cpu_type}. You can specify either the @samp{EV}
17469 style name or the corresponding chip number. GCC supports scheduling
17470 parameters for the EV4, EV5 and EV6 family of processors and
17471 chooses the default values for the instruction set from the processor
17472 you specify. If you do not specify a processor type, GCC defaults
17473 to the processor on which the compiler was built.
17474
17475 Supported values for @var{cpu_type} are
17476
17477 @table @samp
17478 @item ev4
17479 @itemx ev45
17480 @itemx 21064
17481 Schedules as an EV4 and has no instruction set extensions.
17482
17483 @item ev5
17484 @itemx 21164
17485 Schedules as an EV5 and has no instruction set extensions.
17486
17487 @item ev56
17488 @itemx 21164a
17489 Schedules as an EV5 and supports the BWX extension.
17490
17491 @item pca56
17492 @itemx 21164pc
17493 @itemx 21164PC
17494 Schedules as an EV5 and supports the BWX and MAX extensions.
17495
17496 @item ev6
17497 @itemx 21264
17498 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
17499
17500 @item ev67
17501 @itemx 21264a
17502 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
17503 @end table
17504
17505 Native toolchains also support the value @samp{native},
17506 which selects the best architecture option for the host processor.
17507 @option{-mcpu=native} has no effect if GCC does not recognize
17508 the processor.
17509
17510 @item -mtune=@var{cpu_type}
17511 @opindex mtune
17512 Set only the instruction scheduling parameters for machine type
17513 @var{cpu_type}. The instruction set is not changed.
17514
17515 Native toolchains also support the value @samp{native},
17516 which selects the best architecture option for the host processor.
17517 @option{-mtune=native} has no effect if GCC does not recognize
17518 the processor.
17519
17520 @item -mmemory-latency=@var{time}
17521 @opindex mmemory-latency
17522 Sets the latency the scheduler should assume for typical memory
17523 references as seen by the application. This number is highly
17524 dependent on the memory access patterns used by the application
17525 and the size of the external cache on the machine.
17526
17527 Valid options for @var{time} are
17528
17529 @table @samp
17530 @item @var{number}
17531 A decimal number representing clock cycles.
17532
17533 @item L1
17534 @itemx L2
17535 @itemx L3
17536 @itemx main
17537 The compiler contains estimates of the number of clock cycles for
17538 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
17539 (also called Dcache, Scache, and Bcache), as well as to main memory.
17540 Note that L3 is only valid for EV5.
17541
17542 @end table
17543 @end table
17544
17545 @node FR30 Options
17546 @subsection FR30 Options
17547 @cindex FR30 Options
17548
17549 These options are defined specifically for the FR30 port.
17550
17551 @table @gcctabopt
17552
17553 @item -msmall-model
17554 @opindex msmall-model
17555 Use the small address space model. This can produce smaller code, but
17556 it does assume that all symbolic values and addresses fit into a
17557 20-bit range.
17558
17559 @item -mno-lsim
17560 @opindex mno-lsim
17561 Assume that runtime support has been provided and so there is no need
17562 to include the simulator library (@file{libsim.a}) on the linker
17563 command line.
17564
17565 @end table
17566
17567 @node FT32 Options
17568 @subsection FT32 Options
17569 @cindex FT32 Options
17570
17571 These options are defined specifically for the FT32 port.
17572
17573 @table @gcctabopt
17574
17575 @item -msim
17576 @opindex msim
17577 Specifies that the program will be run on the simulator. This causes
17578 an alternate runtime startup and library to be linked.
17579 You must not use this option when generating programs that will run on
17580 real hardware; you must provide your own runtime library for whatever
17581 I/O functions are needed.
17582
17583 @item -mlra
17584 @opindex mlra
17585 Enable Local Register Allocation. This is still experimental for FT32,
17586 so by default the compiler uses standard reload.
17587
17588 @item -mnodiv
17589 @opindex mnodiv
17590 Do not use div and mod instructions.
17591
17592 @end table
17593
17594 @node FRV Options
17595 @subsection FRV Options
17596 @cindex FRV Options
17597
17598 @table @gcctabopt
17599 @item -mgpr-32
17600 @opindex mgpr-32
17601
17602 Only use the first 32 general-purpose registers.
17603
17604 @item -mgpr-64
17605 @opindex mgpr-64
17606
17607 Use all 64 general-purpose registers.
17608
17609 @item -mfpr-32
17610 @opindex mfpr-32
17611
17612 Use only the first 32 floating-point registers.
17613
17614 @item -mfpr-64
17615 @opindex mfpr-64
17616
17617 Use all 64 floating-point registers.
17618
17619 @item -mhard-float
17620 @opindex mhard-float
17621
17622 Use hardware instructions for floating-point operations.
17623
17624 @item -msoft-float
17625 @opindex msoft-float
17626
17627 Use library routines for floating-point operations.
17628
17629 @item -malloc-cc
17630 @opindex malloc-cc
17631
17632 Dynamically allocate condition code registers.
17633
17634 @item -mfixed-cc
17635 @opindex mfixed-cc
17636
17637 Do not try to dynamically allocate condition code registers, only
17638 use @code{icc0} and @code{fcc0}.
17639
17640 @item -mdword
17641 @opindex mdword
17642
17643 Change ABI to use double word insns.
17644
17645 @item -mno-dword
17646 @opindex mno-dword
17647
17648 Do not use double word instructions.
17649
17650 @item -mdouble
17651 @opindex mdouble
17652
17653 Use floating-point double instructions.
17654
17655 @item -mno-double
17656 @opindex mno-double
17657
17658 Do not use floating-point double instructions.
17659
17660 @item -mmedia
17661 @opindex mmedia
17662
17663 Use media instructions.
17664
17665 @item -mno-media
17666 @opindex mno-media
17667
17668 Do not use media instructions.
17669
17670 @item -mmuladd
17671 @opindex mmuladd
17672
17673 Use multiply and add/subtract instructions.
17674
17675 @item -mno-muladd
17676 @opindex mno-muladd
17677
17678 Do not use multiply and add/subtract instructions.
17679
17680 @item -mfdpic
17681 @opindex mfdpic
17682
17683 Select the FDPIC ABI, which uses function descriptors to represent
17684 pointers to functions. Without any PIC/PIE-related options, it
17685 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
17686 assumes GOT entries and small data are within a 12-bit range from the
17687 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
17688 are computed with 32 bits.
17689 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17690
17691 @item -minline-plt
17692 @opindex minline-plt
17693
17694 Enable inlining of PLT entries in function calls to functions that are
17695 not known to bind locally. It has no effect without @option{-mfdpic}.
17696 It's enabled by default if optimizing for speed and compiling for
17697 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
17698 optimization option such as @option{-O3} or above is present in the
17699 command line.
17700
17701 @item -mTLS
17702 @opindex mTLS
17703
17704 Assume a large TLS segment when generating thread-local code.
17705
17706 @item -mtls
17707 @opindex mtls
17708
17709 Do not assume a large TLS segment when generating thread-local code.
17710
17711 @item -mgprel-ro
17712 @opindex mgprel-ro
17713
17714 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
17715 that is known to be in read-only sections. It's enabled by default,
17716 except for @option{-fpic} or @option{-fpie}: even though it may help
17717 make the global offset table smaller, it trades 1 instruction for 4.
17718 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
17719 one of which may be shared by multiple symbols, and it avoids the need
17720 for a GOT entry for the referenced symbol, so it's more likely to be a
17721 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
17722
17723 @item -multilib-library-pic
17724 @opindex multilib-library-pic
17725
17726 Link with the (library, not FD) pic libraries. It's implied by
17727 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
17728 @option{-fpic} without @option{-mfdpic}. You should never have to use
17729 it explicitly.
17730
17731 @item -mlinked-fp
17732 @opindex mlinked-fp
17733
17734 Follow the EABI requirement of always creating a frame pointer whenever
17735 a stack frame is allocated. This option is enabled by default and can
17736 be disabled with @option{-mno-linked-fp}.
17737
17738 @item -mlong-calls
17739 @opindex mlong-calls
17740
17741 Use indirect addressing to call functions outside the current
17742 compilation unit. This allows the functions to be placed anywhere
17743 within the 32-bit address space.
17744
17745 @item -malign-labels
17746 @opindex malign-labels
17747
17748 Try to align labels to an 8-byte boundary by inserting NOPs into the
17749 previous packet. This option only has an effect when VLIW packing
17750 is enabled. It doesn't create new packets; it merely adds NOPs to
17751 existing ones.
17752
17753 @item -mlibrary-pic
17754 @opindex mlibrary-pic
17755
17756 Generate position-independent EABI code.
17757
17758 @item -macc-4
17759 @opindex macc-4
17760
17761 Use only the first four media accumulator registers.
17762
17763 @item -macc-8
17764 @opindex macc-8
17765
17766 Use all eight media accumulator registers.
17767
17768 @item -mpack
17769 @opindex mpack
17770
17771 Pack VLIW instructions.
17772
17773 @item -mno-pack
17774 @opindex mno-pack
17775
17776 Do not pack VLIW instructions.
17777
17778 @item -mno-eflags
17779 @opindex mno-eflags
17780
17781 Do not mark ABI switches in e_flags.
17782
17783 @item -mcond-move
17784 @opindex mcond-move
17785
17786 Enable the use of conditional-move instructions (default).
17787
17788 This switch is mainly for debugging the compiler and will likely be removed
17789 in a future version.
17790
17791 @item -mno-cond-move
17792 @opindex mno-cond-move
17793
17794 Disable the use of conditional-move instructions.
17795
17796 This switch is mainly for debugging the compiler and will likely be removed
17797 in a future version.
17798
17799 @item -mscc
17800 @opindex mscc
17801
17802 Enable the use of conditional set instructions (default).
17803
17804 This switch is mainly for debugging the compiler and will likely be removed
17805 in a future version.
17806
17807 @item -mno-scc
17808 @opindex mno-scc
17809
17810 Disable the use of conditional set instructions.
17811
17812 This switch is mainly for debugging the compiler and will likely be removed
17813 in a future version.
17814
17815 @item -mcond-exec
17816 @opindex mcond-exec
17817
17818 Enable the use of conditional execution (default).
17819
17820 This switch is mainly for debugging the compiler and will likely be removed
17821 in a future version.
17822
17823 @item -mno-cond-exec
17824 @opindex mno-cond-exec
17825
17826 Disable the use of conditional execution.
17827
17828 This switch is mainly for debugging the compiler and will likely be removed
17829 in a future version.
17830
17831 @item -mvliw-branch
17832 @opindex mvliw-branch
17833
17834 Run a pass to pack branches into VLIW instructions (default).
17835
17836 This switch is mainly for debugging the compiler and will likely be removed
17837 in a future version.
17838
17839 @item -mno-vliw-branch
17840 @opindex mno-vliw-branch
17841
17842 Do not run a pass to pack branches into VLIW instructions.
17843
17844 This switch is mainly for debugging the compiler and will likely be removed
17845 in a future version.
17846
17847 @item -mmulti-cond-exec
17848 @opindex mmulti-cond-exec
17849
17850 Enable optimization of @code{&&} and @code{||} in conditional execution
17851 (default).
17852
17853 This switch is mainly for debugging the compiler and will likely be removed
17854 in a future version.
17855
17856 @item -mno-multi-cond-exec
17857 @opindex mno-multi-cond-exec
17858
17859 Disable optimization of @code{&&} and @code{||} in conditional execution.
17860
17861 This switch is mainly for debugging the compiler and will likely be removed
17862 in a future version.
17863
17864 @item -mnested-cond-exec
17865 @opindex mnested-cond-exec
17866
17867 Enable nested conditional execution optimizations (default).
17868
17869 This switch is mainly for debugging the compiler and will likely be removed
17870 in a future version.
17871
17872 @item -mno-nested-cond-exec
17873 @opindex mno-nested-cond-exec
17874
17875 Disable nested conditional execution optimizations.
17876
17877 This switch is mainly for debugging the compiler and will likely be removed
17878 in a future version.
17879
17880 @item -moptimize-membar
17881 @opindex moptimize-membar
17882
17883 This switch removes redundant @code{membar} instructions from the
17884 compiler-generated code. It is enabled by default.
17885
17886 @item -mno-optimize-membar
17887 @opindex mno-optimize-membar
17888
17889 This switch disables the automatic removal of redundant @code{membar}
17890 instructions from the generated code.
17891
17892 @item -mtomcat-stats
17893 @opindex mtomcat-stats
17894
17895 Cause gas to print out tomcat statistics.
17896
17897 @item -mcpu=@var{cpu}
17898 @opindex mcpu
17899
17900 Select the processor type for which to generate code. Possible values are
17901 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
17902 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
17903
17904 @end table
17905
17906 @node GNU/Linux Options
17907 @subsection GNU/Linux Options
17908
17909 These @samp{-m} options are defined for GNU/Linux targets:
17910
17911 @table @gcctabopt
17912 @item -mglibc
17913 @opindex mglibc
17914 Use the GNU C library. This is the default except
17915 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
17916 @samp{*-*-linux-*android*} targets.
17917
17918 @item -muclibc
17919 @opindex muclibc
17920 Use uClibc C library. This is the default on
17921 @samp{*-*-linux-*uclibc*} targets.
17922
17923 @item -mmusl
17924 @opindex mmusl
17925 Use the musl C library. This is the default on
17926 @samp{*-*-linux-*musl*} targets.
17927
17928 @item -mbionic
17929 @opindex mbionic
17930 Use Bionic C library. This is the default on
17931 @samp{*-*-linux-*android*} targets.
17932
17933 @item -mandroid
17934 @opindex mandroid
17935 Compile code compatible with Android platform. This is the default on
17936 @samp{*-*-linux-*android*} targets.
17937
17938 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
17939 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
17940 this option makes the GCC driver pass Android-specific options to the linker.
17941 Finally, this option causes the preprocessor macro @code{__ANDROID__}
17942 to be defined.
17943
17944 @item -tno-android-cc
17945 @opindex tno-android-cc
17946 Disable compilation effects of @option{-mandroid}, i.e., do not enable
17947 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
17948 @option{-fno-rtti} by default.
17949
17950 @item -tno-android-ld
17951 @opindex tno-android-ld
17952 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
17953 linking options to the linker.
17954
17955 @end table
17956
17957 @node H8/300 Options
17958 @subsection H8/300 Options
17959
17960 These @samp{-m} options are defined for the H8/300 implementations:
17961
17962 @table @gcctabopt
17963 @item -mrelax
17964 @opindex mrelax
17965 Shorten some address references at link time, when possible; uses the
17966 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
17967 ld, Using ld}, for a fuller description.
17968
17969 @item -mh
17970 @opindex mh
17971 Generate code for the H8/300H@.
17972
17973 @item -ms
17974 @opindex ms
17975 Generate code for the H8S@.
17976
17977 @item -mn
17978 @opindex mn
17979 Generate code for the H8S and H8/300H in the normal mode. This switch
17980 must be used either with @option{-mh} or @option{-ms}.
17981
17982 @item -ms2600
17983 @opindex ms2600
17984 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
17985
17986 @item -mexr
17987 @opindex mexr
17988 Extended registers are stored on stack before execution of function
17989 with monitor attribute. Default option is @option{-mexr}.
17990 This option is valid only for H8S targets.
17991
17992 @item -mno-exr
17993 @opindex mno-exr
17994 Extended registers are not stored on stack before execution of function
17995 with monitor attribute. Default option is @option{-mno-exr}.
17996 This option is valid only for H8S targets.
17997
17998 @item -mint32
17999 @opindex mint32
18000 Make @code{int} data 32 bits by default.
18001
18002 @item -malign-300
18003 @opindex malign-300
18004 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
18005 The default for the H8/300H and H8S is to align longs and floats on
18006 4-byte boundaries.
18007 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
18008 This option has no effect on the H8/300.
18009 @end table
18010
18011 @node HPPA Options
18012 @subsection HPPA Options
18013 @cindex HPPA Options
18014
18015 These @samp{-m} options are defined for the HPPA family of computers:
18016
18017 @table @gcctabopt
18018 @item -march=@var{architecture-type}
18019 @opindex march
18020 Generate code for the specified architecture. The choices for
18021 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
18022 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
18023 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
18024 architecture option for your machine. Code compiled for lower numbered
18025 architectures runs on higher numbered architectures, but not the
18026 other way around.
18027
18028 @item -mpa-risc-1-0
18029 @itemx -mpa-risc-1-1
18030 @itemx -mpa-risc-2-0
18031 @opindex mpa-risc-1-0
18032 @opindex mpa-risc-1-1
18033 @opindex mpa-risc-2-0
18034 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
18035
18036 @item -mcaller-copies
18037 @opindex mcaller-copies
18038 The caller copies function arguments passed by hidden reference. This
18039 option should be used with care as it is not compatible with the default
18040 32-bit runtime. However, only aggregates larger than eight bytes are
18041 passed by hidden reference and the option provides better compatibility
18042 with OpenMP.
18043
18044 @item -mjump-in-delay
18045 @opindex mjump-in-delay
18046 This option is ignored and provided for compatibility purposes only.
18047
18048 @item -mdisable-fpregs
18049 @opindex mdisable-fpregs
18050 Prevent floating-point registers from being used in any manner. This is
18051 necessary for compiling kernels that perform lazy context switching of
18052 floating-point registers. If you use this option and attempt to perform
18053 floating-point operations, the compiler aborts.
18054
18055 @item -mdisable-indexing
18056 @opindex mdisable-indexing
18057 Prevent the compiler from using indexing address modes. This avoids some
18058 rather obscure problems when compiling MIG generated code under MACH@.
18059
18060 @item -mno-space-regs
18061 @opindex mno-space-regs
18062 Generate code that assumes the target has no space registers. This allows
18063 GCC to generate faster indirect calls and use unscaled index address modes.
18064
18065 Such code is suitable for level 0 PA systems and kernels.
18066
18067 @item -mfast-indirect-calls
18068 @opindex mfast-indirect-calls
18069 Generate code that assumes calls never cross space boundaries. This
18070 allows GCC to emit code that performs faster indirect calls.
18071
18072 This option does not work in the presence of shared libraries or nested
18073 functions.
18074
18075 @item -mfixed-range=@var{register-range}
18076 @opindex mfixed-range
18077 Generate code treating the given register range as fixed registers.
18078 A fixed register is one that the register allocator cannot use. This is
18079 useful when compiling kernel code. A register range is specified as
18080 two registers separated by a dash. Multiple register ranges can be
18081 specified separated by a comma.
18082
18083 @item -mlong-load-store
18084 @opindex mlong-load-store
18085 Generate 3-instruction load and store sequences as sometimes required by
18086 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
18087 the HP compilers.
18088
18089 @item -mportable-runtime
18090 @opindex mportable-runtime
18091 Use the portable calling conventions proposed by HP for ELF systems.
18092
18093 @item -mgas
18094 @opindex mgas
18095 Enable the use of assembler directives only GAS understands.
18096
18097 @item -mschedule=@var{cpu-type}
18098 @opindex mschedule
18099 Schedule code according to the constraints for the machine type
18100 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
18101 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
18102 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
18103 proper scheduling option for your machine. The default scheduling is
18104 @samp{8000}.
18105
18106 @item -mlinker-opt
18107 @opindex mlinker-opt
18108 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
18109 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
18110 linkers in which they give bogus error messages when linking some programs.
18111
18112 @item -msoft-float
18113 @opindex msoft-float
18114 Generate output containing library calls for floating point.
18115 @strong{Warning:} the requisite libraries are not available for all HPPA
18116 targets. Normally the facilities of the machine's usual C compiler are
18117 used, but this cannot be done directly in cross-compilation. You must make
18118 your own arrangements to provide suitable library functions for
18119 cross-compilation.
18120
18121 @option{-msoft-float} changes the calling convention in the output file;
18122 therefore, it is only useful if you compile @emph{all} of a program with
18123 this option. In particular, you need to compile @file{libgcc.a}, the
18124 library that comes with GCC, with @option{-msoft-float} in order for
18125 this to work.
18126
18127 @item -msio
18128 @opindex msio
18129 Generate the predefine, @code{_SIO}, for server IO@. The default is
18130 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
18131 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
18132 options are available under HP-UX and HI-UX@.
18133
18134 @item -mgnu-ld
18135 @opindex mgnu-ld
18136 Use options specific to GNU @command{ld}.
18137 This passes @option{-shared} to @command{ld} when
18138 building a shared library. It is the default when GCC is configured,
18139 explicitly or implicitly, with the GNU linker. This option does not
18140 affect which @command{ld} is called; it only changes what parameters
18141 are passed to that @command{ld}.
18142 The @command{ld} that is called is determined by the
18143 @option{--with-ld} configure option, GCC's program search path, and
18144 finally by the user's @env{PATH}. The linker used by GCC can be printed
18145 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
18146 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18147
18148 @item -mhp-ld
18149 @opindex mhp-ld
18150 Use options specific to HP @command{ld}.
18151 This passes @option{-b} to @command{ld} when building
18152 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
18153 links. It is the default when GCC is configured, explicitly or
18154 implicitly, with the HP linker. This option does not affect
18155 which @command{ld} is called; it only changes what parameters are passed to that
18156 @command{ld}.
18157 The @command{ld} that is called is determined by the @option{--with-ld}
18158 configure option, GCC's program search path, and finally by the user's
18159 @env{PATH}. The linker used by GCC can be printed using @samp{which
18160 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
18161 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18162
18163 @item -mlong-calls
18164 @opindex mno-long-calls
18165 Generate code that uses long call sequences. This ensures that a call
18166 is always able to reach linker generated stubs. The default is to generate
18167 long calls only when the distance from the call site to the beginning
18168 of the function or translation unit, as the case may be, exceeds a
18169 predefined limit set by the branch type being used. The limits for
18170 normal calls are 7,600,000 and 240,000 bytes, respectively for the
18171 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
18172 240,000 bytes.
18173
18174 Distances are measured from the beginning of functions when using the
18175 @option{-ffunction-sections} option, or when using the @option{-mgas}
18176 and @option{-mno-portable-runtime} options together under HP-UX with
18177 the SOM linker.
18178
18179 It is normally not desirable to use this option as it degrades
18180 performance. However, it may be useful in large applications,
18181 particularly when partial linking is used to build the application.
18182
18183 The types of long calls used depends on the capabilities of the
18184 assembler and linker, and the type of code being generated. The
18185 impact on systems that support long absolute calls, and long pic
18186 symbol-difference or pc-relative calls should be relatively small.
18187 However, an indirect call is used on 32-bit ELF systems in pic code
18188 and it is quite long.
18189
18190 @item -munix=@var{unix-std}
18191 @opindex march
18192 Generate compiler predefines and select a startfile for the specified
18193 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
18194 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
18195 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
18196 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
18197 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
18198 and later.
18199
18200 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
18201 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
18202 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
18203 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
18204 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
18205 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
18206
18207 It is @emph{important} to note that this option changes the interfaces
18208 for various library routines. It also affects the operational behavior
18209 of the C library. Thus, @emph{extreme} care is needed in using this
18210 option.
18211
18212 Library code that is intended to operate with more than one UNIX
18213 standard must test, set and restore the variable @code{__xpg4_extended_mask}
18214 as appropriate. Most GNU software doesn't provide this capability.
18215
18216 @item -nolibdld
18217 @opindex nolibdld
18218 Suppress the generation of link options to search libdld.sl when the
18219 @option{-static} option is specified on HP-UX 10 and later.
18220
18221 @item -static
18222 @opindex static
18223 The HP-UX implementation of setlocale in libc has a dependency on
18224 libdld.sl. There isn't an archive version of libdld.sl. Thus,
18225 when the @option{-static} option is specified, special link options
18226 are needed to resolve this dependency.
18227
18228 On HP-UX 10 and later, the GCC driver adds the necessary options to
18229 link with libdld.sl when the @option{-static} option is specified.
18230 This causes the resulting binary to be dynamic. On the 64-bit port,
18231 the linkers generate dynamic binaries by default in any case. The
18232 @option{-nolibdld} option can be used to prevent the GCC driver from
18233 adding these link options.
18234
18235 @item -threads
18236 @opindex threads
18237 Add support for multithreading with the @dfn{dce thread} library
18238 under HP-UX@. This option sets flags for both the preprocessor and
18239 linker.
18240 @end table
18241
18242 @node IA-64 Options
18243 @subsection IA-64 Options
18244 @cindex IA-64 Options
18245
18246 These are the @samp{-m} options defined for the Intel IA-64 architecture.
18247
18248 @table @gcctabopt
18249 @item -mbig-endian
18250 @opindex mbig-endian
18251 Generate code for a big-endian target. This is the default for HP-UX@.
18252
18253 @item -mlittle-endian
18254 @opindex mlittle-endian
18255 Generate code for a little-endian target. This is the default for AIX5
18256 and GNU/Linux.
18257
18258 @item -mgnu-as
18259 @itemx -mno-gnu-as
18260 @opindex mgnu-as
18261 @opindex mno-gnu-as
18262 Generate (or don't) code for the GNU assembler. This is the default.
18263 @c Also, this is the default if the configure option @option{--with-gnu-as}
18264 @c is used.
18265
18266 @item -mgnu-ld
18267 @itemx -mno-gnu-ld
18268 @opindex mgnu-ld
18269 @opindex mno-gnu-ld
18270 Generate (or don't) code for the GNU linker. This is the default.
18271 @c Also, this is the default if the configure option @option{--with-gnu-ld}
18272 @c is used.
18273
18274 @item -mno-pic
18275 @opindex mno-pic
18276 Generate code that does not use a global pointer register. The result
18277 is not position independent code, and violates the IA-64 ABI@.
18278
18279 @item -mvolatile-asm-stop
18280 @itemx -mno-volatile-asm-stop
18281 @opindex mvolatile-asm-stop
18282 @opindex mno-volatile-asm-stop
18283 Generate (or don't) a stop bit immediately before and after volatile asm
18284 statements.
18285
18286 @item -mregister-names
18287 @itemx -mno-register-names
18288 @opindex mregister-names
18289 @opindex mno-register-names
18290 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
18291 the stacked registers. This may make assembler output more readable.
18292
18293 @item -mno-sdata
18294 @itemx -msdata
18295 @opindex mno-sdata
18296 @opindex msdata
18297 Disable (or enable) optimizations that use the small data section. This may
18298 be useful for working around optimizer bugs.
18299
18300 @item -mconstant-gp
18301 @opindex mconstant-gp
18302 Generate code that uses a single constant global pointer value. This is
18303 useful when compiling kernel code.
18304
18305 @item -mauto-pic
18306 @opindex mauto-pic
18307 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
18308 This is useful when compiling firmware code.
18309
18310 @item -minline-float-divide-min-latency
18311 @opindex minline-float-divide-min-latency
18312 Generate code for inline divides of floating-point values
18313 using the minimum latency algorithm.
18314
18315 @item -minline-float-divide-max-throughput
18316 @opindex minline-float-divide-max-throughput
18317 Generate code for inline divides of floating-point values
18318 using the maximum throughput algorithm.
18319
18320 @item -mno-inline-float-divide
18321 @opindex mno-inline-float-divide
18322 Do not generate inline code for divides of floating-point values.
18323
18324 @item -minline-int-divide-min-latency
18325 @opindex minline-int-divide-min-latency
18326 Generate code for inline divides of integer values
18327 using the minimum latency algorithm.
18328
18329 @item -minline-int-divide-max-throughput
18330 @opindex minline-int-divide-max-throughput
18331 Generate code for inline divides of integer values
18332 using the maximum throughput algorithm.
18333
18334 @item -mno-inline-int-divide
18335 @opindex mno-inline-int-divide
18336 Do not generate inline code for divides of integer values.
18337
18338 @item -minline-sqrt-min-latency
18339 @opindex minline-sqrt-min-latency
18340 Generate code for inline square roots
18341 using the minimum latency algorithm.
18342
18343 @item -minline-sqrt-max-throughput
18344 @opindex minline-sqrt-max-throughput
18345 Generate code for inline square roots
18346 using the maximum throughput algorithm.
18347
18348 @item -mno-inline-sqrt
18349 @opindex mno-inline-sqrt
18350 Do not generate inline code for @code{sqrt}.
18351
18352 @item -mfused-madd
18353 @itemx -mno-fused-madd
18354 @opindex mfused-madd
18355 @opindex mno-fused-madd
18356 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
18357 instructions. The default is to use these instructions.
18358
18359 @item -mno-dwarf2-asm
18360 @itemx -mdwarf2-asm
18361 @opindex mno-dwarf2-asm
18362 @opindex mdwarf2-asm
18363 Don't (or do) generate assembler code for the DWARF line number debugging
18364 info. This may be useful when not using the GNU assembler.
18365
18366 @item -mearly-stop-bits
18367 @itemx -mno-early-stop-bits
18368 @opindex mearly-stop-bits
18369 @opindex mno-early-stop-bits
18370 Allow stop bits to be placed earlier than immediately preceding the
18371 instruction that triggered the stop bit. This can improve instruction
18372 scheduling, but does not always do so.
18373
18374 @item -mfixed-range=@var{register-range}
18375 @opindex mfixed-range
18376 Generate code treating the given register range as fixed registers.
18377 A fixed register is one that the register allocator cannot use. This is
18378 useful when compiling kernel code. A register range is specified as
18379 two registers separated by a dash. Multiple register ranges can be
18380 specified separated by a comma.
18381
18382 @item -mtls-size=@var{tls-size}
18383 @opindex mtls-size
18384 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
18385 64.
18386
18387 @item -mtune=@var{cpu-type}
18388 @opindex mtune
18389 Tune the instruction scheduling for a particular CPU, Valid values are
18390 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
18391 and @samp{mckinley}.
18392
18393 @item -milp32
18394 @itemx -mlp64
18395 @opindex milp32
18396 @opindex mlp64
18397 Generate code for a 32-bit or 64-bit environment.
18398 The 32-bit environment sets int, long and pointer to 32 bits.
18399 The 64-bit environment sets int to 32 bits and long and pointer
18400 to 64 bits. These are HP-UX specific flags.
18401
18402 @item -mno-sched-br-data-spec
18403 @itemx -msched-br-data-spec
18404 @opindex mno-sched-br-data-spec
18405 @opindex msched-br-data-spec
18406 (Dis/En)able data speculative scheduling before reload.
18407 This results in generation of @code{ld.a} instructions and
18408 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
18409 The default setting is disabled.
18410
18411 @item -msched-ar-data-spec
18412 @itemx -mno-sched-ar-data-spec
18413 @opindex msched-ar-data-spec
18414 @opindex mno-sched-ar-data-spec
18415 (En/Dis)able data speculative scheduling after reload.
18416 This results in generation of @code{ld.a} instructions and
18417 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
18418 The default setting is enabled.
18419
18420 @item -mno-sched-control-spec
18421 @itemx -msched-control-spec
18422 @opindex mno-sched-control-spec
18423 @opindex msched-control-spec
18424 (Dis/En)able control speculative scheduling. This feature is
18425 available only during region scheduling (i.e.@: before reload).
18426 This results in generation of the @code{ld.s} instructions and
18427 the corresponding check instructions @code{chk.s}.
18428 The default setting is disabled.
18429
18430 @item -msched-br-in-data-spec
18431 @itemx -mno-sched-br-in-data-spec
18432 @opindex msched-br-in-data-spec
18433 @opindex mno-sched-br-in-data-spec
18434 (En/Dis)able speculative scheduling of the instructions that
18435 are dependent on the data speculative loads before reload.
18436 This is effective only with @option{-msched-br-data-spec} enabled.
18437 The default setting is enabled.
18438
18439 @item -msched-ar-in-data-spec
18440 @itemx -mno-sched-ar-in-data-spec
18441 @opindex msched-ar-in-data-spec
18442 @opindex mno-sched-ar-in-data-spec
18443 (En/Dis)able speculative scheduling of the instructions that
18444 are dependent on the data speculative loads after reload.
18445 This is effective only with @option{-msched-ar-data-spec} enabled.
18446 The default setting is enabled.
18447
18448 @item -msched-in-control-spec
18449 @itemx -mno-sched-in-control-spec
18450 @opindex msched-in-control-spec
18451 @opindex mno-sched-in-control-spec
18452 (En/Dis)able speculative scheduling of the instructions that
18453 are dependent on the control speculative loads.
18454 This is effective only with @option{-msched-control-spec} enabled.
18455 The default setting is enabled.
18456
18457 @item -mno-sched-prefer-non-data-spec-insns
18458 @itemx -msched-prefer-non-data-spec-insns
18459 @opindex mno-sched-prefer-non-data-spec-insns
18460 @opindex msched-prefer-non-data-spec-insns
18461 If enabled, data-speculative instructions are chosen for schedule
18462 only if there are no other choices at the moment. This makes
18463 the use of the data speculation much more conservative.
18464 The default setting is disabled.
18465
18466 @item -mno-sched-prefer-non-control-spec-insns
18467 @itemx -msched-prefer-non-control-spec-insns
18468 @opindex mno-sched-prefer-non-control-spec-insns
18469 @opindex msched-prefer-non-control-spec-insns
18470 If enabled, control-speculative instructions are chosen for schedule
18471 only if there are no other choices at the moment. This makes
18472 the use of the control speculation much more conservative.
18473 The default setting is disabled.
18474
18475 @item -mno-sched-count-spec-in-critical-path
18476 @itemx -msched-count-spec-in-critical-path
18477 @opindex mno-sched-count-spec-in-critical-path
18478 @opindex msched-count-spec-in-critical-path
18479 If enabled, speculative dependencies are considered during
18480 computation of the instructions priorities. This makes the use of the
18481 speculation a bit more conservative.
18482 The default setting is disabled.
18483
18484 @item -msched-spec-ldc
18485 @opindex msched-spec-ldc
18486 Use a simple data speculation check. This option is on by default.
18487
18488 @item -msched-control-spec-ldc
18489 @opindex msched-spec-ldc
18490 Use a simple check for control speculation. This option is on by default.
18491
18492 @item -msched-stop-bits-after-every-cycle
18493 @opindex msched-stop-bits-after-every-cycle
18494 Place a stop bit after every cycle when scheduling. This option is on
18495 by default.
18496
18497 @item -msched-fp-mem-deps-zero-cost
18498 @opindex msched-fp-mem-deps-zero-cost
18499 Assume that floating-point stores and loads are not likely to cause a conflict
18500 when placed into the same instruction group. This option is disabled by
18501 default.
18502
18503 @item -msel-sched-dont-check-control-spec
18504 @opindex msel-sched-dont-check-control-spec
18505 Generate checks for control speculation in selective scheduling.
18506 This flag is disabled by default.
18507
18508 @item -msched-max-memory-insns=@var{max-insns}
18509 @opindex msched-max-memory-insns
18510 Limit on the number of memory insns per instruction group, giving lower
18511 priority to subsequent memory insns attempting to schedule in the same
18512 instruction group. Frequently useful to prevent cache bank conflicts.
18513 The default value is 1.
18514
18515 @item -msched-max-memory-insns-hard-limit
18516 @opindex msched-max-memory-insns-hard-limit
18517 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
18518 disallowing more than that number in an instruction group.
18519 Otherwise, the limit is ``soft'', meaning that non-memory operations
18520 are preferred when the limit is reached, but memory operations may still
18521 be scheduled.
18522
18523 @end table
18524
18525 @node LM32 Options
18526 @subsection LM32 Options
18527 @cindex LM32 options
18528
18529 These @option{-m} options are defined for the LatticeMico32 architecture:
18530
18531 @table @gcctabopt
18532 @item -mbarrel-shift-enabled
18533 @opindex mbarrel-shift-enabled
18534 Enable barrel-shift instructions.
18535
18536 @item -mdivide-enabled
18537 @opindex mdivide-enabled
18538 Enable divide and modulus instructions.
18539
18540 @item -mmultiply-enabled
18541 @opindex multiply-enabled
18542 Enable multiply instructions.
18543
18544 @item -msign-extend-enabled
18545 @opindex msign-extend-enabled
18546 Enable sign extend instructions.
18547
18548 @item -muser-enabled
18549 @opindex muser-enabled
18550 Enable user-defined instructions.
18551
18552 @end table
18553
18554 @node M32C Options
18555 @subsection M32C Options
18556 @cindex M32C options
18557
18558 @table @gcctabopt
18559 @item -mcpu=@var{name}
18560 @opindex mcpu=
18561 Select the CPU for which code is generated. @var{name} may be one of
18562 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
18563 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
18564 the M32C/80 series.
18565
18566 @item -msim
18567 @opindex msim
18568 Specifies that the program will be run on the simulator. This causes
18569 an alternate runtime library to be linked in which supports, for
18570 example, file I/O@. You must not use this option when generating
18571 programs that will run on real hardware; you must provide your own
18572 runtime library for whatever I/O functions are needed.
18573
18574 @item -memregs=@var{number}
18575 @opindex memregs=
18576 Specifies the number of memory-based pseudo-registers GCC uses
18577 during code generation. These pseudo-registers are used like real
18578 registers, so there is a tradeoff between GCC's ability to fit the
18579 code into available registers, and the performance penalty of using
18580 memory instead of registers. Note that all modules in a program must
18581 be compiled with the same value for this option. Because of that, you
18582 must not use this option with GCC's default runtime libraries.
18583
18584 @end table
18585
18586 @node M32R/D Options
18587 @subsection M32R/D Options
18588 @cindex M32R/D options
18589
18590 These @option{-m} options are defined for Renesas M32R/D architectures:
18591
18592 @table @gcctabopt
18593 @item -m32r2
18594 @opindex m32r2
18595 Generate code for the M32R/2@.
18596
18597 @item -m32rx
18598 @opindex m32rx
18599 Generate code for the M32R/X@.
18600
18601 @item -m32r
18602 @opindex m32r
18603 Generate code for the M32R@. This is the default.
18604
18605 @item -mmodel=small
18606 @opindex mmodel=small
18607 Assume all objects live in the lower 16MB of memory (so that their addresses
18608 can be loaded with the @code{ld24} instruction), and assume all subroutines
18609 are reachable with the @code{bl} instruction.
18610 This is the default.
18611
18612 The addressability of a particular object can be set with the
18613 @code{model} attribute.
18614
18615 @item -mmodel=medium
18616 @opindex mmodel=medium
18617 Assume objects may be anywhere in the 32-bit address space (the compiler
18618 generates @code{seth/add3} instructions to load their addresses), and
18619 assume all subroutines are reachable with the @code{bl} instruction.
18620
18621 @item -mmodel=large
18622 @opindex mmodel=large
18623 Assume objects may be anywhere in the 32-bit address space (the compiler
18624 generates @code{seth/add3} instructions to load their addresses), and
18625 assume subroutines may not be reachable with the @code{bl} instruction
18626 (the compiler generates the much slower @code{seth/add3/jl}
18627 instruction sequence).
18628
18629 @item -msdata=none
18630 @opindex msdata=none
18631 Disable use of the small data area. Variables are put into
18632 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
18633 @code{section} attribute has been specified).
18634 This is the default.
18635
18636 The small data area consists of sections @code{.sdata} and @code{.sbss}.
18637 Objects may be explicitly put in the small data area with the
18638 @code{section} attribute using one of these sections.
18639
18640 @item -msdata=sdata
18641 @opindex msdata=sdata
18642 Put small global and static data in the small data area, but do not
18643 generate special code to reference them.
18644
18645 @item -msdata=use
18646 @opindex msdata=use
18647 Put small global and static data in the small data area, and generate
18648 special instructions to reference them.
18649
18650 @item -G @var{num}
18651 @opindex G
18652 @cindex smaller data references
18653 Put global and static objects less than or equal to @var{num} bytes
18654 into the small data or BSS sections instead of the normal data or BSS
18655 sections. The default value of @var{num} is 8.
18656 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
18657 for this option to have any effect.
18658
18659 All modules should be compiled with the same @option{-G @var{num}} value.
18660 Compiling with different values of @var{num} may or may not work; if it
18661 doesn't the linker gives an error message---incorrect code is not
18662 generated.
18663
18664 @item -mdebug
18665 @opindex mdebug
18666 Makes the M32R-specific code in the compiler display some statistics
18667 that might help in debugging programs.
18668
18669 @item -malign-loops
18670 @opindex malign-loops
18671 Align all loops to a 32-byte boundary.
18672
18673 @item -mno-align-loops
18674 @opindex mno-align-loops
18675 Do not enforce a 32-byte alignment for loops. This is the default.
18676
18677 @item -missue-rate=@var{number}
18678 @opindex missue-rate=@var{number}
18679 Issue @var{number} instructions per cycle. @var{number} can only be 1
18680 or 2.
18681
18682 @item -mbranch-cost=@var{number}
18683 @opindex mbranch-cost=@var{number}
18684 @var{number} can only be 1 or 2. If it is 1 then branches are
18685 preferred over conditional code, if it is 2, then the opposite applies.
18686
18687 @item -mflush-trap=@var{number}
18688 @opindex mflush-trap=@var{number}
18689 Specifies the trap number to use to flush the cache. The default is
18690 12. Valid numbers are between 0 and 15 inclusive.
18691
18692 @item -mno-flush-trap
18693 @opindex mno-flush-trap
18694 Specifies that the cache cannot be flushed by using a trap.
18695
18696 @item -mflush-func=@var{name}
18697 @opindex mflush-func=@var{name}
18698 Specifies the name of the operating system function to call to flush
18699 the cache. The default is @samp{_flush_cache}, but a function call
18700 is only used if a trap is not available.
18701
18702 @item -mno-flush-func
18703 @opindex mno-flush-func
18704 Indicates that there is no OS function for flushing the cache.
18705
18706 @end table
18707
18708 @node M680x0 Options
18709 @subsection M680x0 Options
18710 @cindex M680x0 options
18711
18712 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
18713 The default settings depend on which architecture was selected when
18714 the compiler was configured; the defaults for the most common choices
18715 are given below.
18716
18717 @table @gcctabopt
18718 @item -march=@var{arch}
18719 @opindex march
18720 Generate code for a specific M680x0 or ColdFire instruction set
18721 architecture. Permissible values of @var{arch} for M680x0
18722 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
18723 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
18724 architectures are selected according to Freescale's ISA classification
18725 and the permissible values are: @samp{isaa}, @samp{isaaplus},
18726 @samp{isab} and @samp{isac}.
18727
18728 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
18729 code for a ColdFire target. The @var{arch} in this macro is one of the
18730 @option{-march} arguments given above.
18731
18732 When used together, @option{-march} and @option{-mtune} select code
18733 that runs on a family of similar processors but that is optimized
18734 for a particular microarchitecture.
18735
18736 @item -mcpu=@var{cpu}
18737 @opindex mcpu
18738 Generate code for a specific M680x0 or ColdFire processor.
18739 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
18740 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
18741 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
18742 below, which also classifies the CPUs into families:
18743
18744 @multitable @columnfractions 0.20 0.80
18745 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
18746 @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}
18747 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
18748 @item @samp{5206e} @tab @samp{5206e}
18749 @item @samp{5208} @tab @samp{5207} @samp{5208}
18750 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
18751 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
18752 @item @samp{5216} @tab @samp{5214} @samp{5216}
18753 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
18754 @item @samp{5225} @tab @samp{5224} @samp{5225}
18755 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
18756 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
18757 @item @samp{5249} @tab @samp{5249}
18758 @item @samp{5250} @tab @samp{5250}
18759 @item @samp{5271} @tab @samp{5270} @samp{5271}
18760 @item @samp{5272} @tab @samp{5272}
18761 @item @samp{5275} @tab @samp{5274} @samp{5275}
18762 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
18763 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
18764 @item @samp{5307} @tab @samp{5307}
18765 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
18766 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
18767 @item @samp{5407} @tab @samp{5407}
18768 @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}
18769 @end multitable
18770
18771 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
18772 @var{arch} is compatible with @var{cpu}. Other combinations of
18773 @option{-mcpu} and @option{-march} are rejected.
18774
18775 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
18776 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
18777 where the value of @var{family} is given by the table above.
18778
18779 @item -mtune=@var{tune}
18780 @opindex mtune
18781 Tune the code for a particular microarchitecture within the
18782 constraints set by @option{-march} and @option{-mcpu}.
18783 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
18784 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
18785 and @samp{cpu32}. The ColdFire microarchitectures
18786 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
18787
18788 You can also use @option{-mtune=68020-40} for code that needs
18789 to run relatively well on 68020, 68030 and 68040 targets.
18790 @option{-mtune=68020-60} is similar but includes 68060 targets
18791 as well. These two options select the same tuning decisions as
18792 @option{-m68020-40} and @option{-m68020-60} respectively.
18793
18794 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
18795 when tuning for 680x0 architecture @var{arch}. It also defines
18796 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
18797 option is used. If GCC is tuning for a range of architectures,
18798 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
18799 it defines the macros for every architecture in the range.
18800
18801 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
18802 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
18803 of the arguments given above.
18804
18805 @item -m68000
18806 @itemx -mc68000
18807 @opindex m68000
18808 @opindex mc68000
18809 Generate output for a 68000. This is the default
18810 when the compiler is configured for 68000-based systems.
18811 It is equivalent to @option{-march=68000}.
18812
18813 Use this option for microcontrollers with a 68000 or EC000 core,
18814 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
18815
18816 @item -m68010
18817 @opindex m68010
18818 Generate output for a 68010. This is the default
18819 when the compiler is configured for 68010-based systems.
18820 It is equivalent to @option{-march=68010}.
18821
18822 @item -m68020
18823 @itemx -mc68020
18824 @opindex m68020
18825 @opindex mc68020
18826 Generate output for a 68020. This is the default
18827 when the compiler is configured for 68020-based systems.
18828 It is equivalent to @option{-march=68020}.
18829
18830 @item -m68030
18831 @opindex m68030
18832 Generate output for a 68030. This is the default when the compiler is
18833 configured for 68030-based systems. It is equivalent to
18834 @option{-march=68030}.
18835
18836 @item -m68040
18837 @opindex m68040
18838 Generate output for a 68040. This is the default when the compiler is
18839 configured for 68040-based systems. It is equivalent to
18840 @option{-march=68040}.
18841
18842 This option inhibits the use of 68881/68882 instructions that have to be
18843 emulated by software on the 68040. Use this option if your 68040 does not
18844 have code to emulate those instructions.
18845
18846 @item -m68060
18847 @opindex m68060
18848 Generate output for a 68060. This is the default when the compiler is
18849 configured for 68060-based systems. It is equivalent to
18850 @option{-march=68060}.
18851
18852 This option inhibits the use of 68020 and 68881/68882 instructions that
18853 have to be emulated by software on the 68060. Use this option if your 68060
18854 does not have code to emulate those instructions.
18855
18856 @item -mcpu32
18857 @opindex mcpu32
18858 Generate output for a CPU32. This is the default
18859 when the compiler is configured for CPU32-based systems.
18860 It is equivalent to @option{-march=cpu32}.
18861
18862 Use this option for microcontrollers with a
18863 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
18864 68336, 68340, 68341, 68349 and 68360.
18865
18866 @item -m5200
18867 @opindex m5200
18868 Generate output for a 520X ColdFire CPU@. This is the default
18869 when the compiler is configured for 520X-based systems.
18870 It is equivalent to @option{-mcpu=5206}, and is now deprecated
18871 in favor of that option.
18872
18873 Use this option for microcontroller with a 5200 core, including
18874 the MCF5202, MCF5203, MCF5204 and MCF5206.
18875
18876 @item -m5206e
18877 @opindex m5206e
18878 Generate output for a 5206e ColdFire CPU@. The option is now
18879 deprecated in favor of the equivalent @option{-mcpu=5206e}.
18880
18881 @item -m528x
18882 @opindex m528x
18883 Generate output for a member of the ColdFire 528X family.
18884 The option is now deprecated in favor of the equivalent
18885 @option{-mcpu=528x}.
18886
18887 @item -m5307
18888 @opindex m5307
18889 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
18890 in favor of the equivalent @option{-mcpu=5307}.
18891
18892 @item -m5407
18893 @opindex m5407
18894 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
18895 in favor of the equivalent @option{-mcpu=5407}.
18896
18897 @item -mcfv4e
18898 @opindex mcfv4e
18899 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
18900 This includes use of hardware floating-point instructions.
18901 The option is equivalent to @option{-mcpu=547x}, and is now
18902 deprecated in favor of that option.
18903
18904 @item -m68020-40
18905 @opindex m68020-40
18906 Generate output for a 68040, without using any of the new instructions.
18907 This results in code that can run relatively efficiently on either a
18908 68020/68881 or a 68030 or a 68040. The generated code does use the
18909 68881 instructions that are emulated on the 68040.
18910
18911 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
18912
18913 @item -m68020-60
18914 @opindex m68020-60
18915 Generate output for a 68060, without using any of the new instructions.
18916 This results in code that can run relatively efficiently on either a
18917 68020/68881 or a 68030 or a 68040. The generated code does use the
18918 68881 instructions that are emulated on the 68060.
18919
18920 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
18921
18922 @item -mhard-float
18923 @itemx -m68881
18924 @opindex mhard-float
18925 @opindex m68881
18926 Generate floating-point instructions. This is the default for 68020
18927 and above, and for ColdFire devices that have an FPU@. It defines the
18928 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
18929 on ColdFire targets.
18930
18931 @item -msoft-float
18932 @opindex msoft-float
18933 Do not generate floating-point instructions; use library calls instead.
18934 This is the default for 68000, 68010, and 68832 targets. It is also
18935 the default for ColdFire devices that have no FPU.
18936
18937 @item -mdiv
18938 @itemx -mno-div
18939 @opindex mdiv
18940 @opindex mno-div
18941 Generate (do not generate) ColdFire hardware divide and remainder
18942 instructions. If @option{-march} is used without @option{-mcpu},
18943 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
18944 architectures. Otherwise, the default is taken from the target CPU
18945 (either the default CPU, or the one specified by @option{-mcpu}). For
18946 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
18947 @option{-mcpu=5206e}.
18948
18949 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
18950
18951 @item -mshort
18952 @opindex mshort
18953 Consider type @code{int} to be 16 bits wide, like @code{short int}.
18954 Additionally, parameters passed on the stack are also aligned to a
18955 16-bit boundary even on targets whose API mandates promotion to 32-bit.
18956
18957 @item -mno-short
18958 @opindex mno-short
18959 Do not consider type @code{int} to be 16 bits wide. This is the default.
18960
18961 @item -mnobitfield
18962 @itemx -mno-bitfield
18963 @opindex mnobitfield
18964 @opindex mno-bitfield
18965 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
18966 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
18967
18968 @item -mbitfield
18969 @opindex mbitfield
18970 Do use the bit-field instructions. The @option{-m68020} option implies
18971 @option{-mbitfield}. This is the default if you use a configuration
18972 designed for a 68020.
18973
18974 @item -mrtd
18975 @opindex mrtd
18976 Use a different function-calling convention, in which functions
18977 that take a fixed number of arguments return with the @code{rtd}
18978 instruction, which pops their arguments while returning. This
18979 saves one instruction in the caller since there is no need to pop
18980 the arguments there.
18981
18982 This calling convention is incompatible with the one normally
18983 used on Unix, so you cannot use it if you need to call libraries
18984 compiled with the Unix compiler.
18985
18986 Also, you must provide function prototypes for all functions that
18987 take variable numbers of arguments (including @code{printf});
18988 otherwise incorrect code is generated for calls to those
18989 functions.
18990
18991 In addition, seriously incorrect code results if you call a
18992 function with too many arguments. (Normally, extra arguments are
18993 harmlessly ignored.)
18994
18995 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
18996 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
18997
18998 @item -mno-rtd
18999 @opindex mno-rtd
19000 Do not use the calling conventions selected by @option{-mrtd}.
19001 This is the default.
19002
19003 @item -malign-int
19004 @itemx -mno-align-int
19005 @opindex malign-int
19006 @opindex mno-align-int
19007 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
19008 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
19009 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
19010 Aligning variables on 32-bit boundaries produces code that runs somewhat
19011 faster on processors with 32-bit busses at the expense of more memory.
19012
19013 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
19014 aligns structures containing the above types differently than
19015 most published application binary interface specifications for the m68k.
19016
19017 @item -mpcrel
19018 @opindex mpcrel
19019 Use the pc-relative addressing mode of the 68000 directly, instead of
19020 using a global offset table. At present, this option implies @option{-fpic},
19021 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
19022 not presently supported with @option{-mpcrel}, though this could be supported for
19023 68020 and higher processors.
19024
19025 @item -mno-strict-align
19026 @itemx -mstrict-align
19027 @opindex mno-strict-align
19028 @opindex mstrict-align
19029 Do not (do) assume that unaligned memory references are handled by
19030 the system.
19031
19032 @item -msep-data
19033 Generate code that allows the data segment to be located in a different
19034 area of memory from the text segment. This allows for execute-in-place in
19035 an environment without virtual memory management. This option implies
19036 @option{-fPIC}.
19037
19038 @item -mno-sep-data
19039 Generate code that assumes that the data segment follows the text segment.
19040 This is the default.
19041
19042 @item -mid-shared-library
19043 Generate code that supports shared libraries via the library ID method.
19044 This allows for execute-in-place and shared libraries in an environment
19045 without virtual memory management. This option implies @option{-fPIC}.
19046
19047 @item -mno-id-shared-library
19048 Generate code that doesn't assume ID-based shared libraries are being used.
19049 This is the default.
19050
19051 @item -mshared-library-id=n
19052 Specifies the identification number of the ID-based shared library being
19053 compiled. Specifying a value of 0 generates more compact code; specifying
19054 other values forces the allocation of that number to the current
19055 library, but is no more space- or time-efficient than omitting this option.
19056
19057 @item -mxgot
19058 @itemx -mno-xgot
19059 @opindex mxgot
19060 @opindex mno-xgot
19061 When generating position-independent code for ColdFire, generate code
19062 that works if the GOT has more than 8192 entries. This code is
19063 larger and slower than code generated without this option. On M680x0
19064 processors, this option is not needed; @option{-fPIC} suffices.
19065
19066 GCC normally uses a single instruction to load values from the GOT@.
19067 While this is relatively efficient, it only works if the GOT
19068 is smaller than about 64k. Anything larger causes the linker
19069 to report an error such as:
19070
19071 @cindex relocation truncated to fit (ColdFire)
19072 @smallexample
19073 relocation truncated to fit: R_68K_GOT16O foobar
19074 @end smallexample
19075
19076 If this happens, you should recompile your code with @option{-mxgot}.
19077 It should then work with very large GOTs. However, code generated with
19078 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
19079 the value of a global symbol.
19080
19081 Note that some linkers, including newer versions of the GNU linker,
19082 can create multiple GOTs and sort GOT entries. If you have such a linker,
19083 you should only need to use @option{-mxgot} when compiling a single
19084 object file that accesses more than 8192 GOT entries. Very few do.
19085
19086 These options have no effect unless GCC is generating
19087 position-independent code.
19088
19089 @item -mlong-jump-table-offsets
19090 @opindex mlong-jump-table-offsets
19091 Use 32-bit offsets in @code{switch} tables. The default is to use
19092 16-bit offsets.
19093
19094 @end table
19095
19096 @node MCore Options
19097 @subsection MCore Options
19098 @cindex MCore options
19099
19100 These are the @samp{-m} options defined for the Motorola M*Core
19101 processors.
19102
19103 @table @gcctabopt
19104
19105 @item -mhardlit
19106 @itemx -mno-hardlit
19107 @opindex mhardlit
19108 @opindex mno-hardlit
19109 Inline constants into the code stream if it can be done in two
19110 instructions or less.
19111
19112 @item -mdiv
19113 @itemx -mno-div
19114 @opindex mdiv
19115 @opindex mno-div
19116 Use the divide instruction. (Enabled by default).
19117
19118 @item -mrelax-immediate
19119 @itemx -mno-relax-immediate
19120 @opindex mrelax-immediate
19121 @opindex mno-relax-immediate
19122 Allow arbitrary-sized immediates in bit operations.
19123
19124 @item -mwide-bitfields
19125 @itemx -mno-wide-bitfields
19126 @opindex mwide-bitfields
19127 @opindex mno-wide-bitfields
19128 Always treat bit-fields as @code{int}-sized.
19129
19130 @item -m4byte-functions
19131 @itemx -mno-4byte-functions
19132 @opindex m4byte-functions
19133 @opindex mno-4byte-functions
19134 Force all functions to be aligned to a 4-byte boundary.
19135
19136 @item -mcallgraph-data
19137 @itemx -mno-callgraph-data
19138 @opindex mcallgraph-data
19139 @opindex mno-callgraph-data
19140 Emit callgraph information.
19141
19142 @item -mslow-bytes
19143 @itemx -mno-slow-bytes
19144 @opindex mslow-bytes
19145 @opindex mno-slow-bytes
19146 Prefer word access when reading byte quantities.
19147
19148 @item -mlittle-endian
19149 @itemx -mbig-endian
19150 @opindex mlittle-endian
19151 @opindex mbig-endian
19152 Generate code for a little-endian target.
19153
19154 @item -m210
19155 @itemx -m340
19156 @opindex m210
19157 @opindex m340
19158 Generate code for the 210 processor.
19159
19160 @item -mno-lsim
19161 @opindex mno-lsim
19162 Assume that runtime support has been provided and so omit the
19163 simulator library (@file{libsim.a)} from the linker command line.
19164
19165 @item -mstack-increment=@var{size}
19166 @opindex mstack-increment
19167 Set the maximum amount for a single stack increment operation. Large
19168 values can increase the speed of programs that contain functions
19169 that need a large amount of stack space, but they can also trigger a
19170 segmentation fault if the stack is extended too much. The default
19171 value is 0x1000.
19172
19173 @end table
19174
19175 @node MeP Options
19176 @subsection MeP Options
19177 @cindex MeP options
19178
19179 @table @gcctabopt
19180
19181 @item -mabsdiff
19182 @opindex mabsdiff
19183 Enables the @code{abs} instruction, which is the absolute difference
19184 between two registers.
19185
19186 @item -mall-opts
19187 @opindex mall-opts
19188 Enables all the optional instructions---average, multiply, divide, bit
19189 operations, leading zero, absolute difference, min/max, clip, and
19190 saturation.
19191
19192
19193 @item -maverage
19194 @opindex maverage
19195 Enables the @code{ave} instruction, which computes the average of two
19196 registers.
19197
19198 @item -mbased=@var{n}
19199 @opindex mbased=
19200 Variables of size @var{n} bytes or smaller are placed in the
19201 @code{.based} section by default. Based variables use the @code{$tp}
19202 register as a base register, and there is a 128-byte limit to the
19203 @code{.based} section.
19204
19205 @item -mbitops
19206 @opindex mbitops
19207 Enables the bit operation instructions---bit test (@code{btstm}), set
19208 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
19209 test-and-set (@code{tas}).
19210
19211 @item -mc=@var{name}
19212 @opindex mc=
19213 Selects which section constant data is placed in. @var{name} may
19214 be @samp{tiny}, @samp{near}, or @samp{far}.
19215
19216 @item -mclip
19217 @opindex mclip
19218 Enables the @code{clip} instruction. Note that @option{-mclip} is not
19219 useful unless you also provide @option{-mminmax}.
19220
19221 @item -mconfig=@var{name}
19222 @opindex mconfig=
19223 Selects one of the built-in core configurations. Each MeP chip has
19224 one or more modules in it; each module has a core CPU and a variety of
19225 coprocessors, optional instructions, and peripherals. The
19226 @code{MeP-Integrator} tool, not part of GCC, provides these
19227 configurations through this option; using this option is the same as
19228 using all the corresponding command-line options. The default
19229 configuration is @samp{default}.
19230
19231 @item -mcop
19232 @opindex mcop
19233 Enables the coprocessor instructions. By default, this is a 32-bit
19234 coprocessor. Note that the coprocessor is normally enabled via the
19235 @option{-mconfig=} option.
19236
19237 @item -mcop32
19238 @opindex mcop32
19239 Enables the 32-bit coprocessor's instructions.
19240
19241 @item -mcop64
19242 @opindex mcop64
19243 Enables the 64-bit coprocessor's instructions.
19244
19245 @item -mivc2
19246 @opindex mivc2
19247 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
19248
19249 @item -mdc
19250 @opindex mdc
19251 Causes constant variables to be placed in the @code{.near} section.
19252
19253 @item -mdiv
19254 @opindex mdiv
19255 Enables the @code{div} and @code{divu} instructions.
19256
19257 @item -meb
19258 @opindex meb
19259 Generate big-endian code.
19260
19261 @item -mel
19262 @opindex mel
19263 Generate little-endian code.
19264
19265 @item -mio-volatile
19266 @opindex mio-volatile
19267 Tells the compiler that any variable marked with the @code{io}
19268 attribute is to be considered volatile.
19269
19270 @item -ml
19271 @opindex ml
19272 Causes variables to be assigned to the @code{.far} section by default.
19273
19274 @item -mleadz
19275 @opindex mleadz
19276 Enables the @code{leadz} (leading zero) instruction.
19277
19278 @item -mm
19279 @opindex mm
19280 Causes variables to be assigned to the @code{.near} section by default.
19281
19282 @item -mminmax
19283 @opindex mminmax
19284 Enables the @code{min} and @code{max} instructions.
19285
19286 @item -mmult
19287 @opindex mmult
19288 Enables the multiplication and multiply-accumulate instructions.
19289
19290 @item -mno-opts
19291 @opindex mno-opts
19292 Disables all the optional instructions enabled by @option{-mall-opts}.
19293
19294 @item -mrepeat
19295 @opindex mrepeat
19296 Enables the @code{repeat} and @code{erepeat} instructions, used for
19297 low-overhead looping.
19298
19299 @item -ms
19300 @opindex ms
19301 Causes all variables to default to the @code{.tiny} section. Note
19302 that there is a 65536-byte limit to this section. Accesses to these
19303 variables use the @code{%gp} base register.
19304
19305 @item -msatur
19306 @opindex msatur
19307 Enables the saturation instructions. Note that the compiler does not
19308 currently generate these itself, but this option is included for
19309 compatibility with other tools, like @code{as}.
19310
19311 @item -msdram
19312 @opindex msdram
19313 Link the SDRAM-based runtime instead of the default ROM-based runtime.
19314
19315 @item -msim
19316 @opindex msim
19317 Link the simulator run-time libraries.
19318
19319 @item -msimnovec
19320 @opindex msimnovec
19321 Link the simulator runtime libraries, excluding built-in support
19322 for reset and exception vectors and tables.
19323
19324 @item -mtf
19325 @opindex mtf
19326 Causes all functions to default to the @code{.far} section. Without
19327 this option, functions default to the @code{.near} section.
19328
19329 @item -mtiny=@var{n}
19330 @opindex mtiny=
19331 Variables that are @var{n} bytes or smaller are allocated to the
19332 @code{.tiny} section. These variables use the @code{$gp} base
19333 register. The default for this option is 4, but note that there's a
19334 65536-byte limit to the @code{.tiny} section.
19335
19336 @end table
19337
19338 @node MicroBlaze Options
19339 @subsection MicroBlaze Options
19340 @cindex MicroBlaze Options
19341
19342 @table @gcctabopt
19343
19344 @item -msoft-float
19345 @opindex msoft-float
19346 Use software emulation for floating point (default).
19347
19348 @item -mhard-float
19349 @opindex mhard-float
19350 Use hardware floating-point instructions.
19351
19352 @item -mmemcpy
19353 @opindex mmemcpy
19354 Do not optimize block moves, use @code{memcpy}.
19355
19356 @item -mno-clearbss
19357 @opindex mno-clearbss
19358 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
19359
19360 @item -mcpu=@var{cpu-type}
19361 @opindex mcpu=
19362 Use features of, and schedule code for, the given CPU.
19363 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
19364 where @var{X} is a major version, @var{YY} is the minor version, and
19365 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
19366 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
19367
19368 @item -mxl-soft-mul
19369 @opindex mxl-soft-mul
19370 Use software multiply emulation (default).
19371
19372 @item -mxl-soft-div
19373 @opindex mxl-soft-div
19374 Use software emulation for divides (default).
19375
19376 @item -mxl-barrel-shift
19377 @opindex mxl-barrel-shift
19378 Use the hardware barrel shifter.
19379
19380 @item -mxl-pattern-compare
19381 @opindex mxl-pattern-compare
19382 Use pattern compare instructions.
19383
19384 @item -msmall-divides
19385 @opindex msmall-divides
19386 Use table lookup optimization for small signed integer divisions.
19387
19388 @item -mxl-stack-check
19389 @opindex mxl-stack-check
19390 This option is deprecated. Use @option{-fstack-check} instead.
19391
19392 @item -mxl-gp-opt
19393 @opindex mxl-gp-opt
19394 Use GP-relative @code{.sdata}/@code{.sbss} sections.
19395
19396 @item -mxl-multiply-high
19397 @opindex mxl-multiply-high
19398 Use multiply high instructions for high part of 32x32 multiply.
19399
19400 @item -mxl-float-convert
19401 @opindex mxl-float-convert
19402 Use hardware floating-point conversion instructions.
19403
19404 @item -mxl-float-sqrt
19405 @opindex mxl-float-sqrt
19406 Use hardware floating-point square root instruction.
19407
19408 @item -mbig-endian
19409 @opindex mbig-endian
19410 Generate code for a big-endian target.
19411
19412 @item -mlittle-endian
19413 @opindex mlittle-endian
19414 Generate code for a little-endian target.
19415
19416 @item -mxl-reorder
19417 @opindex mxl-reorder
19418 Use reorder instructions (swap and byte reversed load/store).
19419
19420 @item -mxl-mode-@var{app-model}
19421 Select application model @var{app-model}. Valid models are
19422 @table @samp
19423 @item executable
19424 normal executable (default), uses startup code @file{crt0.o}.
19425
19426 @item xmdstub
19427 for use with Xilinx Microprocessor Debugger (XMD) based
19428 software intrusive debug agent called xmdstub. This uses startup file
19429 @file{crt1.o} and sets the start address of the program to 0x800.
19430
19431 @item bootstrap
19432 for applications that are loaded using a bootloader.
19433 This model uses startup file @file{crt2.o} which does not contain a processor
19434 reset vector handler. This is suitable for transferring control on a
19435 processor reset to the bootloader rather than the application.
19436
19437 @item novectors
19438 for applications that do not require any of the
19439 MicroBlaze vectors. This option may be useful for applications running
19440 within a monitoring application. This model uses @file{crt3.o} as a startup file.
19441 @end table
19442
19443 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
19444 @option{-mxl-mode-@var{app-model}}.
19445
19446 @end table
19447
19448 @node MIPS Options
19449 @subsection MIPS Options
19450 @cindex MIPS options
19451
19452 @table @gcctabopt
19453
19454 @item -EB
19455 @opindex EB
19456 Generate big-endian code.
19457
19458 @item -EL
19459 @opindex EL
19460 Generate little-endian code. This is the default for @samp{mips*el-*-*}
19461 configurations.
19462
19463 @item -march=@var{arch}
19464 @opindex march
19465 Generate code that runs on @var{arch}, which can be the name of a
19466 generic MIPS ISA, or the name of a particular processor.
19467 The ISA names are:
19468 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
19469 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
19470 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
19471 @samp{mips64r5} and @samp{mips64r6}.
19472 The processor names are:
19473 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
19474 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
19475 @samp{5kc}, @samp{5kf},
19476 @samp{20kc},
19477 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
19478 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
19479 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
19480 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
19481 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
19482 @samp{i6400},
19483 @samp{interaptiv},
19484 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
19485 @samp{m4k},
19486 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
19487 @samp{m5100}, @samp{m5101},
19488 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
19489 @samp{orion},
19490 @samp{p5600},
19491 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
19492 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
19493 @samp{rm7000}, @samp{rm9000},
19494 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
19495 @samp{sb1},
19496 @samp{sr71000},
19497 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
19498 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
19499 @samp{xlr} and @samp{xlp}.
19500 The special value @samp{from-abi} selects the
19501 most compatible architecture for the selected ABI (that is,
19502 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
19503
19504 The native Linux/GNU toolchain also supports the value @samp{native},
19505 which selects the best architecture option for the host processor.
19506 @option{-march=native} has no effect if GCC does not recognize
19507 the processor.
19508
19509 In processor names, a final @samp{000} can be abbreviated as @samp{k}
19510 (for example, @option{-march=r2k}). Prefixes are optional, and
19511 @samp{vr} may be written @samp{r}.
19512
19513 Names of the form @samp{@var{n}f2_1} refer to processors with
19514 FPUs clocked at half the rate of the core, names of the form
19515 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
19516 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
19517 processors with FPUs clocked a ratio of 3:2 with respect to the core.
19518 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
19519 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
19520 accepted as synonyms for @samp{@var{n}f1_1}.
19521
19522 GCC defines two macros based on the value of this option. The first
19523 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
19524 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
19525 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
19526 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
19527 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
19528
19529 Note that the @code{_MIPS_ARCH} macro uses the processor names given
19530 above. In other words, it has the full prefix and does not
19531 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
19532 the macro names the resolved architecture (either @code{"mips1"} or
19533 @code{"mips3"}). It names the default architecture when no
19534 @option{-march} option is given.
19535
19536 @item -mtune=@var{arch}
19537 @opindex mtune
19538 Optimize for @var{arch}. Among other things, this option controls
19539 the way instructions are scheduled, and the perceived cost of arithmetic
19540 operations. The list of @var{arch} values is the same as for
19541 @option{-march}.
19542
19543 When this option is not used, GCC optimizes for the processor
19544 specified by @option{-march}. By using @option{-march} and
19545 @option{-mtune} together, it is possible to generate code that
19546 runs on a family of processors, but optimize the code for one
19547 particular member of that family.
19548
19549 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
19550 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
19551 @option{-march} ones described above.
19552
19553 @item -mips1
19554 @opindex mips1
19555 Equivalent to @option{-march=mips1}.
19556
19557 @item -mips2
19558 @opindex mips2
19559 Equivalent to @option{-march=mips2}.
19560
19561 @item -mips3
19562 @opindex mips3
19563 Equivalent to @option{-march=mips3}.
19564
19565 @item -mips4
19566 @opindex mips4
19567 Equivalent to @option{-march=mips4}.
19568
19569 @item -mips32
19570 @opindex mips32
19571 Equivalent to @option{-march=mips32}.
19572
19573 @item -mips32r3
19574 @opindex mips32r3
19575 Equivalent to @option{-march=mips32r3}.
19576
19577 @item -mips32r5
19578 @opindex mips32r5
19579 Equivalent to @option{-march=mips32r5}.
19580
19581 @item -mips32r6
19582 @opindex mips32r6
19583 Equivalent to @option{-march=mips32r6}.
19584
19585 @item -mips64
19586 @opindex mips64
19587 Equivalent to @option{-march=mips64}.
19588
19589 @item -mips64r2
19590 @opindex mips64r2
19591 Equivalent to @option{-march=mips64r2}.
19592
19593 @item -mips64r3
19594 @opindex mips64r3
19595 Equivalent to @option{-march=mips64r3}.
19596
19597 @item -mips64r5
19598 @opindex mips64r5
19599 Equivalent to @option{-march=mips64r5}.
19600
19601 @item -mips64r6
19602 @opindex mips64r6
19603 Equivalent to @option{-march=mips64r6}.
19604
19605 @item -mips16
19606 @itemx -mno-mips16
19607 @opindex mips16
19608 @opindex mno-mips16
19609 Generate (do not generate) MIPS16 code. If GCC is targeting a
19610 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
19611
19612 MIPS16 code generation can also be controlled on a per-function basis
19613 by means of @code{mips16} and @code{nomips16} attributes.
19614 @xref{Function Attributes}, for more information.
19615
19616 @item -mflip-mips16
19617 @opindex mflip-mips16
19618 Generate MIPS16 code on alternating functions. This option is provided
19619 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
19620 not intended for ordinary use in compiling user code.
19621
19622 @item -minterlink-compressed
19623 @item -mno-interlink-compressed
19624 @opindex minterlink-compressed
19625 @opindex mno-interlink-compressed
19626 Require (do not require) that code using the standard (uncompressed) MIPS ISA
19627 be link-compatible with MIPS16 and microMIPS code, and vice versa.
19628
19629 For example, code using the standard ISA encoding cannot jump directly
19630 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
19631 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
19632 knows that the target of the jump is not compressed.
19633
19634 @item -minterlink-mips16
19635 @itemx -mno-interlink-mips16
19636 @opindex minterlink-mips16
19637 @opindex mno-interlink-mips16
19638 Aliases of @option{-minterlink-compressed} and
19639 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
19640 and are retained for backwards compatibility.
19641
19642 @item -mabi=32
19643 @itemx -mabi=o64
19644 @itemx -mabi=n32
19645 @itemx -mabi=64
19646 @itemx -mabi=eabi
19647 @opindex mabi=32
19648 @opindex mabi=o64
19649 @opindex mabi=n32
19650 @opindex mabi=64
19651 @opindex mabi=eabi
19652 Generate code for the given ABI@.
19653
19654 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
19655 generates 64-bit code when you select a 64-bit architecture, but you
19656 can use @option{-mgp32} to get 32-bit code instead.
19657
19658 For information about the O64 ABI, see
19659 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
19660
19661 GCC supports a variant of the o32 ABI in which floating-point registers
19662 are 64 rather than 32 bits wide. You can select this combination with
19663 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
19664 and @code{mfhc1} instructions and is therefore only supported for
19665 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
19666
19667 The register assignments for arguments and return values remain the
19668 same, but each scalar value is passed in a single 64-bit register
19669 rather than a pair of 32-bit registers. For example, scalar
19670 floating-point values are returned in @samp{$f0} only, not a
19671 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
19672 remains the same in that the even-numbered double-precision registers
19673 are saved.
19674
19675 Two additional variants of the o32 ABI are supported to enable
19676 a transition from 32-bit to 64-bit registers. These are FPXX
19677 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
19678 The FPXX extension mandates that all code must execute correctly
19679 when run using 32-bit or 64-bit registers. The code can be interlinked
19680 with either FP32 or FP64, but not both.
19681 The FP64A extension is similar to the FP64 extension but forbids the
19682 use of odd-numbered single-precision registers. This can be used
19683 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
19684 processors and allows both FP32 and FP64A code to interlink and
19685 run in the same process without changing FPU modes.
19686
19687 @item -mabicalls
19688 @itemx -mno-abicalls
19689 @opindex mabicalls
19690 @opindex mno-abicalls
19691 Generate (do not generate) code that is suitable for SVR4-style
19692 dynamic objects. @option{-mabicalls} is the default for SVR4-based
19693 systems.
19694
19695 @item -mshared
19696 @itemx -mno-shared
19697 Generate (do not generate) code that is fully position-independent,
19698 and that can therefore be linked into shared libraries. This option
19699 only affects @option{-mabicalls}.
19700
19701 All @option{-mabicalls} code has traditionally been position-independent,
19702 regardless of options like @option{-fPIC} and @option{-fpic}. However,
19703 as an extension, the GNU toolchain allows executables to use absolute
19704 accesses for locally-binding symbols. It can also use shorter GP
19705 initialization sequences and generate direct calls to locally-defined
19706 functions. This mode is selected by @option{-mno-shared}.
19707
19708 @option{-mno-shared} depends on binutils 2.16 or higher and generates
19709 objects that can only be linked by the GNU linker. However, the option
19710 does not affect the ABI of the final executable; it only affects the ABI
19711 of relocatable objects. Using @option{-mno-shared} generally makes
19712 executables both smaller and quicker.
19713
19714 @option{-mshared} is the default.
19715
19716 @item -mplt
19717 @itemx -mno-plt
19718 @opindex mplt
19719 @opindex mno-plt
19720 Assume (do not assume) that the static and dynamic linkers
19721 support PLTs and copy relocations. This option only affects
19722 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
19723 has no effect without @option{-msym32}.
19724
19725 You can make @option{-mplt} the default by configuring
19726 GCC with @option{--with-mips-plt}. The default is
19727 @option{-mno-plt} otherwise.
19728
19729 @item -mxgot
19730 @itemx -mno-xgot
19731 @opindex mxgot
19732 @opindex mno-xgot
19733 Lift (do not lift) the usual restrictions on the size of the global
19734 offset table.
19735
19736 GCC normally uses a single instruction to load values from the GOT@.
19737 While this is relatively efficient, it only works if the GOT
19738 is smaller than about 64k. Anything larger causes the linker
19739 to report an error such as:
19740
19741 @cindex relocation truncated to fit (MIPS)
19742 @smallexample
19743 relocation truncated to fit: R_MIPS_GOT16 foobar
19744 @end smallexample
19745
19746 If this happens, you should recompile your code with @option{-mxgot}.
19747 This works with very large GOTs, although the code is also
19748 less efficient, since it takes three instructions to fetch the
19749 value of a global symbol.
19750
19751 Note that some linkers can create multiple GOTs. If you have such a
19752 linker, you should only need to use @option{-mxgot} when a single object
19753 file accesses more than 64k's worth of GOT entries. Very few do.
19754
19755 These options have no effect unless GCC is generating position
19756 independent code.
19757
19758 @item -mgp32
19759 @opindex mgp32
19760 Assume that general-purpose registers are 32 bits wide.
19761
19762 @item -mgp64
19763 @opindex mgp64
19764 Assume that general-purpose registers are 64 bits wide.
19765
19766 @item -mfp32
19767 @opindex mfp32
19768 Assume that floating-point registers are 32 bits wide.
19769
19770 @item -mfp64
19771 @opindex mfp64
19772 Assume that floating-point registers are 64 bits wide.
19773
19774 @item -mfpxx
19775 @opindex mfpxx
19776 Do not assume the width of floating-point registers.
19777
19778 @item -mhard-float
19779 @opindex mhard-float
19780 Use floating-point coprocessor instructions.
19781
19782 @item -msoft-float
19783 @opindex msoft-float
19784 Do not use floating-point coprocessor instructions. Implement
19785 floating-point calculations using library calls instead.
19786
19787 @item -mno-float
19788 @opindex mno-float
19789 Equivalent to @option{-msoft-float}, but additionally asserts that the
19790 program being compiled does not perform any floating-point operations.
19791 This option is presently supported only by some bare-metal MIPS
19792 configurations, where it may select a special set of libraries
19793 that lack all floating-point support (including, for example, the
19794 floating-point @code{printf} formats).
19795 If code compiled with @option{-mno-float} accidentally contains
19796 floating-point operations, it is likely to suffer a link-time
19797 or run-time failure.
19798
19799 @item -msingle-float
19800 @opindex msingle-float
19801 Assume that the floating-point coprocessor only supports single-precision
19802 operations.
19803
19804 @item -mdouble-float
19805 @opindex mdouble-float
19806 Assume that the floating-point coprocessor supports double-precision
19807 operations. This is the default.
19808
19809 @item -modd-spreg
19810 @itemx -mno-odd-spreg
19811 @opindex modd-spreg
19812 @opindex mno-odd-spreg
19813 Enable the use of odd-numbered single-precision floating-point registers
19814 for the o32 ABI. This is the default for processors that are known to
19815 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
19816 is set by default.
19817
19818 @item -mabs=2008
19819 @itemx -mabs=legacy
19820 @opindex mabs=2008
19821 @opindex mabs=legacy
19822 These options control the treatment of the special not-a-number (NaN)
19823 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
19824 @code{neg.@i{fmt}} machine instructions.
19825
19826 By default or when @option{-mabs=legacy} is used the legacy
19827 treatment is selected. In this case these instructions are considered
19828 arithmetic and avoided where correct operation is required and the
19829 input operand might be a NaN. A longer sequence of instructions that
19830 manipulate the sign bit of floating-point datum manually is used
19831 instead unless the @option{-ffinite-math-only} option has also been
19832 specified.
19833
19834 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
19835 this case these instructions are considered non-arithmetic and therefore
19836 operating correctly in all cases, including in particular where the
19837 input operand is a NaN. These instructions are therefore always used
19838 for the respective operations.
19839
19840 @item -mnan=2008
19841 @itemx -mnan=legacy
19842 @opindex mnan=2008
19843 @opindex mnan=legacy
19844 These options control the encoding of the special not-a-number (NaN)
19845 IEEE 754 floating-point data.
19846
19847 The @option{-mnan=legacy} option selects the legacy encoding. In this
19848 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
19849 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
19850 by the first bit of their trailing significand field being 1.
19851
19852 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
19853 this case qNaNs are denoted by the first bit of their trailing
19854 significand field being 1, whereas sNaNs are denoted by the first bit of
19855 their trailing significand field being 0.
19856
19857 The default is @option{-mnan=legacy} unless GCC has been configured with
19858 @option{--with-nan=2008}.
19859
19860 @item -mllsc
19861 @itemx -mno-llsc
19862 @opindex mllsc
19863 @opindex mno-llsc
19864 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
19865 implement atomic memory built-in functions. When neither option is
19866 specified, GCC uses the instructions if the target architecture
19867 supports them.
19868
19869 @option{-mllsc} is useful if the runtime environment can emulate the
19870 instructions and @option{-mno-llsc} can be useful when compiling for
19871 nonstandard ISAs. You can make either option the default by
19872 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
19873 respectively. @option{--with-llsc} is the default for some
19874 configurations; see the installation documentation for details.
19875
19876 @item -mdsp
19877 @itemx -mno-dsp
19878 @opindex mdsp
19879 @opindex mno-dsp
19880 Use (do not use) revision 1 of the MIPS DSP ASE@.
19881 @xref{MIPS DSP Built-in Functions}. This option defines the
19882 preprocessor macro @code{__mips_dsp}. It also defines
19883 @code{__mips_dsp_rev} to 1.
19884
19885 @item -mdspr2
19886 @itemx -mno-dspr2
19887 @opindex mdspr2
19888 @opindex mno-dspr2
19889 Use (do not use) revision 2 of the MIPS DSP ASE@.
19890 @xref{MIPS DSP Built-in Functions}. This option defines the
19891 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
19892 It also defines @code{__mips_dsp_rev} to 2.
19893
19894 @item -msmartmips
19895 @itemx -mno-smartmips
19896 @opindex msmartmips
19897 @opindex mno-smartmips
19898 Use (do not use) the MIPS SmartMIPS ASE.
19899
19900 @item -mpaired-single
19901 @itemx -mno-paired-single
19902 @opindex mpaired-single
19903 @opindex mno-paired-single
19904 Use (do not use) paired-single floating-point instructions.
19905 @xref{MIPS Paired-Single Support}. This option requires
19906 hardware floating-point support to be enabled.
19907
19908 @item -mdmx
19909 @itemx -mno-mdmx
19910 @opindex mdmx
19911 @opindex mno-mdmx
19912 Use (do not use) MIPS Digital Media Extension instructions.
19913 This option can only be used when generating 64-bit code and requires
19914 hardware floating-point support to be enabled.
19915
19916 @item -mips3d
19917 @itemx -mno-mips3d
19918 @opindex mips3d
19919 @opindex mno-mips3d
19920 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
19921 The option @option{-mips3d} implies @option{-mpaired-single}.
19922
19923 @item -mmicromips
19924 @itemx -mno-micromips
19925 @opindex mmicromips
19926 @opindex mno-mmicromips
19927 Generate (do not generate) microMIPS code.
19928
19929 MicroMIPS code generation can also be controlled on a per-function basis
19930 by means of @code{micromips} and @code{nomicromips} attributes.
19931 @xref{Function Attributes}, for more information.
19932
19933 @item -mmt
19934 @itemx -mno-mt
19935 @opindex mmt
19936 @opindex mno-mt
19937 Use (do not use) MT Multithreading instructions.
19938
19939 @item -mmcu
19940 @itemx -mno-mcu
19941 @opindex mmcu
19942 @opindex mno-mcu
19943 Use (do not use) the MIPS MCU ASE instructions.
19944
19945 @item -meva
19946 @itemx -mno-eva
19947 @opindex meva
19948 @opindex mno-eva
19949 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
19950
19951 @item -mvirt
19952 @itemx -mno-virt
19953 @opindex mvirt
19954 @opindex mno-virt
19955 Use (do not use) the MIPS Virtualization (VZ) instructions.
19956
19957 @item -mxpa
19958 @itemx -mno-xpa
19959 @opindex mxpa
19960 @opindex mno-xpa
19961 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
19962
19963 @item -mlong64
19964 @opindex mlong64
19965 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
19966 an explanation of the default and the way that the pointer size is
19967 determined.
19968
19969 @item -mlong32
19970 @opindex mlong32
19971 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
19972
19973 The default size of @code{int}s, @code{long}s and pointers depends on
19974 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
19975 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
19976 32-bit @code{long}s. Pointers are the same size as @code{long}s,
19977 or the same size as integer registers, whichever is smaller.
19978
19979 @item -msym32
19980 @itemx -mno-sym32
19981 @opindex msym32
19982 @opindex mno-sym32
19983 Assume (do not assume) that all symbols have 32-bit values, regardless
19984 of the selected ABI@. This option is useful in combination with
19985 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
19986 to generate shorter and faster references to symbolic addresses.
19987
19988 @item -G @var{num}
19989 @opindex G
19990 Put definitions of externally-visible data in a small data section
19991 if that data is no bigger than @var{num} bytes. GCC can then generate
19992 more efficient accesses to the data; see @option{-mgpopt} for details.
19993
19994 The default @option{-G} option depends on the configuration.
19995
19996 @item -mlocal-sdata
19997 @itemx -mno-local-sdata
19998 @opindex mlocal-sdata
19999 @opindex mno-local-sdata
20000 Extend (do not extend) the @option{-G} behavior to local data too,
20001 such as to static variables in C@. @option{-mlocal-sdata} is the
20002 default for all configurations.
20003
20004 If the linker complains that an application is using too much small data,
20005 you might want to try rebuilding the less performance-critical parts with
20006 @option{-mno-local-sdata}. You might also want to build large
20007 libraries with @option{-mno-local-sdata}, so that the libraries leave
20008 more room for the main program.
20009
20010 @item -mextern-sdata
20011 @itemx -mno-extern-sdata
20012 @opindex mextern-sdata
20013 @opindex mno-extern-sdata
20014 Assume (do not assume) that externally-defined data is in
20015 a small data section if the size of that data is within the @option{-G} limit.
20016 @option{-mextern-sdata} is the default for all configurations.
20017
20018 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
20019 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
20020 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
20021 is placed in a small data section. If @var{Var} is defined by another
20022 module, you must either compile that module with a high-enough
20023 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
20024 definition. If @var{Var} is common, you must link the application
20025 with a high-enough @option{-G} setting.
20026
20027 The easiest way of satisfying these restrictions is to compile
20028 and link every module with the same @option{-G} option. However,
20029 you may wish to build a library that supports several different
20030 small data limits. You can do this by compiling the library with
20031 the highest supported @option{-G} setting and additionally using
20032 @option{-mno-extern-sdata} to stop the library from making assumptions
20033 about externally-defined data.
20034
20035 @item -mgpopt
20036 @itemx -mno-gpopt
20037 @opindex mgpopt
20038 @opindex mno-gpopt
20039 Use (do not use) GP-relative accesses for symbols that are known to be
20040 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
20041 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
20042 configurations.
20043
20044 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
20045 might not hold the value of @code{_gp}. For example, if the code is
20046 part of a library that might be used in a boot monitor, programs that
20047 call boot monitor routines pass an unknown value in @code{$gp}.
20048 (In such situations, the boot monitor itself is usually compiled
20049 with @option{-G0}.)
20050
20051 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
20052 @option{-mno-extern-sdata}.
20053
20054 @item -membedded-data
20055 @itemx -mno-embedded-data
20056 @opindex membedded-data
20057 @opindex mno-embedded-data
20058 Allocate variables to the read-only data section first if possible, then
20059 next in the small data section if possible, otherwise in data. This gives
20060 slightly slower code than the default, but reduces the amount of RAM required
20061 when executing, and thus may be preferred for some embedded systems.
20062
20063 @item -muninit-const-in-rodata
20064 @itemx -mno-uninit-const-in-rodata
20065 @opindex muninit-const-in-rodata
20066 @opindex mno-uninit-const-in-rodata
20067 Put uninitialized @code{const} variables in the read-only data section.
20068 This option is only meaningful in conjunction with @option{-membedded-data}.
20069
20070 @item -mcode-readable=@var{setting}
20071 @opindex mcode-readable
20072 Specify whether GCC may generate code that reads from executable sections.
20073 There are three possible settings:
20074
20075 @table @gcctabopt
20076 @item -mcode-readable=yes
20077 Instructions may freely access executable sections. This is the
20078 default setting.
20079
20080 @item -mcode-readable=pcrel
20081 MIPS16 PC-relative load instructions can access executable sections,
20082 but other instructions must not do so. This option is useful on 4KSc
20083 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
20084 It is also useful on processors that can be configured to have a dual
20085 instruction/data SRAM interface and that, like the M4K, automatically
20086 redirect PC-relative loads to the instruction RAM.
20087
20088 @item -mcode-readable=no
20089 Instructions must not access executable sections. This option can be
20090 useful on targets that are configured to have a dual instruction/data
20091 SRAM interface but that (unlike the M4K) do not automatically redirect
20092 PC-relative loads to the instruction RAM.
20093 @end table
20094
20095 @item -msplit-addresses
20096 @itemx -mno-split-addresses
20097 @opindex msplit-addresses
20098 @opindex mno-split-addresses
20099 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
20100 relocation operators. This option has been superseded by
20101 @option{-mexplicit-relocs} but is retained for backwards compatibility.
20102
20103 @item -mexplicit-relocs
20104 @itemx -mno-explicit-relocs
20105 @opindex mexplicit-relocs
20106 @opindex mno-explicit-relocs
20107 Use (do not use) assembler relocation operators when dealing with symbolic
20108 addresses. The alternative, selected by @option{-mno-explicit-relocs},
20109 is to use assembler macros instead.
20110
20111 @option{-mexplicit-relocs} is the default if GCC was configured
20112 to use an assembler that supports relocation operators.
20113
20114 @item -mcheck-zero-division
20115 @itemx -mno-check-zero-division
20116 @opindex mcheck-zero-division
20117 @opindex mno-check-zero-division
20118 Trap (do not trap) on integer division by zero.
20119
20120 The default is @option{-mcheck-zero-division}.
20121
20122 @item -mdivide-traps
20123 @itemx -mdivide-breaks
20124 @opindex mdivide-traps
20125 @opindex mdivide-breaks
20126 MIPS systems check for division by zero by generating either a
20127 conditional trap or a break instruction. Using traps results in
20128 smaller code, but is only supported on MIPS II and later. Also, some
20129 versions of the Linux kernel have a bug that prevents trap from
20130 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
20131 allow conditional traps on architectures that support them and
20132 @option{-mdivide-breaks} to force the use of breaks.
20133
20134 The default is usually @option{-mdivide-traps}, but this can be
20135 overridden at configure time using @option{--with-divide=breaks}.
20136 Divide-by-zero checks can be completely disabled using
20137 @option{-mno-check-zero-division}.
20138
20139 @item -mload-store-pairs
20140 @itemx -mno-load-store-pairs
20141 @opindex mload-store-pairs
20142 @opindex mno-load-store-pairs
20143 Enable (disable) an optimization that pairs consecutive load or store
20144 instructions to enable load/store bonding. This option is enabled by
20145 default but only takes effect when the selected architecture is known
20146 to support bonding.
20147
20148 @item -mmemcpy
20149 @itemx -mno-memcpy
20150 @opindex mmemcpy
20151 @opindex mno-memcpy
20152 Force (do not force) the use of @code{memcpy} for non-trivial block
20153 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
20154 most constant-sized copies.
20155
20156 @item -mlong-calls
20157 @itemx -mno-long-calls
20158 @opindex mlong-calls
20159 @opindex mno-long-calls
20160 Disable (do not disable) use of the @code{jal} instruction. Calling
20161 functions using @code{jal} is more efficient but requires the caller
20162 and callee to be in the same 256 megabyte segment.
20163
20164 This option has no effect on abicalls code. The default is
20165 @option{-mno-long-calls}.
20166
20167 @item -mmad
20168 @itemx -mno-mad
20169 @opindex mmad
20170 @opindex mno-mad
20171 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
20172 instructions, as provided by the R4650 ISA@.
20173
20174 @item -mimadd
20175 @itemx -mno-imadd
20176 @opindex mimadd
20177 @opindex mno-imadd
20178 Enable (disable) use of the @code{madd} and @code{msub} integer
20179 instructions. The default is @option{-mimadd} on architectures
20180 that support @code{madd} and @code{msub} except for the 74k
20181 architecture where it was found to generate slower code.
20182
20183 @item -mfused-madd
20184 @itemx -mno-fused-madd
20185 @opindex mfused-madd
20186 @opindex mno-fused-madd
20187 Enable (disable) use of the floating-point multiply-accumulate
20188 instructions, when they are available. The default is
20189 @option{-mfused-madd}.
20190
20191 On the R8000 CPU when multiply-accumulate instructions are used,
20192 the intermediate product is calculated to infinite precision
20193 and is not subject to the FCSR Flush to Zero bit. This may be
20194 undesirable in some circumstances. On other processors the result
20195 is numerically identical to the equivalent computation using
20196 separate multiply, add, subtract and negate instructions.
20197
20198 @item -nocpp
20199 @opindex nocpp
20200 Tell the MIPS assembler to not run its preprocessor over user
20201 assembler files (with a @samp{.s} suffix) when assembling them.
20202
20203 @item -mfix-24k
20204 @item -mno-fix-24k
20205 @opindex mfix-24k
20206 @opindex mno-fix-24k
20207 Work around the 24K E48 (lost data on stores during refill) errata.
20208 The workarounds are implemented by the assembler rather than by GCC@.
20209
20210 @item -mfix-r4000
20211 @itemx -mno-fix-r4000
20212 @opindex mfix-r4000
20213 @opindex mno-fix-r4000
20214 Work around certain R4000 CPU errata:
20215 @itemize @minus
20216 @item
20217 A double-word or a variable shift may give an incorrect result if executed
20218 immediately after starting an integer division.
20219 @item
20220 A double-word or a variable shift may give an incorrect result if executed
20221 while an integer multiplication is in progress.
20222 @item
20223 An integer division may give an incorrect result if started in a delay slot
20224 of a taken branch or a jump.
20225 @end itemize
20226
20227 @item -mfix-r4400
20228 @itemx -mno-fix-r4400
20229 @opindex mfix-r4400
20230 @opindex mno-fix-r4400
20231 Work around certain R4400 CPU errata:
20232 @itemize @minus
20233 @item
20234 A double-word or a variable shift may give an incorrect result if executed
20235 immediately after starting an integer division.
20236 @end itemize
20237
20238 @item -mfix-r10000
20239 @itemx -mno-fix-r10000
20240 @opindex mfix-r10000
20241 @opindex mno-fix-r10000
20242 Work around certain R10000 errata:
20243 @itemize @minus
20244 @item
20245 @code{ll}/@code{sc} sequences may not behave atomically on revisions
20246 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
20247 @end itemize
20248
20249 This option can only be used if the target architecture supports
20250 branch-likely instructions. @option{-mfix-r10000} is the default when
20251 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
20252 otherwise.
20253
20254 @item -mfix-rm7000
20255 @itemx -mno-fix-rm7000
20256 @opindex mfix-rm7000
20257 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
20258 workarounds are implemented by the assembler rather than by GCC@.
20259
20260 @item -mfix-vr4120
20261 @itemx -mno-fix-vr4120
20262 @opindex mfix-vr4120
20263 Work around certain VR4120 errata:
20264 @itemize @minus
20265 @item
20266 @code{dmultu} does not always produce the correct result.
20267 @item
20268 @code{div} and @code{ddiv} do not always produce the correct result if one
20269 of the operands is negative.
20270 @end itemize
20271 The workarounds for the division errata rely on special functions in
20272 @file{libgcc.a}. At present, these functions are only provided by
20273 the @code{mips64vr*-elf} configurations.
20274
20275 Other VR4120 errata require a NOP to be inserted between certain pairs of
20276 instructions. These errata are handled by the assembler, not by GCC itself.
20277
20278 @item -mfix-vr4130
20279 @opindex mfix-vr4130
20280 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
20281 workarounds are implemented by the assembler rather than by GCC,
20282 although GCC avoids using @code{mflo} and @code{mfhi} if the
20283 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
20284 instructions are available instead.
20285
20286 @item -mfix-sb1
20287 @itemx -mno-fix-sb1
20288 @opindex mfix-sb1
20289 Work around certain SB-1 CPU core errata.
20290 (This flag currently works around the SB-1 revision 2
20291 ``F1'' and ``F2'' floating-point errata.)
20292
20293 @item -mr10k-cache-barrier=@var{setting}
20294 @opindex mr10k-cache-barrier
20295 Specify whether GCC should insert cache barriers to avoid the
20296 side-effects of speculation on R10K processors.
20297
20298 In common with many processors, the R10K tries to predict the outcome
20299 of a conditional branch and speculatively executes instructions from
20300 the ``taken'' branch. It later aborts these instructions if the
20301 predicted outcome is wrong. However, on the R10K, even aborted
20302 instructions can have side effects.
20303
20304 This problem only affects kernel stores and, depending on the system,
20305 kernel loads. As an example, a speculatively-executed store may load
20306 the target memory into cache and mark the cache line as dirty, even if
20307 the store itself is later aborted. If a DMA operation writes to the
20308 same area of memory before the ``dirty'' line is flushed, the cached
20309 data overwrites the DMA-ed data. See the R10K processor manual
20310 for a full description, including other potential problems.
20311
20312 One workaround is to insert cache barrier instructions before every memory
20313 access that might be speculatively executed and that might have side
20314 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
20315 controls GCC's implementation of this workaround. It assumes that
20316 aborted accesses to any byte in the following regions does not have
20317 side effects:
20318
20319 @enumerate
20320 @item
20321 the memory occupied by the current function's stack frame;
20322
20323 @item
20324 the memory occupied by an incoming stack argument;
20325
20326 @item
20327 the memory occupied by an object with a link-time-constant address.
20328 @end enumerate
20329
20330 It is the kernel's responsibility to ensure that speculative
20331 accesses to these regions are indeed safe.
20332
20333 If the input program contains a function declaration such as:
20334
20335 @smallexample
20336 void foo (void);
20337 @end smallexample
20338
20339 then the implementation of @code{foo} must allow @code{j foo} and
20340 @code{jal foo} to be executed speculatively. GCC honors this
20341 restriction for functions it compiles itself. It expects non-GCC
20342 functions (such as hand-written assembly code) to do the same.
20343
20344 The option has three forms:
20345
20346 @table @gcctabopt
20347 @item -mr10k-cache-barrier=load-store
20348 Insert a cache barrier before a load or store that might be
20349 speculatively executed and that might have side effects even
20350 if aborted.
20351
20352 @item -mr10k-cache-barrier=store
20353 Insert a cache barrier before a store that might be speculatively
20354 executed and that might have side effects even if aborted.
20355
20356 @item -mr10k-cache-barrier=none
20357 Disable the insertion of cache barriers. This is the default setting.
20358 @end table
20359
20360 @item -mflush-func=@var{func}
20361 @itemx -mno-flush-func
20362 @opindex mflush-func
20363 Specifies the function to call to flush the I and D caches, or to not
20364 call any such function. If called, the function must take the same
20365 arguments as the common @code{_flush_func}, that is, the address of the
20366 memory range for which the cache is being flushed, the size of the
20367 memory range, and the number 3 (to flush both caches). The default
20368 depends on the target GCC was configured for, but commonly is either
20369 @code{_flush_func} or @code{__cpu_flush}.
20370
20371 @item mbranch-cost=@var{num}
20372 @opindex mbranch-cost
20373 Set the cost of branches to roughly @var{num} ``simple'' instructions.
20374 This cost is only a heuristic and is not guaranteed to produce
20375 consistent results across releases. A zero cost redundantly selects
20376 the default, which is based on the @option{-mtune} setting.
20377
20378 @item -mbranch-likely
20379 @itemx -mno-branch-likely
20380 @opindex mbranch-likely
20381 @opindex mno-branch-likely
20382 Enable or disable use of Branch Likely instructions, regardless of the
20383 default for the selected architecture. By default, Branch Likely
20384 instructions may be generated if they are supported by the selected
20385 architecture. An exception is for the MIPS32 and MIPS64 architectures
20386 and processors that implement those architectures; for those, Branch
20387 Likely instructions are not be generated by default because the MIPS32
20388 and MIPS64 architectures specifically deprecate their use.
20389
20390 @item -mcompact-branches=never
20391 @itemx -mcompact-branches=optimal
20392 @itemx -mcompact-branches=always
20393 @opindex mcompact-branches=never
20394 @opindex mcompact-branches=optimal
20395 @opindex mcompact-branches=always
20396 These options control which form of branches will be generated. The
20397 default is @option{-mcompact-branches=optimal}.
20398
20399 The @option{-mcompact-branches=never} option ensures that compact branch
20400 instructions will never be generated.
20401
20402 The @option{-mcompact-branches=always} option ensures that a compact
20403 branch instruction will be generated if available. If a compact branch
20404 instruction is not available, a delay slot form of the branch will be
20405 used instead.
20406
20407 This option is supported from MIPS Release 6 onwards.
20408
20409 The @option{-mcompact-branches=optimal} option will cause a delay slot
20410 branch to be used if one is available in the current ISA and the delay
20411 slot is successfully filled. If the delay slot is not filled, a compact
20412 branch will be chosen if one is available.
20413
20414 @item -mfp-exceptions
20415 @itemx -mno-fp-exceptions
20416 @opindex mfp-exceptions
20417 Specifies whether FP exceptions are enabled. This affects how
20418 FP instructions are scheduled for some processors.
20419 The default is that FP exceptions are
20420 enabled.
20421
20422 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
20423 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
20424 FP pipe.
20425
20426 @item -mvr4130-align
20427 @itemx -mno-vr4130-align
20428 @opindex mvr4130-align
20429 The VR4130 pipeline is two-way superscalar, but can only issue two
20430 instructions together if the first one is 8-byte aligned. When this
20431 option is enabled, GCC aligns pairs of instructions that it
20432 thinks should execute in parallel.
20433
20434 This option only has an effect when optimizing for the VR4130.
20435 It normally makes code faster, but at the expense of making it bigger.
20436 It is enabled by default at optimization level @option{-O3}.
20437
20438 @item -msynci
20439 @itemx -mno-synci
20440 @opindex msynci
20441 Enable (disable) generation of @code{synci} instructions on
20442 architectures that support it. The @code{synci} instructions (if
20443 enabled) are generated when @code{__builtin___clear_cache} is
20444 compiled.
20445
20446 This option defaults to @option{-mno-synci}, but the default can be
20447 overridden by configuring GCC with @option{--with-synci}.
20448
20449 When compiling code for single processor systems, it is generally safe
20450 to use @code{synci}. However, on many multi-core (SMP) systems, it
20451 does not invalidate the instruction caches on all cores and may lead
20452 to undefined behavior.
20453
20454 @item -mrelax-pic-calls
20455 @itemx -mno-relax-pic-calls
20456 @opindex mrelax-pic-calls
20457 Try to turn PIC calls that are normally dispatched via register
20458 @code{$25} into direct calls. This is only possible if the linker can
20459 resolve the destination at link time and if the destination is within
20460 range for a direct call.
20461
20462 @option{-mrelax-pic-calls} is the default if GCC was configured to use
20463 an assembler and a linker that support the @code{.reloc} assembly
20464 directive and @option{-mexplicit-relocs} is in effect. With
20465 @option{-mno-explicit-relocs}, this optimization can be performed by the
20466 assembler and the linker alone without help from the compiler.
20467
20468 @item -mmcount-ra-address
20469 @itemx -mno-mcount-ra-address
20470 @opindex mmcount-ra-address
20471 @opindex mno-mcount-ra-address
20472 Emit (do not emit) code that allows @code{_mcount} to modify the
20473 calling function's return address. When enabled, this option extends
20474 the usual @code{_mcount} interface with a new @var{ra-address}
20475 parameter, which has type @code{intptr_t *} and is passed in register
20476 @code{$12}. @code{_mcount} can then modify the return address by
20477 doing both of the following:
20478 @itemize
20479 @item
20480 Returning the new address in register @code{$31}.
20481 @item
20482 Storing the new address in @code{*@var{ra-address}},
20483 if @var{ra-address} is nonnull.
20484 @end itemize
20485
20486 The default is @option{-mno-mcount-ra-address}.
20487
20488 @item -mframe-header-opt
20489 @itemx -mno-frame-header-opt
20490 @opindex mframe-header-opt
20491 Enable (disable) frame header optimization in the o32 ABI. When using the
20492 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
20493 function to write out register arguments. When enabled, this optimization
20494 will suppress the allocation of the frame header if it can be determined that
20495 it is unused.
20496
20497 This optimization is off by default at all optimization levels.
20498
20499 @item -mlxc1-sxc1
20500 @itemx -mno-lxc1-sxc1
20501 @opindex mlxc1-sxc1
20502 When applicable, enable (disable) the generation of @code{lwxc1},
20503 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
20504
20505 @item -mmadd4
20506 @itemx -mno-madd4
20507 @opindex mmadd4
20508 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
20509 @code{madd.d} and related instructions. Enabled by default.
20510
20511 @end table
20512
20513 @node MMIX Options
20514 @subsection MMIX Options
20515 @cindex MMIX Options
20516
20517 These options are defined for the MMIX:
20518
20519 @table @gcctabopt
20520 @item -mlibfuncs
20521 @itemx -mno-libfuncs
20522 @opindex mlibfuncs
20523 @opindex mno-libfuncs
20524 Specify that intrinsic library functions are being compiled, passing all
20525 values in registers, no matter the size.
20526
20527 @item -mepsilon
20528 @itemx -mno-epsilon
20529 @opindex mepsilon
20530 @opindex mno-epsilon
20531 Generate floating-point comparison instructions that compare with respect
20532 to the @code{rE} epsilon register.
20533
20534 @item -mabi=mmixware
20535 @itemx -mabi=gnu
20536 @opindex mabi=mmixware
20537 @opindex mabi=gnu
20538 Generate code that passes function parameters and return values that (in
20539 the called function) are seen as registers @code{$0} and up, as opposed to
20540 the GNU ABI which uses global registers @code{$231} and up.
20541
20542 @item -mzero-extend
20543 @itemx -mno-zero-extend
20544 @opindex mzero-extend
20545 @opindex mno-zero-extend
20546 When reading data from memory in sizes shorter than 64 bits, use (do not
20547 use) zero-extending load instructions by default, rather than
20548 sign-extending ones.
20549
20550 @item -mknuthdiv
20551 @itemx -mno-knuthdiv
20552 @opindex mknuthdiv
20553 @opindex mno-knuthdiv
20554 Make the result of a division yielding a remainder have the same sign as
20555 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
20556 remainder follows the sign of the dividend. Both methods are
20557 arithmetically valid, the latter being almost exclusively used.
20558
20559 @item -mtoplevel-symbols
20560 @itemx -mno-toplevel-symbols
20561 @opindex mtoplevel-symbols
20562 @opindex mno-toplevel-symbols
20563 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
20564 code can be used with the @code{PREFIX} assembly directive.
20565
20566 @item -melf
20567 @opindex melf
20568 Generate an executable in the ELF format, rather than the default
20569 @samp{mmo} format used by the @command{mmix} simulator.
20570
20571 @item -mbranch-predict
20572 @itemx -mno-branch-predict
20573 @opindex mbranch-predict
20574 @opindex mno-branch-predict
20575 Use (do not use) the probable-branch instructions, when static branch
20576 prediction indicates a probable branch.
20577
20578 @item -mbase-addresses
20579 @itemx -mno-base-addresses
20580 @opindex mbase-addresses
20581 @opindex mno-base-addresses
20582 Generate (do not generate) code that uses @emph{base addresses}. Using a
20583 base address automatically generates a request (handled by the assembler
20584 and the linker) for a constant to be set up in a global register. The
20585 register is used for one or more base address requests within the range 0
20586 to 255 from the value held in the register. The generally leads to short
20587 and fast code, but the number of different data items that can be
20588 addressed is limited. This means that a program that uses lots of static
20589 data may require @option{-mno-base-addresses}.
20590
20591 @item -msingle-exit
20592 @itemx -mno-single-exit
20593 @opindex msingle-exit
20594 @opindex mno-single-exit
20595 Force (do not force) generated code to have a single exit point in each
20596 function.
20597 @end table
20598
20599 @node MN10300 Options
20600 @subsection MN10300 Options
20601 @cindex MN10300 options
20602
20603 These @option{-m} options are defined for Matsushita MN10300 architectures:
20604
20605 @table @gcctabopt
20606 @item -mmult-bug
20607 @opindex mmult-bug
20608 Generate code to avoid bugs in the multiply instructions for the MN10300
20609 processors. This is the default.
20610
20611 @item -mno-mult-bug
20612 @opindex mno-mult-bug
20613 Do not generate code to avoid bugs in the multiply instructions for the
20614 MN10300 processors.
20615
20616 @item -mam33
20617 @opindex mam33
20618 Generate code using features specific to the AM33 processor.
20619
20620 @item -mno-am33
20621 @opindex mno-am33
20622 Do not generate code using features specific to the AM33 processor. This
20623 is the default.
20624
20625 @item -mam33-2
20626 @opindex mam33-2
20627 Generate code using features specific to the AM33/2.0 processor.
20628
20629 @item -mam34
20630 @opindex mam34
20631 Generate code using features specific to the AM34 processor.
20632
20633 @item -mtune=@var{cpu-type}
20634 @opindex mtune
20635 Use the timing characteristics of the indicated CPU type when
20636 scheduling instructions. This does not change the targeted processor
20637 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
20638 @samp{am33-2} or @samp{am34}.
20639
20640 @item -mreturn-pointer-on-d0
20641 @opindex mreturn-pointer-on-d0
20642 When generating a function that returns a pointer, return the pointer
20643 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
20644 only in @code{a0}, and attempts to call such functions without a prototype
20645 result in errors. Note that this option is on by default; use
20646 @option{-mno-return-pointer-on-d0} to disable it.
20647
20648 @item -mno-crt0
20649 @opindex mno-crt0
20650 Do not link in the C run-time initialization object file.
20651
20652 @item -mrelax
20653 @opindex mrelax
20654 Indicate to the linker that it should perform a relaxation optimization pass
20655 to shorten branches, calls and absolute memory addresses. This option only
20656 has an effect when used on the command line for the final link step.
20657
20658 This option makes symbolic debugging impossible.
20659
20660 @item -mliw
20661 @opindex mliw
20662 Allow the compiler to generate @emph{Long Instruction Word}
20663 instructions if the target is the @samp{AM33} or later. This is the
20664 default. This option defines the preprocessor macro @code{__LIW__}.
20665
20666 @item -mnoliw
20667 @opindex mnoliw
20668 Do not allow the compiler to generate @emph{Long Instruction Word}
20669 instructions. This option defines the preprocessor macro
20670 @code{__NO_LIW__}.
20671
20672 @item -msetlb
20673 @opindex msetlb
20674 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
20675 instructions if the target is the @samp{AM33} or later. This is the
20676 default. This option defines the preprocessor macro @code{__SETLB__}.
20677
20678 @item -mnosetlb
20679 @opindex mnosetlb
20680 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
20681 instructions. This option defines the preprocessor macro
20682 @code{__NO_SETLB__}.
20683
20684 @end table
20685
20686 @node Moxie Options
20687 @subsection Moxie Options
20688 @cindex Moxie Options
20689
20690 @table @gcctabopt
20691
20692 @item -meb
20693 @opindex meb
20694 Generate big-endian code. This is the default for @samp{moxie-*-*}
20695 configurations.
20696
20697 @item -mel
20698 @opindex mel
20699 Generate little-endian code.
20700
20701 @item -mmul.x
20702 @opindex mmul.x
20703 Generate mul.x and umul.x instructions. This is the default for
20704 @samp{moxiebox-*-*} configurations.
20705
20706 @item -mno-crt0
20707 @opindex mno-crt0
20708 Do not link in the C run-time initialization object file.
20709
20710 @end table
20711
20712 @node MSP430 Options
20713 @subsection MSP430 Options
20714 @cindex MSP430 Options
20715
20716 These options are defined for the MSP430:
20717
20718 @table @gcctabopt
20719
20720 @item -masm-hex
20721 @opindex masm-hex
20722 Force assembly output to always use hex constants. Normally such
20723 constants are signed decimals, but this option is available for
20724 testsuite and/or aesthetic purposes.
20725
20726 @item -mmcu=
20727 @opindex mmcu=
20728 Select the MCU to target. This is used to create a C preprocessor
20729 symbol based upon the MCU name, converted to upper case and pre- and
20730 post-fixed with @samp{__}. This in turn is used by the
20731 @file{msp430.h} header file to select an MCU-specific supplementary
20732 header file.
20733
20734 The option also sets the ISA to use. If the MCU name is one that is
20735 known to only support the 430 ISA then that is selected, otherwise the
20736 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
20737 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
20738 name selects the 430X ISA.
20739
20740 In addition an MCU-specific linker script is added to the linker
20741 command line. The script's name is the name of the MCU with
20742 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
20743 command line defines the C preprocessor symbol @code{__XXX__} and
20744 cause the linker to search for a script called @file{xxx.ld}.
20745
20746 This option is also passed on to the assembler.
20747
20748 @item -mwarn-mcu
20749 @itemx -mno-warn-mcu
20750 @opindex mwarn-mcu
20751 @opindex mno-warn-mcu
20752 This option enables or disables warnings about conflicts between the
20753 MCU name specified by the @option{-mmcu} option and the ISA set by the
20754 @option{-mcpu} option and/or the hardware multiply support set by the
20755 @option{-mhwmult} option. It also toggles warnings about unrecognized
20756 MCU names. This option is on by default.
20757
20758 @item -mcpu=
20759 @opindex mcpu=
20760 Specifies the ISA to use. Accepted values are @samp{msp430},
20761 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
20762 @option{-mmcu=} option should be used to select the ISA.
20763
20764 @item -msim
20765 @opindex msim
20766 Link to the simulator runtime libraries and linker script. Overrides
20767 any scripts that would be selected by the @option{-mmcu=} option.
20768
20769 @item -mlarge
20770 @opindex mlarge
20771 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
20772
20773 @item -msmall
20774 @opindex msmall
20775 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
20776
20777 @item -mrelax
20778 @opindex mrelax
20779 This option is passed to the assembler and linker, and allows the
20780 linker to perform certain optimizations that cannot be done until
20781 the final link.
20782
20783 @item mhwmult=
20784 @opindex mhwmult=
20785 Describes the type of hardware multiply supported by the target.
20786 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
20787 for the original 16-bit-only multiply supported by early MCUs.
20788 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
20789 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
20790 A value of @samp{auto} can also be given. This tells GCC to deduce
20791 the hardware multiply support based upon the MCU name provided by the
20792 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
20793 the MCU name is not recognized then no hardware multiply support is
20794 assumed. @code{auto} is the default setting.
20795
20796 Hardware multiplies are normally performed by calling a library
20797 routine. This saves space in the generated code. When compiling at
20798 @option{-O3} or higher however the hardware multiplier is invoked
20799 inline. This makes for bigger, but faster code.
20800
20801 The hardware multiply routines disable interrupts whilst running and
20802 restore the previous interrupt state when they finish. This makes
20803 them safe to use inside interrupt handlers as well as in normal code.
20804
20805 @item -minrt
20806 @opindex minrt
20807 Enable the use of a minimum runtime environment - no static
20808 initializers or constructors. This is intended for memory-constrained
20809 devices. The compiler includes special symbols in some objects
20810 that tell the linker and runtime which code fragments are required.
20811
20812 @item -mcode-region=
20813 @itemx -mdata-region=
20814 @opindex mcode-region
20815 @opindex mdata-region
20816 These options tell the compiler where to place functions and data that
20817 do not have one of the @code{lower}, @code{upper}, @code{either} or
20818 @code{section} attributes. Possible values are @code{lower},
20819 @code{upper}, @code{either} or @code{any}. The first three behave
20820 like the corresponding attribute. The fourth possible value -
20821 @code{any} - is the default. It leaves placement entirely up to the
20822 linker script and how it assigns the standard sections
20823 (@code{.text}, @code{.data}, etc) to the memory regions.
20824
20825 @item -msilicon-errata=
20826 @opindex msilicon-errata
20827 This option passes on a request to assembler to enable the fixes for
20828 the named silicon errata.
20829
20830 @item -msilicon-errata-warn=
20831 @opindex msilicon-errata-warn
20832 This option passes on a request to the assembler to enable warning
20833 messages when a silicon errata might need to be applied.
20834
20835 @end table
20836
20837 @node NDS32 Options
20838 @subsection NDS32 Options
20839 @cindex NDS32 Options
20840
20841 These options are defined for NDS32 implementations:
20842
20843 @table @gcctabopt
20844
20845 @item -mbig-endian
20846 @opindex mbig-endian
20847 Generate code in big-endian mode.
20848
20849 @item -mlittle-endian
20850 @opindex mlittle-endian
20851 Generate code in little-endian mode.
20852
20853 @item -mreduced-regs
20854 @opindex mreduced-regs
20855 Use reduced-set registers for register allocation.
20856
20857 @item -mfull-regs
20858 @opindex mfull-regs
20859 Use full-set registers for register allocation.
20860
20861 @item -mcmov
20862 @opindex mcmov
20863 Generate conditional move instructions.
20864
20865 @item -mno-cmov
20866 @opindex mno-cmov
20867 Do not generate conditional move instructions.
20868
20869 @item -mperf-ext
20870 @opindex mperf-ext
20871 Generate performance extension instructions.
20872
20873 @item -mno-perf-ext
20874 @opindex mno-perf-ext
20875 Do not generate performance extension instructions.
20876
20877 @item -mv3push
20878 @opindex mv3push
20879 Generate v3 push25/pop25 instructions.
20880
20881 @item -mno-v3push
20882 @opindex mno-v3push
20883 Do not generate v3 push25/pop25 instructions.
20884
20885 @item -m16-bit
20886 @opindex m16-bit
20887 Generate 16-bit instructions.
20888
20889 @item -mno-16-bit
20890 @opindex mno-16-bit
20891 Do not generate 16-bit instructions.
20892
20893 @item -misr-vector-size=@var{num}
20894 @opindex misr-vector-size
20895 Specify the size of each interrupt vector, which must be 4 or 16.
20896
20897 @item -mcache-block-size=@var{num}
20898 @opindex mcache-block-size
20899 Specify the size of each cache block,
20900 which must be a power of 2 between 4 and 512.
20901
20902 @item -march=@var{arch}
20903 @opindex march
20904 Specify the name of the target architecture.
20905
20906 @item -mcmodel=@var{code-model}
20907 @opindex mcmodel
20908 Set the code model to one of
20909 @table @asis
20910 @item @samp{small}
20911 All the data and read-only data segments must be within 512KB addressing space.
20912 The text segment must be within 16MB addressing space.
20913 @item @samp{medium}
20914 The data segment must be within 512KB while the read-only data segment can be
20915 within 4GB addressing space. The text segment should be still within 16MB
20916 addressing space.
20917 @item @samp{large}
20918 All the text and data segments can be within 4GB addressing space.
20919 @end table
20920
20921 @item -mctor-dtor
20922 @opindex mctor-dtor
20923 Enable constructor/destructor feature.
20924
20925 @item -mrelax
20926 @opindex mrelax
20927 Guide linker to relax instructions.
20928
20929 @end table
20930
20931 @node Nios II Options
20932 @subsection Nios II Options
20933 @cindex Nios II options
20934 @cindex Altera Nios II options
20935
20936 These are the options defined for the Altera Nios II processor.
20937
20938 @table @gcctabopt
20939
20940 @item -G @var{num}
20941 @opindex G
20942 @cindex smaller data references
20943 Put global and static objects less than or equal to @var{num} bytes
20944 into the small data or BSS sections instead of the normal data or BSS
20945 sections. The default value of @var{num} is 8.
20946
20947 @item -mgpopt=@var{option}
20948 @item -mgpopt
20949 @itemx -mno-gpopt
20950 @opindex mgpopt
20951 @opindex mno-gpopt
20952 Generate (do not generate) GP-relative accesses. The following
20953 @var{option} names are recognized:
20954
20955 @table @samp
20956
20957 @item none
20958 Do not generate GP-relative accesses.
20959
20960 @item local
20961 Generate GP-relative accesses for small data objects that are not
20962 external, weak, or uninitialized common symbols.
20963 Also use GP-relative addressing for objects that
20964 have been explicitly placed in a small data section via a @code{section}
20965 attribute.
20966
20967 @item global
20968 As for @samp{local}, but also generate GP-relative accesses for
20969 small data objects that are external, weak, or common. If you use this option,
20970 you must ensure that all parts of your program (including libraries) are
20971 compiled with the same @option{-G} setting.
20972
20973 @item data
20974 Generate GP-relative accesses for all data objects in the program. If you
20975 use this option, the entire data and BSS segments
20976 of your program must fit in 64K of memory and you must use an appropriate
20977 linker script to allocate them within the addressable range of the
20978 global pointer.
20979
20980 @item all
20981 Generate GP-relative addresses for function pointers as well as data
20982 pointers. If you use this option, the entire text, data, and BSS segments
20983 of your program must fit in 64K of memory and you must use an appropriate
20984 linker script to allocate them within the addressable range of the
20985 global pointer.
20986
20987 @end table
20988
20989 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
20990 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
20991
20992 The default is @option{-mgpopt} except when @option{-fpic} or
20993 @option{-fPIC} is specified to generate position-independent code.
20994 Note that the Nios II ABI does not permit GP-relative accesses from
20995 shared libraries.
20996
20997 You may need to specify @option{-mno-gpopt} explicitly when building
20998 programs that include large amounts of small data, including large
20999 GOT data sections. In this case, the 16-bit offset for GP-relative
21000 addressing may not be large enough to allow access to the entire
21001 small data section.
21002
21003 @item -mel
21004 @itemx -meb
21005 @opindex mel
21006 @opindex meb
21007 Generate little-endian (default) or big-endian (experimental) code,
21008 respectively.
21009
21010 @item -march=@var{arch}
21011 @opindex march
21012 This specifies the name of the target Nios II architecture. GCC uses this
21013 name to determine what kind of instructions it can emit when generating
21014 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
21015
21016 The preprocessor macro @code{__nios2_arch__} is available to programs,
21017 with value 1 or 2, indicating the targeted ISA level.
21018
21019 @item -mbypass-cache
21020 @itemx -mno-bypass-cache
21021 @opindex mno-bypass-cache
21022 @opindex mbypass-cache
21023 Force all load and store instructions to always bypass cache by
21024 using I/O variants of the instructions. The default is not to
21025 bypass the cache.
21026
21027 @item -mno-cache-volatile
21028 @itemx -mcache-volatile
21029 @opindex mcache-volatile
21030 @opindex mno-cache-volatile
21031 Volatile memory access bypass the cache using the I/O variants of
21032 the load and store instructions. The default is not to bypass the cache.
21033
21034 @item -mno-fast-sw-div
21035 @itemx -mfast-sw-div
21036 @opindex mno-fast-sw-div
21037 @opindex mfast-sw-div
21038 Do not use table-based fast divide for small numbers. The default
21039 is to use the fast divide at @option{-O3} and above.
21040
21041 @item -mno-hw-mul
21042 @itemx -mhw-mul
21043 @itemx -mno-hw-mulx
21044 @itemx -mhw-mulx
21045 @itemx -mno-hw-div
21046 @itemx -mhw-div
21047 @opindex mno-hw-mul
21048 @opindex mhw-mul
21049 @opindex mno-hw-mulx
21050 @opindex mhw-mulx
21051 @opindex mno-hw-div
21052 @opindex mhw-div
21053 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
21054 instructions by the compiler. The default is to emit @code{mul}
21055 and not emit @code{div} and @code{mulx}.
21056
21057 @item -mbmx
21058 @itemx -mno-bmx
21059 @itemx -mcdx
21060 @itemx -mno-cdx
21061 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
21062 CDX (code density) instructions. Enabling these instructions also
21063 requires @option{-march=r2}. Since these instructions are optional
21064 extensions to the R2 architecture, the default is not to emit them.
21065
21066 @item -mcustom-@var{insn}=@var{N}
21067 @itemx -mno-custom-@var{insn}
21068 @opindex mcustom-@var{insn}
21069 @opindex mno-custom-@var{insn}
21070 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
21071 custom instruction with encoding @var{N} when generating code that uses
21072 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
21073 instruction 253 for single-precision floating-point add operations instead
21074 of the default behavior of using a library call.
21075
21076 The following values of @var{insn} are supported. Except as otherwise
21077 noted, floating-point operations are expected to be implemented with
21078 normal IEEE 754 semantics and correspond directly to the C operators or the
21079 equivalent GCC built-in functions (@pxref{Other Builtins}).
21080
21081 Single-precision floating point:
21082 @table @asis
21083
21084 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
21085 Binary arithmetic operations.
21086
21087 @item @samp{fnegs}
21088 Unary negation.
21089
21090 @item @samp{fabss}
21091 Unary absolute value.
21092
21093 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
21094 Comparison operations.
21095
21096 @item @samp{fmins}, @samp{fmaxs}
21097 Floating-point minimum and maximum. These instructions are only
21098 generated if @option{-ffinite-math-only} is specified.
21099
21100 @item @samp{fsqrts}
21101 Unary square root operation.
21102
21103 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
21104 Floating-point trigonometric and exponential functions. These instructions
21105 are only generated if @option{-funsafe-math-optimizations} is also specified.
21106
21107 @end table
21108
21109 Double-precision floating point:
21110 @table @asis
21111
21112 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
21113 Binary arithmetic operations.
21114
21115 @item @samp{fnegd}
21116 Unary negation.
21117
21118 @item @samp{fabsd}
21119 Unary absolute value.
21120
21121 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
21122 Comparison operations.
21123
21124 @item @samp{fmind}, @samp{fmaxd}
21125 Double-precision minimum and maximum. These instructions are only
21126 generated if @option{-ffinite-math-only} is specified.
21127
21128 @item @samp{fsqrtd}
21129 Unary square root operation.
21130
21131 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
21132 Double-precision trigonometric and exponential functions. These instructions
21133 are only generated if @option{-funsafe-math-optimizations} is also specified.
21134
21135 @end table
21136
21137 Conversions:
21138 @table @asis
21139 @item @samp{fextsd}
21140 Conversion from single precision to double precision.
21141
21142 @item @samp{ftruncds}
21143 Conversion from double precision to single precision.
21144
21145 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
21146 Conversion from floating point to signed or unsigned integer types, with
21147 truncation towards zero.
21148
21149 @item @samp{round}
21150 Conversion from single-precision floating point to signed integer,
21151 rounding to the nearest integer and ties away from zero.
21152 This corresponds to the @code{__builtin_lroundf} function when
21153 @option{-fno-math-errno} is used.
21154
21155 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
21156 Conversion from signed or unsigned integer types to floating-point types.
21157
21158 @end table
21159
21160 In addition, all of the following transfer instructions for internal
21161 registers X and Y must be provided to use any of the double-precision
21162 floating-point instructions. Custom instructions taking two
21163 double-precision source operands expect the first operand in the
21164 64-bit register X. The other operand (or only operand of a unary
21165 operation) is given to the custom arithmetic instruction with the
21166 least significant half in source register @var{src1} and the most
21167 significant half in @var{src2}. A custom instruction that returns a
21168 double-precision result returns the most significant 32 bits in the
21169 destination register and the other half in 32-bit register Y.
21170 GCC automatically generates the necessary code sequences to write
21171 register X and/or read register Y when double-precision floating-point
21172 instructions are used.
21173
21174 @table @asis
21175
21176 @item @samp{fwrx}
21177 Write @var{src1} into the least significant half of X and @var{src2} into
21178 the most significant half of X.
21179
21180 @item @samp{fwry}
21181 Write @var{src1} into Y.
21182
21183 @item @samp{frdxhi}, @samp{frdxlo}
21184 Read the most or least (respectively) significant half of X and store it in
21185 @var{dest}.
21186
21187 @item @samp{frdy}
21188 Read the value of Y and store it into @var{dest}.
21189 @end table
21190
21191 Note that you can gain more local control over generation of Nios II custom
21192 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
21193 and @code{target("no-custom-@var{insn}")} function attributes
21194 (@pxref{Function Attributes})
21195 or pragmas (@pxref{Function Specific Option Pragmas}).
21196
21197 @item -mcustom-fpu-cfg=@var{name}
21198 @opindex mcustom-fpu-cfg
21199
21200 This option enables a predefined, named set of custom instruction encodings
21201 (see @option{-mcustom-@var{insn}} above).
21202 Currently, the following sets are defined:
21203
21204 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
21205 @gccoptlist{-mcustom-fmuls=252 @gol
21206 -mcustom-fadds=253 @gol
21207 -mcustom-fsubs=254 @gol
21208 -fsingle-precision-constant}
21209
21210 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
21211 @gccoptlist{-mcustom-fmuls=252 @gol
21212 -mcustom-fadds=253 @gol
21213 -mcustom-fsubs=254 @gol
21214 -mcustom-fdivs=255 @gol
21215 -fsingle-precision-constant}
21216
21217 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
21218 @gccoptlist{-mcustom-floatus=243 @gol
21219 -mcustom-fixsi=244 @gol
21220 -mcustom-floatis=245 @gol
21221 -mcustom-fcmpgts=246 @gol
21222 -mcustom-fcmples=249 @gol
21223 -mcustom-fcmpeqs=250 @gol
21224 -mcustom-fcmpnes=251 @gol
21225 -mcustom-fmuls=252 @gol
21226 -mcustom-fadds=253 @gol
21227 -mcustom-fsubs=254 @gol
21228 -mcustom-fdivs=255 @gol
21229 -fsingle-precision-constant}
21230
21231 Custom instruction assignments given by individual
21232 @option{-mcustom-@var{insn}=} options override those given by
21233 @option{-mcustom-fpu-cfg=}, regardless of the
21234 order of the options on the command line.
21235
21236 Note that you can gain more local control over selection of a FPU
21237 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
21238 function attribute (@pxref{Function Attributes})
21239 or pragma (@pxref{Function Specific Option Pragmas}).
21240
21241 @end table
21242
21243 These additional @samp{-m} options are available for the Altera Nios II
21244 ELF (bare-metal) target:
21245
21246 @table @gcctabopt
21247
21248 @item -mhal
21249 @opindex mhal
21250 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
21251 startup and termination code, and is typically used in conjunction with
21252 @option{-msys-crt0=} to specify the location of the alternate startup code
21253 provided by the HAL BSP.
21254
21255 @item -msmallc
21256 @opindex msmallc
21257 Link with a limited version of the C library, @option{-lsmallc}, rather than
21258 Newlib.
21259
21260 @item -msys-crt0=@var{startfile}
21261 @opindex msys-crt0
21262 @var{startfile} is the file name of the startfile (crt0) to use
21263 when linking. This option is only useful in conjunction with @option{-mhal}.
21264
21265 @item -msys-lib=@var{systemlib}
21266 @opindex msys-lib
21267 @var{systemlib} is the library name of the library that provides
21268 low-level system calls required by the C library,
21269 e.g. @code{read} and @code{write}.
21270 This option is typically used to link with a library provided by a HAL BSP.
21271
21272 @end table
21273
21274 @node Nvidia PTX Options
21275 @subsection Nvidia PTX Options
21276 @cindex Nvidia PTX options
21277 @cindex nvptx options
21278
21279 These options are defined for Nvidia PTX:
21280
21281 @table @gcctabopt
21282
21283 @item -m32
21284 @itemx -m64
21285 @opindex m32
21286 @opindex m64
21287 Generate code for 32-bit or 64-bit ABI.
21288
21289 @item -mmainkernel
21290 @opindex mmainkernel
21291 Link in code for a __main kernel. This is for stand-alone instead of
21292 offloading execution.
21293
21294 @item -moptimize
21295 @opindex moptimize
21296 Apply partitioned execution optimizations. This is the default when any
21297 level of optimization is selected.
21298
21299 @item -msoft-stack
21300 @opindex msoft-stack
21301 Generate code that does not use @code{.local} memory
21302 directly for stack storage. Instead, a per-warp stack pointer is
21303 maintained explicitly. This enables variable-length stack allocation (with
21304 variable-length arrays or @code{alloca}), and when global memory is used for
21305 underlying storage, makes it possible to access automatic variables from other
21306 threads, or with atomic instructions. This code generation variant is used
21307 for OpenMP offloading, but the option is exposed on its own for the purpose
21308 of testing the compiler; to generate code suitable for linking into programs
21309 using OpenMP offloading, use option @option{-mgomp}.
21310
21311 @item -muniform-simt
21312 @opindex muniform-simt
21313 Switch to code generation variant that allows to execute all threads in each
21314 warp, while maintaining memory state and side effects as if only one thread
21315 in each warp was active outside of OpenMP SIMD regions. All atomic operations
21316 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
21317 current lane index equals the master lane index), and the register being
21318 assigned is copied via a shuffle instruction from the master lane. Outside of
21319 SIMD regions lane 0 is the master; inside, each thread sees itself as the
21320 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
21321 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
21322 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
21323 with current lane index to compute the master lane index.
21324
21325 @item -mgomp
21326 @opindex mgomp
21327 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
21328 @option{-muniform-simt} options, and selects corresponding multilib variant.
21329
21330 @end table
21331
21332 @node PDP-11 Options
21333 @subsection PDP-11 Options
21334 @cindex PDP-11 Options
21335
21336 These options are defined for the PDP-11:
21337
21338 @table @gcctabopt
21339 @item -mfpu
21340 @opindex mfpu
21341 Use hardware FPP floating point. This is the default. (FIS floating
21342 point on the PDP-11/40 is not supported.)
21343
21344 @item -msoft-float
21345 @opindex msoft-float
21346 Do not use hardware floating point.
21347
21348 @item -mac0
21349 @opindex mac0
21350 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
21351
21352 @item -mno-ac0
21353 @opindex mno-ac0
21354 Return floating-point results in memory. This is the default.
21355
21356 @item -m40
21357 @opindex m40
21358 Generate code for a PDP-11/40.
21359
21360 @item -m45
21361 @opindex m45
21362 Generate code for a PDP-11/45. This is the default.
21363
21364 @item -m10
21365 @opindex m10
21366 Generate code for a PDP-11/10.
21367
21368 @item -mbcopy-builtin
21369 @opindex mbcopy-builtin
21370 Use inline @code{movmemhi} patterns for copying memory. This is the
21371 default.
21372
21373 @item -mbcopy
21374 @opindex mbcopy
21375 Do not use inline @code{movmemhi} patterns for copying memory.
21376
21377 @item -mint16
21378 @itemx -mno-int32
21379 @opindex mint16
21380 @opindex mno-int32
21381 Use 16-bit @code{int}. This is the default.
21382
21383 @item -mint32
21384 @itemx -mno-int16
21385 @opindex mint32
21386 @opindex mno-int16
21387 Use 32-bit @code{int}.
21388
21389 @item -mfloat64
21390 @itemx -mno-float32
21391 @opindex mfloat64
21392 @opindex mno-float32
21393 Use 64-bit @code{float}. This is the default.
21394
21395 @item -mfloat32
21396 @itemx -mno-float64
21397 @opindex mfloat32
21398 @opindex mno-float64
21399 Use 32-bit @code{float}.
21400
21401 @item -mabshi
21402 @opindex mabshi
21403 Use @code{abshi2} pattern. This is the default.
21404
21405 @item -mno-abshi
21406 @opindex mno-abshi
21407 Do not use @code{abshi2} pattern.
21408
21409 @item -mbranch-expensive
21410 @opindex mbranch-expensive
21411 Pretend that branches are expensive. This is for experimenting with
21412 code generation only.
21413
21414 @item -mbranch-cheap
21415 @opindex mbranch-cheap
21416 Do not pretend that branches are expensive. This is the default.
21417
21418 @item -munix-asm
21419 @opindex munix-asm
21420 Use Unix assembler syntax. This is the default when configured for
21421 @samp{pdp11-*-bsd}.
21422
21423 @item -mdec-asm
21424 @opindex mdec-asm
21425 Use DEC assembler syntax. This is the default when configured for any
21426 PDP-11 target other than @samp{pdp11-*-bsd}.
21427 @end table
21428
21429 @node picoChip Options
21430 @subsection picoChip Options
21431 @cindex picoChip options
21432
21433 These @samp{-m} options are defined for picoChip implementations:
21434
21435 @table @gcctabopt
21436
21437 @item -mae=@var{ae_type}
21438 @opindex mcpu
21439 Set the instruction set, register set, and instruction scheduling
21440 parameters for array element type @var{ae_type}. Supported values
21441 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
21442
21443 @option{-mae=ANY} selects a completely generic AE type. Code
21444 generated with this option runs on any of the other AE types. The
21445 code is not as efficient as it would be if compiled for a specific
21446 AE type, and some types of operation (e.g., multiplication) do not
21447 work properly on all types of AE.
21448
21449 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
21450 for compiled code, and is the default.
21451
21452 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
21453 option may suffer from poor performance of byte (char) manipulation,
21454 since the DSP AE does not provide hardware support for byte load/stores.
21455
21456 @item -msymbol-as-address
21457 Enable the compiler to directly use a symbol name as an address in a
21458 load/store instruction, without first loading it into a
21459 register. Typically, the use of this option generates larger
21460 programs, which run faster than when the option isn't used. However, the
21461 results vary from program to program, so it is left as a user option,
21462 rather than being permanently enabled.
21463
21464 @item -mno-inefficient-warnings
21465 Disables warnings about the generation of inefficient code. These
21466 warnings can be generated, for example, when compiling code that
21467 performs byte-level memory operations on the MAC AE type. The MAC AE has
21468 no hardware support for byte-level memory operations, so all byte
21469 load/stores must be synthesized from word load/store operations. This is
21470 inefficient and a warning is generated to indicate
21471 that you should rewrite the code to avoid byte operations, or to target
21472 an AE type that has the necessary hardware support. This option disables
21473 these warnings.
21474
21475 @end table
21476
21477 @node PowerPC Options
21478 @subsection PowerPC Options
21479 @cindex PowerPC options
21480
21481 These are listed under @xref{RS/6000 and PowerPC Options}.
21482
21483 @node RISC-V Options
21484 @subsection RISC-V Options
21485 @cindex RISC-V Options
21486
21487 These command-line options are defined for RISC-V targets:
21488
21489 @table @gcctabopt
21490 @item -mbranch-cost=@var{n}
21491 @opindex mbranch-cost
21492 Set the cost of branches to roughly @var{n} instructions.
21493
21494 @item -mmemcpy
21495 @itemx -mno-memcpy
21496 @opindex mmemcpy
21497 Don't optimize block moves.
21498
21499 @item -mplt
21500 @itemx -mno-plt
21501 @opindex plt
21502 When generating PIC code, allow the use of PLTs. Ignored for non-PIC.
21503
21504 @item -mabi=@var{ABI-string}
21505 @opindex mabi
21506 Specify integer and floating-point calling convention. This defaults to the
21507 natural calling convention: e.g.@ LP64 for RV64I, ILP32 for RV32I, LP64D for
21508 RV64G.
21509
21510 @item -mfdiv
21511 @itemx -mno-fdiv
21512 @opindex mfdiv
21513 Use hardware floating-point divide and square root instructions. This requires
21514 the F or D extensions for floating-point registers.
21515
21516 @item -mdiv
21517 @itemx -mno-div
21518 @opindex mdiv
21519 Use hardware instructions for integer division. This requires the M extension.
21520
21521 @item -march=@var{ISA-string}
21522 @opindex march
21523 Generate code for given RISC-V ISA (e.g.@ @samp{rv64im}). ISA strings must be
21524 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, and @samp{rv32imaf}.
21525
21526 @item -mtune=@var{processor-string}
21527 @opindex mtune
21528 Optimize the output for the given processor, specified by microarchitecture
21529 name.
21530
21531 @item -msmall-data-limit=@var{n}
21532 @opindex msmall-data-limit
21533 Put global and static data smaller than @var{n} bytes into a special section
21534 (on some targets).
21535
21536 @item -msave-restore
21537 @itemx -mno-save-restore
21538 @opindex msave-restore
21539 Use smaller but slower prologue and epilogue code.
21540
21541 @item -mstrict-align
21542 @itemx -mno-strict-align
21543 @opindex mstrict-align
21544 Do not generate unaligned memory accesses.
21545
21546 @item -mcmodel=@var{code-model}
21547 @opindex mcmodel
21548 Specify the code model.
21549
21550 @end table
21551
21552 @node RL78 Options
21553 @subsection RL78 Options
21554 @cindex RL78 Options
21555
21556 @table @gcctabopt
21557
21558 @item -msim
21559 @opindex msim
21560 Links in additional target libraries to support operation within a
21561 simulator.
21562
21563 @item -mmul=none
21564 @itemx -mmul=g10
21565 @itemx -mmul=g13
21566 @itemx -mmul=g14
21567 @itemx -mmul=rl78
21568 @opindex mmul
21569 Specifies the type of hardware multiplication and division support to
21570 be used. The simplest is @code{none}, which uses software for both
21571 multiplication and division. This is the default. The @code{g13}
21572 value is for the hardware multiply/divide peripheral found on the
21573 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
21574 the multiplication and division instructions supported by the RL78/G14
21575 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
21576 the value @code{mg10} is an alias for @code{none}.
21577
21578 In addition a C preprocessor macro is defined, based upon the setting
21579 of this option. Possible values are: @code{__RL78_MUL_NONE__},
21580 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
21581
21582 @item -mcpu=g10
21583 @itemx -mcpu=g13
21584 @itemx -mcpu=g14
21585 @itemx -mcpu=rl78
21586 @opindex mcpu
21587 Specifies the RL78 core to target. The default is the G14 core, also
21588 known as an S3 core or just RL78. The G13 or S2 core does not have
21589 multiply or divide instructions, instead it uses a hardware peripheral
21590 for these operations. The G10 or S1 core does not have register
21591 banks, so it uses a different calling convention.
21592
21593 If this option is set it also selects the type of hardware multiply
21594 support to use, unless this is overridden by an explicit
21595 @option{-mmul=none} option on the command line. Thus specifying
21596 @option{-mcpu=g13} enables the use of the G13 hardware multiply
21597 peripheral and specifying @option{-mcpu=g10} disables the use of
21598 hardware multiplications altogether.
21599
21600 Note, although the RL78/G14 core is the default target, specifying
21601 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
21602 change the behavior of the toolchain since it also enables G14
21603 hardware multiply support. If these options are not specified on the
21604 command line then software multiplication routines will be used even
21605 though the code targets the RL78 core. This is for backwards
21606 compatibility with older toolchains which did not have hardware
21607 multiply and divide support.
21608
21609 In addition a C preprocessor macro is defined, based upon the setting
21610 of this option. Possible values are: @code{__RL78_G10__},
21611 @code{__RL78_G13__} or @code{__RL78_G14__}.
21612
21613 @item -mg10
21614 @itemx -mg13
21615 @itemx -mg14
21616 @itemx -mrl78
21617 @opindex mg10
21618 @opindex mg13
21619 @opindex mg14
21620 @opindex mrl78
21621 These are aliases for the corresponding @option{-mcpu=} option. They
21622 are provided for backwards compatibility.
21623
21624 @item -mallregs
21625 @opindex mallregs
21626 Allow the compiler to use all of the available registers. By default
21627 registers @code{r24..r31} are reserved for use in interrupt handlers.
21628 With this option enabled these registers can be used in ordinary
21629 functions as well.
21630
21631 @item -m64bit-doubles
21632 @itemx -m32bit-doubles
21633 @opindex m64bit-doubles
21634 @opindex m32bit-doubles
21635 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
21636 or 32 bits (@option{-m32bit-doubles}) in size. The default is
21637 @option{-m32bit-doubles}.
21638
21639 @item -msave-mduc-in-interrupts
21640 @item -mno-save-mduc-in-interrupts
21641 @opindex msave-mduc-in-interrupts
21642 @opindex mno-save-mduc-in-interrupts
21643 Specifies that interrupt handler functions should preserve the
21644 MDUC registers. This is only necessary if normal code might use
21645 the MDUC registers, for example because it performs multiplication
21646 and division operations. The default is to ignore the MDUC registers
21647 as this makes the interrupt handlers faster. The target option -mg13
21648 needs to be passed for this to work as this feature is only available
21649 on the G13 target (S2 core). The MDUC registers will only be saved
21650 if the interrupt handler performs a multiplication or division
21651 operation or it calls another function.
21652
21653 @end table
21654
21655 @node RS/6000 and PowerPC Options
21656 @subsection IBM RS/6000 and PowerPC Options
21657 @cindex RS/6000 and PowerPC Options
21658 @cindex IBM RS/6000 and PowerPC Options
21659
21660 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
21661 @table @gcctabopt
21662 @item -mpowerpc-gpopt
21663 @itemx -mno-powerpc-gpopt
21664 @itemx -mpowerpc-gfxopt
21665 @itemx -mno-powerpc-gfxopt
21666 @need 800
21667 @itemx -mpowerpc64
21668 @itemx -mno-powerpc64
21669 @itemx -mmfcrf
21670 @itemx -mno-mfcrf
21671 @itemx -mpopcntb
21672 @itemx -mno-popcntb
21673 @itemx -mpopcntd
21674 @itemx -mno-popcntd
21675 @itemx -mfprnd
21676 @itemx -mno-fprnd
21677 @need 800
21678 @itemx -mcmpb
21679 @itemx -mno-cmpb
21680 @itemx -mmfpgpr
21681 @itemx -mno-mfpgpr
21682 @itemx -mhard-dfp
21683 @itemx -mno-hard-dfp
21684 @opindex mpowerpc-gpopt
21685 @opindex mno-powerpc-gpopt
21686 @opindex mpowerpc-gfxopt
21687 @opindex mno-powerpc-gfxopt
21688 @opindex mpowerpc64
21689 @opindex mno-powerpc64
21690 @opindex mmfcrf
21691 @opindex mno-mfcrf
21692 @opindex mpopcntb
21693 @opindex mno-popcntb
21694 @opindex mpopcntd
21695 @opindex mno-popcntd
21696 @opindex mfprnd
21697 @opindex mno-fprnd
21698 @opindex mcmpb
21699 @opindex mno-cmpb
21700 @opindex mmfpgpr
21701 @opindex mno-mfpgpr
21702 @opindex mhard-dfp
21703 @opindex mno-hard-dfp
21704 You use these options to specify which instructions are available on the
21705 processor you are using. The default value of these options is
21706 determined when configuring GCC@. Specifying the
21707 @option{-mcpu=@var{cpu_type}} overrides the specification of these
21708 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
21709 rather than the options listed above.
21710
21711 Specifying @option{-mpowerpc-gpopt} allows
21712 GCC to use the optional PowerPC architecture instructions in the
21713 General Purpose group, including floating-point square root. Specifying
21714 @option{-mpowerpc-gfxopt} allows GCC to
21715 use the optional PowerPC architecture instructions in the Graphics
21716 group, including floating-point select.
21717
21718 The @option{-mmfcrf} option allows GCC to generate the move from
21719 condition register field instruction implemented on the POWER4
21720 processor and other processors that support the PowerPC V2.01
21721 architecture.
21722 The @option{-mpopcntb} option allows GCC to generate the popcount and
21723 double-precision FP reciprocal estimate instruction implemented on the
21724 POWER5 processor and other processors that support the PowerPC V2.02
21725 architecture.
21726 The @option{-mpopcntd} option allows GCC to generate the popcount
21727 instruction implemented on the POWER7 processor and other processors
21728 that support the PowerPC V2.06 architecture.
21729 The @option{-mfprnd} option allows GCC to generate the FP round to
21730 integer instructions implemented on the POWER5+ processor and other
21731 processors that support the PowerPC V2.03 architecture.
21732 The @option{-mcmpb} option allows GCC to generate the compare bytes
21733 instruction implemented on the POWER6 processor and other processors
21734 that support the PowerPC V2.05 architecture.
21735 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
21736 general-purpose register instructions implemented on the POWER6X
21737 processor and other processors that support the extended PowerPC V2.05
21738 architecture.
21739 The @option{-mhard-dfp} option allows GCC to generate the decimal
21740 floating-point instructions implemented on some POWER processors.
21741
21742 The @option{-mpowerpc64} option allows GCC to generate the additional
21743 64-bit instructions that are found in the full PowerPC64 architecture
21744 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
21745 @option{-mno-powerpc64}.
21746
21747 @item -mcpu=@var{cpu_type}
21748 @opindex mcpu
21749 Set architecture type, register usage, and
21750 instruction scheduling parameters for machine type @var{cpu_type}.
21751 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
21752 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
21753 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
21754 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
21755 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
21756 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
21757 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
21758 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
21759 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
21760 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
21761 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
21762 and @samp{rs64}.
21763
21764 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
21765 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
21766 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
21767 architecture machine types, with an appropriate, generic processor
21768 model assumed for scheduling purposes.
21769
21770 The other options specify a specific processor. Code generated under
21771 those options runs best on that processor, and may not run at all on
21772 others.
21773
21774 The @option{-mcpu} options automatically enable or disable the
21775 following options:
21776
21777 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
21778 -mpopcntb -mpopcntd -mpowerpc64 @gol
21779 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
21780 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
21781 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
21782 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
21783
21784 The particular options set for any particular CPU varies between
21785 compiler versions, depending on what setting seems to produce optimal
21786 code for that CPU; it doesn't necessarily reflect the actual hardware's
21787 capabilities. If you wish to set an individual option to a particular
21788 value, you may specify it after the @option{-mcpu} option, like
21789 @option{-mcpu=970 -mno-altivec}.
21790
21791 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
21792 not enabled or disabled by the @option{-mcpu} option at present because
21793 AIX does not have full support for these options. You may still
21794 enable or disable them individually if you're sure it'll work in your
21795 environment.
21796
21797 @item -mtune=@var{cpu_type}
21798 @opindex mtune
21799 Set the instruction scheduling parameters for machine type
21800 @var{cpu_type}, but do not set the architecture type or register usage,
21801 as @option{-mcpu=@var{cpu_type}} does. The same
21802 values for @var{cpu_type} are used for @option{-mtune} as for
21803 @option{-mcpu}. If both are specified, the code generated uses the
21804 architecture and registers set by @option{-mcpu}, but the
21805 scheduling parameters set by @option{-mtune}.
21806
21807 @item -mcmodel=small
21808 @opindex mcmodel=small
21809 Generate PowerPC64 code for the small model: The TOC is limited to
21810 64k.
21811
21812 @item -mcmodel=medium
21813 @opindex mcmodel=medium
21814 Generate PowerPC64 code for the medium model: The TOC and other static
21815 data may be up to a total of 4G in size. This is the default for 64-bit
21816 Linux.
21817
21818 @item -mcmodel=large
21819 @opindex mcmodel=large
21820 Generate PowerPC64 code for the large model: The TOC may be up to 4G
21821 in size. Other data and code is only limited by the 64-bit address
21822 space.
21823
21824 @item -maltivec
21825 @itemx -mno-altivec
21826 @opindex maltivec
21827 @opindex mno-altivec
21828 Generate code that uses (does not use) AltiVec instructions, and also
21829 enable the use of built-in functions that allow more direct access to
21830 the AltiVec instruction set. You may also need to set
21831 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
21832 enhancements.
21833
21834 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
21835 @option{-maltivec=be}, the element order for AltiVec intrinsics such
21836 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
21837 match array element order corresponding to the endianness of the
21838 target. That is, element zero identifies the leftmost element in a
21839 vector register when targeting a big-endian platform, and identifies
21840 the rightmost element in a vector register when targeting a
21841 little-endian platform.
21842
21843 @item -maltivec=be
21844 @opindex maltivec=be
21845 Generate AltiVec instructions using big-endian element order,
21846 regardless of whether the target is big- or little-endian. This is
21847 the default when targeting a big-endian platform.
21848
21849 The element order is used to interpret element numbers in AltiVec
21850 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
21851 @code{vec_insert}. By default, these match array element order
21852 corresponding to the endianness for the target.
21853
21854 @item -maltivec=le
21855 @opindex maltivec=le
21856 Generate AltiVec instructions using little-endian element order,
21857 regardless of whether the target is big- or little-endian. This is
21858 the default when targeting a little-endian platform. This option is
21859 currently ignored when targeting a big-endian platform.
21860
21861 The element order is used to interpret element numbers in AltiVec
21862 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
21863 @code{vec_insert}. By default, these match array element order
21864 corresponding to the endianness for the target.
21865
21866 @item -mvrsave
21867 @itemx -mno-vrsave
21868 @opindex mvrsave
21869 @opindex mno-vrsave
21870 Generate VRSAVE instructions when generating AltiVec code.
21871
21872 @item -msecure-plt
21873 @opindex msecure-plt
21874 Generate code that allows @command{ld} and @command{ld.so}
21875 to build executables and shared
21876 libraries with non-executable @code{.plt} and @code{.got} sections.
21877 This is a PowerPC
21878 32-bit SYSV ABI option.
21879
21880 @item -mbss-plt
21881 @opindex mbss-plt
21882 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
21883 fills in, and
21884 requires @code{.plt} and @code{.got}
21885 sections that are both writable and executable.
21886 This is a PowerPC 32-bit SYSV ABI option.
21887
21888 @item -misel
21889 @itemx -mno-isel
21890 @opindex misel
21891 @opindex mno-isel
21892 This switch enables or disables the generation of ISEL instructions.
21893
21894 @item -misel=@var{yes/no}
21895 This switch has been deprecated. Use @option{-misel} and
21896 @option{-mno-isel} instead.
21897
21898 @item -mspe
21899 @itemx -mno-spe
21900 @opindex mspe
21901 @opindex mno-spe
21902 This switch enables or disables the generation of SPE simd
21903 instructions.
21904
21905 @item -mpaired
21906 @itemx -mno-paired
21907 @opindex mpaired
21908 @opindex mno-paired
21909 This switch enables or disables the generation of PAIRED simd
21910 instructions.
21911
21912 @item -mspe=@var{yes/no}
21913 This option has been deprecated. Use @option{-mspe} and
21914 @option{-mno-spe} instead.
21915
21916 @item -mvsx
21917 @itemx -mno-vsx
21918 @opindex mvsx
21919 @opindex mno-vsx
21920 Generate code that uses (does not use) vector/scalar (VSX)
21921 instructions, and also enable the use of built-in functions that allow
21922 more direct access to the VSX instruction set.
21923
21924 @item -mcrypto
21925 @itemx -mno-crypto
21926 @opindex mcrypto
21927 @opindex mno-crypto
21928 Enable the use (disable) of the built-in functions that allow direct
21929 access to the cryptographic instructions that were added in version
21930 2.07 of the PowerPC ISA.
21931
21932 @item -mdirect-move
21933 @itemx -mno-direct-move
21934 @opindex mdirect-move
21935 @opindex mno-direct-move
21936 Generate code that uses (does not use) the instructions to move data
21937 between the general purpose registers and the vector/scalar (VSX)
21938 registers that were added in version 2.07 of the PowerPC ISA.
21939
21940 @item -mhtm
21941 @itemx -mno-htm
21942 @opindex mhtm
21943 @opindex mno-htm
21944 Enable (disable) the use of the built-in functions that allow direct
21945 access to the Hardware Transactional Memory (HTM) instructions that
21946 were added in version 2.07 of the PowerPC ISA.
21947
21948 @item -mpower8-fusion
21949 @itemx -mno-power8-fusion
21950 @opindex mpower8-fusion
21951 @opindex mno-power8-fusion
21952 Generate code that keeps (does not keeps) some integer operations
21953 adjacent so that the instructions can be fused together on power8 and
21954 later processors.
21955
21956 @item -mpower8-vector
21957 @itemx -mno-power8-vector
21958 @opindex mpower8-vector
21959 @opindex mno-power8-vector
21960 Generate code that uses (does not use) the vector and scalar
21961 instructions that were added in version 2.07 of the PowerPC ISA. Also
21962 enable the use of built-in functions that allow more direct access to
21963 the vector instructions.
21964
21965 @item -mquad-memory
21966 @itemx -mno-quad-memory
21967 @opindex mquad-memory
21968 @opindex mno-quad-memory
21969 Generate code that uses (does not use) the non-atomic quad word memory
21970 instructions. The @option{-mquad-memory} option requires use of
21971 64-bit mode.
21972
21973 @item -mquad-memory-atomic
21974 @itemx -mno-quad-memory-atomic
21975 @opindex mquad-memory-atomic
21976 @opindex mno-quad-memory-atomic
21977 Generate code that uses (does not use) the atomic quad word memory
21978 instructions. The @option{-mquad-memory-atomic} option requires use of
21979 64-bit mode.
21980
21981 @item -mfloat128
21982 @itemx -mno-float128
21983 @opindex mfloat128
21984 @opindex mno-float128
21985 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
21986 and use either software emulation for IEEE 128-bit floating point or
21987 hardware instructions.
21988
21989 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
21990 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
21991 option. The @option{-mfloat128} option only works on PowerPC 64-bit
21992 Linux systems.
21993
21994 If you use the ISA 3.0 instruction set (@option{-mcpu=power9}), the
21995 @option{-mfloat128} option will also enable the generation of ISA 3.0
21996 IEEE 128-bit floating point instructions. Otherwise, IEEE 128-bit
21997 floating point will be done with software emulation.
21998
21999 @item -mfloat128-hardware
22000 @itemx -mno-float128-hardware
22001 @opindex mfloat128-hardware
22002 @opindex mno-float128-hardware
22003 Enable/disable using ISA 3.0 hardware instructions to support the
22004 @var{__float128} data type.
22005
22006 If you use @option{-mfloat128-hardware}, it will enable the option
22007 @option{-mfloat128} as well.
22008
22009 If you select ISA 3.0 instructions with @option{-mcpu=power9}, but do
22010 not use either @option{-mfloat128} or @option{-mfloat128-hardware},
22011 the IEEE 128-bit floating point support will not be enabled.
22012
22013 @item -mfloat-gprs=@var{yes/single/double/no}
22014 @itemx -mfloat-gprs
22015 @opindex mfloat-gprs
22016 This switch enables or disables the generation of floating-point
22017 operations on the general-purpose registers for architectures that
22018 support it.
22019
22020 The argument @samp{yes} or @samp{single} enables the use of
22021 single-precision floating-point operations.
22022
22023 The argument @samp{double} enables the use of single and
22024 double-precision floating-point operations.
22025
22026 The argument @samp{no} disables floating-point operations on the
22027 general-purpose registers.
22028
22029 This option is currently only available on the MPC854x.
22030
22031 @item -m32
22032 @itemx -m64
22033 @opindex m32
22034 @opindex m64
22035 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
22036 targets (including GNU/Linux). The 32-bit environment sets int, long
22037 and pointer to 32 bits and generates code that runs on any PowerPC
22038 variant. The 64-bit environment sets int to 32 bits and long and
22039 pointer to 64 bits, and generates code for PowerPC64, as for
22040 @option{-mpowerpc64}.
22041
22042 @item -mfull-toc
22043 @itemx -mno-fp-in-toc
22044 @itemx -mno-sum-in-toc
22045 @itemx -mminimal-toc
22046 @opindex mfull-toc
22047 @opindex mno-fp-in-toc
22048 @opindex mno-sum-in-toc
22049 @opindex mminimal-toc
22050 Modify generation of the TOC (Table Of Contents), which is created for
22051 every executable file. The @option{-mfull-toc} option is selected by
22052 default. In that case, GCC allocates at least one TOC entry for
22053 each unique non-automatic variable reference in your program. GCC
22054 also places floating-point constants in the TOC@. However, only
22055 16,384 entries are available in the TOC@.
22056
22057 If you receive a linker error message that saying you have overflowed
22058 the available TOC space, you can reduce the amount of TOC space used
22059 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
22060 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
22061 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
22062 generate code to calculate the sum of an address and a constant at
22063 run time instead of putting that sum into the TOC@. You may specify one
22064 or both of these options. Each causes GCC to produce very slightly
22065 slower and larger code at the expense of conserving TOC space.
22066
22067 If you still run out of space in the TOC even when you specify both of
22068 these options, specify @option{-mminimal-toc} instead. This option causes
22069 GCC to make only one TOC entry for every file. When you specify this
22070 option, GCC produces code that is slower and larger but which
22071 uses extremely little TOC space. You may wish to use this option
22072 only on files that contain less frequently-executed code.
22073
22074 @item -maix64
22075 @itemx -maix32
22076 @opindex maix64
22077 @opindex maix32
22078 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
22079 @code{long} type, and the infrastructure needed to support them.
22080 Specifying @option{-maix64} implies @option{-mpowerpc64},
22081 while @option{-maix32} disables the 64-bit ABI and
22082 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
22083
22084 @item -mxl-compat
22085 @itemx -mno-xl-compat
22086 @opindex mxl-compat
22087 @opindex mno-xl-compat
22088 Produce code that conforms more closely to IBM XL compiler semantics
22089 when using AIX-compatible ABI@. Pass floating-point arguments to
22090 prototyped functions beyond the register save area (RSA) on the stack
22091 in addition to argument FPRs. Do not assume that most significant
22092 double in 128-bit long double value is properly rounded when comparing
22093 values and converting to double. Use XL symbol names for long double
22094 support routines.
22095
22096 The AIX calling convention was extended but not initially documented to
22097 handle an obscure K&R C case of calling a function that takes the
22098 address of its arguments with fewer arguments than declared. IBM XL
22099 compilers access floating-point arguments that do not fit in the
22100 RSA from the stack when a subroutine is compiled without
22101 optimization. Because always storing floating-point arguments on the
22102 stack is inefficient and rarely needed, this option is not enabled by
22103 default and only is necessary when calling subroutines compiled by IBM
22104 XL compilers without optimization.
22105
22106 @item -mpe
22107 @opindex mpe
22108 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
22109 application written to use message passing with special startup code to
22110 enable the application to run. The system must have PE installed in the
22111 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
22112 must be overridden with the @option{-specs=} option to specify the
22113 appropriate directory location. The Parallel Environment does not
22114 support threads, so the @option{-mpe} option and the @option{-pthread}
22115 option are incompatible.
22116
22117 @item -malign-natural
22118 @itemx -malign-power
22119 @opindex malign-natural
22120 @opindex malign-power
22121 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22122 @option{-malign-natural} overrides the ABI-defined alignment of larger
22123 types, such as floating-point doubles, on their natural size-based boundary.
22124 The option @option{-malign-power} instructs GCC to follow the ABI-specified
22125 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
22126
22127 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
22128 is not supported.
22129
22130 @item -msoft-float
22131 @itemx -mhard-float
22132 @opindex msoft-float
22133 @opindex mhard-float
22134 Generate code that does not use (uses) the floating-point register set.
22135 Software floating-point emulation is provided if you use the
22136 @option{-msoft-float} option, and pass the option to GCC when linking.
22137
22138 @item -msingle-float
22139 @itemx -mdouble-float
22140 @opindex msingle-float
22141 @opindex mdouble-float
22142 Generate code for single- or double-precision floating-point operations.
22143 @option{-mdouble-float} implies @option{-msingle-float}.
22144
22145 @item -msimple-fpu
22146 @opindex msimple-fpu
22147 Do not generate @code{sqrt} and @code{div} instructions for hardware
22148 floating-point unit.
22149
22150 @item -mfpu=@var{name}
22151 @opindex mfpu
22152 Specify type of floating-point unit. Valid values for @var{name} are
22153 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
22154 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
22155 @samp{sp_full} (equivalent to @option{-msingle-float}),
22156 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
22157
22158 @item -mxilinx-fpu
22159 @opindex mxilinx-fpu
22160 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
22161
22162 @item -mmultiple
22163 @itemx -mno-multiple
22164 @opindex mmultiple
22165 @opindex mno-multiple
22166 Generate code that uses (does not use) the load multiple word
22167 instructions and the store multiple word instructions. These
22168 instructions are generated by default on POWER systems, and not
22169 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
22170 PowerPC systems, since those instructions do not work when the
22171 processor is in little-endian mode. The exceptions are PPC740 and
22172 PPC750 which permit these instructions in little-endian mode.
22173
22174 @item -mstring
22175 @itemx -mno-string
22176 @opindex mstring
22177 @opindex mno-string
22178 Generate code that uses (does not use) the load string instructions
22179 and the store string word instructions to save multiple registers and
22180 do small block moves. These instructions are generated by default on
22181 POWER systems, and not generated on PowerPC systems. Do not use
22182 @option{-mstring} on little-endian PowerPC systems, since those
22183 instructions do not work when the processor is in little-endian mode.
22184 The exceptions are PPC740 and PPC750 which permit these instructions
22185 in little-endian mode.
22186
22187 @item -mupdate
22188 @itemx -mno-update
22189 @opindex mupdate
22190 @opindex mno-update
22191 Generate code that uses (does not use) the load or store instructions
22192 that update the base register to the address of the calculated memory
22193 location. These instructions are generated by default. If you use
22194 @option{-mno-update}, there is a small window between the time that the
22195 stack pointer is updated and the address of the previous frame is
22196 stored, which means code that walks the stack frame across interrupts or
22197 signals may get corrupted data.
22198
22199 @item -mavoid-indexed-addresses
22200 @itemx -mno-avoid-indexed-addresses
22201 @opindex mavoid-indexed-addresses
22202 @opindex mno-avoid-indexed-addresses
22203 Generate code that tries to avoid (not avoid) the use of indexed load
22204 or store instructions. These instructions can incur a performance
22205 penalty on Power6 processors in certain situations, such as when
22206 stepping through large arrays that cross a 16M boundary. This option
22207 is enabled by default when targeting Power6 and disabled otherwise.
22208
22209 @item -mfused-madd
22210 @itemx -mno-fused-madd
22211 @opindex mfused-madd
22212 @opindex mno-fused-madd
22213 Generate code that uses (does not use) the floating-point multiply and
22214 accumulate instructions. These instructions are generated by default
22215 if hardware floating point is used. The machine-dependent
22216 @option{-mfused-madd} option is now mapped to the machine-independent
22217 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22218 mapped to @option{-ffp-contract=off}.
22219
22220 @item -mmulhw
22221 @itemx -mno-mulhw
22222 @opindex mmulhw
22223 @opindex mno-mulhw
22224 Generate code that uses (does not use) the half-word multiply and
22225 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
22226 These instructions are generated by default when targeting those
22227 processors.
22228
22229 @item -mdlmzb
22230 @itemx -mno-dlmzb
22231 @opindex mdlmzb
22232 @opindex mno-dlmzb
22233 Generate code that uses (does not use) the string-search @samp{dlmzb}
22234 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
22235 generated by default when targeting those processors.
22236
22237 @item -mno-bit-align
22238 @itemx -mbit-align
22239 @opindex mno-bit-align
22240 @opindex mbit-align
22241 On System V.4 and embedded PowerPC systems do not (do) force structures
22242 and unions that contain bit-fields to be aligned to the base type of the
22243 bit-field.
22244
22245 For example, by default a structure containing nothing but 8
22246 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
22247 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
22248 the structure is aligned to a 1-byte boundary and is 1 byte in
22249 size.
22250
22251 @item -mno-strict-align
22252 @itemx -mstrict-align
22253 @opindex mno-strict-align
22254 @opindex mstrict-align
22255 On System V.4 and embedded PowerPC systems do not (do) assume that
22256 unaligned memory references are handled by the system.
22257
22258 @item -mrelocatable
22259 @itemx -mno-relocatable
22260 @opindex mrelocatable
22261 @opindex mno-relocatable
22262 Generate code that allows (does not allow) a static executable to be
22263 relocated to a different address at run time. A simple embedded
22264 PowerPC system loader should relocate the entire contents of
22265 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
22266 a table of 32-bit addresses generated by this option. For this to
22267 work, all objects linked together must be compiled with
22268 @option{-mrelocatable} or @option{-mrelocatable-lib}.
22269 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
22270
22271 @item -mrelocatable-lib
22272 @itemx -mno-relocatable-lib
22273 @opindex mrelocatable-lib
22274 @opindex mno-relocatable-lib
22275 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
22276 @code{.fixup} section to allow static executables to be relocated at
22277 run time, but @option{-mrelocatable-lib} does not use the smaller stack
22278 alignment of @option{-mrelocatable}. Objects compiled with
22279 @option{-mrelocatable-lib} may be linked with objects compiled with
22280 any combination of the @option{-mrelocatable} options.
22281
22282 @item -mno-toc
22283 @itemx -mtoc
22284 @opindex mno-toc
22285 @opindex mtoc
22286 On System V.4 and embedded PowerPC systems do not (do) assume that
22287 register 2 contains a pointer to a global area pointing to the addresses
22288 used in the program.
22289
22290 @item -mlittle
22291 @itemx -mlittle-endian
22292 @opindex mlittle
22293 @opindex mlittle-endian
22294 On System V.4 and embedded PowerPC systems compile code for the
22295 processor in little-endian mode. The @option{-mlittle-endian} option is
22296 the same as @option{-mlittle}.
22297
22298 @item -mbig
22299 @itemx -mbig-endian
22300 @opindex mbig
22301 @opindex mbig-endian
22302 On System V.4 and embedded PowerPC systems compile code for the
22303 processor in big-endian mode. The @option{-mbig-endian} option is
22304 the same as @option{-mbig}.
22305
22306 @item -mdynamic-no-pic
22307 @opindex mdynamic-no-pic
22308 On Darwin and Mac OS X systems, compile code so that it is not
22309 relocatable, but that its external references are relocatable. The
22310 resulting code is suitable for applications, but not shared
22311 libraries.
22312
22313 @item -msingle-pic-base
22314 @opindex msingle-pic-base
22315 Treat the register used for PIC addressing as read-only, rather than
22316 loading it in the prologue for each function. The runtime system is
22317 responsible for initializing this register with an appropriate value
22318 before execution begins.
22319
22320 @item -mprioritize-restricted-insns=@var{priority}
22321 @opindex mprioritize-restricted-insns
22322 This option controls the priority that is assigned to
22323 dispatch-slot restricted instructions during the second scheduling
22324 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
22325 or @samp{2} to assign no, highest, or second-highest (respectively)
22326 priority to dispatch-slot restricted
22327 instructions.
22328
22329 @item -msched-costly-dep=@var{dependence_type}
22330 @opindex msched-costly-dep
22331 This option controls which dependences are considered costly
22332 by the target during instruction scheduling. The argument
22333 @var{dependence_type} takes one of the following values:
22334
22335 @table @asis
22336 @item @samp{no}
22337 No dependence is costly.
22338
22339 @item @samp{all}
22340 All dependences are costly.
22341
22342 @item @samp{true_store_to_load}
22343 A true dependence from store to load is costly.
22344
22345 @item @samp{store_to_load}
22346 Any dependence from store to load is costly.
22347
22348 @item @var{number}
22349 Any dependence for which the latency is greater than or equal to
22350 @var{number} is costly.
22351 @end table
22352
22353 @item -minsert-sched-nops=@var{scheme}
22354 @opindex minsert-sched-nops
22355 This option controls which NOP insertion scheme is used during
22356 the second scheduling pass. The argument @var{scheme} takes one of the
22357 following values:
22358
22359 @table @asis
22360 @item @samp{no}
22361 Don't insert NOPs.
22362
22363 @item @samp{pad}
22364 Pad with NOPs any dispatch group that has vacant issue slots,
22365 according to the scheduler's grouping.
22366
22367 @item @samp{regroup_exact}
22368 Insert NOPs to force costly dependent insns into
22369 separate groups. Insert exactly as many NOPs as needed to force an insn
22370 to a new group, according to the estimated processor grouping.
22371
22372 @item @var{number}
22373 Insert NOPs to force costly dependent insns into
22374 separate groups. Insert @var{number} NOPs to force an insn to a new group.
22375 @end table
22376
22377 @item -mcall-sysv
22378 @opindex mcall-sysv
22379 On System V.4 and embedded PowerPC systems compile code using calling
22380 conventions that adhere to the March 1995 draft of the System V
22381 Application Binary Interface, PowerPC processor supplement. This is the
22382 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
22383
22384 @item -mcall-sysv-eabi
22385 @itemx -mcall-eabi
22386 @opindex mcall-sysv-eabi
22387 @opindex mcall-eabi
22388 Specify both @option{-mcall-sysv} and @option{-meabi} options.
22389
22390 @item -mcall-sysv-noeabi
22391 @opindex mcall-sysv-noeabi
22392 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
22393
22394 @item -mcall-aixdesc
22395 @opindex m
22396 On System V.4 and embedded PowerPC systems compile code for the AIX
22397 operating system.
22398
22399 @item -mcall-linux
22400 @opindex mcall-linux
22401 On System V.4 and embedded PowerPC systems compile code for the
22402 Linux-based GNU system.
22403
22404 @item -mcall-freebsd
22405 @opindex mcall-freebsd
22406 On System V.4 and embedded PowerPC systems compile code for the
22407 FreeBSD operating system.
22408
22409 @item -mcall-netbsd
22410 @opindex mcall-netbsd
22411 On System V.4 and embedded PowerPC systems compile code for the
22412 NetBSD operating system.
22413
22414 @item -mcall-openbsd
22415 @opindex mcall-netbsd
22416 On System V.4 and embedded PowerPC systems compile code for the
22417 OpenBSD operating system.
22418
22419 @item -maix-struct-return
22420 @opindex maix-struct-return
22421 Return all structures in memory (as specified by the AIX ABI)@.
22422
22423 @item -msvr4-struct-return
22424 @opindex msvr4-struct-return
22425 Return structures smaller than 8 bytes in registers (as specified by the
22426 SVR4 ABI)@.
22427
22428 @item -mabi=@var{abi-type}
22429 @opindex mabi
22430 Extend the current ABI with a particular extension, or remove such extension.
22431 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
22432 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
22433 @samp{elfv1}, @samp{elfv2}@.
22434
22435 @item -mabi=spe
22436 @opindex mabi=spe
22437 Extend the current ABI with SPE ABI extensions. This does not change
22438 the default ABI, instead it adds the SPE ABI extensions to the current
22439 ABI@.
22440
22441 @item -mabi=no-spe
22442 @opindex mabi=no-spe
22443 Disable Book-E SPE ABI extensions for the current ABI@.
22444
22445 @item -mabi=ibmlongdouble
22446 @opindex mabi=ibmlongdouble
22447 Change the current ABI to use IBM extended-precision long double.
22448 This is a PowerPC 32-bit SYSV ABI option.
22449
22450 @item -mabi=ieeelongdouble
22451 @opindex mabi=ieeelongdouble
22452 Change the current ABI to use IEEE extended-precision long double.
22453 This is a PowerPC 32-bit Linux ABI option.
22454
22455 @item -mabi=elfv1
22456 @opindex mabi=elfv1
22457 Change the current ABI to use the ELFv1 ABI.
22458 This is the default ABI for big-endian PowerPC 64-bit Linux.
22459 Overriding the default ABI requires special system support and is
22460 likely to fail in spectacular ways.
22461
22462 @item -mabi=elfv2
22463 @opindex mabi=elfv2
22464 Change the current ABI to use the ELFv2 ABI.
22465 This is the default ABI for little-endian PowerPC 64-bit Linux.
22466 Overriding the default ABI requires special system support and is
22467 likely to fail in spectacular ways.
22468
22469 @item -mgnu-attribute
22470 @itemx -mno-gnu-attribute
22471 @opindex mgnu-attribute
22472 @opindex mno-gnu-attribute
22473 Emit .gnu_attribute assembly directives to set tag/value pairs in a
22474 .gnu.attributes section that specify ABI variations in function
22475 parameters or return values.
22476
22477 @item -mprototype
22478 @itemx -mno-prototype
22479 @opindex mprototype
22480 @opindex mno-prototype
22481 On System V.4 and embedded PowerPC systems assume that all calls to
22482 variable argument functions are properly prototyped. Otherwise, the
22483 compiler must insert an instruction before every non-prototyped call to
22484 set or clear bit 6 of the condition code register (@code{CR}) to
22485 indicate whether floating-point values are passed in the floating-point
22486 registers in case the function takes variable arguments. With
22487 @option{-mprototype}, only calls to prototyped variable argument functions
22488 set or clear the bit.
22489
22490 @item -msim
22491 @opindex msim
22492 On embedded PowerPC systems, assume that the startup module is called
22493 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
22494 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
22495 configurations.
22496
22497 @item -mmvme
22498 @opindex mmvme
22499 On embedded PowerPC systems, assume that the startup module is called
22500 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
22501 @file{libc.a}.
22502
22503 @item -mads
22504 @opindex mads
22505 On embedded PowerPC systems, assume that the startup module is called
22506 @file{crt0.o} and the standard C libraries are @file{libads.a} and
22507 @file{libc.a}.
22508
22509 @item -myellowknife
22510 @opindex myellowknife
22511 On embedded PowerPC systems, assume that the startup module is called
22512 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
22513 @file{libc.a}.
22514
22515 @item -mvxworks
22516 @opindex mvxworks
22517 On System V.4 and embedded PowerPC systems, specify that you are
22518 compiling for a VxWorks system.
22519
22520 @item -memb
22521 @opindex memb
22522 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
22523 header to indicate that @samp{eabi} extended relocations are used.
22524
22525 @item -meabi
22526 @itemx -mno-eabi
22527 @opindex meabi
22528 @opindex mno-eabi
22529 On System V.4 and embedded PowerPC systems do (do not) adhere to the
22530 Embedded Applications Binary Interface (EABI), which is a set of
22531 modifications to the System V.4 specifications. Selecting @option{-meabi}
22532 means that the stack is aligned to an 8-byte boundary, a function
22533 @code{__eabi} is called from @code{main} to set up the EABI
22534 environment, and the @option{-msdata} option can use both @code{r2} and
22535 @code{r13} to point to two separate small data areas. Selecting
22536 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
22537 no EABI initialization function is called from @code{main}, and the
22538 @option{-msdata} option only uses @code{r13} to point to a single
22539 small data area. The @option{-meabi} option is on by default if you
22540 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
22541
22542 @item -msdata=eabi
22543 @opindex msdata=eabi
22544 On System V.4 and embedded PowerPC systems, put small initialized
22545 @code{const} global and static data in the @code{.sdata2} section, which
22546 is pointed to by register @code{r2}. Put small initialized
22547 non-@code{const} global and static data in the @code{.sdata} section,
22548 which is pointed to by register @code{r13}. Put small uninitialized
22549 global and static data in the @code{.sbss} section, which is adjacent to
22550 the @code{.sdata} section. The @option{-msdata=eabi} option is
22551 incompatible with the @option{-mrelocatable} option. The
22552 @option{-msdata=eabi} option also sets the @option{-memb} option.
22553
22554 @item -msdata=sysv
22555 @opindex msdata=sysv
22556 On System V.4 and embedded PowerPC systems, put small global and static
22557 data in the @code{.sdata} section, which is pointed to by register
22558 @code{r13}. Put small uninitialized global and static data in the
22559 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
22560 The @option{-msdata=sysv} option is incompatible with the
22561 @option{-mrelocatable} option.
22562
22563 @item -msdata=default
22564 @itemx -msdata
22565 @opindex msdata=default
22566 @opindex msdata
22567 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
22568 compile code the same as @option{-msdata=eabi}, otherwise compile code the
22569 same as @option{-msdata=sysv}.
22570
22571 @item -msdata=data
22572 @opindex msdata=data
22573 On System V.4 and embedded PowerPC systems, put small global
22574 data in the @code{.sdata} section. Put small uninitialized global
22575 data in the @code{.sbss} section. Do not use register @code{r13}
22576 to address small data however. This is the default behavior unless
22577 other @option{-msdata} options are used.
22578
22579 @item -msdata=none
22580 @itemx -mno-sdata
22581 @opindex msdata=none
22582 @opindex mno-sdata
22583 On embedded PowerPC systems, put all initialized global and static data
22584 in the @code{.data} section, and all uninitialized data in the
22585 @code{.bss} section.
22586
22587 @item -mblock-move-inline-limit=@var{num}
22588 @opindex mblock-move-inline-limit
22589 Inline all block moves (such as calls to @code{memcpy} or structure
22590 copies) less than or equal to @var{num} bytes. The minimum value for
22591 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
22592 targets. The default value is target-specific.
22593
22594 @item -G @var{num}
22595 @opindex G
22596 @cindex smaller data references (PowerPC)
22597 @cindex .sdata/.sdata2 references (PowerPC)
22598 On embedded PowerPC systems, put global and static items less than or
22599 equal to @var{num} bytes into the small data or BSS sections instead of
22600 the normal data or BSS section. By default, @var{num} is 8. The
22601 @option{-G @var{num}} switch is also passed to the linker.
22602 All modules should be compiled with the same @option{-G @var{num}} value.
22603
22604 @item -mregnames
22605 @itemx -mno-regnames
22606 @opindex mregnames
22607 @opindex mno-regnames
22608 On System V.4 and embedded PowerPC systems do (do not) emit register
22609 names in the assembly language output using symbolic forms.
22610
22611 @item -mlongcall
22612 @itemx -mno-longcall
22613 @opindex mlongcall
22614 @opindex mno-longcall
22615 By default assume that all calls are far away so that a longer and more
22616 expensive calling sequence is required. This is required for calls
22617 farther than 32 megabytes (33,554,432 bytes) from the current location.
22618 A short call is generated if the compiler knows
22619 the call cannot be that far away. This setting can be overridden by
22620 the @code{shortcall} function attribute, or by @code{#pragma
22621 longcall(0)}.
22622
22623 Some linkers are capable of detecting out-of-range calls and generating
22624 glue code on the fly. On these systems, long calls are unnecessary and
22625 generate slower code. As of this writing, the AIX linker can do this,
22626 as can the GNU linker for PowerPC/64. It is planned to add this feature
22627 to the GNU linker for 32-bit PowerPC systems as well.
22628
22629 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
22630 callee, L42}, plus a @dfn{branch island} (glue code). The two target
22631 addresses represent the callee and the branch island. The
22632 Darwin/PPC linker prefers the first address and generates a @code{bl
22633 callee} if the PPC @code{bl} instruction reaches the callee directly;
22634 otherwise, the linker generates @code{bl L42} to call the branch
22635 island. The branch island is appended to the body of the
22636 calling function; it computes the full 32-bit address of the callee
22637 and jumps to it.
22638
22639 On Mach-O (Darwin) systems, this option directs the compiler emit to
22640 the glue for every direct call, and the Darwin linker decides whether
22641 to use or discard it.
22642
22643 In the future, GCC may ignore all longcall specifications
22644 when the linker is known to generate glue.
22645
22646 @item -mtls-markers
22647 @itemx -mno-tls-markers
22648 @opindex mtls-markers
22649 @opindex mno-tls-markers
22650 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
22651 specifying the function argument. The relocation allows the linker to
22652 reliably associate function call with argument setup instructions for
22653 TLS optimization, which in turn allows GCC to better schedule the
22654 sequence.
22655
22656 @item -mrecip
22657 @itemx -mno-recip
22658 @opindex mrecip
22659 This option enables use of the reciprocal estimate and
22660 reciprocal square root estimate instructions with additional
22661 Newton-Raphson steps to increase precision instead of doing a divide or
22662 square root and divide for floating-point arguments. You should use
22663 the @option{-ffast-math} option when using @option{-mrecip} (or at
22664 least @option{-funsafe-math-optimizations},
22665 @option{-ffinite-math-only}, @option{-freciprocal-math} and
22666 @option{-fno-trapping-math}). Note that while the throughput of the
22667 sequence is generally higher than the throughput of the non-reciprocal
22668 instruction, the precision of the sequence can be decreased by up to 2
22669 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
22670 roots.
22671
22672 @item -mrecip=@var{opt}
22673 @opindex mrecip=opt
22674 This option controls which reciprocal estimate instructions
22675 may be used. @var{opt} is a comma-separated list of options, which may
22676 be preceded by a @code{!} to invert the option:
22677
22678 @table @samp
22679
22680 @item all
22681 Enable all estimate instructions.
22682
22683 @item default
22684 Enable the default instructions, equivalent to @option{-mrecip}.
22685
22686 @item none
22687 Disable all estimate instructions, equivalent to @option{-mno-recip}.
22688
22689 @item div
22690 Enable the reciprocal approximation instructions for both
22691 single and double precision.
22692
22693 @item divf
22694 Enable the single-precision reciprocal approximation instructions.
22695
22696 @item divd
22697 Enable the double-precision reciprocal approximation instructions.
22698
22699 @item rsqrt
22700 Enable the reciprocal square root approximation instructions for both
22701 single and double precision.
22702
22703 @item rsqrtf
22704 Enable the single-precision reciprocal square root approximation instructions.
22705
22706 @item rsqrtd
22707 Enable the double-precision reciprocal square root approximation instructions.
22708
22709 @end table
22710
22711 So, for example, @option{-mrecip=all,!rsqrtd} enables
22712 all of the reciprocal estimate instructions, except for the
22713 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
22714 which handle the double-precision reciprocal square root calculations.
22715
22716 @item -mrecip-precision
22717 @itemx -mno-recip-precision
22718 @opindex mrecip-precision
22719 Assume (do not assume) that the reciprocal estimate instructions
22720 provide higher-precision estimates than is mandated by the PowerPC
22721 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
22722 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
22723 The double-precision square root estimate instructions are not generated by
22724 default on low-precision machines, since they do not provide an
22725 estimate that converges after three steps.
22726
22727 @item -mveclibabi=@var{type}
22728 @opindex mveclibabi
22729 Specifies the ABI type to use for vectorizing intrinsics using an
22730 external library. The only type supported at present is @samp{mass},
22731 which specifies to use IBM's Mathematical Acceleration Subsystem
22732 (MASS) libraries for vectorizing intrinsics using external libraries.
22733 GCC currently emits calls to @code{acosd2}, @code{acosf4},
22734 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
22735 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
22736 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
22737 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
22738 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
22739 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
22740 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
22741 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
22742 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
22743 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
22744 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
22745 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
22746 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
22747 for power7. Both @option{-ftree-vectorize} and
22748 @option{-funsafe-math-optimizations} must also be enabled. The MASS
22749 libraries must be specified at link time.
22750
22751 @item -mfriz
22752 @itemx -mno-friz
22753 @opindex mfriz
22754 Generate (do not generate) the @code{friz} instruction when the
22755 @option{-funsafe-math-optimizations} option is used to optimize
22756 rounding of floating-point values to 64-bit integer and back to floating
22757 point. The @code{friz} instruction does not return the same value if
22758 the floating-point number is too large to fit in an integer.
22759
22760 @item -mpointers-to-nested-functions
22761 @itemx -mno-pointers-to-nested-functions
22762 @opindex mpointers-to-nested-functions
22763 Generate (do not generate) code to load up the static chain register
22764 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
22765 systems where a function pointer points to a 3-word descriptor giving
22766 the function address, TOC value to be loaded in register @code{r2}, and
22767 static chain value to be loaded in register @code{r11}. The
22768 @option{-mpointers-to-nested-functions} is on by default. You cannot
22769 call through pointers to nested functions or pointers
22770 to functions compiled in other languages that use the static chain if
22771 you use @option{-mno-pointers-to-nested-functions}.
22772
22773 @item -msave-toc-indirect
22774 @itemx -mno-save-toc-indirect
22775 @opindex msave-toc-indirect
22776 Generate (do not generate) code to save the TOC value in the reserved
22777 stack location in the function prologue if the function calls through
22778 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
22779 saved in the prologue, it is saved just before the call through the
22780 pointer. The @option{-mno-save-toc-indirect} option is the default.
22781
22782 @item -mcompat-align-parm
22783 @itemx -mno-compat-align-parm
22784 @opindex mcompat-align-parm
22785 Generate (do not generate) code to pass structure parameters with a
22786 maximum alignment of 64 bits, for compatibility with older versions
22787 of GCC.
22788
22789 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
22790 structure parameter on a 128-bit boundary when that structure contained
22791 a member requiring 128-bit alignment. This is corrected in more
22792 recent versions of GCC. This option may be used to generate code
22793 that is compatible with functions compiled with older versions of
22794 GCC.
22795
22796 The @option{-mno-compat-align-parm} option is the default.
22797
22798 @item -mstack-protector-guard=@var{guard}
22799 @itemx -mstack-protector-guard-reg=@var{reg}
22800 @itemx -mstack-protector-guard-offset=@var{offset}
22801 @itemx -mstack-protector-guard-symbol=@var{symbol}
22802 @opindex mstack-protector-guard
22803 @opindex mstack-protector-guard-reg
22804 @opindex mstack-protector-guard-offset
22805 @opindex mstack-protector-guard-symbol
22806 Generate stack protection code using canary at @var{guard}. Supported
22807 locations are @samp{global} for global canary or @samp{tls} for per-thread
22808 canary in the TLS block (the default with GNU libc version 2.4 or later).
22809
22810 With the latter choice the options
22811 @option{-mstack-protector-guard-reg=@var{reg}} and
22812 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
22813 which register to use as base register for reading the canary, and from what
22814 offset from that base register. The default for those is as specified in the
22815 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
22816 the offset with a symbol reference to a canary in the TLS block.
22817 @end table
22818
22819 @node RX Options
22820 @subsection RX Options
22821 @cindex RX Options
22822
22823 These command-line options are defined for RX targets:
22824
22825 @table @gcctabopt
22826 @item -m64bit-doubles
22827 @itemx -m32bit-doubles
22828 @opindex m64bit-doubles
22829 @opindex m32bit-doubles
22830 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
22831 or 32 bits (@option{-m32bit-doubles}) in size. The default is
22832 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
22833 works on 32-bit values, which is why the default is
22834 @option{-m32bit-doubles}.
22835
22836 @item -fpu
22837 @itemx -nofpu
22838 @opindex fpu
22839 @opindex nofpu
22840 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
22841 floating-point hardware. The default is enabled for the RX600
22842 series and disabled for the RX200 series.
22843
22844 Floating-point instructions are only generated for 32-bit floating-point
22845 values, however, so the FPU hardware is not used for doubles if the
22846 @option{-m64bit-doubles} option is used.
22847
22848 @emph{Note} If the @option{-fpu} option is enabled then
22849 @option{-funsafe-math-optimizations} is also enabled automatically.
22850 This is because the RX FPU instructions are themselves unsafe.
22851
22852 @item -mcpu=@var{name}
22853 @opindex mcpu
22854 Selects the type of RX CPU to be targeted. Currently three types are
22855 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
22856 the specific @samp{RX610} CPU. The default is @samp{RX600}.
22857
22858 The only difference between @samp{RX600} and @samp{RX610} is that the
22859 @samp{RX610} does not support the @code{MVTIPL} instruction.
22860
22861 The @samp{RX200} series does not have a hardware floating-point unit
22862 and so @option{-nofpu} is enabled by default when this type is
22863 selected.
22864
22865 @item -mbig-endian-data
22866 @itemx -mlittle-endian-data
22867 @opindex mbig-endian-data
22868 @opindex mlittle-endian-data
22869 Store data (but not code) in the big-endian format. The default is
22870 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
22871 format.
22872
22873 @item -msmall-data-limit=@var{N}
22874 @opindex msmall-data-limit
22875 Specifies the maximum size in bytes of global and static variables
22876 which can be placed into the small data area. Using the small data
22877 area can lead to smaller and faster code, but the size of area is
22878 limited and it is up to the programmer to ensure that the area does
22879 not overflow. Also when the small data area is used one of the RX's
22880 registers (usually @code{r13}) is reserved for use pointing to this
22881 area, so it is no longer available for use by the compiler. This
22882 could result in slower and/or larger code if variables are pushed onto
22883 the stack instead of being held in this register.
22884
22885 Note, common variables (variables that have not been initialized) and
22886 constants are not placed into the small data area as they are assigned
22887 to other sections in the output executable.
22888
22889 The default value is zero, which disables this feature. Note, this
22890 feature is not enabled by default with higher optimization levels
22891 (@option{-O2} etc) because of the potentially detrimental effects of
22892 reserving a register. It is up to the programmer to experiment and
22893 discover whether this feature is of benefit to their program. See the
22894 description of the @option{-mpid} option for a description of how the
22895 actual register to hold the small data area pointer is chosen.
22896
22897 @item -msim
22898 @itemx -mno-sim
22899 @opindex msim
22900 @opindex mno-sim
22901 Use the simulator runtime. The default is to use the libgloss
22902 board-specific runtime.
22903
22904 @item -mas100-syntax
22905 @itemx -mno-as100-syntax
22906 @opindex mas100-syntax
22907 @opindex mno-as100-syntax
22908 When generating assembler output use a syntax that is compatible with
22909 Renesas's AS100 assembler. This syntax can also be handled by the GAS
22910 assembler, but it has some restrictions so it is not generated by default.
22911
22912 @item -mmax-constant-size=@var{N}
22913 @opindex mmax-constant-size
22914 Specifies the maximum size, in bytes, of a constant that can be used as
22915 an operand in a RX instruction. Although the RX instruction set does
22916 allow constants of up to 4 bytes in length to be used in instructions,
22917 a longer value equates to a longer instruction. Thus in some
22918 circumstances it can be beneficial to restrict the size of constants
22919 that are used in instructions. Constants that are too big are instead
22920 placed into a constant pool and referenced via register indirection.
22921
22922 The value @var{N} can be between 0 and 4. A value of 0 (the default)
22923 or 4 means that constants of any size are allowed.
22924
22925 @item -mrelax
22926 @opindex mrelax
22927 Enable linker relaxation. Linker relaxation is a process whereby the
22928 linker attempts to reduce the size of a program by finding shorter
22929 versions of various instructions. Disabled by default.
22930
22931 @item -mint-register=@var{N}
22932 @opindex mint-register
22933 Specify the number of registers to reserve for fast interrupt handler
22934 functions. The value @var{N} can be between 0 and 4. A value of 1
22935 means that register @code{r13} is reserved for the exclusive use
22936 of fast interrupt handlers. A value of 2 reserves @code{r13} and
22937 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
22938 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
22939 A value of 0, the default, does not reserve any registers.
22940
22941 @item -msave-acc-in-interrupts
22942 @opindex msave-acc-in-interrupts
22943 Specifies that interrupt handler functions should preserve the
22944 accumulator register. This is only necessary if normal code might use
22945 the accumulator register, for example because it performs 64-bit
22946 multiplications. The default is to ignore the accumulator as this
22947 makes the interrupt handlers faster.
22948
22949 @item -mpid
22950 @itemx -mno-pid
22951 @opindex mpid
22952 @opindex mno-pid
22953 Enables the generation of position independent data. When enabled any
22954 access to constant data is done via an offset from a base address
22955 held in a register. This allows the location of constant data to be
22956 determined at run time without requiring the executable to be
22957 relocated, which is a benefit to embedded applications with tight
22958 memory constraints. Data that can be modified is not affected by this
22959 option.
22960
22961 Note, using this feature reserves a register, usually @code{r13}, for
22962 the constant data base address. This can result in slower and/or
22963 larger code, especially in complicated functions.
22964
22965 The actual register chosen to hold the constant data base address
22966 depends upon whether the @option{-msmall-data-limit} and/or the
22967 @option{-mint-register} command-line options are enabled. Starting
22968 with register @code{r13} and proceeding downwards, registers are
22969 allocated first to satisfy the requirements of @option{-mint-register},
22970 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
22971 is possible for the small data area register to be @code{r8} if both
22972 @option{-mint-register=4} and @option{-mpid} are specified on the
22973 command line.
22974
22975 By default this feature is not enabled. The default can be restored
22976 via the @option{-mno-pid} command-line option.
22977
22978 @item -mno-warn-multiple-fast-interrupts
22979 @itemx -mwarn-multiple-fast-interrupts
22980 @opindex mno-warn-multiple-fast-interrupts
22981 @opindex mwarn-multiple-fast-interrupts
22982 Prevents GCC from issuing a warning message if it finds more than one
22983 fast interrupt handler when it is compiling a file. The default is to
22984 issue a warning for each extra fast interrupt handler found, as the RX
22985 only supports one such interrupt.
22986
22987 @item -mallow-string-insns
22988 @itemx -mno-allow-string-insns
22989 @opindex mallow-string-insns
22990 @opindex mno-allow-string-insns
22991 Enables or disables the use of the string manipulation instructions
22992 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
22993 @code{SWHILE} and also the @code{RMPA} instruction. These
22994 instructions may prefetch data, which is not safe to do if accessing
22995 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
22996 for more information).
22997
22998 The default is to allow these instructions, but it is not possible for
22999 GCC to reliably detect all circumstances where a string instruction
23000 might be used to access an I/O register, so their use cannot be
23001 disabled automatically. Instead it is reliant upon the programmer to
23002 use the @option{-mno-allow-string-insns} option if their program
23003 accesses I/O space.
23004
23005 When the instructions are enabled GCC defines the C preprocessor
23006 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
23007 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
23008
23009 @item -mjsr
23010 @itemx -mno-jsr
23011 @opindex mjsr
23012 @opindex mno-jsr
23013 Use only (or not only) @code{JSR} instructions to access functions.
23014 This option can be used when code size exceeds the range of @code{BSR}
23015 instructions. Note that @option{-mno-jsr} does not mean to not use
23016 @code{JSR} but instead means that any type of branch may be used.
23017 @end table
23018
23019 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
23020 has special significance to the RX port when used with the
23021 @code{interrupt} function attribute. This attribute indicates a
23022 function intended to process fast interrupts. GCC ensures
23023 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
23024 and/or @code{r13} and only provided that the normal use of the
23025 corresponding registers have been restricted via the
23026 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
23027 options.
23028
23029 @node S/390 and zSeries Options
23030 @subsection S/390 and zSeries Options
23031 @cindex S/390 and zSeries Options
23032
23033 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
23034
23035 @table @gcctabopt
23036 @item -mhard-float
23037 @itemx -msoft-float
23038 @opindex mhard-float
23039 @opindex msoft-float
23040 Use (do not use) the hardware floating-point instructions and registers
23041 for floating-point operations. When @option{-msoft-float} is specified,
23042 functions in @file{libgcc.a} are used to perform floating-point
23043 operations. When @option{-mhard-float} is specified, the compiler
23044 generates IEEE floating-point instructions. This is the default.
23045
23046 @item -mhard-dfp
23047 @itemx -mno-hard-dfp
23048 @opindex mhard-dfp
23049 @opindex mno-hard-dfp
23050 Use (do not use) the hardware decimal-floating-point instructions for
23051 decimal-floating-point operations. When @option{-mno-hard-dfp} is
23052 specified, functions in @file{libgcc.a} are used to perform
23053 decimal-floating-point operations. When @option{-mhard-dfp} is
23054 specified, the compiler generates decimal-floating-point hardware
23055 instructions. This is the default for @option{-march=z9-ec} or higher.
23056
23057 @item -mlong-double-64
23058 @itemx -mlong-double-128
23059 @opindex mlong-double-64
23060 @opindex mlong-double-128
23061 These switches control the size of @code{long double} type. A size
23062 of 64 bits makes the @code{long double} type equivalent to the @code{double}
23063 type. This is the default.
23064
23065 @item -mbackchain
23066 @itemx -mno-backchain
23067 @opindex mbackchain
23068 @opindex mno-backchain
23069 Store (do not store) the address of the caller's frame as backchain pointer
23070 into the callee's stack frame.
23071 A backchain may be needed to allow debugging using tools that do not understand
23072 DWARF call frame information.
23073 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
23074 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
23075 the backchain is placed into the topmost word of the 96/160 byte register
23076 save area.
23077
23078 In general, code compiled with @option{-mbackchain} is call-compatible with
23079 code compiled with @option{-mmo-backchain}; however, use of the backchain
23080 for debugging purposes usually requires that the whole binary is built with
23081 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
23082 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
23083 to build a linux kernel use @option{-msoft-float}.
23084
23085 The default is to not maintain the backchain.
23086
23087 @item -mpacked-stack
23088 @itemx -mno-packed-stack
23089 @opindex mpacked-stack
23090 @opindex mno-packed-stack
23091 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
23092 specified, the compiler uses the all fields of the 96/160 byte register save
23093 area only for their default purpose; unused fields still take up stack space.
23094 When @option{-mpacked-stack} is specified, register save slots are densely
23095 packed at the top of the register save area; unused space is reused for other
23096 purposes, allowing for more efficient use of the available stack space.
23097 However, when @option{-mbackchain} is also in effect, the topmost word of
23098 the save area is always used to store the backchain, and the return address
23099 register is always saved two words below the backchain.
23100
23101 As long as the stack frame backchain is not used, code generated with
23102 @option{-mpacked-stack} is call-compatible with code generated with
23103 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
23104 S/390 or zSeries generated code that uses the stack frame backchain at run
23105 time, not just for debugging purposes. Such code is not call-compatible
23106 with code compiled with @option{-mpacked-stack}. Also, note that the
23107 combination of @option{-mbackchain},
23108 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
23109 to build a linux kernel use @option{-msoft-float}.
23110
23111 The default is to not use the packed stack layout.
23112
23113 @item -msmall-exec
23114 @itemx -mno-small-exec
23115 @opindex msmall-exec
23116 @opindex mno-small-exec
23117 Generate (or do not generate) code using the @code{bras} instruction
23118 to do subroutine calls.
23119 This only works reliably if the total executable size does not
23120 exceed 64k. The default is to use the @code{basr} instruction instead,
23121 which does not have this limitation.
23122
23123 @item -m64
23124 @itemx -m31
23125 @opindex m64
23126 @opindex m31
23127 When @option{-m31} is specified, generate code compliant to the
23128 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
23129 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
23130 particular to generate 64-bit instructions. For the @samp{s390}
23131 targets, the default is @option{-m31}, while the @samp{s390x}
23132 targets default to @option{-m64}.
23133
23134 @item -mzarch
23135 @itemx -mesa
23136 @opindex mzarch
23137 @opindex mesa
23138 When @option{-mzarch} is specified, generate code using the
23139 instructions available on z/Architecture.
23140 When @option{-mesa} is specified, generate code using the
23141 instructions available on ESA/390. Note that @option{-mesa} is
23142 not possible with @option{-m64}.
23143 When generating code compliant to the GNU/Linux for S/390 ABI,
23144 the default is @option{-mesa}. When generating code compliant
23145 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
23146
23147 @item -mhtm
23148 @itemx -mno-htm
23149 @opindex mhtm
23150 @opindex mno-htm
23151 The @option{-mhtm} option enables a set of builtins making use of
23152 instructions available with the transactional execution facility
23153 introduced with the IBM zEnterprise EC12 machine generation
23154 @ref{S/390 System z Built-in Functions}.
23155 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
23156
23157 @item -mvx
23158 @itemx -mno-vx
23159 @opindex mvx
23160 @opindex mno-vx
23161 When @option{-mvx} is specified, generate code using the instructions
23162 available with the vector extension facility introduced with the IBM
23163 z13 machine generation.
23164 This option changes the ABI for some vector type values with regard to
23165 alignment and calling conventions. In case vector type values are
23166 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
23167 command will be added to mark the resulting binary with the ABI used.
23168 @option{-mvx} is enabled by default when using @option{-march=z13}.
23169
23170 @item -mzvector
23171 @itemx -mno-zvector
23172 @opindex mzvector
23173 @opindex mno-zvector
23174 The @option{-mzvector} option enables vector language extensions and
23175 builtins using instructions available with the vector extension
23176 facility introduced with the IBM z13 machine generation.
23177 This option adds support for @samp{vector} to be used as a keyword to
23178 define vector type variables and arguments. @samp{vector} is only
23179 available when GNU extensions are enabled. It will not be expanded
23180 when requesting strict standard compliance e.g. with @option{-std=c99}.
23181 In addition to the GCC low-level builtins @option{-mzvector} enables
23182 a set of builtins added for compatibility with AltiVec-style
23183 implementations like Power and Cell. In order to make use of these
23184 builtins the header file @file{vecintrin.h} needs to be included.
23185 @option{-mzvector} is disabled by default.
23186
23187 @item -mmvcle
23188 @itemx -mno-mvcle
23189 @opindex mmvcle
23190 @opindex mno-mvcle
23191 Generate (or do not generate) code using the @code{mvcle} instruction
23192 to perform block moves. When @option{-mno-mvcle} is specified,
23193 use a @code{mvc} loop instead. This is the default unless optimizing for
23194 size.
23195
23196 @item -mdebug
23197 @itemx -mno-debug
23198 @opindex mdebug
23199 @opindex mno-debug
23200 Print (or do not print) additional debug information when compiling.
23201 The default is to not print debug information.
23202
23203 @item -march=@var{cpu-type}
23204 @opindex march
23205 Generate code that runs on @var{cpu-type}, which is the name of a
23206 system representing a certain processor type. Possible values for
23207 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
23208 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
23209 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
23210 @samp{native}.
23211
23212 The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and
23213 @samp{g6} are deprecated and will be removed with future releases.
23214
23215 Specifying @samp{native} as cpu type can be used to select the best
23216 architecture option for the host processor.
23217 @option{-march=native} has no effect if GCC does not recognize the
23218 processor.
23219
23220 @item -mtune=@var{cpu-type}
23221 @opindex mtune
23222 Tune to @var{cpu-type} everything applicable about the generated code,
23223 except for the ABI and the set of available instructions.
23224 The list of @var{cpu-type} values is the same as for @option{-march}.
23225 The default is the value used for @option{-march}.
23226
23227 @item -mtpf-trace
23228 @itemx -mno-tpf-trace
23229 @opindex mtpf-trace
23230 @opindex mno-tpf-trace
23231 Generate code that adds (does not add) in TPF OS specific branches to trace
23232 routines in the operating system. This option is off by default, even
23233 when compiling for the TPF OS@.
23234
23235 @item -mfused-madd
23236 @itemx -mno-fused-madd
23237 @opindex mfused-madd
23238 @opindex mno-fused-madd
23239 Generate code that uses (does not use) the floating-point multiply and
23240 accumulate instructions. These instructions are generated by default if
23241 hardware floating point is used.
23242
23243 @item -mwarn-framesize=@var{framesize}
23244 @opindex mwarn-framesize
23245 Emit a warning if the current function exceeds the given frame size. Because
23246 this is a compile-time check it doesn't need to be a real problem when the program
23247 runs. It is intended to identify functions that most probably cause
23248 a stack overflow. It is useful to be used in an environment with limited stack
23249 size e.g.@: the linux kernel.
23250
23251 @item -mwarn-dynamicstack
23252 @opindex mwarn-dynamicstack
23253 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
23254 arrays. This is generally a bad idea with a limited stack size.
23255
23256 @item -mstack-guard=@var{stack-guard}
23257 @itemx -mstack-size=@var{stack-size}
23258 @opindex mstack-guard
23259 @opindex mstack-size
23260 If these options are provided the S/390 back end emits additional instructions in
23261 the function prologue that trigger a trap if the stack size is @var{stack-guard}
23262 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
23263 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
23264 the frame size of the compiled function is chosen.
23265 These options are intended to be used to help debugging stack overflow problems.
23266 The additionally emitted code causes only little overhead and hence can also be
23267 used in production-like systems without greater performance degradation. The given
23268 values have to be exact powers of 2 and @var{stack-size} has to be greater than
23269 @var{stack-guard} without exceeding 64k.
23270 In order to be efficient the extra code makes the assumption that the stack starts
23271 at an address aligned to the value given by @var{stack-size}.
23272 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
23273
23274 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
23275 @opindex mhotpatch
23276 If the hotpatch option is enabled, a ``hot-patching'' function
23277 prologue is generated for all functions in the compilation unit.
23278 The funtion label is prepended with the given number of two-byte
23279 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
23280 the label, 2 * @var{post-halfwords} bytes are appended, using the
23281 largest NOP like instructions the architecture allows (maximum
23282 1000000).
23283
23284 If both arguments are zero, hotpatching is disabled.
23285
23286 This option can be overridden for individual functions with the
23287 @code{hotpatch} attribute.
23288 @end table
23289
23290 @node Score Options
23291 @subsection Score Options
23292 @cindex Score Options
23293
23294 These options are defined for Score implementations:
23295
23296 @table @gcctabopt
23297 @item -meb
23298 @opindex meb
23299 Compile code for big-endian mode. This is the default.
23300
23301 @item -mel
23302 @opindex mel
23303 Compile code for little-endian mode.
23304
23305 @item -mnhwloop
23306 @opindex mnhwloop
23307 Disable generation of @code{bcnz} instructions.
23308
23309 @item -muls
23310 @opindex muls
23311 Enable generation of unaligned load and store instructions.
23312
23313 @item -mmac
23314 @opindex mmac
23315 Enable the use of multiply-accumulate instructions. Disabled by default.
23316
23317 @item -mscore5
23318 @opindex mscore5
23319 Specify the SCORE5 as the target architecture.
23320
23321 @item -mscore5u
23322 @opindex mscore5u
23323 Specify the SCORE5U of the target architecture.
23324
23325 @item -mscore7
23326 @opindex mscore7
23327 Specify the SCORE7 as the target architecture. This is the default.
23328
23329 @item -mscore7d
23330 @opindex mscore7d
23331 Specify the SCORE7D as the target architecture.
23332 @end table
23333
23334 @node SH Options
23335 @subsection SH Options
23336
23337 These @samp{-m} options are defined for the SH implementations:
23338
23339 @table @gcctabopt
23340 @item -m1
23341 @opindex m1
23342 Generate code for the SH1.
23343
23344 @item -m2
23345 @opindex m2
23346 Generate code for the SH2.
23347
23348 @item -m2e
23349 Generate code for the SH2e.
23350
23351 @item -m2a-nofpu
23352 @opindex m2a-nofpu
23353 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
23354 that the floating-point unit is not used.
23355
23356 @item -m2a-single-only
23357 @opindex m2a-single-only
23358 Generate code for the SH2a-FPU, in such a way that no double-precision
23359 floating-point operations are used.
23360
23361 @item -m2a-single
23362 @opindex m2a-single
23363 Generate code for the SH2a-FPU assuming the floating-point unit is in
23364 single-precision mode by default.
23365
23366 @item -m2a
23367 @opindex m2a
23368 Generate code for the SH2a-FPU assuming the floating-point unit is in
23369 double-precision mode by default.
23370
23371 @item -m3
23372 @opindex m3
23373 Generate code for the SH3.
23374
23375 @item -m3e
23376 @opindex m3e
23377 Generate code for the SH3e.
23378
23379 @item -m4-nofpu
23380 @opindex m4-nofpu
23381 Generate code for the SH4 without a floating-point unit.
23382
23383 @item -m4-single-only
23384 @opindex m4-single-only
23385 Generate code for the SH4 with a floating-point unit that only
23386 supports single-precision arithmetic.
23387
23388 @item -m4-single
23389 @opindex m4-single
23390 Generate code for the SH4 assuming the floating-point unit is in
23391 single-precision mode by default.
23392
23393 @item -m4
23394 @opindex m4
23395 Generate code for the SH4.
23396
23397 @item -m4-100
23398 @opindex m4-100
23399 Generate code for SH4-100.
23400
23401 @item -m4-100-nofpu
23402 @opindex m4-100-nofpu
23403 Generate code for SH4-100 in such a way that the
23404 floating-point unit is not used.
23405
23406 @item -m4-100-single
23407 @opindex m4-100-single
23408 Generate code for SH4-100 assuming the floating-point unit is in
23409 single-precision mode by default.
23410
23411 @item -m4-100-single-only
23412 @opindex m4-100-single-only
23413 Generate code for SH4-100 in such a way that no double-precision
23414 floating-point operations are used.
23415
23416 @item -m4-200
23417 @opindex m4-200
23418 Generate code for SH4-200.
23419
23420 @item -m4-200-nofpu
23421 @opindex m4-200-nofpu
23422 Generate code for SH4-200 without in such a way that the
23423 floating-point unit is not used.
23424
23425 @item -m4-200-single
23426 @opindex m4-200-single
23427 Generate code for SH4-200 assuming the floating-point unit is in
23428 single-precision mode by default.
23429
23430 @item -m4-200-single-only
23431 @opindex m4-200-single-only
23432 Generate code for SH4-200 in such a way that no double-precision
23433 floating-point operations are used.
23434
23435 @item -m4-300
23436 @opindex m4-300
23437 Generate code for SH4-300.
23438
23439 @item -m4-300-nofpu
23440 @opindex m4-300-nofpu
23441 Generate code for SH4-300 without in such a way that the
23442 floating-point unit is not used.
23443
23444 @item -m4-300-single
23445 @opindex m4-300-single
23446 Generate code for SH4-300 in such a way that no double-precision
23447 floating-point operations are used.
23448
23449 @item -m4-300-single-only
23450 @opindex m4-300-single-only
23451 Generate code for SH4-300 in such a way that no double-precision
23452 floating-point operations are used.
23453
23454 @item -m4-340
23455 @opindex m4-340
23456 Generate code for SH4-340 (no MMU, no FPU).
23457
23458 @item -m4-500
23459 @opindex m4-500
23460 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
23461 assembler.
23462
23463 @item -m4a-nofpu
23464 @opindex m4a-nofpu
23465 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
23466 floating-point unit is not used.
23467
23468 @item -m4a-single-only
23469 @opindex m4a-single-only
23470 Generate code for the SH4a, in such a way that no double-precision
23471 floating-point operations are used.
23472
23473 @item -m4a-single
23474 @opindex m4a-single
23475 Generate code for the SH4a assuming the floating-point unit is in
23476 single-precision mode by default.
23477
23478 @item -m4a
23479 @opindex m4a
23480 Generate code for the SH4a.
23481
23482 @item -m4al
23483 @opindex m4al
23484 Same as @option{-m4a-nofpu}, except that it implicitly passes
23485 @option{-dsp} to the assembler. GCC doesn't generate any DSP
23486 instructions at the moment.
23487
23488 @item -mb
23489 @opindex mb
23490 Compile code for the processor in big-endian mode.
23491
23492 @item -ml
23493 @opindex ml
23494 Compile code for the processor in little-endian mode.
23495
23496 @item -mdalign
23497 @opindex mdalign
23498 Align doubles at 64-bit boundaries. Note that this changes the calling
23499 conventions, and thus some functions from the standard C library do
23500 not work unless you recompile it first with @option{-mdalign}.
23501
23502 @item -mrelax
23503 @opindex mrelax
23504 Shorten some address references at link time, when possible; uses the
23505 linker option @option{-relax}.
23506
23507 @item -mbigtable
23508 @opindex mbigtable
23509 Use 32-bit offsets in @code{switch} tables. The default is to use
23510 16-bit offsets.
23511
23512 @item -mbitops
23513 @opindex mbitops
23514 Enable the use of bit manipulation instructions on SH2A.
23515
23516 @item -mfmovd
23517 @opindex mfmovd
23518 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
23519 alignment constraints.
23520
23521 @item -mrenesas
23522 @opindex mrenesas
23523 Comply with the calling conventions defined by Renesas.
23524
23525 @item -mno-renesas
23526 @opindex mno-renesas
23527 Comply with the calling conventions defined for GCC before the Renesas
23528 conventions were available. This option is the default for all
23529 targets of the SH toolchain.
23530
23531 @item -mnomacsave
23532 @opindex mnomacsave
23533 Mark the @code{MAC} register as call-clobbered, even if
23534 @option{-mrenesas} is given.
23535
23536 @item -mieee
23537 @itemx -mno-ieee
23538 @opindex mieee
23539 @opindex mno-ieee
23540 Control the IEEE compliance of floating-point comparisons, which affects the
23541 handling of cases where the result of a comparison is unordered. By default
23542 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
23543 enabled @option{-mno-ieee} is implicitly set, which results in faster
23544 floating-point greater-equal and less-equal comparisons. The implicit settings
23545 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
23546
23547 @item -minline-ic_invalidate
23548 @opindex minline-ic_invalidate
23549 Inline code to invalidate instruction cache entries after setting up
23550 nested function trampolines.
23551 This option has no effect if @option{-musermode} is in effect and the selected
23552 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
23553 instruction.
23554 If the selected code generation option does not allow the use of the @code{icbi}
23555 instruction, and @option{-musermode} is not in effect, the inlined code
23556 manipulates the instruction cache address array directly with an associative
23557 write. This not only requires privileged mode at run time, but it also
23558 fails if the cache line had been mapped via the TLB and has become unmapped.
23559
23560 @item -misize
23561 @opindex misize
23562 Dump instruction size and location in the assembly code.
23563
23564 @item -mpadstruct
23565 @opindex mpadstruct
23566 This option is deprecated. It pads structures to multiple of 4 bytes,
23567 which is incompatible with the SH ABI@.
23568
23569 @item -matomic-model=@var{model}
23570 @opindex matomic-model=@var{model}
23571 Sets the model of atomic operations and additional parameters as a comma
23572 separated list. For details on the atomic built-in functions see
23573 @ref{__atomic Builtins}. The following models and parameters are supported:
23574
23575 @table @samp
23576
23577 @item none
23578 Disable compiler generated atomic sequences and emit library calls for atomic
23579 operations. This is the default if the target is not @code{sh*-*-linux*}.
23580
23581 @item soft-gusa
23582 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
23583 built-in functions. The generated atomic sequences require additional support
23584 from the interrupt/exception handling code of the system and are only suitable
23585 for SH3* and SH4* single-core systems. This option is enabled by default when
23586 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
23587 this option also partially utilizes the hardware atomic instructions
23588 @code{movli.l} and @code{movco.l} to create more efficient code, unless
23589 @samp{strict} is specified.
23590
23591 @item soft-tcb
23592 Generate software atomic sequences that use a variable in the thread control
23593 block. This is a variation of the gUSA sequences which can also be used on
23594 SH1* and SH2* targets. The generated atomic sequences require additional
23595 support from the interrupt/exception handling code of the system and are only
23596 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
23597 parameter has to be specified as well.
23598
23599 @item soft-imask
23600 Generate software atomic sequences that temporarily disable interrupts by
23601 setting @code{SR.IMASK = 1111}. This model works only when the program runs
23602 in privileged mode and is only suitable for single-core systems. Additional
23603 support from the interrupt/exception handling code of the system is not
23604 required. This model is enabled by default when the target is
23605 @code{sh*-*-linux*} and SH1* or SH2*.
23606
23607 @item hard-llcs
23608 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
23609 instructions only. This is only available on SH4A and is suitable for
23610 multi-core systems. Since the hardware instructions support only 32 bit atomic
23611 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
23612 Code compiled with this option is also compatible with other software
23613 atomic model interrupt/exception handling systems if executed on an SH4A
23614 system. Additional support from the interrupt/exception handling code of the
23615 system is not required for this model.
23616
23617 @item gbr-offset=
23618 This parameter specifies the offset in bytes of the variable in the thread
23619 control block structure that should be used by the generated atomic sequences
23620 when the @samp{soft-tcb} model has been selected. For other models this
23621 parameter is ignored. The specified value must be an integer multiple of four
23622 and in the range 0-1020.
23623
23624 @item strict
23625 This parameter prevents mixed usage of multiple atomic models, even if they
23626 are compatible, and makes the compiler generate atomic sequences of the
23627 specified model only.
23628
23629 @end table
23630
23631 @item -mtas
23632 @opindex mtas
23633 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
23634 Notice that depending on the particular hardware and software configuration
23635 this can degrade overall performance due to the operand cache line flushes
23636 that are implied by the @code{tas.b} instruction. On multi-core SH4A
23637 processors the @code{tas.b} instruction must be used with caution since it
23638 can result in data corruption for certain cache configurations.
23639
23640 @item -mprefergot
23641 @opindex mprefergot
23642 When generating position-independent code, emit function calls using
23643 the Global Offset Table instead of the Procedure Linkage Table.
23644
23645 @item -musermode
23646 @itemx -mno-usermode
23647 @opindex musermode
23648 @opindex mno-usermode
23649 Don't allow (allow) the compiler generating privileged mode code. Specifying
23650 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
23651 inlined code would not work in user mode. @option{-musermode} is the default
23652 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
23653 @option{-musermode} has no effect, since there is no user mode.
23654
23655 @item -multcost=@var{number}
23656 @opindex multcost=@var{number}
23657 Set the cost to assume for a multiply insn.
23658
23659 @item -mdiv=@var{strategy}
23660 @opindex mdiv=@var{strategy}
23661 Set the division strategy to be used for integer division operations.
23662 @var{strategy} can be one of:
23663
23664 @table @samp
23665
23666 @item call-div1
23667 Calls a library function that uses the single-step division instruction
23668 @code{div1} to perform the operation. Division by zero calculates an
23669 unspecified result and does not trap. This is the default except for SH4,
23670 SH2A and SHcompact.
23671
23672 @item call-fp
23673 Calls a library function that performs the operation in double precision
23674 floating point. Division by zero causes a floating-point exception. This is
23675 the default for SHcompact with FPU. Specifying this for targets that do not
23676 have a double precision FPU defaults to @code{call-div1}.
23677
23678 @item call-table
23679 Calls a library function that uses a lookup table for small divisors and
23680 the @code{div1} instruction with case distinction for larger divisors. Division
23681 by zero calculates an unspecified result and does not trap. This is the default
23682 for SH4. Specifying this for targets that do not have dynamic shift
23683 instructions defaults to @code{call-div1}.
23684
23685 @end table
23686
23687 When a division strategy has not been specified the default strategy is
23688 selected based on the current target. For SH2A the default strategy is to
23689 use the @code{divs} and @code{divu} instructions instead of library function
23690 calls.
23691
23692 @item -maccumulate-outgoing-args
23693 @opindex maccumulate-outgoing-args
23694 Reserve space once for outgoing arguments in the function prologue rather
23695 than around each call. Generally beneficial for performance and size. Also
23696 needed for unwinding to avoid changing the stack frame around conditional code.
23697
23698 @item -mdivsi3_libfunc=@var{name}
23699 @opindex mdivsi3_libfunc=@var{name}
23700 Set the name of the library function used for 32-bit signed division to
23701 @var{name}.
23702 This only affects the name used in the @samp{call} division strategies, and
23703 the compiler still expects the same sets of input/output/clobbered registers as
23704 if this option were not present.
23705
23706 @item -mfixed-range=@var{register-range}
23707 @opindex mfixed-range
23708 Generate code treating the given register range as fixed registers.
23709 A fixed register is one that the register allocator can not use. This is
23710 useful when compiling kernel code. A register range is specified as
23711 two registers separated by a dash. Multiple register ranges can be
23712 specified separated by a comma.
23713
23714 @item -mbranch-cost=@var{num}
23715 @opindex mbranch-cost=@var{num}
23716 Assume @var{num} to be the cost for a branch instruction. Higher numbers
23717 make the compiler try to generate more branch-free code if possible.
23718 If not specified the value is selected depending on the processor type that
23719 is being compiled for.
23720
23721 @item -mzdcbranch
23722 @itemx -mno-zdcbranch
23723 @opindex mzdcbranch
23724 @opindex mno-zdcbranch
23725 Assume (do not assume) that zero displacement conditional branch instructions
23726 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
23727 compiler prefers zero displacement branch code sequences. This is
23728 enabled by default when generating code for SH4 and SH4A. It can be explicitly
23729 disabled by specifying @option{-mno-zdcbranch}.
23730
23731 @item -mcbranch-force-delay-slot
23732 @opindex mcbranch-force-delay-slot
23733 Force the usage of delay slots for conditional branches, which stuffs the delay
23734 slot with a @code{nop} if a suitable instruction cannot be found. By default
23735 this option is disabled. It can be enabled to work around hardware bugs as
23736 found in the original SH7055.
23737
23738 @item -mfused-madd
23739 @itemx -mno-fused-madd
23740 @opindex mfused-madd
23741 @opindex mno-fused-madd
23742 Generate code that uses (does not use) the floating-point multiply and
23743 accumulate instructions. These instructions are generated by default
23744 if hardware floating point is used. The machine-dependent
23745 @option{-mfused-madd} option is now mapped to the machine-independent
23746 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23747 mapped to @option{-ffp-contract=off}.
23748
23749 @item -mfsca
23750 @itemx -mno-fsca
23751 @opindex mfsca
23752 @opindex mno-fsca
23753 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
23754 and cosine approximations. The option @option{-mfsca} must be used in
23755 combination with @option{-funsafe-math-optimizations}. It is enabled by default
23756 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
23757 approximations even if @option{-funsafe-math-optimizations} is in effect.
23758
23759 @item -mfsrra
23760 @itemx -mno-fsrra
23761 @opindex mfsrra
23762 @opindex mno-fsrra
23763 Allow or disallow the compiler to emit the @code{fsrra} instruction for
23764 reciprocal square root approximations. The option @option{-mfsrra} must be used
23765 in combination with @option{-funsafe-math-optimizations} and
23766 @option{-ffinite-math-only}. It is enabled by default when generating code for
23767 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
23768 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
23769 in effect.
23770
23771 @item -mpretend-cmove
23772 @opindex mpretend-cmove
23773 Prefer zero-displacement conditional branches for conditional move instruction
23774 patterns. This can result in faster code on the SH4 processor.
23775
23776 @item -mfdpic
23777 @opindex fdpic
23778 Generate code using the FDPIC ABI.
23779
23780 @end table
23781
23782 @node Solaris 2 Options
23783 @subsection Solaris 2 Options
23784 @cindex Solaris 2 options
23785
23786 These @samp{-m} options are supported on Solaris 2:
23787
23788 @table @gcctabopt
23789 @item -mclear-hwcap
23790 @opindex mclear-hwcap
23791 @option{-mclear-hwcap} tells the compiler to remove the hardware
23792 capabilities generated by the Solaris assembler. This is only necessary
23793 when object files use ISA extensions not supported by the current
23794 machine, but check at runtime whether or not to use them.
23795
23796 @item -mimpure-text
23797 @opindex mimpure-text
23798 @option{-mimpure-text}, used in addition to @option{-shared}, tells
23799 the compiler to not pass @option{-z text} to the linker when linking a
23800 shared object. Using this option, you can link position-dependent
23801 code into a shared object.
23802
23803 @option{-mimpure-text} suppresses the ``relocations remain against
23804 allocatable but non-writable sections'' linker error message.
23805 However, the necessary relocations trigger copy-on-write, and the
23806 shared object is not actually shared across processes. Instead of
23807 using @option{-mimpure-text}, you should compile all source code with
23808 @option{-fpic} or @option{-fPIC}.
23809
23810 @end table
23811
23812 These switches are supported in addition to the above on Solaris 2:
23813
23814 @table @gcctabopt
23815 @item -pthreads
23816 @opindex pthreads
23817 This is a synonym for @option{-pthread}.
23818 @end table
23819
23820 @node SPARC Options
23821 @subsection SPARC Options
23822 @cindex SPARC options
23823
23824 These @samp{-m} options are supported on the SPARC:
23825
23826 @table @gcctabopt
23827 @item -mno-app-regs
23828 @itemx -mapp-regs
23829 @opindex mno-app-regs
23830 @opindex mapp-regs
23831 Specify @option{-mapp-regs} to generate output using the global registers
23832 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
23833 global register 1, each global register 2 through 4 is then treated as an
23834 allocable register that is clobbered by function calls. This is the default.
23835
23836 To be fully SVR4 ABI-compliant at the cost of some performance loss,
23837 specify @option{-mno-app-regs}. You should compile libraries and system
23838 software with this option.
23839
23840 @item -mflat
23841 @itemx -mno-flat
23842 @opindex mflat
23843 @opindex mno-flat
23844 With @option{-mflat}, the compiler does not generate save/restore instructions
23845 and uses a ``flat'' or single register window model. This model is compatible
23846 with the regular register window model. The local registers and the input
23847 registers (0--5) are still treated as ``call-saved'' registers and are
23848 saved on the stack as needed.
23849
23850 With @option{-mno-flat} (the default), the compiler generates save/restore
23851 instructions (except for leaf functions). This is the normal operating mode.
23852
23853 @item -mfpu
23854 @itemx -mhard-float
23855 @opindex mfpu
23856 @opindex mhard-float
23857 Generate output containing floating-point instructions. This is the
23858 default.
23859
23860 @item -mno-fpu
23861 @itemx -msoft-float
23862 @opindex mno-fpu
23863 @opindex msoft-float
23864 Generate output containing library calls for floating point.
23865 @strong{Warning:} the requisite libraries are not available for all SPARC
23866 targets. Normally the facilities of the machine's usual C compiler are
23867 used, but this cannot be done directly in cross-compilation. You must make
23868 your own arrangements to provide suitable library functions for
23869 cross-compilation. The embedded targets @samp{sparc-*-aout} and
23870 @samp{sparclite-*-*} do provide software floating-point support.
23871
23872 @option{-msoft-float} changes the calling convention in the output file;
23873 therefore, it is only useful if you compile @emph{all} of a program with
23874 this option. In particular, you need to compile @file{libgcc.a}, the
23875 library that comes with GCC, with @option{-msoft-float} in order for
23876 this to work.
23877
23878 @item -mhard-quad-float
23879 @opindex mhard-quad-float
23880 Generate output containing quad-word (long double) floating-point
23881 instructions.
23882
23883 @item -msoft-quad-float
23884 @opindex msoft-quad-float
23885 Generate output containing library calls for quad-word (long double)
23886 floating-point instructions. The functions called are those specified
23887 in the SPARC ABI@. This is the default.
23888
23889 As of this writing, there are no SPARC implementations that have hardware
23890 support for the quad-word floating-point instructions. They all invoke
23891 a trap handler for one of these instructions, and then the trap handler
23892 emulates the effect of the instruction. Because of the trap handler overhead,
23893 this is much slower than calling the ABI library routines. Thus the
23894 @option{-msoft-quad-float} option is the default.
23895
23896 @item -mno-unaligned-doubles
23897 @itemx -munaligned-doubles
23898 @opindex mno-unaligned-doubles
23899 @opindex munaligned-doubles
23900 Assume that doubles have 8-byte alignment. This is the default.
23901
23902 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
23903 alignment only if they are contained in another type, or if they have an
23904 absolute address. Otherwise, it assumes they have 4-byte alignment.
23905 Specifying this option avoids some rare compatibility problems with code
23906 generated by other compilers. It is not the default because it results
23907 in a performance loss, especially for floating-point code.
23908
23909 @item -muser-mode
23910 @itemx -mno-user-mode
23911 @opindex muser-mode
23912 @opindex mno-user-mode
23913 Do not generate code that can only run in supervisor mode. This is relevant
23914 only for the @code{casa} instruction emitted for the LEON3 processor. This
23915 is the default.
23916
23917 @item -mfaster-structs
23918 @itemx -mno-faster-structs
23919 @opindex mfaster-structs
23920 @opindex mno-faster-structs
23921 With @option{-mfaster-structs}, the compiler assumes that structures
23922 should have 8-byte alignment. This enables the use of pairs of
23923 @code{ldd} and @code{std} instructions for copies in structure
23924 assignment, in place of twice as many @code{ld} and @code{st} pairs.
23925 However, the use of this changed alignment directly violates the SPARC
23926 ABI@. Thus, it's intended only for use on targets where the developer
23927 acknowledges that their resulting code is not directly in line with
23928 the rules of the ABI@.
23929
23930 @item -mstd-struct-return
23931 @itemx -mno-std-struct-return
23932 @opindex mstd-struct-return
23933 @opindex mno-std-struct-return
23934 With @option{-mstd-struct-return}, the compiler generates checking code
23935 in functions returning structures or unions to detect size mismatches
23936 between the two sides of function calls, as per the 32-bit ABI@.
23937
23938 The default is @option{-mno-std-struct-return}. This option has no effect
23939 in 64-bit mode.
23940
23941 @item -mlra
23942 @itemx -mno-lra
23943 @opindex mlra
23944 @opindex mno-lra
23945 Enable Local Register Allocation. This is the default for SPARC since GCC 7
23946 so @option{-mno-lra} needs to be passed to get old Reload.
23947
23948 @item -mcpu=@var{cpu_type}
23949 @opindex mcpu
23950 Set the instruction set, register set, and instruction scheduling parameters
23951 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23952 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
23953 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
23954 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
23955 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
23956 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
23957
23958 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
23959 which selects the best architecture option for the host processor.
23960 @option{-mcpu=native} has no effect if GCC does not recognize
23961 the processor.
23962
23963 Default instruction scheduling parameters are used for values that select
23964 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
23965 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
23966
23967 Here is a list of each supported architecture and their supported
23968 implementations.
23969
23970 @table @asis
23971 @item v7
23972 cypress, leon3v7
23973
23974 @item v8
23975 supersparc, hypersparc, leon, leon3
23976
23977 @item sparclite
23978 f930, f934, sparclite86x
23979
23980 @item sparclet
23981 tsc701
23982
23983 @item v9
23984 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
23985 niagara7, m8
23986 @end table
23987
23988 By default (unless configured otherwise), GCC generates code for the V7
23989 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
23990 additionally optimizes it for the Cypress CY7C602 chip, as used in the
23991 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
23992 SPARCStation 1, 2, IPX etc.
23993
23994 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
23995 architecture. The only difference from V7 code is that the compiler emits
23996 the integer multiply and integer divide instructions which exist in SPARC-V8
23997 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
23998 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
23999 2000 series.
24000
24001 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
24002 the SPARC architecture. This adds the integer multiply, integer divide step
24003 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
24004 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
24005 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
24006 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
24007 MB86934 chip, which is the more recent SPARClite with FPU@.
24008
24009 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
24010 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
24011 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
24012 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
24013 optimizes it for the TEMIC SPARClet chip.
24014
24015 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
24016 architecture. This adds 64-bit integer and floating-point move instructions,
24017 3 additional floating-point condition code registers and conditional move
24018 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
24019 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
24020 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
24021 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
24022 @option{-mcpu=niagara}, the compiler additionally optimizes it for
24023 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
24024 additionally optimizes it for Sun UltraSPARC T2 chips. With
24025 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
24026 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
24027 additionally optimizes it for Sun UltraSPARC T4 chips. With
24028 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
24029 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
24030 additionally optimizes it for Oracle M8 chips.
24031
24032 @item -mtune=@var{cpu_type}
24033 @opindex mtune
24034 Set the instruction scheduling parameters for machine type
24035 @var{cpu_type}, but do not set the instruction set or register set that the
24036 option @option{-mcpu=@var{cpu_type}} does.
24037
24038 The same values for @option{-mcpu=@var{cpu_type}} can be used for
24039 @option{-mtune=@var{cpu_type}}, but the only useful values are those
24040 that select a particular CPU implementation. Those are
24041 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
24042 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
24043 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
24044 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
24045 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
24046 and GNU/Linux toolchains, @samp{native} can also be used.
24047
24048 @item -mv8plus
24049 @itemx -mno-v8plus
24050 @opindex mv8plus
24051 @opindex mno-v8plus
24052 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
24053 difference from the V8 ABI is that the global and out registers are
24054 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
24055 mode for all SPARC-V9 processors.
24056
24057 @item -mvis
24058 @itemx -mno-vis
24059 @opindex mvis
24060 @opindex mno-vis
24061 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
24062 Visual Instruction Set extensions. The default is @option{-mno-vis}.
24063
24064 @item -mvis2
24065 @itemx -mno-vis2
24066 @opindex mvis2
24067 @opindex mno-vis2
24068 With @option{-mvis2}, GCC generates code that takes advantage of
24069 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
24070 default is @option{-mvis2} when targeting a cpu that supports such
24071 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
24072 also sets @option{-mvis}.
24073
24074 @item -mvis3
24075 @itemx -mno-vis3
24076 @opindex mvis3
24077 @opindex mno-vis3
24078 With @option{-mvis3}, GCC generates code that takes advantage of
24079 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
24080 default is @option{-mvis3} when targeting a cpu that supports such
24081 instructions, such as niagara-3 and later. Setting @option{-mvis3}
24082 also sets @option{-mvis2} and @option{-mvis}.
24083
24084 @item -mvis4
24085 @itemx -mno-vis4
24086 @opindex mvis4
24087 @opindex mno-vis4
24088 With @option{-mvis4}, GCC generates code that takes advantage of
24089 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
24090 default is @option{-mvis4} when targeting a cpu that supports such
24091 instructions, such as niagara-7 and later. Setting @option{-mvis4}
24092 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
24093
24094 @item -mvis4b
24095 @itemx -mno-vis4b
24096 @opindex mvis4b
24097 @opindex mno-vis4b
24098 With @option{-mvis4b}, GCC generates code that takes advantage of
24099 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
24100 the additional VIS instructions introduced in the Oracle SPARC
24101 Architecture 2017. The default is @option{-mvis4b} when targeting a
24102 cpu that supports such instructions, such as m8 and later. Setting
24103 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
24104 @option{-mvis2} and @option{-mvis}.
24105
24106 @item -mcbcond
24107 @itemx -mno-cbcond
24108 @opindex mcbcond
24109 @opindex mno-cbcond
24110 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
24111 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
24112 when targeting a CPU that supports such instructions, such as Niagara-4 and
24113 later.
24114
24115 @item -mfmaf
24116 @itemx -mno-fmaf
24117 @opindex mfmaf
24118 @opindex mno-fmaf
24119 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
24120 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
24121 when targeting a CPU that supports such instructions, such as Niagara-3 and
24122 later.
24123
24124 @item -mfsmuld
24125 @itemx -mno-fsmuld
24126 @opindex mfsmuld
24127 @opindex mno-fsmuld
24128 With @option{-mfsmuld}, GCC generates code that takes advantage of the
24129 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
24130 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
24131 or V9 with FPU except @option{-mcpu=leon}.
24132
24133 @item -mpopc
24134 @itemx -mno-popc
24135 @opindex mpopc
24136 @opindex mno-popc
24137 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
24138 Population Count instruction. The default is @option{-mpopc}
24139 when targeting a CPU that supports such an instruction, such as Niagara-2 and
24140 later.
24141
24142 @item -msubxc
24143 @itemx -mno-subxc
24144 @opindex msubxc
24145 @opindex mno-subxc
24146 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
24147 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
24148 when targeting a CPU that supports such an instruction, such as Niagara-7 and
24149 later.
24150
24151 @item -mfix-at697f
24152 @opindex mfix-at697f
24153 Enable the documented workaround for the single erratum of the Atmel AT697F
24154 processor (which corresponds to erratum #13 of the AT697E processor).
24155
24156 @item -mfix-ut699
24157 @opindex mfix-ut699
24158 Enable the documented workarounds for the floating-point errata and the data
24159 cache nullify errata of the UT699 processor.
24160
24161 @item -mfix-ut700
24162 @opindex mfix-ut700
24163 Enable the documented workaround for the back-to-back store errata of
24164 the UT699E/UT700 processor.
24165
24166 @item -mfix-gr712rc
24167 @opindex mfix-gr712rc
24168 Enable the documented workaround for the back-to-back store errata of
24169 the GR712RC processor.
24170 @end table
24171
24172 These @samp{-m} options are supported in addition to the above
24173 on SPARC-V9 processors in 64-bit environments:
24174
24175 @table @gcctabopt
24176 @item -m32
24177 @itemx -m64
24178 @opindex m32
24179 @opindex m64
24180 Generate code for a 32-bit or 64-bit environment.
24181 The 32-bit environment sets int, long and pointer to 32 bits.
24182 The 64-bit environment sets int to 32 bits and long and pointer
24183 to 64 bits.
24184
24185 @item -mcmodel=@var{which}
24186 @opindex mcmodel
24187 Set the code model to one of
24188
24189 @table @samp
24190 @item medlow
24191 The Medium/Low code model: 64-bit addresses, programs
24192 must be linked in the low 32 bits of memory. Programs can be statically
24193 or dynamically linked.
24194
24195 @item medmid
24196 The Medium/Middle code model: 64-bit addresses, programs
24197 must be linked in the low 44 bits of memory, the text and data segments must
24198 be less than 2GB in size and the data segment must be located within 2GB of
24199 the text segment.
24200
24201 @item medany
24202 The Medium/Anywhere code model: 64-bit addresses, programs
24203 may be linked anywhere in memory, the text and data segments must be less
24204 than 2GB in size and the data segment must be located within 2GB of the
24205 text segment.
24206
24207 @item embmedany
24208 The Medium/Anywhere code model for embedded systems:
24209 64-bit addresses, the text and data segments must be less than 2GB in
24210 size, both starting anywhere in memory (determined at link time). The
24211 global register %g4 points to the base of the data segment. Programs
24212 are statically linked and PIC is not supported.
24213 @end table
24214
24215 @item -mmemory-model=@var{mem-model}
24216 @opindex mmemory-model
24217 Set the memory model in force on the processor to one of
24218
24219 @table @samp
24220 @item default
24221 The default memory model for the processor and operating system.
24222
24223 @item rmo
24224 Relaxed Memory Order
24225
24226 @item pso
24227 Partial Store Order
24228
24229 @item tso
24230 Total Store Order
24231
24232 @item sc
24233 Sequential Consistency
24234 @end table
24235
24236 These memory models are formally defined in Appendix D of the SPARC-V9
24237 architecture manual, as set in the processor's @code{PSTATE.MM} field.
24238
24239 @item -mstack-bias
24240 @itemx -mno-stack-bias
24241 @opindex mstack-bias
24242 @opindex mno-stack-bias
24243 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
24244 frame pointer if present, are offset by @minus{}2047 which must be added back
24245 when making stack frame references. This is the default in 64-bit mode.
24246 Otherwise, assume no such offset is present.
24247 @end table
24248
24249 @node SPU Options
24250 @subsection SPU Options
24251 @cindex SPU options
24252
24253 These @samp{-m} options are supported on the SPU:
24254
24255 @table @gcctabopt
24256 @item -mwarn-reloc
24257 @itemx -merror-reloc
24258 @opindex mwarn-reloc
24259 @opindex merror-reloc
24260
24261 The loader for SPU does not handle dynamic relocations. By default, GCC
24262 gives an error when it generates code that requires a dynamic
24263 relocation. @option{-mno-error-reloc} disables the error,
24264 @option{-mwarn-reloc} generates a warning instead.
24265
24266 @item -msafe-dma
24267 @itemx -munsafe-dma
24268 @opindex msafe-dma
24269 @opindex munsafe-dma
24270
24271 Instructions that initiate or test completion of DMA must not be
24272 reordered with respect to loads and stores of the memory that is being
24273 accessed.
24274 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
24275 memory accesses, but that can lead to inefficient code in places where the
24276 memory is known to not change. Rather than mark the memory as volatile,
24277 you can use @option{-msafe-dma} to tell the compiler to treat
24278 the DMA instructions as potentially affecting all memory.
24279
24280 @item -mbranch-hints
24281 @opindex mbranch-hints
24282
24283 By default, GCC generates a branch hint instruction to avoid
24284 pipeline stalls for always-taken or probably-taken branches. A hint
24285 is not generated closer than 8 instructions away from its branch.
24286 There is little reason to disable them, except for debugging purposes,
24287 or to make an object a little bit smaller.
24288
24289 @item -msmall-mem
24290 @itemx -mlarge-mem
24291 @opindex msmall-mem
24292 @opindex mlarge-mem
24293
24294 By default, GCC generates code assuming that addresses are never larger
24295 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
24296 a full 32-bit address.
24297
24298 @item -mstdmain
24299 @opindex mstdmain
24300
24301 By default, GCC links against startup code that assumes the SPU-style
24302 main function interface (which has an unconventional parameter list).
24303 With @option{-mstdmain}, GCC links your program against startup
24304 code that assumes a C99-style interface to @code{main}, including a
24305 local copy of @code{argv} strings.
24306
24307 @item -mfixed-range=@var{register-range}
24308 @opindex mfixed-range
24309 Generate code treating the given register range as fixed registers.
24310 A fixed register is one that the register allocator cannot use. This is
24311 useful when compiling kernel code. A register range is specified as
24312 two registers separated by a dash. Multiple register ranges can be
24313 specified separated by a comma.
24314
24315 @item -mea32
24316 @itemx -mea64
24317 @opindex mea32
24318 @opindex mea64
24319 Compile code assuming that pointers to the PPU address space accessed
24320 via the @code{__ea} named address space qualifier are either 32 or 64
24321 bits wide. The default is 32 bits. As this is an ABI-changing option,
24322 all object code in an executable must be compiled with the same setting.
24323
24324 @item -maddress-space-conversion
24325 @itemx -mno-address-space-conversion
24326 @opindex maddress-space-conversion
24327 @opindex mno-address-space-conversion
24328 Allow/disallow treating the @code{__ea} address space as superset
24329 of the generic address space. This enables explicit type casts
24330 between @code{__ea} and generic pointer as well as implicit
24331 conversions of generic pointers to @code{__ea} pointers. The
24332 default is to allow address space pointer conversions.
24333
24334 @item -mcache-size=@var{cache-size}
24335 @opindex mcache-size
24336 This option controls the version of libgcc that the compiler links to an
24337 executable and selects a software-managed cache for accessing variables
24338 in the @code{__ea} address space with a particular cache size. Possible
24339 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
24340 and @samp{128}. The default cache size is 64KB.
24341
24342 @item -matomic-updates
24343 @itemx -mno-atomic-updates
24344 @opindex matomic-updates
24345 @opindex mno-atomic-updates
24346 This option controls the version of libgcc that the compiler links to an
24347 executable and selects whether atomic updates to the software-managed
24348 cache of PPU-side variables are used. If you use atomic updates, changes
24349 to a PPU variable from SPU code using the @code{__ea} named address space
24350 qualifier do not interfere with changes to other PPU variables residing
24351 in the same cache line from PPU code. If you do not use atomic updates,
24352 such interference may occur; however, writing back cache lines is
24353 more efficient. The default behavior is to use atomic updates.
24354
24355 @item -mdual-nops
24356 @itemx -mdual-nops=@var{n}
24357 @opindex mdual-nops
24358 By default, GCC inserts NOPs to increase dual issue when it expects
24359 it to increase performance. @var{n} can be a value from 0 to 10. A
24360 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
24361 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
24362
24363 @item -mhint-max-nops=@var{n}
24364 @opindex mhint-max-nops
24365 Maximum number of NOPs to insert for a branch hint. A branch hint must
24366 be at least 8 instructions away from the branch it is affecting. GCC
24367 inserts up to @var{n} NOPs to enforce this, otherwise it does not
24368 generate the branch hint.
24369
24370 @item -mhint-max-distance=@var{n}
24371 @opindex mhint-max-distance
24372 The encoding of the branch hint instruction limits the hint to be within
24373 256 instructions of the branch it is affecting. By default, GCC makes
24374 sure it is within 125.
24375
24376 @item -msafe-hints
24377 @opindex msafe-hints
24378 Work around a hardware bug that causes the SPU to stall indefinitely.
24379 By default, GCC inserts the @code{hbrp} instruction to make sure
24380 this stall won't happen.
24381
24382 @end table
24383
24384 @node System V Options
24385 @subsection Options for System V
24386
24387 These additional options are available on System V Release 4 for
24388 compatibility with other compilers on those systems:
24389
24390 @table @gcctabopt
24391 @item -G
24392 @opindex G
24393 Create a shared object.
24394 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
24395
24396 @item -Qy
24397 @opindex Qy
24398 Identify the versions of each tool used by the compiler, in a
24399 @code{.ident} assembler directive in the output.
24400
24401 @item -Qn
24402 @opindex Qn
24403 Refrain from adding @code{.ident} directives to the output file (this is
24404 the default).
24405
24406 @item -YP,@var{dirs}
24407 @opindex YP
24408 Search the directories @var{dirs}, and no others, for libraries
24409 specified with @option{-l}.
24410
24411 @item -Ym,@var{dir}
24412 @opindex Ym
24413 Look in the directory @var{dir} to find the M4 preprocessor.
24414 The assembler uses this option.
24415 @c This is supposed to go with a -Yd for predefined M4 macro files, but
24416 @c the generic assembler that comes with Solaris takes just -Ym.
24417 @end table
24418
24419 @node TILE-Gx Options
24420 @subsection TILE-Gx Options
24421 @cindex TILE-Gx options
24422
24423 These @samp{-m} options are supported on the TILE-Gx:
24424
24425 @table @gcctabopt
24426 @item -mcmodel=small
24427 @opindex mcmodel=small
24428 Generate code for the small model. The distance for direct calls is
24429 limited to 500M in either direction. PC-relative addresses are 32
24430 bits. Absolute addresses support the full address range.
24431
24432 @item -mcmodel=large
24433 @opindex mcmodel=large
24434 Generate code for the large model. There is no limitation on call
24435 distance, pc-relative addresses, or absolute addresses.
24436
24437 @item -mcpu=@var{name}
24438 @opindex mcpu
24439 Selects the type of CPU to be targeted. Currently the only supported
24440 type is @samp{tilegx}.
24441
24442 @item -m32
24443 @itemx -m64
24444 @opindex m32
24445 @opindex m64
24446 Generate code for a 32-bit or 64-bit environment. The 32-bit
24447 environment sets int, long, and pointer to 32 bits. The 64-bit
24448 environment sets int to 32 bits and long and pointer to 64 bits.
24449
24450 @item -mbig-endian
24451 @itemx -mlittle-endian
24452 @opindex mbig-endian
24453 @opindex mlittle-endian
24454 Generate code in big/little endian mode, respectively.
24455 @end table
24456
24457 @node TILEPro Options
24458 @subsection TILEPro Options
24459 @cindex TILEPro options
24460
24461 These @samp{-m} options are supported on the TILEPro:
24462
24463 @table @gcctabopt
24464 @item -mcpu=@var{name}
24465 @opindex mcpu
24466 Selects the type of CPU to be targeted. Currently the only supported
24467 type is @samp{tilepro}.
24468
24469 @item -m32
24470 @opindex m32
24471 Generate code for a 32-bit environment, which sets int, long, and
24472 pointer to 32 bits. This is the only supported behavior so the flag
24473 is essentially ignored.
24474 @end table
24475
24476 @node V850 Options
24477 @subsection V850 Options
24478 @cindex V850 Options
24479
24480 These @samp{-m} options are defined for V850 implementations:
24481
24482 @table @gcctabopt
24483 @item -mlong-calls
24484 @itemx -mno-long-calls
24485 @opindex mlong-calls
24486 @opindex mno-long-calls
24487 Treat all calls as being far away (near). If calls are assumed to be
24488 far away, the compiler always loads the function's address into a
24489 register, and calls indirect through the pointer.
24490
24491 @item -mno-ep
24492 @itemx -mep
24493 @opindex mno-ep
24494 @opindex mep
24495 Do not optimize (do optimize) basic blocks that use the same index
24496 pointer 4 or more times to copy pointer into the @code{ep} register, and
24497 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
24498 option is on by default if you optimize.
24499
24500 @item -mno-prolog-function
24501 @itemx -mprolog-function
24502 @opindex mno-prolog-function
24503 @opindex mprolog-function
24504 Do not use (do use) external functions to save and restore registers
24505 at the prologue and epilogue of a function. The external functions
24506 are slower, but use less code space if more than one function saves
24507 the same number of registers. The @option{-mprolog-function} option
24508 is on by default if you optimize.
24509
24510 @item -mspace
24511 @opindex mspace
24512 Try to make the code as small as possible. At present, this just turns
24513 on the @option{-mep} and @option{-mprolog-function} options.
24514
24515 @item -mtda=@var{n}
24516 @opindex mtda
24517 Put static or global variables whose size is @var{n} bytes or less into
24518 the tiny data area that register @code{ep} points to. The tiny data
24519 area can hold up to 256 bytes in total (128 bytes for byte references).
24520
24521 @item -msda=@var{n}
24522 @opindex msda
24523 Put static or global variables whose size is @var{n} bytes or less into
24524 the small data area that register @code{gp} points to. The small data
24525 area can hold up to 64 kilobytes.
24526
24527 @item -mzda=@var{n}
24528 @opindex mzda
24529 Put static or global variables whose size is @var{n} bytes or less into
24530 the first 32 kilobytes of memory.
24531
24532 @item -mv850
24533 @opindex mv850
24534 Specify that the target processor is the V850.
24535
24536 @item -mv850e3v5
24537 @opindex mv850e3v5
24538 Specify that the target processor is the V850E3V5. The preprocessor
24539 constant @code{__v850e3v5__} is defined if this option is used.
24540
24541 @item -mv850e2v4
24542 @opindex mv850e2v4
24543 Specify that the target processor is the V850E3V5. This is an alias for
24544 the @option{-mv850e3v5} option.
24545
24546 @item -mv850e2v3
24547 @opindex mv850e2v3
24548 Specify that the target processor is the V850E2V3. The preprocessor
24549 constant @code{__v850e2v3__} is defined if this option is used.
24550
24551 @item -mv850e2
24552 @opindex mv850e2
24553 Specify that the target processor is the V850E2. The preprocessor
24554 constant @code{__v850e2__} is defined if this option is used.
24555
24556 @item -mv850e1
24557 @opindex mv850e1
24558 Specify that the target processor is the V850E1. The preprocessor
24559 constants @code{__v850e1__} and @code{__v850e__} are defined if
24560 this option is used.
24561
24562 @item -mv850es
24563 @opindex mv850es
24564 Specify that the target processor is the V850ES. This is an alias for
24565 the @option{-mv850e1} option.
24566
24567 @item -mv850e
24568 @opindex mv850e
24569 Specify that the target processor is the V850E@. The preprocessor
24570 constant @code{__v850e__} is defined if this option is used.
24571
24572 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
24573 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
24574 are defined then a default target processor is chosen and the
24575 relevant @samp{__v850*__} preprocessor constant is defined.
24576
24577 The preprocessor constants @code{__v850} and @code{__v851__} are always
24578 defined, regardless of which processor variant is the target.
24579
24580 @item -mdisable-callt
24581 @itemx -mno-disable-callt
24582 @opindex mdisable-callt
24583 @opindex mno-disable-callt
24584 This option suppresses generation of the @code{CALLT} instruction for the
24585 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
24586 architecture.
24587
24588 This option is enabled by default when the RH850 ABI is
24589 in use (see @option{-mrh850-abi}), and disabled by default when the
24590 GCC ABI is in use. If @code{CALLT} instructions are being generated
24591 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
24592
24593 @item -mrelax
24594 @itemx -mno-relax
24595 @opindex mrelax
24596 @opindex mno-relax
24597 Pass on (or do not pass on) the @option{-mrelax} command-line option
24598 to the assembler.
24599
24600 @item -mlong-jumps
24601 @itemx -mno-long-jumps
24602 @opindex mlong-jumps
24603 @opindex mno-long-jumps
24604 Disable (or re-enable) the generation of PC-relative jump instructions.
24605
24606 @item -msoft-float
24607 @itemx -mhard-float
24608 @opindex msoft-float
24609 @opindex mhard-float
24610 Disable (or re-enable) the generation of hardware floating point
24611 instructions. This option is only significant when the target
24612 architecture is @samp{V850E2V3} or higher. If hardware floating point
24613 instructions are being generated then the C preprocessor symbol
24614 @code{__FPU_OK__} is defined, otherwise the symbol
24615 @code{__NO_FPU__} is defined.
24616
24617 @item -mloop
24618 @opindex mloop
24619 Enables the use of the e3v5 LOOP instruction. The use of this
24620 instruction is not enabled by default when the e3v5 architecture is
24621 selected because its use is still experimental.
24622
24623 @item -mrh850-abi
24624 @itemx -mghs
24625 @opindex mrh850-abi
24626 @opindex mghs
24627 Enables support for the RH850 version of the V850 ABI. This is the
24628 default. With this version of the ABI the following rules apply:
24629
24630 @itemize
24631 @item
24632 Integer sized structures and unions are returned via a memory pointer
24633 rather than a register.
24634
24635 @item
24636 Large structures and unions (more than 8 bytes in size) are passed by
24637 value.
24638
24639 @item
24640 Functions are aligned to 16-bit boundaries.
24641
24642 @item
24643 The @option{-m8byte-align} command-line option is supported.
24644
24645 @item
24646 The @option{-mdisable-callt} command-line option is enabled by
24647 default. The @option{-mno-disable-callt} command-line option is not
24648 supported.
24649 @end itemize
24650
24651 When this version of the ABI is enabled the C preprocessor symbol
24652 @code{__V850_RH850_ABI__} is defined.
24653
24654 @item -mgcc-abi
24655 @opindex mgcc-abi
24656 Enables support for the old GCC version of the V850 ABI. With this
24657 version of the ABI the following rules apply:
24658
24659 @itemize
24660 @item
24661 Integer sized structures and unions are returned in register @code{r10}.
24662
24663 @item
24664 Large structures and unions (more than 8 bytes in size) are passed by
24665 reference.
24666
24667 @item
24668 Functions are aligned to 32-bit boundaries, unless optimizing for
24669 size.
24670
24671 @item
24672 The @option{-m8byte-align} command-line option is not supported.
24673
24674 @item
24675 The @option{-mdisable-callt} command-line option is supported but not
24676 enabled by default.
24677 @end itemize
24678
24679 When this version of the ABI is enabled the C preprocessor symbol
24680 @code{__V850_GCC_ABI__} is defined.
24681
24682 @item -m8byte-align
24683 @itemx -mno-8byte-align
24684 @opindex m8byte-align
24685 @opindex mno-8byte-align
24686 Enables support for @code{double} and @code{long long} types to be
24687 aligned on 8-byte boundaries. The default is to restrict the
24688 alignment of all objects to at most 4-bytes. When
24689 @option{-m8byte-align} is in effect the C preprocessor symbol
24690 @code{__V850_8BYTE_ALIGN__} is defined.
24691
24692 @item -mbig-switch
24693 @opindex mbig-switch
24694 Generate code suitable for big switch tables. Use this option only if
24695 the assembler/linker complain about out of range branches within a switch
24696 table.
24697
24698 @item -mapp-regs
24699 @opindex mapp-regs
24700 This option causes r2 and r5 to be used in the code generated by
24701 the compiler. This setting is the default.
24702
24703 @item -mno-app-regs
24704 @opindex mno-app-regs
24705 This option causes r2 and r5 to be treated as fixed registers.
24706
24707 @end table
24708
24709 @node VAX Options
24710 @subsection VAX Options
24711 @cindex VAX options
24712
24713 These @samp{-m} options are defined for the VAX:
24714
24715 @table @gcctabopt
24716 @item -munix
24717 @opindex munix
24718 Do not output certain jump instructions (@code{aobleq} and so on)
24719 that the Unix assembler for the VAX cannot handle across long
24720 ranges.
24721
24722 @item -mgnu
24723 @opindex mgnu
24724 Do output those jump instructions, on the assumption that the
24725 GNU assembler is being used.
24726
24727 @item -mg
24728 @opindex mg
24729 Output code for G-format floating-point numbers instead of D-format.
24730 @end table
24731
24732 @node Visium Options
24733 @subsection Visium Options
24734 @cindex Visium options
24735
24736 @table @gcctabopt
24737
24738 @item -mdebug
24739 @opindex mdebug
24740 A program which performs file I/O and is destined to run on an MCM target
24741 should be linked with this option. It causes the libraries libc.a and
24742 libdebug.a to be linked. The program should be run on the target under
24743 the control of the GDB remote debugging stub.
24744
24745 @item -msim
24746 @opindex msim
24747 A program which performs file I/O and is destined to run on the simulator
24748 should be linked with option. This causes libraries libc.a and libsim.a to
24749 be linked.
24750
24751 @item -mfpu
24752 @itemx -mhard-float
24753 @opindex mfpu
24754 @opindex mhard-float
24755 Generate code containing floating-point instructions. This is the
24756 default.
24757
24758 @item -mno-fpu
24759 @itemx -msoft-float
24760 @opindex mno-fpu
24761 @opindex msoft-float
24762 Generate code containing library calls for floating-point.
24763
24764 @option{-msoft-float} changes the calling convention in the output file;
24765 therefore, it is only useful if you compile @emph{all} of a program with
24766 this option. In particular, you need to compile @file{libgcc.a}, the
24767 library that comes with GCC, with @option{-msoft-float} in order for
24768 this to work.
24769
24770 @item -mcpu=@var{cpu_type}
24771 @opindex mcpu
24772 Set the instruction set, register set, and instruction scheduling parameters
24773 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
24774 @samp{mcm}, @samp{gr5} and @samp{gr6}.
24775
24776 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
24777
24778 By default (unless configured otherwise), GCC generates code for the GR5
24779 variant of the Visium architecture.
24780
24781 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
24782 architecture. The only difference from GR5 code is that the compiler will
24783 generate block move instructions.
24784
24785 @item -mtune=@var{cpu_type}
24786 @opindex mtune
24787 Set the instruction scheduling parameters for machine type @var{cpu_type},
24788 but do not set the instruction set or register set that the option
24789 @option{-mcpu=@var{cpu_type}} would.
24790
24791 @item -msv-mode
24792 @opindex msv-mode
24793 Generate code for the supervisor mode, where there are no restrictions on
24794 the access to general registers. This is the default.
24795
24796 @item -muser-mode
24797 @opindex muser-mode
24798 Generate code for the user mode, where the access to some general registers
24799 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
24800 mode; on the GR6, only registers r29 to r31 are affected.
24801 @end table
24802
24803 @node VMS Options
24804 @subsection VMS Options
24805
24806 These @samp{-m} options are defined for the VMS implementations:
24807
24808 @table @gcctabopt
24809 @item -mvms-return-codes
24810 @opindex mvms-return-codes
24811 Return VMS condition codes from @code{main}. The default is to return POSIX-style
24812 condition (e.g.@ error) codes.
24813
24814 @item -mdebug-main=@var{prefix}
24815 @opindex mdebug-main=@var{prefix}
24816 Flag the first routine whose name starts with @var{prefix} as the main
24817 routine for the debugger.
24818
24819 @item -mmalloc64
24820 @opindex mmalloc64
24821 Default to 64-bit memory allocation routines.
24822
24823 @item -mpointer-size=@var{size}
24824 @opindex mpointer-size=@var{size}
24825 Set the default size of pointers. Possible options for @var{size} are
24826 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
24827 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
24828 The later option disables @code{pragma pointer_size}.
24829 @end table
24830
24831 @node VxWorks Options
24832 @subsection VxWorks Options
24833 @cindex VxWorks Options
24834
24835 The options in this section are defined for all VxWorks targets.
24836 Options specific to the target hardware are listed with the other
24837 options for that target.
24838
24839 @table @gcctabopt
24840 @item -mrtp
24841 @opindex mrtp
24842 GCC can generate code for both VxWorks kernels and real time processes
24843 (RTPs). This option switches from the former to the latter. It also
24844 defines the preprocessor macro @code{__RTP__}.
24845
24846 @item -non-static
24847 @opindex non-static
24848 Link an RTP executable against shared libraries rather than static
24849 libraries. The options @option{-static} and @option{-shared} can
24850 also be used for RTPs (@pxref{Link Options}); @option{-static}
24851 is the default.
24852
24853 @item -Bstatic
24854 @itemx -Bdynamic
24855 @opindex Bstatic
24856 @opindex Bdynamic
24857 These options are passed down to the linker. They are defined for
24858 compatibility with Diab.
24859
24860 @item -Xbind-lazy
24861 @opindex Xbind-lazy
24862 Enable lazy binding of function calls. This option is equivalent to
24863 @option{-Wl,-z,now} and is defined for compatibility with Diab.
24864
24865 @item -Xbind-now
24866 @opindex Xbind-now
24867 Disable lazy binding of function calls. This option is the default and
24868 is defined for compatibility with Diab.
24869 @end table
24870
24871 @node x86 Options
24872 @subsection x86 Options
24873 @cindex x86 Options
24874
24875 These @samp{-m} options are defined for the x86 family of computers.
24876
24877 @table @gcctabopt
24878
24879 @item -march=@var{cpu-type}
24880 @opindex march
24881 Generate instructions for the machine type @var{cpu-type}. In contrast to
24882 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
24883 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
24884 to generate code that may not run at all on processors other than the one
24885 indicated. Specifying @option{-march=@var{cpu-type}} implies
24886 @option{-mtune=@var{cpu-type}}.
24887
24888 The choices for @var{cpu-type} are:
24889
24890 @table @samp
24891 @item native
24892 This selects the CPU to generate code for at compilation time by determining
24893 the processor type of the compiling machine. Using @option{-march=native}
24894 enables all instruction subsets supported by the local machine (hence
24895 the result might not run on different machines). Using @option{-mtune=native}
24896 produces code optimized for the local machine under the constraints
24897 of the selected instruction set.
24898
24899 @item i386
24900 Original Intel i386 CPU@.
24901
24902 @item i486
24903 Intel i486 CPU@. (No scheduling is implemented for this chip.)
24904
24905 @item i586
24906 @itemx pentium
24907 Intel Pentium CPU with no MMX support.
24908
24909 @item lakemont
24910 Intel Lakemont MCU, based on Intel Pentium CPU.
24911
24912 @item pentium-mmx
24913 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
24914
24915 @item pentiumpro
24916 Intel Pentium Pro CPU@.
24917
24918 @item i686
24919 When used with @option{-march}, the Pentium Pro
24920 instruction set is used, so the code runs on all i686 family chips.
24921 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
24922
24923 @item pentium2
24924 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
24925 support.
24926
24927 @item pentium3
24928 @itemx pentium3m
24929 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
24930 set support.
24931
24932 @item pentium-m
24933 Intel Pentium M; low-power version of Intel Pentium III CPU
24934 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
24935
24936 @item pentium4
24937 @itemx pentium4m
24938 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
24939
24940 @item prescott
24941 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
24942 set support.
24943
24944 @item nocona
24945 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
24946 SSE2 and SSE3 instruction set support.
24947
24948 @item core2
24949 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
24950 instruction set support.
24951
24952 @item nehalem
24953 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24954 SSE4.1, SSE4.2 and POPCNT instruction set support.
24955
24956 @item westmere
24957 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24958 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
24959
24960 @item sandybridge
24961 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24962 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
24963
24964 @item ivybridge
24965 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24966 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
24967 instruction set support.
24968
24969 @item haswell
24970 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24971 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24972 BMI, BMI2 and F16C instruction set support.
24973
24974 @item broadwell
24975 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24976 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24977 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
24978
24979 @item skylake
24980 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24981 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24982 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
24983 XSAVES instruction set support.
24984
24985 @item bonnell
24986 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
24987 instruction set support.
24988
24989 @item silvermont
24990 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24991 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
24992
24993 @item knl
24994 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
24995 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24996 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
24997 AVX512CD instruction set support.
24998
24999 @item skylake-avx512
25000 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
25001 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
25002 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
25003 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
25004
25005 @item k6
25006 AMD K6 CPU with MMX instruction set support.
25007
25008 @item k6-2
25009 @itemx k6-3
25010 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
25011
25012 @item athlon
25013 @itemx athlon-tbird
25014 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
25015 support.
25016
25017 @item athlon-4
25018 @itemx athlon-xp
25019 @itemx athlon-mp
25020 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
25021 instruction set support.
25022
25023 @item k8
25024 @itemx opteron
25025 @itemx athlon64
25026 @itemx athlon-fx
25027 Processors based on the AMD K8 core with x86-64 instruction set support,
25028 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
25029 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
25030 instruction set extensions.)
25031
25032 @item k8-sse3
25033 @itemx opteron-sse3
25034 @itemx athlon64-sse3
25035 Improved versions of AMD K8 cores with SSE3 instruction set support.
25036
25037 @item amdfam10
25038 @itemx barcelona
25039 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
25040 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
25041 instruction set extensions.)
25042
25043 @item bdver1
25044 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
25045 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
25046 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
25047 @item bdver2
25048 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
25049 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
25050 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
25051 extensions.)
25052 @item bdver3
25053 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
25054 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
25055 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
25056 64-bit instruction set extensions.
25057 @item bdver4
25058 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
25059 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
25060 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
25061 SSE4.2, ABM and 64-bit instruction set extensions.
25062
25063 @item znver1
25064 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
25065 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
25066 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
25067 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
25068 instruction set extensions.
25069
25070 @item btver1
25071 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
25072 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
25073 instruction set extensions.)
25074
25075 @item btver2
25076 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
25077 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
25078 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
25079
25080 @item winchip-c6
25081 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
25082 set support.
25083
25084 @item winchip2
25085 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
25086 instruction set support.
25087
25088 @item c3
25089 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
25090 (No scheduling is implemented for this chip.)
25091
25092 @item c3-2
25093 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
25094 (No scheduling is implemented for this chip.)
25095
25096 @item c7
25097 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
25098 (No scheduling is implemented for this chip.)
25099
25100 @item samuel-2
25101 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
25102 (No scheduling is implemented for this chip.)
25103
25104 @item nehemiah
25105 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
25106 (No scheduling is implemented for this chip.)
25107
25108 @item esther
25109 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
25110 (No scheduling is implemented for this chip.)
25111
25112 @item eden-x2
25113 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
25114 (No scheduling is implemented for this chip.)
25115
25116 @item eden-x4
25117 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
25118 AVX and AVX2 instruction set support.
25119 (No scheduling is implemented for this chip.)
25120
25121 @item nano
25122 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25123 instruction set support.
25124 (No scheduling is implemented for this chip.)
25125
25126 @item nano-1000
25127 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25128 instruction set support.
25129 (No scheduling is implemented for this chip.)
25130
25131 @item nano-2000
25132 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25133 instruction set support.
25134 (No scheduling is implemented for this chip.)
25135
25136 @item nano-3000
25137 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
25138 instruction set support.
25139 (No scheduling is implemented for this chip.)
25140
25141 @item nano-x2
25142 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
25143 instruction set support.
25144 (No scheduling is implemented for this chip.)
25145
25146 @item nano-x4
25147 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
25148 instruction set support.
25149 (No scheduling is implemented for this chip.)
25150
25151 @item geode
25152 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
25153 @end table
25154
25155 @item -mtune=@var{cpu-type}
25156 @opindex mtune
25157 Tune to @var{cpu-type} everything applicable about the generated code, except
25158 for the ABI and the set of available instructions.
25159 While picking a specific @var{cpu-type} schedules things appropriately
25160 for that particular chip, the compiler does not generate any code that
25161 cannot run on the default machine type unless you use a
25162 @option{-march=@var{cpu-type}} option.
25163 For example, if GCC is configured for i686-pc-linux-gnu
25164 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
25165 but still runs on i686 machines.
25166
25167 The choices for @var{cpu-type} are the same as for @option{-march}.
25168 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
25169
25170 @table @samp
25171 @item generic
25172 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
25173 If you know the CPU on which your code will run, then you should use
25174 the corresponding @option{-mtune} or @option{-march} option instead of
25175 @option{-mtune=generic}. But, if you do not know exactly what CPU users
25176 of your application will have, then you should use this option.
25177
25178 As new processors are deployed in the marketplace, the behavior of this
25179 option will change. Therefore, if you upgrade to a newer version of
25180 GCC, code generation controlled by this option will change to reflect
25181 the processors
25182 that are most common at the time that version of GCC is released.
25183
25184 There is no @option{-march=generic} option because @option{-march}
25185 indicates the instruction set the compiler can use, and there is no
25186 generic instruction set applicable to all processors. In contrast,
25187 @option{-mtune} indicates the processor (or, in this case, collection of
25188 processors) for which the code is optimized.
25189
25190 @item intel
25191 Produce code optimized for the most current Intel processors, which are
25192 Haswell and Silvermont for this version of GCC. If you know the CPU
25193 on which your code will run, then you should use the corresponding
25194 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
25195 But, if you want your application performs better on both Haswell and
25196 Silvermont, then you should use this option.
25197
25198 As new Intel processors are deployed in the marketplace, the behavior of
25199 this option will change. Therefore, if you upgrade to a newer version of
25200 GCC, code generation controlled by this option will change to reflect
25201 the most current Intel processors at the time that version of GCC is
25202 released.
25203
25204 There is no @option{-march=intel} option because @option{-march} indicates
25205 the instruction set the compiler can use, and there is no common
25206 instruction set applicable to all processors. In contrast,
25207 @option{-mtune} indicates the processor (or, in this case, collection of
25208 processors) for which the code is optimized.
25209 @end table
25210
25211 @item -mcpu=@var{cpu-type}
25212 @opindex mcpu
25213 A deprecated synonym for @option{-mtune}.
25214
25215 @item -mfpmath=@var{unit}
25216 @opindex mfpmath
25217 Generate floating-point arithmetic for selected unit @var{unit}. The choices
25218 for @var{unit} are:
25219
25220 @table @samp
25221 @item 387
25222 Use the standard 387 floating-point coprocessor present on the majority of chips and
25223 emulated otherwise. Code compiled with this option runs almost everywhere.
25224 The temporary results are computed in 80-bit precision instead of the precision
25225 specified by the type, resulting in slightly different results compared to most
25226 of other chips. See @option{-ffloat-store} for more detailed description.
25227
25228 This is the default choice for non-Darwin x86-32 targets.
25229
25230 @item sse
25231 Use scalar floating-point instructions present in the SSE instruction set.
25232 This instruction set is supported by Pentium III and newer chips,
25233 and in the AMD line
25234 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
25235 instruction set supports only single-precision arithmetic, thus the double and
25236 extended-precision arithmetic are still done using 387. A later version, present
25237 only in Pentium 4 and AMD x86-64 chips, supports double-precision
25238 arithmetic too.
25239
25240 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
25241 or @option{-msse2} switches to enable SSE extensions and make this option
25242 effective. For the x86-64 compiler, these extensions are enabled by default.
25243
25244 The resulting code should be considerably faster in the majority of cases and avoid
25245 the numerical instability problems of 387 code, but may break some existing
25246 code that expects temporaries to be 80 bits.
25247
25248 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
25249 and the default choice for x86-32 targets with the SSE2 instruction set
25250 when @option{-ffast-math} is enabled.
25251
25252 @item sse,387
25253 @itemx sse+387
25254 @itemx both
25255 Attempt to utilize both instruction sets at once. This effectively doubles the
25256 amount of available registers, and on chips with separate execution units for
25257 387 and SSE the execution resources too. Use this option with care, as it is
25258 still experimental, because the GCC register allocator does not model separate
25259 functional units well, resulting in unstable performance.
25260 @end table
25261
25262 @item -masm=@var{dialect}
25263 @opindex masm=@var{dialect}
25264 Output assembly instructions using selected @var{dialect}. Also affects
25265 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
25266 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
25267 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
25268 not support @samp{intel}.
25269
25270 @item -mieee-fp
25271 @itemx -mno-ieee-fp
25272 @opindex mieee-fp
25273 @opindex mno-ieee-fp
25274 Control whether or not the compiler uses IEEE floating-point
25275 comparisons. These correctly handle the case where the result of a
25276 comparison is unordered.
25277
25278 @item -m80387
25279 @item -mhard-float
25280 @opindex 80387
25281 @opindex mhard-float
25282 Generate output containing 80387 instructions for floating point.
25283
25284 @item -mno-80387
25285 @item -msoft-float
25286 @opindex no-80387
25287 @opindex msoft-float
25288 Generate output containing library calls for floating point.
25289
25290 @strong{Warning:} the requisite libraries are not part of GCC@.
25291 Normally the facilities of the machine's usual C compiler are used, but
25292 this cannot be done directly in cross-compilation. You must make your
25293 own arrangements to provide suitable library functions for
25294 cross-compilation.
25295
25296 On machines where a function returns floating-point results in the 80387
25297 register stack, some floating-point opcodes may be emitted even if
25298 @option{-msoft-float} is used.
25299
25300 @item -mno-fp-ret-in-387
25301 @opindex mno-fp-ret-in-387
25302 Do not use the FPU registers for return values of functions.
25303
25304 The usual calling convention has functions return values of types
25305 @code{float} and @code{double} in an FPU register, even if there
25306 is no FPU@. The idea is that the operating system should emulate
25307 an FPU@.
25308
25309 The option @option{-mno-fp-ret-in-387} causes such values to be returned
25310 in ordinary CPU registers instead.
25311
25312 @item -mno-fancy-math-387
25313 @opindex mno-fancy-math-387
25314 Some 387 emulators do not support the @code{sin}, @code{cos} and
25315 @code{sqrt} instructions for the 387. Specify this option to avoid
25316 generating those instructions. This option is the default on
25317 OpenBSD and NetBSD@. This option is overridden when @option{-march}
25318 indicates that the target CPU always has an FPU and so the
25319 instruction does not need emulation. These
25320 instructions are not generated unless you also use the
25321 @option{-funsafe-math-optimizations} switch.
25322
25323 @item -malign-double
25324 @itemx -mno-align-double
25325 @opindex malign-double
25326 @opindex mno-align-double
25327 Control whether GCC aligns @code{double}, @code{long double}, and
25328 @code{long long} variables on a two-word boundary or a one-word
25329 boundary. Aligning @code{double} variables on a two-word boundary
25330 produces code that runs somewhat faster on a Pentium at the
25331 expense of more memory.
25332
25333 On x86-64, @option{-malign-double} is enabled by default.
25334
25335 @strong{Warning:} if you use the @option{-malign-double} switch,
25336 structures containing the above types are aligned differently than
25337 the published application binary interface specifications for the x86-32
25338 and are not binary compatible with structures in code compiled
25339 without that switch.
25340
25341 @item -m96bit-long-double
25342 @itemx -m128bit-long-double
25343 @opindex m96bit-long-double
25344 @opindex m128bit-long-double
25345 These switches control the size of @code{long double} type. The x86-32
25346 application binary interface specifies the size to be 96 bits,
25347 so @option{-m96bit-long-double} is the default in 32-bit mode.
25348
25349 Modern architectures (Pentium and newer) prefer @code{long double}
25350 to be aligned to an 8- or 16-byte boundary. In arrays or structures
25351 conforming to the ABI, this is not possible. So specifying
25352 @option{-m128bit-long-double} aligns @code{long double}
25353 to a 16-byte boundary by padding the @code{long double} with an additional
25354 32-bit zero.
25355
25356 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
25357 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
25358
25359 Notice that neither of these options enable any extra precision over the x87
25360 standard of 80 bits for a @code{long double}.
25361
25362 @strong{Warning:} if you override the default value for your target ABI, this
25363 changes the size of
25364 structures and arrays containing @code{long double} variables,
25365 as well as modifying the function calling convention for functions taking
25366 @code{long double}. Hence they are not binary-compatible
25367 with code compiled without that switch.
25368
25369 @item -mlong-double-64
25370 @itemx -mlong-double-80
25371 @itemx -mlong-double-128
25372 @opindex mlong-double-64
25373 @opindex mlong-double-80
25374 @opindex mlong-double-128
25375 These switches control the size of @code{long double} type. A size
25376 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25377 type. This is the default for 32-bit Bionic C library. A size
25378 of 128 bits makes the @code{long double} type equivalent to the
25379 @code{__float128} type. This is the default for 64-bit Bionic C library.
25380
25381 @strong{Warning:} if you override the default value for your target ABI, this
25382 changes the size of
25383 structures and arrays containing @code{long double} variables,
25384 as well as modifying the function calling convention for functions taking
25385 @code{long double}. Hence they are not binary-compatible
25386 with code compiled without that switch.
25387
25388 @item -malign-data=@var{type}
25389 @opindex malign-data
25390 Control how GCC aligns variables. Supported values for @var{type} are
25391 @samp{compat} uses increased alignment value compatible uses GCC 4.8
25392 and earlier, @samp{abi} uses alignment value as specified by the
25393 psABI, and @samp{cacheline} uses increased alignment value to match
25394 the cache line size. @samp{compat} is the default.
25395
25396 @item -mlarge-data-threshold=@var{threshold}
25397 @opindex mlarge-data-threshold
25398 When @option{-mcmodel=medium} is specified, data objects larger than
25399 @var{threshold} are placed in the large data section. This value must be the
25400 same across all objects linked into the binary, and defaults to 65535.
25401
25402 @item -mrtd
25403 @opindex mrtd
25404 Use a different function-calling convention, in which functions that
25405 take a fixed number of arguments return with the @code{ret @var{num}}
25406 instruction, which pops their arguments while returning. This saves one
25407 instruction in the caller since there is no need to pop the arguments
25408 there.
25409
25410 You can specify that an individual function is called with this calling
25411 sequence with the function attribute @code{stdcall}. You can also
25412 override the @option{-mrtd} option by using the function attribute
25413 @code{cdecl}. @xref{Function Attributes}.
25414
25415 @strong{Warning:} this calling convention is incompatible with the one
25416 normally used on Unix, so you cannot use it if you need to call
25417 libraries compiled with the Unix compiler.
25418
25419 Also, you must provide function prototypes for all functions that
25420 take variable numbers of arguments (including @code{printf});
25421 otherwise incorrect code is generated for calls to those
25422 functions.
25423
25424 In addition, seriously incorrect code results if you call a
25425 function with too many arguments. (Normally, extra arguments are
25426 harmlessly ignored.)
25427
25428 @item -mregparm=@var{num}
25429 @opindex mregparm
25430 Control how many registers are used to pass integer arguments. By
25431 default, no registers are used to pass arguments, and at most 3
25432 registers can be used. You can control this behavior for a specific
25433 function by using the function attribute @code{regparm}.
25434 @xref{Function Attributes}.
25435
25436 @strong{Warning:} if you use this switch, and
25437 @var{num} is nonzero, then you must build all modules with the same
25438 value, including any libraries. This includes the system libraries and
25439 startup modules.
25440
25441 @item -msseregparm
25442 @opindex msseregparm
25443 Use SSE register passing conventions for float and double arguments
25444 and return values. You can control this behavior for a specific
25445 function by using the function attribute @code{sseregparm}.
25446 @xref{Function Attributes}.
25447
25448 @strong{Warning:} if you use this switch then you must build all
25449 modules with the same value, including any libraries. This includes
25450 the system libraries and startup modules.
25451
25452 @item -mvect8-ret-in-mem
25453 @opindex mvect8-ret-in-mem
25454 Return 8-byte vectors in memory instead of MMX registers. This is the
25455 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
25456 Studio compilers until version 12. Later compiler versions (starting
25457 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
25458 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
25459 you need to remain compatible with existing code produced by those
25460 previous compiler versions or older versions of GCC@.
25461
25462 @item -mpc32
25463 @itemx -mpc64
25464 @itemx -mpc80
25465 @opindex mpc32
25466 @opindex mpc64
25467 @opindex mpc80
25468
25469 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
25470 is specified, the significands of results of floating-point operations are
25471 rounded to 24 bits (single precision); @option{-mpc64} rounds the
25472 significands of results of floating-point operations to 53 bits (double
25473 precision) and @option{-mpc80} rounds the significands of results of
25474 floating-point operations to 64 bits (extended double precision), which is
25475 the default. When this option is used, floating-point operations in higher
25476 precisions are not available to the programmer without setting the FPU
25477 control word explicitly.
25478
25479 Setting the rounding of floating-point operations to less than the default
25480 80 bits can speed some programs by 2% or more. Note that some mathematical
25481 libraries assume that extended-precision (80-bit) floating-point operations
25482 are enabled by default; routines in such libraries could suffer significant
25483 loss of accuracy, typically through so-called ``catastrophic cancellation'',
25484 when this option is used to set the precision to less than extended precision.
25485
25486 @item -mstackrealign
25487 @opindex mstackrealign
25488 Realign the stack at entry. On the x86, the @option{-mstackrealign}
25489 option generates an alternate prologue and epilogue that realigns the
25490 run-time stack if necessary. This supports mixing legacy codes that keep
25491 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
25492 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
25493 applicable to individual functions.
25494
25495 @item -mpreferred-stack-boundary=@var{num}
25496 @opindex mpreferred-stack-boundary
25497 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
25498 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
25499 the default is 4 (16 bytes or 128 bits).
25500
25501 @strong{Warning:} When generating code for the x86-64 architecture with
25502 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
25503 used to keep the stack boundary aligned to 8 byte boundary. Since
25504 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
25505 intended to be used in controlled environment where stack space is
25506 important limitation. This option leads to wrong code when functions
25507 compiled with 16 byte stack alignment (such as functions from a standard
25508 library) are called with misaligned stack. In this case, SSE
25509 instructions may lead to misaligned memory access traps. In addition,
25510 variable arguments are handled incorrectly for 16 byte aligned
25511 objects (including x87 long double and __int128), leading to wrong
25512 results. You must build all modules with
25513 @option{-mpreferred-stack-boundary=3}, including any libraries. This
25514 includes the system libraries and startup modules.
25515
25516 @item -mincoming-stack-boundary=@var{num}
25517 @opindex mincoming-stack-boundary
25518 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
25519 boundary. If @option{-mincoming-stack-boundary} is not specified,
25520 the one specified by @option{-mpreferred-stack-boundary} is used.
25521
25522 On Pentium and Pentium Pro, @code{double} and @code{long double} values
25523 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
25524 suffer significant run time performance penalties. On Pentium III, the
25525 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
25526 properly if it is not 16-byte aligned.
25527
25528 To ensure proper alignment of this values on the stack, the stack boundary
25529 must be as aligned as that required by any value stored on the stack.
25530 Further, every function must be generated such that it keeps the stack
25531 aligned. Thus calling a function compiled with a higher preferred
25532 stack boundary from a function compiled with a lower preferred stack
25533 boundary most likely misaligns the stack. It is recommended that
25534 libraries that use callbacks always use the default setting.
25535
25536 This extra alignment does consume extra stack space, and generally
25537 increases code size. Code that is sensitive to stack space usage, such
25538 as embedded systems and operating system kernels, may want to reduce the
25539 preferred alignment to @option{-mpreferred-stack-boundary=2}.
25540
25541 @need 200
25542 @item -mmmx
25543 @opindex mmmx
25544 @need 200
25545 @itemx -msse
25546 @opindex msse
25547 @need 200
25548 @itemx -msse2
25549 @opindex msse2
25550 @need 200
25551 @itemx -msse3
25552 @opindex msse3
25553 @need 200
25554 @itemx -mssse3
25555 @opindex mssse3
25556 @need 200
25557 @itemx -msse4
25558 @opindex msse4
25559 @need 200
25560 @itemx -msse4a
25561 @opindex msse4a
25562 @need 200
25563 @itemx -msse4.1
25564 @opindex msse4.1
25565 @need 200
25566 @itemx -msse4.2
25567 @opindex msse4.2
25568 @need 200
25569 @itemx -mavx
25570 @opindex mavx
25571 @need 200
25572 @itemx -mavx2
25573 @opindex mavx2
25574 @need 200
25575 @itemx -mavx512f
25576 @opindex mavx512f
25577 @need 200
25578 @itemx -mavx512pf
25579 @opindex mavx512pf
25580 @need 200
25581 @itemx -mavx512er
25582 @opindex mavx512er
25583 @need 200
25584 @itemx -mavx512cd
25585 @opindex mavx512cd
25586 @need 200
25587 @itemx -mavx512vl
25588 @opindex mavx512vl
25589 @need 200
25590 @itemx -mavx512bw
25591 @opindex mavx512bw
25592 @need 200
25593 @itemx -mavx512dq
25594 @opindex mavx512dq
25595 @need 200
25596 @itemx -mavx512ifma
25597 @opindex mavx512ifma
25598 @need 200
25599 @itemx -mavx512vbmi
25600 @opindex mavx512vbmi
25601 @need 200
25602 @itemx -msha
25603 @opindex msha
25604 @need 200
25605 @itemx -maes
25606 @opindex maes
25607 @need 200
25608 @itemx -mpclmul
25609 @opindex mpclmul
25610 @need 200
25611 @itemx -mclfushopt
25612 @opindex mclfushopt
25613 @need 200
25614 @itemx -mfsgsbase
25615 @opindex mfsgsbase
25616 @need 200
25617 @itemx -mrdrnd
25618 @opindex mrdrnd
25619 @need 200
25620 @itemx -mf16c
25621 @opindex mf16c
25622 @need 200
25623 @itemx -mfma
25624 @opindex mfma
25625 @need 200
25626 @itemx -mfma4
25627 @opindex mfma4
25628 @need 200
25629 @itemx -mprefetchwt1
25630 @opindex mprefetchwt1
25631 @need 200
25632 @itemx -mxop
25633 @opindex mxop
25634 @need 200
25635 @itemx -mlwp
25636 @opindex mlwp
25637 @need 200
25638 @itemx -m3dnow
25639 @opindex m3dnow
25640 @need 200
25641 @itemx -m3dnowa
25642 @opindex m3dnowa
25643 @need 200
25644 @itemx -mpopcnt
25645 @opindex mpopcnt
25646 @need 200
25647 @itemx -mabm
25648 @opindex mabm
25649 @need 200
25650 @itemx -mbmi
25651 @opindex mbmi
25652 @need 200
25653 @itemx -mbmi2
25654 @need 200
25655 @itemx -mlzcnt
25656 @opindex mlzcnt
25657 @need 200
25658 @itemx -mfxsr
25659 @opindex mfxsr
25660 @need 200
25661 @itemx -mxsave
25662 @opindex mxsave
25663 @need 200
25664 @itemx -mxsaveopt
25665 @opindex mxsaveopt
25666 @need 200
25667 @itemx -mxsavec
25668 @opindex mxsavec
25669 @need 200
25670 @itemx -mxsaves
25671 @opindex mxsaves
25672 @need 200
25673 @itemx -mrtm
25674 @opindex mrtm
25675 @need 200
25676 @itemx -mtbm
25677 @opindex mtbm
25678 @need 200
25679 @itemx -mmpx
25680 @opindex mmpx
25681 @need 200
25682 @itemx -mmwaitx
25683 @opindex mmwaitx
25684 @need 200
25685 @itemx -mclzero
25686 @opindex mclzero
25687 @itemx -mpku
25688 @opindex mpku
25689 These switches enable the use of instructions in the MMX, SSE,
25690 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
25691 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
25692 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
25693 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU, 3DNow!@: or enhanced 3DNow!@:
25694 extended instruction sets. Each has a corresponding @option{-mno-} option
25695 to disable use of these instructions.
25696
25697 These extensions are also available as built-in functions: see
25698 @ref{x86 Built-in Functions}, for details of the functions enabled and
25699 disabled by these switches.
25700
25701 To generate SSE/SSE2 instructions automatically from floating-point
25702 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
25703
25704 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
25705 generates new AVX instructions or AVX equivalence for all SSEx instructions
25706 when needed.
25707
25708 These options enable GCC to use these extended instructions in
25709 generated code, even without @option{-mfpmath=sse}. Applications that
25710 perform run-time CPU detection must compile separate files for each
25711 supported architecture, using the appropriate flags. In particular,
25712 the file containing the CPU detection code should be compiled without
25713 these options.
25714
25715 @item -mdump-tune-features
25716 @opindex mdump-tune-features
25717 This option instructs GCC to dump the names of the x86 performance
25718 tuning features and default settings. The names can be used in
25719 @option{-mtune-ctrl=@var{feature-list}}.
25720
25721 @item -mtune-ctrl=@var{feature-list}
25722 @opindex mtune-ctrl=@var{feature-list}
25723 This option is used to do fine grain control of x86 code generation features.
25724 @var{feature-list} is a comma separated list of @var{feature} names. See also
25725 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
25726 on if it is not preceded with @samp{^}, otherwise, it is turned off.
25727 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
25728 developers. Using it may lead to code paths not covered by testing and can
25729 potentially result in compiler ICEs or runtime errors.
25730
25731 @item -mno-default
25732 @opindex mno-default
25733 This option instructs GCC to turn off all tunable features. See also
25734 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
25735
25736 @item -mcld
25737 @opindex mcld
25738 This option instructs GCC to emit a @code{cld} instruction in the prologue
25739 of functions that use string instructions. String instructions depend on
25740 the DF flag to select between autoincrement or autodecrement mode. While the
25741 ABI specifies the DF flag to be cleared on function entry, some operating
25742 systems violate this specification by not clearing the DF flag in their
25743 exception dispatchers. The exception handler can be invoked with the DF flag
25744 set, which leads to wrong direction mode when string instructions are used.
25745 This option can be enabled by default on 32-bit x86 targets by configuring
25746 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
25747 instructions can be suppressed with the @option{-mno-cld} compiler option
25748 in this case.
25749
25750 @item -mvzeroupper
25751 @opindex mvzeroupper
25752 This option instructs GCC to emit a @code{vzeroupper} instruction
25753 before a transfer of control flow out of the function to minimize
25754 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
25755 intrinsics.
25756
25757 @item -mprefer-avx128
25758 @opindex mprefer-avx128
25759 This option instructs GCC to use 128-bit AVX instructions instead of
25760 256-bit AVX instructions in the auto-vectorizer.
25761
25762 @item -mcx16
25763 @opindex mcx16
25764 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
25765 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
25766 objects. This is useful for atomic updates of data structures exceeding one
25767 machine word in size. The compiler uses this instruction to implement
25768 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
25769 128-bit integers, a library call is always used.
25770
25771 @item -msahf
25772 @opindex msahf
25773 This option enables generation of @code{SAHF} instructions in 64-bit code.
25774 Early Intel Pentium 4 CPUs with Intel 64 support,
25775 prior to the introduction of Pentium 4 G1 step in December 2005,
25776 lacked the @code{LAHF} and @code{SAHF} instructions
25777 which are supported by AMD64.
25778 These are load and store instructions, respectively, for certain status flags.
25779 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
25780 @code{drem}, and @code{remainder} built-in functions;
25781 see @ref{Other Builtins} for details.
25782
25783 @item -mmovbe
25784 @opindex mmovbe
25785 This option enables use of the @code{movbe} instruction to implement
25786 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
25787
25788 @item -mcrc32
25789 @opindex mcrc32
25790 This option enables built-in functions @code{__builtin_ia32_crc32qi},
25791 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
25792 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
25793
25794 @item -mrecip
25795 @opindex mrecip
25796 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
25797 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
25798 with an additional Newton-Raphson step
25799 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
25800 (and their vectorized
25801 variants) for single-precision floating-point arguments. These instructions
25802 are generated only when @option{-funsafe-math-optimizations} is enabled
25803 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
25804 Note that while the throughput of the sequence is higher than the throughput
25805 of the non-reciprocal instruction, the precision of the sequence can be
25806 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
25807
25808 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
25809 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
25810 combination), and doesn't need @option{-mrecip}.
25811
25812 Also note that GCC emits the above sequence with additional Newton-Raphson step
25813 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
25814 already with @option{-ffast-math} (or the above option combination), and
25815 doesn't need @option{-mrecip}.
25816
25817 @item -mrecip=@var{opt}
25818 @opindex mrecip=opt
25819 This option controls which reciprocal estimate instructions
25820 may be used. @var{opt} is a comma-separated list of options, which may
25821 be preceded by a @samp{!} to invert the option:
25822
25823 @table @samp
25824 @item all
25825 Enable all estimate instructions.
25826
25827 @item default
25828 Enable the default instructions, equivalent to @option{-mrecip}.
25829
25830 @item none
25831 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25832
25833 @item div
25834 Enable the approximation for scalar division.
25835
25836 @item vec-div
25837 Enable the approximation for vectorized division.
25838
25839 @item sqrt
25840 Enable the approximation for scalar square root.
25841
25842 @item vec-sqrt
25843 Enable the approximation for vectorized square root.
25844 @end table
25845
25846 So, for example, @option{-mrecip=all,!sqrt} enables
25847 all of the reciprocal approximations, except for square root.
25848
25849 @item -mveclibabi=@var{type}
25850 @opindex mveclibabi
25851 Specifies the ABI type to use for vectorizing intrinsics using an
25852 external library. Supported values for @var{type} are @samp{svml}
25853 for the Intel short
25854 vector math library and @samp{acml} for the AMD math core library.
25855 To use this option, both @option{-ftree-vectorize} and
25856 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
25857 ABI-compatible library must be specified at link time.
25858
25859 GCC currently emits calls to @code{vmldExp2},
25860 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
25861 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
25862 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
25863 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
25864 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
25865 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
25866 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
25867 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
25868 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
25869 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
25870 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
25871 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
25872 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
25873 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
25874 when @option{-mveclibabi=acml} is used.
25875
25876 @item -mabi=@var{name}
25877 @opindex mabi
25878 Generate code for the specified calling convention. Permissible values
25879 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
25880 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
25881 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
25882 You can control this behavior for specific functions by
25883 using the function attributes @code{ms_abi} and @code{sysv_abi}.
25884 @xref{Function Attributes}.
25885
25886 @item -mcall-ms2sysv-xlogues
25887 @opindex mcall-ms2sysv-xlogues
25888 @opindex mno-call-ms2sysv-xlogues
25889 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
25890 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
25891 default, the code for saving and restoring these registers is emitted inline,
25892 resulting in fairly lengthy prologues and epilogues. Using
25893 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
25894 use stubs in the static portion of libgcc to perform these saves and restores,
25895 thus reducing function size at the cost of a few extra instructions.
25896
25897 @item -mtls-dialect=@var{type}
25898 @opindex mtls-dialect
25899 Generate code to access thread-local storage using the @samp{gnu} or
25900 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
25901 @samp{gnu2} is more efficient, but it may add compile- and run-time
25902 requirements that cannot be satisfied on all systems.
25903
25904 @item -mpush-args
25905 @itemx -mno-push-args
25906 @opindex mpush-args
25907 @opindex mno-push-args
25908 Use PUSH operations to store outgoing parameters. This method is shorter
25909 and usually equally fast as method using SUB/MOV operations and is enabled
25910 by default. In some cases disabling it may improve performance because of
25911 improved scheduling and reduced dependencies.
25912
25913 @item -maccumulate-outgoing-args
25914 @opindex maccumulate-outgoing-args
25915 If enabled, the maximum amount of space required for outgoing arguments is
25916 computed in the function prologue. This is faster on most modern CPUs
25917 because of reduced dependencies, improved scheduling and reduced stack usage
25918 when the preferred stack boundary is not equal to 2. The drawback is a notable
25919 increase in code size. This switch implies @option{-mno-push-args}.
25920
25921 @item -mthreads
25922 @opindex mthreads
25923 Support thread-safe exception handling on MinGW. Programs that rely
25924 on thread-safe exception handling must compile and link all code with the
25925 @option{-mthreads} option. When compiling, @option{-mthreads} defines
25926 @option{-D_MT}; when linking, it links in a special thread helper library
25927 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
25928
25929 @item -mms-bitfields
25930 @itemx -mno-ms-bitfields
25931 @opindex mms-bitfields
25932 @opindex mno-ms-bitfields
25933
25934 Enable/disable bit-field layout compatible with the native Microsoft
25935 Windows compiler.
25936
25937 If @code{packed} is used on a structure, or if bit-fields are used,
25938 it may be that the Microsoft ABI lays out the structure differently
25939 than the way GCC normally does. Particularly when moving packed
25940 data between functions compiled with GCC and the native Microsoft compiler
25941 (either via function call or as data in a file), it may be necessary to access
25942 either format.
25943
25944 This option is enabled by default for Microsoft Windows
25945 targets. This behavior can also be controlled locally by use of variable
25946 or type attributes. For more information, see @ref{x86 Variable Attributes}
25947 and @ref{x86 Type Attributes}.
25948
25949 The Microsoft structure layout algorithm is fairly simple with the exception
25950 of the bit-field packing.
25951 The padding and alignment of members of structures and whether a bit-field
25952 can straddle a storage-unit boundary are determine by these rules:
25953
25954 @enumerate
25955 @item Structure members are stored sequentially in the order in which they are
25956 declared: the first member has the lowest memory address and the last member
25957 the highest.
25958
25959 @item Every data object has an alignment requirement. The alignment requirement
25960 for all data except structures, unions, and arrays is either the size of the
25961 object or the current packing size (specified with either the
25962 @code{aligned} attribute or the @code{pack} pragma),
25963 whichever is less. For structures, unions, and arrays,
25964 the alignment requirement is the largest alignment requirement of its members.
25965 Every object is allocated an offset so that:
25966
25967 @smallexample
25968 offset % alignment_requirement == 0
25969 @end smallexample
25970
25971 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
25972 unit if the integral types are the same size and if the next bit-field fits
25973 into the current allocation unit without crossing the boundary imposed by the
25974 common alignment requirements of the bit-fields.
25975 @end enumerate
25976
25977 MSVC interprets zero-length bit-fields in the following ways:
25978
25979 @enumerate
25980 @item If a zero-length bit-field is inserted between two bit-fields that
25981 are normally coalesced, the bit-fields are not coalesced.
25982
25983 For example:
25984
25985 @smallexample
25986 struct
25987 @{
25988 unsigned long bf_1 : 12;
25989 unsigned long : 0;
25990 unsigned long bf_2 : 12;
25991 @} t1;
25992 @end smallexample
25993
25994 @noindent
25995 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
25996 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
25997
25998 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
25999 alignment of the zero-length bit-field is greater than the member that follows it,
26000 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
26001
26002 For example:
26003
26004 @smallexample
26005 struct
26006 @{
26007 char foo : 4;
26008 short : 0;
26009 char bar;
26010 @} t2;
26011
26012 struct
26013 @{
26014 char foo : 4;
26015 short : 0;
26016 double bar;
26017 @} t3;
26018 @end smallexample
26019
26020 @noindent
26021 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
26022 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
26023 bit-field does not affect the alignment of @code{bar} or, as a result, the size
26024 of the structure.
26025
26026 Taking this into account, it is important to note the following:
26027
26028 @enumerate
26029 @item If a zero-length bit-field follows a normal bit-field, the type of the
26030 zero-length bit-field may affect the alignment of the structure as whole. For
26031 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
26032 normal bit-field, and is of type short.
26033
26034 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
26035 still affect the alignment of the structure:
26036
26037 @smallexample
26038 struct
26039 @{
26040 char foo : 6;
26041 long : 0;
26042 @} t4;
26043 @end smallexample
26044
26045 @noindent
26046 Here, @code{t4} takes up 4 bytes.
26047 @end enumerate
26048
26049 @item Zero-length bit-fields following non-bit-field members are ignored:
26050
26051 @smallexample
26052 struct
26053 @{
26054 char foo;
26055 long : 0;
26056 char bar;
26057 @} t5;
26058 @end smallexample
26059
26060 @noindent
26061 Here, @code{t5} takes up 2 bytes.
26062 @end enumerate
26063
26064
26065 @item -mno-align-stringops
26066 @opindex mno-align-stringops
26067 Do not align the destination of inlined string operations. This switch reduces
26068 code size and improves performance in case the destination is already aligned,
26069 but GCC doesn't know about it.
26070
26071 @item -minline-all-stringops
26072 @opindex minline-all-stringops
26073 By default GCC inlines string operations only when the destination is
26074 known to be aligned to least a 4-byte boundary.
26075 This enables more inlining and increases code
26076 size, but may improve performance of code that depends on fast
26077 @code{memcpy}, @code{strlen},
26078 and @code{memset} for short lengths.
26079
26080 @item -minline-stringops-dynamically
26081 @opindex minline-stringops-dynamically
26082 For string operations of unknown size, use run-time checks with
26083 inline code for small blocks and a library call for large blocks.
26084
26085 @item -mstringop-strategy=@var{alg}
26086 @opindex mstringop-strategy=@var{alg}
26087 Override the internal decision heuristic for the particular algorithm to use
26088 for inlining string operations. The allowed values for @var{alg} are:
26089
26090 @table @samp
26091 @item rep_byte
26092 @itemx rep_4byte
26093 @itemx rep_8byte
26094 Expand using i386 @code{rep} prefix of the specified size.
26095
26096 @item byte_loop
26097 @itemx loop
26098 @itemx unrolled_loop
26099 Expand into an inline loop.
26100
26101 @item libcall
26102 Always use a library call.
26103 @end table
26104
26105 @item -mmemcpy-strategy=@var{strategy}
26106 @opindex mmemcpy-strategy=@var{strategy}
26107 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
26108 should be inlined and what inline algorithm to use when the expected size
26109 of the copy operation is known. @var{strategy}
26110 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
26111 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
26112 the max byte size with which inline algorithm @var{alg} is allowed. For the last
26113 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
26114 in the list must be specified in increasing order. The minimal byte size for
26115 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
26116 preceding range.
26117
26118 @item -mmemset-strategy=@var{strategy}
26119 @opindex mmemset-strategy=@var{strategy}
26120 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
26121 @code{__builtin_memset} expansion.
26122
26123 @item -momit-leaf-frame-pointer
26124 @opindex momit-leaf-frame-pointer
26125 Don't keep the frame pointer in a register for leaf functions. This
26126 avoids the instructions to save, set up, and restore frame pointers and
26127 makes an extra register available in leaf functions. The option
26128 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
26129 which might make debugging harder.
26130
26131 @item -mtls-direct-seg-refs
26132 @itemx -mno-tls-direct-seg-refs
26133 @opindex mtls-direct-seg-refs
26134 Controls whether TLS variables may be accessed with offsets from the
26135 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
26136 or whether the thread base pointer must be added. Whether or not this
26137 is valid depends on the operating system, and whether it maps the
26138 segment to cover the entire TLS area.
26139
26140 For systems that use the GNU C Library, the default is on.
26141
26142 @item -msse2avx
26143 @itemx -mno-sse2avx
26144 @opindex msse2avx
26145 Specify that the assembler should encode SSE instructions with VEX
26146 prefix. The option @option{-mavx} turns this on by default.
26147
26148 @item -mfentry
26149 @itemx -mno-fentry
26150 @opindex mfentry
26151 If profiling is active (@option{-pg}), put the profiling
26152 counter call before the prologue.
26153 Note: On x86 architectures the attribute @code{ms_hook_prologue}
26154 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
26155
26156 @item -mrecord-mcount
26157 @itemx -mno-record-mcount
26158 @opindex mrecord-mcount
26159 If profiling is active (@option{-pg}), generate a __mcount_loc section
26160 that contains pointers to each profiling call. This is useful for
26161 automatically patching and out calls.
26162
26163 @item -mnop-mcount
26164 @itemx -mno-nop-mcount
26165 @opindex mnop-mcount
26166 If profiling is active (@option{-pg}), generate the calls to
26167 the profiling functions as NOPs. This is useful when they
26168 should be patched in later dynamically. This is likely only
26169 useful together with @option{-mrecord-mcount}.
26170
26171 @item -mskip-rax-setup
26172 @itemx -mno-skip-rax-setup
26173 @opindex mskip-rax-setup
26174 When generating code for the x86-64 architecture with SSE extensions
26175 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
26176 register when there are no variable arguments passed in vector registers.
26177
26178 @strong{Warning:} Since RAX register is used to avoid unnecessarily
26179 saving vector registers on stack when passing variable arguments, the
26180 impacts of this option are callees may waste some stack space,
26181 misbehave or jump to a random location. GCC 4.4 or newer don't have
26182 those issues, regardless the RAX register value.
26183
26184 @item -m8bit-idiv
26185 @itemx -mno-8bit-idiv
26186 @opindex m8bit-idiv
26187 On some processors, like Intel Atom, 8-bit unsigned integer divide is
26188 much faster than 32-bit/64-bit integer divide. This option generates a
26189 run-time check. If both dividend and divisor are within range of 0
26190 to 255, 8-bit unsigned integer divide is used instead of
26191 32-bit/64-bit integer divide.
26192
26193 @item -mavx256-split-unaligned-load
26194 @itemx -mavx256-split-unaligned-store
26195 @opindex mavx256-split-unaligned-load
26196 @opindex mavx256-split-unaligned-store
26197 Split 32-byte AVX unaligned load and store.
26198
26199 @item -mstack-protector-guard=@var{guard}
26200 @itemx -mstack-protector-guard-reg=@var{reg}
26201 @itemx -mstack-protector-guard-offset=@var{offset}
26202 @opindex mstack-protector-guard
26203 @opindex mstack-protector-guard-reg
26204 @opindex mstack-protector-guard-offset
26205 Generate stack protection code using canary at @var{guard}. Supported
26206 locations are @samp{global} for global canary or @samp{tls} for per-thread
26207 canary in the TLS block (the default). This option has effect only when
26208 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
26209
26210 With the latter choice the options
26211 @option{-mstack-protector-guard-reg=@var{reg}} and
26212 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
26213 which segment register (@code{%fs} or @code{%gs}) to use as base register
26214 for reading the canary, and from what offset from that base register.
26215 The default for those is as specified in the relevant ABI.
26216
26217 @item -mmitigate-rop
26218 @opindex mmitigate-rop
26219 Try to avoid generating code sequences that contain unintended return
26220 opcodes, to mitigate against certain forms of attack. At the moment,
26221 this option is limited in what it can do and should not be relied
26222 on to provide serious protection.
26223
26224 @item -mgeneral-regs-only
26225 @opindex mgeneral-regs-only
26226 Generate code that uses only the general-purpose registers. This
26227 prevents the compiler from using floating-point, vector, mask and bound
26228 registers.
26229
26230 @end table
26231
26232 These @samp{-m} switches are supported in addition to the above
26233 on x86-64 processors in 64-bit environments.
26234
26235 @table @gcctabopt
26236 @item -m32
26237 @itemx -m64
26238 @itemx -mx32
26239 @itemx -m16
26240 @itemx -miamcu
26241 @opindex m32
26242 @opindex m64
26243 @opindex mx32
26244 @opindex m16
26245 @opindex miamcu
26246 Generate code for a 16-bit, 32-bit or 64-bit environment.
26247 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
26248 to 32 bits, and
26249 generates code that runs on any i386 system.
26250
26251 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
26252 types to 64 bits, and generates code for the x86-64 architecture.
26253 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
26254 and @option{-mdynamic-no-pic} options.
26255
26256 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
26257 to 32 bits, and
26258 generates code for the x86-64 architecture.
26259
26260 The @option{-m16} option is the same as @option{-m32}, except for that
26261 it outputs the @code{.code16gcc} assembly directive at the beginning of
26262 the assembly output so that the binary can run in 16-bit mode.
26263
26264 The @option{-miamcu} option generates code which conforms to Intel MCU
26265 psABI. It requires the @option{-m32} option to be turned on.
26266
26267 @item -mno-red-zone
26268 @opindex mno-red-zone
26269 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
26270 by the x86-64 ABI; it is a 128-byte area beyond the location of the
26271 stack pointer that is not modified by signal or interrupt handlers
26272 and therefore can be used for temporary data without adjusting the stack
26273 pointer. The flag @option{-mno-red-zone} disables this red zone.
26274
26275 @item -mcmodel=small
26276 @opindex mcmodel=small
26277 Generate code for the small code model: the program and its symbols must
26278 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
26279 Programs can be statically or dynamically linked. This is the default
26280 code model.
26281
26282 @item -mcmodel=kernel
26283 @opindex mcmodel=kernel
26284 Generate code for the kernel code model. The kernel runs in the
26285 negative 2 GB of the address space.
26286 This model has to be used for Linux kernel code.
26287
26288 @item -mcmodel=medium
26289 @opindex mcmodel=medium
26290 Generate code for the medium model: the program is linked in the lower 2
26291 GB of the address space. Small symbols are also placed there. Symbols
26292 with sizes larger than @option{-mlarge-data-threshold} are put into
26293 large data or BSS sections and can be located above 2GB. Programs can
26294 be statically or dynamically linked.
26295
26296 @item -mcmodel=large
26297 @opindex mcmodel=large
26298 Generate code for the large model. This model makes no assumptions
26299 about addresses and sizes of sections.
26300
26301 @item -maddress-mode=long
26302 @opindex maddress-mode=long
26303 Generate code for long address mode. This is only supported for 64-bit
26304 and x32 environments. It is the default address mode for 64-bit
26305 environments.
26306
26307 @item -maddress-mode=short
26308 @opindex maddress-mode=short
26309 Generate code for short address mode. This is only supported for 32-bit
26310 and x32 environments. It is the default address mode for 32-bit and
26311 x32 environments.
26312 @end table
26313
26314 @node x86 Windows Options
26315 @subsection x86 Windows Options
26316 @cindex x86 Windows Options
26317 @cindex Windows Options for x86
26318
26319 These additional options are available for Microsoft Windows targets:
26320
26321 @table @gcctabopt
26322 @item -mconsole
26323 @opindex mconsole
26324 This option
26325 specifies that a console application is to be generated, by
26326 instructing the linker to set the PE header subsystem type
26327 required for console applications.
26328 This option is available for Cygwin and MinGW targets and is
26329 enabled by default on those targets.
26330
26331 @item -mdll
26332 @opindex mdll
26333 This option is available for Cygwin and MinGW targets. It
26334 specifies that a DLL---a dynamic link library---is to be
26335 generated, enabling the selection of the required runtime
26336 startup object and entry point.
26337
26338 @item -mnop-fun-dllimport
26339 @opindex mnop-fun-dllimport
26340 This option is available for Cygwin and MinGW targets. It
26341 specifies that the @code{dllimport} attribute should be ignored.
26342
26343 @item -mthread
26344 @opindex mthread
26345 This option is available for MinGW targets. It specifies
26346 that MinGW-specific thread support is to be used.
26347
26348 @item -municode
26349 @opindex municode
26350 This option is available for MinGW-w64 targets. It causes
26351 the @code{UNICODE} preprocessor macro to be predefined, and
26352 chooses Unicode-capable runtime startup code.
26353
26354 @item -mwin32
26355 @opindex mwin32
26356 This option is available for Cygwin and MinGW targets. It
26357 specifies that the typical Microsoft Windows predefined macros are to
26358 be set in the pre-processor, but does not influence the choice
26359 of runtime library/startup code.
26360
26361 @item -mwindows
26362 @opindex mwindows
26363 This option is available for Cygwin and MinGW targets. It
26364 specifies that a GUI application is to be generated by
26365 instructing the linker to set the PE header subsystem type
26366 appropriately.
26367
26368 @item -fno-set-stack-executable
26369 @opindex fno-set-stack-executable
26370 This option is available for MinGW targets. It specifies that
26371 the executable flag for the stack used by nested functions isn't
26372 set. This is necessary for binaries running in kernel mode of
26373 Microsoft Windows, as there the User32 API, which is used to set executable
26374 privileges, isn't available.
26375
26376 @item -fwritable-relocated-rdata
26377 @opindex fno-writable-relocated-rdata
26378 This option is available for MinGW and Cygwin targets. It specifies
26379 that relocated-data in read-only section is put into the @code{.data}
26380 section. This is a necessary for older runtimes not supporting
26381 modification of @code{.rdata} sections for pseudo-relocation.
26382
26383 @item -mpe-aligned-commons
26384 @opindex mpe-aligned-commons
26385 This option is available for Cygwin and MinGW targets. It
26386 specifies that the GNU extension to the PE file format that
26387 permits the correct alignment of COMMON variables should be
26388 used when generating code. It is enabled by default if
26389 GCC detects that the target assembler found during configuration
26390 supports the feature.
26391 @end table
26392
26393 See also under @ref{x86 Options} for standard options.
26394
26395 @node Xstormy16 Options
26396 @subsection Xstormy16 Options
26397 @cindex Xstormy16 Options
26398
26399 These options are defined for Xstormy16:
26400
26401 @table @gcctabopt
26402 @item -msim
26403 @opindex msim
26404 Choose startup files and linker script suitable for the simulator.
26405 @end table
26406
26407 @node Xtensa Options
26408 @subsection Xtensa Options
26409 @cindex Xtensa Options
26410
26411 These options are supported for Xtensa targets:
26412
26413 @table @gcctabopt
26414 @item -mconst16
26415 @itemx -mno-const16
26416 @opindex mconst16
26417 @opindex mno-const16
26418 Enable or disable use of @code{CONST16} instructions for loading
26419 constant values. The @code{CONST16} instruction is currently not a
26420 standard option from Tensilica. When enabled, @code{CONST16}
26421 instructions are always used in place of the standard @code{L32R}
26422 instructions. The use of @code{CONST16} is enabled by default only if
26423 the @code{L32R} instruction is not available.
26424
26425 @item -mfused-madd
26426 @itemx -mno-fused-madd
26427 @opindex mfused-madd
26428 @opindex mno-fused-madd
26429 Enable or disable use of fused multiply/add and multiply/subtract
26430 instructions in the floating-point option. This has no effect if the
26431 floating-point option is not also enabled. Disabling fused multiply/add
26432 and multiply/subtract instructions forces the compiler to use separate
26433 instructions for the multiply and add/subtract operations. This may be
26434 desirable in some cases where strict IEEE 754-compliant results are
26435 required: the fused multiply add/subtract instructions do not round the
26436 intermediate result, thereby producing results with @emph{more} bits of
26437 precision than specified by the IEEE standard. Disabling fused multiply
26438 add/subtract instructions also ensures that the program output is not
26439 sensitive to the compiler's ability to combine multiply and add/subtract
26440 operations.
26441
26442 @item -mserialize-volatile
26443 @itemx -mno-serialize-volatile
26444 @opindex mserialize-volatile
26445 @opindex mno-serialize-volatile
26446 When this option is enabled, GCC inserts @code{MEMW} instructions before
26447 @code{volatile} memory references to guarantee sequential consistency.
26448 The default is @option{-mserialize-volatile}. Use
26449 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
26450
26451 @item -mforce-no-pic
26452 @opindex mforce-no-pic
26453 For targets, like GNU/Linux, where all user-mode Xtensa code must be
26454 position-independent code (PIC), this option disables PIC for compiling
26455 kernel code.
26456
26457 @item -mtext-section-literals
26458 @itemx -mno-text-section-literals
26459 @opindex mtext-section-literals
26460 @opindex mno-text-section-literals
26461 These options control the treatment of literal pools. The default is
26462 @option{-mno-text-section-literals}, which places literals in a separate
26463 section in the output file. This allows the literal pool to be placed
26464 in a data RAM/ROM, and it also allows the linker to combine literal
26465 pools from separate object files to remove redundant literals and
26466 improve code size. With @option{-mtext-section-literals}, the literals
26467 are interspersed in the text section in order to keep them as close as
26468 possible to their references. This may be necessary for large assembly
26469 files. Literals for each function are placed right before that function.
26470
26471 @item -mauto-litpools
26472 @itemx -mno-auto-litpools
26473 @opindex mauto-litpools
26474 @opindex mno-auto-litpools
26475 These options control the treatment of literal pools. The default is
26476 @option{-mno-auto-litpools}, which places literals in a separate
26477 section in the output file unless @option{-mtext-section-literals} is
26478 used. With @option{-mauto-litpools} the literals are interspersed in
26479 the text section by the assembler. Compiler does not produce explicit
26480 @code{.literal} directives and loads literals into registers with
26481 @code{MOVI} instructions instead of @code{L32R} to let the assembler
26482 do relaxation and place literals as necessary. This option allows
26483 assembler to create several literal pools per function and assemble
26484 very big functions, which may not be possible with
26485 @option{-mtext-section-literals}.
26486
26487 @item -mtarget-align
26488 @itemx -mno-target-align
26489 @opindex mtarget-align
26490 @opindex mno-target-align
26491 When this option is enabled, GCC instructs the assembler to
26492 automatically align instructions to reduce branch penalties at the
26493 expense of some code density. The assembler attempts to widen density
26494 instructions to align branch targets and the instructions following call
26495 instructions. If there are not enough preceding safe density
26496 instructions to align a target, no widening is performed. The
26497 default is @option{-mtarget-align}. These options do not affect the
26498 treatment of auto-aligned instructions like @code{LOOP}, which the
26499 assembler always aligns, either by widening density instructions or
26500 by inserting NOP instructions.
26501
26502 @item -mlongcalls
26503 @itemx -mno-longcalls
26504 @opindex mlongcalls
26505 @opindex mno-longcalls
26506 When this option is enabled, GCC instructs the assembler to translate
26507 direct calls to indirect calls unless it can determine that the target
26508 of a direct call is in the range allowed by the call instruction. This
26509 translation typically occurs for calls to functions in other source
26510 files. Specifically, the assembler translates a direct @code{CALL}
26511 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
26512 The default is @option{-mno-longcalls}. This option should be used in
26513 programs where the call target can potentially be out of range. This
26514 option is implemented in the assembler, not the compiler, so the
26515 assembly code generated by GCC still shows direct call
26516 instructions---look at the disassembled object code to see the actual
26517 instructions. Note that the assembler uses an indirect call for
26518 every cross-file call, not just those that really are out of range.
26519 @end table
26520
26521 @node zSeries Options
26522 @subsection zSeries Options
26523 @cindex zSeries options
26524
26525 These are listed under @xref{S/390 and zSeries Options}.
26526
26527
26528 @c man end
26529
26530 @node Spec Files
26531 @section Specifying Subprocesses and the Switches to Pass to Them
26532 @cindex Spec Files
26533
26534 @command{gcc} is a driver program. It performs its job by invoking a
26535 sequence of other programs to do the work of compiling, assembling and
26536 linking. GCC interprets its command-line parameters and uses these to
26537 deduce which programs it should invoke, and which command-line options
26538 it ought to place on their command lines. This behavior is controlled
26539 by @dfn{spec strings}. In most cases there is one spec string for each
26540 program that GCC can invoke, but a few programs have multiple spec
26541 strings to control their behavior. The spec strings built into GCC can
26542 be overridden by using the @option{-specs=} command-line switch to specify
26543 a spec file.
26544
26545 @dfn{Spec files} are plain-text files that are used to construct spec
26546 strings. They consist of a sequence of directives separated by blank
26547 lines. The type of directive is determined by the first non-whitespace
26548 character on the line, which can be one of the following:
26549
26550 @table @code
26551 @item %@var{command}
26552 Issues a @var{command} to the spec file processor. The commands that can
26553 appear here are:
26554
26555 @table @code
26556 @item %include <@var{file}>
26557 @cindex @code{%include}
26558 Search for @var{file} and insert its text at the current point in the
26559 specs file.
26560
26561 @item %include_noerr <@var{file}>
26562 @cindex @code{%include_noerr}
26563 Just like @samp{%include}, but do not generate an error message if the include
26564 file cannot be found.
26565
26566 @item %rename @var{old_name} @var{new_name}
26567 @cindex @code{%rename}
26568 Rename the spec string @var{old_name} to @var{new_name}.
26569
26570 @end table
26571
26572 @item *[@var{spec_name}]:
26573 This tells the compiler to create, override or delete the named spec
26574 string. All lines after this directive up to the next directive or
26575 blank line are considered to be the text for the spec string. If this
26576 results in an empty string then the spec is deleted. (Or, if the
26577 spec did not exist, then nothing happens.) Otherwise, if the spec
26578 does not currently exist a new spec is created. If the spec does
26579 exist then its contents are overridden by the text of this
26580 directive, unless the first character of that text is the @samp{+}
26581 character, in which case the text is appended to the spec.
26582
26583 @item [@var{suffix}]:
26584 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
26585 and up to the next directive or blank line are considered to make up the
26586 spec string for the indicated suffix. When the compiler encounters an
26587 input file with the named suffix, it processes the spec string in
26588 order to work out how to compile that file. For example:
26589
26590 @smallexample
26591 .ZZ:
26592 z-compile -input %i
26593 @end smallexample
26594
26595 This says that any input file whose name ends in @samp{.ZZ} should be
26596 passed to the program @samp{z-compile}, which should be invoked with the
26597 command-line switch @option{-input} and with the result of performing the
26598 @samp{%i} substitution. (See below.)
26599
26600 As an alternative to providing a spec string, the text following a
26601 suffix directive can be one of the following:
26602
26603 @table @code
26604 @item @@@var{language}
26605 This says that the suffix is an alias for a known @var{language}. This is
26606 similar to using the @option{-x} command-line switch to GCC to specify a
26607 language explicitly. For example:
26608
26609 @smallexample
26610 .ZZ:
26611 @@c++
26612 @end smallexample
26613
26614 Says that .ZZ files are, in fact, C++ source files.
26615
26616 @item #@var{name}
26617 This causes an error messages saying:
26618
26619 @smallexample
26620 @var{name} compiler not installed on this system.
26621 @end smallexample
26622 @end table
26623
26624 GCC already has an extensive list of suffixes built into it.
26625 This directive adds an entry to the end of the list of suffixes, but
26626 since the list is searched from the end backwards, it is effectively
26627 possible to override earlier entries using this technique.
26628
26629 @end table
26630
26631 GCC has the following spec strings built into it. Spec files can
26632 override these strings or create their own. Note that individual
26633 targets can also add their own spec strings to this list.
26634
26635 @smallexample
26636 asm Options to pass to the assembler
26637 asm_final Options to pass to the assembler post-processor
26638 cpp Options to pass to the C preprocessor
26639 cc1 Options to pass to the C compiler
26640 cc1plus Options to pass to the C++ compiler
26641 endfile Object files to include at the end of the link
26642 link Options to pass to the linker
26643 lib Libraries to include on the command line to the linker
26644 libgcc Decides which GCC support library to pass to the linker
26645 linker Sets the name of the linker
26646 predefines Defines to be passed to the C preprocessor
26647 signed_char Defines to pass to CPP to say whether @code{char} is signed
26648 by default
26649 startfile Object files to include at the start of the link
26650 @end smallexample
26651
26652 Here is a small example of a spec file:
26653
26654 @smallexample
26655 %rename lib old_lib
26656
26657 *lib:
26658 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
26659 @end smallexample
26660
26661 This example renames the spec called @samp{lib} to @samp{old_lib} and
26662 then overrides the previous definition of @samp{lib} with a new one.
26663 The new definition adds in some extra command-line options before
26664 including the text of the old definition.
26665
26666 @dfn{Spec strings} are a list of command-line options to be passed to their
26667 corresponding program. In addition, the spec strings can contain
26668 @samp{%}-prefixed sequences to substitute variable text or to
26669 conditionally insert text into the command line. Using these constructs
26670 it is possible to generate quite complex command lines.
26671
26672 Here is a table of all defined @samp{%}-sequences for spec
26673 strings. Note that spaces are not generated automatically around the
26674 results of expanding these sequences. Therefore you can concatenate them
26675 together or combine them with constant text in a single argument.
26676
26677 @table @code
26678 @item %%
26679 Substitute one @samp{%} into the program name or argument.
26680
26681 @item %i
26682 Substitute the name of the input file being processed.
26683
26684 @item %b
26685 Substitute the basename of the input file being processed.
26686 This is the substring up to (and not including) the last period
26687 and not including the directory.
26688
26689 @item %B
26690 This is the same as @samp{%b}, but include the file suffix (text after
26691 the last period).
26692
26693 @item %d
26694 Marks the argument containing or following the @samp{%d} as a
26695 temporary file name, so that that file is deleted if GCC exits
26696 successfully. Unlike @samp{%g}, this contributes no text to the
26697 argument.
26698
26699 @item %g@var{suffix}
26700 Substitute a file name that has suffix @var{suffix} and is chosen
26701 once per compilation, and mark the argument in the same way as
26702 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
26703 name is now chosen in a way that is hard to predict even when previously
26704 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
26705 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
26706 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
26707 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
26708 was simply substituted with a file name chosen once per compilation,
26709 without regard to any appended suffix (which was therefore treated
26710 just like ordinary text), making such attacks more likely to succeed.
26711
26712 @item %u@var{suffix}
26713 Like @samp{%g}, but generates a new temporary file name
26714 each time it appears instead of once per compilation.
26715
26716 @item %U@var{suffix}
26717 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
26718 new one if there is no such last file name. In the absence of any
26719 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
26720 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
26721 involves the generation of two distinct file names, one
26722 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
26723 simply substituted with a file name chosen for the previous @samp{%u},
26724 without regard to any appended suffix.
26725
26726 @item %j@var{suffix}
26727 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
26728 writable, and if @option{-save-temps} is not used;
26729 otherwise, substitute the name
26730 of a temporary file, just like @samp{%u}. This temporary file is not
26731 meant for communication between processes, but rather as a junk
26732 disposal mechanism.
26733
26734 @item %|@var{suffix}
26735 @itemx %m@var{suffix}
26736 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
26737 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
26738 all. These are the two most common ways to instruct a program that it
26739 should read from standard input or write to standard output. If you
26740 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
26741 construct: see for example @file{f/lang-specs.h}.
26742
26743 @item %.@var{SUFFIX}
26744 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
26745 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
26746 terminated by the next space or %.
26747
26748 @item %w
26749 Marks the argument containing or following the @samp{%w} as the
26750 designated output file of this compilation. This puts the argument
26751 into the sequence of arguments that @samp{%o} substitutes.
26752
26753 @item %o
26754 Substitutes the names of all the output files, with spaces
26755 automatically placed around them. You should write spaces
26756 around the @samp{%o} as well or the results are undefined.
26757 @samp{%o} is for use in the specs for running the linker.
26758 Input files whose names have no recognized suffix are not compiled
26759 at all, but they are included among the output files, so they are
26760 linked.
26761
26762 @item %O
26763 Substitutes the suffix for object files. Note that this is
26764 handled specially when it immediately follows @samp{%g, %u, or %U},
26765 because of the need for those to form complete file names. The
26766 handling is such that @samp{%O} is treated exactly as if it had already
26767 been substituted, except that @samp{%g, %u, and %U} do not currently
26768 support additional @var{suffix} characters following @samp{%O} as they do
26769 following, for example, @samp{.o}.
26770
26771 @item %p
26772 Substitutes the standard macro predefinitions for the
26773 current target machine. Use this when running @command{cpp}.
26774
26775 @item %P
26776 Like @samp{%p}, but puts @samp{__} before and after the name of each
26777 predefined macro, except for macros that start with @samp{__} or with
26778 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
26779 C@.
26780
26781 @item %I
26782 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
26783 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
26784 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
26785 and @option{-imultilib} as necessary.
26786
26787 @item %s
26788 Current argument is the name of a library or startup file of some sort.
26789 Search for that file in a standard list of directories and substitute
26790 the full name found. The current working directory is included in the
26791 list of directories scanned.
26792
26793 @item %T
26794 Current argument is the name of a linker script. Search for that file
26795 in the current list of directories to scan for libraries. If the file
26796 is located insert a @option{--script} option into the command line
26797 followed by the full path name found. If the file is not found then
26798 generate an error message. Note: the current working directory is not
26799 searched.
26800
26801 @item %e@var{str}
26802 Print @var{str} as an error message. @var{str} is terminated by a newline.
26803 Use this when inconsistent options are detected.
26804
26805 @item %(@var{name})
26806 Substitute the contents of spec string @var{name} at this point.
26807
26808 @item %x@{@var{option}@}
26809 Accumulate an option for @samp{%X}.
26810
26811 @item %X
26812 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
26813 spec string.
26814
26815 @item %Y
26816 Output the accumulated assembler options specified by @option{-Wa}.
26817
26818 @item %Z
26819 Output the accumulated preprocessor options specified by @option{-Wp}.
26820
26821 @item %a
26822 Process the @code{asm} spec. This is used to compute the
26823 switches to be passed to the assembler.
26824
26825 @item %A
26826 Process the @code{asm_final} spec. This is a spec string for
26827 passing switches to an assembler post-processor, if such a program is
26828 needed.
26829
26830 @item %l
26831 Process the @code{link} spec. This is the spec for computing the
26832 command line passed to the linker. Typically it makes use of the
26833 @samp{%L %G %S %D and %E} sequences.
26834
26835 @item %D
26836 Dump out a @option{-L} option for each directory that GCC believes might
26837 contain startup files. If the target supports multilibs then the
26838 current multilib directory is prepended to each of these paths.
26839
26840 @item %L
26841 Process the @code{lib} spec. This is a spec string for deciding which
26842 libraries are included on the command line to the linker.
26843
26844 @item %G
26845 Process the @code{libgcc} spec. This is a spec string for deciding
26846 which GCC support library is included on the command line to the linker.
26847
26848 @item %S
26849 Process the @code{startfile} spec. This is a spec for deciding which
26850 object files are the first ones passed to the linker. Typically
26851 this might be a file named @file{crt0.o}.
26852
26853 @item %E
26854 Process the @code{endfile} spec. This is a spec string that specifies
26855 the last object files that are passed to the linker.
26856
26857 @item %C
26858 Process the @code{cpp} spec. This is used to construct the arguments
26859 to be passed to the C preprocessor.
26860
26861 @item %1
26862 Process the @code{cc1} spec. This is used to construct the options to be
26863 passed to the actual C compiler (@command{cc1}).
26864
26865 @item %2
26866 Process the @code{cc1plus} spec. This is used to construct the options to be
26867 passed to the actual C++ compiler (@command{cc1plus}).
26868
26869 @item %*
26870 Substitute the variable part of a matched option. See below.
26871 Note that each comma in the substituted string is replaced by
26872 a single space.
26873
26874 @item %<S
26875 Remove all occurrences of @code{-S} from the command line. Note---this
26876 command is position dependent. @samp{%} commands in the spec string
26877 before this one see @code{-S}, @samp{%} commands in the spec string
26878 after this one do not.
26879
26880 @item %:@var{function}(@var{args})
26881 Call the named function @var{function}, passing it @var{args}.
26882 @var{args} is first processed as a nested spec string, then split
26883 into an argument vector in the usual fashion. The function returns
26884 a string which is processed as if it had appeared literally as part
26885 of the current spec.
26886
26887 The following built-in spec functions are provided:
26888
26889 @table @code
26890 @item @code{getenv}
26891 The @code{getenv} spec function takes two arguments: an environment
26892 variable name and a string. If the environment variable is not
26893 defined, a fatal error is issued. Otherwise, the return value is the
26894 value of the environment variable concatenated with the string. For
26895 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
26896
26897 @smallexample
26898 %:getenv(TOPDIR /include)
26899 @end smallexample
26900
26901 expands to @file{/path/to/top/include}.
26902
26903 @item @code{if-exists}
26904 The @code{if-exists} spec function takes one argument, an absolute
26905 pathname to a file. If the file exists, @code{if-exists} returns the
26906 pathname. Here is a small example of its usage:
26907
26908 @smallexample
26909 *startfile:
26910 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
26911 @end smallexample
26912
26913 @item @code{if-exists-else}
26914 The @code{if-exists-else} spec function is similar to the @code{if-exists}
26915 spec function, except that it takes two arguments. The first argument is
26916 an absolute pathname to a file. If the file exists, @code{if-exists-else}
26917 returns the pathname. If it does not exist, it returns the second argument.
26918 This way, @code{if-exists-else} can be used to select one file or another,
26919 based on the existence of the first. Here is a small example of its usage:
26920
26921 @smallexample
26922 *startfile:
26923 crt0%O%s %:if-exists(crti%O%s) \
26924 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
26925 @end smallexample
26926
26927 @item @code{replace-outfile}
26928 The @code{replace-outfile} spec function takes two arguments. It looks for the
26929 first argument in the outfiles array and replaces it with the second argument. Here
26930 is a small example of its usage:
26931
26932 @smallexample
26933 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
26934 @end smallexample
26935
26936 @item @code{remove-outfile}
26937 The @code{remove-outfile} spec function takes one argument. It looks for the
26938 first argument in the outfiles array and removes it. Here is a small example
26939 its usage:
26940
26941 @smallexample
26942 %:remove-outfile(-lm)
26943 @end smallexample
26944
26945 @item @code{pass-through-libs}
26946 The @code{pass-through-libs} spec function takes any number of arguments. It
26947 finds any @option{-l} options and any non-options ending in @file{.a} (which it
26948 assumes are the names of linker input library archive files) and returns a
26949 result containing all the found arguments each prepended by
26950 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
26951 intended to be passed to the LTO linker plugin.
26952
26953 @smallexample
26954 %:pass-through-libs(%G %L %G)
26955 @end smallexample
26956
26957 @item @code{print-asm-header}
26958 The @code{print-asm-header} function takes no arguments and simply
26959 prints a banner like:
26960
26961 @smallexample
26962 Assembler options
26963 =================
26964
26965 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
26966 @end smallexample
26967
26968 It is used to separate compiler options from assembler options
26969 in the @option{--target-help} output.
26970 @end table
26971
26972 @item %@{S@}
26973 Substitutes the @code{-S} switch, if that switch is given to GCC@.
26974 If that switch is not specified, this substitutes nothing. Note that
26975 the leading dash is omitted when specifying this option, and it is
26976 automatically inserted if the substitution is performed. Thus the spec
26977 string @samp{%@{foo@}} matches the command-line option @option{-foo}
26978 and outputs the command-line option @option{-foo}.
26979
26980 @item %W@{S@}
26981 Like %@{@code{S}@} but mark last argument supplied within as a file to be
26982 deleted on failure.
26983
26984 @item %@{S*@}
26985 Substitutes all the switches specified to GCC whose names start
26986 with @code{-S}, but which also take an argument. This is used for
26987 switches like @option{-o}, @option{-D}, @option{-I}, etc.
26988 GCC considers @option{-o foo} as being
26989 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
26990 text, including the space. Thus two arguments are generated.
26991
26992 @item %@{S*&T*@}
26993 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
26994 (the order of @code{S} and @code{T} in the spec is not significant).
26995 There can be any number of ampersand-separated variables; for each the
26996 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
26997
26998 @item %@{S:X@}
26999 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
27000
27001 @item %@{!S:X@}
27002 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
27003
27004 @item %@{S*:X@}
27005 Substitutes @code{X} if one or more switches whose names start with
27006 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
27007 once, no matter how many such switches appeared. However, if @code{%*}
27008 appears somewhere in @code{X}, then @code{X} is substituted once
27009 for each matching switch, with the @code{%*} replaced by the part of
27010 that switch matching the @code{*}.
27011
27012 If @code{%*} appears as the last part of a spec sequence then a space
27013 is added after the end of the last substitution. If there is more
27014 text in the sequence, however, then a space is not generated. This
27015 allows the @code{%*} substitution to be used as part of a larger
27016 string. For example, a spec string like this:
27017
27018 @smallexample
27019 %@{mcu=*:--script=%*/memory.ld@}
27020 @end smallexample
27021
27022 @noindent
27023 when matching an option like @option{-mcu=newchip} produces:
27024
27025 @smallexample
27026 --script=newchip/memory.ld
27027 @end smallexample
27028
27029 @item %@{.S:X@}
27030 Substitutes @code{X}, if processing a file with suffix @code{S}.
27031
27032 @item %@{!.S:X@}
27033 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
27034
27035 @item %@{,S:X@}
27036 Substitutes @code{X}, if processing a file for language @code{S}.
27037
27038 @item %@{!,S:X@}
27039 Substitutes @code{X}, if not processing a file for language @code{S}.
27040
27041 @item %@{S|P:X@}
27042 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
27043 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
27044 @code{*} sequences as well, although they have a stronger binding than
27045 the @samp{|}. If @code{%*} appears in @code{X}, all of the
27046 alternatives must be starred, and only the first matching alternative
27047 is substituted.
27048
27049 For example, a spec string like this:
27050
27051 @smallexample
27052 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
27053 @end smallexample
27054
27055 @noindent
27056 outputs the following command-line options from the following input
27057 command-line options:
27058
27059 @smallexample
27060 fred.c -foo -baz
27061 jim.d -bar -boggle
27062 -d fred.c -foo -baz -boggle
27063 -d jim.d -bar -baz -boggle
27064 @end smallexample
27065
27066 @item %@{S:X; T:Y; :D@}
27067
27068 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
27069 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
27070 be as many clauses as you need. This may be combined with @code{.},
27071 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
27072
27073
27074 @end table
27075
27076 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
27077 or similar construct can use a backslash to ignore the special meaning
27078 of the character following it, thus allowing literal matching of a
27079 character that is otherwise specially treated. For example,
27080 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
27081 @option{-std=iso9899:1999} option is given.
27082
27083 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
27084 construct may contain other nested @samp{%} constructs or spaces, or
27085 even newlines. They are processed as usual, as described above.
27086 Trailing white space in @code{X} is ignored. White space may also
27087 appear anywhere on the left side of the colon in these constructs,
27088 except between @code{.} or @code{*} and the corresponding word.
27089
27090 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
27091 handled specifically in these constructs. If another value of
27092 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
27093 @option{-W} switch is found later in the command line, the earlier
27094 switch value is ignored, except with @{@code{S}*@} where @code{S} is
27095 just one letter, which passes all matching options.
27096
27097 The character @samp{|} at the beginning of the predicate text is used to
27098 indicate that a command should be piped to the following command, but
27099 only if @option{-pipe} is specified.
27100
27101 It is built into GCC which switches take arguments and which do not.
27102 (You might think it would be useful to generalize this to allow each
27103 compiler's spec to say which switches take arguments. But this cannot
27104 be done in a consistent fashion. GCC cannot even decide which input
27105 files have been specified without knowing which switches take arguments,
27106 and it must know which input files to compile in order to tell which
27107 compilers to run).
27108
27109 GCC also knows implicitly that arguments starting in @option{-l} are to be
27110 treated as compiler output files, and passed to the linker in their
27111 proper position among the other output files.
27112
27113 @node Environment Variables
27114 @section Environment Variables Affecting GCC
27115 @cindex environment variables
27116
27117 @c man begin ENVIRONMENT
27118 This section describes several environment variables that affect how GCC
27119 operates. Some of them work by specifying directories or prefixes to use
27120 when searching for various kinds of files. Some are used to specify other
27121 aspects of the compilation environment.
27122
27123 Note that you can also specify places to search using options such as
27124 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
27125 take precedence over places specified using environment variables, which
27126 in turn take precedence over those specified by the configuration of GCC@.
27127 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
27128 GNU Compiler Collection (GCC) Internals}.
27129
27130 @table @env
27131 @item LANG
27132 @itemx LC_CTYPE
27133 @c @itemx LC_COLLATE
27134 @itemx LC_MESSAGES
27135 @c @itemx LC_MONETARY
27136 @c @itemx LC_NUMERIC
27137 @c @itemx LC_TIME
27138 @itemx LC_ALL
27139 @findex LANG
27140 @findex LC_CTYPE
27141 @c @findex LC_COLLATE
27142 @findex LC_MESSAGES
27143 @c @findex LC_MONETARY
27144 @c @findex LC_NUMERIC
27145 @c @findex LC_TIME
27146 @findex LC_ALL
27147 @cindex locale
27148 These environment variables control the way that GCC uses
27149 localization information which allows GCC to work with different
27150 national conventions. GCC inspects the locale categories
27151 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
27152 so. These locale categories can be set to any value supported by your
27153 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
27154 Kingdom encoded in UTF-8.
27155
27156 The @env{LC_CTYPE} environment variable specifies character
27157 classification. GCC uses it to determine the character boundaries in
27158 a string; this is needed for some multibyte encodings that contain quote
27159 and escape characters that are otherwise interpreted as a string
27160 end or escape.
27161
27162 The @env{LC_MESSAGES} environment variable specifies the language to
27163 use in diagnostic messages.
27164
27165 If the @env{LC_ALL} environment variable is set, it overrides the value
27166 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
27167 and @env{LC_MESSAGES} default to the value of the @env{LANG}
27168 environment variable. If none of these variables are set, GCC
27169 defaults to traditional C English behavior.
27170
27171 @item TMPDIR
27172 @findex TMPDIR
27173 If @env{TMPDIR} is set, it specifies the directory to use for temporary
27174 files. GCC uses temporary files to hold the output of one stage of
27175 compilation which is to be used as input to the next stage: for example,
27176 the output of the preprocessor, which is the input to the compiler
27177 proper.
27178
27179 @item GCC_COMPARE_DEBUG
27180 @findex GCC_COMPARE_DEBUG
27181 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
27182 @option{-fcompare-debug} to the compiler driver. See the documentation
27183 of this option for more details.
27184
27185 @item GCC_EXEC_PREFIX
27186 @findex GCC_EXEC_PREFIX
27187 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
27188 names of the subprograms executed by the compiler. No slash is added
27189 when this prefix is combined with the name of a subprogram, but you can
27190 specify a prefix that ends with a slash if you wish.
27191
27192 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
27193 an appropriate prefix to use based on the pathname it is invoked with.
27194
27195 If GCC cannot find the subprogram using the specified prefix, it
27196 tries looking in the usual places for the subprogram.
27197
27198 The default value of @env{GCC_EXEC_PREFIX} is
27199 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
27200 the installed compiler. In many cases @var{prefix} is the value
27201 of @code{prefix} when you ran the @file{configure} script.
27202
27203 Other prefixes specified with @option{-B} take precedence over this prefix.
27204
27205 This prefix is also used for finding files such as @file{crt0.o} that are
27206 used for linking.
27207
27208 In addition, the prefix is used in an unusual way in finding the
27209 directories to search for header files. For each of the standard
27210 directories whose name normally begins with @samp{/usr/local/lib/gcc}
27211 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
27212 replacing that beginning with the specified prefix to produce an
27213 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
27214 @file{foo/bar} just before it searches the standard directory
27215 @file{/usr/local/lib/bar}.
27216 If a standard directory begins with the configured
27217 @var{prefix} then the value of @var{prefix} is replaced by
27218 @env{GCC_EXEC_PREFIX} when looking for header files.
27219
27220 @item COMPILER_PATH
27221 @findex COMPILER_PATH
27222 The value of @env{COMPILER_PATH} is a colon-separated list of
27223 directories, much like @env{PATH}. GCC tries the directories thus
27224 specified when searching for subprograms, if it cannot find the
27225 subprograms using @env{GCC_EXEC_PREFIX}.
27226
27227 @item LIBRARY_PATH
27228 @findex LIBRARY_PATH
27229 The value of @env{LIBRARY_PATH} is a colon-separated list of
27230 directories, much like @env{PATH}. When configured as a native compiler,
27231 GCC tries the directories thus specified when searching for special
27232 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
27233 using GCC also uses these directories when searching for ordinary
27234 libraries for the @option{-l} option (but directories specified with
27235 @option{-L} come first).
27236
27237 @item LANG
27238 @findex LANG
27239 @cindex locale definition
27240 This variable is used to pass locale information to the compiler. One way in
27241 which this information is used is to determine the character set to be used
27242 when character literals, string literals and comments are parsed in C and C++.
27243 When the compiler is configured to allow multibyte characters,
27244 the following values for @env{LANG} are recognized:
27245
27246 @table @samp
27247 @item C-JIS
27248 Recognize JIS characters.
27249 @item C-SJIS
27250 Recognize SJIS characters.
27251 @item C-EUCJP
27252 Recognize EUCJP characters.
27253 @end table
27254
27255 If @env{LANG} is not defined, or if it has some other value, then the
27256 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
27257 recognize and translate multibyte characters.
27258 @end table
27259
27260 @noindent
27261 Some additional environment variables affect the behavior of the
27262 preprocessor.
27263
27264 @include cppenv.texi
27265
27266 @c man end
27267
27268 @node Precompiled Headers
27269 @section Using Precompiled Headers
27270 @cindex precompiled headers
27271 @cindex speed of compilation
27272
27273 Often large projects have many header files that are included in every
27274 source file. The time the compiler takes to process these header files
27275 over and over again can account for nearly all of the time required to
27276 build the project. To make builds faster, GCC allows you to
27277 @dfn{precompile} a header file.
27278
27279 To create a precompiled header file, simply compile it as you would any
27280 other file, if necessary using the @option{-x} option to make the driver
27281 treat it as a C or C++ header file. You may want to use a
27282 tool like @command{make} to keep the precompiled header up-to-date when
27283 the headers it contains change.
27284
27285 A precompiled header file is searched for when @code{#include} is
27286 seen in the compilation. As it searches for the included file
27287 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
27288 compiler looks for a precompiled header in each directory just before it
27289 looks for the include file in that directory. The name searched for is
27290 the name specified in the @code{#include} with @samp{.gch} appended. If
27291 the precompiled header file cannot be used, it is ignored.
27292
27293 For instance, if you have @code{#include "all.h"}, and you have
27294 @file{all.h.gch} in the same directory as @file{all.h}, then the
27295 precompiled header file is used if possible, and the original
27296 header is used otherwise.
27297
27298 Alternatively, you might decide to put the precompiled header file in a
27299 directory and use @option{-I} to ensure that directory is searched
27300 before (or instead of) the directory containing the original header.
27301 Then, if you want to check that the precompiled header file is always
27302 used, you can put a file of the same name as the original header in this
27303 directory containing an @code{#error} command.
27304
27305 This also works with @option{-include}. So yet another way to use
27306 precompiled headers, good for projects not designed with precompiled
27307 header files in mind, is to simply take most of the header files used by
27308 a project, include them from another header file, precompile that header
27309 file, and @option{-include} the precompiled header. If the header files
27310 have guards against multiple inclusion, they are skipped because
27311 they've already been included (in the precompiled header).
27312
27313 If you need to precompile the same header file for different
27314 languages, targets, or compiler options, you can instead make a
27315 @emph{directory} named like @file{all.h.gch}, and put each precompiled
27316 header in the directory, perhaps using @option{-o}. It doesn't matter
27317 what you call the files in the directory; every precompiled header in
27318 the directory is considered. The first precompiled header
27319 encountered in the directory that is valid for this compilation is
27320 used; they're searched in no particular order.
27321
27322 There are many other possibilities, limited only by your imagination,
27323 good sense, and the constraints of your build system.
27324
27325 A precompiled header file can be used only when these conditions apply:
27326
27327 @itemize
27328 @item
27329 Only one precompiled header can be used in a particular compilation.
27330
27331 @item
27332 A precompiled header cannot be used once the first C token is seen. You
27333 can have preprocessor directives before a precompiled header; you cannot
27334 include a precompiled header from inside another header.
27335
27336 @item
27337 The precompiled header file must be produced for the same language as
27338 the current compilation. You cannot use a C precompiled header for a C++
27339 compilation.
27340
27341 @item
27342 The precompiled header file must have been produced by the same compiler
27343 binary as the current compilation is using.
27344
27345 @item
27346 Any macros defined before the precompiled header is included must
27347 either be defined in the same way as when the precompiled header was
27348 generated, or must not affect the precompiled header, which usually
27349 means that they don't appear in the precompiled header at all.
27350
27351 The @option{-D} option is one way to define a macro before a
27352 precompiled header is included; using a @code{#define} can also do it.
27353 There are also some options that define macros implicitly, like
27354 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
27355 defined this way.
27356
27357 @item If debugging information is output when using the precompiled
27358 header, using @option{-g} or similar, the same kind of debugging information
27359 must have been output when building the precompiled header. However,
27360 a precompiled header built using @option{-g} can be used in a compilation
27361 when no debugging information is being output.
27362
27363 @item The same @option{-m} options must generally be used when building
27364 and using the precompiled header. @xref{Submodel Options},
27365 for any cases where this rule is relaxed.
27366
27367 @item Each of the following options must be the same when building and using
27368 the precompiled header:
27369
27370 @gccoptlist{-fexceptions}
27371
27372 @item
27373 Some other command-line options starting with @option{-f},
27374 @option{-p}, or @option{-O} must be defined in the same way as when
27375 the precompiled header was generated. At present, it's not clear
27376 which options are safe to change and which are not; the safest choice
27377 is to use exactly the same options when generating and using the
27378 precompiled header. The following are known to be safe:
27379
27380 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
27381 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
27382 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
27383 -pedantic-errors}
27384
27385 @end itemize
27386
27387 For all of these except the last, the compiler automatically
27388 ignores the precompiled header if the conditions aren't met. If you
27389 find an option combination that doesn't work and doesn't cause the
27390 precompiled header to be ignored, please consider filing a bug report,
27391 see @ref{Bugs}.
27392
27393 If you do use differing options when generating and using the
27394 precompiled header, the actual behavior is a mixture of the
27395 behavior for the options. For instance, if you use @option{-g} to
27396 generate the precompiled header but not when using it, you may or may
27397 not get debugging information for routines in the precompiled header.