]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
Document -fipa-vrp
[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 -Wnon-virtual-dtor -Wreorder -Wregister @gol
219 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
220 -Wno-non-template-friend -Wold-style-cast @gol
221 -Woverloaded-virtual -Wno-pmf-conversions @gol
222 -Wsign-promo -Wvirtual-inheritance}
223
224 @item Objective-C and Objective-C++ Language Options
225 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
226 Objective-C and Objective-C++ Dialects}.
227 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
228 -fgnu-runtime -fnext-runtime @gol
229 -fno-nil-receivers @gol
230 -fobjc-abi-version=@var{n} @gol
231 -fobjc-call-cxx-cdtors @gol
232 -fobjc-direct-dispatch @gol
233 -fobjc-exceptions @gol
234 -fobjc-gc @gol
235 -fobjc-nilcheck @gol
236 -fobjc-std=objc1 @gol
237 -fno-local-ivars @gol
238 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
239 -freplace-objc-classes @gol
240 -fzero-link @gol
241 -gen-decls @gol
242 -Wassign-intercept @gol
243 -Wno-protocol -Wselector @gol
244 -Wstrict-selector-match @gol
245 -Wundeclared-selector}
246
247 @item Diagnostic Message Formatting Options
248 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
249 @gccoptlist{-fmessage-length=@var{n} @gol
250 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
251 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
252 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
253 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
254 -fno-show-column}
255
256 @item Warning Options
257 @xref{Warning Options,,Options to Request or Suppress Warnings}.
258 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
259 -pedantic-errors @gol
260 -w -Wextra -Wall -Waddress -Waggregate-return @gol
261 -Walloc-zero -Walloc-size-larger-than=@var{n}
262 -Walloca -Walloca-larger-than=@var{n} @gol
263 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
264 -Wno-attributes -Wbool-compare -Wbool-operation @gol
265 -Wno-builtin-declaration-mismatch @gol
266 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
267 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
268 -Wchar-subscripts -Wchkp -Wclobbered -Wcomment @gol
269 -Wconditionally-supported @gol
270 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
271 -Wdelete-incomplete @gol
272 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
273 -Wdisabled-optimization @gol
274 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
275 -Wno-div-by-zero -Wdouble-promotion -Wduplicated-cond @gol
276 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
277 -Werror -Werror=* -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
278 -Wno-format-contains-nul -Wno-format-extra-args @gol
279 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
280 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
281 -Wformat-y2k -Wframe-address @gol
282 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
283 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
284 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
285 -Wimplicit-function-declaration -Wimplicit-int @gol
286 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
287 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
288 -Winvalid-pch -Wlarger-than=@var{len} @gol
289 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
290 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
291 -Wmisleading-indentation -Wmissing-braces @gol
292 -Wmissing-field-initializers -Wmissing-include-dirs @gol
293 -Wno-multichar -Wnonnull -Wnonnull-compare @gol
294 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
295 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
296 -Woverride-init-side-effects -Woverlength-strings @gol
297 -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
298 -Wparentheses -Wno-pedantic-ms-format @gol
299 -Wplacement-new -Wplacement-new=@var{n} @gol
300 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
301 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
302 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
303 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
304 -Wshift-overflow -Wshift-overflow=@var{n} @gol
305 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
306 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
307 -Wno-scalar-storage-order @gol
308 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
309 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
310 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
311 -Wstringop-overflow=@var{n} @gol
312 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
313 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
314 -Wmissing-format-attribute -Wsubobject-linkage @gol
315 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
316 -Wswitch-unreachable -Wsync-nand @gol
317 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
318 -Wtype-limits -Wundef @gol
319 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
320 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
321 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
322 -Wunused-parameter -Wno-unused-result @gol
323 -Wunused-value -Wunused-variable @gol
324 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
325 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
326 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
327 -Wvla -Wvla-larger-than=@var{n} -Wvolatile-register-var -Wwrite-strings @gol
328 -Wzero-as-null-pointer-constant -Whsa}
329
330 @item C and Objective-C-only Warning Options
331 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
332 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
333 -Wold-style-declaration -Wold-style-definition @gol
334 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
335 -Wdeclaration-after-statement -Wpointer-sign}
336
337 @item Debugging Options
338 @xref{Debugging Options,,Options for Debugging Your Program}.
339 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
340 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
341 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
342 -gcolumn-info -gno-column-info @gol
343 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
344 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
345 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
346 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
347 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
348 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
349 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
350 -fvar-tracking -fvar-tracking-assignments}
351
352 @item Optimization Options
353 @xref{Optimize Options,,Options that Control Optimization}.
354 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
355 -falign-jumps[=@var{n}] @gol
356 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
357 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
358 -fauto-inc-dec -fbranch-probabilities @gol
359 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
360 -fbtr-bb-exclusive -fcaller-saves @gol
361 -fcombine-stack-adjustments -fconserve-stack @gol
362 -fcompare-elim -fcprop-registers -fcrossjumping @gol
363 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
364 -fcx-limited-range @gol
365 -fdata-sections -fdce -fdelayed-branch @gol
366 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
367 -fdevirtualize-at-ltrans -fdse @gol
368 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
369 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
370 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
371 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
372 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
373 -fif-conversion2 -findirect-inlining @gol
374 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
375 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
376 -fipa-bit-cp -fipa-vrp @gol
377 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
378 -fira-algorithm=@var{algorithm} @gol
379 -fira-region=@var{region} -fira-hoist-pressure @gol
380 -fira-loop-pressure -fno-ira-share-save-slots @gol
381 -fno-ira-share-spill-slots @gol
382 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
383 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
384 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
385 -floop-block -floop-interchange -floop-strip-mine @gol
386 -floop-unroll-and-jam -floop-nest-optimize @gol
387 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
388 -flto-partition=@var{alg} -fmerge-all-constants @gol
389 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
390 -fmove-loop-invariants -fno-branch-count-reg @gol
391 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
392 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
393 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
394 -fno-sched-spec -fno-signed-zeros @gol
395 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
396 -fomit-frame-pointer -foptimize-sibling-calls @gol
397 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
398 -fprefetch-loop-arrays @gol
399 -fprofile-correction @gol
400 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
401 -fprofile-reorder-functions @gol
402 -freciprocal-math -free -frename-registers -freorder-blocks @gol
403 -freorder-blocks-algorithm=@var{algorithm} @gol
404 -freorder-blocks-and-partition -freorder-functions @gol
405 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
406 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
407 -fsched-spec-load -fsched-spec-load-dangerous @gol
408 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
409 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
410 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
411 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
412 -fschedule-fusion @gol
413 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
414 -fselective-scheduling -fselective-scheduling2 @gol
415 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
416 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
417 -fsignaling-nans @gol
418 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
419 -fsplit-paths @gol
420 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
421 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
422 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
423 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
424 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
425 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
426 -ftree-loop-if-convert -ftree-loop-im @gol
427 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
428 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
429 -ftree-loop-vectorize @gol
430 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
431 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
432 -ftree-switch-conversion -ftree-tail-merge @gol
433 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
434 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
435 -funsafe-math-optimizations -funswitch-loops @gol
436 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
437 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
438 --param @var{name}=@var{value}
439 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
440
441 @item Program Instrumentation Options
442 @xref{Instrumentation Options,,Program Instrumentation Options}.
443 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
444 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
445 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
446 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
447 -fsanitize-undefined-trap-on-error -fbounds-check @gol
448 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
449 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
450 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
451 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
452 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
453 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
454 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
455 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
456 -fchkp-use-wrappers -fchkp-flexible-struct-trailing-arrays@gol
457 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
458 -fstack-protector-explicit -fstack-check @gol
459 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
460 -fno-stack-limit -fsplit-stack @gol
461 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
462 -fvtv-counts -fvtv-debug @gol
463 -finstrument-functions @gol
464 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
465 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
466
467 @item Preprocessor Options
468 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
469 @gccoptlist{-A@var{question}=@var{answer} @gol
470 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
471 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
472 -dD -dI -dM -dN -dU @gol
473 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
474 -fexec-charset=@var{charset} -fextended-identifiers @gol
475 -finput-charset=@var{charset} -fno-canonical-system-headers @gol
476 -fpch-deps -fpch-preprocess -fpreprocessed @gol
477 -ftabstop=@var{width} -ftrack-macro-expansion @gol
478 -fwide-exec-charset=@var{charset} -fworking-directory @gol
479 -H -imacros @var{file} -include @var{file} @gol
480 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
481 -no-integrated-cpp -P -pthread -remap @gol
482 -traditional -traditional-cpp -trigraphs @gol
483 -U@var{macro} -undef @gol
484 -Wp,@var{option} -Xpreprocessor @var{option}}
485
486 @item Assembler Options
487 @xref{Assembler Options,,Passing Options to the Assembler}.
488 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
489
490 @item Linker Options
491 @xref{Link Options,,Options for Linking}.
492 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
493 -nostartfiles -nodefaultlibs -nostdlib -pie -pthread -rdynamic @gol
494 -s -static -static-libgcc -static-libstdc++ @gol
495 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
496 -static-libmpx -static-libmpxwrappers @gol
497 -shared -shared-libgcc -symbolic @gol
498 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
499 -u @var{symbol} -z @var{keyword}}
500
501 @item Directory Options
502 @xref{Directory Options,,Options for Directory Search}.
503 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
504 -idirafter @var{dir} @gol
505 -imacros @var{file} -imultilib @var{dir} @gol
506 -iplugindir=@var{dir} -iprefix @var{file} @gol
507 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
508 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
509 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
510 -nostdinc -nostdinc++ --sysroot=@var{dir}}
511
512 @item Code Generation Options
513 @xref{Code Gen Options,,Options for Code Generation Conventions}.
514 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
515 -ffixed-@var{reg} -fexceptions @gol
516 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
517 -fasynchronous-unwind-tables @gol
518 -fno-gnu-unique @gol
519 -finhibit-size-directive -fno-common -fno-ident @gol
520 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
521 -fno-jump-tables @gol
522 -frecord-gcc-switches @gol
523 -freg-struct-return -fshort-enums -fshort-wchar @gol
524 -fverbose-asm -fpack-struct[=@var{n}] @gol
525 -fleading-underscore -ftls-model=@var{model} @gol
526 -fstack-reuse=@var{reuse_level} @gol
527 -ftrampolines -ftrapv -fwrapv @gol
528 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
529 -fstrict-volatile-bitfields -fsync-libcalls}
530
531 @item Developer Options
532 @xref{Developer Options,,GCC Developer Options}.
533 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
534 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
535 -fdbg-cnt=@var{counter-value-list} @gol
536 -fdisable-ipa-@var{pass_name} @gol
537 -fdisable-rtl-@var{pass_name} @gol
538 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
539 -fdisable-tree-@var{pass_name} @gol
540 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
541 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
542 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
543 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
544 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
545 -fdump-passes @gol
546 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
547 -fdump-statistics @gol
548 -fdump-final-insns@r{[}=@var{file}@r{]}
549 -fdump-tree-all @gol
550 -fdump-tree-@var{switch} @gol
551 -fdump-tree-@var{switch}-@var{options} @gol
552 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
553 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
554 -fenable-@var{kind}-@var{pass} @gol
555 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
556 -fira-verbose=@var{n} @gol
557 -flto-report -flto-report-wpa -fmem-report-wpa @gol
558 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
559 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
560 -fprofile-report @gol
561 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
562 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
563 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
564 -fvar-tracking-assignments-toggle -gtoggle @gol
565 -print-file-name=@var{library} -print-libgcc-file-name @gol
566 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
567 -print-prog-name=@var{program} -print-search-dirs -Q @gol
568 -print-sysroot -print-sysroot-headers-suffix @gol
569 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
570
571 @item Machine-Dependent Options
572 @xref{Submodel Options,,Machine-Dependent Options}.
573 @c This list is ordered alphanumerically by subsection name.
574 @c Try and put the significant identifier (CPU or system) first,
575 @c so users have a clue at guessing where the ones they want will be.
576
577 @emph{AArch64 Options}
578 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
579 -mgeneral-regs-only @gol
580 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
581 -mstrict-align @gol
582 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
583 -mtls-dialect=desc -mtls-dialect=traditional @gol
584 -mtls-size=@var{size} @gol
585 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
586 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol
587 -mlow-precision-recip-sqrt -mno-low-precision-recip-sqrt@gol
588 -mlow-precision-sqrt -mno-low-precision-sqrt@gol
589 -mlow-precision-div -mno-low-precision-div @gol
590 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
591
592 @emph{Adapteva Epiphany Options}
593 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
594 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
595 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
596 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
597 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
598 -msplit-vecmove-early -m1reg-@var{reg}}
599
600 @emph{ARC Options}
601 @gccoptlist{-mbarrel-shifter @gol
602 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
603 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
604 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
605 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
606 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
607 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
608 -mlong-calls -mmedium-calls -msdata @gol
609 -mvolatile-cache -mtp-regno=@var{regno} @gol
610 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
611 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
612 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
613 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
614 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
615 -mtune=@var{cpu} -mmultcost=@var{num} @gol
616 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
617 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
618
619 @emph{ARM Options}
620 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
621 -mabi=@var{name} @gol
622 -mapcs-stack-check -mno-apcs-stack-check @gol
623 -mapcs-reentrant -mno-apcs-reentrant @gol
624 -msched-prolog -mno-sched-prolog @gol
625 -mlittle-endian -mbig-endian @gol
626 -mfloat-abi=@var{name} @gol
627 -mfp16-format=@var{name}
628 -mthumb-interwork -mno-thumb-interwork @gol
629 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
630 -mtune=@var{name} -mprint-tune-info @gol
631 -mstructure-size-boundary=@var{n} @gol
632 -mabort-on-noreturn @gol
633 -mlong-calls -mno-long-calls @gol
634 -msingle-pic-base -mno-single-pic-base @gol
635 -mpic-register=@var{reg} @gol
636 -mnop-fun-dllimport @gol
637 -mpoke-function-name @gol
638 -mthumb -marm @gol
639 -mtpcs-frame -mtpcs-leaf-frame @gol
640 -mcaller-super-interworking -mcallee-super-interworking @gol
641 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
642 -mword-relocations @gol
643 -mfix-cortex-m3-ldrd @gol
644 -munaligned-access @gol
645 -mneon-for-64bits @gol
646 -mslow-flash-data @gol
647 -masm-syntax-unified @gol
648 -mrestrict-it @gol
649 -mpure-code @gol
650 -mcmse}
651
652 @emph{AVR Options}
653 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
654 -mbranch-cost=@var{cost} @gol
655 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
656 -mrelax -mrmw -mstrict-X -mtiny-stack -mfract-convert-truncate @gol
657 -nodevicelib @gol
658 -Waddr-space-convert -Wmisspelled-isr}
659
660 @emph{Blackfin Options}
661 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
662 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
663 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
664 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
665 -mno-id-shared-library -mshared-library-id=@var{n} @gol
666 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
667 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
668 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
669 -micplb}
670
671 @emph{C6X Options}
672 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
673 -msim -msdata=@var{sdata-type}}
674
675 @emph{CRIS Options}
676 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
677 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
678 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
679 -mstack-align -mdata-align -mconst-align @gol
680 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
681 -melf -maout -melinux -mlinux -sim -sim2 @gol
682 -mmul-bug-workaround -mno-mul-bug-workaround}
683
684 @emph{CR16 Options}
685 @gccoptlist{-mmac @gol
686 -mcr16cplus -mcr16c @gol
687 -msim -mint32 -mbit-ops
688 -mdata-model=@var{model}}
689
690 @emph{Darwin Options}
691 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
692 -arch_only -bind_at_load -bundle -bundle_loader @gol
693 -client_name -compatibility_version -current_version @gol
694 -dead_strip @gol
695 -dependency-file -dylib_file -dylinker_install_name @gol
696 -dynamic -dynamiclib -exported_symbols_list @gol
697 -filelist -flat_namespace -force_cpusubtype_ALL @gol
698 -force_flat_namespace -headerpad_max_install_names @gol
699 -iframework @gol
700 -image_base -init -install_name -keep_private_externs @gol
701 -multi_module -multiply_defined -multiply_defined_unused @gol
702 -noall_load -no_dead_strip_inits_and_terms @gol
703 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
704 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
705 -private_bundle -read_only_relocs -sectalign @gol
706 -sectobjectsymbols -whyload -seg1addr @gol
707 -sectcreate -sectobjectsymbols -sectorder @gol
708 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
709 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
710 -segprot -segs_read_only_addr -segs_read_write_addr @gol
711 -single_module -static -sub_library -sub_umbrella @gol
712 -twolevel_namespace -umbrella -undefined @gol
713 -unexported_symbols_list -weak_reference_mismatches @gol
714 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
715 -mkernel -mone-byte-bool}
716
717 @emph{DEC Alpha Options}
718 @gccoptlist{-mno-fp-regs -msoft-float @gol
719 -mieee -mieee-with-inexact -mieee-conformant @gol
720 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
721 -mtrap-precision=@var{mode} -mbuild-constants @gol
722 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
723 -mbwx -mmax -mfix -mcix @gol
724 -mfloat-vax -mfloat-ieee @gol
725 -mexplicit-relocs -msmall-data -mlarge-data @gol
726 -msmall-text -mlarge-text @gol
727 -mmemory-latency=@var{time}}
728
729 @emph{FR30 Options}
730 @gccoptlist{-msmall-model -mno-lsim}
731
732 @emph{FT32 Options}
733 @gccoptlist{-msim -mlra -mnodiv}
734
735 @emph{FRV Options}
736 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
737 -mhard-float -msoft-float @gol
738 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
739 -mdouble -mno-double @gol
740 -mmedia -mno-media -mmuladd -mno-muladd @gol
741 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
742 -mlinked-fp -mlong-calls -malign-labels @gol
743 -mlibrary-pic -macc-4 -macc-8 @gol
744 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
745 -moptimize-membar -mno-optimize-membar @gol
746 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
747 -mvliw-branch -mno-vliw-branch @gol
748 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
749 -mno-nested-cond-exec -mtomcat-stats @gol
750 -mTLS -mtls @gol
751 -mcpu=@var{cpu}}
752
753 @emph{GNU/Linux Options}
754 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
755 -tno-android-cc -tno-android-ld}
756
757 @emph{H8/300 Options}
758 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
759
760 @emph{HPPA Options}
761 @gccoptlist{-march=@var{architecture-type} @gol
762 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
763 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
764 -mfixed-range=@var{register-range} @gol
765 -mjump-in-delay -mlinker-opt -mlong-calls @gol
766 -mlong-load-store -mno-disable-fpregs @gol
767 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
768 -mno-jump-in-delay -mno-long-load-store @gol
769 -mno-portable-runtime -mno-soft-float @gol
770 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
771 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
772 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
773 -munix=@var{unix-std} -nolibdld -static -threads}
774
775 @emph{IA-64 Options}
776 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
777 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
778 -mconstant-gp -mauto-pic -mfused-madd @gol
779 -minline-float-divide-min-latency @gol
780 -minline-float-divide-max-throughput @gol
781 -mno-inline-float-divide @gol
782 -minline-int-divide-min-latency @gol
783 -minline-int-divide-max-throughput @gol
784 -mno-inline-int-divide @gol
785 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
786 -mno-inline-sqrt @gol
787 -mdwarf2-asm -mearly-stop-bits @gol
788 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
789 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
790 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
791 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
792 -msched-spec-ldc -msched-spec-control-ldc @gol
793 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
794 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
795 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
796 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
797
798 @emph{LM32 Options}
799 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
800 -msign-extend-enabled -muser-enabled}
801
802 @emph{M32R/D Options}
803 @gccoptlist{-m32r2 -m32rx -m32r @gol
804 -mdebug @gol
805 -malign-loops -mno-align-loops @gol
806 -missue-rate=@var{number} @gol
807 -mbranch-cost=@var{number} @gol
808 -mmodel=@var{code-size-model-type} @gol
809 -msdata=@var{sdata-type} @gol
810 -mno-flush-func -mflush-func=@var{name} @gol
811 -mno-flush-trap -mflush-trap=@var{number} @gol
812 -G @var{num}}
813
814 @emph{M32C Options}
815 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
816
817 @emph{M680x0 Options}
818 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
819 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
820 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
821 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
822 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
823 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
824 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
825 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
826 -mxgot -mno-xgot -mlong-jump-table-offsets}
827
828 @emph{MCore Options}
829 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
830 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
831 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
832 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
833 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
834
835 @emph{MeP Options}
836 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
837 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
838 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
839 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
840 -mtiny=@var{n}}
841
842 @emph{MicroBlaze Options}
843 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
844 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
845 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
846 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
847 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
848
849 @emph{MIPS Options}
850 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
851 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
852 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
853 -mips16 -mno-mips16 -mflip-mips16 @gol
854 -minterlink-compressed -mno-interlink-compressed @gol
855 -minterlink-mips16 -mno-interlink-mips16 @gol
856 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
857 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
858 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
859 -mno-float -msingle-float -mdouble-float @gol
860 -modd-spreg -mno-odd-spreg @gol
861 -mabs=@var{mode} -mnan=@var{encoding} @gol
862 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
863 -mmcu -mmno-mcu @gol
864 -meva -mno-eva @gol
865 -mvirt -mno-virt @gol
866 -mxpa -mno-xpa @gol
867 -mmicromips -mno-micromips @gol
868 -mmsa -mno-msa @gol
869 -mfpu=@var{fpu-type} @gol
870 -msmartmips -mno-smartmips @gol
871 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
872 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
873 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
874 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
875 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
876 -membedded-data -mno-embedded-data @gol
877 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
878 -mcode-readable=@var{setting} @gol
879 -msplit-addresses -mno-split-addresses @gol
880 -mexplicit-relocs -mno-explicit-relocs @gol
881 -mcheck-zero-division -mno-check-zero-division @gol
882 -mdivide-traps -mdivide-breaks @gol
883 -mload-store-pairs -mno-load-store-pairs @gol
884 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
885 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
886 -mfix-24k -mno-fix-24k @gol
887 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
888 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
889 -mfix-vr4120 -mno-fix-vr4120 @gol
890 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
891 -mflush-func=@var{func} -mno-flush-func @gol
892 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
893 -mcompact-branches=@var{policy} @gol
894 -mfp-exceptions -mno-fp-exceptions @gol
895 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
896 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
897 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
898 -mframe-header-opt -mno-frame-header-opt}
899
900 @emph{MMIX Options}
901 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
902 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
903 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
904 -mno-base-addresses -msingle-exit -mno-single-exit}
905
906 @emph{MN10300 Options}
907 @gccoptlist{-mmult-bug -mno-mult-bug @gol
908 -mno-am33 -mam33 -mam33-2 -mam34 @gol
909 -mtune=@var{cpu-type} @gol
910 -mreturn-pointer-on-d0 @gol
911 -mno-crt0 -mrelax -mliw -msetlb}
912
913 @emph{Moxie Options}
914 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
915
916 @emph{MSP430 Options}
917 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
918 -mwarn-mcu @gol
919 -mcode-region= -mdata-region= @gol
920 -msilicon-errata= -msilicon-errata-warn= @gol
921 -mhwmult= -minrt}
922
923 @emph{NDS32 Options}
924 @gccoptlist{-mbig-endian -mlittle-endian @gol
925 -mreduced-regs -mfull-regs @gol
926 -mcmov -mno-cmov @gol
927 -mperf-ext -mno-perf-ext @gol
928 -mv3push -mno-v3push @gol
929 -m16bit -mno-16bit @gol
930 -misr-vector-size=@var{num} @gol
931 -mcache-block-size=@var{num} @gol
932 -march=@var{arch} @gol
933 -mcmodel=@var{code-model} @gol
934 -mctor-dtor -mrelax}
935
936 @emph{Nios II Options}
937 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
938 -mel -meb @gol
939 -mno-bypass-cache -mbypass-cache @gol
940 -mno-cache-volatile -mcache-volatile @gol
941 -mno-fast-sw-div -mfast-sw-div @gol
942 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
943 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
944 -mcustom-fpu-cfg=@var{name} @gol
945 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
946 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
947
948 @emph{Nvidia PTX Options}
949 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
950
951 @emph{PDP-11 Options}
952 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
953 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
954 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
955 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
956 -mbranch-expensive -mbranch-cheap @gol
957 -munix-asm -mdec-asm}
958
959 @emph{picoChip Options}
960 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
961 -msymbol-as-address -mno-inefficient-warnings}
962
963 @emph{PowerPC Options}
964 See RS/6000 and PowerPC Options.
965
966 @emph{RISC-V Options}
967 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
968 -mmemcpy -mno-memcpy @gol
969 -mplt -mno-plt @gol
970 -mabi=@var{ABI-string} @gol
971 -mfdiv -mno-fdiv @gol
972 -mdiv -mno-div @gol
973 -march=@var{ISA-string} @gol
974 -mtune=@var{processor-string} @gol
975 -msmall-data-limit=@var{N-bytes} @gol
976 -msave-restore -mno-save-restore @gol
977 -mcmodel=@var{code-model} @gol
978 -mexplicit-relocs -mno-explicit-relocs @gol}
979
980 @emph{RL78 Options}
981 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
982 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
983 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
984
985 @emph{RS/6000 and PowerPC Options}
986 @gccoptlist{-mcpu=@var{cpu-type} @gol
987 -mtune=@var{cpu-type} @gol
988 -mcmodel=@var{code-model} @gol
989 -mpowerpc64 @gol
990 -maltivec -mno-altivec @gol
991 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
992 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
993 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
994 -mfprnd -mno-fprnd @gol
995 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
996 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
997 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
998 -malign-power -malign-natural @gol
999 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1000 -msingle-float -mdouble-float -msimple-fpu @gol
1001 -mstring -mno-string -mupdate -mno-update @gol
1002 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1003 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1004 -mstrict-align -mno-strict-align -mrelocatable @gol
1005 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1006 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1007 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1008 -mprioritize-restricted-insns=@var{priority} @gol
1009 -msched-costly-dep=@var{dependence_type} @gol
1010 -minsert-sched-nops=@var{scheme} @gol
1011 -mcall-sysv -mcall-netbsd @gol
1012 -maix-struct-return -msvr4-struct-return @gol
1013 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1014 -mblock-move-inline-limit=@var{num} @gol
1015 -misel -mno-isel @gol
1016 -misel=yes -misel=no @gol
1017 -mspe -mno-spe @gol
1018 -mspe=yes -mspe=no @gol
1019 -mpaired @gol
1020 -mgen-cell-microcode -mwarn-cell-microcode @gol
1021 -mvrsave -mno-vrsave @gol
1022 -mmulhw -mno-mulhw @gol
1023 -mdlmzb -mno-dlmzb @gol
1024 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1025 -mprototype -mno-prototype @gol
1026 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1027 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1028 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1029 -mno-recip-precision @gol
1030 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1031 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1032 -msave-toc-indirect -mno-save-toc-indirect @gol
1033 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1034 -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol
1035 -mquad-memory -mno-quad-memory @gol
1036 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1037 -mcompat-align-parm -mno-compat-align-parm @gol
1038 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
1039 -mupper-regs-di -mno-upper-regs-di @gol
1040 -mupper-regs -mno-upper-regs @gol
1041 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1042 -mgnu-attribute -mno-gnu-attribute @gol
1043 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1044 -mstack-protector-guard-offset=@var{offset} @gol
1045 -mlra -mno-lra}
1046
1047 @emph{RX Options}
1048 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1049 -mcpu=@gol
1050 -mbig-endian-data -mlittle-endian-data @gol
1051 -msmall-data @gol
1052 -msim -mno-sim@gol
1053 -mas100-syntax -mno-as100-syntax@gol
1054 -mrelax@gol
1055 -mmax-constant-size=@gol
1056 -mint-register=@gol
1057 -mpid@gol
1058 -mallow-string-insns -mno-allow-string-insns@gol
1059 -mjsr@gol
1060 -mno-warn-multiple-fast-interrupts@gol
1061 -msave-acc-in-interrupts}
1062
1063 @emph{S/390 and zSeries Options}
1064 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1065 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1066 -mlong-double-64 -mlong-double-128 @gol
1067 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1068 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1069 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1070 -mhtm -mvx -mzvector @gol
1071 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1072 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1073 -mhotpatch=@var{halfwords},@var{halfwords}}
1074
1075 @emph{Score Options}
1076 @gccoptlist{-meb -mel @gol
1077 -mnhwloop @gol
1078 -muls @gol
1079 -mmac @gol
1080 -mscore5 -mscore5u -mscore7 -mscore7d}
1081
1082 @emph{SH Options}
1083 @gccoptlist{-m1 -m2 -m2e @gol
1084 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1085 -m3 -m3e @gol
1086 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1087 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1088 -mb -ml -mdalign -mrelax @gol
1089 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1090 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1091 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1092 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1093 -maccumulate-outgoing-args @gol
1094 -matomic-model=@var{atomic-model} @gol
1095 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1096 -mcbranch-force-delay-slot @gol
1097 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1098 -mpretend-cmove -mtas}
1099
1100 @emph{Solaris 2 Options}
1101 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1102 -pthreads}
1103
1104 @emph{SPARC Options}
1105 @gccoptlist{-mcpu=@var{cpu-type} @gol
1106 -mtune=@var{cpu-type} @gol
1107 -mcmodel=@var{code-model} @gol
1108 -mmemory-model=@var{mem-model} @gol
1109 -m32 -m64 -mapp-regs -mno-app-regs @gol
1110 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1111 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1112 -mhard-quad-float -msoft-quad-float @gol
1113 -mstack-bias -mno-stack-bias @gol
1114 -mstd-struct-return -mno-std-struct-return @gol
1115 -munaligned-doubles -mno-unaligned-doubles @gol
1116 -muser-mode -mno-user-mode @gol
1117 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1118 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1119 -mcbcond -mno-cbcond -mfmaf -mno-fmaf @gol
1120 -mpopc -mno-popc -msubxc -mno-subxc@gol
1121 -mfix-at697f -mfix-ut699 @gol
1122 -mlra -mno-lra}
1123
1124 @emph{SPU Options}
1125 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1126 -msafe-dma -munsafe-dma @gol
1127 -mbranch-hints @gol
1128 -msmall-mem -mlarge-mem -mstdmain @gol
1129 -mfixed-range=@var{register-range} @gol
1130 -mea32 -mea64 @gol
1131 -maddress-space-conversion -mno-address-space-conversion @gol
1132 -mcache-size=@var{cache-size} @gol
1133 -matomic-updates -mno-atomic-updates}
1134
1135 @emph{System V Options}
1136 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1137
1138 @emph{TILE-Gx Options}
1139 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1140 -mcmodel=@var{code-model}}
1141
1142 @emph{TILEPro Options}
1143 @gccoptlist{-mcpu=@var{cpu} -m32}
1144
1145 @emph{V850 Options}
1146 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1147 -mprolog-function -mno-prolog-function -mspace @gol
1148 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1149 -mapp-regs -mno-app-regs @gol
1150 -mdisable-callt -mno-disable-callt @gol
1151 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1152 -mv850e -mv850 -mv850e3v5 @gol
1153 -mloop @gol
1154 -mrelax @gol
1155 -mlong-jumps @gol
1156 -msoft-float @gol
1157 -mhard-float @gol
1158 -mgcc-abi @gol
1159 -mrh850-abi @gol
1160 -mbig-switch}
1161
1162 @emph{VAX Options}
1163 @gccoptlist{-mg -mgnu -munix}
1164
1165 @emph{Visium Options}
1166 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1167 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1168
1169 @emph{VMS Options}
1170 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1171 -mpointer-size=@var{size}}
1172
1173 @emph{VxWorks Options}
1174 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1175 -Xbind-lazy -Xbind-now}
1176
1177 @emph{x86 Options}
1178 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1179 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1180 -mfpmath=@var{unit} @gol
1181 -masm=@var{dialect} -mno-fancy-math-387 @gol
1182 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1183 -mno-wide-multiply -mrtd -malign-double @gol
1184 -mpreferred-stack-boundary=@var{num} @gol
1185 -mincoming-stack-boundary=@var{num} @gol
1186 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1187 -mrecip -mrecip=@var{opt} @gol
1188 -mvzeroupper -mprefer-avx128 @gol
1189 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1190 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1191 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1192 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1193 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1194 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1195 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx @gol
1196 -mmwaitx -mclzero -mpku -mthreads @gol
1197 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1198 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1199 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1200 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1201 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1202 -mregparm=@var{num} -msseregparm @gol
1203 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1204 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1205 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1206 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1207 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1208 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1209 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1210 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1211 -mmitigate-rop -mgeneral-regs-only}
1212
1213 @emph{x86 Windows Options}
1214 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1215 -mnop-fun-dllimport -mthread @gol
1216 -municode -mwin32 -mwindows -fno-set-stack-executable}
1217
1218 @emph{Xstormy16 Options}
1219 @gccoptlist{-msim}
1220
1221 @emph{Xtensa Options}
1222 @gccoptlist{-mconst16 -mno-const16 @gol
1223 -mfused-madd -mno-fused-madd @gol
1224 -mforce-no-pic @gol
1225 -mserialize-volatile -mno-serialize-volatile @gol
1226 -mtext-section-literals -mno-text-section-literals @gol
1227 -mauto-litpools -mno-auto-litpools @gol
1228 -mtarget-align -mno-target-align @gol
1229 -mlongcalls -mno-longcalls}
1230
1231 @emph{zSeries Options}
1232 See S/390 and zSeries Options.
1233 @end table
1234
1235
1236 @node Overall Options
1237 @section Options Controlling the Kind of Output
1238
1239 Compilation can involve up to four stages: preprocessing, compilation
1240 proper, assembly and linking, always in that order. GCC is capable of
1241 preprocessing and compiling several files either into several
1242 assembler input files, or into one assembler input file; then each
1243 assembler input file produces an object file, and linking combines all
1244 the object files (those newly compiled, and those specified as input)
1245 into an executable file.
1246
1247 @cindex file name suffix
1248 For any given input file, the file name suffix determines what kind of
1249 compilation is done:
1250
1251 @table @gcctabopt
1252 @item @var{file}.c
1253 C source code that must be preprocessed.
1254
1255 @item @var{file}.i
1256 C source code that should not be preprocessed.
1257
1258 @item @var{file}.ii
1259 C++ source code that should not be preprocessed.
1260
1261 @item @var{file}.m
1262 Objective-C source code. Note that you must link with the @file{libobjc}
1263 library to make an Objective-C program work.
1264
1265 @item @var{file}.mi
1266 Objective-C source code that should not be preprocessed.
1267
1268 @item @var{file}.mm
1269 @itemx @var{file}.M
1270 Objective-C++ source code. Note that you must link with the @file{libobjc}
1271 library to make an Objective-C++ program work. Note that @samp{.M} refers
1272 to a literal capital M@.
1273
1274 @item @var{file}.mii
1275 Objective-C++ source code that should not be preprocessed.
1276
1277 @item @var{file}.h
1278 C, C++, Objective-C or Objective-C++ header file to be turned into a
1279 precompiled header (default), or C, C++ header file to be turned into an
1280 Ada spec (via the @option{-fdump-ada-spec} switch).
1281
1282 @item @var{file}.cc
1283 @itemx @var{file}.cp
1284 @itemx @var{file}.cxx
1285 @itemx @var{file}.cpp
1286 @itemx @var{file}.CPP
1287 @itemx @var{file}.c++
1288 @itemx @var{file}.C
1289 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1290 the last two letters must both be literally @samp{x}. Likewise,
1291 @samp{.C} refers to a literal capital C@.
1292
1293 @item @var{file}.mm
1294 @itemx @var{file}.M
1295 Objective-C++ source code that must be preprocessed.
1296
1297 @item @var{file}.mii
1298 Objective-C++ source code that should not be preprocessed.
1299
1300 @item @var{file}.hh
1301 @itemx @var{file}.H
1302 @itemx @var{file}.hp
1303 @itemx @var{file}.hxx
1304 @itemx @var{file}.hpp
1305 @itemx @var{file}.HPP
1306 @itemx @var{file}.h++
1307 @itemx @var{file}.tcc
1308 C++ header file to be turned into a precompiled header or Ada spec.
1309
1310 @item @var{file}.f
1311 @itemx @var{file}.for
1312 @itemx @var{file}.ftn
1313 Fixed form Fortran source code that should not be preprocessed.
1314
1315 @item @var{file}.F
1316 @itemx @var{file}.FOR
1317 @itemx @var{file}.fpp
1318 @itemx @var{file}.FPP
1319 @itemx @var{file}.FTN
1320 Fixed form Fortran source code that must be preprocessed (with the traditional
1321 preprocessor).
1322
1323 @item @var{file}.f90
1324 @itemx @var{file}.f95
1325 @itemx @var{file}.f03
1326 @itemx @var{file}.f08
1327 Free form Fortran source code that should not be preprocessed.
1328
1329 @item @var{file}.F90
1330 @itemx @var{file}.F95
1331 @itemx @var{file}.F03
1332 @itemx @var{file}.F08
1333 Free form Fortran source code that must be preprocessed (with the
1334 traditional preprocessor).
1335
1336 @item @var{file}.go
1337 Go source code.
1338
1339 @item @var{file}.brig
1340 BRIG files (binary representation of HSAIL).
1341
1342 @item @var{file}.ads
1343 Ada source code file that contains a library unit declaration (a
1344 declaration of a package, subprogram, or generic, or a generic
1345 instantiation), or a library unit renaming declaration (a package,
1346 generic, or subprogram renaming declaration). Such files are also
1347 called @dfn{specs}.
1348
1349 @item @var{file}.adb
1350 Ada source code file containing a library unit body (a subprogram or
1351 package body). Such files are also called @dfn{bodies}.
1352
1353 @c GCC also knows about some suffixes for languages not yet included:
1354 @c Pascal:
1355 @c @var{file}.p
1356 @c @var{file}.pas
1357 @c Ratfor:
1358 @c @var{file}.r
1359
1360 @item @var{file}.s
1361 Assembler code.
1362
1363 @item @var{file}.S
1364 @itemx @var{file}.sx
1365 Assembler code that must be preprocessed.
1366
1367 @item @var{other}
1368 An object file to be fed straight into linking.
1369 Any file name with no recognized suffix is treated this way.
1370 @end table
1371
1372 @opindex x
1373 You can specify the input language explicitly with the @option{-x} option:
1374
1375 @table @gcctabopt
1376 @item -x @var{language}
1377 Specify explicitly the @var{language} for the following input files
1378 (rather than letting the compiler choose a default based on the file
1379 name suffix). This option applies to all following input files until
1380 the next @option{-x} option. Possible values for @var{language} are:
1381 @smallexample
1382 c c-header cpp-output
1383 c++ c++-header c++-cpp-output
1384 objective-c objective-c-header objective-c-cpp-output
1385 objective-c++ objective-c++-header objective-c++-cpp-output
1386 assembler assembler-with-cpp
1387 ada
1388 f77 f77-cpp-input f95 f95-cpp-input
1389 go
1390 brig
1391 @end smallexample
1392
1393 @item -x none
1394 Turn off any specification of a language, so that subsequent files are
1395 handled according to their file name suffixes (as they are if @option{-x}
1396 has not been used at all).
1397 @end table
1398
1399 If you only want some of the stages of compilation, you can use
1400 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1401 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1402 @command{gcc} is to stop. Note that some combinations (for example,
1403 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1404
1405 @table @gcctabopt
1406 @item -c
1407 @opindex c
1408 Compile or assemble the source files, but do not link. The linking
1409 stage simply is not done. The ultimate output is in the form of an
1410 object file for each source file.
1411
1412 By default, the object file name for a source file is made by replacing
1413 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1414
1415 Unrecognized input files, not requiring compilation or assembly, are
1416 ignored.
1417
1418 @item -S
1419 @opindex S
1420 Stop after the stage of compilation proper; do not assemble. The output
1421 is in the form of an assembler code file for each non-assembler input
1422 file specified.
1423
1424 By default, the assembler file name for a source file is made by
1425 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1426
1427 Input files that don't require compilation are ignored.
1428
1429 @item -E
1430 @opindex E
1431 Stop after the preprocessing stage; do not run the compiler proper. The
1432 output is in the form of preprocessed source code, which is sent to the
1433 standard output.
1434
1435 Input files that don't require preprocessing are ignored.
1436
1437 @cindex output file option
1438 @item -o @var{file}
1439 @opindex o
1440 Place output in file @var{file}. This applies to whatever
1441 sort of output is being produced, whether it be an executable file,
1442 an object file, an assembler file or preprocessed C code.
1443
1444 If @option{-o} is not specified, the default is to put an executable
1445 file in @file{a.out}, the object file for
1446 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1447 assembler file in @file{@var{source}.s}, a precompiled header file in
1448 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1449 standard output.
1450
1451 @item -v
1452 @opindex v
1453 Print (on standard error output) the commands executed to run the stages
1454 of compilation. Also print the version number of the compiler driver
1455 program and of the preprocessor and the compiler proper.
1456
1457 @item -###
1458 @opindex ###
1459 Like @option{-v} except the commands are not executed and arguments
1460 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1461 This is useful for shell scripts to capture the driver-generated command lines.
1462
1463 @item --help
1464 @opindex help
1465 Print (on the standard output) a description of the command-line options
1466 understood by @command{gcc}. If the @option{-v} option is also specified
1467 then @option{--help} is also passed on to the various processes
1468 invoked by @command{gcc}, so that they can display the command-line options
1469 they accept. If the @option{-Wextra} option has also been specified
1470 (prior to the @option{--help} option), then command-line options that
1471 have no documentation associated with them are also displayed.
1472
1473 @item --target-help
1474 @opindex target-help
1475 Print (on the standard output) a description of target-specific command-line
1476 options for each tool. For some targets extra target-specific
1477 information may also be printed.
1478
1479 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1480 Print (on the standard output) a description of the command-line
1481 options understood by the compiler that fit into all specified classes
1482 and qualifiers. These are the supported classes:
1483
1484 @table @asis
1485 @item @samp{optimizers}
1486 Display all of the optimization options supported by the
1487 compiler.
1488
1489 @item @samp{warnings}
1490 Display all of the options controlling warning messages
1491 produced by the compiler.
1492
1493 @item @samp{target}
1494 Display target-specific options. Unlike the
1495 @option{--target-help} option however, target-specific options of the
1496 linker and assembler are not displayed. This is because those
1497 tools do not currently support the extended @option{--help=} syntax.
1498
1499 @item @samp{params}
1500 Display the values recognized by the @option{--param}
1501 option.
1502
1503 @item @var{language}
1504 Display the options supported for @var{language}, where
1505 @var{language} is the name of one of the languages supported in this
1506 version of GCC@.
1507
1508 @item @samp{common}
1509 Display the options that are common to all languages.
1510 @end table
1511
1512 These are the supported qualifiers:
1513
1514 @table @asis
1515 @item @samp{undocumented}
1516 Display only those options that are undocumented.
1517
1518 @item @samp{joined}
1519 Display options taking an argument that appears after an equal
1520 sign in the same continuous piece of text, such as:
1521 @samp{--help=target}.
1522
1523 @item @samp{separate}
1524 Display options taking an argument that appears as a separate word
1525 following the original option, such as: @samp{-o output-file}.
1526 @end table
1527
1528 Thus for example to display all the undocumented target-specific
1529 switches supported by the compiler, use:
1530
1531 @smallexample
1532 --help=target,undocumented
1533 @end smallexample
1534
1535 The sense of a qualifier can be inverted by prefixing it with the
1536 @samp{^} character, so for example to display all binary warning
1537 options (i.e., ones that are either on or off and that do not take an
1538 argument) that have a description, use:
1539
1540 @smallexample
1541 --help=warnings,^joined,^undocumented
1542 @end smallexample
1543
1544 The argument to @option{--help=} should not consist solely of inverted
1545 qualifiers.
1546
1547 Combining several classes is possible, although this usually
1548 restricts the output so much that there is nothing to display. One
1549 case where it does work, however, is when one of the classes is
1550 @var{target}. For example, to display all the target-specific
1551 optimization options, use:
1552
1553 @smallexample
1554 --help=target,optimizers
1555 @end smallexample
1556
1557 The @option{--help=} option can be repeated on the command line. Each
1558 successive use displays its requested class of options, skipping
1559 those that have already been displayed.
1560
1561 If the @option{-Q} option appears on the command line before the
1562 @option{--help=} option, then the descriptive text displayed by
1563 @option{--help=} is changed. Instead of describing the displayed
1564 options, an indication is given as to whether the option is enabled,
1565 disabled or set to a specific value (assuming that the compiler
1566 knows this at the point where the @option{--help=} option is used).
1567
1568 Here is a truncated example from the ARM port of @command{gcc}:
1569
1570 @smallexample
1571 % gcc -Q -mabi=2 --help=target -c
1572 The following options are target specific:
1573 -mabi= 2
1574 -mabort-on-noreturn [disabled]
1575 -mapcs [disabled]
1576 @end smallexample
1577
1578 The output is sensitive to the effects of previous command-line
1579 options, so for example it is possible to find out which optimizations
1580 are enabled at @option{-O2} by using:
1581
1582 @smallexample
1583 -Q -O2 --help=optimizers
1584 @end smallexample
1585
1586 Alternatively you can discover which binary optimizations are enabled
1587 by @option{-O3} by using:
1588
1589 @smallexample
1590 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1591 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1592 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1593 @end smallexample
1594
1595 @item --version
1596 @opindex version
1597 Display the version number and copyrights of the invoked GCC@.
1598
1599 @item -pass-exit-codes
1600 @opindex pass-exit-codes
1601 Normally the @command{gcc} program exits with the code of 1 if any
1602 phase of the compiler returns a non-success return code. If you specify
1603 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1604 the numerically highest error produced by any phase returning an error
1605 indication. The C, C++, and Fortran front ends return 4 if an internal
1606 compiler error is encountered.
1607
1608 @item -pipe
1609 @opindex pipe
1610 Use pipes rather than temporary files for communication between the
1611 various stages of compilation. This fails to work on some systems where
1612 the assembler is unable to read from a pipe; but the GNU assembler has
1613 no trouble.
1614
1615 @item -specs=@var{file}
1616 @opindex specs
1617 Process @var{file} after the compiler reads in the standard @file{specs}
1618 file, in order to override the defaults which the @command{gcc} driver
1619 program uses when determining what switches to pass to @command{cc1},
1620 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1621 @option{-specs=@var{file}} can be specified on the command line, and they
1622 are processed in order, from left to right. @xref{Spec Files}, for
1623 information about the format of the @var{file}.
1624
1625 @item -wrapper
1626 @opindex wrapper
1627 Invoke all subcommands under a wrapper program. The name of the
1628 wrapper program and its parameters are passed as a comma separated
1629 list.
1630
1631 @smallexample
1632 gcc -c t.c -wrapper gdb,--args
1633 @end smallexample
1634
1635 @noindent
1636 This invokes all subprograms of @command{gcc} under
1637 @samp{gdb --args}, thus the invocation of @command{cc1} is
1638 @samp{gdb --args cc1 @dots{}}.
1639
1640 @item -fplugin=@var{name}.so
1641 @opindex fplugin
1642 Load the plugin code in file @var{name}.so, assumed to be a
1643 shared object to be dlopen'd by the compiler. The base name of
1644 the shared object file is used to identify the plugin for the
1645 purposes of argument parsing (See
1646 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1647 Each plugin should define the callback functions specified in the
1648 Plugins API.
1649
1650 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1651 @opindex fplugin-arg
1652 Define an argument called @var{key} with a value of @var{value}
1653 for the plugin called @var{name}.
1654
1655 @item -fdump-ada-spec@r{[}-slim@r{]}
1656 @opindex fdump-ada-spec
1657 For C and C++ source and include files, generate corresponding Ada specs.
1658 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1659 GNAT User's Guide}, which provides detailed documentation on this feature.
1660
1661 @item -fada-spec-parent=@var{unit}
1662 @opindex fada-spec-parent
1663 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1664 Ada specs as child units of parent @var{unit}.
1665
1666 @item -fdump-go-spec=@var{file}
1667 @opindex fdump-go-spec
1668 For input files in any language, generate corresponding Go
1669 declarations in @var{file}. This generates Go @code{const},
1670 @code{type}, @code{var}, and @code{func} declarations which may be a
1671 useful way to start writing a Go interface to code written in some
1672 other language.
1673
1674 @include @value{srcdir}/../libiberty/at-file.texi
1675 @end table
1676
1677 @node Invoking G++
1678 @section Compiling C++ Programs
1679
1680 @cindex suffixes for C++ source
1681 @cindex C++ source file suffixes
1682 C++ source files conventionally use one of the suffixes @samp{.C},
1683 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1684 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1685 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1686 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1687 files with these names and compiles them as C++ programs even if you
1688 call the compiler the same way as for compiling C programs (usually
1689 with the name @command{gcc}).
1690
1691 @findex g++
1692 @findex c++
1693 However, the use of @command{gcc} does not add the C++ library.
1694 @command{g++} is a program that calls GCC and automatically specifies linking
1695 against the C++ library. It treats @samp{.c},
1696 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1697 files unless @option{-x} is used. This program is also useful when
1698 precompiling a C header file with a @samp{.h} extension for use in C++
1699 compilations. On many systems, @command{g++} is also installed with
1700 the name @command{c++}.
1701
1702 @cindex invoking @command{g++}
1703 When you compile C++ programs, you may specify many of the same
1704 command-line options that you use for compiling programs in any
1705 language; or command-line options meaningful for C and related
1706 languages; or options that are meaningful only for C++ programs.
1707 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1708 explanations of options for languages related to C@.
1709 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1710 explanations of options that are meaningful only for C++ programs.
1711
1712 @node C Dialect Options
1713 @section Options Controlling C Dialect
1714 @cindex dialect options
1715 @cindex language dialect options
1716 @cindex options, dialect
1717
1718 The following options control the dialect of C (or languages derived
1719 from C, such as C++, Objective-C and Objective-C++) that the compiler
1720 accepts:
1721
1722 @table @gcctabopt
1723 @cindex ANSI support
1724 @cindex ISO support
1725 @item -ansi
1726 @opindex ansi
1727 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1728 equivalent to @option{-std=c++98}.
1729
1730 This turns off certain features of GCC that are incompatible with ISO
1731 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1732 such as the @code{asm} and @code{typeof} keywords, and
1733 predefined macros such as @code{unix} and @code{vax} that identify the
1734 type of system you are using. It also enables the undesirable and
1735 rarely used ISO trigraph feature. For the C compiler,
1736 it disables recognition of C++ style @samp{//} comments as well as
1737 the @code{inline} keyword.
1738
1739 The alternate keywords @code{__asm__}, @code{__extension__},
1740 @code{__inline__} and @code{__typeof__} continue to work despite
1741 @option{-ansi}. You would not want to use them in an ISO C program, of
1742 course, but it is useful to put them in header files that might be included
1743 in compilations done with @option{-ansi}. Alternate predefined macros
1744 such as @code{__unix__} and @code{__vax__} are also available, with or
1745 without @option{-ansi}.
1746
1747 The @option{-ansi} option does not cause non-ISO programs to be
1748 rejected gratuitously. For that, @option{-Wpedantic} is required in
1749 addition to @option{-ansi}. @xref{Warning Options}.
1750
1751 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1752 option is used. Some header files may notice this macro and refrain
1753 from declaring certain functions or defining certain macros that the
1754 ISO standard doesn't call for; this is to avoid interfering with any
1755 programs that might use these names for other things.
1756
1757 Functions that are normally built in but do not have semantics
1758 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1759 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1760 built-in functions provided by GCC}, for details of the functions
1761 affected.
1762
1763 @item -std=
1764 @opindex std
1765 Determine the language standard. @xref{Standards,,Language Standards
1766 Supported by GCC}, for details of these standard versions. This option
1767 is currently only supported when compiling C or C++.
1768
1769 The compiler can accept several base standards, such as @samp{c90} or
1770 @samp{c++98}, and GNU dialects of those standards, such as
1771 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1772 compiler accepts all programs following that standard plus those
1773 using GNU extensions that do not contradict it. For example,
1774 @option{-std=c90} turns off certain features of GCC that are
1775 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1776 keywords, but not other GNU extensions that do not have a meaning in
1777 ISO C90, such as omitting the middle term of a @code{?:}
1778 expression. On the other hand, when a GNU dialect of a standard is
1779 specified, all features supported by the compiler are enabled, even when
1780 those features change the meaning of the base standard. As a result, some
1781 strict-conforming programs may be rejected. The particular standard
1782 is used by @option{-Wpedantic} to identify which features are GNU
1783 extensions given that version of the standard. For example
1784 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1785 comments, while @option{-std=gnu99 -Wpedantic} does not.
1786
1787 A value for this option must be provided; possible values are
1788
1789 @table @samp
1790 @item c90
1791 @itemx c89
1792 @itemx iso9899:1990
1793 Support all ISO C90 programs (certain GNU extensions that conflict
1794 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1795
1796 @item iso9899:199409
1797 ISO C90 as modified in amendment 1.
1798
1799 @item c99
1800 @itemx c9x
1801 @itemx iso9899:1999
1802 @itemx iso9899:199x
1803 ISO C99. This standard is substantially completely supported, modulo
1804 bugs and floating-point issues
1805 (mainly but not entirely relating to optional C99 features from
1806 Annexes F and G). See
1807 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1808 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1809
1810 @item c11
1811 @itemx c1x
1812 @itemx iso9899:2011
1813 ISO C11, the 2011 revision of the ISO C standard. This standard is
1814 substantially completely supported, modulo bugs, floating-point issues
1815 (mainly but not entirely relating to optional C11 features from
1816 Annexes F and G) and the optional Annexes K (Bounds-checking
1817 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1818
1819 @item gnu90
1820 @itemx gnu89
1821 GNU dialect of ISO C90 (including some C99 features).
1822
1823 @item gnu99
1824 @itemx gnu9x
1825 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1826
1827 @item gnu11
1828 @itemx gnu1x
1829 GNU dialect of ISO C11. This is the default for C code.
1830 The name @samp{gnu1x} is deprecated.
1831
1832 @item c++98
1833 @itemx c++03
1834 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1835 additional defect reports. Same as @option{-ansi} for C++ code.
1836
1837 @item gnu++98
1838 @itemx gnu++03
1839 GNU dialect of @option{-std=c++98}.
1840
1841 @item c++11
1842 @itemx c++0x
1843 The 2011 ISO C++ standard plus amendments.
1844 The name @samp{c++0x} is deprecated.
1845
1846 @item gnu++11
1847 @itemx gnu++0x
1848 GNU dialect of @option{-std=c++11}.
1849 The name @samp{gnu++0x} is deprecated.
1850
1851 @item c++14
1852 @itemx c++1y
1853 The 2014 ISO C++ standard plus amendments.
1854 The name @samp{c++1y} is deprecated.
1855
1856 @item gnu++14
1857 @itemx gnu++1y
1858 GNU dialect of @option{-std=c++14}.
1859 This is the default for C++ code.
1860 The name @samp{gnu++1y} is deprecated.
1861
1862 @item c++1z
1863 The next revision of the ISO C++ standard, tentatively planned for
1864 2017. Support is highly experimental, and will almost certainly
1865 change in incompatible ways in future releases.
1866
1867 @item gnu++1z
1868 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1869 and will almost certainly change in incompatible ways in future
1870 releases.
1871 @end table
1872
1873 @item -fgnu89-inline
1874 @opindex fgnu89-inline
1875 The option @option{-fgnu89-inline} tells GCC to use the traditional
1876 GNU semantics for @code{inline} functions when in C99 mode.
1877 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1878 Using this option is roughly equivalent to adding the
1879 @code{gnu_inline} function attribute to all inline functions
1880 (@pxref{Function Attributes}).
1881
1882 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1883 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1884 specifies the default behavior).
1885 This option is not supported in @option{-std=c90} or
1886 @option{-std=gnu90} mode.
1887
1888 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1889 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1890 in effect for @code{inline} functions. @xref{Common Predefined
1891 Macros,,,cpp,The C Preprocessor}.
1892
1893 @item -fpermitted-flt-eval-methods=@var{style}
1894 @opindex fpermitted-flt-eval-methods
1895 @opindex fpermitted-flt-eval-methods=c11
1896 @opindex fpermitted-flt-eval-methods=ts-18661-3
1897 ISO/IEC TS 18661-3 defines new permissible values for
1898 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
1899 a semantic type that is an interchange or extended format should be
1900 evaluated to the precision and range of that type. These new values are
1901 a superset of those permitted under C99/C11, which does not specify the
1902 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
1903 conforming to C11 may not have been written expecting the possibility of
1904 the new values.
1905
1906 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
1907 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
1908 or the extended set of values specified in ISO/IEC TS 18661-3.
1909
1910 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
1911
1912 The default when in a standards compliant mode (@option{-std=c11} or similar)
1913 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
1914 dialect (@option{-std=gnu11} or similar) is
1915 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
1916
1917 @item -aux-info @var{filename}
1918 @opindex aux-info
1919 Output to the given filename prototyped declarations for all functions
1920 declared and/or defined in a translation unit, including those in header
1921 files. This option is silently ignored in any language other than C@.
1922
1923 Besides declarations, the file indicates, in comments, the origin of
1924 each declaration (source file and line), whether the declaration was
1925 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1926 @samp{O} for old, respectively, in the first character after the line
1927 number and the colon), and whether it came from a declaration or a
1928 definition (@samp{C} or @samp{F}, respectively, in the following
1929 character). In the case of function definitions, a K&R-style list of
1930 arguments followed by their declarations is also provided, inside
1931 comments, after the declaration.
1932
1933 @item -fallow-parameterless-variadic-functions
1934 @opindex fallow-parameterless-variadic-functions
1935 Accept variadic functions without named parameters.
1936
1937 Although it is possible to define such a function, this is not very
1938 useful as it is not possible to read the arguments. This is only
1939 supported for C as this construct is allowed by C++.
1940
1941 @item -fno-asm
1942 @opindex fno-asm
1943 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1944 keyword, so that code can use these words as identifiers. You can use
1945 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1946 instead. @option{-ansi} implies @option{-fno-asm}.
1947
1948 In C++, this switch only affects the @code{typeof} keyword, since
1949 @code{asm} and @code{inline} are standard keywords. You may want to
1950 use the @option{-fno-gnu-keywords} flag instead, which has the same
1951 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1952 switch only affects the @code{asm} and @code{typeof} keywords, since
1953 @code{inline} is a standard keyword in ISO C99.
1954
1955 @item -fno-builtin
1956 @itemx -fno-builtin-@var{function}
1957 @opindex fno-builtin
1958 @cindex built-in functions
1959 Don't recognize built-in functions that do not begin with
1960 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1961 functions provided by GCC}, for details of the functions affected,
1962 including those which are not built-in functions when @option{-ansi} or
1963 @option{-std} options for strict ISO C conformance are used because they
1964 do not have an ISO standard meaning.
1965
1966 GCC normally generates special code to handle certain built-in functions
1967 more efficiently; for instance, calls to @code{alloca} may become single
1968 instructions which adjust the stack directly, and calls to @code{memcpy}
1969 may become inline copy loops. The resulting code is often both smaller
1970 and faster, but since the function calls no longer appear as such, you
1971 cannot set a breakpoint on those calls, nor can you change the behavior
1972 of the functions by linking with a different library. In addition,
1973 when a function is recognized as a built-in function, GCC may use
1974 information about that function to warn about problems with calls to
1975 that function, or to generate more efficient code, even if the
1976 resulting code still contains calls to that function. For example,
1977 warnings are given with @option{-Wformat} for bad calls to
1978 @code{printf} when @code{printf} is built in and @code{strlen} is
1979 known not to modify global memory.
1980
1981 With the @option{-fno-builtin-@var{function}} option
1982 only the built-in function @var{function} is
1983 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1984 function is named that is not built-in in this version of GCC, this
1985 option is ignored. There is no corresponding
1986 @option{-fbuiltin-@var{function}} option; if you wish to enable
1987 built-in functions selectively when using @option{-fno-builtin} or
1988 @option{-ffreestanding}, you may define macros such as:
1989
1990 @smallexample
1991 #define abs(n) __builtin_abs ((n))
1992 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1993 @end smallexample
1994
1995 @item -fgimple
1996 @opindex fgimple
1997
1998 Enable parsing of function definitions marked with @code{__GIMPLE}.
1999 This is an experimental feature that allows unit testing of GIMPLE
2000 passes.
2001
2002 @item -fhosted
2003 @opindex fhosted
2004 @cindex hosted environment
2005
2006 Assert that compilation targets a hosted environment. This implies
2007 @option{-fbuiltin}. A hosted environment is one in which the
2008 entire standard library is available, and in which @code{main} has a return
2009 type of @code{int}. Examples are nearly everything except a kernel.
2010 This is equivalent to @option{-fno-freestanding}.
2011
2012 @item -ffreestanding
2013 @opindex ffreestanding
2014 @cindex hosted environment
2015
2016 Assert that compilation targets a freestanding environment. This
2017 implies @option{-fno-builtin}. A freestanding environment
2018 is one in which the standard library may not exist, and program startup may
2019 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2020 This is equivalent to @option{-fno-hosted}.
2021
2022 @xref{Standards,,Language Standards Supported by GCC}, for details of
2023 freestanding and hosted environments.
2024
2025 @item -fopenacc
2026 @opindex fopenacc
2027 @cindex OpenACC accelerator programming
2028 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2029 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2030 compiler generates accelerated code according to the OpenACC Application
2031 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
2032 implies @option{-pthread}, and thus is only supported on targets that
2033 have support for @option{-pthread}.
2034
2035 @item -fopenacc-dim=@var{geom}
2036 @opindex fopenacc-dim
2037 @cindex OpenACC accelerator programming
2038 Specify default compute dimensions for parallel offload regions that do
2039 not explicitly specify. The @var{geom} value is a triple of
2040 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2041 can be omitted, to use a target-specific default value.
2042
2043 @item -fopenmp
2044 @opindex fopenmp
2045 @cindex OpenMP parallel
2046 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2047 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2048 compiler generates parallel code according to the OpenMP Application
2049 Program Interface v4.5 @w{@uref{http://www.openmp.org/}}. This option
2050 implies @option{-pthread}, and thus is only supported on targets that
2051 have support for @option{-pthread}. @option{-fopenmp} implies
2052 @option{-fopenmp-simd}.
2053
2054 @item -fopenmp-simd
2055 @opindex fopenmp-simd
2056 @cindex OpenMP SIMD
2057 @cindex SIMD
2058 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2059 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2060 are ignored.
2061
2062 @item -fcilkplus
2063 @opindex fcilkplus
2064 @cindex Enable Cilk Plus
2065 Enable the usage of Cilk Plus language extension features for C/C++.
2066 When the option @option{-fcilkplus} is specified, enable the usage of
2067 the Cilk Plus Language extension features for C/C++. The present
2068 implementation follows ABI version 1.2. This is an experimental
2069 feature that is only partially complete, and whose interface may
2070 change in future versions of GCC as the official specification
2071 changes. Currently, all features but @code{_Cilk_for} have been
2072 implemented.
2073
2074 @item -fgnu-tm
2075 @opindex fgnu-tm
2076 When the option @option{-fgnu-tm} is specified, the compiler
2077 generates code for the Linux variant of Intel's current Transactional
2078 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2079 an experimental feature whose interface may change in future versions
2080 of GCC, as the official specification changes. Please note that not
2081 all architectures are supported for this feature.
2082
2083 For more information on GCC's support for transactional memory,
2084 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2085 Transactional Memory Library}.
2086
2087 Note that the transactional memory feature is not supported with
2088 non-call exceptions (@option{-fnon-call-exceptions}).
2089
2090 @item -fms-extensions
2091 @opindex fms-extensions
2092 Accept some non-standard constructs used in Microsoft header files.
2093
2094 In C++ code, this allows member names in structures to be similar
2095 to previous types declarations.
2096
2097 @smallexample
2098 typedef int UOW;
2099 struct ABC @{
2100 UOW UOW;
2101 @};
2102 @end smallexample
2103
2104 Some cases of unnamed fields in structures and unions are only
2105 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2106 fields within structs/unions}, for details.
2107
2108 Note that this option is off for all targets but x86
2109 targets using ms-abi.
2110
2111 @item -fplan9-extensions
2112 @opindex fplan9-extensions
2113 Accept some non-standard constructs used in Plan 9 code.
2114
2115 This enables @option{-fms-extensions}, permits passing pointers to
2116 structures with anonymous fields to functions that expect pointers to
2117 elements of the type of the field, and permits referring to anonymous
2118 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2119 struct/union fields within structs/unions}, for details. This is only
2120 supported for C, not C++.
2121
2122 @item -fcond-mismatch
2123 @opindex fcond-mismatch
2124 Allow conditional expressions with mismatched types in the second and
2125 third arguments. The value of such an expression is void. This option
2126 is not supported for C++.
2127
2128 @item -flax-vector-conversions
2129 @opindex flax-vector-conversions
2130 Allow implicit conversions between vectors with differing numbers of
2131 elements and/or incompatible element types. This option should not be
2132 used for new code.
2133
2134 @item -funsigned-char
2135 @opindex funsigned-char
2136 Let the type @code{char} be unsigned, like @code{unsigned char}.
2137
2138 Each kind of machine has a default for what @code{char} should
2139 be. It is either like @code{unsigned char} by default or like
2140 @code{signed char} by default.
2141
2142 Ideally, a portable program should always use @code{signed char} or
2143 @code{unsigned char} when it depends on the signedness of an object.
2144 But many programs have been written to use plain @code{char} and
2145 expect it to be signed, or expect it to be unsigned, depending on the
2146 machines they were written for. This option, and its inverse, let you
2147 make such a program work with the opposite default.
2148
2149 The type @code{char} is always a distinct type from each of
2150 @code{signed char} or @code{unsigned char}, even though its behavior
2151 is always just like one of those two.
2152
2153 @item -fsigned-char
2154 @opindex fsigned-char
2155 Let the type @code{char} be signed, like @code{signed char}.
2156
2157 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2158 the negative form of @option{-funsigned-char}. Likewise, the option
2159 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2160
2161 @item -fsigned-bitfields
2162 @itemx -funsigned-bitfields
2163 @itemx -fno-signed-bitfields
2164 @itemx -fno-unsigned-bitfields
2165 @opindex fsigned-bitfields
2166 @opindex funsigned-bitfields
2167 @opindex fno-signed-bitfields
2168 @opindex fno-unsigned-bitfields
2169 These options control whether a bit-field is signed or unsigned, when the
2170 declaration does not use either @code{signed} or @code{unsigned}. By
2171 default, such a bit-field is signed, because this is consistent: the
2172 basic integer types such as @code{int} are signed types.
2173
2174 @item -fsso-struct=@var{endianness}
2175 @opindex fsso-struct
2176 Set the default scalar storage order of structures and unions to the
2177 specified endianness. The accepted values are @samp{big-endian},
2178 @samp{little-endian} and @samp{native} for the native endianness of
2179 the target (the default). This option is not supported for C++.
2180
2181 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2182 code that is not binary compatible with code generated without it if the
2183 specified endianness is not the native endianness of the target.
2184 @end table
2185
2186 @node C++ Dialect Options
2187 @section Options Controlling C++ Dialect
2188
2189 @cindex compiler options, C++
2190 @cindex C++ options, command-line
2191 @cindex options, C++
2192 This section describes the command-line options that are only meaningful
2193 for C++ programs. You can also use most of the GNU compiler options
2194 regardless of what language your program is in. For example, you
2195 might compile a file @file{firstClass.C} like this:
2196
2197 @smallexample
2198 g++ -g -fstrict-enums -O -c firstClass.C
2199 @end smallexample
2200
2201 @noindent
2202 In this example, only @option{-fstrict-enums} is an option meant
2203 only for C++ programs; you can use the other options with any
2204 language supported by GCC@.
2205
2206 Some options for compiling C programs, such as @option{-std}, are also
2207 relevant for C++ programs.
2208 @xref{C Dialect Options,,Options Controlling C Dialect}.
2209
2210 Here is a list of options that are @emph{only} for compiling C++ programs:
2211
2212 @table @gcctabopt
2213
2214 @item -fabi-version=@var{n}
2215 @opindex fabi-version
2216 Use version @var{n} of the C++ ABI@. The default is version 0.
2217
2218 Version 0 refers to the version conforming most closely to
2219 the C++ ABI specification. Therefore, the ABI obtained using version 0
2220 will change in different versions of G++ as ABI bugs are fixed.
2221
2222 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2223
2224 Version 2 is the version of the C++ ABI that first appeared in G++
2225 3.4, and was the default through G++ 4.9.
2226
2227 Version 3 corrects an error in mangling a constant address as a
2228 template argument.
2229
2230 Version 4, which first appeared in G++ 4.5, implements a standard
2231 mangling for vector types.
2232
2233 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2234 attribute const/volatile on function pointer types, decltype of a
2235 plain decl, and use of a function parameter in the declaration of
2236 another parameter.
2237
2238 Version 6, which first appeared in G++ 4.7, corrects the promotion
2239 behavior of C++11 scoped enums and the mangling of template argument
2240 packs, const/static_cast, prefix ++ and --, and a class scope function
2241 used as a template argument.
2242
2243 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2244 builtin type and corrects the mangling of lambdas in default argument
2245 scope.
2246
2247 Version 8, which first appeared in G++ 4.9, corrects the substitution
2248 behavior of function types with function-cv-qualifiers.
2249
2250 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2251 @code{nullptr_t}.
2252
2253 Version 10, which first appeared in G++ 6.1, adds mangling of
2254 attributes that affect type identity, such as ia32 calling convention
2255 attributes (e.g. @samp{stdcall}).
2256
2257 Version 11, which first appeared in G++ 7, corrects the mangling of
2258 sizeof... expressions and operator names. For multiple entities with
2259 the same name within a function, that are declared in different scopes,
2260 the mangling now changes starting with the twelfth occurrence. It also
2261 implies @option{-fnew-inheriting-ctors}.
2262
2263 See also @option{-Wabi}.
2264
2265 @item -fabi-compat-version=@var{n}
2266 @opindex fabi-compat-version
2267 On targets that support strong aliases, G++
2268 works around mangling changes by creating an alias with the correct
2269 mangled name when defining a symbol with an incorrect mangled name.
2270 This switch specifies which ABI version to use for the alias.
2271
2272 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2273 compatibility). If another ABI version is explicitly selected, this
2274 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2275 use @option{-fabi-compat-version=2}.
2276
2277 If this option is not provided but @option{-Wabi=@var{n}} is, that
2278 version is used for compatibility aliases. If this option is provided
2279 along with @option{-Wabi} (without the version), the version from this
2280 option is used for the warning.
2281
2282 @item -fno-access-control
2283 @opindex fno-access-control
2284 Turn off all access checking. This switch is mainly useful for working
2285 around bugs in the access control code.
2286
2287 @item -faligned-new
2288 @opindex faligned-new
2289 Enable support for C++17 @code{new} of types that require more
2290 alignment than @code{void* ::operator new(std::size_t)} provides. A
2291 numeric argument such as @code{-faligned-new=32} can be used to
2292 specify how much alignment (in bytes) is provided by that function,
2293 but few users will need to override the default of
2294 @code{alignof(std::max_align_t)}.
2295
2296 @item -fcheck-new
2297 @opindex fcheck-new
2298 Check that the pointer returned by @code{operator new} is non-null
2299 before attempting to modify the storage allocated. This check is
2300 normally unnecessary because the C++ standard specifies that
2301 @code{operator new} only returns @code{0} if it is declared
2302 @code{throw()}, in which case the compiler always checks the
2303 return value even without this option. In all other cases, when
2304 @code{operator new} has a non-empty exception specification, memory
2305 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2306 @samp{new (nothrow)}.
2307
2308 @item -fconcepts
2309 @opindex fconcepts
2310 Enable support for the C++ Extensions for Concepts Technical
2311 Specification, ISO 19217 (2015), which allows code like
2312
2313 @smallexample
2314 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2315 template <Addable T> T add (T a, T b) @{ return a + b; @}
2316 @end smallexample
2317
2318 @item -fconstexpr-depth=@var{n}
2319 @opindex fconstexpr-depth
2320 Set the maximum nested evaluation depth for C++11 constexpr functions
2321 to @var{n}. A limit is needed to detect endless recursion during
2322 constant expression evaluation. The minimum specified by the standard
2323 is 512.
2324
2325 @item -fconstexpr-loop-limit=@var{n}
2326 @opindex fconstexpr-loop-limit
2327 Set the maximum number of iterations for a loop in C++14 constexpr functions
2328 to @var{n}. A limit is needed to detect infinite loops during
2329 constant expression evaluation. The default is 262144 (1<<18).
2330
2331 @item -fdeduce-init-list
2332 @opindex fdeduce-init-list
2333 Enable deduction of a template type parameter as
2334 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2335
2336 @smallexample
2337 template <class T> auto forward(T t) -> decltype (realfn (t))
2338 @{
2339 return realfn (t);
2340 @}
2341
2342 void f()
2343 @{
2344 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2345 @}
2346 @end smallexample
2347
2348 This deduction was implemented as a possible extension to the
2349 originally proposed semantics for the C++11 standard, but was not part
2350 of the final standard, so it is disabled by default. This option is
2351 deprecated, and may be removed in a future version of G++.
2352
2353 @item -ffriend-injection
2354 @opindex ffriend-injection
2355 Inject friend functions into the enclosing namespace, so that they are
2356 visible outside the scope of the class in which they are declared.
2357 Friend functions were documented to work this way in the old Annotated
2358 C++ Reference Manual.
2359 However, in ISO C++ a friend function that is not declared
2360 in an enclosing scope can only be found using argument dependent
2361 lookup. GCC defaults to the standard behavior.
2362
2363 This option is for compatibility, and may be removed in a future
2364 release of G++.
2365
2366 @item -fno-elide-constructors
2367 @opindex fno-elide-constructors
2368 The C++ standard allows an implementation to omit creating a temporary
2369 that is only used to initialize another object of the same type.
2370 Specifying this option disables that optimization, and forces G++ to
2371 call the copy constructor in all cases. This option also causes G++
2372 to call trivial member functions which otherwise would be expanded inline.
2373
2374 In C++17, the compiler is required to omit these temporaries, but this
2375 option still affects trivial member functions.
2376
2377 @item -fno-enforce-eh-specs
2378 @opindex fno-enforce-eh-specs
2379 Don't generate code to check for violation of exception specifications
2380 at run time. This option violates the C++ standard, but may be useful
2381 for reducing code size in production builds, much like defining
2382 @code{NDEBUG}. This does not give user code permission to throw
2383 exceptions in violation of the exception specifications; the compiler
2384 still optimizes based on the specifications, so throwing an
2385 unexpected exception results in undefined behavior at run time.
2386
2387 @item -fextern-tls-init
2388 @itemx -fno-extern-tls-init
2389 @opindex fextern-tls-init
2390 @opindex fno-extern-tls-init
2391 The C++11 and OpenMP standards allow @code{thread_local} and
2392 @code{threadprivate} variables to have dynamic (runtime)
2393 initialization. To support this, any use of such a variable goes
2394 through a wrapper function that performs any necessary initialization.
2395 When the use and definition of the variable are in the same
2396 translation unit, this overhead can be optimized away, but when the
2397 use is in a different translation unit there is significant overhead
2398 even if the variable doesn't actually need dynamic initialization. If
2399 the programmer can be sure that no use of the variable in a
2400 non-defining TU needs to trigger dynamic initialization (either
2401 because the variable is statically initialized, or a use of the
2402 variable in the defining TU will be executed before any uses in
2403 another TU), they can avoid this overhead with the
2404 @option{-fno-extern-tls-init} option.
2405
2406 On targets that support symbol aliases, the default is
2407 @option{-fextern-tls-init}. On targets that do not support symbol
2408 aliases, the default is @option{-fno-extern-tls-init}.
2409
2410 @item -ffor-scope
2411 @itemx -fno-for-scope
2412 @opindex ffor-scope
2413 @opindex fno-for-scope
2414 If @option{-ffor-scope} is specified, the scope of variables declared in
2415 a @i{for-init-statement} is limited to the @code{for} loop itself,
2416 as specified by the C++ standard.
2417 If @option{-fno-for-scope} is specified, the scope of variables declared in
2418 a @i{for-init-statement} extends to the end of the enclosing scope,
2419 as was the case in old versions of G++, and other (traditional)
2420 implementations of C++.
2421
2422 If neither flag is given, the default is to follow the standard,
2423 but to allow and give a warning for old-style code that would
2424 otherwise be invalid, or have different behavior.
2425
2426 @item -fno-gnu-keywords
2427 @opindex fno-gnu-keywords
2428 Do not recognize @code{typeof} as a keyword, so that code can use this
2429 word as an identifier. You can use the keyword @code{__typeof__} instead.
2430 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2431 @option{-std=c++98}, @option{-std=c++11}, etc.
2432
2433 @item -fno-implicit-templates
2434 @opindex fno-implicit-templates
2435 Never emit code for non-inline templates that are instantiated
2436 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2437 @xref{Template Instantiation}, for more information.
2438
2439 @item -fno-implicit-inline-templates
2440 @opindex fno-implicit-inline-templates
2441 Don't emit code for implicit instantiations of inline templates, either.
2442 The default is to handle inlines differently so that compiles with and
2443 without optimization need the same set of explicit instantiations.
2444
2445 @item -fno-implement-inlines
2446 @opindex fno-implement-inlines
2447 To save space, do not emit out-of-line copies of inline functions
2448 controlled by @code{#pragma implementation}. This causes linker
2449 errors if these functions are not inlined everywhere they are called.
2450
2451 @item -fms-extensions
2452 @opindex fms-extensions
2453 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2454 int and getting a pointer to member function via non-standard syntax.
2455
2456 @item -fnew-inheriting-ctors
2457 @opindex fnew-inheriting-ctors
2458 Enable the P0136 adjustment to the semantics of C++11 constructor
2459 inheritance. This is part of C++17 but also considered to be a Defect
2460 Report against C++11 and C++14. This flag is enabled by default
2461 unless @option{-fabi-version=10} or lower is specified.
2462
2463 @item -fnew-ttp-matching
2464 @opindex fnew-ttp-matching
2465 Enable the P0522 resolution to Core issue 150, template template
2466 parameters and default arguments: this allows a template with default
2467 template arguments as an argument for a template template parameter
2468 with fewer template parameters. This flag is enabled by default for
2469 @option{-std=c++1z}.
2470
2471 @item -fno-nonansi-builtins
2472 @opindex fno-nonansi-builtins
2473 Disable built-in declarations of functions that are not mandated by
2474 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2475 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2476
2477 @item -fnothrow-opt
2478 @opindex fnothrow-opt
2479 Treat a @code{throw()} exception specification as if it were a
2480 @code{noexcept} specification to reduce or eliminate the text size
2481 overhead relative to a function with no exception specification. If
2482 the function has local variables of types with non-trivial
2483 destructors, the exception specification actually makes the
2484 function smaller because the EH cleanups for those variables can be
2485 optimized away. The semantic effect is that an exception thrown out of
2486 a function with such an exception specification results in a call
2487 to @code{terminate} rather than @code{unexpected}.
2488
2489 @item -fno-operator-names
2490 @opindex fno-operator-names
2491 Do not treat the operator name keywords @code{and}, @code{bitand},
2492 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2493 synonyms as keywords.
2494
2495 @item -fno-optional-diags
2496 @opindex fno-optional-diags
2497 Disable diagnostics that the standard says a compiler does not need to
2498 issue. Currently, the only such diagnostic issued by G++ is the one for
2499 a name having multiple meanings within a class.
2500
2501 @item -fpermissive
2502 @opindex fpermissive
2503 Downgrade some diagnostics about nonconformant code from errors to
2504 warnings. Thus, using @option{-fpermissive} allows some
2505 nonconforming code to compile.
2506
2507 @item -fno-pretty-templates
2508 @opindex fno-pretty-templates
2509 When an error message refers to a specialization of a function
2510 template, the compiler normally prints the signature of the
2511 template followed by the template arguments and any typedefs or
2512 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2513 rather than @code{void f(int)}) so that it's clear which template is
2514 involved. When an error message refers to a specialization of a class
2515 template, the compiler omits any template arguments that match
2516 the default template arguments for that template. If either of these
2517 behaviors make it harder to understand the error message rather than
2518 easier, you can use @option{-fno-pretty-templates} to disable them.
2519
2520 @item -frepo
2521 @opindex frepo
2522 Enable automatic template instantiation at link time. This option also
2523 implies @option{-fno-implicit-templates}. @xref{Template
2524 Instantiation}, for more information.
2525
2526 @item -fno-rtti
2527 @opindex fno-rtti
2528 Disable generation of information about every class with virtual
2529 functions for use by the C++ run-time type identification features
2530 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2531 of the language, you can save some space by using this flag. Note that
2532 exception handling uses the same information, but G++ generates it as
2533 needed. The @code{dynamic_cast} operator can still be used for casts that
2534 do not require run-time type information, i.e.@: casts to @code{void *} or to
2535 unambiguous base classes.
2536
2537 @item -fsized-deallocation
2538 @opindex fsized-deallocation
2539 Enable the built-in global declarations
2540 @smallexample
2541 void operator delete (void *, std::size_t) noexcept;
2542 void operator delete[] (void *, std::size_t) noexcept;
2543 @end smallexample
2544 as introduced in C++14. This is useful for user-defined replacement
2545 deallocation functions that, for example, use the size of the object
2546 to make deallocation faster. Enabled by default under
2547 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2548 warns about places that might want to add a definition.
2549
2550 @item -fstrict-enums
2551 @opindex fstrict-enums
2552 Allow the compiler to optimize using the assumption that a value of
2553 enumerated type can only be one of the values of the enumeration (as
2554 defined in the C++ standard; basically, a value that can be
2555 represented in the minimum number of bits needed to represent all the
2556 enumerators). This assumption may not be valid if the program uses a
2557 cast to convert an arbitrary integer value to the enumerated type.
2558
2559 @item -fstrong-eval-order
2560 @opindex fstrong-eval-order
2561 Evaluate member access, array subscripting, and shift expressions in
2562 left-to-right order, and evaluate assignment in right-to-left order,
2563 as adopted for C++17. Enabled by default with @option{-std=c++1z}.
2564 @option{-fstrong-eval-order=some} enables just the ordering of member
2565 access and shift expressions, and is the default without
2566 @option{-std=c++1z}.
2567
2568 @item -ftemplate-backtrace-limit=@var{n}
2569 @opindex ftemplate-backtrace-limit
2570 Set the maximum number of template instantiation notes for a single
2571 warning or error to @var{n}. The default value is 10.
2572
2573 @item -ftemplate-depth=@var{n}
2574 @opindex ftemplate-depth
2575 Set the maximum instantiation depth for template classes to @var{n}.
2576 A limit on the template instantiation depth is needed to detect
2577 endless recursions during template class instantiation. ANSI/ISO C++
2578 conforming programs must not rely on a maximum depth greater than 17
2579 (changed to 1024 in C++11). The default value is 900, as the compiler
2580 can run out of stack space before hitting 1024 in some situations.
2581
2582 @item -fno-threadsafe-statics
2583 @opindex fno-threadsafe-statics
2584 Do not emit the extra code to use the routines specified in the C++
2585 ABI for thread-safe initialization of local statics. You can use this
2586 option to reduce code size slightly in code that doesn't need to be
2587 thread-safe.
2588
2589 @item -fuse-cxa-atexit
2590 @opindex fuse-cxa-atexit
2591 Register destructors for objects with static storage duration with the
2592 @code{__cxa_atexit} function rather than the @code{atexit} function.
2593 This option is required for fully standards-compliant handling of static
2594 destructors, but only works if your C library supports
2595 @code{__cxa_atexit}.
2596
2597 @item -fno-use-cxa-get-exception-ptr
2598 @opindex fno-use-cxa-get-exception-ptr
2599 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2600 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2601 if the runtime routine is not available.
2602
2603 @item -fvisibility-inlines-hidden
2604 @opindex fvisibility-inlines-hidden
2605 This switch declares that the user does not attempt to compare
2606 pointers to inline functions or methods where the addresses of the two functions
2607 are taken in different shared objects.
2608
2609 The effect of this is that GCC may, effectively, mark inline methods with
2610 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2611 appear in the export table of a DSO and do not require a PLT indirection
2612 when used within the DSO@. Enabling this option can have a dramatic effect
2613 on load and link times of a DSO as it massively reduces the size of the
2614 dynamic export table when the library makes heavy use of templates.
2615
2616 The behavior of this switch is not quite the same as marking the
2617 methods as hidden directly, because it does not affect static variables
2618 local to the function or cause the compiler to deduce that
2619 the function is defined in only one shared object.
2620
2621 You may mark a method as having a visibility explicitly to negate the
2622 effect of the switch for that method. For example, if you do want to
2623 compare pointers to a particular inline method, you might mark it as
2624 having default visibility. Marking the enclosing class with explicit
2625 visibility has no effect.
2626
2627 Explicitly instantiated inline methods are unaffected by this option
2628 as their linkage might otherwise cross a shared library boundary.
2629 @xref{Template Instantiation}.
2630
2631 @item -fvisibility-ms-compat
2632 @opindex fvisibility-ms-compat
2633 This flag attempts to use visibility settings to make GCC's C++
2634 linkage model compatible with that of Microsoft Visual Studio.
2635
2636 The flag makes these changes to GCC's linkage model:
2637
2638 @enumerate
2639 @item
2640 It sets the default visibility to @code{hidden}, like
2641 @option{-fvisibility=hidden}.
2642
2643 @item
2644 Types, but not their members, are not hidden by default.
2645
2646 @item
2647 The One Definition Rule is relaxed for types without explicit
2648 visibility specifications that are defined in more than one
2649 shared object: those declarations are permitted if they are
2650 permitted when this option is not used.
2651 @end enumerate
2652
2653 In new code it is better to use @option{-fvisibility=hidden} and
2654 export those classes that are intended to be externally visible.
2655 Unfortunately it is possible for code to rely, perhaps accidentally,
2656 on the Visual Studio behavior.
2657
2658 Among the consequences of these changes are that static data members
2659 of the same type with the same name but defined in different shared
2660 objects are different, so changing one does not change the other;
2661 and that pointers to function members defined in different shared
2662 objects may not compare equal. When this flag is given, it is a
2663 violation of the ODR to define types with the same name differently.
2664
2665 @item -fno-weak
2666 @opindex fno-weak
2667 Do not use weak symbol support, even if it is provided by the linker.
2668 By default, G++ uses weak symbols if they are available. This
2669 option exists only for testing, and should not be used by end-users;
2670 it results in inferior code and has no benefits. This option may
2671 be removed in a future release of G++.
2672
2673 @item -nostdinc++
2674 @opindex nostdinc++
2675 Do not search for header files in the standard directories specific to
2676 C++, but do still search the other standard directories. (This option
2677 is used when building the C++ library.)
2678 @end table
2679
2680 In addition, these optimization, warning, and code generation options
2681 have meanings only for C++ programs:
2682
2683 @table @gcctabopt
2684 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2685 @opindex Wabi
2686 @opindex Wno-abi
2687 Warn when G++ it generates code that is probably not compatible with
2688 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2689 ABI with each major release, normally @option{-Wabi} will warn only if
2690 there is a check added later in a release series for an ABI issue
2691 discovered since the initial release. @option{-Wabi} will warn about
2692 more things if an older ABI version is selected (with
2693 @option{-fabi-version=@var{n}}).
2694
2695 @option{-Wabi} can also be used with an explicit version number to
2696 warn about compatibility with a particular @option{-fabi-version}
2697 level, e.g. @option{-Wabi=2} to warn about changes relative to
2698 @option{-fabi-version=2}.
2699
2700 If an explicit version number is provided and
2701 @option{-fabi-compat-version} is not specified, the version number
2702 from this option is used for compatibility aliases. If no explicit
2703 version number is provided with this option, but
2704 @option{-fabi-compat-version} is specified, that version number is
2705 used for ABI warnings.
2706
2707 Although an effort has been made to warn about
2708 all such cases, there are probably some cases that are not warned about,
2709 even though G++ is generating incompatible code. There may also be
2710 cases where warnings are emitted even though the code that is generated
2711 is compatible.
2712
2713 You should rewrite your code to avoid these warnings if you are
2714 concerned about the fact that code generated by G++ may not be binary
2715 compatible with code generated by other compilers.
2716
2717 Known incompatibilities in @option{-fabi-version=2} (which was the
2718 default from GCC 3.4 to 4.9) include:
2719
2720 @itemize @bullet
2721
2722 @item
2723 A template with a non-type template parameter of reference type was
2724 mangled incorrectly:
2725 @smallexample
2726 extern int N;
2727 template <int &> struct S @{@};
2728 void n (S<N>) @{2@}
2729 @end smallexample
2730
2731 This was fixed in @option{-fabi-version=3}.
2732
2733 @item
2734 SIMD vector types declared using @code{__attribute ((vector_size))} were
2735 mangled in a non-standard way that does not allow for overloading of
2736 functions taking vectors of different sizes.
2737
2738 The mangling was changed in @option{-fabi-version=4}.
2739
2740 @item
2741 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2742 qualifiers, and @code{decltype} of a plain declaration was folded away.
2743
2744 These mangling issues were fixed in @option{-fabi-version=5}.
2745
2746 @item
2747 Scoped enumerators passed as arguments to a variadic function are
2748 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2749 On most targets this does not actually affect the parameter passing
2750 ABI, as there is no way to pass an argument smaller than @code{int}.
2751
2752 Also, the ABI changed the mangling of template argument packs,
2753 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2754 a class scope function used as a template argument.
2755
2756 These issues were corrected in @option{-fabi-version=6}.
2757
2758 @item
2759 Lambdas in default argument scope were mangled incorrectly, and the
2760 ABI changed the mangling of @code{nullptr_t}.
2761
2762 These issues were corrected in @option{-fabi-version=7}.
2763
2764 @item
2765 When mangling a function type with function-cv-qualifiers, the
2766 un-qualified function type was incorrectly treated as a substitution
2767 candidate.
2768
2769 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2770
2771 @item
2772 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2773 unaligned accesses. Note that this did not affect the ABI of a
2774 function with a @code{nullptr_t} parameter, as parameters have a
2775 minimum alignment.
2776
2777 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2778
2779 @item
2780 Target-specific attributes that affect the identity of a type, such as
2781 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2782 did not affect the mangled name, leading to name collisions when
2783 function pointers were used as template arguments.
2784
2785 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2786
2787 @end itemize
2788
2789 It also warns about psABI-related changes. The known psABI changes at this
2790 point include:
2791
2792 @itemize @bullet
2793
2794 @item
2795 For SysV/x86-64, unions with @code{long double} members are
2796 passed in memory as specified in psABI. For example:
2797
2798 @smallexample
2799 union U @{
2800 long double ld;
2801 int i;
2802 @};
2803 @end smallexample
2804
2805 @noindent
2806 @code{union U} is always passed in memory.
2807
2808 @end itemize
2809
2810 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2811 @opindex Wabi-tag
2812 @opindex -Wabi-tag
2813 Warn when a type with an ABI tag is used in a context that does not
2814 have that ABI tag. See @ref{C++ Attributes} for more information
2815 about ABI tags.
2816
2817 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2818 @opindex Wctor-dtor-privacy
2819 @opindex Wno-ctor-dtor-privacy
2820 Warn when a class seems unusable because all the constructors or
2821 destructors in that class are private, and it has neither friends nor
2822 public static member functions. Also warn if there are no non-private
2823 methods, and there's at least one private member function that isn't
2824 a constructor or destructor.
2825
2826 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2827 @opindex Wdelete-non-virtual-dtor
2828 @opindex Wno-delete-non-virtual-dtor
2829 Warn when @code{delete} is used to destroy an instance of a class that
2830 has virtual functions and non-virtual destructor. It is unsafe to delete
2831 an instance of a derived class through a pointer to a base class if the
2832 base class does not have a virtual destructor. This warning is enabled
2833 by @option{-Wall}.
2834
2835 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2836 @opindex Wliteral-suffix
2837 @opindex Wno-literal-suffix
2838 Warn when a string or character literal is followed by a ud-suffix which does
2839 not begin with an underscore. As a conforming extension, GCC treats such
2840 suffixes as separate preprocessing tokens in order to maintain backwards
2841 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2842 For example:
2843
2844 @smallexample
2845 #define __STDC_FORMAT_MACROS
2846 #include <inttypes.h>
2847 #include <stdio.h>
2848
2849 int main() @{
2850 int64_t i64 = 123;
2851 printf("My int64: %" PRId64"\n", i64);
2852 @}
2853 @end smallexample
2854
2855 In this case, @code{PRId64} is treated as a separate preprocessing token.
2856
2857 Additionally, warn when a user-defined literal operator is declared with
2858 a literal suffix identifier that doesn't begin with an underscore. Literal
2859 suffix identifiers that don't begin with an underscore are reserved for
2860 future standardization.
2861
2862 This warning is enabled by default.
2863
2864 @item -Wlto-type-mismatch
2865 @opindex Wlto-type-mismatch
2866 @opindex Wno-lto-type-mismatch
2867
2868 During the link-time optimization warn about type mismatches in
2869 global declarations from different compilation units.
2870 Requires @option{-flto} to be enabled. Enabled by default.
2871
2872 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2873 @opindex Wnarrowing
2874 @opindex Wno-narrowing
2875 With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing
2876 conversion prohibited by C++11 occurs within
2877 @samp{@{ @}}, e.g.
2878
2879 @smallexample
2880 int i = @{ 2.2 @}; // error: narrowing from double to int
2881 @end smallexample
2882
2883 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2884
2885 When a later standard is in effect, e.g. when using @option{-std=c++11},
2886 narrowing conversions are diagnosed by default, as required by the standard.
2887 A narrowing conversion from a constant produces an error,
2888 and a narrowing conversion from a non-constant produces a warning,
2889 but @option{-Wno-narrowing} suppresses the diagnostic.
2890 Note that this does not affect the meaning of well-formed code;
2891 narrowing conversions are still considered ill-formed in SFINAE contexts.
2892
2893 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2894 @opindex Wnoexcept
2895 @opindex Wno-noexcept
2896 Warn when a noexcept-expression evaluates to false because of a call
2897 to a function that does not have a non-throwing exception
2898 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2899 the compiler to never throw an exception.
2900
2901 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2902 @opindex Wnoexcept-type
2903 @opindex Wno-noexcept-type
2904 Warn if the C++1z feature making @code{noexcept} part of a function
2905 type changes the mangled name of a symbol relative to C++14. Enabled
2906 by @option{-Wabi} and @option{-Wc++1z-compat}.
2907
2908 @smallexample
2909 template <class T> void f(T t) @{ t(); @};
2910 void g() noexcept;
2911 void h() @{ f(g); @} // in C++14 calls f<void(*)()>, in C++1z calls f<void(*)()noexcept>
2912 @end smallexample
2913
2914
2915 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2916 @opindex Wnon-virtual-dtor
2917 @opindex Wno-non-virtual-dtor
2918 Warn when a class has virtual functions and an accessible non-virtual
2919 destructor itself or in an accessible polymorphic base class, in which
2920 case it is possible but unsafe to delete an instance of a derived
2921 class through a pointer to the class itself or base class. This
2922 warning is automatically enabled if @option{-Weffc++} is specified.
2923
2924 @item -Wregister @r{(C++ and Objective-C++ only)}
2925 @opindex Wregister
2926 @opindex Wno-register
2927 Warn on uses of the @code{register} storage class specifier, except
2928 when it is part of the GNU @ref{Explicit Register Variables} extension.
2929 The use of the @code{register} keyword as storage class specifier has
2930 been deprecated in C++11 and removed in C++17.
2931 Enabled by default with @option{-std=c++1z}.
2932
2933 @item -Wreorder @r{(C++ and Objective-C++ only)}
2934 @opindex Wreorder
2935 @opindex Wno-reorder
2936 @cindex reordering, warning
2937 @cindex warning for reordering of member initializers
2938 Warn when the order of member initializers given in the code does not
2939 match the order in which they must be executed. For instance:
2940
2941 @smallexample
2942 struct A @{
2943 int i;
2944 int j;
2945 A(): j (0), i (1) @{ @}
2946 @};
2947 @end smallexample
2948
2949 @noindent
2950 The compiler rearranges the member initializers for @code{i}
2951 and @code{j} to match the declaration order of the members, emitting
2952 a warning to that effect. This warning is enabled by @option{-Wall}.
2953
2954 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2955 @opindex fext-numeric-literals
2956 @opindex fno-ext-numeric-literals
2957 Accept imaginary, fixed-point, or machine-defined
2958 literal number suffixes as GNU extensions.
2959 When this option is turned off these suffixes are treated
2960 as C++11 user-defined literal numeric suffixes.
2961 This is on by default for all pre-C++11 dialects and all GNU dialects:
2962 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2963 @option{-std=gnu++14}.
2964 This option is off by default
2965 for ISO C++11 onwards (@option{-std=c++11}, ...).
2966 @end table
2967
2968 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2969
2970 @table @gcctabopt
2971 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2972 @opindex Weffc++
2973 @opindex Wno-effc++
2974 Warn about violations of the following style guidelines from Scott Meyers'
2975 @cite{Effective C++} series of books:
2976
2977 @itemize @bullet
2978 @item
2979 Define a copy constructor and an assignment operator for classes
2980 with dynamically-allocated memory.
2981
2982 @item
2983 Prefer initialization to assignment in constructors.
2984
2985 @item
2986 Have @code{operator=} return a reference to @code{*this}.
2987
2988 @item
2989 Don't try to return a reference when you must return an object.
2990
2991 @item
2992 Distinguish between prefix and postfix forms of increment and
2993 decrement operators.
2994
2995 @item
2996 Never overload @code{&&}, @code{||}, or @code{,}.
2997
2998 @end itemize
2999
3000 This option also enables @option{-Wnon-virtual-dtor}, which is also
3001 one of the effective C++ recommendations. However, the check is
3002 extended to warn about the lack of virtual destructor in accessible
3003 non-polymorphic bases classes too.
3004
3005 When selecting this option, be aware that the standard library
3006 headers do not obey all of these guidelines; use @samp{grep -v}
3007 to filter out those warnings.
3008
3009 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3010 @opindex Wstrict-null-sentinel
3011 @opindex Wno-strict-null-sentinel
3012 Warn about the use of an uncasted @code{NULL} as sentinel. When
3013 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3014 to @code{__null}. Although it is a null pointer constant rather than a
3015 null pointer, it is guaranteed to be of the same size as a pointer.
3016 But this use is not portable across different compilers.
3017
3018 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3019 @opindex Wno-non-template-friend
3020 @opindex Wnon-template-friend
3021 Disable warnings when non-template friend functions are declared
3022 within a template. In very old versions of GCC that predate implementation
3023 of the ISO standard, declarations such as
3024 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3025 could be interpreted as a particular specialization of a template
3026 function; the warning exists to diagnose compatibility problems,
3027 and is enabled by default.
3028
3029 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3030 @opindex Wold-style-cast
3031 @opindex Wno-old-style-cast
3032 Warn if an old-style (C-style) cast to a non-void type is used within
3033 a C++ program. The new-style casts (@code{dynamic_cast},
3034 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3035 less vulnerable to unintended effects and much easier to search for.
3036
3037 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3038 @opindex Woverloaded-virtual
3039 @opindex Wno-overloaded-virtual
3040 @cindex overloaded virtual function, warning
3041 @cindex warning for overloaded virtual function
3042 Warn when a function declaration hides virtual functions from a
3043 base class. For example, in:
3044
3045 @smallexample
3046 struct A @{
3047 virtual void f();
3048 @};
3049
3050 struct B: public A @{
3051 void f(int);
3052 @};
3053 @end smallexample
3054
3055 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3056 like:
3057
3058 @smallexample
3059 B* b;
3060 b->f();
3061 @end smallexample
3062
3063 @noindent
3064 fails to compile.
3065
3066 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3067 @opindex Wno-pmf-conversions
3068 @opindex Wpmf-conversions
3069 Disable the diagnostic for converting a bound pointer to member function
3070 to a plain pointer.
3071
3072 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3073 @opindex Wsign-promo
3074 @opindex Wno-sign-promo
3075 Warn when overload resolution chooses a promotion from unsigned or
3076 enumerated type to a signed type, over a conversion to an unsigned type of
3077 the same size. Previous versions of G++ tried to preserve
3078 unsignedness, but the standard mandates the current behavior.
3079
3080 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3081 @opindex Wtemplates
3082 Warn when a primary template declaration is encountered. Some coding
3083 rules disallow templates, and this may be used to enforce that rule.
3084 The warning is inactive inside a system header file, such as the STL, so
3085 one can still use the STL. One may also instantiate or specialize
3086 templates.
3087
3088 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3089 @opindex Wmultiple-inheritance
3090 Warn when a class is defined with multiple direct base classes. Some
3091 coding rules disallow multiple inheritance, and this may be used to
3092 enforce that rule. The warning is inactive inside a system header file,
3093 such as the STL, so one can still use the STL. One may also define
3094 classes that indirectly use multiple inheritance.
3095
3096 @item -Wvirtual-inheritance
3097 @opindex Wvirtual-inheritance
3098 Warn when a class is defined with a virtual direct base class. Some
3099 coding rules disallow multiple inheritance, and this may be used to
3100 enforce that rule. The warning is inactive inside a system header file,
3101 such as the STL, so one can still use the STL. One may also define
3102 classes that indirectly use virtual inheritance.
3103
3104 @item -Wnamespaces
3105 @opindex Wnamespaces
3106 Warn when a namespace definition is opened. Some coding rules disallow
3107 namespaces, and this may be used to enforce that rule. The warning is
3108 inactive inside a system header file, such as the STL, so one can still
3109 use the STL. One may also use using directives and qualified names.
3110
3111 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3112 @opindex Wterminate
3113 @opindex Wno-terminate
3114 Disable the warning about a throw-expression that will immediately
3115 result in a call to @code{terminate}.
3116 @end table
3117
3118 @node Objective-C and Objective-C++ Dialect Options
3119 @section Options Controlling Objective-C and Objective-C++ Dialects
3120
3121 @cindex compiler options, Objective-C and Objective-C++
3122 @cindex Objective-C and Objective-C++ options, command-line
3123 @cindex options, Objective-C and Objective-C++
3124 (NOTE: This manual does not describe the Objective-C and Objective-C++
3125 languages themselves. @xref{Standards,,Language Standards
3126 Supported by GCC}, for references.)
3127
3128 This section describes the command-line options that are only meaningful
3129 for Objective-C and Objective-C++ programs. You can also use most of
3130 the language-independent GNU compiler options.
3131 For example, you might compile a file @file{some_class.m} like this:
3132
3133 @smallexample
3134 gcc -g -fgnu-runtime -O -c some_class.m
3135 @end smallexample
3136
3137 @noindent
3138 In this example, @option{-fgnu-runtime} is an option meant only for
3139 Objective-C and Objective-C++ programs; you can use the other options with
3140 any language supported by GCC@.
3141
3142 Note that since Objective-C is an extension of the C language, Objective-C
3143 compilations may also use options specific to the C front-end (e.g.,
3144 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3145 C++-specific options (e.g., @option{-Wabi}).
3146
3147 Here is a list of options that are @emph{only} for compiling Objective-C
3148 and Objective-C++ programs:
3149
3150 @table @gcctabopt
3151 @item -fconstant-string-class=@var{class-name}
3152 @opindex fconstant-string-class
3153 Use @var{class-name} as the name of the class to instantiate for each
3154 literal string specified with the syntax @code{@@"@dots{}"}. The default
3155 class name is @code{NXConstantString} if the GNU runtime is being used, and
3156 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3157 @option{-fconstant-cfstrings} option, if also present, overrides the
3158 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3159 to be laid out as constant CoreFoundation strings.
3160
3161 @item -fgnu-runtime
3162 @opindex fgnu-runtime
3163 Generate object code compatible with the standard GNU Objective-C
3164 runtime. This is the default for most types of systems.
3165
3166 @item -fnext-runtime
3167 @opindex fnext-runtime
3168 Generate output compatible with the NeXT runtime. This is the default
3169 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3170 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3171 used.
3172
3173 @item -fno-nil-receivers
3174 @opindex fno-nil-receivers
3175 Assume that all Objective-C message dispatches (@code{[receiver
3176 message:arg]}) in this translation unit ensure that the receiver is
3177 not @code{nil}. This allows for more efficient entry points in the
3178 runtime to be used. This option is only available in conjunction with
3179 the NeXT runtime and ABI version 0 or 1.
3180
3181 @item -fobjc-abi-version=@var{n}
3182 @opindex fobjc-abi-version
3183 Use version @var{n} of the Objective-C ABI for the selected runtime.
3184 This option is currently supported only for the NeXT runtime. In that
3185 case, Version 0 is the traditional (32-bit) ABI without support for
3186 properties and other Objective-C 2.0 additions. Version 1 is the
3187 traditional (32-bit) ABI with support for properties and other
3188 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3189 nothing is specified, the default is Version 0 on 32-bit target
3190 machines, and Version 2 on 64-bit target machines.
3191
3192 @item -fobjc-call-cxx-cdtors
3193 @opindex fobjc-call-cxx-cdtors
3194 For each Objective-C class, check if any of its instance variables is a
3195 C++ object with a non-trivial default constructor. If so, synthesize a
3196 special @code{- (id) .cxx_construct} instance method which runs
3197 non-trivial default constructors on any such instance variables, in order,
3198 and then return @code{self}. Similarly, check if any instance variable
3199 is a C++ object with a non-trivial destructor, and if so, synthesize a
3200 special @code{- (void) .cxx_destruct} method which runs
3201 all such default destructors, in reverse order.
3202
3203 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3204 methods thusly generated only operate on instance variables
3205 declared in the current Objective-C class, and not those inherited
3206 from superclasses. It is the responsibility of the Objective-C
3207 runtime to invoke all such methods in an object's inheritance
3208 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3209 by the runtime immediately after a new object instance is allocated;
3210 the @code{- (void) .cxx_destruct} methods are invoked immediately
3211 before the runtime deallocates an object instance.
3212
3213 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3214 support for invoking the @code{- (id) .cxx_construct} and
3215 @code{- (void) .cxx_destruct} methods.
3216
3217 @item -fobjc-direct-dispatch
3218 @opindex fobjc-direct-dispatch
3219 Allow fast jumps to the message dispatcher. On Darwin this is
3220 accomplished via the comm page.
3221
3222 @item -fobjc-exceptions
3223 @opindex fobjc-exceptions
3224 Enable syntactic support for structured exception handling in
3225 Objective-C, similar to what is offered by C++. This option
3226 is required to use the Objective-C keywords @code{@@try},
3227 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3228 @code{@@synchronized}. This option is available with both the GNU
3229 runtime and the NeXT runtime (but not available in conjunction with
3230 the NeXT runtime on Mac OS X 10.2 and earlier).
3231
3232 @item -fobjc-gc
3233 @opindex fobjc-gc
3234 Enable garbage collection (GC) in Objective-C and Objective-C++
3235 programs. This option is only available with the NeXT runtime; the
3236 GNU runtime has a different garbage collection implementation that
3237 does not require special compiler flags.
3238
3239 @item -fobjc-nilcheck
3240 @opindex fobjc-nilcheck
3241 For the NeXT runtime with version 2 of the ABI, check for a nil
3242 receiver in method invocations before doing the actual method call.
3243 This is the default and can be disabled using
3244 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3245 checked for nil in this way no matter what this flag is set to.
3246 Currently this flag does nothing when the GNU runtime, or an older
3247 version of the NeXT runtime ABI, is used.
3248
3249 @item -fobjc-std=objc1
3250 @opindex fobjc-std
3251 Conform to the language syntax of Objective-C 1.0, the language
3252 recognized by GCC 4.0. This only affects the Objective-C additions to
3253 the C/C++ language; it does not affect conformance to C/C++ standards,
3254 which is controlled by the separate C/C++ dialect option flags. When
3255 this option is used with the Objective-C or Objective-C++ compiler,
3256 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3257 This is useful if you need to make sure that your Objective-C code can
3258 be compiled with older versions of GCC@.
3259
3260 @item -freplace-objc-classes
3261 @opindex freplace-objc-classes
3262 Emit a special marker instructing @command{ld(1)} not to statically link in
3263 the resulting object file, and allow @command{dyld(1)} to load it in at
3264 run time instead. This is used in conjunction with the Fix-and-Continue
3265 debugging mode, where the object file in question may be recompiled and
3266 dynamically reloaded in the course of program execution, without the need
3267 to restart the program itself. Currently, Fix-and-Continue functionality
3268 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3269 and later.
3270
3271 @item -fzero-link
3272 @opindex fzero-link
3273 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3274 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3275 compile time) with static class references that get initialized at load time,
3276 which improves run-time performance. Specifying the @option{-fzero-link} flag
3277 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3278 to be retained. This is useful in Zero-Link debugging mode, since it allows
3279 for individual class implementations to be modified during program execution.
3280 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3281 regardless of command-line options.
3282
3283 @item -fno-local-ivars
3284 @opindex fno-local-ivars
3285 @opindex flocal-ivars
3286 By default instance variables in Objective-C can be accessed as if
3287 they were local variables from within the methods of the class they're
3288 declared in. This can lead to shadowing between instance variables
3289 and other variables declared either locally inside a class method or
3290 globally with the same name. Specifying the @option{-fno-local-ivars}
3291 flag disables this behavior thus avoiding variable shadowing issues.
3292
3293 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3294 @opindex fivar-visibility
3295 Set the default instance variable visibility to the specified option
3296 so that instance variables declared outside the scope of any access
3297 modifier directives default to the specified visibility.
3298
3299 @item -gen-decls
3300 @opindex gen-decls
3301 Dump interface declarations for all classes seen in the source file to a
3302 file named @file{@var{sourcename}.decl}.
3303
3304 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3305 @opindex Wassign-intercept
3306 @opindex Wno-assign-intercept
3307 Warn whenever an Objective-C assignment is being intercepted by the
3308 garbage collector.
3309
3310 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3311 @opindex Wno-protocol
3312 @opindex Wprotocol
3313 If a class is declared to implement a protocol, a warning is issued for
3314 every method in the protocol that is not implemented by the class. The
3315 default behavior is to issue a warning for every method not explicitly
3316 implemented in the class, even if a method implementation is inherited
3317 from the superclass. If you use the @option{-Wno-protocol} option, then
3318 methods inherited from the superclass are considered to be implemented,
3319 and no warning is issued for them.
3320
3321 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3322 @opindex Wselector
3323 @opindex Wno-selector
3324 Warn if multiple methods of different types for the same selector are
3325 found during compilation. The check is performed on the list of methods
3326 in the final stage of compilation. Additionally, a check is performed
3327 for each selector appearing in a @code{@@selector(@dots{})}
3328 expression, and a corresponding method for that selector has been found
3329 during compilation. Because these checks scan the method table only at
3330 the end of compilation, these warnings are not produced if the final
3331 stage of compilation is not reached, for example because an error is
3332 found during compilation, or because the @option{-fsyntax-only} option is
3333 being used.
3334
3335 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3336 @opindex Wstrict-selector-match
3337 @opindex Wno-strict-selector-match
3338 Warn if multiple methods with differing argument and/or return types are
3339 found for a given selector when attempting to send a message using this
3340 selector to a receiver of type @code{id} or @code{Class}. When this flag
3341 is off (which is the default behavior), the compiler omits such warnings
3342 if any differences found are confined to types that share the same size
3343 and alignment.
3344
3345 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3346 @opindex Wundeclared-selector
3347 @opindex Wno-undeclared-selector
3348 Warn if a @code{@@selector(@dots{})} expression referring to an
3349 undeclared selector is found. A selector is considered undeclared if no
3350 method with that name has been declared before the
3351 @code{@@selector(@dots{})} expression, either explicitly in an
3352 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3353 an @code{@@implementation} section. This option always performs its
3354 checks as soon as a @code{@@selector(@dots{})} expression is found,
3355 while @option{-Wselector} only performs its checks in the final stage of
3356 compilation. This also enforces the coding style convention
3357 that methods and selectors must be declared before being used.
3358
3359 @item -print-objc-runtime-info
3360 @opindex print-objc-runtime-info
3361 Generate C header describing the largest structure that is passed by
3362 value, if any.
3363
3364 @end table
3365
3366 @node Diagnostic Message Formatting Options
3367 @section Options to Control Diagnostic Messages Formatting
3368 @cindex options to control diagnostics formatting
3369 @cindex diagnostic messages
3370 @cindex message formatting
3371
3372 Traditionally, diagnostic messages have been formatted irrespective of
3373 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3374 options described below
3375 to control the formatting algorithm for diagnostic messages,
3376 e.g.@: how many characters per line, how often source location
3377 information should be reported. Note that some language front ends may not
3378 honor these options.
3379
3380 @table @gcctabopt
3381 @item -fmessage-length=@var{n}
3382 @opindex fmessage-length
3383 Try to format error messages so that they fit on lines of about
3384 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3385 done; each error message appears on a single line. This is the
3386 default for all front ends.
3387
3388 @item -fdiagnostics-show-location=once
3389 @opindex fdiagnostics-show-location
3390 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3391 reporter to emit source location information @emph{once}; that is, in
3392 case the message is too long to fit on a single physical line and has to
3393 be wrapped, the source location won't be emitted (as prefix) again,
3394 over and over, in subsequent continuation lines. This is the default
3395 behavior.
3396
3397 @item -fdiagnostics-show-location=every-line
3398 Only meaningful in line-wrapping mode. Instructs the diagnostic
3399 messages reporter to emit the same source location information (as
3400 prefix) for physical lines that result from the process of breaking
3401 a message which is too long to fit on a single line.
3402
3403 @item -fdiagnostics-color[=@var{WHEN}]
3404 @itemx -fno-diagnostics-color
3405 @opindex fdiagnostics-color
3406 @cindex highlight, color
3407 @vindex GCC_COLORS @r{environment variable}
3408 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3409 or @samp{auto}. The default depends on how the compiler has been configured,
3410 it can be any of the above @var{WHEN} options or also @samp{never}
3411 if @env{GCC_COLORS} environment variable isn't present in the environment,
3412 and @samp{auto} otherwise.
3413 @samp{auto} means to use color only when the standard error is a terminal.
3414 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3415 aliases for @option{-fdiagnostics-color=always} and
3416 @option{-fdiagnostics-color=never}, respectively.
3417
3418 The colors are defined by the environment variable @env{GCC_COLORS}.
3419 Its value is a colon-separated list of capabilities and Select Graphic
3420 Rendition (SGR) substrings. SGR commands are interpreted by the
3421 terminal or terminal emulator. (See the section in the documentation
3422 of your text terminal for permitted values and their meanings as
3423 character attributes.) These substring values are integers in decimal
3424 representation and can be concatenated with semicolons.
3425 Common values to concatenate include
3426 @samp{1} for bold,
3427 @samp{4} for underline,
3428 @samp{5} for blink,
3429 @samp{7} for inverse,
3430 @samp{39} for default foreground color,
3431 @samp{30} to @samp{37} for foreground colors,
3432 @samp{90} to @samp{97} for 16-color mode foreground colors,
3433 @samp{38;5;0} to @samp{38;5;255}
3434 for 88-color and 256-color modes foreground colors,
3435 @samp{49} for default background color,
3436 @samp{40} to @samp{47} for background colors,
3437 @samp{100} to @samp{107} for 16-color mode background colors,
3438 and @samp{48;5;0} to @samp{48;5;255}
3439 for 88-color and 256-color modes background colors.
3440
3441 The default @env{GCC_COLORS} is
3442 @smallexample
3443 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3444 quote=01:fixit-insert=32:fixit-delete=31:\
3445 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32
3446 @end smallexample
3447 @noindent
3448 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3449 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3450 @samp{01} is bold, and @samp{31} is red.
3451 Setting @env{GCC_COLORS} to the empty string disables colors.
3452 Supported capabilities are as follows.
3453
3454 @table @code
3455 @item error=
3456 @vindex error GCC_COLORS @r{capability}
3457 SGR substring for error: markers.
3458
3459 @item warning=
3460 @vindex warning GCC_COLORS @r{capability}
3461 SGR substring for warning: markers.
3462
3463 @item note=
3464 @vindex note GCC_COLORS @r{capability}
3465 SGR substring for note: markers.
3466
3467 @item range1=
3468 @vindex range1 GCC_COLORS @r{capability}
3469 SGR substring for first additional range.
3470
3471 @item range2=
3472 @vindex range2 GCC_COLORS @r{capability}
3473 SGR substring for second additional range.
3474
3475 @item locus=
3476 @vindex locus GCC_COLORS @r{capability}
3477 SGR substring for location information, @samp{file:line} or
3478 @samp{file:line:column} etc.
3479
3480 @item quote=
3481 @vindex quote GCC_COLORS @r{capability}
3482 SGR substring for information printed within quotes.
3483
3484 @item fixit-insert=
3485 @vindex fixit-insert GCC_COLORS @r{capability}
3486 SGR substring for fix-it hints suggesting text to
3487 be inserted or replaced.
3488
3489 @item fixit-delete=
3490 @vindex fixit-delete GCC_COLORS @r{capability}
3491 SGR substring for fix-it hints suggesting text to
3492 be deleted.
3493
3494 @item diff-filename=
3495 @vindex diff-filename GCC_COLORS @r{capability}
3496 SGR substring for filename headers within generated patches.
3497
3498 @item diff-hunk=
3499 @vindex diff-hunk GCC_COLORS @r{capability}
3500 SGR substring for the starts of hunks within generated patches.
3501
3502 @item diff-delete=
3503 @vindex diff-delete GCC_COLORS @r{capability}
3504 SGR substring for deleted lines within generated patches.
3505
3506 @item diff-insert=
3507 @vindex diff-insert GCC_COLORS @r{capability}
3508 SGR substring for inserted lines within generated patches.
3509 @end table
3510
3511 @item -fno-diagnostics-show-option
3512 @opindex fno-diagnostics-show-option
3513 @opindex fdiagnostics-show-option
3514 By default, each diagnostic emitted includes text indicating the
3515 command-line option that directly controls the diagnostic (if such an
3516 option is known to the diagnostic machinery). Specifying the
3517 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3518
3519 @item -fno-diagnostics-show-caret
3520 @opindex fno-diagnostics-show-caret
3521 @opindex fdiagnostics-show-caret
3522 By default, each diagnostic emitted includes the original source line
3523 and a caret @samp{^} indicating the column. This option suppresses this
3524 information. The source line is truncated to @var{n} characters, if
3525 the @option{-fmessage-length=n} option is given. When the output is done
3526 to the terminal, the width is limited to the width given by the
3527 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3528
3529 @item -fdiagnostics-parseable-fixits
3530 @opindex fdiagnostics-parseable-fixits
3531 Emit fix-it hints in a machine-parseable format, suitable for consumption
3532 by IDEs. For each fix-it, a line will be printed after the relevant
3533 diagnostic, starting with the string ``fix-it:''. For example:
3534
3535 @smallexample
3536 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3537 @end smallexample
3538
3539 The location is expressed as a half-open range, expressed as a count of
3540 bytes, starting at byte 1 for the initial column. In the above example,
3541 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3542 given string:
3543
3544 @smallexample
3545 00000000011111111112222222222
3546 12345678901234567890123456789
3547 gtk_widget_showall (dlg);
3548 ^^^^^^^^^^^^^^^^^^
3549 gtk_widget_show_all
3550 @end smallexample
3551
3552 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3553 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3554 (e.g. vertical tab as ``\013'').
3555
3556 An empty replacement string indicates that the given range is to be removed.
3557 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3558 be inserted at the given position.
3559
3560 @item -fdiagnostics-generate-patch
3561 @opindex fdiagnostics-generate-patch
3562 Print fix-it hints to stderr in unified diff format, after any diagnostics
3563 are printed. For example:
3564
3565 @smallexample
3566 --- test.c
3567 +++ test.c
3568 @@ -42,5 +42,5 @@
3569
3570 void show_cb(GtkDialog *dlg)
3571 @{
3572 - gtk_widget_showall(dlg);
3573 + gtk_widget_show_all(dlg);
3574 @}
3575
3576 @end smallexample
3577
3578 The diff may or may not be colorized, following the same rules
3579 as for diagnostics (see @option{-fdiagnostics-color}).
3580
3581 @item -fno-show-column
3582 @opindex fno-show-column
3583 Do not print column numbers in diagnostics. This may be necessary if
3584 diagnostics are being scanned by a program that does not understand the
3585 column numbers, such as @command{dejagnu}.
3586
3587 @end table
3588
3589 @node Warning Options
3590 @section Options to Request or Suppress Warnings
3591 @cindex options to control warnings
3592 @cindex warning messages
3593 @cindex messages, warning
3594 @cindex suppressing warnings
3595
3596 Warnings are diagnostic messages that report constructions that
3597 are not inherently erroneous but that are risky or suggest there
3598 may have been an error.
3599
3600 The following language-independent options do not enable specific
3601 warnings but control the kinds of diagnostics produced by GCC@.
3602
3603 @table @gcctabopt
3604 @cindex syntax checking
3605 @item -fsyntax-only
3606 @opindex fsyntax-only
3607 Check the code for syntax errors, but don't do anything beyond that.
3608
3609 @item -fmax-errors=@var{n}
3610 @opindex fmax-errors
3611 Limits the maximum number of error messages to @var{n}, at which point
3612 GCC bails out rather than attempting to continue processing the source
3613 code. If @var{n} is 0 (the default), there is no limit on the number
3614 of error messages produced. If @option{-Wfatal-errors} is also
3615 specified, then @option{-Wfatal-errors} takes precedence over this
3616 option.
3617
3618 @item -w
3619 @opindex w
3620 Inhibit all warning messages.
3621
3622 @item -Werror
3623 @opindex Werror
3624 @opindex Wno-error
3625 Make all warnings into errors.
3626
3627 @item -Werror=
3628 @opindex Werror=
3629 @opindex Wno-error=
3630 Make the specified warning into an error. The specifier for a warning
3631 is appended; for example @option{-Werror=switch} turns the warnings
3632 controlled by @option{-Wswitch} into errors. This switch takes a
3633 negative form, to be used to negate @option{-Werror} for specific
3634 warnings; for example @option{-Wno-error=switch} makes
3635 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3636 is in effect.
3637
3638 The warning message for each controllable warning includes the
3639 option that controls the warning. That option can then be used with
3640 @option{-Werror=} and @option{-Wno-error=} as described above.
3641 (Printing of the option in the warning message can be disabled using the
3642 @option{-fno-diagnostics-show-option} flag.)
3643
3644 Note that specifying @option{-Werror=}@var{foo} automatically implies
3645 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3646 imply anything.
3647
3648 @item -Wfatal-errors
3649 @opindex Wfatal-errors
3650 @opindex Wno-fatal-errors
3651 This option causes the compiler to abort compilation on the first error
3652 occurred rather than trying to keep going and printing further error
3653 messages.
3654
3655 @end table
3656
3657 You can request many specific warnings with options beginning with
3658 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3659 implicit declarations. Each of these specific warning options also
3660 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3661 example, @option{-Wno-implicit}. This manual lists only one of the
3662 two forms, whichever is not the default. For further
3663 language-specific options also refer to @ref{C++ Dialect Options} and
3664 @ref{Objective-C and Objective-C++ Dialect Options}.
3665
3666 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3667 options, such as @option{-Wunused}, which may turn on further options,
3668 such as @option{-Wunused-value}. The combined effect of positive and
3669 negative forms is that more specific options have priority over less
3670 specific ones, independently of their position in the command-line. For
3671 options of the same specificity, the last one takes effect. Options
3672 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3673 as if they appeared at the end of the command-line.
3674
3675 When an unrecognized warning option is requested (e.g.,
3676 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3677 that the option is not recognized. However, if the @option{-Wno-} form
3678 is used, the behavior is slightly different: no diagnostic is
3679 produced for @option{-Wno-unknown-warning} unless other diagnostics
3680 are being produced. This allows the use of new @option{-Wno-} options
3681 with old compilers, but if something goes wrong, the compiler
3682 warns that an unrecognized option is present.
3683
3684 @table @gcctabopt
3685 @item -Wpedantic
3686 @itemx -pedantic
3687 @opindex pedantic
3688 @opindex Wpedantic
3689 Issue all the warnings demanded by strict ISO C and ISO C++;
3690 reject all programs that use forbidden extensions, and some other
3691 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3692 version of the ISO C standard specified by any @option{-std} option used.
3693
3694 Valid ISO C and ISO C++ programs should compile properly with or without
3695 this option (though a rare few require @option{-ansi} or a
3696 @option{-std} option specifying the required version of ISO C)@. However,
3697 without this option, certain GNU extensions and traditional C and C++
3698 features are supported as well. With this option, they are rejected.
3699
3700 @option{-Wpedantic} does not cause warning messages for use of the
3701 alternate keywords whose names begin and end with @samp{__}. Pedantic
3702 warnings are also disabled in the expression that follows
3703 @code{__extension__}. However, only system header files should use
3704 these escape routes; application programs should avoid them.
3705 @xref{Alternate Keywords}.
3706
3707 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3708 C conformance. They soon find that it does not do quite what they want:
3709 it finds some non-ISO practices, but not all---only those for which
3710 ISO C @emph{requires} a diagnostic, and some others for which
3711 diagnostics have been added.
3712
3713 A feature to report any failure to conform to ISO C might be useful in
3714 some instances, but would require considerable additional work and would
3715 be quite different from @option{-Wpedantic}. We don't have plans to
3716 support such a feature in the near future.
3717
3718 Where the standard specified with @option{-std} represents a GNU
3719 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3720 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3721 extended dialect is based. Warnings from @option{-Wpedantic} are given
3722 where they are required by the base standard. (It does not make sense
3723 for such warnings to be given only for features not in the specified GNU
3724 C dialect, since by definition the GNU dialects of C include all
3725 features the compiler supports with the given option, and there would be
3726 nothing to warn about.)
3727
3728 @item -pedantic-errors
3729 @opindex pedantic-errors
3730 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3731 requires a diagnostic, in some cases where there is undefined behavior
3732 at compile-time and in some other cases that do not prevent compilation
3733 of programs that are valid according to the standard. This is not
3734 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3735 by this option and not enabled by the latter and vice versa.
3736
3737 @item -Wall
3738 @opindex Wall
3739 @opindex Wno-all
3740 This enables all the warnings about constructions that some users
3741 consider questionable, and that are easy to avoid (or modify to
3742 prevent the warning), even in conjunction with macros. This also
3743 enables some language-specific warnings described in @ref{C++ Dialect
3744 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3745
3746 @option{-Wall} turns on the following warning flags:
3747
3748 @gccoptlist{-Waddress @gol
3749 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3750 -Wbool-compare @gol
3751 -Wbool-operation @gol
3752 -Wc++11-compat -Wc++14-compat @gol
3753 -Wchar-subscripts @gol
3754 -Wcomment @gol
3755 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3756 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3757 -Wformat @gol
3758 -Wint-in-bool-context @gol
3759 -Wimplicit @r{(C and Objective-C only)} @gol
3760 -Wimplicit-int @r{(C and Objective-C only)} @gol
3761 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3762 -Winit-self @r{(only for C++)} @gol
3763 -Wlogical-not-parentheses @gol
3764 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3765 -Wmaybe-uninitialized @gol
3766 -Wmemset-elt-size @gol
3767 -Wmemset-transposed-args @gol
3768 -Wmisleading-indentation @r{(only for C/C++)} @gol
3769 -Wmissing-braces @r{(only for C/ObjC)} @gol
3770 -Wnarrowing @r{(only for C++)} @gol
3771 -Wnonnull @gol
3772 -Wnonnull-compare @gol
3773 -Wopenmp-simd @gol
3774 -Wparentheses @gol
3775 -Wpointer-sign @gol
3776 -Wreorder @gol
3777 -Wreturn-type @gol
3778 -Wsequence-point @gol
3779 -Wsign-compare @r{(only in C++)} @gol
3780 -Wsizeof-pointer-memaccess @gol
3781 -Wstrict-aliasing @gol
3782 -Wstrict-overflow=1 @gol
3783 -Wswitch @gol
3784 -Wtautological-compare @gol
3785 -Wtrigraphs @gol
3786 -Wuninitialized @gol
3787 -Wunknown-pragmas @gol
3788 -Wunused-function @gol
3789 -Wunused-label @gol
3790 -Wunused-value @gol
3791 -Wunused-variable @gol
3792 -Wvolatile-register-var @gol
3793 }
3794
3795 Note that some warning flags are not implied by @option{-Wall}. Some of
3796 them warn about constructions that users generally do not consider
3797 questionable, but which occasionally you might wish to check for;
3798 others warn about constructions that are necessary or hard to avoid in
3799 some cases, and there is no simple way to modify the code to suppress
3800 the warning. Some of them are enabled by @option{-Wextra} but many of
3801 them must be enabled individually.
3802
3803 @item -Wextra
3804 @opindex W
3805 @opindex Wextra
3806 @opindex Wno-extra
3807 This enables some extra warning flags that are not enabled by
3808 @option{-Wall}. (This option used to be called @option{-W}. The older
3809 name is still supported, but the newer name is more descriptive.)
3810
3811 @gccoptlist{-Wclobbered @gol
3812 -Wempty-body @gol
3813 -Wignored-qualifiers @gol
3814 -Wimplicit-fallthrough=3 @gol
3815 -Wmissing-field-initializers @gol
3816 -Wmissing-parameter-type @r{(C only)} @gol
3817 -Wold-style-declaration @r{(C only)} @gol
3818 -Woverride-init @gol
3819 -Wsign-compare @r{(C only)} @gol
3820 -Wtype-limits @gol
3821 -Wuninitialized @gol
3822 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3823 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3824 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3825 }
3826
3827 The option @option{-Wextra} also prints warning messages for the
3828 following cases:
3829
3830 @itemize @bullet
3831
3832 @item
3833 A pointer is compared against integer zero with @code{<}, @code{<=},
3834 @code{>}, or @code{>=}.
3835
3836 @item
3837 (C++ only) An enumerator and a non-enumerator both appear in a
3838 conditional expression.
3839
3840 @item
3841 (C++ only) Ambiguous virtual bases.
3842
3843 @item
3844 (C++ only) Subscripting an array that has been declared @code{register}.
3845
3846 @item
3847 (C++ only) Taking the address of a variable that has been declared
3848 @code{register}.
3849
3850 @item
3851 (C++ only) A base class is not initialized in the copy constructor
3852 of a derived class.
3853
3854 @end itemize
3855
3856 @item -Wchar-subscripts
3857 @opindex Wchar-subscripts
3858 @opindex Wno-char-subscripts
3859 Warn if an array subscript has type @code{char}. This is a common cause
3860 of error, as programmers often forget that this type is signed on some
3861 machines.
3862 This warning is enabled by @option{-Wall}.
3863
3864 @item -Wchkp
3865 @opindex Wchkp
3866 Warn about an invalid memory access that is found by Pointer Bounds Checker
3867 (@option{-fcheck-pointer-bounds}).
3868
3869 @item -Wno-coverage-mismatch
3870 @opindex Wno-coverage-mismatch
3871 Warn if feedback profiles do not match when using the
3872 @option{-fprofile-use} option.
3873 If a source file is changed between compiling with @option{-fprofile-gen} and
3874 with @option{-fprofile-use}, the files with the profile feedback can fail
3875 to match the source file and GCC cannot use the profile feedback
3876 information. By default, this warning is enabled and is treated as an
3877 error. @option{-Wno-coverage-mismatch} can be used to disable the
3878 warning or @option{-Wno-error=coverage-mismatch} can be used to
3879 disable the error. Disabling the error for this warning can result in
3880 poorly optimized code and is useful only in the
3881 case of very minor changes such as bug fixes to an existing code-base.
3882 Completely disabling the warning is not recommended.
3883
3884 @item -Wno-cpp
3885 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3886
3887 Suppress warning messages emitted by @code{#warning} directives.
3888
3889 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3890 @opindex Wdouble-promotion
3891 @opindex Wno-double-promotion
3892 Give a warning when a value of type @code{float} is implicitly
3893 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3894 floating-point unit implement @code{float} in hardware, but emulate
3895 @code{double} in software. On such a machine, doing computations
3896 using @code{double} values is much more expensive because of the
3897 overhead required for software emulation.
3898
3899 It is easy to accidentally do computations with @code{double} because
3900 floating-point literals are implicitly of type @code{double}. For
3901 example, in:
3902 @smallexample
3903 @group
3904 float area(float radius)
3905 @{
3906 return 3.14159 * radius * radius;
3907 @}
3908 @end group
3909 @end smallexample
3910 the compiler performs the entire computation with @code{double}
3911 because the floating-point literal is a @code{double}.
3912
3913 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
3914 @opindex Wduplicate-decl-specifier
3915 @opindex Wno-duplicate-decl-specifier
3916 Warn if a declaration has duplicate @code{const}, @code{volatile},
3917 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
3918 @option{-Wall}.
3919
3920 @item -Wformat
3921 @itemx -Wformat=@var{n}
3922 @opindex Wformat
3923 @opindex Wno-format
3924 @opindex ffreestanding
3925 @opindex fno-builtin
3926 @opindex Wformat=
3927 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3928 the arguments supplied have types appropriate to the format string
3929 specified, and that the conversions specified in the format string make
3930 sense. This includes standard functions, and others specified by format
3931 attributes (@pxref{Function Attributes}), in the @code{printf},
3932 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3933 not in the C standard) families (or other target-specific families).
3934 Which functions are checked without format attributes having been
3935 specified depends on the standard version selected, and such checks of
3936 functions without the attribute specified are disabled by
3937 @option{-ffreestanding} or @option{-fno-builtin}.
3938
3939 The formats are checked against the format features supported by GNU
3940 libc version 2.2. These include all ISO C90 and C99 features, as well
3941 as features from the Single Unix Specification and some BSD and GNU
3942 extensions. Other library implementations may not support all these
3943 features; GCC does not support warning about features that go beyond a
3944 particular library's limitations. However, if @option{-Wpedantic} is used
3945 with @option{-Wformat}, warnings are given about format features not
3946 in the selected standard version (but not for @code{strfmon} formats,
3947 since those are not in any version of the C standard). @xref{C Dialect
3948 Options,,Options Controlling C Dialect}.
3949
3950 @table @gcctabopt
3951 @item -Wformat=1
3952 @itemx -Wformat
3953 @opindex Wformat
3954 @opindex Wformat=1
3955 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3956 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3957 @option{-Wformat} also checks for null format arguments for several
3958 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3959 aspects of this level of format checking can be disabled by the
3960 options: @option{-Wno-format-contains-nul},
3961 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3962 @option{-Wformat} is enabled by @option{-Wall}.
3963
3964 @item -Wno-format-contains-nul
3965 @opindex Wno-format-contains-nul
3966 @opindex Wformat-contains-nul
3967 If @option{-Wformat} is specified, do not warn about format strings that
3968 contain NUL bytes.
3969
3970 @item -Wno-format-extra-args
3971 @opindex Wno-format-extra-args
3972 @opindex Wformat-extra-args
3973 If @option{-Wformat} is specified, do not warn about excess arguments to a
3974 @code{printf} or @code{scanf} format function. The C standard specifies
3975 that such arguments are ignored.
3976
3977 Where the unused arguments lie between used arguments that are
3978 specified with @samp{$} operand number specifications, normally
3979 warnings are still given, since the implementation could not know what
3980 type to pass to @code{va_arg} to skip the unused arguments. However,
3981 in the case of @code{scanf} formats, this option suppresses the
3982 warning if the unused arguments are all pointers, since the Single
3983 Unix Specification says that such unused arguments are allowed.
3984
3985 @item -Wformat-overflow
3986 @itemx -Wformat-overflow=@var{level}
3987 @opindex Wformat-overflow
3988 @opindex Wno-format-overflow
3989 Warn about calls to formatted input/output functions such as @code{sprintf}
3990 and @code{vsprintf} that might overflow the destination buffer. When the
3991 exact number of bytes written by a format directive cannot be determined
3992 at compile-time it is estimated based on heuristics that depend on the
3993 @var{level} argument and on optimization. While enabling optimization
3994 will in most cases improve the accuracy of the warning, it may also
3995 result in false positives.
3996
3997 @table @gcctabopt
3998 @item -Wformat-overflow
3999 @item -Wformat-overflow=1
4000 @opindex Wformat-overflow
4001 @opindex Wno-format-overflow
4002 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4003 employs a conservative approach that warns only about calls that most
4004 likely overflow the buffer. At this level, numeric arguments to format
4005 directives with unknown values are assumed to have the value of one, and
4006 strings of unknown length to be empty. Numeric arguments that are known
4007 to be bounded to a subrange of their type, or string arguments whose output
4008 is bounded either by their directive's precision or by a finite set of
4009 string literals, are assumed to take on the value within the range that
4010 results in the most bytes on output. For example, the call to @code{sprintf}
4011 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4012 the terminating NUL character (@code{'\0'}) appended by the function
4013 to the destination buffer will be written past its end. Increasing
4014 the size of the buffer by a single byte is sufficient to avoid the
4015 warning, though it may not be sufficient to avoid the overflow.
4016
4017 @smallexample
4018 void f (int a, int b)
4019 @{
4020 char buf [12];
4021 sprintf (buf, "a = %i, b = %i\n", a, b);
4022 @}
4023 @end smallexample
4024
4025 @item -Wformat-overflow=2
4026 Level @var{2} warns also about calls that might overflow the destination
4027 buffer given an argument of sufficient length or magnitude. At level
4028 @var{2}, unknown numeric arguments are assumed to have the minimum
4029 representable value for signed types with a precision greater than 1, and
4030 the maximum representable value otherwise. Unknown string arguments whose
4031 length cannot be assumed to be bounded either by the directive's precision,
4032 or by a finite set of string literals they may evaluate to, or the character
4033 array they may point to, are assumed to be 1 character long.
4034
4035 At level @var{2}, the call in the example above is again diagnosed, but
4036 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4037 @code{%i} directive will write some of its digits beyond the end of
4038 the destination buffer. To make the call safe regardless of the values
4039 of the two variables, the size of the destination buffer must be increased
4040 to at least 34 bytes. GCC includes the minimum size of the buffer in
4041 an informational note following the warning.
4042
4043 An alternative to increasing the size of the destination buffer is to
4044 constrain the range of formatted values. The maximum length of string
4045 arguments can be bounded by specifying the precision in the format
4046 directive. When numeric arguments of format directives can be assumed
4047 to be bounded by less than the precision of their type, choosing
4048 an appropriate length modifier to the format specifier will reduce
4049 the required buffer size. For example, if @var{a} and @var{b} in the
4050 example above can be assumed to be within the precision of
4051 the @code{short int} type then using either the @code{%hi} format
4052 directive or casting the argument to @code{short} reduces the maximum
4053 required size of the buffer to 24 bytes.
4054
4055 @smallexample
4056 void f (int a, int b)
4057 @{
4058 char buf [23];
4059 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4060 @}
4061 @end smallexample
4062 @end table
4063
4064 @item -Wno-format-zero-length
4065 @opindex Wno-format-zero-length
4066 @opindex Wformat-zero-length
4067 If @option{-Wformat} is specified, do not warn about zero-length formats.
4068 The C standard specifies that zero-length formats are allowed.
4069
4070
4071 @item -Wformat=2
4072 @opindex Wformat=2
4073 Enable @option{-Wformat} plus additional format checks. Currently
4074 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4075 -Wformat-y2k}.
4076
4077 @item -Wformat-nonliteral
4078 @opindex Wformat-nonliteral
4079 @opindex Wno-format-nonliteral
4080 If @option{-Wformat} is specified, also warn if the format string is not a
4081 string literal and so cannot be checked, unless the format function
4082 takes its format arguments as a @code{va_list}.
4083
4084 @item -Wformat-security
4085 @opindex Wformat-security
4086 @opindex Wno-format-security
4087 If @option{-Wformat} is specified, also warn about uses of format
4088 functions that represent possible security problems. At present, this
4089 warns about calls to @code{printf} and @code{scanf} functions where the
4090 format string is not a string literal and there are no format arguments,
4091 as in @code{printf (foo);}. This may be a security hole if the format
4092 string came from untrusted input and contains @samp{%n}. (This is
4093 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4094 in future warnings may be added to @option{-Wformat-security} that are not
4095 included in @option{-Wformat-nonliteral}.)
4096
4097 @item -Wformat-signedness
4098 @opindex Wformat-signedness
4099 @opindex Wno-format-signedness
4100 If @option{-Wformat} is specified, also warn if the format string
4101 requires an unsigned argument and the argument is signed and vice versa.
4102
4103 @item -Wformat-truncation
4104 @itemx -Wformat-truncation=@var{level}
4105 @opindex Wformat-truncation
4106 @opindex Wno-format-truncation
4107 Warn about calls to formatted input/output functions such as @code{snprintf}
4108 and @code{vsnprintf} that might result in output truncation. When the exact
4109 number of bytes written by a format directive cannot be determined at
4110 compile-time it is estimated based on heuristics that depend on
4111 the @var{level} argument and on optimization. While enabling optimization
4112 will in most cases improve the accuracy of the warning, it may also result
4113 in false positives. Except as noted otherwise, the option uses the same
4114 logic @option{-Wformat-overflow}.
4115
4116 @table @gcctabopt
4117 @item -Wformat-truncation
4118 @item -Wformat-truncation=1
4119 @opindex Wformat-truncation
4120 @opindex Wno-format-overflow
4121 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4122 employs a conservative approach that warns only about calls to bounded
4123 functions whose return value is unused and that will most likely result
4124 in output truncation.
4125
4126 @item -Wformat-truncation=2
4127 Level @var{2} warns also about calls to bounded functions whose return
4128 value is used and that might result in truncation given an argument of
4129 sufficient length or magnitude.
4130 @end table
4131
4132 @item -Wformat-y2k
4133 @opindex Wformat-y2k
4134 @opindex Wno-format-y2k
4135 If @option{-Wformat} is specified, also warn about @code{strftime}
4136 formats that may yield only a two-digit year.
4137 @end table
4138
4139 @item -Wnonnull
4140 @opindex Wnonnull
4141 @opindex Wno-nonnull
4142 Warn about passing a null pointer for arguments marked as
4143 requiring a non-null value by the @code{nonnull} function attribute.
4144
4145 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4146 can be disabled with the @option{-Wno-nonnull} option.
4147
4148 @item -Wnonnull-compare
4149 @opindex Wnonnull-compare
4150 @opindex Wno-nonnull-compare
4151 Warn when comparing an argument marked with the @code{nonnull}
4152 function attribute against null inside the function.
4153
4154 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4155 can be disabled with the @option{-Wno-nonnull-compare} option.
4156
4157 @item -Wnull-dereference
4158 @opindex Wnull-dereference
4159 @opindex Wno-null-dereference
4160 Warn if the compiler detects paths that trigger erroneous or
4161 undefined behavior due to dereferencing a null pointer. This option
4162 is only active when @option{-fdelete-null-pointer-checks} is active,
4163 which is enabled by optimizations in most targets. The precision of
4164 the warnings depends on the optimization options used.
4165
4166 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4167 @opindex Winit-self
4168 @opindex Wno-init-self
4169 Warn about uninitialized variables that are initialized with themselves.
4170 Note this option can only be used with the @option{-Wuninitialized} option.
4171
4172 For example, GCC warns about @code{i} being uninitialized in the
4173 following snippet only when @option{-Winit-self} has been specified:
4174 @smallexample
4175 @group
4176 int f()
4177 @{
4178 int i = i;
4179 return i;
4180 @}
4181 @end group
4182 @end smallexample
4183
4184 This warning is enabled by @option{-Wall} in C++.
4185
4186 @item -Wimplicit-int @r{(C and Objective-C only)}
4187 @opindex Wimplicit-int
4188 @opindex Wno-implicit-int
4189 Warn when a declaration does not specify a type.
4190 This warning is enabled by @option{-Wall}.
4191
4192 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4193 @opindex Wimplicit-function-declaration
4194 @opindex Wno-implicit-function-declaration
4195 Give a warning whenever a function is used before being declared. In
4196 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4197 enabled by default and it is made into an error by
4198 @option{-pedantic-errors}. This warning is also enabled by
4199 @option{-Wall}.
4200
4201 @item -Wimplicit @r{(C and Objective-C only)}
4202 @opindex Wimplicit
4203 @opindex Wno-implicit
4204 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4205 This warning is enabled by @option{-Wall}.
4206
4207 @item -Wimplicit-fallthrough
4208 @opindex Wimplicit-fallthrough
4209 @opindex Wno-implicit-fallthrough
4210 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4211 and @option{-Wno-implicit-fallthrough} is the same as
4212 @option{-Wimplicit-fallthrough=0}.
4213
4214 @item -Wimplicit-fallthrough=@var{n}
4215 @opindex Wimplicit-fallthrough=
4216 Warn when a switch case falls through. For example:
4217
4218 @smallexample
4219 @group
4220 switch (cond)
4221 @{
4222 case 1:
4223 a = 1;
4224 break;
4225 case 2:
4226 a = 2;
4227 case 3:
4228 a = 3;
4229 break;
4230 @}
4231 @end group
4232 @end smallexample
4233
4234 This warning does not warn when the last statement of a case cannot
4235 fall through, e.g. when there is a return statement or a call to function
4236 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4237 also takes into account control flow statements, such as ifs, and only
4238 warns when appropriate. E.g.@:
4239
4240 @smallexample
4241 @group
4242 switch (cond)
4243 @{
4244 case 1:
4245 if (i > 3) @{
4246 bar (5);
4247 break;
4248 @} else if (i < 1) @{
4249 bar (0);
4250 @} else
4251 return;
4252 default:
4253 @dots{}
4254 @}
4255 @end group
4256 @end smallexample
4257
4258 Since there are occasions where a switch case fall through is desirable,
4259 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4260 to be used along with a null statement to suppress this warning that
4261 would normally occur:
4262
4263 @smallexample
4264 @group
4265 switch (cond)
4266 @{
4267 case 1:
4268 bar (0);
4269 __attribute__ ((fallthrough));
4270 default:
4271 @dots{}
4272 @}
4273 @end group
4274 @end smallexample
4275
4276 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4277 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4278 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4279 Instead of the these attributes, it is also possible to add a fallthrough
4280 comment to silence the warning. The whole body of the C or C++ style comment
4281 should match the given regular expressions listed below. The option argument
4282 @var{n} specifies what kind of comments are accepted:
4283
4284 @itemize @bullet
4285
4286 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4287
4288 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4289 expression, any comment is used as fallthrough comment.
4290
4291 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4292 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4293
4294 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4295 following regular expressions:
4296
4297 @itemize @bullet
4298
4299 @item @code{-fallthrough}
4300
4301 @item @code{@@fallthrough@@}
4302
4303 @item @code{lint -fallthrough[ \t]*}
4304
4305 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4306
4307 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4308
4309 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4310
4311 @end itemize
4312
4313 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4314 following regular expressions:
4315
4316 @itemize @bullet
4317
4318 @item @code{-fallthrough}
4319
4320 @item @code{@@fallthrough@@}
4321
4322 @item @code{lint -fallthrough[ \t]*}
4323
4324 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4325
4326 @end itemize
4327
4328 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4329 fallthrough comments, only attributes disable the warning.
4330
4331 @end itemize
4332
4333 The comment needs to be followed after optional whitespace and other comments
4334 by @code{case} or @code{default} keywords or by a user label that precedes some
4335 @code{case} or @code{default} label.
4336
4337 @smallexample
4338 @group
4339 switch (cond)
4340 @{
4341 case 1:
4342 bar (0);
4343 /* FALLTHRU */
4344 default:
4345 @dots{}
4346 @}
4347 @end group
4348 @end smallexample
4349
4350 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4351
4352 @item -Wignored-qualifiers @r{(C and C++ only)}
4353 @opindex Wignored-qualifiers
4354 @opindex Wno-ignored-qualifiers
4355 Warn if the return type of a function has a type qualifier
4356 such as @code{const}. For ISO C such a type qualifier has no effect,
4357 since the value returned by a function is not an lvalue.
4358 For C++, the warning is only emitted for scalar types or @code{void}.
4359 ISO C prohibits qualified @code{void} return types on function
4360 definitions, so such return types always receive a warning
4361 even without this option.
4362
4363 This warning is also enabled by @option{-Wextra}.
4364
4365 @item -Wignored-attributes @r{(C and C++ only)}
4366 @opindex Wignored-attributes
4367 @opindex Wno-ignored-attributes
4368 Warn when an attribute is ignored. This is different from the
4369 @option{-Wattributes} option in that it warns whenever the compiler decides
4370 to drop an attribute, not that the attribute is either unknown, used in a
4371 wrong place, etc. This warning is enabled by default.
4372
4373 @item -Wmain
4374 @opindex Wmain
4375 @opindex Wno-main
4376 Warn if the type of @code{main} is suspicious. @code{main} should be
4377 a function with external linkage, returning int, taking either zero
4378 arguments, two, or three arguments of appropriate types. This warning
4379 is enabled by default in C++ and is enabled by either @option{-Wall}
4380 or @option{-Wpedantic}.
4381
4382 @item -Wmisleading-indentation @r{(C and C++ only)}
4383 @opindex Wmisleading-indentation
4384 @opindex Wno-misleading-indentation
4385 Warn when the indentation of the code does not reflect the block structure.
4386 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4387 @code{for} clauses with a guarded statement that does not use braces,
4388 followed by an unguarded statement with the same indentation.
4389
4390 In the following example, the call to ``bar'' is misleadingly indented as
4391 if it were guarded by the ``if'' conditional.
4392
4393 @smallexample
4394 if (some_condition ())
4395 foo ();
4396 bar (); /* Gotcha: this is not guarded by the "if". */
4397 @end smallexample
4398
4399 In the case of mixed tabs and spaces, the warning uses the
4400 @option{-ftabstop=} option to determine if the statements line up
4401 (defaulting to 8).
4402
4403 The warning is not issued for code involving multiline preprocessor logic
4404 such as the following example.
4405
4406 @smallexample
4407 if (flagA)
4408 foo (0);
4409 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4410 if (flagB)
4411 #endif
4412 foo (1);
4413 @end smallexample
4414
4415 The warning is not issued after a @code{#line} directive, since this
4416 typically indicates autogenerated code, and no assumptions can be made
4417 about the layout of the file that the directive references.
4418
4419 This warning is enabled by @option{-Wall} in C and C++.
4420
4421 @item -Wmissing-braces
4422 @opindex Wmissing-braces
4423 @opindex Wno-missing-braces
4424 Warn if an aggregate or union initializer is not fully bracketed. In
4425 the following example, the initializer for @code{a} is not fully
4426 bracketed, but that for @code{b} is fully bracketed. This warning is
4427 enabled by @option{-Wall} in C.
4428
4429 @smallexample
4430 int a[2][2] = @{ 0, 1, 2, 3 @};
4431 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4432 @end smallexample
4433
4434 This warning is enabled by @option{-Wall}.
4435
4436 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4437 @opindex Wmissing-include-dirs
4438 @opindex Wno-missing-include-dirs
4439 Warn if a user-supplied include directory does not exist.
4440
4441 @item -Wparentheses
4442 @opindex Wparentheses
4443 @opindex Wno-parentheses
4444 Warn if parentheses are omitted in certain contexts, such
4445 as when there is an assignment in a context where a truth value
4446 is expected, or when operators are nested whose precedence people
4447 often get confused about.
4448
4449 Also warn if a comparison like @code{x<=y<=z} appears; this is
4450 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4451 interpretation from that of ordinary mathematical notation.
4452
4453 Also warn for dangerous uses of the GNU extension to
4454 @code{?:} with omitted middle operand. When the condition
4455 in the @code{?}: operator is a boolean expression, the omitted value is
4456 always 1. Often programmers expect it to be a value computed
4457 inside the conditional expression instead.
4458
4459 This warning is enabled by @option{-Wall}.
4460
4461 @item -Wsequence-point
4462 @opindex Wsequence-point
4463 @opindex Wno-sequence-point
4464 Warn about code that may have undefined semantics because of violations
4465 of sequence point rules in the C and C++ standards.
4466
4467 The C and C++ standards define the order in which expressions in a C/C++
4468 program are evaluated in terms of @dfn{sequence points}, which represent
4469 a partial ordering between the execution of parts of the program: those
4470 executed before the sequence point, and those executed after it. These
4471 occur after the evaluation of a full expression (one which is not part
4472 of a larger expression), after the evaluation of the first operand of a
4473 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4474 function is called (but after the evaluation of its arguments and the
4475 expression denoting the called function), and in certain other places.
4476 Other than as expressed by the sequence point rules, the order of
4477 evaluation of subexpressions of an expression is not specified. All
4478 these rules describe only a partial order rather than a total order,
4479 since, for example, if two functions are called within one expression
4480 with no sequence point between them, the order in which the functions
4481 are called is not specified. However, the standards committee have
4482 ruled that function calls do not overlap.
4483
4484 It is not specified when between sequence points modifications to the
4485 values of objects take effect. Programs whose behavior depends on this
4486 have undefined behavior; the C and C++ standards specify that ``Between
4487 the previous and next sequence point an object shall have its stored
4488 value modified at most once by the evaluation of an expression.
4489 Furthermore, the prior value shall be read only to determine the value
4490 to be stored.''. If a program breaks these rules, the results on any
4491 particular implementation are entirely unpredictable.
4492
4493 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4494 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4495 diagnosed by this option, and it may give an occasional false positive
4496 result, but in general it has been found fairly effective at detecting
4497 this sort of problem in programs.
4498
4499 The C++17 standard will define the order of evaluation of operands in
4500 more cases: in particular it requires that the right-hand side of an
4501 assignment be evaluated before the left-hand side, so the above
4502 examples are no longer undefined. But this warning will still warn
4503 about them, to help people avoid writing code that is undefined in C
4504 and earlier revisions of C++.
4505
4506 The standard is worded confusingly, therefore there is some debate
4507 over the precise meaning of the sequence point rules in subtle cases.
4508 Links to discussions of the problem, including proposed formal
4509 definitions, may be found on the GCC readings page, at
4510 @uref{http://gcc.gnu.org/@/readings.html}.
4511
4512 This warning is enabled by @option{-Wall} for C and C++.
4513
4514 @item -Wno-return-local-addr
4515 @opindex Wno-return-local-addr
4516 @opindex Wreturn-local-addr
4517 Do not warn about returning a pointer (or in C++, a reference) to a
4518 variable that goes out of scope after the function returns.
4519
4520 @item -Wreturn-type
4521 @opindex Wreturn-type
4522 @opindex Wno-return-type
4523 Warn whenever a function is defined with a return type that defaults
4524 to @code{int}. Also warn about any @code{return} statement with no
4525 return value in a function whose return type is not @code{void}
4526 (falling off the end of the function body is considered returning
4527 without a value).
4528
4529 For C only, warn about a @code{return} statement with an expression in a
4530 function whose return type is @code{void}, unless the expression type is
4531 also @code{void}. As a GNU extension, the latter case is accepted
4532 without a warning unless @option{-Wpedantic} is used.
4533
4534 For C++, a function without return type always produces a diagnostic
4535 message, even when @option{-Wno-return-type} is specified. The only
4536 exceptions are @code{main} and functions defined in system headers.
4537
4538 This warning is enabled by @option{-Wall}.
4539
4540 @item -Wshift-count-negative
4541 @opindex Wshift-count-negative
4542 @opindex Wno-shift-count-negative
4543 Warn if shift count is negative. This warning is enabled by default.
4544
4545 @item -Wshift-count-overflow
4546 @opindex Wshift-count-overflow
4547 @opindex Wno-shift-count-overflow
4548 Warn if shift count >= width of type. This warning is enabled by default.
4549
4550 @item -Wshift-negative-value
4551 @opindex Wshift-negative-value
4552 @opindex Wno-shift-negative-value
4553 Warn if left shifting a negative value. This warning is enabled by
4554 @option{-Wextra} in C99 and C++11 modes (and newer).
4555
4556 @item -Wshift-overflow
4557 @itemx -Wshift-overflow=@var{n}
4558 @opindex Wshift-overflow
4559 @opindex Wno-shift-overflow
4560 Warn about left shift overflows. This warning is enabled by
4561 default in C99 and C++11 modes (and newer).
4562
4563 @table @gcctabopt
4564 @item -Wshift-overflow=1
4565 This is the warning level of @option{-Wshift-overflow} and is enabled
4566 by default in C99 and C++11 modes (and newer). This warning level does
4567 not warn about left-shifting 1 into the sign bit. (However, in C, such
4568 an overflow is still rejected in contexts where an integer constant expression
4569 is required.)
4570
4571 @item -Wshift-overflow=2
4572 This warning level also warns about left-shifting 1 into the sign bit,
4573 unless C++14 mode is active.
4574 @end table
4575
4576 @item -Wswitch
4577 @opindex Wswitch
4578 @opindex Wno-switch
4579 Warn whenever a @code{switch} statement has an index of enumerated type
4580 and lacks a @code{case} for one or more of the named codes of that
4581 enumeration. (The presence of a @code{default} label prevents this
4582 warning.) @code{case} labels outside the enumeration range also
4583 provoke warnings when this option is used (even if there is a
4584 @code{default} label).
4585 This warning is enabled by @option{-Wall}.
4586
4587 @item -Wswitch-default
4588 @opindex Wswitch-default
4589 @opindex Wno-switch-default
4590 Warn whenever a @code{switch} statement does not have a @code{default}
4591 case.
4592
4593 @item -Wswitch-enum
4594 @opindex Wswitch-enum
4595 @opindex Wno-switch-enum
4596 Warn whenever a @code{switch} statement has an index of enumerated type
4597 and lacks a @code{case} for one or more of the named codes of that
4598 enumeration. @code{case} labels outside the enumeration range also
4599 provoke warnings when this option is used. The only difference
4600 between @option{-Wswitch} and this option is that this option gives a
4601 warning about an omitted enumeration code even if there is a
4602 @code{default} label.
4603
4604 @item -Wswitch-bool
4605 @opindex Wswitch-bool
4606 @opindex Wno-switch-bool
4607 Warn whenever a @code{switch} statement has an index of boolean type
4608 and the case values are outside the range of a boolean type.
4609 It is possible to suppress this warning by casting the controlling
4610 expression to a type other than @code{bool}. For example:
4611 @smallexample
4612 @group
4613 switch ((int) (a == 4))
4614 @{
4615 @dots{}
4616 @}
4617 @end group
4618 @end smallexample
4619 This warning is enabled by default for C and C++ programs.
4620
4621 @item -Wswitch-unreachable
4622 @opindex Wswitch-unreachable
4623 @opindex Wno-switch-unreachable
4624 Warn whenever a @code{switch} statement contains statements between the
4625 controlling expression and the first case label, which will never be
4626 executed. For example:
4627 @smallexample
4628 @group
4629 switch (cond)
4630 @{
4631 i = 15;
4632 @dots{}
4633 case 5:
4634 @dots{}
4635 @}
4636 @end group
4637 @end smallexample
4638 @option{-Wswitch-unreachable} does not warn if the statement between the
4639 controlling expression and the first case label is just a declaration:
4640 @smallexample
4641 @group
4642 switch (cond)
4643 @{
4644 int i;
4645 @dots{}
4646 case 5:
4647 i = 5;
4648 @dots{}
4649 @}
4650 @end group
4651 @end smallexample
4652 This warning is enabled by default for C and C++ programs.
4653
4654 @item -Wsync-nand @r{(C and C++ only)}
4655 @opindex Wsync-nand
4656 @opindex Wno-sync-nand
4657 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4658 built-in functions are used. These functions changed semantics in GCC 4.4.
4659
4660 @item -Wunused-but-set-parameter
4661 @opindex Wunused-but-set-parameter
4662 @opindex Wno-unused-but-set-parameter
4663 Warn whenever a function parameter is assigned to, but otherwise unused
4664 (aside from its declaration).
4665
4666 To suppress this warning use the @code{unused} attribute
4667 (@pxref{Variable Attributes}).
4668
4669 This warning is also enabled by @option{-Wunused} together with
4670 @option{-Wextra}.
4671
4672 @item -Wunused-but-set-variable
4673 @opindex Wunused-but-set-variable
4674 @opindex Wno-unused-but-set-variable
4675 Warn whenever a local variable is assigned to, but otherwise unused
4676 (aside from its declaration).
4677 This warning is enabled by @option{-Wall}.
4678
4679 To suppress this warning use the @code{unused} attribute
4680 (@pxref{Variable Attributes}).
4681
4682 This warning is also enabled by @option{-Wunused}, which is enabled
4683 by @option{-Wall}.
4684
4685 @item -Wunused-function
4686 @opindex Wunused-function
4687 @opindex Wno-unused-function
4688 Warn whenever a static function is declared but not defined or a
4689 non-inline static function is unused.
4690 This warning is enabled by @option{-Wall}.
4691
4692 @item -Wunused-label
4693 @opindex Wunused-label
4694 @opindex Wno-unused-label
4695 Warn whenever a label is declared but not used.
4696 This warning is enabled by @option{-Wall}.
4697
4698 To suppress this warning use the @code{unused} attribute
4699 (@pxref{Variable Attributes}).
4700
4701 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4702 @opindex Wunused-local-typedefs
4703 Warn when a typedef locally defined in a function is not used.
4704 This warning is enabled by @option{-Wall}.
4705
4706 @item -Wunused-parameter
4707 @opindex Wunused-parameter
4708 @opindex Wno-unused-parameter
4709 Warn whenever a function parameter is unused aside from its declaration.
4710
4711 To suppress this warning use the @code{unused} attribute
4712 (@pxref{Variable Attributes}).
4713
4714 @item -Wno-unused-result
4715 @opindex Wunused-result
4716 @opindex Wno-unused-result
4717 Do not warn if a caller of a function marked with attribute
4718 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4719 its return value. The default is @option{-Wunused-result}.
4720
4721 @item -Wunused-variable
4722 @opindex Wunused-variable
4723 @opindex Wno-unused-variable
4724 Warn whenever a local or static variable is unused aside from its
4725 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4726 but not for C++. This warning is enabled by @option{-Wall}.
4727
4728 To suppress this warning use the @code{unused} attribute
4729 (@pxref{Variable Attributes}).
4730
4731 @item -Wunused-const-variable
4732 @itemx -Wunused-const-variable=@var{n}
4733 @opindex Wunused-const-variable
4734 @opindex Wno-unused-const-variable
4735 Warn whenever a constant static variable is unused aside from its declaration.
4736 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4737 for C, but not for C++. In C this declares variable storage, but in C++ this
4738 is not an error since const variables take the place of @code{#define}s.
4739
4740 To suppress this warning use the @code{unused} attribute
4741 (@pxref{Variable Attributes}).
4742
4743 @table @gcctabopt
4744 @item -Wunused-const-variable=1
4745 This is the warning level that is enabled by @option{-Wunused-variable} for
4746 C. It warns only about unused static const variables defined in the main
4747 compilation unit, but not about static const variables declared in any
4748 header included.
4749
4750 @item -Wunused-const-variable=2
4751 This warning level also warns for unused constant static variables in
4752 headers (excluding system headers). This is the warning level of
4753 @option{-Wunused-const-variable} and must be explicitly requested since
4754 in C++ this isn't an error and in C it might be harder to clean up all
4755 headers included.
4756 @end table
4757
4758 @item -Wunused-value
4759 @opindex Wunused-value
4760 @opindex Wno-unused-value
4761 Warn whenever a statement computes a result that is explicitly not
4762 used. To suppress this warning cast the unused expression to
4763 @code{void}. This includes an expression-statement or the left-hand
4764 side of a comma expression that contains no side effects. For example,
4765 an expression such as @code{x[i,j]} causes a warning, while
4766 @code{x[(void)i,j]} does not.
4767
4768 This warning is enabled by @option{-Wall}.
4769
4770 @item -Wunused
4771 @opindex Wunused
4772 @opindex Wno-unused
4773 All the above @option{-Wunused} options combined.
4774
4775 In order to get a warning about an unused function parameter, you must
4776 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4777 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4778
4779 @item -Wuninitialized
4780 @opindex Wuninitialized
4781 @opindex Wno-uninitialized
4782 Warn if an automatic variable is used without first being initialized
4783 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4784 warn if a non-static reference or non-static @code{const} member
4785 appears in a class without constructors.
4786
4787 If you want to warn about code that uses the uninitialized value of the
4788 variable in its own initializer, use the @option{-Winit-self} option.
4789
4790 These warnings occur for individual uninitialized or clobbered
4791 elements of structure, union or array variables as well as for
4792 variables that are uninitialized or clobbered as a whole. They do
4793 not occur for variables or elements declared @code{volatile}. Because
4794 these warnings depend on optimization, the exact variables or elements
4795 for which there are warnings depends on the precise optimization
4796 options and version of GCC used.
4797
4798 Note that there may be no warning about a variable that is used only
4799 to compute a value that itself is never used, because such
4800 computations may be deleted by data flow analysis before the warnings
4801 are printed.
4802
4803 @item -Winvalid-memory-model
4804 @opindex Winvalid-memory-model
4805 @opindex Wno-invalid-memory-model
4806 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4807 and the C11 atomic generic functions with a memory consistency argument
4808 that is either invalid for the operation or outside the range of values
4809 of the @code{memory_order} enumeration. For example, since the
4810 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4811 defined for the relaxed, release, and sequentially consistent memory
4812 orders the following code is diagnosed:
4813
4814 @smallexample
4815 void store (int *i)
4816 @{
4817 __atomic_store_n (i, 0, memory_order_consume);
4818 @}
4819 @end smallexample
4820
4821 @option{-Winvalid-memory-model} is enabled by default.
4822
4823 @item -Wmaybe-uninitialized
4824 @opindex Wmaybe-uninitialized
4825 @opindex Wno-maybe-uninitialized
4826 For an automatic variable, if there exists a path from the function
4827 entry to a use of the variable that is initialized, but there exist
4828 some other paths for which the variable is not initialized, the compiler
4829 emits a warning if it cannot prove the uninitialized paths are not
4830 executed at run time. These warnings are made optional because GCC is
4831 not smart enough to see all the reasons why the code might be correct
4832 in spite of appearing to have an error. Here is one example of how
4833 this can happen:
4834
4835 @smallexample
4836 @group
4837 @{
4838 int x;
4839 switch (y)
4840 @{
4841 case 1: x = 1;
4842 break;
4843 case 2: x = 4;
4844 break;
4845 case 3: x = 5;
4846 @}
4847 foo (x);
4848 @}
4849 @end group
4850 @end smallexample
4851
4852 @noindent
4853 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4854 always initialized, but GCC doesn't know this. To suppress the
4855 warning, you need to provide a default case with assert(0) or
4856 similar code.
4857
4858 @cindex @code{longjmp} warnings
4859 This option also warns when a non-volatile automatic variable might be
4860 changed by a call to @code{longjmp}. These warnings as well are possible
4861 only in optimizing compilation.
4862
4863 The compiler sees only the calls to @code{setjmp}. It cannot know
4864 where @code{longjmp} will be called; in fact, a signal handler could
4865 call it at any point in the code. As a result, you may get a warning
4866 even when there is in fact no problem because @code{longjmp} cannot
4867 in fact be called at the place that would cause a problem.
4868
4869 Some spurious warnings can be avoided if you declare all the functions
4870 you use that never return as @code{noreturn}. @xref{Function
4871 Attributes}.
4872
4873 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4874
4875 @item -Wunknown-pragmas
4876 @opindex Wunknown-pragmas
4877 @opindex Wno-unknown-pragmas
4878 @cindex warning for unknown pragmas
4879 @cindex unknown pragmas, warning
4880 @cindex pragmas, warning of unknown
4881 Warn when a @code{#pragma} directive is encountered that is not understood by
4882 GCC@. If this command-line option is used, warnings are even issued
4883 for unknown pragmas in system header files. This is not the case if
4884 the warnings are only enabled by the @option{-Wall} command-line option.
4885
4886 @item -Wno-pragmas
4887 @opindex Wno-pragmas
4888 @opindex Wpragmas
4889 Do not warn about misuses of pragmas, such as incorrect parameters,
4890 invalid syntax, or conflicts between pragmas. See also
4891 @option{-Wunknown-pragmas}.
4892
4893 @item -Wstrict-aliasing
4894 @opindex Wstrict-aliasing
4895 @opindex Wno-strict-aliasing
4896 This option is only active when @option{-fstrict-aliasing} is active.
4897 It warns about code that might break the strict aliasing rules that the
4898 compiler is using for optimization. The warning does not catch all
4899 cases, but does attempt to catch the more common pitfalls. It is
4900 included in @option{-Wall}.
4901 It is equivalent to @option{-Wstrict-aliasing=3}
4902
4903 @item -Wstrict-aliasing=n
4904 @opindex Wstrict-aliasing=n
4905 This option is only active when @option{-fstrict-aliasing} is active.
4906 It warns about code that might break the strict aliasing rules that the
4907 compiler is using for optimization.
4908 Higher levels correspond to higher accuracy (fewer false positives).
4909 Higher levels also correspond to more effort, similar to the way @option{-O}
4910 works.
4911 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4912
4913 Level 1: Most aggressive, quick, least accurate.
4914 Possibly useful when higher levels
4915 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4916 false negatives. However, it has many false positives.
4917 Warns for all pointer conversions between possibly incompatible types,
4918 even if never dereferenced. Runs in the front end only.
4919
4920 Level 2: Aggressive, quick, not too precise.
4921 May still have many false positives (not as many as level 1 though),
4922 and few false negatives (but possibly more than level 1).
4923 Unlike level 1, it only warns when an address is taken. Warns about
4924 incomplete types. Runs in the front end only.
4925
4926 Level 3 (default for @option{-Wstrict-aliasing}):
4927 Should have very few false positives and few false
4928 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4929 Takes care of the common pun+dereference pattern in the front end:
4930 @code{*(int*)&some_float}.
4931 If optimization is enabled, it also runs in the back end, where it deals
4932 with multiple statement cases using flow-sensitive points-to information.
4933 Only warns when the converted pointer is dereferenced.
4934 Does not warn about incomplete types.
4935
4936 @item -Wstrict-overflow
4937 @itemx -Wstrict-overflow=@var{n}
4938 @opindex Wstrict-overflow
4939 @opindex Wno-strict-overflow
4940 This option is only active when @option{-fstrict-overflow} is active.
4941 It warns about cases where the compiler optimizes based on the
4942 assumption that signed overflow does not occur. Note that it does not
4943 warn about all cases where the code might overflow: it only warns
4944 about cases where the compiler implements some optimization. Thus
4945 this warning depends on the optimization level.
4946
4947 An optimization that assumes that signed overflow does not occur is
4948 perfectly safe if the values of the variables involved are such that
4949 overflow never does, in fact, occur. Therefore this warning can
4950 easily give a false positive: a warning about code that is not
4951 actually a problem. To help focus on important issues, several
4952 warning levels are defined. No warnings are issued for the use of
4953 undefined signed overflow when estimating how many iterations a loop
4954 requires, in particular when determining whether a loop will be
4955 executed at all.
4956
4957 @table @gcctabopt
4958 @item -Wstrict-overflow=1
4959 Warn about cases that are both questionable and easy to avoid. For
4960 example, with @option{-fstrict-overflow}, the compiler simplifies
4961 @code{x + 1 > x} to @code{1}. This level of
4962 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4963 are not, and must be explicitly requested.
4964
4965 @item -Wstrict-overflow=2
4966 Also warn about other cases where a comparison is simplified to a
4967 constant. For example: @code{abs (x) >= 0}. This can only be
4968 simplified when @option{-fstrict-overflow} is in effect, because
4969 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4970 zero. @option{-Wstrict-overflow} (with no level) is the same as
4971 @option{-Wstrict-overflow=2}.
4972
4973 @item -Wstrict-overflow=3
4974 Also warn about other cases where a comparison is simplified. For
4975 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4976
4977 @item -Wstrict-overflow=4
4978 Also warn about other simplifications not covered by the above cases.
4979 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4980
4981 @item -Wstrict-overflow=5
4982 Also warn about cases where the compiler reduces the magnitude of a
4983 constant involved in a comparison. For example: @code{x + 2 > y} is
4984 simplified to @code{x + 1 >= y}. This is reported only at the
4985 highest warning level because this simplification applies to many
4986 comparisons, so this warning level gives a very large number of
4987 false positives.
4988 @end table
4989
4990 @item -Wstringop-overflow
4991 @itemx -Wstringop-overflow=@var{type}
4992 @opindex Wstringop-overflow
4993 @opindex Wno-stringop-overflow
4994 Warn for calls to string manipulation functions such as @code{memcpy} and
4995 @code{strcpy} that are determined to overflow the destination buffer. The
4996 optional argument is one greater than the type of Object Size Checking to
4997 perform to determine the size of the destination. @xref{Object Size Checking}.
4998 The argument is meaningful only for functions that operate on character arrays
4999 but not for raw memory functions like @code{memcpy} which always make use
5000 of Object Size type-0. The option also warns for calls that specify a size
5001 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5002 The option produces the best results with optimization enabled but can detect
5003 a small subset of simple buffer overflows even without optimization in
5004 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5005 correspond to the standard functions. In any case, the option warns about
5006 just a subset of buffer overflows detected by the corresponding overflow
5007 checking built-ins. For example, the option will issue a warning for
5008 the @code{strcpy} call below because it copies at least 5 characters
5009 (the string @code{"blue"} including the terminating NUL) into the buffer
5010 of size 4.
5011
5012 @smallexample
5013 enum Color @{ blue, purple, yellow @};
5014 const char* f (enum Color clr)
5015 @{
5016 static char buf [4];
5017 const char *str;
5018 switch (clr)
5019 @{
5020 case blue: str = "blue"; break;
5021 case purple: str = "purple"; break;
5022 case yellow: str = "yellow"; break;
5023 @}
5024
5025 return strcpy (buf, str); // warning here
5026 @}
5027 @end smallexample
5028
5029 Option @option{-Wstringop-overflow=2} is enabled by default.
5030
5031 @table @gcctabopt
5032 @item -Wstringop-overflow
5033 @item -Wstringop-overflow=1
5034 @opindex Wstringop-overflow
5035 @opindex Wno-stringop-overflow
5036 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5037 to determine the sizes of destination objects. This is the default setting
5038 of the option. At this setting the option will not warn for writes past
5039 the end of subobjects of larger objects accessed by pointers unless the
5040 size of the largest surrounding object is known. When the destination may
5041 be one of several objects it is assumed to be the largest one of them. On
5042 Linux systems, when optimization is enabled at this setting the option warns
5043 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5044 a non-zero value.
5045
5046 @item -Wstringop-overflow=2
5047 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5048 to determine the sizes of destination objects. At this setting the option
5049 will warn about overflows when writing to members of the largest complete
5050 objects whose exact size is known. It will, however, not warn for excessive
5051 writes to the same members of unknown objects referenced by pointers since
5052 they may point to arrays containing unknown numbers of elements.
5053
5054 @item -Wstringop-overflow=3
5055 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5056 to determine the sizes of destination objects. At this setting the option
5057 warns about overflowing the smallest object or data member. This is the
5058 most restrictive setting of the option that may result in warnings for safe
5059 code.
5060
5061 @item -Wstringop-overflow=4
5062 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5063 to determine the sizes of destination objects. At this setting the option
5064 will warn about overflowing any data members, and when the destination is
5065 one of several objects it uses the size of the largest of them to decide
5066 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5067 setting of the option may result in warnings for benign code.
5068 @end table
5069
5070 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
5071 @opindex Wsuggest-attribute=
5072 @opindex Wno-suggest-attribute=
5073 Warn for cases where adding an attribute may be beneficial. The
5074 attributes currently supported are listed below.
5075
5076 @table @gcctabopt
5077 @item -Wsuggest-attribute=pure
5078 @itemx -Wsuggest-attribute=const
5079 @itemx -Wsuggest-attribute=noreturn
5080 @opindex Wsuggest-attribute=pure
5081 @opindex Wno-suggest-attribute=pure
5082 @opindex Wsuggest-attribute=const
5083 @opindex Wno-suggest-attribute=const
5084 @opindex Wsuggest-attribute=noreturn
5085 @opindex Wno-suggest-attribute=noreturn
5086
5087 Warn about functions that might be candidates for attributes
5088 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
5089 functions visible in other compilation units or (in the case of @code{pure} and
5090 @code{const}) if it cannot prove that the function returns normally. A function
5091 returns normally if it doesn't contain an infinite loop or return abnormally
5092 by throwing, calling @code{abort} or trapping. This analysis requires option
5093 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
5094 higher. Higher optimization levels improve the accuracy of the analysis.
5095
5096 @item -Wsuggest-attribute=format
5097 @itemx -Wmissing-format-attribute
5098 @opindex Wsuggest-attribute=format
5099 @opindex Wmissing-format-attribute
5100 @opindex Wno-suggest-attribute=format
5101 @opindex Wno-missing-format-attribute
5102 @opindex Wformat
5103 @opindex Wno-format
5104
5105 Warn about function pointers that might be candidates for @code{format}
5106 attributes. Note these are only possible candidates, not absolute ones.
5107 GCC guesses that function pointers with @code{format} attributes that
5108 are used in assignment, initialization, parameter passing or return
5109 statements should have a corresponding @code{format} attribute in the
5110 resulting type. I.e.@: the left-hand side of the assignment or
5111 initialization, the type of the parameter variable, or the return type
5112 of the containing function respectively should also have a @code{format}
5113 attribute to avoid the warning.
5114
5115 GCC also warns about function definitions that might be
5116 candidates for @code{format} attributes. Again, these are only
5117 possible candidates. GCC guesses that @code{format} attributes
5118 might be appropriate for any function that calls a function like
5119 @code{vprintf} or @code{vscanf}, but this might not always be the
5120 case, and some functions for which @code{format} attributes are
5121 appropriate may not be detected.
5122 @end table
5123
5124 @item -Wsuggest-final-types
5125 @opindex Wno-suggest-final-types
5126 @opindex Wsuggest-final-types
5127 Warn about types with virtual methods where code quality would be improved
5128 if the type were declared with the C++11 @code{final} specifier,
5129 or, if possible,
5130 declared in an anonymous namespace. This allows GCC to more aggressively
5131 devirtualize the polymorphic calls. This warning is more effective with link
5132 time optimization, where the information about the class hierarchy graph is
5133 more complete.
5134
5135 @item -Wsuggest-final-methods
5136 @opindex Wno-suggest-final-methods
5137 @opindex Wsuggest-final-methods
5138 Warn about virtual methods where code quality would be improved if the method
5139 were declared with the C++11 @code{final} specifier,
5140 or, if possible, its type were
5141 declared in an anonymous namespace or with the @code{final} specifier.
5142 This warning is
5143 more effective with link-time optimization, where the information about the
5144 class hierarchy graph is more complete. It is recommended to first consider
5145 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5146 annotations.
5147
5148 @item -Wsuggest-override
5149 Warn about overriding virtual functions that are not marked with the override
5150 keyword.
5151
5152 @item -Walloc-zero
5153 @opindex Wno-alloc-zero
5154 @opindex Walloc-zero
5155 Warn about calls to allocation functions decorated with attribute
5156 @code{alloc_size} that specify zero bytes, including those to the built-in
5157 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5158 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5159 when called with a zero size differs among implementations (and in the case
5160 of @code{realloc} has been deprecated) relying on it may result in subtle
5161 portability bugs and should be avoided.
5162
5163 @item -Walloc-size-larger-than=@var{n}
5164 Warn about calls to functions decorated with attribute @code{alloc_size}
5165 that attempt to allocate objects larger than the specified number of bytes,
5166 or where the result of the size computation in an integer type with infinite
5167 precision would exceed @code{SIZE_MAX / 2}. The option argument @var{n}
5168 may end in one of the standard suffixes designating a multiple of bytes
5169 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
5170 @code{MB} and @code{MiB} for megabyte and mebibyte, and so on.
5171 @xref{Function Attributes}.
5172
5173 @item -Walloca
5174 @opindex Wno-alloca
5175 @opindex Walloca
5176 This option warns on all uses of @code{alloca} in the source.
5177
5178 @item -Walloca-larger-than=@var{n}
5179 This option warns on calls to @code{alloca} that are not bounded by a
5180 controlling predicate limiting its argument of integer type to at most
5181 @var{n} bytes, or calls to @code{alloca} where the bound is unknown.
5182 Arguments of non-integer types are considered unbounded even if they
5183 appear to be constrained to the expected range.
5184
5185 For example, a bounded case of @code{alloca} could be:
5186
5187 @smallexample
5188 void func (size_t n)
5189 @{
5190 void *p;
5191 if (n <= 1000)
5192 p = alloca (n);
5193 else
5194 p = malloc (n);
5195 f (p);
5196 @}
5197 @end smallexample
5198
5199 In the above example, passing @code{-Walloca-larger-than=1000} would not
5200 issue a warning because the call to @code{alloca} is known to be at most
5201 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5202 the compiler would emit a warning.
5203
5204 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5205 controlling predicate constraining its integer argument. For example:
5206
5207 @smallexample
5208 void func ()
5209 @{
5210 void *p = alloca (n);
5211 f (p);
5212 @}
5213 @end smallexample
5214
5215 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5216 a warning, but this time because of the lack of bounds checking.
5217
5218 Note, that even seemingly correct code involving signed integers could
5219 cause a warning:
5220
5221 @smallexample
5222 void func (signed int n)
5223 @{
5224 if (n < 500)
5225 @{
5226 p = alloca (n);
5227 f (p);
5228 @}
5229 @}
5230 @end smallexample
5231
5232 In the above example, @var{n} could be negative, causing a larger than
5233 expected argument to be implicitly cast into the @code{alloca} call.
5234
5235 This option also warns when @code{alloca} is used in a loop.
5236
5237 This warning is not enabled by @option{-Wall}, and is only active when
5238 @option{-ftree-vrp} is active (default for @option{-O2} and above).
5239
5240 See also @option{-Wvla-larger-than=@var{n}}.
5241
5242 @item -Warray-bounds
5243 @itemx -Warray-bounds=@var{n}
5244 @opindex Wno-array-bounds
5245 @opindex Warray-bounds
5246 This option is only active when @option{-ftree-vrp} is active
5247 (default for @option{-O2} and above). It warns about subscripts to arrays
5248 that are always out of bounds. This warning is enabled by @option{-Wall}.
5249
5250 @table @gcctabopt
5251 @item -Warray-bounds=1
5252 This is the warning level of @option{-Warray-bounds} and is enabled
5253 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5254
5255 @item -Warray-bounds=2
5256 This warning level also warns about out of bounds access for
5257 arrays at the end of a struct and for arrays accessed through
5258 pointers. This warning level may give a larger number of
5259 false positives and is deactivated by default.
5260 @end table
5261
5262 @item -Wbool-compare
5263 @opindex Wno-bool-compare
5264 @opindex Wbool-compare
5265 Warn about boolean expression compared with an integer value different from
5266 @code{true}/@code{false}. For instance, the following comparison is
5267 always false:
5268 @smallexample
5269 int n = 5;
5270 @dots{}
5271 if ((n > 1) == 2) @{ @dots{} @}
5272 @end smallexample
5273 This warning is enabled by @option{-Wall}.
5274
5275 @item -Wbool-operation
5276 @opindex Wno-bool-operation
5277 @opindex Wbool-operation
5278 Warn about suspicious operations on expressions of a boolean type. For
5279 instance, bitwise negation of a boolean is very likely a bug in the program.
5280 For C, this warning also warns about incrementing or decrementing a boolean,
5281 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5282 Incrementing a boolean is invalid in C++1z, and deprecated otherwise.)
5283
5284 This warning is enabled by @option{-Wall}.
5285
5286 @item -Wduplicated-branches
5287 @opindex Wno-duplicated-branches
5288 @opindex Wduplicated-branches
5289 Warn when an if-else has identical branches. This warning detects cases like
5290 @smallexample
5291 if (p != NULL)
5292 return 0;
5293 else
5294 return 0;
5295 @end smallexample
5296 It doesn't warn when both branches contain just a null statement. This warning
5297 also warn for conditional operators:
5298 @smallexample
5299 int i = x ? *p : *p;
5300 @end smallexample
5301
5302 @item -Wduplicated-cond
5303 @opindex Wno-duplicated-cond
5304 @opindex Wduplicated-cond
5305 Warn about duplicated conditions in an if-else-if chain. For instance,
5306 warn for the following code:
5307 @smallexample
5308 if (p->q != NULL) @{ @dots{} @}
5309 else if (p->q != NULL) @{ @dots{} @}
5310 @end smallexample
5311
5312 @item -Wframe-address
5313 @opindex Wno-frame-address
5314 @opindex Wframe-address
5315 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5316 is called with an argument greater than 0. Such calls may return indeterminate
5317 values or crash the program. The warning is included in @option{-Wall}.
5318
5319 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5320 @opindex Wno-discarded-qualifiers
5321 @opindex Wdiscarded-qualifiers
5322 Do not warn if type qualifiers on pointers are being discarded.
5323 Typically, the compiler warns if a @code{const char *} variable is
5324 passed to a function that takes a @code{char *} parameter. This option
5325 can be used to suppress such a warning.
5326
5327 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5328 @opindex Wno-discarded-array-qualifiers
5329 @opindex Wdiscarded-array-qualifiers
5330 Do not warn if type qualifiers on arrays which are pointer targets
5331 are being discarded. Typically, the compiler warns if a
5332 @code{const int (*)[]} variable is passed to a function that
5333 takes a @code{int (*)[]} parameter. This option can be used to
5334 suppress such a warning.
5335
5336 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5337 @opindex Wno-incompatible-pointer-types
5338 @opindex Wincompatible-pointer-types
5339 Do not warn when there is a conversion between pointers that have incompatible
5340 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5341 which warns for pointer argument passing or assignment with different
5342 signedness.
5343
5344 @item -Wno-int-conversion @r{(C and Objective-C only)}
5345 @opindex Wno-int-conversion
5346 @opindex Wint-conversion
5347 Do not warn about incompatible integer to pointer and pointer to integer
5348 conversions. This warning is about implicit conversions; for explicit
5349 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5350 @option{-Wno-pointer-to-int-cast} may be used.
5351
5352 @item -Wno-div-by-zero
5353 @opindex Wno-div-by-zero
5354 @opindex Wdiv-by-zero
5355 Do not warn about compile-time integer division by zero. Floating-point
5356 division by zero is not warned about, as it can be a legitimate way of
5357 obtaining infinities and NaNs.
5358
5359 @item -Wsystem-headers
5360 @opindex Wsystem-headers
5361 @opindex Wno-system-headers
5362 @cindex warnings from system headers
5363 @cindex system headers, warnings from
5364 Print warning messages for constructs found in system header files.
5365 Warnings from system headers are normally suppressed, on the assumption
5366 that they usually do not indicate real problems and would only make the
5367 compiler output harder to read. Using this command-line option tells
5368 GCC to emit warnings from system headers as if they occurred in user
5369 code. However, note that using @option{-Wall} in conjunction with this
5370 option does @emph{not} warn about unknown pragmas in system
5371 headers---for that, @option{-Wunknown-pragmas} must also be used.
5372
5373 @item -Wtautological-compare
5374 @opindex Wtautological-compare
5375 @opindex Wno-tautological-compare
5376 Warn if a self-comparison always evaluates to true or false. This
5377 warning detects various mistakes such as:
5378 @smallexample
5379 int i = 1;
5380 @dots{}
5381 if (i > i) @{ @dots{} @}
5382 @end smallexample
5383 This warning is enabled by @option{-Wall}.
5384
5385 @item -Wtrampolines
5386 @opindex Wtrampolines
5387 @opindex Wno-trampolines
5388 Warn about trampolines generated for pointers to nested functions.
5389 A trampoline is a small piece of data or code that is created at run
5390 time on the stack when the address of a nested function is taken, and is
5391 used to call the nested function indirectly. For some targets, it is
5392 made up of data only and thus requires no special treatment. But, for
5393 most targets, it is made up of code and thus requires the stack to be
5394 made executable in order for the program to work properly.
5395
5396 @item -Wfloat-equal
5397 @opindex Wfloat-equal
5398 @opindex Wno-float-equal
5399 Warn if floating-point values are used in equality comparisons.
5400
5401 The idea behind this is that sometimes it is convenient (for the
5402 programmer) to consider floating-point values as approximations to
5403 infinitely precise real numbers. If you are doing this, then you need
5404 to compute (by analyzing the code, or in some other way) the maximum or
5405 likely maximum error that the computation introduces, and allow for it
5406 when performing comparisons (and when producing output, but that's a
5407 different problem). In particular, instead of testing for equality, you
5408 should check to see whether the two values have ranges that overlap; and
5409 this is done with the relational operators, so equality comparisons are
5410 probably mistaken.
5411
5412 @item -Wtraditional @r{(C and Objective-C only)}
5413 @opindex Wtraditional
5414 @opindex Wno-traditional
5415 Warn about certain constructs that behave differently in traditional and
5416 ISO C@. Also warn about ISO C constructs that have no traditional C
5417 equivalent, and/or problematic constructs that should be avoided.
5418
5419 @itemize @bullet
5420 @item
5421 Macro parameters that appear within string literals in the macro body.
5422 In traditional C macro replacement takes place within string literals,
5423 but in ISO C it does not.
5424
5425 @item
5426 In traditional C, some preprocessor directives did not exist.
5427 Traditional preprocessors only considered a line to be a directive
5428 if the @samp{#} appeared in column 1 on the line. Therefore
5429 @option{-Wtraditional} warns about directives that traditional C
5430 understands but ignores because the @samp{#} does not appear as the
5431 first character on the line. It also suggests you hide directives like
5432 @code{#pragma} not understood by traditional C by indenting them. Some
5433 traditional implementations do not recognize @code{#elif}, so this option
5434 suggests avoiding it altogether.
5435
5436 @item
5437 A function-like macro that appears without arguments.
5438
5439 @item
5440 The unary plus operator.
5441
5442 @item
5443 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5444 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5445 constants.) Note, these suffixes appear in macros defined in the system
5446 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5447 Use of these macros in user code might normally lead to spurious
5448 warnings, however GCC's integrated preprocessor has enough context to
5449 avoid warning in these cases.
5450
5451 @item
5452 A function declared external in one block and then used after the end of
5453 the block.
5454
5455 @item
5456 A @code{switch} statement has an operand of type @code{long}.
5457
5458 @item
5459 A non-@code{static} function declaration follows a @code{static} one.
5460 This construct is not accepted by some traditional C compilers.
5461
5462 @item
5463 The ISO type of an integer constant has a different width or
5464 signedness from its traditional type. This warning is only issued if
5465 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5466 typically represent bit patterns, are not warned about.
5467
5468 @item
5469 Usage of ISO string concatenation is detected.
5470
5471 @item
5472 Initialization of automatic aggregates.
5473
5474 @item
5475 Identifier conflicts with labels. Traditional C lacks a separate
5476 namespace for labels.
5477
5478 @item
5479 Initialization of unions. If the initializer is zero, the warning is
5480 omitted. This is done under the assumption that the zero initializer in
5481 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
5482 initializer warnings and relies on default initialization to zero in the
5483 traditional C case.
5484
5485 @item
5486 Conversions by prototypes between fixed/floating-point values and vice
5487 versa. The absence of these prototypes when compiling with traditional
5488 C causes serious problems. This is a subset of the possible
5489 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
5490
5491 @item
5492 Use of ISO C style function definitions. This warning intentionally is
5493 @emph{not} issued for prototype declarations or variadic functions
5494 because these ISO C features appear in your code when using
5495 libiberty's traditional C compatibility macros, @code{PARAMS} and
5496 @code{VPARAMS}. This warning is also bypassed for nested functions
5497 because that feature is already a GCC extension and thus not relevant to
5498 traditional C compatibility.
5499 @end itemize
5500
5501 @item -Wtraditional-conversion @r{(C and Objective-C only)}
5502 @opindex Wtraditional-conversion
5503 @opindex Wno-traditional-conversion
5504 Warn if a prototype causes a type conversion that is different from what
5505 would happen to the same argument in the absence of a prototype. This
5506 includes conversions of fixed point to floating and vice versa, and
5507 conversions changing the width or signedness of a fixed-point argument
5508 except when the same as the default promotion.
5509
5510 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
5511 @opindex Wdeclaration-after-statement
5512 @opindex Wno-declaration-after-statement
5513 Warn when a declaration is found after a statement in a block. This
5514 construct, known from C++, was introduced with ISO C99 and is by default
5515 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
5516
5517 @item -Wshadow
5518 @opindex Wshadow
5519 @opindex Wno-shadow
5520 Warn whenever a local variable or type declaration shadows another
5521 variable, parameter, type, class member (in C++), or instance variable
5522 (in Objective-C) or whenever a built-in function is shadowed. Note
5523 that in C++, the compiler warns if a local variable shadows an
5524 explicit typedef, but not if it shadows a struct/class/enum.
5525 Same as @option{-Wshadow=global}.
5526
5527 @item -Wno-shadow-ivar @r{(Objective-C only)}
5528 @opindex Wno-shadow-ivar
5529 @opindex Wshadow-ivar
5530 Do not warn whenever a local variable shadows an instance variable in an
5531 Objective-C method.
5532
5533 @item -Wshadow=global
5534 @opindex Wshadow=local
5535 The default for @option{-Wshadow}. Warns for any (global) shadowing.
5536
5537 @item -Wshadow=local
5538 @opindex Wshadow=local
5539 Warn when a local variable shadows another local variable or parameter.
5540 This warning is enabled by @option{-Wshadow=global}.
5541
5542 @item -Wshadow=compatible-local
5543 @opindex Wshadow=compatible-local
5544 Warn when a local variable shadows another local variable or parameter
5545 whose type is compatible with that of the shadowing variable. In C++,
5546 type compatibility here means the type of the shadowing variable can be
5547 converted to that of the shadowed variable. The creation of this flag
5548 (in addition to @option{-Wshadow=local}) is based on the idea that when
5549 a local variable shadows another one of incompatible type, it is most
5550 likely intentional, not a bug or typo, as shown in the following example:
5551
5552 @smallexample
5553 @group
5554 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5555 @{
5556 for (int i = 0; i < N; ++i)
5557 @{
5558 ...
5559 @}
5560 ...
5561 @}
5562 @end group
5563 @end smallexample
5564
5565 Since the two variable @code{i} in the example above have incompatible types,
5566 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
5567 Because their types are incompatible, if a programmer accidentally uses one
5568 in place of the other, type checking will catch that and emit an error or
5569 warning. So not warning (about shadowing) in this case will not lead to
5570 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
5571 possibly reduce the number of warnings triggered by intentional shadowing.
5572
5573 This warning is enabled by @option{-Wshadow=local}.
5574
5575 @item -Wlarger-than=@var{len}
5576 @opindex Wlarger-than=@var{len}
5577 @opindex Wlarger-than-@var{len}
5578 Warn whenever an object of larger than @var{len} bytes is defined.
5579
5580 @item -Wframe-larger-than=@var{len}
5581 @opindex Wframe-larger-than
5582 Warn if the size of a function frame is larger than @var{len} bytes.
5583 The computation done to determine the stack frame size is approximate
5584 and not conservative.
5585 The actual requirements may be somewhat greater than @var{len}
5586 even if you do not get a warning. In addition, any space allocated
5587 via @code{alloca}, variable-length arrays, or related constructs
5588 is not included by the compiler when determining
5589 whether or not to issue a warning.
5590
5591 @item -Wno-free-nonheap-object
5592 @opindex Wno-free-nonheap-object
5593 @opindex Wfree-nonheap-object
5594 Do not warn when attempting to free an object that was not allocated
5595 on the heap.
5596
5597 @item -Wstack-usage=@var{len}
5598 @opindex Wstack-usage
5599 Warn if the stack usage of a function might be larger than @var{len} bytes.
5600 The computation done to determine the stack usage is conservative.
5601 Any space allocated via @code{alloca}, variable-length arrays, or related
5602 constructs is included by the compiler when determining whether or not to
5603 issue a warning.
5604
5605 The message is in keeping with the output of @option{-fstack-usage}.
5606
5607 @itemize
5608 @item
5609 If the stack usage is fully static but exceeds the specified amount, it's:
5610
5611 @smallexample
5612 warning: stack usage is 1120 bytes
5613 @end smallexample
5614 @item
5615 If the stack usage is (partly) dynamic but bounded, it's:
5616
5617 @smallexample
5618 warning: stack usage might be 1648 bytes
5619 @end smallexample
5620 @item
5621 If the stack usage is (partly) dynamic and not bounded, it's:
5622
5623 @smallexample
5624 warning: stack usage might be unbounded
5625 @end smallexample
5626 @end itemize
5627
5628 @item -Wunsafe-loop-optimizations
5629 @opindex Wunsafe-loop-optimizations
5630 @opindex Wno-unsafe-loop-optimizations
5631 Warn if the loop cannot be optimized because the compiler cannot
5632 assume anything on the bounds of the loop indices. With
5633 @option{-funsafe-loop-optimizations} warn if the compiler makes
5634 such assumptions.
5635
5636 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
5637 @opindex Wno-pedantic-ms-format
5638 @opindex Wpedantic-ms-format
5639 When used in combination with @option{-Wformat}
5640 and @option{-pedantic} without GNU extensions, this option
5641 disables the warnings about non-ISO @code{printf} / @code{scanf} format
5642 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
5643 which depend on the MS runtime.
5644
5645 @item -Waligned-new
5646 @opindex Waligned-new
5647 @opindex Wno-aligned-new
5648 Warn about a new-expression of a type that requires greater alignment
5649 than the @code{alignof(std::max_align_t)} but uses an allocation
5650 function without an explicit alignment parameter. This option is
5651 enabled by @option{-Wall}.
5652
5653 Normally this only warns about global allocation functions, but
5654 @option{-Waligned-new=all} also warns about class member allocation
5655 functions.
5656
5657 @item -Wplacement-new
5658 @itemx -Wplacement-new=@var{n}
5659 @opindex Wplacement-new
5660 @opindex Wno-placement-new
5661 Warn about placement new expressions with undefined behavior, such as
5662 constructing an object in a buffer that is smaller than the type of
5663 the object. For example, the placement new expression below is diagnosed
5664 because it attempts to construct an array of 64 integers in a buffer only
5665 64 bytes large.
5666 @smallexample
5667 char buf [64];
5668 new (buf) int[64];
5669 @end smallexample
5670 This warning is enabled by default.
5671
5672 @table @gcctabopt
5673 @item -Wplacement-new=1
5674 This is the default warning level of @option{-Wplacement-new}. At this
5675 level the warning is not issued for some strictly undefined constructs that
5676 GCC allows as extensions for compatibility with legacy code. For example,
5677 the following @code{new} expression is not diagnosed at this level even
5678 though it has undefined behavior according to the C++ standard because
5679 it writes past the end of the one-element array.
5680 @smallexample
5681 struct S @{ int n, a[1]; @};
5682 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5683 new (s->a)int [32]();
5684 @end smallexample
5685
5686 @item -Wplacement-new=2
5687 At this level, in addition to diagnosing all the same constructs as at level
5688 1, a diagnostic is also issued for placement new expressions that construct
5689 an object in the last member of structure whose type is an array of a single
5690 element and whose size is less than the size of the object being constructed.
5691 While the previous example would be diagnosed, the following construct makes
5692 use of the flexible member array extension to avoid the warning at level 2.
5693 @smallexample
5694 struct S @{ int n, a[]; @};
5695 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5696 new (s->a)int [32]();
5697 @end smallexample
5698
5699 @end table
5700
5701 @item -Wpointer-arith
5702 @opindex Wpointer-arith
5703 @opindex Wno-pointer-arith
5704 Warn about anything that depends on the ``size of'' a function type or
5705 of @code{void}. GNU C assigns these types a size of 1, for
5706 convenience in calculations with @code{void *} pointers and pointers
5707 to functions. In C++, warn also when an arithmetic operation involves
5708 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
5709
5710 @item -Wpointer-compare
5711 @opindex Wpointer-compare
5712 @opindex Wno-pointer-compare
5713 Warn if a pointer is compared with a zero character constant. This usually
5714 means that the pointer was meant to be dereferenced. For example:
5715
5716 @smallexample
5717 const char *p = foo ();
5718 if (p == '\0')
5719 return 42;
5720 @end smallexample
5721
5722 Note that the code above is invalid in C++11.
5723
5724 This warning is enabled by default.
5725
5726 @item -Wtype-limits
5727 @opindex Wtype-limits
5728 @opindex Wno-type-limits
5729 Warn if a comparison is always true or always false due to the limited
5730 range of the data type, but do not warn for constant expressions. For
5731 example, warn if an unsigned variable is compared against zero with
5732 @code{<} or @code{>=}. This warning is also enabled by
5733 @option{-Wextra}.
5734
5735 @include cppwarnopts.texi
5736
5737 @item -Wbad-function-cast @r{(C and Objective-C only)}
5738 @opindex Wbad-function-cast
5739 @opindex Wno-bad-function-cast
5740 Warn when a function call is cast to a non-matching type.
5741 For example, warn if a call to a function returning an integer type
5742 is cast to a pointer type.
5743
5744 @item -Wc90-c99-compat @r{(C and Objective-C only)}
5745 @opindex Wc90-c99-compat
5746 @opindex Wno-c90-c99-compat
5747 Warn about features not present in ISO C90, but present in ISO C99.
5748 For instance, warn about use of variable length arrays, @code{long long}
5749 type, @code{bool} type, compound literals, designated initializers, and so
5750 on. This option is independent of the standards mode. Warnings are disabled
5751 in the expression that follows @code{__extension__}.
5752
5753 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5754 @opindex Wc99-c11-compat
5755 @opindex Wno-c99-c11-compat
5756 Warn about features not present in ISO C99, but present in ISO C11.
5757 For instance, warn about use of anonymous structures and unions,
5758 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5759 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5760 and so on. This option is independent of the standards mode. Warnings are
5761 disabled in the expression that follows @code{__extension__}.
5762
5763 @item -Wc++-compat @r{(C and Objective-C only)}
5764 @opindex Wc++-compat
5765 Warn about ISO C constructs that are outside of the common subset of
5766 ISO C and ISO C++, e.g.@: request for implicit conversion from
5767 @code{void *} to a pointer to non-@code{void} type.
5768
5769 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5770 @opindex Wc++11-compat
5771 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5772 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5773 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5774 enabled by @option{-Wall}.
5775
5776 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5777 @opindex Wc++14-compat
5778 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5779 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5780
5781 @item -Wc++1z-compat @r{(C++ and Objective-C++ only)}
5782 @opindex Wc++1z-compat
5783 Warn about C++ constructs whose meaning differs between ISO C++ 2014
5784 and the forthoming ISO C++ 2017(?). This warning is enabled by @option{-Wall}.
5785
5786 @item -Wcast-qual
5787 @opindex Wcast-qual
5788 @opindex Wno-cast-qual
5789 Warn whenever a pointer is cast so as to remove a type qualifier from
5790 the target type. For example, warn if a @code{const char *} is cast
5791 to an ordinary @code{char *}.
5792
5793 Also warn when making a cast that introduces a type qualifier in an
5794 unsafe way. For example, casting @code{char **} to @code{const char **}
5795 is unsafe, as in this example:
5796
5797 @smallexample
5798 /* p is char ** value. */
5799 const char **q = (const char **) p;
5800 /* Assignment of readonly string to const char * is OK. */
5801 *q = "string";
5802 /* Now char** pointer points to read-only memory. */
5803 **p = 'b';
5804 @end smallexample
5805
5806 @item -Wcast-align
5807 @opindex Wcast-align
5808 @opindex Wno-cast-align
5809 Warn whenever a pointer is cast such that the required alignment of the
5810 target is increased. For example, warn if a @code{char *} is cast to
5811 an @code{int *} on machines where integers can only be accessed at
5812 two- or four-byte boundaries.
5813
5814 @item -Wwrite-strings
5815 @opindex Wwrite-strings
5816 @opindex Wno-write-strings
5817 When compiling C, give string constants the type @code{const
5818 char[@var{length}]} so that copying the address of one into a
5819 non-@code{const} @code{char *} pointer produces a warning. These
5820 warnings help you find at compile time code that can try to write
5821 into a string constant, but only if you have been very careful about
5822 using @code{const} in declarations and prototypes. Otherwise, it is
5823 just a nuisance. This is why we did not make @option{-Wall} request
5824 these warnings.
5825
5826 When compiling C++, warn about the deprecated conversion from string
5827 literals to @code{char *}. This warning is enabled by default for C++
5828 programs.
5829
5830 @item -Wclobbered
5831 @opindex Wclobbered
5832 @opindex Wno-clobbered
5833 Warn for variables that might be changed by @code{longjmp} or
5834 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5835
5836 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5837 @opindex Wconditionally-supported
5838 @opindex Wno-conditionally-supported
5839 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5840
5841 @item -Wconversion
5842 @opindex Wconversion
5843 @opindex Wno-conversion
5844 Warn for implicit conversions that may alter a value. This includes
5845 conversions between real and integer, like @code{abs (x)} when
5846 @code{x} is @code{double}; conversions between signed and unsigned,
5847 like @code{unsigned ui = -1}; and conversions to smaller types, like
5848 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5849 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5850 changed by the conversion like in @code{abs (2.0)}. Warnings about
5851 conversions between signed and unsigned integers can be disabled by
5852 using @option{-Wno-sign-conversion}.
5853
5854 For C++, also warn for confusing overload resolution for user-defined
5855 conversions; and conversions that never use a type conversion
5856 operator: conversions to @code{void}, the same type, a base class or a
5857 reference to them. Warnings about conversions between signed and
5858 unsigned integers are disabled by default in C++ unless
5859 @option{-Wsign-conversion} is explicitly enabled.
5860
5861 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5862 @opindex Wconversion-null
5863 @opindex Wno-conversion-null
5864 Do not warn for conversions between @code{NULL} and non-pointer
5865 types. @option{-Wconversion-null} is enabled by default.
5866
5867 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5868 @opindex Wzero-as-null-pointer-constant
5869 @opindex Wno-zero-as-null-pointer-constant
5870 Warn when a literal @samp{0} is used as null pointer constant. This can
5871 be useful to facilitate the conversion to @code{nullptr} in C++11.
5872
5873 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5874 @opindex Wsubobject-linkage
5875 @opindex Wno-subobject-linkage
5876 Warn if a class type has a base or a field whose type uses the anonymous
5877 namespace or depends on a type with no linkage. If a type A depends on
5878 a type B with no or internal linkage, defining it in multiple
5879 translation units would be an ODR violation because the meaning of B
5880 is different in each translation unit. If A only appears in a single
5881 translation unit, the best way to silence the warning is to give it
5882 internal linkage by putting it in an anonymous namespace as well. The
5883 compiler doesn't give this warning for types defined in the main .C
5884 file, as those are unlikely to have multiple definitions.
5885 @option{-Wsubobject-linkage} is enabled by default.
5886
5887 @item -Wdangling-else
5888 @opindex Wdangling-else
5889 @opindex Wno-dangling-else
5890 Warn about constructions where there may be confusion to which
5891 @code{if} statement an @code{else} branch belongs. Here is an example of
5892 such a case:
5893
5894 @smallexample
5895 @group
5896 @{
5897 if (a)
5898 if (b)
5899 foo ();
5900 else
5901 bar ();
5902 @}
5903 @end group
5904 @end smallexample
5905
5906 In C/C++, every @code{else} branch belongs to the innermost possible
5907 @code{if} statement, which in this example is @code{if (b)}. This is
5908 often not what the programmer expected, as illustrated in the above
5909 example by indentation the programmer chose. When there is the
5910 potential for this confusion, GCC issues a warning when this flag
5911 is specified. To eliminate the warning, add explicit braces around
5912 the innermost @code{if} statement so there is no way the @code{else}
5913 can belong to the enclosing @code{if}. The resulting code
5914 looks like this:
5915
5916 @smallexample
5917 @group
5918 @{
5919 if (a)
5920 @{
5921 if (b)
5922 foo ();
5923 else
5924 bar ();
5925 @}
5926 @}
5927 @end group
5928 @end smallexample
5929
5930 This warning is enabled by @option{-Wparentheses}.
5931
5932 @item -Wdate-time
5933 @opindex Wdate-time
5934 @opindex Wno-date-time
5935 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5936 are encountered as they might prevent bit-wise-identical reproducible
5937 compilations.
5938
5939 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5940 @opindex Wdelete-incomplete
5941 @opindex Wno-delete-incomplete
5942 Warn when deleting a pointer to incomplete type, which may cause
5943 undefined behavior at runtime. This warning is enabled by default.
5944
5945 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5946 @opindex Wuseless-cast
5947 @opindex Wno-useless-cast
5948 Warn when an expression is casted to its own type.
5949
5950 @item -Wempty-body
5951 @opindex Wempty-body
5952 @opindex Wno-empty-body
5953 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5954 while} statement. This warning is also enabled by @option{-Wextra}.
5955
5956 @item -Wenum-compare
5957 @opindex Wenum-compare
5958 @opindex Wno-enum-compare
5959 Warn about a comparison between values of different enumerated types.
5960 In C++ enumerated type mismatches in conditional expressions are also
5961 diagnosed and the warning is enabled by default. In C this warning is
5962 enabled by @option{-Wall}.
5963
5964 @item -Wjump-misses-init @r{(C, Objective-C only)}
5965 @opindex Wjump-misses-init
5966 @opindex Wno-jump-misses-init
5967 Warn if a @code{goto} statement or a @code{switch} statement jumps
5968 forward across the initialization of a variable, or jumps backward to a
5969 label after the variable has been initialized. This only warns about
5970 variables that are initialized when they are declared. This warning is
5971 only supported for C and Objective-C; in C++ this sort of branch is an
5972 error in any case.
5973
5974 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5975 can be disabled with the @option{-Wno-jump-misses-init} option.
5976
5977 @item -Wsign-compare
5978 @opindex Wsign-compare
5979 @opindex Wno-sign-compare
5980 @cindex warning for comparison of signed and unsigned values
5981 @cindex comparison of signed and unsigned values, warning
5982 @cindex signed and unsigned values, comparison warning
5983 Warn when a comparison between signed and unsigned values could produce
5984 an incorrect result when the signed value is converted to unsigned.
5985 In C++, this warning is also enabled by @option{-Wall}. In C, it is
5986 also enabled by @option{-Wextra}.
5987
5988 @item -Wsign-conversion
5989 @opindex Wsign-conversion
5990 @opindex Wno-sign-conversion
5991 Warn for implicit conversions that may change the sign of an integer
5992 value, like assigning a signed integer expression to an unsigned
5993 integer variable. An explicit cast silences the warning. In C, this
5994 option is enabled also by @option{-Wconversion}.
5995
5996 @item -Wfloat-conversion
5997 @opindex Wfloat-conversion
5998 @opindex Wno-float-conversion
5999 Warn for implicit conversions that reduce the precision of a real value.
6000 This includes conversions from real to integer, and from higher precision
6001 real to lower precision real values. This option is also enabled by
6002 @option{-Wconversion}.
6003
6004 @item -Wno-scalar-storage-order
6005 @opindex -Wno-scalar-storage-order
6006 @opindex -Wscalar-storage-order
6007 Do not warn on suspicious constructs involving reverse scalar storage order.
6008
6009 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6010 @opindex Wsized-deallocation
6011 @opindex Wno-sized-deallocation
6012 Warn about a definition of an unsized deallocation function
6013 @smallexample
6014 void operator delete (void *) noexcept;
6015 void operator delete[] (void *) noexcept;
6016 @end smallexample
6017 without a definition of the corresponding sized deallocation function
6018 @smallexample
6019 void operator delete (void *, std::size_t) noexcept;
6020 void operator delete[] (void *, std::size_t) noexcept;
6021 @end smallexample
6022 or vice versa. Enabled by @option{-Wextra} along with
6023 @option{-fsized-deallocation}.
6024
6025 @item -Wsizeof-pointer-memaccess
6026 @opindex Wsizeof-pointer-memaccess
6027 @opindex Wno-sizeof-pointer-memaccess
6028 Warn for suspicious length parameters to certain string and memory built-in
6029 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
6030 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
6031 but a pointer, and suggests a possible fix, or about
6032 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
6033 @option{-Wall}.
6034
6035 @item -Wsizeof-array-argument
6036 @opindex Wsizeof-array-argument
6037 @opindex Wno-sizeof-array-argument
6038 Warn when the @code{sizeof} operator is applied to a parameter that is
6039 declared as an array in a function definition. This warning is enabled by
6040 default for C and C++ programs.
6041
6042 @item -Wmemset-elt-size
6043 @opindex Wmemset-elt-size
6044 @opindex Wno-memset-elt-size
6045 Warn for suspicious calls to the @code{memset} built-in function, if the
6046 first argument references an array, and the third argument is a number
6047 equal to the number of elements, but not equal to the size of the array
6048 in memory. This indicates that the user has omitted a multiplication by
6049 the element size. This warning is enabled by @option{-Wall}.
6050
6051 @item -Wmemset-transposed-args
6052 @opindex Wmemset-transposed-args
6053 @opindex Wno-memset-transposed-args
6054 Warn for suspicious calls to the @code{memset} built-in function, if the
6055 second argument is not zero and the third argument is zero. This warns e.g.@
6056 about @code{memset (buf, sizeof buf, 0)} where most probably
6057 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6058 is only emitted if the third argument is literal zero. If it is some
6059 expression that is folded to zero, a cast of zero to some type, etc.,
6060 it is far less likely that the user has mistakenly exchanged the arguments
6061 and no warning is emitted. This warning is enabled by @option{-Wall}.
6062
6063 @item -Waddress
6064 @opindex Waddress
6065 @opindex Wno-address
6066 Warn about suspicious uses of memory addresses. These include using
6067 the address of a function in a conditional expression, such as
6068 @code{void func(void); if (func)}, and comparisons against the memory
6069 address of a string literal, such as @code{if (x == "abc")}. Such
6070 uses typically indicate a programmer error: the address of a function
6071 always evaluates to true, so their use in a conditional usually
6072 indicate that the programmer forgot the parentheses in a function
6073 call; and comparisons against string literals result in unspecified
6074 behavior and are not portable in C, so they usually indicate that the
6075 programmer intended to use @code{strcmp}. This warning is enabled by
6076 @option{-Wall}.
6077
6078 @item -Wlogical-op
6079 @opindex Wlogical-op
6080 @opindex Wno-logical-op
6081 Warn about suspicious uses of logical operators in expressions.
6082 This includes using logical operators in contexts where a
6083 bit-wise operator is likely to be expected. Also warns when
6084 the operands of a logical operator are the same:
6085 @smallexample
6086 extern int a;
6087 if (a < 0 && a < 0) @{ @dots{} @}
6088 @end smallexample
6089
6090 @item -Wlogical-not-parentheses
6091 @opindex Wlogical-not-parentheses
6092 @opindex Wno-logical-not-parentheses
6093 Warn about logical not used on the left hand side operand of a comparison.
6094 This option does not warn if the right operand is considered to be a boolean
6095 expression. Its purpose is to detect suspicious code like the following:
6096 @smallexample
6097 int a;
6098 @dots{}
6099 if (!a > 1) @{ @dots{} @}
6100 @end smallexample
6101
6102 It is possible to suppress the warning by wrapping the LHS into
6103 parentheses:
6104 @smallexample
6105 if ((!a) > 1) @{ @dots{} @}
6106 @end smallexample
6107
6108 This warning is enabled by @option{-Wall}.
6109
6110 @item -Waggregate-return
6111 @opindex Waggregate-return
6112 @opindex Wno-aggregate-return
6113 Warn if any functions that return structures or unions are defined or
6114 called. (In languages where you can return an array, this also elicits
6115 a warning.)
6116
6117 @item -Wno-aggressive-loop-optimizations
6118 @opindex Wno-aggressive-loop-optimizations
6119 @opindex Waggressive-loop-optimizations
6120 Warn if in a loop with constant number of iterations the compiler detects
6121 undefined behavior in some statement during one or more of the iterations.
6122
6123 @item -Wno-attributes
6124 @opindex Wno-attributes
6125 @opindex Wattributes
6126 Do not warn if an unexpected @code{__attribute__} is used, such as
6127 unrecognized attributes, function attributes applied to variables,
6128 etc. This does not stop errors for incorrect use of supported
6129 attributes.
6130
6131 @item -Wno-builtin-declaration-mismatch
6132 @opindex Wno-builtin-declaration-mismatch
6133 @opindex Wbuiltin-declaration-mismatch
6134 Warn if a built-in function is declared with the wrong signature.
6135 This warning is enabled by default.
6136
6137 @item -Wno-builtin-macro-redefined
6138 @opindex Wno-builtin-macro-redefined
6139 @opindex Wbuiltin-macro-redefined
6140 Do not warn if certain built-in macros are redefined. This suppresses
6141 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6142 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6143
6144 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6145 @opindex Wstrict-prototypes
6146 @opindex Wno-strict-prototypes
6147 Warn if a function is declared or defined without specifying the
6148 argument types. (An old-style function definition is permitted without
6149 a warning if preceded by a declaration that specifies the argument
6150 types.)
6151
6152 @item -Wold-style-declaration @r{(C and Objective-C only)}
6153 @opindex Wold-style-declaration
6154 @opindex Wno-old-style-declaration
6155 Warn for obsolescent usages, according to the C Standard, in a
6156 declaration. For example, warn if storage-class specifiers like
6157 @code{static} are not the first things in a declaration. This warning
6158 is also enabled by @option{-Wextra}.
6159
6160 @item -Wold-style-definition @r{(C and Objective-C only)}
6161 @opindex Wold-style-definition
6162 @opindex Wno-old-style-definition
6163 Warn if an old-style function definition is used. A warning is given
6164 even if there is a previous prototype.
6165
6166 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6167 @opindex Wmissing-parameter-type
6168 @opindex Wno-missing-parameter-type
6169 A function parameter is declared without a type specifier in K&R-style
6170 functions:
6171
6172 @smallexample
6173 void foo(bar) @{ @}
6174 @end smallexample
6175
6176 This warning is also enabled by @option{-Wextra}.
6177
6178 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6179 @opindex Wmissing-prototypes
6180 @opindex Wno-missing-prototypes
6181 Warn if a global function is defined without a previous prototype
6182 declaration. This warning is issued even if the definition itself
6183 provides a prototype. Use this option to detect global functions
6184 that do not have a matching prototype declaration in a header file.
6185 This option is not valid for C++ because all function declarations
6186 provide prototypes and a non-matching declaration declares an
6187 overload rather than conflict with an earlier declaration.
6188 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6189
6190 @item -Wmissing-declarations
6191 @opindex Wmissing-declarations
6192 @opindex Wno-missing-declarations
6193 Warn if a global function is defined without a previous declaration.
6194 Do so even if the definition itself provides a prototype.
6195 Use this option to detect global functions that are not declared in
6196 header files. In C, no warnings are issued for functions with previous
6197 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6198 missing prototypes. In C++, no warnings are issued for function templates,
6199 or for inline functions, or for functions in anonymous namespaces.
6200
6201 @item -Wmissing-field-initializers
6202 @opindex Wmissing-field-initializers
6203 @opindex Wno-missing-field-initializers
6204 @opindex W
6205 @opindex Wextra
6206 @opindex Wno-extra
6207 Warn if a structure's initializer has some fields missing. For
6208 example, the following code causes such a warning, because
6209 @code{x.h} is implicitly zero:
6210
6211 @smallexample
6212 struct s @{ int f, g, h; @};
6213 struct s x = @{ 3, 4 @};
6214 @end smallexample
6215
6216 This option does not warn about designated initializers, so the following
6217 modification does not trigger a warning:
6218
6219 @smallexample
6220 struct s @{ int f, g, h; @};
6221 struct s x = @{ .f = 3, .g = 4 @};
6222 @end smallexample
6223
6224 In C++ this option does not warn either about the empty @{ @}
6225 initializer, for example:
6226
6227 @smallexample
6228 struct s @{ int f, g, h; @};
6229 s x = @{ @};
6230 @end smallexample
6231
6232 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6233 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6234
6235 @item -Wno-multichar
6236 @opindex Wno-multichar
6237 @opindex Wmultichar
6238 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6239 Usually they indicate a typo in the user's code, as they have
6240 implementation-defined values, and should not be used in portable code.
6241
6242 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6243 @opindex Wnormalized=
6244 @opindex Wnormalized
6245 @opindex Wno-normalized
6246 @cindex NFC
6247 @cindex NFKC
6248 @cindex character set, input normalization
6249 In ISO C and ISO C++, two identifiers are different if they are
6250 different sequences of characters. However, sometimes when characters
6251 outside the basic ASCII character set are used, you can have two
6252 different character sequences that look the same. To avoid confusion,
6253 the ISO 10646 standard sets out some @dfn{normalization rules} which
6254 when applied ensure that two sequences that look the same are turned into
6255 the same sequence. GCC can warn you if you are using identifiers that
6256 have not been normalized; this option controls that warning.
6257
6258 There are four levels of warning supported by GCC@. The default is
6259 @option{-Wnormalized=nfc}, which warns about any identifier that is
6260 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6261 recommended form for most uses. It is equivalent to
6262 @option{-Wnormalized}.
6263
6264 Unfortunately, there are some characters allowed in identifiers by
6265 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6266 identifiers. That is, there's no way to use these symbols in portable
6267 ISO C or C++ and have all your identifiers in NFC@.
6268 @option{-Wnormalized=id} suppresses the warning for these characters.
6269 It is hoped that future versions of the standards involved will correct
6270 this, which is why this option is not the default.
6271
6272 You can switch the warning off for all characters by writing
6273 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6274 only do this if you are using some other normalization scheme (like
6275 ``D''), because otherwise you can easily create bugs that are
6276 literally impossible to see.
6277
6278 Some characters in ISO 10646 have distinct meanings but look identical
6279 in some fonts or display methodologies, especially once formatting has
6280 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6281 LETTER N'', displays just like a regular @code{n} that has been
6282 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6283 normalization scheme to convert all these into a standard form as
6284 well, and GCC warns if your code is not in NFKC if you use
6285 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6286 about every identifier that contains the letter O because it might be
6287 confused with the digit 0, and so is not the default, but may be
6288 useful as a local coding convention if the programming environment
6289 cannot be fixed to display these characters distinctly.
6290
6291 @item -Wno-deprecated
6292 @opindex Wno-deprecated
6293 @opindex Wdeprecated
6294 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6295
6296 @item -Wno-deprecated-declarations
6297 @opindex Wno-deprecated-declarations
6298 @opindex Wdeprecated-declarations
6299 Do not warn about uses of functions (@pxref{Function Attributes}),
6300 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6301 Attributes}) marked as deprecated by using the @code{deprecated}
6302 attribute.
6303
6304 @item -Wno-overflow
6305 @opindex Wno-overflow
6306 @opindex Woverflow
6307 Do not warn about compile-time overflow in constant expressions.
6308
6309 @item -Wno-odr
6310 @opindex Wno-odr
6311 @opindex Wodr
6312 Warn about One Definition Rule violations during link-time optimization.
6313 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6314
6315 @item -Wopenmp-simd
6316 @opindex Wopenm-simd
6317 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
6318 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6319 option can be used to relax the cost model.
6320
6321 @item -Woverride-init @r{(C and Objective-C only)}
6322 @opindex Woverride-init
6323 @opindex Wno-override-init
6324 @opindex W
6325 @opindex Wextra
6326 @opindex Wno-extra
6327 Warn if an initialized field without side effects is overridden when
6328 using designated initializers (@pxref{Designated Inits, , Designated
6329 Initializers}).
6330
6331 This warning is included in @option{-Wextra}. To get other
6332 @option{-Wextra} warnings without this one, use @option{-Wextra
6333 -Wno-override-init}.
6334
6335 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6336 @opindex Woverride-init-side-effects
6337 @opindex Wno-override-init-side-effects
6338 Warn if an initialized field with side effects is overridden when
6339 using designated initializers (@pxref{Designated Inits, , Designated
6340 Initializers}). This warning is enabled by default.
6341
6342 @item -Wpacked
6343 @opindex Wpacked
6344 @opindex Wno-packed
6345 Warn if a structure is given the packed attribute, but the packed
6346 attribute has no effect on the layout or size of the structure.
6347 Such structures may be mis-aligned for little benefit. For
6348 instance, in this code, the variable @code{f.x} in @code{struct bar}
6349 is misaligned even though @code{struct bar} does not itself
6350 have the packed attribute:
6351
6352 @smallexample
6353 @group
6354 struct foo @{
6355 int x;
6356 char a, b, c, d;
6357 @} __attribute__((packed));
6358 struct bar @{
6359 char z;
6360 struct foo f;
6361 @};
6362 @end group
6363 @end smallexample
6364
6365 @item -Wpacked-bitfield-compat
6366 @opindex Wpacked-bitfield-compat
6367 @opindex Wno-packed-bitfield-compat
6368 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
6369 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
6370 the change can lead to differences in the structure layout. GCC
6371 informs you when the offset of such a field has changed in GCC 4.4.
6372 For example there is no longer a 4-bit padding between field @code{a}
6373 and @code{b} in this structure:
6374
6375 @smallexample
6376 struct foo
6377 @{
6378 char a:4;
6379 char b:8;
6380 @} __attribute__ ((packed));
6381 @end smallexample
6382
6383 This warning is enabled by default. Use
6384 @option{-Wno-packed-bitfield-compat} to disable this warning.
6385
6386 @item -Wpadded
6387 @opindex Wpadded
6388 @opindex Wno-padded
6389 Warn if padding is included in a structure, either to align an element
6390 of the structure or to align the whole structure. Sometimes when this
6391 happens it is possible to rearrange the fields of the structure to
6392 reduce the padding and so make the structure smaller.
6393
6394 @item -Wredundant-decls
6395 @opindex Wredundant-decls
6396 @opindex Wno-redundant-decls
6397 Warn if anything is declared more than once in the same scope, even in
6398 cases where multiple declaration is valid and changes nothing.
6399
6400 @item -Wrestrict
6401 @opindex Wrestrict
6402 @opindex Wno-restrict
6403 Warn when an argument passed to a restrict-qualified parameter
6404 aliases with another argument.
6405
6406 @item -Wnested-externs @r{(C and Objective-C only)}
6407 @opindex Wnested-externs
6408 @opindex Wno-nested-externs
6409 Warn if an @code{extern} declaration is encountered within a function.
6410
6411 @item -Wno-inherited-variadic-ctor
6412 @opindex Winherited-variadic-ctor
6413 @opindex Wno-inherited-variadic-ctor
6414 Suppress warnings about use of C++11 inheriting constructors when the
6415 base class inherited from has a C variadic constructor; the warning is
6416 on by default because the ellipsis is not inherited.
6417
6418 @item -Winline
6419 @opindex Winline
6420 @opindex Wno-inline
6421 Warn if a function that is declared as inline cannot be inlined.
6422 Even with this option, the compiler does not warn about failures to
6423 inline functions declared in system headers.
6424
6425 The compiler uses a variety of heuristics to determine whether or not
6426 to inline a function. For example, the compiler takes into account
6427 the size of the function being inlined and the amount of inlining
6428 that has already been done in the current function. Therefore,
6429 seemingly insignificant changes in the source program can cause the
6430 warnings produced by @option{-Winline} to appear or disappear.
6431
6432 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6433 @opindex Wno-invalid-offsetof
6434 @opindex Winvalid-offsetof
6435 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6436 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6437 to a non-standard-layout type is undefined. In existing C++ implementations,
6438 however, @code{offsetof} typically gives meaningful results.
6439 This flag is for users who are aware that they are
6440 writing nonportable code and who have deliberately chosen to ignore the
6441 warning about it.
6442
6443 The restrictions on @code{offsetof} may be relaxed in a future version
6444 of the C++ standard.
6445
6446 @item -Wint-in-bool-context
6447 @opindex Wint-in-bool-context
6448 @opindex Wno-int-in-bool-context
6449 Warn for suspicious use of integer values where boolean values are expected,
6450 such as conditional expressions (?:) using non-boolean integer constants in
6451 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
6452 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
6453 for all kinds of multiplications regardless of the data type.
6454 This warning is enabled by @option{-Wall}.
6455
6456 @item -Wno-int-to-pointer-cast
6457 @opindex Wno-int-to-pointer-cast
6458 @opindex Wint-to-pointer-cast
6459 Suppress warnings from casts to pointer type of an integer of a
6460 different size. In C++, casting to a pointer type of smaller size is
6461 an error. @option{Wint-to-pointer-cast} is enabled by default.
6462
6463
6464 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
6465 @opindex Wno-pointer-to-int-cast
6466 @opindex Wpointer-to-int-cast
6467 Suppress warnings from casts from a pointer to an integer type of a
6468 different size.
6469
6470 @item -Winvalid-pch
6471 @opindex Winvalid-pch
6472 @opindex Wno-invalid-pch
6473 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
6474 the search path but can't be used.
6475
6476 @item -Wlong-long
6477 @opindex Wlong-long
6478 @opindex Wno-long-long
6479 Warn if @code{long long} type is used. This is enabled by either
6480 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
6481 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
6482
6483 @item -Wvariadic-macros
6484 @opindex Wvariadic-macros
6485 @opindex Wno-variadic-macros
6486 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6487 alternate syntax is used in ISO C99 mode. This is enabled by either
6488 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
6489 messages, use @option{-Wno-variadic-macros}.
6490
6491 @item -Wvarargs
6492 @opindex Wvarargs
6493 @opindex Wno-varargs
6494 Warn upon questionable usage of the macros used to handle variable
6495 arguments like @code{va_start}. This is default. To inhibit the
6496 warning messages, use @option{-Wno-varargs}.
6497
6498 @item -Wvector-operation-performance
6499 @opindex Wvector-operation-performance
6500 @opindex Wno-vector-operation-performance
6501 Warn if vector operation is not implemented via SIMD capabilities of the
6502 architecture. Mainly useful for the performance tuning.
6503 Vector operation can be implemented @code{piecewise}, which means that the
6504 scalar operation is performed on every vector element;
6505 @code{in parallel}, which means that the vector operation is implemented
6506 using scalars of wider type, which normally is more performance efficient;
6507 and @code{as a single scalar}, which means that vector fits into a
6508 scalar type.
6509
6510 @item -Wno-virtual-move-assign
6511 @opindex Wvirtual-move-assign
6512 @opindex Wno-virtual-move-assign
6513 Suppress warnings about inheriting from a virtual base with a
6514 non-trivial C++11 move assignment operator. This is dangerous because
6515 if the virtual base is reachable along more than one path, it is
6516 moved multiple times, which can mean both objects end up in the
6517 moved-from state. If the move assignment operator is written to avoid
6518 moving from a moved-from object, this warning can be disabled.
6519
6520 @item -Wvla
6521 @opindex Wvla
6522 @opindex Wno-vla
6523 Warn if a variable-length array is used in the code.
6524 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
6525 the variable-length array.
6526
6527 @item -Wvla-larger-than=@var{n}
6528 If this option is used, the compiler will warn on uses of
6529 variable-length arrays where the size is either unbounded, or bounded
6530 by an argument that can be larger than @var{n} bytes. This is similar
6531 to how @option{-Walloca-larger-than=@var{n}} works, but with
6532 variable-length arrays.
6533
6534 Note that GCC may optimize small variable-length arrays of a known
6535 value into plain arrays, so this warning may not get triggered for
6536 such arrays.
6537
6538 This warning is not enabled by @option{-Wall}, and is only active when
6539 @option{-ftree-vrp} is active (default for @option{-O2} and above).
6540
6541 See also @option{-Walloca-larger-than=@var{n}}.
6542
6543 @item -Wvolatile-register-var
6544 @opindex Wvolatile-register-var
6545 @opindex Wno-volatile-register-var
6546 Warn if a register variable is declared volatile. The volatile
6547 modifier does not inhibit all optimizations that may eliminate reads
6548 and/or writes to register variables. This warning is enabled by
6549 @option{-Wall}.
6550
6551 @item -Wdisabled-optimization
6552 @opindex Wdisabled-optimization
6553 @opindex Wno-disabled-optimization
6554 Warn if a requested optimization pass is disabled. This warning does
6555 not generally indicate that there is anything wrong with your code; it
6556 merely indicates that GCC's optimizers are unable to handle the code
6557 effectively. Often, the problem is that your code is too big or too
6558 complex; GCC refuses to optimize programs when the optimization
6559 itself is likely to take inordinate amounts of time.
6560
6561 @item -Wpointer-sign @r{(C and Objective-C only)}
6562 @opindex Wpointer-sign
6563 @opindex Wno-pointer-sign
6564 Warn for pointer argument passing or assignment with different signedness.
6565 This option is only supported for C and Objective-C@. It is implied by
6566 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
6567 @option{-Wno-pointer-sign}.
6568
6569 @item -Wstack-protector
6570 @opindex Wstack-protector
6571 @opindex Wno-stack-protector
6572 This option is only active when @option{-fstack-protector} is active. It
6573 warns about functions that are not protected against stack smashing.
6574
6575 @item -Woverlength-strings
6576 @opindex Woverlength-strings
6577 @opindex Wno-overlength-strings
6578 Warn about string constants that are longer than the ``minimum
6579 maximum'' length specified in the C standard. Modern compilers
6580 generally allow string constants that are much longer than the
6581 standard's minimum limit, but very portable programs should avoid
6582 using longer strings.
6583
6584 The limit applies @emph{after} string constant concatenation, and does
6585 not count the trailing NUL@. In C90, the limit was 509 characters; in
6586 C99, it was raised to 4095. C++98 does not specify a normative
6587 minimum maximum, so we do not diagnose overlength strings in C++@.
6588
6589 This option is implied by @option{-Wpedantic}, and can be disabled with
6590 @option{-Wno-overlength-strings}.
6591
6592 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
6593 @opindex Wunsuffixed-float-constants
6594
6595 Issue a warning for any floating constant that does not have
6596 a suffix. When used together with @option{-Wsystem-headers} it
6597 warns about such constants in system header files. This can be useful
6598 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
6599 from the decimal floating-point extension to C99.
6600
6601 @item -Wno-designated-init @r{(C and Objective-C only)}
6602 Suppress warnings when a positional initializer is used to initialize
6603 a structure that has been marked with the @code{designated_init}
6604 attribute.
6605
6606 @item -Whsa
6607 Issue a warning when HSAIL cannot be emitted for the compiled function or
6608 OpenMP construct.
6609
6610 @end table
6611
6612 @node Debugging Options
6613 @section Options for Debugging Your Program
6614 @cindex options, debugging
6615 @cindex debugging information options
6616
6617 To tell GCC to emit extra information for use by a debugger, in almost
6618 all cases you need only to add @option{-g} to your other options.
6619
6620 GCC allows you to use @option{-g} with
6621 @option{-O}. The shortcuts taken by optimized code may occasionally
6622 be surprising: some variables you declared may not exist
6623 at all; flow of control may briefly move where you did not expect it;
6624 some statements may not be executed because they compute constant
6625 results or their values are already at hand; some statements may
6626 execute in different places because they have been moved out of loops.
6627 Nevertheless it is possible to debug optimized output. This makes
6628 it reasonable to use the optimizer for programs that might have bugs.
6629
6630 If you are not using some other optimization option, consider
6631 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
6632 With no @option{-O} option at all, some compiler passes that collect
6633 information useful for debugging do not run at all, so that
6634 @option{-Og} may result in a better debugging experience.
6635
6636 @table @gcctabopt
6637 @item -g
6638 @opindex g
6639 Produce debugging information in the operating system's native format
6640 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
6641 information.
6642
6643 On most systems that use stabs format, @option{-g} enables use of extra
6644 debugging information that only GDB can use; this extra information
6645 makes debugging work better in GDB but probably makes other debuggers
6646 crash or
6647 refuse to read the program. If you want to control for certain whether
6648 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
6649 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
6650
6651 @item -ggdb
6652 @opindex ggdb
6653 Produce debugging information for use by GDB@. This means to use the
6654 most expressive format available (DWARF, stabs, or the native format
6655 if neither of those are supported), including GDB extensions if at all
6656 possible.
6657
6658 @item -gdwarf
6659 @itemx -gdwarf-@var{version}
6660 @opindex gdwarf
6661 Produce debugging information in DWARF format (if that is supported).
6662 The value of @var{version} may be either 2, 3, 4 or 5; the default version
6663 for most targets is 4. DWARF Version 5 is only experimental.
6664
6665 Note that with DWARF Version 2, some ports require and always
6666 use some non-conflicting DWARF 3 extensions in the unwind tables.
6667
6668 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
6669 for maximum benefit.
6670
6671 GCC no longer supports DWARF Version 1, which is substantially
6672 different than Version 2 and later. For historical reasons, some
6673 other DWARF-related options (including @option{-feliminate-dwarf2-dups}
6674 and @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
6675 in their names, but apply to all currently-supported versions of DWARF.
6676
6677 @item -gstabs
6678 @opindex gstabs
6679 Produce debugging information in stabs format (if that is supported),
6680 without GDB extensions. This is the format used by DBX on most BSD
6681 systems. On MIPS, Alpha and System V Release 4 systems this option
6682 produces stabs debugging output that is not understood by DBX or SDB@.
6683 On System V Release 4 systems this option requires the GNU assembler.
6684
6685 @item -gstabs+
6686 @opindex gstabs+
6687 Produce debugging information in stabs format (if that is supported),
6688 using GNU extensions understood only by the GNU debugger (GDB)@. The
6689 use of these extensions is likely to make other debuggers crash or
6690 refuse to read the program.
6691
6692 @item -gcoff
6693 @opindex gcoff
6694 Produce debugging information in COFF format (if that is supported).
6695 This is the format used by SDB on most System V systems prior to
6696 System V Release 4.
6697
6698 @item -gxcoff
6699 @opindex gxcoff
6700 Produce debugging information in XCOFF format (if that is supported).
6701 This is the format used by the DBX debugger on IBM RS/6000 systems.
6702
6703 @item -gxcoff+
6704 @opindex gxcoff+
6705 Produce debugging information in XCOFF format (if that is supported),
6706 using GNU extensions understood only by the GNU debugger (GDB)@. The
6707 use of these extensions is likely to make other debuggers crash or
6708 refuse to read the program, and may cause assemblers other than the GNU
6709 assembler (GAS) to fail with an error.
6710
6711 @item -gvms
6712 @opindex gvms
6713 Produce debugging information in Alpha/VMS debug format (if that is
6714 supported). This is the format used by DEBUG on Alpha/VMS systems.
6715
6716 @item -g@var{level}
6717 @itemx -ggdb@var{level}
6718 @itemx -gstabs@var{level}
6719 @itemx -gcoff@var{level}
6720 @itemx -gxcoff@var{level}
6721 @itemx -gvms@var{level}
6722 Request debugging information and also use @var{level} to specify how
6723 much information. The default level is 2.
6724
6725 Level 0 produces no debug information at all. Thus, @option{-g0} negates
6726 @option{-g}.
6727
6728 Level 1 produces minimal information, enough for making backtraces in
6729 parts of the program that you don't plan to debug. This includes
6730 descriptions of functions and external variables, and line number
6731 tables, but no information about local variables.
6732
6733 Level 3 includes extra information, such as all the macro definitions
6734 present in the program. Some debuggers support macro expansion when
6735 you use @option{-g3}.
6736
6737 @option{-gdwarf} does not accept a concatenated debug level, to avoid
6738 confusion with @option{-gdwarf-@var{level}}.
6739 Instead use an additional @option{-g@var{level}} option to change the
6740 debug level for DWARF.
6741
6742 @item -feliminate-unused-debug-symbols
6743 @opindex feliminate-unused-debug-symbols
6744 Produce debugging information in stabs format (if that is supported),
6745 for only symbols that are actually used.
6746
6747 @item -femit-class-debug-always
6748 @opindex femit-class-debug-always
6749 Instead of emitting debugging information for a C++ class in only one
6750 object file, emit it in all object files using the class. This option
6751 should be used only with debuggers that are unable to handle the way GCC
6752 normally emits debugging information for classes because using this
6753 option increases the size of debugging information by as much as a
6754 factor of two.
6755
6756 @item -fno-merge-debug-strings
6757 @opindex fmerge-debug-strings
6758 @opindex fno-merge-debug-strings
6759 Direct the linker to not merge together strings in the debugging
6760 information that are identical in different object files. Merging is
6761 not supported by all assemblers or linkers. Merging decreases the size
6762 of the debug information in the output file at the cost of increasing
6763 link processing time. Merging is enabled by default.
6764
6765 @item -fdebug-prefix-map=@var{old}=@var{new}
6766 @opindex fdebug-prefix-map
6767 When compiling files in directory @file{@var{old}}, record debugging
6768 information describing them as in @file{@var{new}} instead.
6769
6770 @item -fvar-tracking
6771 @opindex fvar-tracking
6772 Run variable tracking pass. It computes where variables are stored at each
6773 position in code. Better debugging information is then generated
6774 (if the debugging information format supports this information).
6775
6776 It is enabled by default when compiling with optimization (@option{-Os},
6777 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6778 the debug info format supports it.
6779
6780 @item -fvar-tracking-assignments
6781 @opindex fvar-tracking-assignments
6782 @opindex fno-var-tracking-assignments
6783 Annotate assignments to user variables early in the compilation and
6784 attempt to carry the annotations over throughout the compilation all the
6785 way to the end, in an attempt to improve debug information while
6786 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6787
6788 It can be enabled even if var-tracking is disabled, in which case
6789 annotations are created and maintained, but discarded at the end.
6790 By default, this flag is enabled together with @option{-fvar-tracking},
6791 except when selective scheduling is enabled.
6792
6793 @item -gsplit-dwarf
6794 @opindex gsplit-dwarf
6795 Separate as much DWARF debugging information as possible into a
6796 separate output file with the extension @file{.dwo}. This option allows
6797 the build system to avoid linking files with debug information. To
6798 be useful, this option requires a debugger capable of reading @file{.dwo}
6799 files.
6800
6801 @item -gpubnames
6802 @opindex gpubnames
6803 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
6804
6805 @item -ggnu-pubnames
6806 @opindex ggnu-pubnames
6807 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
6808 suitable for conversion into a GDB@ index. This option is only useful
6809 with a linker that can produce GDB@ index version 7.
6810
6811 @item -fdebug-types-section
6812 @opindex fdebug-types-section
6813 @opindex fno-debug-types-section
6814 When using DWARF Version 4 or higher, type DIEs can be put into
6815 their own @code{.debug_types} section instead of making them part of the
6816 @code{.debug_info} section. It is more efficient to put them in a separate
6817 comdat sections since the linker can then remove duplicates.
6818 But not all DWARF consumers support @code{.debug_types} sections yet
6819 and on some objects @code{.debug_types} produces larger instead of smaller
6820 debugging information.
6821
6822 @item -grecord-gcc-switches
6823 @item -gno-record-gcc-switches
6824 @opindex grecord-gcc-switches
6825 @opindex gno-record-gcc-switches
6826 This switch causes the command-line options used to invoke the
6827 compiler that may affect code generation to be appended to the
6828 DW_AT_producer attribute in DWARF debugging information. The options
6829 are concatenated with spaces separating them from each other and from
6830 the compiler version.
6831 It is enabled by default.
6832 See also @option{-frecord-gcc-switches} for another
6833 way of storing compiler options into the object file.
6834
6835 @item -gstrict-dwarf
6836 @opindex gstrict-dwarf
6837 Disallow using extensions of later DWARF standard version than selected
6838 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
6839 DWARF extensions from later standard versions is allowed.
6840
6841 @item -gno-strict-dwarf
6842 @opindex gno-strict-dwarf
6843 Allow using extensions of later DWARF standard version than selected with
6844 @option{-gdwarf-@var{version}}.
6845
6846 @item -gcolumn-info
6847 @item -gno-column-info
6848 @opindex gcolumn-info
6849 @opindex gno-column-info
6850 Emit location column information into DWARF debugging information, rather
6851 than just file and line.
6852 This option is disabled by default.
6853
6854 @item -gz@r{[}=@var{type}@r{]}
6855 @opindex gz
6856 Produce compressed debug sections in DWARF format, if that is supported.
6857 If @var{type} is not given, the default type depends on the capabilities
6858 of the assembler and linker used. @var{type} may be one of
6859 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
6860 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
6861 compression in traditional GNU format). If the linker doesn't support
6862 writing compressed debug sections, the option is rejected. Otherwise,
6863 if the assembler does not support them, @option{-gz} is silently ignored
6864 when producing object files.
6865
6866 @item -feliminate-dwarf2-dups
6867 @opindex feliminate-dwarf2-dups
6868 Compress DWARF debugging information by eliminating duplicated
6869 information about each symbol. This option only makes sense when
6870 generating DWARF debugging information.
6871
6872 @item -femit-struct-debug-baseonly
6873 @opindex femit-struct-debug-baseonly
6874 Emit debug information for struct-like types
6875 only when the base name of the compilation source file
6876 matches the base name of file in which the struct is defined.
6877
6878 This option substantially reduces the size of debugging information,
6879 but at significant potential loss in type information to the debugger.
6880 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6881 See @option{-femit-struct-debug-detailed} for more detailed control.
6882
6883 This option works only with DWARF debug output.
6884
6885 @item -femit-struct-debug-reduced
6886 @opindex femit-struct-debug-reduced
6887 Emit debug information for struct-like types
6888 only when the base name of the compilation source file
6889 matches the base name of file in which the type is defined,
6890 unless the struct is a template or defined in a system header.
6891
6892 This option significantly reduces the size of debugging information,
6893 with some potential loss in type information to the debugger.
6894 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6895 See @option{-femit-struct-debug-detailed} for more detailed control.
6896
6897 This option works only with DWARF debug output.
6898
6899 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6900 @opindex femit-struct-debug-detailed
6901 Specify the struct-like types
6902 for which the compiler generates debug information.
6903 The intent is to reduce duplicate struct debug information
6904 between different object files within the same program.
6905
6906 This option is a detailed version of
6907 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6908 which serves for most needs.
6909
6910 A specification has the syntax@*
6911 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6912
6913 The optional first word limits the specification to
6914 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6915 A struct type is used directly when it is the type of a variable, member.
6916 Indirect uses arise through pointers to structs.
6917 That is, when use of an incomplete struct is valid, the use is indirect.
6918 An example is
6919 @samp{struct one direct; struct two * indirect;}.
6920
6921 The optional second word limits the specification to
6922 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6923 Generic structs are a bit complicated to explain.
6924 For C++, these are non-explicit specializations of template classes,
6925 or non-template classes within the above.
6926 Other programming languages have generics,
6927 but @option{-femit-struct-debug-detailed} does not yet implement them.
6928
6929 The third word specifies the source files for those
6930 structs for which the compiler should emit debug information.
6931 The values @samp{none} and @samp{any} have the normal meaning.
6932 The value @samp{base} means that
6933 the base of name of the file in which the type declaration appears
6934 must match the base of the name of the main compilation file.
6935 In practice, this means that when compiling @file{foo.c}, debug information
6936 is generated for types declared in that file and @file{foo.h},
6937 but not other header files.
6938 The value @samp{sys} means those types satisfying @samp{base}
6939 or declared in system or compiler headers.
6940
6941 You may need to experiment to determine the best settings for your application.
6942
6943 The default is @option{-femit-struct-debug-detailed=all}.
6944
6945 This option works only with DWARF debug output.
6946
6947 @item -fno-dwarf2-cfi-asm
6948 @opindex fdwarf2-cfi-asm
6949 @opindex fno-dwarf2-cfi-asm
6950 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
6951 instead of using GAS @code{.cfi_*} directives.
6952
6953 @item -fno-eliminate-unused-debug-types
6954 @opindex feliminate-unused-debug-types
6955 @opindex fno-eliminate-unused-debug-types
6956 Normally, when producing DWARF output, GCC avoids producing debug symbol
6957 output for types that are nowhere used in the source file being compiled.
6958 Sometimes it is useful to have GCC emit debugging
6959 information for all types declared in a compilation
6960 unit, regardless of whether or not they are actually used
6961 in that compilation unit, for example
6962 if, in the debugger, you want to cast a value to a type that is
6963 not actually used in your program (but is declared). More often,
6964 however, this results in a significant amount of wasted space.
6965 @end table
6966
6967 @node Optimize Options
6968 @section Options That Control Optimization
6969 @cindex optimize options
6970 @cindex options, optimization
6971
6972 These options control various sorts of optimizations.
6973
6974 Without any optimization option, the compiler's goal is to reduce the
6975 cost of compilation and to make debugging produce the expected
6976 results. Statements are independent: if you stop the program with a
6977 breakpoint between statements, you can then assign a new value to any
6978 variable or change the program counter to any other statement in the
6979 function and get exactly the results you expect from the source
6980 code.
6981
6982 Turning on optimization flags makes the compiler attempt to improve
6983 the performance and/or code size at the expense of compilation time
6984 and possibly the ability to debug the program.
6985
6986 The compiler performs optimization based on the knowledge it has of the
6987 program. Compiling multiple files at once to a single output file mode allows
6988 the compiler to use information gained from all of the files when compiling
6989 each of them.
6990
6991 Not all optimizations are controlled directly by a flag. Only
6992 optimizations that have a flag are listed in this section.
6993
6994 Most optimizations are only enabled if an @option{-O} level is set on
6995 the command line. Otherwise they are disabled, even if individual
6996 optimization flags are specified.
6997
6998 Depending on the target and how GCC was configured, a slightly different
6999 set of optimizations may be enabled at each @option{-O} level than
7000 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7001 to find out the exact set of optimizations that are enabled at each level.
7002 @xref{Overall Options}, for examples.
7003
7004 @table @gcctabopt
7005 @item -O
7006 @itemx -O1
7007 @opindex O
7008 @opindex O1
7009 Optimize. Optimizing compilation takes somewhat more time, and a lot
7010 more memory for a large function.
7011
7012 With @option{-O}, the compiler tries to reduce code size and execution
7013 time, without performing any optimizations that take a great deal of
7014 compilation time.
7015
7016 @option{-O} turns on the following optimization flags:
7017 @gccoptlist{
7018 -fauto-inc-dec @gol
7019 -fbranch-count-reg @gol
7020 -fcombine-stack-adjustments @gol
7021 -fcompare-elim @gol
7022 -fcprop-registers @gol
7023 -fdce @gol
7024 -fdefer-pop @gol
7025 -fdelayed-branch @gol
7026 -fdse @gol
7027 -fforward-propagate @gol
7028 -fguess-branch-probability @gol
7029 -fif-conversion2 @gol
7030 -fif-conversion @gol
7031 -finline-functions-called-once @gol
7032 -fipa-pure-const @gol
7033 -fipa-profile @gol
7034 -fipa-reference @gol
7035 -fmerge-constants @gol
7036 -fmove-loop-invariants @gol
7037 -freorder-blocks @gol
7038 -fshrink-wrap @gol
7039 -fshrink-wrap-separate @gol
7040 -fsplit-wide-types @gol
7041 -fssa-backprop @gol
7042 -fssa-phiopt @gol
7043 -ftree-bit-ccp @gol
7044 -ftree-ccp @gol
7045 -ftree-ch @gol
7046 -ftree-coalesce-vars @gol
7047 -ftree-copy-prop @gol
7048 -ftree-dce @gol
7049 -ftree-dominator-opts @gol
7050 -ftree-dse @gol
7051 -ftree-forwprop @gol
7052 -ftree-fre @gol
7053 -ftree-phiprop @gol
7054 -ftree-sink @gol
7055 -ftree-slsr @gol
7056 -ftree-sra @gol
7057 -ftree-pta @gol
7058 -ftree-ter @gol
7059 -funit-at-a-time}
7060
7061 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
7062 where doing so does not interfere with debugging.
7063
7064 @item -O2
7065 @opindex O2
7066 Optimize even more. GCC performs nearly all supported optimizations
7067 that do not involve a space-speed tradeoff.
7068 As compared to @option{-O}, this option increases both compilation time
7069 and the performance of the generated code.
7070
7071 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7072 also turns on the following optimization flags:
7073 @gccoptlist{-fthread-jumps @gol
7074 -falign-functions -falign-jumps @gol
7075 -falign-loops -falign-labels @gol
7076 -fcaller-saves @gol
7077 -fcrossjumping @gol
7078 -fcse-follow-jumps -fcse-skip-blocks @gol
7079 -fdelete-null-pointer-checks @gol
7080 -fdevirtualize -fdevirtualize-speculatively @gol
7081 -fexpensive-optimizations @gol
7082 -fgcse -fgcse-lm @gol
7083 -fhoist-adjacent-loads @gol
7084 -finline-small-functions @gol
7085 -findirect-inlining @gol
7086 -fipa-cp @gol
7087 -fipa-bit-cp @gol
7088 -fipa-vrp @gol
7089 -fipa-sra @gol
7090 -fipa-icf @gol
7091 -fisolate-erroneous-paths-dereference @gol
7092 -flra-remat @gol
7093 -foptimize-sibling-calls @gol
7094 -foptimize-strlen @gol
7095 -fpartial-inlining @gol
7096 -fpeephole2 @gol
7097 -freorder-blocks-algorithm=stc @gol
7098 -freorder-blocks-and-partition -freorder-functions @gol
7099 -frerun-cse-after-loop @gol
7100 -fsched-interblock -fsched-spec @gol
7101 -fschedule-insns -fschedule-insns2 @gol
7102 -fstore-merging @gol
7103 -fstrict-aliasing -fstrict-overflow @gol
7104 -ftree-builtin-call-dce @gol
7105 -ftree-switch-conversion -ftree-tail-merge @gol
7106 -fcode-hoisting @gol
7107 -ftree-pre @gol
7108 -ftree-vrp @gol
7109 -fipa-ra}
7110
7111 Please note the warning under @option{-fgcse} about
7112 invoking @option{-O2} on programs that use computed gotos.
7113
7114 @item -O3
7115 @opindex O3
7116 Optimize yet more. @option{-O3} turns on all optimizations specified
7117 by @option{-O2} and also turns on the @option{-finline-functions},
7118 @option{-funswitch-loops}, @option{-fpredictive-commoning},
7119 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
7120 @option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
7121 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
7122 @option{-ftree-partial-pre}, @option{-fpeel-loops}
7123 and @option{-fipa-cp-clone} options.
7124
7125 @item -O0
7126 @opindex O0
7127 Reduce compilation time and make debugging produce the expected
7128 results. This is the default.
7129
7130 @item -Os
7131 @opindex Os
7132 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7133 do not typically increase code size. It also performs further
7134 optimizations designed to reduce code size.
7135
7136 @option{-Os} disables the following optimization flags:
7137 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7138 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
7139 -freorder-blocks-and-partition -fprefetch-loop-arrays}
7140
7141 @item -Ofast
7142 @opindex Ofast
7143 Disregard strict standards compliance. @option{-Ofast} enables all
7144 @option{-O3} optimizations. It also enables optimizations that are not
7145 valid for all standard-compliant programs.
7146 It turns on @option{-ffast-math} and the Fortran-specific
7147 @option{-fno-protect-parens} and @option{-fstack-arrays}.
7148
7149 @item -Og
7150 @opindex Og
7151 Optimize debugging experience. @option{-Og} enables optimizations
7152 that do not interfere with debugging. It should be the optimization
7153 level of choice for the standard edit-compile-debug cycle, offering
7154 a reasonable level of optimization while maintaining fast compilation
7155 and a good debugging experience.
7156 @end table
7157
7158 If you use multiple @option{-O} options, with or without level numbers,
7159 the last such option is the one that is effective.
7160
7161 Options of the form @option{-f@var{flag}} specify machine-independent
7162 flags. Most flags have both positive and negative forms; the negative
7163 form of @option{-ffoo} is @option{-fno-foo}. In the table
7164 below, only one of the forms is listed---the one you typically
7165 use. You can figure out the other form by either removing @samp{no-}
7166 or adding it.
7167
7168 The following options control specific optimizations. They are either
7169 activated by @option{-O} options or are related to ones that are. You
7170 can use the following flags in the rare cases when ``fine-tuning'' of
7171 optimizations to be performed is desired.
7172
7173 @table @gcctabopt
7174 @item -fno-defer-pop
7175 @opindex fno-defer-pop
7176 Always pop the arguments to each function call as soon as that function
7177 returns. For machines that must pop arguments after a function call,
7178 the compiler normally lets arguments accumulate on the stack for several
7179 function calls and pops them all at once.
7180
7181 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7182
7183 @item -fforward-propagate
7184 @opindex fforward-propagate
7185 Perform a forward propagation pass on RTL@. The pass tries to combine two
7186 instructions and checks if the result can be simplified. If loop unrolling
7187 is active, two passes are performed and the second is scheduled after
7188 loop unrolling.
7189
7190 This option is enabled by default at optimization levels @option{-O},
7191 @option{-O2}, @option{-O3}, @option{-Os}.
7192
7193 @item -ffp-contract=@var{style}
7194 @opindex ffp-contract
7195 @option{-ffp-contract=off} disables floating-point expression contraction.
7196 @option{-ffp-contract=fast} enables floating-point expression contraction
7197 such as forming of fused multiply-add operations if the target has
7198 native support for them.
7199 @option{-ffp-contract=on} enables floating-point expression contraction
7200 if allowed by the language standard. This is currently not implemented
7201 and treated equal to @option{-ffp-contract=off}.
7202
7203 The default is @option{-ffp-contract=fast}.
7204
7205 @item -fomit-frame-pointer
7206 @opindex fomit-frame-pointer
7207 Don't keep the frame pointer in a register for functions that
7208 don't need one. This avoids the instructions to save, set up and
7209 restore frame pointers; it also makes an extra register available
7210 in many functions. @strong{It also makes debugging impossible on
7211 some machines.}
7212
7213 On some machines, such as the VAX, this flag has no effect, because
7214 the standard calling sequence automatically handles the frame pointer
7215 and nothing is saved by pretending it doesn't exist. The
7216 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
7217 whether a target machine supports this flag. @xref{Registers,,Register
7218 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
7219
7220 The default setting (when not optimizing for
7221 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
7222 @option{-fomit-frame-pointer}. You can configure GCC with the
7223 @option{--enable-frame-pointer} configure option to change the default.
7224
7225 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7226
7227 @item -foptimize-sibling-calls
7228 @opindex foptimize-sibling-calls
7229 Optimize sibling and tail recursive calls.
7230
7231 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7232
7233 @item -foptimize-strlen
7234 @opindex foptimize-strlen
7235 Optimize various standard C string functions (e.g. @code{strlen},
7236 @code{strchr} or @code{strcpy}) and
7237 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7238
7239 Enabled at levels @option{-O2}, @option{-O3}.
7240
7241 @item -fno-inline
7242 @opindex fno-inline
7243 Do not expand any functions inline apart from those marked with
7244 the @code{always_inline} attribute. This is the default when not
7245 optimizing.
7246
7247 Single functions can be exempted from inlining by marking them
7248 with the @code{noinline} attribute.
7249
7250 @item -finline-small-functions
7251 @opindex finline-small-functions
7252 Integrate functions into their callers when their body is smaller than expected
7253 function call code (so overall size of program gets smaller). The compiler
7254 heuristically decides which functions are simple enough to be worth integrating
7255 in this way. This inlining applies to all functions, even those not declared
7256 inline.
7257
7258 Enabled at level @option{-O2}.
7259
7260 @item -findirect-inlining
7261 @opindex findirect-inlining
7262 Inline also indirect calls that are discovered to be known at compile
7263 time thanks to previous inlining. This option has any effect only
7264 when inlining itself is turned on by the @option{-finline-functions}
7265 or @option{-finline-small-functions} options.
7266
7267 Enabled at level @option{-O2}.
7268
7269 @item -finline-functions
7270 @opindex finline-functions
7271 Consider all functions for inlining, even if they are not declared inline.
7272 The compiler heuristically decides which functions are worth integrating
7273 in this way.
7274
7275 If all calls to a given function are integrated, and the function is
7276 declared @code{static}, then the function is normally not output as
7277 assembler code in its own right.
7278
7279 Enabled at level @option{-O3}.
7280
7281 @item -finline-functions-called-once
7282 @opindex finline-functions-called-once
7283 Consider all @code{static} functions called once for inlining into their
7284 caller even if they are not marked @code{inline}. If a call to a given
7285 function is integrated, then the function is not output as assembler code
7286 in its own right.
7287
7288 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7289
7290 @item -fearly-inlining
7291 @opindex fearly-inlining
7292 Inline functions marked by @code{always_inline} and functions whose body seems
7293 smaller than the function call overhead early before doing
7294 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7295 makes profiling significantly cheaper and usually inlining faster on programs
7296 having large chains of nested wrapper functions.
7297
7298 Enabled by default.
7299
7300 @item -fipa-sra
7301 @opindex fipa-sra
7302 Perform interprocedural scalar replacement of aggregates, removal of
7303 unused parameters and replacement of parameters passed by reference
7304 by parameters passed by value.
7305
7306 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7307
7308 @item -finline-limit=@var{n}
7309 @opindex finline-limit
7310 By default, GCC limits the size of functions that can be inlined. This flag
7311 allows coarse control of this limit. @var{n} is the size of functions that
7312 can be inlined in number of pseudo instructions.
7313
7314 Inlining is actually controlled by a number of parameters, which may be
7315 specified individually by using @option{--param @var{name}=@var{value}}.
7316 The @option{-finline-limit=@var{n}} option sets some of these parameters
7317 as follows:
7318
7319 @table @gcctabopt
7320 @item max-inline-insns-single
7321 is set to @var{n}/2.
7322 @item max-inline-insns-auto
7323 is set to @var{n}/2.
7324 @end table
7325
7326 See below for a documentation of the individual
7327 parameters controlling inlining and for the defaults of these parameters.
7328
7329 @emph{Note:} there may be no value to @option{-finline-limit} that results
7330 in default behavior.
7331
7332 @emph{Note:} pseudo instruction represents, in this particular context, an
7333 abstract measurement of function's size. In no way does it represent a count
7334 of assembly instructions and as such its exact meaning might change from one
7335 release to an another.
7336
7337 @item -fno-keep-inline-dllexport
7338 @opindex fno-keep-inline-dllexport
7339 This is a more fine-grained version of @option{-fkeep-inline-functions},
7340 which applies only to functions that are declared using the @code{dllexport}
7341 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
7342 Functions}.
7343
7344 @item -fkeep-inline-functions
7345 @opindex fkeep-inline-functions
7346 In C, emit @code{static} functions that are declared @code{inline}
7347 into the object file, even if the function has been inlined into all
7348 of its callers. This switch does not affect functions using the
7349 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7350 inline functions into the object file.
7351
7352 @item -fkeep-static-functions
7353 @opindex fkeep-static-functions
7354 Emit @code{static} functions into the object file, even if the function
7355 is never used.
7356
7357 @item -fkeep-static-consts
7358 @opindex fkeep-static-consts
7359 Emit variables declared @code{static const} when optimization isn't turned
7360 on, even if the variables aren't referenced.
7361
7362 GCC enables this option by default. If you want to force the compiler to
7363 check if a variable is referenced, regardless of whether or not
7364 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7365
7366 @item -fmerge-constants
7367 @opindex fmerge-constants
7368 Attempt to merge identical constants (string constants and floating-point
7369 constants) across compilation units.
7370
7371 This option is the default for optimized compilation if the assembler and
7372 linker support it. Use @option{-fno-merge-constants} to inhibit this
7373 behavior.
7374
7375 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7376
7377 @item -fmerge-all-constants
7378 @opindex fmerge-all-constants
7379 Attempt to merge identical constants and identical variables.
7380
7381 This option implies @option{-fmerge-constants}. In addition to
7382 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7383 arrays or initialized constant variables with integral or floating-point
7384 types. Languages like C or C++ require each variable, including multiple
7385 instances of the same variable in recursive calls, to have distinct locations,
7386 so using this option results in non-conforming
7387 behavior.
7388
7389 @item -fmodulo-sched
7390 @opindex fmodulo-sched
7391 Perform swing modulo scheduling immediately before the first scheduling
7392 pass. This pass looks at innermost loops and reorders their
7393 instructions by overlapping different iterations.
7394
7395 @item -fmodulo-sched-allow-regmoves
7396 @opindex fmodulo-sched-allow-regmoves
7397 Perform more aggressive SMS-based modulo scheduling with register moves
7398 allowed. By setting this flag certain anti-dependences edges are
7399 deleted, which triggers the generation of reg-moves based on the
7400 life-range analysis. This option is effective only with
7401 @option{-fmodulo-sched} enabled.
7402
7403 @item -fno-branch-count-reg
7404 @opindex fno-branch-count-reg
7405 Avoid running a pass scanning for opportunities to use ``decrement and
7406 branch'' instructions on a count register instead of generating sequences
7407 of instructions that decrement a register, compare it against zero, and
7408 then branch based upon the result. This option is only meaningful on
7409 architectures that support such instructions, which include x86, PowerPC,
7410 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
7411 doesn't remove the decrement and branch instructions from the generated
7412 instruction stream introduced by other optimization passes.
7413
7414 Enabled by default at @option{-O1} and higher.
7415
7416 The default is @option{-fbranch-count-reg}.
7417
7418 @item -fno-function-cse
7419 @opindex fno-function-cse
7420 Do not put function addresses in registers; make each instruction that
7421 calls a constant function contain the function's address explicitly.
7422
7423 This option results in less efficient code, but some strange hacks
7424 that alter the assembler output may be confused by the optimizations
7425 performed when this option is not used.
7426
7427 The default is @option{-ffunction-cse}
7428
7429 @item -fno-zero-initialized-in-bss
7430 @opindex fno-zero-initialized-in-bss
7431 If the target supports a BSS section, GCC by default puts variables that
7432 are initialized to zero into BSS@. This can save space in the resulting
7433 code.
7434
7435 This option turns off this behavior because some programs explicitly
7436 rely on variables going to the data section---e.g., so that the
7437 resulting executable can find the beginning of that section and/or make
7438 assumptions based on that.
7439
7440 The default is @option{-fzero-initialized-in-bss}.
7441
7442 @item -fthread-jumps
7443 @opindex fthread-jumps
7444 Perform optimizations that check to see if a jump branches to a
7445 location where another comparison subsumed by the first is found. If
7446 so, the first branch is redirected to either the destination of the
7447 second branch or a point immediately following it, depending on whether
7448 the condition is known to be true or false.
7449
7450 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7451
7452 @item -fsplit-wide-types
7453 @opindex fsplit-wide-types
7454 When using a type that occupies multiple registers, such as @code{long
7455 long} on a 32-bit system, split the registers apart and allocate them
7456 independently. This normally generates better code for those types,
7457 but may make debugging more difficult.
7458
7459 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7460 @option{-Os}.
7461
7462 @item -fcse-follow-jumps
7463 @opindex fcse-follow-jumps
7464 In common subexpression elimination (CSE), scan through jump instructions
7465 when the target of the jump is not reached by any other path. For
7466 example, when CSE encounters an @code{if} statement with an
7467 @code{else} clause, CSE follows the jump when the condition
7468 tested is false.
7469
7470 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7471
7472 @item -fcse-skip-blocks
7473 @opindex fcse-skip-blocks
7474 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7475 follow jumps that conditionally skip over blocks. When CSE
7476 encounters a simple @code{if} statement with no else clause,
7477 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7478 body of the @code{if}.
7479
7480 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7481
7482 @item -frerun-cse-after-loop
7483 @opindex frerun-cse-after-loop
7484 Re-run common subexpression elimination after loop optimizations are
7485 performed.
7486
7487 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7488
7489 @item -fgcse
7490 @opindex fgcse
7491 Perform a global common subexpression elimination pass.
7492 This pass also performs global constant and copy propagation.
7493
7494 @emph{Note:} When compiling a program using computed gotos, a GCC
7495 extension, you may get better run-time performance if you disable
7496 the global common subexpression elimination pass by adding
7497 @option{-fno-gcse} to the command line.
7498
7499 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7500
7501 @item -fgcse-lm
7502 @opindex fgcse-lm
7503 When @option{-fgcse-lm} is enabled, global common subexpression elimination
7504 attempts to move loads that are only killed by stores into themselves. This
7505 allows a loop containing a load/store sequence to be changed to a load outside
7506 the loop, and a copy/store within the loop.
7507
7508 Enabled by default when @option{-fgcse} is enabled.
7509
7510 @item -fgcse-sm
7511 @opindex fgcse-sm
7512 When @option{-fgcse-sm} is enabled, a store motion pass is run after
7513 global common subexpression elimination. This pass attempts to move
7514 stores out of loops. When used in conjunction with @option{-fgcse-lm},
7515 loops containing a load/store sequence can be changed to a load before
7516 the loop and a store after the loop.
7517
7518 Not enabled at any optimization level.
7519
7520 @item -fgcse-las
7521 @opindex fgcse-las
7522 When @option{-fgcse-las} is enabled, the global common subexpression
7523 elimination pass eliminates redundant loads that come after stores to the
7524 same memory location (both partial and full redundancies).
7525
7526 Not enabled at any optimization level.
7527
7528 @item -fgcse-after-reload
7529 @opindex fgcse-after-reload
7530 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7531 pass is performed after reload. The purpose of this pass is to clean up
7532 redundant spilling.
7533
7534 @item -faggressive-loop-optimizations
7535 @opindex faggressive-loop-optimizations
7536 This option tells the loop optimizer to use language constraints to
7537 derive bounds for the number of iterations of a loop. This assumes that
7538 loop code does not invoke undefined behavior by for example causing signed
7539 integer overflows or out-of-bound array accesses. The bounds for the
7540 number of iterations of a loop are used to guide loop unrolling and peeling
7541 and loop exit test optimizations.
7542 This option is enabled by default.
7543
7544 @item -funconstrained-commons
7545 @opindex funconstrained-commons
7546 This option tells the compiler that variables declared in common blocks
7547 (e.g. Fortran) may later be overridden with longer trailing arrays. This
7548 prevents certain optimizations that depend on knowing the array bounds.
7549
7550 @item -fcrossjumping
7551 @opindex fcrossjumping
7552 Perform cross-jumping transformation.
7553 This transformation unifies equivalent code and saves code size. The
7554 resulting code may or may not perform better than without cross-jumping.
7555
7556 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7557
7558 @item -fauto-inc-dec
7559 @opindex fauto-inc-dec
7560 Combine increments or decrements of addresses with memory accesses.
7561 This pass is always skipped on architectures that do not have
7562 instructions to support this. Enabled by default at @option{-O} and
7563 higher on architectures that support this.
7564
7565 @item -fdce
7566 @opindex fdce
7567 Perform dead code elimination (DCE) on RTL@.
7568 Enabled by default at @option{-O} and higher.
7569
7570 @item -fdse
7571 @opindex fdse
7572 Perform dead store elimination (DSE) on RTL@.
7573 Enabled by default at @option{-O} and higher.
7574
7575 @item -fif-conversion
7576 @opindex fif-conversion
7577 Attempt to transform conditional jumps into branch-less equivalents. This
7578 includes use of conditional moves, min, max, set flags and abs instructions, and
7579 some tricks doable by standard arithmetics. The use of conditional execution
7580 on chips where it is available is controlled by @option{-fif-conversion2}.
7581
7582 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7583
7584 @item -fif-conversion2
7585 @opindex fif-conversion2
7586 Use conditional execution (where available) to transform conditional jumps into
7587 branch-less equivalents.
7588
7589 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7590
7591 @item -fdeclone-ctor-dtor
7592 @opindex fdeclone-ctor-dtor
7593 The C++ ABI requires multiple entry points for constructors and
7594 destructors: one for a base subobject, one for a complete object, and
7595 one for a virtual destructor that calls operator delete afterwards.
7596 For a hierarchy with virtual bases, the base and complete variants are
7597 clones, which means two copies of the function. With this option, the
7598 base and complete variants are changed to be thunks that call a common
7599 implementation.
7600
7601 Enabled by @option{-Os}.
7602
7603 @item -fdelete-null-pointer-checks
7604 @opindex fdelete-null-pointer-checks
7605 Assume that programs cannot safely dereference null pointers, and that
7606 no code or data element resides at address zero.
7607 This option enables simple constant
7608 folding optimizations at all optimization levels. In addition, other
7609 optimization passes in GCC use this flag to control global dataflow
7610 analyses that eliminate useless checks for null pointers; these assume
7611 that a memory access to address zero always results in a trap, so
7612 that if a pointer is checked after it has already been dereferenced,
7613 it cannot be null.
7614
7615 Note however that in some environments this assumption is not true.
7616 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
7617 for programs that depend on that behavior.
7618
7619 This option is enabled by default on most targets. On Nios II ELF, it
7620 defaults to off. On AVR and CR16, this option is completely disabled.
7621
7622 Passes that use the dataflow information
7623 are enabled independently at different optimization levels.
7624
7625 @item -fdevirtualize
7626 @opindex fdevirtualize
7627 Attempt to convert calls to virtual functions to direct calls. This
7628 is done both within a procedure and interprocedurally as part of
7629 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
7630 propagation (@option{-fipa-cp}).
7631 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7632
7633 @item -fdevirtualize-speculatively
7634 @opindex fdevirtualize-speculatively
7635 Attempt to convert calls to virtual functions to speculative direct calls.
7636 Based on the analysis of the type inheritance graph, determine for a given call
7637 the set of likely targets. If the set is small, preferably of size 1, change
7638 the call into a conditional deciding between direct and indirect calls. The
7639 speculative calls enable more optimizations, such as inlining. When they seem
7640 useless after further optimization, they are converted back into original form.
7641
7642 @item -fdevirtualize-at-ltrans
7643 @opindex fdevirtualize-at-ltrans
7644 Stream extra information needed for aggressive devirtualization when running
7645 the link-time optimizer in local transformation mode.
7646 This option enables more devirtualization but
7647 significantly increases the size of streamed data. For this reason it is
7648 disabled by default.
7649
7650 @item -fexpensive-optimizations
7651 @opindex fexpensive-optimizations
7652 Perform a number of minor optimizations that are relatively expensive.
7653
7654 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7655
7656 @item -free
7657 @opindex free
7658 Attempt to remove redundant extension instructions. This is especially
7659 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
7660 registers after writing to their lower 32-bit half.
7661
7662 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
7663 @option{-O3}, @option{-Os}.
7664
7665 @item -fno-lifetime-dse
7666 @opindex fno-lifetime-dse
7667 In C++ the value of an object is only affected by changes within its
7668 lifetime: when the constructor begins, the object has an indeterminate
7669 value, and any changes during the lifetime of the object are dead when
7670 the object is destroyed. Normally dead store elimination will take
7671 advantage of this; if your code relies on the value of the object
7672 storage persisting beyond the lifetime of the object, you can use this
7673 flag to disable this optimization. To preserve stores before the
7674 constructor starts (e.g. because your operator new clears the object
7675 storage) but still treat the object as dead after the destructor you,
7676 can use @option{-flifetime-dse=1}. The default behavior can be
7677 explicitly selected with @option{-flifetime-dse=2}.
7678 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
7679
7680 @item -flive-range-shrinkage
7681 @opindex flive-range-shrinkage
7682 Attempt to decrease register pressure through register live range
7683 shrinkage. This is helpful for fast processors with small or moderate
7684 size register sets.
7685
7686 @item -fira-algorithm=@var{algorithm}
7687 @opindex fira-algorithm
7688 Use the specified coloring algorithm for the integrated register
7689 allocator. The @var{algorithm} argument can be @samp{priority}, which
7690 specifies Chow's priority coloring, or @samp{CB}, which specifies
7691 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
7692 for all architectures, but for those targets that do support it, it is
7693 the default because it generates better code.
7694
7695 @item -fira-region=@var{region}
7696 @opindex fira-region
7697 Use specified regions for the integrated register allocator. The
7698 @var{region} argument should be one of the following:
7699
7700 @table @samp
7701
7702 @item all
7703 Use all loops as register allocation regions.
7704 This can give the best results for machines with a small and/or
7705 irregular register set.
7706
7707 @item mixed
7708 Use all loops except for loops with small register pressure
7709 as the regions. This value usually gives
7710 the best results in most cases and for most architectures,
7711 and is enabled by default when compiling with optimization for speed
7712 (@option{-O}, @option{-O2}, @dots{}).
7713
7714 @item one
7715 Use all functions as a single region.
7716 This typically results in the smallest code size, and is enabled by default for
7717 @option{-Os} or @option{-O0}.
7718
7719 @end table
7720
7721 @item -fira-hoist-pressure
7722 @opindex fira-hoist-pressure
7723 Use IRA to evaluate register pressure in the code hoisting pass for
7724 decisions to hoist expressions. This option usually results in smaller
7725 code, but it can slow the compiler down.
7726
7727 This option is enabled at level @option{-Os} for all targets.
7728
7729 @item -fira-loop-pressure
7730 @opindex fira-loop-pressure
7731 Use IRA to evaluate register pressure in loops for decisions to move
7732 loop invariants. This option usually results in generation
7733 of faster and smaller code on machines with large register files (>= 32
7734 registers), but it can slow the compiler down.
7735
7736 This option is enabled at level @option{-O3} for some targets.
7737
7738 @item -fno-ira-share-save-slots
7739 @opindex fno-ira-share-save-slots
7740 Disable sharing of stack slots used for saving call-used hard
7741 registers living through a call. Each hard register gets a
7742 separate stack slot, and as a result function stack frames are
7743 larger.
7744
7745 @item -fno-ira-share-spill-slots
7746 @opindex fno-ira-share-spill-slots
7747 Disable sharing of stack slots allocated for pseudo-registers. Each
7748 pseudo-register that does not get a hard register gets a separate
7749 stack slot, and as a result function stack frames are larger.
7750
7751 @item -flra-remat
7752 @opindex flra-remat
7753 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7754 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7755 values if it is profitable.
7756
7757 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7758
7759 @item -fdelayed-branch
7760 @opindex fdelayed-branch
7761 If supported for the target machine, attempt to reorder instructions
7762 to exploit instruction slots available after delayed branch
7763 instructions.
7764
7765 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7766
7767 @item -fschedule-insns
7768 @opindex fschedule-insns
7769 If supported for the target machine, attempt to reorder instructions to
7770 eliminate execution stalls due to required data being unavailable. This
7771 helps machines that have slow floating point or memory load instructions
7772 by allowing other instructions to be issued until the result of the load
7773 or floating-point instruction is required.
7774
7775 Enabled at levels @option{-O2}, @option{-O3}.
7776
7777 @item -fschedule-insns2
7778 @opindex fschedule-insns2
7779 Similar to @option{-fschedule-insns}, but requests an additional pass of
7780 instruction scheduling after register allocation has been done. This is
7781 especially useful on machines with a relatively small number of
7782 registers and where memory load instructions take more than one cycle.
7783
7784 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7785
7786 @item -fno-sched-interblock
7787 @opindex fno-sched-interblock
7788 Don't schedule instructions across basic blocks. This is normally
7789 enabled by default when scheduling before register allocation, i.e.@:
7790 with @option{-fschedule-insns} or at @option{-O2} or higher.
7791
7792 @item -fno-sched-spec
7793 @opindex fno-sched-spec
7794 Don't allow speculative motion of non-load instructions. This is normally
7795 enabled by default when scheduling before register allocation, i.e.@:
7796 with @option{-fschedule-insns} or at @option{-O2} or higher.
7797
7798 @item -fsched-pressure
7799 @opindex fsched-pressure
7800 Enable register pressure sensitive insn scheduling before register
7801 allocation. This only makes sense when scheduling before register
7802 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7803 @option{-O2} or higher. Usage of this option can improve the
7804 generated code and decrease its size by preventing register pressure
7805 increase above the number of available hard registers and subsequent
7806 spills in register allocation.
7807
7808 @item -fsched-spec-load
7809 @opindex fsched-spec-load
7810 Allow speculative motion of some load instructions. This only makes
7811 sense when scheduling before register allocation, i.e.@: with
7812 @option{-fschedule-insns} or at @option{-O2} or higher.
7813
7814 @item -fsched-spec-load-dangerous
7815 @opindex fsched-spec-load-dangerous
7816 Allow speculative motion of more load instructions. This only makes
7817 sense when scheduling before register allocation, i.e.@: with
7818 @option{-fschedule-insns} or at @option{-O2} or higher.
7819
7820 @item -fsched-stalled-insns
7821 @itemx -fsched-stalled-insns=@var{n}
7822 @opindex fsched-stalled-insns
7823 Define how many insns (if any) can be moved prematurely from the queue
7824 of stalled insns into the ready list during the second scheduling pass.
7825 @option{-fno-sched-stalled-insns} means that no insns are moved
7826 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7827 on how many queued insns can be moved prematurely.
7828 @option{-fsched-stalled-insns} without a value is equivalent to
7829 @option{-fsched-stalled-insns=1}.
7830
7831 @item -fsched-stalled-insns-dep
7832 @itemx -fsched-stalled-insns-dep=@var{n}
7833 @opindex fsched-stalled-insns-dep
7834 Define how many insn groups (cycles) are examined for a dependency
7835 on a stalled insn that is a candidate for premature removal from the queue
7836 of stalled insns. This has an effect only during the second scheduling pass,
7837 and only if @option{-fsched-stalled-insns} is used.
7838 @option{-fno-sched-stalled-insns-dep} is equivalent to
7839 @option{-fsched-stalled-insns-dep=0}.
7840 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7841 @option{-fsched-stalled-insns-dep=1}.
7842
7843 @item -fsched2-use-superblocks
7844 @opindex fsched2-use-superblocks
7845 When scheduling after register allocation, use superblock scheduling.
7846 This allows motion across basic block boundaries,
7847 resulting in faster schedules. This option is experimental, as not all machine
7848 descriptions used by GCC model the CPU closely enough to avoid unreliable
7849 results from the algorithm.
7850
7851 This only makes sense when scheduling after register allocation, i.e.@: with
7852 @option{-fschedule-insns2} or at @option{-O2} or higher.
7853
7854 @item -fsched-group-heuristic
7855 @opindex fsched-group-heuristic
7856 Enable the group heuristic in the scheduler. This heuristic favors
7857 the instruction that belongs to a schedule group. This is enabled
7858 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7859 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7860
7861 @item -fsched-critical-path-heuristic
7862 @opindex fsched-critical-path-heuristic
7863 Enable the critical-path heuristic in the scheduler. This heuristic favors
7864 instructions on the critical path. This is enabled by default when
7865 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7866 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7867
7868 @item -fsched-spec-insn-heuristic
7869 @opindex fsched-spec-insn-heuristic
7870 Enable the speculative instruction heuristic in the scheduler. This
7871 heuristic favors speculative instructions with greater dependency weakness.
7872 This is enabled by default when scheduling is enabled, i.e.@:
7873 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7874 or at @option{-O2} or higher.
7875
7876 @item -fsched-rank-heuristic
7877 @opindex fsched-rank-heuristic
7878 Enable the rank heuristic in the scheduler. This heuristic favors
7879 the instruction belonging to a basic block with greater size or frequency.
7880 This is enabled by default when scheduling is enabled, i.e.@:
7881 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7882 at @option{-O2} or higher.
7883
7884 @item -fsched-last-insn-heuristic
7885 @opindex fsched-last-insn-heuristic
7886 Enable the last-instruction heuristic in the scheduler. This heuristic
7887 favors the instruction that is less dependent on the last instruction
7888 scheduled. This is enabled by default when scheduling is enabled,
7889 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7890 at @option{-O2} or higher.
7891
7892 @item -fsched-dep-count-heuristic
7893 @opindex fsched-dep-count-heuristic
7894 Enable the dependent-count heuristic in the scheduler. This heuristic
7895 favors the instruction that has more instructions depending on it.
7896 This is enabled by default when scheduling is enabled, i.e.@:
7897 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7898 at @option{-O2} or higher.
7899
7900 @item -freschedule-modulo-scheduled-loops
7901 @opindex freschedule-modulo-scheduled-loops
7902 Modulo scheduling is performed before traditional scheduling. If a loop
7903 is modulo scheduled, later scheduling passes may change its schedule.
7904 Use this option to control that behavior.
7905
7906 @item -fselective-scheduling
7907 @opindex fselective-scheduling
7908 Schedule instructions using selective scheduling algorithm. Selective
7909 scheduling runs instead of the first scheduler pass.
7910
7911 @item -fselective-scheduling2
7912 @opindex fselective-scheduling2
7913 Schedule instructions using selective scheduling algorithm. Selective
7914 scheduling runs instead of the second scheduler pass.
7915
7916 @item -fsel-sched-pipelining
7917 @opindex fsel-sched-pipelining
7918 Enable software pipelining of innermost loops during selective scheduling.
7919 This option has no effect unless one of @option{-fselective-scheduling} or
7920 @option{-fselective-scheduling2} is turned on.
7921
7922 @item -fsel-sched-pipelining-outer-loops
7923 @opindex fsel-sched-pipelining-outer-loops
7924 When pipelining loops during selective scheduling, also pipeline outer loops.
7925 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7926
7927 @item -fsemantic-interposition
7928 @opindex fsemantic-interposition
7929 Some object formats, like ELF, allow interposing of symbols by the
7930 dynamic linker.
7931 This means that for symbols exported from the DSO, the compiler cannot perform
7932 interprocedural propagation, inlining and other optimizations in anticipation
7933 that the function or variable in question may change. While this feature is
7934 useful, for example, to rewrite memory allocation functions by a debugging
7935 implementation, it is expensive in the terms of code quality.
7936 With @option{-fno-semantic-interposition} the compiler assumes that
7937 if interposition happens for functions the overwriting function will have
7938 precisely the same semantics (and side effects).
7939 Similarly if interposition happens
7940 for variables, the constructor of the variable will be the same. The flag
7941 has no effect for functions explicitly declared inline
7942 (where it is never allowed for interposition to change semantics)
7943 and for symbols explicitly declared weak.
7944
7945 @item -fshrink-wrap
7946 @opindex fshrink-wrap
7947 Emit function prologues only before parts of the function that need it,
7948 rather than at the top of the function. This flag is enabled by default at
7949 @option{-O} and higher.
7950
7951 @item -fshrink-wrap-separate
7952 @opindex fshrink-wrap-separate
7953 Shrink-wrap separate parts of the prologue and epilogue separately, so that
7954 those parts are only executed when needed.
7955 This option is on by default, but has no effect unless @option{-fshrink-wrap}
7956 is also turned on and the target supports this.
7957
7958 @item -fcaller-saves
7959 @opindex fcaller-saves
7960 Enable allocation of values to registers that are clobbered by
7961 function calls, by emitting extra instructions to save and restore the
7962 registers around such calls. Such allocation is done only when it
7963 seems to result in better code.
7964
7965 This option is always enabled by default on certain machines, usually
7966 those which have no call-preserved registers to use instead.
7967
7968 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7969
7970 @item -fcombine-stack-adjustments
7971 @opindex fcombine-stack-adjustments
7972 Tracks stack adjustments (pushes and pops) and stack memory references
7973 and then tries to find ways to combine them.
7974
7975 Enabled by default at @option{-O1} and higher.
7976
7977 @item -fipa-ra
7978 @opindex fipa-ra
7979 Use caller save registers for allocation if those registers are not used by
7980 any called function. In that case it is not necessary to save and restore
7981 them around calls. This is only possible if called functions are part of
7982 same compilation unit as current function and they are compiled before it.
7983
7984 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
7985 is disabled if generated code will be instrumented for profiling
7986 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
7987 exactly (this happens on targets that do not expose prologues
7988 and epilogues in RTL).
7989
7990 @item -fconserve-stack
7991 @opindex fconserve-stack
7992 Attempt to minimize stack usage. The compiler attempts to use less
7993 stack space, even if that makes the program slower. This option
7994 implies setting the @option{large-stack-frame} parameter to 100
7995 and the @option{large-stack-frame-growth} parameter to 400.
7996
7997 @item -ftree-reassoc
7998 @opindex ftree-reassoc
7999 Perform reassociation on trees. This flag is enabled by default
8000 at @option{-O} and higher.
8001
8002 @item -fcode-hoisting
8003 @opindex fcode-hoisting
8004 Perform code hoisting. Code hoisting tries to move the
8005 evaluation of expressions executed on all paths to the function exit
8006 as early as possible. This is especially useful as a code size
8007 optimization, but it often helps for code speed as well.
8008 This flag is enabled by default at @option{-O2} and higher.
8009
8010 @item -ftree-pre
8011 @opindex ftree-pre
8012 Perform partial redundancy elimination (PRE) on trees. This flag is
8013 enabled by default at @option{-O2} and @option{-O3}.
8014
8015 @item -ftree-partial-pre
8016 @opindex ftree-partial-pre
8017 Make partial redundancy elimination (PRE) more aggressive. This flag is
8018 enabled by default at @option{-O3}.
8019
8020 @item -ftree-forwprop
8021 @opindex ftree-forwprop
8022 Perform forward propagation on trees. This flag is enabled by default
8023 at @option{-O} and higher.
8024
8025 @item -ftree-fre
8026 @opindex ftree-fre
8027 Perform full redundancy elimination (FRE) on trees. The difference
8028 between FRE and PRE is that FRE only considers expressions
8029 that are computed on all paths leading to the redundant computation.
8030 This analysis is faster than PRE, though it exposes fewer redundancies.
8031 This flag is enabled by default at @option{-O} and higher.
8032
8033 @item -ftree-phiprop
8034 @opindex ftree-phiprop
8035 Perform hoisting of loads from conditional pointers on trees. This
8036 pass is enabled by default at @option{-O} and higher.
8037
8038 @item -fhoist-adjacent-loads
8039 @opindex fhoist-adjacent-loads
8040 Speculatively hoist loads from both branches of an if-then-else if the
8041 loads are from adjacent locations in the same structure and the target
8042 architecture has a conditional move instruction. This flag is enabled
8043 by default at @option{-O2} and higher.
8044
8045 @item -ftree-copy-prop
8046 @opindex ftree-copy-prop
8047 Perform copy propagation on trees. This pass eliminates unnecessary
8048 copy operations. This flag is enabled by default at @option{-O} and
8049 higher.
8050
8051 @item -fipa-pure-const
8052 @opindex fipa-pure-const
8053 Discover which functions are pure or constant.
8054 Enabled by default at @option{-O} and higher.
8055
8056 @item -fipa-reference
8057 @opindex fipa-reference
8058 Discover which static variables do not escape the
8059 compilation unit.
8060 Enabled by default at @option{-O} and higher.
8061
8062 @item -fipa-pta
8063 @opindex fipa-pta
8064 Perform interprocedural pointer analysis and interprocedural modification
8065 and reference analysis. This option can cause excessive memory and
8066 compile-time usage on large compilation units. It is not enabled by
8067 default at any optimization level.
8068
8069 @item -fipa-profile
8070 @opindex fipa-profile
8071 Perform interprocedural profile propagation. The functions called only from
8072 cold functions are marked as cold. Also functions executed once (such as
8073 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8074 functions and loop less parts of functions executed once are then optimized for
8075 size.
8076 Enabled by default at @option{-O} and higher.
8077
8078 @item -fipa-cp
8079 @opindex fipa-cp
8080 Perform interprocedural constant propagation.
8081 This optimization analyzes the program to determine when values passed
8082 to functions are constants and then optimizes accordingly.
8083 This optimization can substantially increase performance
8084 if the application has constants passed to functions.
8085 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8086
8087 @item -fipa-cp-clone
8088 @opindex fipa-cp-clone
8089 Perform function cloning to make interprocedural constant propagation stronger.
8090 When enabled, interprocedural constant propagation performs function cloning
8091 when externally visible function can be called with constant arguments.
8092 Because this optimization can create multiple copies of functions,
8093 it may significantly increase code size
8094 (see @option{--param ipcp-unit-growth=@var{value}}).
8095 This flag is enabled by default at @option{-O3}.
8096
8097 @item -fipa-bit-cp
8098 @opindex -fipa-bit-cp
8099 When enabled, perform interprocedural bitwise constant
8100 propagation. This flag is enabled by default at @option{-O2}. It
8101 requires that @option{-fipa-cp} is enabled.
8102
8103 @item -fipa-vrp
8104 @opindex -fipa-vrp
8105 When enabled, perform interprocedural propagation of value
8106 ranges. This flag is enabled by default at @option{-O2}. It requires
8107 that @option{-fipa-cp} is enabled.
8108
8109 @item -fipa-icf
8110 @opindex fipa-icf
8111 Perform Identical Code Folding for functions and read-only variables.
8112 The optimization reduces code size and may disturb unwind stacks by replacing
8113 a function by equivalent one with a different name. The optimization works
8114 more effectively with link-time optimization enabled.
8115
8116 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8117 works on different levels and thus the optimizations are not same - there are
8118 equivalences that are found only by GCC and equivalences found only by Gold.
8119
8120 This flag is enabled by default at @option{-O2} and @option{-Os}.
8121
8122 @item -fisolate-erroneous-paths-dereference
8123 @opindex fisolate-erroneous-paths-dereference
8124 Detect paths that trigger erroneous or undefined behavior due to
8125 dereferencing a null pointer. Isolate those paths from the main control
8126 flow and turn the statement with erroneous or undefined behavior into a trap.
8127 This flag is enabled by default at @option{-O2} and higher and depends on
8128 @option{-fdelete-null-pointer-checks} also being enabled.
8129
8130 @item -fisolate-erroneous-paths-attribute
8131 @opindex fisolate-erroneous-paths-attribute
8132 Detect paths that trigger erroneous or undefined behavior due a null value
8133 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8134 attribute. Isolate those paths from the main control flow and turn the
8135 statement with erroneous or undefined behavior into a trap. This is not
8136 currently enabled, but may be enabled by @option{-O2} in the future.
8137
8138 @item -ftree-sink
8139 @opindex ftree-sink
8140 Perform forward store motion on trees. This flag is
8141 enabled by default at @option{-O} and higher.
8142
8143 @item -ftree-bit-ccp
8144 @opindex ftree-bit-ccp
8145 Perform sparse conditional bit constant propagation on trees and propagate
8146 pointer alignment information.
8147 This pass only operates on local scalar variables and is enabled by default
8148 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8149
8150 @item -ftree-ccp
8151 @opindex ftree-ccp
8152 Perform sparse conditional constant propagation (CCP) on trees. This
8153 pass only operates on local scalar variables and is enabled by default
8154 at @option{-O} and higher.
8155
8156 @item -fssa-backprop
8157 @opindex fssa-backprop
8158 Propagate information about uses of a value up the definition chain
8159 in order to simplify the definitions. For example, this pass strips
8160 sign operations if the sign of a value never matters. The flag is
8161 enabled by default at @option{-O} and higher.
8162
8163 @item -fssa-phiopt
8164 @opindex fssa-phiopt
8165 Perform pattern matching on SSA PHI nodes to optimize conditional
8166 code. This pass is enabled by default at @option{-O} and higher.
8167
8168 @item -ftree-switch-conversion
8169 @opindex ftree-switch-conversion
8170 Perform conversion of simple initializations in a switch to
8171 initializations from a scalar array. This flag is enabled by default
8172 at @option{-O2} and higher.
8173
8174 @item -ftree-tail-merge
8175 @opindex ftree-tail-merge
8176 Look for identical code sequences. When found, replace one with a jump to the
8177 other. This optimization is known as tail merging or cross jumping. This flag
8178 is enabled by default at @option{-O2} and higher. The compilation time
8179 in this pass can
8180 be limited using @option{max-tail-merge-comparisons} parameter and
8181 @option{max-tail-merge-iterations} parameter.
8182
8183 @item -ftree-dce
8184 @opindex ftree-dce
8185 Perform dead code elimination (DCE) on trees. This flag is enabled by
8186 default at @option{-O} and higher.
8187
8188 @item -ftree-builtin-call-dce
8189 @opindex ftree-builtin-call-dce
8190 Perform conditional dead code elimination (DCE) for calls to built-in functions
8191 that may set @code{errno} but are otherwise side-effect free. This flag is
8192 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8193 specified.
8194
8195 @item -ftree-dominator-opts
8196 @opindex ftree-dominator-opts
8197 Perform a variety of simple scalar cleanups (constant/copy
8198 propagation, redundancy elimination, range propagation and expression
8199 simplification) based on a dominator tree traversal. This also
8200 performs jump threading (to reduce jumps to jumps). This flag is
8201 enabled by default at @option{-O} and higher.
8202
8203 @item -ftree-dse
8204 @opindex ftree-dse
8205 Perform dead store elimination (DSE) on trees. A dead store is a store into
8206 a memory location that is later overwritten by another store without
8207 any intervening loads. In this case the earlier store can be deleted. This
8208 flag is enabled by default at @option{-O} and higher.
8209
8210 @item -ftree-ch
8211 @opindex ftree-ch
8212 Perform loop header copying on trees. This is beneficial since it increases
8213 effectiveness of code motion optimizations. It also saves one jump. This flag
8214 is enabled by default at @option{-O} and higher. It is not enabled
8215 for @option{-Os}, since it usually increases code size.
8216
8217 @item -ftree-loop-optimize
8218 @opindex ftree-loop-optimize
8219 Perform loop optimizations on trees. This flag is enabled by default
8220 at @option{-O} and higher.
8221
8222 @item -ftree-loop-linear
8223 @itemx -floop-interchange
8224 @itemx -floop-strip-mine
8225 @itemx -floop-block
8226 @itemx -floop-unroll-and-jam
8227 @opindex ftree-loop-linear
8228 @opindex floop-interchange
8229 @opindex floop-strip-mine
8230 @opindex floop-block
8231 @opindex floop-unroll-and-jam
8232 Perform loop nest optimizations. Same as
8233 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8234 to be configured with @option{--with-isl} to enable the Graphite loop
8235 transformation infrastructure.
8236
8237 @item -fgraphite-identity
8238 @opindex fgraphite-identity
8239 Enable the identity transformation for graphite. For every SCoP we generate
8240 the polyhedral representation and transform it back to gimple. Using
8241 @option{-fgraphite-identity} we can check the costs or benefits of the
8242 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8243 are also performed by the code generator isl, like index splitting and
8244 dead code elimination in loops.
8245
8246 @item -floop-nest-optimize
8247 @opindex floop-nest-optimize
8248 Enable the isl based loop nest optimizer. This is a generic loop nest
8249 optimizer based on the Pluto optimization algorithms. It calculates a loop
8250 structure optimized for data-locality and parallelism. This option
8251 is experimental.
8252
8253 @item -floop-parallelize-all
8254 @opindex floop-parallelize-all
8255 Use the Graphite data dependence analysis to identify loops that can
8256 be parallelized. Parallelize all the loops that can be analyzed to
8257 not contain loop carried dependences without checking that it is
8258 profitable to parallelize the loops.
8259
8260 @item -ftree-coalesce-vars
8261 @opindex ftree-coalesce-vars
8262 While transforming the program out of the SSA representation, attempt to
8263 reduce copying by coalescing versions of different user-defined
8264 variables, instead of just compiler temporaries. This may severely
8265 limit the ability to debug an optimized program compiled with
8266 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8267 prevents SSA coalescing of user variables. This option is enabled by
8268 default if optimization is enabled, and it does very little otherwise.
8269
8270 @item -ftree-loop-if-convert
8271 @opindex ftree-loop-if-convert
8272 Attempt to transform conditional jumps in the innermost loops to
8273 branch-less equivalents. The intent is to remove control-flow from
8274 the innermost loops in order to improve the ability of the
8275 vectorization pass to handle these loops. This is enabled by default
8276 if vectorization is enabled.
8277
8278 @item -ftree-loop-distribution
8279 @opindex ftree-loop-distribution
8280 Perform loop distribution. This flag can improve cache performance on
8281 big loop bodies and allow further loop optimizations, like
8282 parallelization or vectorization, to take place. For example, the loop
8283 @smallexample
8284 DO I = 1, N
8285 A(I) = B(I) + C
8286 D(I) = E(I) * F
8287 ENDDO
8288 @end smallexample
8289 is transformed to
8290 @smallexample
8291 DO I = 1, N
8292 A(I) = B(I) + C
8293 ENDDO
8294 DO I = 1, N
8295 D(I) = E(I) * F
8296 ENDDO
8297 @end smallexample
8298
8299 @item -ftree-loop-distribute-patterns
8300 @opindex ftree-loop-distribute-patterns
8301 Perform loop distribution of patterns that can be code generated with
8302 calls to a library. This flag is enabled by default at @option{-O3}.
8303
8304 This pass distributes the initialization loops and generates a call to
8305 memset zero. For example, the loop
8306 @smallexample
8307 DO I = 1, N
8308 A(I) = 0
8309 B(I) = A(I) + I
8310 ENDDO
8311 @end smallexample
8312 is transformed to
8313 @smallexample
8314 DO I = 1, N
8315 A(I) = 0
8316 ENDDO
8317 DO I = 1, N
8318 B(I) = A(I) + I
8319 ENDDO
8320 @end smallexample
8321 and the initialization loop is transformed into a call to memset zero.
8322
8323 @item -ftree-loop-im
8324 @opindex ftree-loop-im
8325 Perform loop invariant motion on trees. This pass moves only invariants that
8326 are hard to handle at RTL level (function calls, operations that expand to
8327 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8328 operands of conditions that are invariant out of the loop, so that we can use
8329 just trivial invariantness analysis in loop unswitching. The pass also includes
8330 store motion.
8331
8332 @item -ftree-loop-ivcanon
8333 @opindex ftree-loop-ivcanon
8334 Create a canonical counter for number of iterations in loops for which
8335 determining number of iterations requires complicated analysis. Later
8336 optimizations then may determine the number easily. Useful especially
8337 in connection with unrolling.
8338
8339 @item -fivopts
8340 @opindex fivopts
8341 Perform induction variable optimizations (strength reduction, induction
8342 variable merging and induction variable elimination) on trees.
8343
8344 @item -ftree-parallelize-loops=n
8345 @opindex ftree-parallelize-loops
8346 Parallelize loops, i.e., split their iteration space to run in n threads.
8347 This is only possible for loops whose iterations are independent
8348 and can be arbitrarily reordered. The optimization is only
8349 profitable on multiprocessor machines, for loops that are CPU-intensive,
8350 rather than constrained e.g.@: by memory bandwidth. This option
8351 implies @option{-pthread}, and thus is only supported on targets
8352 that have support for @option{-pthread}.
8353
8354 @item -ftree-pta
8355 @opindex ftree-pta
8356 Perform function-local points-to analysis on trees. This flag is
8357 enabled by default at @option{-O} and higher.
8358
8359 @item -ftree-sra
8360 @opindex ftree-sra
8361 Perform scalar replacement of aggregates. This pass replaces structure
8362 references with scalars to prevent committing structures to memory too
8363 early. This flag is enabled by default at @option{-O} and higher.
8364
8365 @item -fstore-merging
8366 @opindex fstore-merging
8367 Perform merging of narrow stores to consecutive memory addresses. This pass
8368 merges contiguous stores of immediate values narrower than a word into fewer
8369 wider stores to reduce the number of instructions. This is enabled by default
8370 at @option{-O2} and higher as well as @option{-Os}.
8371
8372 @item -ftree-ter
8373 @opindex ftree-ter
8374 Perform temporary expression replacement during the SSA->normal phase. Single
8375 use/single def temporaries are replaced at their use location with their
8376 defining expression. This results in non-GIMPLE code, but gives the expanders
8377 much more complex trees to work on resulting in better RTL generation. This is
8378 enabled by default at @option{-O} and higher.
8379
8380 @item -ftree-slsr
8381 @opindex ftree-slsr
8382 Perform straight-line strength reduction on trees. This recognizes related
8383 expressions involving multiplications and replaces them by less expensive
8384 calculations when possible. This is enabled by default at @option{-O} and
8385 higher.
8386
8387 @item -ftree-vectorize
8388 @opindex ftree-vectorize
8389 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8390 and @option{-ftree-slp-vectorize} if not explicitly specified.
8391
8392 @item -ftree-loop-vectorize
8393 @opindex ftree-loop-vectorize
8394 Perform loop vectorization on trees. This flag is enabled by default at
8395 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8396
8397 @item -ftree-slp-vectorize
8398 @opindex ftree-slp-vectorize
8399 Perform basic block vectorization on trees. This flag is enabled by default at
8400 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8401
8402 @item -fvect-cost-model=@var{model}
8403 @opindex fvect-cost-model
8404 Alter the cost model used for vectorization. The @var{model} argument
8405 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
8406 With the @samp{unlimited} model the vectorized code-path is assumed
8407 to be profitable while with the @samp{dynamic} model a runtime check
8408 guards the vectorized code-path to enable it only for iteration
8409 counts that will likely execute faster than when executing the original
8410 scalar loop. The @samp{cheap} model disables vectorization of
8411 loops where doing so would be cost prohibitive for example due to
8412 required runtime checks for data dependence or alignment but otherwise
8413 is equal to the @samp{dynamic} model.
8414 The default cost model depends on other optimization flags and is
8415 either @samp{dynamic} or @samp{cheap}.
8416
8417 @item -fsimd-cost-model=@var{model}
8418 @opindex fsimd-cost-model
8419 Alter the cost model used for vectorization of loops marked with the OpenMP
8420 or Cilk Plus simd directive. The @var{model} argument should be one of
8421 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
8422 have the same meaning as described in @option{-fvect-cost-model} and by
8423 default a cost model defined with @option{-fvect-cost-model} is used.
8424
8425 @item -ftree-vrp
8426 @opindex ftree-vrp
8427 Perform Value Range Propagation on trees. This is similar to the
8428 constant propagation pass, but instead of values, ranges of values are
8429 propagated. This allows the optimizers to remove unnecessary range
8430 checks like array bound checks and null pointer checks. This is
8431 enabled by default at @option{-O2} and higher. Null pointer check
8432 elimination is only done if @option{-fdelete-null-pointer-checks} is
8433 enabled.
8434
8435 @item -fsplit-paths
8436 @opindex fsplit-paths
8437 Split paths leading to loop backedges. This can improve dead code
8438 elimination and common subexpression elimination. This is enabled by
8439 default at @option{-O2} and above.
8440
8441 @item -fsplit-ivs-in-unroller
8442 @opindex fsplit-ivs-in-unroller
8443 Enables expression of values of induction variables in later iterations
8444 of the unrolled loop using the value in the first iteration. This breaks
8445 long dependency chains, thus improving efficiency of the scheduling passes.
8446
8447 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8448 same effect. However, that is not reliable in cases where the loop body
8449 is more complicated than a single basic block. It also does not work at all
8450 on some architectures due to restrictions in the CSE pass.
8451
8452 This optimization is enabled by default.
8453
8454 @item -fvariable-expansion-in-unroller
8455 @opindex fvariable-expansion-in-unroller
8456 With this option, the compiler creates multiple copies of some
8457 local variables when unrolling a loop, which can result in superior code.
8458
8459 @item -fpartial-inlining
8460 @opindex fpartial-inlining
8461 Inline parts of functions. This option has any effect only
8462 when inlining itself is turned on by the @option{-finline-functions}
8463 or @option{-finline-small-functions} options.
8464
8465 Enabled at level @option{-O2}.
8466
8467 @item -fpredictive-commoning
8468 @opindex fpredictive-commoning
8469 Perform predictive commoning optimization, i.e., reusing computations
8470 (especially memory loads and stores) performed in previous
8471 iterations of loops.
8472
8473 This option is enabled at level @option{-O3}.
8474
8475 @item -fprefetch-loop-arrays
8476 @opindex fprefetch-loop-arrays
8477 If supported by the target machine, generate instructions to prefetch
8478 memory to improve the performance of loops that access large arrays.
8479
8480 This option may generate better or worse code; results are highly
8481 dependent on the structure of loops within the source code.
8482
8483 Disabled at level @option{-Os}.
8484
8485 @item -fno-printf-return-value
8486 @opindex fno-printf-return-value
8487 Do not substitute constants for known return value of formatted output
8488 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
8489 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
8490 transformation allows GCC to optimize or even eliminate branches based
8491 on the known return value of these functions called with arguments that
8492 are either constant, or whose values are known to be in a range that
8493 makes determining the exact return value possible. For example, when
8494 @option{-fprintf-return-value} is in effect, both the branch and the
8495 body of the @code{if} statement (but not the call to @code{snprint})
8496 can be optimized away when @code{i} is a 32-bit or smaller integer
8497 because the return value is guaranteed to be at most 8.
8498
8499 @smallexample
8500 char buf[9];
8501 if (snprintf (buf, "%08x", i) >= sizeof buf)
8502 @dots{}
8503 @end smallexample
8504
8505 The @option{-fprintf-return-value} option relies on other optimizations
8506 and yields best results with @option{-O2}. It works in tandem with the
8507 @option{-Wformat-overflow} and @option{-Wformat-truncation} options.
8508 The @option{-fprintf-return-value} option is enabled by default.
8509
8510 @item -fno-peephole
8511 @itemx -fno-peephole2
8512 @opindex fno-peephole
8513 @opindex fno-peephole2
8514 Disable any machine-specific peephole optimizations. The difference
8515 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
8516 are implemented in the compiler; some targets use one, some use the
8517 other, a few use both.
8518
8519 @option{-fpeephole} is enabled by default.
8520 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8521
8522 @item -fno-guess-branch-probability
8523 @opindex fno-guess-branch-probability
8524 Do not guess branch probabilities using heuristics.
8525
8526 GCC uses heuristics to guess branch probabilities if they are
8527 not provided by profiling feedback (@option{-fprofile-arcs}). These
8528 heuristics are based on the control flow graph. If some branch probabilities
8529 are specified by @code{__builtin_expect}, then the heuristics are
8530 used to guess branch probabilities for the rest of the control flow graph,
8531 taking the @code{__builtin_expect} info into account. The interactions
8532 between the heuristics and @code{__builtin_expect} can be complex, and in
8533 some cases, it may be useful to disable the heuristics so that the effects
8534 of @code{__builtin_expect} are easier to understand.
8535
8536 The default is @option{-fguess-branch-probability} at levels
8537 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8538
8539 @item -freorder-blocks
8540 @opindex freorder-blocks
8541 Reorder basic blocks in the compiled function in order to reduce number of
8542 taken branches and improve code locality.
8543
8544 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8545
8546 @item -freorder-blocks-algorithm=@var{algorithm}
8547 @opindex freorder-blocks-algorithm
8548 Use the specified algorithm for basic block reordering. The
8549 @var{algorithm} argument can be @samp{simple}, which does not increase
8550 code size (except sometimes due to secondary effects like alignment),
8551 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
8552 put all often executed code together, minimizing the number of branches
8553 executed by making extra copies of code.
8554
8555 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
8556 @samp{stc} at levels @option{-O2}, @option{-O3}.
8557
8558 @item -freorder-blocks-and-partition
8559 @opindex freorder-blocks-and-partition
8560 In addition to reordering basic blocks in the compiled function, in order
8561 to reduce number of taken branches, partitions hot and cold basic blocks
8562 into separate sections of the assembly and @file{.o} files, to improve
8563 paging and cache locality performance.
8564
8565 This optimization is automatically turned off in the presence of
8566 exception handling, for linkonce sections, for functions with a user-defined
8567 section attribute and on any architecture that does not support named
8568 sections.
8569
8570 Enabled for x86 at levels @option{-O2}, @option{-O3}.
8571
8572 @item -freorder-functions
8573 @opindex freorder-functions
8574 Reorder functions in the object file in order to
8575 improve code locality. This is implemented by using special
8576 subsections @code{.text.hot} for most frequently executed functions and
8577 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
8578 the linker so object file format must support named sections and linker must
8579 place them in a reasonable way.
8580
8581 Also profile feedback must be available to make this option effective. See
8582 @option{-fprofile-arcs} for details.
8583
8584 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8585
8586 @item -fstrict-aliasing
8587 @opindex fstrict-aliasing
8588 Allow the compiler to assume the strictest aliasing rules applicable to
8589 the language being compiled. For C (and C++), this activates
8590 optimizations based on the type of expressions. In particular, an
8591 object of one type is assumed never to reside at the same address as an
8592 object of a different type, unless the types are almost the same. For
8593 example, an @code{unsigned int} can alias an @code{int}, but not a
8594 @code{void*} or a @code{double}. A character type may alias any other
8595 type.
8596
8597 @anchor{Type-punning}Pay special attention to code like this:
8598 @smallexample
8599 union a_union @{
8600 int i;
8601 double d;
8602 @};
8603
8604 int f() @{
8605 union a_union t;
8606 t.d = 3.0;
8607 return t.i;
8608 @}
8609 @end smallexample
8610 The practice of reading from a different union member than the one most
8611 recently written to (called ``type-punning'') is common. Even with
8612 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
8613 is accessed through the union type. So, the code above works as
8614 expected. @xref{Structures unions enumerations and bit-fields
8615 implementation}. However, this code might not:
8616 @smallexample
8617 int f() @{
8618 union a_union t;
8619 int* ip;
8620 t.d = 3.0;
8621 ip = &t.i;
8622 return *ip;
8623 @}
8624 @end smallexample
8625
8626 Similarly, access by taking the address, casting the resulting pointer
8627 and dereferencing the result has undefined behavior, even if the cast
8628 uses a union type, e.g.:
8629 @smallexample
8630 int f() @{
8631 double d = 3.0;
8632 return ((union a_union *) &d)->i;
8633 @}
8634 @end smallexample
8635
8636 The @option{-fstrict-aliasing} option is enabled at levels
8637 @option{-O2}, @option{-O3}, @option{-Os}.
8638
8639 @item -fstrict-overflow
8640 @opindex fstrict-overflow
8641 Allow the compiler to assume strict signed overflow rules, depending
8642 on the language being compiled. For C (and C++) this means that
8643 overflow when doing arithmetic with signed numbers is undefined, which
8644 means that the compiler may assume that it does not happen. This
8645 permits various optimizations. For example, the compiler assumes
8646 that an expression like @code{i + 10 > i} is always true for
8647 signed @code{i}. This assumption is only valid if signed overflow is
8648 undefined, as the expression is false if @code{i + 10} overflows when
8649 using twos complement arithmetic. When this option is in effect any
8650 attempt to determine whether an operation on signed numbers
8651 overflows must be written carefully to not actually involve overflow.
8652
8653 This option also allows the compiler to assume strict pointer
8654 semantics: given a pointer to an object, if adding an offset to that
8655 pointer does not produce a pointer to the same object, the addition is
8656 undefined. This permits the compiler to conclude that @code{p + u >
8657 p} is always true for a pointer @code{p} and unsigned integer
8658 @code{u}. This assumption is only valid because pointer wraparound is
8659 undefined, as the expression is false if @code{p + u} overflows using
8660 twos complement arithmetic.
8661
8662 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
8663 that integer signed overflow is fully defined: it wraps. When
8664 @option{-fwrapv} is used, there is no difference between
8665 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
8666 integers. With @option{-fwrapv} certain types of overflow are
8667 permitted. For example, if the compiler gets an overflow when doing
8668 arithmetic on constants, the overflowed value can still be used with
8669 @option{-fwrapv}, but not otherwise.
8670
8671 The @option{-fstrict-overflow} option is enabled at levels
8672 @option{-O2}, @option{-O3}, @option{-Os}.
8673
8674 @item -falign-functions
8675 @itemx -falign-functions=@var{n}
8676 @opindex falign-functions
8677 Align the start of functions to the next power-of-two greater than
8678 @var{n}, skipping up to @var{n} bytes. For instance,
8679 @option{-falign-functions=32} aligns functions to the next 32-byte
8680 boundary, but @option{-falign-functions=24} aligns to the next
8681 32-byte boundary only if this can be done by skipping 23 bytes or less.
8682
8683 @option{-fno-align-functions} and @option{-falign-functions=1} are
8684 equivalent and mean that functions are not aligned.
8685
8686 Some assemblers only support this flag when @var{n} is a power of two;
8687 in that case, it is rounded up.
8688
8689 If @var{n} is not specified or is zero, use a machine-dependent default.
8690
8691 Enabled at levels @option{-O2}, @option{-O3}.
8692
8693 @item -flimit-function-alignment
8694 If this option is enabled, the compiler tries to avoid unnecessarily
8695 overaligning functions. It attempts to instruct the assembler to align
8696 by the amount specified by @option{-falign-functions}, but not to
8697 skip more bytes than the size of the function.
8698
8699 @item -falign-labels
8700 @itemx -falign-labels=@var{n}
8701 @opindex falign-labels
8702 Align all branch targets to a power-of-two boundary, skipping up to
8703 @var{n} bytes like @option{-falign-functions}. This option can easily
8704 make code slower, because it must insert dummy operations for when the
8705 branch target is reached in the usual flow of the code.
8706
8707 @option{-fno-align-labels} and @option{-falign-labels=1} are
8708 equivalent and mean that labels are not aligned.
8709
8710 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8711 are greater than this value, then their values are used instead.
8712
8713 If @var{n} is not specified or is zero, use a machine-dependent default
8714 which is very likely to be @samp{1}, meaning no alignment.
8715
8716 Enabled at levels @option{-O2}, @option{-O3}.
8717
8718 @item -falign-loops
8719 @itemx -falign-loops=@var{n}
8720 @opindex falign-loops
8721 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8722 like @option{-falign-functions}. If the loops are
8723 executed many times, this makes up for any execution of the dummy
8724 operations.
8725
8726 @option{-fno-align-loops} and @option{-falign-loops=1} are
8727 equivalent and mean that loops are not aligned.
8728
8729 If @var{n} is not specified or is zero, use a machine-dependent default.
8730
8731 Enabled at levels @option{-O2}, @option{-O3}.
8732
8733 @item -falign-jumps
8734 @itemx -falign-jumps=@var{n}
8735 @opindex falign-jumps
8736 Align branch targets to a power-of-two boundary, for branch targets
8737 where the targets can only be reached by jumping, skipping up to @var{n}
8738 bytes like @option{-falign-functions}. In this case, no dummy operations
8739 need be executed.
8740
8741 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
8742 equivalent and mean that loops are not aligned.
8743
8744 If @var{n} is not specified or is zero, use a machine-dependent default.
8745
8746 Enabled at levels @option{-O2}, @option{-O3}.
8747
8748 @item -funit-at-a-time
8749 @opindex funit-at-a-time
8750 This option is left for compatibility reasons. @option{-funit-at-a-time}
8751 has no effect, while @option{-fno-unit-at-a-time} implies
8752 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8753
8754 Enabled by default.
8755
8756 @item -fno-toplevel-reorder
8757 @opindex fno-toplevel-reorder
8758 Do not reorder top-level functions, variables, and @code{asm}
8759 statements. Output them in the same order that they appear in the
8760 input file. When this option is used, unreferenced static variables
8761 are not removed. This option is intended to support existing code
8762 that relies on a particular ordering. For new code, it is better to
8763 use attributes when possible.
8764
8765 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8766 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8767 targets.
8768
8769 @item -fweb
8770 @opindex fweb
8771 Constructs webs as commonly used for register allocation purposes and assign
8772 each web individual pseudo register. This allows the register allocation pass
8773 to operate on pseudos directly, but also strengthens several other optimization
8774 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8775 however, make debugging impossible, since variables no longer stay in a
8776 ``home register''.
8777
8778 Enabled by default with @option{-funroll-loops}.
8779
8780 @item -fwhole-program
8781 @opindex fwhole-program
8782 Assume that the current compilation unit represents the whole program being
8783 compiled. All public functions and variables with the exception of @code{main}
8784 and those merged by attribute @code{externally_visible} become static functions
8785 and in effect are optimized more aggressively by interprocedural optimizers.
8786
8787 This option should not be used in combination with @option{-flto}.
8788 Instead relying on a linker plugin should provide safer and more precise
8789 information.
8790
8791 @item -flto[=@var{n}]
8792 @opindex flto
8793 This option runs the standard link-time optimizer. When invoked
8794 with source code, it generates GIMPLE (one of GCC's internal
8795 representations) and writes it to special ELF sections in the object
8796 file. When the object files are linked together, all the function
8797 bodies are read from these ELF sections and instantiated as if they
8798 had been part of the same translation unit.
8799
8800 To use the link-time optimizer, @option{-flto} and optimization
8801 options should be specified at compile time and during the final link.
8802 It is recommended that you compile all the files participating in the
8803 same link with the same options and also specify those options at
8804 link time.
8805 For example:
8806
8807 @smallexample
8808 gcc -c -O2 -flto foo.c
8809 gcc -c -O2 -flto bar.c
8810 gcc -o myprog -flto -O2 foo.o bar.o
8811 @end smallexample
8812
8813 The first two invocations to GCC save a bytecode representation
8814 of GIMPLE into special ELF sections inside @file{foo.o} and
8815 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8816 @file{foo.o} and @file{bar.o}, merges the two files into a single
8817 internal image, and compiles the result as usual. Since both
8818 @file{foo.o} and @file{bar.o} are merged into a single image, this
8819 causes all the interprocedural analyses and optimizations in GCC to
8820 work across the two files as if they were a single one. This means,
8821 for example, that the inliner is able to inline functions in
8822 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8823
8824 Another (simpler) way to enable link-time optimization is:
8825
8826 @smallexample
8827 gcc -o myprog -flto -O2 foo.c bar.c
8828 @end smallexample
8829
8830 The above generates bytecode for @file{foo.c} and @file{bar.c},
8831 merges them together into a single GIMPLE representation and optimizes
8832 them as usual to produce @file{myprog}.
8833
8834 The only important thing to keep in mind is that to enable link-time
8835 optimizations you need to use the GCC driver to perform the link step.
8836 GCC then automatically performs link-time optimization if any of the
8837 objects involved were compiled with the @option{-flto} command-line option.
8838 You generally
8839 should specify the optimization options to be used for link-time
8840 optimization though GCC tries to be clever at guessing an
8841 optimization level to use from the options used at compile time
8842 if you fail to specify one at link time. You can always override
8843 the automatic decision to do link-time optimization
8844 by passing @option{-fno-lto} to the link command.
8845
8846 To make whole program optimization effective, it is necessary to make
8847 certain whole program assumptions. The compiler needs to know
8848 what functions and variables can be accessed by libraries and runtime
8849 outside of the link-time optimized unit. When supported by the linker,
8850 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8851 to the compiler about used and externally visible symbols. When
8852 the linker plugin is not available, @option{-fwhole-program} should be
8853 used to allow the compiler to make these assumptions, which leads
8854 to more aggressive optimization decisions.
8855
8856 When @option{-fuse-linker-plugin} is not enabled, when a file is
8857 compiled with @option{-flto}, the generated object file is larger than
8858 a regular object file because it contains GIMPLE bytecodes and the usual
8859 final code (see @option{-ffat-lto-objects}. This means that
8860 object files with LTO information can be linked as normal object
8861 files; if @option{-fno-lto} is passed to the linker, no
8862 interprocedural optimizations are applied. Note that when
8863 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
8864 but you cannot perform a regular, non-LTO link on them.
8865
8866 Additionally, the optimization flags used to compile individual files
8867 are not necessarily related to those used at link time. For instance,
8868
8869 @smallexample
8870 gcc -c -O0 -ffat-lto-objects -flto foo.c
8871 gcc -c -O0 -ffat-lto-objects -flto bar.c
8872 gcc -o myprog -O3 foo.o bar.o
8873 @end smallexample
8874
8875 This produces individual object files with unoptimized assembler
8876 code, but the resulting binary @file{myprog} is optimized at
8877 @option{-O3}. If, instead, the final binary is generated with
8878 @option{-fno-lto}, then @file{myprog} is not optimized.
8879
8880 When producing the final binary, GCC only
8881 applies link-time optimizations to those files that contain bytecode.
8882 Therefore, you can mix and match object files and libraries with
8883 GIMPLE bytecodes and final object code. GCC automatically selects
8884 which files to optimize in LTO mode and which files to link without
8885 further processing.
8886
8887 There are some code generation flags preserved by GCC when
8888 generating bytecodes, as they need to be used during the final link
8889 stage. Generally options specified at link time override those
8890 specified at compile time.
8891
8892 If you do not specify an optimization level option @option{-O} at
8893 link time, then GCC uses the highest optimization level
8894 used when compiling the object files.
8895
8896 Currently, the following options and their settings are taken from
8897 the first object file that explicitly specifies them:
8898 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8899 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8900 and all the @option{-m} target flags.
8901
8902 Certain ABI-changing flags are required to match in all compilation units,
8903 and trying to override this at link time with a conflicting value
8904 is ignored. This includes options such as @option{-freg-struct-return}
8905 and @option{-fpcc-struct-return}.
8906
8907 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8908 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8909 are passed through to the link stage and merged conservatively for
8910 conflicting translation units. Specifically
8911 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8912 precedence; and for example @option{-ffp-contract=off} takes precedence
8913 over @option{-ffp-contract=fast}. You can override them at link time.
8914
8915 If LTO encounters objects with C linkage declared with incompatible
8916 types in separate translation units to be linked together (undefined
8917 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8918 issued. The behavior is still undefined at run time. Similar
8919 diagnostics may be raised for other languages.
8920
8921 Another feature of LTO is that it is possible to apply interprocedural
8922 optimizations on files written in different languages:
8923
8924 @smallexample
8925 gcc -c -flto foo.c
8926 g++ -c -flto bar.cc
8927 gfortran -c -flto baz.f90
8928 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8929 @end smallexample
8930
8931 Notice that the final link is done with @command{g++} to get the C++
8932 runtime libraries and @option{-lgfortran} is added to get the Fortran
8933 runtime libraries. In general, when mixing languages in LTO mode, you
8934 should use the same link command options as when mixing languages in a
8935 regular (non-LTO) compilation.
8936
8937 If object files containing GIMPLE bytecode are stored in a library archive, say
8938 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8939 are using a linker with plugin support. To create static libraries suitable
8940 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8941 and @command{ranlib};
8942 to show the symbols of object files with GIMPLE bytecode, use
8943 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8944 and @command{nm} have been compiled with plugin support. At link time, use the the
8945 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8946 the LTO optimization process:
8947
8948 @smallexample
8949 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8950 @end smallexample
8951
8952 With the linker plugin enabled, the linker extracts the needed
8953 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8954 to make them part of the aggregated GIMPLE image to be optimized.
8955
8956 If you are not using a linker with plugin support and/or do not
8957 enable the linker plugin, then the objects inside @file{libfoo.a}
8958 are extracted and linked as usual, but they do not participate
8959 in the LTO optimization process. In order to make a static library suitable
8960 for both LTO optimization and usual linkage, compile its object files with
8961 @option{-flto} @option{-ffat-lto-objects}.
8962
8963 Link-time optimizations do not require the presence of the whole program to
8964 operate. If the program does not require any symbols to be exported, it is
8965 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8966 the interprocedural optimizers to use more aggressive assumptions which may
8967 lead to improved optimization opportunities.
8968 Use of @option{-fwhole-program} is not needed when linker plugin is
8969 active (see @option{-fuse-linker-plugin}).
8970
8971 The current implementation of LTO makes no
8972 attempt to generate bytecode that is portable between different
8973 types of hosts. The bytecode files are versioned and there is a
8974 strict version check, so bytecode files generated in one version of
8975 GCC do not work with an older or newer version of GCC.
8976
8977 Link-time optimization does not work well with generation of debugging
8978 information. Combining @option{-flto} with
8979 @option{-g} is currently experimental and expected to produce unexpected
8980 results.
8981
8982 If you specify the optional @var{n}, the optimization and code
8983 generation done at link time is executed in parallel using @var{n}
8984 parallel jobs by utilizing an installed @command{make} program. The
8985 environment variable @env{MAKE} may be used to override the program
8986 used. The default value for @var{n} is 1.
8987
8988 You can also specify @option{-flto=jobserver} to use GNU make's
8989 job server mode to determine the number of parallel jobs. This
8990 is useful when the Makefile calling GCC is already executing in parallel.
8991 You must prepend a @samp{+} to the command recipe in the parent Makefile
8992 for this to work. This option likely only works if @env{MAKE} is
8993 GNU make.
8994
8995 @item -flto-partition=@var{alg}
8996 @opindex flto-partition
8997 Specify the partitioning algorithm used by the link-time optimizer.
8998 The value is either @samp{1to1} to specify a partitioning mirroring
8999 the original source files or @samp{balanced} to specify partitioning
9000 into equally sized chunks (whenever possible) or @samp{max} to create
9001 new partition for every symbol where possible. Specifying @samp{none}
9002 as an algorithm disables partitioning and streaming completely.
9003 The default value is @samp{balanced}. While @samp{1to1} can be used
9004 as an workaround for various code ordering issues, the @samp{max}
9005 partitioning is intended for internal testing only.
9006 The value @samp{one} specifies that exactly one partition should be
9007 used while the value @samp{none} bypasses partitioning and executes
9008 the link-time optimization step directly from the WPA phase.
9009
9010 @item -flto-odr-type-merging
9011 @opindex flto-odr-type-merging
9012 Enable streaming of mangled types names of C++ types and their unification
9013 at link time. This increases size of LTO object files, but enables
9014 diagnostics about One Definition Rule violations.
9015
9016 @item -flto-compression-level=@var{n}
9017 @opindex flto-compression-level
9018 This option specifies the level of compression used for intermediate
9019 language written to LTO object files, and is only meaningful in
9020 conjunction with LTO mode (@option{-flto}). Valid
9021 values are 0 (no compression) to 9 (maximum compression). Values
9022 outside this range are clamped to either 0 or 9. If the option is not
9023 given, a default balanced compression setting is used.
9024
9025 @item -fuse-linker-plugin
9026 @opindex fuse-linker-plugin
9027 Enables the use of a linker plugin during link-time optimization. This
9028 option relies on plugin support in the linker, which is available in gold
9029 or in GNU ld 2.21 or newer.
9030
9031 This option enables the extraction of object files with GIMPLE bytecode out
9032 of library archives. This improves the quality of optimization by exposing
9033 more code to the link-time optimizer. This information specifies what
9034 symbols can be accessed externally (by non-LTO object or during dynamic
9035 linking). Resulting code quality improvements on binaries (and shared
9036 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9037 See @option{-flto} for a description of the effect of this flag and how to
9038 use it.
9039
9040 This option is enabled by default when LTO support in GCC is enabled
9041 and GCC was configured for use with
9042 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9043
9044 @item -ffat-lto-objects
9045 @opindex ffat-lto-objects
9046 Fat LTO objects are object files that contain both the intermediate language
9047 and the object code. This makes them usable for both LTO linking and normal
9048 linking. This option is effective only when compiling with @option{-flto}
9049 and is ignored at link time.
9050
9051 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9052 requires the complete toolchain to be aware of LTO. It requires a linker with
9053 linker plugin support for basic functionality. Additionally,
9054 @command{nm}, @command{ar} and @command{ranlib}
9055 need to support linker plugins to allow a full-featured build environment
9056 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9057 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9058 to these tools. With non fat LTO makefiles need to be modified to use them.
9059
9060 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9061 support.
9062
9063 @item -fcompare-elim
9064 @opindex fcompare-elim
9065 After register allocation and post-register allocation instruction splitting,
9066 identify arithmetic instructions that compute processor flags similar to a
9067 comparison operation based on that arithmetic. If possible, eliminate the
9068 explicit comparison operation.
9069
9070 This pass only applies to certain targets that cannot explicitly represent
9071 the comparison operation before register allocation is complete.
9072
9073 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9074
9075 @item -fcprop-registers
9076 @opindex fcprop-registers
9077 After register allocation and post-register allocation instruction splitting,
9078 perform a copy-propagation pass to try to reduce scheduling dependencies
9079 and occasionally eliminate the copy.
9080
9081 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9082
9083 @item -fprofile-correction
9084 @opindex fprofile-correction
9085 Profiles collected using an instrumented binary for multi-threaded programs may
9086 be inconsistent due to missed counter updates. When this option is specified,
9087 GCC uses heuristics to correct or smooth out such inconsistencies. By
9088 default, GCC emits an error message when an inconsistent profile is detected.
9089
9090 @item -fprofile-use
9091 @itemx -fprofile-use=@var{path}
9092 @opindex fprofile-use
9093 Enable profile feedback-directed optimizations,
9094 and the following optimizations
9095 which are generally profitable only with profile feedback available:
9096 @option{-fbranch-probabilities}, @option{-fvpt},
9097 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9098 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9099
9100 Before you can use this option, you must first generate profiling information.
9101 @xref{Instrumentation Options}, for information about the
9102 @option{-fprofile-generate} option.
9103
9104 By default, GCC emits an error message if the feedback profiles do not
9105 match the source code. This error can be turned into a warning by using
9106 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9107 code.
9108
9109 If @var{path} is specified, GCC looks at the @var{path} to find
9110 the profile feedback data files. See @option{-fprofile-dir}.
9111
9112 @item -fauto-profile
9113 @itemx -fauto-profile=@var{path}
9114 @opindex fauto-profile
9115 Enable sampling-based feedback-directed optimizations,
9116 and the following optimizations
9117 which are generally profitable only with profile feedback available:
9118 @option{-fbranch-probabilities}, @option{-fvpt},
9119 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9120 @option{-ftree-vectorize},
9121 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9122 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9123 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9124
9125 @var{path} is the name of a file containing AutoFDO profile information.
9126 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9127
9128 Producing an AutoFDO profile data file requires running your program
9129 with the @command{perf} utility on a supported GNU/Linux target system.
9130 For more information, see @uref{https://perf.wiki.kernel.org/}.
9131
9132 E.g.
9133 @smallexample
9134 perf record -e br_inst_retired:near_taken -b -o perf.data \
9135 -- your_program
9136 @end smallexample
9137
9138 Then use the @command{create_gcov} tool to convert the raw profile data
9139 to a format that can be used by GCC.@ You must also supply the
9140 unstripped binary for your program to this tool.
9141 See @uref{https://github.com/google/autofdo}.
9142
9143 E.g.
9144 @smallexample
9145 create_gcov --binary=your_program.unstripped --profile=perf.data \
9146 --gcov=profile.afdo
9147 @end smallexample
9148 @end table
9149
9150 The following options control compiler behavior regarding floating-point
9151 arithmetic. These options trade off between speed and
9152 correctness. All must be specifically enabled.
9153
9154 @table @gcctabopt
9155 @item -ffloat-store
9156 @opindex ffloat-store
9157 Do not store floating-point variables in registers, and inhibit other
9158 options that might change whether a floating-point value is taken from a
9159 register or memory.
9160
9161 @cindex floating-point precision
9162 This option prevents undesirable excess precision on machines such as
9163 the 68000 where the floating registers (of the 68881) keep more
9164 precision than a @code{double} is supposed to have. Similarly for the
9165 x86 architecture. For most programs, the excess precision does only
9166 good, but a few programs rely on the precise definition of IEEE floating
9167 point. Use @option{-ffloat-store} for such programs, after modifying
9168 them to store all pertinent intermediate computations into variables.
9169
9170 @item -fexcess-precision=@var{style}
9171 @opindex fexcess-precision
9172 This option allows further control over excess precision on machines
9173 where floating-point operations occur in a format with more precision or
9174 range than the IEEE standard and interchange floating-point types. By
9175 default, @option{-fexcess-precision=fast} is in effect; this means that
9176 operations may be carried out in a wider precision than the types specified
9177 in the source if that would result in faster code, and it is unpredictable
9178 when rounding to the types specified in the source code takes place.
9179 When compiling C, if @option{-fexcess-precision=standard} is specified then
9180 excess precision follows the rules specified in ISO C99; in particular,
9181 both casts and assignments cause values to be rounded to their
9182 semantic types (whereas @option{-ffloat-store} only affects
9183 assignments). This option is enabled by default for C if a strict
9184 conformance option such as @option{-std=c99} is used.
9185 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
9186 regardless of whether a strict conformance option is used.
9187
9188 @opindex mfpmath
9189 @option{-fexcess-precision=standard} is not implemented for languages
9190 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
9191 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9192 semantics apply without excess precision, and in the latter, rounding
9193 is unpredictable.
9194
9195 @item -ffast-math
9196 @opindex ffast-math
9197 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9198 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9199 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
9200 @option{-fexcess-precision=fast}.
9201
9202 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9203
9204 This option is not turned on by any @option{-O} option besides
9205 @option{-Ofast} since it can result in incorrect output for programs
9206 that depend on an exact implementation of IEEE or ISO rules/specifications
9207 for math functions. It may, however, yield faster code for programs
9208 that do not require the guarantees of these specifications.
9209
9210 @item -fno-math-errno
9211 @opindex fno-math-errno
9212 Do not set @code{errno} after calling math functions that are executed
9213 with a single instruction, e.g., @code{sqrt}. A program that relies on
9214 IEEE exceptions for math error handling may want to use this flag
9215 for speed while maintaining IEEE arithmetic compatibility.
9216
9217 This option is not turned on by any @option{-O} option since
9218 it can result in incorrect output for programs that depend on
9219 an exact implementation of IEEE or ISO rules/specifications for
9220 math functions. It may, however, yield faster code for programs
9221 that do not require the guarantees of these specifications.
9222
9223 The default is @option{-fmath-errno}.
9224
9225 On Darwin systems, the math library never sets @code{errno}. There is
9226 therefore no reason for the compiler to consider the possibility that
9227 it might, and @option{-fno-math-errno} is the default.
9228
9229 @item -funsafe-math-optimizations
9230 @opindex funsafe-math-optimizations
9231
9232 Allow optimizations for floating-point arithmetic that (a) assume
9233 that arguments and results are valid and (b) may violate IEEE or
9234 ANSI standards. When used at link time, it may include libraries
9235 or startup files that change the default FPU control word or other
9236 similar optimizations.
9237
9238 This option is not turned on by any @option{-O} option since
9239 it can result in incorrect output for programs that depend on
9240 an exact implementation of IEEE or ISO rules/specifications for
9241 math functions. It may, however, yield faster code for programs
9242 that do not require the guarantees of these specifications.
9243 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9244 @option{-fassociative-math} and @option{-freciprocal-math}.
9245
9246 The default is @option{-fno-unsafe-math-optimizations}.
9247
9248 @item -fassociative-math
9249 @opindex fassociative-math
9250
9251 Allow re-association of operands in series of floating-point operations.
9252 This violates the ISO C and C++ language standard by possibly changing
9253 computation result. NOTE: re-ordering may change the sign of zero as
9254 well as ignore NaNs and inhibit or create underflow or overflow (and
9255 thus cannot be used on code that relies on rounding behavior like
9256 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9257 and thus may not be used when ordered comparisons are required.
9258 This option requires that both @option{-fno-signed-zeros} and
9259 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9260 much sense with @option{-frounding-math}. For Fortran the option
9261 is automatically enabled when both @option{-fno-signed-zeros} and
9262 @option{-fno-trapping-math} are in effect.
9263
9264 The default is @option{-fno-associative-math}.
9265
9266 @item -freciprocal-math
9267 @opindex freciprocal-math
9268
9269 Allow the reciprocal of a value to be used instead of dividing by
9270 the value if this enables optimizations. For example @code{x / y}
9271 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9272 is subject to common subexpression elimination. Note that this loses
9273 precision and increases the number of flops operating on the value.
9274
9275 The default is @option{-fno-reciprocal-math}.
9276
9277 @item -ffinite-math-only
9278 @opindex ffinite-math-only
9279 Allow optimizations for floating-point arithmetic that assume
9280 that arguments and results are not NaNs or +-Infs.
9281
9282 This option is not turned on by any @option{-O} option since
9283 it can result in incorrect output for programs that depend on
9284 an exact implementation of IEEE or ISO rules/specifications for
9285 math functions. It may, however, yield faster code for programs
9286 that do not require the guarantees of these specifications.
9287
9288 The default is @option{-fno-finite-math-only}.
9289
9290 @item -fno-signed-zeros
9291 @opindex fno-signed-zeros
9292 Allow optimizations for floating-point arithmetic that ignore the
9293 signedness of zero. IEEE arithmetic specifies the behavior of
9294 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9295 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9296 This option implies that the sign of a zero result isn't significant.
9297
9298 The default is @option{-fsigned-zeros}.
9299
9300 @item -fno-trapping-math
9301 @opindex fno-trapping-math
9302 Compile code assuming that floating-point operations cannot generate
9303 user-visible traps. These traps include division by zero, overflow,
9304 underflow, inexact result and invalid operation. This option requires
9305 that @option{-fno-signaling-nans} be in effect. Setting this option may
9306 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9307
9308 This option should never be turned on by any @option{-O} option since
9309 it can result in incorrect output for programs that depend on
9310 an exact implementation of IEEE or ISO rules/specifications for
9311 math functions.
9312
9313 The default is @option{-ftrapping-math}.
9314
9315 @item -frounding-math
9316 @opindex frounding-math
9317 Disable transformations and optimizations that assume default floating-point
9318 rounding behavior. This is round-to-zero for all floating point
9319 to integer conversions, and round-to-nearest for all other arithmetic
9320 truncations. This option should be specified for programs that change
9321 the FP rounding mode dynamically, or that may be executed with a
9322 non-default rounding mode. This option disables constant folding of
9323 floating-point expressions at compile time (which may be affected by
9324 rounding mode) and arithmetic transformations that are unsafe in the
9325 presence of sign-dependent rounding modes.
9326
9327 The default is @option{-fno-rounding-math}.
9328
9329 This option is experimental and does not currently guarantee to
9330 disable all GCC optimizations that are affected by rounding mode.
9331 Future versions of GCC may provide finer control of this setting
9332 using C99's @code{FENV_ACCESS} pragma. This command-line option
9333 will be used to specify the default state for @code{FENV_ACCESS}.
9334
9335 @item -fsignaling-nans
9336 @opindex fsignaling-nans
9337 Compile code assuming that IEEE signaling NaNs may generate user-visible
9338 traps during floating-point operations. Setting this option disables
9339 optimizations that may change the number of exceptions visible with
9340 signaling NaNs. This option implies @option{-ftrapping-math}.
9341
9342 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9343 be defined.
9344
9345 The default is @option{-fno-signaling-nans}.
9346
9347 This option is experimental and does not currently guarantee to
9348 disable all GCC optimizations that affect signaling NaN behavior.
9349
9350 @item -fno-fp-int-builtin-inexact
9351 @opindex fno-fp-int-builtin-inexact
9352 Do not allow the built-in functions @code{ceil}, @code{floor},
9353 @code{round} and @code{trunc}, and their @code{float} and @code{long
9354 double} variants, to generate code that raises the ``inexact''
9355 floating-point exception for noninteger arguments. ISO C99 and C11
9356 allow these functions to raise the ``inexact'' exception, but ISO/IEC
9357 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
9358 functions to do so.
9359
9360 The default is @option{-ffp-int-builtin-inexact}, allowing the
9361 exception to be raised. This option does nothing unless
9362 @option{-ftrapping-math} is in effect.
9363
9364 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
9365 generate a call to a library function then the ``inexact'' exception
9366 may be raised if the library implementation does not follow TS 18661.
9367
9368 @item -fsingle-precision-constant
9369 @opindex fsingle-precision-constant
9370 Treat floating-point constants as single precision instead of
9371 implicitly converting them to double-precision constants.
9372
9373 @item -fcx-limited-range
9374 @opindex fcx-limited-range
9375 When enabled, this option states that a range reduction step is not
9376 needed when performing complex division. Also, there is no checking
9377 whether the result of a complex multiplication or division is @code{NaN
9378 + I*NaN}, with an attempt to rescue the situation in that case. The
9379 default is @option{-fno-cx-limited-range}, but is enabled by
9380 @option{-ffast-math}.
9381
9382 This option controls the default setting of the ISO C99
9383 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9384 all languages.
9385
9386 @item -fcx-fortran-rules
9387 @opindex fcx-fortran-rules
9388 Complex multiplication and division follow Fortran rules. Range
9389 reduction is done as part of complex division, but there is no checking
9390 whether the result of a complex multiplication or division is @code{NaN
9391 + I*NaN}, with an attempt to rescue the situation in that case.
9392
9393 The default is @option{-fno-cx-fortran-rules}.
9394
9395 @end table
9396
9397 The following options control optimizations that may improve
9398 performance, but are not enabled by any @option{-O} options. This
9399 section includes experimental options that may produce broken code.
9400
9401 @table @gcctabopt
9402 @item -fbranch-probabilities
9403 @opindex fbranch-probabilities
9404 After running a program compiled with @option{-fprofile-arcs}
9405 (@pxref{Instrumentation Options}),
9406 you can compile it a second time using
9407 @option{-fbranch-probabilities}, to improve optimizations based on
9408 the number of times each branch was taken. When a program
9409 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9410 counts to a file called @file{@var{sourcename}.gcda} for each source
9411 file. The information in this data file is very dependent on the
9412 structure of the generated code, so you must use the same source code
9413 and the same optimization options for both compilations.
9414
9415 With @option{-fbranch-probabilities}, GCC puts a
9416 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9417 These can be used to improve optimization. Currently, they are only
9418 used in one place: in @file{reorg.c}, instead of guessing which path a
9419 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9420 exactly determine which path is taken more often.
9421
9422 @item -fprofile-values
9423 @opindex fprofile-values
9424 If combined with @option{-fprofile-arcs}, it adds code so that some
9425 data about values of expressions in the program is gathered.
9426
9427 With @option{-fbranch-probabilities}, it reads back the data gathered
9428 from profiling values of expressions for usage in optimizations.
9429
9430 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9431
9432 @item -fprofile-reorder-functions
9433 @opindex fprofile-reorder-functions
9434 Function reordering based on profile instrumentation collects
9435 first time of execution of a function and orders these functions
9436 in ascending order.
9437
9438 Enabled with @option{-fprofile-use}.
9439
9440 @item -fvpt
9441 @opindex fvpt
9442 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9443 to add code to gather information about values of expressions.
9444
9445 With @option{-fbranch-probabilities}, it reads back the data gathered
9446 and actually performs the optimizations based on them.
9447 Currently the optimizations include specialization of division operations
9448 using the knowledge about the value of the denominator.
9449
9450 @item -frename-registers
9451 @opindex frename-registers
9452 Attempt to avoid false dependencies in scheduled code by making use
9453 of registers left over after register allocation. This optimization
9454 most benefits processors with lots of registers. Depending on the
9455 debug information format adopted by the target, however, it can
9456 make debugging impossible, since variables no longer stay in
9457 a ``home register''.
9458
9459 Enabled by default with @option{-funroll-loops}.
9460
9461 @item -fschedule-fusion
9462 @opindex fschedule-fusion
9463 Performs a target dependent pass over the instruction stream to schedule
9464 instructions of same type together because target machine can execute them
9465 more efficiently if they are adjacent to each other in the instruction flow.
9466
9467 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9468
9469 @item -ftracer
9470 @opindex ftracer
9471 Perform tail duplication to enlarge superblock size. This transformation
9472 simplifies the control flow of the function allowing other optimizations to do
9473 a better job.
9474
9475 Enabled with @option{-fprofile-use}.
9476
9477 @item -funroll-loops
9478 @opindex funroll-loops
9479 Unroll loops whose number of iterations can be determined at compile time or
9480 upon entry to the loop. @option{-funroll-loops} implies
9481 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9482 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9483 a small constant number of iterations). This option makes code larger, and may
9484 or may not make it run faster.
9485
9486 Enabled with @option{-fprofile-use}.
9487
9488 @item -funroll-all-loops
9489 @opindex funroll-all-loops
9490 Unroll all loops, even if their number of iterations is uncertain when
9491 the loop is entered. This usually makes programs run more slowly.
9492 @option{-funroll-all-loops} implies the same options as
9493 @option{-funroll-loops}.
9494
9495 @item -fpeel-loops
9496 @opindex fpeel-loops
9497 Peels loops for which there is enough information that they do not
9498 roll much (from profile feedback or static analysis). It also turns on
9499 complete loop peeling (i.e.@: complete removal of loops with small constant
9500 number of iterations).
9501
9502 Enabled with @option{-O3} and/or @option{-fprofile-use}.
9503
9504 @item -fmove-loop-invariants
9505 @opindex fmove-loop-invariants
9506 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
9507 at level @option{-O1}
9508
9509 @item -fsplit-loops
9510 @opindex fsplit-loops
9511 Split a loop into two if it contains a condition that's always true
9512 for one side of the iteration space and false for the other.
9513
9514 @item -funswitch-loops
9515 @opindex funswitch-loops
9516 Move branches with loop invariant conditions out of the loop, with duplicates
9517 of the loop on both branches (modified according to result of the condition).
9518
9519 @item -ffunction-sections
9520 @itemx -fdata-sections
9521 @opindex ffunction-sections
9522 @opindex fdata-sections
9523 Place each function or data item into its own section in the output
9524 file if the target supports arbitrary sections. The name of the
9525 function or the name of the data item determines the section's name
9526 in the output file.
9527
9528 Use these options on systems where the linker can perform optimizations
9529 to improve locality of reference in the instruction space. Most systems
9530 using the ELF object format and SPARC processors running Solaris 2 have
9531 linkers with such optimizations. AIX may have these optimizations in
9532 the future.
9533
9534 Only use these options when there are significant benefits from doing
9535 so. When you specify these options, the assembler and linker
9536 create larger object and executable files and are also slower.
9537 You cannot use @command{gprof} on all systems if you
9538 specify this option, and you may have problems with debugging if
9539 you specify both this option and @option{-g}.
9540
9541 @item -fbranch-target-load-optimize
9542 @opindex fbranch-target-load-optimize
9543 Perform branch target register load optimization before prologue / epilogue
9544 threading.
9545 The use of target registers can typically be exposed only during reload,
9546 thus hoisting loads out of loops and doing inter-block scheduling needs
9547 a separate optimization pass.
9548
9549 @item -fbranch-target-load-optimize2
9550 @opindex fbranch-target-load-optimize2
9551 Perform branch target register load optimization after prologue / epilogue
9552 threading.
9553
9554 @item -fbtr-bb-exclusive
9555 @opindex fbtr-bb-exclusive
9556 When performing branch target register load optimization, don't reuse
9557 branch target registers within any basic block.
9558
9559 @item -fstdarg-opt
9560 @opindex fstdarg-opt
9561 Optimize the prologue of variadic argument functions with respect to usage of
9562 those arguments.
9563
9564 @item -fsection-anchors
9565 @opindex fsection-anchors
9566 Try to reduce the number of symbolic address calculations by using
9567 shared ``anchor'' symbols to address nearby objects. This transformation
9568 can help to reduce the number of GOT entries and GOT accesses on some
9569 targets.
9570
9571 For example, the implementation of the following function @code{foo}:
9572
9573 @smallexample
9574 static int a, b, c;
9575 int foo (void) @{ return a + b + c; @}
9576 @end smallexample
9577
9578 @noindent
9579 usually calculates the addresses of all three variables, but if you
9580 compile it with @option{-fsection-anchors}, it accesses the variables
9581 from a common anchor point instead. The effect is similar to the
9582 following pseudocode (which isn't valid C):
9583
9584 @smallexample
9585 int foo (void)
9586 @{
9587 register int *xr = &x;
9588 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9589 @}
9590 @end smallexample
9591
9592 Not all targets support this option.
9593
9594 @item --param @var{name}=@var{value}
9595 @opindex param
9596 In some places, GCC uses various constants to control the amount of
9597 optimization that is done. For example, GCC does not inline functions
9598 that contain more than a certain number of instructions. You can
9599 control some of these constants on the command line using the
9600 @option{--param} option.
9601
9602 The names of specific parameters, and the meaning of the values, are
9603 tied to the internals of the compiler, and are subject to change
9604 without notice in future releases.
9605
9606 In each case, the @var{value} is an integer. The allowable choices for
9607 @var{name} are:
9608
9609 @table @gcctabopt
9610 @item predictable-branch-outcome
9611 When branch is predicted to be taken with probability lower than this threshold
9612 (in percent), then it is considered well predictable. The default is 10.
9613
9614 @item max-rtl-if-conversion-insns
9615 RTL if-conversion tries to remove conditional branches around a block and
9616 replace them with conditionally executed instructions. This parameter
9617 gives the maximum number of instructions in a block which should be
9618 considered for if-conversion. The default is 10, though the compiler will
9619 also use other heuristics to decide whether if-conversion is likely to be
9620 profitable.
9621
9622 @item max-rtl-if-conversion-predictable-cost
9623 @item max-rtl-if-conversion-unpredictable-cost
9624 RTL if-conversion will try to remove conditional branches around a block
9625 and replace them with conditionally executed instructions. These parameters
9626 give the maximum permissible cost for the sequence that would be generated
9627 by if-conversion depending on whether the branch is statically determined
9628 to be predictable or not. The units for this parameter are the same as
9629 those for the GCC internal seq_cost metric. The compiler will try to
9630 provide a reasonable default for this parameter using the BRANCH_COST
9631 target macro.
9632
9633 @item max-crossjump-edges
9634 The maximum number of incoming edges to consider for cross-jumping.
9635 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
9636 the number of edges incoming to each block. Increasing values mean
9637 more aggressive optimization, making the compilation time increase with
9638 probably small improvement in executable size.
9639
9640 @item min-crossjump-insns
9641 The minimum number of instructions that must be matched at the end
9642 of two blocks before cross-jumping is performed on them. This
9643 value is ignored in the case where all instructions in the block being
9644 cross-jumped from are matched. The default value is 5.
9645
9646 @item max-grow-copy-bb-insns
9647 The maximum code size expansion factor when copying basic blocks
9648 instead of jumping. The expansion is relative to a jump instruction.
9649 The default value is 8.
9650
9651 @item max-goto-duplication-insns
9652 The maximum number of instructions to duplicate to a block that jumps
9653 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
9654 passes, GCC factors computed gotos early in the compilation process,
9655 and unfactors them as late as possible. Only computed jumps at the
9656 end of a basic blocks with no more than max-goto-duplication-insns are
9657 unfactored. The default value is 8.
9658
9659 @item max-delay-slot-insn-search
9660 The maximum number of instructions to consider when looking for an
9661 instruction to fill a delay slot. If more than this arbitrary number of
9662 instructions are searched, the time savings from filling the delay slot
9663 are minimal, so stop searching. Increasing values mean more
9664 aggressive optimization, making the compilation time increase with probably
9665 small improvement in execution time.
9666
9667 @item max-delay-slot-live-search
9668 When trying to fill delay slots, the maximum number of instructions to
9669 consider when searching for a block with valid live register
9670 information. Increasing this arbitrarily chosen value means more
9671 aggressive optimization, increasing the compilation time. This parameter
9672 should be removed when the delay slot code is rewritten to maintain the
9673 control-flow graph.
9674
9675 @item max-gcse-memory
9676 The approximate maximum amount of memory that can be allocated in
9677 order to perform the global common subexpression elimination
9678 optimization. If more memory than specified is required, the
9679 optimization is not done.
9680
9681 @item max-gcse-insertion-ratio
9682 If the ratio of expression insertions to deletions is larger than this value
9683 for any expression, then RTL PRE inserts or removes the expression and thus
9684 leaves partially redundant computations in the instruction stream. The default value is 20.
9685
9686 @item max-pending-list-length
9687 The maximum number of pending dependencies scheduling allows
9688 before flushing the current state and starting over. Large functions
9689 with few branches or calls can create excessively large lists which
9690 needlessly consume memory and resources.
9691
9692 @item max-modulo-backtrack-attempts
9693 The maximum number of backtrack attempts the scheduler should make
9694 when modulo scheduling a loop. Larger values can exponentially increase
9695 compilation time.
9696
9697 @item max-inline-insns-single
9698 Several parameters control the tree inliner used in GCC@.
9699 This number sets the maximum number of instructions (counted in GCC's
9700 internal representation) in a single function that the tree inliner
9701 considers for inlining. This only affects functions declared
9702 inline and methods implemented in a class declaration (C++).
9703 The default value is 400.
9704
9705 @item max-inline-insns-auto
9706 When you use @option{-finline-functions} (included in @option{-O3}),
9707 a lot of functions that would otherwise not be considered for inlining
9708 by the compiler are investigated. To those functions, a different
9709 (more restrictive) limit compared to functions declared inline can
9710 be applied.
9711 The default value is 40.
9712
9713 @item inline-min-speedup
9714 When estimated performance improvement of caller + callee runtime exceeds this
9715 threshold (in percent), the function can be inlined regardless of the limit on
9716 @option{--param max-inline-insns-single} and @option{--param
9717 max-inline-insns-auto}.
9718
9719 @item large-function-insns
9720 The limit specifying really large functions. For functions larger than this
9721 limit after inlining, inlining is constrained by
9722 @option{--param large-function-growth}. This parameter is useful primarily
9723 to avoid extreme compilation time caused by non-linear algorithms used by the
9724 back end.
9725 The default value is 2700.
9726
9727 @item large-function-growth
9728 Specifies maximal growth of large function caused by inlining in percents.
9729 The default value is 100 which limits large function growth to 2.0 times
9730 the original size.
9731
9732 @item large-unit-insns
9733 The limit specifying large translation unit. Growth caused by inlining of
9734 units larger than this limit is limited by @option{--param inline-unit-growth}.
9735 For small units this might be too tight.
9736 For example, consider a unit consisting of function A
9737 that is inline and B that just calls A three times. If B is small relative to
9738 A, the growth of unit is 300\% and yet such inlining is very sane. For very
9739 large units consisting of small inlineable functions, however, the overall unit
9740 growth limit is needed to avoid exponential explosion of code size. Thus for
9741 smaller units, the size is increased to @option{--param large-unit-insns}
9742 before applying @option{--param inline-unit-growth}. The default is 10000.
9743
9744 @item inline-unit-growth
9745 Specifies maximal overall growth of the compilation unit caused by inlining.
9746 The default value is 20 which limits unit growth to 1.2 times the original
9747 size. Cold functions (either marked cold via an attribute or by profile
9748 feedback) are not accounted into the unit size.
9749
9750 @item ipcp-unit-growth
9751 Specifies maximal overall growth of the compilation unit caused by
9752 interprocedural constant propagation. The default value is 10 which limits
9753 unit growth to 1.1 times the original size.
9754
9755 @item large-stack-frame
9756 The limit specifying large stack frames. While inlining the algorithm is trying
9757 to not grow past this limit too much. The default value is 256 bytes.
9758
9759 @item large-stack-frame-growth
9760 Specifies maximal growth of large stack frames caused by inlining in percents.
9761 The default value is 1000 which limits large stack frame growth to 11 times
9762 the original size.
9763
9764 @item max-inline-insns-recursive
9765 @itemx max-inline-insns-recursive-auto
9766 Specifies the maximum number of instructions an out-of-line copy of a
9767 self-recursive inline
9768 function can grow into by performing recursive inlining.
9769
9770 @option{--param max-inline-insns-recursive} applies to functions
9771 declared inline.
9772 For functions not declared inline, recursive inlining
9773 happens only when @option{-finline-functions} (included in @option{-O3}) is
9774 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
9775 default value is 450.
9776
9777 @item max-inline-recursive-depth
9778 @itemx max-inline-recursive-depth-auto
9779 Specifies the maximum recursion depth used for recursive inlining.
9780
9781 @option{--param max-inline-recursive-depth} applies to functions
9782 declared inline. For functions not declared inline, recursive inlining
9783 happens only when @option{-finline-functions} (included in @option{-O3}) is
9784 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
9785 default value is 8.
9786
9787 @item min-inline-recursive-probability
9788 Recursive inlining is profitable only for function having deep recursion
9789 in average and can hurt for function having little recursion depth by
9790 increasing the prologue size or complexity of function body to other
9791 optimizers.
9792
9793 When profile feedback is available (see @option{-fprofile-generate}) the actual
9794 recursion depth can be guessed from the probability that function recurses
9795 via a given call expression. This parameter limits inlining only to call
9796 expressions whose probability exceeds the given threshold (in percents).
9797 The default value is 10.
9798
9799 @item early-inlining-insns
9800 Specify growth that the early inliner can make. In effect it increases
9801 the amount of inlining for code having a large abstraction penalty.
9802 The default value is 14.
9803
9804 @item max-early-inliner-iterations
9805 Limit of iterations of the early inliner. This basically bounds
9806 the number of nested indirect calls the early inliner can resolve.
9807 Deeper chains are still handled by late inlining.
9808
9809 @item comdat-sharing-probability
9810 Probability (in percent) that C++ inline function with comdat visibility
9811 are shared across multiple compilation units. The default value is 20.
9812
9813 @item profile-func-internal-id
9814 A parameter to control whether to use function internal id in profile
9815 database lookup. If the value is 0, the compiler uses an id that
9816 is based on function assembler name and filename, which makes old profile
9817 data more tolerant to source changes such as function reordering etc.
9818 The default value is 0.
9819
9820 @item min-vect-loop-bound
9821 The minimum number of iterations under which loops are not vectorized
9822 when @option{-ftree-vectorize} is used. The number of iterations after
9823 vectorization needs to be greater than the value specified by this option
9824 to allow vectorization. The default value is 0.
9825
9826 @item gcse-cost-distance-ratio
9827 Scaling factor in calculation of maximum distance an expression
9828 can be moved by GCSE optimizations. This is currently supported only in the
9829 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9830 is with simple expressions, i.e., the expressions that have cost
9831 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9832 hoisting of simple expressions. The default value is 10.
9833
9834 @item gcse-unrestricted-cost
9835 Cost, roughly measured as the cost of a single typical machine
9836 instruction, at which GCSE optimizations do not constrain
9837 the distance an expression can travel. This is currently
9838 supported only in the code hoisting pass. The lesser the cost,
9839 the more aggressive code hoisting is. Specifying 0
9840 allows all expressions to travel unrestricted distances.
9841 The default value is 3.
9842
9843 @item max-hoist-depth
9844 The depth of search in the dominator tree for expressions to hoist.
9845 This is used to avoid quadratic behavior in hoisting algorithm.
9846 The value of 0 does not limit on the search, but may slow down compilation
9847 of huge functions. The default value is 30.
9848
9849 @item max-tail-merge-comparisons
9850 The maximum amount of similar bbs to compare a bb with. This is used to
9851 avoid quadratic behavior in tree tail merging. The default value is 10.
9852
9853 @item max-tail-merge-iterations
9854 The maximum amount of iterations of the pass over the function. This is used to
9855 limit compilation time in tree tail merging. The default value is 2.
9856
9857 @item store-merging-allow-unaligned
9858 Allow the store merging pass to introduce unaligned stores if it is legal to
9859 do so. The default value is 1.
9860
9861 @item max-stores-to-merge
9862 The maximum number of stores to attempt to merge into wider stores in the store
9863 merging pass. The minimum value is 2 and the default is 64.
9864
9865 @item max-unrolled-insns
9866 The maximum number of instructions that a loop may have to be unrolled.
9867 If a loop is unrolled, this parameter also determines how many times
9868 the loop code is unrolled.
9869
9870 @item max-average-unrolled-insns
9871 The maximum number of instructions biased by probabilities of their execution
9872 that a loop may have to be unrolled. If a loop is unrolled,
9873 this parameter also determines how many times the loop code is unrolled.
9874
9875 @item max-unroll-times
9876 The maximum number of unrollings of a single loop.
9877
9878 @item max-peeled-insns
9879 The maximum number of instructions that a loop may have to be peeled.
9880 If a loop is peeled, this parameter also determines how many times
9881 the loop code is peeled.
9882
9883 @item max-peel-times
9884 The maximum number of peelings of a single loop.
9885
9886 @item max-peel-branches
9887 The maximum number of branches on the hot path through the peeled sequence.
9888
9889 @item max-completely-peeled-insns
9890 The maximum number of insns of a completely peeled loop.
9891
9892 @item max-completely-peel-times
9893 The maximum number of iterations of a loop to be suitable for complete peeling.
9894
9895 @item max-completely-peel-loop-nest-depth
9896 The maximum depth of a loop nest suitable for complete peeling.
9897
9898 @item max-unswitch-insns
9899 The maximum number of insns of an unswitched loop.
9900
9901 @item max-unswitch-level
9902 The maximum number of branches unswitched in a single loop.
9903
9904 @item max-loop-headers-insns
9905 The maximum number of insns in loop header duplicated by he copy loop headers
9906 pass.
9907
9908 @item lim-expensive
9909 The minimum cost of an expensive expression in the loop invariant motion.
9910
9911 @item iv-consider-all-candidates-bound
9912 Bound on number of candidates for induction variables, below which
9913 all candidates are considered for each use in induction variable
9914 optimizations. If there are more candidates than this,
9915 only the most relevant ones are considered to avoid quadratic time complexity.
9916
9917 @item iv-max-considered-uses
9918 The induction variable optimizations give up on loops that contain more
9919 induction variable uses.
9920
9921 @item iv-always-prune-cand-set-bound
9922 If the number of candidates in the set is smaller than this value,
9923 always try to remove unnecessary ivs from the set
9924 when adding a new one.
9925
9926 @item avg-loop-niter
9927 Average number of iterations of a loop.
9928
9929 @item dse-max-object-size
9930 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
9931 Larger values may result in larger compilation times.
9932
9933 @item scev-max-expr-size
9934 Bound on size of expressions used in the scalar evolutions analyzer.
9935 Large expressions slow the analyzer.
9936
9937 @item scev-max-expr-complexity
9938 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9939 Complex expressions slow the analyzer.
9940
9941 @item max-tree-if-conversion-phi-args
9942 Maximum number of arguments in a PHI supported by TREE if conversion
9943 unless the loop is marked with simd pragma.
9944
9945 @item vect-max-version-for-alignment-checks
9946 The maximum number of run-time checks that can be performed when
9947 doing loop versioning for alignment in the vectorizer.
9948
9949 @item vect-max-version-for-alias-checks
9950 The maximum number of run-time checks that can be performed when
9951 doing loop versioning for alias in the vectorizer.
9952
9953 @item vect-max-peeling-for-alignment
9954 The maximum number of loop peels to enhance access alignment
9955 for vectorizer. Value -1 means no limit.
9956
9957 @item max-iterations-to-track
9958 The maximum number of iterations of a loop the brute-force algorithm
9959 for analysis of the number of iterations of the loop tries to evaluate.
9960
9961 @item hot-bb-count-ws-permille
9962 A basic block profile count is considered hot if it contributes to
9963 the given permillage (i.e. 0...1000) of the entire profiled execution.
9964
9965 @item hot-bb-frequency-fraction
9966 Select fraction of the entry block frequency of executions of basic block in
9967 function given basic block needs to have to be considered hot.
9968
9969 @item max-predicted-iterations
9970 The maximum number of loop iterations we predict statically. This is useful
9971 in cases where a function contains a single loop with known bound and
9972 another loop with unknown bound.
9973 The known number of iterations is predicted correctly, while
9974 the unknown number of iterations average to roughly 10. This means that the
9975 loop without bounds appears artificially cold relative to the other one.
9976
9977 @item builtin-expect-probability
9978 Control the probability of the expression having the specified value. This
9979 parameter takes a percentage (i.e. 0 ... 100) as input.
9980 The default probability of 90 is obtained empirically.
9981
9982 @item align-threshold
9983
9984 Select fraction of the maximal frequency of executions of a basic block in
9985 a function to align the basic block.
9986
9987 @item align-loop-iterations
9988
9989 A loop expected to iterate at least the selected number of iterations is
9990 aligned.
9991
9992 @item tracer-dynamic-coverage
9993 @itemx tracer-dynamic-coverage-feedback
9994
9995 This value is used to limit superblock formation once the given percentage of
9996 executed instructions is covered. This limits unnecessary code size
9997 expansion.
9998
9999 The @option{tracer-dynamic-coverage-feedback} parameter
10000 is used only when profile
10001 feedback is available. The real profiles (as opposed to statically estimated
10002 ones) are much less balanced allowing the threshold to be larger value.
10003
10004 @item tracer-max-code-growth
10005 Stop tail duplication once code growth has reached given percentage. This is
10006 a rather artificial limit, as most of the duplicates are eliminated later in
10007 cross jumping, so it may be set to much higher values than is the desired code
10008 growth.
10009
10010 @item tracer-min-branch-ratio
10011
10012 Stop reverse growth when the reverse probability of best edge is less than this
10013 threshold (in percent).
10014
10015 @item tracer-min-branch-probability
10016 @itemx tracer-min-branch-probability-feedback
10017
10018 Stop forward growth if the best edge has probability lower than this
10019 threshold.
10020
10021 Similarly to @option{tracer-dynamic-coverage} two parameters are
10022 provided. @option{tracer-min-branch-probability-feedback} is used for
10023 compilation with profile feedback and @option{tracer-min-branch-probability}
10024 compilation without. The value for compilation with profile feedback
10025 needs to be more conservative (higher) in order to make tracer
10026 effective.
10027
10028 @item max-cse-path-length
10029
10030 The maximum number of basic blocks on path that CSE considers.
10031 The default is 10.
10032
10033 @item max-cse-insns
10034 The maximum number of instructions CSE processes before flushing.
10035 The default is 1000.
10036
10037 @item ggc-min-expand
10038
10039 GCC uses a garbage collector to manage its own memory allocation. This
10040 parameter specifies the minimum percentage by which the garbage
10041 collector's heap should be allowed to expand between collections.
10042 Tuning this may improve compilation speed; it has no effect on code
10043 generation.
10044
10045 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10046 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10047 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10048 GCC is not able to calculate RAM on a particular platform, the lower
10049 bound of 30% is used. Setting this parameter and
10050 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10051 every opportunity. This is extremely slow, but can be useful for
10052 debugging.
10053
10054 @item ggc-min-heapsize
10055
10056 Minimum size of the garbage collector's heap before it begins bothering
10057 to collect garbage. The first collection occurs after the heap expands
10058 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10059 tuning this may improve compilation speed, and has no effect on code
10060 generation.
10061
10062 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10063 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10064 with a lower bound of 4096 (four megabytes) and an upper bound of
10065 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10066 particular platform, the lower bound is used. Setting this parameter
10067 very large effectively disables garbage collection. Setting this
10068 parameter and @option{ggc-min-expand} to zero causes a full collection
10069 to occur at every opportunity.
10070
10071 @item max-reload-search-insns
10072 The maximum number of instruction reload should look backward for equivalent
10073 register. Increasing values mean more aggressive optimization, making the
10074 compilation time increase with probably slightly better performance.
10075 The default value is 100.
10076
10077 @item max-cselib-memory-locations
10078 The maximum number of memory locations cselib should take into account.
10079 Increasing values mean more aggressive optimization, making the compilation time
10080 increase with probably slightly better performance. The default value is 500.
10081
10082 @item max-sched-ready-insns
10083 The maximum number of instructions ready to be issued the scheduler should
10084 consider at any given time during the first scheduling pass. Increasing
10085 values mean more thorough searches, making the compilation time increase
10086 with probably little benefit. The default value is 100.
10087
10088 @item max-sched-region-blocks
10089 The maximum number of blocks in a region to be considered for
10090 interblock scheduling. The default value is 10.
10091
10092 @item max-pipeline-region-blocks
10093 The maximum number of blocks in a region to be considered for
10094 pipelining in the selective scheduler. The default value is 15.
10095
10096 @item max-sched-region-insns
10097 The maximum number of insns in a region to be considered for
10098 interblock scheduling. The default value is 100.
10099
10100 @item max-pipeline-region-insns
10101 The maximum number of insns in a region to be considered for
10102 pipelining in the selective scheduler. The default value is 200.
10103
10104 @item min-spec-prob
10105 The minimum probability (in percents) of reaching a source block
10106 for interblock speculative scheduling. The default value is 40.
10107
10108 @item max-sched-extend-regions-iters
10109 The maximum number of iterations through CFG to extend regions.
10110 A value of 0 (the default) disables region extensions.
10111
10112 @item max-sched-insn-conflict-delay
10113 The maximum conflict delay for an insn to be considered for speculative motion.
10114 The default value is 3.
10115
10116 @item sched-spec-prob-cutoff
10117 The minimal probability of speculation success (in percents), so that
10118 speculative insns are scheduled.
10119 The default value is 40.
10120
10121 @item sched-state-edge-prob-cutoff
10122 The minimum probability an edge must have for the scheduler to save its
10123 state across it.
10124 The default value is 10.
10125
10126 @item sched-mem-true-dep-cost
10127 Minimal distance (in CPU cycles) between store and load targeting same
10128 memory locations. The default value is 1.
10129
10130 @item selsched-max-lookahead
10131 The maximum size of the lookahead window of selective scheduling. It is a
10132 depth of search for available instructions.
10133 The default value is 50.
10134
10135 @item selsched-max-sched-times
10136 The maximum number of times that an instruction is scheduled during
10137 selective scheduling. This is the limit on the number of iterations
10138 through which the instruction may be pipelined. The default value is 2.
10139
10140 @item selsched-insns-to-rename
10141 The maximum number of best instructions in the ready list that are considered
10142 for renaming in the selective scheduler. The default value is 2.
10143
10144 @item sms-min-sc
10145 The minimum value of stage count that swing modulo scheduler
10146 generates. The default value is 2.
10147
10148 @item max-last-value-rtl
10149 The maximum size measured as number of RTLs that can be recorded in an expression
10150 in combiner for a pseudo register as last known value of that register. The default
10151 is 10000.
10152
10153 @item max-combine-insns
10154 The maximum number of instructions the RTL combiner tries to combine.
10155 The default value is 2 at @option{-Og} and 4 otherwise.
10156
10157 @item integer-share-limit
10158 Small integer constants can use a shared data structure, reducing the
10159 compiler's memory usage and increasing its speed. This sets the maximum
10160 value of a shared integer constant. The default value is 256.
10161
10162 @item ssp-buffer-size
10163 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10164 protection when @option{-fstack-protection} is used.
10165
10166 @item min-size-for-stack-sharing
10167 The minimum size of variables taking part in stack slot sharing when not
10168 optimizing. The default value is 32.
10169
10170 @item max-jump-thread-duplication-stmts
10171 Maximum number of statements allowed in a block that needs to be
10172 duplicated when threading jumps.
10173
10174 @item max-fields-for-field-sensitive
10175 Maximum number of fields in a structure treated in
10176 a field sensitive manner during pointer analysis. The default is zero
10177 for @option{-O0} and @option{-O1},
10178 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10179
10180 @item prefetch-latency
10181 Estimate on average number of instructions that are executed before
10182 prefetch finishes. The distance prefetched ahead is proportional
10183 to this constant. Increasing this number may also lead to less
10184 streams being prefetched (see @option{simultaneous-prefetches}).
10185
10186 @item simultaneous-prefetches
10187 Maximum number of prefetches that can run at the same time.
10188
10189 @item l1-cache-line-size
10190 The size of cache line in L1 cache, in bytes.
10191
10192 @item l1-cache-size
10193 The size of L1 cache, in kilobytes.
10194
10195 @item l2-cache-size
10196 The size of L2 cache, in kilobytes.
10197
10198 @item min-insn-to-prefetch-ratio
10199 The minimum ratio between the number of instructions and the
10200 number of prefetches to enable prefetching in a loop.
10201
10202 @item prefetch-min-insn-to-mem-ratio
10203 The minimum ratio between the number of instructions and the
10204 number of memory references to enable prefetching in a loop.
10205
10206 @item use-canonical-types
10207 Whether the compiler should use the ``canonical'' type system. By
10208 default, this should always be 1, which uses a more efficient internal
10209 mechanism for comparing types in C++ and Objective-C++. However, if
10210 bugs in the canonical type system are causing compilation failures,
10211 set this value to 0 to disable canonical types.
10212
10213 @item switch-conversion-max-branch-ratio
10214 Switch initialization conversion refuses to create arrays that are
10215 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10216 branches in the switch.
10217
10218 @item max-partial-antic-length
10219 Maximum length of the partial antic set computed during the tree
10220 partial redundancy elimination optimization (@option{-ftree-pre}) when
10221 optimizing at @option{-O3} and above. For some sorts of source code
10222 the enhanced partial redundancy elimination optimization can run away,
10223 consuming all of the memory available on the host machine. This
10224 parameter sets a limit on the length of the sets that are computed,
10225 which prevents the runaway behavior. Setting a value of 0 for
10226 this parameter allows an unlimited set length.
10227
10228 @item sccvn-max-scc-size
10229 Maximum size of a strongly connected component (SCC) during SCCVN
10230 processing. If this limit is hit, SCCVN processing for the whole
10231 function is not done and optimizations depending on it are
10232 disabled. The default maximum SCC size is 10000.
10233
10234 @item sccvn-max-alias-queries-per-access
10235 Maximum number of alias-oracle queries we perform when looking for
10236 redundancies for loads and stores. If this limit is hit the search
10237 is aborted and the load or store is not considered redundant. The
10238 number of queries is algorithmically limited to the number of
10239 stores on all paths from the load to the function entry.
10240 The default maximum number of queries is 1000.
10241
10242 @item ira-max-loops-num
10243 IRA uses regional register allocation by default. If a function
10244 contains more loops than the number given by this parameter, only at most
10245 the given number of the most frequently-executed loops form regions
10246 for regional register allocation. The default value of the
10247 parameter is 100.
10248
10249 @item ira-max-conflict-table-size
10250 Although IRA uses a sophisticated algorithm to compress the conflict
10251 table, the table can still require excessive amounts of memory for
10252 huge functions. If the conflict table for a function could be more
10253 than the size in MB given by this parameter, the register allocator
10254 instead uses a faster, simpler, and lower-quality
10255 algorithm that does not require building a pseudo-register conflict table.
10256 The default value of the parameter is 2000.
10257
10258 @item ira-loop-reserved-regs
10259 IRA can be used to evaluate more accurate register pressure in loops
10260 for decisions to move loop invariants (see @option{-O3}). The number
10261 of available registers reserved for some other purposes is given
10262 by this parameter. The default value of the parameter is 2, which is
10263 the minimal number of registers needed by typical instructions.
10264 This value is the best found from numerous experiments.
10265
10266 @item lra-inheritance-ebb-probability-cutoff
10267 LRA tries to reuse values reloaded in registers in subsequent insns.
10268 This optimization is called inheritance. EBB is used as a region to
10269 do this optimization. The parameter defines a minimal fall-through
10270 edge probability in percentage used to add BB to inheritance EBB in
10271 LRA. The default value of the parameter is 40. The value was chosen
10272 from numerous runs of SPEC2000 on x86-64.
10273
10274 @item loop-invariant-max-bbs-in-loop
10275 Loop invariant motion can be very expensive, both in compilation time and
10276 in amount of needed compile-time memory, with very large loops. Loops
10277 with more basic blocks than this parameter won't have loop invariant
10278 motion optimization performed on them. The default value of the
10279 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10280
10281 @item loop-max-datarefs-for-datadeps
10282 Building data dependencies is expensive for very large loops. This
10283 parameter limits the number of data references in loops that are
10284 considered for data dependence analysis. These large loops are no
10285 handled by the optimizations using loop data dependencies.
10286 The default value is 1000.
10287
10288 @item max-vartrack-size
10289 Sets a maximum number of hash table slots to use during variable
10290 tracking dataflow analysis of any function. If this limit is exceeded
10291 with variable tracking at assignments enabled, analysis for that
10292 function is retried without it, after removing all debug insns from
10293 the function. If the limit is exceeded even without debug insns, var
10294 tracking analysis is completely disabled for the function. Setting
10295 the parameter to zero makes it unlimited.
10296
10297 @item max-vartrack-expr-depth
10298 Sets a maximum number of recursion levels when attempting to map
10299 variable names or debug temporaries to value expressions. This trades
10300 compilation time for more complete debug information. If this is set too
10301 low, value expressions that are available and could be represented in
10302 debug information may end up not being used; setting this higher may
10303 enable the compiler to find more complex debug expressions, but compile
10304 time and memory use may grow. The default is 12.
10305
10306 @item min-nondebug-insn-uid
10307 Use uids starting at this parameter for nondebug insns. The range below
10308 the parameter is reserved exclusively for debug insns created by
10309 @option{-fvar-tracking-assignments}, but debug insns may get
10310 (non-overlapping) uids above it if the reserved range is exhausted.
10311
10312 @item ipa-sra-ptr-growth-factor
10313 IPA-SRA replaces a pointer to an aggregate with one or more new
10314 parameters only when their cumulative size is less or equal to
10315 @option{ipa-sra-ptr-growth-factor} times the size of the original
10316 pointer parameter.
10317
10318 @item sra-max-scalarization-size-Ospeed
10319 @item sra-max-scalarization-size-Osize
10320 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10321 replace scalar parts of aggregates with uses of independent scalar
10322 variables. These parameters control the maximum size, in storage units,
10323 of aggregate which is considered for replacement when compiling for
10324 speed
10325 (@option{sra-max-scalarization-size-Ospeed}) or size
10326 (@option{sra-max-scalarization-size-Osize}) respectively.
10327
10328 @item tm-max-aggregate-size
10329 When making copies of thread-local variables in a transaction, this
10330 parameter specifies the size in bytes after which variables are
10331 saved with the logging functions as opposed to save/restore code
10332 sequence pairs. This option only applies when using
10333 @option{-fgnu-tm}.
10334
10335 @item graphite-max-nb-scop-params
10336 To avoid exponential effects in the Graphite loop transforms, the
10337 number of parameters in a Static Control Part (SCoP) is bounded. The
10338 default value is 10 parameters. A variable whose value is unknown at
10339 compilation time and defined outside a SCoP is a parameter of the SCoP.
10340
10341 @item graphite-max-bbs-per-function
10342 To avoid exponential effects in the detection of SCoPs, the size of
10343 the functions analyzed by Graphite is bounded. The default value is
10344 100 basic blocks.
10345
10346 @item loop-block-tile-size
10347 Loop blocking or strip mining transforms, enabled with
10348 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10349 loop in the loop nest by a given number of iterations. The strip
10350 length can be changed using the @option{loop-block-tile-size}
10351 parameter. The default value is 51 iterations.
10352
10353 @item loop-unroll-jam-size
10354 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
10355 default value is 4.
10356
10357 @item loop-unroll-jam-depth
10358 Specify the dimension to be unrolled (counting from the most inner loop)
10359 for the @option{-floop-unroll-and-jam}. The default value is 2.
10360
10361 @item ipa-cp-value-list-size
10362 IPA-CP attempts to track all possible values and types passed to a function's
10363 parameter in order to propagate them and perform devirtualization.
10364 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10365 stores per one formal parameter of a function.
10366
10367 @item ipa-cp-eval-threshold
10368 IPA-CP calculates its own score of cloning profitability heuristics
10369 and performs those cloning opportunities with scores that exceed
10370 @option{ipa-cp-eval-threshold}.
10371
10372 @item ipa-cp-recursion-penalty
10373 Percentage penalty the recursive functions will receive when they
10374 are evaluated for cloning.
10375
10376 @item ipa-cp-single-call-penalty
10377 Percentage penalty functions containing a single call to another
10378 function will receive when they are evaluated for cloning.
10379
10380
10381 @item ipa-max-agg-items
10382 IPA-CP is also capable to propagate a number of scalar values passed
10383 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10384 number of such values per one parameter.
10385
10386 @item ipa-cp-loop-hint-bonus
10387 When IPA-CP determines that a cloning candidate would make the number
10388 of iterations of a loop known, it adds a bonus of
10389 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10390 the candidate.
10391
10392 @item ipa-cp-array-index-hint-bonus
10393 When IPA-CP determines that a cloning candidate would make the index of
10394 an array access known, it adds a bonus of
10395 @option{ipa-cp-array-index-hint-bonus} to the profitability
10396 score of the candidate.
10397
10398 @item ipa-max-aa-steps
10399 During its analysis of function bodies, IPA-CP employs alias analysis
10400 in order to track values pointed to by function parameters. In order
10401 not spend too much time analyzing huge functions, it gives up and
10402 consider all memory clobbered after examining
10403 @option{ipa-max-aa-steps} statements modifying memory.
10404
10405 @item lto-partitions
10406 Specify desired number of partitions produced during WHOPR compilation.
10407 The number of partitions should exceed the number of CPUs used for compilation.
10408 The default value is 32.
10409
10410 @item lto-min-partition
10411 Size of minimal partition for WHOPR (in estimated instructions).
10412 This prevents expenses of splitting very small programs into too many
10413 partitions.
10414
10415 @item lto-max-partition
10416 Size of max partition for WHOPR (in estimated instructions).
10417 to provide an upper bound for individual size of partition.
10418 Meant to be used only with balanced partitioning.
10419
10420 @item cxx-max-namespaces-for-diagnostic-help
10421 The maximum number of namespaces to consult for suggestions when C++
10422 name lookup fails for an identifier. The default is 1000.
10423
10424 @item sink-frequency-threshold
10425 The maximum relative execution frequency (in percents) of the target block
10426 relative to a statement's original block to allow statement sinking of a
10427 statement. Larger numbers result in more aggressive statement sinking.
10428 The default value is 75. A small positive adjustment is applied for
10429 statements with memory operands as those are even more profitable so sink.
10430
10431 @item max-stores-to-sink
10432 The maximum number of conditional store pairs that can be sunk. Set to 0
10433 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10434 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10435
10436 @item allow-store-data-races
10437 Allow optimizers to introduce new data races on stores.
10438 Set to 1 to allow, otherwise to 0. This option is enabled by default
10439 at optimization level @option{-Ofast}.
10440
10441 @item case-values-threshold
10442 The smallest number of different values for which it is best to use a
10443 jump-table instead of a tree of conditional branches. If the value is
10444 0, use the default for the machine. The default is 0.
10445
10446 @item tree-reassoc-width
10447 Set the maximum number of instructions executed in parallel in
10448 reassociated tree. This parameter overrides target dependent
10449 heuristics used by default if has non zero value.
10450
10451 @item sched-pressure-algorithm
10452 Choose between the two available implementations of
10453 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10454 and is the more likely to prevent instructions from being reordered.
10455 Algorithm 2 was designed to be a compromise between the relatively
10456 conservative approach taken by algorithm 1 and the rather aggressive
10457 approach taken by the default scheduler. It relies more heavily on
10458 having a regular register file and accurate register pressure classes.
10459 See @file{haifa-sched.c} in the GCC sources for more details.
10460
10461 The default choice depends on the target.
10462
10463 @item max-slsr-cand-scan
10464 Set the maximum number of existing candidates that are considered when
10465 seeking a basis for a new straight-line strength reduction candidate.
10466
10467 @item asan-globals
10468 Enable buffer overflow detection for global objects. This kind
10469 of protection is enabled by default if you are using
10470 @option{-fsanitize=address} option.
10471 To disable global objects protection use @option{--param asan-globals=0}.
10472
10473 @item asan-stack
10474 Enable buffer overflow detection for stack objects. This kind of
10475 protection is enabled by default when using @option{-fsanitize=address}.
10476 To disable stack protection use @option{--param asan-stack=0} option.
10477
10478 @item asan-instrument-reads
10479 Enable buffer overflow detection for memory reads. This kind of
10480 protection is enabled by default when using @option{-fsanitize=address}.
10481 To disable memory reads protection use
10482 @option{--param asan-instrument-reads=0}.
10483
10484 @item asan-instrument-writes
10485 Enable buffer overflow detection for memory writes. This kind of
10486 protection is enabled by default when using @option{-fsanitize=address}.
10487 To disable memory writes protection use
10488 @option{--param asan-instrument-writes=0} option.
10489
10490 @item asan-memintrin
10491 Enable detection for built-in functions. This kind of protection
10492 is enabled by default when using @option{-fsanitize=address}.
10493 To disable built-in functions protection use
10494 @option{--param asan-memintrin=0}.
10495
10496 @item asan-use-after-return
10497 Enable detection of use-after-return. This kind of protection
10498 is enabled by default when using the @option{-fsanitize=address} option.
10499 To disable it use @option{--param asan-use-after-return=0}.
10500
10501 Note: By default the check is disabled at run time. To enable it,
10502 add @code{detect_stack_use_after_return=1} to the environment variable
10503 @env{ASAN_OPTIONS}.
10504
10505 @item asan-instrumentation-with-call-threshold
10506 If number of memory accesses in function being instrumented
10507 is greater or equal to this number, use callbacks instead of inline checks.
10508 E.g. to disable inline code use
10509 @option{--param asan-instrumentation-with-call-threshold=0}.
10510
10511 @item use-after-scope-direct-emission-threshold
10512 If the size of a local variable in bytes is smaller or equal to this
10513 number, directly poison (or unpoison) shadow memory instead of using
10514 run-time callbacks. The default value is 256.
10515
10516 @item chkp-max-ctor-size
10517 Static constructors generated by Pointer Bounds Checker may become very
10518 large and significantly increase compile time at optimization level
10519 @option{-O1} and higher. This parameter is a maximum number of statements
10520 in a single generated constructor. Default value is 5000.
10521
10522 @item max-fsm-thread-path-insns
10523 Maximum number of instructions to copy when duplicating blocks on a
10524 finite state automaton jump thread path. The default is 100.
10525
10526 @item max-fsm-thread-length
10527 Maximum number of basic blocks on a finite state automaton jump thread
10528 path. The default is 10.
10529
10530 @item max-fsm-thread-paths
10531 Maximum number of new jump thread paths to create for a finite state
10532 automaton. The default is 50.
10533
10534 @item parloops-chunk-size
10535 Chunk size of omp schedule for loops parallelized by parloops. The default
10536 is 0.
10537
10538 @item parloops-schedule
10539 Schedule type of omp schedule for loops parallelized by parloops (static,
10540 dynamic, guided, auto, runtime). The default is static.
10541
10542 @item max-ssa-name-query-depth
10543 Maximum depth of recursion when querying properties of SSA names in things
10544 like fold routines. One level of recursion corresponds to following a
10545 use-def chain.
10546
10547 @item hsa-gen-debug-stores
10548 Enable emission of special debug stores within HSA kernels which are
10549 then read and reported by libgomp plugin. Generation of these stores
10550 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
10551 enable it.
10552
10553 @item max-speculative-devirt-maydefs
10554 The maximum number of may-defs we analyze when looking for a must-def
10555 specifying the dynamic type of an object that invokes a virtual call
10556 we may be able to devirtualize speculatively.
10557
10558 @item max-vrp-switch-assertions
10559 The maximum number of assertions to add along the default edge of a switch
10560 statement during VRP. The default is 10.
10561 @end table
10562 @end table
10563
10564 @node Instrumentation Options
10565 @section Program Instrumentation Options
10566 @cindex instrumentation options
10567 @cindex program instrumentation options
10568 @cindex run-time error checking options
10569 @cindex profiling options
10570 @cindex options, program instrumentation
10571 @cindex options, run-time error checking
10572 @cindex options, profiling
10573
10574 GCC supports a number of command-line options that control adding
10575 run-time instrumentation to the code it normally generates.
10576 For example, one purpose of instrumentation is collect profiling
10577 statistics for use in finding program hot spots, code coverage
10578 analysis, or profile-guided optimizations.
10579 Another class of program instrumentation is adding run-time checking
10580 to detect programming errors like invalid pointer
10581 dereferences or out-of-bounds array accesses, as well as deliberately
10582 hostile attacks such as stack smashing or C++ vtable hijacking.
10583 There is also a general hook which can be used to implement other
10584 forms of tracing or function-level instrumentation for debug or
10585 program analysis purposes.
10586
10587 @table @gcctabopt
10588 @cindex @command{prof}
10589 @item -p
10590 @opindex p
10591 Generate extra code to write profile information suitable for the
10592 analysis program @command{prof}. You must use this option when compiling
10593 the source files you want data about, and you must also use it when
10594 linking.
10595
10596 @cindex @command{gprof}
10597 @item -pg
10598 @opindex pg
10599 Generate extra code to write profile information suitable for the
10600 analysis program @command{gprof}. You must use this option when compiling
10601 the source files you want data about, and you must also use it when
10602 linking.
10603
10604 @item -fprofile-arcs
10605 @opindex fprofile-arcs
10606 Add code so that program flow @dfn{arcs} are instrumented. During
10607 execution the program records how many times each branch and call is
10608 executed and how many times it is taken or returns. On targets that support
10609 constructors with priority support, profiling properly handles constructors,
10610 destructors and C++ constructors (and destructors) of classes which are used
10611 as a type of a global variable.
10612
10613 When the compiled
10614 program exits it saves this data to a file called
10615 @file{@var{auxname}.gcda} for each source file. The data may be used for
10616 profile-directed optimizations (@option{-fbranch-probabilities}), or for
10617 test coverage analysis (@option{-ftest-coverage}). Each object file's
10618 @var{auxname} is generated from the name of the output file, if
10619 explicitly specified and it is not the final executable, otherwise it is
10620 the basename of the source file. In both cases any suffix is removed
10621 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
10622 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
10623 @xref{Cross-profiling}.
10624
10625 @cindex @command{gcov}
10626 @item --coverage
10627 @opindex coverage
10628
10629 This option is used to compile and link code instrumented for coverage
10630 analysis. The option is a synonym for @option{-fprofile-arcs}
10631 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
10632 linking). See the documentation for those options for more details.
10633
10634 @itemize
10635
10636 @item
10637 Compile the source files with @option{-fprofile-arcs} plus optimization
10638 and code generation options. For test coverage analysis, use the
10639 additional @option{-ftest-coverage} option. You do not need to profile
10640 every source file in a program.
10641
10642 @item
10643 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
10644 (the latter implies the former).
10645
10646 @item
10647 Run the program on a representative workload to generate the arc profile
10648 information. This may be repeated any number of times. You can run
10649 concurrent instances of your program, and provided that the file system
10650 supports locking, the data files will be correctly updated. Also
10651 @code{fork} calls are detected and correctly handled (double counting
10652 will not happen).
10653
10654 @item
10655 For profile-directed optimizations, compile the source files again with
10656 the same optimization and code generation options plus
10657 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
10658 Control Optimization}).
10659
10660 @item
10661 For test coverage analysis, use @command{gcov} to produce human readable
10662 information from the @file{.gcno} and @file{.gcda} files. Refer to the
10663 @command{gcov} documentation for further information.
10664
10665 @end itemize
10666
10667 With @option{-fprofile-arcs}, for each function of your program GCC
10668 creates a program flow graph, then finds a spanning tree for the graph.
10669 Only arcs that are not on the spanning tree have to be instrumented: the
10670 compiler adds code to count the number of times that these arcs are
10671 executed. When an arc is the only exit or only entrance to a block, the
10672 instrumentation code can be added to the block; otherwise, a new basic
10673 block must be created to hold the instrumentation code.
10674
10675 @need 2000
10676 @item -ftest-coverage
10677 @opindex ftest-coverage
10678 Produce a notes file that the @command{gcov} code-coverage utility
10679 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
10680 show program coverage. Each source file's note file is called
10681 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
10682 above for a description of @var{auxname} and instructions on how to
10683 generate test coverage data. Coverage data matches the source files
10684 more closely if you do not optimize.
10685
10686 @item -fprofile-dir=@var{path}
10687 @opindex fprofile-dir
10688
10689 Set the directory to search for the profile data files in to @var{path}.
10690 This option affects only the profile data generated by
10691 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
10692 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
10693 and its related options. Both absolute and relative paths can be used.
10694 By default, GCC uses the current directory as @var{path}, thus the
10695 profile data file appears in the same directory as the object file.
10696
10697 @item -fprofile-generate
10698 @itemx -fprofile-generate=@var{path}
10699 @opindex fprofile-generate
10700
10701 Enable options usually used for instrumenting application to produce
10702 profile useful for later recompilation with profile feedback based
10703 optimization. You must use @option{-fprofile-generate} both when
10704 compiling and when linking your program.
10705
10706 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
10707
10708 If @var{path} is specified, GCC looks at the @var{path} to find
10709 the profile feedback data files. See @option{-fprofile-dir}.
10710
10711 To optimize the program based on the collected profile information, use
10712 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
10713
10714 @item -fprofile-update=@var{method}
10715 @opindex fprofile-update
10716
10717 Alter the update method for an application instrumented for profile
10718 feedback based optimization. The @var{method} argument should be one of
10719 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
10720 The first one is useful for single-threaded applications,
10721 while the second one prevents profile corruption by emitting thread-safe code.
10722
10723 @strong{Warning:} When an application does not properly join all threads
10724 (or creates an detached thread), a profile file can be still corrupted.
10725
10726 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
10727 when supported by a target, or to @samp{single} otherwise. The GCC driver
10728 automatically selects @samp{prefer-atomic} when @option{-pthread}
10729 is present in the command line.
10730
10731 @item -fsanitize=address
10732 @opindex fsanitize=address
10733 Enable AddressSanitizer, a fast memory error detector.
10734 Memory access instructions are instrumented to detect
10735 out-of-bounds and use-after-free bugs.
10736 The option enables @option{-fsanitize-address-use-after-scope}.
10737 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
10738 more details. The run-time behavior can be influenced using the
10739 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
10740 the available options are shown at startup of the instrumented program. See
10741 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
10742 for a list of supported options.
10743 The option can't be combined with @option{-fsanitize=thread}
10744 and/or @option{-fcheck-pointer-bounds}.
10745
10746 @item -fsanitize=kernel-address
10747 @opindex fsanitize=kernel-address
10748 Enable AddressSanitizer for Linux kernel.
10749 See @uref{https://github.com/google/kasan/wiki} for more details.
10750 The option can't be combined with @option{-fcheck-pointer-bounds}.
10751
10752 @item -fsanitize=thread
10753 @opindex fsanitize=thread
10754 Enable ThreadSanitizer, a fast data race detector.
10755 Memory access instructions are instrumented to detect
10756 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
10757 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
10758 environment variable; see
10759 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
10760 supported options.
10761 The option can't be combined with @option{-fsanitize=address},
10762 @option{-fsanitize=leak} and/or @option{-fcheck-pointer-bounds}.
10763
10764 @item -fsanitize=leak
10765 @opindex fsanitize=leak
10766 Enable LeakSanitizer, a memory leak detector.
10767 This option only matters for linking of executables and
10768 the executable is linked against a library that overrides @code{malloc}
10769 and other allocator functions. See
10770 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
10771 details. The run-time behavior can be influenced using the
10772 @env{LSAN_OPTIONS} environment variable.
10773 The option can't be combined with @option{-fsanitize=thread}.
10774
10775 @item -fsanitize=undefined
10776 @opindex fsanitize=undefined
10777 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
10778 Various computations are instrumented to detect undefined behavior
10779 at runtime. Current suboptions are:
10780
10781 @table @gcctabopt
10782
10783 @item -fsanitize=shift
10784 @opindex fsanitize=shift
10785 This option enables checking that the result of a shift operation is
10786 not undefined. Note that what exactly is considered undefined differs
10787 slightly between C and C++, as well as between ISO C90 and C99, etc.
10788 This option has two suboptions, @option{-fsanitize=shift-base} and
10789 @option{-fsanitize=shift-exponent}.
10790
10791 @item -fsanitize=shift-exponent
10792 @opindex fsanitize=shift-exponent
10793 This option enables checking that the second argument of a shift operation
10794 is not negative and is smaller than the precision of the promoted first
10795 argument.
10796
10797 @item -fsanitize=shift-base
10798 @opindex fsanitize=shift-base
10799 If the second argument of a shift operation is within range, check that the
10800 result of a shift operation is not undefined. Note that what exactly is
10801 considered undefined differs slightly between C and C++, as well as between
10802 ISO C90 and C99, etc.
10803
10804 @item -fsanitize=integer-divide-by-zero
10805 @opindex fsanitize=integer-divide-by-zero
10806 Detect integer division by zero as well as @code{INT_MIN / -1} division.
10807
10808 @item -fsanitize=unreachable
10809 @opindex fsanitize=unreachable
10810 With this option, the compiler turns the @code{__builtin_unreachable}
10811 call into a diagnostics message call instead. When reaching the
10812 @code{__builtin_unreachable} call, the behavior is undefined.
10813
10814 @item -fsanitize=vla-bound
10815 @opindex fsanitize=vla-bound
10816 This option instructs the compiler to check that the size of a variable
10817 length array is positive.
10818
10819 @item -fsanitize=null
10820 @opindex fsanitize=null
10821 This option enables pointer checking. Particularly, the application
10822 built with this option turned on will issue an error message when it
10823 tries to dereference a NULL pointer, or if a reference (possibly an
10824 rvalue reference) is bound to a NULL pointer, or if a method is invoked
10825 on an object pointed by a NULL pointer.
10826
10827 @item -fsanitize=return
10828 @opindex fsanitize=return
10829 This option enables return statement checking. Programs
10830 built with this option turned on will issue an error message
10831 when the end of a non-void function is reached without actually
10832 returning a value. This option works in C++ only.
10833
10834 @item -fsanitize=signed-integer-overflow
10835 @opindex fsanitize=signed-integer-overflow
10836 This option enables signed integer overflow checking. We check that
10837 the result of @code{+}, @code{*}, and both unary and binary @code{-}
10838 does not overflow in the signed arithmetics. Note, integer promotion
10839 rules must be taken into account. That is, the following is not an
10840 overflow:
10841 @smallexample
10842 signed char a = SCHAR_MAX;
10843 a++;
10844 @end smallexample
10845
10846 @item -fsanitize=bounds
10847 @opindex fsanitize=bounds
10848 This option enables instrumentation of array bounds. Various out of bounds
10849 accesses are detected. Flexible array members, flexible array member-like
10850 arrays, and initializers of variables with static storage are not instrumented.
10851 The option can't be combined with @option{-fcheck-pointer-bounds}.
10852
10853 @item -fsanitize=bounds-strict
10854 @opindex fsanitize=bounds-strict
10855 This option enables strict instrumentation of array bounds. Most out of bounds
10856 accesses are detected, including flexible array members and flexible array
10857 member-like arrays. Initializers of variables with static storage are not
10858 instrumented. The option can't be combined
10859 with @option{-fcheck-pointer-bounds}.
10860
10861 @item -fsanitize=alignment
10862 @opindex fsanitize=alignment
10863
10864 This option enables checking of alignment of pointers when they are
10865 dereferenced, or when a reference is bound to insufficiently aligned target,
10866 or when a method or constructor is invoked on insufficiently aligned object.
10867
10868 @item -fsanitize=object-size
10869 @opindex fsanitize=object-size
10870 This option enables instrumentation of memory references using the
10871 @code{__builtin_object_size} function. Various out of bounds pointer
10872 accesses are detected.
10873
10874 @item -fsanitize=float-divide-by-zero
10875 @opindex fsanitize=float-divide-by-zero
10876 Detect floating-point division by zero. Unlike other similar options,
10877 @option{-fsanitize=float-divide-by-zero} is not enabled by
10878 @option{-fsanitize=undefined}, since floating-point division by zero can
10879 be a legitimate way of obtaining infinities and NaNs.
10880
10881 @item -fsanitize=float-cast-overflow
10882 @opindex fsanitize=float-cast-overflow
10883 This option enables floating-point type to integer conversion checking.
10884 We check that the result of the conversion does not overflow.
10885 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
10886 not enabled by @option{-fsanitize=undefined}.
10887 This option does not work well with @code{FE_INVALID} exceptions enabled.
10888
10889 @item -fsanitize=nonnull-attribute
10890 @opindex fsanitize=nonnull-attribute
10891
10892 This option enables instrumentation of calls, checking whether null values
10893 are not passed to arguments marked as requiring a non-null value by the
10894 @code{nonnull} function attribute.
10895
10896 @item -fsanitize=returns-nonnull-attribute
10897 @opindex fsanitize=returns-nonnull-attribute
10898
10899 This option enables instrumentation of return statements in functions
10900 marked with @code{returns_nonnull} function attribute, to detect returning
10901 of null values from such functions.
10902
10903 @item -fsanitize=bool
10904 @opindex fsanitize=bool
10905
10906 This option enables instrumentation of loads from bool. If a value other
10907 than 0/1 is loaded, a run-time error is issued.
10908
10909 @item -fsanitize=enum
10910 @opindex fsanitize=enum
10911
10912 This option enables instrumentation of loads from an enum type. If
10913 a value outside the range of values for the enum type is loaded,
10914 a run-time error is issued.
10915
10916 @item -fsanitize=vptr
10917 @opindex fsanitize=vptr
10918
10919 This option enables instrumentation of C++ member function calls, member
10920 accesses and some conversions between pointers to base and derived classes,
10921 to verify the referenced object has the correct dynamic type.
10922
10923 @end table
10924
10925 While @option{-ftrapv} causes traps for signed overflows to be emitted,
10926 @option{-fsanitize=undefined} gives a diagnostic message.
10927 This currently works only for the C family of languages.
10928
10929 @item -fno-sanitize=all
10930 @opindex fno-sanitize=all
10931
10932 This option disables all previously enabled sanitizers.
10933 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
10934 together.
10935
10936 @item -fasan-shadow-offset=@var{number}
10937 @opindex fasan-shadow-offset
10938 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
10939 It is useful for experimenting with different shadow memory layouts in
10940 Kernel AddressSanitizer.
10941
10942 @item -fsanitize-sections=@var{s1},@var{s2},...
10943 @opindex fsanitize-sections
10944 Sanitize global variables in selected user-defined sections. @var{si} may
10945 contain wildcards.
10946
10947 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
10948 @opindex fsanitize-recover
10949 @opindex fno-sanitize-recover
10950 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
10951 mentioned in comma-separated list of @var{opts}. Enabling this option
10952 for a sanitizer component causes it to attempt to continue
10953 running the program as if no error happened. This means multiple
10954 runtime errors can be reported in a single program run, and the exit
10955 code of the program may indicate success even when errors
10956 have been reported. The @option{-fno-sanitize-recover=} option
10957 can be used to alter
10958 this behavior: only the first detected error is reported
10959 and program then exits with a non-zero exit code.
10960
10961 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
10962 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
10963 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
10964 @option{-fsanitize=bounds-strict},
10965 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
10966 For these sanitizers error recovery is turned on by default,
10967 except @option{-fsanitize=address}, for which this feature is experimental.
10968 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
10969 accepted, the former enables recovery for all sanitizers that support it,
10970 the latter disables recovery for all sanitizers that support it.
10971
10972 Even if a recovery mode is turned on the compiler side, it needs to be also
10973 enabled on the runtime library side, otherwise the failures are still fatal.
10974 The runtime library defaults to @code{halt_on_error=0} for
10975 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
10976 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
10977 setting the @code{halt_on_error} flag in the corresponding environment variable.
10978
10979 Syntax without an explicit @var{opts} parameter is deprecated. It is
10980 equivalent to specifying an @var{opts} list of:
10981
10982 @smallexample
10983 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
10984 @end smallexample
10985
10986 @item -fsanitize-address-use-after-scope
10987 @opindex fsanitize-address-use-after-scope
10988 Enable sanitization of local variables to detect use-after-scope bugs.
10989 The option sets @option{-fstack-reuse} to @samp{none}.
10990
10991 @item -fsanitize-undefined-trap-on-error
10992 @opindex fsanitize-undefined-trap-on-error
10993 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
10994 report undefined behavior using @code{__builtin_trap} rather than
10995 a @code{libubsan} library routine. The advantage of this is that the
10996 @code{libubsan} library is not needed and is not linked in, so this
10997 is usable even in freestanding environments.
10998
10999 @item -fsanitize-coverage=trace-pc
11000 @opindex fsanitize-coverage=trace-pc
11001 Enable coverage-guided fuzzing code instrumentation.
11002 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
11003
11004 @item -fbounds-check
11005 @opindex fbounds-check
11006 For front ends that support it, generate additional code to check that
11007 indices used to access arrays are within the declared range. This is
11008 currently only supported by the Fortran front end, where this option
11009 defaults to false.
11010
11011 @item -fcheck-pointer-bounds
11012 @opindex fcheck-pointer-bounds
11013 @opindex fno-check-pointer-bounds
11014 @cindex Pointer Bounds Checker options
11015 Enable Pointer Bounds Checker instrumentation. Each memory reference
11016 is instrumented with checks of the pointer used for memory access against
11017 bounds associated with that pointer.
11018
11019 Currently there
11020 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
11021 and @option{-mmpx} are required to enable this feature.
11022 MPX-based instrumentation requires
11023 a runtime library to enable MPX in hardware and handle bounds
11024 violation signals. By default when @option{-fcheck-pointer-bounds}
11025 and @option{-mmpx} options are used to link a program, the GCC driver
11026 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
11027 Bounds checking on calls to dynamic libraries requires a linker
11028 with @option{-z bndplt} support; if GCC was configured with a linker
11029 without support for this option (including the Gold linker and older
11030 versions of ld), a warning is given if you link with @option{-mmpx}
11031 without also specifying @option{-static}, since the overall effectiveness
11032 of the bounds checking protection is reduced.
11033 See also @option{-static-libmpxwrappers}.
11034
11035 MPX-based instrumentation
11036 may be used for debugging and also may be included in production code
11037 to increase program security. Depending on usage, you may
11038 have different requirements for the runtime library. The current version
11039 of the MPX runtime library is more oriented for use as a debugging
11040 tool. MPX runtime library usage implies @option{-lpthread}. See
11041 also @option{-static-libmpx}. The runtime library behavior can be
11042 influenced using various @env{CHKP_RT_*} environment variables. See
11043 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
11044 for more details.
11045
11046 Generated instrumentation may be controlled by various
11047 @option{-fchkp-*} options and by the @code{bnd_variable_size}
11048 structure field attribute (@pxref{Type Attributes}) and
11049 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
11050 (@pxref{Function Attributes}). GCC also provides a number of built-in
11051 functions for controlling the Pointer Bounds Checker. @xref{Pointer
11052 Bounds Checker builtins}, for more information.
11053
11054 @item -fchkp-check-incomplete-type
11055 @opindex fchkp-check-incomplete-type
11056 @opindex fno-chkp-check-incomplete-type
11057 Generate pointer bounds checks for variables with incomplete type.
11058 Enabled by default.
11059
11060 @item -fchkp-narrow-bounds
11061 @opindex fchkp-narrow-bounds
11062 @opindex fno-chkp-narrow-bounds
11063 Controls bounds used by Pointer Bounds Checker for pointers to object
11064 fields. If narrowing is enabled then field bounds are used. Otherwise
11065 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
11066 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
11067
11068 @item -fchkp-first-field-has-own-bounds
11069 @opindex fchkp-first-field-has-own-bounds
11070 @opindex fno-chkp-first-field-has-own-bounds
11071 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
11072 first field in the structure. By default a pointer to the first field has
11073 the same bounds as a pointer to the whole structure.
11074
11075 @item -fchkp-flexible-struct-trailing-arrays
11076 @opindex fchkp-flexible-struct-trailing-arrays
11077 @opindex fno-chkp-flexible-struct-trailing-arrays
11078 Forces Pointer Bounds Checker to treat all trailing arrays in structures as
11079 possibly flexible. By default only array fields with zero length or that are
11080 marked with attribute bnd_variable_size are treated as flexible.
11081
11082 @item -fchkp-narrow-to-innermost-array
11083 @opindex fchkp-narrow-to-innermost-array
11084 @opindex fno-chkp-narrow-to-innermost-array
11085 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
11086 case of nested static array access. By default this option is disabled and
11087 bounds of the outermost array are used.
11088
11089 @item -fchkp-optimize
11090 @opindex fchkp-optimize
11091 @opindex fno-chkp-optimize
11092 Enables Pointer Bounds Checker optimizations. Enabled by default at
11093 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
11094
11095 @item -fchkp-use-fast-string-functions
11096 @opindex fchkp-use-fast-string-functions
11097 @opindex fno-chkp-use-fast-string-functions
11098 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
11099 by Pointer Bounds Checker. Disabled by default.
11100
11101 @item -fchkp-use-nochk-string-functions
11102 @opindex fchkp-use-nochk-string-functions
11103 @opindex fno-chkp-use-nochk-string-functions
11104 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
11105 by Pointer Bounds Checker. Disabled by default.
11106
11107 @item -fchkp-use-static-bounds
11108 @opindex fchkp-use-static-bounds
11109 @opindex fno-chkp-use-static-bounds
11110 Allow Pointer Bounds Checker to generate static bounds holding
11111 bounds of static variables. Enabled by default.
11112
11113 @item -fchkp-use-static-const-bounds
11114 @opindex fchkp-use-static-const-bounds
11115 @opindex fno-chkp-use-static-const-bounds
11116 Use statically-initialized bounds for constant bounds instead of
11117 generating them each time they are required. By default enabled when
11118 @option{-fchkp-use-static-bounds} is enabled.
11119
11120 @item -fchkp-treat-zero-dynamic-size-as-infinite
11121 @opindex fchkp-treat-zero-dynamic-size-as-infinite
11122 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
11123 With this option, objects with incomplete type whose
11124 dynamically-obtained size is zero are treated as having infinite size
11125 instead by Pointer Bounds
11126 Checker. This option may be helpful if a program is linked with a library
11127 missing size information for some symbols. Disabled by default.
11128
11129 @item -fchkp-check-read
11130 @opindex fchkp-check-read
11131 @opindex fno-chkp-check-read
11132 Instructs Pointer Bounds Checker to generate checks for all read
11133 accesses to memory. Enabled by default.
11134
11135 @item -fchkp-check-write
11136 @opindex fchkp-check-write
11137 @opindex fno-chkp-check-write
11138 Instructs Pointer Bounds Checker to generate checks for all write
11139 accesses to memory. Enabled by default.
11140
11141 @item -fchkp-store-bounds
11142 @opindex fchkp-store-bounds
11143 @opindex fno-chkp-store-bounds
11144 Instructs Pointer Bounds Checker to generate bounds stores for
11145 pointer writes. Enabled by default.
11146
11147 @item -fchkp-instrument-calls
11148 @opindex fchkp-instrument-calls
11149 @opindex fno-chkp-instrument-calls
11150 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
11151 Enabled by default.
11152
11153 @item -fchkp-instrument-marked-only
11154 @opindex fchkp-instrument-marked-only
11155 @opindex fno-chkp-instrument-marked-only
11156 Instructs Pointer Bounds Checker to instrument only functions
11157 marked with the @code{bnd_instrument} attribute
11158 (@pxref{Function Attributes}). Disabled by default.
11159
11160 @item -fchkp-use-wrappers
11161 @opindex fchkp-use-wrappers
11162 @opindex fno-chkp-use-wrappers
11163 Allows Pointer Bounds Checker to replace calls to built-in functions
11164 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
11165 is used to link a program, the GCC driver automatically links
11166 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
11167 Enabled by default.
11168
11169 @item -fstack-protector
11170 @opindex fstack-protector
11171 Emit extra code to check for buffer overflows, such as stack smashing
11172 attacks. This is done by adding a guard variable to functions with
11173 vulnerable objects. This includes functions that call @code{alloca}, and
11174 functions with buffers larger than 8 bytes. The guards are initialized
11175 when a function is entered and then checked when the function exits.
11176 If a guard check fails, an error message is printed and the program exits.
11177
11178 @item -fstack-protector-all
11179 @opindex fstack-protector-all
11180 Like @option{-fstack-protector} except that all functions are protected.
11181
11182 @item -fstack-protector-strong
11183 @opindex fstack-protector-strong
11184 Like @option{-fstack-protector} but includes additional functions to
11185 be protected --- those that have local array definitions, or have
11186 references to local frame addresses.
11187
11188 @item -fstack-protector-explicit
11189 @opindex fstack-protector-explicit
11190 Like @option{-fstack-protector} but only protects those functions which
11191 have the @code{stack_protect} attribute.
11192
11193 @item -fstack-check
11194 @opindex fstack-check
11195 Generate code to verify that you do not go beyond the boundary of the
11196 stack. You should specify this flag if you are running in an
11197 environment with multiple threads, but you only rarely need to specify it in
11198 a single-threaded environment since stack overflow is automatically
11199 detected on nearly all systems if there is only one stack.
11200
11201 Note that this switch does not actually cause checking to be done; the
11202 operating system or the language runtime must do that. The switch causes
11203 generation of code to ensure that they see the stack being extended.
11204
11205 You can additionally specify a string parameter: @samp{no} means no
11206 checking, @samp{generic} means force the use of old-style checking,
11207 @samp{specific} means use the best checking method and is equivalent
11208 to bare @option{-fstack-check}.
11209
11210 Old-style checking is a generic mechanism that requires no specific
11211 target support in the compiler but comes with the following drawbacks:
11212
11213 @enumerate
11214 @item
11215 Modified allocation strategy for large objects: they are always
11216 allocated dynamically if their size exceeds a fixed threshold.
11217
11218 @item
11219 Fixed limit on the size of the static frame of functions: when it is
11220 topped by a particular function, stack checking is not reliable and
11221 a warning is issued by the compiler.
11222
11223 @item
11224 Inefficiency: because of both the modified allocation strategy and the
11225 generic implementation, code performance is hampered.
11226 @end enumerate
11227
11228 Note that old-style stack checking is also the fallback method for
11229 @samp{specific} if no target support has been added in the compiler.
11230
11231 @item -fstack-limit-register=@var{reg}
11232 @itemx -fstack-limit-symbol=@var{sym}
11233 @itemx -fno-stack-limit
11234 @opindex fstack-limit-register
11235 @opindex fstack-limit-symbol
11236 @opindex fno-stack-limit
11237 Generate code to ensure that the stack does not grow beyond a certain value,
11238 either the value of a register or the address of a symbol. If a larger
11239 stack is required, a signal is raised at run time. For most targets,
11240 the signal is raised before the stack overruns the boundary, so
11241 it is possible to catch the signal without taking special precautions.
11242
11243 For instance, if the stack starts at absolute address @samp{0x80000000}
11244 and grows downwards, you can use the flags
11245 @option{-fstack-limit-symbol=__stack_limit} and
11246 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11247 of 128KB@. Note that this may only work with the GNU linker.
11248
11249 You can locally override stack limit checking by using the
11250 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11251
11252 @item -fsplit-stack
11253 @opindex fsplit-stack
11254 Generate code to automatically split the stack before it overflows.
11255 The resulting program has a discontiguous stack which can only
11256 overflow if the program is unable to allocate any more memory. This
11257 is most useful when running threaded programs, as it is no longer
11258 necessary to calculate a good stack size to use for each thread. This
11259 is currently only implemented for the x86 targets running
11260 GNU/Linux.
11261
11262 When code compiled with @option{-fsplit-stack} calls code compiled
11263 without @option{-fsplit-stack}, there may not be much stack space
11264 available for the latter code to run. If compiling all code,
11265 including library code, with @option{-fsplit-stack} is not an option,
11266 then the linker can fix up these calls so that the code compiled
11267 without @option{-fsplit-stack} always has a large stack. Support for
11268 this is implemented in the gold linker in GNU binutils release 2.21
11269 and later.
11270
11271 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
11272 @opindex fvtable-verify
11273 This option is only available when compiling C++ code.
11274 It turns on (or off, if using @option{-fvtable-verify=none}) the security
11275 feature that verifies at run time, for every virtual call, that
11276 the vtable pointer through which the call is made is valid for the type of
11277 the object, and has not been corrupted or overwritten. If an invalid vtable
11278 pointer is detected at run time, an error is reported and execution of the
11279 program is immediately halted.
11280
11281 This option causes run-time data structures to be built at program startup,
11282 which are used for verifying the vtable pointers.
11283 The options @samp{std} and @samp{preinit}
11284 control the timing of when these data structures are built. In both cases the
11285 data structures are built before execution reaches @code{main}. Using
11286 @option{-fvtable-verify=std} causes the data structures to be built after
11287 shared libraries have been loaded and initialized.
11288 @option{-fvtable-verify=preinit} causes them to be built before shared
11289 libraries have been loaded and initialized.
11290
11291 If this option appears multiple times in the command line with different
11292 values specified, @samp{none} takes highest priority over both @samp{std} and
11293 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
11294
11295 @item -fvtv-debug
11296 @opindex fvtv-debug
11297 When used in conjunction with @option{-fvtable-verify=std} or
11298 @option{-fvtable-verify=preinit}, causes debug versions of the
11299 runtime functions for the vtable verification feature to be called.
11300 This flag also causes the compiler to log information about which
11301 vtable pointers it finds for each class.
11302 This information is written to a file named @file{vtv_set_ptr_data.log}
11303 in the directory named by the environment variable @env{VTV_LOGS_DIR}
11304 if that is defined or the current working directory otherwise.
11305
11306 Note: This feature @emph{appends} data to the log file. If you want a fresh log
11307 file, be sure to delete any existing one.
11308
11309 @item -fvtv-counts
11310 @opindex fvtv-counts
11311 This is a debugging flag. When used in conjunction with
11312 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
11313 causes the compiler to keep track of the total number of virtual calls
11314 it encounters and the number of verifications it inserts. It also
11315 counts the number of calls to certain run-time library functions
11316 that it inserts and logs this information for each compilation unit.
11317 The compiler writes this information to a file named
11318 @file{vtv_count_data.log} in the directory named by the environment
11319 variable @env{VTV_LOGS_DIR} if that is defined or the current working
11320 directory otherwise. It also counts the size of the vtable pointer sets
11321 for each class, and writes this information to @file{vtv_class_set_sizes.log}
11322 in the same directory.
11323
11324 Note: This feature @emph{appends} data to the log files. To get fresh log
11325 files, be sure to delete any existing ones.
11326
11327 @item -finstrument-functions
11328 @opindex finstrument-functions
11329 Generate instrumentation calls for entry and exit to functions. Just
11330 after function entry and just before function exit, the following
11331 profiling functions are called with the address of the current
11332 function and its call site. (On some platforms,
11333 @code{__builtin_return_address} does not work beyond the current
11334 function, so the call site information may not be available to the
11335 profiling functions otherwise.)
11336
11337 @smallexample
11338 void __cyg_profile_func_enter (void *this_fn,
11339 void *call_site);
11340 void __cyg_profile_func_exit (void *this_fn,
11341 void *call_site);
11342 @end smallexample
11343
11344 The first argument is the address of the start of the current function,
11345 which may be looked up exactly in the symbol table.
11346
11347 This instrumentation is also done for functions expanded inline in other
11348 functions. The profiling calls indicate where, conceptually, the
11349 inline function is entered and exited. This means that addressable
11350 versions of such functions must be available. If all your uses of a
11351 function are expanded inline, this may mean an additional expansion of
11352 code size. If you use @code{extern inline} in your C code, an
11353 addressable version of such functions must be provided. (This is
11354 normally the case anyway, but if you get lucky and the optimizer always
11355 expands the functions inline, you might have gotten away without
11356 providing static copies.)
11357
11358 A function may be given the attribute @code{no_instrument_function}, in
11359 which case this instrumentation is not done. This can be used, for
11360 example, for the profiling functions listed above, high-priority
11361 interrupt routines, and any functions from which the profiling functions
11362 cannot safely be called (perhaps signal handlers, if the profiling
11363 routines generate output or allocate memory).
11364
11365 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
11366 @opindex finstrument-functions-exclude-file-list
11367
11368 Set the list of functions that are excluded from instrumentation (see
11369 the description of @option{-finstrument-functions}). If the file that
11370 contains a function definition matches with one of @var{file}, then
11371 that function is not instrumented. The match is done on substrings:
11372 if the @var{file} parameter is a substring of the file name, it is
11373 considered to be a match.
11374
11375 For example:
11376
11377 @smallexample
11378 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
11379 @end smallexample
11380
11381 @noindent
11382 excludes any inline function defined in files whose pathnames
11383 contain @file{/bits/stl} or @file{include/sys}.
11384
11385 If, for some reason, you want to include letter @samp{,} in one of
11386 @var{sym}, write @samp{\,}. For example,
11387 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
11388 (note the single quote surrounding the option).
11389
11390 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
11391 @opindex finstrument-functions-exclude-function-list
11392
11393 This is similar to @option{-finstrument-functions-exclude-file-list},
11394 but this option sets the list of function names to be excluded from
11395 instrumentation. The function name to be matched is its user-visible
11396 name, such as @code{vector<int> blah(const vector<int> &)}, not the
11397 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
11398 match is done on substrings: if the @var{sym} parameter is a substring
11399 of the function name, it is considered to be a match. For C99 and C++
11400 extended identifiers, the function name must be given in UTF-8, not
11401 using universal character names.
11402
11403 @end table
11404
11405
11406 @node Preprocessor Options
11407 @section Options Controlling the Preprocessor
11408 @cindex preprocessor options
11409 @cindex options, preprocessor
11410
11411 These options control the C preprocessor, which is run on each C source
11412 file before actual compilation.
11413
11414 If you use the @option{-E} option, nothing is done except preprocessing.
11415 Some of these options make sense only together with @option{-E} because
11416 they cause the preprocessor output to be unsuitable for actual
11417 compilation.
11418
11419 In addition to the options listed here, there are a number of options
11420 to control search paths for include files documented in
11421 @ref{Directory Options}.
11422 Options to control preprocessor diagnostics are listed in
11423 @ref{Warning Options}.
11424
11425 @table @gcctabopt
11426 @include cppopts.texi
11427
11428 @item -Wp,@var{option}
11429 @opindex Wp
11430 You can use @option{-Wp,@var{option}} to bypass the compiler driver
11431 and pass @var{option} directly through to the preprocessor. If
11432 @var{option} contains commas, it is split into multiple options at the
11433 commas. However, many options are modified, translated or interpreted
11434 by the compiler driver before being passed to the preprocessor, and
11435 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
11436 interface is undocumented and subject to change, so whenever possible
11437 you should avoid using @option{-Wp} and let the driver handle the
11438 options instead.
11439
11440 @item -Xpreprocessor @var{option}
11441 @opindex Xpreprocessor
11442 Pass @var{option} as an option to the preprocessor. You can use this to
11443 supply system-specific preprocessor options that GCC does not
11444 recognize.
11445
11446 If you want to pass an option that takes an argument, you must use
11447 @option{-Xpreprocessor} twice, once for the option and once for the argument.
11448
11449 @item -no-integrated-cpp
11450 @opindex no-integrated-cpp
11451 Perform preprocessing as a separate pass before compilation.
11452 By default, GCC performs preprocessing as an integrated part of
11453 input tokenization and parsing.
11454 If this option is provided, the appropriate language front end
11455 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
11456 and Objective-C, respectively) is instead invoked twice,
11457 once for preprocessing only and once for actual compilation
11458 of the preprocessed input.
11459 This option may be useful in conjunction with the @option{-B} or
11460 @option{-wrapper} options to specify an alternate preprocessor or
11461 perform additional processing of the program source between
11462 normal preprocessing and compilation.
11463
11464 @end table
11465
11466 @node Assembler Options
11467 @section Passing Options to the Assembler
11468
11469 @c prevent bad page break with this line
11470 You can pass options to the assembler.
11471
11472 @table @gcctabopt
11473 @item -Wa,@var{option}
11474 @opindex Wa
11475 Pass @var{option} as an option to the assembler. If @var{option}
11476 contains commas, it is split into multiple options at the commas.
11477
11478 @item -Xassembler @var{option}
11479 @opindex Xassembler
11480 Pass @var{option} as an option to the assembler. You can use this to
11481 supply system-specific assembler options that GCC does not
11482 recognize.
11483
11484 If you want to pass an option that takes an argument, you must use
11485 @option{-Xassembler} twice, once for the option and once for the argument.
11486
11487 @end table
11488
11489 @node Link Options
11490 @section Options for Linking
11491 @cindex link options
11492 @cindex options, linking
11493
11494 These options come into play when the compiler links object files into
11495 an executable output file. They are meaningless if the compiler is
11496 not doing a link step.
11497
11498 @table @gcctabopt
11499 @cindex file names
11500 @item @var{object-file-name}
11501 A file name that does not end in a special recognized suffix is
11502 considered to name an object file or library. (Object files are
11503 distinguished from libraries by the linker according to the file
11504 contents.) If linking is done, these object files are used as input
11505 to the linker.
11506
11507 @item -c
11508 @itemx -S
11509 @itemx -E
11510 @opindex c
11511 @opindex S
11512 @opindex E
11513 If any of these options is used, then the linker is not run, and
11514 object file names should not be used as arguments. @xref{Overall
11515 Options}.
11516
11517 @item -fuse-ld=bfd
11518 @opindex fuse-ld=bfd
11519 Use the @command{bfd} linker instead of the default linker.
11520
11521 @item -fuse-ld=gold
11522 @opindex fuse-ld=gold
11523 Use the @command{gold} linker instead of the default linker.
11524
11525 @cindex Libraries
11526 @item -l@var{library}
11527 @itemx -l @var{library}
11528 @opindex l
11529 Search the library named @var{library} when linking. (The second
11530 alternative with the library as a separate argument is only for
11531 POSIX compliance and is not recommended.)
11532
11533 It makes a difference where in the command you write this option; the
11534 linker searches and processes libraries and object files in the order they
11535 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
11536 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
11537 to functions in @samp{z}, those functions may not be loaded.
11538
11539 The linker searches a standard list of directories for the library,
11540 which is actually a file named @file{lib@var{library}.a}. The linker
11541 then uses this file as if it had been specified precisely by name.
11542
11543 The directories searched include several standard system directories
11544 plus any that you specify with @option{-L}.
11545
11546 Normally the files found this way are library files---archive files
11547 whose members are object files. The linker handles an archive file by
11548 scanning through it for members which define symbols that have so far
11549 been referenced but not defined. But if the file that is found is an
11550 ordinary object file, it is linked in the usual fashion. The only
11551 difference between using an @option{-l} option and specifying a file name
11552 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
11553 and searches several directories.
11554
11555 @item -lobjc
11556 @opindex lobjc
11557 You need this special case of the @option{-l} option in order to
11558 link an Objective-C or Objective-C++ program.
11559
11560 @item -nostartfiles
11561 @opindex nostartfiles
11562 Do not use the standard system startup files when linking.
11563 The standard system libraries are used normally, unless @option{-nostdlib}
11564 or @option{-nodefaultlibs} is used.
11565
11566 @item -nodefaultlibs
11567 @opindex nodefaultlibs
11568 Do not use the standard system libraries when linking.
11569 Only the libraries you specify are passed to the linker, and options
11570 specifying linkage of the system libraries, such as @option{-static-libgcc}
11571 or @option{-shared-libgcc}, are ignored.
11572 The standard startup files are used normally, unless @option{-nostartfiles}
11573 is used.
11574
11575 The compiler may generate calls to @code{memcmp},
11576 @code{memset}, @code{memcpy} and @code{memmove}.
11577 These entries are usually resolved by entries in
11578 libc. These entry points should be supplied through some other
11579 mechanism when this option is specified.
11580
11581 @item -nostdlib
11582 @opindex nostdlib
11583 Do not use the standard system startup files or libraries when linking.
11584 No startup files and only the libraries you specify are passed to
11585 the linker, and options specifying linkage of the system libraries, such as
11586 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
11587
11588 The compiler may generate calls to @code{memcmp}, @code{memset},
11589 @code{memcpy} and @code{memmove}.
11590 These entries are usually resolved by entries in
11591 libc. These entry points should be supplied through some other
11592 mechanism when this option is specified.
11593
11594 @cindex @option{-lgcc}, use with @option{-nostdlib}
11595 @cindex @option{-nostdlib} and unresolved references
11596 @cindex unresolved references and @option{-nostdlib}
11597 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
11598 @cindex @option{-nodefaultlibs} and unresolved references
11599 @cindex unresolved references and @option{-nodefaultlibs}
11600 One of the standard libraries bypassed by @option{-nostdlib} and
11601 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
11602 which GCC uses to overcome shortcomings of particular machines, or special
11603 needs for some languages.
11604 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
11605 Collection (GCC) Internals},
11606 for more discussion of @file{libgcc.a}.)
11607 In most cases, you need @file{libgcc.a} even when you want to avoid
11608 other standard libraries. In other words, when you specify @option{-nostdlib}
11609 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
11610 This ensures that you have no unresolved references to internal GCC
11611 library subroutines.
11612 (An example of such an internal subroutine is @code{__main}, used to ensure C++
11613 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
11614 GNU Compiler Collection (GCC) Internals}.)
11615
11616 @item -pie
11617 @opindex pie
11618 Produce a position independent executable on targets that support it.
11619 For predictable results, you must also specify the same set of options
11620 used for compilation (@option{-fpie}, @option{-fPIE},
11621 or model suboptions) when you specify this linker option.
11622
11623 @item -no-pie
11624 @opindex no-pie
11625 Don't produce a position independent executable.
11626
11627 @item -pthread
11628 @opindex pthread
11629 Link with the POSIX threads library. This option is supported on
11630 GNU/Linux targets, most other Unix derivatives, and also on
11631 x86 Cygwin and MinGW targets. On some targets this option also sets
11632 flags for the preprocessor, so it should be used consistently for both
11633 compilation and linking.
11634
11635 @item -rdynamic
11636 @opindex rdynamic
11637 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
11638 that support it. This instructs the linker to add all symbols, not
11639 only used ones, to the dynamic symbol table. This option is needed
11640 for some uses of @code{dlopen} or to allow obtaining backtraces
11641 from within a program.
11642
11643 @item -s
11644 @opindex s
11645 Remove all symbol table and relocation information from the executable.
11646
11647 @item -static
11648 @opindex static
11649 On systems that support dynamic linking, this prevents linking with the shared
11650 libraries. On other systems, this option has no effect.
11651
11652 @item -shared
11653 @opindex shared
11654 Produce a shared object which can then be linked with other objects to
11655 form an executable. Not all systems support this option. For predictable
11656 results, you must also specify the same set of options used for compilation
11657 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
11658 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
11659 needs to build supplementary stub code for constructors to work. On
11660 multi-libbed systems, @samp{gcc -shared} must select the correct support
11661 libraries to link against. Failing to supply the correct flags may lead
11662 to subtle defects. Supplying them in cases where they are not necessary
11663 is innocuous.}
11664
11665 @item -shared-libgcc
11666 @itemx -static-libgcc
11667 @opindex shared-libgcc
11668 @opindex static-libgcc
11669 On systems that provide @file{libgcc} as a shared library, these options
11670 force the use of either the shared or static version, respectively.
11671 If no shared version of @file{libgcc} was built when the compiler was
11672 configured, these options have no effect.
11673
11674 There are several situations in which an application should use the
11675 shared @file{libgcc} instead of the static version. The most common
11676 of these is when the application wishes to throw and catch exceptions
11677 across different shared libraries. In that case, each of the libraries
11678 as well as the application itself should use the shared @file{libgcc}.
11679
11680 Therefore, the G++ and driver automatically adds @option{-shared-libgcc}
11681 whenever you build a shared library or a main executable, because C++
11682 programs typically use exceptions, so this is the right thing to do.
11683
11684 If, instead, you use the GCC driver to create shared libraries, you may
11685 find that they are not always linked with the shared @file{libgcc}.
11686 If GCC finds, at its configuration time, that you have a non-GNU linker
11687 or a GNU linker that does not support option @option{--eh-frame-hdr},
11688 it links the shared version of @file{libgcc} into shared libraries
11689 by default. Otherwise, it takes advantage of the linker and optimizes
11690 away the linking with the shared version of @file{libgcc}, linking with
11691 the static version of libgcc by default. This allows exceptions to
11692 propagate through such shared libraries, without incurring relocation
11693 costs at library load time.
11694
11695 However, if a library or main executable is supposed to throw or catch
11696 exceptions, you must link it using the G++ driver, as appropriate
11697 for the languages used in the program, or using the option
11698 @option{-shared-libgcc}, such that it is linked with the shared
11699 @file{libgcc}.
11700
11701 @item -static-libasan
11702 @opindex static-libasan
11703 When the @option{-fsanitize=address} option is used to link a program,
11704 the GCC driver automatically links against @option{libasan}. If
11705 @file{libasan} is available as a shared library, and the @option{-static}
11706 option is not used, then this links against the shared version of
11707 @file{libasan}. The @option{-static-libasan} option directs the GCC
11708 driver to link @file{libasan} statically, without necessarily linking
11709 other libraries statically.
11710
11711 @item -static-libtsan
11712 @opindex static-libtsan
11713 When the @option{-fsanitize=thread} option is used to link a program,
11714 the GCC driver automatically links against @option{libtsan}. If
11715 @file{libtsan} is available as a shared library, and the @option{-static}
11716 option is not used, then this links against the shared version of
11717 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
11718 driver to link @file{libtsan} statically, without necessarily linking
11719 other libraries statically.
11720
11721 @item -static-liblsan
11722 @opindex static-liblsan
11723 When the @option{-fsanitize=leak} option is used to link a program,
11724 the GCC driver automatically links against @option{liblsan}. If
11725 @file{liblsan} is available as a shared library, and the @option{-static}
11726 option is not used, then this links against the shared version of
11727 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
11728 driver to link @file{liblsan} statically, without necessarily linking
11729 other libraries statically.
11730
11731 @item -static-libubsan
11732 @opindex static-libubsan
11733 When the @option{-fsanitize=undefined} option is used to link a program,
11734 the GCC driver automatically links against @option{libubsan}. If
11735 @file{libubsan} is available as a shared library, and the @option{-static}
11736 option is not used, then this links against the shared version of
11737 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
11738 driver to link @file{libubsan} statically, without necessarily linking
11739 other libraries statically.
11740
11741 @item -static-libmpx
11742 @opindex static-libmpx
11743 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
11744 used to link a program, the GCC driver automatically links against
11745 @file{libmpx}. If @file{libmpx} is available as a shared library,
11746 and the @option{-static} option is not used, then this links against
11747 the shared version of @file{libmpx}. The @option{-static-libmpx}
11748 option directs the GCC driver to link @file{libmpx} statically,
11749 without necessarily linking other libraries statically.
11750
11751 @item -static-libmpxwrappers
11752 @opindex static-libmpxwrappers
11753 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
11754 to link a program without also using @option{-fno-chkp-use-wrappers}, the
11755 GCC driver automatically links against @file{libmpxwrappers}. If
11756 @file{libmpxwrappers} is available as a shared library, and the
11757 @option{-static} option is not used, then this links against the shared
11758 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
11759 option directs the GCC driver to link @file{libmpxwrappers} statically,
11760 without necessarily linking other libraries statically.
11761
11762 @item -static-libstdc++
11763 @opindex static-libstdc++
11764 When the @command{g++} program is used to link a C++ program, it
11765 normally automatically links against @option{libstdc++}. If
11766 @file{libstdc++} is available as a shared library, and the
11767 @option{-static} option is not used, then this links against the
11768 shared version of @file{libstdc++}. That is normally fine. However, it
11769 is sometimes useful to freeze the version of @file{libstdc++} used by
11770 the program without going all the way to a fully static link. The
11771 @option{-static-libstdc++} option directs the @command{g++} driver to
11772 link @file{libstdc++} statically, without necessarily linking other
11773 libraries statically.
11774
11775 @item -symbolic
11776 @opindex symbolic
11777 Bind references to global symbols when building a shared object. Warn
11778 about any unresolved references (unless overridden by the link editor
11779 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
11780 this option.
11781
11782 @item -T @var{script}
11783 @opindex T
11784 @cindex linker script
11785 Use @var{script} as the linker script. This option is supported by most
11786 systems using the GNU linker. On some targets, such as bare-board
11787 targets without an operating system, the @option{-T} option may be required
11788 when linking to avoid references to undefined symbols.
11789
11790 @item -Xlinker @var{option}
11791 @opindex Xlinker
11792 Pass @var{option} as an option to the linker. You can use this to
11793 supply system-specific linker options that GCC does not recognize.
11794
11795 If you want to pass an option that takes a separate argument, you must use
11796 @option{-Xlinker} twice, once for the option and once for the argument.
11797 For example, to pass @option{-assert definitions}, you must write
11798 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
11799 @option{-Xlinker "-assert definitions"}, because this passes the entire
11800 string as a single argument, which is not what the linker expects.
11801
11802 When using the GNU linker, it is usually more convenient to pass
11803 arguments to linker options using the @option{@var{option}=@var{value}}
11804 syntax than as separate arguments. For example, you can specify
11805 @option{-Xlinker -Map=output.map} rather than
11806 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
11807 this syntax for command-line options.
11808
11809 @item -Wl,@var{option}
11810 @opindex Wl
11811 Pass @var{option} as an option to the linker. If @var{option} contains
11812 commas, it is split into multiple options at the commas. You can use this
11813 syntax to pass an argument to the option.
11814 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
11815 linker. When using the GNU linker, you can also get the same effect with
11816 @option{-Wl,-Map=output.map}.
11817
11818 @item -u @var{symbol}
11819 @opindex u
11820 Pretend the symbol @var{symbol} is undefined, to force linking of
11821 library modules to define it. You can use @option{-u} multiple times with
11822 different symbols to force loading of additional library modules.
11823
11824 @item -z @var{keyword}
11825 @opindex z
11826 @option{-z} is passed directly on to the linker along with the keyword
11827 @var{keyword}. See the section in the documentation of your linker for
11828 permitted values and their meanings.
11829 @end table
11830
11831 @node Directory Options
11832 @section Options for Directory Search
11833 @cindex directory options
11834 @cindex options, directory search
11835 @cindex search path
11836
11837 These options specify directories to search for header files, for
11838 libraries and for parts of the compiler:
11839
11840 @table @gcctabopt
11841 @include cppdiropts.texi
11842
11843 @item -iplugindir=@var{dir}
11844 @opindex iplugindir=
11845 Set the directory to search for plugins that are passed
11846 by @option{-fplugin=@var{name}} instead of
11847 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
11848 to be used by the user, but only passed by the driver.
11849
11850 @item -L@var{dir}
11851 @opindex L
11852 Add directory @var{dir} to the list of directories to be searched
11853 for @option{-l}.
11854
11855 @item -B@var{prefix}
11856 @opindex B
11857 This option specifies where to find the executables, libraries,
11858 include files, and data files of the compiler itself.
11859
11860 The compiler driver program runs one or more of the subprograms
11861 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
11862 @var{prefix} as a prefix for each program it tries to run, both with and
11863 without @samp{@var{machine}/@var{version}/} for the corresponding target
11864 machine and compiler version.
11865
11866 For each subprogram to be run, the compiler driver first tries the
11867 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
11868 is not specified, the driver tries two standard prefixes,
11869 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
11870 those results in a file name that is found, the unmodified program
11871 name is searched for using the directories specified in your
11872 @env{PATH} environment variable.
11873
11874 The compiler checks to see if the path provided by @option{-B}
11875 refers to a directory, and if necessary it adds a directory
11876 separator character at the end of the path.
11877
11878 @option{-B} prefixes that effectively specify directory names also apply
11879 to libraries in the linker, because the compiler translates these
11880 options into @option{-L} options for the linker. They also apply to
11881 include files in the preprocessor, because the compiler translates these
11882 options into @option{-isystem} options for the preprocessor. In this case,
11883 the compiler appends @samp{include} to the prefix.
11884
11885 The runtime support file @file{libgcc.a} can also be searched for using
11886 the @option{-B} prefix, if needed. If it is not found there, the two
11887 standard prefixes above are tried, and that is all. The file is left
11888 out of the link if it is not found by those means.
11889
11890 Another way to specify a prefix much like the @option{-B} prefix is to use
11891 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
11892 Variables}.
11893
11894 As a special kludge, if the path provided by @option{-B} is
11895 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
11896 9, then it is replaced by @file{[dir/]include}. This is to help
11897 with boot-strapping the compiler.
11898
11899 @item -no-canonical-prefixes
11900 @opindex no-canonical-prefixes
11901 Do not expand any symbolic links, resolve references to @samp{/../}
11902 or @samp{/./}, or make the path absolute when generating a relative
11903 prefix.
11904
11905 @item --sysroot=@var{dir}
11906 @opindex sysroot
11907 Use @var{dir} as the logical root directory for headers and libraries.
11908 For example, if the compiler normally searches for headers in
11909 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
11910 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
11911
11912 If you use both this option and the @option{-isysroot} option, then
11913 the @option{--sysroot} option applies to libraries, but the
11914 @option{-isysroot} option applies to header files.
11915
11916 The GNU linker (beginning with version 2.16) has the necessary support
11917 for this option. If your linker does not support this option, the
11918 header file aspect of @option{--sysroot} still works, but the
11919 library aspect does not.
11920
11921 @item --no-sysroot-suffix
11922 @opindex no-sysroot-suffix
11923 For some targets, a suffix is added to the root directory specified
11924 with @option{--sysroot}, depending on the other options used, so that
11925 headers may for example be found in
11926 @file{@var{dir}/@var{suffix}/usr/include} instead of
11927 @file{@var{dir}/usr/include}. This option disables the addition of
11928 such a suffix.
11929
11930 @end table
11931
11932 @node Code Gen Options
11933 @section Options for Code Generation Conventions
11934 @cindex code generation conventions
11935 @cindex options, code generation
11936 @cindex run-time options
11937
11938 These machine-independent options control the interface conventions
11939 used in code generation.
11940
11941 Most of them have both positive and negative forms; the negative form
11942 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
11943 one of the forms is listed---the one that is not the default. You
11944 can figure out the other form by either removing @samp{no-} or adding
11945 it.
11946
11947 @table @gcctabopt
11948 @item -fstack-reuse=@var{reuse-level}
11949 @opindex fstack_reuse
11950 This option controls stack space reuse for user declared local/auto variables
11951 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
11952 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
11953 local variables and temporaries, @samp{named_vars} enables the reuse only for
11954 user defined local variables with names, and @samp{none} disables stack reuse
11955 completely. The default value is @samp{all}. The option is needed when the
11956 program extends the lifetime of a scoped local variable or a compiler generated
11957 temporary beyond the end point defined by the language. When a lifetime of
11958 a variable ends, and if the variable lives in memory, the optimizing compiler
11959 has the freedom to reuse its stack space with other temporaries or scoped
11960 local variables whose live range does not overlap with it. Legacy code extending
11961 local lifetime is likely to break with the stack reuse optimization.
11962
11963 For example,
11964
11965 @smallexample
11966 int *p;
11967 @{
11968 int local1;
11969
11970 p = &local1;
11971 local1 = 10;
11972 ....
11973 @}
11974 @{
11975 int local2;
11976 local2 = 20;
11977 ...
11978 @}
11979
11980 if (*p == 10) // out of scope use of local1
11981 @{
11982
11983 @}
11984 @end smallexample
11985
11986 Another example:
11987 @smallexample
11988
11989 struct A
11990 @{
11991 A(int k) : i(k), j(k) @{ @}
11992 int i;
11993 int j;
11994 @};
11995
11996 A *ap;
11997
11998 void foo(const A& ar)
11999 @{
12000 ap = &ar;
12001 @}
12002
12003 void bar()
12004 @{
12005 foo(A(10)); // temp object's lifetime ends when foo returns
12006
12007 @{
12008 A a(20);
12009 ....
12010 @}
12011 ap->i+= 10; // ap references out of scope temp whose space
12012 // is reused with a. What is the value of ap->i?
12013 @}
12014
12015 @end smallexample
12016
12017 The lifetime of a compiler generated temporary is well defined by the C++
12018 standard. When a lifetime of a temporary ends, and if the temporary lives
12019 in memory, the optimizing compiler has the freedom to reuse its stack
12020 space with other temporaries or scoped local variables whose live range
12021 does not overlap with it. However some of the legacy code relies on
12022 the behavior of older compilers in which temporaries' stack space is
12023 not reused, the aggressive stack reuse can lead to runtime errors. This
12024 option is used to control the temporary stack reuse optimization.
12025
12026 @item -ftrapv
12027 @opindex ftrapv
12028 This option generates traps for signed overflow on addition, subtraction,
12029 multiplication operations.
12030 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12031 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12032 @option{-fwrapv} being effective. Note that only active options override, so
12033 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12034 results in @option{-ftrapv} being effective.
12035
12036 @item -fwrapv
12037 @opindex fwrapv
12038 This option instructs the compiler to assume that signed arithmetic
12039 overflow of addition, subtraction and multiplication wraps around
12040 using twos-complement representation. This flag enables some optimizations
12041 and disables others.
12042 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12043 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12044 @option{-fwrapv} being effective. Note that only active options override, so
12045 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12046 results in @option{-ftrapv} being effective.
12047
12048 @item -fexceptions
12049 @opindex fexceptions
12050 Enable exception handling. Generates extra code needed to propagate
12051 exceptions. For some targets, this implies GCC generates frame
12052 unwind information for all functions, which can produce significant data
12053 size overhead, although it does not affect execution. If you do not
12054 specify this option, GCC enables it by default for languages like
12055 C++ that normally require exception handling, and disables it for
12056 languages like C that do not normally require it. However, you may need
12057 to enable this option when compiling C code that needs to interoperate
12058 properly with exception handlers written in C++. You may also wish to
12059 disable this option if you are compiling older C++ programs that don't
12060 use exception handling.
12061
12062 @item -fnon-call-exceptions
12063 @opindex fnon-call-exceptions
12064 Generate code that allows trapping instructions to throw exceptions.
12065 Note that this requires platform-specific runtime support that does
12066 not exist everywhere. Moreover, it only allows @emph{trapping}
12067 instructions to throw exceptions, i.e.@: memory references or floating-point
12068 instructions. It does not allow exceptions to be thrown from
12069 arbitrary signal handlers such as @code{SIGALRM}.
12070
12071 @item -fdelete-dead-exceptions
12072 @opindex fdelete-dead-exceptions
12073 Consider that instructions that may throw exceptions but don't otherwise
12074 contribute to the execution of the program can be optimized away.
12075 This option is enabled by default for the Ada front end, as permitted by
12076 the Ada language specification.
12077 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
12078
12079 @item -funwind-tables
12080 @opindex funwind-tables
12081 Similar to @option{-fexceptions}, except that it just generates any needed
12082 static data, but does not affect the generated code in any other way.
12083 You normally do not need to enable this option; instead, a language processor
12084 that needs this handling enables it on your behalf.
12085
12086 @item -fasynchronous-unwind-tables
12087 @opindex fasynchronous-unwind-tables
12088 Generate unwind table in DWARF format, if supported by target machine. The
12089 table is exact at each instruction boundary, so it can be used for stack
12090 unwinding from asynchronous events (such as debugger or garbage collector).
12091
12092 @item -fno-gnu-unique
12093 @opindex fno-gnu-unique
12094 On systems with recent GNU assembler and C library, the C++ compiler
12095 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
12096 of template static data members and static local variables in inline
12097 functions are unique even in the presence of @code{RTLD_LOCAL}; this
12098 is necessary to avoid problems with a library used by two different
12099 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
12100 therefore disagreeing with the other one about the binding of the
12101 symbol. But this causes @code{dlclose} to be ignored for affected
12102 DSOs; if your program relies on reinitialization of a DSO via
12103 @code{dlclose} and @code{dlopen}, you can use
12104 @option{-fno-gnu-unique}.
12105
12106 @item -fpcc-struct-return
12107 @opindex fpcc-struct-return
12108 Return ``short'' @code{struct} and @code{union} values in memory like
12109 longer ones, rather than in registers. This convention is less
12110 efficient, but it has the advantage of allowing intercallability between
12111 GCC-compiled files and files compiled with other compilers, particularly
12112 the Portable C Compiler (pcc).
12113
12114 The precise convention for returning structures in memory depends
12115 on the target configuration macros.
12116
12117 Short structures and unions are those whose size and alignment match
12118 that of some integer type.
12119
12120 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
12121 switch is not binary compatible with code compiled with the
12122 @option{-freg-struct-return} switch.
12123 Use it to conform to a non-default application binary interface.
12124
12125 @item -freg-struct-return
12126 @opindex freg-struct-return
12127 Return @code{struct} and @code{union} values in registers when possible.
12128 This is more efficient for small structures than
12129 @option{-fpcc-struct-return}.
12130
12131 If you specify neither @option{-fpcc-struct-return} nor
12132 @option{-freg-struct-return}, GCC defaults to whichever convention is
12133 standard for the target. If there is no standard convention, GCC
12134 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
12135 the principal compiler. In those cases, we can choose the standard, and
12136 we chose the more efficient register return alternative.
12137
12138 @strong{Warning:} code compiled with the @option{-freg-struct-return}
12139 switch is not binary compatible with code compiled with the
12140 @option{-fpcc-struct-return} switch.
12141 Use it to conform to a non-default application binary interface.
12142
12143 @item -fshort-enums
12144 @opindex fshort-enums
12145 Allocate to an @code{enum} type only as many bytes as it needs for the
12146 declared range of possible values. Specifically, the @code{enum} type
12147 is equivalent to the smallest integer type that has enough room.
12148
12149 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
12150 code that is not binary compatible with code generated without that switch.
12151 Use it to conform to a non-default application binary interface.
12152
12153 @item -fshort-wchar
12154 @opindex fshort-wchar
12155 Override the underlying type for @code{wchar_t} to be @code{short
12156 unsigned int} instead of the default for the target. This option is
12157 useful for building programs to run under WINE@.
12158
12159 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
12160 code that is not binary compatible with code generated without that switch.
12161 Use it to conform to a non-default application binary interface.
12162
12163 @item -fno-common
12164 @opindex fno-common
12165 @cindex tentative definitions
12166 In C code, this option controls the placement of global variables
12167 defined without an initializer, known as @dfn{tentative definitions}
12168 in the C standard. Tentative definitions are distinct from declarations
12169 of a variable with the @code{extern} keyword, which do not allocate storage.
12170
12171 Unix C compilers have traditionally allocated storage for
12172 uninitialized global variables in a common block. This allows the
12173 linker to resolve all tentative definitions of the same variable
12174 in different compilation units to the same object, or to a non-tentative
12175 definition.
12176 This is the behavior specified by @option{-fcommon}, and is the default for
12177 GCC on most targets.
12178 On the other hand, this behavior is not required by ISO
12179 C, and on some targets may carry a speed or code size penalty on
12180 variable references.
12181
12182 The @option{-fno-common} option specifies that the compiler should instead
12183 place uninitialized global variables in the data section of the object file.
12184 This inhibits the merging of tentative definitions by the linker so
12185 you get a multiple-definition error if the same
12186 variable is defined in more than one compilation unit.
12187 Compiling with @option{-fno-common} is useful on targets for which
12188 it provides better performance, or if you wish to verify that the
12189 program will work on other systems that always treat uninitialized
12190 variable definitions this way.
12191
12192 @item -fno-ident
12193 @opindex fno-ident
12194 Ignore the @code{#ident} directive.
12195
12196 @item -finhibit-size-directive
12197 @opindex finhibit-size-directive
12198 Don't output a @code{.size} assembler directive, or anything else that
12199 would cause trouble if the function is split in the middle, and the
12200 two halves are placed at locations far apart in memory. This option is
12201 used when compiling @file{crtstuff.c}; you should not need to use it
12202 for anything else.
12203
12204 @item -fverbose-asm
12205 @opindex fverbose-asm
12206 Put extra commentary information in the generated assembly code to
12207 make it more readable. This option is generally only of use to those
12208 who actually need to read the generated assembly code (perhaps while
12209 debugging the compiler itself).
12210
12211 @option{-fno-verbose-asm}, the default, causes the
12212 extra information to be omitted and is useful when comparing two assembler
12213 files.
12214
12215 The added comments include:
12216
12217 @itemize @bullet
12218
12219 @item
12220 information on the compiler version and command-line options,
12221
12222 @item
12223 the source code lines associated with the assembly instructions,
12224 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12225
12226 @item
12227 hints on which high-level expressions correspond to
12228 the various assembly instruction operands.
12229
12230 @end itemize
12231
12232 For example, given this C source file:
12233
12234 @smallexample
12235 int test (int n)
12236 @{
12237 int i;
12238 int total = 0;
12239
12240 for (i = 0; i < n; i++)
12241 total += i * i;
12242
12243 return total;
12244 @}
12245 @end smallexample
12246
12247 compiling to (x86_64) assembly via @option{-S} and emitting the result
12248 direct to stdout via @option{-o} @option{-}
12249
12250 @smallexample
12251 gcc -S test.c -fverbose-asm -Os -o -
12252 @end smallexample
12253
12254 gives output similar to this:
12255
12256 @smallexample
12257 .file "test.c"
12258 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12259 [...snip...]
12260 # options passed:
12261 [...snip...]
12262
12263 .text
12264 .globl test
12265 .type test, @@function
12266 test:
12267 .LFB0:
12268 .cfi_startproc
12269 # test.c:4: int total = 0;
12270 xorl %eax, %eax # <retval>
12271 # test.c:6: for (i = 0; i < n; i++)
12272 xorl %edx, %edx # i
12273 .L2:
12274 # test.c:6: for (i = 0; i < n; i++)
12275 cmpl %edi, %edx # n, i
12276 jge .L5 #,
12277 # test.c:7: total += i * i;
12278 movl %edx, %ecx # i, tmp92
12279 imull %edx, %ecx # i, tmp92
12280 # test.c:6: for (i = 0; i < n; i++)
12281 incl %edx # i
12282 # test.c:7: total += i * i;
12283 addl %ecx, %eax # tmp92, <retval>
12284 jmp .L2 #
12285 .L5:
12286 # test.c:10: @}
12287 ret
12288 .cfi_endproc
12289 .LFE0:
12290 .size test, .-test
12291 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
12292 .section .note.GNU-stack,"",@@progbits
12293 @end smallexample
12294
12295 The comments are intended for humans rather than machines and hence the
12296 precise format of the comments is subject to change.
12297
12298 @item -frecord-gcc-switches
12299 @opindex frecord-gcc-switches
12300 This switch causes the command line used to invoke the
12301 compiler to be recorded into the object file that is being created.
12302 This switch is only implemented on some targets and the exact format
12303 of the recording is target and binary file format dependent, but it
12304 usually takes the form of a section containing ASCII text. This
12305 switch is related to the @option{-fverbose-asm} switch, but that
12306 switch only records information in the assembler output file as
12307 comments, so it never reaches the object file.
12308 See also @option{-grecord-gcc-switches} for another
12309 way of storing compiler options into the object file.
12310
12311 @item -fpic
12312 @opindex fpic
12313 @cindex global offset table
12314 @cindex PIC
12315 Generate position-independent code (PIC) suitable for use in a shared
12316 library, if supported for the target machine. Such code accesses all
12317 constant addresses through a global offset table (GOT)@. The dynamic
12318 loader resolves the GOT entries when the program starts (the dynamic
12319 loader is not part of GCC; it is part of the operating system). If
12320 the GOT size for the linked executable exceeds a machine-specific
12321 maximum size, you get an error message from the linker indicating that
12322 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
12323 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
12324 on the m68k and RS/6000. The x86 has no such limit.)
12325
12326 Position-independent code requires special support, and therefore works
12327 only on certain machines. For the x86, GCC supports PIC for System V
12328 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
12329 position-independent.
12330
12331 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12332 are defined to 1.
12333
12334 @item -fPIC
12335 @opindex fPIC
12336 If supported for the target machine, emit position-independent code,
12337 suitable for dynamic linking and avoiding any limit on the size of the
12338 global offset table. This option makes a difference on AArch64, m68k,
12339 PowerPC and SPARC@.
12340
12341 Position-independent code requires special support, and therefore works
12342 only on certain machines.
12343
12344 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12345 are defined to 2.
12346
12347 @item -fpie
12348 @itemx -fPIE
12349 @opindex fpie
12350 @opindex fPIE
12351 These options are similar to @option{-fpic} and @option{-fPIC}, but
12352 generated position independent code can be only linked into executables.
12353 Usually these options are used when @option{-pie} GCC option is
12354 used during linking.
12355
12356 @option{-fpie} and @option{-fPIE} both define the macros
12357 @code{__pie__} and @code{__PIE__}. The macros have the value 1
12358 for @option{-fpie} and 2 for @option{-fPIE}.
12359
12360 @item -fno-plt
12361 @opindex fno-plt
12362 Do not use the PLT for external function calls in position-independent code.
12363 Instead, load the callee address at call sites from the GOT and branch to it.
12364 This leads to more efficient code by eliminating PLT stubs and exposing
12365 GOT loads to optimizations. On architectures such as 32-bit x86 where
12366 PLT stubs expect the GOT pointer in a specific register, this gives more
12367 register allocation freedom to the compiler.
12368 Lazy binding requires use of the PLT;
12369 with @option{-fno-plt} all external symbols are resolved at load time.
12370
12371 Alternatively, the function attribute @code{noplt} can be used to avoid calls
12372 through the PLT for specific external functions.
12373
12374 In position-dependent code, a few targets also convert calls to
12375 functions that are marked to not use the PLT to use the GOT instead.
12376
12377 @item -fno-jump-tables
12378 @opindex fno-jump-tables
12379 Do not use jump tables for switch statements even where it would be
12380 more efficient than other code generation strategies. This option is
12381 of use in conjunction with @option{-fpic} or @option{-fPIC} for
12382 building code that forms part of a dynamic linker and cannot
12383 reference the address of a jump table. On some targets, jump tables
12384 do not require a GOT and this option is not needed.
12385
12386 @item -ffixed-@var{reg}
12387 @opindex ffixed
12388 Treat the register named @var{reg} as a fixed register; generated code
12389 should never refer to it (except perhaps as a stack pointer, frame
12390 pointer or in some other fixed role).
12391
12392 @var{reg} must be the name of a register. The register names accepted
12393 are machine-specific and are defined in the @code{REGISTER_NAMES}
12394 macro in the machine description macro file.
12395
12396 This flag does not have a negative form, because it specifies a
12397 three-way choice.
12398
12399 @item -fcall-used-@var{reg}
12400 @opindex fcall-used
12401 Treat the register named @var{reg} as an allocable register that is
12402 clobbered by function calls. It may be allocated for temporaries or
12403 variables that do not live across a call. Functions compiled this way
12404 do not save and restore the register @var{reg}.
12405
12406 It is an error to use this flag with the frame pointer or stack pointer.
12407 Use of this flag for other registers that have fixed pervasive roles in
12408 the machine's execution model produces disastrous results.
12409
12410 This flag does not have a negative form, because it specifies a
12411 three-way choice.
12412
12413 @item -fcall-saved-@var{reg}
12414 @opindex fcall-saved
12415 Treat the register named @var{reg} as an allocable register saved by
12416 functions. It may be allocated even for temporaries or variables that
12417 live across a call. Functions compiled this way save and restore
12418 the register @var{reg} if they use it.
12419
12420 It is an error to use this flag with the frame pointer or stack pointer.
12421 Use of this flag for other registers that have fixed pervasive roles in
12422 the machine's execution model produces disastrous results.
12423
12424 A different sort of disaster results from the use of this flag for
12425 a register in which function values may be returned.
12426
12427 This flag does not have a negative form, because it specifies a
12428 three-way choice.
12429
12430 @item -fpack-struct[=@var{n}]
12431 @opindex fpack-struct
12432 Without a value specified, pack all structure members together without
12433 holes. When a value is specified (which must be a small power of two), pack
12434 structure members according to this value, representing the maximum
12435 alignment (that is, objects with default alignment requirements larger than
12436 this are output potentially unaligned at the next fitting location.
12437
12438 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
12439 code that is not binary compatible with code generated without that switch.
12440 Additionally, it makes the code suboptimal.
12441 Use it to conform to a non-default application binary interface.
12442
12443 @item -fleading-underscore
12444 @opindex fleading-underscore
12445 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
12446 change the way C symbols are represented in the object file. One use
12447 is to help link with legacy assembly code.
12448
12449 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
12450 generate code that is not binary compatible with code generated without that
12451 switch. Use it to conform to a non-default application binary interface.
12452 Not all targets provide complete support for this switch.
12453
12454 @item -ftls-model=@var{model}
12455 @opindex ftls-model
12456 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
12457 The @var{model} argument should be one of @samp{global-dynamic},
12458 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
12459 Note that the choice is subject to optimization: the compiler may use
12460 a more efficient model for symbols not visible outside of the translation
12461 unit, or if @option{-fpic} is not given on the command line.
12462
12463 The default without @option{-fpic} is @samp{initial-exec}; with
12464 @option{-fpic} the default is @samp{global-dynamic}.
12465
12466 @item -ftrampolines
12467 @opindex ftrampolines
12468 For targets that normally need trampolines for nested functions, always
12469 generate them instead of using descriptors. Otherwise, for targets that
12470 do not need them, like for example HP-PA or IA-64, do nothing.
12471
12472 A trampoline is a small piece of code that is created at run time on the
12473 stack when the address of a nested function is taken, and is used to call
12474 the nested function indirectly. Therefore, it requires the stack to be
12475 made executable in order for the program to work properly.
12476
12477 @option{-fno-trampolines} is enabled by default on a language by language
12478 basis to let the compiler avoid generating them, if it computes that this
12479 is safe, and replace them with descriptors. Descriptors are made up of data
12480 only, but the generated code must be prepared to deal with them. As of this
12481 writing, @option{-fno-trampolines} is enabled by default only for Ada.
12482
12483 Moreover, code compiled with @option{-ftrampolines} and code compiled with
12484 @option{-fno-trampolines} are not binary compatible if nested functions are
12485 present. This option must therefore be used on a program-wide basis and be
12486 manipulated with extreme care.
12487
12488 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
12489 @opindex fvisibility
12490 Set the default ELF image symbol visibility to the specified option---all
12491 symbols are marked with this unless overridden within the code.
12492 Using this feature can very substantially improve linking and
12493 load times of shared object libraries, produce more optimized
12494 code, provide near-perfect API export and prevent symbol clashes.
12495 It is @strong{strongly} recommended that you use this in any shared objects
12496 you distribute.
12497
12498 Despite the nomenclature, @samp{default} always means public; i.e.,
12499 available to be linked against from outside the shared object.
12500 @samp{protected} and @samp{internal} are pretty useless in real-world
12501 usage so the only other commonly used option is @samp{hidden}.
12502 The default if @option{-fvisibility} isn't specified is
12503 @samp{default}, i.e., make every symbol public.
12504
12505 A good explanation of the benefits offered by ensuring ELF
12506 symbols have the correct visibility is given by ``How To Write
12507 Shared Libraries'' by Ulrich Drepper (which can be found at
12508 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
12509 solution made possible by this option to marking things hidden when
12510 the default is public is to make the default hidden and mark things
12511 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
12512 and @code{__attribute__ ((visibility("default")))} instead of
12513 @code{__declspec(dllexport)} you get almost identical semantics with
12514 identical syntax. This is a great boon to those working with
12515 cross-platform projects.
12516
12517 For those adding visibility support to existing code, you may find
12518 @code{#pragma GCC visibility} of use. This works by you enclosing
12519 the declarations you wish to set visibility for with (for example)
12520 @code{#pragma GCC visibility push(hidden)} and
12521 @code{#pragma GCC visibility pop}.
12522 Bear in mind that symbol visibility should be viewed @strong{as
12523 part of the API interface contract} and thus all new code should
12524 always specify visibility when it is not the default; i.e., declarations
12525 only for use within the local DSO should @strong{always} be marked explicitly
12526 as hidden as so to avoid PLT indirection overheads---making this
12527 abundantly clear also aids readability and self-documentation of the code.
12528 Note that due to ISO C++ specification requirements, @code{operator new} and
12529 @code{operator delete} must always be of default visibility.
12530
12531 Be aware that headers from outside your project, in particular system
12532 headers and headers from any other library you use, may not be
12533 expecting to be compiled with visibility other than the default. You
12534 may need to explicitly say @code{#pragma GCC visibility push(default)}
12535 before including any such headers.
12536
12537 @code{extern} declarations are not affected by @option{-fvisibility}, so
12538 a lot of code can be recompiled with @option{-fvisibility=hidden} with
12539 no modifications. However, this means that calls to @code{extern}
12540 functions with no explicit visibility use the PLT, so it is more
12541 effective to use @code{__attribute ((visibility))} and/or
12542 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
12543 declarations should be treated as hidden.
12544
12545 Note that @option{-fvisibility} does affect C++ vague linkage
12546 entities. This means that, for instance, an exception class that is
12547 be thrown between DSOs must be explicitly marked with default
12548 visibility so that the @samp{type_info} nodes are unified between
12549 the DSOs.
12550
12551 An overview of these techniques, their benefits and how to use them
12552 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
12553
12554 @item -fstrict-volatile-bitfields
12555 @opindex fstrict-volatile-bitfields
12556 This option should be used if accesses to volatile bit-fields (or other
12557 structure fields, although the compiler usually honors those types
12558 anyway) should use a single access of the width of the
12559 field's type, aligned to a natural alignment if possible. For
12560 example, targets with memory-mapped peripheral registers might require
12561 all such accesses to be 16 bits wide; with this flag you can
12562 declare all peripheral bit-fields as @code{unsigned short} (assuming short
12563 is 16 bits on these targets) to force GCC to use 16-bit accesses
12564 instead of, perhaps, a more efficient 32-bit access.
12565
12566 If this option is disabled, the compiler uses the most efficient
12567 instruction. In the previous example, that might be a 32-bit load
12568 instruction, even though that accesses bytes that do not contain
12569 any portion of the bit-field, or memory-mapped registers unrelated to
12570 the one being updated.
12571
12572 In some cases, such as when the @code{packed} attribute is applied to a
12573 structure field, it may not be possible to access the field with a single
12574 read or write that is correctly aligned for the target machine. In this
12575 case GCC falls back to generating multiple accesses rather than code that
12576 will fault or truncate the result at run time.
12577
12578 Note: Due to restrictions of the C/C++11 memory model, write accesses are
12579 not allowed to touch non bit-field members. It is therefore recommended
12580 to define all bits of the field's type as bit-field members.
12581
12582 The default value of this option is determined by the application binary
12583 interface for the target processor.
12584
12585 @item -fsync-libcalls
12586 @opindex fsync-libcalls
12587 This option controls whether any out-of-line instance of the @code{__sync}
12588 family of functions may be used to implement the C++11 @code{__atomic}
12589 family of functions.
12590
12591 The default value of this option is enabled, thus the only useful form
12592 of the option is @option{-fno-sync-libcalls}. This option is used in
12593 the implementation of the @file{libatomic} runtime library.
12594
12595 @end table
12596
12597 @node Developer Options
12598 @section GCC Developer Options
12599 @cindex developer options
12600 @cindex debugging GCC
12601 @cindex debug dump options
12602 @cindex dump options
12603 @cindex compilation statistics
12604
12605 This section describes command-line options that are primarily of
12606 interest to GCC developers, including options to support compiler
12607 testing and investigation of compiler bugs and compile-time
12608 performance problems. This includes options that produce debug dumps
12609 at various points in the compilation; that print statistics such as
12610 memory use and execution time; and that print information about GCC's
12611 configuration, such as where it searches for libraries. You should
12612 rarely need to use any of these options for ordinary compilation and
12613 linking tasks.
12614
12615 @table @gcctabopt
12616
12617 @item -d@var{letters}
12618 @itemx -fdump-rtl-@var{pass}
12619 @itemx -fdump-rtl-@var{pass}=@var{filename}
12620 @opindex d
12621 @opindex fdump-rtl-@var{pass}
12622 Says to make debugging dumps during compilation at times specified by
12623 @var{letters}. This is used for debugging the RTL-based passes of the
12624 compiler. The file names for most of the dumps are made by appending
12625 a pass number and a word to the @var{dumpname}, and the files are
12626 created in the directory of the output file. In case of
12627 @option{=@var{filename}} option, the dump is output on the given file
12628 instead of the pass numbered dump files. Note that the pass number is
12629 assigned as passes are registered into the pass manager. Most passes
12630 are registered in the order that they will execute and for these passes
12631 the number corresponds to the pass execution order. However, passes
12632 registered by plugins, passes specific to compilation targets, or
12633 passes that are otherwise registered after all the other passes are
12634 numbered higher than a pass named "final", even if they are executed
12635 earlier. @var{dumpname} is generated from the name of the output
12636 file if explicitly specified and not an executable, otherwise it is
12637 the basename of the source file.
12638
12639 Some @option{-d@var{letters}} switches have different meaning when
12640 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
12641 for information about preprocessor-specific dump options.
12642
12643 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
12644 @option{-d} option @var{letters}. Here are the possible
12645 letters for use in @var{pass} and @var{letters}, and their meanings:
12646
12647 @table @gcctabopt
12648
12649 @item -fdump-rtl-alignments
12650 @opindex fdump-rtl-alignments
12651 Dump after branch alignments have been computed.
12652
12653 @item -fdump-rtl-asmcons
12654 @opindex fdump-rtl-asmcons
12655 Dump after fixing rtl statements that have unsatisfied in/out constraints.
12656
12657 @item -fdump-rtl-auto_inc_dec
12658 @opindex fdump-rtl-auto_inc_dec
12659 Dump after auto-inc-dec discovery. This pass is only run on
12660 architectures that have auto inc or auto dec instructions.
12661
12662 @item -fdump-rtl-barriers
12663 @opindex fdump-rtl-barriers
12664 Dump after cleaning up the barrier instructions.
12665
12666 @item -fdump-rtl-bbpart
12667 @opindex fdump-rtl-bbpart
12668 Dump after partitioning hot and cold basic blocks.
12669
12670 @item -fdump-rtl-bbro
12671 @opindex fdump-rtl-bbro
12672 Dump after block reordering.
12673
12674 @item -fdump-rtl-btl1
12675 @itemx -fdump-rtl-btl2
12676 @opindex fdump-rtl-btl2
12677 @opindex fdump-rtl-btl2
12678 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
12679 after the two branch
12680 target load optimization passes.
12681
12682 @item -fdump-rtl-bypass
12683 @opindex fdump-rtl-bypass
12684 Dump after jump bypassing and control flow optimizations.
12685
12686 @item -fdump-rtl-combine
12687 @opindex fdump-rtl-combine
12688 Dump after the RTL instruction combination pass.
12689
12690 @item -fdump-rtl-compgotos
12691 @opindex fdump-rtl-compgotos
12692 Dump after duplicating the computed gotos.
12693
12694 @item -fdump-rtl-ce1
12695 @itemx -fdump-rtl-ce2
12696 @itemx -fdump-rtl-ce3
12697 @opindex fdump-rtl-ce1
12698 @opindex fdump-rtl-ce2
12699 @opindex fdump-rtl-ce3
12700 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
12701 @option{-fdump-rtl-ce3} enable dumping after the three
12702 if conversion passes.
12703
12704 @item -fdump-rtl-cprop_hardreg
12705 @opindex fdump-rtl-cprop_hardreg
12706 Dump after hard register copy propagation.
12707
12708 @item -fdump-rtl-csa
12709 @opindex fdump-rtl-csa
12710 Dump after combining stack adjustments.
12711
12712 @item -fdump-rtl-cse1
12713 @itemx -fdump-rtl-cse2
12714 @opindex fdump-rtl-cse1
12715 @opindex fdump-rtl-cse2
12716 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
12717 the two common subexpression elimination passes.
12718
12719 @item -fdump-rtl-dce
12720 @opindex fdump-rtl-dce
12721 Dump after the standalone dead code elimination passes.
12722
12723 @item -fdump-rtl-dbr
12724 @opindex fdump-rtl-dbr
12725 Dump after delayed branch scheduling.
12726
12727 @item -fdump-rtl-dce1
12728 @itemx -fdump-rtl-dce2
12729 @opindex fdump-rtl-dce1
12730 @opindex fdump-rtl-dce2
12731 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
12732 the two dead store elimination passes.
12733
12734 @item -fdump-rtl-eh
12735 @opindex fdump-rtl-eh
12736 Dump after finalization of EH handling code.
12737
12738 @item -fdump-rtl-eh_ranges
12739 @opindex fdump-rtl-eh_ranges
12740 Dump after conversion of EH handling range regions.
12741
12742 @item -fdump-rtl-expand
12743 @opindex fdump-rtl-expand
12744 Dump after RTL generation.
12745
12746 @item -fdump-rtl-fwprop1
12747 @itemx -fdump-rtl-fwprop2
12748 @opindex fdump-rtl-fwprop1
12749 @opindex fdump-rtl-fwprop2
12750 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
12751 dumping after the two forward propagation passes.
12752
12753 @item -fdump-rtl-gcse1
12754 @itemx -fdump-rtl-gcse2
12755 @opindex fdump-rtl-gcse1
12756 @opindex fdump-rtl-gcse2
12757 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
12758 after global common subexpression elimination.
12759
12760 @item -fdump-rtl-init-regs
12761 @opindex fdump-rtl-init-regs
12762 Dump after the initialization of the registers.
12763
12764 @item -fdump-rtl-initvals
12765 @opindex fdump-rtl-initvals
12766 Dump after the computation of the initial value sets.
12767
12768 @item -fdump-rtl-into_cfglayout
12769 @opindex fdump-rtl-into_cfglayout
12770 Dump after converting to cfglayout mode.
12771
12772 @item -fdump-rtl-ira
12773 @opindex fdump-rtl-ira
12774 Dump after iterated register allocation.
12775
12776 @item -fdump-rtl-jump
12777 @opindex fdump-rtl-jump
12778 Dump after the second jump optimization.
12779
12780 @item -fdump-rtl-loop2
12781 @opindex fdump-rtl-loop2
12782 @option{-fdump-rtl-loop2} enables dumping after the rtl
12783 loop optimization passes.
12784
12785 @item -fdump-rtl-mach
12786 @opindex fdump-rtl-mach
12787 Dump after performing the machine dependent reorganization pass, if that
12788 pass exists.
12789
12790 @item -fdump-rtl-mode_sw
12791 @opindex fdump-rtl-mode_sw
12792 Dump after removing redundant mode switches.
12793
12794 @item -fdump-rtl-rnreg
12795 @opindex fdump-rtl-rnreg
12796 Dump after register renumbering.
12797
12798 @item -fdump-rtl-outof_cfglayout
12799 @opindex fdump-rtl-outof_cfglayout
12800 Dump after converting from cfglayout mode.
12801
12802 @item -fdump-rtl-peephole2
12803 @opindex fdump-rtl-peephole2
12804 Dump after the peephole pass.
12805
12806 @item -fdump-rtl-postreload
12807 @opindex fdump-rtl-postreload
12808 Dump after post-reload optimizations.
12809
12810 @item -fdump-rtl-pro_and_epilogue
12811 @opindex fdump-rtl-pro_and_epilogue
12812 Dump after generating the function prologues and epilogues.
12813
12814 @item -fdump-rtl-sched1
12815 @itemx -fdump-rtl-sched2
12816 @opindex fdump-rtl-sched1
12817 @opindex fdump-rtl-sched2
12818 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
12819 after the basic block scheduling passes.
12820
12821 @item -fdump-rtl-ree
12822 @opindex fdump-rtl-ree
12823 Dump after sign/zero extension elimination.
12824
12825 @item -fdump-rtl-seqabstr
12826 @opindex fdump-rtl-seqabstr
12827 Dump after common sequence discovery.
12828
12829 @item -fdump-rtl-shorten
12830 @opindex fdump-rtl-shorten
12831 Dump after shortening branches.
12832
12833 @item -fdump-rtl-sibling
12834 @opindex fdump-rtl-sibling
12835 Dump after sibling call optimizations.
12836
12837 @item -fdump-rtl-split1
12838 @itemx -fdump-rtl-split2
12839 @itemx -fdump-rtl-split3
12840 @itemx -fdump-rtl-split4
12841 @itemx -fdump-rtl-split5
12842 @opindex fdump-rtl-split1
12843 @opindex fdump-rtl-split2
12844 @opindex fdump-rtl-split3
12845 @opindex fdump-rtl-split4
12846 @opindex fdump-rtl-split5
12847 These options enable dumping after five rounds of
12848 instruction splitting.
12849
12850 @item -fdump-rtl-sms
12851 @opindex fdump-rtl-sms
12852 Dump after modulo scheduling. This pass is only run on some
12853 architectures.
12854
12855 @item -fdump-rtl-stack
12856 @opindex fdump-rtl-stack
12857 Dump after conversion from GCC's ``flat register file'' registers to the
12858 x87's stack-like registers. This pass is only run on x86 variants.
12859
12860 @item -fdump-rtl-subreg1
12861 @itemx -fdump-rtl-subreg2
12862 @opindex fdump-rtl-subreg1
12863 @opindex fdump-rtl-subreg2
12864 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
12865 the two subreg expansion passes.
12866
12867 @item -fdump-rtl-unshare
12868 @opindex fdump-rtl-unshare
12869 Dump after all rtl has been unshared.
12870
12871 @item -fdump-rtl-vartrack
12872 @opindex fdump-rtl-vartrack
12873 Dump after variable tracking.
12874
12875 @item -fdump-rtl-vregs
12876 @opindex fdump-rtl-vregs
12877 Dump after converting virtual registers to hard registers.
12878
12879 @item -fdump-rtl-web
12880 @opindex fdump-rtl-web
12881 Dump after live range splitting.
12882
12883 @item -fdump-rtl-regclass
12884 @itemx -fdump-rtl-subregs_of_mode_init
12885 @itemx -fdump-rtl-subregs_of_mode_finish
12886 @itemx -fdump-rtl-dfinit
12887 @itemx -fdump-rtl-dfinish
12888 @opindex fdump-rtl-regclass
12889 @opindex fdump-rtl-subregs_of_mode_init
12890 @opindex fdump-rtl-subregs_of_mode_finish
12891 @opindex fdump-rtl-dfinit
12892 @opindex fdump-rtl-dfinish
12893 These dumps are defined but always produce empty files.
12894
12895 @item -da
12896 @itemx -fdump-rtl-all
12897 @opindex da
12898 @opindex fdump-rtl-all
12899 Produce all the dumps listed above.
12900
12901 @item -dA
12902 @opindex dA
12903 Annotate the assembler output with miscellaneous debugging information.
12904
12905 @item -dD
12906 @opindex dD
12907 Dump all macro definitions, at the end of preprocessing, in addition to
12908 normal output.
12909
12910 @item -dH
12911 @opindex dH
12912 Produce a core dump whenever an error occurs.
12913
12914 @item -dp
12915 @opindex dp
12916 Annotate the assembler output with a comment indicating which
12917 pattern and alternative is used. The length of each instruction is
12918 also printed.
12919
12920 @item -dP
12921 @opindex dP
12922 Dump the RTL in the assembler output as a comment before each instruction.
12923 Also turns on @option{-dp} annotation.
12924
12925 @item -dx
12926 @opindex dx
12927 Just generate RTL for a function instead of compiling it. Usually used
12928 with @option{-fdump-rtl-expand}.
12929 @end table
12930
12931 @item -fdump-noaddr
12932 @opindex fdump-noaddr
12933 When doing debugging dumps, suppress address output. This makes it more
12934 feasible to use diff on debugging dumps for compiler invocations with
12935 different compiler binaries and/or different
12936 text / bss / data / heap / stack / dso start locations.
12937
12938 @item -freport-bug
12939 @opindex freport-bug
12940 Collect and dump debug information into a temporary file if an
12941 internal compiler error (ICE) occurs.
12942
12943 @item -fdump-unnumbered
12944 @opindex fdump-unnumbered
12945 When doing debugging dumps, suppress instruction numbers and address output.
12946 This makes it more feasible to use diff on debugging dumps for compiler
12947 invocations with different options, in particular with and without
12948 @option{-g}.
12949
12950 @item -fdump-unnumbered-links
12951 @opindex fdump-unnumbered-links
12952 When doing debugging dumps (see @option{-d} option above), suppress
12953 instruction numbers for the links to the previous and next instructions
12954 in a sequence.
12955
12956 @item -fdump-translation-unit @r{(C++ only)}
12957 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
12958 @opindex fdump-translation-unit
12959 Dump a representation of the tree structure for the entire translation
12960 unit to a file. The file name is made by appending @file{.tu} to the
12961 source file name, and the file is created in the same directory as the
12962 output file. If the @samp{-@var{options}} form is used, @var{options}
12963 controls the details of the dump as described for the
12964 @option{-fdump-tree} options.
12965
12966 @item -fdump-class-hierarchy @r{(C++ only)}
12967 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
12968 @opindex fdump-class-hierarchy
12969 Dump a representation of each class's hierarchy and virtual function
12970 table layout to a file. The file name is made by appending
12971 @file{.class} to the source file name, and the file is created in the
12972 same directory as the output file. If the @samp{-@var{options}} form
12973 is used, @var{options} controls the details of the dump as described
12974 for the @option{-fdump-tree} options.
12975
12976 @item -fdump-ipa-@var{switch}
12977 @opindex fdump-ipa
12978 Control the dumping at various stages of inter-procedural analysis
12979 language tree to a file. The file name is generated by appending a
12980 switch specific suffix to the source file name, and the file is created
12981 in the same directory as the output file. The following dumps are
12982 possible:
12983
12984 @table @samp
12985 @item all
12986 Enables all inter-procedural analysis dumps.
12987
12988 @item cgraph
12989 Dumps information about call-graph optimization, unused function removal,
12990 and inlining decisions.
12991
12992 @item inline
12993 Dump after function inlining.
12994
12995 @end table
12996
12997 @item -fdump-passes
12998 @opindex fdump-passes
12999 Print on @file{stderr} the list of optimization passes that are turned
13000 on and off by the current command-line options.
13001
13002 @item -fdump-statistics-@var{option}
13003 @opindex fdump-statistics
13004 Enable and control dumping of pass statistics in a separate file. The
13005 file name is generated by appending a suffix ending in
13006 @samp{.statistics} to the source file name, and the file is created in
13007 the same directory as the output file. If the @samp{-@var{option}}
13008 form is used, @samp{-stats} causes counters to be summed over the
13009 whole compilation unit while @samp{-details} dumps every event as
13010 the passes generate them. The default with no option is to sum
13011 counters for each function compiled.
13012
13013 @item -fdump-tree-all
13014 @itemx -fdump-tree-@var{switch}
13015 @itemx -fdump-tree-@var{switch}-@var{options}
13016 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
13017 @opindex fdump-tree-all
13018 @opindex fdump-tree
13019 Control the dumping at various stages of processing the intermediate
13020 language tree to a file. The file name is generated by appending a
13021 switch-specific suffix to the source file name, and the file is
13022 created in the same directory as the output file. In case of
13023 @option{=@var{filename}} option, the dump is output on the given file
13024 instead of the auto named dump files. If the @samp{-@var{options}}
13025 form is used, @var{options} is a list of @samp{-} separated options
13026 which control the details of the dump. Not all options are applicable
13027 to all dumps; those that are not meaningful are ignored. The
13028 following options are available
13029
13030 @table @samp
13031 @item address
13032 Print the address of each node. Usually this is not meaningful as it
13033 changes according to the environment and source file. Its primary use
13034 is for tying up a dump file with a debug environment.
13035 @item asmname
13036 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
13037 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
13038 use working backward from mangled names in the assembly file.
13039 @item slim
13040 When dumping front-end intermediate representations, inhibit dumping
13041 of members of a scope or body of a function merely because that scope
13042 has been reached. Only dump such items when they are directly reachable
13043 by some other path.
13044
13045 When dumping pretty-printed trees, this option inhibits dumping the
13046 bodies of control structures.
13047
13048 When dumping RTL, print the RTL in slim (condensed) form instead of
13049 the default LISP-like representation.
13050 @item raw
13051 Print a raw representation of the tree. By default, trees are
13052 pretty-printed into a C-like representation.
13053 @item details
13054 Enable more detailed dumps (not honored by every dump option). Also
13055 include information from the optimization passes.
13056 @item stats
13057 Enable dumping various statistics about the pass (not honored by every dump
13058 option).
13059 @item blocks
13060 Enable showing basic block boundaries (disabled in raw dumps).
13061 @item graph
13062 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
13063 dump a representation of the control flow graph suitable for viewing with
13064 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
13065 the file is pretty-printed as a subgraph, so that GraphViz can render them
13066 all in a single plot.
13067
13068 This option currently only works for RTL dumps, and the RTL is always
13069 dumped in slim form.
13070 @item vops
13071 Enable showing virtual operands for every statement.
13072 @item lineno
13073 Enable showing line numbers for statements.
13074 @item uid
13075 Enable showing the unique ID (@code{DECL_UID}) for each variable.
13076 @item verbose
13077 Enable showing the tree dump for each statement.
13078 @item eh
13079 Enable showing the EH region number holding each statement.
13080 @item scev
13081 Enable showing scalar evolution analysis details.
13082 @item optimized
13083 Enable showing optimization information (only available in certain
13084 passes).
13085 @item missed
13086 Enable showing missed optimization information (only available in certain
13087 passes).
13088 @item note
13089 Enable other detailed optimization information (only available in
13090 certain passes).
13091 @item =@var{filename}
13092 Instead of an auto named dump file, output into the given file
13093 name. The file names @file{stdout} and @file{stderr} are treated
13094 specially and are considered already open standard streams. For
13095 example,
13096
13097 @smallexample
13098 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
13099 -fdump-tree-pre=/dev/stderr file.c
13100 @end smallexample
13101
13102 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
13103 output on to @file{stderr}. If two conflicting dump filenames are
13104 given for the same pass, then the latter option overrides the earlier
13105 one.
13106
13107 @item all
13108 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
13109 and @option{lineno}.
13110
13111 @item optall
13112 Turn on all optimization options, i.e., @option{optimized},
13113 @option{missed}, and @option{note}.
13114 @end table
13115
13116 To determine what tree dumps are available or find the dump for a pass
13117 of interest follow the steps below.
13118
13119 @enumerate
13120 @item
13121 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
13122 look for a code that corresponds to the pass you are interested in.
13123 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
13124 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
13125 The number at the end distinguishes distinct invocations of the same pass.
13126 @item
13127 To enable the creation of the dump file, append the pass code to
13128 the @option{-fdump-} option prefix and invoke GCC with it. For example,
13129 to enable the dump from the Early Value Range Propagation pass, invoke
13130 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
13131 specify the name of the dump file. If you don't specify one, GCC
13132 creates as described below.
13133 @item
13134 Find the pass dump in a file whose name is composed of three components
13135 separated by a period: the name of the source file GCC was invoked to
13136 compile, a numeric suffix indicating the pass number followed by the
13137 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
13138 and finally the pass code. For example, the Early VRP pass dump might
13139 be in a file named @file{myfile.c.038t.evrp} in the current working
13140 directory. Note that the numeric codes are not stable and may change
13141 from one version of GCC to another.
13142 @end enumerate
13143
13144 @item -fopt-info
13145 @itemx -fopt-info-@var{options}
13146 @itemx -fopt-info-@var{options}=@var{filename}
13147 @opindex fopt-info
13148 Controls optimization dumps from various optimization passes. If the
13149 @samp{-@var{options}} form is used, @var{options} is a list of
13150 @samp{-} separated option keywords to select the dump details and
13151 optimizations.
13152
13153 The @var{options} can be divided into two groups: options describing the
13154 verbosity of the dump, and options describing which optimizations
13155 should be included. The options from both the groups can be freely
13156 mixed as they are non-overlapping. However, in case of any conflicts,
13157 the later options override the earlier options on the command
13158 line.
13159
13160 The following options control the dump verbosity:
13161
13162 @table @samp
13163 @item optimized
13164 Print information when an optimization is successfully applied. It is
13165 up to a pass to decide which information is relevant. For example, the
13166 vectorizer passes print the source location of loops which are
13167 successfully vectorized.
13168 @item missed
13169 Print information about missed optimizations. Individual passes
13170 control which information to include in the output.
13171 @item note
13172 Print verbose information about optimizations, such as certain
13173 transformations, more detailed messages about decisions etc.
13174 @item all
13175 Print detailed optimization information. This includes
13176 @samp{optimized}, @samp{missed}, and @samp{note}.
13177 @end table
13178
13179 One or more of the following option keywords can be used to describe a
13180 group of optimizations:
13181
13182 @table @samp
13183 @item ipa
13184 Enable dumps from all interprocedural optimizations.
13185 @item loop
13186 Enable dumps from all loop optimizations.
13187 @item inline
13188 Enable dumps from all inlining optimizations.
13189 @item omp
13190 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
13191 @item vec
13192 Enable dumps from all vectorization optimizations.
13193 @item optall
13194 Enable dumps from all optimizations. This is a superset of
13195 the optimization groups listed above.
13196 @end table
13197
13198 If @var{options} is
13199 omitted, it defaults to @samp{optimized-optall}, which means to dump all
13200 info about successful optimizations from all the passes.
13201
13202 If the @var{filename} is provided, then the dumps from all the
13203 applicable optimizations are concatenated into the @var{filename}.
13204 Otherwise the dump is output onto @file{stderr}. Though multiple
13205 @option{-fopt-info} options are accepted, only one of them can include
13206 a @var{filename}. If other filenames are provided then all but the
13207 first such option are ignored.
13208
13209 Note that the output @var{filename} is overwritten
13210 in case of multiple translation units. If a combined output from
13211 multiple translation units is desired, @file{stderr} should be used
13212 instead.
13213
13214 In the following example, the optimization info is output to
13215 @file{stderr}:
13216
13217 @smallexample
13218 gcc -O3 -fopt-info
13219 @end smallexample
13220
13221 This example:
13222 @smallexample
13223 gcc -O3 -fopt-info-missed=missed.all
13224 @end smallexample
13225
13226 @noindent
13227 outputs missed optimization report from all the passes into
13228 @file{missed.all}, and this one:
13229
13230 @smallexample
13231 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13232 @end smallexample
13233
13234 @noindent
13235 prints information about missed optimization opportunities from
13236 vectorization passes on @file{stderr}.
13237 Note that @option{-fopt-info-vec-missed} is equivalent to
13238 @option{-fopt-info-missed-vec}.
13239
13240 As another example,
13241 @smallexample
13242 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13243 @end smallexample
13244
13245 @noindent
13246 outputs information about missed optimizations as well as
13247 optimized locations from all the inlining passes into
13248 @file{inline.txt}.
13249
13250 Finally, consider:
13251
13252 @smallexample
13253 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13254 @end smallexample
13255
13256 @noindent
13257 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
13258 in conflict since only one output file is allowed. In this case, only
13259 the first option takes effect and the subsequent options are
13260 ignored. Thus only @file{vec.miss} is produced which contains
13261 dumps from the vectorizer about missed opportunities.
13262
13263 @item -fsched-verbose=@var{n}
13264 @opindex fsched-verbose
13265 On targets that use instruction scheduling, this option controls the
13266 amount of debugging output the scheduler prints to the dump files.
13267
13268 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
13269 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
13270 For @var{n} greater than one, it also output basic block probabilities,
13271 detailed ready list information and unit/insn info. For @var{n} greater
13272 than two, it includes RTL at abort point, control-flow and regions info.
13273 And for @var{n} over four, @option{-fsched-verbose} also includes
13274 dependence info.
13275
13276
13277
13278 @item -fenable-@var{kind}-@var{pass}
13279 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
13280 @opindex fdisable-
13281 @opindex fenable-
13282
13283 This is a set of options that are used to explicitly disable/enable
13284 optimization passes. These options are intended for use for debugging GCC.
13285 Compiler users should use regular options for enabling/disabling
13286 passes instead.
13287
13288 @table @gcctabopt
13289
13290 @item -fdisable-ipa-@var{pass}
13291 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13292 statically invoked in the compiler multiple times, the pass name should be
13293 appended with a sequential number starting from 1.
13294
13295 @item -fdisable-rtl-@var{pass}
13296 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
13297 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
13298 statically invoked in the compiler multiple times, the pass name should be
13299 appended with a sequential number starting from 1. @var{range-list} is a
13300 comma-separated list of function ranges or assembler names. Each range is a number
13301 pair separated by a colon. The range is inclusive in both ends. If the range
13302 is trivial, the number pair can be simplified as a single number. If the
13303 function's call graph node's @var{uid} falls within one of the specified ranges,
13304 the @var{pass} is disabled for that function. The @var{uid} is shown in the
13305 function header of a dump file, and the pass names can be dumped by using
13306 option @option{-fdump-passes}.
13307
13308 @item -fdisable-tree-@var{pass}
13309 @itemx -fdisable-tree-@var{pass}=@var{range-list}
13310 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
13311 option arguments.
13312
13313 @item -fenable-ipa-@var{pass}
13314 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13315 statically invoked in the compiler multiple times, the pass name should be
13316 appended with a sequential number starting from 1.
13317
13318 @item -fenable-rtl-@var{pass}
13319 @itemx -fenable-rtl-@var{pass}=@var{range-list}
13320 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
13321 description and examples.
13322
13323 @item -fenable-tree-@var{pass}
13324 @itemx -fenable-tree-@var{pass}=@var{range-list}
13325 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
13326 of option arguments.
13327
13328 @end table
13329
13330 Here are some examples showing uses of these options.
13331
13332 @smallexample
13333
13334 # disable ccp1 for all functions
13335 -fdisable-tree-ccp1
13336 # disable complete unroll for function whose cgraph node uid is 1
13337 -fenable-tree-cunroll=1
13338 # disable gcse2 for functions at the following ranges [1,1],
13339 # [300,400], and [400,1000]
13340 # disable gcse2 for functions foo and foo2
13341 -fdisable-rtl-gcse2=foo,foo2
13342 # disable early inlining
13343 -fdisable-tree-einline
13344 # disable ipa inlining
13345 -fdisable-ipa-inline
13346 # enable tree full unroll
13347 -fenable-tree-unroll
13348
13349 @end smallexample
13350
13351 @item -fchecking
13352 @itemx -fchecking=@var{n}
13353 @opindex fchecking
13354 @opindex fno-checking
13355 Enable internal consistency checking. The default depends on
13356 the compiler configuration. @option{-fchecking=2} enables further
13357 internal consistency checking that might affect code generation.
13358
13359 @item -frandom-seed=@var{string}
13360 @opindex frandom-seed
13361 This option provides a seed that GCC uses in place of
13362 random numbers in generating certain symbol names
13363 that have to be different in every compiled file. It is also used to
13364 place unique stamps in coverage data files and the object files that
13365 produce them. You can use the @option{-frandom-seed} option to produce
13366 reproducibly identical object files.
13367
13368 The @var{string} can either be a number (decimal, octal or hex) or an
13369 arbitrary string (in which case it's converted to a number by
13370 computing CRC32).
13371
13372 The @var{string} should be different for every file you compile.
13373
13374 @item -save-temps
13375 @itemx -save-temps=cwd
13376 @opindex save-temps
13377 Store the usual ``temporary'' intermediate files permanently; place them
13378 in the current directory and name them based on the source file. Thus,
13379 compiling @file{foo.c} with @option{-c -save-temps} produces files
13380 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
13381 preprocessed @file{foo.i} output file even though the compiler now
13382 normally uses an integrated preprocessor.
13383
13384 When used in combination with the @option{-x} command-line option,
13385 @option{-save-temps} is sensible enough to avoid over writing an
13386 input source file with the same extension as an intermediate file.
13387 The corresponding intermediate file may be obtained by renaming the
13388 source file before using @option{-save-temps}.
13389
13390 If you invoke GCC in parallel, compiling several different source
13391 files that share a common base name in different subdirectories or the
13392 same source file compiled for multiple output destinations, it is
13393 likely that the different parallel compilers will interfere with each
13394 other, and overwrite the temporary files. For instance:
13395
13396 @smallexample
13397 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
13398 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
13399 @end smallexample
13400
13401 may result in @file{foo.i} and @file{foo.o} being written to
13402 simultaneously by both compilers.
13403
13404 @item -save-temps=obj
13405 @opindex save-temps=obj
13406 Store the usual ``temporary'' intermediate files permanently. If the
13407 @option{-o} option is used, the temporary files are based on the
13408 object file. If the @option{-o} option is not used, the
13409 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
13410
13411 For example:
13412
13413 @smallexample
13414 gcc -save-temps=obj -c foo.c
13415 gcc -save-temps=obj -c bar.c -o dir/xbar.o
13416 gcc -save-temps=obj foobar.c -o dir2/yfoobar
13417 @end smallexample
13418
13419 @noindent
13420 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
13421 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
13422 @file{dir2/yfoobar.o}.
13423
13424 @item -time@r{[}=@var{file}@r{]}
13425 @opindex time
13426 Report the CPU time taken by each subprocess in the compilation
13427 sequence. For C source files, this is the compiler proper and assembler
13428 (plus the linker if linking is done).
13429
13430 Without the specification of an output file, the output looks like this:
13431
13432 @smallexample
13433 # cc1 0.12 0.01
13434 # as 0.00 0.01
13435 @end smallexample
13436
13437 The first number on each line is the ``user time'', that is time spent
13438 executing the program itself. The second number is ``system time'',
13439 time spent executing operating system routines on behalf of the program.
13440 Both numbers are in seconds.
13441
13442 With the specification of an output file, the output is appended to the
13443 named file, and it looks like this:
13444
13445 @smallexample
13446 0.12 0.01 cc1 @var{options}
13447 0.00 0.01 as @var{options}
13448 @end smallexample
13449
13450 The ``user time'' and the ``system time'' are moved before the program
13451 name, and the options passed to the program are displayed, so that one
13452 can later tell what file was being compiled, and with which options.
13453
13454 @item -fdump-final-insns@r{[}=@var{file}@r{]}
13455 @opindex fdump-final-insns
13456 Dump the final internal representation (RTL) to @var{file}. If the
13457 optional argument is omitted (or if @var{file} is @code{.}), the name
13458 of the dump file is determined by appending @code{.gkd} to the
13459 compilation output file name.
13460
13461 @item -fcompare-debug@r{[}=@var{opts}@r{]}
13462 @opindex fcompare-debug
13463 @opindex fno-compare-debug
13464 If no error occurs during compilation, run the compiler a second time,
13465 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
13466 passed to the second compilation. Dump the final internal
13467 representation in both compilations, and print an error if they differ.
13468
13469 If the equal sign is omitted, the default @option{-gtoggle} is used.
13470
13471 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
13472 and nonzero, implicitly enables @option{-fcompare-debug}. If
13473 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
13474 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
13475 is used.
13476
13477 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
13478 is equivalent to @option{-fno-compare-debug}, which disables the dumping
13479 of the final representation and the second compilation, preventing even
13480 @env{GCC_COMPARE_DEBUG} from taking effect.
13481
13482 To verify full coverage during @option{-fcompare-debug} testing, set
13483 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
13484 which GCC rejects as an invalid option in any actual compilation
13485 (rather than preprocessing, assembly or linking). To get just a
13486 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
13487 not overridden} will do.
13488
13489 @item -fcompare-debug-second
13490 @opindex fcompare-debug-second
13491 This option is implicitly passed to the compiler for the second
13492 compilation requested by @option{-fcompare-debug}, along with options to
13493 silence warnings, and omitting other options that would cause
13494 side-effect compiler outputs to files or to the standard output. Dump
13495 files and preserved temporary files are renamed so as to contain the
13496 @code{.gk} additional extension during the second compilation, to avoid
13497 overwriting those generated by the first.
13498
13499 When this option is passed to the compiler driver, it causes the
13500 @emph{first} compilation to be skipped, which makes it useful for little
13501 other than debugging the compiler proper.
13502
13503 @item -gtoggle
13504 @opindex gtoggle
13505 Turn off generation of debug info, if leaving out this option
13506 generates it, or turn it on at level 2 otherwise. The position of this
13507 argument in the command line does not matter; it takes effect after all
13508 other options are processed, and it does so only once, no matter how
13509 many times it is given. This is mainly intended to be used with
13510 @option{-fcompare-debug}.
13511
13512 @item -fvar-tracking-assignments-toggle
13513 @opindex fvar-tracking-assignments-toggle
13514 @opindex fno-var-tracking-assignments-toggle
13515 Toggle @option{-fvar-tracking-assignments}, in the same way that
13516 @option{-gtoggle} toggles @option{-g}.
13517
13518 @item -Q
13519 @opindex Q
13520 Makes the compiler print out each function name as it is compiled, and
13521 print some statistics about each pass when it finishes.
13522
13523 @item -ftime-report
13524 @opindex ftime-report
13525 Makes the compiler print some statistics about the time consumed by each
13526 pass when it finishes.
13527
13528 @item -ftime-report-details
13529 @opindex ftime-report-details
13530 Record the time consumed by infrastructure parts separately for each pass.
13531
13532 @item -fira-verbose=@var{n}
13533 @opindex fira-verbose
13534 Control the verbosity of the dump file for the integrated register allocator.
13535 The default value is 5. If the value @var{n} is greater or equal to 10,
13536 the dump output is sent to stderr using the same format as @var{n} minus 10.
13537
13538 @item -flto-report
13539 @opindex flto-report
13540 Prints a report with internal details on the workings of the link-time
13541 optimizer. The contents of this report vary from version to version.
13542 It is meant to be useful to GCC developers when processing object
13543 files in LTO mode (via @option{-flto}).
13544
13545 Disabled by default.
13546
13547 @item -flto-report-wpa
13548 @opindex flto-report-wpa
13549 Like @option{-flto-report}, but only print for the WPA phase of Link
13550 Time Optimization.
13551
13552 @item -fmem-report
13553 @opindex fmem-report
13554 Makes the compiler print some statistics about permanent memory
13555 allocation when it finishes.
13556
13557 @item -fmem-report-wpa
13558 @opindex fmem-report-wpa
13559 Makes the compiler print some statistics about permanent memory
13560 allocation for the WPA phase only.
13561
13562 @item -fpre-ipa-mem-report
13563 @opindex fpre-ipa-mem-report
13564 @item -fpost-ipa-mem-report
13565 @opindex fpost-ipa-mem-report
13566 Makes the compiler print some statistics about permanent memory
13567 allocation before or after interprocedural optimization.
13568
13569 @item -fprofile-report
13570 @opindex fprofile-report
13571 Makes the compiler print some statistics about consistency of the
13572 (estimated) profile and effect of individual passes.
13573
13574 @item -fstack-usage
13575 @opindex fstack-usage
13576 Makes the compiler output stack usage information for the program, on a
13577 per-function basis. The filename for the dump is made by appending
13578 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
13579 the output file, if explicitly specified and it is not an executable,
13580 otherwise it is the basename of the source file. An entry is made up
13581 of three fields:
13582
13583 @itemize
13584 @item
13585 The name of the function.
13586 @item
13587 A number of bytes.
13588 @item
13589 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
13590 @end itemize
13591
13592 The qualifier @code{static} means that the function manipulates the stack
13593 statically: a fixed number of bytes are allocated for the frame on function
13594 entry and released on function exit; no stack adjustments are otherwise made
13595 in the function. The second field is this fixed number of bytes.
13596
13597 The qualifier @code{dynamic} means that the function manipulates the stack
13598 dynamically: in addition to the static allocation described above, stack
13599 adjustments are made in the body of the function, for example to push/pop
13600 arguments around function calls. If the qualifier @code{bounded} is also
13601 present, the amount of these adjustments is bounded at compile time and
13602 the second field is an upper bound of the total amount of stack used by
13603 the function. If it is not present, the amount of these adjustments is
13604 not bounded at compile time and the second field only represents the
13605 bounded part.
13606
13607 @item -fstats
13608 @opindex fstats
13609 Emit statistics about front-end processing at the end of the compilation.
13610 This option is supported only by the C++ front end, and
13611 the information is generally only useful to the G++ development team.
13612
13613 @item -fdbg-cnt-list
13614 @opindex fdbg-cnt-list
13615 Print the name and the counter upper bound for all debug counters.
13616
13617
13618 @item -fdbg-cnt=@var{counter-value-list}
13619 @opindex fdbg-cnt
13620 Set the internal debug counter upper bound. @var{counter-value-list}
13621 is a comma-separated list of @var{name}:@var{value} pairs
13622 which sets the upper bound of each debug counter @var{name} to @var{value}.
13623 All debug counters have the initial upper bound of @code{UINT_MAX};
13624 thus @code{dbg_cnt} returns true always unless the upper bound
13625 is set by this option.
13626 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
13627 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
13628
13629 @item -print-file-name=@var{library}
13630 @opindex print-file-name
13631 Print the full absolute name of the library file @var{library} that
13632 would be used when linking---and don't do anything else. With this
13633 option, GCC does not compile or link anything; it just prints the
13634 file name.
13635
13636 @item -print-multi-directory
13637 @opindex print-multi-directory
13638 Print the directory name corresponding to the multilib selected by any
13639 other switches present in the command line. This directory is supposed
13640 to exist in @env{GCC_EXEC_PREFIX}.
13641
13642 @item -print-multi-lib
13643 @opindex print-multi-lib
13644 Print the mapping from multilib directory names to compiler switches
13645 that enable them. The directory name is separated from the switches by
13646 @samp{;}, and each switch starts with an @samp{@@} instead of the
13647 @samp{-}, without spaces between multiple switches. This is supposed to
13648 ease shell processing.
13649
13650 @item -print-multi-os-directory
13651 @opindex print-multi-os-directory
13652 Print the path to OS libraries for the selected
13653 multilib, relative to some @file{lib} subdirectory. If OS libraries are
13654 present in the @file{lib} subdirectory and no multilibs are used, this is
13655 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
13656 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
13657 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
13658 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
13659
13660 @item -print-multiarch
13661 @opindex print-multiarch
13662 Print the path to OS libraries for the selected multiarch,
13663 relative to some @file{lib} subdirectory.
13664
13665 @item -print-prog-name=@var{program}
13666 @opindex print-prog-name
13667 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
13668
13669 @item -print-libgcc-file-name
13670 @opindex print-libgcc-file-name
13671 Same as @option{-print-file-name=libgcc.a}.
13672
13673 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
13674 but you do want to link with @file{libgcc.a}. You can do:
13675
13676 @smallexample
13677 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
13678 @end smallexample
13679
13680 @item -print-search-dirs
13681 @opindex print-search-dirs
13682 Print the name of the configured installation directory and a list of
13683 program and library directories @command{gcc} searches---and don't do anything else.
13684
13685 This is useful when @command{gcc} prints the error message
13686 @samp{installation problem, cannot exec cpp0: No such file or directory}.
13687 To resolve this you either need to put @file{cpp0} and the other compiler
13688 components where @command{gcc} expects to find them, or you can set the environment
13689 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
13690 Don't forget the trailing @samp{/}.
13691 @xref{Environment Variables}.
13692
13693 @item -print-sysroot
13694 @opindex print-sysroot
13695 Print the target sysroot directory that is used during
13696 compilation. This is the target sysroot specified either at configure
13697 time or using the @option{--sysroot} option, possibly with an extra
13698 suffix that depends on compilation options. If no target sysroot is
13699 specified, the option prints nothing.
13700
13701 @item -print-sysroot-headers-suffix
13702 @opindex print-sysroot-headers-suffix
13703 Print the suffix added to the target sysroot when searching for
13704 headers, or give an error if the compiler is not configured with such
13705 a suffix---and don't do anything else.
13706
13707 @item -dumpmachine
13708 @opindex dumpmachine
13709 Print the compiler's target machine (for example,
13710 @samp{i686-pc-linux-gnu})---and don't do anything else.
13711
13712 @item -dumpversion
13713 @opindex dumpversion
13714 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
13715 anything else. This is the compiler version used in filesystem paths,
13716 specs, can be depending on how the compiler has been configured just
13717 a single number (major version), two numbers separated by dot (major and
13718 minor version) or three numbers separated by dots (major, minor and patchlevel
13719 version).
13720
13721 @item -dumpfullversion
13722 @opindex dumpfullversion
13723 Print the full compiler version, always 3 numbers separated by dots,
13724 major, minor and patchlevel version.
13725
13726 @item -dumpspecs
13727 @opindex dumpspecs
13728 Print the compiler's built-in specs---and don't do anything else. (This
13729 is used when GCC itself is being built.) @xref{Spec Files}.
13730 @end table
13731
13732 @node Submodel Options
13733 @section Machine-Dependent Options
13734 @cindex submodel options
13735 @cindex specifying hardware config
13736 @cindex hardware models and configurations, specifying
13737 @cindex target-dependent options
13738 @cindex machine-dependent options
13739
13740 Each target machine supported by GCC can have its own options---for
13741 example, to allow you to compile for a particular processor variant or
13742 ABI, or to control optimizations specific to that machine. By
13743 convention, the names of machine-specific options start with
13744 @samp{-m}.
13745
13746 Some configurations of the compiler also support additional target-specific
13747 options, usually for compatibility with other compilers on the same
13748 platform.
13749
13750 @c This list is ordered alphanumerically by subsection name.
13751 @c It should be the same order and spelling as these options are listed
13752 @c in Machine Dependent Options
13753
13754 @menu
13755 * AArch64 Options::
13756 * Adapteva Epiphany Options::
13757 * ARC Options::
13758 * ARM Options::
13759 * AVR Options::
13760 * Blackfin Options::
13761 * C6X Options::
13762 * CRIS Options::
13763 * CR16 Options::
13764 * Darwin Options::
13765 * DEC Alpha Options::
13766 * FR30 Options::
13767 * FT32 Options::
13768 * FRV Options::
13769 * GNU/Linux Options::
13770 * H8/300 Options::
13771 * HPPA Options::
13772 * IA-64 Options::
13773 * LM32 Options::
13774 * M32C Options::
13775 * M32R/D Options::
13776 * M680x0 Options::
13777 * MCore Options::
13778 * MeP Options::
13779 * MicroBlaze Options::
13780 * MIPS Options::
13781 * MMIX Options::
13782 * MN10300 Options::
13783 * Moxie Options::
13784 * MSP430 Options::
13785 * NDS32 Options::
13786 * Nios II Options::
13787 * Nvidia PTX Options::
13788 * PDP-11 Options::
13789 * picoChip Options::
13790 * PowerPC Options::
13791 * RISC-V Options::
13792 * RL78 Options::
13793 * RS/6000 and PowerPC Options::
13794 * RX Options::
13795 * S/390 and zSeries Options::
13796 * Score Options::
13797 * SH Options::
13798 * Solaris 2 Options::
13799 * SPARC Options::
13800 * SPU Options::
13801 * System V Options::
13802 * TILE-Gx Options::
13803 * TILEPro Options::
13804 * V850 Options::
13805 * VAX Options::
13806 * Visium Options::
13807 * VMS Options::
13808 * VxWorks Options::
13809 * x86 Options::
13810 * x86 Windows Options::
13811 * Xstormy16 Options::
13812 * Xtensa Options::
13813 * zSeries Options::
13814 @end menu
13815
13816 @node AArch64 Options
13817 @subsection AArch64 Options
13818 @cindex AArch64 Options
13819
13820 These options are defined for AArch64 implementations:
13821
13822 @table @gcctabopt
13823
13824 @item -mabi=@var{name}
13825 @opindex mabi
13826 Generate code for the specified data model. Permissible values
13827 are @samp{ilp32} for SysV-like data model where int, long int and pointers
13828 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
13829 but long int and pointers are 64 bits.
13830
13831 The default depends on the specific target configuration. Note that
13832 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
13833 entire program with the same ABI, and link with a compatible set of libraries.
13834
13835 @item -mbig-endian
13836 @opindex mbig-endian
13837 Generate big-endian code. This is the default when GCC is configured for an
13838 @samp{aarch64_be-*-*} target.
13839
13840 @item -mgeneral-regs-only
13841 @opindex mgeneral-regs-only
13842 Generate code which uses only the general-purpose registers. This will prevent
13843 the compiler from using floating-point and Advanced SIMD registers but will not
13844 impose any restrictions on the assembler.
13845
13846 @item -mlittle-endian
13847 @opindex mlittle-endian
13848 Generate little-endian code. This is the default when GCC is configured for an
13849 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
13850
13851 @item -mcmodel=tiny
13852 @opindex mcmodel=tiny
13853 Generate code for the tiny code model. The program and its statically defined
13854 symbols must be within 1MB of each other. Programs can be statically or
13855 dynamically linked.
13856
13857 @item -mcmodel=small
13858 @opindex mcmodel=small
13859 Generate code for the small code model. The program and its statically defined
13860 symbols must be within 4GB of each other. Programs can be statically or
13861 dynamically linked. This is the default code model.
13862
13863 @item -mcmodel=large
13864 @opindex mcmodel=large
13865 Generate code for the large code model. This makes no assumptions about
13866 addresses and sizes of sections. Programs can be statically linked only.
13867
13868 @item -mstrict-align
13869 @opindex mstrict-align
13870 Avoid generating memory accesses that may not be aligned on a natural object
13871 boundary as described in the architecture specification.
13872
13873 @item -momit-leaf-frame-pointer
13874 @itemx -mno-omit-leaf-frame-pointer
13875 @opindex momit-leaf-frame-pointer
13876 @opindex mno-omit-leaf-frame-pointer
13877 Omit or keep the frame pointer in leaf functions. The former behavior is the
13878 default.
13879
13880 @item -mtls-dialect=desc
13881 @opindex mtls-dialect=desc
13882 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
13883 of TLS variables. This is the default.
13884
13885 @item -mtls-dialect=traditional
13886 @opindex mtls-dialect=traditional
13887 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
13888 of TLS variables.
13889
13890 @item -mtls-size=@var{size}
13891 @opindex mtls-size
13892 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
13893 This option requires binutils 2.26 or newer.
13894
13895 @item -mfix-cortex-a53-835769
13896 @itemx -mno-fix-cortex-a53-835769
13897 @opindex mfix-cortex-a53-835769
13898 @opindex mno-fix-cortex-a53-835769
13899 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
13900 This involves inserting a NOP instruction between memory instructions and
13901 64-bit integer multiply-accumulate instructions.
13902
13903 @item -mfix-cortex-a53-843419
13904 @itemx -mno-fix-cortex-a53-843419
13905 @opindex mfix-cortex-a53-843419
13906 @opindex mno-fix-cortex-a53-843419
13907 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
13908 This erratum workaround is made at link time and this will only pass the
13909 corresponding flag to the linker.
13910
13911 @item -mlow-precision-recip-sqrt
13912 @item -mno-low-precision-recip-sqrt
13913 @opindex mlow-precision-recip-sqrt
13914 @opindex mno-low-precision-recip-sqrt
13915 Enable or disable the reciprocal square root approximation.
13916 This option only has an effect if @option{-ffast-math} or
13917 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13918 precision of reciprocal square root results to about 16 bits for
13919 single precision and to 32 bits for double precision.
13920
13921 @item -mlow-precision-sqrt
13922 @item -mno-low-precision-sqrt
13923 @opindex -mlow-precision-sqrt
13924 @opindex -mno-low-precision-sqrt
13925 Enable or disable the square root approximation.
13926 This option only has an effect if @option{-ffast-math} or
13927 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13928 precision of square root results to about 16 bits for
13929 single precision and to 32 bits for double precision.
13930 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
13931
13932 @item -mlow-precision-div
13933 @item -mno-low-precision-div
13934 @opindex -mlow-precision-div
13935 @opindex -mno-low-precision-div
13936 Enable or disable the division approximation.
13937 This option only has an effect if @option{-ffast-math} or
13938 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13939 precision of division results to about 16 bits for
13940 single precision and to 32 bits for double precision.
13941
13942 @item -march=@var{name}
13943 @opindex march
13944 Specify the name of the target architecture and, optionally, one or
13945 more feature modifiers. This option has the form
13946 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
13947
13948 The permissible values for @var{arch} are @samp{armv8-a},
13949 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @var{native}.
13950
13951 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
13952 support for the ARMv8.3-A architecture extensions.
13953
13954 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
13955 support for the ARMv8.2-A architecture extensions.
13956
13957 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
13958 support for the ARMv8.1-A architecture extension. In particular, it
13959 enables the @samp{+crc} and @samp{+lse} features.
13960
13961 The value @samp{native} is available on native AArch64 GNU/Linux and
13962 causes the compiler to pick the architecture of the host system. This
13963 option has no effect if the compiler is unable to recognize the
13964 architecture of the host system,
13965
13966 The permissible values for @var{feature} are listed in the sub-section
13967 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13968 Feature Modifiers}. Where conflicting feature modifiers are
13969 specified, the right-most feature is used.
13970
13971 GCC uses @var{name} to determine what kind of instructions it can emit
13972 when generating assembly code. If @option{-march} is specified
13973 without either of @option{-mtune} or @option{-mcpu} also being
13974 specified, the code is tuned to perform well across a range of target
13975 processors implementing the target architecture.
13976
13977 @item -mtune=@var{name}
13978 @opindex mtune
13979 Specify the name of the target processor for which GCC should tune the
13980 performance of the code. Permissible values for this option are:
13981 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
13982 @samp{cortex-a72}, @samp{cortex-a73}, @samp{exynos-m1}, @samp{falkor},
13983 @samp{qdf24xx}, @samp{xgene1}, @samp{vulcan}, @samp{thunderx},
13984 @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
13985 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53},
13986 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
13987 @samp{cortex-a73.cortex-a53}, @samp{native}.
13988
13989 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
13990 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}
13991 specify that GCC should tune for a big.LITTLE system.
13992
13993 Additionally on native AArch64 GNU/Linux systems the value
13994 @samp{native} tunes performance to the host system. This option has no effect
13995 if the compiler is unable to recognize the processor of the host system.
13996
13997 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
13998 are specified, the code is tuned to perform well across a range
13999 of target processors.
14000
14001 This option cannot be suffixed by feature modifiers.
14002
14003 @item -mcpu=@var{name}
14004 @opindex mcpu
14005 Specify the name of the target processor, optionally suffixed by one
14006 or more feature modifiers. This option has the form
14007 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
14008 the permissible values for @var{cpu} are the same as those available
14009 for @option{-mtune}. The permissible values for @var{feature} are
14010 documented in the sub-section on
14011 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14012 Feature Modifiers}. Where conflicting feature modifiers are
14013 specified, the right-most feature is used.
14014
14015 GCC uses @var{name} to determine what kind of instructions it can emit when
14016 generating assembly code (as if by @option{-march}) and to determine
14017 the target processor for which to tune for performance (as if
14018 by @option{-mtune}). Where this option is used in conjunction
14019 with @option{-march} or @option{-mtune}, those options take precedence
14020 over the appropriate part of this option.
14021
14022 @item -moverride=@var{string}
14023 @opindex moverride
14024 Override tuning decisions made by the back-end in response to a
14025 @option{-mtune=} switch. The syntax, semantics, and accepted values
14026 for @var{string} in this option are not guaranteed to be consistent
14027 across releases.
14028
14029 This option is only intended to be useful when developing GCC.
14030
14031 @item -mpc-relative-literal-loads
14032 @opindex mpc-relative-literal-loads
14033 Enable PC-relative literal loads. With this option literal pools are
14034 accessed using a single instruction and emitted after each function. This
14035 limits the maximum size of functions to 1MB. This is enabled by default for
14036 @option{-mcmodel=tiny}.
14037
14038 @item -msign-return-address=@var{scope}
14039 @opindex msign-return-address
14040 Select the function scope on which return address signing will be applied.
14041 Permissible values are @samp{none}, which disables return address signing,
14042 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
14043 functions, and @samp{all}, which enables pointer signing for all functions. The
14044 default value is @samp{none}.
14045
14046 @end table
14047
14048 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
14049 @anchor{aarch64-feature-modifiers}
14050 @cindex @option{-march} feature modifiers
14051 @cindex @option{-mcpu} feature modifiers
14052 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
14053 the following and their inverses @option{no@var{feature}}:
14054
14055 @table @samp
14056 @item crc
14057 Enable CRC extension. This is on by default for
14058 @option{-march=armv8.1-a}.
14059 @item crypto
14060 Enable Crypto extension. This also enables Advanced SIMD and floating-point
14061 instructions.
14062 @item fp
14063 Enable floating-point instructions. This is on by default for all possible
14064 values for options @option{-march} and @option{-mcpu}.
14065 @item simd
14066 Enable Advanced SIMD instructions. This also enables floating-point
14067 instructions. This is on by default for all possible values for options
14068 @option{-march} and @option{-mcpu}.
14069 @item lse
14070 Enable Large System Extension instructions. This is on by default for
14071 @option{-march=armv8.1-a}.
14072 @item fp16
14073 Enable FP16 extension. This also enables floating-point instructions.
14074
14075 @end table
14076
14077 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
14078 Conversely, @option{nofp} implies @option{nosimd}, which implies
14079 @option{nocrypto}.
14080
14081 @node Adapteva Epiphany Options
14082 @subsection Adapteva Epiphany Options
14083
14084 These @samp{-m} options are defined for Adapteva Epiphany:
14085
14086 @table @gcctabopt
14087 @item -mhalf-reg-file
14088 @opindex mhalf-reg-file
14089 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
14090 That allows code to run on hardware variants that lack these registers.
14091
14092 @item -mprefer-short-insn-regs
14093 @opindex mprefer-short-insn-regs
14094 Preferentially allocate registers that allow short instruction generation.
14095 This can result in increased instruction count, so this may either reduce or
14096 increase overall code size.
14097
14098 @item -mbranch-cost=@var{num}
14099 @opindex mbranch-cost
14100 Set the cost of branches to roughly @var{num} ``simple'' instructions.
14101 This cost is only a heuristic and is not guaranteed to produce
14102 consistent results across releases.
14103
14104 @item -mcmove
14105 @opindex mcmove
14106 Enable the generation of conditional moves.
14107
14108 @item -mnops=@var{num}
14109 @opindex mnops
14110 Emit @var{num} NOPs before every other generated instruction.
14111
14112 @item -mno-soft-cmpsf
14113 @opindex mno-soft-cmpsf
14114 For single-precision floating-point comparisons, emit an @code{fsub} instruction
14115 and test the flags. This is faster than a software comparison, but can
14116 get incorrect results in the presence of NaNs, or when two different small
14117 numbers are compared such that their difference is calculated as zero.
14118 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
14119 software comparisons.
14120
14121 @item -mstack-offset=@var{num}
14122 @opindex mstack-offset
14123 Set the offset between the top of the stack and the stack pointer.
14124 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
14125 can be used by leaf functions without stack allocation.
14126 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
14127 Note also that this option changes the ABI; compiling a program with a
14128 different stack offset than the libraries have been compiled with
14129 generally does not work.
14130 This option can be useful if you want to evaluate if a different stack
14131 offset would give you better code, but to actually use a different stack
14132 offset to build working programs, it is recommended to configure the
14133 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
14134
14135 @item -mno-round-nearest
14136 @opindex mno-round-nearest
14137 Make the scheduler assume that the rounding mode has been set to
14138 truncating. The default is @option{-mround-nearest}.
14139
14140 @item -mlong-calls
14141 @opindex mlong-calls
14142 If not otherwise specified by an attribute, assume all calls might be beyond
14143 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
14144 function address into a register before performing a (otherwise direct) call.
14145 This is the default.
14146
14147 @item -mshort-calls
14148 @opindex short-calls
14149 If not otherwise specified by an attribute, assume all direct calls are
14150 in the range of the @code{b} / @code{bl} instructions, so use these instructions
14151 for direct calls. The default is @option{-mlong-calls}.
14152
14153 @item -msmall16
14154 @opindex msmall16
14155 Assume addresses can be loaded as 16-bit unsigned values. This does not
14156 apply to function addresses for which @option{-mlong-calls} semantics
14157 are in effect.
14158
14159 @item -mfp-mode=@var{mode}
14160 @opindex mfp-mode
14161 Set the prevailing mode of the floating-point unit.
14162 This determines the floating-point mode that is provided and expected
14163 at function call and return time. Making this mode match the mode you
14164 predominantly need at function start can make your programs smaller and
14165 faster by avoiding unnecessary mode switches.
14166
14167 @var{mode} can be set to one the following values:
14168
14169 @table @samp
14170 @item caller
14171 Any mode at function entry is valid, and retained or restored when
14172 the function returns, and when it calls other functions.
14173 This mode is useful for compiling libraries or other compilation units
14174 you might want to incorporate into different programs with different
14175 prevailing FPU modes, and the convenience of being able to use a single
14176 object file outweighs the size and speed overhead for any extra
14177 mode switching that might be needed, compared with what would be needed
14178 with a more specific choice of prevailing FPU mode.
14179
14180 @item truncate
14181 This is the mode used for floating-point calculations with
14182 truncating (i.e.@: round towards zero) rounding mode. That includes
14183 conversion from floating point to integer.
14184
14185 @item round-nearest
14186 This is the mode used for floating-point calculations with
14187 round-to-nearest-or-even rounding mode.
14188
14189 @item int
14190 This is the mode used to perform integer calculations in the FPU, e.g.@:
14191 integer multiply, or integer multiply-and-accumulate.
14192 @end table
14193
14194 The default is @option{-mfp-mode=caller}
14195
14196 @item -mnosplit-lohi
14197 @itemx -mno-postinc
14198 @itemx -mno-postmodify
14199 @opindex mnosplit-lohi
14200 @opindex mno-postinc
14201 @opindex mno-postmodify
14202 Code generation tweaks that disable, respectively, splitting of 32-bit
14203 loads, generation of post-increment addresses, and generation of
14204 post-modify addresses. The defaults are @option{msplit-lohi},
14205 @option{-mpost-inc}, and @option{-mpost-modify}.
14206
14207 @item -mnovect-double
14208 @opindex mno-vect-double
14209 Change the preferred SIMD mode to SImode. The default is
14210 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
14211
14212 @item -max-vect-align=@var{num}
14213 @opindex max-vect-align
14214 The maximum alignment for SIMD vector mode types.
14215 @var{num} may be 4 or 8. The default is 8.
14216 Note that this is an ABI change, even though many library function
14217 interfaces are unaffected if they don't use SIMD vector modes
14218 in places that affect size and/or alignment of relevant types.
14219
14220 @item -msplit-vecmove-early
14221 @opindex msplit-vecmove-early
14222 Split vector moves into single word moves before reload. In theory this
14223 can give better register allocation, but so far the reverse seems to be
14224 generally the case.
14225
14226 @item -m1reg-@var{reg}
14227 @opindex m1reg-
14228 Specify a register to hold the constant @minus{}1, which makes loading small negative
14229 constants and certain bitmasks faster.
14230 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
14231 which specify use of that register as a fixed register,
14232 and @samp{none}, which means that no register is used for this
14233 purpose. The default is @option{-m1reg-none}.
14234
14235 @end table
14236
14237 @node ARC Options
14238 @subsection ARC Options
14239 @cindex ARC options
14240
14241 The following options control the architecture variant for which code
14242 is being compiled:
14243
14244 @c architecture variants
14245 @table @gcctabopt
14246
14247 @item -mbarrel-shifter
14248 @opindex mbarrel-shifter
14249 Generate instructions supported by barrel shifter. This is the default
14250 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
14251
14252 @item -mcpu=@var{cpu}
14253 @opindex mcpu
14254 Set architecture type, register usage, and instruction scheduling
14255 parameters for @var{cpu}. There are also shortcut alias options
14256 available for backward compatibility and convenience. Supported
14257 values for @var{cpu} are
14258
14259 @table @samp
14260 @opindex mA6
14261 @opindex mARC600
14262 @item arc600
14263 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
14264
14265 @item arc601
14266 @opindex mARC601
14267 Compile for ARC601. Alias: @option{-mARC601}.
14268
14269 @item arc700
14270 @opindex mA7
14271 @opindex mARC700
14272 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
14273 This is the default when configured with @option{--with-cpu=arc700}@.
14274
14275 @item arcem
14276 Compile for ARC EM.
14277
14278 @item archs
14279 Compile for ARC HS.
14280
14281 @item em
14282 Compile for ARC EM CPU with no hardware extensions.
14283
14284 @item em4
14285 Compile for ARC EM4 CPU.
14286
14287 @item em4_dmips
14288 Compile for ARC EM4 DMIPS CPU.
14289
14290 @item em4_fpus
14291 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
14292 extension.
14293
14294 @item em4_fpuda
14295 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
14296 double assist instructions.
14297
14298 @item hs
14299 Compile for ARC HS CPU with no hardware extensions except the atomic
14300 instructions.
14301
14302 @item hs34
14303 Compile for ARC HS34 CPU.
14304
14305 @item hs38
14306 Compile for ARC HS38 CPU.
14307
14308 @item hs38_linux
14309 Compile for ARC HS38 CPU with all hardware extensions on.
14310
14311 @item arc600_norm
14312 Compile for ARC 600 CPU with @code{norm} instructions enabled.
14313
14314 @item arc600_mul32x16
14315 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
14316 instructions enabled.
14317
14318 @item arc600_mul64
14319 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
14320 instructions enabled.
14321
14322 @item arc601_norm
14323 Compile for ARC 601 CPU with @code{norm} instructions enabled.
14324
14325 @item arc601_mul32x16
14326 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
14327 instructions enabled.
14328
14329 @item arc601_mul64
14330 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
14331 instructions enabled.
14332
14333 @item nps400
14334 Compile for ARC 700 on NPS400 chip.
14335
14336 @end table
14337
14338 @item -mdpfp
14339 @opindex mdpfp
14340 @itemx -mdpfp-compact
14341 @opindex mdpfp-compact
14342 Generate double-precision FPX instructions, tuned for the compact
14343 implementation.
14344
14345 @item -mdpfp-fast
14346 @opindex mdpfp-fast
14347 Generate double-precision FPX instructions, tuned for the fast
14348 implementation.
14349
14350 @item -mno-dpfp-lrsr
14351 @opindex mno-dpfp-lrsr
14352 Disable @code{lr} and @code{sr} instructions from using FPX extension
14353 aux registers.
14354
14355 @item -mea
14356 @opindex mea
14357 Generate extended arithmetic instructions. Currently only
14358 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
14359 supported. This is always enabled for @option{-mcpu=ARC700}.
14360
14361 @item -mno-mpy
14362 @opindex mno-mpy
14363 Do not generate @code{mpy}-family instructions for ARC700. This option is
14364 deprecated.
14365
14366 @item -mmul32x16
14367 @opindex mmul32x16
14368 Generate 32x16-bit multiply and multiply-accumulate instructions.
14369
14370 @item -mmul64
14371 @opindex mmul64
14372 Generate @code{mul64} and @code{mulu64} instructions.
14373 Only valid for @option{-mcpu=ARC600}.
14374
14375 @item -mnorm
14376 @opindex mnorm
14377 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
14378 is in effect.
14379
14380 @item -mspfp
14381 @opindex mspfp
14382 @itemx -mspfp-compact
14383 @opindex mspfp-compact
14384 Generate single-precision FPX instructions, tuned for the compact
14385 implementation.
14386
14387 @item -mspfp-fast
14388 @opindex mspfp-fast
14389 Generate single-precision FPX instructions, tuned for the fast
14390 implementation.
14391
14392 @item -msimd
14393 @opindex msimd
14394 Enable generation of ARC SIMD instructions via target-specific
14395 builtins. Only valid for @option{-mcpu=ARC700}.
14396
14397 @item -msoft-float
14398 @opindex msoft-float
14399 This option ignored; it is provided for compatibility purposes only.
14400 Software floating-point code is emitted by default, and this default
14401 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
14402 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
14403 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
14404
14405 @item -mswap
14406 @opindex mswap
14407 Generate @code{swap} instructions.
14408
14409 @item -matomic
14410 @opindex matomic
14411 This enables use of the locked load/store conditional extension to implement
14412 atomic memory built-in functions. Not available for ARC 6xx or ARC
14413 EM cores.
14414
14415 @item -mdiv-rem
14416 @opindex mdiv-rem
14417 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
14418
14419 @item -mcode-density
14420 @opindex mcode-density
14421 Enable code density instructions for ARC EM.
14422 This option is on by default for ARC HS.
14423
14424 @item -mll64
14425 @opindex mll64
14426 Enable double load/store operations for ARC HS cores.
14427
14428 @item -mtp-regno=@var{regno}
14429 @opindex mtp-regno
14430 Specify thread pointer register number.
14431
14432 @item -mmpy-option=@var{multo}
14433 @opindex mmpy-option
14434 Compile ARCv2 code with a multiplier design option. You can specify
14435 the option using either a string or numeric value for @var{multo}.
14436 @samp{wlh1} is the default value. The recognized values are:
14437
14438 @table @samp
14439 @item 0
14440 @itemx none
14441 No multiplier available.
14442
14443 @item 1
14444 @itemx w
14445 16x16 multiplier, fully pipelined.
14446 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
14447
14448 @item 2
14449 @itemx wlh1
14450 32x32 multiplier, fully
14451 pipelined (1 stage). The following instructions are additionally
14452 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14453
14454 @item 3
14455 @itemx wlh2
14456 32x32 multiplier, fully pipelined
14457 (2 stages). The following instructions are additionally enabled: @code{mpy},
14458 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14459
14460 @item 4
14461 @itemx wlh3
14462 Two 16x16 multipliers, blocking,
14463 sequential. The following instructions are additionally enabled: @code{mpy},
14464 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14465
14466 @item 5
14467 @itemx wlh4
14468 One 16x16 multiplier, blocking,
14469 sequential. The following instructions are additionally enabled: @code{mpy},
14470 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14471
14472 @item 6
14473 @itemx wlh5
14474 One 32x4 multiplier, blocking,
14475 sequential. The following instructions are additionally enabled: @code{mpy},
14476 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
14477
14478 @item 7
14479 @itemx plus_dmpy
14480 ARC HS SIMD support.
14481
14482 @item 8
14483 @itemx plus_macd
14484 ARC HS SIMD support.
14485
14486 @item 9
14487 @itemx plus_qmacw
14488 ARC HS SIMD support.
14489
14490 @end table
14491
14492 This option is only available for ARCv2 cores@.
14493
14494 @item -mfpu=@var{fpu}
14495 @opindex mfpu
14496 Enables support for specific floating-point hardware extensions for ARCv2
14497 cores. Supported values for @var{fpu} are:
14498
14499 @table @samp
14500
14501 @item fpus
14502 Enables support for single-precision floating-point hardware
14503 extensions@.
14504
14505 @item fpud
14506 Enables support for double-precision floating-point hardware
14507 extensions. The single-precision floating-point extension is also
14508 enabled. Not available for ARC EM@.
14509
14510 @item fpuda
14511 Enables support for double-precision floating-point hardware
14512 extensions using double-precision assist instructions. The single-precision
14513 floating-point extension is also enabled. This option is
14514 only available for ARC EM@.
14515
14516 @item fpuda_div
14517 Enables support for double-precision floating-point hardware
14518 extensions using double-precision assist instructions.
14519 The single-precision floating-point, square-root, and divide
14520 extensions are also enabled. This option is
14521 only available for ARC EM@.
14522
14523 @item fpuda_fma
14524 Enables support for double-precision floating-point hardware
14525 extensions using double-precision assist instructions.
14526 The single-precision floating-point and fused multiply and add
14527 hardware extensions are also enabled. This option is
14528 only available for ARC EM@.
14529
14530 @item fpuda_all
14531 Enables support for double-precision floating-point hardware
14532 extensions using double-precision assist instructions.
14533 All single-precision floating-point hardware extensions are also
14534 enabled. This option is only available for ARC EM@.
14535
14536 @item fpus_div
14537 Enables support for single-precision floating-point, square-root and divide
14538 hardware extensions@.
14539
14540 @item fpud_div
14541 Enables support for double-precision floating-point, square-root and divide
14542 hardware extensions. This option
14543 includes option @samp{fpus_div}. Not available for ARC EM@.
14544
14545 @item fpus_fma
14546 Enables support for single-precision floating-point and
14547 fused multiply and add hardware extensions@.
14548
14549 @item fpud_fma
14550 Enables support for double-precision floating-point and
14551 fused multiply and add hardware extensions. This option
14552 includes option @samp{fpus_fma}. Not available for ARC EM@.
14553
14554 @item fpus_all
14555 Enables support for all single-precision floating-point hardware
14556 extensions@.
14557
14558 @item fpud_all
14559 Enables support for all single- and double-precision floating-point
14560 hardware extensions. Not available for ARC EM@.
14561
14562 @end table
14563
14564 @end table
14565
14566 The following options are passed through to the assembler, and also
14567 define preprocessor macro symbols.
14568
14569 @c Flags used by the assembler, but for which we define preprocessor
14570 @c macro symbols as well.
14571 @table @gcctabopt
14572 @item -mdsp-packa
14573 @opindex mdsp-packa
14574 Passed down to the assembler to enable the DSP Pack A extensions.
14575 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
14576 deprecated.
14577
14578 @item -mdvbf
14579 @opindex mdvbf
14580 Passed down to the assembler to enable the dual Viterbi butterfly
14581 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
14582 option is deprecated.
14583
14584 @c ARC700 4.10 extension instruction
14585 @item -mlock
14586 @opindex mlock
14587 Passed down to the assembler to enable the locked load/store
14588 conditional extension. Also sets the preprocessor symbol
14589 @code{__Xlock}.
14590
14591 @item -mmac-d16
14592 @opindex mmac-d16
14593 Passed down to the assembler. Also sets the preprocessor symbol
14594 @code{__Xxmac_d16}. This option is deprecated.
14595
14596 @item -mmac-24
14597 @opindex mmac-24
14598 Passed down to the assembler. Also sets the preprocessor symbol
14599 @code{__Xxmac_24}. This option is deprecated.
14600
14601 @c ARC700 4.10 extension instruction
14602 @item -mrtsc
14603 @opindex mrtsc
14604 Passed down to the assembler to enable the 64-bit time-stamp counter
14605 extension instruction. Also sets the preprocessor symbol
14606 @code{__Xrtsc}. This option is deprecated.
14607
14608 @c ARC700 4.10 extension instruction
14609 @item -mswape
14610 @opindex mswape
14611 Passed down to the assembler to enable the swap byte ordering
14612 extension instruction. Also sets the preprocessor symbol
14613 @code{__Xswape}.
14614
14615 @item -mtelephony
14616 @opindex mtelephony
14617 Passed down to the assembler to enable dual- and single-operand
14618 instructions for telephony. Also sets the preprocessor symbol
14619 @code{__Xtelephony}. This option is deprecated.
14620
14621 @item -mxy
14622 @opindex mxy
14623 Passed down to the assembler to enable the XY memory extension. Also
14624 sets the preprocessor symbol @code{__Xxy}.
14625
14626 @end table
14627
14628 The following options control how the assembly code is annotated:
14629
14630 @c Assembly annotation options
14631 @table @gcctabopt
14632 @item -misize
14633 @opindex misize
14634 Annotate assembler instructions with estimated addresses.
14635
14636 @item -mannotate-align
14637 @opindex mannotate-align
14638 Explain what alignment considerations lead to the decision to make an
14639 instruction short or long.
14640
14641 @end table
14642
14643 The following options are passed through to the linker:
14644
14645 @c options passed through to the linker
14646 @table @gcctabopt
14647 @item -marclinux
14648 @opindex marclinux
14649 Passed through to the linker, to specify use of the @code{arclinux} emulation.
14650 This option is enabled by default in tool chains built for
14651 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
14652 when profiling is not requested.
14653
14654 @item -marclinux_prof
14655 @opindex marclinux_prof
14656 Passed through to the linker, to specify use of the
14657 @code{arclinux_prof} emulation. This option is enabled by default in
14658 tool chains built for @w{@code{arc-linux-uclibc}} and
14659 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
14660
14661 @end table
14662
14663 The following options control the semantics of generated code:
14664
14665 @c semantically relevant code generation options
14666 @table @gcctabopt
14667 @item -mlong-calls
14668 @opindex mlong-calls
14669 Generate calls as register indirect calls, thus providing access
14670 to the full 32-bit address range.
14671
14672 @item -mmedium-calls
14673 @opindex mmedium-calls
14674 Don't use less than 25-bit addressing range for calls, which is the
14675 offset available for an unconditional branch-and-link
14676 instruction. Conditional execution of function calls is suppressed, to
14677 allow use of the 25-bit range, rather than the 21-bit range with
14678 conditional branch-and-link. This is the default for tool chains built
14679 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
14680
14681 @item -mno-sdata
14682 @opindex mno-sdata
14683 Do not generate sdata references. This is the default for tool chains
14684 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
14685 targets.
14686
14687 @item -mvolatile-cache
14688 @opindex mvolatile-cache
14689 Use ordinarily cached memory accesses for volatile references. This is the
14690 default.
14691
14692 @item -mno-volatile-cache
14693 @opindex mno-volatile-cache
14694 Enable cache bypass for volatile references.
14695
14696 @end table
14697
14698 The following options fine tune code generation:
14699 @c code generation tuning options
14700 @table @gcctabopt
14701 @item -malign-call
14702 @opindex malign-call
14703 Do alignment optimizations for call instructions.
14704
14705 @item -mauto-modify-reg
14706 @opindex mauto-modify-reg
14707 Enable the use of pre/post modify with register displacement.
14708
14709 @item -mbbit-peephole
14710 @opindex mbbit-peephole
14711 Enable bbit peephole2.
14712
14713 @item -mno-brcc
14714 @opindex mno-brcc
14715 This option disables a target-specific pass in @file{arc_reorg} to
14716 generate compare-and-branch (@code{br@var{cc}}) instructions.
14717 It has no effect on
14718 generation of these instructions driven by the combiner pass.
14719
14720 @item -mcase-vector-pcrel
14721 @opindex mcase-vector-pcrel
14722 Use PC-relative switch case tables to enable case table shortening.
14723 This is the default for @option{-Os}.
14724
14725 @item -mcompact-casesi
14726 @opindex mcompact-casesi
14727 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
14728 and only available for ARCv1 cores.
14729
14730 @item -mno-cond-exec
14731 @opindex mno-cond-exec
14732 Disable the ARCompact-specific pass to generate conditional
14733 execution instructions.
14734
14735 Due to delay slot scheduling and interactions between operand numbers,
14736 literal sizes, instruction lengths, and the support for conditional execution,
14737 the target-independent pass to generate conditional execution is often lacking,
14738 so the ARC port has kept a special pass around that tries to find more
14739 conditional execution generation opportunities after register allocation,
14740 branch shortening, and delay slot scheduling have been done. This pass
14741 generally, but not always, improves performance and code size, at the cost of
14742 extra compilation time, which is why there is an option to switch it off.
14743 If you have a problem with call instructions exceeding their allowable
14744 offset range because they are conditionalized, you should consider using
14745 @option{-mmedium-calls} instead.
14746
14747 @item -mearly-cbranchsi
14748 @opindex mearly-cbranchsi
14749 Enable pre-reload use of the @code{cbranchsi} pattern.
14750
14751 @item -mexpand-adddi
14752 @opindex mexpand-adddi
14753 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
14754 @code{add.f}, @code{adc} etc.
14755
14756 @item -mindexed-loads
14757 @opindex mindexed-loads
14758 Enable the use of indexed loads. This can be problematic because some
14759 optimizers then assume that indexed stores exist, which is not
14760 the case.
14761
14762 @opindex mlra
14763 Enable Local Register Allocation. This is still experimental for ARC,
14764 so by default the compiler uses standard reload
14765 (i.e. @option{-mno-lra}).
14766
14767 @item -mlra-priority-none
14768 @opindex mlra-priority-none
14769 Don't indicate any priority for target registers.
14770
14771 @item -mlra-priority-compact
14772 @opindex mlra-priority-compact
14773 Indicate target register priority for r0..r3 / r12..r15.
14774
14775 @item -mlra-priority-noncompact
14776 @opindex mlra-priority-noncompact
14777 Reduce target register priority for r0..r3 / r12..r15.
14778
14779 @item -mno-millicode
14780 @opindex mno-millicode
14781 When optimizing for size (using @option{-Os}), prologues and epilogues
14782 that have to save or restore a large number of registers are often
14783 shortened by using call to a special function in libgcc; this is
14784 referred to as a @emph{millicode} call. As these calls can pose
14785 performance issues, and/or cause linking issues when linking in a
14786 nonstandard way, this option is provided to turn off millicode call
14787 generation.
14788
14789 @item -mmixed-code
14790 @opindex mmixed-code
14791 Tweak register allocation to help 16-bit instruction generation.
14792 This generally has the effect of decreasing the average instruction size
14793 while increasing the instruction count.
14794
14795 @item -mq-class
14796 @opindex mq-class
14797 Enable @samp{q} instruction alternatives.
14798 This is the default for @option{-Os}.
14799
14800 @item -mRcq
14801 @opindex mRcq
14802 Enable @samp{Rcq} constraint handling.
14803 Most short code generation depends on this.
14804 This is the default.
14805
14806 @item -mRcw
14807 @opindex mRcw
14808 Enable @samp{Rcw} constraint handling.
14809 Most ccfsm condexec mostly depends on this.
14810 This is the default.
14811
14812 @item -msize-level=@var{level}
14813 @opindex msize-level
14814 Fine-tune size optimization with regards to instruction lengths and alignment.
14815 The recognized values for @var{level} are:
14816 @table @samp
14817 @item 0
14818 No size optimization. This level is deprecated and treated like @samp{1}.
14819
14820 @item 1
14821 Short instructions are used opportunistically.
14822
14823 @item 2
14824 In addition, alignment of loops and of code after barriers are dropped.
14825
14826 @item 3
14827 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
14828
14829 @end table
14830
14831 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
14832 the behavior when this is not set is equivalent to level @samp{1}.
14833
14834 @item -mtune=@var{cpu}
14835 @opindex mtune
14836 Set instruction scheduling parameters for @var{cpu}, overriding any implied
14837 by @option{-mcpu=}.
14838
14839 Supported values for @var{cpu} are
14840
14841 @table @samp
14842 @item ARC600
14843 Tune for ARC600 CPU.
14844
14845 @item ARC601
14846 Tune for ARC601 CPU.
14847
14848 @item ARC700
14849 Tune for ARC700 CPU with standard multiplier block.
14850
14851 @item ARC700-xmac
14852 Tune for ARC700 CPU with XMAC block.
14853
14854 @item ARC725D
14855 Tune for ARC725D CPU.
14856
14857 @item ARC750D
14858 Tune for ARC750D CPU.
14859
14860 @end table
14861
14862 @item -mmultcost=@var{num}
14863 @opindex mmultcost
14864 Cost to assume for a multiply instruction, with @samp{4} being equal to a
14865 normal instruction.
14866
14867 @item -munalign-prob-threshold=@var{probability}
14868 @opindex munalign-prob-threshold
14869 Set probability threshold for unaligning branches.
14870 When tuning for @samp{ARC700} and optimizing for speed, branches without
14871 filled delay slot are preferably emitted unaligned and long, unless
14872 profiling indicates that the probability for the branch to be taken
14873 is below @var{probability}. @xref{Cross-profiling}.
14874 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
14875
14876 @end table
14877
14878 The following options are maintained for backward compatibility, but
14879 are now deprecated and will be removed in a future release:
14880
14881 @c Deprecated options
14882 @table @gcctabopt
14883
14884 @item -margonaut
14885 @opindex margonaut
14886 Obsolete FPX.
14887
14888 @item -mbig-endian
14889 @opindex mbig-endian
14890 @itemx -EB
14891 @opindex EB
14892 Compile code for big-endian targets. Use of these options is now
14893 deprecated. Big-endian code is supported by configuring GCC to build
14894 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
14895 for which big endian is the default.
14896
14897 @item -mlittle-endian
14898 @opindex mlittle-endian
14899 @itemx -EL
14900 @opindex EL
14901 Compile code for little-endian targets. Use of these options is now
14902 deprecated. Little-endian code is supported by configuring GCC to build
14903 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
14904 for which little endian is the default.
14905
14906 @item -mbarrel_shifter
14907 @opindex mbarrel_shifter
14908 Replaced by @option{-mbarrel-shifter}.
14909
14910 @item -mdpfp_compact
14911 @opindex mdpfp_compact
14912 Replaced by @option{-mdpfp-compact}.
14913
14914 @item -mdpfp_fast
14915 @opindex mdpfp_fast
14916 Replaced by @option{-mdpfp-fast}.
14917
14918 @item -mdsp_packa
14919 @opindex mdsp_packa
14920 Replaced by @option{-mdsp-packa}.
14921
14922 @item -mEA
14923 @opindex mEA
14924 Replaced by @option{-mea}.
14925
14926 @item -mmac_24
14927 @opindex mmac_24
14928 Replaced by @option{-mmac-24}.
14929
14930 @item -mmac_d16
14931 @opindex mmac_d16
14932 Replaced by @option{-mmac-d16}.
14933
14934 @item -mspfp_compact
14935 @opindex mspfp_compact
14936 Replaced by @option{-mspfp-compact}.
14937
14938 @item -mspfp_fast
14939 @opindex mspfp_fast
14940 Replaced by @option{-mspfp-fast}.
14941
14942 @item -mtune=@var{cpu}
14943 @opindex mtune
14944 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
14945 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
14946 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
14947
14948 @item -multcost=@var{num}
14949 @opindex multcost
14950 Replaced by @option{-mmultcost}.
14951
14952 @end table
14953
14954 @node ARM Options
14955 @subsection ARM Options
14956 @cindex ARM options
14957
14958 These @samp{-m} options are defined for the ARM port:
14959
14960 @table @gcctabopt
14961 @item -mabi=@var{name}
14962 @opindex mabi
14963 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
14964 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
14965
14966 @item -mapcs-frame
14967 @opindex mapcs-frame
14968 Generate a stack frame that is compliant with the ARM Procedure Call
14969 Standard for all functions, even if this is not strictly necessary for
14970 correct execution of the code. Specifying @option{-fomit-frame-pointer}
14971 with this option causes the stack frames not to be generated for
14972 leaf functions. The default is @option{-mno-apcs-frame}.
14973 This option is deprecated.
14974
14975 @item -mapcs
14976 @opindex mapcs
14977 This is a synonym for @option{-mapcs-frame} and is deprecated.
14978
14979 @ignore
14980 @c not currently implemented
14981 @item -mapcs-stack-check
14982 @opindex mapcs-stack-check
14983 Generate code to check the amount of stack space available upon entry to
14984 every function (that actually uses some stack space). If there is
14985 insufficient space available then either the function
14986 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
14987 called, depending upon the amount of stack space required. The runtime
14988 system is required to provide these functions. The default is
14989 @option{-mno-apcs-stack-check}, since this produces smaller code.
14990
14991 @c not currently implemented
14992 @item -mapcs-reentrant
14993 @opindex mapcs-reentrant
14994 Generate reentrant, position-independent code. The default is
14995 @option{-mno-apcs-reentrant}.
14996 @end ignore
14997
14998 @item -mthumb-interwork
14999 @opindex mthumb-interwork
15000 Generate code that supports calling between the ARM and Thumb
15001 instruction sets. Without this option, on pre-v5 architectures, the
15002 two instruction sets cannot be reliably used inside one program. The
15003 default is @option{-mno-thumb-interwork}, since slightly larger code
15004 is generated when @option{-mthumb-interwork} is specified. In AAPCS
15005 configurations this option is meaningless.
15006
15007 @item -mno-sched-prolog
15008 @opindex mno-sched-prolog
15009 Prevent the reordering of instructions in the function prologue, or the
15010 merging of those instruction with the instructions in the function's
15011 body. This means that all functions start with a recognizable set
15012 of instructions (or in fact one of a choice from a small set of
15013 different function prologues), and this information can be used to
15014 locate the start of functions inside an executable piece of code. The
15015 default is @option{-msched-prolog}.
15016
15017 @item -mfloat-abi=@var{name}
15018 @opindex mfloat-abi
15019 Specifies which floating-point ABI to use. Permissible values
15020 are: @samp{soft}, @samp{softfp} and @samp{hard}.
15021
15022 Specifying @samp{soft} causes GCC to generate output containing
15023 library calls for floating-point operations.
15024 @samp{softfp} allows the generation of code using hardware floating-point
15025 instructions, but still uses the soft-float calling conventions.
15026 @samp{hard} allows generation of floating-point instructions
15027 and uses FPU-specific calling conventions.
15028
15029 The default depends on the specific target configuration. Note that
15030 the hard-float and soft-float ABIs are not link-compatible; you must
15031 compile your entire program with the same ABI, and link with a
15032 compatible set of libraries.
15033
15034 @item -mlittle-endian
15035 @opindex mlittle-endian
15036 Generate code for a processor running in little-endian mode. This is
15037 the default for all standard configurations.
15038
15039 @item -mbig-endian
15040 @opindex mbig-endian
15041 Generate code for a processor running in big-endian mode; the default is
15042 to compile code for a little-endian processor.
15043
15044 @item -march=@var{name}
15045 @opindex march
15046 This specifies the name of the target ARM architecture. GCC uses this
15047 name to determine what kind of instructions it can emit when generating
15048 assembly code. This option can be used in conjunction with or instead
15049 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
15050 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
15051 @samp{armv5}, @samp{armv5e}, @samp{armv5t}, @samp{armv5te},
15052 @samp{armv6}, @samp{armv6-m}, @samp{armv6j}, @samp{armv6k},
15053 @samp{armv6kz}, @samp{armv6s-m},
15054 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk},
15055 @samp{armv7}, @samp{armv7-a}, @samp{armv7-m}, @samp{armv7-r}, @samp{armv7e-m},
15056 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
15057 @samp{armv8.1-a+crc}, @samp{armv8-m.base}, @samp{armv8-m.main},
15058 @samp{armv8-m.main+dsp}, @samp{iwmmxt}, @samp{iwmmxt2}.
15059
15060 Architecture revisions older than @samp{armv4t} are deprecated.
15061
15062 @option{-march=armv6s-m} is the @samp{armv6-m} architecture with support for
15063 the (now mandatory) SVC instruction.
15064
15065 @option{-march=armv6zk} is an alias for @samp{armv6kz}, existing for backwards
15066 compatibility.
15067
15068 @option{-march=armv7ve} is the @samp{armv7-a} architecture with virtualization
15069 extensions.
15070
15071 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
15072 architecture together with the optional CRC32 extensions.
15073
15074 @option{-march=armv8.1-a} enables compiler support for the ARMv8.1-A
15075 architecture. This also enables the features provided by
15076 @option{-march=armv8-a+crc}.
15077
15078 @option{-march=armv8.2-a} enables compiler support for the ARMv8.2-A
15079 architecture. This also enables the features provided by
15080 @option{-march=armv8.1-a}.
15081
15082 @option{-march=armv8.2-a+fp16} enables compiler support for the
15083 ARMv8.2-A architecture with the optional FP16 instructions extension.
15084 This also enables the features provided by @option{-march=armv8.1-a}
15085 and implies @option{-mfp16-format=ieee}.
15086
15087 @option{-march=native} causes the compiler to auto-detect the architecture
15088 of the build computer. At present, this feature is only supported on
15089 GNU/Linux, and not all architectures are recognized. If the auto-detect
15090 is unsuccessful the option has no effect.
15091
15092 @item -mtune=@var{name}
15093 @opindex mtune
15094 This option specifies the name of the target ARM processor for
15095 which GCC should tune the performance of the code.
15096 For some ARM implementations better performance can be obtained by using
15097 this option.
15098 Permissible names are: @samp{arm2}, @samp{arm250},
15099 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
15100 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
15101 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
15102 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
15103 @samp{arm720},
15104 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
15105 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
15106 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
15107 @samp{strongarm1110},
15108 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
15109 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
15110 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
15111 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
15112 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
15113 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
15114 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
15115 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
15116 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
15117 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
15118 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-r4},
15119 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
15120 @samp{cortex-m33},
15121 @samp{cortex-m23},
15122 @samp{cortex-m7},
15123 @samp{cortex-m4},
15124 @samp{cortex-m3},
15125 @samp{cortex-m1},
15126 @samp{cortex-m0},
15127 @samp{cortex-m0plus},
15128 @samp{cortex-m1.small-multiply},
15129 @samp{cortex-m0.small-multiply},
15130 @samp{cortex-m0plus.small-multiply},
15131 @samp{exynos-m1},
15132 @samp{falkor},
15133 @samp{qdf24xx},
15134 @samp{marvell-pj4},
15135 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
15136 @samp{fa526}, @samp{fa626},
15137 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
15138 @samp{xgene1}.
15139
15140 Additionally, this option can specify that GCC should tune the performance
15141 of the code for a big.LITTLE system. Permissible names are:
15142 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
15143 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15144 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}.
15145
15146 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
15147 performance for a blend of processors within architecture @var{arch}.
15148 The aim is to generate code that run well on the current most popular
15149 processors, balancing between optimizations that benefit some CPUs in the
15150 range, and avoiding performance pitfalls of other CPUs. The effects of
15151 this option may change in future GCC versions as CPU models come and go.
15152
15153 @option{-mtune=native} causes the compiler to auto-detect the CPU
15154 of the build computer. At present, this feature is only supported on
15155 GNU/Linux, and not all architectures are recognized. If the auto-detect is
15156 unsuccessful the option has no effect.
15157
15158 @item -mcpu=@var{name}
15159 @opindex mcpu
15160 This specifies the name of the target ARM processor. GCC uses this name
15161 to derive the name of the target ARM architecture (as if specified
15162 by @option{-march}) and the ARM processor type for which to tune for
15163 performance (as if specified by @option{-mtune}). Where this option
15164 is used in conjunction with @option{-march} or @option{-mtune},
15165 those options take precedence over the appropriate part of this option.
15166
15167 Permissible names for this option are the same as those for
15168 @option{-mtune}.
15169
15170 @option{-mcpu=generic-@var{arch}} is also permissible, and is
15171 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
15172 See @option{-mtune} for more information.
15173
15174 @option{-mcpu=native} causes the compiler to auto-detect the CPU
15175 of the build computer. At present, this feature is only supported on
15176 GNU/Linux, and not all architectures are recognized. If the auto-detect
15177 is unsuccessful the option has no effect.
15178
15179 @item -mfpu=@var{name}
15180 @opindex mfpu
15181 This specifies what floating-point hardware (or hardware emulation) is
15182 available on the target. Permissible names are: @samp{vfpv2}, @samp{vfpv3},
15183 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
15184 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
15185 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
15186 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
15187 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
15188 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
15189 is an alias for @samp{vfpv2}.
15190
15191 If @option{-msoft-float} is specified this specifies the format of
15192 floating-point values.
15193
15194 If the selected floating-point hardware includes the NEON extension
15195 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
15196 operations are not generated by GCC's auto-vectorization pass unless
15197 @option{-funsafe-math-optimizations} is also specified. This is
15198 because NEON hardware does not fully implement the IEEE 754 standard for
15199 floating-point arithmetic (in particular denormal values are treated as
15200 zero), so the use of NEON instructions may lead to a loss of precision.
15201
15202 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}).
15203
15204 @item -mfp16-format=@var{name}
15205 @opindex mfp16-format
15206 Specify the format of the @code{__fp16} half-precision floating-point type.
15207 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
15208 the default is @samp{none}, in which case the @code{__fp16} type is not
15209 defined. @xref{Half-Precision}, for more information.
15210
15211 @item -mstructure-size-boundary=@var{n}
15212 @opindex mstructure-size-boundary
15213 The sizes of all structures and unions are rounded up to a multiple
15214 of the number of bits set by this option. Permissible values are 8, 32
15215 and 64. The default value varies for different toolchains. For the COFF
15216 targeted toolchain the default value is 8. A value of 64 is only allowed
15217 if the underlying ABI supports it.
15218
15219 Specifying a larger number can produce faster, more efficient code, but
15220 can also increase the size of the program. Different values are potentially
15221 incompatible. Code compiled with one value cannot necessarily expect to
15222 work with code or libraries compiled with another value, if they exchange
15223 information using structures or unions.
15224
15225 @item -mabort-on-noreturn
15226 @opindex mabort-on-noreturn
15227 Generate a call to the function @code{abort} at the end of a
15228 @code{noreturn} function. It is executed if the function tries to
15229 return.
15230
15231 @item -mlong-calls
15232 @itemx -mno-long-calls
15233 @opindex mlong-calls
15234 @opindex mno-long-calls
15235 Tells the compiler to perform function calls by first loading the
15236 address of the function into a register and then performing a subroutine
15237 call on this register. This switch is needed if the target function
15238 lies outside of the 64-megabyte addressing range of the offset-based
15239 version of subroutine call instruction.
15240
15241 Even if this switch is enabled, not all function calls are turned
15242 into long calls. The heuristic is that static functions, functions
15243 that have the @code{short_call} attribute, functions that are inside
15244 the scope of a @code{#pragma no_long_calls} directive, and functions whose
15245 definitions have already been compiled within the current compilation
15246 unit are not turned into long calls. The exceptions to this rule are
15247 that weak function definitions, functions with the @code{long_call}
15248 attribute or the @code{section} attribute, and functions that are within
15249 the scope of a @code{#pragma long_calls} directive are always
15250 turned into long calls.
15251
15252 This feature is not enabled by default. Specifying
15253 @option{-mno-long-calls} restores the default behavior, as does
15254 placing the function calls within the scope of a @code{#pragma
15255 long_calls_off} directive. Note these switches have no effect on how
15256 the compiler generates code to handle function calls via function
15257 pointers.
15258
15259 @item -msingle-pic-base
15260 @opindex msingle-pic-base
15261 Treat the register used for PIC addressing as read-only, rather than
15262 loading it in the prologue for each function. The runtime system is
15263 responsible for initializing this register with an appropriate value
15264 before execution begins.
15265
15266 @item -mpic-register=@var{reg}
15267 @opindex mpic-register
15268 Specify the register to be used for PIC addressing.
15269 For standard PIC base case, the default is any suitable register
15270 determined by compiler. For single PIC base case, the default is
15271 @samp{R9} if target is EABI based or stack-checking is enabled,
15272 otherwise the default is @samp{R10}.
15273
15274 @item -mpic-data-is-text-relative
15275 @opindex mpic-data-is-text-relative
15276 Assume that the displacement between the text and data segments is fixed
15277 at static link time. This permits using PC-relative addressing
15278 operations to access data known to be in the data segment. For
15279 non-VxWorks RTP targets, this option is enabled by default. When
15280 disabled on such targets, it will enable @option{-msingle-pic-base} by
15281 default.
15282
15283 @item -mpoke-function-name
15284 @opindex mpoke-function-name
15285 Write the name of each function into the text section, directly
15286 preceding the function prologue. The generated code is similar to this:
15287
15288 @smallexample
15289 t0
15290 .ascii "arm_poke_function_name", 0
15291 .align
15292 t1
15293 .word 0xff000000 + (t1 - t0)
15294 arm_poke_function_name
15295 mov ip, sp
15296 stmfd sp!, @{fp, ip, lr, pc@}
15297 sub fp, ip, #4
15298 @end smallexample
15299
15300 When performing a stack backtrace, code can inspect the value of
15301 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
15302 location @code{pc - 12} and the top 8 bits are set, then we know that
15303 there is a function name embedded immediately preceding this location
15304 and has length @code{((pc[-3]) & 0xff000000)}.
15305
15306 @item -mthumb
15307 @itemx -marm
15308 @opindex marm
15309 @opindex mthumb
15310
15311 Select between generating code that executes in ARM and Thumb
15312 states. The default for most configurations is to generate code
15313 that executes in ARM state, but the default can be changed by
15314 configuring GCC with the @option{--with-mode=}@var{state}
15315 configure option.
15316
15317 You can also override the ARM and Thumb mode for each function
15318 by using the @code{target("thumb")} and @code{target("arm")} function attributes
15319 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
15320
15321 @item -mtpcs-frame
15322 @opindex mtpcs-frame
15323 Generate a stack frame that is compliant with the Thumb Procedure Call
15324 Standard for all non-leaf functions. (A leaf function is one that does
15325 not call any other functions.) The default is @option{-mno-tpcs-frame}.
15326
15327 @item -mtpcs-leaf-frame
15328 @opindex mtpcs-leaf-frame
15329 Generate a stack frame that is compliant with the Thumb Procedure Call
15330 Standard for all leaf functions. (A leaf function is one that does
15331 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
15332
15333 @item -mcallee-super-interworking
15334 @opindex mcallee-super-interworking
15335 Gives all externally visible functions in the file being compiled an ARM
15336 instruction set header which switches to Thumb mode before executing the
15337 rest of the function. This allows these functions to be called from
15338 non-interworking code. This option is not valid in AAPCS configurations
15339 because interworking is enabled by default.
15340
15341 @item -mcaller-super-interworking
15342 @opindex mcaller-super-interworking
15343 Allows calls via function pointers (including virtual functions) to
15344 execute correctly regardless of whether the target code has been
15345 compiled for interworking or not. There is a small overhead in the cost
15346 of executing a function pointer if this option is enabled. This option
15347 is not valid in AAPCS configurations because interworking is enabled
15348 by default.
15349
15350 @item -mtp=@var{name}
15351 @opindex mtp
15352 Specify the access model for the thread local storage pointer. The valid
15353 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
15354 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
15355 (supported in the arm6k architecture), and @samp{auto}, which uses the
15356 best available method for the selected processor. The default setting is
15357 @samp{auto}.
15358
15359 @item -mtls-dialect=@var{dialect}
15360 @opindex mtls-dialect
15361 Specify the dialect to use for accessing thread local storage. Two
15362 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
15363 @samp{gnu} dialect selects the original GNU scheme for supporting
15364 local and global dynamic TLS models. The @samp{gnu2} dialect
15365 selects the GNU descriptor scheme, which provides better performance
15366 for shared libraries. The GNU descriptor scheme is compatible with
15367 the original scheme, but does require new assembler, linker and
15368 library support. Initial and local exec TLS models are unaffected by
15369 this option and always use the original scheme.
15370
15371 @item -mword-relocations
15372 @opindex mword-relocations
15373 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
15374 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
15375 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
15376 is specified.
15377
15378 @item -mfix-cortex-m3-ldrd
15379 @opindex mfix-cortex-m3-ldrd
15380 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
15381 with overlapping destination and base registers are used. This option avoids
15382 generating these instructions. This option is enabled by default when
15383 @option{-mcpu=cortex-m3} is specified.
15384
15385 @item -munaligned-access
15386 @itemx -mno-unaligned-access
15387 @opindex munaligned-access
15388 @opindex mno-unaligned-access
15389 Enables (or disables) reading and writing of 16- and 32- bit values
15390 from addresses that are not 16- or 32- bit aligned. By default
15391 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
15392 ARMv8-M Baseline architectures, and enabled for all other
15393 architectures. If unaligned access is not enabled then words in packed
15394 data structures are accessed a byte at a time.
15395
15396 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
15397 generated object file to either true or false, depending upon the
15398 setting of this option. If unaligned access is enabled then the
15399 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
15400 defined.
15401
15402 @item -mneon-for-64bits
15403 @opindex mneon-for-64bits
15404 Enables using Neon to handle scalar 64-bits operations. This is
15405 disabled by default since the cost of moving data from core registers
15406 to Neon is high.
15407
15408 @item -mslow-flash-data
15409 @opindex mslow-flash-data
15410 Assume loading data from flash is slower than fetching instruction.
15411 Therefore literal load is minimized for better performance.
15412 This option is only supported when compiling for ARMv7 M-profile and
15413 off by default.
15414
15415 @item -masm-syntax-unified
15416 @opindex masm-syntax-unified
15417 Assume inline assembler is using unified asm syntax. The default is
15418 currently off which implies divided syntax. This option has no impact
15419 on Thumb2. However, this may change in future releases of GCC.
15420 Divided syntax should be considered deprecated.
15421
15422 @item -mrestrict-it
15423 @opindex mrestrict-it
15424 Restricts generation of IT blocks to conform to the rules of ARMv8.
15425 IT blocks can only contain a single 16-bit instruction from a select
15426 set of instructions. This option is on by default for ARMv8 Thumb mode.
15427
15428 @item -mprint-tune-info
15429 @opindex mprint-tune-info
15430 Print CPU tuning information as comment in assembler file. This is
15431 an option used only for regression testing of the compiler and not
15432 intended for ordinary use in compiling code. This option is disabled
15433 by default.
15434
15435 @item -mpure-code
15436 @opindex mpure-code
15437 Do not allow constant data to be placed in code sections.
15438 Additionally, when compiling for ELF object format give all text sections the
15439 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
15440 is only available when generating non-pic code for ARMv7-M targets.
15441
15442 @item -mcmse
15443 @opindex mcmse
15444 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
15445 Development Tools Engineering Specification", which can be found on
15446 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
15447 @end table
15448
15449 @node AVR Options
15450 @subsection AVR Options
15451 @cindex AVR Options
15452
15453 These options are defined for AVR implementations:
15454
15455 @table @gcctabopt
15456 @item -mmcu=@var{mcu}
15457 @opindex mmcu
15458 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
15459
15460 The default for this option is@tie{}@samp{avr2}.
15461
15462 GCC supports the following AVR devices and ISAs:
15463
15464 @include avr-mmcu.texi
15465
15466 @item -mabsdata
15467 @opindex mabsdata
15468
15469 Assume that all data in static storage can be accessed by LDS / STS
15470 instructions. This option has only an effect on reduced Tiny devices like
15471 ATtiny40. See also the @code{absdata}
15472 @ref{AVR Variable Attributes,variable attribute}.
15473
15474 @item -maccumulate-args
15475 @opindex maccumulate-args
15476 Accumulate outgoing function arguments and acquire/release the needed
15477 stack space for outgoing function arguments once in function
15478 prologue/epilogue. Without this option, outgoing arguments are pushed
15479 before calling a function and popped afterwards.
15480
15481 Popping the arguments after the function call can be expensive on
15482 AVR so that accumulating the stack space might lead to smaller
15483 executables because arguments need not be removed from the
15484 stack after such a function call.
15485
15486 This option can lead to reduced code size for functions that perform
15487 several calls to functions that get their arguments on the stack like
15488 calls to printf-like functions.
15489
15490 @item -mbranch-cost=@var{cost}
15491 @opindex mbranch-cost
15492 Set the branch costs for conditional branch instructions to
15493 @var{cost}. Reasonable values for @var{cost} are small, non-negative
15494 integers. The default branch cost is 0.
15495
15496 @item -mcall-prologues
15497 @opindex mcall-prologues
15498 Functions prologues/epilogues are expanded as calls to appropriate
15499 subroutines. Code size is smaller.
15500
15501 @item -mint8
15502 @opindex mint8
15503 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
15504 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
15505 and @code{long long} is 4 bytes. Please note that this option does not
15506 conform to the C standards, but it results in smaller code
15507 size.
15508
15509 @item -mn-flash=@var{num}
15510 @opindex mn-flash
15511 Assume that the flash memory has a size of
15512 @var{num} times 64@tie{}KiB.
15513
15514 @item -mno-interrupts
15515 @opindex mno-interrupts
15516 Generated code is not compatible with hardware interrupts.
15517 Code size is smaller.
15518
15519 @item -mrelax
15520 @opindex mrelax
15521 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
15522 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
15523 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
15524 the assembler's command line and the @option{--relax} option to the
15525 linker's command line.
15526
15527 Jump relaxing is performed by the linker because jump offsets are not
15528 known before code is located. Therefore, the assembler code generated by the
15529 compiler is the same, but the instructions in the executable may
15530 differ from instructions in the assembler code.
15531
15532 Relaxing must be turned on if linker stubs are needed, see the
15533 section on @code{EIND} and linker stubs below.
15534
15535 @item -mrmw
15536 @opindex mrmw
15537 Assume that the device supports the Read-Modify-Write
15538 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
15539
15540 @item -msp8
15541 @opindex msp8
15542 Treat the stack pointer register as an 8-bit register,
15543 i.e.@: assume the high byte of the stack pointer is zero.
15544 In general, you don't need to set this option by hand.
15545
15546 This option is used internally by the compiler to select and
15547 build multilibs for architectures @code{avr2} and @code{avr25}.
15548 These architectures mix devices with and without @code{SPH}.
15549 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
15550 the compiler driver adds or removes this option from the compiler
15551 proper's command line, because the compiler then knows if the device
15552 or architecture has an 8-bit stack pointer and thus no @code{SPH}
15553 register or not.
15554
15555 @item -mstrict-X
15556 @opindex mstrict-X
15557 Use address register @code{X} in a way proposed by the hardware. This means
15558 that @code{X} is only used in indirect, post-increment or
15559 pre-decrement addressing.
15560
15561 Without this option, the @code{X} register may be used in the same way
15562 as @code{Y} or @code{Z} which then is emulated by additional
15563 instructions.
15564 For example, loading a value with @code{X+const} addressing with a
15565 small non-negative @code{const < 64} to a register @var{Rn} is
15566 performed as
15567
15568 @example
15569 adiw r26, const ; X += const
15570 ld @var{Rn}, X ; @var{Rn} = *X
15571 sbiw r26, const ; X -= const
15572 @end example
15573
15574 @item -mtiny-stack
15575 @opindex mtiny-stack
15576 Only change the lower 8@tie{}bits of the stack pointer.
15577
15578 @item -mfract-convert-truncate
15579 @opindex mfract-convert-truncate
15580 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
15581
15582 @item -nodevicelib
15583 @opindex nodevicelib
15584 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
15585
15586 @item -Waddr-space-convert
15587 @opindex Waddr-space-convert
15588 Warn about conversions between address spaces in the case where the
15589 resulting address space is not contained in the incoming address space.
15590
15591 @item -Wmisspelled-isr
15592 @opindex Wmisspelled-isr
15593 Warn if the ISR is misspelled, i.e. without __vector prefix.
15594 Enabled by default.
15595 @end table
15596
15597 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
15598 @cindex @code{EIND}
15599 Pointers in the implementation are 16@tie{}bits wide.
15600 The address of a function or label is represented as word address so
15601 that indirect jumps and calls can target any code address in the
15602 range of 64@tie{}Ki words.
15603
15604 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
15605 bytes of program memory space, there is a special function register called
15606 @code{EIND} that serves as most significant part of the target address
15607 when @code{EICALL} or @code{EIJMP} instructions are used.
15608
15609 Indirect jumps and calls on these devices are handled as follows by
15610 the compiler and are subject to some limitations:
15611
15612 @itemize @bullet
15613
15614 @item
15615 The compiler never sets @code{EIND}.
15616
15617 @item
15618 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
15619 instructions or might read @code{EIND} directly in order to emulate an
15620 indirect call/jump by means of a @code{RET} instruction.
15621
15622 @item
15623 The compiler assumes that @code{EIND} never changes during the startup
15624 code or during the application. In particular, @code{EIND} is not
15625 saved/restored in function or interrupt service routine
15626 prologue/epilogue.
15627
15628 @item
15629 For indirect calls to functions and computed goto, the linker
15630 generates @emph{stubs}. Stubs are jump pads sometimes also called
15631 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
15632 The stub contains a direct jump to the desired address.
15633
15634 @item
15635 Linker relaxation must be turned on so that the linker generates
15636 the stubs correctly in all situations. See the compiler option
15637 @option{-mrelax} and the linker option @option{--relax}.
15638 There are corner cases where the linker is supposed to generate stubs
15639 but aborts without relaxation and without a helpful error message.
15640
15641 @item
15642 The default linker script is arranged for code with @code{EIND = 0}.
15643 If code is supposed to work for a setup with @code{EIND != 0}, a custom
15644 linker script has to be used in order to place the sections whose
15645 name start with @code{.trampolines} into the segment where @code{EIND}
15646 points to.
15647
15648 @item
15649 The startup code from libgcc never sets @code{EIND}.
15650 Notice that startup code is a blend of code from libgcc and AVR-LibC.
15651 For the impact of AVR-LibC on @code{EIND}, see the
15652 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
15653
15654 @item
15655 It is legitimate for user-specific startup code to set up @code{EIND}
15656 early, for example by means of initialization code located in
15657 section @code{.init3}. Such code runs prior to general startup code
15658 that initializes RAM and calls constructors, but after the bit
15659 of startup code from AVR-LibC that sets @code{EIND} to the segment
15660 where the vector table is located.
15661 @example
15662 #include <avr/io.h>
15663
15664 static void
15665 __attribute__((section(".init3"),naked,used,no_instrument_function))
15666 init3_set_eind (void)
15667 @{
15668 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
15669 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
15670 @}
15671 @end example
15672
15673 @noindent
15674 The @code{__trampolines_start} symbol is defined in the linker script.
15675
15676 @item
15677 Stubs are generated automatically by the linker if
15678 the following two conditions are met:
15679 @itemize @minus
15680
15681 @item The address of a label is taken by means of the @code{gs} modifier
15682 (short for @emph{generate stubs}) like so:
15683 @example
15684 LDI r24, lo8(gs(@var{func}))
15685 LDI r25, hi8(gs(@var{func}))
15686 @end example
15687 @item The final location of that label is in a code segment
15688 @emph{outside} the segment where the stubs are located.
15689 @end itemize
15690
15691 @item
15692 The compiler emits such @code{gs} modifiers for code labels in the
15693 following situations:
15694 @itemize @minus
15695 @item Taking address of a function or code label.
15696 @item Computed goto.
15697 @item If prologue-save function is used, see @option{-mcall-prologues}
15698 command-line option.
15699 @item Switch/case dispatch tables. If you do not want such dispatch
15700 tables you can specify the @option{-fno-jump-tables} command-line option.
15701 @item C and C++ constructors/destructors called during startup/shutdown.
15702 @item If the tools hit a @code{gs()} modifier explained above.
15703 @end itemize
15704
15705 @item
15706 Jumping to non-symbolic addresses like so is @emph{not} supported:
15707
15708 @example
15709 int main (void)
15710 @{
15711 /* Call function at word address 0x2 */
15712 return ((int(*)(void)) 0x2)();
15713 @}
15714 @end example
15715
15716 Instead, a stub has to be set up, i.e.@: the function has to be called
15717 through a symbol (@code{func_4} in the example):
15718
15719 @example
15720 int main (void)
15721 @{
15722 extern int func_4 (void);
15723
15724 /* Call function at byte address 0x4 */
15725 return func_4();
15726 @}
15727 @end example
15728
15729 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
15730 Alternatively, @code{func_4} can be defined in the linker script.
15731 @end itemize
15732
15733 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
15734 @cindex @code{RAMPD}
15735 @cindex @code{RAMPX}
15736 @cindex @code{RAMPY}
15737 @cindex @code{RAMPZ}
15738 Some AVR devices support memories larger than the 64@tie{}KiB range
15739 that can be accessed with 16-bit pointers. To access memory locations
15740 outside this 64@tie{}KiB range, the content of a @code{RAMP}
15741 register is used as high part of the address:
15742 The @code{X}, @code{Y}, @code{Z} address register is concatenated
15743 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
15744 register, respectively, to get a wide address. Similarly,
15745 @code{RAMPD} is used together with direct addressing.
15746
15747 @itemize
15748 @item
15749 The startup code initializes the @code{RAMP} special function
15750 registers with zero.
15751
15752 @item
15753 If a @ref{AVR Named Address Spaces,named address space} other than
15754 generic or @code{__flash} is used, then @code{RAMPZ} is set
15755 as needed before the operation.
15756
15757 @item
15758 If the device supports RAM larger than 64@tie{}KiB and the compiler
15759 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
15760 is reset to zero after the operation.
15761
15762 @item
15763 If the device comes with a specific @code{RAMP} register, the ISR
15764 prologue/epilogue saves/restores that SFR and initializes it with
15765 zero in case the ISR code might (implicitly) use it.
15766
15767 @item
15768 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
15769 If you use inline assembler to read from locations outside the
15770 16-bit address range and change one of the @code{RAMP} registers,
15771 you must reset it to zero after the access.
15772
15773 @end itemize
15774
15775 @subsubsection AVR Built-in Macros
15776
15777 GCC defines several built-in macros so that the user code can test
15778 for the presence or absence of features. Almost any of the following
15779 built-in macros are deduced from device capabilities and thus
15780 triggered by the @option{-mmcu=} command-line option.
15781
15782 For even more AVR-specific built-in macros see
15783 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
15784
15785 @table @code
15786
15787 @item __AVR_ARCH__
15788 Build-in macro that resolves to a decimal number that identifies the
15789 architecture and depends on the @option{-mmcu=@var{mcu}} option.
15790 Possible values are:
15791
15792 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
15793 @code{4}, @code{5}, @code{51}, @code{6}
15794
15795 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
15796 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
15797
15798 respectively and
15799
15800 @code{100}, @code{102}, @code{104},
15801 @code{105}, @code{106}, @code{107}
15802
15803 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
15804 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
15805 If @var{mcu} specifies a device, this built-in macro is set
15806 accordingly. For example, with @option{-mmcu=atmega8} the macro is
15807 defined to @code{4}.
15808
15809 @item __AVR_@var{Device}__
15810 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
15811 the device's name. For example, @option{-mmcu=atmega8} defines the
15812 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
15813 @code{__AVR_ATtiny261A__}, etc.
15814
15815 The built-in macros' names follow
15816 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
15817 the device name as from the AVR user manual. The difference between
15818 @var{Device} in the built-in macro and @var{device} in
15819 @option{-mmcu=@var{device}} is that the latter is always lowercase.
15820
15821 If @var{device} is not a device but only a core architecture like
15822 @samp{avr51}, this macro is not defined.
15823
15824 @item __AVR_DEVICE_NAME__
15825 Setting @option{-mmcu=@var{device}} defines this built-in macro to
15826 the device's name. For example, with @option{-mmcu=atmega8} the macro
15827 is defined to @code{atmega8}.
15828
15829 If @var{device} is not a device but only a core architecture like
15830 @samp{avr51}, this macro is not defined.
15831
15832 @item __AVR_XMEGA__
15833 The device / architecture belongs to the XMEGA family of devices.
15834
15835 @item __AVR_HAVE_ELPM__
15836 The device has the @code{ELPM} instruction.
15837
15838 @item __AVR_HAVE_ELPMX__
15839 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
15840 R@var{n},Z+} instructions.
15841
15842 @item __AVR_HAVE_MOVW__
15843 The device has the @code{MOVW} instruction to perform 16-bit
15844 register-register moves.
15845
15846 @item __AVR_HAVE_LPMX__
15847 The device has the @code{LPM R@var{n},Z} and
15848 @code{LPM R@var{n},Z+} instructions.
15849
15850 @item __AVR_HAVE_MUL__
15851 The device has a hardware multiplier.
15852
15853 @item __AVR_HAVE_JMP_CALL__
15854 The device has the @code{JMP} and @code{CALL} instructions.
15855 This is the case for devices with at least 16@tie{}KiB of program
15856 memory.
15857
15858 @item __AVR_HAVE_EIJMP_EICALL__
15859 @itemx __AVR_3_BYTE_PC__
15860 The device has the @code{EIJMP} and @code{EICALL} instructions.
15861 This is the case for devices with more than 128@tie{}KiB of program memory.
15862 This also means that the program counter
15863 (PC) is 3@tie{}bytes wide.
15864
15865 @item __AVR_2_BYTE_PC__
15866 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
15867 with up to 128@tie{}KiB of program memory.
15868
15869 @item __AVR_HAVE_8BIT_SP__
15870 @itemx __AVR_HAVE_16BIT_SP__
15871 The stack pointer (SP) register is treated as 8-bit respectively
15872 16-bit register by the compiler.
15873 The definition of these macros is affected by @option{-mtiny-stack}.
15874
15875 @item __AVR_HAVE_SPH__
15876 @itemx __AVR_SP8__
15877 The device has the SPH (high part of stack pointer) special function
15878 register or has an 8-bit stack pointer, respectively.
15879 The definition of these macros is affected by @option{-mmcu=} and
15880 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
15881 by @option{-msp8}.
15882
15883 @item __AVR_HAVE_RAMPD__
15884 @itemx __AVR_HAVE_RAMPX__
15885 @itemx __AVR_HAVE_RAMPY__
15886 @itemx __AVR_HAVE_RAMPZ__
15887 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
15888 @code{RAMPZ} special function register, respectively.
15889
15890 @item __NO_INTERRUPTS__
15891 This macro reflects the @option{-mno-interrupts} command-line option.
15892
15893 @item __AVR_ERRATA_SKIP__
15894 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
15895 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
15896 instructions because of a hardware erratum. Skip instructions are
15897 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
15898 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
15899 set.
15900
15901 @item __AVR_ISA_RMW__
15902 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
15903
15904 @item __AVR_SFR_OFFSET__=@var{offset}
15905 Instructions that can address I/O special function registers directly
15906 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
15907 address as if addressed by an instruction to access RAM like @code{LD}
15908 or @code{STS}. This offset depends on the device architecture and has
15909 to be subtracted from the RAM address in order to get the
15910 respective I/O@tie{}address.
15911
15912 @item __WITH_AVRLIBC__
15913 The compiler is configured to be used together with AVR-Libc.
15914 See the @option{--with-avrlibc} configure option.
15915
15916 @end table
15917
15918 @node Blackfin Options
15919 @subsection Blackfin Options
15920 @cindex Blackfin Options
15921
15922 @table @gcctabopt
15923 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
15924 @opindex mcpu=
15925 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
15926 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
15927 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
15928 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
15929 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
15930 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
15931 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
15932 @samp{bf561}, @samp{bf592}.
15933
15934 The optional @var{sirevision} specifies the silicon revision of the target
15935 Blackfin processor. Any workarounds available for the targeted silicon revision
15936 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
15937 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
15938 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
15939 hexadecimal digits representing the major and minor numbers in the silicon
15940 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
15941 is not defined. If @var{sirevision} is @samp{any}, the
15942 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
15943 If this optional @var{sirevision} is not used, GCC assumes the latest known
15944 silicon revision of the targeted Blackfin processor.
15945
15946 GCC defines a preprocessor macro for the specified @var{cpu}.
15947 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
15948 provided by libgloss to be linked in if @option{-msim} is not given.
15949
15950 Without this option, @samp{bf532} is used as the processor by default.
15951
15952 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
15953 only the preprocessor macro is defined.
15954
15955 @item -msim
15956 @opindex msim
15957 Specifies that the program will be run on the simulator. This causes
15958 the simulator BSP provided by libgloss to be linked in. This option
15959 has effect only for @samp{bfin-elf} toolchain.
15960 Certain other options, such as @option{-mid-shared-library} and
15961 @option{-mfdpic}, imply @option{-msim}.
15962
15963 @item -momit-leaf-frame-pointer
15964 @opindex momit-leaf-frame-pointer
15965 Don't keep the frame pointer in a register for leaf functions. This
15966 avoids the instructions to save, set up and restore frame pointers and
15967 makes an extra register available in leaf functions. The option
15968 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
15969 which might make debugging harder.
15970
15971 @item -mspecld-anomaly
15972 @opindex mspecld-anomaly
15973 When enabled, the compiler ensures that the generated code does not
15974 contain speculative loads after jump instructions. If this option is used,
15975 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
15976
15977 @item -mno-specld-anomaly
15978 @opindex mno-specld-anomaly
15979 Don't generate extra code to prevent speculative loads from occurring.
15980
15981 @item -mcsync-anomaly
15982 @opindex mcsync-anomaly
15983 When enabled, the compiler ensures that the generated code does not
15984 contain CSYNC or SSYNC instructions too soon after conditional branches.
15985 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
15986
15987 @item -mno-csync-anomaly
15988 @opindex mno-csync-anomaly
15989 Don't generate extra code to prevent CSYNC or SSYNC instructions from
15990 occurring too soon after a conditional branch.
15991
15992 @item -mlow-64k
15993 @opindex mlow-64k
15994 When enabled, the compiler is free to take advantage of the knowledge that
15995 the entire program fits into the low 64k of memory.
15996
15997 @item -mno-low-64k
15998 @opindex mno-low-64k
15999 Assume that the program is arbitrarily large. This is the default.
16000
16001 @item -mstack-check-l1
16002 @opindex mstack-check-l1
16003 Do stack checking using information placed into L1 scratchpad memory by the
16004 uClinux kernel.
16005
16006 @item -mid-shared-library
16007 @opindex mid-shared-library
16008 Generate code that supports shared libraries via the library ID method.
16009 This allows for execute in place and shared libraries in an environment
16010 without virtual memory management. This option implies @option{-fPIC}.
16011 With a @samp{bfin-elf} target, this option implies @option{-msim}.
16012
16013 @item -mno-id-shared-library
16014 @opindex mno-id-shared-library
16015 Generate code that doesn't assume ID-based shared libraries are being used.
16016 This is the default.
16017
16018 @item -mleaf-id-shared-library
16019 @opindex mleaf-id-shared-library
16020 Generate code that supports shared libraries via the library ID method,
16021 but assumes that this library or executable won't link against any other
16022 ID shared libraries. That allows the compiler to use faster code for jumps
16023 and calls.
16024
16025 @item -mno-leaf-id-shared-library
16026 @opindex mno-leaf-id-shared-library
16027 Do not assume that the code being compiled won't link against any ID shared
16028 libraries. Slower code is generated for jump and call insns.
16029
16030 @item -mshared-library-id=n
16031 @opindex mshared-library-id
16032 Specifies the identification number of the ID-based shared library being
16033 compiled. Specifying a value of 0 generates more compact code; specifying
16034 other values forces the allocation of that number to the current
16035 library but is no more space- or time-efficient than omitting this option.
16036
16037 @item -msep-data
16038 @opindex msep-data
16039 Generate code that allows the data segment to be located in a different
16040 area of memory from the text segment. This allows for execute in place in
16041 an environment without virtual memory management by eliminating relocations
16042 against the text section.
16043
16044 @item -mno-sep-data
16045 @opindex mno-sep-data
16046 Generate code that assumes that the data segment follows the text segment.
16047 This is the default.
16048
16049 @item -mlong-calls
16050 @itemx -mno-long-calls
16051 @opindex mlong-calls
16052 @opindex mno-long-calls
16053 Tells the compiler to perform function calls by first loading the
16054 address of the function into a register and then performing a subroutine
16055 call on this register. This switch is needed if the target function
16056 lies outside of the 24-bit addressing range of the offset-based
16057 version of subroutine call instruction.
16058
16059 This feature is not enabled by default. Specifying
16060 @option{-mno-long-calls} restores the default behavior. Note these
16061 switches have no effect on how the compiler generates code to handle
16062 function calls via function pointers.
16063
16064 @item -mfast-fp
16065 @opindex mfast-fp
16066 Link with the fast floating-point library. This library relaxes some of
16067 the IEEE floating-point standard's rules for checking inputs against
16068 Not-a-Number (NAN), in the interest of performance.
16069
16070 @item -minline-plt
16071 @opindex minline-plt
16072 Enable inlining of PLT entries in function calls to functions that are
16073 not known to bind locally. It has no effect without @option{-mfdpic}.
16074
16075 @item -mmulticore
16076 @opindex mmulticore
16077 Build a standalone application for multicore Blackfin processors.
16078 This option causes proper start files and link scripts supporting
16079 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
16080 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
16081
16082 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
16083 selects the one-application-per-core programming model. Without
16084 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
16085 programming model is used. In this model, the main function of Core B
16086 should be named as @code{coreb_main}.
16087
16088 If this option is not used, the single-core application programming
16089 model is used.
16090
16091 @item -mcorea
16092 @opindex mcorea
16093 Build a standalone application for Core A of BF561 when using
16094 the one-application-per-core programming model. Proper start files
16095 and link scripts are used to support Core A, and the macro
16096 @code{__BFIN_COREA} is defined.
16097 This option can only be used in conjunction with @option{-mmulticore}.
16098
16099 @item -mcoreb
16100 @opindex mcoreb
16101 Build a standalone application for Core B of BF561 when using
16102 the one-application-per-core programming model. Proper start files
16103 and link scripts are used to support Core B, and the macro
16104 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
16105 should be used instead of @code{main}.
16106 This option can only be used in conjunction with @option{-mmulticore}.
16107
16108 @item -msdram
16109 @opindex msdram
16110 Build a standalone application for SDRAM. Proper start files and
16111 link scripts are used to put the application into SDRAM, and the macro
16112 @code{__BFIN_SDRAM} is defined.
16113 The loader should initialize SDRAM before loading the application.
16114
16115 @item -micplb
16116 @opindex micplb
16117 Assume that ICPLBs are enabled at run time. This has an effect on certain
16118 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
16119 are enabled; for standalone applications the default is off.
16120 @end table
16121
16122 @node C6X Options
16123 @subsection C6X Options
16124 @cindex C6X Options
16125
16126 @table @gcctabopt
16127 @item -march=@var{name}
16128 @opindex march
16129 This specifies the name of the target architecture. GCC uses this
16130 name to determine what kind of instructions it can emit when generating
16131 assembly code. Permissible names are: @samp{c62x},
16132 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
16133
16134 @item -mbig-endian
16135 @opindex mbig-endian
16136 Generate code for a big-endian target.
16137
16138 @item -mlittle-endian
16139 @opindex mlittle-endian
16140 Generate code for a little-endian target. This is the default.
16141
16142 @item -msim
16143 @opindex msim
16144 Choose startup files and linker script suitable for the simulator.
16145
16146 @item -msdata=default
16147 @opindex msdata=default
16148 Put small global and static data in the @code{.neardata} section,
16149 which is pointed to by register @code{B14}. Put small uninitialized
16150 global and static data in the @code{.bss} section, which is adjacent
16151 to the @code{.neardata} section. Put small read-only data into the
16152 @code{.rodata} section. The corresponding sections used for large
16153 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
16154
16155 @item -msdata=all
16156 @opindex msdata=all
16157 Put all data, not just small objects, into the sections reserved for
16158 small data, and use addressing relative to the @code{B14} register to
16159 access them.
16160
16161 @item -msdata=none
16162 @opindex msdata=none
16163 Make no use of the sections reserved for small data, and use absolute
16164 addresses to access all data. Put all initialized global and static
16165 data in the @code{.fardata} section, and all uninitialized data in the
16166 @code{.far} section. Put all constant data into the @code{.const}
16167 section.
16168 @end table
16169
16170 @node CRIS Options
16171 @subsection CRIS Options
16172 @cindex CRIS Options
16173
16174 These options are defined specifically for the CRIS ports.
16175
16176 @table @gcctabopt
16177 @item -march=@var{architecture-type}
16178 @itemx -mcpu=@var{architecture-type}
16179 @opindex march
16180 @opindex mcpu
16181 Generate code for the specified architecture. The choices for
16182 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
16183 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
16184 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
16185 @samp{v10}.
16186
16187 @item -mtune=@var{architecture-type}
16188 @opindex mtune
16189 Tune to @var{architecture-type} everything applicable about the generated
16190 code, except for the ABI and the set of available instructions. The
16191 choices for @var{architecture-type} are the same as for
16192 @option{-march=@var{architecture-type}}.
16193
16194 @item -mmax-stack-frame=@var{n}
16195 @opindex mmax-stack-frame
16196 Warn when the stack frame of a function exceeds @var{n} bytes.
16197
16198 @item -metrax4
16199 @itemx -metrax100
16200 @opindex metrax4
16201 @opindex metrax100
16202 The options @option{-metrax4} and @option{-metrax100} are synonyms for
16203 @option{-march=v3} and @option{-march=v8} respectively.
16204
16205 @item -mmul-bug-workaround
16206 @itemx -mno-mul-bug-workaround
16207 @opindex mmul-bug-workaround
16208 @opindex mno-mul-bug-workaround
16209 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
16210 models where it applies. This option is active by default.
16211
16212 @item -mpdebug
16213 @opindex mpdebug
16214 Enable CRIS-specific verbose debug-related information in the assembly
16215 code. This option also has the effect of turning off the @samp{#NO_APP}
16216 formatted-code indicator to the assembler at the beginning of the
16217 assembly file.
16218
16219 @item -mcc-init
16220 @opindex mcc-init
16221 Do not use condition-code results from previous instruction; always emit
16222 compare and test instructions before use of condition codes.
16223
16224 @item -mno-side-effects
16225 @opindex mno-side-effects
16226 Do not emit instructions with side effects in addressing modes other than
16227 post-increment.
16228
16229 @item -mstack-align
16230 @itemx -mno-stack-align
16231 @itemx -mdata-align
16232 @itemx -mno-data-align
16233 @itemx -mconst-align
16234 @itemx -mno-const-align
16235 @opindex mstack-align
16236 @opindex mno-stack-align
16237 @opindex mdata-align
16238 @opindex mno-data-align
16239 @opindex mconst-align
16240 @opindex mno-const-align
16241 These options (@samp{no-} options) arrange (eliminate arrangements) for the
16242 stack frame, individual data and constants to be aligned for the maximum
16243 single data access size for the chosen CPU model. The default is to
16244 arrange for 32-bit alignment. ABI details such as structure layout are
16245 not affected by these options.
16246
16247 @item -m32-bit
16248 @itemx -m16-bit
16249 @itemx -m8-bit
16250 @opindex m32-bit
16251 @opindex m16-bit
16252 @opindex m8-bit
16253 Similar to the stack- data- and const-align options above, these options
16254 arrange for stack frame, writable data and constants to all be 32-bit,
16255 16-bit or 8-bit aligned. The default is 32-bit alignment.
16256
16257 @item -mno-prologue-epilogue
16258 @itemx -mprologue-epilogue
16259 @opindex mno-prologue-epilogue
16260 @opindex mprologue-epilogue
16261 With @option{-mno-prologue-epilogue}, the normal function prologue and
16262 epilogue which set up the stack frame are omitted and no return
16263 instructions or return sequences are generated in the code. Use this
16264 option only together with visual inspection of the compiled code: no
16265 warnings or errors are generated when call-saved registers must be saved,
16266 or storage for local variables needs to be allocated.
16267
16268 @item -mno-gotplt
16269 @itemx -mgotplt
16270 @opindex mno-gotplt
16271 @opindex mgotplt
16272 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
16273 instruction sequences that load addresses for functions from the PLT part
16274 of the GOT rather than (traditional on other architectures) calls to the
16275 PLT@. The default is @option{-mgotplt}.
16276
16277 @item -melf
16278 @opindex melf
16279 Legacy no-op option only recognized with the cris-axis-elf and
16280 cris-axis-linux-gnu targets.
16281
16282 @item -mlinux
16283 @opindex mlinux
16284 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
16285
16286 @item -sim
16287 @opindex sim
16288 This option, recognized for the cris-axis-elf, arranges
16289 to link with input-output functions from a simulator library. Code,
16290 initialized data and zero-initialized data are allocated consecutively.
16291
16292 @item -sim2
16293 @opindex sim2
16294 Like @option{-sim}, but pass linker options to locate initialized data at
16295 0x40000000 and zero-initialized data at 0x80000000.
16296 @end table
16297
16298 @node CR16 Options
16299 @subsection CR16 Options
16300 @cindex CR16 Options
16301
16302 These options are defined specifically for the CR16 ports.
16303
16304 @table @gcctabopt
16305
16306 @item -mmac
16307 @opindex mmac
16308 Enable the use of multiply-accumulate instructions. Disabled by default.
16309
16310 @item -mcr16cplus
16311 @itemx -mcr16c
16312 @opindex mcr16cplus
16313 @opindex mcr16c
16314 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
16315 is default.
16316
16317 @item -msim
16318 @opindex msim
16319 Links the library libsim.a which is in compatible with simulator. Applicable
16320 to ELF compiler only.
16321
16322 @item -mint32
16323 @opindex mint32
16324 Choose integer type as 32-bit wide.
16325
16326 @item -mbit-ops
16327 @opindex mbit-ops
16328 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
16329
16330 @item -mdata-model=@var{model}
16331 @opindex mdata-model
16332 Choose a data model. The choices for @var{model} are @samp{near},
16333 @samp{far} or @samp{medium}. @samp{medium} is default.
16334 However, @samp{far} is not valid with @option{-mcr16c}, as the
16335 CR16C architecture does not support the far data model.
16336 @end table
16337
16338 @node Darwin Options
16339 @subsection Darwin Options
16340 @cindex Darwin options
16341
16342 These options are defined for all architectures running the Darwin operating
16343 system.
16344
16345 FSF GCC on Darwin does not create ``fat'' object files; it creates
16346 an object file for the single architecture that GCC was built to
16347 target. Apple's GCC on Darwin does create ``fat'' files if multiple
16348 @option{-arch} options are used; it does so by running the compiler or
16349 linker multiple times and joining the results together with
16350 @file{lipo}.
16351
16352 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
16353 @samp{i686}) is determined by the flags that specify the ISA
16354 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
16355 @option{-force_cpusubtype_ALL} option can be used to override this.
16356
16357 The Darwin tools vary in their behavior when presented with an ISA
16358 mismatch. The assembler, @file{as}, only permits instructions to
16359 be used that are valid for the subtype of the file it is generating,
16360 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
16361 The linker for shared libraries, @file{/usr/bin/libtool}, fails
16362 and prints an error if asked to create a shared library with a less
16363 restrictive subtype than its input files (for instance, trying to put
16364 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
16365 for executables, @command{ld}, quietly gives the executable the most
16366 restrictive subtype of any of its input files.
16367
16368 @table @gcctabopt
16369 @item -F@var{dir}
16370 @opindex F
16371 Add the framework directory @var{dir} to the head of the list of
16372 directories to be searched for header files. These directories are
16373 interleaved with those specified by @option{-I} options and are
16374 scanned in a left-to-right order.
16375
16376 A framework directory is a directory with frameworks in it. A
16377 framework is a directory with a @file{Headers} and/or
16378 @file{PrivateHeaders} directory contained directly in it that ends
16379 in @file{.framework}. The name of a framework is the name of this
16380 directory excluding the @file{.framework}. Headers associated with
16381 the framework are found in one of those two directories, with
16382 @file{Headers} being searched first. A subframework is a framework
16383 directory that is in a framework's @file{Frameworks} directory.
16384 Includes of subframework headers can only appear in a header of a
16385 framework that contains the subframework, or in a sibling subframework
16386 header. Two subframeworks are siblings if they occur in the same
16387 framework. A subframework should not have the same name as a
16388 framework; a warning is issued if this is violated. Currently a
16389 subframework cannot have subframeworks; in the future, the mechanism
16390 may be extended to support this. The standard frameworks can be found
16391 in @file{/System/Library/Frameworks} and
16392 @file{/Library/Frameworks}. An example include looks like
16393 @code{#include <Framework/header.h>}, where @file{Framework} denotes
16394 the name of the framework and @file{header.h} is found in the
16395 @file{PrivateHeaders} or @file{Headers} directory.
16396
16397 @item -iframework@var{dir}
16398 @opindex iframework
16399 Like @option{-F} except the directory is a treated as a system
16400 directory. The main difference between this @option{-iframework} and
16401 @option{-F} is that with @option{-iframework} the compiler does not
16402 warn about constructs contained within header files found via
16403 @var{dir}. This option is valid only for the C family of languages.
16404
16405 @item -gused
16406 @opindex gused
16407 Emit debugging information for symbols that are used. For stabs
16408 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
16409 This is by default ON@.
16410
16411 @item -gfull
16412 @opindex gfull
16413 Emit debugging information for all symbols and types.
16414
16415 @item -mmacosx-version-min=@var{version}
16416 The earliest version of MacOS X that this executable will run on
16417 is @var{version}. Typical values of @var{version} include @code{10.1},
16418 @code{10.2}, and @code{10.3.9}.
16419
16420 If the compiler was built to use the system's headers by default,
16421 then the default for this option is the system version on which the
16422 compiler is running, otherwise the default is to make choices that
16423 are compatible with as many systems and code bases as possible.
16424
16425 @item -mkernel
16426 @opindex mkernel
16427 Enable kernel development mode. The @option{-mkernel} option sets
16428 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
16429 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
16430 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
16431 applicable. This mode also sets @option{-mno-altivec},
16432 @option{-msoft-float}, @option{-fno-builtin} and
16433 @option{-mlong-branch} for PowerPC targets.
16434
16435 @item -mone-byte-bool
16436 @opindex mone-byte-bool
16437 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
16438 By default @code{sizeof(bool)} is @code{4} when compiling for
16439 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
16440 option has no effect on x86.
16441
16442 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
16443 to generate code that is not binary compatible with code generated
16444 without that switch. Using this switch may require recompiling all
16445 other modules in a program, including system libraries. Use this
16446 switch to conform to a non-default data model.
16447
16448 @item -mfix-and-continue
16449 @itemx -ffix-and-continue
16450 @itemx -findirect-data
16451 @opindex mfix-and-continue
16452 @opindex ffix-and-continue
16453 @opindex findirect-data
16454 Generate code suitable for fast turnaround development, such as to
16455 allow GDB to dynamically load @file{.o} files into already-running
16456 programs. @option{-findirect-data} and @option{-ffix-and-continue}
16457 are provided for backwards compatibility.
16458
16459 @item -all_load
16460 @opindex all_load
16461 Loads all members of static archive libraries.
16462 See man ld(1) for more information.
16463
16464 @item -arch_errors_fatal
16465 @opindex arch_errors_fatal
16466 Cause the errors having to do with files that have the wrong architecture
16467 to be fatal.
16468
16469 @item -bind_at_load
16470 @opindex bind_at_load
16471 Causes the output file to be marked such that the dynamic linker will
16472 bind all undefined references when the file is loaded or launched.
16473
16474 @item -bundle
16475 @opindex bundle
16476 Produce a Mach-o bundle format file.
16477 See man ld(1) for more information.
16478
16479 @item -bundle_loader @var{executable}
16480 @opindex bundle_loader
16481 This option specifies the @var{executable} that will load the build
16482 output file being linked. See man ld(1) for more information.
16483
16484 @item -dynamiclib
16485 @opindex dynamiclib
16486 When passed this option, GCC produces a dynamic library instead of
16487 an executable when linking, using the Darwin @file{libtool} command.
16488
16489 @item -force_cpusubtype_ALL
16490 @opindex force_cpusubtype_ALL
16491 This causes GCC's output file to have the @samp{ALL} subtype, instead of
16492 one controlled by the @option{-mcpu} or @option{-march} option.
16493
16494 @item -allowable_client @var{client_name}
16495 @itemx -client_name
16496 @itemx -compatibility_version
16497 @itemx -current_version
16498 @itemx -dead_strip
16499 @itemx -dependency-file
16500 @itemx -dylib_file
16501 @itemx -dylinker_install_name
16502 @itemx -dynamic
16503 @itemx -exported_symbols_list
16504 @itemx -filelist
16505 @need 800
16506 @itemx -flat_namespace
16507 @itemx -force_flat_namespace
16508 @itemx -headerpad_max_install_names
16509 @itemx -image_base
16510 @itemx -init
16511 @itemx -install_name
16512 @itemx -keep_private_externs
16513 @itemx -multi_module
16514 @itemx -multiply_defined
16515 @itemx -multiply_defined_unused
16516 @need 800
16517 @itemx -noall_load
16518 @itemx -no_dead_strip_inits_and_terms
16519 @itemx -nofixprebinding
16520 @itemx -nomultidefs
16521 @itemx -noprebind
16522 @itemx -noseglinkedit
16523 @itemx -pagezero_size
16524 @itemx -prebind
16525 @itemx -prebind_all_twolevel_modules
16526 @itemx -private_bundle
16527 @need 800
16528 @itemx -read_only_relocs
16529 @itemx -sectalign
16530 @itemx -sectobjectsymbols
16531 @itemx -whyload
16532 @itemx -seg1addr
16533 @itemx -sectcreate
16534 @itemx -sectobjectsymbols
16535 @itemx -sectorder
16536 @itemx -segaddr
16537 @itemx -segs_read_only_addr
16538 @need 800
16539 @itemx -segs_read_write_addr
16540 @itemx -seg_addr_table
16541 @itemx -seg_addr_table_filename
16542 @itemx -seglinkedit
16543 @itemx -segprot
16544 @itemx -segs_read_only_addr
16545 @itemx -segs_read_write_addr
16546 @itemx -single_module
16547 @itemx -static
16548 @itemx -sub_library
16549 @need 800
16550 @itemx -sub_umbrella
16551 @itemx -twolevel_namespace
16552 @itemx -umbrella
16553 @itemx -undefined
16554 @itemx -unexported_symbols_list
16555 @itemx -weak_reference_mismatches
16556 @itemx -whatsloaded
16557 @opindex allowable_client
16558 @opindex client_name
16559 @opindex compatibility_version
16560 @opindex current_version
16561 @opindex dead_strip
16562 @opindex dependency-file
16563 @opindex dylib_file
16564 @opindex dylinker_install_name
16565 @opindex dynamic
16566 @opindex exported_symbols_list
16567 @opindex filelist
16568 @opindex flat_namespace
16569 @opindex force_flat_namespace
16570 @opindex headerpad_max_install_names
16571 @opindex image_base
16572 @opindex init
16573 @opindex install_name
16574 @opindex keep_private_externs
16575 @opindex multi_module
16576 @opindex multiply_defined
16577 @opindex multiply_defined_unused
16578 @opindex noall_load
16579 @opindex no_dead_strip_inits_and_terms
16580 @opindex nofixprebinding
16581 @opindex nomultidefs
16582 @opindex noprebind
16583 @opindex noseglinkedit
16584 @opindex pagezero_size
16585 @opindex prebind
16586 @opindex prebind_all_twolevel_modules
16587 @opindex private_bundle
16588 @opindex read_only_relocs
16589 @opindex sectalign
16590 @opindex sectobjectsymbols
16591 @opindex whyload
16592 @opindex seg1addr
16593 @opindex sectcreate
16594 @opindex sectobjectsymbols
16595 @opindex sectorder
16596 @opindex segaddr
16597 @opindex segs_read_only_addr
16598 @opindex segs_read_write_addr
16599 @opindex seg_addr_table
16600 @opindex seg_addr_table_filename
16601 @opindex seglinkedit
16602 @opindex segprot
16603 @opindex segs_read_only_addr
16604 @opindex segs_read_write_addr
16605 @opindex single_module
16606 @opindex static
16607 @opindex sub_library
16608 @opindex sub_umbrella
16609 @opindex twolevel_namespace
16610 @opindex umbrella
16611 @opindex undefined
16612 @opindex unexported_symbols_list
16613 @opindex weak_reference_mismatches
16614 @opindex whatsloaded
16615 These options are passed to the Darwin linker. The Darwin linker man page
16616 describes them in detail.
16617 @end table
16618
16619 @node DEC Alpha Options
16620 @subsection DEC Alpha Options
16621
16622 These @samp{-m} options are defined for the DEC Alpha implementations:
16623
16624 @table @gcctabopt
16625 @item -mno-soft-float
16626 @itemx -msoft-float
16627 @opindex mno-soft-float
16628 @opindex msoft-float
16629 Use (do not use) the hardware floating-point instructions for
16630 floating-point operations. When @option{-msoft-float} is specified,
16631 functions in @file{libgcc.a} are used to perform floating-point
16632 operations. Unless they are replaced by routines that emulate the
16633 floating-point operations, or compiled in such a way as to call such
16634 emulations routines, these routines issue floating-point
16635 operations. If you are compiling for an Alpha without floating-point
16636 operations, you must ensure that the library is built so as not to call
16637 them.
16638
16639 Note that Alpha implementations without floating-point operations are
16640 required to have floating-point registers.
16641
16642 @item -mfp-reg
16643 @itemx -mno-fp-regs
16644 @opindex mfp-reg
16645 @opindex mno-fp-regs
16646 Generate code that uses (does not use) the floating-point register set.
16647 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
16648 register set is not used, floating-point operands are passed in integer
16649 registers as if they were integers and floating-point results are passed
16650 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
16651 so any function with a floating-point argument or return value called by code
16652 compiled with @option{-mno-fp-regs} must also be compiled with that
16653 option.
16654
16655 A typical use of this option is building a kernel that does not use,
16656 and hence need not save and restore, any floating-point registers.
16657
16658 @item -mieee
16659 @opindex mieee
16660 The Alpha architecture implements floating-point hardware optimized for
16661 maximum performance. It is mostly compliant with the IEEE floating-point
16662 standard. However, for full compliance, software assistance is
16663 required. This option generates code fully IEEE-compliant code
16664 @emph{except} that the @var{inexact-flag} is not maintained (see below).
16665 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
16666 defined during compilation. The resulting code is less efficient but is
16667 able to correctly support denormalized numbers and exceptional IEEE
16668 values such as not-a-number and plus/minus infinity. Other Alpha
16669 compilers call this option @option{-ieee_with_no_inexact}.
16670
16671 @item -mieee-with-inexact
16672 @opindex mieee-with-inexact
16673 This is like @option{-mieee} except the generated code also maintains
16674 the IEEE @var{inexact-flag}. Turning on this option causes the
16675 generated code to implement fully-compliant IEEE math. In addition to
16676 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
16677 macro. On some Alpha implementations the resulting code may execute
16678 significantly slower than the code generated by default. Since there is
16679 very little code that depends on the @var{inexact-flag}, you should
16680 normally not specify this option. Other Alpha compilers call this
16681 option @option{-ieee_with_inexact}.
16682
16683 @item -mfp-trap-mode=@var{trap-mode}
16684 @opindex mfp-trap-mode
16685 This option controls what floating-point related traps are enabled.
16686 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
16687 The trap mode can be set to one of four values:
16688
16689 @table @samp
16690 @item n
16691 This is the default (normal) setting. The only traps that are enabled
16692 are the ones that cannot be disabled in software (e.g., division by zero
16693 trap).
16694
16695 @item u
16696 In addition to the traps enabled by @samp{n}, underflow traps are enabled
16697 as well.
16698
16699 @item su
16700 Like @samp{u}, but the instructions are marked to be safe for software
16701 completion (see Alpha architecture manual for details).
16702
16703 @item sui
16704 Like @samp{su}, but inexact traps are enabled as well.
16705 @end table
16706
16707 @item -mfp-rounding-mode=@var{rounding-mode}
16708 @opindex mfp-rounding-mode
16709 Selects the IEEE rounding mode. Other Alpha compilers call this option
16710 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
16711 of:
16712
16713 @table @samp
16714 @item n
16715 Normal IEEE rounding mode. Floating-point numbers are rounded towards
16716 the nearest machine number or towards the even machine number in case
16717 of a tie.
16718
16719 @item m
16720 Round towards minus infinity.
16721
16722 @item c
16723 Chopped rounding mode. Floating-point numbers are rounded towards zero.
16724
16725 @item d
16726 Dynamic rounding mode. A field in the floating-point control register
16727 (@var{fpcr}, see Alpha architecture reference manual) controls the
16728 rounding mode in effect. The C library initializes this register for
16729 rounding towards plus infinity. Thus, unless your program modifies the
16730 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
16731 @end table
16732
16733 @item -mtrap-precision=@var{trap-precision}
16734 @opindex mtrap-precision
16735 In the Alpha architecture, floating-point traps are imprecise. This
16736 means without software assistance it is impossible to recover from a
16737 floating trap and program execution normally needs to be terminated.
16738 GCC can generate code that can assist operating system trap handlers
16739 in determining the exact location that caused a floating-point trap.
16740 Depending on the requirements of an application, different levels of
16741 precisions can be selected:
16742
16743 @table @samp
16744 @item p
16745 Program precision. This option is the default and means a trap handler
16746 can only identify which program caused a floating-point exception.
16747
16748 @item f
16749 Function precision. The trap handler can determine the function that
16750 caused a floating-point exception.
16751
16752 @item i
16753 Instruction precision. The trap handler can determine the exact
16754 instruction that caused a floating-point exception.
16755 @end table
16756
16757 Other Alpha compilers provide the equivalent options called
16758 @option{-scope_safe} and @option{-resumption_safe}.
16759
16760 @item -mieee-conformant
16761 @opindex mieee-conformant
16762 This option marks the generated code as IEEE conformant. You must not
16763 use this option unless you also specify @option{-mtrap-precision=i} and either
16764 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
16765 is to emit the line @samp{.eflag 48} in the function prologue of the
16766 generated assembly file.
16767
16768 @item -mbuild-constants
16769 @opindex mbuild-constants
16770 Normally GCC examines a 32- or 64-bit integer constant to
16771 see if it can construct it from smaller constants in two or three
16772 instructions. If it cannot, it outputs the constant as a literal and
16773 generates code to load it from the data segment at run time.
16774
16775 Use this option to require GCC to construct @emph{all} integer constants
16776 using code, even if it takes more instructions (the maximum is six).
16777
16778 You typically use this option to build a shared library dynamic
16779 loader. Itself a shared library, it must relocate itself in memory
16780 before it can find the variables and constants in its own data segment.
16781
16782 @item -mbwx
16783 @itemx -mno-bwx
16784 @itemx -mcix
16785 @itemx -mno-cix
16786 @itemx -mfix
16787 @itemx -mno-fix
16788 @itemx -mmax
16789 @itemx -mno-max
16790 @opindex mbwx
16791 @opindex mno-bwx
16792 @opindex mcix
16793 @opindex mno-cix
16794 @opindex mfix
16795 @opindex mno-fix
16796 @opindex mmax
16797 @opindex mno-max
16798 Indicate whether GCC should generate code to use the optional BWX,
16799 CIX, FIX and MAX instruction sets. The default is to use the instruction
16800 sets supported by the CPU type specified via @option{-mcpu=} option or that
16801 of the CPU on which GCC was built if none is specified.
16802
16803 @item -mfloat-vax
16804 @itemx -mfloat-ieee
16805 @opindex mfloat-vax
16806 @opindex mfloat-ieee
16807 Generate code that uses (does not use) VAX F and G floating-point
16808 arithmetic instead of IEEE single and double precision.
16809
16810 @item -mexplicit-relocs
16811 @itemx -mno-explicit-relocs
16812 @opindex mexplicit-relocs
16813 @opindex mno-explicit-relocs
16814 Older Alpha assemblers provided no way to generate symbol relocations
16815 except via assembler macros. Use of these macros does not allow
16816 optimal instruction scheduling. GNU binutils as of version 2.12
16817 supports a new syntax that allows the compiler to explicitly mark
16818 which relocations should apply to which instructions. This option
16819 is mostly useful for debugging, as GCC detects the capabilities of
16820 the assembler when it is built and sets the default accordingly.
16821
16822 @item -msmall-data
16823 @itemx -mlarge-data
16824 @opindex msmall-data
16825 @opindex mlarge-data
16826 When @option{-mexplicit-relocs} is in effect, static data is
16827 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
16828 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
16829 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
16830 16-bit relocations off of the @code{$gp} register. This limits the
16831 size of the small data area to 64KB, but allows the variables to be
16832 directly accessed via a single instruction.
16833
16834 The default is @option{-mlarge-data}. With this option the data area
16835 is limited to just below 2GB@. Programs that require more than 2GB of
16836 data must use @code{malloc} or @code{mmap} to allocate the data in the
16837 heap instead of in the program's data segment.
16838
16839 When generating code for shared libraries, @option{-fpic} implies
16840 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
16841
16842 @item -msmall-text
16843 @itemx -mlarge-text
16844 @opindex msmall-text
16845 @opindex mlarge-text
16846 When @option{-msmall-text} is used, the compiler assumes that the
16847 code of the entire program (or shared library) fits in 4MB, and is
16848 thus reachable with a branch instruction. When @option{-msmall-data}
16849 is used, the compiler can assume that all local symbols share the
16850 same @code{$gp} value, and thus reduce the number of instructions
16851 required for a function call from 4 to 1.
16852
16853 The default is @option{-mlarge-text}.
16854
16855 @item -mcpu=@var{cpu_type}
16856 @opindex mcpu
16857 Set the instruction set and instruction scheduling parameters for
16858 machine type @var{cpu_type}. You can specify either the @samp{EV}
16859 style name or the corresponding chip number. GCC supports scheduling
16860 parameters for the EV4, EV5 and EV6 family of processors and
16861 chooses the default values for the instruction set from the processor
16862 you specify. If you do not specify a processor type, GCC defaults
16863 to the processor on which the compiler was built.
16864
16865 Supported values for @var{cpu_type} are
16866
16867 @table @samp
16868 @item ev4
16869 @itemx ev45
16870 @itemx 21064
16871 Schedules as an EV4 and has no instruction set extensions.
16872
16873 @item ev5
16874 @itemx 21164
16875 Schedules as an EV5 and has no instruction set extensions.
16876
16877 @item ev56
16878 @itemx 21164a
16879 Schedules as an EV5 and supports the BWX extension.
16880
16881 @item pca56
16882 @itemx 21164pc
16883 @itemx 21164PC
16884 Schedules as an EV5 and supports the BWX and MAX extensions.
16885
16886 @item ev6
16887 @itemx 21264
16888 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
16889
16890 @item ev67
16891 @itemx 21264a
16892 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
16893 @end table
16894
16895 Native toolchains also support the value @samp{native},
16896 which selects the best architecture option for the host processor.
16897 @option{-mcpu=native} has no effect if GCC does not recognize
16898 the processor.
16899
16900 @item -mtune=@var{cpu_type}
16901 @opindex mtune
16902 Set only the instruction scheduling parameters for machine type
16903 @var{cpu_type}. The instruction set is not changed.
16904
16905 Native toolchains also support the value @samp{native},
16906 which selects the best architecture option for the host processor.
16907 @option{-mtune=native} has no effect if GCC does not recognize
16908 the processor.
16909
16910 @item -mmemory-latency=@var{time}
16911 @opindex mmemory-latency
16912 Sets the latency the scheduler should assume for typical memory
16913 references as seen by the application. This number is highly
16914 dependent on the memory access patterns used by the application
16915 and the size of the external cache on the machine.
16916
16917 Valid options for @var{time} are
16918
16919 @table @samp
16920 @item @var{number}
16921 A decimal number representing clock cycles.
16922
16923 @item L1
16924 @itemx L2
16925 @itemx L3
16926 @itemx main
16927 The compiler contains estimates of the number of clock cycles for
16928 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
16929 (also called Dcache, Scache, and Bcache), as well as to main memory.
16930 Note that L3 is only valid for EV5.
16931
16932 @end table
16933 @end table
16934
16935 @node FR30 Options
16936 @subsection FR30 Options
16937 @cindex FR30 Options
16938
16939 These options are defined specifically for the FR30 port.
16940
16941 @table @gcctabopt
16942
16943 @item -msmall-model
16944 @opindex msmall-model
16945 Use the small address space model. This can produce smaller code, but
16946 it does assume that all symbolic values and addresses fit into a
16947 20-bit range.
16948
16949 @item -mno-lsim
16950 @opindex mno-lsim
16951 Assume that runtime support has been provided and so there is no need
16952 to include the simulator library (@file{libsim.a}) on the linker
16953 command line.
16954
16955 @end table
16956
16957 @node FT32 Options
16958 @subsection FT32 Options
16959 @cindex FT32 Options
16960
16961 These options are defined specifically for the FT32 port.
16962
16963 @table @gcctabopt
16964
16965 @item -msim
16966 @opindex msim
16967 Specifies that the program will be run on the simulator. This causes
16968 an alternate runtime startup and library to be linked.
16969 You must not use this option when generating programs that will run on
16970 real hardware; you must provide your own runtime library for whatever
16971 I/O functions are needed.
16972
16973 @item -mlra
16974 @opindex mlra
16975 Enable Local Register Allocation. This is still experimental for FT32,
16976 so by default the compiler uses standard reload.
16977
16978 @item -mnodiv
16979 @opindex mnodiv
16980 Do not use div and mod instructions.
16981
16982 @end table
16983
16984 @node FRV Options
16985 @subsection FRV Options
16986 @cindex FRV Options
16987
16988 @table @gcctabopt
16989 @item -mgpr-32
16990 @opindex mgpr-32
16991
16992 Only use the first 32 general-purpose registers.
16993
16994 @item -mgpr-64
16995 @opindex mgpr-64
16996
16997 Use all 64 general-purpose registers.
16998
16999 @item -mfpr-32
17000 @opindex mfpr-32
17001
17002 Use only the first 32 floating-point registers.
17003
17004 @item -mfpr-64
17005 @opindex mfpr-64
17006
17007 Use all 64 floating-point registers.
17008
17009 @item -mhard-float
17010 @opindex mhard-float
17011
17012 Use hardware instructions for floating-point operations.
17013
17014 @item -msoft-float
17015 @opindex msoft-float
17016
17017 Use library routines for floating-point operations.
17018
17019 @item -malloc-cc
17020 @opindex malloc-cc
17021
17022 Dynamically allocate condition code registers.
17023
17024 @item -mfixed-cc
17025 @opindex mfixed-cc
17026
17027 Do not try to dynamically allocate condition code registers, only
17028 use @code{icc0} and @code{fcc0}.
17029
17030 @item -mdword
17031 @opindex mdword
17032
17033 Change ABI to use double word insns.
17034
17035 @item -mno-dword
17036 @opindex mno-dword
17037
17038 Do not use double word instructions.
17039
17040 @item -mdouble
17041 @opindex mdouble
17042
17043 Use floating-point double instructions.
17044
17045 @item -mno-double
17046 @opindex mno-double
17047
17048 Do not use floating-point double instructions.
17049
17050 @item -mmedia
17051 @opindex mmedia
17052
17053 Use media instructions.
17054
17055 @item -mno-media
17056 @opindex mno-media
17057
17058 Do not use media instructions.
17059
17060 @item -mmuladd
17061 @opindex mmuladd
17062
17063 Use multiply and add/subtract instructions.
17064
17065 @item -mno-muladd
17066 @opindex mno-muladd
17067
17068 Do not use multiply and add/subtract instructions.
17069
17070 @item -mfdpic
17071 @opindex mfdpic
17072
17073 Select the FDPIC ABI, which uses function descriptors to represent
17074 pointers to functions. Without any PIC/PIE-related options, it
17075 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
17076 assumes GOT entries and small data are within a 12-bit range from the
17077 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
17078 are computed with 32 bits.
17079 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17080
17081 @item -minline-plt
17082 @opindex minline-plt
17083
17084 Enable inlining of PLT entries in function calls to functions that are
17085 not known to bind locally. It has no effect without @option{-mfdpic}.
17086 It's enabled by default if optimizing for speed and compiling for
17087 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
17088 optimization option such as @option{-O3} or above is present in the
17089 command line.
17090
17091 @item -mTLS
17092 @opindex mTLS
17093
17094 Assume a large TLS segment when generating thread-local code.
17095
17096 @item -mtls
17097 @opindex mtls
17098
17099 Do not assume a large TLS segment when generating thread-local code.
17100
17101 @item -mgprel-ro
17102 @opindex mgprel-ro
17103
17104 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
17105 that is known to be in read-only sections. It's enabled by default,
17106 except for @option{-fpic} or @option{-fpie}: even though it may help
17107 make the global offset table smaller, it trades 1 instruction for 4.
17108 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
17109 one of which may be shared by multiple symbols, and it avoids the need
17110 for a GOT entry for the referenced symbol, so it's more likely to be a
17111 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
17112
17113 @item -multilib-library-pic
17114 @opindex multilib-library-pic
17115
17116 Link with the (library, not FD) pic libraries. It's implied by
17117 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
17118 @option{-fpic} without @option{-mfdpic}. You should never have to use
17119 it explicitly.
17120
17121 @item -mlinked-fp
17122 @opindex mlinked-fp
17123
17124 Follow the EABI requirement of always creating a frame pointer whenever
17125 a stack frame is allocated. This option is enabled by default and can
17126 be disabled with @option{-mno-linked-fp}.
17127
17128 @item -mlong-calls
17129 @opindex mlong-calls
17130
17131 Use indirect addressing to call functions outside the current
17132 compilation unit. This allows the functions to be placed anywhere
17133 within the 32-bit address space.
17134
17135 @item -malign-labels
17136 @opindex malign-labels
17137
17138 Try to align labels to an 8-byte boundary by inserting NOPs into the
17139 previous packet. This option only has an effect when VLIW packing
17140 is enabled. It doesn't create new packets; it merely adds NOPs to
17141 existing ones.
17142
17143 @item -mlibrary-pic
17144 @opindex mlibrary-pic
17145
17146 Generate position-independent EABI code.
17147
17148 @item -macc-4
17149 @opindex macc-4
17150
17151 Use only the first four media accumulator registers.
17152
17153 @item -macc-8
17154 @opindex macc-8
17155
17156 Use all eight media accumulator registers.
17157
17158 @item -mpack
17159 @opindex mpack
17160
17161 Pack VLIW instructions.
17162
17163 @item -mno-pack
17164 @opindex mno-pack
17165
17166 Do not pack VLIW instructions.
17167
17168 @item -mno-eflags
17169 @opindex mno-eflags
17170
17171 Do not mark ABI switches in e_flags.
17172
17173 @item -mcond-move
17174 @opindex mcond-move
17175
17176 Enable the use of conditional-move instructions (default).
17177
17178 This switch is mainly for debugging the compiler and will likely be removed
17179 in a future version.
17180
17181 @item -mno-cond-move
17182 @opindex mno-cond-move
17183
17184 Disable the use of conditional-move instructions.
17185
17186 This switch is mainly for debugging the compiler and will likely be removed
17187 in a future version.
17188
17189 @item -mscc
17190 @opindex mscc
17191
17192 Enable the use of conditional set instructions (default).
17193
17194 This switch is mainly for debugging the compiler and will likely be removed
17195 in a future version.
17196
17197 @item -mno-scc
17198 @opindex mno-scc
17199
17200 Disable the use of conditional set instructions.
17201
17202 This switch is mainly for debugging the compiler and will likely be removed
17203 in a future version.
17204
17205 @item -mcond-exec
17206 @opindex mcond-exec
17207
17208 Enable the use of conditional execution (default).
17209
17210 This switch is mainly for debugging the compiler and will likely be removed
17211 in a future version.
17212
17213 @item -mno-cond-exec
17214 @opindex mno-cond-exec
17215
17216 Disable the use of conditional execution.
17217
17218 This switch is mainly for debugging the compiler and will likely be removed
17219 in a future version.
17220
17221 @item -mvliw-branch
17222 @opindex mvliw-branch
17223
17224 Run a pass to pack branches into VLIW instructions (default).
17225
17226 This switch is mainly for debugging the compiler and will likely be removed
17227 in a future version.
17228
17229 @item -mno-vliw-branch
17230 @opindex mno-vliw-branch
17231
17232 Do not run a pass to pack branches into VLIW instructions.
17233
17234 This switch is mainly for debugging the compiler and will likely be removed
17235 in a future version.
17236
17237 @item -mmulti-cond-exec
17238 @opindex mmulti-cond-exec
17239
17240 Enable optimization of @code{&&} and @code{||} in conditional execution
17241 (default).
17242
17243 This switch is mainly for debugging the compiler and will likely be removed
17244 in a future version.
17245
17246 @item -mno-multi-cond-exec
17247 @opindex mno-multi-cond-exec
17248
17249 Disable optimization of @code{&&} and @code{||} in conditional execution.
17250
17251 This switch is mainly for debugging the compiler and will likely be removed
17252 in a future version.
17253
17254 @item -mnested-cond-exec
17255 @opindex mnested-cond-exec
17256
17257 Enable nested conditional execution optimizations (default).
17258
17259 This switch is mainly for debugging the compiler and will likely be removed
17260 in a future version.
17261
17262 @item -mno-nested-cond-exec
17263 @opindex mno-nested-cond-exec
17264
17265 Disable nested conditional execution optimizations.
17266
17267 This switch is mainly for debugging the compiler and will likely be removed
17268 in a future version.
17269
17270 @item -moptimize-membar
17271 @opindex moptimize-membar
17272
17273 This switch removes redundant @code{membar} instructions from the
17274 compiler-generated code. It is enabled by default.
17275
17276 @item -mno-optimize-membar
17277 @opindex mno-optimize-membar
17278
17279 This switch disables the automatic removal of redundant @code{membar}
17280 instructions from the generated code.
17281
17282 @item -mtomcat-stats
17283 @opindex mtomcat-stats
17284
17285 Cause gas to print out tomcat statistics.
17286
17287 @item -mcpu=@var{cpu}
17288 @opindex mcpu
17289
17290 Select the processor type for which to generate code. Possible values are
17291 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
17292 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
17293
17294 @end table
17295
17296 @node GNU/Linux Options
17297 @subsection GNU/Linux Options
17298
17299 These @samp{-m} options are defined for GNU/Linux targets:
17300
17301 @table @gcctabopt
17302 @item -mglibc
17303 @opindex mglibc
17304 Use the GNU C library. This is the default except
17305 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
17306 @samp{*-*-linux-*android*} targets.
17307
17308 @item -muclibc
17309 @opindex muclibc
17310 Use uClibc C library. This is the default on
17311 @samp{*-*-linux-*uclibc*} targets.
17312
17313 @item -mmusl
17314 @opindex mmusl
17315 Use the musl C library. This is the default on
17316 @samp{*-*-linux-*musl*} targets.
17317
17318 @item -mbionic
17319 @opindex mbionic
17320 Use Bionic C library. This is the default on
17321 @samp{*-*-linux-*android*} targets.
17322
17323 @item -mandroid
17324 @opindex mandroid
17325 Compile code compatible with Android platform. This is the default on
17326 @samp{*-*-linux-*android*} targets.
17327
17328 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
17329 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
17330 this option makes the GCC driver pass Android-specific options to the linker.
17331 Finally, this option causes the preprocessor macro @code{__ANDROID__}
17332 to be defined.
17333
17334 @item -tno-android-cc
17335 @opindex tno-android-cc
17336 Disable compilation effects of @option{-mandroid}, i.e., do not enable
17337 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
17338 @option{-fno-rtti} by default.
17339
17340 @item -tno-android-ld
17341 @opindex tno-android-ld
17342 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
17343 linking options to the linker.
17344
17345 @end table
17346
17347 @node H8/300 Options
17348 @subsection H8/300 Options
17349
17350 These @samp{-m} options are defined for the H8/300 implementations:
17351
17352 @table @gcctabopt
17353 @item -mrelax
17354 @opindex mrelax
17355 Shorten some address references at link time, when possible; uses the
17356 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
17357 ld, Using ld}, for a fuller description.
17358
17359 @item -mh
17360 @opindex mh
17361 Generate code for the H8/300H@.
17362
17363 @item -ms
17364 @opindex ms
17365 Generate code for the H8S@.
17366
17367 @item -mn
17368 @opindex mn
17369 Generate code for the H8S and H8/300H in the normal mode. This switch
17370 must be used either with @option{-mh} or @option{-ms}.
17371
17372 @item -ms2600
17373 @opindex ms2600
17374 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
17375
17376 @item -mexr
17377 @opindex mexr
17378 Extended registers are stored on stack before execution of function
17379 with monitor attribute. Default option is @option{-mexr}.
17380 This option is valid only for H8S targets.
17381
17382 @item -mno-exr
17383 @opindex mno-exr
17384 Extended registers are not stored on stack before execution of function
17385 with monitor attribute. Default option is @option{-mno-exr}.
17386 This option is valid only for H8S targets.
17387
17388 @item -mint32
17389 @opindex mint32
17390 Make @code{int} data 32 bits by default.
17391
17392 @item -malign-300
17393 @opindex malign-300
17394 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
17395 The default for the H8/300H and H8S is to align longs and floats on
17396 4-byte boundaries.
17397 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
17398 This option has no effect on the H8/300.
17399 @end table
17400
17401 @node HPPA Options
17402 @subsection HPPA Options
17403 @cindex HPPA Options
17404
17405 These @samp{-m} options are defined for the HPPA family of computers:
17406
17407 @table @gcctabopt
17408 @item -march=@var{architecture-type}
17409 @opindex march
17410 Generate code for the specified architecture. The choices for
17411 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
17412 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
17413 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
17414 architecture option for your machine. Code compiled for lower numbered
17415 architectures runs on higher numbered architectures, but not the
17416 other way around.
17417
17418 @item -mpa-risc-1-0
17419 @itemx -mpa-risc-1-1
17420 @itemx -mpa-risc-2-0
17421 @opindex mpa-risc-1-0
17422 @opindex mpa-risc-1-1
17423 @opindex mpa-risc-2-0
17424 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
17425
17426 @item -mcaller-copies
17427 @opindex mcaller-copies
17428 The caller copies function arguments passed by hidden reference. This
17429 option should be used with care as it is not compatible with the default
17430 32-bit runtime. However, only aggregates larger than eight bytes are
17431 passed by hidden reference and the option provides better compatibility
17432 with OpenMP.
17433
17434 @item -mjump-in-delay
17435 @opindex mjump-in-delay
17436 This option is ignored and provided for compatibility purposes only.
17437
17438 @item -mdisable-fpregs
17439 @opindex mdisable-fpregs
17440 Prevent floating-point registers from being used in any manner. This is
17441 necessary for compiling kernels that perform lazy context switching of
17442 floating-point registers. If you use this option and attempt to perform
17443 floating-point operations, the compiler aborts.
17444
17445 @item -mdisable-indexing
17446 @opindex mdisable-indexing
17447 Prevent the compiler from using indexing address modes. This avoids some
17448 rather obscure problems when compiling MIG generated code under MACH@.
17449
17450 @item -mno-space-regs
17451 @opindex mno-space-regs
17452 Generate code that assumes the target has no space registers. This allows
17453 GCC to generate faster indirect calls and use unscaled index address modes.
17454
17455 Such code is suitable for level 0 PA systems and kernels.
17456
17457 @item -mfast-indirect-calls
17458 @opindex mfast-indirect-calls
17459 Generate code that assumes calls never cross space boundaries. This
17460 allows GCC to emit code that performs faster indirect calls.
17461
17462 This option does not work in the presence of shared libraries or nested
17463 functions.
17464
17465 @item -mfixed-range=@var{register-range}
17466 @opindex mfixed-range
17467 Generate code treating the given register range as fixed registers.
17468 A fixed register is one that the register allocator cannot use. This is
17469 useful when compiling kernel code. A register range is specified as
17470 two registers separated by a dash. Multiple register ranges can be
17471 specified separated by a comma.
17472
17473 @item -mlong-load-store
17474 @opindex mlong-load-store
17475 Generate 3-instruction load and store sequences as sometimes required by
17476 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
17477 the HP compilers.
17478
17479 @item -mportable-runtime
17480 @opindex mportable-runtime
17481 Use the portable calling conventions proposed by HP for ELF systems.
17482
17483 @item -mgas
17484 @opindex mgas
17485 Enable the use of assembler directives only GAS understands.
17486
17487 @item -mschedule=@var{cpu-type}
17488 @opindex mschedule
17489 Schedule code according to the constraints for the machine type
17490 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
17491 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
17492 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
17493 proper scheduling option for your machine. The default scheduling is
17494 @samp{8000}.
17495
17496 @item -mlinker-opt
17497 @opindex mlinker-opt
17498 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
17499 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
17500 linkers in which they give bogus error messages when linking some programs.
17501
17502 @item -msoft-float
17503 @opindex msoft-float
17504 Generate output containing library calls for floating point.
17505 @strong{Warning:} the requisite libraries are not available for all HPPA
17506 targets. Normally the facilities of the machine's usual C compiler are
17507 used, but this cannot be done directly in cross-compilation. You must make
17508 your own arrangements to provide suitable library functions for
17509 cross-compilation.
17510
17511 @option{-msoft-float} changes the calling convention in the output file;
17512 therefore, it is only useful if you compile @emph{all} of a program with
17513 this option. In particular, you need to compile @file{libgcc.a}, the
17514 library that comes with GCC, with @option{-msoft-float} in order for
17515 this to work.
17516
17517 @item -msio
17518 @opindex msio
17519 Generate the predefine, @code{_SIO}, for server IO@. The default is
17520 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
17521 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
17522 options are available under HP-UX and HI-UX@.
17523
17524 @item -mgnu-ld
17525 @opindex mgnu-ld
17526 Use options specific to GNU @command{ld}.
17527 This passes @option{-shared} to @command{ld} when
17528 building a shared library. It is the default when GCC is configured,
17529 explicitly or implicitly, with the GNU linker. This option does not
17530 affect which @command{ld} is called; it only changes what parameters
17531 are passed to that @command{ld}.
17532 The @command{ld} that is called is determined by the
17533 @option{--with-ld} configure option, GCC's program search path, and
17534 finally by the user's @env{PATH}. The linker used by GCC can be printed
17535 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
17536 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
17537
17538 @item -mhp-ld
17539 @opindex mhp-ld
17540 Use options specific to HP @command{ld}.
17541 This passes @option{-b} to @command{ld} when building
17542 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
17543 links. It is the default when GCC is configured, explicitly or
17544 implicitly, with the HP linker. This option does not affect
17545 which @command{ld} is called; it only changes what parameters are passed to that
17546 @command{ld}.
17547 The @command{ld} that is called is determined by the @option{--with-ld}
17548 configure option, GCC's program search path, and finally by the user's
17549 @env{PATH}. The linker used by GCC can be printed using @samp{which
17550 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
17551 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
17552
17553 @item -mlong-calls
17554 @opindex mno-long-calls
17555 Generate code that uses long call sequences. This ensures that a call
17556 is always able to reach linker generated stubs. The default is to generate
17557 long calls only when the distance from the call site to the beginning
17558 of the function or translation unit, as the case may be, exceeds a
17559 predefined limit set by the branch type being used. The limits for
17560 normal calls are 7,600,000 and 240,000 bytes, respectively for the
17561 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
17562 240,000 bytes.
17563
17564 Distances are measured from the beginning of functions when using the
17565 @option{-ffunction-sections} option, or when using the @option{-mgas}
17566 and @option{-mno-portable-runtime} options together under HP-UX with
17567 the SOM linker.
17568
17569 It is normally not desirable to use this option as it degrades
17570 performance. However, it may be useful in large applications,
17571 particularly when partial linking is used to build the application.
17572
17573 The types of long calls used depends on the capabilities of the
17574 assembler and linker, and the type of code being generated. The
17575 impact on systems that support long absolute calls, and long pic
17576 symbol-difference or pc-relative calls should be relatively small.
17577 However, an indirect call is used on 32-bit ELF systems in pic code
17578 and it is quite long.
17579
17580 @item -munix=@var{unix-std}
17581 @opindex march
17582 Generate compiler predefines and select a startfile for the specified
17583 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
17584 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
17585 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
17586 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
17587 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
17588 and later.
17589
17590 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
17591 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
17592 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
17593 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
17594 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
17595 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
17596
17597 It is @emph{important} to note that this option changes the interfaces
17598 for various library routines. It also affects the operational behavior
17599 of the C library. Thus, @emph{extreme} care is needed in using this
17600 option.
17601
17602 Library code that is intended to operate with more than one UNIX
17603 standard must test, set and restore the variable @code{__xpg4_extended_mask}
17604 as appropriate. Most GNU software doesn't provide this capability.
17605
17606 @item -nolibdld
17607 @opindex nolibdld
17608 Suppress the generation of link options to search libdld.sl when the
17609 @option{-static} option is specified on HP-UX 10 and later.
17610
17611 @item -static
17612 @opindex static
17613 The HP-UX implementation of setlocale in libc has a dependency on
17614 libdld.sl. There isn't an archive version of libdld.sl. Thus,
17615 when the @option{-static} option is specified, special link options
17616 are needed to resolve this dependency.
17617
17618 On HP-UX 10 and later, the GCC driver adds the necessary options to
17619 link with libdld.sl when the @option{-static} option is specified.
17620 This causes the resulting binary to be dynamic. On the 64-bit port,
17621 the linkers generate dynamic binaries by default in any case. The
17622 @option{-nolibdld} option can be used to prevent the GCC driver from
17623 adding these link options.
17624
17625 @item -threads
17626 @opindex threads
17627 Add support for multithreading with the @dfn{dce thread} library
17628 under HP-UX@. This option sets flags for both the preprocessor and
17629 linker.
17630 @end table
17631
17632 @node IA-64 Options
17633 @subsection IA-64 Options
17634 @cindex IA-64 Options
17635
17636 These are the @samp{-m} options defined for the Intel IA-64 architecture.
17637
17638 @table @gcctabopt
17639 @item -mbig-endian
17640 @opindex mbig-endian
17641 Generate code for a big-endian target. This is the default for HP-UX@.
17642
17643 @item -mlittle-endian
17644 @opindex mlittle-endian
17645 Generate code for a little-endian target. This is the default for AIX5
17646 and GNU/Linux.
17647
17648 @item -mgnu-as
17649 @itemx -mno-gnu-as
17650 @opindex mgnu-as
17651 @opindex mno-gnu-as
17652 Generate (or don't) code for the GNU assembler. This is the default.
17653 @c Also, this is the default if the configure option @option{--with-gnu-as}
17654 @c is used.
17655
17656 @item -mgnu-ld
17657 @itemx -mno-gnu-ld
17658 @opindex mgnu-ld
17659 @opindex mno-gnu-ld
17660 Generate (or don't) code for the GNU linker. This is the default.
17661 @c Also, this is the default if the configure option @option{--with-gnu-ld}
17662 @c is used.
17663
17664 @item -mno-pic
17665 @opindex mno-pic
17666 Generate code that does not use a global pointer register. The result
17667 is not position independent code, and violates the IA-64 ABI@.
17668
17669 @item -mvolatile-asm-stop
17670 @itemx -mno-volatile-asm-stop
17671 @opindex mvolatile-asm-stop
17672 @opindex mno-volatile-asm-stop
17673 Generate (or don't) a stop bit immediately before and after volatile asm
17674 statements.
17675
17676 @item -mregister-names
17677 @itemx -mno-register-names
17678 @opindex mregister-names
17679 @opindex mno-register-names
17680 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
17681 the stacked registers. This may make assembler output more readable.
17682
17683 @item -mno-sdata
17684 @itemx -msdata
17685 @opindex mno-sdata
17686 @opindex msdata
17687 Disable (or enable) optimizations that use the small data section. This may
17688 be useful for working around optimizer bugs.
17689
17690 @item -mconstant-gp
17691 @opindex mconstant-gp
17692 Generate code that uses a single constant global pointer value. This is
17693 useful when compiling kernel code.
17694
17695 @item -mauto-pic
17696 @opindex mauto-pic
17697 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
17698 This is useful when compiling firmware code.
17699
17700 @item -minline-float-divide-min-latency
17701 @opindex minline-float-divide-min-latency
17702 Generate code for inline divides of floating-point values
17703 using the minimum latency algorithm.
17704
17705 @item -minline-float-divide-max-throughput
17706 @opindex minline-float-divide-max-throughput
17707 Generate code for inline divides of floating-point values
17708 using the maximum throughput algorithm.
17709
17710 @item -mno-inline-float-divide
17711 @opindex mno-inline-float-divide
17712 Do not generate inline code for divides of floating-point values.
17713
17714 @item -minline-int-divide-min-latency
17715 @opindex minline-int-divide-min-latency
17716 Generate code for inline divides of integer values
17717 using the minimum latency algorithm.
17718
17719 @item -minline-int-divide-max-throughput
17720 @opindex minline-int-divide-max-throughput
17721 Generate code for inline divides of integer values
17722 using the maximum throughput algorithm.
17723
17724 @item -mno-inline-int-divide
17725 @opindex mno-inline-int-divide
17726 Do not generate inline code for divides of integer values.
17727
17728 @item -minline-sqrt-min-latency
17729 @opindex minline-sqrt-min-latency
17730 Generate code for inline square roots
17731 using the minimum latency algorithm.
17732
17733 @item -minline-sqrt-max-throughput
17734 @opindex minline-sqrt-max-throughput
17735 Generate code for inline square roots
17736 using the maximum throughput algorithm.
17737
17738 @item -mno-inline-sqrt
17739 @opindex mno-inline-sqrt
17740 Do not generate inline code for @code{sqrt}.
17741
17742 @item -mfused-madd
17743 @itemx -mno-fused-madd
17744 @opindex mfused-madd
17745 @opindex mno-fused-madd
17746 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
17747 instructions. The default is to use these instructions.
17748
17749 @item -mno-dwarf2-asm
17750 @itemx -mdwarf2-asm
17751 @opindex mno-dwarf2-asm
17752 @opindex mdwarf2-asm
17753 Don't (or do) generate assembler code for the DWARF line number debugging
17754 info. This may be useful when not using the GNU assembler.
17755
17756 @item -mearly-stop-bits
17757 @itemx -mno-early-stop-bits
17758 @opindex mearly-stop-bits
17759 @opindex mno-early-stop-bits
17760 Allow stop bits to be placed earlier than immediately preceding the
17761 instruction that triggered the stop bit. This can improve instruction
17762 scheduling, but does not always do so.
17763
17764 @item -mfixed-range=@var{register-range}
17765 @opindex mfixed-range
17766 Generate code treating the given register range as fixed registers.
17767 A fixed register is one that the register allocator cannot use. This is
17768 useful when compiling kernel code. A register range is specified as
17769 two registers separated by a dash. Multiple register ranges can be
17770 specified separated by a comma.
17771
17772 @item -mtls-size=@var{tls-size}
17773 @opindex mtls-size
17774 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
17775 64.
17776
17777 @item -mtune=@var{cpu-type}
17778 @opindex mtune
17779 Tune the instruction scheduling for a particular CPU, Valid values are
17780 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
17781 and @samp{mckinley}.
17782
17783 @item -milp32
17784 @itemx -mlp64
17785 @opindex milp32
17786 @opindex mlp64
17787 Generate code for a 32-bit or 64-bit environment.
17788 The 32-bit environment sets int, long and pointer to 32 bits.
17789 The 64-bit environment sets int to 32 bits and long and pointer
17790 to 64 bits. These are HP-UX specific flags.
17791
17792 @item -mno-sched-br-data-spec
17793 @itemx -msched-br-data-spec
17794 @opindex mno-sched-br-data-spec
17795 @opindex msched-br-data-spec
17796 (Dis/En)able data speculative scheduling before reload.
17797 This results in generation of @code{ld.a} instructions and
17798 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17799 The default setting is disabled.
17800
17801 @item -msched-ar-data-spec
17802 @itemx -mno-sched-ar-data-spec
17803 @opindex msched-ar-data-spec
17804 @opindex mno-sched-ar-data-spec
17805 (En/Dis)able data speculative scheduling after reload.
17806 This results in generation of @code{ld.a} instructions and
17807 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17808 The default setting is enabled.
17809
17810 @item -mno-sched-control-spec
17811 @itemx -msched-control-spec
17812 @opindex mno-sched-control-spec
17813 @opindex msched-control-spec
17814 (Dis/En)able control speculative scheduling. This feature is
17815 available only during region scheduling (i.e.@: before reload).
17816 This results in generation of the @code{ld.s} instructions and
17817 the corresponding check instructions @code{chk.s}.
17818 The default setting is disabled.
17819
17820 @item -msched-br-in-data-spec
17821 @itemx -mno-sched-br-in-data-spec
17822 @opindex msched-br-in-data-spec
17823 @opindex mno-sched-br-in-data-spec
17824 (En/Dis)able speculative scheduling of the instructions that
17825 are dependent on the data speculative loads before reload.
17826 This is effective only with @option{-msched-br-data-spec} enabled.
17827 The default setting is enabled.
17828
17829 @item -msched-ar-in-data-spec
17830 @itemx -mno-sched-ar-in-data-spec
17831 @opindex msched-ar-in-data-spec
17832 @opindex mno-sched-ar-in-data-spec
17833 (En/Dis)able speculative scheduling of the instructions that
17834 are dependent on the data speculative loads after reload.
17835 This is effective only with @option{-msched-ar-data-spec} enabled.
17836 The default setting is enabled.
17837
17838 @item -msched-in-control-spec
17839 @itemx -mno-sched-in-control-spec
17840 @opindex msched-in-control-spec
17841 @opindex mno-sched-in-control-spec
17842 (En/Dis)able speculative scheduling of the instructions that
17843 are dependent on the control speculative loads.
17844 This is effective only with @option{-msched-control-spec} enabled.
17845 The default setting is enabled.
17846
17847 @item -mno-sched-prefer-non-data-spec-insns
17848 @itemx -msched-prefer-non-data-spec-insns
17849 @opindex mno-sched-prefer-non-data-spec-insns
17850 @opindex msched-prefer-non-data-spec-insns
17851 If enabled, data-speculative instructions are chosen for schedule
17852 only if there are no other choices at the moment. This makes
17853 the use of the data speculation much more conservative.
17854 The default setting is disabled.
17855
17856 @item -mno-sched-prefer-non-control-spec-insns
17857 @itemx -msched-prefer-non-control-spec-insns
17858 @opindex mno-sched-prefer-non-control-spec-insns
17859 @opindex msched-prefer-non-control-spec-insns
17860 If enabled, control-speculative instructions are chosen for schedule
17861 only if there are no other choices at the moment. This makes
17862 the use of the control speculation much more conservative.
17863 The default setting is disabled.
17864
17865 @item -mno-sched-count-spec-in-critical-path
17866 @itemx -msched-count-spec-in-critical-path
17867 @opindex mno-sched-count-spec-in-critical-path
17868 @opindex msched-count-spec-in-critical-path
17869 If enabled, speculative dependencies are considered during
17870 computation of the instructions priorities. This makes the use of the
17871 speculation a bit more conservative.
17872 The default setting is disabled.
17873
17874 @item -msched-spec-ldc
17875 @opindex msched-spec-ldc
17876 Use a simple data speculation check. This option is on by default.
17877
17878 @item -msched-control-spec-ldc
17879 @opindex msched-spec-ldc
17880 Use a simple check for control speculation. This option is on by default.
17881
17882 @item -msched-stop-bits-after-every-cycle
17883 @opindex msched-stop-bits-after-every-cycle
17884 Place a stop bit after every cycle when scheduling. This option is on
17885 by default.
17886
17887 @item -msched-fp-mem-deps-zero-cost
17888 @opindex msched-fp-mem-deps-zero-cost
17889 Assume that floating-point stores and loads are not likely to cause a conflict
17890 when placed into the same instruction group. This option is disabled by
17891 default.
17892
17893 @item -msel-sched-dont-check-control-spec
17894 @opindex msel-sched-dont-check-control-spec
17895 Generate checks for control speculation in selective scheduling.
17896 This flag is disabled by default.
17897
17898 @item -msched-max-memory-insns=@var{max-insns}
17899 @opindex msched-max-memory-insns
17900 Limit on the number of memory insns per instruction group, giving lower
17901 priority to subsequent memory insns attempting to schedule in the same
17902 instruction group. Frequently useful to prevent cache bank conflicts.
17903 The default value is 1.
17904
17905 @item -msched-max-memory-insns-hard-limit
17906 @opindex msched-max-memory-insns-hard-limit
17907 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
17908 disallowing more than that number in an instruction group.
17909 Otherwise, the limit is ``soft'', meaning that non-memory operations
17910 are preferred when the limit is reached, but memory operations may still
17911 be scheduled.
17912
17913 @end table
17914
17915 @node LM32 Options
17916 @subsection LM32 Options
17917 @cindex LM32 options
17918
17919 These @option{-m} options are defined for the LatticeMico32 architecture:
17920
17921 @table @gcctabopt
17922 @item -mbarrel-shift-enabled
17923 @opindex mbarrel-shift-enabled
17924 Enable barrel-shift instructions.
17925
17926 @item -mdivide-enabled
17927 @opindex mdivide-enabled
17928 Enable divide and modulus instructions.
17929
17930 @item -mmultiply-enabled
17931 @opindex multiply-enabled
17932 Enable multiply instructions.
17933
17934 @item -msign-extend-enabled
17935 @opindex msign-extend-enabled
17936 Enable sign extend instructions.
17937
17938 @item -muser-enabled
17939 @opindex muser-enabled
17940 Enable user-defined instructions.
17941
17942 @end table
17943
17944 @node M32C Options
17945 @subsection M32C Options
17946 @cindex M32C options
17947
17948 @table @gcctabopt
17949 @item -mcpu=@var{name}
17950 @opindex mcpu=
17951 Select the CPU for which code is generated. @var{name} may be one of
17952 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
17953 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
17954 the M32C/80 series.
17955
17956 @item -msim
17957 @opindex msim
17958 Specifies that the program will be run on the simulator. This causes
17959 an alternate runtime library to be linked in which supports, for
17960 example, file I/O@. You must not use this option when generating
17961 programs that will run on real hardware; you must provide your own
17962 runtime library for whatever I/O functions are needed.
17963
17964 @item -memregs=@var{number}
17965 @opindex memregs=
17966 Specifies the number of memory-based pseudo-registers GCC uses
17967 during code generation. These pseudo-registers are used like real
17968 registers, so there is a tradeoff between GCC's ability to fit the
17969 code into available registers, and the performance penalty of using
17970 memory instead of registers. Note that all modules in a program must
17971 be compiled with the same value for this option. Because of that, you
17972 must not use this option with GCC's default runtime libraries.
17973
17974 @end table
17975
17976 @node M32R/D Options
17977 @subsection M32R/D Options
17978 @cindex M32R/D options
17979
17980 These @option{-m} options are defined for Renesas M32R/D architectures:
17981
17982 @table @gcctabopt
17983 @item -m32r2
17984 @opindex m32r2
17985 Generate code for the M32R/2@.
17986
17987 @item -m32rx
17988 @opindex m32rx
17989 Generate code for the M32R/X@.
17990
17991 @item -m32r
17992 @opindex m32r
17993 Generate code for the M32R@. This is the default.
17994
17995 @item -mmodel=small
17996 @opindex mmodel=small
17997 Assume all objects live in the lower 16MB of memory (so that their addresses
17998 can be loaded with the @code{ld24} instruction), and assume all subroutines
17999 are reachable with the @code{bl} instruction.
18000 This is the default.
18001
18002 The addressability of a particular object can be set with the
18003 @code{model} attribute.
18004
18005 @item -mmodel=medium
18006 @opindex mmodel=medium
18007 Assume objects may be anywhere in the 32-bit address space (the compiler
18008 generates @code{seth/add3} instructions to load their addresses), and
18009 assume all subroutines are reachable with the @code{bl} instruction.
18010
18011 @item -mmodel=large
18012 @opindex mmodel=large
18013 Assume objects may be anywhere in the 32-bit address space (the compiler
18014 generates @code{seth/add3} instructions to load their addresses), and
18015 assume subroutines may not be reachable with the @code{bl} instruction
18016 (the compiler generates the much slower @code{seth/add3/jl}
18017 instruction sequence).
18018
18019 @item -msdata=none
18020 @opindex msdata=none
18021 Disable use of the small data area. Variables are put into
18022 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
18023 @code{section} attribute has been specified).
18024 This is the default.
18025
18026 The small data area consists of sections @code{.sdata} and @code{.sbss}.
18027 Objects may be explicitly put in the small data area with the
18028 @code{section} attribute using one of these sections.
18029
18030 @item -msdata=sdata
18031 @opindex msdata=sdata
18032 Put small global and static data in the small data area, but do not
18033 generate special code to reference them.
18034
18035 @item -msdata=use
18036 @opindex msdata=use
18037 Put small global and static data in the small data area, and generate
18038 special instructions to reference them.
18039
18040 @item -G @var{num}
18041 @opindex G
18042 @cindex smaller data references
18043 Put global and static objects less than or equal to @var{num} bytes
18044 into the small data or BSS sections instead of the normal data or BSS
18045 sections. The default value of @var{num} is 8.
18046 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
18047 for this option to have any effect.
18048
18049 All modules should be compiled with the same @option{-G @var{num}} value.
18050 Compiling with different values of @var{num} may or may not work; if it
18051 doesn't the linker gives an error message---incorrect code is not
18052 generated.
18053
18054 @item -mdebug
18055 @opindex mdebug
18056 Makes the M32R-specific code in the compiler display some statistics
18057 that might help in debugging programs.
18058
18059 @item -malign-loops
18060 @opindex malign-loops
18061 Align all loops to a 32-byte boundary.
18062
18063 @item -mno-align-loops
18064 @opindex mno-align-loops
18065 Do not enforce a 32-byte alignment for loops. This is the default.
18066
18067 @item -missue-rate=@var{number}
18068 @opindex missue-rate=@var{number}
18069 Issue @var{number} instructions per cycle. @var{number} can only be 1
18070 or 2.
18071
18072 @item -mbranch-cost=@var{number}
18073 @opindex mbranch-cost=@var{number}
18074 @var{number} can only be 1 or 2. If it is 1 then branches are
18075 preferred over conditional code, if it is 2, then the opposite applies.
18076
18077 @item -mflush-trap=@var{number}
18078 @opindex mflush-trap=@var{number}
18079 Specifies the trap number to use to flush the cache. The default is
18080 12. Valid numbers are between 0 and 15 inclusive.
18081
18082 @item -mno-flush-trap
18083 @opindex mno-flush-trap
18084 Specifies that the cache cannot be flushed by using a trap.
18085
18086 @item -mflush-func=@var{name}
18087 @opindex mflush-func=@var{name}
18088 Specifies the name of the operating system function to call to flush
18089 the cache. The default is @samp{_flush_cache}, but a function call
18090 is only used if a trap is not available.
18091
18092 @item -mno-flush-func
18093 @opindex mno-flush-func
18094 Indicates that there is no OS function for flushing the cache.
18095
18096 @end table
18097
18098 @node M680x0 Options
18099 @subsection M680x0 Options
18100 @cindex M680x0 options
18101
18102 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
18103 The default settings depend on which architecture was selected when
18104 the compiler was configured; the defaults for the most common choices
18105 are given below.
18106
18107 @table @gcctabopt
18108 @item -march=@var{arch}
18109 @opindex march
18110 Generate code for a specific M680x0 or ColdFire instruction set
18111 architecture. Permissible values of @var{arch} for M680x0
18112 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
18113 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
18114 architectures are selected according to Freescale's ISA classification
18115 and the permissible values are: @samp{isaa}, @samp{isaaplus},
18116 @samp{isab} and @samp{isac}.
18117
18118 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
18119 code for a ColdFire target. The @var{arch} in this macro is one of the
18120 @option{-march} arguments given above.
18121
18122 When used together, @option{-march} and @option{-mtune} select code
18123 that runs on a family of similar processors but that is optimized
18124 for a particular microarchitecture.
18125
18126 @item -mcpu=@var{cpu}
18127 @opindex mcpu
18128 Generate code for a specific M680x0 or ColdFire processor.
18129 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
18130 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
18131 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
18132 below, which also classifies the CPUs into families:
18133
18134 @multitable @columnfractions 0.20 0.80
18135 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
18136 @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}
18137 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
18138 @item @samp{5206e} @tab @samp{5206e}
18139 @item @samp{5208} @tab @samp{5207} @samp{5208}
18140 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
18141 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
18142 @item @samp{5216} @tab @samp{5214} @samp{5216}
18143 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
18144 @item @samp{5225} @tab @samp{5224} @samp{5225}
18145 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
18146 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
18147 @item @samp{5249} @tab @samp{5249}
18148 @item @samp{5250} @tab @samp{5250}
18149 @item @samp{5271} @tab @samp{5270} @samp{5271}
18150 @item @samp{5272} @tab @samp{5272}
18151 @item @samp{5275} @tab @samp{5274} @samp{5275}
18152 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
18153 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
18154 @item @samp{5307} @tab @samp{5307}
18155 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
18156 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
18157 @item @samp{5407} @tab @samp{5407}
18158 @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}
18159 @end multitable
18160
18161 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
18162 @var{arch} is compatible with @var{cpu}. Other combinations of
18163 @option{-mcpu} and @option{-march} are rejected.
18164
18165 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
18166 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
18167 where the value of @var{family} is given by the table above.
18168
18169 @item -mtune=@var{tune}
18170 @opindex mtune
18171 Tune the code for a particular microarchitecture within the
18172 constraints set by @option{-march} and @option{-mcpu}.
18173 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
18174 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
18175 and @samp{cpu32}. The ColdFire microarchitectures
18176 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
18177
18178 You can also use @option{-mtune=68020-40} for code that needs
18179 to run relatively well on 68020, 68030 and 68040 targets.
18180 @option{-mtune=68020-60} is similar but includes 68060 targets
18181 as well. These two options select the same tuning decisions as
18182 @option{-m68020-40} and @option{-m68020-60} respectively.
18183
18184 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
18185 when tuning for 680x0 architecture @var{arch}. It also defines
18186 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
18187 option is used. If GCC is tuning for a range of architectures,
18188 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
18189 it defines the macros for every architecture in the range.
18190
18191 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
18192 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
18193 of the arguments given above.
18194
18195 @item -m68000
18196 @itemx -mc68000
18197 @opindex m68000
18198 @opindex mc68000
18199 Generate output for a 68000. This is the default
18200 when the compiler is configured for 68000-based systems.
18201 It is equivalent to @option{-march=68000}.
18202
18203 Use this option for microcontrollers with a 68000 or EC000 core,
18204 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
18205
18206 @item -m68010
18207 @opindex m68010
18208 Generate output for a 68010. This is the default
18209 when the compiler is configured for 68010-based systems.
18210 It is equivalent to @option{-march=68010}.
18211
18212 @item -m68020
18213 @itemx -mc68020
18214 @opindex m68020
18215 @opindex mc68020
18216 Generate output for a 68020. This is the default
18217 when the compiler is configured for 68020-based systems.
18218 It is equivalent to @option{-march=68020}.
18219
18220 @item -m68030
18221 @opindex m68030
18222 Generate output for a 68030. This is the default when the compiler is
18223 configured for 68030-based systems. It is equivalent to
18224 @option{-march=68030}.
18225
18226 @item -m68040
18227 @opindex m68040
18228 Generate output for a 68040. This is the default when the compiler is
18229 configured for 68040-based systems. It is equivalent to
18230 @option{-march=68040}.
18231
18232 This option inhibits the use of 68881/68882 instructions that have to be
18233 emulated by software on the 68040. Use this option if your 68040 does not
18234 have code to emulate those instructions.
18235
18236 @item -m68060
18237 @opindex m68060
18238 Generate output for a 68060. This is the default when the compiler is
18239 configured for 68060-based systems. It is equivalent to
18240 @option{-march=68060}.
18241
18242 This option inhibits the use of 68020 and 68881/68882 instructions that
18243 have to be emulated by software on the 68060. Use this option if your 68060
18244 does not have code to emulate those instructions.
18245
18246 @item -mcpu32
18247 @opindex mcpu32
18248 Generate output for a CPU32. This is the default
18249 when the compiler is configured for CPU32-based systems.
18250 It is equivalent to @option{-march=cpu32}.
18251
18252 Use this option for microcontrollers with a
18253 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
18254 68336, 68340, 68341, 68349 and 68360.
18255
18256 @item -m5200
18257 @opindex m5200
18258 Generate output for a 520X ColdFire CPU@. This is the default
18259 when the compiler is configured for 520X-based systems.
18260 It is equivalent to @option{-mcpu=5206}, and is now deprecated
18261 in favor of that option.
18262
18263 Use this option for microcontroller with a 5200 core, including
18264 the MCF5202, MCF5203, MCF5204 and MCF5206.
18265
18266 @item -m5206e
18267 @opindex m5206e
18268 Generate output for a 5206e ColdFire CPU@. The option is now
18269 deprecated in favor of the equivalent @option{-mcpu=5206e}.
18270
18271 @item -m528x
18272 @opindex m528x
18273 Generate output for a member of the ColdFire 528X family.
18274 The option is now deprecated in favor of the equivalent
18275 @option{-mcpu=528x}.
18276
18277 @item -m5307
18278 @opindex m5307
18279 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
18280 in favor of the equivalent @option{-mcpu=5307}.
18281
18282 @item -m5407
18283 @opindex m5407
18284 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
18285 in favor of the equivalent @option{-mcpu=5407}.
18286
18287 @item -mcfv4e
18288 @opindex mcfv4e
18289 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
18290 This includes use of hardware floating-point instructions.
18291 The option is equivalent to @option{-mcpu=547x}, and is now
18292 deprecated in favor of that option.
18293
18294 @item -m68020-40
18295 @opindex m68020-40
18296 Generate output for a 68040, without using any of the new instructions.
18297 This results in code that can run relatively efficiently on either a
18298 68020/68881 or a 68030 or a 68040. The generated code does use the
18299 68881 instructions that are emulated on the 68040.
18300
18301 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
18302
18303 @item -m68020-60
18304 @opindex m68020-60
18305 Generate output for a 68060, without using any of the new instructions.
18306 This results in code that can run relatively efficiently on either a
18307 68020/68881 or a 68030 or a 68040. The generated code does use the
18308 68881 instructions that are emulated on the 68060.
18309
18310 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
18311
18312 @item -mhard-float
18313 @itemx -m68881
18314 @opindex mhard-float
18315 @opindex m68881
18316 Generate floating-point instructions. This is the default for 68020
18317 and above, and for ColdFire devices that have an FPU@. It defines the
18318 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
18319 on ColdFire targets.
18320
18321 @item -msoft-float
18322 @opindex msoft-float
18323 Do not generate floating-point instructions; use library calls instead.
18324 This is the default for 68000, 68010, and 68832 targets. It is also
18325 the default for ColdFire devices that have no FPU.
18326
18327 @item -mdiv
18328 @itemx -mno-div
18329 @opindex mdiv
18330 @opindex mno-div
18331 Generate (do not generate) ColdFire hardware divide and remainder
18332 instructions. If @option{-march} is used without @option{-mcpu},
18333 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
18334 architectures. Otherwise, the default is taken from the target CPU
18335 (either the default CPU, or the one specified by @option{-mcpu}). For
18336 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
18337 @option{-mcpu=5206e}.
18338
18339 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
18340
18341 @item -mshort
18342 @opindex mshort
18343 Consider type @code{int} to be 16 bits wide, like @code{short int}.
18344 Additionally, parameters passed on the stack are also aligned to a
18345 16-bit boundary even on targets whose API mandates promotion to 32-bit.
18346
18347 @item -mno-short
18348 @opindex mno-short
18349 Do not consider type @code{int} to be 16 bits wide. This is the default.
18350
18351 @item -mnobitfield
18352 @itemx -mno-bitfield
18353 @opindex mnobitfield
18354 @opindex mno-bitfield
18355 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
18356 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
18357
18358 @item -mbitfield
18359 @opindex mbitfield
18360 Do use the bit-field instructions. The @option{-m68020} option implies
18361 @option{-mbitfield}. This is the default if you use a configuration
18362 designed for a 68020.
18363
18364 @item -mrtd
18365 @opindex mrtd
18366 Use a different function-calling convention, in which functions
18367 that take a fixed number of arguments return with the @code{rtd}
18368 instruction, which pops their arguments while returning. This
18369 saves one instruction in the caller since there is no need to pop
18370 the arguments there.
18371
18372 This calling convention is incompatible with the one normally
18373 used on Unix, so you cannot use it if you need to call libraries
18374 compiled with the Unix compiler.
18375
18376 Also, you must provide function prototypes for all functions that
18377 take variable numbers of arguments (including @code{printf});
18378 otherwise incorrect code is generated for calls to those
18379 functions.
18380
18381 In addition, seriously incorrect code results if you call a
18382 function with too many arguments. (Normally, extra arguments are
18383 harmlessly ignored.)
18384
18385 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
18386 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
18387
18388 @item -mno-rtd
18389 @opindex mno-rtd
18390 Do not use the calling conventions selected by @option{-mrtd}.
18391 This is the default.
18392
18393 @item -malign-int
18394 @itemx -mno-align-int
18395 @opindex malign-int
18396 @opindex mno-align-int
18397 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
18398 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
18399 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
18400 Aligning variables on 32-bit boundaries produces code that runs somewhat
18401 faster on processors with 32-bit busses at the expense of more memory.
18402
18403 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
18404 aligns structures containing the above types differently than
18405 most published application binary interface specifications for the m68k.
18406
18407 @item -mpcrel
18408 @opindex mpcrel
18409 Use the pc-relative addressing mode of the 68000 directly, instead of
18410 using a global offset table. At present, this option implies @option{-fpic},
18411 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
18412 not presently supported with @option{-mpcrel}, though this could be supported for
18413 68020 and higher processors.
18414
18415 @item -mno-strict-align
18416 @itemx -mstrict-align
18417 @opindex mno-strict-align
18418 @opindex mstrict-align
18419 Do not (do) assume that unaligned memory references are handled by
18420 the system.
18421
18422 @item -msep-data
18423 Generate code that allows the data segment to be located in a different
18424 area of memory from the text segment. This allows for execute-in-place in
18425 an environment without virtual memory management. This option implies
18426 @option{-fPIC}.
18427
18428 @item -mno-sep-data
18429 Generate code that assumes that the data segment follows the text segment.
18430 This is the default.
18431
18432 @item -mid-shared-library
18433 Generate code that supports shared libraries via the library ID method.
18434 This allows for execute-in-place and shared libraries in an environment
18435 without virtual memory management. This option implies @option{-fPIC}.
18436
18437 @item -mno-id-shared-library
18438 Generate code that doesn't assume ID-based shared libraries are being used.
18439 This is the default.
18440
18441 @item -mshared-library-id=n
18442 Specifies the identification number of the ID-based shared library being
18443 compiled. Specifying a value of 0 generates more compact code; specifying
18444 other values forces the allocation of that number to the current
18445 library, but is no more space- or time-efficient than omitting this option.
18446
18447 @item -mxgot
18448 @itemx -mno-xgot
18449 @opindex mxgot
18450 @opindex mno-xgot
18451 When generating position-independent code for ColdFire, generate code
18452 that works if the GOT has more than 8192 entries. This code is
18453 larger and slower than code generated without this option. On M680x0
18454 processors, this option is not needed; @option{-fPIC} suffices.
18455
18456 GCC normally uses a single instruction to load values from the GOT@.
18457 While this is relatively efficient, it only works if the GOT
18458 is smaller than about 64k. Anything larger causes the linker
18459 to report an error such as:
18460
18461 @cindex relocation truncated to fit (ColdFire)
18462 @smallexample
18463 relocation truncated to fit: R_68K_GOT16O foobar
18464 @end smallexample
18465
18466 If this happens, you should recompile your code with @option{-mxgot}.
18467 It should then work with very large GOTs. However, code generated with
18468 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
18469 the value of a global symbol.
18470
18471 Note that some linkers, including newer versions of the GNU linker,
18472 can create multiple GOTs and sort GOT entries. If you have such a linker,
18473 you should only need to use @option{-mxgot} when compiling a single
18474 object file that accesses more than 8192 GOT entries. Very few do.
18475
18476 These options have no effect unless GCC is generating
18477 position-independent code.
18478
18479 @item -mlong-jump-table-offsets
18480 @opindex mlong-jump-table-offsets
18481 Use 32-bit offsets in @code{switch} tables. The default is to use
18482 16-bit offsets.
18483
18484 @end table
18485
18486 @node MCore Options
18487 @subsection MCore Options
18488 @cindex MCore options
18489
18490 These are the @samp{-m} options defined for the Motorola M*Core
18491 processors.
18492
18493 @table @gcctabopt
18494
18495 @item -mhardlit
18496 @itemx -mno-hardlit
18497 @opindex mhardlit
18498 @opindex mno-hardlit
18499 Inline constants into the code stream if it can be done in two
18500 instructions or less.
18501
18502 @item -mdiv
18503 @itemx -mno-div
18504 @opindex mdiv
18505 @opindex mno-div
18506 Use the divide instruction. (Enabled by default).
18507
18508 @item -mrelax-immediate
18509 @itemx -mno-relax-immediate
18510 @opindex mrelax-immediate
18511 @opindex mno-relax-immediate
18512 Allow arbitrary-sized immediates in bit operations.
18513
18514 @item -mwide-bitfields
18515 @itemx -mno-wide-bitfields
18516 @opindex mwide-bitfields
18517 @opindex mno-wide-bitfields
18518 Always treat bit-fields as @code{int}-sized.
18519
18520 @item -m4byte-functions
18521 @itemx -mno-4byte-functions
18522 @opindex m4byte-functions
18523 @opindex mno-4byte-functions
18524 Force all functions to be aligned to a 4-byte boundary.
18525
18526 @item -mcallgraph-data
18527 @itemx -mno-callgraph-data
18528 @opindex mcallgraph-data
18529 @opindex mno-callgraph-data
18530 Emit callgraph information.
18531
18532 @item -mslow-bytes
18533 @itemx -mno-slow-bytes
18534 @opindex mslow-bytes
18535 @opindex mno-slow-bytes
18536 Prefer word access when reading byte quantities.
18537
18538 @item -mlittle-endian
18539 @itemx -mbig-endian
18540 @opindex mlittle-endian
18541 @opindex mbig-endian
18542 Generate code for a little-endian target.
18543
18544 @item -m210
18545 @itemx -m340
18546 @opindex m210
18547 @opindex m340
18548 Generate code for the 210 processor.
18549
18550 @item -mno-lsim
18551 @opindex mno-lsim
18552 Assume that runtime support has been provided and so omit the
18553 simulator library (@file{libsim.a)} from the linker command line.
18554
18555 @item -mstack-increment=@var{size}
18556 @opindex mstack-increment
18557 Set the maximum amount for a single stack increment operation. Large
18558 values can increase the speed of programs that contain functions
18559 that need a large amount of stack space, but they can also trigger a
18560 segmentation fault if the stack is extended too much. The default
18561 value is 0x1000.
18562
18563 @end table
18564
18565 @node MeP Options
18566 @subsection MeP Options
18567 @cindex MeP options
18568
18569 @table @gcctabopt
18570
18571 @item -mabsdiff
18572 @opindex mabsdiff
18573 Enables the @code{abs} instruction, which is the absolute difference
18574 between two registers.
18575
18576 @item -mall-opts
18577 @opindex mall-opts
18578 Enables all the optional instructions---average, multiply, divide, bit
18579 operations, leading zero, absolute difference, min/max, clip, and
18580 saturation.
18581
18582
18583 @item -maverage
18584 @opindex maverage
18585 Enables the @code{ave} instruction, which computes the average of two
18586 registers.
18587
18588 @item -mbased=@var{n}
18589 @opindex mbased=
18590 Variables of size @var{n} bytes or smaller are placed in the
18591 @code{.based} section by default. Based variables use the @code{$tp}
18592 register as a base register, and there is a 128-byte limit to the
18593 @code{.based} section.
18594
18595 @item -mbitops
18596 @opindex mbitops
18597 Enables the bit operation instructions---bit test (@code{btstm}), set
18598 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
18599 test-and-set (@code{tas}).
18600
18601 @item -mc=@var{name}
18602 @opindex mc=
18603 Selects which section constant data is placed in. @var{name} may
18604 be @samp{tiny}, @samp{near}, or @samp{far}.
18605
18606 @item -mclip
18607 @opindex mclip
18608 Enables the @code{clip} instruction. Note that @option{-mclip} is not
18609 useful unless you also provide @option{-mminmax}.
18610
18611 @item -mconfig=@var{name}
18612 @opindex mconfig=
18613 Selects one of the built-in core configurations. Each MeP chip has
18614 one or more modules in it; each module has a core CPU and a variety of
18615 coprocessors, optional instructions, and peripherals. The
18616 @code{MeP-Integrator} tool, not part of GCC, provides these
18617 configurations through this option; using this option is the same as
18618 using all the corresponding command-line options. The default
18619 configuration is @samp{default}.
18620
18621 @item -mcop
18622 @opindex mcop
18623 Enables the coprocessor instructions. By default, this is a 32-bit
18624 coprocessor. Note that the coprocessor is normally enabled via the
18625 @option{-mconfig=} option.
18626
18627 @item -mcop32
18628 @opindex mcop32
18629 Enables the 32-bit coprocessor's instructions.
18630
18631 @item -mcop64
18632 @opindex mcop64
18633 Enables the 64-bit coprocessor's instructions.
18634
18635 @item -mivc2
18636 @opindex mivc2
18637 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
18638
18639 @item -mdc
18640 @opindex mdc
18641 Causes constant variables to be placed in the @code{.near} section.
18642
18643 @item -mdiv
18644 @opindex mdiv
18645 Enables the @code{div} and @code{divu} instructions.
18646
18647 @item -meb
18648 @opindex meb
18649 Generate big-endian code.
18650
18651 @item -mel
18652 @opindex mel
18653 Generate little-endian code.
18654
18655 @item -mio-volatile
18656 @opindex mio-volatile
18657 Tells the compiler that any variable marked with the @code{io}
18658 attribute is to be considered volatile.
18659
18660 @item -ml
18661 @opindex ml
18662 Causes variables to be assigned to the @code{.far} section by default.
18663
18664 @item -mleadz
18665 @opindex mleadz
18666 Enables the @code{leadz} (leading zero) instruction.
18667
18668 @item -mm
18669 @opindex mm
18670 Causes variables to be assigned to the @code{.near} section by default.
18671
18672 @item -mminmax
18673 @opindex mminmax
18674 Enables the @code{min} and @code{max} instructions.
18675
18676 @item -mmult
18677 @opindex mmult
18678 Enables the multiplication and multiply-accumulate instructions.
18679
18680 @item -mno-opts
18681 @opindex mno-opts
18682 Disables all the optional instructions enabled by @option{-mall-opts}.
18683
18684 @item -mrepeat
18685 @opindex mrepeat
18686 Enables the @code{repeat} and @code{erepeat} instructions, used for
18687 low-overhead looping.
18688
18689 @item -ms
18690 @opindex ms
18691 Causes all variables to default to the @code{.tiny} section. Note
18692 that there is a 65536-byte limit to this section. Accesses to these
18693 variables use the @code{%gp} base register.
18694
18695 @item -msatur
18696 @opindex msatur
18697 Enables the saturation instructions. Note that the compiler does not
18698 currently generate these itself, but this option is included for
18699 compatibility with other tools, like @code{as}.
18700
18701 @item -msdram
18702 @opindex msdram
18703 Link the SDRAM-based runtime instead of the default ROM-based runtime.
18704
18705 @item -msim
18706 @opindex msim
18707 Link the simulator run-time libraries.
18708
18709 @item -msimnovec
18710 @opindex msimnovec
18711 Link the simulator runtime libraries, excluding built-in support
18712 for reset and exception vectors and tables.
18713
18714 @item -mtf
18715 @opindex mtf
18716 Causes all functions to default to the @code{.far} section. Without
18717 this option, functions default to the @code{.near} section.
18718
18719 @item -mtiny=@var{n}
18720 @opindex mtiny=
18721 Variables that are @var{n} bytes or smaller are allocated to the
18722 @code{.tiny} section. These variables use the @code{$gp} base
18723 register. The default for this option is 4, but note that there's a
18724 65536-byte limit to the @code{.tiny} section.
18725
18726 @end table
18727
18728 @node MicroBlaze Options
18729 @subsection MicroBlaze Options
18730 @cindex MicroBlaze Options
18731
18732 @table @gcctabopt
18733
18734 @item -msoft-float
18735 @opindex msoft-float
18736 Use software emulation for floating point (default).
18737
18738 @item -mhard-float
18739 @opindex mhard-float
18740 Use hardware floating-point instructions.
18741
18742 @item -mmemcpy
18743 @opindex mmemcpy
18744 Do not optimize block moves, use @code{memcpy}.
18745
18746 @item -mno-clearbss
18747 @opindex mno-clearbss
18748 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
18749
18750 @item -mcpu=@var{cpu-type}
18751 @opindex mcpu=
18752 Use features of, and schedule code for, the given CPU.
18753 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
18754 where @var{X} is a major version, @var{YY} is the minor version, and
18755 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
18756 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
18757
18758 @item -mxl-soft-mul
18759 @opindex mxl-soft-mul
18760 Use software multiply emulation (default).
18761
18762 @item -mxl-soft-div
18763 @opindex mxl-soft-div
18764 Use software emulation for divides (default).
18765
18766 @item -mxl-barrel-shift
18767 @opindex mxl-barrel-shift
18768 Use the hardware barrel shifter.
18769
18770 @item -mxl-pattern-compare
18771 @opindex mxl-pattern-compare
18772 Use pattern compare instructions.
18773
18774 @item -msmall-divides
18775 @opindex msmall-divides
18776 Use table lookup optimization for small signed integer divisions.
18777
18778 @item -mxl-stack-check
18779 @opindex mxl-stack-check
18780 This option is deprecated. Use @option{-fstack-check} instead.
18781
18782 @item -mxl-gp-opt
18783 @opindex mxl-gp-opt
18784 Use GP-relative @code{.sdata}/@code{.sbss} sections.
18785
18786 @item -mxl-multiply-high
18787 @opindex mxl-multiply-high
18788 Use multiply high instructions for high part of 32x32 multiply.
18789
18790 @item -mxl-float-convert
18791 @opindex mxl-float-convert
18792 Use hardware floating-point conversion instructions.
18793
18794 @item -mxl-float-sqrt
18795 @opindex mxl-float-sqrt
18796 Use hardware floating-point square root instruction.
18797
18798 @item -mbig-endian
18799 @opindex mbig-endian
18800 Generate code for a big-endian target.
18801
18802 @item -mlittle-endian
18803 @opindex mlittle-endian
18804 Generate code for a little-endian target.
18805
18806 @item -mxl-reorder
18807 @opindex mxl-reorder
18808 Use reorder instructions (swap and byte reversed load/store).
18809
18810 @item -mxl-mode-@var{app-model}
18811 Select application model @var{app-model}. Valid models are
18812 @table @samp
18813 @item executable
18814 normal executable (default), uses startup code @file{crt0.o}.
18815
18816 @item xmdstub
18817 for use with Xilinx Microprocessor Debugger (XMD) based
18818 software intrusive debug agent called xmdstub. This uses startup file
18819 @file{crt1.o} and sets the start address of the program to 0x800.
18820
18821 @item bootstrap
18822 for applications that are loaded using a bootloader.
18823 This model uses startup file @file{crt2.o} which does not contain a processor
18824 reset vector handler. This is suitable for transferring control on a
18825 processor reset to the bootloader rather than the application.
18826
18827 @item novectors
18828 for applications that do not require any of the
18829 MicroBlaze vectors. This option may be useful for applications running
18830 within a monitoring application. This model uses @file{crt3.o} as a startup file.
18831 @end table
18832
18833 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
18834 @option{-mxl-mode-@var{app-model}}.
18835
18836 @end table
18837
18838 @node MIPS Options
18839 @subsection MIPS Options
18840 @cindex MIPS options
18841
18842 @table @gcctabopt
18843
18844 @item -EB
18845 @opindex EB
18846 Generate big-endian code.
18847
18848 @item -EL
18849 @opindex EL
18850 Generate little-endian code. This is the default for @samp{mips*el-*-*}
18851 configurations.
18852
18853 @item -march=@var{arch}
18854 @opindex march
18855 Generate code that runs on @var{arch}, which can be the name of a
18856 generic MIPS ISA, or the name of a particular processor.
18857 The ISA names are:
18858 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
18859 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
18860 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
18861 @samp{mips64r5} and @samp{mips64r6}.
18862 The processor names are:
18863 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
18864 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
18865 @samp{5kc}, @samp{5kf},
18866 @samp{20kc},
18867 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
18868 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
18869 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
18870 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
18871 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
18872 @samp{i6400},
18873 @samp{interaptiv},
18874 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
18875 @samp{m4k},
18876 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
18877 @samp{m5100}, @samp{m5101},
18878 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
18879 @samp{orion},
18880 @samp{p5600},
18881 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
18882 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
18883 @samp{rm7000}, @samp{rm9000},
18884 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
18885 @samp{sb1},
18886 @samp{sr71000},
18887 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
18888 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
18889 @samp{xlr} and @samp{xlp}.
18890 The special value @samp{from-abi} selects the
18891 most compatible architecture for the selected ABI (that is,
18892 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
18893
18894 The native Linux/GNU toolchain also supports the value @samp{native},
18895 which selects the best architecture option for the host processor.
18896 @option{-march=native} has no effect if GCC does not recognize
18897 the processor.
18898
18899 In processor names, a final @samp{000} can be abbreviated as @samp{k}
18900 (for example, @option{-march=r2k}). Prefixes are optional, and
18901 @samp{vr} may be written @samp{r}.
18902
18903 Names of the form @samp{@var{n}f2_1} refer to processors with
18904 FPUs clocked at half the rate of the core, names of the form
18905 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
18906 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
18907 processors with FPUs clocked a ratio of 3:2 with respect to the core.
18908 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
18909 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
18910 accepted as synonyms for @samp{@var{n}f1_1}.
18911
18912 GCC defines two macros based on the value of this option. The first
18913 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
18914 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
18915 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
18916 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
18917 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
18918
18919 Note that the @code{_MIPS_ARCH} macro uses the processor names given
18920 above. In other words, it has the full prefix and does not
18921 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
18922 the macro names the resolved architecture (either @code{"mips1"} or
18923 @code{"mips3"}). It names the default architecture when no
18924 @option{-march} option is given.
18925
18926 @item -mtune=@var{arch}
18927 @opindex mtune
18928 Optimize for @var{arch}. Among other things, this option controls
18929 the way instructions are scheduled, and the perceived cost of arithmetic
18930 operations. The list of @var{arch} values is the same as for
18931 @option{-march}.
18932
18933 When this option is not used, GCC optimizes for the processor
18934 specified by @option{-march}. By using @option{-march} and
18935 @option{-mtune} together, it is possible to generate code that
18936 runs on a family of processors, but optimize the code for one
18937 particular member of that family.
18938
18939 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
18940 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
18941 @option{-march} ones described above.
18942
18943 @item -mips1
18944 @opindex mips1
18945 Equivalent to @option{-march=mips1}.
18946
18947 @item -mips2
18948 @opindex mips2
18949 Equivalent to @option{-march=mips2}.
18950
18951 @item -mips3
18952 @opindex mips3
18953 Equivalent to @option{-march=mips3}.
18954
18955 @item -mips4
18956 @opindex mips4
18957 Equivalent to @option{-march=mips4}.
18958
18959 @item -mips32
18960 @opindex mips32
18961 Equivalent to @option{-march=mips32}.
18962
18963 @item -mips32r3
18964 @opindex mips32r3
18965 Equivalent to @option{-march=mips32r3}.
18966
18967 @item -mips32r5
18968 @opindex mips32r5
18969 Equivalent to @option{-march=mips32r5}.
18970
18971 @item -mips32r6
18972 @opindex mips32r6
18973 Equivalent to @option{-march=mips32r6}.
18974
18975 @item -mips64
18976 @opindex mips64
18977 Equivalent to @option{-march=mips64}.
18978
18979 @item -mips64r2
18980 @opindex mips64r2
18981 Equivalent to @option{-march=mips64r2}.
18982
18983 @item -mips64r3
18984 @opindex mips64r3
18985 Equivalent to @option{-march=mips64r3}.
18986
18987 @item -mips64r5
18988 @opindex mips64r5
18989 Equivalent to @option{-march=mips64r5}.
18990
18991 @item -mips64r6
18992 @opindex mips64r6
18993 Equivalent to @option{-march=mips64r6}.
18994
18995 @item -mips16
18996 @itemx -mno-mips16
18997 @opindex mips16
18998 @opindex mno-mips16
18999 Generate (do not generate) MIPS16 code. If GCC is targeting a
19000 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
19001
19002 MIPS16 code generation can also be controlled on a per-function basis
19003 by means of @code{mips16} and @code{nomips16} attributes.
19004 @xref{Function Attributes}, for more information.
19005
19006 @item -mflip-mips16
19007 @opindex mflip-mips16
19008 Generate MIPS16 code on alternating functions. This option is provided
19009 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
19010 not intended for ordinary use in compiling user code.
19011
19012 @item -minterlink-compressed
19013 @item -mno-interlink-compressed
19014 @opindex minterlink-compressed
19015 @opindex mno-interlink-compressed
19016 Require (do not require) that code using the standard (uncompressed) MIPS ISA
19017 be link-compatible with MIPS16 and microMIPS code, and vice versa.
19018
19019 For example, code using the standard ISA encoding cannot jump directly
19020 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
19021 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
19022 knows that the target of the jump is not compressed.
19023
19024 @item -minterlink-mips16
19025 @itemx -mno-interlink-mips16
19026 @opindex minterlink-mips16
19027 @opindex mno-interlink-mips16
19028 Aliases of @option{-minterlink-compressed} and
19029 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
19030 and are retained for backwards compatibility.
19031
19032 @item -mabi=32
19033 @itemx -mabi=o64
19034 @itemx -mabi=n32
19035 @itemx -mabi=64
19036 @itemx -mabi=eabi
19037 @opindex mabi=32
19038 @opindex mabi=o64
19039 @opindex mabi=n32
19040 @opindex mabi=64
19041 @opindex mabi=eabi
19042 Generate code for the given ABI@.
19043
19044 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
19045 generates 64-bit code when you select a 64-bit architecture, but you
19046 can use @option{-mgp32} to get 32-bit code instead.
19047
19048 For information about the O64 ABI, see
19049 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
19050
19051 GCC supports a variant of the o32 ABI in which floating-point registers
19052 are 64 rather than 32 bits wide. You can select this combination with
19053 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
19054 and @code{mfhc1} instructions and is therefore only supported for
19055 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
19056
19057 The register assignments for arguments and return values remain the
19058 same, but each scalar value is passed in a single 64-bit register
19059 rather than a pair of 32-bit registers. For example, scalar
19060 floating-point values are returned in @samp{$f0} only, not a
19061 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
19062 remains the same in that the even-numbered double-precision registers
19063 are saved.
19064
19065 Two additional variants of the o32 ABI are supported to enable
19066 a transition from 32-bit to 64-bit registers. These are FPXX
19067 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
19068 The FPXX extension mandates that all code must execute correctly
19069 when run using 32-bit or 64-bit registers. The code can be interlinked
19070 with either FP32 or FP64, but not both.
19071 The FP64A extension is similar to the FP64 extension but forbids the
19072 use of odd-numbered single-precision registers. This can be used
19073 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
19074 processors and allows both FP32 and FP64A code to interlink and
19075 run in the same process without changing FPU modes.
19076
19077 @item -mabicalls
19078 @itemx -mno-abicalls
19079 @opindex mabicalls
19080 @opindex mno-abicalls
19081 Generate (do not generate) code that is suitable for SVR4-style
19082 dynamic objects. @option{-mabicalls} is the default for SVR4-based
19083 systems.
19084
19085 @item -mshared
19086 @itemx -mno-shared
19087 Generate (do not generate) code that is fully position-independent,
19088 and that can therefore be linked into shared libraries. This option
19089 only affects @option{-mabicalls}.
19090
19091 All @option{-mabicalls} code has traditionally been position-independent,
19092 regardless of options like @option{-fPIC} and @option{-fpic}. However,
19093 as an extension, the GNU toolchain allows executables to use absolute
19094 accesses for locally-binding symbols. It can also use shorter GP
19095 initialization sequences and generate direct calls to locally-defined
19096 functions. This mode is selected by @option{-mno-shared}.
19097
19098 @option{-mno-shared} depends on binutils 2.16 or higher and generates
19099 objects that can only be linked by the GNU linker. However, the option
19100 does not affect the ABI of the final executable; it only affects the ABI
19101 of relocatable objects. Using @option{-mno-shared} generally makes
19102 executables both smaller and quicker.
19103
19104 @option{-mshared} is the default.
19105
19106 @item -mplt
19107 @itemx -mno-plt
19108 @opindex mplt
19109 @opindex mno-plt
19110 Assume (do not assume) that the static and dynamic linkers
19111 support PLTs and copy relocations. This option only affects
19112 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
19113 has no effect without @option{-msym32}.
19114
19115 You can make @option{-mplt} the default by configuring
19116 GCC with @option{--with-mips-plt}. The default is
19117 @option{-mno-plt} otherwise.
19118
19119 @item -mxgot
19120 @itemx -mno-xgot
19121 @opindex mxgot
19122 @opindex mno-xgot
19123 Lift (do not lift) the usual restrictions on the size of the global
19124 offset table.
19125
19126 GCC normally uses a single instruction to load values from the GOT@.
19127 While this is relatively efficient, it only works if the GOT
19128 is smaller than about 64k. Anything larger causes the linker
19129 to report an error such as:
19130
19131 @cindex relocation truncated to fit (MIPS)
19132 @smallexample
19133 relocation truncated to fit: R_MIPS_GOT16 foobar
19134 @end smallexample
19135
19136 If this happens, you should recompile your code with @option{-mxgot}.
19137 This works with very large GOTs, although the code is also
19138 less efficient, since it takes three instructions to fetch the
19139 value of a global symbol.
19140
19141 Note that some linkers can create multiple GOTs. If you have such a
19142 linker, you should only need to use @option{-mxgot} when a single object
19143 file accesses more than 64k's worth of GOT entries. Very few do.
19144
19145 These options have no effect unless GCC is generating position
19146 independent code.
19147
19148 @item -mgp32
19149 @opindex mgp32
19150 Assume that general-purpose registers are 32 bits wide.
19151
19152 @item -mgp64
19153 @opindex mgp64
19154 Assume that general-purpose registers are 64 bits wide.
19155
19156 @item -mfp32
19157 @opindex mfp32
19158 Assume that floating-point registers are 32 bits wide.
19159
19160 @item -mfp64
19161 @opindex mfp64
19162 Assume that floating-point registers are 64 bits wide.
19163
19164 @item -mfpxx
19165 @opindex mfpxx
19166 Do not assume the width of floating-point registers.
19167
19168 @item -mhard-float
19169 @opindex mhard-float
19170 Use floating-point coprocessor instructions.
19171
19172 @item -msoft-float
19173 @opindex msoft-float
19174 Do not use floating-point coprocessor instructions. Implement
19175 floating-point calculations using library calls instead.
19176
19177 @item -mno-float
19178 @opindex mno-float
19179 Equivalent to @option{-msoft-float}, but additionally asserts that the
19180 program being compiled does not perform any floating-point operations.
19181 This option is presently supported only by some bare-metal MIPS
19182 configurations, where it may select a special set of libraries
19183 that lack all floating-point support (including, for example, the
19184 floating-point @code{printf} formats).
19185 If code compiled with @option{-mno-float} accidentally contains
19186 floating-point operations, it is likely to suffer a link-time
19187 or run-time failure.
19188
19189 @item -msingle-float
19190 @opindex msingle-float
19191 Assume that the floating-point coprocessor only supports single-precision
19192 operations.
19193
19194 @item -mdouble-float
19195 @opindex mdouble-float
19196 Assume that the floating-point coprocessor supports double-precision
19197 operations. This is the default.
19198
19199 @item -modd-spreg
19200 @itemx -mno-odd-spreg
19201 @opindex modd-spreg
19202 @opindex mno-odd-spreg
19203 Enable the use of odd-numbered single-precision floating-point registers
19204 for the o32 ABI. This is the default for processors that are known to
19205 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
19206 is set by default.
19207
19208 @item -mabs=2008
19209 @itemx -mabs=legacy
19210 @opindex mabs=2008
19211 @opindex mabs=legacy
19212 These options control the treatment of the special not-a-number (NaN)
19213 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
19214 @code{neg.@i{fmt}} machine instructions.
19215
19216 By default or when @option{-mabs=legacy} is used the legacy
19217 treatment is selected. In this case these instructions are considered
19218 arithmetic and avoided where correct operation is required and the
19219 input operand might be a NaN. A longer sequence of instructions that
19220 manipulate the sign bit of floating-point datum manually is used
19221 instead unless the @option{-ffinite-math-only} option has also been
19222 specified.
19223
19224 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
19225 this case these instructions are considered non-arithmetic and therefore
19226 operating correctly in all cases, including in particular where the
19227 input operand is a NaN. These instructions are therefore always used
19228 for the respective operations.
19229
19230 @item -mnan=2008
19231 @itemx -mnan=legacy
19232 @opindex mnan=2008
19233 @opindex mnan=legacy
19234 These options control the encoding of the special not-a-number (NaN)
19235 IEEE 754 floating-point data.
19236
19237 The @option{-mnan=legacy} option selects the legacy encoding. In this
19238 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
19239 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
19240 by the first bit of their trailing significand field being 1.
19241
19242 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
19243 this case qNaNs are denoted by the first bit of their trailing
19244 significand field being 1, whereas sNaNs are denoted by the first bit of
19245 their trailing significand field being 0.
19246
19247 The default is @option{-mnan=legacy} unless GCC has been configured with
19248 @option{--with-nan=2008}.
19249
19250 @item -mllsc
19251 @itemx -mno-llsc
19252 @opindex mllsc
19253 @opindex mno-llsc
19254 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
19255 implement atomic memory built-in functions. When neither option is
19256 specified, GCC uses the instructions if the target architecture
19257 supports them.
19258
19259 @option{-mllsc} is useful if the runtime environment can emulate the
19260 instructions and @option{-mno-llsc} can be useful when compiling for
19261 nonstandard ISAs. You can make either option the default by
19262 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
19263 respectively. @option{--with-llsc} is the default for some
19264 configurations; see the installation documentation for details.
19265
19266 @item -mdsp
19267 @itemx -mno-dsp
19268 @opindex mdsp
19269 @opindex mno-dsp
19270 Use (do not use) revision 1 of the MIPS DSP ASE@.
19271 @xref{MIPS DSP Built-in Functions}. This option defines the
19272 preprocessor macro @code{__mips_dsp}. It also defines
19273 @code{__mips_dsp_rev} to 1.
19274
19275 @item -mdspr2
19276 @itemx -mno-dspr2
19277 @opindex mdspr2
19278 @opindex mno-dspr2
19279 Use (do not use) revision 2 of the MIPS DSP ASE@.
19280 @xref{MIPS DSP Built-in Functions}. This option defines the
19281 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
19282 It also defines @code{__mips_dsp_rev} to 2.
19283
19284 @item -msmartmips
19285 @itemx -mno-smartmips
19286 @opindex msmartmips
19287 @opindex mno-smartmips
19288 Use (do not use) the MIPS SmartMIPS ASE.
19289
19290 @item -mpaired-single
19291 @itemx -mno-paired-single
19292 @opindex mpaired-single
19293 @opindex mno-paired-single
19294 Use (do not use) paired-single floating-point instructions.
19295 @xref{MIPS Paired-Single Support}. This option requires
19296 hardware floating-point support to be enabled.
19297
19298 @item -mdmx
19299 @itemx -mno-mdmx
19300 @opindex mdmx
19301 @opindex mno-mdmx
19302 Use (do not use) MIPS Digital Media Extension instructions.
19303 This option can only be used when generating 64-bit code and requires
19304 hardware floating-point support to be enabled.
19305
19306 @item -mips3d
19307 @itemx -mno-mips3d
19308 @opindex mips3d
19309 @opindex mno-mips3d
19310 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
19311 The option @option{-mips3d} implies @option{-mpaired-single}.
19312
19313 @item -mmicromips
19314 @itemx -mno-micromips
19315 @opindex mmicromips
19316 @opindex mno-mmicromips
19317 Generate (do not generate) microMIPS code.
19318
19319 MicroMIPS code generation can also be controlled on a per-function basis
19320 by means of @code{micromips} and @code{nomicromips} attributes.
19321 @xref{Function Attributes}, for more information.
19322
19323 @item -mmt
19324 @itemx -mno-mt
19325 @opindex mmt
19326 @opindex mno-mt
19327 Use (do not use) MT Multithreading instructions.
19328
19329 @item -mmcu
19330 @itemx -mno-mcu
19331 @opindex mmcu
19332 @opindex mno-mcu
19333 Use (do not use) the MIPS MCU ASE instructions.
19334
19335 @item -meva
19336 @itemx -mno-eva
19337 @opindex meva
19338 @opindex mno-eva
19339 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
19340
19341 @item -mvirt
19342 @itemx -mno-virt
19343 @opindex mvirt
19344 @opindex mno-virt
19345 Use (do not use) the MIPS Virtualization Application Specific instructions.
19346
19347 @item -mxpa
19348 @itemx -mno-xpa
19349 @opindex mxpa
19350 @opindex mno-xpa
19351 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
19352
19353 @item -mlong64
19354 @opindex mlong64
19355 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
19356 an explanation of the default and the way that the pointer size is
19357 determined.
19358
19359 @item -mlong32
19360 @opindex mlong32
19361 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
19362
19363 The default size of @code{int}s, @code{long}s and pointers depends on
19364 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
19365 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
19366 32-bit @code{long}s. Pointers are the same size as @code{long}s,
19367 or the same size as integer registers, whichever is smaller.
19368
19369 @item -msym32
19370 @itemx -mno-sym32
19371 @opindex msym32
19372 @opindex mno-sym32
19373 Assume (do not assume) that all symbols have 32-bit values, regardless
19374 of the selected ABI@. This option is useful in combination with
19375 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
19376 to generate shorter and faster references to symbolic addresses.
19377
19378 @item -G @var{num}
19379 @opindex G
19380 Put definitions of externally-visible data in a small data section
19381 if that data is no bigger than @var{num} bytes. GCC can then generate
19382 more efficient accesses to the data; see @option{-mgpopt} for details.
19383
19384 The default @option{-G} option depends on the configuration.
19385
19386 @item -mlocal-sdata
19387 @itemx -mno-local-sdata
19388 @opindex mlocal-sdata
19389 @opindex mno-local-sdata
19390 Extend (do not extend) the @option{-G} behavior to local data too,
19391 such as to static variables in C@. @option{-mlocal-sdata} is the
19392 default for all configurations.
19393
19394 If the linker complains that an application is using too much small data,
19395 you might want to try rebuilding the less performance-critical parts with
19396 @option{-mno-local-sdata}. You might also want to build large
19397 libraries with @option{-mno-local-sdata}, so that the libraries leave
19398 more room for the main program.
19399
19400 @item -mextern-sdata
19401 @itemx -mno-extern-sdata
19402 @opindex mextern-sdata
19403 @opindex mno-extern-sdata
19404 Assume (do not assume) that externally-defined data is in
19405 a small data section if the size of that data is within the @option{-G} limit.
19406 @option{-mextern-sdata} is the default for all configurations.
19407
19408 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
19409 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
19410 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
19411 is placed in a small data section. If @var{Var} is defined by another
19412 module, you must either compile that module with a high-enough
19413 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
19414 definition. If @var{Var} is common, you must link the application
19415 with a high-enough @option{-G} setting.
19416
19417 The easiest way of satisfying these restrictions is to compile
19418 and link every module with the same @option{-G} option. However,
19419 you may wish to build a library that supports several different
19420 small data limits. You can do this by compiling the library with
19421 the highest supported @option{-G} setting and additionally using
19422 @option{-mno-extern-sdata} to stop the library from making assumptions
19423 about externally-defined data.
19424
19425 @item -mgpopt
19426 @itemx -mno-gpopt
19427 @opindex mgpopt
19428 @opindex mno-gpopt
19429 Use (do not use) GP-relative accesses for symbols that are known to be
19430 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
19431 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
19432 configurations.
19433
19434 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
19435 might not hold the value of @code{_gp}. For example, if the code is
19436 part of a library that might be used in a boot monitor, programs that
19437 call boot monitor routines pass an unknown value in @code{$gp}.
19438 (In such situations, the boot monitor itself is usually compiled
19439 with @option{-G0}.)
19440
19441 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
19442 @option{-mno-extern-sdata}.
19443
19444 @item -membedded-data
19445 @itemx -mno-embedded-data
19446 @opindex membedded-data
19447 @opindex mno-embedded-data
19448 Allocate variables to the read-only data section first if possible, then
19449 next in the small data section if possible, otherwise in data. This gives
19450 slightly slower code than the default, but reduces the amount of RAM required
19451 when executing, and thus may be preferred for some embedded systems.
19452
19453 @item -muninit-const-in-rodata
19454 @itemx -mno-uninit-const-in-rodata
19455 @opindex muninit-const-in-rodata
19456 @opindex mno-uninit-const-in-rodata
19457 Put uninitialized @code{const} variables in the read-only data section.
19458 This option is only meaningful in conjunction with @option{-membedded-data}.
19459
19460 @item -mcode-readable=@var{setting}
19461 @opindex mcode-readable
19462 Specify whether GCC may generate code that reads from executable sections.
19463 There are three possible settings:
19464
19465 @table @gcctabopt
19466 @item -mcode-readable=yes
19467 Instructions may freely access executable sections. This is the
19468 default setting.
19469
19470 @item -mcode-readable=pcrel
19471 MIPS16 PC-relative load instructions can access executable sections,
19472 but other instructions must not do so. This option is useful on 4KSc
19473 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
19474 It is also useful on processors that can be configured to have a dual
19475 instruction/data SRAM interface and that, like the M4K, automatically
19476 redirect PC-relative loads to the instruction RAM.
19477
19478 @item -mcode-readable=no
19479 Instructions must not access executable sections. This option can be
19480 useful on targets that are configured to have a dual instruction/data
19481 SRAM interface but that (unlike the M4K) do not automatically redirect
19482 PC-relative loads to the instruction RAM.
19483 @end table
19484
19485 @item -msplit-addresses
19486 @itemx -mno-split-addresses
19487 @opindex msplit-addresses
19488 @opindex mno-split-addresses
19489 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
19490 relocation operators. This option has been superseded by
19491 @option{-mexplicit-relocs} but is retained for backwards compatibility.
19492
19493 @item -mexplicit-relocs
19494 @itemx -mno-explicit-relocs
19495 @opindex mexplicit-relocs
19496 @opindex mno-explicit-relocs
19497 Use (do not use) assembler relocation operators when dealing with symbolic
19498 addresses. The alternative, selected by @option{-mno-explicit-relocs},
19499 is to use assembler macros instead.
19500
19501 @option{-mexplicit-relocs} is the default if GCC was configured
19502 to use an assembler that supports relocation operators.
19503
19504 @item -mcheck-zero-division
19505 @itemx -mno-check-zero-division
19506 @opindex mcheck-zero-division
19507 @opindex mno-check-zero-division
19508 Trap (do not trap) on integer division by zero.
19509
19510 The default is @option{-mcheck-zero-division}.
19511
19512 @item -mdivide-traps
19513 @itemx -mdivide-breaks
19514 @opindex mdivide-traps
19515 @opindex mdivide-breaks
19516 MIPS systems check for division by zero by generating either a
19517 conditional trap or a break instruction. Using traps results in
19518 smaller code, but is only supported on MIPS II and later. Also, some
19519 versions of the Linux kernel have a bug that prevents trap from
19520 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
19521 allow conditional traps on architectures that support them and
19522 @option{-mdivide-breaks} to force the use of breaks.
19523
19524 The default is usually @option{-mdivide-traps}, but this can be
19525 overridden at configure time using @option{--with-divide=breaks}.
19526 Divide-by-zero checks can be completely disabled using
19527 @option{-mno-check-zero-division}.
19528
19529 @item -mload-store-pairs
19530 @itemx -mno-load-store-pairs
19531 @opindex mload-store-pairs
19532 @opindex mno-load-store-pairs
19533 Enable (disable) an optimization that pairs consecutive load or store
19534 instructions to enable load/store bonding. This option is enabled by
19535 default but only takes effect when the selected architecture is known
19536 to support bonding.
19537
19538 @item -mmemcpy
19539 @itemx -mno-memcpy
19540 @opindex mmemcpy
19541 @opindex mno-memcpy
19542 Force (do not force) the use of @code{memcpy} for non-trivial block
19543 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
19544 most constant-sized copies.
19545
19546 @item -mlong-calls
19547 @itemx -mno-long-calls
19548 @opindex mlong-calls
19549 @opindex mno-long-calls
19550 Disable (do not disable) use of the @code{jal} instruction. Calling
19551 functions using @code{jal} is more efficient but requires the caller
19552 and callee to be in the same 256 megabyte segment.
19553
19554 This option has no effect on abicalls code. The default is
19555 @option{-mno-long-calls}.
19556
19557 @item -mmad
19558 @itemx -mno-mad
19559 @opindex mmad
19560 @opindex mno-mad
19561 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
19562 instructions, as provided by the R4650 ISA@.
19563
19564 @item -mimadd
19565 @itemx -mno-imadd
19566 @opindex mimadd
19567 @opindex mno-imadd
19568 Enable (disable) use of the @code{madd} and @code{msub} integer
19569 instructions. The default is @option{-mimadd} on architectures
19570 that support @code{madd} and @code{msub} except for the 74k
19571 architecture where it was found to generate slower code.
19572
19573 @item -mfused-madd
19574 @itemx -mno-fused-madd
19575 @opindex mfused-madd
19576 @opindex mno-fused-madd
19577 Enable (disable) use of the floating-point multiply-accumulate
19578 instructions, when they are available. The default is
19579 @option{-mfused-madd}.
19580
19581 On the R8000 CPU when multiply-accumulate instructions are used,
19582 the intermediate product is calculated to infinite precision
19583 and is not subject to the FCSR Flush to Zero bit. This may be
19584 undesirable in some circumstances. On other processors the result
19585 is numerically identical to the equivalent computation using
19586 separate multiply, add, subtract and negate instructions.
19587
19588 @item -nocpp
19589 @opindex nocpp
19590 Tell the MIPS assembler to not run its preprocessor over user
19591 assembler files (with a @samp{.s} suffix) when assembling them.
19592
19593 @item -mfix-24k
19594 @item -mno-fix-24k
19595 @opindex mfix-24k
19596 @opindex mno-fix-24k
19597 Work around the 24K E48 (lost data on stores during refill) errata.
19598 The workarounds are implemented by the assembler rather than by GCC@.
19599
19600 @item -mfix-r4000
19601 @itemx -mno-fix-r4000
19602 @opindex mfix-r4000
19603 @opindex mno-fix-r4000
19604 Work around certain R4000 CPU errata:
19605 @itemize @minus
19606 @item
19607 A double-word or a variable shift may give an incorrect result if executed
19608 immediately after starting an integer division.
19609 @item
19610 A double-word or a variable shift may give an incorrect result if executed
19611 while an integer multiplication is in progress.
19612 @item
19613 An integer division may give an incorrect result if started in a delay slot
19614 of a taken branch or a jump.
19615 @end itemize
19616
19617 @item -mfix-r4400
19618 @itemx -mno-fix-r4400
19619 @opindex mfix-r4400
19620 @opindex mno-fix-r4400
19621 Work around certain R4400 CPU errata:
19622 @itemize @minus
19623 @item
19624 A double-word or a variable shift may give an incorrect result if executed
19625 immediately after starting an integer division.
19626 @end itemize
19627
19628 @item -mfix-r10000
19629 @itemx -mno-fix-r10000
19630 @opindex mfix-r10000
19631 @opindex mno-fix-r10000
19632 Work around certain R10000 errata:
19633 @itemize @minus
19634 @item
19635 @code{ll}/@code{sc} sequences may not behave atomically on revisions
19636 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
19637 @end itemize
19638
19639 This option can only be used if the target architecture supports
19640 branch-likely instructions. @option{-mfix-r10000} is the default when
19641 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
19642 otherwise.
19643
19644 @item -mfix-rm7000
19645 @itemx -mno-fix-rm7000
19646 @opindex mfix-rm7000
19647 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
19648 workarounds are implemented by the assembler rather than by GCC@.
19649
19650 @item -mfix-vr4120
19651 @itemx -mno-fix-vr4120
19652 @opindex mfix-vr4120
19653 Work around certain VR4120 errata:
19654 @itemize @minus
19655 @item
19656 @code{dmultu} does not always produce the correct result.
19657 @item
19658 @code{div} and @code{ddiv} do not always produce the correct result if one
19659 of the operands is negative.
19660 @end itemize
19661 The workarounds for the division errata rely on special functions in
19662 @file{libgcc.a}. At present, these functions are only provided by
19663 the @code{mips64vr*-elf} configurations.
19664
19665 Other VR4120 errata require a NOP to be inserted between certain pairs of
19666 instructions. These errata are handled by the assembler, not by GCC itself.
19667
19668 @item -mfix-vr4130
19669 @opindex mfix-vr4130
19670 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
19671 workarounds are implemented by the assembler rather than by GCC,
19672 although GCC avoids using @code{mflo} and @code{mfhi} if the
19673 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
19674 instructions are available instead.
19675
19676 @item -mfix-sb1
19677 @itemx -mno-fix-sb1
19678 @opindex mfix-sb1
19679 Work around certain SB-1 CPU core errata.
19680 (This flag currently works around the SB-1 revision 2
19681 ``F1'' and ``F2'' floating-point errata.)
19682
19683 @item -mr10k-cache-barrier=@var{setting}
19684 @opindex mr10k-cache-barrier
19685 Specify whether GCC should insert cache barriers to avoid the
19686 side-effects of speculation on R10K processors.
19687
19688 In common with many processors, the R10K tries to predict the outcome
19689 of a conditional branch and speculatively executes instructions from
19690 the ``taken'' branch. It later aborts these instructions if the
19691 predicted outcome is wrong. However, on the R10K, even aborted
19692 instructions can have side effects.
19693
19694 This problem only affects kernel stores and, depending on the system,
19695 kernel loads. As an example, a speculatively-executed store may load
19696 the target memory into cache and mark the cache line as dirty, even if
19697 the store itself is later aborted. If a DMA operation writes to the
19698 same area of memory before the ``dirty'' line is flushed, the cached
19699 data overwrites the DMA-ed data. See the R10K processor manual
19700 for a full description, including other potential problems.
19701
19702 One workaround is to insert cache barrier instructions before every memory
19703 access that might be speculatively executed and that might have side
19704 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
19705 controls GCC's implementation of this workaround. It assumes that
19706 aborted accesses to any byte in the following regions does not have
19707 side effects:
19708
19709 @enumerate
19710 @item
19711 the memory occupied by the current function's stack frame;
19712
19713 @item
19714 the memory occupied by an incoming stack argument;
19715
19716 @item
19717 the memory occupied by an object with a link-time-constant address.
19718 @end enumerate
19719
19720 It is the kernel's responsibility to ensure that speculative
19721 accesses to these regions are indeed safe.
19722
19723 If the input program contains a function declaration such as:
19724
19725 @smallexample
19726 void foo (void);
19727 @end smallexample
19728
19729 then the implementation of @code{foo} must allow @code{j foo} and
19730 @code{jal foo} to be executed speculatively. GCC honors this
19731 restriction for functions it compiles itself. It expects non-GCC
19732 functions (such as hand-written assembly code) to do the same.
19733
19734 The option has three forms:
19735
19736 @table @gcctabopt
19737 @item -mr10k-cache-barrier=load-store
19738 Insert a cache barrier before a load or store that might be
19739 speculatively executed and that might have side effects even
19740 if aborted.
19741
19742 @item -mr10k-cache-barrier=store
19743 Insert a cache barrier before a store that might be speculatively
19744 executed and that might have side effects even if aborted.
19745
19746 @item -mr10k-cache-barrier=none
19747 Disable the insertion of cache barriers. This is the default setting.
19748 @end table
19749
19750 @item -mflush-func=@var{func}
19751 @itemx -mno-flush-func
19752 @opindex mflush-func
19753 Specifies the function to call to flush the I and D caches, or to not
19754 call any such function. If called, the function must take the same
19755 arguments as the common @code{_flush_func}, that is, the address of the
19756 memory range for which the cache is being flushed, the size of the
19757 memory range, and the number 3 (to flush both caches). The default
19758 depends on the target GCC was configured for, but commonly is either
19759 @code{_flush_func} or @code{__cpu_flush}.
19760
19761 @item mbranch-cost=@var{num}
19762 @opindex mbranch-cost
19763 Set the cost of branches to roughly @var{num} ``simple'' instructions.
19764 This cost is only a heuristic and is not guaranteed to produce
19765 consistent results across releases. A zero cost redundantly selects
19766 the default, which is based on the @option{-mtune} setting.
19767
19768 @item -mbranch-likely
19769 @itemx -mno-branch-likely
19770 @opindex mbranch-likely
19771 @opindex mno-branch-likely
19772 Enable or disable use of Branch Likely instructions, regardless of the
19773 default for the selected architecture. By default, Branch Likely
19774 instructions may be generated if they are supported by the selected
19775 architecture. An exception is for the MIPS32 and MIPS64 architectures
19776 and processors that implement those architectures; for those, Branch
19777 Likely instructions are not be generated by default because the MIPS32
19778 and MIPS64 architectures specifically deprecate their use.
19779
19780 @item -mcompact-branches=never
19781 @itemx -mcompact-branches=optimal
19782 @itemx -mcompact-branches=always
19783 @opindex mcompact-branches=never
19784 @opindex mcompact-branches=optimal
19785 @opindex mcompact-branches=always
19786 These options control which form of branches will be generated. The
19787 default is @option{-mcompact-branches=optimal}.
19788
19789 The @option{-mcompact-branches=never} option ensures that compact branch
19790 instructions will never be generated.
19791
19792 The @option{-mcompact-branches=always} option ensures that a compact
19793 branch instruction will be generated if available. If a compact branch
19794 instruction is not available, a delay slot form of the branch will be
19795 used instead.
19796
19797 This option is supported from MIPS Release 6 onwards.
19798
19799 The @option{-mcompact-branches=optimal} option will cause a delay slot
19800 branch to be used if one is available in the current ISA and the delay
19801 slot is successfully filled. If the delay slot is not filled, a compact
19802 branch will be chosen if one is available.
19803
19804 @item -mfp-exceptions
19805 @itemx -mno-fp-exceptions
19806 @opindex mfp-exceptions
19807 Specifies whether FP exceptions are enabled. This affects how
19808 FP instructions are scheduled for some processors.
19809 The default is that FP exceptions are
19810 enabled.
19811
19812 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
19813 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
19814 FP pipe.
19815
19816 @item -mvr4130-align
19817 @itemx -mno-vr4130-align
19818 @opindex mvr4130-align
19819 The VR4130 pipeline is two-way superscalar, but can only issue two
19820 instructions together if the first one is 8-byte aligned. When this
19821 option is enabled, GCC aligns pairs of instructions that it
19822 thinks should execute in parallel.
19823
19824 This option only has an effect when optimizing for the VR4130.
19825 It normally makes code faster, but at the expense of making it bigger.
19826 It is enabled by default at optimization level @option{-O3}.
19827
19828 @item -msynci
19829 @itemx -mno-synci
19830 @opindex msynci
19831 Enable (disable) generation of @code{synci} instructions on
19832 architectures that support it. The @code{synci} instructions (if
19833 enabled) are generated when @code{__builtin___clear_cache} is
19834 compiled.
19835
19836 This option defaults to @option{-mno-synci}, but the default can be
19837 overridden by configuring GCC with @option{--with-synci}.
19838
19839 When compiling code for single processor systems, it is generally safe
19840 to use @code{synci}. However, on many multi-core (SMP) systems, it
19841 does not invalidate the instruction caches on all cores and may lead
19842 to undefined behavior.
19843
19844 @item -mrelax-pic-calls
19845 @itemx -mno-relax-pic-calls
19846 @opindex mrelax-pic-calls
19847 Try to turn PIC calls that are normally dispatched via register
19848 @code{$25} into direct calls. This is only possible if the linker can
19849 resolve the destination at link time and if the destination is within
19850 range for a direct call.
19851
19852 @option{-mrelax-pic-calls} is the default if GCC was configured to use
19853 an assembler and a linker that support the @code{.reloc} assembly
19854 directive and @option{-mexplicit-relocs} is in effect. With
19855 @option{-mno-explicit-relocs}, this optimization can be performed by the
19856 assembler and the linker alone without help from the compiler.
19857
19858 @item -mmcount-ra-address
19859 @itemx -mno-mcount-ra-address
19860 @opindex mmcount-ra-address
19861 @opindex mno-mcount-ra-address
19862 Emit (do not emit) code that allows @code{_mcount} to modify the
19863 calling function's return address. When enabled, this option extends
19864 the usual @code{_mcount} interface with a new @var{ra-address}
19865 parameter, which has type @code{intptr_t *} and is passed in register
19866 @code{$12}. @code{_mcount} can then modify the return address by
19867 doing both of the following:
19868 @itemize
19869 @item
19870 Returning the new address in register @code{$31}.
19871 @item
19872 Storing the new address in @code{*@var{ra-address}},
19873 if @var{ra-address} is nonnull.
19874 @end itemize
19875
19876 The default is @option{-mno-mcount-ra-address}.
19877
19878 @item -mframe-header-opt
19879 @itemx -mno-frame-header-opt
19880 @opindex mframe-header-opt
19881 Enable (disable) frame header optimization in the o32 ABI. When using the
19882 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
19883 function to write out register arguments. When enabled, this optimization
19884 will suppress the allocation of the frame header if it can be determined that
19885 it is unused.
19886
19887 This optimization is off by default at all optimization levels.
19888
19889 @item -mlxc1-sxc1
19890 @itemx -mno-lxc1-sxc1
19891 @opindex mlxc1-sxc1
19892 When applicable, enable (disable) the generation of @code{lwxc1},
19893 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
19894
19895 @item -mmadd4
19896 @itemx -mno-madd4
19897 @opindex mmadd4
19898 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
19899 @code{madd.d} and related instructions. Enabled by default.
19900
19901 @end table
19902
19903 @node MMIX Options
19904 @subsection MMIX Options
19905 @cindex MMIX Options
19906
19907 These options are defined for the MMIX:
19908
19909 @table @gcctabopt
19910 @item -mlibfuncs
19911 @itemx -mno-libfuncs
19912 @opindex mlibfuncs
19913 @opindex mno-libfuncs
19914 Specify that intrinsic library functions are being compiled, passing all
19915 values in registers, no matter the size.
19916
19917 @item -mepsilon
19918 @itemx -mno-epsilon
19919 @opindex mepsilon
19920 @opindex mno-epsilon
19921 Generate floating-point comparison instructions that compare with respect
19922 to the @code{rE} epsilon register.
19923
19924 @item -mabi=mmixware
19925 @itemx -mabi=gnu
19926 @opindex mabi=mmixware
19927 @opindex mabi=gnu
19928 Generate code that passes function parameters and return values that (in
19929 the called function) are seen as registers @code{$0} and up, as opposed to
19930 the GNU ABI which uses global registers @code{$231} and up.
19931
19932 @item -mzero-extend
19933 @itemx -mno-zero-extend
19934 @opindex mzero-extend
19935 @opindex mno-zero-extend
19936 When reading data from memory in sizes shorter than 64 bits, use (do not
19937 use) zero-extending load instructions by default, rather than
19938 sign-extending ones.
19939
19940 @item -mknuthdiv
19941 @itemx -mno-knuthdiv
19942 @opindex mknuthdiv
19943 @opindex mno-knuthdiv
19944 Make the result of a division yielding a remainder have the same sign as
19945 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
19946 remainder follows the sign of the dividend. Both methods are
19947 arithmetically valid, the latter being almost exclusively used.
19948
19949 @item -mtoplevel-symbols
19950 @itemx -mno-toplevel-symbols
19951 @opindex mtoplevel-symbols
19952 @opindex mno-toplevel-symbols
19953 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
19954 code can be used with the @code{PREFIX} assembly directive.
19955
19956 @item -melf
19957 @opindex melf
19958 Generate an executable in the ELF format, rather than the default
19959 @samp{mmo} format used by the @command{mmix} simulator.
19960
19961 @item -mbranch-predict
19962 @itemx -mno-branch-predict
19963 @opindex mbranch-predict
19964 @opindex mno-branch-predict
19965 Use (do not use) the probable-branch instructions, when static branch
19966 prediction indicates a probable branch.
19967
19968 @item -mbase-addresses
19969 @itemx -mno-base-addresses
19970 @opindex mbase-addresses
19971 @opindex mno-base-addresses
19972 Generate (do not generate) code that uses @emph{base addresses}. Using a
19973 base address automatically generates a request (handled by the assembler
19974 and the linker) for a constant to be set up in a global register. The
19975 register is used for one or more base address requests within the range 0
19976 to 255 from the value held in the register. The generally leads to short
19977 and fast code, but the number of different data items that can be
19978 addressed is limited. This means that a program that uses lots of static
19979 data may require @option{-mno-base-addresses}.
19980
19981 @item -msingle-exit
19982 @itemx -mno-single-exit
19983 @opindex msingle-exit
19984 @opindex mno-single-exit
19985 Force (do not force) generated code to have a single exit point in each
19986 function.
19987 @end table
19988
19989 @node MN10300 Options
19990 @subsection MN10300 Options
19991 @cindex MN10300 options
19992
19993 These @option{-m} options are defined for Matsushita MN10300 architectures:
19994
19995 @table @gcctabopt
19996 @item -mmult-bug
19997 @opindex mmult-bug
19998 Generate code to avoid bugs in the multiply instructions for the MN10300
19999 processors. This is the default.
20000
20001 @item -mno-mult-bug
20002 @opindex mno-mult-bug
20003 Do not generate code to avoid bugs in the multiply instructions for the
20004 MN10300 processors.
20005
20006 @item -mam33
20007 @opindex mam33
20008 Generate code using features specific to the AM33 processor.
20009
20010 @item -mno-am33
20011 @opindex mno-am33
20012 Do not generate code using features specific to the AM33 processor. This
20013 is the default.
20014
20015 @item -mam33-2
20016 @opindex mam33-2
20017 Generate code using features specific to the AM33/2.0 processor.
20018
20019 @item -mam34
20020 @opindex mam34
20021 Generate code using features specific to the AM34 processor.
20022
20023 @item -mtune=@var{cpu-type}
20024 @opindex mtune
20025 Use the timing characteristics of the indicated CPU type when
20026 scheduling instructions. This does not change the targeted processor
20027 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
20028 @samp{am33-2} or @samp{am34}.
20029
20030 @item -mreturn-pointer-on-d0
20031 @opindex mreturn-pointer-on-d0
20032 When generating a function that returns a pointer, return the pointer
20033 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
20034 only in @code{a0}, and attempts to call such functions without a prototype
20035 result in errors. Note that this option is on by default; use
20036 @option{-mno-return-pointer-on-d0} to disable it.
20037
20038 @item -mno-crt0
20039 @opindex mno-crt0
20040 Do not link in the C run-time initialization object file.
20041
20042 @item -mrelax
20043 @opindex mrelax
20044 Indicate to the linker that it should perform a relaxation optimization pass
20045 to shorten branches, calls and absolute memory addresses. This option only
20046 has an effect when used on the command line for the final link step.
20047
20048 This option makes symbolic debugging impossible.
20049
20050 @item -mliw
20051 @opindex mliw
20052 Allow the compiler to generate @emph{Long Instruction Word}
20053 instructions if the target is the @samp{AM33} or later. This is the
20054 default. This option defines the preprocessor macro @code{__LIW__}.
20055
20056 @item -mnoliw
20057 @opindex mnoliw
20058 Do not allow the compiler to generate @emph{Long Instruction Word}
20059 instructions. This option defines the preprocessor macro
20060 @code{__NO_LIW__}.
20061
20062 @item -msetlb
20063 @opindex msetlb
20064 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
20065 instructions if the target is the @samp{AM33} or later. This is the
20066 default. This option defines the preprocessor macro @code{__SETLB__}.
20067
20068 @item -mnosetlb
20069 @opindex mnosetlb
20070 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
20071 instructions. This option defines the preprocessor macro
20072 @code{__NO_SETLB__}.
20073
20074 @end table
20075
20076 @node Moxie Options
20077 @subsection Moxie Options
20078 @cindex Moxie Options
20079
20080 @table @gcctabopt
20081
20082 @item -meb
20083 @opindex meb
20084 Generate big-endian code. This is the default for @samp{moxie-*-*}
20085 configurations.
20086
20087 @item -mel
20088 @opindex mel
20089 Generate little-endian code.
20090
20091 @item -mmul.x
20092 @opindex mmul.x
20093 Generate mul.x and umul.x instructions. This is the default for
20094 @samp{moxiebox-*-*} configurations.
20095
20096 @item -mno-crt0
20097 @opindex mno-crt0
20098 Do not link in the C run-time initialization object file.
20099
20100 @end table
20101
20102 @node MSP430 Options
20103 @subsection MSP430 Options
20104 @cindex MSP430 Options
20105
20106 These options are defined for the MSP430:
20107
20108 @table @gcctabopt
20109
20110 @item -masm-hex
20111 @opindex masm-hex
20112 Force assembly output to always use hex constants. Normally such
20113 constants are signed decimals, but this option is available for
20114 testsuite and/or aesthetic purposes.
20115
20116 @item -mmcu=
20117 @opindex mmcu=
20118 Select the MCU to target. This is used to create a C preprocessor
20119 symbol based upon the MCU name, converted to upper case and pre- and
20120 post-fixed with @samp{__}. This in turn is used by the
20121 @file{msp430.h} header file to select an MCU-specific supplementary
20122 header file.
20123
20124 The option also sets the ISA to use. If the MCU name is one that is
20125 known to only support the 430 ISA then that is selected, otherwise the
20126 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
20127 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
20128 name selects the 430X ISA.
20129
20130 In addition an MCU-specific linker script is added to the linker
20131 command line. The script's name is the name of the MCU with
20132 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
20133 command line defines the C preprocessor symbol @code{__XXX__} and
20134 cause the linker to search for a script called @file{xxx.ld}.
20135
20136 This option is also passed on to the assembler.
20137
20138 @item -mwarn-mcu
20139 @itemx -mno-warn-mcu
20140 @opindex mwarn-mcu
20141 @opindex mno-warn-mcu
20142 This option enables or disables warnings about conflicts between the
20143 MCU name specified by the @option{-mmcu} option and the ISA set by the
20144 @option{-mcpu} option and/or the hardware multiply support set by the
20145 @option{-mhwmult} option. It also toggles warnings about unrecognized
20146 MCU names. This option is on by default.
20147
20148 @item -mcpu=
20149 @opindex mcpu=
20150 Specifies the ISA to use. Accepted values are @samp{msp430},
20151 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
20152 @option{-mmcu=} option should be used to select the ISA.
20153
20154 @item -msim
20155 @opindex msim
20156 Link to the simulator runtime libraries and linker script. Overrides
20157 any scripts that would be selected by the @option{-mmcu=} option.
20158
20159 @item -mlarge
20160 @opindex mlarge
20161 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
20162
20163 @item -msmall
20164 @opindex msmall
20165 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
20166
20167 @item -mrelax
20168 @opindex mrelax
20169 This option is passed to the assembler and linker, and allows the
20170 linker to perform certain optimizations that cannot be done until
20171 the final link.
20172
20173 @item mhwmult=
20174 @opindex mhwmult=
20175 Describes the type of hardware multiply supported by the target.
20176 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
20177 for the original 16-bit-only multiply supported by early MCUs.
20178 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
20179 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
20180 A value of @samp{auto} can also be given. This tells GCC to deduce
20181 the hardware multiply support based upon the MCU name provided by the
20182 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
20183 the MCU name is not recognized then no hardware multiply support is
20184 assumed. @code{auto} is the default setting.
20185
20186 Hardware multiplies are normally performed by calling a library
20187 routine. This saves space in the generated code. When compiling at
20188 @option{-O3} or higher however the hardware multiplier is invoked
20189 inline. This makes for bigger, but faster code.
20190
20191 The hardware multiply routines disable interrupts whilst running and
20192 restore the previous interrupt state when they finish. This makes
20193 them safe to use inside interrupt handlers as well as in normal code.
20194
20195 @item -minrt
20196 @opindex minrt
20197 Enable the use of a minimum runtime environment - no static
20198 initializers or constructors. This is intended for memory-constrained
20199 devices. The compiler includes special symbols in some objects
20200 that tell the linker and runtime which code fragments are required.
20201
20202 @item -mcode-region=
20203 @itemx -mdata-region=
20204 @opindex mcode-region
20205 @opindex mdata-region
20206 These options tell the compiler where to place functions and data that
20207 do not have one of the @code{lower}, @code{upper}, @code{either} or
20208 @code{section} attributes. Possible values are @code{lower},
20209 @code{upper}, @code{either} or @code{any}. The first three behave
20210 like the corresponding attribute. The fourth possible value -
20211 @code{any} - is the default. It leaves placement entirely up to the
20212 linker script and how it assigns the standard sections
20213 (@code{.text}, @code{.data}, etc) to the memory regions.
20214
20215 @item -msilicon-errata=
20216 @opindex msilicon-errata
20217 This option passes on a request to assembler to enable the fixes for
20218 the named silicon errata.
20219
20220 @item -msilicon-errata-warn=
20221 @opindex msilicon-errata-warn
20222 This option passes on a request to the assembler to enable warning
20223 messages when a silicon errata might need to be applied.
20224
20225 @end table
20226
20227 @node NDS32 Options
20228 @subsection NDS32 Options
20229 @cindex NDS32 Options
20230
20231 These options are defined for NDS32 implementations:
20232
20233 @table @gcctabopt
20234
20235 @item -mbig-endian
20236 @opindex mbig-endian
20237 Generate code in big-endian mode.
20238
20239 @item -mlittle-endian
20240 @opindex mlittle-endian
20241 Generate code in little-endian mode.
20242
20243 @item -mreduced-regs
20244 @opindex mreduced-regs
20245 Use reduced-set registers for register allocation.
20246
20247 @item -mfull-regs
20248 @opindex mfull-regs
20249 Use full-set registers for register allocation.
20250
20251 @item -mcmov
20252 @opindex mcmov
20253 Generate conditional move instructions.
20254
20255 @item -mno-cmov
20256 @opindex mno-cmov
20257 Do not generate conditional move instructions.
20258
20259 @item -mperf-ext
20260 @opindex mperf-ext
20261 Generate performance extension instructions.
20262
20263 @item -mno-perf-ext
20264 @opindex mno-perf-ext
20265 Do not generate performance extension instructions.
20266
20267 @item -mv3push
20268 @opindex mv3push
20269 Generate v3 push25/pop25 instructions.
20270
20271 @item -mno-v3push
20272 @opindex mno-v3push
20273 Do not generate v3 push25/pop25 instructions.
20274
20275 @item -m16-bit
20276 @opindex m16-bit
20277 Generate 16-bit instructions.
20278
20279 @item -mno-16-bit
20280 @opindex mno-16-bit
20281 Do not generate 16-bit instructions.
20282
20283 @item -misr-vector-size=@var{num}
20284 @opindex misr-vector-size
20285 Specify the size of each interrupt vector, which must be 4 or 16.
20286
20287 @item -mcache-block-size=@var{num}
20288 @opindex mcache-block-size
20289 Specify the size of each cache block,
20290 which must be a power of 2 between 4 and 512.
20291
20292 @item -march=@var{arch}
20293 @opindex march
20294 Specify the name of the target architecture.
20295
20296 @item -mcmodel=@var{code-model}
20297 @opindex mcmodel
20298 Set the code model to one of
20299 @table @asis
20300 @item @samp{small}
20301 All the data and read-only data segments must be within 512KB addressing space.
20302 The text segment must be within 16MB addressing space.
20303 @item @samp{medium}
20304 The data segment must be within 512KB while the read-only data segment can be
20305 within 4GB addressing space. The text segment should be still within 16MB
20306 addressing space.
20307 @item @samp{large}
20308 All the text and data segments can be within 4GB addressing space.
20309 @end table
20310
20311 @item -mctor-dtor
20312 @opindex mctor-dtor
20313 Enable constructor/destructor feature.
20314
20315 @item -mrelax
20316 @opindex mrelax
20317 Guide linker to relax instructions.
20318
20319 @end table
20320
20321 @node Nios II Options
20322 @subsection Nios II Options
20323 @cindex Nios II options
20324 @cindex Altera Nios II options
20325
20326 These are the options defined for the Altera Nios II processor.
20327
20328 @table @gcctabopt
20329
20330 @item -G @var{num}
20331 @opindex G
20332 @cindex smaller data references
20333 Put global and static objects less than or equal to @var{num} bytes
20334 into the small data or BSS sections instead of the normal data or BSS
20335 sections. The default value of @var{num} is 8.
20336
20337 @item -mgpopt=@var{option}
20338 @item -mgpopt
20339 @itemx -mno-gpopt
20340 @opindex mgpopt
20341 @opindex mno-gpopt
20342 Generate (do not generate) GP-relative accesses. The following
20343 @var{option} names are recognized:
20344
20345 @table @samp
20346
20347 @item none
20348 Do not generate GP-relative accesses.
20349
20350 @item local
20351 Generate GP-relative accesses for small data objects that are not
20352 external, weak, or uninitialized common symbols.
20353 Also use GP-relative addressing for objects that
20354 have been explicitly placed in a small data section via a @code{section}
20355 attribute.
20356
20357 @item global
20358 As for @samp{local}, but also generate GP-relative accesses for
20359 small data objects that are external, weak, or common. If you use this option,
20360 you must ensure that all parts of your program (including libraries) are
20361 compiled with the same @option{-G} setting.
20362
20363 @item data
20364 Generate GP-relative accesses for all data objects in the program. If you
20365 use this option, the entire data and BSS segments
20366 of your program must fit in 64K of memory and you must use an appropriate
20367 linker script to allocate them within the addressable range of the
20368 global pointer.
20369
20370 @item all
20371 Generate GP-relative addresses for function pointers as well as data
20372 pointers. If you use this option, the entire text, data, and BSS segments
20373 of your program must fit in 64K of memory and you must use an appropriate
20374 linker script to allocate them within the addressable range of the
20375 global pointer.
20376
20377 @end table
20378
20379 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
20380 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
20381
20382 The default is @option{-mgpopt} except when @option{-fpic} or
20383 @option{-fPIC} is specified to generate position-independent code.
20384 Note that the Nios II ABI does not permit GP-relative accesses from
20385 shared libraries.
20386
20387 You may need to specify @option{-mno-gpopt} explicitly when building
20388 programs that include large amounts of small data, including large
20389 GOT data sections. In this case, the 16-bit offset for GP-relative
20390 addressing may not be large enough to allow access to the entire
20391 small data section.
20392
20393 @item -mel
20394 @itemx -meb
20395 @opindex mel
20396 @opindex meb
20397 Generate little-endian (default) or big-endian (experimental) code,
20398 respectively.
20399
20400 @item -march=@var{arch}
20401 @opindex march
20402 This specifies the name of the target Nios II architecture. GCC uses this
20403 name to determine what kind of instructions it can emit when generating
20404 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
20405
20406 The preprocessor macro @code{__nios2_arch__} is available to programs,
20407 with value 1 or 2, indicating the targeted ISA level.
20408
20409 @item -mbypass-cache
20410 @itemx -mno-bypass-cache
20411 @opindex mno-bypass-cache
20412 @opindex mbypass-cache
20413 Force all load and store instructions to always bypass cache by
20414 using I/O variants of the instructions. The default is not to
20415 bypass the cache.
20416
20417 @item -mno-cache-volatile
20418 @itemx -mcache-volatile
20419 @opindex mcache-volatile
20420 @opindex mno-cache-volatile
20421 Volatile memory access bypass the cache using the I/O variants of
20422 the load and store instructions. The default is not to bypass the cache.
20423
20424 @item -mno-fast-sw-div
20425 @itemx -mfast-sw-div
20426 @opindex mno-fast-sw-div
20427 @opindex mfast-sw-div
20428 Do not use table-based fast divide for small numbers. The default
20429 is to use the fast divide at @option{-O3} and above.
20430
20431 @item -mno-hw-mul
20432 @itemx -mhw-mul
20433 @itemx -mno-hw-mulx
20434 @itemx -mhw-mulx
20435 @itemx -mno-hw-div
20436 @itemx -mhw-div
20437 @opindex mno-hw-mul
20438 @opindex mhw-mul
20439 @opindex mno-hw-mulx
20440 @opindex mhw-mulx
20441 @opindex mno-hw-div
20442 @opindex mhw-div
20443 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
20444 instructions by the compiler. The default is to emit @code{mul}
20445 and not emit @code{div} and @code{mulx}.
20446
20447 @item -mbmx
20448 @itemx -mno-bmx
20449 @itemx -mcdx
20450 @itemx -mno-cdx
20451 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
20452 CDX (code density) instructions. Enabling these instructions also
20453 requires @option{-march=r2}. Since these instructions are optional
20454 extensions to the R2 architecture, the default is not to emit them.
20455
20456 @item -mcustom-@var{insn}=@var{N}
20457 @itemx -mno-custom-@var{insn}
20458 @opindex mcustom-@var{insn}
20459 @opindex mno-custom-@var{insn}
20460 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
20461 custom instruction with encoding @var{N} when generating code that uses
20462 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
20463 instruction 253 for single-precision floating-point add operations instead
20464 of the default behavior of using a library call.
20465
20466 The following values of @var{insn} are supported. Except as otherwise
20467 noted, floating-point operations are expected to be implemented with
20468 normal IEEE 754 semantics and correspond directly to the C operators or the
20469 equivalent GCC built-in functions (@pxref{Other Builtins}).
20470
20471 Single-precision floating point:
20472 @table @asis
20473
20474 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
20475 Binary arithmetic operations.
20476
20477 @item @samp{fnegs}
20478 Unary negation.
20479
20480 @item @samp{fabss}
20481 Unary absolute value.
20482
20483 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
20484 Comparison operations.
20485
20486 @item @samp{fmins}, @samp{fmaxs}
20487 Floating-point minimum and maximum. These instructions are only
20488 generated if @option{-ffinite-math-only} is specified.
20489
20490 @item @samp{fsqrts}
20491 Unary square root operation.
20492
20493 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
20494 Floating-point trigonometric and exponential functions. These instructions
20495 are only generated if @option{-funsafe-math-optimizations} is also specified.
20496
20497 @end table
20498
20499 Double-precision floating point:
20500 @table @asis
20501
20502 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
20503 Binary arithmetic operations.
20504
20505 @item @samp{fnegd}
20506 Unary negation.
20507
20508 @item @samp{fabsd}
20509 Unary absolute value.
20510
20511 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
20512 Comparison operations.
20513
20514 @item @samp{fmind}, @samp{fmaxd}
20515 Double-precision minimum and maximum. These instructions are only
20516 generated if @option{-ffinite-math-only} is specified.
20517
20518 @item @samp{fsqrtd}
20519 Unary square root operation.
20520
20521 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
20522 Double-precision trigonometric and exponential functions. These instructions
20523 are only generated if @option{-funsafe-math-optimizations} is also specified.
20524
20525 @end table
20526
20527 Conversions:
20528 @table @asis
20529 @item @samp{fextsd}
20530 Conversion from single precision to double precision.
20531
20532 @item @samp{ftruncds}
20533 Conversion from double precision to single precision.
20534
20535 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
20536 Conversion from floating point to signed or unsigned integer types, with
20537 truncation towards zero.
20538
20539 @item @samp{round}
20540 Conversion from single-precision floating point to signed integer,
20541 rounding to the nearest integer and ties away from zero.
20542 This corresponds to the @code{__builtin_lroundf} function when
20543 @option{-fno-math-errno} is used.
20544
20545 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
20546 Conversion from signed or unsigned integer types to floating-point types.
20547
20548 @end table
20549
20550 In addition, all of the following transfer instructions for internal
20551 registers X and Y must be provided to use any of the double-precision
20552 floating-point instructions. Custom instructions taking two
20553 double-precision source operands expect the first operand in the
20554 64-bit register X. The other operand (or only operand of a unary
20555 operation) is given to the custom arithmetic instruction with the
20556 least significant half in source register @var{src1} and the most
20557 significant half in @var{src2}. A custom instruction that returns a
20558 double-precision result returns the most significant 32 bits in the
20559 destination register and the other half in 32-bit register Y.
20560 GCC automatically generates the necessary code sequences to write
20561 register X and/or read register Y when double-precision floating-point
20562 instructions are used.
20563
20564 @table @asis
20565
20566 @item @samp{fwrx}
20567 Write @var{src1} into the least significant half of X and @var{src2} into
20568 the most significant half of X.
20569
20570 @item @samp{fwry}
20571 Write @var{src1} into Y.
20572
20573 @item @samp{frdxhi}, @samp{frdxlo}
20574 Read the most or least (respectively) significant half of X and store it in
20575 @var{dest}.
20576
20577 @item @samp{frdy}
20578 Read the value of Y and store it into @var{dest}.
20579 @end table
20580
20581 Note that you can gain more local control over generation of Nios II custom
20582 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
20583 and @code{target("no-custom-@var{insn}")} function attributes
20584 (@pxref{Function Attributes})
20585 or pragmas (@pxref{Function Specific Option Pragmas}).
20586
20587 @item -mcustom-fpu-cfg=@var{name}
20588 @opindex mcustom-fpu-cfg
20589
20590 This option enables a predefined, named set of custom instruction encodings
20591 (see @option{-mcustom-@var{insn}} above).
20592 Currently, the following sets are defined:
20593
20594 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
20595 @gccoptlist{-mcustom-fmuls=252 @gol
20596 -mcustom-fadds=253 @gol
20597 -mcustom-fsubs=254 @gol
20598 -fsingle-precision-constant}
20599
20600 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
20601 @gccoptlist{-mcustom-fmuls=252 @gol
20602 -mcustom-fadds=253 @gol
20603 -mcustom-fsubs=254 @gol
20604 -mcustom-fdivs=255 @gol
20605 -fsingle-precision-constant}
20606
20607 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
20608 @gccoptlist{-mcustom-floatus=243 @gol
20609 -mcustom-fixsi=244 @gol
20610 -mcustom-floatis=245 @gol
20611 -mcustom-fcmpgts=246 @gol
20612 -mcustom-fcmples=249 @gol
20613 -mcustom-fcmpeqs=250 @gol
20614 -mcustom-fcmpnes=251 @gol
20615 -mcustom-fmuls=252 @gol
20616 -mcustom-fadds=253 @gol
20617 -mcustom-fsubs=254 @gol
20618 -mcustom-fdivs=255 @gol
20619 -fsingle-precision-constant}
20620
20621 Custom instruction assignments given by individual
20622 @option{-mcustom-@var{insn}=} options override those given by
20623 @option{-mcustom-fpu-cfg=}, regardless of the
20624 order of the options on the command line.
20625
20626 Note that you can gain more local control over selection of a FPU
20627 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
20628 function attribute (@pxref{Function Attributes})
20629 or pragma (@pxref{Function Specific Option Pragmas}).
20630
20631 @end table
20632
20633 These additional @samp{-m} options are available for the Altera Nios II
20634 ELF (bare-metal) target:
20635
20636 @table @gcctabopt
20637
20638 @item -mhal
20639 @opindex mhal
20640 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
20641 startup and termination code, and is typically used in conjunction with
20642 @option{-msys-crt0=} to specify the location of the alternate startup code
20643 provided by the HAL BSP.
20644
20645 @item -msmallc
20646 @opindex msmallc
20647 Link with a limited version of the C library, @option{-lsmallc}, rather than
20648 Newlib.
20649
20650 @item -msys-crt0=@var{startfile}
20651 @opindex msys-crt0
20652 @var{startfile} is the file name of the startfile (crt0) to use
20653 when linking. This option is only useful in conjunction with @option{-mhal}.
20654
20655 @item -msys-lib=@var{systemlib}
20656 @opindex msys-lib
20657 @var{systemlib} is the library name of the library that provides
20658 low-level system calls required by the C library,
20659 e.g. @code{read} and @code{write}.
20660 This option is typically used to link with a library provided by a HAL BSP.
20661
20662 @end table
20663
20664 @node Nvidia PTX Options
20665 @subsection Nvidia PTX Options
20666 @cindex Nvidia PTX options
20667 @cindex nvptx options
20668
20669 These options are defined for Nvidia PTX:
20670
20671 @table @gcctabopt
20672
20673 @item -m32
20674 @itemx -m64
20675 @opindex m32
20676 @opindex m64
20677 Generate code for 32-bit or 64-bit ABI.
20678
20679 @item -mmainkernel
20680 @opindex mmainkernel
20681 Link in code for a __main kernel. This is for stand-alone instead of
20682 offloading execution.
20683
20684 @item -moptimize
20685 @opindex moptimize
20686 Apply partitioned execution optimizations. This is the default when any
20687 level of optimization is selected.
20688
20689 @item -msoft-stack
20690 @opindex msoft-stack
20691 Generate code that does not use @code{.local} memory
20692 directly for stack storage. Instead, a per-warp stack pointer is
20693 maintained explicitly. This enables variable-length stack allocation (with
20694 variable-length arrays or @code{alloca}), and when global memory is used for
20695 underlying storage, makes it possible to access automatic variables from other
20696 threads, or with atomic instructions. This code generation variant is used
20697 for OpenMP offloading, but the option is exposed on its own for the purpose
20698 of testing the compiler; to generate code suitable for linking into programs
20699 using OpenMP offloading, use option @option{-mgomp}.
20700
20701 @item -muniform-simt
20702 @opindex muniform-simt
20703 Switch to code generation variant that allows to execute all threads in each
20704 warp, while maintaining memory state and side effects as if only one thread
20705 in each warp was active outside of OpenMP SIMD regions. All atomic operations
20706 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
20707 current lane index equals the master lane index), and the register being
20708 assigned is copied via a shuffle instruction from the master lane. Outside of
20709 SIMD regions lane 0 is the master; inside, each thread sees itself as the
20710 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
20711 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
20712 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
20713 with current lane index to compute the master lane index.
20714
20715 @item -mgomp
20716 @opindex mgomp
20717 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
20718 @option{-muniform-simt} options, and selects corresponding multilib variant.
20719
20720 @end table
20721
20722 @node PDP-11 Options
20723 @subsection PDP-11 Options
20724 @cindex PDP-11 Options
20725
20726 These options are defined for the PDP-11:
20727
20728 @table @gcctabopt
20729 @item -mfpu
20730 @opindex mfpu
20731 Use hardware FPP floating point. This is the default. (FIS floating
20732 point on the PDP-11/40 is not supported.)
20733
20734 @item -msoft-float
20735 @opindex msoft-float
20736 Do not use hardware floating point.
20737
20738 @item -mac0
20739 @opindex mac0
20740 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
20741
20742 @item -mno-ac0
20743 @opindex mno-ac0
20744 Return floating-point results in memory. This is the default.
20745
20746 @item -m40
20747 @opindex m40
20748 Generate code for a PDP-11/40.
20749
20750 @item -m45
20751 @opindex m45
20752 Generate code for a PDP-11/45. This is the default.
20753
20754 @item -m10
20755 @opindex m10
20756 Generate code for a PDP-11/10.
20757
20758 @item -mbcopy-builtin
20759 @opindex mbcopy-builtin
20760 Use inline @code{movmemhi} patterns for copying memory. This is the
20761 default.
20762
20763 @item -mbcopy
20764 @opindex mbcopy
20765 Do not use inline @code{movmemhi} patterns for copying memory.
20766
20767 @item -mint16
20768 @itemx -mno-int32
20769 @opindex mint16
20770 @opindex mno-int32
20771 Use 16-bit @code{int}. This is the default.
20772
20773 @item -mint32
20774 @itemx -mno-int16
20775 @opindex mint32
20776 @opindex mno-int16
20777 Use 32-bit @code{int}.
20778
20779 @item -mfloat64
20780 @itemx -mno-float32
20781 @opindex mfloat64
20782 @opindex mno-float32
20783 Use 64-bit @code{float}. This is the default.
20784
20785 @item -mfloat32
20786 @itemx -mno-float64
20787 @opindex mfloat32
20788 @opindex mno-float64
20789 Use 32-bit @code{float}.
20790
20791 @item -mabshi
20792 @opindex mabshi
20793 Use @code{abshi2} pattern. This is the default.
20794
20795 @item -mno-abshi
20796 @opindex mno-abshi
20797 Do not use @code{abshi2} pattern.
20798
20799 @item -mbranch-expensive
20800 @opindex mbranch-expensive
20801 Pretend that branches are expensive. This is for experimenting with
20802 code generation only.
20803
20804 @item -mbranch-cheap
20805 @opindex mbranch-cheap
20806 Do not pretend that branches are expensive. This is the default.
20807
20808 @item -munix-asm
20809 @opindex munix-asm
20810 Use Unix assembler syntax. This is the default when configured for
20811 @samp{pdp11-*-bsd}.
20812
20813 @item -mdec-asm
20814 @opindex mdec-asm
20815 Use DEC assembler syntax. This is the default when configured for any
20816 PDP-11 target other than @samp{pdp11-*-bsd}.
20817 @end table
20818
20819 @node picoChip Options
20820 @subsection picoChip Options
20821 @cindex picoChip options
20822
20823 These @samp{-m} options are defined for picoChip implementations:
20824
20825 @table @gcctabopt
20826
20827 @item -mae=@var{ae_type}
20828 @opindex mcpu
20829 Set the instruction set, register set, and instruction scheduling
20830 parameters for array element type @var{ae_type}. Supported values
20831 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
20832
20833 @option{-mae=ANY} selects a completely generic AE type. Code
20834 generated with this option runs on any of the other AE types. The
20835 code is not as efficient as it would be if compiled for a specific
20836 AE type, and some types of operation (e.g., multiplication) do not
20837 work properly on all types of AE.
20838
20839 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
20840 for compiled code, and is the default.
20841
20842 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
20843 option may suffer from poor performance of byte (char) manipulation,
20844 since the DSP AE does not provide hardware support for byte load/stores.
20845
20846 @item -msymbol-as-address
20847 Enable the compiler to directly use a symbol name as an address in a
20848 load/store instruction, without first loading it into a
20849 register. Typically, the use of this option generates larger
20850 programs, which run faster than when the option isn't used. However, the
20851 results vary from program to program, so it is left as a user option,
20852 rather than being permanently enabled.
20853
20854 @item -mno-inefficient-warnings
20855 Disables warnings about the generation of inefficient code. These
20856 warnings can be generated, for example, when compiling code that
20857 performs byte-level memory operations on the MAC AE type. The MAC AE has
20858 no hardware support for byte-level memory operations, so all byte
20859 load/stores must be synthesized from word load/store operations. This is
20860 inefficient and a warning is generated to indicate
20861 that you should rewrite the code to avoid byte operations, or to target
20862 an AE type that has the necessary hardware support. This option disables
20863 these warnings.
20864
20865 @end table
20866
20867 @node PowerPC Options
20868 @subsection PowerPC Options
20869 @cindex PowerPC options
20870
20871 These are listed under @xref{RS/6000 and PowerPC Options}.
20872
20873 @node RISC-V Options
20874 @subsection RISC-V Options
20875 @cindex RISC-V Options
20876
20877 These command-line options are defined for RISC-V targets:
20878
20879 @table @gcctabopt
20880 @item -mbranch-cost=@var{n}
20881 @opindex mbranch-cost
20882 Set the cost of branches to roughly @var{n} instructions.
20883
20884 @item -mmemcpy
20885 @itemx -mno-memcpy
20886 @opindex mmemcpy
20887 Don't optimize block moves.
20888
20889 @item -mplt
20890 @itemx -mno-plt
20891 @opindex plt
20892 When generating PIC code, allow the use of PLTs. Ignored for non-PIC.
20893
20894 @item -mabi=@var{ABI-string}
20895 @opindex mabi
20896 Specify integer and floating-point calling convention. This defaults to the
20897 natural calling convention: e.g.@ LP64 for RV64I, ILP32 for RV32I, LP64D for
20898 RV64G.
20899
20900 @item -mfdiv
20901 @itemx -mno-fdiv
20902 @opindex mfdiv
20903 Use hardware floating-point divide and square root instructions. This requires
20904 the F or D extensions for floating-point registers.
20905
20906 @item -mdiv
20907 @itemx -mno-div
20908 @opindex mdiv
20909 Use hardware instructions for integer division. This requires the M extension.
20910
20911 @item -march=@var{ISA-string}
20912 @opindex march
20913 Generate code for given RISC-V ISA (e.g.@ @samp{rv64im}). ISA strings must be
20914 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, and @samp{rv32imaf}.
20915
20916 @item -mtune=@var{processor-string}
20917 @opindex mtune
20918 Optimize the output for the given processor, specified by microarchitecture
20919 name.
20920
20921 @item -msmall-data-limit=@var{n}
20922 @opindex msmall-data-limit
20923 Put global and static data smaller than @var{n} bytes into a special section
20924 (on some targets).
20925
20926 @item -msave-restore
20927 @itemx -mno-save-restore
20928 @opindex msave-restore
20929 Use smaller but slower prologue and epilogue code.
20930
20931 @item -mcmodel=@var{code-model}
20932 @opindex mcmodel
20933 Specify the code model.
20934
20935 @end table
20936
20937 @node RL78 Options
20938 @subsection RL78 Options
20939 @cindex RL78 Options
20940
20941 @table @gcctabopt
20942
20943 @item -msim
20944 @opindex msim
20945 Links in additional target libraries to support operation within a
20946 simulator.
20947
20948 @item -mmul=none
20949 @itemx -mmul=g10
20950 @itemx -mmul=g13
20951 @itemx -mmul=g14
20952 @itemx -mmul=rl78
20953 @opindex mmul
20954 Specifies the type of hardware multiplication and division support to
20955 be used. The simplest is @code{none}, which uses software for both
20956 multiplication and division. This is the default. The @code{g13}
20957 value is for the hardware multiply/divide peripheral found on the
20958 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
20959 the multiplication and division instructions supported by the RL78/G14
20960 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
20961 the value @code{mg10} is an alias for @code{none}.
20962
20963 In addition a C preprocessor macro is defined, based upon the setting
20964 of this option. Possible values are: @code{__RL78_MUL_NONE__},
20965 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
20966
20967 @item -mcpu=g10
20968 @itemx -mcpu=g13
20969 @itemx -mcpu=g14
20970 @itemx -mcpu=rl78
20971 @opindex mcpu
20972 Specifies the RL78 core to target. The default is the G14 core, also
20973 known as an S3 core or just RL78. The G13 or S2 core does not have
20974 multiply or divide instructions, instead it uses a hardware peripheral
20975 for these operations. The G10 or S1 core does not have register
20976 banks, so it uses a different calling convention.
20977
20978 If this option is set it also selects the type of hardware multiply
20979 support to use, unless this is overridden by an explicit
20980 @option{-mmul=none} option on the command line. Thus specifying
20981 @option{-mcpu=g13} enables the use of the G13 hardware multiply
20982 peripheral and specifying @option{-mcpu=g10} disables the use of
20983 hardware multiplications altogether.
20984
20985 Note, although the RL78/G14 core is the default target, specifying
20986 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
20987 change the behavior of the toolchain since it also enables G14
20988 hardware multiply support. If these options are not specified on the
20989 command line then software multiplication routines will be used even
20990 though the code targets the RL78 core. This is for backwards
20991 compatibility with older toolchains which did not have hardware
20992 multiply and divide support.
20993
20994 In addition a C preprocessor macro is defined, based upon the setting
20995 of this option. Possible values are: @code{__RL78_G10__},
20996 @code{__RL78_G13__} or @code{__RL78_G14__}.
20997
20998 @item -mg10
20999 @itemx -mg13
21000 @itemx -mg14
21001 @itemx -mrl78
21002 @opindex mg10
21003 @opindex mg13
21004 @opindex mg14
21005 @opindex mrl78
21006 These are aliases for the corresponding @option{-mcpu=} option. They
21007 are provided for backwards compatibility.
21008
21009 @item -mallregs
21010 @opindex mallregs
21011 Allow the compiler to use all of the available registers. By default
21012 registers @code{r24..r31} are reserved for use in interrupt handlers.
21013 With this option enabled these registers can be used in ordinary
21014 functions as well.
21015
21016 @item -m64bit-doubles
21017 @itemx -m32bit-doubles
21018 @opindex m64bit-doubles
21019 @opindex m32bit-doubles
21020 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
21021 or 32 bits (@option{-m32bit-doubles}) in size. The default is
21022 @option{-m32bit-doubles}.
21023
21024 @item -msave-mduc-in-interrupts
21025 @item -mno-save-mduc-in-interrupts
21026 @opindex msave-mduc-in-interrupts
21027 @opindex mno-save-mduc-in-interrupts
21028 Specifies that interrupt handler functions should preserve the
21029 MDUC registers. This is only necessary if normal code might use
21030 the MDUC registers, for example because it performs multiplication
21031 and division operations. The default is to ignore the MDUC registers
21032 as this makes the interrupt handlers faster. The target option -mg13
21033 needs to be passed for this to work as this feature is only available
21034 on the G13 target (S2 core). The MDUC registers will only be saved
21035 if the interrupt handler performs a multiplication or division
21036 operation or it calls another function.
21037
21038 @end table
21039
21040 @node RS/6000 and PowerPC Options
21041 @subsection IBM RS/6000 and PowerPC Options
21042 @cindex RS/6000 and PowerPC Options
21043 @cindex IBM RS/6000 and PowerPC Options
21044
21045 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
21046 @table @gcctabopt
21047 @item -mpowerpc-gpopt
21048 @itemx -mno-powerpc-gpopt
21049 @itemx -mpowerpc-gfxopt
21050 @itemx -mno-powerpc-gfxopt
21051 @need 800
21052 @itemx -mpowerpc64
21053 @itemx -mno-powerpc64
21054 @itemx -mmfcrf
21055 @itemx -mno-mfcrf
21056 @itemx -mpopcntb
21057 @itemx -mno-popcntb
21058 @itemx -mpopcntd
21059 @itemx -mno-popcntd
21060 @itemx -mfprnd
21061 @itemx -mno-fprnd
21062 @need 800
21063 @itemx -mcmpb
21064 @itemx -mno-cmpb
21065 @itemx -mmfpgpr
21066 @itemx -mno-mfpgpr
21067 @itemx -mhard-dfp
21068 @itemx -mno-hard-dfp
21069 @opindex mpowerpc-gpopt
21070 @opindex mno-powerpc-gpopt
21071 @opindex mpowerpc-gfxopt
21072 @opindex mno-powerpc-gfxopt
21073 @opindex mpowerpc64
21074 @opindex mno-powerpc64
21075 @opindex mmfcrf
21076 @opindex mno-mfcrf
21077 @opindex mpopcntb
21078 @opindex mno-popcntb
21079 @opindex mpopcntd
21080 @opindex mno-popcntd
21081 @opindex mfprnd
21082 @opindex mno-fprnd
21083 @opindex mcmpb
21084 @opindex mno-cmpb
21085 @opindex mmfpgpr
21086 @opindex mno-mfpgpr
21087 @opindex mhard-dfp
21088 @opindex mno-hard-dfp
21089 You use these options to specify which instructions are available on the
21090 processor you are using. The default value of these options is
21091 determined when configuring GCC@. Specifying the
21092 @option{-mcpu=@var{cpu_type}} overrides the specification of these
21093 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
21094 rather than the options listed above.
21095
21096 Specifying @option{-mpowerpc-gpopt} allows
21097 GCC to use the optional PowerPC architecture instructions in the
21098 General Purpose group, including floating-point square root. Specifying
21099 @option{-mpowerpc-gfxopt} allows GCC to
21100 use the optional PowerPC architecture instructions in the Graphics
21101 group, including floating-point select.
21102
21103 The @option{-mmfcrf} option allows GCC to generate the move from
21104 condition register field instruction implemented on the POWER4
21105 processor and other processors that support the PowerPC V2.01
21106 architecture.
21107 The @option{-mpopcntb} option allows GCC to generate the popcount and
21108 double-precision FP reciprocal estimate instruction implemented on the
21109 POWER5 processor and other processors that support the PowerPC V2.02
21110 architecture.
21111 The @option{-mpopcntd} option allows GCC to generate the popcount
21112 instruction implemented on the POWER7 processor and other processors
21113 that support the PowerPC V2.06 architecture.
21114 The @option{-mfprnd} option allows GCC to generate the FP round to
21115 integer instructions implemented on the POWER5+ processor and other
21116 processors that support the PowerPC V2.03 architecture.
21117 The @option{-mcmpb} option allows GCC to generate the compare bytes
21118 instruction implemented on the POWER6 processor and other processors
21119 that support the PowerPC V2.05 architecture.
21120 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
21121 general-purpose register instructions implemented on the POWER6X
21122 processor and other processors that support the extended PowerPC V2.05
21123 architecture.
21124 The @option{-mhard-dfp} option allows GCC to generate the decimal
21125 floating-point instructions implemented on some POWER processors.
21126
21127 The @option{-mpowerpc64} option allows GCC to generate the additional
21128 64-bit instructions that are found in the full PowerPC64 architecture
21129 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
21130 @option{-mno-powerpc64}.
21131
21132 @item -mcpu=@var{cpu_type}
21133 @opindex mcpu
21134 Set architecture type, register usage, and
21135 instruction scheduling parameters for machine type @var{cpu_type}.
21136 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
21137 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
21138 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
21139 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
21140 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
21141 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
21142 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
21143 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
21144 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
21145 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
21146 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
21147 and @samp{rs64}.
21148
21149 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
21150 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
21151 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
21152 architecture machine types, with an appropriate, generic processor
21153 model assumed for scheduling purposes.
21154
21155 The other options specify a specific processor. Code generated under
21156 those options runs best on that processor, and may not run at all on
21157 others.
21158
21159 The @option{-mcpu} options automatically enable or disable the
21160 following options:
21161
21162 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
21163 -mpopcntb -mpopcntd -mpowerpc64 @gol
21164 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
21165 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
21166 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
21167 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
21168
21169 The particular options set for any particular CPU varies between
21170 compiler versions, depending on what setting seems to produce optimal
21171 code for that CPU; it doesn't necessarily reflect the actual hardware's
21172 capabilities. If you wish to set an individual option to a particular
21173 value, you may specify it after the @option{-mcpu} option, like
21174 @option{-mcpu=970 -mno-altivec}.
21175
21176 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
21177 not enabled or disabled by the @option{-mcpu} option at present because
21178 AIX does not have full support for these options. You may still
21179 enable or disable them individually if you're sure it'll work in your
21180 environment.
21181
21182 @item -mtune=@var{cpu_type}
21183 @opindex mtune
21184 Set the instruction scheduling parameters for machine type
21185 @var{cpu_type}, but do not set the architecture type or register usage,
21186 as @option{-mcpu=@var{cpu_type}} does. The same
21187 values for @var{cpu_type} are used for @option{-mtune} as for
21188 @option{-mcpu}. If both are specified, the code generated uses the
21189 architecture and registers set by @option{-mcpu}, but the
21190 scheduling parameters set by @option{-mtune}.
21191
21192 @item -mcmodel=small
21193 @opindex mcmodel=small
21194 Generate PowerPC64 code for the small model: The TOC is limited to
21195 64k.
21196
21197 @item -mcmodel=medium
21198 @opindex mcmodel=medium
21199 Generate PowerPC64 code for the medium model: The TOC and other static
21200 data may be up to a total of 4G in size. This is the default for 64-bit
21201 Linux.
21202
21203 @item -mcmodel=large
21204 @opindex mcmodel=large
21205 Generate PowerPC64 code for the large model: The TOC may be up to 4G
21206 in size. Other data and code is only limited by the 64-bit address
21207 space.
21208
21209 @item -maltivec
21210 @itemx -mno-altivec
21211 @opindex maltivec
21212 @opindex mno-altivec
21213 Generate code that uses (does not use) AltiVec instructions, and also
21214 enable the use of built-in functions that allow more direct access to
21215 the AltiVec instruction set. You may also need to set
21216 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
21217 enhancements.
21218
21219 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
21220 @option{-maltivec=be}, the element order for AltiVec intrinsics such
21221 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
21222 match array element order corresponding to the endianness of the
21223 target. That is, element zero identifies the leftmost element in a
21224 vector register when targeting a big-endian platform, and identifies
21225 the rightmost element in a vector register when targeting a
21226 little-endian platform.
21227
21228 @item -maltivec=be
21229 @opindex maltivec=be
21230 Generate AltiVec instructions using big-endian element order,
21231 regardless of whether the target is big- or little-endian. This is
21232 the default when targeting a big-endian platform.
21233
21234 The element order is used to interpret element numbers in AltiVec
21235 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
21236 @code{vec_insert}. By default, these match array element order
21237 corresponding to the endianness for the target.
21238
21239 @item -maltivec=le
21240 @opindex maltivec=le
21241 Generate AltiVec instructions using little-endian element order,
21242 regardless of whether the target is big- or little-endian. This is
21243 the default when targeting a little-endian platform. This option is
21244 currently ignored when targeting a big-endian platform.
21245
21246 The element order is used to interpret element numbers in AltiVec
21247 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
21248 @code{vec_insert}. By default, these match array element order
21249 corresponding to the endianness for the target.
21250
21251 @item -mvrsave
21252 @itemx -mno-vrsave
21253 @opindex mvrsave
21254 @opindex mno-vrsave
21255 Generate VRSAVE instructions when generating AltiVec code.
21256
21257 @item -mgen-cell-microcode
21258 @opindex mgen-cell-microcode
21259 Generate Cell microcode instructions.
21260
21261 @item -mwarn-cell-microcode
21262 @opindex mwarn-cell-microcode
21263 Warn when a Cell microcode instruction is emitted. An example
21264 of a Cell microcode instruction is a variable shift.
21265
21266 @item -msecure-plt
21267 @opindex msecure-plt
21268 Generate code that allows @command{ld} and @command{ld.so}
21269 to build executables and shared
21270 libraries with non-executable @code{.plt} and @code{.got} sections.
21271 This is a PowerPC
21272 32-bit SYSV ABI option.
21273
21274 @item -mbss-plt
21275 @opindex mbss-plt
21276 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
21277 fills in, and
21278 requires @code{.plt} and @code{.got}
21279 sections that are both writable and executable.
21280 This is a PowerPC 32-bit SYSV ABI option.
21281
21282 @item -misel
21283 @itemx -mno-isel
21284 @opindex misel
21285 @opindex mno-isel
21286 This switch enables or disables the generation of ISEL instructions.
21287
21288 @item -misel=@var{yes/no}
21289 This switch has been deprecated. Use @option{-misel} and
21290 @option{-mno-isel} instead.
21291
21292 @item -mlra
21293 @opindex mlra
21294 Enable Local Register Allocation. By default the port uses LRA.
21295 (i.e. @option{-mno-lra}).
21296
21297 @item -mspe
21298 @itemx -mno-spe
21299 @opindex mspe
21300 @opindex mno-spe
21301 This switch enables or disables the generation of SPE simd
21302 instructions.
21303
21304 @item -mpaired
21305 @itemx -mno-paired
21306 @opindex mpaired
21307 @opindex mno-paired
21308 This switch enables or disables the generation of PAIRED simd
21309 instructions.
21310
21311 @item -mspe=@var{yes/no}
21312 This option has been deprecated. Use @option{-mspe} and
21313 @option{-mno-spe} instead.
21314
21315 @item -mvsx
21316 @itemx -mno-vsx
21317 @opindex mvsx
21318 @opindex mno-vsx
21319 Generate code that uses (does not use) vector/scalar (VSX)
21320 instructions, and also enable the use of built-in functions that allow
21321 more direct access to the VSX instruction set.
21322
21323 @item -mcrypto
21324 @itemx -mno-crypto
21325 @opindex mcrypto
21326 @opindex mno-crypto
21327 Enable the use (disable) of the built-in functions that allow direct
21328 access to the cryptographic instructions that were added in version
21329 2.07 of the PowerPC ISA.
21330
21331 @item -mdirect-move
21332 @itemx -mno-direct-move
21333 @opindex mdirect-move
21334 @opindex mno-direct-move
21335 Generate code that uses (does not use) the instructions to move data
21336 between the general purpose registers and the vector/scalar (VSX)
21337 registers that were added in version 2.07 of the PowerPC ISA.
21338
21339 @item -mhtm
21340 @itemx -mno-htm
21341 @opindex mhtm
21342 @opindex mno-htm
21343 Enable (disable) the use of the built-in functions that allow direct
21344 access to the Hardware Transactional Memory (HTM) instructions that
21345 were added in version 2.07 of the PowerPC ISA.
21346
21347 @item -mpower8-fusion
21348 @itemx -mno-power8-fusion
21349 @opindex mpower8-fusion
21350 @opindex mno-power8-fusion
21351 Generate code that keeps (does not keeps) some integer operations
21352 adjacent so that the instructions can be fused together on power8 and
21353 later processors.
21354
21355 @item -mpower8-vector
21356 @itemx -mno-power8-vector
21357 @opindex mpower8-vector
21358 @opindex mno-power8-vector
21359 Generate code that uses (does not use) the vector and scalar
21360 instructions that were added in version 2.07 of the PowerPC ISA. Also
21361 enable the use of built-in functions that allow more direct access to
21362 the vector instructions.
21363
21364 @item -mquad-memory
21365 @itemx -mno-quad-memory
21366 @opindex mquad-memory
21367 @opindex mno-quad-memory
21368 Generate code that uses (does not use) the non-atomic quad word memory
21369 instructions. The @option{-mquad-memory} option requires use of
21370 64-bit mode.
21371
21372 @item -mquad-memory-atomic
21373 @itemx -mno-quad-memory-atomic
21374 @opindex mquad-memory-atomic
21375 @opindex mno-quad-memory-atomic
21376 Generate code that uses (does not use) the atomic quad word memory
21377 instructions. The @option{-mquad-memory-atomic} option requires use of
21378 64-bit mode.
21379
21380 @item -mupper-regs-di
21381 @itemx -mno-upper-regs-di
21382 @opindex mupper-regs-di
21383 @opindex mno-upper-regs-di
21384 Generate code that uses (does not use) the scalar instructions that
21385 target all 64 registers in the vector/scalar floating point register
21386 set that were added in version 2.06 of the PowerPC ISA when processing
21387 integers. @option{-mupper-regs-di} is turned on by default if you use
21388 any of the @option{-mcpu=power7}, @option{-mcpu=power8},
21389 @option{-mcpu=power9}, or @option{-mvsx} options.
21390
21391 @item -mupper-regs-df
21392 @itemx -mno-upper-regs-df
21393 @opindex mupper-regs-df
21394 @opindex mno-upper-regs-df
21395 Generate code that uses (does not use) the scalar double precision
21396 instructions that target all 64 registers in the vector/scalar
21397 floating point register set that were added in version 2.06 of the
21398 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
21399 use any of the @option{-mcpu=power7}, @option{-mcpu=power8},
21400 @option{-mcpu=power9}, or @option{-mvsx} options.
21401
21402 @item -mupper-regs-sf
21403 @itemx -mno-upper-regs-sf
21404 @opindex mupper-regs-sf
21405 @opindex mno-upper-regs-sf
21406 Generate code that uses (does not use) the scalar single precision
21407 instructions that target all 64 registers in the vector/scalar
21408 floating point register set that were added in version 2.07 of the
21409 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
21410 use either of the @option{-mcpu=power8}, @option{-mpower8-vector}, or
21411 @option{-mcpu=power9} options.
21412
21413 @item -mupper-regs
21414 @itemx -mno-upper-regs
21415 @opindex mupper-regs
21416 @opindex mno-upper-regs
21417 Generate code that uses (does not use) the scalar
21418 instructions that target all 64 registers in the vector/scalar
21419 floating point register set, depending on the model of the machine.
21420
21421 If the @option{-mno-upper-regs} option is used, it turns off both
21422 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
21423
21424 @item -mfloat128
21425 @itemx -mno-float128
21426 @opindex mfloat128
21427 @opindex mno-float128
21428 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
21429 and use either software emulation for IEEE 128-bit floating point or
21430 hardware instructions.
21431
21432 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
21433 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
21434 option. The @option{-mfloat128} option only works on PowerPC 64-bit
21435 Linux systems.
21436
21437 If you use the ISA 3.0 instruction set (@option{-mcpu=power9}), the
21438 @option{-mfloat128} option will also enable the generation of ISA 3.0
21439 IEEE 128-bit floating point instructions. Otherwise, IEEE 128-bit
21440 floating point will be done with software emulation.
21441
21442 @item -mfloat128-hardware
21443 @itemx -mno-float128-hardware
21444 @opindex mfloat128-hardware
21445 @opindex mno-float128-hardware
21446 Enable/disable using ISA 3.0 hardware instructions to support the
21447 @var{__float128} data type.
21448
21449 If you use @option{-mfloat128-hardware}, it will enable the option
21450 @option{-mfloat128} as well.
21451
21452 If you select ISA 3.0 instructions with @option{-mcpu=power9}, but do
21453 not use either @option{-mfloat128} or @option{-mfloat128-hardware},
21454 the IEEE 128-bit floating point support will not be enabled.
21455
21456 @item -mfloat-gprs=@var{yes/single/double/no}
21457 @itemx -mfloat-gprs
21458 @opindex mfloat-gprs
21459 This switch enables or disables the generation of floating-point
21460 operations on the general-purpose registers for architectures that
21461 support it.
21462
21463 The argument @samp{yes} or @samp{single} enables the use of
21464 single-precision floating-point operations.
21465
21466 The argument @samp{double} enables the use of single and
21467 double-precision floating-point operations.
21468
21469 The argument @samp{no} disables floating-point operations on the
21470 general-purpose registers.
21471
21472 This option is currently only available on the MPC854x.
21473
21474 @item -m32
21475 @itemx -m64
21476 @opindex m32
21477 @opindex m64
21478 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
21479 targets (including GNU/Linux). The 32-bit environment sets int, long
21480 and pointer to 32 bits and generates code that runs on any PowerPC
21481 variant. The 64-bit environment sets int to 32 bits and long and
21482 pointer to 64 bits, and generates code for PowerPC64, as for
21483 @option{-mpowerpc64}.
21484
21485 @item -mfull-toc
21486 @itemx -mno-fp-in-toc
21487 @itemx -mno-sum-in-toc
21488 @itemx -mminimal-toc
21489 @opindex mfull-toc
21490 @opindex mno-fp-in-toc
21491 @opindex mno-sum-in-toc
21492 @opindex mminimal-toc
21493 Modify generation of the TOC (Table Of Contents), which is created for
21494 every executable file. The @option{-mfull-toc} option is selected by
21495 default. In that case, GCC allocates at least one TOC entry for
21496 each unique non-automatic variable reference in your program. GCC
21497 also places floating-point constants in the TOC@. However, only
21498 16,384 entries are available in the TOC@.
21499
21500 If you receive a linker error message that saying you have overflowed
21501 the available TOC space, you can reduce the amount of TOC space used
21502 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
21503 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
21504 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
21505 generate code to calculate the sum of an address and a constant at
21506 run time instead of putting that sum into the TOC@. You may specify one
21507 or both of these options. Each causes GCC to produce very slightly
21508 slower and larger code at the expense of conserving TOC space.
21509
21510 If you still run out of space in the TOC even when you specify both of
21511 these options, specify @option{-mminimal-toc} instead. This option causes
21512 GCC to make only one TOC entry for every file. When you specify this
21513 option, GCC produces code that is slower and larger but which
21514 uses extremely little TOC space. You may wish to use this option
21515 only on files that contain less frequently-executed code.
21516
21517 @item -maix64
21518 @itemx -maix32
21519 @opindex maix64
21520 @opindex maix32
21521 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
21522 @code{long} type, and the infrastructure needed to support them.
21523 Specifying @option{-maix64} implies @option{-mpowerpc64},
21524 while @option{-maix32} disables the 64-bit ABI and
21525 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
21526
21527 @item -mxl-compat
21528 @itemx -mno-xl-compat
21529 @opindex mxl-compat
21530 @opindex mno-xl-compat
21531 Produce code that conforms more closely to IBM XL compiler semantics
21532 when using AIX-compatible ABI@. Pass floating-point arguments to
21533 prototyped functions beyond the register save area (RSA) on the stack
21534 in addition to argument FPRs. Do not assume that most significant
21535 double in 128-bit long double value is properly rounded when comparing
21536 values and converting to double. Use XL symbol names for long double
21537 support routines.
21538
21539 The AIX calling convention was extended but not initially documented to
21540 handle an obscure K&R C case of calling a function that takes the
21541 address of its arguments with fewer arguments than declared. IBM XL
21542 compilers access floating-point arguments that do not fit in the
21543 RSA from the stack when a subroutine is compiled without
21544 optimization. Because always storing floating-point arguments on the
21545 stack is inefficient and rarely needed, this option is not enabled by
21546 default and only is necessary when calling subroutines compiled by IBM
21547 XL compilers without optimization.
21548
21549 @item -mpe
21550 @opindex mpe
21551 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
21552 application written to use message passing with special startup code to
21553 enable the application to run. The system must have PE installed in the
21554 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
21555 must be overridden with the @option{-specs=} option to specify the
21556 appropriate directory location. The Parallel Environment does not
21557 support threads, so the @option{-mpe} option and the @option{-pthread}
21558 option are incompatible.
21559
21560 @item -malign-natural
21561 @itemx -malign-power
21562 @opindex malign-natural
21563 @opindex malign-power
21564 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
21565 @option{-malign-natural} overrides the ABI-defined alignment of larger
21566 types, such as floating-point doubles, on their natural size-based boundary.
21567 The option @option{-malign-power} instructs GCC to follow the ABI-specified
21568 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
21569
21570 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
21571 is not supported.
21572
21573 @item -msoft-float
21574 @itemx -mhard-float
21575 @opindex msoft-float
21576 @opindex mhard-float
21577 Generate code that does not use (uses) the floating-point register set.
21578 Software floating-point emulation is provided if you use the
21579 @option{-msoft-float} option, and pass the option to GCC when linking.
21580
21581 @item -msingle-float
21582 @itemx -mdouble-float
21583 @opindex msingle-float
21584 @opindex mdouble-float
21585 Generate code for single- or double-precision floating-point operations.
21586 @option{-mdouble-float} implies @option{-msingle-float}.
21587
21588 @item -msimple-fpu
21589 @opindex msimple-fpu
21590 Do not generate @code{sqrt} and @code{div} instructions for hardware
21591 floating-point unit.
21592
21593 @item -mfpu=@var{name}
21594 @opindex mfpu
21595 Specify type of floating-point unit. Valid values for @var{name} are
21596 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
21597 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
21598 @samp{sp_full} (equivalent to @option{-msingle-float}),
21599 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
21600
21601 @item -mxilinx-fpu
21602 @opindex mxilinx-fpu
21603 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
21604
21605 @item -mmultiple
21606 @itemx -mno-multiple
21607 @opindex mmultiple
21608 @opindex mno-multiple
21609 Generate code that uses (does not use) the load multiple word
21610 instructions and the store multiple word instructions. These
21611 instructions are generated by default on POWER systems, and not
21612 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
21613 PowerPC systems, since those instructions do not work when the
21614 processor is in little-endian mode. The exceptions are PPC740 and
21615 PPC750 which permit these instructions in little-endian mode.
21616
21617 @item -mstring
21618 @itemx -mno-string
21619 @opindex mstring
21620 @opindex mno-string
21621 Generate code that uses (does not use) the load string instructions
21622 and the store string word instructions to save multiple registers and
21623 do small block moves. These instructions are generated by default on
21624 POWER systems, and not generated on PowerPC systems. Do not use
21625 @option{-mstring} on little-endian PowerPC systems, since those
21626 instructions do not work when the processor is in little-endian mode.
21627 The exceptions are PPC740 and PPC750 which permit these instructions
21628 in little-endian mode.
21629
21630 @item -mupdate
21631 @itemx -mno-update
21632 @opindex mupdate
21633 @opindex mno-update
21634 Generate code that uses (does not use) the load or store instructions
21635 that update the base register to the address of the calculated memory
21636 location. These instructions are generated by default. If you use
21637 @option{-mno-update}, there is a small window between the time that the
21638 stack pointer is updated and the address of the previous frame is
21639 stored, which means code that walks the stack frame across interrupts or
21640 signals may get corrupted data.
21641
21642 @item -mavoid-indexed-addresses
21643 @itemx -mno-avoid-indexed-addresses
21644 @opindex mavoid-indexed-addresses
21645 @opindex mno-avoid-indexed-addresses
21646 Generate code that tries to avoid (not avoid) the use of indexed load
21647 or store instructions. These instructions can incur a performance
21648 penalty on Power6 processors in certain situations, such as when
21649 stepping through large arrays that cross a 16M boundary. This option
21650 is enabled by default when targeting Power6 and disabled otherwise.
21651
21652 @item -mfused-madd
21653 @itemx -mno-fused-madd
21654 @opindex mfused-madd
21655 @opindex mno-fused-madd
21656 Generate code that uses (does not use) the floating-point multiply and
21657 accumulate instructions. These instructions are generated by default
21658 if hardware floating point is used. The machine-dependent
21659 @option{-mfused-madd} option is now mapped to the machine-independent
21660 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
21661 mapped to @option{-ffp-contract=off}.
21662
21663 @item -mmulhw
21664 @itemx -mno-mulhw
21665 @opindex mmulhw
21666 @opindex mno-mulhw
21667 Generate code that uses (does not use) the half-word multiply and
21668 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
21669 These instructions are generated by default when targeting those
21670 processors.
21671
21672 @item -mdlmzb
21673 @itemx -mno-dlmzb
21674 @opindex mdlmzb
21675 @opindex mno-dlmzb
21676 Generate code that uses (does not use) the string-search @samp{dlmzb}
21677 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
21678 generated by default when targeting those processors.
21679
21680 @item -mno-bit-align
21681 @itemx -mbit-align
21682 @opindex mno-bit-align
21683 @opindex mbit-align
21684 On System V.4 and embedded PowerPC systems do not (do) force structures
21685 and unions that contain bit-fields to be aligned to the base type of the
21686 bit-field.
21687
21688 For example, by default a structure containing nothing but 8
21689 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
21690 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
21691 the structure is aligned to a 1-byte boundary and is 1 byte in
21692 size.
21693
21694 @item -mno-strict-align
21695 @itemx -mstrict-align
21696 @opindex mno-strict-align
21697 @opindex mstrict-align
21698 On System V.4 and embedded PowerPC systems do not (do) assume that
21699 unaligned memory references are handled by the system.
21700
21701 @item -mrelocatable
21702 @itemx -mno-relocatable
21703 @opindex mrelocatable
21704 @opindex mno-relocatable
21705 Generate code that allows (does not allow) a static executable to be
21706 relocated to a different address at run time. A simple embedded
21707 PowerPC system loader should relocate the entire contents of
21708 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
21709 a table of 32-bit addresses generated by this option. For this to
21710 work, all objects linked together must be compiled with
21711 @option{-mrelocatable} or @option{-mrelocatable-lib}.
21712 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
21713
21714 @item -mrelocatable-lib
21715 @itemx -mno-relocatable-lib
21716 @opindex mrelocatable-lib
21717 @opindex mno-relocatable-lib
21718 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
21719 @code{.fixup} section to allow static executables to be relocated at
21720 run time, but @option{-mrelocatable-lib} does not use the smaller stack
21721 alignment of @option{-mrelocatable}. Objects compiled with
21722 @option{-mrelocatable-lib} may be linked with objects compiled with
21723 any combination of the @option{-mrelocatable} options.
21724
21725 @item -mno-toc
21726 @itemx -mtoc
21727 @opindex mno-toc
21728 @opindex mtoc
21729 On System V.4 and embedded PowerPC systems do not (do) assume that
21730 register 2 contains a pointer to a global area pointing to the addresses
21731 used in the program.
21732
21733 @item -mlittle
21734 @itemx -mlittle-endian
21735 @opindex mlittle
21736 @opindex mlittle-endian
21737 On System V.4 and embedded PowerPC systems compile code for the
21738 processor in little-endian mode. The @option{-mlittle-endian} option is
21739 the same as @option{-mlittle}.
21740
21741 @item -mbig
21742 @itemx -mbig-endian
21743 @opindex mbig
21744 @opindex mbig-endian
21745 On System V.4 and embedded PowerPC systems compile code for the
21746 processor in big-endian mode. The @option{-mbig-endian} option is
21747 the same as @option{-mbig}.
21748
21749 @item -mdynamic-no-pic
21750 @opindex mdynamic-no-pic
21751 On Darwin and Mac OS X systems, compile code so that it is not
21752 relocatable, but that its external references are relocatable. The
21753 resulting code is suitable for applications, but not shared
21754 libraries.
21755
21756 @item -msingle-pic-base
21757 @opindex msingle-pic-base
21758 Treat the register used for PIC addressing as read-only, rather than
21759 loading it in the prologue for each function. The runtime system is
21760 responsible for initializing this register with an appropriate value
21761 before execution begins.
21762
21763 @item -mprioritize-restricted-insns=@var{priority}
21764 @opindex mprioritize-restricted-insns
21765 This option controls the priority that is assigned to
21766 dispatch-slot restricted instructions during the second scheduling
21767 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
21768 or @samp{2} to assign no, highest, or second-highest (respectively)
21769 priority to dispatch-slot restricted
21770 instructions.
21771
21772 @item -msched-costly-dep=@var{dependence_type}
21773 @opindex msched-costly-dep
21774 This option controls which dependences are considered costly
21775 by the target during instruction scheduling. The argument
21776 @var{dependence_type} takes one of the following values:
21777
21778 @table @asis
21779 @item @samp{no}
21780 No dependence is costly.
21781
21782 @item @samp{all}
21783 All dependences are costly.
21784
21785 @item @samp{true_store_to_load}
21786 A true dependence from store to load is costly.
21787
21788 @item @samp{store_to_load}
21789 Any dependence from store to load is costly.
21790
21791 @item @var{number}
21792 Any dependence for which the latency is greater than or equal to
21793 @var{number} is costly.
21794 @end table
21795
21796 @item -minsert-sched-nops=@var{scheme}
21797 @opindex minsert-sched-nops
21798 This option controls which NOP insertion scheme is used during
21799 the second scheduling pass. The argument @var{scheme} takes one of the
21800 following values:
21801
21802 @table @asis
21803 @item @samp{no}
21804 Don't insert NOPs.
21805
21806 @item @samp{pad}
21807 Pad with NOPs any dispatch group that has vacant issue slots,
21808 according to the scheduler's grouping.
21809
21810 @item @samp{regroup_exact}
21811 Insert NOPs to force costly dependent insns into
21812 separate groups. Insert exactly as many NOPs as needed to force an insn
21813 to a new group, according to the estimated processor grouping.
21814
21815 @item @var{number}
21816 Insert NOPs to force costly dependent insns into
21817 separate groups. Insert @var{number} NOPs to force an insn to a new group.
21818 @end table
21819
21820 @item -mcall-sysv
21821 @opindex mcall-sysv
21822 On System V.4 and embedded PowerPC systems compile code using calling
21823 conventions that adhere to the March 1995 draft of the System V
21824 Application Binary Interface, PowerPC processor supplement. This is the
21825 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
21826
21827 @item -mcall-sysv-eabi
21828 @itemx -mcall-eabi
21829 @opindex mcall-sysv-eabi
21830 @opindex mcall-eabi
21831 Specify both @option{-mcall-sysv} and @option{-meabi} options.
21832
21833 @item -mcall-sysv-noeabi
21834 @opindex mcall-sysv-noeabi
21835 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
21836
21837 @item -mcall-aixdesc
21838 @opindex m
21839 On System V.4 and embedded PowerPC systems compile code for the AIX
21840 operating system.
21841
21842 @item -mcall-linux
21843 @opindex mcall-linux
21844 On System V.4 and embedded PowerPC systems compile code for the
21845 Linux-based GNU system.
21846
21847 @item -mcall-freebsd
21848 @opindex mcall-freebsd
21849 On System V.4 and embedded PowerPC systems compile code for the
21850 FreeBSD operating system.
21851
21852 @item -mcall-netbsd
21853 @opindex mcall-netbsd
21854 On System V.4 and embedded PowerPC systems compile code for the
21855 NetBSD operating system.
21856
21857 @item -mcall-openbsd
21858 @opindex mcall-netbsd
21859 On System V.4 and embedded PowerPC systems compile code for the
21860 OpenBSD operating system.
21861
21862 @item -maix-struct-return
21863 @opindex maix-struct-return
21864 Return all structures in memory (as specified by the AIX ABI)@.
21865
21866 @item -msvr4-struct-return
21867 @opindex msvr4-struct-return
21868 Return structures smaller than 8 bytes in registers (as specified by the
21869 SVR4 ABI)@.
21870
21871 @item -mabi=@var{abi-type}
21872 @opindex mabi
21873 Extend the current ABI with a particular extension, or remove such extension.
21874 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
21875 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
21876 @samp{elfv1}, @samp{elfv2}@.
21877
21878 @item -mabi=spe
21879 @opindex mabi=spe
21880 Extend the current ABI with SPE ABI extensions. This does not change
21881 the default ABI, instead it adds the SPE ABI extensions to the current
21882 ABI@.
21883
21884 @item -mabi=no-spe
21885 @opindex mabi=no-spe
21886 Disable Book-E SPE ABI extensions for the current ABI@.
21887
21888 @item -mabi=ibmlongdouble
21889 @opindex mabi=ibmlongdouble
21890 Change the current ABI to use IBM extended-precision long double.
21891 This is a PowerPC 32-bit SYSV ABI option.
21892
21893 @item -mabi=ieeelongdouble
21894 @opindex mabi=ieeelongdouble
21895 Change the current ABI to use IEEE extended-precision long double.
21896 This is a PowerPC 32-bit Linux ABI option.
21897
21898 @item -mabi=elfv1
21899 @opindex mabi=elfv1
21900 Change the current ABI to use the ELFv1 ABI.
21901 This is the default ABI for big-endian PowerPC 64-bit Linux.
21902 Overriding the default ABI requires special system support and is
21903 likely to fail in spectacular ways.
21904
21905 @item -mabi=elfv2
21906 @opindex mabi=elfv2
21907 Change the current ABI to use the ELFv2 ABI.
21908 This is the default ABI for little-endian PowerPC 64-bit Linux.
21909 Overriding the default ABI requires special system support and is
21910 likely to fail in spectacular ways.
21911
21912 @item -mgnu-attribute
21913 @itemx -mno-gnu-attribute
21914 @opindex mgnu-attribute
21915 @opindex mno-gnu-attribute
21916 Emit .gnu_attribute assembly directives to set tag/value pairs in a
21917 .gnu.attributes section that specify ABI variations in function
21918 parameters or return values.
21919
21920 @item -mprototype
21921 @itemx -mno-prototype
21922 @opindex mprototype
21923 @opindex mno-prototype
21924 On System V.4 and embedded PowerPC systems assume that all calls to
21925 variable argument functions are properly prototyped. Otherwise, the
21926 compiler must insert an instruction before every non-prototyped call to
21927 set or clear bit 6 of the condition code register (@code{CR}) to
21928 indicate whether floating-point values are passed in the floating-point
21929 registers in case the function takes variable arguments. With
21930 @option{-mprototype}, only calls to prototyped variable argument functions
21931 set or clear the bit.
21932
21933 @item -msim
21934 @opindex msim
21935 On embedded PowerPC systems, assume that the startup module is called
21936 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
21937 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
21938 configurations.
21939
21940 @item -mmvme
21941 @opindex mmvme
21942 On embedded PowerPC systems, assume that the startup module is called
21943 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
21944 @file{libc.a}.
21945
21946 @item -mads
21947 @opindex mads
21948 On embedded PowerPC systems, assume that the startup module is called
21949 @file{crt0.o} and the standard C libraries are @file{libads.a} and
21950 @file{libc.a}.
21951
21952 @item -myellowknife
21953 @opindex myellowknife
21954 On embedded PowerPC systems, assume that the startup module is called
21955 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
21956 @file{libc.a}.
21957
21958 @item -mvxworks
21959 @opindex mvxworks
21960 On System V.4 and embedded PowerPC systems, specify that you are
21961 compiling for a VxWorks system.
21962
21963 @item -memb
21964 @opindex memb
21965 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
21966 header to indicate that @samp{eabi} extended relocations are used.
21967
21968 @item -meabi
21969 @itemx -mno-eabi
21970 @opindex meabi
21971 @opindex mno-eabi
21972 On System V.4 and embedded PowerPC systems do (do not) adhere to the
21973 Embedded Applications Binary Interface (EABI), which is a set of
21974 modifications to the System V.4 specifications. Selecting @option{-meabi}
21975 means that the stack is aligned to an 8-byte boundary, a function
21976 @code{__eabi} is called from @code{main} to set up the EABI
21977 environment, and the @option{-msdata} option can use both @code{r2} and
21978 @code{r13} to point to two separate small data areas. Selecting
21979 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
21980 no EABI initialization function is called from @code{main}, and the
21981 @option{-msdata} option only uses @code{r13} to point to a single
21982 small data area. The @option{-meabi} option is on by default if you
21983 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
21984
21985 @item -msdata=eabi
21986 @opindex msdata=eabi
21987 On System V.4 and embedded PowerPC systems, put small initialized
21988 @code{const} global and static data in the @code{.sdata2} section, which
21989 is pointed to by register @code{r2}. Put small initialized
21990 non-@code{const} global and static data in the @code{.sdata} section,
21991 which is pointed to by register @code{r13}. Put small uninitialized
21992 global and static data in the @code{.sbss} section, which is adjacent to
21993 the @code{.sdata} section. The @option{-msdata=eabi} option is
21994 incompatible with the @option{-mrelocatable} option. The
21995 @option{-msdata=eabi} option also sets the @option{-memb} option.
21996
21997 @item -msdata=sysv
21998 @opindex msdata=sysv
21999 On System V.4 and embedded PowerPC systems, put small global and static
22000 data in the @code{.sdata} section, which is pointed to by register
22001 @code{r13}. Put small uninitialized global and static data in the
22002 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
22003 The @option{-msdata=sysv} option is incompatible with the
22004 @option{-mrelocatable} option.
22005
22006 @item -msdata=default
22007 @itemx -msdata
22008 @opindex msdata=default
22009 @opindex msdata
22010 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
22011 compile code the same as @option{-msdata=eabi}, otherwise compile code the
22012 same as @option{-msdata=sysv}.
22013
22014 @item -msdata=data
22015 @opindex msdata=data
22016 On System V.4 and embedded PowerPC systems, put small global
22017 data in the @code{.sdata} section. Put small uninitialized global
22018 data in the @code{.sbss} section. Do not use register @code{r13}
22019 to address small data however. This is the default behavior unless
22020 other @option{-msdata} options are used.
22021
22022 @item -msdata=none
22023 @itemx -mno-sdata
22024 @opindex msdata=none
22025 @opindex mno-sdata
22026 On embedded PowerPC systems, put all initialized global and static data
22027 in the @code{.data} section, and all uninitialized data in the
22028 @code{.bss} section.
22029
22030 @item -mblock-move-inline-limit=@var{num}
22031 @opindex mblock-move-inline-limit
22032 Inline all block moves (such as calls to @code{memcpy} or structure
22033 copies) less than or equal to @var{num} bytes. The minimum value for
22034 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
22035 targets. The default value is target-specific.
22036
22037 @item -G @var{num}
22038 @opindex G
22039 @cindex smaller data references (PowerPC)
22040 @cindex .sdata/.sdata2 references (PowerPC)
22041 On embedded PowerPC systems, put global and static items less than or
22042 equal to @var{num} bytes into the small data or BSS sections instead of
22043 the normal data or BSS section. By default, @var{num} is 8. The
22044 @option{-G @var{num}} switch is also passed to the linker.
22045 All modules should be compiled with the same @option{-G @var{num}} value.
22046
22047 @item -mregnames
22048 @itemx -mno-regnames
22049 @opindex mregnames
22050 @opindex mno-regnames
22051 On System V.4 and embedded PowerPC systems do (do not) emit register
22052 names in the assembly language output using symbolic forms.
22053
22054 @item -mlongcall
22055 @itemx -mno-longcall
22056 @opindex mlongcall
22057 @opindex mno-longcall
22058 By default assume that all calls are far away so that a longer and more
22059 expensive calling sequence is required. This is required for calls
22060 farther than 32 megabytes (33,554,432 bytes) from the current location.
22061 A short call is generated if the compiler knows
22062 the call cannot be that far away. This setting can be overridden by
22063 the @code{shortcall} function attribute, or by @code{#pragma
22064 longcall(0)}.
22065
22066 Some linkers are capable of detecting out-of-range calls and generating
22067 glue code on the fly. On these systems, long calls are unnecessary and
22068 generate slower code. As of this writing, the AIX linker can do this,
22069 as can the GNU linker for PowerPC/64. It is planned to add this feature
22070 to the GNU linker for 32-bit PowerPC systems as well.
22071
22072 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
22073 callee, L42}, plus a @dfn{branch island} (glue code). The two target
22074 addresses represent the callee and the branch island. The
22075 Darwin/PPC linker prefers the first address and generates a @code{bl
22076 callee} if the PPC @code{bl} instruction reaches the callee directly;
22077 otherwise, the linker generates @code{bl L42} to call the branch
22078 island. The branch island is appended to the body of the
22079 calling function; it computes the full 32-bit address of the callee
22080 and jumps to it.
22081
22082 On Mach-O (Darwin) systems, this option directs the compiler emit to
22083 the glue for every direct call, and the Darwin linker decides whether
22084 to use or discard it.
22085
22086 In the future, GCC may ignore all longcall specifications
22087 when the linker is known to generate glue.
22088
22089 @item -mtls-markers
22090 @itemx -mno-tls-markers
22091 @opindex mtls-markers
22092 @opindex mno-tls-markers
22093 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
22094 specifying the function argument. The relocation allows the linker to
22095 reliably associate function call with argument setup instructions for
22096 TLS optimization, which in turn allows GCC to better schedule the
22097 sequence.
22098
22099 @item -mrecip
22100 @itemx -mno-recip
22101 @opindex mrecip
22102 This option enables use of the reciprocal estimate and
22103 reciprocal square root estimate instructions with additional
22104 Newton-Raphson steps to increase precision instead of doing a divide or
22105 square root and divide for floating-point arguments. You should use
22106 the @option{-ffast-math} option when using @option{-mrecip} (or at
22107 least @option{-funsafe-math-optimizations},
22108 @option{-ffinite-math-only}, @option{-freciprocal-math} and
22109 @option{-fno-trapping-math}). Note that while the throughput of the
22110 sequence is generally higher than the throughput of the non-reciprocal
22111 instruction, the precision of the sequence can be decreased by up to 2
22112 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
22113 roots.
22114
22115 @item -mrecip=@var{opt}
22116 @opindex mrecip=opt
22117 This option controls which reciprocal estimate instructions
22118 may be used. @var{opt} is a comma-separated list of options, which may
22119 be preceded by a @code{!} to invert the option:
22120
22121 @table @samp
22122
22123 @item all
22124 Enable all estimate instructions.
22125
22126 @item default
22127 Enable the default instructions, equivalent to @option{-mrecip}.
22128
22129 @item none
22130 Disable all estimate instructions, equivalent to @option{-mno-recip}.
22131
22132 @item div
22133 Enable the reciprocal approximation instructions for both
22134 single and double precision.
22135
22136 @item divf
22137 Enable the single-precision reciprocal approximation instructions.
22138
22139 @item divd
22140 Enable the double-precision reciprocal approximation instructions.
22141
22142 @item rsqrt
22143 Enable the reciprocal square root approximation instructions for both
22144 single and double precision.
22145
22146 @item rsqrtf
22147 Enable the single-precision reciprocal square root approximation instructions.
22148
22149 @item rsqrtd
22150 Enable the double-precision reciprocal square root approximation instructions.
22151
22152 @end table
22153
22154 So, for example, @option{-mrecip=all,!rsqrtd} enables
22155 all of the reciprocal estimate instructions, except for the
22156 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
22157 which handle the double-precision reciprocal square root calculations.
22158
22159 @item -mrecip-precision
22160 @itemx -mno-recip-precision
22161 @opindex mrecip-precision
22162 Assume (do not assume) that the reciprocal estimate instructions
22163 provide higher-precision estimates than is mandated by the PowerPC
22164 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
22165 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
22166 The double-precision square root estimate instructions are not generated by
22167 default on low-precision machines, since they do not provide an
22168 estimate that converges after three steps.
22169
22170 @item -mveclibabi=@var{type}
22171 @opindex mveclibabi
22172 Specifies the ABI type to use for vectorizing intrinsics using an
22173 external library. The only type supported at present is @samp{mass},
22174 which specifies to use IBM's Mathematical Acceleration Subsystem
22175 (MASS) libraries for vectorizing intrinsics using external libraries.
22176 GCC currently emits calls to @code{acosd2}, @code{acosf4},
22177 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
22178 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
22179 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
22180 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
22181 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
22182 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
22183 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
22184 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
22185 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
22186 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
22187 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
22188 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
22189 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
22190 for power7. Both @option{-ftree-vectorize} and
22191 @option{-funsafe-math-optimizations} must also be enabled. The MASS
22192 libraries must be specified at link time.
22193
22194 @item -mfriz
22195 @itemx -mno-friz
22196 @opindex mfriz
22197 Generate (do not generate) the @code{friz} instruction when the
22198 @option{-funsafe-math-optimizations} option is used to optimize
22199 rounding of floating-point values to 64-bit integer and back to floating
22200 point. The @code{friz} instruction does not return the same value if
22201 the floating-point number is too large to fit in an integer.
22202
22203 @item -mpointers-to-nested-functions
22204 @itemx -mno-pointers-to-nested-functions
22205 @opindex mpointers-to-nested-functions
22206 Generate (do not generate) code to load up the static chain register
22207 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
22208 systems where a function pointer points to a 3-word descriptor giving
22209 the function address, TOC value to be loaded in register @code{r2}, and
22210 static chain value to be loaded in register @code{r11}. The
22211 @option{-mpointers-to-nested-functions} is on by default. You cannot
22212 call through pointers to nested functions or pointers
22213 to functions compiled in other languages that use the static chain if
22214 you use @option{-mno-pointers-to-nested-functions}.
22215
22216 @item -msave-toc-indirect
22217 @itemx -mno-save-toc-indirect
22218 @opindex msave-toc-indirect
22219 Generate (do not generate) code to save the TOC value in the reserved
22220 stack location in the function prologue if the function calls through
22221 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
22222 saved in the prologue, it is saved just before the call through the
22223 pointer. The @option{-mno-save-toc-indirect} option is the default.
22224
22225 @item -mcompat-align-parm
22226 @itemx -mno-compat-align-parm
22227 @opindex mcompat-align-parm
22228 Generate (do not generate) code to pass structure parameters with a
22229 maximum alignment of 64 bits, for compatibility with older versions
22230 of GCC.
22231
22232 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
22233 structure parameter on a 128-bit boundary when that structure contained
22234 a member requiring 128-bit alignment. This is corrected in more
22235 recent versions of GCC. This option may be used to generate code
22236 that is compatible with functions compiled with older versions of
22237 GCC.
22238
22239 The @option{-mno-compat-align-parm} option is the default.
22240
22241 @item -mstack-protector-guard=@var{guard}
22242 @itemx -mstack-protector-guard-reg=@var{reg}
22243 @itemx -mstack-protector-guard-offset=@var{offset}
22244 @opindex mstack-protector-guard
22245 @opindex mstack-protector-guard-reg
22246 @opindex mstack-protector-guard-offset
22247 Generate stack protection code using canary at @var{guard}. Supported
22248 locations are @samp{global} for global canary or @samp{tls} for per-thread
22249 canary in the TLS block (the default with GNU libc version 2.4 or later).
22250
22251 With the latter choice the options
22252 @option{-mstack-protector-guard-reg=@var{reg}} and
22253 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
22254 which register to use as base register for reading the canary, and from what
22255 offset from that base register. The default for those is as specified in the
22256 relevant ABI.
22257 @end table
22258
22259 @node RX Options
22260 @subsection RX Options
22261 @cindex RX Options
22262
22263 These command-line options are defined for RX targets:
22264
22265 @table @gcctabopt
22266 @item -m64bit-doubles
22267 @itemx -m32bit-doubles
22268 @opindex m64bit-doubles
22269 @opindex m32bit-doubles
22270 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
22271 or 32 bits (@option{-m32bit-doubles}) in size. The default is
22272 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
22273 works on 32-bit values, which is why the default is
22274 @option{-m32bit-doubles}.
22275
22276 @item -fpu
22277 @itemx -nofpu
22278 @opindex fpu
22279 @opindex nofpu
22280 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
22281 floating-point hardware. The default is enabled for the RX600
22282 series and disabled for the RX200 series.
22283
22284 Floating-point instructions are only generated for 32-bit floating-point
22285 values, however, so the FPU hardware is not used for doubles if the
22286 @option{-m64bit-doubles} option is used.
22287
22288 @emph{Note} If the @option{-fpu} option is enabled then
22289 @option{-funsafe-math-optimizations} is also enabled automatically.
22290 This is because the RX FPU instructions are themselves unsafe.
22291
22292 @item -mcpu=@var{name}
22293 @opindex mcpu
22294 Selects the type of RX CPU to be targeted. Currently three types are
22295 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
22296 the specific @samp{RX610} CPU. The default is @samp{RX600}.
22297
22298 The only difference between @samp{RX600} and @samp{RX610} is that the
22299 @samp{RX610} does not support the @code{MVTIPL} instruction.
22300
22301 The @samp{RX200} series does not have a hardware floating-point unit
22302 and so @option{-nofpu} is enabled by default when this type is
22303 selected.
22304
22305 @item -mbig-endian-data
22306 @itemx -mlittle-endian-data
22307 @opindex mbig-endian-data
22308 @opindex mlittle-endian-data
22309 Store data (but not code) in the big-endian format. The default is
22310 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
22311 format.
22312
22313 @item -msmall-data-limit=@var{N}
22314 @opindex msmall-data-limit
22315 Specifies the maximum size in bytes of global and static variables
22316 which can be placed into the small data area. Using the small data
22317 area can lead to smaller and faster code, but the size of area is
22318 limited and it is up to the programmer to ensure that the area does
22319 not overflow. Also when the small data area is used one of the RX's
22320 registers (usually @code{r13}) is reserved for use pointing to this
22321 area, so it is no longer available for use by the compiler. This
22322 could result in slower and/or larger code if variables are pushed onto
22323 the stack instead of being held in this register.
22324
22325 Note, common variables (variables that have not been initialized) and
22326 constants are not placed into the small data area as they are assigned
22327 to other sections in the output executable.
22328
22329 The default value is zero, which disables this feature. Note, this
22330 feature is not enabled by default with higher optimization levels
22331 (@option{-O2} etc) because of the potentially detrimental effects of
22332 reserving a register. It is up to the programmer to experiment and
22333 discover whether this feature is of benefit to their program. See the
22334 description of the @option{-mpid} option for a description of how the
22335 actual register to hold the small data area pointer is chosen.
22336
22337 @item -msim
22338 @itemx -mno-sim
22339 @opindex msim
22340 @opindex mno-sim
22341 Use the simulator runtime. The default is to use the libgloss
22342 board-specific runtime.
22343
22344 @item -mas100-syntax
22345 @itemx -mno-as100-syntax
22346 @opindex mas100-syntax
22347 @opindex mno-as100-syntax
22348 When generating assembler output use a syntax that is compatible with
22349 Renesas's AS100 assembler. This syntax can also be handled by the GAS
22350 assembler, but it has some restrictions so it is not generated by default.
22351
22352 @item -mmax-constant-size=@var{N}
22353 @opindex mmax-constant-size
22354 Specifies the maximum size, in bytes, of a constant that can be used as
22355 an operand in a RX instruction. Although the RX instruction set does
22356 allow constants of up to 4 bytes in length to be used in instructions,
22357 a longer value equates to a longer instruction. Thus in some
22358 circumstances it can be beneficial to restrict the size of constants
22359 that are used in instructions. Constants that are too big are instead
22360 placed into a constant pool and referenced via register indirection.
22361
22362 The value @var{N} can be between 0 and 4. A value of 0 (the default)
22363 or 4 means that constants of any size are allowed.
22364
22365 @item -mrelax
22366 @opindex mrelax
22367 Enable linker relaxation. Linker relaxation is a process whereby the
22368 linker attempts to reduce the size of a program by finding shorter
22369 versions of various instructions. Disabled by default.
22370
22371 @item -mint-register=@var{N}
22372 @opindex mint-register
22373 Specify the number of registers to reserve for fast interrupt handler
22374 functions. The value @var{N} can be between 0 and 4. A value of 1
22375 means that register @code{r13} is reserved for the exclusive use
22376 of fast interrupt handlers. A value of 2 reserves @code{r13} and
22377 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
22378 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
22379 A value of 0, the default, does not reserve any registers.
22380
22381 @item -msave-acc-in-interrupts
22382 @opindex msave-acc-in-interrupts
22383 Specifies that interrupt handler functions should preserve the
22384 accumulator register. This is only necessary if normal code might use
22385 the accumulator register, for example because it performs 64-bit
22386 multiplications. The default is to ignore the accumulator as this
22387 makes the interrupt handlers faster.
22388
22389 @item -mpid
22390 @itemx -mno-pid
22391 @opindex mpid
22392 @opindex mno-pid
22393 Enables the generation of position independent data. When enabled any
22394 access to constant data is done via an offset from a base address
22395 held in a register. This allows the location of constant data to be
22396 determined at run time without requiring the executable to be
22397 relocated, which is a benefit to embedded applications with tight
22398 memory constraints. Data that can be modified is not affected by this
22399 option.
22400
22401 Note, using this feature reserves a register, usually @code{r13}, for
22402 the constant data base address. This can result in slower and/or
22403 larger code, especially in complicated functions.
22404
22405 The actual register chosen to hold the constant data base address
22406 depends upon whether the @option{-msmall-data-limit} and/or the
22407 @option{-mint-register} command-line options are enabled. Starting
22408 with register @code{r13} and proceeding downwards, registers are
22409 allocated first to satisfy the requirements of @option{-mint-register},
22410 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
22411 is possible for the small data area register to be @code{r8} if both
22412 @option{-mint-register=4} and @option{-mpid} are specified on the
22413 command line.
22414
22415 By default this feature is not enabled. The default can be restored
22416 via the @option{-mno-pid} command-line option.
22417
22418 @item -mno-warn-multiple-fast-interrupts
22419 @itemx -mwarn-multiple-fast-interrupts
22420 @opindex mno-warn-multiple-fast-interrupts
22421 @opindex mwarn-multiple-fast-interrupts
22422 Prevents GCC from issuing a warning message if it finds more than one
22423 fast interrupt handler when it is compiling a file. The default is to
22424 issue a warning for each extra fast interrupt handler found, as the RX
22425 only supports one such interrupt.
22426
22427 @item -mallow-string-insns
22428 @itemx -mno-allow-string-insns
22429 @opindex mallow-string-insns
22430 @opindex mno-allow-string-insns
22431 Enables or disables the use of the string manipulation instructions
22432 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
22433 @code{SWHILE} and also the @code{RMPA} instruction. These
22434 instructions may prefetch data, which is not safe to do if accessing
22435 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
22436 for more information).
22437
22438 The default is to allow these instructions, but it is not possible for
22439 GCC to reliably detect all circumstances where a string instruction
22440 might be used to access an I/O register, so their use cannot be
22441 disabled automatically. Instead it is reliant upon the programmer to
22442 use the @option{-mno-allow-string-insns} option if their program
22443 accesses I/O space.
22444
22445 When the instructions are enabled GCC defines the C preprocessor
22446 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
22447 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
22448
22449 @item -mjsr
22450 @itemx -mno-jsr
22451 @opindex mjsr
22452 @opindex mno-jsr
22453 Use only (or not only) @code{JSR} instructions to access functions.
22454 This option can be used when code size exceeds the range of @code{BSR}
22455 instructions. Note that @option{-mno-jsr} does not mean to not use
22456 @code{JSR} but instead means that any type of branch may be used.
22457 @end table
22458
22459 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
22460 has special significance to the RX port when used with the
22461 @code{interrupt} function attribute. This attribute indicates a
22462 function intended to process fast interrupts. GCC ensures
22463 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
22464 and/or @code{r13} and only provided that the normal use of the
22465 corresponding registers have been restricted via the
22466 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
22467 options.
22468
22469 @node S/390 and zSeries Options
22470 @subsection S/390 and zSeries Options
22471 @cindex S/390 and zSeries Options
22472
22473 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
22474
22475 @table @gcctabopt
22476 @item -mhard-float
22477 @itemx -msoft-float
22478 @opindex mhard-float
22479 @opindex msoft-float
22480 Use (do not use) the hardware floating-point instructions and registers
22481 for floating-point operations. When @option{-msoft-float} is specified,
22482 functions in @file{libgcc.a} are used to perform floating-point
22483 operations. When @option{-mhard-float} is specified, the compiler
22484 generates IEEE floating-point instructions. This is the default.
22485
22486 @item -mhard-dfp
22487 @itemx -mno-hard-dfp
22488 @opindex mhard-dfp
22489 @opindex mno-hard-dfp
22490 Use (do not use) the hardware decimal-floating-point instructions for
22491 decimal-floating-point operations. When @option{-mno-hard-dfp} is
22492 specified, functions in @file{libgcc.a} are used to perform
22493 decimal-floating-point operations. When @option{-mhard-dfp} is
22494 specified, the compiler generates decimal-floating-point hardware
22495 instructions. This is the default for @option{-march=z9-ec} or higher.
22496
22497 @item -mlong-double-64
22498 @itemx -mlong-double-128
22499 @opindex mlong-double-64
22500 @opindex mlong-double-128
22501 These switches control the size of @code{long double} type. A size
22502 of 64 bits makes the @code{long double} type equivalent to the @code{double}
22503 type. This is the default.
22504
22505 @item -mbackchain
22506 @itemx -mno-backchain
22507 @opindex mbackchain
22508 @opindex mno-backchain
22509 Store (do not store) the address of the caller's frame as backchain pointer
22510 into the callee's stack frame.
22511 A backchain may be needed to allow debugging using tools that do not understand
22512 DWARF call frame information.
22513 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
22514 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
22515 the backchain is placed into the topmost word of the 96/160 byte register
22516 save area.
22517
22518 In general, code compiled with @option{-mbackchain} is call-compatible with
22519 code compiled with @option{-mmo-backchain}; however, use of the backchain
22520 for debugging purposes usually requires that the whole binary is built with
22521 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
22522 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
22523 to build a linux kernel use @option{-msoft-float}.
22524
22525 The default is to not maintain the backchain.
22526
22527 @item -mpacked-stack
22528 @itemx -mno-packed-stack
22529 @opindex mpacked-stack
22530 @opindex mno-packed-stack
22531 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
22532 specified, the compiler uses the all fields of the 96/160 byte register save
22533 area only for their default purpose; unused fields still take up stack space.
22534 When @option{-mpacked-stack} is specified, register save slots are densely
22535 packed at the top of the register save area; unused space is reused for other
22536 purposes, allowing for more efficient use of the available stack space.
22537 However, when @option{-mbackchain} is also in effect, the topmost word of
22538 the save area is always used to store the backchain, and the return address
22539 register is always saved two words below the backchain.
22540
22541 As long as the stack frame backchain is not used, code generated with
22542 @option{-mpacked-stack} is call-compatible with code generated with
22543 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
22544 S/390 or zSeries generated code that uses the stack frame backchain at run
22545 time, not just for debugging purposes. Such code is not call-compatible
22546 with code compiled with @option{-mpacked-stack}. Also, note that the
22547 combination of @option{-mbackchain},
22548 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
22549 to build a linux kernel use @option{-msoft-float}.
22550
22551 The default is to not use the packed stack layout.
22552
22553 @item -msmall-exec
22554 @itemx -mno-small-exec
22555 @opindex msmall-exec
22556 @opindex mno-small-exec
22557 Generate (or do not generate) code using the @code{bras} instruction
22558 to do subroutine calls.
22559 This only works reliably if the total executable size does not
22560 exceed 64k. The default is to use the @code{basr} instruction instead,
22561 which does not have this limitation.
22562
22563 @item -m64
22564 @itemx -m31
22565 @opindex m64
22566 @opindex m31
22567 When @option{-m31} is specified, generate code compliant to the
22568 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
22569 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
22570 particular to generate 64-bit instructions. For the @samp{s390}
22571 targets, the default is @option{-m31}, while the @samp{s390x}
22572 targets default to @option{-m64}.
22573
22574 @item -mzarch
22575 @itemx -mesa
22576 @opindex mzarch
22577 @opindex mesa
22578 When @option{-mzarch} is specified, generate code using the
22579 instructions available on z/Architecture.
22580 When @option{-mesa} is specified, generate code using the
22581 instructions available on ESA/390. Note that @option{-mesa} is
22582 not possible with @option{-m64}.
22583 When generating code compliant to the GNU/Linux for S/390 ABI,
22584 the default is @option{-mesa}. When generating code compliant
22585 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
22586
22587 @item -mhtm
22588 @itemx -mno-htm
22589 @opindex mhtm
22590 @opindex mno-htm
22591 The @option{-mhtm} option enables a set of builtins making use of
22592 instructions available with the transactional execution facility
22593 introduced with the IBM zEnterprise EC12 machine generation
22594 @ref{S/390 System z Built-in Functions}.
22595 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
22596
22597 @item -mvx
22598 @itemx -mno-vx
22599 @opindex mvx
22600 @opindex mno-vx
22601 When @option{-mvx} is specified, generate code using the instructions
22602 available with the vector extension facility introduced with the IBM
22603 z13 machine generation.
22604 This option changes the ABI for some vector type values with regard to
22605 alignment and calling conventions. In case vector type values are
22606 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
22607 command will be added to mark the resulting binary with the ABI used.
22608 @option{-mvx} is enabled by default when using @option{-march=z13}.
22609
22610 @item -mzvector
22611 @itemx -mno-zvector
22612 @opindex mzvector
22613 @opindex mno-zvector
22614 The @option{-mzvector} option enables vector language extensions and
22615 builtins using instructions available with the vector extension
22616 facility introduced with the IBM z13 machine generation.
22617 This option adds support for @samp{vector} to be used as a keyword to
22618 define vector type variables and arguments. @samp{vector} is only
22619 available when GNU extensions are enabled. It will not be expanded
22620 when requesting strict standard compliance e.g. with @option{-std=c99}.
22621 In addition to the GCC low-level builtins @option{-mzvector} enables
22622 a set of builtins added for compatibility with AltiVec-style
22623 implementations like Power and Cell. In order to make use of these
22624 builtins the header file @file{vecintrin.h} needs to be included.
22625 @option{-mzvector} is disabled by default.
22626
22627 @item -mmvcle
22628 @itemx -mno-mvcle
22629 @opindex mmvcle
22630 @opindex mno-mvcle
22631 Generate (or do not generate) code using the @code{mvcle} instruction
22632 to perform block moves. When @option{-mno-mvcle} is specified,
22633 use a @code{mvc} loop instead. This is the default unless optimizing for
22634 size.
22635
22636 @item -mdebug
22637 @itemx -mno-debug
22638 @opindex mdebug
22639 @opindex mno-debug
22640 Print (or do not print) additional debug information when compiling.
22641 The default is to not print debug information.
22642
22643 @item -march=@var{cpu-type}
22644 @opindex march
22645 Generate code that runs on @var{cpu-type}, which is the name of a
22646 system representing a certain processor type. Possible values for
22647 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
22648 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
22649 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
22650 @samp{native}.
22651
22652 The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and
22653 @samp{g6} are deprecated and will be removed with future releases.
22654
22655 Specifying @samp{native} as cpu type can be used to select the best
22656 architecture option for the host processor.
22657 @option{-march=native} has no effect if GCC does not recognize the
22658 processor.
22659
22660 @item -mtune=@var{cpu-type}
22661 @opindex mtune
22662 Tune to @var{cpu-type} everything applicable about the generated code,
22663 except for the ABI and the set of available instructions.
22664 The list of @var{cpu-type} values is the same as for @option{-march}.
22665 The default is the value used for @option{-march}.
22666
22667 @item -mtpf-trace
22668 @itemx -mno-tpf-trace
22669 @opindex mtpf-trace
22670 @opindex mno-tpf-trace
22671 Generate code that adds (does not add) in TPF OS specific branches to trace
22672 routines in the operating system. This option is off by default, even
22673 when compiling for the TPF OS@.
22674
22675 @item -mfused-madd
22676 @itemx -mno-fused-madd
22677 @opindex mfused-madd
22678 @opindex mno-fused-madd
22679 Generate code that uses (does not use) the floating-point multiply and
22680 accumulate instructions. These instructions are generated by default if
22681 hardware floating point is used.
22682
22683 @item -mwarn-framesize=@var{framesize}
22684 @opindex mwarn-framesize
22685 Emit a warning if the current function exceeds the given frame size. Because
22686 this is a compile-time check it doesn't need to be a real problem when the program
22687 runs. It is intended to identify functions that most probably cause
22688 a stack overflow. It is useful to be used in an environment with limited stack
22689 size e.g.@: the linux kernel.
22690
22691 @item -mwarn-dynamicstack
22692 @opindex mwarn-dynamicstack
22693 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
22694 arrays. This is generally a bad idea with a limited stack size.
22695
22696 @item -mstack-guard=@var{stack-guard}
22697 @itemx -mstack-size=@var{stack-size}
22698 @opindex mstack-guard
22699 @opindex mstack-size
22700 If these options are provided the S/390 back end emits additional instructions in
22701 the function prologue that trigger a trap if the stack size is @var{stack-guard}
22702 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
22703 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
22704 the frame size of the compiled function is chosen.
22705 These options are intended to be used to help debugging stack overflow problems.
22706 The additionally emitted code causes only little overhead and hence can also be
22707 used in production-like systems without greater performance degradation. The given
22708 values have to be exact powers of 2 and @var{stack-size} has to be greater than
22709 @var{stack-guard} without exceeding 64k.
22710 In order to be efficient the extra code makes the assumption that the stack starts
22711 at an address aligned to the value given by @var{stack-size}.
22712 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
22713
22714 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
22715 @opindex mhotpatch
22716 If the hotpatch option is enabled, a ``hot-patching'' function
22717 prologue is generated for all functions in the compilation unit.
22718 The funtion label is prepended with the given number of two-byte
22719 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
22720 the label, 2 * @var{post-halfwords} bytes are appended, using the
22721 largest NOP like instructions the architecture allows (maximum
22722 1000000).
22723
22724 If both arguments are zero, hotpatching is disabled.
22725
22726 This option can be overridden for individual functions with the
22727 @code{hotpatch} attribute.
22728 @end table
22729
22730 @node Score Options
22731 @subsection Score Options
22732 @cindex Score Options
22733
22734 These options are defined for Score implementations:
22735
22736 @table @gcctabopt
22737 @item -meb
22738 @opindex meb
22739 Compile code for big-endian mode. This is the default.
22740
22741 @item -mel
22742 @opindex mel
22743 Compile code for little-endian mode.
22744
22745 @item -mnhwloop
22746 @opindex mnhwloop
22747 Disable generation of @code{bcnz} instructions.
22748
22749 @item -muls
22750 @opindex muls
22751 Enable generation of unaligned load and store instructions.
22752
22753 @item -mmac
22754 @opindex mmac
22755 Enable the use of multiply-accumulate instructions. Disabled by default.
22756
22757 @item -mscore5
22758 @opindex mscore5
22759 Specify the SCORE5 as the target architecture.
22760
22761 @item -mscore5u
22762 @opindex mscore5u
22763 Specify the SCORE5U of the target architecture.
22764
22765 @item -mscore7
22766 @opindex mscore7
22767 Specify the SCORE7 as the target architecture. This is the default.
22768
22769 @item -mscore7d
22770 @opindex mscore7d
22771 Specify the SCORE7D as the target architecture.
22772 @end table
22773
22774 @node SH Options
22775 @subsection SH Options
22776
22777 These @samp{-m} options are defined for the SH implementations:
22778
22779 @table @gcctabopt
22780 @item -m1
22781 @opindex m1
22782 Generate code for the SH1.
22783
22784 @item -m2
22785 @opindex m2
22786 Generate code for the SH2.
22787
22788 @item -m2e
22789 Generate code for the SH2e.
22790
22791 @item -m2a-nofpu
22792 @opindex m2a-nofpu
22793 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
22794 that the floating-point unit is not used.
22795
22796 @item -m2a-single-only
22797 @opindex m2a-single-only
22798 Generate code for the SH2a-FPU, in such a way that no double-precision
22799 floating-point operations are used.
22800
22801 @item -m2a-single
22802 @opindex m2a-single
22803 Generate code for the SH2a-FPU assuming the floating-point unit is in
22804 single-precision mode by default.
22805
22806 @item -m2a
22807 @opindex m2a
22808 Generate code for the SH2a-FPU assuming the floating-point unit is in
22809 double-precision mode by default.
22810
22811 @item -m3
22812 @opindex m3
22813 Generate code for the SH3.
22814
22815 @item -m3e
22816 @opindex m3e
22817 Generate code for the SH3e.
22818
22819 @item -m4-nofpu
22820 @opindex m4-nofpu
22821 Generate code for the SH4 without a floating-point unit.
22822
22823 @item -m4-single-only
22824 @opindex m4-single-only
22825 Generate code for the SH4 with a floating-point unit that only
22826 supports single-precision arithmetic.
22827
22828 @item -m4-single
22829 @opindex m4-single
22830 Generate code for the SH4 assuming the floating-point unit is in
22831 single-precision mode by default.
22832
22833 @item -m4
22834 @opindex m4
22835 Generate code for the SH4.
22836
22837 @item -m4-100
22838 @opindex m4-100
22839 Generate code for SH4-100.
22840
22841 @item -m4-100-nofpu
22842 @opindex m4-100-nofpu
22843 Generate code for SH4-100 in such a way that the
22844 floating-point unit is not used.
22845
22846 @item -m4-100-single
22847 @opindex m4-100-single
22848 Generate code for SH4-100 assuming the floating-point unit is in
22849 single-precision mode by default.
22850
22851 @item -m4-100-single-only
22852 @opindex m4-100-single-only
22853 Generate code for SH4-100 in such a way that no double-precision
22854 floating-point operations are used.
22855
22856 @item -m4-200
22857 @opindex m4-200
22858 Generate code for SH4-200.
22859
22860 @item -m4-200-nofpu
22861 @opindex m4-200-nofpu
22862 Generate code for SH4-200 without in such a way that the
22863 floating-point unit is not used.
22864
22865 @item -m4-200-single
22866 @opindex m4-200-single
22867 Generate code for SH4-200 assuming the floating-point unit is in
22868 single-precision mode by default.
22869
22870 @item -m4-200-single-only
22871 @opindex m4-200-single-only
22872 Generate code for SH4-200 in such a way that no double-precision
22873 floating-point operations are used.
22874
22875 @item -m4-300
22876 @opindex m4-300
22877 Generate code for SH4-300.
22878
22879 @item -m4-300-nofpu
22880 @opindex m4-300-nofpu
22881 Generate code for SH4-300 without in such a way that the
22882 floating-point unit is not used.
22883
22884 @item -m4-300-single
22885 @opindex m4-300-single
22886 Generate code for SH4-300 in such a way that no double-precision
22887 floating-point operations are used.
22888
22889 @item -m4-300-single-only
22890 @opindex m4-300-single-only
22891 Generate code for SH4-300 in such a way that no double-precision
22892 floating-point operations are used.
22893
22894 @item -m4-340
22895 @opindex m4-340
22896 Generate code for SH4-340 (no MMU, no FPU).
22897
22898 @item -m4-500
22899 @opindex m4-500
22900 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
22901 assembler.
22902
22903 @item -m4a-nofpu
22904 @opindex m4a-nofpu
22905 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
22906 floating-point unit is not used.
22907
22908 @item -m4a-single-only
22909 @opindex m4a-single-only
22910 Generate code for the SH4a, in such a way that no double-precision
22911 floating-point operations are used.
22912
22913 @item -m4a-single
22914 @opindex m4a-single
22915 Generate code for the SH4a assuming the floating-point unit is in
22916 single-precision mode by default.
22917
22918 @item -m4a
22919 @opindex m4a
22920 Generate code for the SH4a.
22921
22922 @item -m4al
22923 @opindex m4al
22924 Same as @option{-m4a-nofpu}, except that it implicitly passes
22925 @option{-dsp} to the assembler. GCC doesn't generate any DSP
22926 instructions at the moment.
22927
22928 @item -mb
22929 @opindex mb
22930 Compile code for the processor in big-endian mode.
22931
22932 @item -ml
22933 @opindex ml
22934 Compile code for the processor in little-endian mode.
22935
22936 @item -mdalign
22937 @opindex mdalign
22938 Align doubles at 64-bit boundaries. Note that this changes the calling
22939 conventions, and thus some functions from the standard C library do
22940 not work unless you recompile it first with @option{-mdalign}.
22941
22942 @item -mrelax
22943 @opindex mrelax
22944 Shorten some address references at link time, when possible; uses the
22945 linker option @option{-relax}.
22946
22947 @item -mbigtable
22948 @opindex mbigtable
22949 Use 32-bit offsets in @code{switch} tables. The default is to use
22950 16-bit offsets.
22951
22952 @item -mbitops
22953 @opindex mbitops
22954 Enable the use of bit manipulation instructions on SH2A.
22955
22956 @item -mfmovd
22957 @opindex mfmovd
22958 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
22959 alignment constraints.
22960
22961 @item -mrenesas
22962 @opindex mrenesas
22963 Comply with the calling conventions defined by Renesas.
22964
22965 @item -mno-renesas
22966 @opindex mno-renesas
22967 Comply with the calling conventions defined for GCC before the Renesas
22968 conventions were available. This option is the default for all
22969 targets of the SH toolchain.
22970
22971 @item -mnomacsave
22972 @opindex mnomacsave
22973 Mark the @code{MAC} register as call-clobbered, even if
22974 @option{-mrenesas} is given.
22975
22976 @item -mieee
22977 @itemx -mno-ieee
22978 @opindex mieee
22979 @opindex mno-ieee
22980 Control the IEEE compliance of floating-point comparisons, which affects the
22981 handling of cases where the result of a comparison is unordered. By default
22982 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
22983 enabled @option{-mno-ieee} is implicitly set, which results in faster
22984 floating-point greater-equal and less-equal comparisons. The implicit settings
22985 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
22986
22987 @item -minline-ic_invalidate
22988 @opindex minline-ic_invalidate
22989 Inline code to invalidate instruction cache entries after setting up
22990 nested function trampolines.
22991 This option has no effect if @option{-musermode} is in effect and the selected
22992 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
22993 instruction.
22994 If the selected code generation option does not allow the use of the @code{icbi}
22995 instruction, and @option{-musermode} is not in effect, the inlined code
22996 manipulates the instruction cache address array directly with an associative
22997 write. This not only requires privileged mode at run time, but it also
22998 fails if the cache line had been mapped via the TLB and has become unmapped.
22999
23000 @item -misize
23001 @opindex misize
23002 Dump instruction size and location in the assembly code.
23003
23004 @item -mpadstruct
23005 @opindex mpadstruct
23006 This option is deprecated. It pads structures to multiple of 4 bytes,
23007 which is incompatible with the SH ABI@.
23008
23009 @item -matomic-model=@var{model}
23010 @opindex matomic-model=@var{model}
23011 Sets the model of atomic operations and additional parameters as a comma
23012 separated list. For details on the atomic built-in functions see
23013 @ref{__atomic Builtins}. The following models and parameters are supported:
23014
23015 @table @samp
23016
23017 @item none
23018 Disable compiler generated atomic sequences and emit library calls for atomic
23019 operations. This is the default if the target is not @code{sh*-*-linux*}.
23020
23021 @item soft-gusa
23022 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
23023 built-in functions. The generated atomic sequences require additional support
23024 from the interrupt/exception handling code of the system and are only suitable
23025 for SH3* and SH4* single-core systems. This option is enabled by default when
23026 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
23027 this option also partially utilizes the hardware atomic instructions
23028 @code{movli.l} and @code{movco.l} to create more efficient code, unless
23029 @samp{strict} is specified.
23030
23031 @item soft-tcb
23032 Generate software atomic sequences that use a variable in the thread control
23033 block. This is a variation of the gUSA sequences which can also be used on
23034 SH1* and SH2* targets. The generated atomic sequences require additional
23035 support from the interrupt/exception handling code of the system and are only
23036 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
23037 parameter has to be specified as well.
23038
23039 @item soft-imask
23040 Generate software atomic sequences that temporarily disable interrupts by
23041 setting @code{SR.IMASK = 1111}. This model works only when the program runs
23042 in privileged mode and is only suitable for single-core systems. Additional
23043 support from the interrupt/exception handling code of the system is not
23044 required. This model is enabled by default when the target is
23045 @code{sh*-*-linux*} and SH1* or SH2*.
23046
23047 @item hard-llcs
23048 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
23049 instructions only. This is only available on SH4A and is suitable for
23050 multi-core systems. Since the hardware instructions support only 32 bit atomic
23051 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
23052 Code compiled with this option is also compatible with other software
23053 atomic model interrupt/exception handling systems if executed on an SH4A
23054 system. Additional support from the interrupt/exception handling code of the
23055 system is not required for this model.
23056
23057 @item gbr-offset=
23058 This parameter specifies the offset in bytes of the variable in the thread
23059 control block structure that should be used by the generated atomic sequences
23060 when the @samp{soft-tcb} model has been selected. For other models this
23061 parameter is ignored. The specified value must be an integer multiple of four
23062 and in the range 0-1020.
23063
23064 @item strict
23065 This parameter prevents mixed usage of multiple atomic models, even if they
23066 are compatible, and makes the compiler generate atomic sequences of the
23067 specified model only.
23068
23069 @end table
23070
23071 @item -mtas
23072 @opindex mtas
23073 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
23074 Notice that depending on the particular hardware and software configuration
23075 this can degrade overall performance due to the operand cache line flushes
23076 that are implied by the @code{tas.b} instruction. On multi-core SH4A
23077 processors the @code{tas.b} instruction must be used with caution since it
23078 can result in data corruption for certain cache configurations.
23079
23080 @item -mprefergot
23081 @opindex mprefergot
23082 When generating position-independent code, emit function calls using
23083 the Global Offset Table instead of the Procedure Linkage Table.
23084
23085 @item -musermode
23086 @itemx -mno-usermode
23087 @opindex musermode
23088 @opindex mno-usermode
23089 Don't allow (allow) the compiler generating privileged mode code. Specifying
23090 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
23091 inlined code would not work in user mode. @option{-musermode} is the default
23092 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
23093 @option{-musermode} has no effect, since there is no user mode.
23094
23095 @item -multcost=@var{number}
23096 @opindex multcost=@var{number}
23097 Set the cost to assume for a multiply insn.
23098
23099 @item -mdiv=@var{strategy}
23100 @opindex mdiv=@var{strategy}
23101 Set the division strategy to be used for integer division operations.
23102 @var{strategy} can be one of:
23103
23104 @table @samp
23105
23106 @item call-div1
23107 Calls a library function that uses the single-step division instruction
23108 @code{div1} to perform the operation. Division by zero calculates an
23109 unspecified result and does not trap. This is the default except for SH4,
23110 SH2A and SHcompact.
23111
23112 @item call-fp
23113 Calls a library function that performs the operation in double precision
23114 floating point. Division by zero causes a floating-point exception. This is
23115 the default for SHcompact with FPU. Specifying this for targets that do not
23116 have a double precision FPU defaults to @code{call-div1}.
23117
23118 @item call-table
23119 Calls a library function that uses a lookup table for small divisors and
23120 the @code{div1} instruction with case distinction for larger divisors. Division
23121 by zero calculates an unspecified result and does not trap. This is the default
23122 for SH4. Specifying this for targets that do not have dynamic shift
23123 instructions defaults to @code{call-div1}.
23124
23125 @end table
23126
23127 When a division strategy has not been specified the default strategy is
23128 selected based on the current target. For SH2A the default strategy is to
23129 use the @code{divs} and @code{divu} instructions instead of library function
23130 calls.
23131
23132 @item -maccumulate-outgoing-args
23133 @opindex maccumulate-outgoing-args
23134 Reserve space once for outgoing arguments in the function prologue rather
23135 than around each call. Generally beneficial for performance and size. Also
23136 needed for unwinding to avoid changing the stack frame around conditional code.
23137
23138 @item -mdivsi3_libfunc=@var{name}
23139 @opindex mdivsi3_libfunc=@var{name}
23140 Set the name of the library function used for 32-bit signed division to
23141 @var{name}.
23142 This only affects the name used in the @samp{call} division strategies, and
23143 the compiler still expects the same sets of input/output/clobbered registers as
23144 if this option were not present.
23145
23146 @item -mfixed-range=@var{register-range}
23147 @opindex mfixed-range
23148 Generate code treating the given register range as fixed registers.
23149 A fixed register is one that the register allocator can not use. This is
23150 useful when compiling kernel code. A register range is specified as
23151 two registers separated by a dash. Multiple register ranges can be
23152 specified separated by a comma.
23153
23154 @item -mbranch-cost=@var{num}
23155 @opindex mbranch-cost=@var{num}
23156 Assume @var{num} to be the cost for a branch instruction. Higher numbers
23157 make the compiler try to generate more branch-free code if possible.
23158 If not specified the value is selected depending on the processor type that
23159 is being compiled for.
23160
23161 @item -mzdcbranch
23162 @itemx -mno-zdcbranch
23163 @opindex mzdcbranch
23164 @opindex mno-zdcbranch
23165 Assume (do not assume) that zero displacement conditional branch instructions
23166 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
23167 compiler prefers zero displacement branch code sequences. This is
23168 enabled by default when generating code for SH4 and SH4A. It can be explicitly
23169 disabled by specifying @option{-mno-zdcbranch}.
23170
23171 @item -mcbranch-force-delay-slot
23172 @opindex mcbranch-force-delay-slot
23173 Force the usage of delay slots for conditional branches, which stuffs the delay
23174 slot with a @code{nop} if a suitable instruction can't be found. By default
23175 this option is disabled. It can be enabled to work around hardware bugs as
23176 found in the original SH7055.
23177
23178 @item -mfused-madd
23179 @itemx -mno-fused-madd
23180 @opindex mfused-madd
23181 @opindex mno-fused-madd
23182 Generate code that uses (does not use) the floating-point multiply and
23183 accumulate instructions. These instructions are generated by default
23184 if hardware floating point is used. The machine-dependent
23185 @option{-mfused-madd} option is now mapped to the machine-independent
23186 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23187 mapped to @option{-ffp-contract=off}.
23188
23189 @item -mfsca
23190 @itemx -mno-fsca
23191 @opindex mfsca
23192 @opindex mno-fsca
23193 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
23194 and cosine approximations. The option @option{-mfsca} must be used in
23195 combination with @option{-funsafe-math-optimizations}. It is enabled by default
23196 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
23197 approximations even if @option{-funsafe-math-optimizations} is in effect.
23198
23199 @item -mfsrra
23200 @itemx -mno-fsrra
23201 @opindex mfsrra
23202 @opindex mno-fsrra
23203 Allow or disallow the compiler to emit the @code{fsrra} instruction for
23204 reciprocal square root approximations. The option @option{-mfsrra} must be used
23205 in combination with @option{-funsafe-math-optimizations} and
23206 @option{-ffinite-math-only}. It is enabled by default when generating code for
23207 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
23208 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
23209 in effect.
23210
23211 @item -mpretend-cmove
23212 @opindex mpretend-cmove
23213 Prefer zero-displacement conditional branches for conditional move instruction
23214 patterns. This can result in faster code on the SH4 processor.
23215
23216 @item -mfdpic
23217 @opindex fdpic
23218 Generate code using the FDPIC ABI.
23219
23220 @end table
23221
23222 @node Solaris 2 Options
23223 @subsection Solaris 2 Options
23224 @cindex Solaris 2 options
23225
23226 These @samp{-m} options are supported on Solaris 2:
23227
23228 @table @gcctabopt
23229 @item -mclear-hwcap
23230 @opindex mclear-hwcap
23231 @option{-mclear-hwcap} tells the compiler to remove the hardware
23232 capabilities generated by the Solaris assembler. This is only necessary
23233 when object files use ISA extensions not supported by the current
23234 machine, but check at runtime whether or not to use them.
23235
23236 @item -mimpure-text
23237 @opindex mimpure-text
23238 @option{-mimpure-text}, used in addition to @option{-shared}, tells
23239 the compiler to not pass @option{-z text} to the linker when linking a
23240 shared object. Using this option, you can link position-dependent
23241 code into a shared object.
23242
23243 @option{-mimpure-text} suppresses the ``relocations remain against
23244 allocatable but non-writable sections'' linker error message.
23245 However, the necessary relocations trigger copy-on-write, and the
23246 shared object is not actually shared across processes. Instead of
23247 using @option{-mimpure-text}, you should compile all source code with
23248 @option{-fpic} or @option{-fPIC}.
23249
23250 @end table
23251
23252 These switches are supported in addition to the above on Solaris 2:
23253
23254 @table @gcctabopt
23255 @item -pthreads
23256 @opindex pthreads
23257 This is a synonym for @option{-pthread}.
23258 @end table
23259
23260 @node SPARC Options
23261 @subsection SPARC Options
23262 @cindex SPARC options
23263
23264 These @samp{-m} options are supported on the SPARC:
23265
23266 @table @gcctabopt
23267 @item -mno-app-regs
23268 @itemx -mapp-regs
23269 @opindex mno-app-regs
23270 @opindex mapp-regs
23271 Specify @option{-mapp-regs} to generate output using the global registers
23272 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
23273 global register 1, each global register 2 through 4 is then treated as an
23274 allocable register that is clobbered by function calls. This is the default.
23275
23276 To be fully SVR4 ABI-compliant at the cost of some performance loss,
23277 specify @option{-mno-app-regs}. You should compile libraries and system
23278 software with this option.
23279
23280 @item -mflat
23281 @itemx -mno-flat
23282 @opindex mflat
23283 @opindex mno-flat
23284 With @option{-mflat}, the compiler does not generate save/restore instructions
23285 and uses a ``flat'' or single register window model. This model is compatible
23286 with the regular register window model. The local registers and the input
23287 registers (0--5) are still treated as ``call-saved'' registers and are
23288 saved on the stack as needed.
23289
23290 With @option{-mno-flat} (the default), the compiler generates save/restore
23291 instructions (except for leaf functions). This is the normal operating mode.
23292
23293 @item -mfpu
23294 @itemx -mhard-float
23295 @opindex mfpu
23296 @opindex mhard-float
23297 Generate output containing floating-point instructions. This is the
23298 default.
23299
23300 @item -mno-fpu
23301 @itemx -msoft-float
23302 @opindex mno-fpu
23303 @opindex msoft-float
23304 Generate output containing library calls for floating point.
23305 @strong{Warning:} the requisite libraries are not available for all SPARC
23306 targets. Normally the facilities of the machine's usual C compiler are
23307 used, but this cannot be done directly in cross-compilation. You must make
23308 your own arrangements to provide suitable library functions for
23309 cross-compilation. The embedded targets @samp{sparc-*-aout} and
23310 @samp{sparclite-*-*} do provide software floating-point support.
23311
23312 @option{-msoft-float} changes the calling convention in the output file;
23313 therefore, it is only useful if you compile @emph{all} of a program with
23314 this option. In particular, you need to compile @file{libgcc.a}, the
23315 library that comes with GCC, with @option{-msoft-float} in order for
23316 this to work.
23317
23318 @item -mhard-quad-float
23319 @opindex mhard-quad-float
23320 Generate output containing quad-word (long double) floating-point
23321 instructions.
23322
23323 @item -msoft-quad-float
23324 @opindex msoft-quad-float
23325 Generate output containing library calls for quad-word (long double)
23326 floating-point instructions. The functions called are those specified
23327 in the SPARC ABI@. This is the default.
23328
23329 As of this writing, there are no SPARC implementations that have hardware
23330 support for the quad-word floating-point instructions. They all invoke
23331 a trap handler for one of these instructions, and then the trap handler
23332 emulates the effect of the instruction. Because of the trap handler overhead,
23333 this is much slower than calling the ABI library routines. Thus the
23334 @option{-msoft-quad-float} option is the default.
23335
23336 @item -mno-unaligned-doubles
23337 @itemx -munaligned-doubles
23338 @opindex mno-unaligned-doubles
23339 @opindex munaligned-doubles
23340 Assume that doubles have 8-byte alignment. This is the default.
23341
23342 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
23343 alignment only if they are contained in another type, or if they have an
23344 absolute address. Otherwise, it assumes they have 4-byte alignment.
23345 Specifying this option avoids some rare compatibility problems with code
23346 generated by other compilers. It is not the default because it results
23347 in a performance loss, especially for floating-point code.
23348
23349 @item -muser-mode
23350 @itemx -mno-user-mode
23351 @opindex muser-mode
23352 @opindex mno-user-mode
23353 Do not generate code that can only run in supervisor mode. This is relevant
23354 only for the @code{casa} instruction emitted for the LEON3 processor. This
23355 is the default.
23356
23357 @item -mfaster-structs
23358 @itemx -mno-faster-structs
23359 @opindex mfaster-structs
23360 @opindex mno-faster-structs
23361 With @option{-mfaster-structs}, the compiler assumes that structures
23362 should have 8-byte alignment. This enables the use of pairs of
23363 @code{ldd} and @code{std} instructions for copies in structure
23364 assignment, in place of twice as many @code{ld} and @code{st} pairs.
23365 However, the use of this changed alignment directly violates the SPARC
23366 ABI@. Thus, it's intended only for use on targets where the developer
23367 acknowledges that their resulting code is not directly in line with
23368 the rules of the ABI@.
23369
23370 @item -mstd-struct-return
23371 @itemx -mno-std-struct-return
23372 @opindex mstd-struct-return
23373 @opindex mno-std-struct-return
23374 With @option{-mstd-struct-return}, the compiler generates checking code
23375 in functions returning structures or unions to detect size mismatches
23376 between the two sides of function calls, as per the 32-bit ABI@.
23377
23378 The default is @option{-mno-std-struct-return}. This option has no effect
23379 in 64-bit mode.
23380
23381 @item -mlra
23382 @itemx -mno-lra
23383 @opindex mlra
23384 @opindex mno-lra
23385 Enable Local Register Allocation. This is the default for SPARC since GCC 7
23386 so @option{-mno-lra} needs to be passed to get old Reload.
23387
23388 @item -mcpu=@var{cpu_type}
23389 @opindex mcpu
23390 Set the instruction set, register set, and instruction scheduling parameters
23391 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23392 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
23393 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
23394 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
23395 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
23396 @samp{niagara3}, @samp{niagara4} and @samp{niagara7}.
23397
23398 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
23399 which selects the best architecture option for the host processor.
23400 @option{-mcpu=native} has no effect if GCC does not recognize
23401 the processor.
23402
23403 Default instruction scheduling parameters are used for values that select
23404 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
23405 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
23406
23407 Here is a list of each supported architecture and their supported
23408 implementations.
23409
23410 @table @asis
23411 @item v7
23412 cypress, leon3v7
23413
23414 @item v8
23415 supersparc, hypersparc, leon, leon3
23416
23417 @item sparclite
23418 f930, f934, sparclite86x
23419
23420 @item sparclet
23421 tsc701
23422
23423 @item v9
23424 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7
23425 @end table
23426
23427 By default (unless configured otherwise), GCC generates code for the V7
23428 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
23429 additionally optimizes it for the Cypress CY7C602 chip, as used in the
23430 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
23431 SPARCStation 1, 2, IPX etc.
23432
23433 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
23434 architecture. The only difference from V7 code is that the compiler emits
23435 the integer multiply and integer divide instructions which exist in SPARC-V8
23436 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
23437 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
23438 2000 series.
23439
23440 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
23441 the SPARC architecture. This adds the integer multiply, integer divide step
23442 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
23443 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
23444 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
23445 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
23446 MB86934 chip, which is the more recent SPARClite with FPU@.
23447
23448 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
23449 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
23450 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
23451 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
23452 optimizes it for the TEMIC SPARClet chip.
23453
23454 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
23455 architecture. This adds 64-bit integer and floating-point move instructions,
23456 3 additional floating-point condition code registers and conditional move
23457 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
23458 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
23459 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
23460 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
23461 @option{-mcpu=niagara}, the compiler additionally optimizes it for
23462 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
23463 additionally optimizes it for Sun UltraSPARC T2 chips. With
23464 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
23465 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
23466 additionally optimizes it for Sun UltraSPARC T4 chips. With
23467 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
23468 Oracle SPARC M7 chips.
23469
23470 @item -mtune=@var{cpu_type}
23471 @opindex mtune
23472 Set the instruction scheduling parameters for machine type
23473 @var{cpu_type}, but do not set the instruction set or register set that the
23474 option @option{-mcpu=@var{cpu_type}} does.
23475
23476 The same values for @option{-mcpu=@var{cpu_type}} can be used for
23477 @option{-mtune=@var{cpu_type}}, but the only useful values are those
23478 that select a particular CPU implementation. Those are
23479 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
23480 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
23481 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
23482 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
23483 @samp{niagara4} and @samp{niagara7}. With native Solaris and
23484 GNU/Linux toolchains, @samp{native} can also be used.
23485
23486 @item -mv8plus
23487 @itemx -mno-v8plus
23488 @opindex mv8plus
23489 @opindex mno-v8plus
23490 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
23491 difference from the V8 ABI is that the global and out registers are
23492 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
23493 mode for all SPARC-V9 processors.
23494
23495 @item -mvis
23496 @itemx -mno-vis
23497 @opindex mvis
23498 @opindex mno-vis
23499 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
23500 Visual Instruction Set extensions. The default is @option{-mno-vis}.
23501
23502 @item -mvis2
23503 @itemx -mno-vis2
23504 @opindex mvis2
23505 @opindex mno-vis2
23506 With @option{-mvis2}, GCC generates code that takes advantage of
23507 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
23508 default is @option{-mvis2} when targeting a cpu that supports such
23509 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
23510 also sets @option{-mvis}.
23511
23512 @item -mvis3
23513 @itemx -mno-vis3
23514 @opindex mvis3
23515 @opindex mno-vis3
23516 With @option{-mvis3}, GCC generates code that takes advantage of
23517 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
23518 default is @option{-mvis3} when targeting a cpu that supports such
23519 instructions, such as niagara-3 and later. Setting @option{-mvis3}
23520 also sets @option{-mvis2} and @option{-mvis}.
23521
23522 @item -mvis4
23523 @itemx -mno-vis4
23524 @opindex mvis4
23525 @opindex mno-vis4
23526 With @option{-mvis4}, GCC generates code that takes advantage of
23527 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
23528 default is @option{-mvis4} when targeting a cpu that supports such
23529 instructions, such as niagara-7 and later. Setting @option{-mvis4}
23530 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
23531
23532 @item -mcbcond
23533 @itemx -mno-cbcond
23534 @opindex mcbcond
23535 @opindex mno-cbcond
23536 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
23537 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
23538 when targeting a CPU that supports such instructions, such as Niagara-4 and
23539 later.
23540
23541 @item -mfmaf
23542 @itemx -mno-fmaf
23543 @opindex mfmaf
23544 @opindex mno-fmaf
23545 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
23546 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
23547 when targeting a CPU that supports such instructions, such as Niagara-3 and
23548 later.
23549
23550 @item -mpopc
23551 @itemx -mno-popc
23552 @opindex mpopc
23553 @opindex mno-popc
23554 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
23555 Population Count instruction. The default is @option{-mpopc}
23556 when targeting a CPU that supports such an instruction, such as Niagara-2 and
23557 later.
23558
23559 @item -msubxc
23560 @itemx -mno-subxc
23561 @opindex msubxc
23562 @opindex mno-subxc
23563 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
23564 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
23565 when targeting a CPU that supports such an instruction, such as Niagara-7 and
23566 later.
23567
23568 @item -mfix-at697f
23569 @opindex mfix-at697f
23570 Enable the documented workaround for the single erratum of the Atmel AT697F
23571 processor (which corresponds to erratum #13 of the AT697E processor).
23572
23573 @item -mfix-ut699
23574 @opindex mfix-ut699
23575 Enable the documented workarounds for the floating-point errata and the data
23576 cache nullify errata of the UT699 processor.
23577 @end table
23578
23579 These @samp{-m} options are supported in addition to the above
23580 on SPARC-V9 processors in 64-bit environments:
23581
23582 @table @gcctabopt
23583 @item -m32
23584 @itemx -m64
23585 @opindex m32
23586 @opindex m64
23587 Generate code for a 32-bit or 64-bit environment.
23588 The 32-bit environment sets int, long and pointer to 32 bits.
23589 The 64-bit environment sets int to 32 bits and long and pointer
23590 to 64 bits.
23591
23592 @item -mcmodel=@var{which}
23593 @opindex mcmodel
23594 Set the code model to one of
23595
23596 @table @samp
23597 @item medlow
23598 The Medium/Low code model: 64-bit addresses, programs
23599 must be linked in the low 32 bits of memory. Programs can be statically
23600 or dynamically linked.
23601
23602 @item medmid
23603 The Medium/Middle code model: 64-bit addresses, programs
23604 must be linked in the low 44 bits of memory, the text and data segments must
23605 be less than 2GB in size and the data segment must be located within 2GB of
23606 the text segment.
23607
23608 @item medany
23609 The Medium/Anywhere code model: 64-bit addresses, programs
23610 may be linked anywhere in memory, the text and data segments must be less
23611 than 2GB in size and the data segment must be located within 2GB of the
23612 text segment.
23613
23614 @item embmedany
23615 The Medium/Anywhere code model for embedded systems:
23616 64-bit addresses, the text and data segments must be less than 2GB in
23617 size, both starting anywhere in memory (determined at link time). The
23618 global register %g4 points to the base of the data segment. Programs
23619 are statically linked and PIC is not supported.
23620 @end table
23621
23622 @item -mmemory-model=@var{mem-model}
23623 @opindex mmemory-model
23624 Set the memory model in force on the processor to one of
23625
23626 @table @samp
23627 @item default
23628 The default memory model for the processor and operating system.
23629
23630 @item rmo
23631 Relaxed Memory Order
23632
23633 @item pso
23634 Partial Store Order
23635
23636 @item tso
23637 Total Store Order
23638
23639 @item sc
23640 Sequential Consistency
23641 @end table
23642
23643 These memory models are formally defined in Appendix D of the SPARC-V9
23644 architecture manual, as set in the processor's @code{PSTATE.MM} field.
23645
23646 @item -mstack-bias
23647 @itemx -mno-stack-bias
23648 @opindex mstack-bias
23649 @opindex mno-stack-bias
23650 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
23651 frame pointer if present, are offset by @minus{}2047 which must be added back
23652 when making stack frame references. This is the default in 64-bit mode.
23653 Otherwise, assume no such offset is present.
23654 @end table
23655
23656 @node SPU Options
23657 @subsection SPU Options
23658 @cindex SPU options
23659
23660 These @samp{-m} options are supported on the SPU:
23661
23662 @table @gcctabopt
23663 @item -mwarn-reloc
23664 @itemx -merror-reloc
23665 @opindex mwarn-reloc
23666 @opindex merror-reloc
23667
23668 The loader for SPU does not handle dynamic relocations. By default, GCC
23669 gives an error when it generates code that requires a dynamic
23670 relocation. @option{-mno-error-reloc} disables the error,
23671 @option{-mwarn-reloc} generates a warning instead.
23672
23673 @item -msafe-dma
23674 @itemx -munsafe-dma
23675 @opindex msafe-dma
23676 @opindex munsafe-dma
23677
23678 Instructions that initiate or test completion of DMA must not be
23679 reordered with respect to loads and stores of the memory that is being
23680 accessed.
23681 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
23682 memory accesses, but that can lead to inefficient code in places where the
23683 memory is known to not change. Rather than mark the memory as volatile,
23684 you can use @option{-msafe-dma} to tell the compiler to treat
23685 the DMA instructions as potentially affecting all memory.
23686
23687 @item -mbranch-hints
23688 @opindex mbranch-hints
23689
23690 By default, GCC generates a branch hint instruction to avoid
23691 pipeline stalls for always-taken or probably-taken branches. A hint
23692 is not generated closer than 8 instructions away from its branch.
23693 There is little reason to disable them, except for debugging purposes,
23694 or to make an object a little bit smaller.
23695
23696 @item -msmall-mem
23697 @itemx -mlarge-mem
23698 @opindex msmall-mem
23699 @opindex mlarge-mem
23700
23701 By default, GCC generates code assuming that addresses are never larger
23702 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
23703 a full 32-bit address.
23704
23705 @item -mstdmain
23706 @opindex mstdmain
23707
23708 By default, GCC links against startup code that assumes the SPU-style
23709 main function interface (which has an unconventional parameter list).
23710 With @option{-mstdmain}, GCC links your program against startup
23711 code that assumes a C99-style interface to @code{main}, including a
23712 local copy of @code{argv} strings.
23713
23714 @item -mfixed-range=@var{register-range}
23715 @opindex mfixed-range
23716 Generate code treating the given register range as fixed registers.
23717 A fixed register is one that the register allocator cannot use. This is
23718 useful when compiling kernel code. A register range is specified as
23719 two registers separated by a dash. Multiple register ranges can be
23720 specified separated by a comma.
23721
23722 @item -mea32
23723 @itemx -mea64
23724 @opindex mea32
23725 @opindex mea64
23726 Compile code assuming that pointers to the PPU address space accessed
23727 via the @code{__ea} named address space qualifier are either 32 or 64
23728 bits wide. The default is 32 bits. As this is an ABI-changing option,
23729 all object code in an executable must be compiled with the same setting.
23730
23731 @item -maddress-space-conversion
23732 @itemx -mno-address-space-conversion
23733 @opindex maddress-space-conversion
23734 @opindex mno-address-space-conversion
23735 Allow/disallow treating the @code{__ea} address space as superset
23736 of the generic address space. This enables explicit type casts
23737 between @code{__ea} and generic pointer as well as implicit
23738 conversions of generic pointers to @code{__ea} pointers. The
23739 default is to allow address space pointer conversions.
23740
23741 @item -mcache-size=@var{cache-size}
23742 @opindex mcache-size
23743 This option controls the version of libgcc that the compiler links to an
23744 executable and selects a software-managed cache for accessing variables
23745 in the @code{__ea} address space with a particular cache size. Possible
23746 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
23747 and @samp{128}. The default cache size is 64KB.
23748
23749 @item -matomic-updates
23750 @itemx -mno-atomic-updates
23751 @opindex matomic-updates
23752 @opindex mno-atomic-updates
23753 This option controls the version of libgcc that the compiler links to an
23754 executable and selects whether atomic updates to the software-managed
23755 cache of PPU-side variables are used. If you use atomic updates, changes
23756 to a PPU variable from SPU code using the @code{__ea} named address space
23757 qualifier do not interfere with changes to other PPU variables residing
23758 in the same cache line from PPU code. If you do not use atomic updates,
23759 such interference may occur; however, writing back cache lines is
23760 more efficient. The default behavior is to use atomic updates.
23761
23762 @item -mdual-nops
23763 @itemx -mdual-nops=@var{n}
23764 @opindex mdual-nops
23765 By default, GCC inserts NOPs to increase dual issue when it expects
23766 it to increase performance. @var{n} can be a value from 0 to 10. A
23767 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
23768 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
23769
23770 @item -mhint-max-nops=@var{n}
23771 @opindex mhint-max-nops
23772 Maximum number of NOPs to insert for a branch hint. A branch hint must
23773 be at least 8 instructions away from the branch it is affecting. GCC
23774 inserts up to @var{n} NOPs to enforce this, otherwise it does not
23775 generate the branch hint.
23776
23777 @item -mhint-max-distance=@var{n}
23778 @opindex mhint-max-distance
23779 The encoding of the branch hint instruction limits the hint to be within
23780 256 instructions of the branch it is affecting. By default, GCC makes
23781 sure it is within 125.
23782
23783 @item -msafe-hints
23784 @opindex msafe-hints
23785 Work around a hardware bug that causes the SPU to stall indefinitely.
23786 By default, GCC inserts the @code{hbrp} instruction to make sure
23787 this stall won't happen.
23788
23789 @end table
23790
23791 @node System V Options
23792 @subsection Options for System V
23793
23794 These additional options are available on System V Release 4 for
23795 compatibility with other compilers on those systems:
23796
23797 @table @gcctabopt
23798 @item -G
23799 @opindex G
23800 Create a shared object.
23801 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
23802
23803 @item -Qy
23804 @opindex Qy
23805 Identify the versions of each tool used by the compiler, in a
23806 @code{.ident} assembler directive in the output.
23807
23808 @item -Qn
23809 @opindex Qn
23810 Refrain from adding @code{.ident} directives to the output file (this is
23811 the default).
23812
23813 @item -YP,@var{dirs}
23814 @opindex YP
23815 Search the directories @var{dirs}, and no others, for libraries
23816 specified with @option{-l}.
23817
23818 @item -Ym,@var{dir}
23819 @opindex Ym
23820 Look in the directory @var{dir} to find the M4 preprocessor.
23821 The assembler uses this option.
23822 @c This is supposed to go with a -Yd for predefined M4 macro files, but
23823 @c the generic assembler that comes with Solaris takes just -Ym.
23824 @end table
23825
23826 @node TILE-Gx Options
23827 @subsection TILE-Gx Options
23828 @cindex TILE-Gx options
23829
23830 These @samp{-m} options are supported on the TILE-Gx:
23831
23832 @table @gcctabopt
23833 @item -mcmodel=small
23834 @opindex mcmodel=small
23835 Generate code for the small model. The distance for direct calls is
23836 limited to 500M in either direction. PC-relative addresses are 32
23837 bits. Absolute addresses support the full address range.
23838
23839 @item -mcmodel=large
23840 @opindex mcmodel=large
23841 Generate code for the large model. There is no limitation on call
23842 distance, pc-relative addresses, or absolute addresses.
23843
23844 @item -mcpu=@var{name}
23845 @opindex mcpu
23846 Selects the type of CPU to be targeted. Currently the only supported
23847 type is @samp{tilegx}.
23848
23849 @item -m32
23850 @itemx -m64
23851 @opindex m32
23852 @opindex m64
23853 Generate code for a 32-bit or 64-bit environment. The 32-bit
23854 environment sets int, long, and pointer to 32 bits. The 64-bit
23855 environment sets int to 32 bits and long and pointer to 64 bits.
23856
23857 @item -mbig-endian
23858 @itemx -mlittle-endian
23859 @opindex mbig-endian
23860 @opindex mlittle-endian
23861 Generate code in big/little endian mode, respectively.
23862 @end table
23863
23864 @node TILEPro Options
23865 @subsection TILEPro Options
23866 @cindex TILEPro options
23867
23868 These @samp{-m} options are supported on the TILEPro:
23869
23870 @table @gcctabopt
23871 @item -mcpu=@var{name}
23872 @opindex mcpu
23873 Selects the type of CPU to be targeted. Currently the only supported
23874 type is @samp{tilepro}.
23875
23876 @item -m32
23877 @opindex m32
23878 Generate code for a 32-bit environment, which sets int, long, and
23879 pointer to 32 bits. This is the only supported behavior so the flag
23880 is essentially ignored.
23881 @end table
23882
23883 @node V850 Options
23884 @subsection V850 Options
23885 @cindex V850 Options
23886
23887 These @samp{-m} options are defined for V850 implementations:
23888
23889 @table @gcctabopt
23890 @item -mlong-calls
23891 @itemx -mno-long-calls
23892 @opindex mlong-calls
23893 @opindex mno-long-calls
23894 Treat all calls as being far away (near). If calls are assumed to be
23895 far away, the compiler always loads the function's address into a
23896 register, and calls indirect through the pointer.
23897
23898 @item -mno-ep
23899 @itemx -mep
23900 @opindex mno-ep
23901 @opindex mep
23902 Do not optimize (do optimize) basic blocks that use the same index
23903 pointer 4 or more times to copy pointer into the @code{ep} register, and
23904 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
23905 option is on by default if you optimize.
23906
23907 @item -mno-prolog-function
23908 @itemx -mprolog-function
23909 @opindex mno-prolog-function
23910 @opindex mprolog-function
23911 Do not use (do use) external functions to save and restore registers
23912 at the prologue and epilogue of a function. The external functions
23913 are slower, but use less code space if more than one function saves
23914 the same number of registers. The @option{-mprolog-function} option
23915 is on by default if you optimize.
23916
23917 @item -mspace
23918 @opindex mspace
23919 Try to make the code as small as possible. At present, this just turns
23920 on the @option{-mep} and @option{-mprolog-function} options.
23921
23922 @item -mtda=@var{n}
23923 @opindex mtda
23924 Put static or global variables whose size is @var{n} bytes or less into
23925 the tiny data area that register @code{ep} points to. The tiny data
23926 area can hold up to 256 bytes in total (128 bytes for byte references).
23927
23928 @item -msda=@var{n}
23929 @opindex msda
23930 Put static or global variables whose size is @var{n} bytes or less into
23931 the small data area that register @code{gp} points to. The small data
23932 area can hold up to 64 kilobytes.
23933
23934 @item -mzda=@var{n}
23935 @opindex mzda
23936 Put static or global variables whose size is @var{n} bytes or less into
23937 the first 32 kilobytes of memory.
23938
23939 @item -mv850
23940 @opindex mv850
23941 Specify that the target processor is the V850.
23942
23943 @item -mv850e3v5
23944 @opindex mv850e3v5
23945 Specify that the target processor is the V850E3V5. The preprocessor
23946 constant @code{__v850e3v5__} is defined if this option is used.
23947
23948 @item -mv850e2v4
23949 @opindex mv850e2v4
23950 Specify that the target processor is the V850E3V5. This is an alias for
23951 the @option{-mv850e3v5} option.
23952
23953 @item -mv850e2v3
23954 @opindex mv850e2v3
23955 Specify that the target processor is the V850E2V3. The preprocessor
23956 constant @code{__v850e2v3__} is defined if this option is used.
23957
23958 @item -mv850e2
23959 @opindex mv850e2
23960 Specify that the target processor is the V850E2. The preprocessor
23961 constant @code{__v850e2__} is defined if this option is used.
23962
23963 @item -mv850e1
23964 @opindex mv850e1
23965 Specify that the target processor is the V850E1. The preprocessor
23966 constants @code{__v850e1__} and @code{__v850e__} are defined if
23967 this option is used.
23968
23969 @item -mv850es
23970 @opindex mv850es
23971 Specify that the target processor is the V850ES. This is an alias for
23972 the @option{-mv850e1} option.
23973
23974 @item -mv850e
23975 @opindex mv850e
23976 Specify that the target processor is the V850E@. The preprocessor
23977 constant @code{__v850e__} is defined if this option is used.
23978
23979 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
23980 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
23981 are defined then a default target processor is chosen and the
23982 relevant @samp{__v850*__} preprocessor constant is defined.
23983
23984 The preprocessor constants @code{__v850} and @code{__v851__} are always
23985 defined, regardless of which processor variant is the target.
23986
23987 @item -mdisable-callt
23988 @itemx -mno-disable-callt
23989 @opindex mdisable-callt
23990 @opindex mno-disable-callt
23991 This option suppresses generation of the @code{CALLT} instruction for the
23992 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
23993 architecture.
23994
23995 This option is enabled by default when the RH850 ABI is
23996 in use (see @option{-mrh850-abi}), and disabled by default when the
23997 GCC ABI is in use. If @code{CALLT} instructions are being generated
23998 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
23999
24000 @item -mrelax
24001 @itemx -mno-relax
24002 @opindex mrelax
24003 @opindex mno-relax
24004 Pass on (or do not pass on) the @option{-mrelax} command-line option
24005 to the assembler.
24006
24007 @item -mlong-jumps
24008 @itemx -mno-long-jumps
24009 @opindex mlong-jumps
24010 @opindex mno-long-jumps
24011 Disable (or re-enable) the generation of PC-relative jump instructions.
24012
24013 @item -msoft-float
24014 @itemx -mhard-float
24015 @opindex msoft-float
24016 @opindex mhard-float
24017 Disable (or re-enable) the generation of hardware floating point
24018 instructions. This option is only significant when the target
24019 architecture is @samp{V850E2V3} or higher. If hardware floating point
24020 instructions are being generated then the C preprocessor symbol
24021 @code{__FPU_OK__} is defined, otherwise the symbol
24022 @code{__NO_FPU__} is defined.
24023
24024 @item -mloop
24025 @opindex mloop
24026 Enables the use of the e3v5 LOOP instruction. The use of this
24027 instruction is not enabled by default when the e3v5 architecture is
24028 selected because its use is still experimental.
24029
24030 @item -mrh850-abi
24031 @itemx -mghs
24032 @opindex mrh850-abi
24033 @opindex mghs
24034 Enables support for the RH850 version of the V850 ABI. This is the
24035 default. With this version of the ABI the following rules apply:
24036
24037 @itemize
24038 @item
24039 Integer sized structures and unions are returned via a memory pointer
24040 rather than a register.
24041
24042 @item
24043 Large structures and unions (more than 8 bytes in size) are passed by
24044 value.
24045
24046 @item
24047 Functions are aligned to 16-bit boundaries.
24048
24049 @item
24050 The @option{-m8byte-align} command-line option is supported.
24051
24052 @item
24053 The @option{-mdisable-callt} command-line option is enabled by
24054 default. The @option{-mno-disable-callt} command-line option is not
24055 supported.
24056 @end itemize
24057
24058 When this version of the ABI is enabled the C preprocessor symbol
24059 @code{__V850_RH850_ABI__} is defined.
24060
24061 @item -mgcc-abi
24062 @opindex mgcc-abi
24063 Enables support for the old GCC version of the V850 ABI. With this
24064 version of the ABI the following rules apply:
24065
24066 @itemize
24067 @item
24068 Integer sized structures and unions are returned in register @code{r10}.
24069
24070 @item
24071 Large structures and unions (more than 8 bytes in size) are passed by
24072 reference.
24073
24074 @item
24075 Functions are aligned to 32-bit boundaries, unless optimizing for
24076 size.
24077
24078 @item
24079 The @option{-m8byte-align} command-line option is not supported.
24080
24081 @item
24082 The @option{-mdisable-callt} command-line option is supported but not
24083 enabled by default.
24084 @end itemize
24085
24086 When this version of the ABI is enabled the C preprocessor symbol
24087 @code{__V850_GCC_ABI__} is defined.
24088
24089 @item -m8byte-align
24090 @itemx -mno-8byte-align
24091 @opindex m8byte-align
24092 @opindex mno-8byte-align
24093 Enables support for @code{double} and @code{long long} types to be
24094 aligned on 8-byte boundaries. The default is to restrict the
24095 alignment of all objects to at most 4-bytes. When
24096 @option{-m8byte-align} is in effect the C preprocessor symbol
24097 @code{__V850_8BYTE_ALIGN__} is defined.
24098
24099 @item -mbig-switch
24100 @opindex mbig-switch
24101 Generate code suitable for big switch tables. Use this option only if
24102 the assembler/linker complain about out of range branches within a switch
24103 table.
24104
24105 @item -mapp-regs
24106 @opindex mapp-regs
24107 This option causes r2 and r5 to be used in the code generated by
24108 the compiler. This setting is the default.
24109
24110 @item -mno-app-regs
24111 @opindex mno-app-regs
24112 This option causes r2 and r5 to be treated as fixed registers.
24113
24114 @end table
24115
24116 @node VAX Options
24117 @subsection VAX Options
24118 @cindex VAX options
24119
24120 These @samp{-m} options are defined for the VAX:
24121
24122 @table @gcctabopt
24123 @item -munix
24124 @opindex munix
24125 Do not output certain jump instructions (@code{aobleq} and so on)
24126 that the Unix assembler for the VAX cannot handle across long
24127 ranges.
24128
24129 @item -mgnu
24130 @opindex mgnu
24131 Do output those jump instructions, on the assumption that the
24132 GNU assembler is being used.
24133
24134 @item -mg
24135 @opindex mg
24136 Output code for G-format floating-point numbers instead of D-format.
24137 @end table
24138
24139 @node Visium Options
24140 @subsection Visium Options
24141 @cindex Visium options
24142
24143 @table @gcctabopt
24144
24145 @item -mdebug
24146 @opindex mdebug
24147 A program which performs file I/O and is destined to run on an MCM target
24148 should be linked with this option. It causes the libraries libc.a and
24149 libdebug.a to be linked. The program should be run on the target under
24150 the control of the GDB remote debugging stub.
24151
24152 @item -msim
24153 @opindex msim
24154 A program which performs file I/O and is destined to run on the simulator
24155 should be linked with option. This causes libraries libc.a and libsim.a to
24156 be linked.
24157
24158 @item -mfpu
24159 @itemx -mhard-float
24160 @opindex mfpu
24161 @opindex mhard-float
24162 Generate code containing floating-point instructions. This is the
24163 default.
24164
24165 @item -mno-fpu
24166 @itemx -msoft-float
24167 @opindex mno-fpu
24168 @opindex msoft-float
24169 Generate code containing library calls for floating-point.
24170
24171 @option{-msoft-float} changes the calling convention in the output file;
24172 therefore, it is only useful if you compile @emph{all} of a program with
24173 this option. In particular, you need to compile @file{libgcc.a}, the
24174 library that comes with GCC, with @option{-msoft-float} in order for
24175 this to work.
24176
24177 @item -mcpu=@var{cpu_type}
24178 @opindex mcpu
24179 Set the instruction set, register set, and instruction scheduling parameters
24180 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
24181 @samp{mcm}, @samp{gr5} and @samp{gr6}.
24182
24183 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
24184
24185 By default (unless configured otherwise), GCC generates code for the GR5
24186 variant of the Visium architecture.
24187
24188 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
24189 architecture. The only difference from GR5 code is that the compiler will
24190 generate block move instructions.
24191
24192 @item -mtune=@var{cpu_type}
24193 @opindex mtune
24194 Set the instruction scheduling parameters for machine type @var{cpu_type},
24195 but do not set the instruction set or register set that the option
24196 @option{-mcpu=@var{cpu_type}} would.
24197
24198 @item -msv-mode
24199 @opindex msv-mode
24200 Generate code for the supervisor mode, where there are no restrictions on
24201 the access to general registers. This is the default.
24202
24203 @item -muser-mode
24204 @opindex muser-mode
24205 Generate code for the user mode, where the access to some general registers
24206 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
24207 mode; on the GR6, only registers r29 to r31 are affected.
24208 @end table
24209
24210 @node VMS Options
24211 @subsection VMS Options
24212
24213 These @samp{-m} options are defined for the VMS implementations:
24214
24215 @table @gcctabopt
24216 @item -mvms-return-codes
24217 @opindex mvms-return-codes
24218 Return VMS condition codes from @code{main}. The default is to return POSIX-style
24219 condition (e.g.@ error) codes.
24220
24221 @item -mdebug-main=@var{prefix}
24222 @opindex mdebug-main=@var{prefix}
24223 Flag the first routine whose name starts with @var{prefix} as the main
24224 routine for the debugger.
24225
24226 @item -mmalloc64
24227 @opindex mmalloc64
24228 Default to 64-bit memory allocation routines.
24229
24230 @item -mpointer-size=@var{size}
24231 @opindex mpointer-size=@var{size}
24232 Set the default size of pointers. Possible options for @var{size} are
24233 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
24234 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
24235 The later option disables @code{pragma pointer_size}.
24236 @end table
24237
24238 @node VxWorks Options
24239 @subsection VxWorks Options
24240 @cindex VxWorks Options
24241
24242 The options in this section are defined for all VxWorks targets.
24243 Options specific to the target hardware are listed with the other
24244 options for that target.
24245
24246 @table @gcctabopt
24247 @item -mrtp
24248 @opindex mrtp
24249 GCC can generate code for both VxWorks kernels and real time processes
24250 (RTPs). This option switches from the former to the latter. It also
24251 defines the preprocessor macro @code{__RTP__}.
24252
24253 @item -non-static
24254 @opindex non-static
24255 Link an RTP executable against shared libraries rather than static
24256 libraries. The options @option{-static} and @option{-shared} can
24257 also be used for RTPs (@pxref{Link Options}); @option{-static}
24258 is the default.
24259
24260 @item -Bstatic
24261 @itemx -Bdynamic
24262 @opindex Bstatic
24263 @opindex Bdynamic
24264 These options are passed down to the linker. They are defined for
24265 compatibility with Diab.
24266
24267 @item -Xbind-lazy
24268 @opindex Xbind-lazy
24269 Enable lazy binding of function calls. This option is equivalent to
24270 @option{-Wl,-z,now} and is defined for compatibility with Diab.
24271
24272 @item -Xbind-now
24273 @opindex Xbind-now
24274 Disable lazy binding of function calls. This option is the default and
24275 is defined for compatibility with Diab.
24276 @end table
24277
24278 @node x86 Options
24279 @subsection x86 Options
24280 @cindex x86 Options
24281
24282 These @samp{-m} options are defined for the x86 family of computers.
24283
24284 @table @gcctabopt
24285
24286 @item -march=@var{cpu-type}
24287 @opindex march
24288 Generate instructions for the machine type @var{cpu-type}. In contrast to
24289 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
24290 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
24291 to generate code that may not run at all on processors other than the one
24292 indicated. Specifying @option{-march=@var{cpu-type}} implies
24293 @option{-mtune=@var{cpu-type}}.
24294
24295 The choices for @var{cpu-type} are:
24296
24297 @table @samp
24298 @item native
24299 This selects the CPU to generate code for at compilation time by determining
24300 the processor type of the compiling machine. Using @option{-march=native}
24301 enables all instruction subsets supported by the local machine (hence
24302 the result might not run on different machines). Using @option{-mtune=native}
24303 produces code optimized for the local machine under the constraints
24304 of the selected instruction set.
24305
24306 @item i386
24307 Original Intel i386 CPU@.
24308
24309 @item i486
24310 Intel i486 CPU@. (No scheduling is implemented for this chip.)
24311
24312 @item i586
24313 @itemx pentium
24314 Intel Pentium CPU with no MMX support.
24315
24316 @item lakemont
24317 Intel Lakemont MCU, based on Intel Pentium CPU.
24318
24319 @item pentium-mmx
24320 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
24321
24322 @item pentiumpro
24323 Intel Pentium Pro CPU@.
24324
24325 @item i686
24326 When used with @option{-march}, the Pentium Pro
24327 instruction set is used, so the code runs on all i686 family chips.
24328 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
24329
24330 @item pentium2
24331 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
24332 support.
24333
24334 @item pentium3
24335 @itemx pentium3m
24336 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
24337 set support.
24338
24339 @item pentium-m
24340 Intel Pentium M; low-power version of Intel Pentium III CPU
24341 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
24342
24343 @item pentium4
24344 @itemx pentium4m
24345 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
24346
24347 @item prescott
24348 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
24349 set support.
24350
24351 @item nocona
24352 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
24353 SSE2 and SSE3 instruction set support.
24354
24355 @item core2
24356 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
24357 instruction set support.
24358
24359 @item nehalem
24360 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24361 SSE4.1, SSE4.2 and POPCNT instruction set support.
24362
24363 @item westmere
24364 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24365 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
24366
24367 @item sandybridge
24368 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24369 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
24370
24371 @item ivybridge
24372 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24373 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
24374 instruction set support.
24375
24376 @item haswell
24377 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24378 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24379 BMI, BMI2 and F16C instruction set support.
24380
24381 @item broadwell
24382 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24383 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24384 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
24385
24386 @item skylake
24387 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24388 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24389 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
24390 XSAVES instruction set support.
24391
24392 @item bonnell
24393 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
24394 instruction set support.
24395
24396 @item silvermont
24397 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24398 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
24399
24400 @item knl
24401 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
24402 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24403 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
24404 AVX512CD instruction set support.
24405
24406 @item skylake-avx512
24407 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
24408 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24409 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
24410 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
24411
24412 @item k6
24413 AMD K6 CPU with MMX instruction set support.
24414
24415 @item k6-2
24416 @itemx k6-3
24417 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
24418
24419 @item athlon
24420 @itemx athlon-tbird
24421 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
24422 support.
24423
24424 @item athlon-4
24425 @itemx athlon-xp
24426 @itemx athlon-mp
24427 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
24428 instruction set support.
24429
24430 @item k8
24431 @itemx opteron
24432 @itemx athlon64
24433 @itemx athlon-fx
24434 Processors based on the AMD K8 core with x86-64 instruction set support,
24435 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
24436 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
24437 instruction set extensions.)
24438
24439 @item k8-sse3
24440 @itemx opteron-sse3
24441 @itemx athlon64-sse3
24442 Improved versions of AMD K8 cores with SSE3 instruction set support.
24443
24444 @item amdfam10
24445 @itemx barcelona
24446 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
24447 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
24448 instruction set extensions.)
24449
24450 @item bdver1
24451 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
24452 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
24453 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
24454 @item bdver2
24455 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
24456 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
24457 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
24458 extensions.)
24459 @item bdver3
24460 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
24461 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
24462 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
24463 64-bit instruction set extensions.
24464 @item bdver4
24465 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
24466 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
24467 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
24468 SSE4.2, ABM and 64-bit instruction set extensions.
24469
24470 @item znver1
24471 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
24472 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
24473 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
24474 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
24475 instruction set extensions.
24476
24477 @item btver1
24478 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
24479 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
24480 instruction set extensions.)
24481
24482 @item btver2
24483 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
24484 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
24485 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
24486
24487 @item winchip-c6
24488 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
24489 set support.
24490
24491 @item winchip2
24492 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
24493 instruction set support.
24494
24495 @item c3
24496 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
24497 (No scheduling is implemented for this chip.)
24498
24499 @item c3-2
24500 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
24501 (No scheduling is implemented for this chip.)
24502
24503 @item c7
24504 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
24505 (No scheduling is implemented for this chip.)
24506
24507 @item samuel-2
24508 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
24509 (No scheduling is implemented for this chip.)
24510
24511 @item nehemiah
24512 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
24513 (No scheduling is implemented for this chip.)
24514
24515 @item esther
24516 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
24517 (No scheduling is implemented for this chip.)
24518
24519 @item eden-x2
24520 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
24521 (No scheduling is implemented for this chip.)
24522
24523 @item eden-x4
24524 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
24525 AVX and AVX2 instruction set support.
24526 (No scheduling is implemented for this chip.)
24527
24528 @item nano
24529 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24530 instruction set support.
24531 (No scheduling is implemented for this chip.)
24532
24533 @item nano-1000
24534 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24535 instruction set support.
24536 (No scheduling is implemented for this chip.)
24537
24538 @item nano-2000
24539 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24540 instruction set support.
24541 (No scheduling is implemented for this chip.)
24542
24543 @item nano-3000
24544 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
24545 instruction set support.
24546 (No scheduling is implemented for this chip.)
24547
24548 @item nano-x2
24549 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
24550 instruction set support.
24551 (No scheduling is implemented for this chip.)
24552
24553 @item nano-x4
24554 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
24555 instruction set support.
24556 (No scheduling is implemented for this chip.)
24557
24558 @item geode
24559 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
24560 @end table
24561
24562 @item -mtune=@var{cpu-type}
24563 @opindex mtune
24564 Tune to @var{cpu-type} everything applicable about the generated code, except
24565 for the ABI and the set of available instructions.
24566 While picking a specific @var{cpu-type} schedules things appropriately
24567 for that particular chip, the compiler does not generate any code that
24568 cannot run on the default machine type unless you use a
24569 @option{-march=@var{cpu-type}} option.
24570 For example, if GCC is configured for i686-pc-linux-gnu
24571 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
24572 but still runs on i686 machines.
24573
24574 The choices for @var{cpu-type} are the same as for @option{-march}.
24575 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
24576
24577 @table @samp
24578 @item generic
24579 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
24580 If you know the CPU on which your code will run, then you should use
24581 the corresponding @option{-mtune} or @option{-march} option instead of
24582 @option{-mtune=generic}. But, if you do not know exactly what CPU users
24583 of your application will have, then you should use this option.
24584
24585 As new processors are deployed in the marketplace, the behavior of this
24586 option will change. Therefore, if you upgrade to a newer version of
24587 GCC, code generation controlled by this option will change to reflect
24588 the processors
24589 that are most common at the time that version of GCC is released.
24590
24591 There is no @option{-march=generic} option because @option{-march}
24592 indicates the instruction set the compiler can use, and there is no
24593 generic instruction set applicable to all processors. In contrast,
24594 @option{-mtune} indicates the processor (or, in this case, collection of
24595 processors) for which the code is optimized.
24596
24597 @item intel
24598 Produce code optimized for the most current Intel processors, which are
24599 Haswell and Silvermont for this version of GCC. If you know the CPU
24600 on which your code will run, then you should use the corresponding
24601 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
24602 But, if you want your application performs better on both Haswell and
24603 Silvermont, then you should use this option.
24604
24605 As new Intel processors are deployed in the marketplace, the behavior of
24606 this option will change. Therefore, if you upgrade to a newer version of
24607 GCC, code generation controlled by this option will change to reflect
24608 the most current Intel processors at the time that version of GCC is
24609 released.
24610
24611 There is no @option{-march=intel} option because @option{-march} indicates
24612 the instruction set the compiler can use, and there is no common
24613 instruction set applicable to all processors. In contrast,
24614 @option{-mtune} indicates the processor (or, in this case, collection of
24615 processors) for which the code is optimized.
24616 @end table
24617
24618 @item -mcpu=@var{cpu-type}
24619 @opindex mcpu
24620 A deprecated synonym for @option{-mtune}.
24621
24622 @item -mfpmath=@var{unit}
24623 @opindex mfpmath
24624 Generate floating-point arithmetic for selected unit @var{unit}. The choices
24625 for @var{unit} are:
24626
24627 @table @samp
24628 @item 387
24629 Use the standard 387 floating-point coprocessor present on the majority of chips and
24630 emulated otherwise. Code compiled with this option runs almost everywhere.
24631 The temporary results are computed in 80-bit precision instead of the precision
24632 specified by the type, resulting in slightly different results compared to most
24633 of other chips. See @option{-ffloat-store} for more detailed description.
24634
24635 This is the default choice for non-Darwin x86-32 targets.
24636
24637 @item sse
24638 Use scalar floating-point instructions present in the SSE instruction set.
24639 This instruction set is supported by Pentium III and newer chips,
24640 and in the AMD line
24641 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
24642 instruction set supports only single-precision arithmetic, thus the double and
24643 extended-precision arithmetic are still done using 387. A later version, present
24644 only in Pentium 4 and AMD x86-64 chips, supports double-precision
24645 arithmetic too.
24646
24647 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
24648 or @option{-msse2} switches to enable SSE extensions and make this option
24649 effective. For the x86-64 compiler, these extensions are enabled by default.
24650
24651 The resulting code should be considerably faster in the majority of cases and avoid
24652 the numerical instability problems of 387 code, but may break some existing
24653 code that expects temporaries to be 80 bits.
24654
24655 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
24656 and the default choice for x86-32 targets with the SSE2 instruction set
24657 when @option{-ffast-math} is enabled.
24658
24659 @item sse,387
24660 @itemx sse+387
24661 @itemx both
24662 Attempt to utilize both instruction sets at once. This effectively doubles the
24663 amount of available registers, and on chips with separate execution units for
24664 387 and SSE the execution resources too. Use this option with care, as it is
24665 still experimental, because the GCC register allocator does not model separate
24666 functional units well, resulting in unstable performance.
24667 @end table
24668
24669 @item -masm=@var{dialect}
24670 @opindex masm=@var{dialect}
24671 Output assembly instructions using selected @var{dialect}. Also affects
24672 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
24673 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
24674 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
24675 not support @samp{intel}.
24676
24677 @item -mieee-fp
24678 @itemx -mno-ieee-fp
24679 @opindex mieee-fp
24680 @opindex mno-ieee-fp
24681 Control whether or not the compiler uses IEEE floating-point
24682 comparisons. These correctly handle the case where the result of a
24683 comparison is unordered.
24684
24685 @item -m80387
24686 @item -mhard-float
24687 @opindex 80387
24688 @opindex mhard-float
24689 Generate output containing 80387 instructions for floating point.
24690
24691 @item -mno-80387
24692 @item -msoft-float
24693 @opindex no-80387
24694 @opindex msoft-float
24695 Generate output containing library calls for floating point.
24696
24697 @strong{Warning:} the requisite libraries are not part of GCC@.
24698 Normally the facilities of the machine's usual C compiler are used, but
24699 this can't be done directly in cross-compilation. You must make your
24700 own arrangements to provide suitable library functions for
24701 cross-compilation.
24702
24703 On machines where a function returns floating-point results in the 80387
24704 register stack, some floating-point opcodes may be emitted even if
24705 @option{-msoft-float} is used.
24706
24707 @item -mno-fp-ret-in-387
24708 @opindex mno-fp-ret-in-387
24709 Do not use the FPU registers for return values of functions.
24710
24711 The usual calling convention has functions return values of types
24712 @code{float} and @code{double} in an FPU register, even if there
24713 is no FPU@. The idea is that the operating system should emulate
24714 an FPU@.
24715
24716 The option @option{-mno-fp-ret-in-387} causes such values to be returned
24717 in ordinary CPU registers instead.
24718
24719 @item -mno-fancy-math-387
24720 @opindex mno-fancy-math-387
24721 Some 387 emulators do not support the @code{sin}, @code{cos} and
24722 @code{sqrt} instructions for the 387. Specify this option to avoid
24723 generating those instructions. This option is the default on
24724 OpenBSD and NetBSD@. This option is overridden when @option{-march}
24725 indicates that the target CPU always has an FPU and so the
24726 instruction does not need emulation. These
24727 instructions are not generated unless you also use the
24728 @option{-funsafe-math-optimizations} switch.
24729
24730 @item -malign-double
24731 @itemx -mno-align-double
24732 @opindex malign-double
24733 @opindex mno-align-double
24734 Control whether GCC aligns @code{double}, @code{long double}, and
24735 @code{long long} variables on a two-word boundary or a one-word
24736 boundary. Aligning @code{double} variables on a two-word boundary
24737 produces code that runs somewhat faster on a Pentium at the
24738 expense of more memory.
24739
24740 On x86-64, @option{-malign-double} is enabled by default.
24741
24742 @strong{Warning:} if you use the @option{-malign-double} switch,
24743 structures containing the above types are aligned differently than
24744 the published application binary interface specifications for the x86-32
24745 and are not binary compatible with structures in code compiled
24746 without that switch.
24747
24748 @item -m96bit-long-double
24749 @itemx -m128bit-long-double
24750 @opindex m96bit-long-double
24751 @opindex m128bit-long-double
24752 These switches control the size of @code{long double} type. The x86-32
24753 application binary interface specifies the size to be 96 bits,
24754 so @option{-m96bit-long-double} is the default in 32-bit mode.
24755
24756 Modern architectures (Pentium and newer) prefer @code{long double}
24757 to be aligned to an 8- or 16-byte boundary. In arrays or structures
24758 conforming to the ABI, this is not possible. So specifying
24759 @option{-m128bit-long-double} aligns @code{long double}
24760 to a 16-byte boundary by padding the @code{long double} with an additional
24761 32-bit zero.
24762
24763 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
24764 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
24765
24766 Notice that neither of these options enable any extra precision over the x87
24767 standard of 80 bits for a @code{long double}.
24768
24769 @strong{Warning:} if you override the default value for your target ABI, this
24770 changes the size of
24771 structures and arrays containing @code{long double} variables,
24772 as well as modifying the function calling convention for functions taking
24773 @code{long double}. Hence they are not binary-compatible
24774 with code compiled without that switch.
24775
24776 @item -mlong-double-64
24777 @itemx -mlong-double-80
24778 @itemx -mlong-double-128
24779 @opindex mlong-double-64
24780 @opindex mlong-double-80
24781 @opindex mlong-double-128
24782 These switches control the size of @code{long double} type. A size
24783 of 64 bits makes the @code{long double} type equivalent to the @code{double}
24784 type. This is the default for 32-bit Bionic C library. A size
24785 of 128 bits makes the @code{long double} type equivalent to the
24786 @code{__float128} type. This is the default for 64-bit Bionic C library.
24787
24788 @strong{Warning:} if you override the default value for your target ABI, this
24789 changes the size of
24790 structures and arrays containing @code{long double} variables,
24791 as well as modifying the function calling convention for functions taking
24792 @code{long double}. Hence they are not binary-compatible
24793 with code compiled without that switch.
24794
24795 @item -malign-data=@var{type}
24796 @opindex malign-data
24797 Control how GCC aligns variables. Supported values for @var{type} are
24798 @samp{compat} uses increased alignment value compatible uses GCC 4.8
24799 and earlier, @samp{abi} uses alignment value as specified by the
24800 psABI, and @samp{cacheline} uses increased alignment value to match
24801 the cache line size. @samp{compat} is the default.
24802
24803 @item -mlarge-data-threshold=@var{threshold}
24804 @opindex mlarge-data-threshold
24805 When @option{-mcmodel=medium} is specified, data objects larger than
24806 @var{threshold} are placed in the large data section. This value must be the
24807 same across all objects linked into the binary, and defaults to 65535.
24808
24809 @item -mrtd
24810 @opindex mrtd
24811 Use a different function-calling convention, in which functions that
24812 take a fixed number of arguments return with the @code{ret @var{num}}
24813 instruction, which pops their arguments while returning. This saves one
24814 instruction in the caller since there is no need to pop the arguments
24815 there.
24816
24817 You can specify that an individual function is called with this calling
24818 sequence with the function attribute @code{stdcall}. You can also
24819 override the @option{-mrtd} option by using the function attribute
24820 @code{cdecl}. @xref{Function Attributes}.
24821
24822 @strong{Warning:} this calling convention is incompatible with the one
24823 normally used on Unix, so you cannot use it if you need to call
24824 libraries compiled with the Unix compiler.
24825
24826 Also, you must provide function prototypes for all functions that
24827 take variable numbers of arguments (including @code{printf});
24828 otherwise incorrect code is generated for calls to those
24829 functions.
24830
24831 In addition, seriously incorrect code results if you call a
24832 function with too many arguments. (Normally, extra arguments are
24833 harmlessly ignored.)
24834
24835 @item -mregparm=@var{num}
24836 @opindex mregparm
24837 Control how many registers are used to pass integer arguments. By
24838 default, no registers are used to pass arguments, and at most 3
24839 registers can be used. You can control this behavior for a specific
24840 function by using the function attribute @code{regparm}.
24841 @xref{Function Attributes}.
24842
24843 @strong{Warning:} if you use this switch, and
24844 @var{num} is nonzero, then you must build all modules with the same
24845 value, including any libraries. This includes the system libraries and
24846 startup modules.
24847
24848 @item -msseregparm
24849 @opindex msseregparm
24850 Use SSE register passing conventions for float and double arguments
24851 and return values. You can control this behavior for a specific
24852 function by using the function attribute @code{sseregparm}.
24853 @xref{Function Attributes}.
24854
24855 @strong{Warning:} if you use this switch then you must build all
24856 modules with the same value, including any libraries. This includes
24857 the system libraries and startup modules.
24858
24859 @item -mvect8-ret-in-mem
24860 @opindex mvect8-ret-in-mem
24861 Return 8-byte vectors in memory instead of MMX registers. This is the
24862 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
24863 Studio compilers until version 12. Later compiler versions (starting
24864 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
24865 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
24866 you need to remain compatible with existing code produced by those
24867 previous compiler versions or older versions of GCC@.
24868
24869 @item -mpc32
24870 @itemx -mpc64
24871 @itemx -mpc80
24872 @opindex mpc32
24873 @opindex mpc64
24874 @opindex mpc80
24875
24876 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
24877 is specified, the significands of results of floating-point operations are
24878 rounded to 24 bits (single precision); @option{-mpc64} rounds the
24879 significands of results of floating-point operations to 53 bits (double
24880 precision) and @option{-mpc80} rounds the significands of results of
24881 floating-point operations to 64 bits (extended double precision), which is
24882 the default. When this option is used, floating-point operations in higher
24883 precisions are not available to the programmer without setting the FPU
24884 control word explicitly.
24885
24886 Setting the rounding of floating-point operations to less than the default
24887 80 bits can speed some programs by 2% or more. Note that some mathematical
24888 libraries assume that extended-precision (80-bit) floating-point operations
24889 are enabled by default; routines in such libraries could suffer significant
24890 loss of accuracy, typically through so-called ``catastrophic cancellation'',
24891 when this option is used to set the precision to less than extended precision.
24892
24893 @item -mstackrealign
24894 @opindex mstackrealign
24895 Realign the stack at entry. On the x86, the @option{-mstackrealign}
24896 option generates an alternate prologue and epilogue that realigns the
24897 run-time stack if necessary. This supports mixing legacy codes that keep
24898 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
24899 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
24900 applicable to individual functions.
24901
24902 @item -mpreferred-stack-boundary=@var{num}
24903 @opindex mpreferred-stack-boundary
24904 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24905 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24906 the default is 4 (16 bytes or 128 bits).
24907
24908 @strong{Warning:} When generating code for the x86-64 architecture with
24909 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
24910 used to keep the stack boundary aligned to 8 byte boundary. Since
24911 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
24912 intended to be used in controlled environment where stack space is
24913 important limitation. This option leads to wrong code when functions
24914 compiled with 16 byte stack alignment (such as functions from a standard
24915 library) are called with misaligned stack. In this case, SSE
24916 instructions may lead to misaligned memory access traps. In addition,
24917 variable arguments are handled incorrectly for 16 byte aligned
24918 objects (including x87 long double and __int128), leading to wrong
24919 results. You must build all modules with
24920 @option{-mpreferred-stack-boundary=3}, including any libraries. This
24921 includes the system libraries and startup modules.
24922
24923 @item -mincoming-stack-boundary=@var{num}
24924 @opindex mincoming-stack-boundary
24925 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
24926 boundary. If @option{-mincoming-stack-boundary} is not specified,
24927 the one specified by @option{-mpreferred-stack-boundary} is used.
24928
24929 On Pentium and Pentium Pro, @code{double} and @code{long double} values
24930 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
24931 suffer significant run time performance penalties. On Pentium III, the
24932 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
24933 properly if it is not 16-byte aligned.
24934
24935 To ensure proper alignment of this values on the stack, the stack boundary
24936 must be as aligned as that required by any value stored on the stack.
24937 Further, every function must be generated such that it keeps the stack
24938 aligned. Thus calling a function compiled with a higher preferred
24939 stack boundary from a function compiled with a lower preferred stack
24940 boundary most likely misaligns the stack. It is recommended that
24941 libraries that use callbacks always use the default setting.
24942
24943 This extra alignment does consume extra stack space, and generally
24944 increases code size. Code that is sensitive to stack space usage, such
24945 as embedded systems and operating system kernels, may want to reduce the
24946 preferred alignment to @option{-mpreferred-stack-boundary=2}.
24947
24948 @need 200
24949 @item -mmmx
24950 @opindex mmmx
24951 @need 200
24952 @itemx -msse
24953 @opindex msse
24954 @need 200
24955 @itemx -msse2
24956 @opindex msse2
24957 @need 200
24958 @itemx -msse3
24959 @opindex msse3
24960 @need 200
24961 @itemx -mssse3
24962 @opindex mssse3
24963 @need 200
24964 @itemx -msse4
24965 @opindex msse4
24966 @need 200
24967 @itemx -msse4a
24968 @opindex msse4a
24969 @need 200
24970 @itemx -msse4.1
24971 @opindex msse4.1
24972 @need 200
24973 @itemx -msse4.2
24974 @opindex msse4.2
24975 @need 200
24976 @itemx -mavx
24977 @opindex mavx
24978 @need 200
24979 @itemx -mavx2
24980 @opindex mavx2
24981 @need 200
24982 @itemx -mavx512f
24983 @opindex mavx512f
24984 @need 200
24985 @itemx -mavx512pf
24986 @opindex mavx512pf
24987 @need 200
24988 @itemx -mavx512er
24989 @opindex mavx512er
24990 @need 200
24991 @itemx -mavx512cd
24992 @opindex mavx512cd
24993 @need 200
24994 @itemx -mavx512vl
24995 @opindex mavx512vl
24996 @need 200
24997 @itemx -mavx512bw
24998 @opindex mavx512bw
24999 @need 200
25000 @itemx -mavx512dq
25001 @opindex mavx512dq
25002 @need 200
25003 @itemx -mavx512ifma
25004 @opindex mavx512ifma
25005 @need 200
25006 @itemx -mavx512vbmi
25007 @opindex mavx512vbmi
25008 @need 200
25009 @itemx -msha
25010 @opindex msha
25011 @need 200
25012 @itemx -maes
25013 @opindex maes
25014 @need 200
25015 @itemx -mpclmul
25016 @opindex mpclmul
25017 @need 200
25018 @itemx -mclfushopt
25019 @opindex mclfushopt
25020 @need 200
25021 @itemx -mfsgsbase
25022 @opindex mfsgsbase
25023 @need 200
25024 @itemx -mrdrnd
25025 @opindex mrdrnd
25026 @need 200
25027 @itemx -mf16c
25028 @opindex mf16c
25029 @need 200
25030 @itemx -mfma
25031 @opindex mfma
25032 @need 200
25033 @itemx -mfma4
25034 @opindex mfma4
25035 @need 200
25036 @itemx -mprefetchwt1
25037 @opindex mprefetchwt1
25038 @need 200
25039 @itemx -mxop
25040 @opindex mxop
25041 @need 200
25042 @itemx -mlwp
25043 @opindex mlwp
25044 @need 200
25045 @itemx -m3dnow
25046 @opindex m3dnow
25047 @need 200
25048 @itemx -m3dnowa
25049 @opindex m3dnowa
25050 @need 200
25051 @itemx -mpopcnt
25052 @opindex mpopcnt
25053 @need 200
25054 @itemx -mabm
25055 @opindex mabm
25056 @need 200
25057 @itemx -mbmi
25058 @opindex mbmi
25059 @need 200
25060 @itemx -mbmi2
25061 @need 200
25062 @itemx -mlzcnt
25063 @opindex mlzcnt
25064 @need 200
25065 @itemx -mfxsr
25066 @opindex mfxsr
25067 @need 200
25068 @itemx -mxsave
25069 @opindex mxsave
25070 @need 200
25071 @itemx -mxsaveopt
25072 @opindex mxsaveopt
25073 @need 200
25074 @itemx -mxsavec
25075 @opindex mxsavec
25076 @need 200
25077 @itemx -mxsaves
25078 @opindex mxsaves
25079 @need 200
25080 @itemx -mrtm
25081 @opindex mrtm
25082 @need 200
25083 @itemx -mtbm
25084 @opindex mtbm
25085 @need 200
25086 @itemx -mmpx
25087 @opindex mmpx
25088 @need 200
25089 @itemx -mmwaitx
25090 @opindex mmwaitx
25091 @need 200
25092 @itemx -mclzero
25093 @opindex mclzero
25094 @itemx -mpku
25095 @opindex mpku
25096 These switches enable the use of instructions in the MMX, SSE,
25097 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
25098 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
25099 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
25100 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU, 3DNow!@: or enhanced 3DNow!@:
25101 extended instruction sets. Each has a corresponding @option{-mno-} option
25102 to disable use of these instructions.
25103
25104 These extensions are also available as built-in functions: see
25105 @ref{x86 Built-in Functions}, for details of the functions enabled and
25106 disabled by these switches.
25107
25108 To generate SSE/SSE2 instructions automatically from floating-point
25109 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
25110
25111 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
25112 generates new AVX instructions or AVX equivalence for all SSEx instructions
25113 when needed.
25114
25115 These options enable GCC to use these extended instructions in
25116 generated code, even without @option{-mfpmath=sse}. Applications that
25117 perform run-time CPU detection must compile separate files for each
25118 supported architecture, using the appropriate flags. In particular,
25119 the file containing the CPU detection code should be compiled without
25120 these options.
25121
25122 @item -mdump-tune-features
25123 @opindex mdump-tune-features
25124 This option instructs GCC to dump the names of the x86 performance
25125 tuning features and default settings. The names can be used in
25126 @option{-mtune-ctrl=@var{feature-list}}.
25127
25128 @item -mtune-ctrl=@var{feature-list}
25129 @opindex mtune-ctrl=@var{feature-list}
25130 This option is used to do fine grain control of x86 code generation features.
25131 @var{feature-list} is a comma separated list of @var{feature} names. See also
25132 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
25133 on if it is not preceded with @samp{^}, otherwise, it is turned off.
25134 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
25135 developers. Using it may lead to code paths not covered by testing and can
25136 potentially result in compiler ICEs or runtime errors.
25137
25138 @item -mno-default
25139 @opindex mno-default
25140 This option instructs GCC to turn off all tunable features. See also
25141 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
25142
25143 @item -mcld
25144 @opindex mcld
25145 This option instructs GCC to emit a @code{cld} instruction in the prologue
25146 of functions that use string instructions. String instructions depend on
25147 the DF flag to select between autoincrement or autodecrement mode. While the
25148 ABI specifies the DF flag to be cleared on function entry, some operating
25149 systems violate this specification by not clearing the DF flag in their
25150 exception dispatchers. The exception handler can be invoked with the DF flag
25151 set, which leads to wrong direction mode when string instructions are used.
25152 This option can be enabled by default on 32-bit x86 targets by configuring
25153 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
25154 instructions can be suppressed with the @option{-mno-cld} compiler option
25155 in this case.
25156
25157 @item -mvzeroupper
25158 @opindex mvzeroupper
25159 This option instructs GCC to emit a @code{vzeroupper} instruction
25160 before a transfer of control flow out of the function to minimize
25161 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
25162 intrinsics.
25163
25164 @item -mprefer-avx128
25165 @opindex mprefer-avx128
25166 This option instructs GCC to use 128-bit AVX instructions instead of
25167 256-bit AVX instructions in the auto-vectorizer.
25168
25169 @item -mcx16
25170 @opindex mcx16
25171 This option enables GCC to generate @code{CMPXCHG16B} instructions.
25172 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
25173 (or oword) data types.
25174 This is useful for high-resolution counters that can be updated
25175 by multiple processors (or cores). This instruction is generated as part of
25176 atomic built-in functions: see @ref{__sync Builtins} or
25177 @ref{__atomic Builtins} for details.
25178
25179 @item -msahf
25180 @opindex msahf
25181 This option enables generation of @code{SAHF} instructions in 64-bit code.
25182 Early Intel Pentium 4 CPUs with Intel 64 support,
25183 prior to the introduction of Pentium 4 G1 step in December 2005,
25184 lacked the @code{LAHF} and @code{SAHF} instructions
25185 which are supported by AMD64.
25186 These are load and store instructions, respectively, for certain status flags.
25187 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
25188 @code{drem}, and @code{remainder} built-in functions;
25189 see @ref{Other Builtins} for details.
25190
25191 @item -mmovbe
25192 @opindex mmovbe
25193 This option enables use of the @code{movbe} instruction to implement
25194 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
25195
25196 @item -mcrc32
25197 @opindex mcrc32
25198 This option enables built-in functions @code{__builtin_ia32_crc32qi},
25199 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
25200 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
25201
25202 @item -mrecip
25203 @opindex mrecip
25204 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
25205 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
25206 with an additional Newton-Raphson step
25207 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
25208 (and their vectorized
25209 variants) for single-precision floating-point arguments. These instructions
25210 are generated only when @option{-funsafe-math-optimizations} is enabled
25211 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
25212 Note that while the throughput of the sequence is higher than the throughput
25213 of the non-reciprocal instruction, the precision of the sequence can be
25214 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
25215
25216 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
25217 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
25218 combination), and doesn't need @option{-mrecip}.
25219
25220 Also note that GCC emits the above sequence with additional Newton-Raphson step
25221 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
25222 already with @option{-ffast-math} (or the above option combination), and
25223 doesn't need @option{-mrecip}.
25224
25225 @item -mrecip=@var{opt}
25226 @opindex mrecip=opt
25227 This option controls which reciprocal estimate instructions
25228 may be used. @var{opt} is a comma-separated list of options, which may
25229 be preceded by a @samp{!} to invert the option:
25230
25231 @table @samp
25232 @item all
25233 Enable all estimate instructions.
25234
25235 @item default
25236 Enable the default instructions, equivalent to @option{-mrecip}.
25237
25238 @item none
25239 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25240
25241 @item div
25242 Enable the approximation for scalar division.
25243
25244 @item vec-div
25245 Enable the approximation for vectorized division.
25246
25247 @item sqrt
25248 Enable the approximation for scalar square root.
25249
25250 @item vec-sqrt
25251 Enable the approximation for vectorized square root.
25252 @end table
25253
25254 So, for example, @option{-mrecip=all,!sqrt} enables
25255 all of the reciprocal approximations, except for square root.
25256
25257 @item -mveclibabi=@var{type}
25258 @opindex mveclibabi
25259 Specifies the ABI type to use for vectorizing intrinsics using an
25260 external library. Supported values for @var{type} are @samp{svml}
25261 for the Intel short
25262 vector math library and @samp{acml} for the AMD math core library.
25263 To use this option, both @option{-ftree-vectorize} and
25264 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
25265 ABI-compatible library must be specified at link time.
25266
25267 GCC currently emits calls to @code{vmldExp2},
25268 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
25269 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
25270 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
25271 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
25272 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
25273 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
25274 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
25275 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
25276 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
25277 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
25278 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
25279 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
25280 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
25281 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
25282 when @option{-mveclibabi=acml} is used.
25283
25284 @item -mabi=@var{name}
25285 @opindex mabi
25286 Generate code for the specified calling convention. Permissible values
25287 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
25288 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
25289 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
25290 You can control this behavior for specific functions by
25291 using the function attributes @code{ms_abi} and @code{sysv_abi}.
25292 @xref{Function Attributes}.
25293
25294 @item -mtls-dialect=@var{type}
25295 @opindex mtls-dialect
25296 Generate code to access thread-local storage using the @samp{gnu} or
25297 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
25298 @samp{gnu2} is more efficient, but it may add compile- and run-time
25299 requirements that cannot be satisfied on all systems.
25300
25301 @item -mpush-args
25302 @itemx -mno-push-args
25303 @opindex mpush-args
25304 @opindex mno-push-args
25305 Use PUSH operations to store outgoing parameters. This method is shorter
25306 and usually equally fast as method using SUB/MOV operations and is enabled
25307 by default. In some cases disabling it may improve performance because of
25308 improved scheduling and reduced dependencies.
25309
25310 @item -maccumulate-outgoing-args
25311 @opindex maccumulate-outgoing-args
25312 If enabled, the maximum amount of space required for outgoing arguments is
25313 computed in the function prologue. This is faster on most modern CPUs
25314 because of reduced dependencies, improved scheduling and reduced stack usage
25315 when the preferred stack boundary is not equal to 2. The drawback is a notable
25316 increase in code size. This switch implies @option{-mno-push-args}.
25317
25318 @item -mthreads
25319 @opindex mthreads
25320 Support thread-safe exception handling on MinGW. Programs that rely
25321 on thread-safe exception handling must compile and link all code with the
25322 @option{-mthreads} option. When compiling, @option{-mthreads} defines
25323 @option{-D_MT}; when linking, it links in a special thread helper library
25324 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
25325
25326 @item -mms-bitfields
25327 @itemx -mno-ms-bitfields
25328 @opindex mms-bitfields
25329 @opindex mno-ms-bitfields
25330
25331 Enable/disable bit-field layout compatible with the native Microsoft
25332 Windows compiler.
25333
25334 If @code{packed} is used on a structure, or if bit-fields are used,
25335 it may be that the Microsoft ABI lays out the structure differently
25336 than the way GCC normally does. Particularly when moving packed
25337 data between functions compiled with GCC and the native Microsoft compiler
25338 (either via function call or as data in a file), it may be necessary to access
25339 either format.
25340
25341 This option is enabled by default for Microsoft Windows
25342 targets. This behavior can also be controlled locally by use of variable
25343 or type attributes. For more information, see @ref{x86 Variable Attributes}
25344 and @ref{x86 Type Attributes}.
25345
25346 The Microsoft structure layout algorithm is fairly simple with the exception
25347 of the bit-field packing.
25348 The padding and alignment of members of structures and whether a bit-field
25349 can straddle a storage-unit boundary are determine by these rules:
25350
25351 @enumerate
25352 @item Structure members are stored sequentially in the order in which they are
25353 declared: the first member has the lowest memory address and the last member
25354 the highest.
25355
25356 @item Every data object has an alignment requirement. The alignment requirement
25357 for all data except structures, unions, and arrays is either the size of the
25358 object or the current packing size (specified with either the
25359 @code{aligned} attribute or the @code{pack} pragma),
25360 whichever is less. For structures, unions, and arrays,
25361 the alignment requirement is the largest alignment requirement of its members.
25362 Every object is allocated an offset so that:
25363
25364 @smallexample
25365 offset % alignment_requirement == 0
25366 @end smallexample
25367
25368 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
25369 unit if the integral types are the same size and if the next bit-field fits
25370 into the current allocation unit without crossing the boundary imposed by the
25371 common alignment requirements of the bit-fields.
25372 @end enumerate
25373
25374 MSVC interprets zero-length bit-fields in the following ways:
25375
25376 @enumerate
25377 @item If a zero-length bit-field is inserted between two bit-fields that
25378 are normally coalesced, the bit-fields are not coalesced.
25379
25380 For example:
25381
25382 @smallexample
25383 struct
25384 @{
25385 unsigned long bf_1 : 12;
25386 unsigned long : 0;
25387 unsigned long bf_2 : 12;
25388 @} t1;
25389 @end smallexample
25390
25391 @noindent
25392 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
25393 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
25394
25395 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
25396 alignment of the zero-length bit-field is greater than the member that follows it,
25397 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
25398
25399 For example:
25400
25401 @smallexample
25402 struct
25403 @{
25404 char foo : 4;
25405 short : 0;
25406 char bar;
25407 @} t2;
25408
25409 struct
25410 @{
25411 char foo : 4;
25412 short : 0;
25413 double bar;
25414 @} t3;
25415 @end smallexample
25416
25417 @noindent
25418 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
25419 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
25420 bit-field does not affect the alignment of @code{bar} or, as a result, the size
25421 of the structure.
25422
25423 Taking this into account, it is important to note the following:
25424
25425 @enumerate
25426 @item If a zero-length bit-field follows a normal bit-field, the type of the
25427 zero-length bit-field may affect the alignment of the structure as whole. For
25428 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
25429 normal bit-field, and is of type short.
25430
25431 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
25432 still affect the alignment of the structure:
25433
25434 @smallexample
25435 struct
25436 @{
25437 char foo : 6;
25438 long : 0;
25439 @} t4;
25440 @end smallexample
25441
25442 @noindent
25443 Here, @code{t4} takes up 4 bytes.
25444 @end enumerate
25445
25446 @item Zero-length bit-fields following non-bit-field members are ignored:
25447
25448 @smallexample
25449 struct
25450 @{
25451 char foo;
25452 long : 0;
25453 char bar;
25454 @} t5;
25455 @end smallexample
25456
25457 @noindent
25458 Here, @code{t5} takes up 2 bytes.
25459 @end enumerate
25460
25461
25462 @item -mno-align-stringops
25463 @opindex mno-align-stringops
25464 Do not align the destination of inlined string operations. This switch reduces
25465 code size and improves performance in case the destination is already aligned,
25466 but GCC doesn't know about it.
25467
25468 @item -minline-all-stringops
25469 @opindex minline-all-stringops
25470 By default GCC inlines string operations only when the destination is
25471 known to be aligned to least a 4-byte boundary.
25472 This enables more inlining and increases code
25473 size, but may improve performance of code that depends on fast
25474 @code{memcpy}, @code{strlen},
25475 and @code{memset} for short lengths.
25476
25477 @item -minline-stringops-dynamically
25478 @opindex minline-stringops-dynamically
25479 For string operations of unknown size, use run-time checks with
25480 inline code for small blocks and a library call for large blocks.
25481
25482 @item -mstringop-strategy=@var{alg}
25483 @opindex mstringop-strategy=@var{alg}
25484 Override the internal decision heuristic for the particular algorithm to use
25485 for inlining string operations. The allowed values for @var{alg} are:
25486
25487 @table @samp
25488 @item rep_byte
25489 @itemx rep_4byte
25490 @itemx rep_8byte
25491 Expand using i386 @code{rep} prefix of the specified size.
25492
25493 @item byte_loop
25494 @itemx loop
25495 @itemx unrolled_loop
25496 Expand into an inline loop.
25497
25498 @item libcall
25499 Always use a library call.
25500 @end table
25501
25502 @item -mmemcpy-strategy=@var{strategy}
25503 @opindex mmemcpy-strategy=@var{strategy}
25504 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
25505 should be inlined and what inline algorithm to use when the expected size
25506 of the copy operation is known. @var{strategy}
25507 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
25508 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
25509 the max byte size with which inline algorithm @var{alg} is allowed. For the last
25510 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
25511 in the list must be specified in increasing order. The minimal byte size for
25512 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
25513 preceding range.
25514
25515 @item -mmemset-strategy=@var{strategy}
25516 @opindex mmemset-strategy=@var{strategy}
25517 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
25518 @code{__builtin_memset} expansion.
25519
25520 @item -momit-leaf-frame-pointer
25521 @opindex momit-leaf-frame-pointer
25522 Don't keep the frame pointer in a register for leaf functions. This
25523 avoids the instructions to save, set up, and restore frame pointers and
25524 makes an extra register available in leaf functions. The option
25525 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
25526 which might make debugging harder.
25527
25528 @item -mtls-direct-seg-refs
25529 @itemx -mno-tls-direct-seg-refs
25530 @opindex mtls-direct-seg-refs
25531 Controls whether TLS variables may be accessed with offsets from the
25532 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
25533 or whether the thread base pointer must be added. Whether or not this
25534 is valid depends on the operating system, and whether it maps the
25535 segment to cover the entire TLS area.
25536
25537 For systems that use the GNU C Library, the default is on.
25538
25539 @item -msse2avx
25540 @itemx -mno-sse2avx
25541 @opindex msse2avx
25542 Specify that the assembler should encode SSE instructions with VEX
25543 prefix. The option @option{-mavx} turns this on by default.
25544
25545 @item -mfentry
25546 @itemx -mno-fentry
25547 @opindex mfentry
25548 If profiling is active (@option{-pg}), put the profiling
25549 counter call before the prologue.
25550 Note: On x86 architectures the attribute @code{ms_hook_prologue}
25551 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
25552
25553 @item -mrecord-mcount
25554 @itemx -mno-record-mcount
25555 @opindex mrecord-mcount
25556 If profiling is active (@option{-pg}), generate a __mcount_loc section
25557 that contains pointers to each profiling call. This is useful for
25558 automatically patching and out calls.
25559
25560 @item -mnop-mcount
25561 @itemx -mno-nop-mcount
25562 @opindex mnop-mcount
25563 If profiling is active (@option{-pg}), generate the calls to
25564 the profiling functions as NOPs. This is useful when they
25565 should be patched in later dynamically. This is likely only
25566 useful together with @option{-mrecord-mcount}.
25567
25568 @item -mskip-rax-setup
25569 @itemx -mno-skip-rax-setup
25570 @opindex mskip-rax-setup
25571 When generating code for the x86-64 architecture with SSE extensions
25572 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
25573 register when there are no variable arguments passed in vector registers.
25574
25575 @strong{Warning:} Since RAX register is used to avoid unnecessarily
25576 saving vector registers on stack when passing variable arguments, the
25577 impacts of this option are callees may waste some stack space,
25578 misbehave or jump to a random location. GCC 4.4 or newer don't have
25579 those issues, regardless the RAX register value.
25580
25581 @item -m8bit-idiv
25582 @itemx -mno-8bit-idiv
25583 @opindex m8bit-idiv
25584 On some processors, like Intel Atom, 8-bit unsigned integer divide is
25585 much faster than 32-bit/64-bit integer divide. This option generates a
25586 run-time check. If both dividend and divisor are within range of 0
25587 to 255, 8-bit unsigned integer divide is used instead of
25588 32-bit/64-bit integer divide.
25589
25590 @item -mavx256-split-unaligned-load
25591 @itemx -mavx256-split-unaligned-store
25592 @opindex mavx256-split-unaligned-load
25593 @opindex mavx256-split-unaligned-store
25594 Split 32-byte AVX unaligned load and store.
25595
25596 @item -mstack-protector-guard=@var{guard}
25597 @opindex mstack-protector-guard=@var{guard}
25598 Generate stack protection code using canary at @var{guard}. Supported
25599 locations are @samp{global} for global canary or @samp{tls} for per-thread
25600 canary in the TLS block (the default). This option has effect only when
25601 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
25602
25603 @item -mmitigate-rop
25604 @opindex mmitigate-rop
25605 Try to avoid generating code sequences that contain unintended return
25606 opcodes, to mitigate against certain forms of attack. At the moment,
25607 this option is limited in what it can do and should not be relied
25608 on to provide serious protection.
25609
25610 @item -mgeneral-regs-only
25611 @opindex mgeneral-regs-only
25612 Generate code that uses only the general-purpose registers. This
25613 prevents the compiler from using floating-point, vector, mask and bound
25614 registers.
25615
25616 @end table
25617
25618 These @samp{-m} switches are supported in addition to the above
25619 on x86-64 processors in 64-bit environments.
25620
25621 @table @gcctabopt
25622 @item -m32
25623 @itemx -m64
25624 @itemx -mx32
25625 @itemx -m16
25626 @itemx -miamcu
25627 @opindex m32
25628 @opindex m64
25629 @opindex mx32
25630 @opindex m16
25631 @opindex miamcu
25632 Generate code for a 16-bit, 32-bit or 64-bit environment.
25633 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
25634 to 32 bits, and
25635 generates code that runs on any i386 system.
25636
25637 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
25638 types to 64 bits, and generates code for the x86-64 architecture.
25639 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
25640 and @option{-mdynamic-no-pic} options.
25641
25642 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
25643 to 32 bits, and
25644 generates code for the x86-64 architecture.
25645
25646 The @option{-m16} option is the same as @option{-m32}, except for that
25647 it outputs the @code{.code16gcc} assembly directive at the beginning of
25648 the assembly output so that the binary can run in 16-bit mode.
25649
25650 The @option{-miamcu} option generates code which conforms to Intel MCU
25651 psABI. It requires the @option{-m32} option to be turned on.
25652
25653 @item -mno-red-zone
25654 @opindex mno-red-zone
25655 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
25656 by the x86-64 ABI; it is a 128-byte area beyond the location of the
25657 stack pointer that is not modified by signal or interrupt handlers
25658 and therefore can be used for temporary data without adjusting the stack
25659 pointer. The flag @option{-mno-red-zone} disables this red zone.
25660
25661 @item -mcmodel=small
25662 @opindex mcmodel=small
25663 Generate code for the small code model: the program and its symbols must
25664 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
25665 Programs can be statically or dynamically linked. This is the default
25666 code model.
25667
25668 @item -mcmodel=kernel
25669 @opindex mcmodel=kernel
25670 Generate code for the kernel code model. The kernel runs in the
25671 negative 2 GB of the address space.
25672 This model has to be used for Linux kernel code.
25673
25674 @item -mcmodel=medium
25675 @opindex mcmodel=medium
25676 Generate code for the medium model: the program is linked in the lower 2
25677 GB of the address space. Small symbols are also placed there. Symbols
25678 with sizes larger than @option{-mlarge-data-threshold} are put into
25679 large data or BSS sections and can be located above 2GB. Programs can
25680 be statically or dynamically linked.
25681
25682 @item -mcmodel=large
25683 @opindex mcmodel=large
25684 Generate code for the large model. This model makes no assumptions
25685 about addresses and sizes of sections.
25686
25687 @item -maddress-mode=long
25688 @opindex maddress-mode=long
25689 Generate code for long address mode. This is only supported for 64-bit
25690 and x32 environments. It is the default address mode for 64-bit
25691 environments.
25692
25693 @item -maddress-mode=short
25694 @opindex maddress-mode=short
25695 Generate code for short address mode. This is only supported for 32-bit
25696 and x32 environments. It is the default address mode for 32-bit and
25697 x32 environments.
25698 @end table
25699
25700 @node x86 Windows Options
25701 @subsection x86 Windows Options
25702 @cindex x86 Windows Options
25703 @cindex Windows Options for x86
25704
25705 These additional options are available for Microsoft Windows targets:
25706
25707 @table @gcctabopt
25708 @item -mconsole
25709 @opindex mconsole
25710 This option
25711 specifies that a console application is to be generated, by
25712 instructing the linker to set the PE header subsystem type
25713 required for console applications.
25714 This option is available for Cygwin and MinGW targets and is
25715 enabled by default on those targets.
25716
25717 @item -mdll
25718 @opindex mdll
25719 This option is available for Cygwin and MinGW targets. It
25720 specifies that a DLL---a dynamic link library---is to be
25721 generated, enabling the selection of the required runtime
25722 startup object and entry point.
25723
25724 @item -mnop-fun-dllimport
25725 @opindex mnop-fun-dllimport
25726 This option is available for Cygwin and MinGW targets. It
25727 specifies that the @code{dllimport} attribute should be ignored.
25728
25729 @item -mthread
25730 @opindex mthread
25731 This option is available for MinGW targets. It specifies
25732 that MinGW-specific thread support is to be used.
25733
25734 @item -municode
25735 @opindex municode
25736 This option is available for MinGW-w64 targets. It causes
25737 the @code{UNICODE} preprocessor macro to be predefined, and
25738 chooses Unicode-capable runtime startup code.
25739
25740 @item -mwin32
25741 @opindex mwin32
25742 This option is available for Cygwin and MinGW targets. It
25743 specifies that the typical Microsoft Windows predefined macros are to
25744 be set in the pre-processor, but does not influence the choice
25745 of runtime library/startup code.
25746
25747 @item -mwindows
25748 @opindex mwindows
25749 This option is available for Cygwin and MinGW targets. It
25750 specifies that a GUI application is to be generated by
25751 instructing the linker to set the PE header subsystem type
25752 appropriately.
25753
25754 @item -fno-set-stack-executable
25755 @opindex fno-set-stack-executable
25756 This option is available for MinGW targets. It specifies that
25757 the executable flag for the stack used by nested functions isn't
25758 set. This is necessary for binaries running in kernel mode of
25759 Microsoft Windows, as there the User32 API, which is used to set executable
25760 privileges, isn't available.
25761
25762 @item -fwritable-relocated-rdata
25763 @opindex fno-writable-relocated-rdata
25764 This option is available for MinGW and Cygwin targets. It specifies
25765 that relocated-data in read-only section is put into the @code{.data}
25766 section. This is a necessary for older runtimes not supporting
25767 modification of @code{.rdata} sections for pseudo-relocation.
25768
25769 @item -mpe-aligned-commons
25770 @opindex mpe-aligned-commons
25771 This option is available for Cygwin and MinGW targets. It
25772 specifies that the GNU extension to the PE file format that
25773 permits the correct alignment of COMMON variables should be
25774 used when generating code. It is enabled by default if
25775 GCC detects that the target assembler found during configuration
25776 supports the feature.
25777 @end table
25778
25779 See also under @ref{x86 Options} for standard options.
25780
25781 @node Xstormy16 Options
25782 @subsection Xstormy16 Options
25783 @cindex Xstormy16 Options
25784
25785 These options are defined for Xstormy16:
25786
25787 @table @gcctabopt
25788 @item -msim
25789 @opindex msim
25790 Choose startup files and linker script suitable for the simulator.
25791 @end table
25792
25793 @node Xtensa Options
25794 @subsection Xtensa Options
25795 @cindex Xtensa Options
25796
25797 These options are supported for Xtensa targets:
25798
25799 @table @gcctabopt
25800 @item -mconst16
25801 @itemx -mno-const16
25802 @opindex mconst16
25803 @opindex mno-const16
25804 Enable or disable use of @code{CONST16} instructions for loading
25805 constant values. The @code{CONST16} instruction is currently not a
25806 standard option from Tensilica. When enabled, @code{CONST16}
25807 instructions are always used in place of the standard @code{L32R}
25808 instructions. The use of @code{CONST16} is enabled by default only if
25809 the @code{L32R} instruction is not available.
25810
25811 @item -mfused-madd
25812 @itemx -mno-fused-madd
25813 @opindex mfused-madd
25814 @opindex mno-fused-madd
25815 Enable or disable use of fused multiply/add and multiply/subtract
25816 instructions in the floating-point option. This has no effect if the
25817 floating-point option is not also enabled. Disabling fused multiply/add
25818 and multiply/subtract instructions forces the compiler to use separate
25819 instructions for the multiply and add/subtract operations. This may be
25820 desirable in some cases where strict IEEE 754-compliant results are
25821 required: the fused multiply add/subtract instructions do not round the
25822 intermediate result, thereby producing results with @emph{more} bits of
25823 precision than specified by the IEEE standard. Disabling fused multiply
25824 add/subtract instructions also ensures that the program output is not
25825 sensitive to the compiler's ability to combine multiply and add/subtract
25826 operations.
25827
25828 @item -mserialize-volatile
25829 @itemx -mno-serialize-volatile
25830 @opindex mserialize-volatile
25831 @opindex mno-serialize-volatile
25832 When this option is enabled, GCC inserts @code{MEMW} instructions before
25833 @code{volatile} memory references to guarantee sequential consistency.
25834 The default is @option{-mserialize-volatile}. Use
25835 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
25836
25837 @item -mforce-no-pic
25838 @opindex mforce-no-pic
25839 For targets, like GNU/Linux, where all user-mode Xtensa code must be
25840 position-independent code (PIC), this option disables PIC for compiling
25841 kernel code.
25842
25843 @item -mtext-section-literals
25844 @itemx -mno-text-section-literals
25845 @opindex mtext-section-literals
25846 @opindex mno-text-section-literals
25847 These options control the treatment of literal pools. The default is
25848 @option{-mno-text-section-literals}, which places literals in a separate
25849 section in the output file. This allows the literal pool to be placed
25850 in a data RAM/ROM, and it also allows the linker to combine literal
25851 pools from separate object files to remove redundant literals and
25852 improve code size. With @option{-mtext-section-literals}, the literals
25853 are interspersed in the text section in order to keep them as close as
25854 possible to their references. This may be necessary for large assembly
25855 files. Literals for each function are placed right before that function.
25856
25857 @item -mauto-litpools
25858 @itemx -mno-auto-litpools
25859 @opindex mauto-litpools
25860 @opindex mno-auto-litpools
25861 These options control the treatment of literal pools. The default is
25862 @option{-mno-auto-litpools}, which places literals in a separate
25863 section in the output file unless @option{-mtext-section-literals} is
25864 used. With @option{-mauto-litpools} the literals are interspersed in
25865 the text section by the assembler. Compiler does not produce explicit
25866 @code{.literal} directives and loads literals into registers with
25867 @code{MOVI} instructions instead of @code{L32R} to let the assembler
25868 do relaxation and place literals as necessary. This option allows
25869 assembler to create several literal pools per function and assemble
25870 very big functions, which may not be possible with
25871 @option{-mtext-section-literals}.
25872
25873 @item -mtarget-align
25874 @itemx -mno-target-align
25875 @opindex mtarget-align
25876 @opindex mno-target-align
25877 When this option is enabled, GCC instructs the assembler to
25878 automatically align instructions to reduce branch penalties at the
25879 expense of some code density. The assembler attempts to widen density
25880 instructions to align branch targets and the instructions following call
25881 instructions. If there are not enough preceding safe density
25882 instructions to align a target, no widening is performed. The
25883 default is @option{-mtarget-align}. These options do not affect the
25884 treatment of auto-aligned instructions like @code{LOOP}, which the
25885 assembler always aligns, either by widening density instructions or
25886 by inserting NOP instructions.
25887
25888 @item -mlongcalls
25889 @itemx -mno-longcalls
25890 @opindex mlongcalls
25891 @opindex mno-longcalls
25892 When this option is enabled, GCC instructs the assembler to translate
25893 direct calls to indirect calls unless it can determine that the target
25894 of a direct call is in the range allowed by the call instruction. This
25895 translation typically occurs for calls to functions in other source
25896 files. Specifically, the assembler translates a direct @code{CALL}
25897 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
25898 The default is @option{-mno-longcalls}. This option should be used in
25899 programs where the call target can potentially be out of range. This
25900 option is implemented in the assembler, not the compiler, so the
25901 assembly code generated by GCC still shows direct call
25902 instructions---look at the disassembled object code to see the actual
25903 instructions. Note that the assembler uses an indirect call for
25904 every cross-file call, not just those that really are out of range.
25905 @end table
25906
25907 @node zSeries Options
25908 @subsection zSeries Options
25909 @cindex zSeries options
25910
25911 These are listed under @xref{S/390 and zSeries Options}.
25912
25913
25914 @c man end
25915
25916 @node Spec Files
25917 @section Specifying Subprocesses and the Switches to Pass to Them
25918 @cindex Spec Files
25919
25920 @command{gcc} is a driver program. It performs its job by invoking a
25921 sequence of other programs to do the work of compiling, assembling and
25922 linking. GCC interprets its command-line parameters and uses these to
25923 deduce which programs it should invoke, and which command-line options
25924 it ought to place on their command lines. This behavior is controlled
25925 by @dfn{spec strings}. In most cases there is one spec string for each
25926 program that GCC can invoke, but a few programs have multiple spec
25927 strings to control their behavior. The spec strings built into GCC can
25928 be overridden by using the @option{-specs=} command-line switch to specify
25929 a spec file.
25930
25931 @dfn{Spec files} are plain-text files that are used to construct spec
25932 strings. They consist of a sequence of directives separated by blank
25933 lines. The type of directive is determined by the first non-whitespace
25934 character on the line, which can be one of the following:
25935
25936 @table @code
25937 @item %@var{command}
25938 Issues a @var{command} to the spec file processor. The commands that can
25939 appear here are:
25940
25941 @table @code
25942 @item %include <@var{file}>
25943 @cindex @code{%include}
25944 Search for @var{file} and insert its text at the current point in the
25945 specs file.
25946
25947 @item %include_noerr <@var{file}>
25948 @cindex @code{%include_noerr}
25949 Just like @samp{%include}, but do not generate an error message if the include
25950 file cannot be found.
25951
25952 @item %rename @var{old_name} @var{new_name}
25953 @cindex @code{%rename}
25954 Rename the spec string @var{old_name} to @var{new_name}.
25955
25956 @end table
25957
25958 @item *[@var{spec_name}]:
25959 This tells the compiler to create, override or delete the named spec
25960 string. All lines after this directive up to the next directive or
25961 blank line are considered to be the text for the spec string. If this
25962 results in an empty string then the spec is deleted. (Or, if the
25963 spec did not exist, then nothing happens.) Otherwise, if the spec
25964 does not currently exist a new spec is created. If the spec does
25965 exist then its contents are overridden by the text of this
25966 directive, unless the first character of that text is the @samp{+}
25967 character, in which case the text is appended to the spec.
25968
25969 @item [@var{suffix}]:
25970 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
25971 and up to the next directive or blank line are considered to make up the
25972 spec string for the indicated suffix. When the compiler encounters an
25973 input file with the named suffix, it processes the spec string in
25974 order to work out how to compile that file. For example:
25975
25976 @smallexample
25977 .ZZ:
25978 z-compile -input %i
25979 @end smallexample
25980
25981 This says that any input file whose name ends in @samp{.ZZ} should be
25982 passed to the program @samp{z-compile}, which should be invoked with the
25983 command-line switch @option{-input} and with the result of performing the
25984 @samp{%i} substitution. (See below.)
25985
25986 As an alternative to providing a spec string, the text following a
25987 suffix directive can be one of the following:
25988
25989 @table @code
25990 @item @@@var{language}
25991 This says that the suffix is an alias for a known @var{language}. This is
25992 similar to using the @option{-x} command-line switch to GCC to specify a
25993 language explicitly. For example:
25994
25995 @smallexample
25996 .ZZ:
25997 @@c++
25998 @end smallexample
25999
26000 Says that .ZZ files are, in fact, C++ source files.
26001
26002 @item #@var{name}
26003 This causes an error messages saying:
26004
26005 @smallexample
26006 @var{name} compiler not installed on this system.
26007 @end smallexample
26008 @end table
26009
26010 GCC already has an extensive list of suffixes built into it.
26011 This directive adds an entry to the end of the list of suffixes, but
26012 since the list is searched from the end backwards, it is effectively
26013 possible to override earlier entries using this technique.
26014
26015 @end table
26016
26017 GCC has the following spec strings built into it. Spec files can
26018 override these strings or create their own. Note that individual
26019 targets can also add their own spec strings to this list.
26020
26021 @smallexample
26022 asm Options to pass to the assembler
26023 asm_final Options to pass to the assembler post-processor
26024 cpp Options to pass to the C preprocessor
26025 cc1 Options to pass to the C compiler
26026 cc1plus Options to pass to the C++ compiler
26027 endfile Object files to include at the end of the link
26028 link Options to pass to the linker
26029 lib Libraries to include on the command line to the linker
26030 libgcc Decides which GCC support library to pass to the linker
26031 linker Sets the name of the linker
26032 predefines Defines to be passed to the C preprocessor
26033 signed_char Defines to pass to CPP to say whether @code{char} is signed
26034 by default
26035 startfile Object files to include at the start of the link
26036 @end smallexample
26037
26038 Here is a small example of a spec file:
26039
26040 @smallexample
26041 %rename lib old_lib
26042
26043 *lib:
26044 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
26045 @end smallexample
26046
26047 This example renames the spec called @samp{lib} to @samp{old_lib} and
26048 then overrides the previous definition of @samp{lib} with a new one.
26049 The new definition adds in some extra command-line options before
26050 including the text of the old definition.
26051
26052 @dfn{Spec strings} are a list of command-line options to be passed to their
26053 corresponding program. In addition, the spec strings can contain
26054 @samp{%}-prefixed sequences to substitute variable text or to
26055 conditionally insert text into the command line. Using these constructs
26056 it is possible to generate quite complex command lines.
26057
26058 Here is a table of all defined @samp{%}-sequences for spec
26059 strings. Note that spaces are not generated automatically around the
26060 results of expanding these sequences. Therefore you can concatenate them
26061 together or combine them with constant text in a single argument.
26062
26063 @table @code
26064 @item %%
26065 Substitute one @samp{%} into the program name or argument.
26066
26067 @item %i
26068 Substitute the name of the input file being processed.
26069
26070 @item %b
26071 Substitute the basename of the input file being processed.
26072 This is the substring up to (and not including) the last period
26073 and not including the directory.
26074
26075 @item %B
26076 This is the same as @samp{%b}, but include the file suffix (text after
26077 the last period).
26078
26079 @item %d
26080 Marks the argument containing or following the @samp{%d} as a
26081 temporary file name, so that that file is deleted if GCC exits
26082 successfully. Unlike @samp{%g}, this contributes no text to the
26083 argument.
26084
26085 @item %g@var{suffix}
26086 Substitute a file name that has suffix @var{suffix} and is chosen
26087 once per compilation, and mark the argument in the same way as
26088 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
26089 name is now chosen in a way that is hard to predict even when previously
26090 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
26091 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
26092 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
26093 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
26094 was simply substituted with a file name chosen once per compilation,
26095 without regard to any appended suffix (which was therefore treated
26096 just like ordinary text), making such attacks more likely to succeed.
26097
26098 @item %u@var{suffix}
26099 Like @samp{%g}, but generates a new temporary file name
26100 each time it appears instead of once per compilation.
26101
26102 @item %U@var{suffix}
26103 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
26104 new one if there is no such last file name. In the absence of any
26105 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
26106 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
26107 involves the generation of two distinct file names, one
26108 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
26109 simply substituted with a file name chosen for the previous @samp{%u},
26110 without regard to any appended suffix.
26111
26112 @item %j@var{suffix}
26113 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
26114 writable, and if @option{-save-temps} is not used;
26115 otherwise, substitute the name
26116 of a temporary file, just like @samp{%u}. This temporary file is not
26117 meant for communication between processes, but rather as a junk
26118 disposal mechanism.
26119
26120 @item %|@var{suffix}
26121 @itemx %m@var{suffix}
26122 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
26123 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
26124 all. These are the two most common ways to instruct a program that it
26125 should read from standard input or write to standard output. If you
26126 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
26127 construct: see for example @file{f/lang-specs.h}.
26128
26129 @item %.@var{SUFFIX}
26130 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
26131 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
26132 terminated by the next space or %.
26133
26134 @item %w
26135 Marks the argument containing or following the @samp{%w} as the
26136 designated output file of this compilation. This puts the argument
26137 into the sequence of arguments that @samp{%o} substitutes.
26138
26139 @item %o
26140 Substitutes the names of all the output files, with spaces
26141 automatically placed around them. You should write spaces
26142 around the @samp{%o} as well or the results are undefined.
26143 @samp{%o} is for use in the specs for running the linker.
26144 Input files whose names have no recognized suffix are not compiled
26145 at all, but they are included among the output files, so they are
26146 linked.
26147
26148 @item %O
26149 Substitutes the suffix for object files. Note that this is
26150 handled specially when it immediately follows @samp{%g, %u, or %U},
26151 because of the need for those to form complete file names. The
26152 handling is such that @samp{%O} is treated exactly as if it had already
26153 been substituted, except that @samp{%g, %u, and %U} do not currently
26154 support additional @var{suffix} characters following @samp{%O} as they do
26155 following, for example, @samp{.o}.
26156
26157 @item %p
26158 Substitutes the standard macro predefinitions for the
26159 current target machine. Use this when running @command{cpp}.
26160
26161 @item %P
26162 Like @samp{%p}, but puts @samp{__} before and after the name of each
26163 predefined macro, except for macros that start with @samp{__} or with
26164 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
26165 C@.
26166
26167 @item %I
26168 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
26169 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
26170 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
26171 and @option{-imultilib} as necessary.
26172
26173 @item %s
26174 Current argument is the name of a library or startup file of some sort.
26175 Search for that file in a standard list of directories and substitute
26176 the full name found. The current working directory is included in the
26177 list of directories scanned.
26178
26179 @item %T
26180 Current argument is the name of a linker script. Search for that file
26181 in the current list of directories to scan for libraries. If the file
26182 is located insert a @option{--script} option into the command line
26183 followed by the full path name found. If the file is not found then
26184 generate an error message. Note: the current working directory is not
26185 searched.
26186
26187 @item %e@var{str}
26188 Print @var{str} as an error message. @var{str} is terminated by a newline.
26189 Use this when inconsistent options are detected.
26190
26191 @item %(@var{name})
26192 Substitute the contents of spec string @var{name} at this point.
26193
26194 @item %x@{@var{option}@}
26195 Accumulate an option for @samp{%X}.
26196
26197 @item %X
26198 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
26199 spec string.
26200
26201 @item %Y
26202 Output the accumulated assembler options specified by @option{-Wa}.
26203
26204 @item %Z
26205 Output the accumulated preprocessor options specified by @option{-Wp}.
26206
26207 @item %a
26208 Process the @code{asm} spec. This is used to compute the
26209 switches to be passed to the assembler.
26210
26211 @item %A
26212 Process the @code{asm_final} spec. This is a spec string for
26213 passing switches to an assembler post-processor, if such a program is
26214 needed.
26215
26216 @item %l
26217 Process the @code{link} spec. This is the spec for computing the
26218 command line passed to the linker. Typically it makes use of the
26219 @samp{%L %G %S %D and %E} sequences.
26220
26221 @item %D
26222 Dump out a @option{-L} option for each directory that GCC believes might
26223 contain startup files. If the target supports multilibs then the
26224 current multilib directory is prepended to each of these paths.
26225
26226 @item %L
26227 Process the @code{lib} spec. This is a spec string for deciding which
26228 libraries are included on the command line to the linker.
26229
26230 @item %G
26231 Process the @code{libgcc} spec. This is a spec string for deciding
26232 which GCC support library is included on the command line to the linker.
26233
26234 @item %S
26235 Process the @code{startfile} spec. This is a spec for deciding which
26236 object files are the first ones passed to the linker. Typically
26237 this might be a file named @file{crt0.o}.
26238
26239 @item %E
26240 Process the @code{endfile} spec. This is a spec string that specifies
26241 the last object files that are passed to the linker.
26242
26243 @item %C
26244 Process the @code{cpp} spec. This is used to construct the arguments
26245 to be passed to the C preprocessor.
26246
26247 @item %1
26248 Process the @code{cc1} spec. This is used to construct the options to be
26249 passed to the actual C compiler (@command{cc1}).
26250
26251 @item %2
26252 Process the @code{cc1plus} spec. This is used to construct the options to be
26253 passed to the actual C++ compiler (@command{cc1plus}).
26254
26255 @item %*
26256 Substitute the variable part of a matched option. See below.
26257 Note that each comma in the substituted string is replaced by
26258 a single space.
26259
26260 @item %<@code{S}
26261 Remove all occurrences of @code{-S} from the command line. Note---this
26262 command is position dependent. @samp{%} commands in the spec string
26263 before this one see @code{-S}, @samp{%} commands in the spec string
26264 after this one do not.
26265
26266 @item %:@var{function}(@var{args})
26267 Call the named function @var{function}, passing it @var{args}.
26268 @var{args} is first processed as a nested spec string, then split
26269 into an argument vector in the usual fashion. The function returns
26270 a string which is processed as if it had appeared literally as part
26271 of the current spec.
26272
26273 The following built-in spec functions are provided:
26274
26275 @table @code
26276 @item @code{getenv}
26277 The @code{getenv} spec function takes two arguments: an environment
26278 variable name and a string. If the environment variable is not
26279 defined, a fatal error is issued. Otherwise, the return value is the
26280 value of the environment variable concatenated with the string. For
26281 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
26282
26283 @smallexample
26284 %:getenv(TOPDIR /include)
26285 @end smallexample
26286
26287 expands to @file{/path/to/top/include}.
26288
26289 @item @code{if-exists}
26290 The @code{if-exists} spec function takes one argument, an absolute
26291 pathname to a file. If the file exists, @code{if-exists} returns the
26292 pathname. Here is a small example of its usage:
26293
26294 @smallexample
26295 *startfile:
26296 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
26297 @end smallexample
26298
26299 @item @code{if-exists-else}
26300 The @code{if-exists-else} spec function is similar to the @code{if-exists}
26301 spec function, except that it takes two arguments. The first argument is
26302 an absolute pathname to a file. If the file exists, @code{if-exists-else}
26303 returns the pathname. If it does not exist, it returns the second argument.
26304 This way, @code{if-exists-else} can be used to select one file or another,
26305 based on the existence of the first. Here is a small example of its usage:
26306
26307 @smallexample
26308 *startfile:
26309 crt0%O%s %:if-exists(crti%O%s) \
26310 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
26311 @end smallexample
26312
26313 @item @code{replace-outfile}
26314 The @code{replace-outfile} spec function takes two arguments. It looks for the
26315 first argument in the outfiles array and replaces it with the second argument. Here
26316 is a small example of its usage:
26317
26318 @smallexample
26319 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
26320 @end smallexample
26321
26322 @item @code{remove-outfile}
26323 The @code{remove-outfile} spec function takes one argument. It looks for the
26324 first argument in the outfiles array and removes it. Here is a small example
26325 its usage:
26326
26327 @smallexample
26328 %:remove-outfile(-lm)
26329 @end smallexample
26330
26331 @item @code{pass-through-libs}
26332 The @code{pass-through-libs} spec function takes any number of arguments. It
26333 finds any @option{-l} options and any non-options ending in @file{.a} (which it
26334 assumes are the names of linker input library archive files) and returns a
26335 result containing all the found arguments each prepended by
26336 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
26337 intended to be passed to the LTO linker plugin.
26338
26339 @smallexample
26340 %:pass-through-libs(%G %L %G)
26341 @end smallexample
26342
26343 @item @code{print-asm-header}
26344 The @code{print-asm-header} function takes no arguments and simply
26345 prints a banner like:
26346
26347 @smallexample
26348 Assembler options
26349 =================
26350
26351 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
26352 @end smallexample
26353
26354 It is used to separate compiler options from assembler options
26355 in the @option{--target-help} output.
26356 @end table
26357
26358 @item %@{@code{S}@}
26359 Substitutes the @code{-S} switch, if that switch is given to GCC@.
26360 If that switch is not specified, this substitutes nothing. Note that
26361 the leading dash is omitted when specifying this option, and it is
26362 automatically inserted if the substitution is performed. Thus the spec
26363 string @samp{%@{foo@}} matches the command-line option @option{-foo}
26364 and outputs the command-line option @option{-foo}.
26365
26366 @item %W@{@code{S}@}
26367 Like %@{@code{S}@} but mark last argument supplied within as a file to be
26368 deleted on failure.
26369
26370 @item %@{@code{S}*@}
26371 Substitutes all the switches specified to GCC whose names start
26372 with @code{-S}, but which also take an argument. This is used for
26373 switches like @option{-o}, @option{-D}, @option{-I}, etc.
26374 GCC considers @option{-o foo} as being
26375 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
26376 text, including the space. Thus two arguments are generated.
26377
26378 @item %@{@code{S}*&@code{T}*@}
26379 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
26380 (the order of @code{S} and @code{T} in the spec is not significant).
26381 There can be any number of ampersand-separated variables; for each the
26382 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
26383
26384 @item %@{@code{S}:@code{X}@}
26385 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
26386
26387 @item %@{!@code{S}:@code{X}@}
26388 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
26389
26390 @item %@{@code{S}*:@code{X}@}
26391 Substitutes @code{X} if one or more switches whose names start with
26392 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
26393 once, no matter how many such switches appeared. However, if @code{%*}
26394 appears somewhere in @code{X}, then @code{X} is substituted once
26395 for each matching switch, with the @code{%*} replaced by the part of
26396 that switch matching the @code{*}.
26397
26398 If @code{%*} appears as the last part of a spec sequence then a space
26399 is added after the end of the last substitution. If there is more
26400 text in the sequence, however, then a space is not generated. This
26401 allows the @code{%*} substitution to be used as part of a larger
26402 string. For example, a spec string like this:
26403
26404 @smallexample
26405 %@{mcu=*:--script=%*/memory.ld@}
26406 @end smallexample
26407
26408 @noindent
26409 when matching an option like @option{-mcu=newchip} produces:
26410
26411 @smallexample
26412 --script=newchip/memory.ld
26413 @end smallexample
26414
26415 @item %@{.@code{S}:@code{X}@}
26416 Substitutes @code{X}, if processing a file with suffix @code{S}.
26417
26418 @item %@{!.@code{S}:@code{X}@}
26419 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
26420
26421 @item %@{,@code{S}:@code{X}@}
26422 Substitutes @code{X}, if processing a file for language @code{S}.
26423
26424 @item %@{!,@code{S}:@code{X}@}
26425 Substitutes @code{X}, if not processing a file for language @code{S}.
26426
26427 @item %@{@code{S}|@code{P}:@code{X}@}
26428 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
26429 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
26430 @code{*} sequences as well, although they have a stronger binding than
26431 the @samp{|}. If @code{%*} appears in @code{X}, all of the
26432 alternatives must be starred, and only the first matching alternative
26433 is substituted.
26434
26435 For example, a spec string like this:
26436
26437 @smallexample
26438 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
26439 @end smallexample
26440
26441 @noindent
26442 outputs the following command-line options from the following input
26443 command-line options:
26444
26445 @smallexample
26446 fred.c -foo -baz
26447 jim.d -bar -boggle
26448 -d fred.c -foo -baz -boggle
26449 -d jim.d -bar -baz -boggle
26450 @end smallexample
26451
26452 @item %@{S:X; T:Y; :D@}
26453
26454 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
26455 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
26456 be as many clauses as you need. This may be combined with @code{.},
26457 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
26458
26459
26460 @end table
26461
26462 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
26463 construct may contain other nested @samp{%} constructs or spaces, or
26464 even newlines. They are processed as usual, as described above.
26465 Trailing white space in @code{X} is ignored. White space may also
26466 appear anywhere on the left side of the colon in these constructs,
26467 except between @code{.} or @code{*} and the corresponding word.
26468
26469 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
26470 handled specifically in these constructs. If another value of
26471 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
26472 @option{-W} switch is found later in the command line, the earlier
26473 switch value is ignored, except with @{@code{S}*@} where @code{S} is
26474 just one letter, which passes all matching options.
26475
26476 The character @samp{|} at the beginning of the predicate text is used to
26477 indicate that a command should be piped to the following command, but
26478 only if @option{-pipe} is specified.
26479
26480 It is built into GCC which switches take arguments and which do not.
26481 (You might think it would be useful to generalize this to allow each
26482 compiler's spec to say which switches take arguments. But this cannot
26483 be done in a consistent fashion. GCC cannot even decide which input
26484 files have been specified without knowing which switches take arguments,
26485 and it must know which input files to compile in order to tell which
26486 compilers to run).
26487
26488 GCC also knows implicitly that arguments starting in @option{-l} are to be
26489 treated as compiler output files, and passed to the linker in their
26490 proper position among the other output files.
26491
26492 @node Environment Variables
26493 @section Environment Variables Affecting GCC
26494 @cindex environment variables
26495
26496 @c man begin ENVIRONMENT
26497 This section describes several environment variables that affect how GCC
26498 operates. Some of them work by specifying directories or prefixes to use
26499 when searching for various kinds of files. Some are used to specify other
26500 aspects of the compilation environment.
26501
26502 Note that you can also specify places to search using options such as
26503 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
26504 take precedence over places specified using environment variables, which
26505 in turn take precedence over those specified by the configuration of GCC@.
26506 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
26507 GNU Compiler Collection (GCC) Internals}.
26508
26509 @table @env
26510 @item LANG
26511 @itemx LC_CTYPE
26512 @c @itemx LC_COLLATE
26513 @itemx LC_MESSAGES
26514 @c @itemx LC_MONETARY
26515 @c @itemx LC_NUMERIC
26516 @c @itemx LC_TIME
26517 @itemx LC_ALL
26518 @findex LANG
26519 @findex LC_CTYPE
26520 @c @findex LC_COLLATE
26521 @findex LC_MESSAGES
26522 @c @findex LC_MONETARY
26523 @c @findex LC_NUMERIC
26524 @c @findex LC_TIME
26525 @findex LC_ALL
26526 @cindex locale
26527 These environment variables control the way that GCC uses
26528 localization information which allows GCC to work with different
26529 national conventions. GCC inspects the locale categories
26530 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
26531 so. These locale categories can be set to any value supported by your
26532 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
26533 Kingdom encoded in UTF-8.
26534
26535 The @env{LC_CTYPE} environment variable specifies character
26536 classification. GCC uses it to determine the character boundaries in
26537 a string; this is needed for some multibyte encodings that contain quote
26538 and escape characters that are otherwise interpreted as a string
26539 end or escape.
26540
26541 The @env{LC_MESSAGES} environment variable specifies the language to
26542 use in diagnostic messages.
26543
26544 If the @env{LC_ALL} environment variable is set, it overrides the value
26545 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
26546 and @env{LC_MESSAGES} default to the value of the @env{LANG}
26547 environment variable. If none of these variables are set, GCC
26548 defaults to traditional C English behavior.
26549
26550 @item TMPDIR
26551 @findex TMPDIR
26552 If @env{TMPDIR} is set, it specifies the directory to use for temporary
26553 files. GCC uses temporary files to hold the output of one stage of
26554 compilation which is to be used as input to the next stage: for example,
26555 the output of the preprocessor, which is the input to the compiler
26556 proper.
26557
26558 @item GCC_COMPARE_DEBUG
26559 @findex GCC_COMPARE_DEBUG
26560 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
26561 @option{-fcompare-debug} to the compiler driver. See the documentation
26562 of this option for more details.
26563
26564 @item GCC_EXEC_PREFIX
26565 @findex GCC_EXEC_PREFIX
26566 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
26567 names of the subprograms executed by the compiler. No slash is added
26568 when this prefix is combined with the name of a subprogram, but you can
26569 specify a prefix that ends with a slash if you wish.
26570
26571 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
26572 an appropriate prefix to use based on the pathname it is invoked with.
26573
26574 If GCC cannot find the subprogram using the specified prefix, it
26575 tries looking in the usual places for the subprogram.
26576
26577 The default value of @env{GCC_EXEC_PREFIX} is
26578 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
26579 the installed compiler. In many cases @var{prefix} is the value
26580 of @code{prefix} when you ran the @file{configure} script.
26581
26582 Other prefixes specified with @option{-B} take precedence over this prefix.
26583
26584 This prefix is also used for finding files such as @file{crt0.o} that are
26585 used for linking.
26586
26587 In addition, the prefix is used in an unusual way in finding the
26588 directories to search for header files. For each of the standard
26589 directories whose name normally begins with @samp{/usr/local/lib/gcc}
26590 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
26591 replacing that beginning with the specified prefix to produce an
26592 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
26593 @file{foo/bar} just before it searches the standard directory
26594 @file{/usr/local/lib/bar}.
26595 If a standard directory begins with the configured
26596 @var{prefix} then the value of @var{prefix} is replaced by
26597 @env{GCC_EXEC_PREFIX} when looking for header files.
26598
26599 @item COMPILER_PATH
26600 @findex COMPILER_PATH
26601 The value of @env{COMPILER_PATH} is a colon-separated list of
26602 directories, much like @env{PATH}. GCC tries the directories thus
26603 specified when searching for subprograms, if it can't find the
26604 subprograms using @env{GCC_EXEC_PREFIX}.
26605
26606 @item LIBRARY_PATH
26607 @findex LIBRARY_PATH
26608 The value of @env{LIBRARY_PATH} is a colon-separated list of
26609 directories, much like @env{PATH}. When configured as a native compiler,
26610 GCC tries the directories thus specified when searching for special
26611 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
26612 using GCC also uses these directories when searching for ordinary
26613 libraries for the @option{-l} option (but directories specified with
26614 @option{-L} come first).
26615
26616 @item LANG
26617 @findex LANG
26618 @cindex locale definition
26619 This variable is used to pass locale information to the compiler. One way in
26620 which this information is used is to determine the character set to be used
26621 when character literals, string literals and comments are parsed in C and C++.
26622 When the compiler is configured to allow multibyte characters,
26623 the following values for @env{LANG} are recognized:
26624
26625 @table @samp
26626 @item C-JIS
26627 Recognize JIS characters.
26628 @item C-SJIS
26629 Recognize SJIS characters.
26630 @item C-EUCJP
26631 Recognize EUCJP characters.
26632 @end table
26633
26634 If @env{LANG} is not defined, or if it has some other value, then the
26635 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
26636 recognize and translate multibyte characters.
26637 @end table
26638
26639 @noindent
26640 Some additional environment variables affect the behavior of the
26641 preprocessor.
26642
26643 @include cppenv.texi
26644
26645 @c man end
26646
26647 @node Precompiled Headers
26648 @section Using Precompiled Headers
26649 @cindex precompiled headers
26650 @cindex speed of compilation
26651
26652 Often large projects have many header files that are included in every
26653 source file. The time the compiler takes to process these header files
26654 over and over again can account for nearly all of the time required to
26655 build the project. To make builds faster, GCC allows you to
26656 @dfn{precompile} a header file.
26657
26658 To create a precompiled header file, simply compile it as you would any
26659 other file, if necessary using the @option{-x} option to make the driver
26660 treat it as a C or C++ header file. You may want to use a
26661 tool like @command{make} to keep the precompiled header up-to-date when
26662 the headers it contains change.
26663
26664 A precompiled header file is searched for when @code{#include} is
26665 seen in the compilation. As it searches for the included file
26666 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
26667 compiler looks for a precompiled header in each directory just before it
26668 looks for the include file in that directory. The name searched for is
26669 the name specified in the @code{#include} with @samp{.gch} appended. If
26670 the precompiled header file can't be used, it is ignored.
26671
26672 For instance, if you have @code{#include "all.h"}, and you have
26673 @file{all.h.gch} in the same directory as @file{all.h}, then the
26674 precompiled header file is used if possible, and the original
26675 header is used otherwise.
26676
26677 Alternatively, you might decide to put the precompiled header file in a
26678 directory and use @option{-I} to ensure that directory is searched
26679 before (or instead of) the directory containing the original header.
26680 Then, if you want to check that the precompiled header file is always
26681 used, you can put a file of the same name as the original header in this
26682 directory containing an @code{#error} command.
26683
26684 This also works with @option{-include}. So yet another way to use
26685 precompiled headers, good for projects not designed with precompiled
26686 header files in mind, is to simply take most of the header files used by
26687 a project, include them from another header file, precompile that header
26688 file, and @option{-include} the precompiled header. If the header files
26689 have guards against multiple inclusion, they are skipped because
26690 they've already been included (in the precompiled header).
26691
26692 If you need to precompile the same header file for different
26693 languages, targets, or compiler options, you can instead make a
26694 @emph{directory} named like @file{all.h.gch}, and put each precompiled
26695 header in the directory, perhaps using @option{-o}. It doesn't matter
26696 what you call the files in the directory; every precompiled header in
26697 the directory is considered. The first precompiled header
26698 encountered in the directory that is valid for this compilation is
26699 used; they're searched in no particular order.
26700
26701 There are many other possibilities, limited only by your imagination,
26702 good sense, and the constraints of your build system.
26703
26704 A precompiled header file can be used only when these conditions apply:
26705
26706 @itemize
26707 @item
26708 Only one precompiled header can be used in a particular compilation.
26709
26710 @item
26711 A precompiled header can't be used once the first C token is seen. You
26712 can have preprocessor directives before a precompiled header; you cannot
26713 include a precompiled header from inside another header.
26714
26715 @item
26716 The precompiled header file must be produced for the same language as
26717 the current compilation. You can't use a C precompiled header for a C++
26718 compilation.
26719
26720 @item
26721 The precompiled header file must have been produced by the same compiler
26722 binary as the current compilation is using.
26723
26724 @item
26725 Any macros defined before the precompiled header is included must
26726 either be defined in the same way as when the precompiled header was
26727 generated, or must not affect the precompiled header, which usually
26728 means that they don't appear in the precompiled header at all.
26729
26730 The @option{-D} option is one way to define a macro before a
26731 precompiled header is included; using a @code{#define} can also do it.
26732 There are also some options that define macros implicitly, like
26733 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
26734 defined this way.
26735
26736 @item If debugging information is output when using the precompiled
26737 header, using @option{-g} or similar, the same kind of debugging information
26738 must have been output when building the precompiled header. However,
26739 a precompiled header built using @option{-g} can be used in a compilation
26740 when no debugging information is being output.
26741
26742 @item The same @option{-m} options must generally be used when building
26743 and using the precompiled header. @xref{Submodel Options},
26744 for any cases where this rule is relaxed.
26745
26746 @item Each of the following options must be the same when building and using
26747 the precompiled header:
26748
26749 @gccoptlist{-fexceptions}
26750
26751 @item
26752 Some other command-line options starting with @option{-f},
26753 @option{-p}, or @option{-O} must be defined in the same way as when
26754 the precompiled header was generated. At present, it's not clear
26755 which options are safe to change and which are not; the safest choice
26756 is to use exactly the same options when generating and using the
26757 precompiled header. The following are known to be safe:
26758
26759 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
26760 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
26761 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
26762 -pedantic-errors}
26763
26764 @end itemize
26765
26766 For all of these except the last, the compiler automatically
26767 ignores the precompiled header if the conditions aren't met. If you
26768 find an option combination that doesn't work and doesn't cause the
26769 precompiled header to be ignored, please consider filing a bug report,
26770 see @ref{Bugs}.
26771
26772 If you do use differing options when generating and using the
26773 precompiled header, the actual behavior is a mixture of the
26774 behavior for the options. For instance, if you use @option{-g} to
26775 generate the precompiled header but not when using it, you may or may
26776 not get debugging information for routines in the precompiled header.