]> gcc.gnu.org Git - gcc.git/blob - gcc/doc/invoke.texi
Cherry-pick fprofile-generate-atomic from google/gcc-4_9
[gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2016 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-2016 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 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
182 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
183 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
184 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness}
185 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
186 -fsigned-bitfields -fsigned-char @gol
187 -funsigned-bitfields -funsigned-char @gol
188 -trigraphs -traditional -traditional-cpp}
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 -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 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
203 -fno-optional-diags -fpermissive @gol
204 -fno-pretty-templates @gol
205 -frepo -fno-rtti -fsized-deallocation @gol
206 -ftemplate-backtrace-limit=@var{n} @gol
207 -ftemplate-depth=@var{n} @gol
208 -fno-threadsafe-statics -fuse-cxa-atexit @gol
209 -fno-weak -nostdinc++ @gol
210 -fvisibility-inlines-hidden @gol
211 -fvisibility-ms-compat @gol
212 -fext-numeric-literals @gol
213 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
214 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
215 -Wnamespaces -Wnarrowing @gol
216 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
217 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
218 -Wno-non-template-friend -Wold-style-cast @gol
219 -Woverloaded-virtual -Wno-pmf-conversions @gol
220 -Wsign-promo -Wvirtual-inheritance}
221
222 @item Objective-C and Objective-C++ Language Options
223 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
224 Objective-C and Objective-C++ Dialects}.
225 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
226 -fgnu-runtime -fnext-runtime @gol
227 -fno-nil-receivers @gol
228 -fobjc-abi-version=@var{n} @gol
229 -fobjc-call-cxx-cdtors @gol
230 -fobjc-direct-dispatch @gol
231 -fobjc-exceptions @gol
232 -fobjc-gc @gol
233 -fobjc-nilcheck @gol
234 -fobjc-std=objc1 @gol
235 -fno-local-ivars @gol
236 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
237 -freplace-objc-classes @gol
238 -fzero-link @gol
239 -gen-decls @gol
240 -Wassign-intercept @gol
241 -Wno-protocol -Wselector @gol
242 -Wstrict-selector-match @gol
243 -Wundeclared-selector}
244
245 @item Diagnostic Message Formatting Options
246 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
247 @gccoptlist{-fmessage-length=@var{n} @gol
248 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
249 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
250 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
251 -fdiagnostics-parseable-fixits}
252
253 @item Warning Options
254 @xref{Warning Options,,Options to Request or Suppress Warnings}.
255 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
256 -pedantic-errors @gol
257 -w -Wextra -Wall -Waddress -Waggregate-return @gol
258 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
259 -Wno-attributes -Wbool-compare -Wno-builtin-macro-redefined @gol
260 -Wc90-c99-compat -Wc99-c11-compat @gol
261 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
262 -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
263 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
264 -Wdelete-incomplete @gol
265 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
266 -Wdisabled-optimization @gol
267 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
268 -Wno-div-by-zero -Wdouble-promotion -Wduplicated-cond @gol
269 -Wempty-body -Wenum-compare -Wno-endif-labels @gol
270 -Werror -Werror=* -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
271 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
272 -Wformat-security -Wformat-signedness -Wformat-y2k -Wframe-address @gol
273 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
274 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
275 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
276 -Winit-self -Winline -Wno-int-conversion @gol
277 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
278 -Winvalid-pch -Wlarger-than=@var{len} @gol
279 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
280 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
281 -Wmisleading-indentation -Wmissing-braces @gol
282 -Wmissing-field-initializers -Wmissing-include-dirs @gol
283 -Wno-multichar -Wnonnull -Wnonnull-compare @gol
284 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
285 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
286 -Woverride-init-side-effects -Woverlength-strings @gol
287 -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
288 -Wparentheses -Wno-pedantic-ms-format @gol
289 -Wplacement-new -Wplacement-new=@var{n} @gol
290 -Wpointer-arith -Wno-pointer-to-int-cast @gol
291 -Wno-pragmas -Wredundant-decls -Wno-return-local-addr @gol
292 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
293 -Wshift-overflow -Wshift-overflow=@var{n} @gol
294 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
295 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
296 -Wno-scalar-storage-order @gol
297 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
298 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
299 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
300 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
301 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
302 -Wmissing-format-attribute -Wsubobject-linkage @gol
303 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
304 -Wswitch-unreachable -Wsync-nand @gol
305 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
306 -Wtype-limits -Wundef @gol
307 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
308 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
309 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
310 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
311 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
312 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
313 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
314 -Wvla -Wvolatile-register-var -Wwrite-strings @gol
315 -Wzero-as-null-pointer-constant -Whsa}
316
317 @item C and Objective-C-only Warning Options
318 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
319 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
320 -Wold-style-declaration -Wold-style-definition @gol
321 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
322 -Wdeclaration-after-statement -Wpointer-sign}
323
324 @item Debugging Options
325 @xref{Debugging Options,,Options for Debugging Your Program}.
326 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
327 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
328 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
329 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
330 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
331 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
332 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
333 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
334 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
335 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
336 -fvar-tracking -fvar-tracking-assignments}
337
338 @item Optimization Options
339 @xref{Optimize Options,,Options that Control Optimization}.
340 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
341 -falign-jumps[=@var{n}] @gol
342 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
343 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
344 -fauto-inc-dec -fbranch-probabilities @gol
345 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
346 -fbtr-bb-exclusive -fcaller-saves @gol
347 -fcombine-stack-adjustments -fconserve-stack @gol
348 -fcompare-elim -fcprop-registers -fcrossjumping @gol
349 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
350 -fcx-limited-range @gol
351 -fdata-sections -fdce -fdelayed-branch @gol
352 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
353 -fdevirtualize-at-ltrans -fdse @gol
354 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
355 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
356 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
357 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
358 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
359 -fif-conversion2 -findirect-inlining @gol
360 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
361 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment @gol
362 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
363 -fira-algorithm=@var{algorithm} @gol
364 -fira-region=@var{region} -fira-hoist-pressure @gol
365 -fira-loop-pressure -fno-ira-share-save-slots @gol
366 -fno-ira-share-spill-slots @gol
367 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
368 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
369 -fkeep-static-consts -flive-range-shrinkage @gol
370 -floop-block -floop-interchange -floop-strip-mine @gol
371 -floop-unroll-and-jam -floop-nest-optimize @gol
372 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
373 -flto-partition=@var{alg} -fmerge-all-constants @gol
374 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
375 -fmove-loop-invariants -fno-branch-count-reg @gol
376 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
377 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
378 -fno-peephole2 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
379 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
380 -fomit-frame-pointer -foptimize-sibling-calls @gol
381 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
382 -fprefetch-loop-arrays @gol
383 -fprofile-correction @gol
384 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
385 -fprofile-reorder-functions @gol
386 -freciprocal-math -free -frename-registers -freorder-blocks @gol
387 -freorder-blocks-algorithm=@var{algorithm} @gol
388 -freorder-blocks-and-partition -freorder-functions @gol
389 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
390 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
391 -fsched-spec-load -fsched-spec-load-dangerous @gol
392 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
393 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
394 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
395 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
396 -fschedule-fusion @gol
397 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
398 -fselective-scheduling -fselective-scheduling2 @gol
399 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
400 -fsemantic-interposition -fshrink-wrap -fsignaling-nans @gol
401 -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
402 -fsplit-paths @gol
403 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
404 -fstdarg-opt -fstrict-aliasing @gol
405 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
406 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
407 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
408 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting -ftree-loop-if-convert @gol
409 -ftree-loop-if-convert-stores -ftree-loop-im @gol
410 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
411 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
412 -ftree-loop-vectorize @gol
413 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
414 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
415 -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
416 -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
417 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
418 -funsafe-math-optimizations -funswitch-loops @gol
419 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
420 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
421 --param @var{name}=@var{value}
422 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
423
424 @item Program Instrumentation Options
425 @xref{Instrumentation Options,,Program Instrumentation Options}.
426 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
427 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
428 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
429 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
430 -fsanitize-undefined-trap-on-error -fbounds-check @gol
431 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
432 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
433 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
434 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
435 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
436 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
437 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
438 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
439 -fchkp-use-wrappers @gol
440 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
441 -fstack-protector-explicit -fstack-check @gol
442 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
443 -fno-stack-limit -fsplit-stack @gol
444 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
445 -fvtv-counts -fvtv-debug @gol
446 -finstrument-functions @gol
447 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
448 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
449
450 @item Preprocessor Options
451 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
452 @gccoptlist{-A@var{question}=@var{answer} @gol
453 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
454 -C -dD -dI -dM -dN @gol
455 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
456 -idirafter @var{dir} @gol
457 -include @var{file} -imacros @var{file} @gol
458 -iprefix @var{file} -iwithprefix @var{dir} @gol
459 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
460 -imultilib @var{dir} -isysroot @var{dir} @gol
461 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
462 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
463 -remap -trigraphs -undef -U@var{macro} @gol
464 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
465
466 @item Assembler Option
467 @xref{Assembler Options,,Passing Options to the Assembler}.
468 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
469
470 @item Linker Options
471 @xref{Link Options,,Options for Linking}.
472 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
473 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
474 -s -static -static-libgcc -static-libstdc++ @gol
475 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
476 -static-libmpx -static-libmpxwrappers @gol
477 -shared -shared-libgcc -symbolic @gol
478 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
479 -u @var{symbol} -z @var{keyword}}
480
481 @item Directory Options
482 @xref{Directory Options,,Options for Directory Search}.
483 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
484 -iquote@var{dir} -L@var{dir} -no-canonical-prefixes -I- @gol
485 --sysroot=@var{dir} --no-sysroot-suffix}
486
487 @item Code Generation Options
488 @xref{Code Gen Options,,Options for Code Generation Conventions}.
489 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
490 -ffixed-@var{reg} -fexceptions @gol
491 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
492 -fasynchronous-unwind-tables @gol
493 -fno-gnu-unique @gol
494 -finhibit-size-directive -fno-common -fno-ident @gol
495 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
496 -fno-jump-tables @gol
497 -frecord-gcc-switches @gol
498 -freg-struct-return -fshort-enums -fshort-wchar @gol
499 -fverbose-asm -fpack-struct[=@var{n}] @gol
500 -fleading-underscore -ftls-model=@var{model} @gol
501 -fstack-reuse=@var{reuse_level} @gol
502 -ftrapv -fwrapv @gol
503 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
504 -fstrict-volatile-bitfields -fsync-libcalls}
505
506 @item Developer Options
507 @xref{Developer Options,,GCC Developer Options}.
508 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
509 -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
510 -fdbg-cnt=@var{counter-value-list} @gol
511 -fdisable-ipa-@var{pass_name} @gol
512 -fdisable-rtl-@var{pass_name} @gol
513 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
514 -fdisable-tree-@var{pass_name} @gol
515 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
516 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
517 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
518 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
519 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
520 -fdump-passes @gol
521 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
522 -fdump-statistics @gol
523 -fdump-tree-all @gol
524 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
525 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
526 -fdump-tree-cfg -fdump-tree-alias @gol
527 -fdump-tree-ch @gol
528 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
529 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
530 -fdump-tree-gimple@r{[}-raw@r{]} @gol
531 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
532 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
533 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
534 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
535 -fdump-tree-backprop@r{[}-@var{n}@r{]} @gol
536 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
537 -fdump-tree-nrv -fdump-tree-vect @gol
538 -fdump-tree-sink @gol
539 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
540 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
541 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
542 -fdump-tree-vtable-verify @gol
543 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
544 -fdump-tree-split-paths@r{[}-@var{n}@r{]} @gol
545 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
546 -fdump-final-insns=@var{file} @gol
547 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
548 -fenable-@var{kind}-@var{pass} @gol
549 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
550 -fira-verbose=@var{n} @gol
551 -flto-report -flto-report-wpa -fmem-report-wpa @gol
552 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
553 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
554 -fprofile-report @gol
555 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
556 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
557 -fstats -fstack-usage -ftime-report @gol
558 -fvar-tracking-assignments-toggle -gtoggle @gol
559 -print-file-name=@var{library} -print-libgcc-file-name @gol
560 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
561 -print-prog-name=@var{program} -print-search-dirs -Q @gol
562 -print-sysroot -print-sysroot-headers-suffix @gol
563 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
564
565 @item Machine-Dependent Options
566 @xref{Submodel Options,,Machine-Dependent Options}.
567 @c This list is ordered alphanumerically by subsection name.
568 @c Try and put the significant identifier (CPU or system) first,
569 @c so users have a clue at guessing where the ones they want will be.
570
571 @emph{AArch64 Options}
572 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
573 -mgeneral-regs-only @gol
574 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
575 -mstrict-align @gol
576 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
577 -mtls-dialect=desc -mtls-dialect=traditional @gol
578 -mtls-size=@var{size} @gol
579 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
580 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol
581 -mlow-precision-recip-sqrt -mno-low-precision-recip-sqrt@gol
582 -mlow-precision-sqrt -mno-low-precision-sqrt@gol
583 -mlow-precision-div -mno-low-precision-div @gol
584 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
585
586 @emph{Adapteva Epiphany Options}
587 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
588 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
589 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
590 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
591 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
592 -msplit-vecmove-early -m1reg-@var{reg}}
593
594 @emph{ARC Options}
595 @gccoptlist{-mbarrel-shifter @gol
596 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
597 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
598 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
599 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
600 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
601 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
602 -mlong-calls -mmedium-calls -msdata @gol
603 -mucb-mcount -mvolatile-cache -mtp-regno=@var{regno} @gol
604 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
605 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
606 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
607 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
608 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
609 -mtune=@var{cpu} -mmultcost=@var{num} @gol
610 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
611 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
612
613 @emph{ARM Options}
614 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
615 -mabi=@var{name} @gol
616 -mapcs-stack-check -mno-apcs-stack-check @gol
617 -mapcs-float -mno-apcs-float @gol
618 -mapcs-reentrant -mno-apcs-reentrant @gol
619 -msched-prolog -mno-sched-prolog @gol
620 -mlittle-endian -mbig-endian @gol
621 -mfloat-abi=@var{name} @gol
622 -mfp16-format=@var{name}
623 -mthumb-interwork -mno-thumb-interwork @gol
624 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
625 -mtune=@var{name} -mprint-tune-info @gol
626 -mstructure-size-boundary=@var{n} @gol
627 -mabort-on-noreturn @gol
628 -mlong-calls -mno-long-calls @gol
629 -msingle-pic-base -mno-single-pic-base @gol
630 -mpic-register=@var{reg} @gol
631 -mnop-fun-dllimport @gol
632 -mpoke-function-name @gol
633 -mthumb -marm @gol
634 -mtpcs-frame -mtpcs-leaf-frame @gol
635 -mcaller-super-interworking -mcallee-super-interworking @gol
636 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
637 -mword-relocations @gol
638 -mfix-cortex-m3-ldrd @gol
639 -munaligned-access @gol
640 -mneon-for-64bits @gol
641 -mslow-flash-data @gol
642 -masm-syntax-unified @gol
643 -mrestrict-it}
644
645 @emph{AVR Options}
646 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
647 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
648 -mrelax -mrmw -mstrict-X -mtiny-stack -mfract-convert-truncate -nodevicelib @gol
649 -Waddr-space-convert -Wmisspelled-isr}
650
651 @emph{Blackfin Options}
652 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
653 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
654 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
655 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
656 -mno-id-shared-library -mshared-library-id=@var{n} @gol
657 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
658 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
659 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
660 -micplb}
661
662 @emph{C6X Options}
663 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
664 -msim -msdata=@var{sdata-type}}
665
666 @emph{CRIS Options}
667 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
668 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
669 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
670 -mstack-align -mdata-align -mconst-align @gol
671 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
672 -melf -maout -melinux -mlinux -sim -sim2 @gol
673 -mmul-bug-workaround -mno-mul-bug-workaround}
674
675 @emph{CR16 Options}
676 @gccoptlist{-mmac @gol
677 -mcr16cplus -mcr16c @gol
678 -msim -mint32 -mbit-ops
679 -mdata-model=@var{model}}
680
681 @emph{Darwin Options}
682 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
683 -arch_only -bind_at_load -bundle -bundle_loader @gol
684 -client_name -compatibility_version -current_version @gol
685 -dead_strip @gol
686 -dependency-file -dylib_file -dylinker_install_name @gol
687 -dynamic -dynamiclib -exported_symbols_list @gol
688 -filelist -flat_namespace -force_cpusubtype_ALL @gol
689 -force_flat_namespace -headerpad_max_install_names @gol
690 -iframework @gol
691 -image_base -init -install_name -keep_private_externs @gol
692 -multi_module -multiply_defined -multiply_defined_unused @gol
693 -noall_load -no_dead_strip_inits_and_terms @gol
694 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
695 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
696 -private_bundle -read_only_relocs -sectalign @gol
697 -sectobjectsymbols -whyload -seg1addr @gol
698 -sectcreate -sectobjectsymbols -sectorder @gol
699 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
700 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
701 -segprot -segs_read_only_addr -segs_read_write_addr @gol
702 -single_module -static -sub_library -sub_umbrella @gol
703 -twolevel_namespace -umbrella -undefined @gol
704 -unexported_symbols_list -weak_reference_mismatches @gol
705 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
706 -mkernel -mone-byte-bool}
707
708 @emph{DEC Alpha Options}
709 @gccoptlist{-mno-fp-regs -msoft-float @gol
710 -mieee -mieee-with-inexact -mieee-conformant @gol
711 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
712 -mtrap-precision=@var{mode} -mbuild-constants @gol
713 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
714 -mbwx -mmax -mfix -mcix @gol
715 -mfloat-vax -mfloat-ieee @gol
716 -mexplicit-relocs -msmall-data -mlarge-data @gol
717 -msmall-text -mlarge-text @gol
718 -mmemory-latency=@var{time}}
719
720 @emph{FR30 Options}
721 @gccoptlist{-msmall-model -mno-lsim}
722
723 @emph{FT32 Options}
724 @gccoptlist{-msim -mlra -mnodiv}
725
726 @emph{FRV Options}
727 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
728 -mhard-float -msoft-float @gol
729 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
730 -mdouble -mno-double @gol
731 -mmedia -mno-media -mmuladd -mno-muladd @gol
732 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
733 -mlinked-fp -mlong-calls -malign-labels @gol
734 -mlibrary-pic -macc-4 -macc-8 @gol
735 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
736 -moptimize-membar -mno-optimize-membar @gol
737 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
738 -mvliw-branch -mno-vliw-branch @gol
739 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
740 -mno-nested-cond-exec -mtomcat-stats @gol
741 -mTLS -mtls @gol
742 -mcpu=@var{cpu}}
743
744 @emph{GNU/Linux Options}
745 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
746 -tno-android-cc -tno-android-ld}
747
748 @emph{H8/300 Options}
749 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
750
751 @emph{HPPA Options}
752 @gccoptlist{-march=@var{architecture-type} @gol
753 -mdisable-fpregs -mdisable-indexing @gol
754 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
755 -mfixed-range=@var{register-range} @gol
756 -mjump-in-delay -mlinker-opt -mlong-calls @gol
757 -mlong-load-store -mno-disable-fpregs @gol
758 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
759 -mno-jump-in-delay -mno-long-load-store @gol
760 -mno-portable-runtime -mno-soft-float @gol
761 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
762 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
763 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
764 -munix=@var{unix-std} -nolibdld -static -threads}
765
766 @emph{IA-64 Options}
767 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
768 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
769 -mconstant-gp -mauto-pic -mfused-madd @gol
770 -minline-float-divide-min-latency @gol
771 -minline-float-divide-max-throughput @gol
772 -mno-inline-float-divide @gol
773 -minline-int-divide-min-latency @gol
774 -minline-int-divide-max-throughput @gol
775 -mno-inline-int-divide @gol
776 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
777 -mno-inline-sqrt @gol
778 -mdwarf2-asm -mearly-stop-bits @gol
779 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
780 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
781 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
782 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
783 -msched-spec-ldc -msched-spec-control-ldc @gol
784 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
785 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
786 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
787 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
788
789 @emph{LM32 Options}
790 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
791 -msign-extend-enabled -muser-enabled}
792
793 @emph{M32R/D Options}
794 @gccoptlist{-m32r2 -m32rx -m32r @gol
795 -mdebug @gol
796 -malign-loops -mno-align-loops @gol
797 -missue-rate=@var{number} @gol
798 -mbranch-cost=@var{number} @gol
799 -mmodel=@var{code-size-model-type} @gol
800 -msdata=@var{sdata-type} @gol
801 -mno-flush-func -mflush-func=@var{name} @gol
802 -mno-flush-trap -mflush-trap=@var{number} @gol
803 -G @var{num}}
804
805 @emph{M32C Options}
806 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
807
808 @emph{M680x0 Options}
809 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
810 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
811 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
812 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
813 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
814 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
815 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
816 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
817 -mxgot -mno-xgot}
818
819 @emph{MCore Options}
820 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
821 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
822 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
823 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
824 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
825
826 @emph{MeP Options}
827 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
828 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
829 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
830 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
831 -mtiny=@var{n}}
832
833 @emph{MicroBlaze Options}
834 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
835 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
836 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
837 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
838 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
839
840 @emph{MIPS Options}
841 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
842 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
843 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
844 -mips16 -mno-mips16 -mflip-mips16 @gol
845 -minterlink-compressed -mno-interlink-compressed @gol
846 -minterlink-mips16 -mno-interlink-mips16 @gol
847 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
848 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
849 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
850 -mno-float -msingle-float -mdouble-float @gol
851 -modd-spreg -mno-odd-spreg @gol
852 -mabs=@var{mode} -mnan=@var{encoding} @gol
853 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
854 -mmcu -mmno-mcu @gol
855 -meva -mno-eva @gol
856 -mvirt -mno-virt @gol
857 -mxpa -mno-xpa @gol
858 -mmicromips -mno-micromips @gol
859 -mmsa -mno-msa @gol
860 -mfpu=@var{fpu-type} @gol
861 -msmartmips -mno-smartmips @gol
862 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
863 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
864 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
865 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
866 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
867 -membedded-data -mno-embedded-data @gol
868 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
869 -mcode-readable=@var{setting} @gol
870 -msplit-addresses -mno-split-addresses @gol
871 -mexplicit-relocs -mno-explicit-relocs @gol
872 -mcheck-zero-division -mno-check-zero-division @gol
873 -mdivide-traps -mdivide-breaks @gol
874 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
875 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
876 -mfix-24k -mno-fix-24k @gol
877 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
878 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
879 -mfix-vr4120 -mno-fix-vr4120 @gol
880 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
881 -mflush-func=@var{func} -mno-flush-func @gol
882 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
883 -mcompact-branches=@var{policy} @gol
884 -mfp-exceptions -mno-fp-exceptions @gol
885 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
886 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
887 -mframe-header-opt -mno-frame-header-opt}
888
889 @emph{MMIX Options}
890 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
891 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
892 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
893 -mno-base-addresses -msingle-exit -mno-single-exit}
894
895 @emph{MN10300 Options}
896 @gccoptlist{-mmult-bug -mno-mult-bug @gol
897 -mno-am33 -mam33 -mam33-2 -mam34 @gol
898 -mtune=@var{cpu-type} @gol
899 -mreturn-pointer-on-d0 @gol
900 -mno-crt0 -mrelax -mliw -msetlb}
901
902 @emph{Moxie Options}
903 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
904
905 @emph{MSP430 Options}
906 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
907 -mwarn-mcu @gol
908 -mcode-region= -mdata-region= @gol
909 -msilicon-errata= -msilicon-errata-warn= @gol
910 -mhwmult= -minrt}
911
912 @emph{NDS32 Options}
913 @gccoptlist{-mbig-endian -mlittle-endian @gol
914 -mreduced-regs -mfull-regs @gol
915 -mcmov -mno-cmov @gol
916 -mperf-ext -mno-perf-ext @gol
917 -mv3push -mno-v3push @gol
918 -m16bit -mno-16bit @gol
919 -misr-vector-size=@var{num} @gol
920 -mcache-block-size=@var{num} @gol
921 -march=@var{arch} @gol
922 -mcmodel=@var{code-model} @gol
923 -mctor-dtor -mrelax}
924
925 @emph{Nios II Options}
926 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
927 -mel -meb @gol
928 -mno-bypass-cache -mbypass-cache @gol
929 -mno-cache-volatile -mcache-volatile @gol
930 -mno-fast-sw-div -mfast-sw-div @gol
931 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
932 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
933 -mcustom-fpu-cfg=@var{name} @gol
934 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
935 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
936
937 @emph{Nvidia PTX Options}
938 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
939
940 @emph{PDP-11 Options}
941 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
942 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
943 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
944 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
945 -mbranch-expensive -mbranch-cheap @gol
946 -munix-asm -mdec-asm}
947
948 @emph{picoChip Options}
949 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
950 -msymbol-as-address -mno-inefficient-warnings}
951
952 @emph{PowerPC Options}
953 See RS/6000 and PowerPC Options.
954
955 @emph{RL78 Options}
956 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
957 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
958 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
959
960 @emph{RS/6000 and PowerPC Options}
961 @gccoptlist{-mcpu=@var{cpu-type} @gol
962 -mtune=@var{cpu-type} @gol
963 -mcmodel=@var{code-model} @gol
964 -mpowerpc64 @gol
965 -maltivec -mno-altivec @gol
966 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
967 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
968 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
969 -mfprnd -mno-fprnd @gol
970 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
971 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
972 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
973 -malign-power -malign-natural @gol
974 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
975 -msingle-float -mdouble-float -msimple-fpu @gol
976 -mstring -mno-string -mupdate -mno-update @gol
977 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
978 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
979 -mstrict-align -mno-strict-align -mrelocatable @gol
980 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
981 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
982 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
983 -mprioritize-restricted-insns=@var{priority} @gol
984 -msched-costly-dep=@var{dependence_type} @gol
985 -minsert-sched-nops=@var{scheme} @gol
986 -mcall-sysv -mcall-netbsd @gol
987 -maix-struct-return -msvr4-struct-return @gol
988 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
989 -mblock-move-inline-limit=@var{num} @gol
990 -misel -mno-isel @gol
991 -misel=yes -misel=no @gol
992 -mspe -mno-spe @gol
993 -mspe=yes -mspe=no @gol
994 -mpaired @gol
995 -mgen-cell-microcode -mwarn-cell-microcode @gol
996 -mvrsave -mno-vrsave @gol
997 -mmulhw -mno-mulhw @gol
998 -mdlmzb -mno-dlmzb @gol
999 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1000 -mprototype -mno-prototype @gol
1001 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1002 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
1003 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1004 -mno-recip-precision @gol
1005 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1006 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1007 -msave-toc-indirect -mno-save-toc-indirect @gol
1008 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1009 -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol
1010 -mquad-memory -mno-quad-memory @gol
1011 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1012 -mcompat-align-parm -mno-compat-align-parm @gol
1013 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
1014 -mupper-regs-di -mno-upper-regs-di @gol
1015 -mupper-regs -mno-upper-regs @gol
1016 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1017 -mlra -mno-lra}
1018
1019 @emph{RX Options}
1020 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1021 -mcpu=@gol
1022 -mbig-endian-data -mlittle-endian-data @gol
1023 -msmall-data @gol
1024 -msim -mno-sim@gol
1025 -mas100-syntax -mno-as100-syntax@gol
1026 -mrelax@gol
1027 -mmax-constant-size=@gol
1028 -mint-register=@gol
1029 -mpid@gol
1030 -mallow-string-insns -mno-allow-string-insns@gol
1031 -mjsr@gol
1032 -mno-warn-multiple-fast-interrupts@gol
1033 -msave-acc-in-interrupts}
1034
1035 @emph{S/390 and zSeries Options}
1036 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1037 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1038 -mlong-double-64 -mlong-double-128 @gol
1039 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1040 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1041 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1042 -mhtm -mvx -mzvector @gol
1043 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1044 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1045 -mhotpatch=@var{halfwords},@var{halfwords}}
1046
1047 @emph{Score Options}
1048 @gccoptlist{-meb -mel @gol
1049 -mnhwloop @gol
1050 -muls @gol
1051 -mmac @gol
1052 -mscore5 -mscore5u -mscore7 -mscore7d}
1053
1054 @emph{SH Options}
1055 @gccoptlist{-m1 -m2 -m2e @gol
1056 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1057 -m3 -m3e @gol
1058 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1059 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1060 -mb -ml -mdalign -mrelax @gol
1061 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1062 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1063 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1064 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1065 -maccumulate-outgoing-args @gol
1066 -matomic-model=@var{atomic-model} @gol
1067 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1068 -mcbranch-force-delay-slot @gol
1069 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1070 -mpretend-cmove -mtas}
1071
1072 @emph{Solaris 2 Options}
1073 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1074 -pthreads -pthread}
1075
1076 @emph{SPARC Options}
1077 @gccoptlist{-mcpu=@var{cpu-type} @gol
1078 -mtune=@var{cpu-type} @gol
1079 -mcmodel=@var{code-model} @gol
1080 -mmemory-model=@var{mem-model} @gol
1081 -m32 -m64 -mapp-regs -mno-app-regs @gol
1082 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1083 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1084 -mhard-quad-float -msoft-quad-float @gol
1085 -mstack-bias -mno-stack-bias @gol
1086 -mstd-struct-return -mno-std-struct-return @gol
1087 -munaligned-doubles -mno-unaligned-doubles @gol
1088 -muser-mode -mno-user-mode @gol
1089 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1090 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1091 -mcbcond -mno-cbcond @gol
1092 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
1093 -mfix-at697f -mfix-ut699}
1094
1095 @emph{SPU Options}
1096 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1097 -msafe-dma -munsafe-dma @gol
1098 -mbranch-hints @gol
1099 -msmall-mem -mlarge-mem -mstdmain @gol
1100 -mfixed-range=@var{register-range} @gol
1101 -mea32 -mea64 @gol
1102 -maddress-space-conversion -mno-address-space-conversion @gol
1103 -mcache-size=@var{cache-size} @gol
1104 -matomic-updates -mno-atomic-updates}
1105
1106 @emph{System V Options}
1107 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1108
1109 @emph{TILE-Gx Options}
1110 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1111 -mcmodel=@var{code-model}}
1112
1113 @emph{TILEPro Options}
1114 @gccoptlist{-mcpu=@var{cpu} -m32}
1115
1116 @emph{V850 Options}
1117 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1118 -mprolog-function -mno-prolog-function -mspace @gol
1119 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1120 -mapp-regs -mno-app-regs @gol
1121 -mdisable-callt -mno-disable-callt @gol
1122 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1123 -mv850e -mv850 -mv850e3v5 @gol
1124 -mloop @gol
1125 -mrelax @gol
1126 -mlong-jumps @gol
1127 -msoft-float @gol
1128 -mhard-float @gol
1129 -mgcc-abi @gol
1130 -mrh850-abi @gol
1131 -mbig-switch}
1132
1133 @emph{VAX Options}
1134 @gccoptlist{-mg -mgnu -munix}
1135
1136 @emph{Visium Options}
1137 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1138 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1139
1140 @emph{VMS Options}
1141 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1142 -mpointer-size=@var{size}}
1143
1144 @emph{VxWorks Options}
1145 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1146 -Xbind-lazy -Xbind-now}
1147
1148 @emph{x86 Options}
1149 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1150 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1151 -mfpmath=@var{unit} @gol
1152 -masm=@var{dialect} -mno-fancy-math-387 @gol
1153 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1154 -mno-wide-multiply -mrtd -malign-double @gol
1155 -mpreferred-stack-boundary=@var{num} @gol
1156 -mincoming-stack-boundary=@var{num} @gol
1157 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1158 -mrecip -mrecip=@var{opt} @gol
1159 -mvzeroupper -mprefer-avx128 @gol
1160 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1161 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1162 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1163 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1164 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1165 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
1166 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mclzero
1167 -mpku -mthreads @gol
1168 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1169 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1170 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1171 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1172 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1173 -mregparm=@var{num} -msseregparm @gol
1174 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1175 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1176 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1177 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1178 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1179 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1180 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1181 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1182 -mmitigate-rop -mgeneral-regs-only}
1183
1184 @emph{x86 Windows Options}
1185 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1186 -mnop-fun-dllimport -mthread @gol
1187 -municode -mwin32 -mwindows -fno-set-stack-executable}
1188
1189 @emph{Xstormy16 Options}
1190 @gccoptlist{-msim}
1191
1192 @emph{Xtensa Options}
1193 @gccoptlist{-mconst16 -mno-const16 @gol
1194 -mfused-madd -mno-fused-madd @gol
1195 -mforce-no-pic @gol
1196 -mserialize-volatile -mno-serialize-volatile @gol
1197 -mtext-section-literals -mno-text-section-literals @gol
1198 -mauto-litpools -mno-auto-litpools @gol
1199 -mtarget-align -mno-target-align @gol
1200 -mlongcalls -mno-longcalls}
1201
1202 @emph{zSeries Options}
1203 See S/390 and zSeries Options.
1204 @end table
1205
1206
1207 @node Overall Options
1208 @section Options Controlling the Kind of Output
1209
1210 Compilation can involve up to four stages: preprocessing, compilation
1211 proper, assembly and linking, always in that order. GCC is capable of
1212 preprocessing and compiling several files either into several
1213 assembler input files, or into one assembler input file; then each
1214 assembler input file produces an object file, and linking combines all
1215 the object files (those newly compiled, and those specified as input)
1216 into an executable file.
1217
1218 @cindex file name suffix
1219 For any given input file, the file name suffix determines what kind of
1220 compilation is done:
1221
1222 @table @gcctabopt
1223 @item @var{file}.c
1224 C source code that must be preprocessed.
1225
1226 @item @var{file}.i
1227 C source code that should not be preprocessed.
1228
1229 @item @var{file}.ii
1230 C++ source code that should not be preprocessed.
1231
1232 @item @var{file}.m
1233 Objective-C source code. Note that you must link with the @file{libobjc}
1234 library to make an Objective-C program work.
1235
1236 @item @var{file}.mi
1237 Objective-C source code that should not be preprocessed.
1238
1239 @item @var{file}.mm
1240 @itemx @var{file}.M
1241 Objective-C++ source code. Note that you must link with the @file{libobjc}
1242 library to make an Objective-C++ program work. Note that @samp{.M} refers
1243 to a literal capital M@.
1244
1245 @item @var{file}.mii
1246 Objective-C++ source code that should not be preprocessed.
1247
1248 @item @var{file}.h
1249 C, C++, Objective-C or Objective-C++ header file to be turned into a
1250 precompiled header (default), or C, C++ header file to be turned into an
1251 Ada spec (via the @option{-fdump-ada-spec} switch).
1252
1253 @item @var{file}.cc
1254 @itemx @var{file}.cp
1255 @itemx @var{file}.cxx
1256 @itemx @var{file}.cpp
1257 @itemx @var{file}.CPP
1258 @itemx @var{file}.c++
1259 @itemx @var{file}.C
1260 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1261 the last two letters must both be literally @samp{x}. Likewise,
1262 @samp{.C} refers to a literal capital C@.
1263
1264 @item @var{file}.mm
1265 @itemx @var{file}.M
1266 Objective-C++ source code that must be preprocessed.
1267
1268 @item @var{file}.mii
1269 Objective-C++ source code that should not be preprocessed.
1270
1271 @item @var{file}.hh
1272 @itemx @var{file}.H
1273 @itemx @var{file}.hp
1274 @itemx @var{file}.hxx
1275 @itemx @var{file}.hpp
1276 @itemx @var{file}.HPP
1277 @itemx @var{file}.h++
1278 @itemx @var{file}.tcc
1279 C++ header file to be turned into a precompiled header or Ada spec.
1280
1281 @item @var{file}.f
1282 @itemx @var{file}.for
1283 @itemx @var{file}.ftn
1284 Fixed form Fortran source code that should not be preprocessed.
1285
1286 @item @var{file}.F
1287 @itemx @var{file}.FOR
1288 @itemx @var{file}.fpp
1289 @itemx @var{file}.FPP
1290 @itemx @var{file}.FTN
1291 Fixed form Fortran source code that must be preprocessed (with the traditional
1292 preprocessor).
1293
1294 @item @var{file}.f90
1295 @itemx @var{file}.f95
1296 @itemx @var{file}.f03
1297 @itemx @var{file}.f08
1298 Free form Fortran source code that should not be preprocessed.
1299
1300 @item @var{file}.F90
1301 @itemx @var{file}.F95
1302 @itemx @var{file}.F03
1303 @itemx @var{file}.F08
1304 Free form Fortran source code that must be preprocessed (with the
1305 traditional preprocessor).
1306
1307 @item @var{file}.go
1308 Go source code.
1309
1310 @c FIXME: Descriptions of Java file types.
1311 @c @var{file}.java
1312 @c @var{file}.class
1313 @c @var{file}.zip
1314 @c @var{file}.jar
1315
1316 @item @var{file}.ads
1317 Ada source code file that contains a library unit declaration (a
1318 declaration of a package, subprogram, or generic, or a generic
1319 instantiation), or a library unit renaming declaration (a package,
1320 generic, or subprogram renaming declaration). Such files are also
1321 called @dfn{specs}.
1322
1323 @item @var{file}.adb
1324 Ada source code file containing a library unit body (a subprogram or
1325 package body). Such files are also called @dfn{bodies}.
1326
1327 @c GCC also knows about some suffixes for languages not yet included:
1328 @c Pascal:
1329 @c @var{file}.p
1330 @c @var{file}.pas
1331 @c Ratfor:
1332 @c @var{file}.r
1333
1334 @item @var{file}.s
1335 Assembler code.
1336
1337 @item @var{file}.S
1338 @itemx @var{file}.sx
1339 Assembler code that must be preprocessed.
1340
1341 @item @var{other}
1342 An object file to be fed straight into linking.
1343 Any file name with no recognized suffix is treated this way.
1344 @end table
1345
1346 @opindex x
1347 You can specify the input language explicitly with the @option{-x} option:
1348
1349 @table @gcctabopt
1350 @item -x @var{language}
1351 Specify explicitly the @var{language} for the following input files
1352 (rather than letting the compiler choose a default based on the file
1353 name suffix). This option applies to all following input files until
1354 the next @option{-x} option. Possible values for @var{language} are:
1355 @smallexample
1356 c c-header cpp-output
1357 c++ c++-header c++-cpp-output
1358 objective-c objective-c-header objective-c-cpp-output
1359 objective-c++ objective-c++-header objective-c++-cpp-output
1360 assembler assembler-with-cpp
1361 ada
1362 f77 f77-cpp-input f95 f95-cpp-input
1363 go
1364 java
1365 @end smallexample
1366
1367 @item -x none
1368 Turn off any specification of a language, so that subsequent files are
1369 handled according to their file name suffixes (as they are if @option{-x}
1370 has not been used at all).
1371 @end table
1372
1373 If you only want some of the stages of compilation, you can use
1374 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1375 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1376 @command{gcc} is to stop. Note that some combinations (for example,
1377 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1378
1379 @table @gcctabopt
1380 @item -c
1381 @opindex c
1382 Compile or assemble the source files, but do not link. The linking
1383 stage simply is not done. The ultimate output is in the form of an
1384 object file for each source file.
1385
1386 By default, the object file name for a source file is made by replacing
1387 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1388
1389 Unrecognized input files, not requiring compilation or assembly, are
1390 ignored.
1391
1392 @item -S
1393 @opindex S
1394 Stop after the stage of compilation proper; do not assemble. The output
1395 is in the form of an assembler code file for each non-assembler input
1396 file specified.
1397
1398 By default, the assembler file name for a source file is made by
1399 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1400
1401 Input files that don't require compilation are ignored.
1402
1403 @item -E
1404 @opindex E
1405 Stop after the preprocessing stage; do not run the compiler proper. The
1406 output is in the form of preprocessed source code, which is sent to the
1407 standard output.
1408
1409 Input files that don't require preprocessing are ignored.
1410
1411 @cindex output file option
1412 @item -o @var{file}
1413 @opindex o
1414 Place output in file @var{file}. This applies to whatever
1415 sort of output is being produced, whether it be an executable file,
1416 an object file, an assembler file or preprocessed C code.
1417
1418 If @option{-o} is not specified, the default is to put an executable
1419 file in @file{a.out}, the object file for
1420 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1421 assembler file in @file{@var{source}.s}, a precompiled header file in
1422 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1423 standard output.
1424
1425 @item -v
1426 @opindex v
1427 Print (on standard error output) the commands executed to run the stages
1428 of compilation. Also print the version number of the compiler driver
1429 program and of the preprocessor and the compiler proper.
1430
1431 @item -###
1432 @opindex ###
1433 Like @option{-v} except the commands are not executed and arguments
1434 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1435 This is useful for shell scripts to capture the driver-generated command lines.
1436
1437 @item --help
1438 @opindex help
1439 Print (on the standard output) a description of the command-line options
1440 understood by @command{gcc}. If the @option{-v} option is also specified
1441 then @option{--help} is also passed on to the various processes
1442 invoked by @command{gcc}, so that they can display the command-line options
1443 they accept. If the @option{-Wextra} option has also been specified
1444 (prior to the @option{--help} option), then command-line options that
1445 have no documentation associated with them are also displayed.
1446
1447 @item --target-help
1448 @opindex target-help
1449 Print (on the standard output) a description of target-specific command-line
1450 options for each tool. For some targets extra target-specific
1451 information may also be printed.
1452
1453 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1454 Print (on the standard output) a description of the command-line
1455 options understood by the compiler that fit into all specified classes
1456 and qualifiers. These are the supported classes:
1457
1458 @table @asis
1459 @item @samp{optimizers}
1460 Display all of the optimization options supported by the
1461 compiler.
1462
1463 @item @samp{warnings}
1464 Display all of the options controlling warning messages
1465 produced by the compiler.
1466
1467 @item @samp{target}
1468 Display target-specific options. Unlike the
1469 @option{--target-help} option however, target-specific options of the
1470 linker and assembler are not displayed. This is because those
1471 tools do not currently support the extended @option{--help=} syntax.
1472
1473 @item @samp{params}
1474 Display the values recognized by the @option{--param}
1475 option.
1476
1477 @item @var{language}
1478 Display the options supported for @var{language}, where
1479 @var{language} is the name of one of the languages supported in this
1480 version of GCC@.
1481
1482 @item @samp{common}
1483 Display the options that are common to all languages.
1484 @end table
1485
1486 These are the supported qualifiers:
1487
1488 @table @asis
1489 @item @samp{undocumented}
1490 Display only those options that are undocumented.
1491
1492 @item @samp{joined}
1493 Display options taking an argument that appears after an equal
1494 sign in the same continuous piece of text, such as:
1495 @samp{--help=target}.
1496
1497 @item @samp{separate}
1498 Display options taking an argument that appears as a separate word
1499 following the original option, such as: @samp{-o output-file}.
1500 @end table
1501
1502 Thus for example to display all the undocumented target-specific
1503 switches supported by the compiler, use:
1504
1505 @smallexample
1506 --help=target,undocumented
1507 @end smallexample
1508
1509 The sense of a qualifier can be inverted by prefixing it with the
1510 @samp{^} character, so for example to display all binary warning
1511 options (i.e., ones that are either on or off and that do not take an
1512 argument) that have a description, use:
1513
1514 @smallexample
1515 --help=warnings,^joined,^undocumented
1516 @end smallexample
1517
1518 The argument to @option{--help=} should not consist solely of inverted
1519 qualifiers.
1520
1521 Combining several classes is possible, although this usually
1522 restricts the output so much that there is nothing to display. One
1523 case where it does work, however, is when one of the classes is
1524 @var{target}. For example, to display all the target-specific
1525 optimization options, use:
1526
1527 @smallexample
1528 --help=target,optimizers
1529 @end smallexample
1530
1531 The @option{--help=} option can be repeated on the command line. Each
1532 successive use displays its requested class of options, skipping
1533 those that have already been displayed.
1534
1535 If the @option{-Q} option appears on the command line before the
1536 @option{--help=} option, then the descriptive text displayed by
1537 @option{--help=} is changed. Instead of describing the displayed
1538 options, an indication is given as to whether the option is enabled,
1539 disabled or set to a specific value (assuming that the compiler
1540 knows this at the point where the @option{--help=} option is used).
1541
1542 Here is a truncated example from the ARM port of @command{gcc}:
1543
1544 @smallexample
1545 % gcc -Q -mabi=2 --help=target -c
1546 The following options are target specific:
1547 -mabi= 2
1548 -mabort-on-noreturn [disabled]
1549 -mapcs [disabled]
1550 @end smallexample
1551
1552 The output is sensitive to the effects of previous command-line
1553 options, so for example it is possible to find out which optimizations
1554 are enabled at @option{-O2} by using:
1555
1556 @smallexample
1557 -Q -O2 --help=optimizers
1558 @end smallexample
1559
1560 Alternatively you can discover which binary optimizations are enabled
1561 by @option{-O3} by using:
1562
1563 @smallexample
1564 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1565 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1566 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1567 @end smallexample
1568
1569 @item --version
1570 @opindex version
1571 Display the version number and copyrights of the invoked GCC@.
1572
1573 @item -pass-exit-codes
1574 @opindex pass-exit-codes
1575 Normally the @command{gcc} program exits with the code of 1 if any
1576 phase of the compiler returns a non-success return code. If you specify
1577 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1578 the numerically highest error produced by any phase returning an error
1579 indication. The C, C++, and Fortran front ends return 4 if an internal
1580 compiler error is encountered.
1581
1582 @item -pipe
1583 @opindex pipe
1584 Use pipes rather than temporary files for communication between the
1585 various stages of compilation. This fails to work on some systems where
1586 the assembler is unable to read from a pipe; but the GNU assembler has
1587 no trouble.
1588
1589 @item -specs=@var{file}
1590 @opindex specs
1591 Process @var{file} after the compiler reads in the standard @file{specs}
1592 file, in order to override the defaults which the @command{gcc} driver
1593 program uses when determining what switches to pass to @command{cc1},
1594 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1595 @option{-specs=@var{file}} can be specified on the command line, and they
1596 are processed in order, from left to right. @xref{Spec Files}, for
1597 information about the format of the @var{file}.
1598
1599 @item -wrapper
1600 @opindex wrapper
1601 Invoke all subcommands under a wrapper program. The name of the
1602 wrapper program and its parameters are passed as a comma separated
1603 list.
1604
1605 @smallexample
1606 gcc -c t.c -wrapper gdb,--args
1607 @end smallexample
1608
1609 @noindent
1610 This invokes all subprograms of @command{gcc} under
1611 @samp{gdb --args}, thus the invocation of @command{cc1} is
1612 @samp{gdb --args cc1 @dots{}}.
1613
1614 @item -fplugin=@var{name}.so
1615 @opindex fplugin
1616 Load the plugin code in file @var{name}.so, assumed to be a
1617 shared object to be dlopen'd by the compiler. The base name of
1618 the shared object file is used to identify the plugin for the
1619 purposes of argument parsing (See
1620 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1621 Each plugin should define the callback functions specified in the
1622 Plugins API.
1623
1624 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1625 @opindex fplugin-arg
1626 Define an argument called @var{key} with a value of @var{value}
1627 for the plugin called @var{name}.
1628
1629 @item -fdump-ada-spec@r{[}-slim@r{]}
1630 @opindex fdump-ada-spec
1631 For C and C++ source and include files, generate corresponding Ada specs.
1632 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1633 GNAT User's Guide}, which provides detailed documentation on this feature.
1634
1635 @item -fada-spec-parent=@var{unit}
1636 @opindex fada-spec-parent
1637 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1638 Ada specs as child units of parent @var{unit}.
1639
1640 @item -fdump-go-spec=@var{file}
1641 @opindex fdump-go-spec
1642 For input files in any language, generate corresponding Go
1643 declarations in @var{file}. This generates Go @code{const},
1644 @code{type}, @code{var}, and @code{func} declarations which may be a
1645 useful way to start writing a Go interface to code written in some
1646 other language.
1647
1648 @include @value{srcdir}/../libiberty/at-file.texi
1649 @end table
1650
1651 @node Invoking G++
1652 @section Compiling C++ Programs
1653
1654 @cindex suffixes for C++ source
1655 @cindex C++ source file suffixes
1656 C++ source files conventionally use one of the suffixes @samp{.C},
1657 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1658 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1659 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1660 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1661 files with these names and compiles them as C++ programs even if you
1662 call the compiler the same way as for compiling C programs (usually
1663 with the name @command{gcc}).
1664
1665 @findex g++
1666 @findex c++
1667 However, the use of @command{gcc} does not add the C++ library.
1668 @command{g++} is a program that calls GCC and automatically specifies linking
1669 against the C++ library. It treats @samp{.c},
1670 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1671 files unless @option{-x} is used. This program is also useful when
1672 precompiling a C header file with a @samp{.h} extension for use in C++
1673 compilations. On many systems, @command{g++} is also installed with
1674 the name @command{c++}.
1675
1676 @cindex invoking @command{g++}
1677 When you compile C++ programs, you may specify many of the same
1678 command-line options that you use for compiling programs in any
1679 language; or command-line options meaningful for C and related
1680 languages; or options that are meaningful only for C++ programs.
1681 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1682 explanations of options for languages related to C@.
1683 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1684 explanations of options that are meaningful only for C++ programs.
1685
1686 @node C Dialect Options
1687 @section Options Controlling C Dialect
1688 @cindex dialect options
1689 @cindex language dialect options
1690 @cindex options, dialect
1691
1692 The following options control the dialect of C (or languages derived
1693 from C, such as C++, Objective-C and Objective-C++) that the compiler
1694 accepts:
1695
1696 @table @gcctabopt
1697 @cindex ANSI support
1698 @cindex ISO support
1699 @item -ansi
1700 @opindex ansi
1701 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1702 equivalent to @option{-std=c++98}.
1703
1704 This turns off certain features of GCC that are incompatible with ISO
1705 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1706 such as the @code{asm} and @code{typeof} keywords, and
1707 predefined macros such as @code{unix} and @code{vax} that identify the
1708 type of system you are using. It also enables the undesirable and
1709 rarely used ISO trigraph feature. For the C compiler,
1710 it disables recognition of C++ style @samp{//} comments as well as
1711 the @code{inline} keyword.
1712
1713 The alternate keywords @code{__asm__}, @code{__extension__},
1714 @code{__inline__} and @code{__typeof__} continue to work despite
1715 @option{-ansi}. You would not want to use them in an ISO C program, of
1716 course, but it is useful to put them in header files that might be included
1717 in compilations done with @option{-ansi}. Alternate predefined macros
1718 such as @code{__unix__} and @code{__vax__} are also available, with or
1719 without @option{-ansi}.
1720
1721 The @option{-ansi} option does not cause non-ISO programs to be
1722 rejected gratuitously. For that, @option{-Wpedantic} is required in
1723 addition to @option{-ansi}. @xref{Warning Options}.
1724
1725 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1726 option is used. Some header files may notice this macro and refrain
1727 from declaring certain functions or defining certain macros that the
1728 ISO standard doesn't call for; this is to avoid interfering with any
1729 programs that might use these names for other things.
1730
1731 Functions that are normally built in but do not have semantics
1732 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1733 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1734 built-in functions provided by GCC}, for details of the functions
1735 affected.
1736
1737 @item -std=
1738 @opindex std
1739 Determine the language standard. @xref{Standards,,Language Standards
1740 Supported by GCC}, for details of these standard versions. This option
1741 is currently only supported when compiling C or C++.
1742
1743 The compiler can accept several base standards, such as @samp{c90} or
1744 @samp{c++98}, and GNU dialects of those standards, such as
1745 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1746 compiler accepts all programs following that standard plus those
1747 using GNU extensions that do not contradict it. For example,
1748 @option{-std=c90} turns off certain features of GCC that are
1749 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1750 keywords, but not other GNU extensions that do not have a meaning in
1751 ISO C90, such as omitting the middle term of a @code{?:}
1752 expression. On the other hand, when a GNU dialect of a standard is
1753 specified, all features supported by the compiler are enabled, even when
1754 those features change the meaning of the base standard. As a result, some
1755 strict-conforming programs may be rejected. The particular standard
1756 is used by @option{-Wpedantic} to identify which features are GNU
1757 extensions given that version of the standard. For example
1758 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1759 comments, while @option{-std=gnu99 -Wpedantic} does not.
1760
1761 A value for this option must be provided; possible values are
1762
1763 @table @samp
1764 @item c90
1765 @itemx c89
1766 @itemx iso9899:1990
1767 Support all ISO C90 programs (certain GNU extensions that conflict
1768 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1769
1770 @item iso9899:199409
1771 ISO C90 as modified in amendment 1.
1772
1773 @item c99
1774 @itemx c9x
1775 @itemx iso9899:1999
1776 @itemx iso9899:199x
1777 ISO C99. This standard is substantially completely supported, modulo
1778 bugs and floating-point issues
1779 (mainly but not entirely relating to optional C99 features from
1780 Annexes F and G). See
1781 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1782 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1783
1784 @item c11
1785 @itemx c1x
1786 @itemx iso9899:2011
1787 ISO C11, the 2011 revision of the ISO C standard. This standard is
1788 substantially completely supported, modulo bugs, floating-point issues
1789 (mainly but not entirely relating to optional C11 features from
1790 Annexes F and G) and the optional Annexes K (Bounds-checking
1791 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1792
1793 @item gnu90
1794 @itemx gnu89
1795 GNU dialect of ISO C90 (including some C99 features).
1796
1797 @item gnu99
1798 @itemx gnu9x
1799 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1800
1801 @item gnu11
1802 @itemx gnu1x
1803 GNU dialect of ISO C11. This is the default for C code.
1804 The name @samp{gnu1x} is deprecated.
1805
1806 @item c++98
1807 @itemx c++03
1808 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1809 additional defect reports. Same as @option{-ansi} for C++ code.
1810
1811 @item gnu++98
1812 @itemx gnu++03
1813 GNU dialect of @option{-std=c++98}.
1814
1815 @item c++11
1816 @itemx c++0x
1817 The 2011 ISO C++ standard plus amendments.
1818 The name @samp{c++0x} is deprecated.
1819
1820 @item gnu++11
1821 @itemx gnu++0x
1822 GNU dialect of @option{-std=c++11}.
1823 The name @samp{gnu++0x} is deprecated.
1824
1825 @item c++14
1826 @itemx c++1y
1827 The 2014 ISO C++ standard plus amendments.
1828 The name @samp{c++1y} is deprecated.
1829
1830 @item gnu++14
1831 @itemx gnu++1y
1832 GNU dialect of @option{-std=c++14}.
1833 This is the default for C++ code.
1834 The name @samp{gnu++1y} is deprecated.
1835
1836 @item c++1z
1837 The next revision of the ISO C++ standard, tentatively planned for
1838 2017. Support is highly experimental, and will almost certainly
1839 change in incompatible ways in future releases.
1840
1841 @item gnu++1z
1842 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1843 and will almost certainly change in incompatible ways in future
1844 releases.
1845 @end table
1846
1847 @item -fgnu89-inline
1848 @opindex fgnu89-inline
1849 The option @option{-fgnu89-inline} tells GCC to use the traditional
1850 GNU semantics for @code{inline} functions when in C99 mode.
1851 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1852 Using this option is roughly equivalent to adding the
1853 @code{gnu_inline} function attribute to all inline functions
1854 (@pxref{Function Attributes}).
1855
1856 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1857 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1858 specifies the default behavior).
1859 This option is not supported in @option{-std=c90} or
1860 @option{-std=gnu90} mode.
1861
1862 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1863 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1864 in effect for @code{inline} functions. @xref{Common Predefined
1865 Macros,,,cpp,The C Preprocessor}.
1866
1867 @item -aux-info @var{filename}
1868 @opindex aux-info
1869 Output to the given filename prototyped declarations for all functions
1870 declared and/or defined in a translation unit, including those in header
1871 files. This option is silently ignored in any language other than C@.
1872
1873 Besides declarations, the file indicates, in comments, the origin of
1874 each declaration (source file and line), whether the declaration was
1875 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1876 @samp{O} for old, respectively, in the first character after the line
1877 number and the colon), and whether it came from a declaration or a
1878 definition (@samp{C} or @samp{F}, respectively, in the following
1879 character). In the case of function definitions, a K&R-style list of
1880 arguments followed by their declarations is also provided, inside
1881 comments, after the declaration.
1882
1883 @item -fallow-parameterless-variadic-functions
1884 @opindex fallow-parameterless-variadic-functions
1885 Accept variadic functions without named parameters.
1886
1887 Although it is possible to define such a function, this is not very
1888 useful as it is not possible to read the arguments. This is only
1889 supported for C as this construct is allowed by C++.
1890
1891 @item -fno-asm
1892 @opindex fno-asm
1893 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1894 keyword, so that code can use these words as identifiers. You can use
1895 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1896 instead. @option{-ansi} implies @option{-fno-asm}.
1897
1898 In C++, this switch only affects the @code{typeof} keyword, since
1899 @code{asm} and @code{inline} are standard keywords. You may want to
1900 use the @option{-fno-gnu-keywords} flag instead, which has the same
1901 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1902 switch only affects the @code{asm} and @code{typeof} keywords, since
1903 @code{inline} is a standard keyword in ISO C99.
1904
1905 @item -fno-builtin
1906 @itemx -fno-builtin-@var{function}
1907 @opindex fno-builtin
1908 @cindex built-in functions
1909 Don't recognize built-in functions that do not begin with
1910 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1911 functions provided by GCC}, for details of the functions affected,
1912 including those which are not built-in functions when @option{-ansi} or
1913 @option{-std} options for strict ISO C conformance are used because they
1914 do not have an ISO standard meaning.
1915
1916 GCC normally generates special code to handle certain built-in functions
1917 more efficiently; for instance, calls to @code{alloca} may become single
1918 instructions which adjust the stack directly, and calls to @code{memcpy}
1919 may become inline copy loops. The resulting code is often both smaller
1920 and faster, but since the function calls no longer appear as such, you
1921 cannot set a breakpoint on those calls, nor can you change the behavior
1922 of the functions by linking with a different library. In addition,
1923 when a function is recognized as a built-in function, GCC may use
1924 information about that function to warn about problems with calls to
1925 that function, or to generate more efficient code, even if the
1926 resulting code still contains calls to that function. For example,
1927 warnings are given with @option{-Wformat} for bad calls to
1928 @code{printf} when @code{printf} is built in and @code{strlen} is
1929 known not to modify global memory.
1930
1931 With the @option{-fno-builtin-@var{function}} option
1932 only the built-in function @var{function} is
1933 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1934 function is named that is not built-in in this version of GCC, this
1935 option is ignored. There is no corresponding
1936 @option{-fbuiltin-@var{function}} option; if you wish to enable
1937 built-in functions selectively when using @option{-fno-builtin} or
1938 @option{-ffreestanding}, you may define macros such as:
1939
1940 @smallexample
1941 #define abs(n) __builtin_abs ((n))
1942 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1943 @end smallexample
1944
1945 @item -fhosted
1946 @opindex fhosted
1947 @cindex hosted environment
1948
1949 Assert that compilation targets a hosted environment. This implies
1950 @option{-fbuiltin}. A hosted environment is one in which the
1951 entire standard library is available, and in which @code{main} has a return
1952 type of @code{int}. Examples are nearly everything except a kernel.
1953 This is equivalent to @option{-fno-freestanding}.
1954
1955 @item -ffreestanding
1956 @opindex ffreestanding
1957 @cindex hosted environment
1958
1959 Assert that compilation targets a freestanding environment. This
1960 implies @option{-fno-builtin}. A freestanding environment
1961 is one in which the standard library may not exist, and program startup may
1962 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1963 This is equivalent to @option{-fno-hosted}.
1964
1965 @xref{Standards,,Language Standards Supported by GCC}, for details of
1966 freestanding and hosted environments.
1967
1968 @item -fopenacc
1969 @opindex fopenacc
1970 @cindex OpenACC accelerator programming
1971 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
1972 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
1973 compiler generates accelerated code according to the OpenACC Application
1974 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
1975 implies @option{-pthread}, and thus is only supported on targets that
1976 have support for @option{-pthread}.
1977
1978 @item -fopenacc-dim=@var{geom}
1979 @opindex fopenacc-dim
1980 @cindex OpenACC accelerator programming
1981 Specify default compute dimensions for parallel offload regions that do
1982 not explicitly specify. The @var{geom} value is a triple of
1983 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
1984 can be omitted, to use a target-specific default value.
1985
1986 @item -fopenmp
1987 @opindex fopenmp
1988 @cindex OpenMP parallel
1989 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1990 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1991 compiler generates parallel code according to the OpenMP Application
1992 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
1993 implies @option{-pthread}, and thus is only supported on targets that
1994 have support for @option{-pthread}. @option{-fopenmp} implies
1995 @option{-fopenmp-simd}.
1996
1997 @item -fopenmp-simd
1998 @opindex fopenmp-simd
1999 @cindex OpenMP SIMD
2000 @cindex SIMD
2001 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2002 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2003 are ignored.
2004
2005 @item -fcilkplus
2006 @opindex fcilkplus
2007 @cindex Enable Cilk Plus
2008 Enable the usage of Cilk Plus language extension features for C/C++.
2009 When the option @option{-fcilkplus} is specified, enable the usage of
2010 the Cilk Plus Language extension features for C/C++. The present
2011 implementation follows ABI version 1.2. This is an experimental
2012 feature that is only partially complete, and whose interface may
2013 change in future versions of GCC as the official specification
2014 changes. Currently, all features but @code{_Cilk_for} have been
2015 implemented.
2016
2017 @item -fgnu-tm
2018 @opindex fgnu-tm
2019 When the option @option{-fgnu-tm} is specified, the compiler
2020 generates code for the Linux variant of Intel's current Transactional
2021 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2022 an experimental feature whose interface may change in future versions
2023 of GCC, as the official specification changes. Please note that not
2024 all architectures are supported for this feature.
2025
2026 For more information on GCC's support for transactional memory,
2027 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2028 Transactional Memory Library}.
2029
2030 Note that the transactional memory feature is not supported with
2031 non-call exceptions (@option{-fnon-call-exceptions}).
2032
2033 @item -fms-extensions
2034 @opindex fms-extensions
2035 Accept some non-standard constructs used in Microsoft header files.
2036
2037 In C++ code, this allows member names in structures to be similar
2038 to previous types declarations.
2039
2040 @smallexample
2041 typedef int UOW;
2042 struct ABC @{
2043 UOW UOW;
2044 @};
2045 @end smallexample
2046
2047 Some cases of unnamed fields in structures and unions are only
2048 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2049 fields within structs/unions}, for details.
2050
2051 Note that this option is off for all targets but x86
2052 targets using ms-abi.
2053
2054 @item -fplan9-extensions
2055 @opindex fplan9-extensions
2056 Accept some non-standard constructs used in Plan 9 code.
2057
2058 This enables @option{-fms-extensions}, permits passing pointers to
2059 structures with anonymous fields to functions that expect pointers to
2060 elements of the type of the field, and permits referring to anonymous
2061 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2062 struct/union fields within structs/unions}, for details. This is only
2063 supported for C, not C++.
2064
2065 @item -trigraphs
2066 @opindex trigraphs
2067 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
2068 options for strict ISO C conformance) implies @option{-trigraphs}.
2069
2070 @cindex traditional C language
2071 @cindex C language, traditional
2072 @item -traditional
2073 @itemx -traditional-cpp
2074 @opindex traditional-cpp
2075 @opindex traditional
2076 Formerly, these options caused GCC to attempt to emulate a pre-standard
2077 C compiler. They are now only supported with the @option{-E} switch.
2078 The preprocessor continues to support a pre-standard mode. See the GNU
2079 CPP manual for details.
2080
2081 @item -fcond-mismatch
2082 @opindex fcond-mismatch
2083 Allow conditional expressions with mismatched types in the second and
2084 third arguments. The value of such an expression is void. This option
2085 is not supported for C++.
2086
2087 @item -flax-vector-conversions
2088 @opindex flax-vector-conversions
2089 Allow implicit conversions between vectors with differing numbers of
2090 elements and/or incompatible element types. This option should not be
2091 used for new code.
2092
2093 @item -funsigned-char
2094 @opindex funsigned-char
2095 Let the type @code{char} be unsigned, like @code{unsigned char}.
2096
2097 Each kind of machine has a default for what @code{char} should
2098 be. It is either like @code{unsigned char} by default or like
2099 @code{signed char} by default.
2100
2101 Ideally, a portable program should always use @code{signed char} or
2102 @code{unsigned char} when it depends on the signedness of an object.
2103 But many programs have been written to use plain @code{char} and
2104 expect it to be signed, or expect it to be unsigned, depending on the
2105 machines they were written for. This option, and its inverse, let you
2106 make such a program work with the opposite default.
2107
2108 The type @code{char} is always a distinct type from each of
2109 @code{signed char} or @code{unsigned char}, even though its behavior
2110 is always just like one of those two.
2111
2112 @item -fsigned-char
2113 @opindex fsigned-char
2114 Let the type @code{char} be signed, like @code{signed char}.
2115
2116 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2117 the negative form of @option{-funsigned-char}. Likewise, the option
2118 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2119
2120 @item -fsigned-bitfields
2121 @itemx -funsigned-bitfields
2122 @itemx -fno-signed-bitfields
2123 @itemx -fno-unsigned-bitfields
2124 @opindex fsigned-bitfields
2125 @opindex funsigned-bitfields
2126 @opindex fno-signed-bitfields
2127 @opindex fno-unsigned-bitfields
2128 These options control whether a bit-field is signed or unsigned, when the
2129 declaration does not use either @code{signed} or @code{unsigned}. By
2130 default, such a bit-field is signed, because this is consistent: the
2131 basic integer types such as @code{int} are signed types.
2132
2133 @item -fsso-struct=@var{endianness}
2134 @opindex fsso-struct
2135 Set the default scalar storage order of structures and unions to the
2136 specified endianness. The accepted values are @samp{big-endian} and
2137 @samp{little-endian}. If the option is not passed, the compiler uses
2138 the native endianness of the target. This option is not supported for C++.
2139
2140 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2141 code that is not binary compatible with code generated without it if the
2142 specified endianness is not the native endianness of the target.
2143 @end table
2144
2145 @node C++ Dialect Options
2146 @section Options Controlling C++ Dialect
2147
2148 @cindex compiler options, C++
2149 @cindex C++ options, command-line
2150 @cindex options, C++
2151 This section describes the command-line options that are only meaningful
2152 for C++ programs. You can also use most of the GNU compiler options
2153 regardless of what language your program is in. For example, you
2154 might compile a file @file{firstClass.C} like this:
2155
2156 @smallexample
2157 g++ -g -fstrict-enums -O -c firstClass.C
2158 @end smallexample
2159
2160 @noindent
2161 In this example, only @option{-fstrict-enums} is an option meant
2162 only for C++ programs; you can use the other options with any
2163 language supported by GCC@.
2164
2165 Some options for compiling C programs, such as @option{-std}, are also
2166 relevant for C++ programs.
2167 @xref{C Dialect Options,,Options Controlling C Dialect}.
2168
2169 Here is a list of options that are @emph{only} for compiling C++ programs:
2170
2171 @table @gcctabopt
2172
2173 @item -fabi-version=@var{n}
2174 @opindex fabi-version
2175 Use version @var{n} of the C++ ABI@. The default is version 0.
2176
2177 Version 0 refers to the version conforming most closely to
2178 the C++ ABI specification. Therefore, the ABI obtained using version 0
2179 will change in different versions of G++ as ABI bugs are fixed.
2180
2181 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2182
2183 Version 2 is the version of the C++ ABI that first appeared in G++
2184 3.4, and was the default through G++ 4.9.
2185
2186 Version 3 corrects an error in mangling a constant address as a
2187 template argument.
2188
2189 Version 4, which first appeared in G++ 4.5, implements a standard
2190 mangling for vector types.
2191
2192 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2193 attribute const/volatile on function pointer types, decltype of a
2194 plain decl, and use of a function parameter in the declaration of
2195 another parameter.
2196
2197 Version 6, which first appeared in G++ 4.7, corrects the promotion
2198 behavior of C++11 scoped enums and the mangling of template argument
2199 packs, const/static_cast, prefix ++ and --, and a class scope function
2200 used as a template argument.
2201
2202 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2203 builtin type and corrects the mangling of lambdas in default argument
2204 scope.
2205
2206 Version 8, which first appeared in G++ 4.9, corrects the substitution
2207 behavior of function types with function-cv-qualifiers.
2208
2209 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2210 @code{nullptr_t}.
2211
2212 Version 10, which first appeared in G++ 6.1, adds mangling of
2213 attributes that affect type identity, such as ia32 calling convention
2214 attributes (e.g. @samp{stdcall}).
2215
2216 See also @option{-Wabi}.
2217
2218 @item -fabi-compat-version=@var{n}
2219 @opindex fabi-compat-version
2220 On targets that support strong aliases, G++
2221 works around mangling changes by creating an alias with the correct
2222 mangled name when defining a symbol with an incorrect mangled name.
2223 This switch specifies which ABI version to use for the alias.
2224
2225 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2226 compatibility). If another ABI version is explicitly selected, this
2227 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2228 use @option{-fabi-compat-version=2}.
2229
2230 If this option is not provided but @option{-Wabi=@var{n}} is, that
2231 version is used for compatibility aliases. If this option is provided
2232 along with @option{-Wabi} (without the version), the version from this
2233 option is used for the warning.
2234
2235 @item -fno-access-control
2236 @opindex fno-access-control
2237 Turn off all access checking. This switch is mainly useful for working
2238 around bugs in the access control code.
2239
2240 @item -fcheck-new
2241 @opindex fcheck-new
2242 Check that the pointer returned by @code{operator new} is non-null
2243 before attempting to modify the storage allocated. This check is
2244 normally unnecessary because the C++ standard specifies that
2245 @code{operator new} only returns @code{0} if it is declared
2246 @code{throw()}, in which case the compiler always checks the
2247 return value even without this option. In all other cases, when
2248 @code{operator new} has a non-empty exception specification, memory
2249 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2250 @samp{new (nothrow)}.
2251
2252 @item -fconcepts
2253 @opindex fconcepts
2254 Enable support for the C++ Extensions for Concepts Technical
2255 Specification, ISO 19217 (2015), which allows code like
2256
2257 @smallexample
2258 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2259 template <Addable T> T add (T a, T b) @{ return a + b; @}
2260 @end smallexample
2261
2262 @item -fconstexpr-depth=@var{n}
2263 @opindex fconstexpr-depth
2264 Set the maximum nested evaluation depth for C++11 constexpr functions
2265 to @var{n}. A limit is needed to detect endless recursion during
2266 constant expression evaluation. The minimum specified by the standard
2267 is 512.
2268
2269 @item -fconstexpr-loop-limit=@var{n}
2270 @opindex fconstexpr-loop-limit
2271 Set the maximum number of iterations for a loop in C++14 constexpr functions
2272 to @var{n}. A limit is needed to detect infinite loops during
2273 constant expression evaluation. The default is 262144 (1<<18).
2274
2275 @item -fdeduce-init-list
2276 @opindex fdeduce-init-list
2277 Enable deduction of a template type parameter as
2278 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2279
2280 @smallexample
2281 template <class T> auto forward(T t) -> decltype (realfn (t))
2282 @{
2283 return realfn (t);
2284 @}
2285
2286 void f()
2287 @{
2288 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2289 @}
2290 @end smallexample
2291
2292 This deduction was implemented as a possible extension to the
2293 originally proposed semantics for the C++11 standard, but was not part
2294 of the final standard, so it is disabled by default. This option is
2295 deprecated, and may be removed in a future version of G++.
2296
2297 @item -ffriend-injection
2298 @opindex ffriend-injection
2299 Inject friend functions into the enclosing namespace, so that they are
2300 visible outside the scope of the class in which they are declared.
2301 Friend functions were documented to work this way in the old Annotated
2302 C++ Reference Manual.
2303 However, in ISO C++ a friend function that is not declared
2304 in an enclosing scope can only be found using argument dependent
2305 lookup. GCC defaults to the standard behavior.
2306
2307 This option is for compatibility, and may be removed in a future
2308 release of G++.
2309
2310 @item -fno-elide-constructors
2311 @opindex fno-elide-constructors
2312 The C++ standard allows an implementation to omit creating a temporary
2313 that is only used to initialize another object of the same type.
2314 Specifying this option disables that optimization, and forces G++ to
2315 call the copy constructor in all cases.
2316
2317 @item -fno-enforce-eh-specs
2318 @opindex fno-enforce-eh-specs
2319 Don't generate code to check for violation of exception specifications
2320 at run time. This option violates the C++ standard, but may be useful
2321 for reducing code size in production builds, much like defining
2322 @code{NDEBUG}. This does not give user code permission to throw
2323 exceptions in violation of the exception specifications; the compiler
2324 still optimizes based on the specifications, so throwing an
2325 unexpected exception results in undefined behavior at run time.
2326
2327 @item -fextern-tls-init
2328 @itemx -fno-extern-tls-init
2329 @opindex fextern-tls-init
2330 @opindex fno-extern-tls-init
2331 The C++11 and OpenMP standards allow @code{thread_local} and
2332 @code{threadprivate} variables to have dynamic (runtime)
2333 initialization. To support this, any use of such a variable goes
2334 through a wrapper function that performs any necessary initialization.
2335 When the use and definition of the variable are in the same
2336 translation unit, this overhead can be optimized away, but when the
2337 use is in a different translation unit there is significant overhead
2338 even if the variable doesn't actually need dynamic initialization. If
2339 the programmer can be sure that no use of the variable in a
2340 non-defining TU needs to trigger dynamic initialization (either
2341 because the variable is statically initialized, or a use of the
2342 variable in the defining TU will be executed before any uses in
2343 another TU), they can avoid this overhead with the
2344 @option{-fno-extern-tls-init} option.
2345
2346 On targets that support symbol aliases, the default is
2347 @option{-fextern-tls-init}. On targets that do not support symbol
2348 aliases, the default is @option{-fno-extern-tls-init}.
2349
2350 @item -ffor-scope
2351 @itemx -fno-for-scope
2352 @opindex ffor-scope
2353 @opindex fno-for-scope
2354 If @option{-ffor-scope} is specified, the scope of variables declared in
2355 a @i{for-init-statement} is limited to the @code{for} loop itself,
2356 as specified by the C++ standard.
2357 If @option{-fno-for-scope} is specified, the scope of variables declared in
2358 a @i{for-init-statement} extends to the end of the enclosing scope,
2359 as was the case in old versions of G++, and other (traditional)
2360 implementations of C++.
2361
2362 If neither flag is given, the default is to follow the standard,
2363 but to allow and give a warning for old-style code that would
2364 otherwise be invalid, or have different behavior.
2365
2366 @item -fno-gnu-keywords
2367 @opindex fno-gnu-keywords
2368 Do not recognize @code{typeof} as a keyword, so that code can use this
2369 word as an identifier. You can use the keyword @code{__typeof__} instead.
2370 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2371 @option{-std=c++98}, @option{-std=c++11}, etc.
2372
2373 @item -fno-implicit-templates
2374 @opindex fno-implicit-templates
2375 Never emit code for non-inline templates that are instantiated
2376 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2377 @xref{Template Instantiation}, for more information.
2378
2379 @item -fno-implicit-inline-templates
2380 @opindex fno-implicit-inline-templates
2381 Don't emit code for implicit instantiations of inline templates, either.
2382 The default is to handle inlines differently so that compiles with and
2383 without optimization need the same set of explicit instantiations.
2384
2385 @item -fno-implement-inlines
2386 @opindex fno-implement-inlines
2387 To save space, do not emit out-of-line copies of inline functions
2388 controlled by @code{#pragma implementation}. This causes linker
2389 errors if these functions are not inlined everywhere they are called.
2390
2391 @item -fms-extensions
2392 @opindex fms-extensions
2393 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2394 int and getting a pointer to member function via non-standard syntax.
2395
2396 @item -fno-nonansi-builtins
2397 @opindex fno-nonansi-builtins
2398 Disable built-in declarations of functions that are not mandated by
2399 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2400 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2401
2402 @item -fnothrow-opt
2403 @opindex fnothrow-opt
2404 Treat a @code{throw()} exception specification as if it were a
2405 @code{noexcept} specification to reduce or eliminate the text size
2406 overhead relative to a function with no exception specification. If
2407 the function has local variables of types with non-trivial
2408 destructors, the exception specification actually makes the
2409 function smaller because the EH cleanups for those variables can be
2410 optimized away. The semantic effect is that an exception thrown out of
2411 a function with such an exception specification results in a call
2412 to @code{terminate} rather than @code{unexpected}.
2413
2414 @item -fno-operator-names
2415 @opindex fno-operator-names
2416 Do not treat the operator name keywords @code{and}, @code{bitand},
2417 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2418 synonyms as keywords.
2419
2420 @item -fno-optional-diags
2421 @opindex fno-optional-diags
2422 Disable diagnostics that the standard says a compiler does not need to
2423 issue. Currently, the only such diagnostic issued by G++ is the one for
2424 a name having multiple meanings within a class.
2425
2426 @item -fpermissive
2427 @opindex fpermissive
2428 Downgrade some diagnostics about nonconformant code from errors to
2429 warnings. Thus, using @option{-fpermissive} allows some
2430 nonconforming code to compile.
2431
2432 @item -fno-pretty-templates
2433 @opindex fno-pretty-templates
2434 When an error message refers to a specialization of a function
2435 template, the compiler normally prints the signature of the
2436 template followed by the template arguments and any typedefs or
2437 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2438 rather than @code{void f(int)}) so that it's clear which template is
2439 involved. When an error message refers to a specialization of a class
2440 template, the compiler omits any template arguments that match
2441 the default template arguments for that template. If either of these
2442 behaviors make it harder to understand the error message rather than
2443 easier, you can use @option{-fno-pretty-templates} to disable them.
2444
2445 @item -frepo
2446 @opindex frepo
2447 Enable automatic template instantiation at link time. This option also
2448 implies @option{-fno-implicit-templates}. @xref{Template
2449 Instantiation}, for more information.
2450
2451 @item -fno-rtti
2452 @opindex fno-rtti
2453 Disable generation of information about every class with virtual
2454 functions for use by the C++ run-time type identification features
2455 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2456 of the language, you can save some space by using this flag. Note that
2457 exception handling uses the same information, but G++ generates it as
2458 needed. The @code{dynamic_cast} operator can still be used for casts that
2459 do not require run-time type information, i.e.@: casts to @code{void *} or to
2460 unambiguous base classes.
2461
2462 @item -fsized-deallocation
2463 @opindex fsized-deallocation
2464 Enable the built-in global declarations
2465 @smallexample
2466 void operator delete (void *, std::size_t) noexcept;
2467 void operator delete[] (void *, std::size_t) noexcept;
2468 @end smallexample
2469 as introduced in C++14. This is useful for user-defined replacement
2470 deallocation functions that, for example, use the size of the object
2471 to make deallocation faster. Enabled by default under
2472 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2473 warns about places that might want to add a definition.
2474
2475 @item -fstrict-enums
2476 @opindex fstrict-enums
2477 Allow the compiler to optimize using the assumption that a value of
2478 enumerated type can only be one of the values of the enumeration (as
2479 defined in the C++ standard; basically, a value that can be
2480 represented in the minimum number of bits needed to represent all the
2481 enumerators). This assumption may not be valid if the program uses a
2482 cast to convert an arbitrary integer value to the enumerated type.
2483
2484 @item -fstrong-eval-order
2485 @opindex fstrong-eval-order
2486 Evaluate member access, array subscripting, and shift expressions in
2487 left-to-right order, and evaluate assignment in right-to-left order,
2488 as adopted for C++17. Enabled by default with @option{-std=c++1z}.
2489 @option{-fstrong-eval-order=some} enables just the ordering of member
2490 access and shift expressions, and is the default without
2491 @option{-std=c++1z}.
2492
2493 @item -ftemplate-backtrace-limit=@var{n}
2494 @opindex ftemplate-backtrace-limit
2495 Set the maximum number of template instantiation notes for a single
2496 warning or error to @var{n}. The default value is 10.
2497
2498 @item -ftemplate-depth=@var{n}
2499 @opindex ftemplate-depth
2500 Set the maximum instantiation depth for template classes to @var{n}.
2501 A limit on the template instantiation depth is needed to detect
2502 endless recursions during template class instantiation. ANSI/ISO C++
2503 conforming programs must not rely on a maximum depth greater than 17
2504 (changed to 1024 in C++11). The default value is 900, as the compiler
2505 can run out of stack space before hitting 1024 in some situations.
2506
2507 @item -fno-threadsafe-statics
2508 @opindex fno-threadsafe-statics
2509 Do not emit the extra code to use the routines specified in the C++
2510 ABI for thread-safe initialization of local statics. You can use this
2511 option to reduce code size slightly in code that doesn't need to be
2512 thread-safe.
2513
2514 @item -fuse-cxa-atexit
2515 @opindex fuse-cxa-atexit
2516 Register destructors for objects with static storage duration with the
2517 @code{__cxa_atexit} function rather than the @code{atexit} function.
2518 This option is required for fully standards-compliant handling of static
2519 destructors, but only works if your C library supports
2520 @code{__cxa_atexit}.
2521
2522 @item -fno-use-cxa-get-exception-ptr
2523 @opindex fno-use-cxa-get-exception-ptr
2524 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2525 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2526 if the runtime routine is not available.
2527
2528 @item -fvisibility-inlines-hidden
2529 @opindex fvisibility-inlines-hidden
2530 This switch declares that the user does not attempt to compare
2531 pointers to inline functions or methods where the addresses of the two functions
2532 are taken in different shared objects.
2533
2534 The effect of this is that GCC may, effectively, mark inline methods with
2535 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2536 appear in the export table of a DSO and do not require a PLT indirection
2537 when used within the DSO@. Enabling this option can have a dramatic effect
2538 on load and link times of a DSO as it massively reduces the size of the
2539 dynamic export table when the library makes heavy use of templates.
2540
2541 The behavior of this switch is not quite the same as marking the
2542 methods as hidden directly, because it does not affect static variables
2543 local to the function or cause the compiler to deduce that
2544 the function is defined in only one shared object.
2545
2546 You may mark a method as having a visibility explicitly to negate the
2547 effect of the switch for that method. For example, if you do want to
2548 compare pointers to a particular inline method, you might mark it as
2549 having default visibility. Marking the enclosing class with explicit
2550 visibility has no effect.
2551
2552 Explicitly instantiated inline methods are unaffected by this option
2553 as their linkage might otherwise cross a shared library boundary.
2554 @xref{Template Instantiation}.
2555
2556 @item -fvisibility-ms-compat
2557 @opindex fvisibility-ms-compat
2558 This flag attempts to use visibility settings to make GCC's C++
2559 linkage model compatible with that of Microsoft Visual Studio.
2560
2561 The flag makes these changes to GCC's linkage model:
2562
2563 @enumerate
2564 @item
2565 It sets the default visibility to @code{hidden}, like
2566 @option{-fvisibility=hidden}.
2567
2568 @item
2569 Types, but not their members, are not hidden by default.
2570
2571 @item
2572 The One Definition Rule is relaxed for types without explicit
2573 visibility specifications that are defined in more than one
2574 shared object: those declarations are permitted if they are
2575 permitted when this option is not used.
2576 @end enumerate
2577
2578 In new code it is better to use @option{-fvisibility=hidden} and
2579 export those classes that are intended to be externally visible.
2580 Unfortunately it is possible for code to rely, perhaps accidentally,
2581 on the Visual Studio behavior.
2582
2583 Among the consequences of these changes are that static data members
2584 of the same type with the same name but defined in different shared
2585 objects are different, so changing one does not change the other;
2586 and that pointers to function members defined in different shared
2587 objects may not compare equal. When this flag is given, it is a
2588 violation of the ODR to define types with the same name differently.
2589
2590 @item -fno-weak
2591 @opindex fno-weak
2592 Do not use weak symbol support, even if it is provided by the linker.
2593 By default, G++ uses weak symbols if they are available. This
2594 option exists only for testing, and should not be used by end-users;
2595 it results in inferior code and has no benefits. This option may
2596 be removed in a future release of G++.
2597
2598 @item -nostdinc++
2599 @opindex nostdinc++
2600 Do not search for header files in the standard directories specific to
2601 C++, but do still search the other standard directories. (This option
2602 is used when building the C++ library.)
2603 @end table
2604
2605 In addition, these optimization, warning, and code generation options
2606 have meanings only for C++ programs:
2607
2608 @table @gcctabopt
2609 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2610 @opindex Wabi
2611 @opindex Wno-abi
2612 Warn when G++ it generates code that is probably not compatible with
2613 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2614 ABI with each major release, normally @option{-Wabi} will warn only if
2615 there is a check added later in a release series for an ABI issue
2616 discovered since the initial release. @option{-Wabi} will warn about
2617 more things if an older ABI version is selected (with
2618 @option{-fabi-version=@var{n}}).
2619
2620 @option{-Wabi} can also be used with an explicit version number to
2621 warn about compatibility with a particular @option{-fabi-version}
2622 level, e.g. @option{-Wabi=2} to warn about changes relative to
2623 @option{-fabi-version=2}.
2624
2625 If an explicit version number is provided and
2626 @option{-fabi-compat-version} is not specified, the version number
2627 from this option is used for compatibility aliases. If no explicit
2628 version number is provided with this option, but
2629 @option{-fabi-compat-version} is specified, that version number is
2630 used for ABI warnings.
2631
2632 Although an effort has been made to warn about
2633 all such cases, there are probably some cases that are not warned about,
2634 even though G++ is generating incompatible code. There may also be
2635 cases where warnings are emitted even though the code that is generated
2636 is compatible.
2637
2638 You should rewrite your code to avoid these warnings if you are
2639 concerned about the fact that code generated by G++ may not be binary
2640 compatible with code generated by other compilers.
2641
2642 Known incompatibilities in @option{-fabi-version=2} (which was the
2643 default from GCC 3.4 to 4.9) include:
2644
2645 @itemize @bullet
2646
2647 @item
2648 A template with a non-type template parameter of reference type was
2649 mangled incorrectly:
2650 @smallexample
2651 extern int N;
2652 template <int &> struct S @{@};
2653 void n (S<N>) @{2@}
2654 @end smallexample
2655
2656 This was fixed in @option{-fabi-version=3}.
2657
2658 @item
2659 SIMD vector types declared using @code{__attribute ((vector_size))} were
2660 mangled in a non-standard way that does not allow for overloading of
2661 functions taking vectors of different sizes.
2662
2663 The mangling was changed in @option{-fabi-version=4}.
2664
2665 @item
2666 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2667 qualifiers, and @code{decltype} of a plain declaration was folded away.
2668
2669 These mangling issues were fixed in @option{-fabi-version=5}.
2670
2671 @item
2672 Scoped enumerators passed as arguments to a variadic function are
2673 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2674 On most targets this does not actually affect the parameter passing
2675 ABI, as there is no way to pass an argument smaller than @code{int}.
2676
2677 Also, the ABI changed the mangling of template argument packs,
2678 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2679 a class scope function used as a template argument.
2680
2681 These issues were corrected in @option{-fabi-version=6}.
2682
2683 @item
2684 Lambdas in default argument scope were mangled incorrectly, and the
2685 ABI changed the mangling of @code{nullptr_t}.
2686
2687 These issues were corrected in @option{-fabi-version=7}.
2688
2689 @item
2690 When mangling a function type with function-cv-qualifiers, the
2691 un-qualified function type was incorrectly treated as a substitution
2692 candidate.
2693
2694 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2695
2696 @item
2697 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2698 unaligned accesses. Note that this did not affect the ABI of a
2699 function with a @code{nullptr_t} parameter, as parameters have a
2700 minimum alignment.
2701
2702 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2703
2704 @item
2705 Target-specific attributes that affect the identity of a type, such as
2706 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2707 did not affect the mangled name, leading to name collisions when
2708 function pointers were used as template arguments.
2709
2710 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2711
2712 @end itemize
2713
2714 It also warns about psABI-related changes. The known psABI changes at this
2715 point include:
2716
2717 @itemize @bullet
2718
2719 @item
2720 For SysV/x86-64, unions with @code{long double} members are
2721 passed in memory as specified in psABI. For example:
2722
2723 @smallexample
2724 union U @{
2725 long double ld;
2726 int i;
2727 @};
2728 @end smallexample
2729
2730 @noindent
2731 @code{union U} is always passed in memory.
2732
2733 @end itemize
2734
2735 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2736 @opindex Wabi-tag
2737 @opindex -Wabi-tag
2738 Warn when a type with an ABI tag is used in a context that does not
2739 have that ABI tag. See @ref{C++ Attributes} for more information
2740 about ABI tags.
2741
2742 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2743 @opindex Wctor-dtor-privacy
2744 @opindex Wno-ctor-dtor-privacy
2745 Warn when a class seems unusable because all the constructors or
2746 destructors in that class are private, and it has neither friends nor
2747 public static member functions. Also warn if there are no non-private
2748 methods, and there's at least one private member function that isn't
2749 a constructor or destructor.
2750
2751 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2752 @opindex Wdelete-non-virtual-dtor
2753 @opindex Wno-delete-non-virtual-dtor
2754 Warn when @code{delete} is used to destroy an instance of a class that
2755 has virtual functions and non-virtual destructor. It is unsafe to delete
2756 an instance of a derived class through a pointer to a base class if the
2757 base class does not have a virtual destructor. This warning is enabled
2758 by @option{-Wall}.
2759
2760 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2761 @opindex Wliteral-suffix
2762 @opindex Wno-literal-suffix
2763 Warn when a string or character literal is followed by a ud-suffix which does
2764 not begin with an underscore. As a conforming extension, GCC treats such
2765 suffixes as separate preprocessing tokens in order to maintain backwards
2766 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2767 For example:
2768
2769 @smallexample
2770 #define __STDC_FORMAT_MACROS
2771 #include <inttypes.h>
2772 #include <stdio.h>
2773
2774 int main() @{
2775 int64_t i64 = 123;
2776 printf("My int64: %" PRId64"\n", i64);
2777 @}
2778 @end smallexample
2779
2780 In this case, @code{PRId64} is treated as a separate preprocessing token.
2781
2782 This warning is enabled by default.
2783
2784 @item -Wlto-type-mismatch
2785 @opindex Wlto-type-mismatch
2786 @opindex Wno-lto-type-mismatch
2787
2788 During the link-time optimization warn about type mismatches in
2789 global declarations from different compilation units.
2790 Requires @option{-flto} to be enabled. Enabled by default.
2791
2792 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2793 @opindex Wnarrowing
2794 @opindex Wno-narrowing
2795 With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing
2796 conversion prohibited by C++11 occurs within
2797 @samp{@{ @}}, e.g.
2798
2799 @smallexample
2800 int i = @{ 2.2 @}; // error: narrowing from double to int
2801 @end smallexample
2802
2803 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2804
2805 When a later standard is in effect, e.g. when using @option{-std=c++11},
2806 narrowing conversions are diagnosed by default, as required by the standard.
2807 A narrowing conversion from a constant produces an error,
2808 and a narrowing conversion from a non-constant produces a warning,
2809 but @option{-Wno-narrowing} suppresses the diagnostic.
2810 Note that this does not affect the meaning of well-formed code;
2811 narrowing conversions are still considered ill-formed in SFINAE contexts.
2812
2813 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2814 @opindex Wnoexcept
2815 @opindex Wno-noexcept
2816 Warn when a noexcept-expression evaluates to false because of a call
2817 to a function that does not have a non-throwing exception
2818 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2819 the compiler to never throw an exception.
2820
2821 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2822 @opindex Wnon-virtual-dtor
2823 @opindex Wno-non-virtual-dtor
2824 Warn when a class has virtual functions and an accessible non-virtual
2825 destructor itself or in an accessible polymorphic base class, in which
2826 case it is possible but unsafe to delete an instance of a derived
2827 class through a pointer to the class itself or base class. This
2828 warning is automatically enabled if @option{-Weffc++} is specified.
2829
2830 @item -Wreorder @r{(C++ and Objective-C++ only)}
2831 @opindex Wreorder
2832 @opindex Wno-reorder
2833 @cindex reordering, warning
2834 @cindex warning for reordering of member initializers
2835 Warn when the order of member initializers given in the code does not
2836 match the order in which they must be executed. For instance:
2837
2838 @smallexample
2839 struct A @{
2840 int i;
2841 int j;
2842 A(): j (0), i (1) @{ @}
2843 @};
2844 @end smallexample
2845
2846 @noindent
2847 The compiler rearranges the member initializers for @code{i}
2848 and @code{j} to match the declaration order of the members, emitting
2849 a warning to that effect. This warning is enabled by @option{-Wall}.
2850
2851 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2852 @opindex fext-numeric-literals
2853 @opindex fno-ext-numeric-literals
2854 Accept imaginary, fixed-point, or machine-defined
2855 literal number suffixes as GNU extensions.
2856 When this option is turned off these suffixes are treated
2857 as C++11 user-defined literal numeric suffixes.
2858 This is on by default for all pre-C++11 dialects and all GNU dialects:
2859 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2860 @option{-std=gnu++14}.
2861 This option is off by default
2862 for ISO C++11 onwards (@option{-std=c++11}, ...).
2863 @end table
2864
2865 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2866
2867 @table @gcctabopt
2868 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2869 @opindex Weffc++
2870 @opindex Wno-effc++
2871 Warn about violations of the following style guidelines from Scott Meyers'
2872 @cite{Effective C++} series of books:
2873
2874 @itemize @bullet
2875 @item
2876 Define a copy constructor and an assignment operator for classes
2877 with dynamically-allocated memory.
2878
2879 @item
2880 Prefer initialization to assignment in constructors.
2881
2882 @item
2883 Have @code{operator=} return a reference to @code{*this}.
2884
2885 @item
2886 Don't try to return a reference when you must return an object.
2887
2888 @item
2889 Distinguish between prefix and postfix forms of increment and
2890 decrement operators.
2891
2892 @item
2893 Never overload @code{&&}, @code{||}, or @code{,}.
2894
2895 @end itemize
2896
2897 This option also enables @option{-Wnon-virtual-dtor}, which is also
2898 one of the effective C++ recommendations. However, the check is
2899 extended to warn about the lack of virtual destructor in accessible
2900 non-polymorphic bases classes too.
2901
2902 When selecting this option, be aware that the standard library
2903 headers do not obey all of these guidelines; use @samp{grep -v}
2904 to filter out those warnings.
2905
2906 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2907 @opindex Wstrict-null-sentinel
2908 @opindex Wno-strict-null-sentinel
2909 Warn about the use of an uncasted @code{NULL} as sentinel. When
2910 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2911 to @code{__null}. Although it is a null pointer constant rather than a
2912 null pointer, it is guaranteed to be of the same size as a pointer.
2913 But this use is not portable across different compilers.
2914
2915 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2916 @opindex Wno-non-template-friend
2917 @opindex Wnon-template-friend
2918 Disable warnings when non-templatized friend functions are declared
2919 within a template. Since the advent of explicit template specification
2920 support in G++, if the name of the friend is an unqualified-id (i.e.,
2921 @samp{friend foo(int)}), the C++ language specification demands that the
2922 friend declare or define an ordinary, nontemplate function. (Section
2923 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2924 could be interpreted as a particular specialization of a templatized
2925 function. Because this non-conforming behavior is no longer the default
2926 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2927 check existing code for potential trouble spots and is on by default.
2928 This new compiler behavior can be turned off with
2929 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2930 but disables the helpful warning.
2931
2932 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2933 @opindex Wold-style-cast
2934 @opindex Wno-old-style-cast
2935 Warn if an old-style (C-style) cast to a non-void type is used within
2936 a C++ program. The new-style casts (@code{dynamic_cast},
2937 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
2938 less vulnerable to unintended effects and much easier to search for.
2939
2940 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2941 @opindex Woverloaded-virtual
2942 @opindex Wno-overloaded-virtual
2943 @cindex overloaded virtual function, warning
2944 @cindex warning for overloaded virtual function
2945 Warn when a function declaration hides virtual functions from a
2946 base class. For example, in:
2947
2948 @smallexample
2949 struct A @{
2950 virtual void f();
2951 @};
2952
2953 struct B: public A @{
2954 void f(int);
2955 @};
2956 @end smallexample
2957
2958 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2959 like:
2960
2961 @smallexample
2962 B* b;
2963 b->f();
2964 @end smallexample
2965
2966 @noindent
2967 fails to compile.
2968
2969 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2970 @opindex Wno-pmf-conversions
2971 @opindex Wpmf-conversions
2972 Disable the diagnostic for converting a bound pointer to member function
2973 to a plain pointer.
2974
2975 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2976 @opindex Wsign-promo
2977 @opindex Wno-sign-promo
2978 Warn when overload resolution chooses a promotion from unsigned or
2979 enumerated type to a signed type, over a conversion to an unsigned type of
2980 the same size. Previous versions of G++ tried to preserve
2981 unsignedness, but the standard mandates the current behavior.
2982
2983 @item -Wtemplates @r{(C++ and Objective-C++ only)}
2984 @opindex Wtemplates
2985 Warn when a primary template declaration is encountered. Some coding
2986 rules disallow templates, and this may be used to enforce that rule.
2987 The warning is inactive inside a system header file, such as the STL, so
2988 one can still use the STL. One may also instantiate or specialize
2989 templates.
2990
2991 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
2992 @opindex Wmultiple-inheritance
2993 Warn when a class is defined with multiple direct base classes. Some
2994 coding rules disallow multiple inheritance, and this may be used to
2995 enforce that rule. The warning is inactive inside a system header file,
2996 such as the STL, so one can still use the STL. One may also define
2997 classes that indirectly use multiple inheritance.
2998
2999 @item -Wvirtual-inheritance
3000 @opindex Wvirtual-inheritance
3001 Warn when a class is defined with a virtual direct base classe. Some
3002 coding rules disallow multiple inheritance, and this may be used to
3003 enforce that rule. The warning is inactive inside a system header file,
3004 such as the STL, so one can still use the STL. One may also define
3005 classes that indirectly use virtual inheritance.
3006
3007 @item -Wnamespaces
3008 @opindex Wnamespaces
3009 Warn when a namespace definition is opened. Some coding rules disallow
3010 namespaces, and this may be used to enforce that rule. The warning is
3011 inactive inside a system header file, such as the STL, so one can still
3012 use the STL. One may also use using directives and qualified names.
3013
3014 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3015 @opindex Wterminate
3016 @opindex Wno-terminate
3017 Disable the warning about a throw-expression that will immediately
3018 result in a call to @code{terminate}.
3019 @end table
3020
3021 @node Objective-C and Objective-C++ Dialect Options
3022 @section Options Controlling Objective-C and Objective-C++ Dialects
3023
3024 @cindex compiler options, Objective-C and Objective-C++
3025 @cindex Objective-C and Objective-C++ options, command-line
3026 @cindex options, Objective-C and Objective-C++
3027 (NOTE: This manual does not describe the Objective-C and Objective-C++
3028 languages themselves. @xref{Standards,,Language Standards
3029 Supported by GCC}, for references.)
3030
3031 This section describes the command-line options that are only meaningful
3032 for Objective-C and Objective-C++ programs. You can also use most of
3033 the language-independent GNU compiler options.
3034 For example, you might compile a file @file{some_class.m} like this:
3035
3036 @smallexample
3037 gcc -g -fgnu-runtime -O -c some_class.m
3038 @end smallexample
3039
3040 @noindent
3041 In this example, @option{-fgnu-runtime} is an option meant only for
3042 Objective-C and Objective-C++ programs; you can use the other options with
3043 any language supported by GCC@.
3044
3045 Note that since Objective-C is an extension of the C language, Objective-C
3046 compilations may also use options specific to the C front-end (e.g.,
3047 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3048 C++-specific options (e.g., @option{-Wabi}).
3049
3050 Here is a list of options that are @emph{only} for compiling Objective-C
3051 and Objective-C++ programs:
3052
3053 @table @gcctabopt
3054 @item -fconstant-string-class=@var{class-name}
3055 @opindex fconstant-string-class
3056 Use @var{class-name} as the name of the class to instantiate for each
3057 literal string specified with the syntax @code{@@"@dots{}"}. The default
3058 class name is @code{NXConstantString} if the GNU runtime is being used, and
3059 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3060 @option{-fconstant-cfstrings} option, if also present, overrides the
3061 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3062 to be laid out as constant CoreFoundation strings.
3063
3064 @item -fgnu-runtime
3065 @opindex fgnu-runtime
3066 Generate object code compatible with the standard GNU Objective-C
3067 runtime. This is the default for most types of systems.
3068
3069 @item -fnext-runtime
3070 @opindex fnext-runtime
3071 Generate output compatible with the NeXT runtime. This is the default
3072 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3073 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3074 used.
3075
3076 @item -fno-nil-receivers
3077 @opindex fno-nil-receivers
3078 Assume that all Objective-C message dispatches (@code{[receiver
3079 message:arg]}) in this translation unit ensure that the receiver is
3080 not @code{nil}. This allows for more efficient entry points in the
3081 runtime to be used. This option is only available in conjunction with
3082 the NeXT runtime and ABI version 0 or 1.
3083
3084 @item -fobjc-abi-version=@var{n}
3085 @opindex fobjc-abi-version
3086 Use version @var{n} of the Objective-C ABI for the selected runtime.
3087 This option is currently supported only for the NeXT runtime. In that
3088 case, Version 0 is the traditional (32-bit) ABI without support for
3089 properties and other Objective-C 2.0 additions. Version 1 is the
3090 traditional (32-bit) ABI with support for properties and other
3091 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3092 nothing is specified, the default is Version 0 on 32-bit target
3093 machines, and Version 2 on 64-bit target machines.
3094
3095 @item -fobjc-call-cxx-cdtors
3096 @opindex fobjc-call-cxx-cdtors
3097 For each Objective-C class, check if any of its instance variables is a
3098 C++ object with a non-trivial default constructor. If so, synthesize a
3099 special @code{- (id) .cxx_construct} instance method which runs
3100 non-trivial default constructors on any such instance variables, in order,
3101 and then return @code{self}. Similarly, check if any instance variable
3102 is a C++ object with a non-trivial destructor, and if so, synthesize a
3103 special @code{- (void) .cxx_destruct} method which runs
3104 all such default destructors, in reverse order.
3105
3106 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3107 methods thusly generated only operate on instance variables
3108 declared in the current Objective-C class, and not those inherited
3109 from superclasses. It is the responsibility of the Objective-C
3110 runtime to invoke all such methods in an object's inheritance
3111 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3112 by the runtime immediately after a new object instance is allocated;
3113 the @code{- (void) .cxx_destruct} methods are invoked immediately
3114 before the runtime deallocates an object instance.
3115
3116 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3117 support for invoking the @code{- (id) .cxx_construct} and
3118 @code{- (void) .cxx_destruct} methods.
3119
3120 @item -fobjc-direct-dispatch
3121 @opindex fobjc-direct-dispatch
3122 Allow fast jumps to the message dispatcher. On Darwin this is
3123 accomplished via the comm page.
3124
3125 @item -fobjc-exceptions
3126 @opindex fobjc-exceptions
3127 Enable syntactic support for structured exception handling in
3128 Objective-C, similar to what is offered by C++ and Java. This option
3129 is required to use the Objective-C keywords @code{@@try},
3130 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3131 @code{@@synchronized}. This option is available with both the GNU
3132 runtime and the NeXT runtime (but not available in conjunction with
3133 the NeXT runtime on Mac OS X 10.2 and earlier).
3134
3135 @item -fobjc-gc
3136 @opindex fobjc-gc
3137 Enable garbage collection (GC) in Objective-C and Objective-C++
3138 programs. This option is only available with the NeXT runtime; the
3139 GNU runtime has a different garbage collection implementation that
3140 does not require special compiler flags.
3141
3142 @item -fobjc-nilcheck
3143 @opindex fobjc-nilcheck
3144 For the NeXT runtime with version 2 of the ABI, check for a nil
3145 receiver in method invocations before doing the actual method call.
3146 This is the default and can be disabled using
3147 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3148 checked for nil in this way no matter what this flag is set to.
3149 Currently this flag does nothing when the GNU runtime, or an older
3150 version of the NeXT runtime ABI, is used.
3151
3152 @item -fobjc-std=objc1
3153 @opindex fobjc-std
3154 Conform to the language syntax of Objective-C 1.0, the language
3155 recognized by GCC 4.0. This only affects the Objective-C additions to
3156 the C/C++ language; it does not affect conformance to C/C++ standards,
3157 which is controlled by the separate C/C++ dialect option flags. When
3158 this option is used with the Objective-C or Objective-C++ compiler,
3159 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3160 This is useful if you need to make sure that your Objective-C code can
3161 be compiled with older versions of GCC@.
3162
3163 @item -freplace-objc-classes
3164 @opindex freplace-objc-classes
3165 Emit a special marker instructing @command{ld(1)} not to statically link in
3166 the resulting object file, and allow @command{dyld(1)} to load it in at
3167 run time instead. This is used in conjunction with the Fix-and-Continue
3168 debugging mode, where the object file in question may be recompiled and
3169 dynamically reloaded in the course of program execution, without the need
3170 to restart the program itself. Currently, Fix-and-Continue functionality
3171 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3172 and later.
3173
3174 @item -fzero-link
3175 @opindex fzero-link
3176 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3177 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3178 compile time) with static class references that get initialized at load time,
3179 which improves run-time performance. Specifying the @option{-fzero-link} flag
3180 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3181 to be retained. This is useful in Zero-Link debugging mode, since it allows
3182 for individual class implementations to be modified during program execution.
3183 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3184 regardless of command-line options.
3185
3186 @item -fno-local-ivars
3187 @opindex fno-local-ivars
3188 @opindex flocal-ivars
3189 By default instance variables in Objective-C can be accessed as if
3190 they were local variables from within the methods of the class they're
3191 declared in. This can lead to shadowing between instance variables
3192 and other variables declared either locally inside a class method or
3193 globally with the same name. Specifying the @option{-fno-local-ivars}
3194 flag disables this behavior thus avoiding variable shadowing issues.
3195
3196 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3197 @opindex fivar-visibility
3198 Set the default instance variable visibility to the specified option
3199 so that instance variables declared outside the scope of any access
3200 modifier directives default to the specified visibility.
3201
3202 @item -gen-decls
3203 @opindex gen-decls
3204 Dump interface declarations for all classes seen in the source file to a
3205 file named @file{@var{sourcename}.decl}.
3206
3207 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3208 @opindex Wassign-intercept
3209 @opindex Wno-assign-intercept
3210 Warn whenever an Objective-C assignment is being intercepted by the
3211 garbage collector.
3212
3213 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3214 @opindex Wno-protocol
3215 @opindex Wprotocol
3216 If a class is declared to implement a protocol, a warning is issued for
3217 every method in the protocol that is not implemented by the class. The
3218 default behavior is to issue a warning for every method not explicitly
3219 implemented in the class, even if a method implementation is inherited
3220 from the superclass. If you use the @option{-Wno-protocol} option, then
3221 methods inherited from the superclass are considered to be implemented,
3222 and no warning is issued for them.
3223
3224 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3225 @opindex Wselector
3226 @opindex Wno-selector
3227 Warn if multiple methods of different types for the same selector are
3228 found during compilation. The check is performed on the list of methods
3229 in the final stage of compilation. Additionally, a check is performed
3230 for each selector appearing in a @code{@@selector(@dots{})}
3231 expression, and a corresponding method for that selector has been found
3232 during compilation. Because these checks scan the method table only at
3233 the end of compilation, these warnings are not produced if the final
3234 stage of compilation is not reached, for example because an error is
3235 found during compilation, or because the @option{-fsyntax-only} option is
3236 being used.
3237
3238 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3239 @opindex Wstrict-selector-match
3240 @opindex Wno-strict-selector-match
3241 Warn if multiple methods with differing argument and/or return types are
3242 found for a given selector when attempting to send a message using this
3243 selector to a receiver of type @code{id} or @code{Class}. When this flag
3244 is off (which is the default behavior), the compiler omits such warnings
3245 if any differences found are confined to types that share the same size
3246 and alignment.
3247
3248 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3249 @opindex Wundeclared-selector
3250 @opindex Wno-undeclared-selector
3251 Warn if a @code{@@selector(@dots{})} expression referring to an
3252 undeclared selector is found. A selector is considered undeclared if no
3253 method with that name has been declared before the
3254 @code{@@selector(@dots{})} expression, either explicitly in an
3255 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3256 an @code{@@implementation} section. This option always performs its
3257 checks as soon as a @code{@@selector(@dots{})} expression is found,
3258 while @option{-Wselector} only performs its checks in the final stage of
3259 compilation. This also enforces the coding style convention
3260 that methods and selectors must be declared before being used.
3261
3262 @item -print-objc-runtime-info
3263 @opindex print-objc-runtime-info
3264 Generate C header describing the largest structure that is passed by
3265 value, if any.
3266
3267 @end table
3268
3269 @node Diagnostic Message Formatting Options
3270 @section Options to Control Diagnostic Messages Formatting
3271 @cindex options to control diagnostics formatting
3272 @cindex diagnostic messages
3273 @cindex message formatting
3274
3275 Traditionally, diagnostic messages have been formatted irrespective of
3276 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3277 options described below
3278 to control the formatting algorithm for diagnostic messages,
3279 e.g.@: how many characters per line, how often source location
3280 information should be reported. Note that some language front ends may not
3281 honor these options.
3282
3283 @table @gcctabopt
3284 @item -fmessage-length=@var{n}
3285 @opindex fmessage-length
3286 Try to format error messages so that they fit on lines of about
3287 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3288 done; each error message appears on a single line. This is the
3289 default for all front ends.
3290
3291 @item -fdiagnostics-show-location=once
3292 @opindex fdiagnostics-show-location
3293 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3294 reporter to emit source location information @emph{once}; that is, in
3295 case the message is too long to fit on a single physical line and has to
3296 be wrapped, the source location won't be emitted (as prefix) again,
3297 over and over, in subsequent continuation lines. This is the default
3298 behavior.
3299
3300 @item -fdiagnostics-show-location=every-line
3301 Only meaningful in line-wrapping mode. Instructs the diagnostic
3302 messages reporter to emit the same source location information (as
3303 prefix) for physical lines that result from the process of breaking
3304 a message which is too long to fit on a single line.
3305
3306 @item -fdiagnostics-color[=@var{WHEN}]
3307 @itemx -fno-diagnostics-color
3308 @opindex fdiagnostics-color
3309 @cindex highlight, color
3310 @vindex GCC_COLORS @r{environment variable}
3311 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3312 or @samp{auto}. The default depends on how the compiler has been configured,
3313 it can be any of the above @var{WHEN} options or also @samp{never}
3314 if @env{GCC_COLORS} environment variable isn't present in the environment,
3315 and @samp{auto} otherwise.
3316 @samp{auto} means to use color only when the standard error is a terminal.
3317 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3318 aliases for @option{-fdiagnostics-color=always} and
3319 @option{-fdiagnostics-color=never}, respectively.
3320
3321 The colors are defined by the environment variable @env{GCC_COLORS}.
3322 Its value is a colon-separated list of capabilities and Select Graphic
3323 Rendition (SGR) substrings. SGR commands are interpreted by the
3324 terminal or terminal emulator. (See the section in the documentation
3325 of your text terminal for permitted values and their meanings as
3326 character attributes.) These substring values are integers in decimal
3327 representation and can be concatenated with semicolons.
3328 Common values to concatenate include
3329 @samp{1} for bold,
3330 @samp{4} for underline,
3331 @samp{5} for blink,
3332 @samp{7} for inverse,
3333 @samp{39} for default foreground color,
3334 @samp{30} to @samp{37} for foreground colors,
3335 @samp{90} to @samp{97} for 16-color mode foreground colors,
3336 @samp{38;5;0} to @samp{38;5;255}
3337 for 88-color and 256-color modes foreground colors,
3338 @samp{49} for default background color,
3339 @samp{40} to @samp{47} for background colors,
3340 @samp{100} to @samp{107} for 16-color mode background colors,
3341 and @samp{48;5;0} to @samp{48;5;255}
3342 for 88-color and 256-color modes background colors.
3343
3344 The default @env{GCC_COLORS} is
3345 @smallexample
3346 error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01
3347 @end smallexample
3348 @noindent
3349 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3350 @samp{01;36} is bold cyan, @samp{01;32} is bold green and
3351 @samp{01} is bold. Setting @env{GCC_COLORS} to the empty
3352 string disables colors.
3353 Supported capabilities are as follows.
3354
3355 @table @code
3356 @item error=
3357 @vindex error GCC_COLORS @r{capability}
3358 SGR substring for error: markers.
3359
3360 @item warning=
3361 @vindex warning GCC_COLORS @r{capability}
3362 SGR substring for warning: markers.
3363
3364 @item note=
3365 @vindex note GCC_COLORS @r{capability}
3366 SGR substring for note: markers.
3367
3368 @item caret=
3369 @vindex caret GCC_COLORS @r{capability}
3370 SGR substring for caret line.
3371
3372 @item locus=
3373 @vindex locus GCC_COLORS @r{capability}
3374 SGR substring for location information, @samp{file:line} or
3375 @samp{file:line:column} etc.
3376
3377 @item quote=
3378 @vindex quote GCC_COLORS @r{capability}
3379 SGR substring for information printed within quotes.
3380 @end table
3381
3382 @item -fno-diagnostics-show-option
3383 @opindex fno-diagnostics-show-option
3384 @opindex fdiagnostics-show-option
3385 By default, each diagnostic emitted includes text indicating the
3386 command-line option that directly controls the diagnostic (if such an
3387 option is known to the diagnostic machinery). Specifying the
3388 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3389
3390 @item -fno-diagnostics-show-caret
3391 @opindex fno-diagnostics-show-caret
3392 @opindex fdiagnostics-show-caret
3393 By default, each diagnostic emitted includes the original source line
3394 and a caret @samp{^} indicating the column. This option suppresses this
3395 information. The source line is truncated to @var{n} characters, if
3396 the @option{-fmessage-length=n} option is given. When the output is done
3397 to the terminal, the width is limited to the width given by the
3398 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3399
3400 @item -fdiagnostics-parseable-fixits
3401 @opindex fdiagnostics-parseable-fixits
3402 Emit fix-it hints in a machine-parseable format, suitable for consumption
3403 by IDEs. For each fix-it, a line will be printed after the relevant
3404 diagnostic, starting with the string ``fix-it:''. For example:
3405
3406 @smallexample
3407 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3408 @end smallexample
3409
3410 The location is expressed as a half-open range, expressed as a count of
3411 bytes, starting at byte 1 for the initial column. In the above example,
3412 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3413 given string:
3414
3415 @smallexample
3416 00000000011111111112222222222
3417 12345678901234567890123456789
3418 gtk_widget_showall (dlg);
3419 ^^^^^^^^^^^^^^^^^^
3420 gtk_widget_show_all
3421 @end smallexample
3422
3423 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3424 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3425 (e.g. vertical tab as ``\013'').
3426
3427 An empty replacement string indicates that the given range is to be removed.
3428 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3429 be inserted at the given position.
3430
3431 @end table
3432
3433 @node Warning Options
3434 @section Options to Request or Suppress Warnings
3435 @cindex options to control warnings
3436 @cindex warning messages
3437 @cindex messages, warning
3438 @cindex suppressing warnings
3439
3440 Warnings are diagnostic messages that report constructions that
3441 are not inherently erroneous but that are risky or suggest there
3442 may have been an error.
3443
3444 The following language-independent options do not enable specific
3445 warnings but control the kinds of diagnostics produced by GCC@.
3446
3447 @table @gcctabopt
3448 @cindex syntax checking
3449 @item -fsyntax-only
3450 @opindex fsyntax-only
3451 Check the code for syntax errors, but don't do anything beyond that.
3452
3453 @item -fmax-errors=@var{n}
3454 @opindex fmax-errors
3455 Limits the maximum number of error messages to @var{n}, at which point
3456 GCC bails out rather than attempting to continue processing the source
3457 code. If @var{n} is 0 (the default), there is no limit on the number
3458 of error messages produced. If @option{-Wfatal-errors} is also
3459 specified, then @option{-Wfatal-errors} takes precedence over this
3460 option.
3461
3462 @item -w
3463 @opindex w
3464 Inhibit all warning messages.
3465
3466 @item -Werror
3467 @opindex Werror
3468 @opindex Wno-error
3469 Make all warnings into errors.
3470
3471 @item -Werror=
3472 @opindex Werror=
3473 @opindex Wno-error=
3474 Make the specified warning into an error. The specifier for a warning
3475 is appended; for example @option{-Werror=switch} turns the warnings
3476 controlled by @option{-Wswitch} into errors. This switch takes a
3477 negative form, to be used to negate @option{-Werror} for specific
3478 warnings; for example @option{-Wno-error=switch} makes
3479 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3480 is in effect.
3481
3482 The warning message for each controllable warning includes the
3483 option that controls the warning. That option can then be used with
3484 @option{-Werror=} and @option{-Wno-error=} as described above.
3485 (Printing of the option in the warning message can be disabled using the
3486 @option{-fno-diagnostics-show-option} flag.)
3487
3488 Note that specifying @option{-Werror=}@var{foo} automatically implies
3489 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3490 imply anything.
3491
3492 @item -Wfatal-errors
3493 @opindex Wfatal-errors
3494 @opindex Wno-fatal-errors
3495 This option causes the compiler to abort compilation on the first error
3496 occurred rather than trying to keep going and printing further error
3497 messages.
3498
3499 @end table
3500
3501 You can request many specific warnings with options beginning with
3502 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3503 implicit declarations. Each of these specific warning options also
3504 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3505 example, @option{-Wno-implicit}. This manual lists only one of the
3506 two forms, whichever is not the default. For further
3507 language-specific options also refer to @ref{C++ Dialect Options} and
3508 @ref{Objective-C and Objective-C++ Dialect Options}.
3509
3510 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3511 options, such as @option{-Wunused}, which may turn on further options,
3512 such as @option{-Wunused-value}. The combined effect of positive and
3513 negative forms is that more specific options have priority over less
3514 specific ones, independently of their position in the command-line. For
3515 options of the same specificity, the last one takes effect. Options
3516 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3517 as if they appeared at the end of the command-line.
3518
3519 When an unrecognized warning option is requested (e.g.,
3520 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3521 that the option is not recognized. However, if the @option{-Wno-} form
3522 is used, the behavior is slightly different: no diagnostic is
3523 produced for @option{-Wno-unknown-warning} unless other diagnostics
3524 are being produced. This allows the use of new @option{-Wno-} options
3525 with old compilers, but if something goes wrong, the compiler
3526 warns that an unrecognized option is present.
3527
3528 @table @gcctabopt
3529 @item -Wpedantic
3530 @itemx -pedantic
3531 @opindex pedantic
3532 @opindex Wpedantic
3533 Issue all the warnings demanded by strict ISO C and ISO C++;
3534 reject all programs that use forbidden extensions, and some other
3535 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3536 version of the ISO C standard specified by any @option{-std} option used.
3537
3538 Valid ISO C and ISO C++ programs should compile properly with or without
3539 this option (though a rare few require @option{-ansi} or a
3540 @option{-std} option specifying the required version of ISO C)@. However,
3541 without this option, certain GNU extensions and traditional C and C++
3542 features are supported as well. With this option, they are rejected.
3543
3544 @option{-Wpedantic} does not cause warning messages for use of the
3545 alternate keywords whose names begin and end with @samp{__}. Pedantic
3546 warnings are also disabled in the expression that follows
3547 @code{__extension__}. However, only system header files should use
3548 these escape routes; application programs should avoid them.
3549 @xref{Alternate Keywords}.
3550
3551 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3552 C conformance. They soon find that it does not do quite what they want:
3553 it finds some non-ISO practices, but not all---only those for which
3554 ISO C @emph{requires} a diagnostic, and some others for which
3555 diagnostics have been added.
3556
3557 A feature to report any failure to conform to ISO C might be useful in
3558 some instances, but would require considerable additional work and would
3559 be quite different from @option{-Wpedantic}. We don't have plans to
3560 support such a feature in the near future.
3561
3562 Where the standard specified with @option{-std} represents a GNU
3563 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3564 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3565 extended dialect is based. Warnings from @option{-Wpedantic} are given
3566 where they are required by the base standard. (It does not make sense
3567 for such warnings to be given only for features not in the specified GNU
3568 C dialect, since by definition the GNU dialects of C include all
3569 features the compiler supports with the given option, and there would be
3570 nothing to warn about.)
3571
3572 @item -pedantic-errors
3573 @opindex pedantic-errors
3574 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3575 requires a diagnostic, in some cases where there is undefined behavior
3576 at compile-time and in some other cases that do not prevent compilation
3577 of programs that are valid according to the standard. This is not
3578 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3579 by this option and not enabled by the latter and vice versa.
3580
3581 @item -Wall
3582 @opindex Wall
3583 @opindex Wno-all
3584 This enables all the warnings about constructions that some users
3585 consider questionable, and that are easy to avoid (or modify to
3586 prevent the warning), even in conjunction with macros. This also
3587 enables some language-specific warnings described in @ref{C++ Dialect
3588 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3589
3590 @option{-Wall} turns on the following warning flags:
3591
3592 @gccoptlist{-Waddress @gol
3593 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3594 -Wbool-compare @gol
3595 -Wc++11-compat -Wc++14-compat@gol
3596 -Wchar-subscripts @gol
3597 -Wcomment @gol
3598 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3599 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3600 -Wformat @gol
3601 -Wimplicit @r{(C and Objective-C only)} @gol
3602 -Wimplicit-int @r{(C and Objective-C only)} @gol
3603 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3604 -Winit-self @r{(only for C++)} @gol
3605 -Wlogical-not-parentheses
3606 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3607 -Wmaybe-uninitialized @gol
3608 -Wmemset-elt-size @gol
3609 -Wmemset-transposed-args @gol
3610 -Wmisleading-indentation @r{(only for C/C++)} @gol
3611 -Wmissing-braces @r{(only for C/ObjC)} @gol
3612 -Wnarrowing @r{(only for C++)} @gol
3613 -Wnonnull @gol
3614 -Wnonnull-compare @gol
3615 -Wopenmp-simd @gol
3616 -Wparentheses @gol
3617 -Wpointer-sign @gol
3618 -Wreorder @gol
3619 -Wreturn-type @gol
3620 -Wsequence-point @gol
3621 -Wsign-compare @r{(only in C++)} @gol
3622 -Wsizeof-pointer-memaccess @gol
3623 -Wstrict-aliasing @gol
3624 -Wstrict-overflow=1 @gol
3625 -Wswitch @gol
3626 -Wtautological-compare @gol
3627 -Wtrigraphs @gol
3628 -Wuninitialized @gol
3629 -Wunknown-pragmas @gol
3630 -Wunused-function @gol
3631 -Wunused-label @gol
3632 -Wunused-value @gol
3633 -Wunused-variable @gol
3634 -Wvolatile-register-var @gol
3635 }
3636
3637 Note that some warning flags are not implied by @option{-Wall}. Some of
3638 them warn about constructions that users generally do not consider
3639 questionable, but which occasionally you might wish to check for;
3640 others warn about constructions that are necessary or hard to avoid in
3641 some cases, and there is no simple way to modify the code to suppress
3642 the warning. Some of them are enabled by @option{-Wextra} but many of
3643 them must be enabled individually.
3644
3645 @item -Wextra
3646 @opindex W
3647 @opindex Wextra
3648 @opindex Wno-extra
3649 This enables some extra warning flags that are not enabled by
3650 @option{-Wall}. (This option used to be called @option{-W}. The older
3651 name is still supported, but the newer name is more descriptive.)
3652
3653 @gccoptlist{-Wclobbered @gol
3654 -Wempty-body @gol
3655 -Wignored-qualifiers @gol
3656 -Wmissing-field-initializers @gol
3657 -Wmissing-parameter-type @r{(C only)} @gol
3658 -Wold-style-declaration @r{(C only)} @gol
3659 -Woverride-init @gol
3660 -Wsign-compare @r{(C only)} @gol
3661 -Wtype-limits @gol
3662 -Wuninitialized @gol
3663 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3664 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3665 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3666 }
3667
3668 The option @option{-Wextra} also prints warning messages for the
3669 following cases:
3670
3671 @itemize @bullet
3672
3673 @item
3674 A pointer is compared against integer zero with @code{<}, @code{<=},
3675 @code{>}, or @code{>=}.
3676
3677 @item
3678 (C++ only) An enumerator and a non-enumerator both appear in a
3679 conditional expression.
3680
3681 @item
3682 (C++ only) Ambiguous virtual bases.
3683
3684 @item
3685 (C++ only) Subscripting an array that has been declared @code{register}.
3686
3687 @item
3688 (C++ only) Taking the address of a variable that has been declared
3689 @code{register}.
3690
3691 @item
3692 (C++ only) A base class is not initialized in a derived class's copy
3693 constructor.
3694
3695 @end itemize
3696
3697 @item -Wchar-subscripts
3698 @opindex Wchar-subscripts
3699 @opindex Wno-char-subscripts
3700 Warn if an array subscript has type @code{char}. This is a common cause
3701 of error, as programmers often forget that this type is signed on some
3702 machines.
3703 This warning is enabled by @option{-Wall}.
3704
3705 @item -Wcomment
3706 @opindex Wcomment
3707 @opindex Wno-comment
3708 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3709 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3710 This warning is enabled by @option{-Wall}.
3711
3712 @item -Wno-coverage-mismatch
3713 @opindex Wno-coverage-mismatch
3714 Warn if feedback profiles do not match when using the
3715 @option{-fprofile-use} option.
3716 If a source file is changed between compiling with @option{-fprofile-gen} and
3717 with @option{-fprofile-use}, the files with the profile feedback can fail
3718 to match the source file and GCC cannot use the profile feedback
3719 information. By default, this warning is enabled and is treated as an
3720 error. @option{-Wno-coverage-mismatch} can be used to disable the
3721 warning or @option{-Wno-error=coverage-mismatch} can be used to
3722 disable the error. Disabling the error for this warning can result in
3723 poorly optimized code and is useful only in the
3724 case of very minor changes such as bug fixes to an existing code-base.
3725 Completely disabling the warning is not recommended.
3726
3727 @item -Wno-cpp
3728 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3729
3730 Suppress warning messages emitted by @code{#warning} directives.
3731
3732 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3733 @opindex Wdouble-promotion
3734 @opindex Wno-double-promotion
3735 Give a warning when a value of type @code{float} is implicitly
3736 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3737 floating-point unit implement @code{float} in hardware, but emulate
3738 @code{double} in software. On such a machine, doing computations
3739 using @code{double} values is much more expensive because of the
3740 overhead required for software emulation.
3741
3742 It is easy to accidentally do computations with @code{double} because
3743 floating-point literals are implicitly of type @code{double}. For
3744 example, in:
3745 @smallexample
3746 @group
3747 float area(float radius)
3748 @{
3749 return 3.14159 * radius * radius;
3750 @}
3751 @end group
3752 @end smallexample
3753 the compiler performs the entire computation with @code{double}
3754 because the floating-point literal is a @code{double}.
3755
3756 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
3757 @opindex Wduplicate-decl-specifier
3758 @opindex Wno-duplicate-decl-specifier
3759 Warn if a declaration has duplicate @code{const}, @code{volatile},
3760 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
3761 @option{-Wall}.
3762
3763 @item -Wformat
3764 @itemx -Wformat=@var{n}
3765 @opindex Wformat
3766 @opindex Wno-format
3767 @opindex ffreestanding
3768 @opindex fno-builtin
3769 @opindex Wformat=
3770 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3771 the arguments supplied have types appropriate to the format string
3772 specified, and that the conversions specified in the format string make
3773 sense. This includes standard functions, and others specified by format
3774 attributes (@pxref{Function Attributes}), in the @code{printf},
3775 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3776 not in the C standard) families (or other target-specific families).
3777 Which functions are checked without format attributes having been
3778 specified depends on the standard version selected, and such checks of
3779 functions without the attribute specified are disabled by
3780 @option{-ffreestanding} or @option{-fno-builtin}.
3781
3782 The formats are checked against the format features supported by GNU
3783 libc version 2.2. These include all ISO C90 and C99 features, as well
3784 as features from the Single Unix Specification and some BSD and GNU
3785 extensions. Other library implementations may not support all these
3786 features; GCC does not support warning about features that go beyond a
3787 particular library's limitations. However, if @option{-Wpedantic} is used
3788 with @option{-Wformat}, warnings are given about format features not
3789 in the selected standard version (but not for @code{strfmon} formats,
3790 since those are not in any version of the C standard). @xref{C Dialect
3791 Options,,Options Controlling C Dialect}.
3792
3793 @table @gcctabopt
3794 @item -Wformat=1
3795 @itemx -Wformat
3796 @opindex Wformat
3797 @opindex Wformat=1
3798 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3799 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3800 @option{-Wformat} also checks for null format arguments for several
3801 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3802 aspects of this level of format checking can be disabled by the
3803 options: @option{-Wno-format-contains-nul},
3804 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3805 @option{-Wformat} is enabled by @option{-Wall}.
3806
3807 @item -Wno-format-contains-nul
3808 @opindex Wno-format-contains-nul
3809 @opindex Wformat-contains-nul
3810 If @option{-Wformat} is specified, do not warn about format strings that
3811 contain NUL bytes.
3812
3813 @item -Wno-format-extra-args
3814 @opindex Wno-format-extra-args
3815 @opindex Wformat-extra-args
3816 If @option{-Wformat} is specified, do not warn about excess arguments to a
3817 @code{printf} or @code{scanf} format function. The C standard specifies
3818 that such arguments are ignored.
3819
3820 Where the unused arguments lie between used arguments that are
3821 specified with @samp{$} operand number specifications, normally
3822 warnings are still given, since the implementation could not know what
3823 type to pass to @code{va_arg} to skip the unused arguments. However,
3824 in the case of @code{scanf} formats, this option suppresses the
3825 warning if the unused arguments are all pointers, since the Single
3826 Unix Specification says that such unused arguments are allowed.
3827
3828 @item -Wno-format-zero-length
3829 @opindex Wno-format-zero-length
3830 @opindex Wformat-zero-length
3831 If @option{-Wformat} is specified, do not warn about zero-length formats.
3832 The C standard specifies that zero-length formats are allowed.
3833
3834
3835 @item -Wformat=2
3836 @opindex Wformat=2
3837 Enable @option{-Wformat} plus additional format checks. Currently
3838 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3839 -Wformat-y2k}.
3840
3841 @item -Wformat-nonliteral
3842 @opindex Wformat-nonliteral
3843 @opindex Wno-format-nonliteral
3844 If @option{-Wformat} is specified, also warn if the format string is not a
3845 string literal and so cannot be checked, unless the format function
3846 takes its format arguments as a @code{va_list}.
3847
3848 @item -Wformat-security
3849 @opindex Wformat-security
3850 @opindex Wno-format-security
3851 If @option{-Wformat} is specified, also warn about uses of format
3852 functions that represent possible security problems. At present, this
3853 warns about calls to @code{printf} and @code{scanf} functions where the
3854 format string is not a string literal and there are no format arguments,
3855 as in @code{printf (foo);}. This may be a security hole if the format
3856 string came from untrusted input and contains @samp{%n}. (This is
3857 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3858 in future warnings may be added to @option{-Wformat-security} that are not
3859 included in @option{-Wformat-nonliteral}.)
3860
3861 @item -Wformat-signedness
3862 @opindex Wformat-signedness
3863 @opindex Wno-format-signedness
3864 If @option{-Wformat} is specified, also warn if the format string
3865 requires an unsigned argument and the argument is signed and vice versa.
3866
3867 @item -Wformat-y2k
3868 @opindex Wformat-y2k
3869 @opindex Wno-format-y2k
3870 If @option{-Wformat} is specified, also warn about @code{strftime}
3871 formats that may yield only a two-digit year.
3872 @end table
3873
3874 @item -Wnonnull
3875 @opindex Wnonnull
3876 @opindex Wno-nonnull
3877 Warn about passing a null pointer for arguments marked as
3878 requiring a non-null value by the @code{nonnull} function attribute.
3879
3880 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3881 can be disabled with the @option{-Wno-nonnull} option.
3882
3883 @item -Wnonnull-compare
3884 @opindex Wnonnull-compare
3885 @opindex Wno-nonnull-compare
3886 Warn when comparing an argument marked with the @code{nonnull}
3887 function attribute against null inside the function.
3888
3889 @option{-Wnonnull-compare} is included in @option{-Wall}. It
3890 can be disabled with the @option{-Wno-nonnull-compare} option.
3891
3892 @item -Wnull-dereference
3893 @opindex Wnull-dereference
3894 @opindex Wno-null-dereference
3895 Warn if the compiler detects paths that trigger erroneous or
3896 undefined behavior due to dereferencing a null pointer. This option
3897 is only active when @option{-fdelete-null-pointer-checks} is active,
3898 which is enabled by optimizations in most targets. The precision of
3899 the warnings depends on the optimization options used.
3900
3901 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3902 @opindex Winit-self
3903 @opindex Wno-init-self
3904 Warn about uninitialized variables that are initialized with themselves.
3905 Note this option can only be used with the @option{-Wuninitialized} option.
3906
3907 For example, GCC warns about @code{i} being uninitialized in the
3908 following snippet only when @option{-Winit-self} has been specified:
3909 @smallexample
3910 @group
3911 int f()
3912 @{
3913 int i = i;
3914 return i;
3915 @}
3916 @end group
3917 @end smallexample
3918
3919 This warning is enabled by @option{-Wall} in C++.
3920
3921 @item -Wimplicit-int @r{(C and Objective-C only)}
3922 @opindex Wimplicit-int
3923 @opindex Wno-implicit-int
3924 Warn when a declaration does not specify a type.
3925 This warning is enabled by @option{-Wall}.
3926
3927 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3928 @opindex Wimplicit-function-declaration
3929 @opindex Wno-implicit-function-declaration
3930 Give a warning whenever a function is used before being declared. In
3931 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3932 enabled by default and it is made into an error by
3933 @option{-pedantic-errors}. This warning is also enabled by
3934 @option{-Wall}.
3935
3936 @item -Wimplicit @r{(C and Objective-C only)}
3937 @opindex Wimplicit
3938 @opindex Wno-implicit
3939 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3940 This warning is enabled by @option{-Wall}.
3941
3942 @item -Wignored-qualifiers @r{(C and C++ only)}
3943 @opindex Wignored-qualifiers
3944 @opindex Wno-ignored-qualifiers
3945 Warn if the return type of a function has a type qualifier
3946 such as @code{const}. For ISO C such a type qualifier has no effect,
3947 since the value returned by a function is not an lvalue.
3948 For C++, the warning is only emitted for scalar types or @code{void}.
3949 ISO C prohibits qualified @code{void} return types on function
3950 definitions, so such return types always receive a warning
3951 even without this option.
3952
3953 This warning is also enabled by @option{-Wextra}.
3954
3955 @item -Wignored-attributes @r{(C and C++ only)}
3956 @opindex Wignored-attributes
3957 @opindex Wno-ignored-attributes
3958 Warn when an attribute is ignored. This is different from the
3959 @option{-Wattributes} option in that it warns whenever the compiler decides
3960 to drop an attribute, not that the attribute is either unknown, used in a
3961 wrong place, etc. This warning is enabled by default.
3962
3963 @item -Wmain
3964 @opindex Wmain
3965 @opindex Wno-main
3966 Warn if the type of @code{main} is suspicious. @code{main} should be
3967 a function with external linkage, returning int, taking either zero
3968 arguments, two, or three arguments of appropriate types. This warning
3969 is enabled by default in C++ and is enabled by either @option{-Wall}
3970 or @option{-Wpedantic}.
3971
3972 @item -Wmisleading-indentation @r{(C and C++ only)}
3973 @opindex Wmisleading-indentation
3974 @opindex Wno-misleading-indentation
3975 Warn when the indentation of the code does not reflect the block structure.
3976 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
3977 @code{for} clauses with a guarded statement that does not use braces,
3978 followed by an unguarded statement with the same indentation.
3979
3980 In the following example, the call to ``bar'' is misleadingly indented as
3981 if it were guarded by the ``if'' conditional.
3982
3983 @smallexample
3984 if (some_condition ())
3985 foo ();
3986 bar (); /* Gotcha: this is not guarded by the "if". */
3987 @end smallexample
3988
3989 In the case of mixed tabs and spaces, the warning uses the
3990 @option{-ftabstop=} option to determine if the statements line up
3991 (defaulting to 8).
3992
3993 The warning is not issued for code involving multiline preprocessor logic
3994 such as the following example.
3995
3996 @smallexample
3997 if (flagA)
3998 foo (0);
3999 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4000 if (flagB)
4001 #endif
4002 foo (1);
4003 @end smallexample
4004
4005 The warning is not issued after a @code{#line} directive, since this
4006 typically indicates autogenerated code, and no assumptions can be made
4007 about the layout of the file that the directive references.
4008
4009 This warning is enabled by @option{-Wall} in C and C++.
4010
4011 @item -Wmissing-braces
4012 @opindex Wmissing-braces
4013 @opindex Wno-missing-braces
4014 Warn if an aggregate or union initializer is not fully bracketed. In
4015 the following example, the initializer for @code{a} is not fully
4016 bracketed, but that for @code{b} is fully bracketed. This warning is
4017 enabled by @option{-Wall} in C.
4018
4019 @smallexample
4020 int a[2][2] = @{ 0, 1, 2, 3 @};
4021 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4022 @end smallexample
4023
4024 This warning is enabled by @option{-Wall}.
4025
4026 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4027 @opindex Wmissing-include-dirs
4028 @opindex Wno-missing-include-dirs
4029 Warn if a user-supplied include directory does not exist.
4030
4031 @item -Wparentheses
4032 @opindex Wparentheses
4033 @opindex Wno-parentheses
4034 Warn if parentheses are omitted in certain contexts, such
4035 as when there is an assignment in a context where a truth value
4036 is expected, or when operators are nested whose precedence people
4037 often get confused about.
4038
4039 Also warn if a comparison like @code{x<=y<=z} appears; this is
4040 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4041 interpretation from that of ordinary mathematical notation.
4042
4043 Also warn for dangerous uses of the GNU extension to
4044 @code{?:} with omitted middle operand. When the condition
4045 in the @code{?}: operator is a boolean expression, the omitted value is
4046 always 1. Often programmers expect it to be a value computed
4047 inside the conditional expression instead.
4048
4049 This warning is enabled by @option{-Wall}.
4050
4051 @item -Wsequence-point
4052 @opindex Wsequence-point
4053 @opindex Wno-sequence-point
4054 Warn about code that may have undefined semantics because of violations
4055 of sequence point rules in the C and C++ standards.
4056
4057 The C and C++ standards define the order in which expressions in a C/C++
4058 program are evaluated in terms of @dfn{sequence points}, which represent
4059 a partial ordering between the execution of parts of the program: those
4060 executed before the sequence point, and those executed after it. These
4061 occur after the evaluation of a full expression (one which is not part
4062 of a larger expression), after the evaluation of the first operand of a
4063 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4064 function is called (but after the evaluation of its arguments and the
4065 expression denoting the called function), and in certain other places.
4066 Other than as expressed by the sequence point rules, the order of
4067 evaluation of subexpressions of an expression is not specified. All
4068 these rules describe only a partial order rather than a total order,
4069 since, for example, if two functions are called within one expression
4070 with no sequence point between them, the order in which the functions
4071 are called is not specified. However, the standards committee have
4072 ruled that function calls do not overlap.
4073
4074 It is not specified when between sequence points modifications to the
4075 values of objects take effect. Programs whose behavior depends on this
4076 have undefined behavior; the C and C++ standards specify that ``Between
4077 the previous and next sequence point an object shall have its stored
4078 value modified at most once by the evaluation of an expression.
4079 Furthermore, the prior value shall be read only to determine the value
4080 to be stored.''. If a program breaks these rules, the results on any
4081 particular implementation are entirely unpredictable.
4082
4083 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4084 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4085 diagnosed by this option, and it may give an occasional false positive
4086 result, but in general it has been found fairly effective at detecting
4087 this sort of problem in programs.
4088
4089 The C++17 standard will define the order of evaluation of operands in
4090 more cases: in particular it requires that the right-hand side of an
4091 assignment be evaluated before the left-hand side, so the above
4092 examples are no longer undefined. But this warning will still warn
4093 about them, to help people avoid writing code that is undefined in C
4094 and earlier revisions of C++.
4095
4096 The standard is worded confusingly, therefore there is some debate
4097 over the precise meaning of the sequence point rules in subtle cases.
4098 Links to discussions of the problem, including proposed formal
4099 definitions, may be found on the GCC readings page, at
4100 @uref{http://gcc.gnu.org/@/readings.html}.
4101
4102 This warning is enabled by @option{-Wall} for C and C++.
4103
4104 @item -Wno-return-local-addr
4105 @opindex Wno-return-local-addr
4106 @opindex Wreturn-local-addr
4107 Do not warn about returning a pointer (or in C++, a reference) to a
4108 variable that goes out of scope after the function returns.
4109
4110 @item -Wreturn-type
4111 @opindex Wreturn-type
4112 @opindex Wno-return-type
4113 Warn whenever a function is defined with a return type that defaults
4114 to @code{int}. Also warn about any @code{return} statement with no
4115 return value in a function whose return type is not @code{void}
4116 (falling off the end of the function body is considered returning
4117 without a value).
4118
4119 For C only, warn about a @code{return} statement with an expression in a
4120 function whose return type is @code{void}, unless the expression type is
4121 also @code{void}. As a GNU extension, the latter case is accepted
4122 without a warning unless @option{-Wpedantic} is used.
4123
4124 For C++, a function without return type always produces a diagnostic
4125 message, even when @option{-Wno-return-type} is specified. The only
4126 exceptions are @code{main} and functions defined in system headers.
4127
4128 This warning is enabled by @option{-Wall}.
4129
4130 @item -Wshift-count-negative
4131 @opindex Wshift-count-negative
4132 @opindex Wno-shift-count-negative
4133 Warn if shift count is negative. This warning is enabled by default.
4134
4135 @item -Wshift-count-overflow
4136 @opindex Wshift-count-overflow
4137 @opindex Wno-shift-count-overflow
4138 Warn if shift count >= width of type. This warning is enabled by default.
4139
4140 @item -Wshift-negative-value
4141 @opindex Wshift-negative-value
4142 @opindex Wno-shift-negative-value
4143 Warn if left shifting a negative value. This warning is enabled by
4144 @option{-Wextra} in C99 and C++11 modes (and newer).
4145
4146 @item -Wshift-overflow
4147 @itemx -Wshift-overflow=@var{n}
4148 @opindex Wshift-overflow
4149 @opindex Wno-shift-overflow
4150 Warn about left shift overflows. This warning is enabled by
4151 default in C99 and C++11 modes (and newer).
4152
4153 @table @gcctabopt
4154 @item -Wshift-overflow=1
4155 This is the warning level of @option{-Wshift-overflow} and is enabled
4156 by default in C99 and C++11 modes (and newer). This warning level does
4157 not warn about left-shifting 1 into the sign bit. (However, in C, such
4158 an overflow is still rejected in contexts where an integer constant expression
4159 is required.)
4160
4161 @item -Wshift-overflow=2
4162 This warning level also warns about left-shifting 1 into the sign bit,
4163 unless C++14 mode is active.
4164 @end table
4165
4166 @item -Wswitch
4167 @opindex Wswitch
4168 @opindex Wno-switch
4169 Warn whenever a @code{switch} statement has an index of enumerated type
4170 and lacks a @code{case} for one or more of the named codes of that
4171 enumeration. (The presence of a @code{default} label prevents this
4172 warning.) @code{case} labels outside the enumeration range also
4173 provoke warnings when this option is used (even if there is a
4174 @code{default} label).
4175 This warning is enabled by @option{-Wall}.
4176
4177 @item -Wswitch-default
4178 @opindex Wswitch-default
4179 @opindex Wno-switch-default
4180 Warn whenever a @code{switch} statement does not have a @code{default}
4181 case.
4182
4183 @item -Wswitch-enum
4184 @opindex Wswitch-enum
4185 @opindex Wno-switch-enum
4186 Warn whenever a @code{switch} statement has an index of enumerated type
4187 and lacks a @code{case} for one or more of the named codes of that
4188 enumeration. @code{case} labels outside the enumeration range also
4189 provoke warnings when this option is used. The only difference
4190 between @option{-Wswitch} and this option is that this option gives a
4191 warning about an omitted enumeration code even if there is a
4192 @code{default} label.
4193
4194 @item -Wswitch-bool
4195 @opindex Wswitch-bool
4196 @opindex Wno-switch-bool
4197 Warn whenever a @code{switch} statement has an index of boolean type
4198 and the case values are outside the range of a boolean type.
4199 It is possible to suppress this warning by casting the controlling
4200 expression to a type other than @code{bool}. For example:
4201 @smallexample
4202 @group
4203 switch ((int) (a == 4))
4204 @{
4205 @dots{}
4206 @}
4207 @end group
4208 @end smallexample
4209 This warning is enabled by default for C and C++ programs.
4210
4211 @item -Wswitch-unreachable
4212 @opindex Wswitch-unreachable
4213 @opindex Wno-switch-unreachable
4214 Warn whenever a @code{switch} statement contains statements between the
4215 controlling expression and the first case label, which will never be
4216 executed. For example:
4217 @smallexample
4218 @group
4219 switch (cond)
4220 @{
4221 i = 15;
4222 @dots{}
4223 case 5:
4224 @dots{}
4225 @}
4226 @end group
4227 @end smallexample
4228 @option{-Wswitch-unreachable} does not warn if the statement between the
4229 controlling expression and the first case label is just a declaration:
4230 @smallexample
4231 @group
4232 switch (cond)
4233 @{
4234 int i;
4235 @dots{}
4236 case 5:
4237 i = 5;
4238 @dots{}
4239 @}
4240 @end group
4241 @end smallexample
4242 This warning is enabled by default for C and C++ programs.
4243
4244 @item -Wsync-nand @r{(C and C++ only)}
4245 @opindex Wsync-nand
4246 @opindex Wno-sync-nand
4247 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4248 built-in functions are used. These functions changed semantics in GCC 4.4.
4249
4250 @item -Wtrigraphs
4251 @opindex Wtrigraphs
4252 @opindex Wno-trigraphs
4253 Warn if any trigraphs are encountered that might change the meaning of
4254 the program (trigraphs within comments are not warned about).
4255 This warning is enabled by @option{-Wall}.
4256
4257 @item -Wunused-but-set-parameter
4258 @opindex Wunused-but-set-parameter
4259 @opindex Wno-unused-but-set-parameter
4260 Warn whenever a function parameter is assigned to, but otherwise unused
4261 (aside from its declaration).
4262
4263 To suppress this warning use the @code{unused} attribute
4264 (@pxref{Variable Attributes}).
4265
4266 This warning is also enabled by @option{-Wunused} together with
4267 @option{-Wextra}.
4268
4269 @item -Wunused-but-set-variable
4270 @opindex Wunused-but-set-variable
4271 @opindex Wno-unused-but-set-variable
4272 Warn whenever a local variable is assigned to, but otherwise unused
4273 (aside from its declaration).
4274 This warning is enabled by @option{-Wall}.
4275
4276 To suppress this warning use the @code{unused} attribute
4277 (@pxref{Variable Attributes}).
4278
4279 This warning is also enabled by @option{-Wunused}, which is enabled
4280 by @option{-Wall}.
4281
4282 @item -Wunused-function
4283 @opindex Wunused-function
4284 @opindex Wno-unused-function
4285 Warn whenever a static function is declared but not defined or a
4286 non-inline static function is unused.
4287 This warning is enabled by @option{-Wall}.
4288
4289 @item -Wunused-label
4290 @opindex Wunused-label
4291 @opindex Wno-unused-label
4292 Warn whenever a label is declared but not used.
4293 This warning is enabled by @option{-Wall}.
4294
4295 To suppress this warning use the @code{unused} attribute
4296 (@pxref{Variable Attributes}).
4297
4298 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4299 @opindex Wunused-local-typedefs
4300 Warn when a typedef locally defined in a function is not used.
4301 This warning is enabled by @option{-Wall}.
4302
4303 @item -Wunused-parameter
4304 @opindex Wunused-parameter
4305 @opindex Wno-unused-parameter
4306 Warn whenever a function parameter is unused aside from its declaration.
4307
4308 To suppress this warning use the @code{unused} attribute
4309 (@pxref{Variable Attributes}).
4310
4311 @item -Wno-unused-result
4312 @opindex Wunused-result
4313 @opindex Wno-unused-result
4314 Do not warn if a caller of a function marked with attribute
4315 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4316 its return value. The default is @option{-Wunused-result}.
4317
4318 @item -Wunused-variable
4319 @opindex Wunused-variable
4320 @opindex Wno-unused-variable
4321 Warn whenever a local or static variable is unused aside from its
4322 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4323 but not for C++. This warning is enabled by @option{-Wall}.
4324
4325 To suppress this warning use the @code{unused} attribute
4326 (@pxref{Variable Attributes}).
4327
4328 @item -Wunused-const-variable
4329 @itemx -Wunused-const-variable=@var{n}
4330 @opindex Wunused-const-variable
4331 @opindex Wno-unused-const-variable
4332 Warn whenever a constant static variable is unused aside from its declaration.
4333 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4334 for C, but not for C++. In C this declares variable storage, but in C++ this
4335 is not an error since const variables take the place of @code{#define}s.
4336
4337 To suppress this warning use the @code{unused} attribute
4338 (@pxref{Variable Attributes}).
4339
4340 @table @gcctabopt
4341 @item -Wunused-const-variable=1
4342 This is the warning level that is enabled by @option{-Wunused-variable} for
4343 C. It warns only about unused static const variables defined in the main
4344 compilation unit, but not about static const variables declared in any
4345 header included.
4346
4347 @item -Wunused-const-variable=2
4348 This warning level also warns for unused constant static variables in
4349 headers (excluding system headers). This is the warning level of
4350 @option{-Wunused-const-variable} and must be explicitly requested since
4351 in C++ this isn't an error and in C it might be harder to clean up all
4352 headers included.
4353 @end table
4354
4355 @item -Wunused-value
4356 @opindex Wunused-value
4357 @opindex Wno-unused-value
4358 Warn whenever a statement computes a result that is explicitly not
4359 used. To suppress this warning cast the unused expression to
4360 @code{void}. This includes an expression-statement or the left-hand
4361 side of a comma expression that contains no side effects. For example,
4362 an expression such as @code{x[i,j]} causes a warning, while
4363 @code{x[(void)i,j]} does not.
4364
4365 This warning is enabled by @option{-Wall}.
4366
4367 @item -Wunused
4368 @opindex Wunused
4369 @opindex Wno-unused
4370 All the above @option{-Wunused} options combined.
4371
4372 In order to get a warning about an unused function parameter, you must
4373 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4374 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4375
4376 @item -Wuninitialized
4377 @opindex Wuninitialized
4378 @opindex Wno-uninitialized
4379 Warn if an automatic variable is used without first being initialized
4380 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4381 warn if a non-static reference or non-static @code{const} member
4382 appears in a class without constructors.
4383
4384 If you want to warn about code that uses the uninitialized value of the
4385 variable in its own initializer, use the @option{-Winit-self} option.
4386
4387 These warnings occur for individual uninitialized or clobbered
4388 elements of structure, union or array variables as well as for
4389 variables that are uninitialized or clobbered as a whole. They do
4390 not occur for variables or elements declared @code{volatile}. Because
4391 these warnings depend on optimization, the exact variables or elements
4392 for which there are warnings depends on the precise optimization
4393 options and version of GCC used.
4394
4395 Note that there may be no warning about a variable that is used only
4396 to compute a value that itself is never used, because such
4397 computations may be deleted by data flow analysis before the warnings
4398 are printed.
4399
4400 @item -Winvalid-memory-model
4401 @opindex Winvalid-memory-model
4402 @opindex Wno-invalid-memory-model
4403 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4404 and the C11 atomic generic functions with a memory consistency argument
4405 that is either invalid for the operation or outside the range of values
4406 of the @code{memory_order} enumeration. For example, since the
4407 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4408 defined for the relaxed, release, and sequentially consistent memory
4409 orders the following code is diagnosed:
4410
4411 @smallexample
4412 void store (int *i)
4413 @{
4414 __atomic_store_n (i, 0, memory_order_consume);
4415 @}
4416 @end smallexample
4417
4418 @option{-Winvalid-memory-model} is enabled by default.
4419
4420 @item -Wmaybe-uninitialized
4421 @opindex Wmaybe-uninitialized
4422 @opindex Wno-maybe-uninitialized
4423 For an automatic variable, if there exists a path from the function
4424 entry to a use of the variable that is initialized, but there exist
4425 some other paths for which the variable is not initialized, the compiler
4426 emits a warning if it cannot prove the uninitialized paths are not
4427 executed at run time. These warnings are made optional because GCC is
4428 not smart enough to see all the reasons why the code might be correct
4429 in spite of appearing to have an error. Here is one example of how
4430 this can happen:
4431
4432 @smallexample
4433 @group
4434 @{
4435 int x;
4436 switch (y)
4437 @{
4438 case 1: x = 1;
4439 break;
4440 case 2: x = 4;
4441 break;
4442 case 3: x = 5;
4443 @}
4444 foo (x);
4445 @}
4446 @end group
4447 @end smallexample
4448
4449 @noindent
4450 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4451 always initialized, but GCC doesn't know this. To suppress the
4452 warning, you need to provide a default case with assert(0) or
4453 similar code.
4454
4455 @cindex @code{longjmp} warnings
4456 This option also warns when a non-volatile automatic variable might be
4457 changed by a call to @code{longjmp}. These warnings as well are possible
4458 only in optimizing compilation.
4459
4460 The compiler sees only the calls to @code{setjmp}. It cannot know
4461 where @code{longjmp} will be called; in fact, a signal handler could
4462 call it at any point in the code. As a result, you may get a warning
4463 even when there is in fact no problem because @code{longjmp} cannot
4464 in fact be called at the place that would cause a problem.
4465
4466 Some spurious warnings can be avoided if you declare all the functions
4467 you use that never return as @code{noreturn}. @xref{Function
4468 Attributes}.
4469
4470 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4471
4472 @item -Wunknown-pragmas
4473 @opindex Wunknown-pragmas
4474 @opindex Wno-unknown-pragmas
4475 @cindex warning for unknown pragmas
4476 @cindex unknown pragmas, warning
4477 @cindex pragmas, warning of unknown
4478 Warn when a @code{#pragma} directive is encountered that is not understood by
4479 GCC@. If this command-line option is used, warnings are even issued
4480 for unknown pragmas in system header files. This is not the case if
4481 the warnings are only enabled by the @option{-Wall} command-line option.
4482
4483 @item -Wno-pragmas
4484 @opindex Wno-pragmas
4485 @opindex Wpragmas
4486 Do not warn about misuses of pragmas, such as incorrect parameters,
4487 invalid syntax, or conflicts between pragmas. See also
4488 @option{-Wunknown-pragmas}.
4489
4490 @item -Wstrict-aliasing
4491 @opindex Wstrict-aliasing
4492 @opindex Wno-strict-aliasing
4493 This option is only active when @option{-fstrict-aliasing} is active.
4494 It warns about code that might break the strict aliasing rules that the
4495 compiler is using for optimization. The warning does not catch all
4496 cases, but does attempt to catch the more common pitfalls. It is
4497 included in @option{-Wall}.
4498 It is equivalent to @option{-Wstrict-aliasing=3}
4499
4500 @item -Wstrict-aliasing=n
4501 @opindex Wstrict-aliasing=n
4502 This option is only active when @option{-fstrict-aliasing} is active.
4503 It warns about code that might break the strict aliasing rules that the
4504 compiler is using for optimization.
4505 Higher levels correspond to higher accuracy (fewer false positives).
4506 Higher levels also correspond to more effort, similar to the way @option{-O}
4507 works.
4508 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4509
4510 Level 1: Most aggressive, quick, least accurate.
4511 Possibly useful when higher levels
4512 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4513 false negatives. However, it has many false positives.
4514 Warns for all pointer conversions between possibly incompatible types,
4515 even if never dereferenced. Runs in the front end only.
4516
4517 Level 2: Aggressive, quick, not too precise.
4518 May still have many false positives (not as many as level 1 though),
4519 and few false negatives (but possibly more than level 1).
4520 Unlike level 1, it only warns when an address is taken. Warns about
4521 incomplete types. Runs in the front end only.
4522
4523 Level 3 (default for @option{-Wstrict-aliasing}):
4524 Should have very few false positives and few false
4525 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4526 Takes care of the common pun+dereference pattern in the front end:
4527 @code{*(int*)&some_float}.
4528 If optimization is enabled, it also runs in the back end, where it deals
4529 with multiple statement cases using flow-sensitive points-to information.
4530 Only warns when the converted pointer is dereferenced.
4531 Does not warn about incomplete types.
4532
4533 @item -Wstrict-overflow
4534 @itemx -Wstrict-overflow=@var{n}
4535 @opindex Wstrict-overflow
4536 @opindex Wno-strict-overflow
4537 This option is only active when @option{-fstrict-overflow} is active.
4538 It warns about cases where the compiler optimizes based on the
4539 assumption that signed overflow does not occur. Note that it does not
4540 warn about all cases where the code might overflow: it only warns
4541 about cases where the compiler implements some optimization. Thus
4542 this warning depends on the optimization level.
4543
4544 An optimization that assumes that signed overflow does not occur is
4545 perfectly safe if the values of the variables involved are such that
4546 overflow never does, in fact, occur. Therefore this warning can
4547 easily give a false positive: a warning about code that is not
4548 actually a problem. To help focus on important issues, several
4549 warning levels are defined. No warnings are issued for the use of
4550 undefined signed overflow when estimating how many iterations a loop
4551 requires, in particular when determining whether a loop will be
4552 executed at all.
4553
4554 @table @gcctabopt
4555 @item -Wstrict-overflow=1
4556 Warn about cases that are both questionable and easy to avoid. For
4557 example, with @option{-fstrict-overflow}, the compiler simplifies
4558 @code{x + 1 > x} to @code{1}. This level of
4559 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4560 are not, and must be explicitly requested.
4561
4562 @item -Wstrict-overflow=2
4563 Also warn about other cases where a comparison is simplified to a
4564 constant. For example: @code{abs (x) >= 0}. This can only be
4565 simplified when @option{-fstrict-overflow} is in effect, because
4566 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4567 zero. @option{-Wstrict-overflow} (with no level) is the same as
4568 @option{-Wstrict-overflow=2}.
4569
4570 @item -Wstrict-overflow=3
4571 Also warn about other cases where a comparison is simplified. For
4572 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4573
4574 @item -Wstrict-overflow=4
4575 Also warn about other simplifications not covered by the above cases.
4576 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4577
4578 @item -Wstrict-overflow=5
4579 Also warn about cases where the compiler reduces the magnitude of a
4580 constant involved in a comparison. For example: @code{x + 2 > y} is
4581 simplified to @code{x + 1 >= y}. This is reported only at the
4582 highest warning level because this simplification applies to many
4583 comparisons, so this warning level gives a very large number of
4584 false positives.
4585 @end table
4586
4587 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4588 @opindex Wsuggest-attribute=
4589 @opindex Wno-suggest-attribute=
4590 Warn for cases where adding an attribute may be beneficial. The
4591 attributes currently supported are listed below.
4592
4593 @table @gcctabopt
4594 @item -Wsuggest-attribute=pure
4595 @itemx -Wsuggest-attribute=const
4596 @itemx -Wsuggest-attribute=noreturn
4597 @opindex Wsuggest-attribute=pure
4598 @opindex Wno-suggest-attribute=pure
4599 @opindex Wsuggest-attribute=const
4600 @opindex Wno-suggest-attribute=const
4601 @opindex Wsuggest-attribute=noreturn
4602 @opindex Wno-suggest-attribute=noreturn
4603
4604 Warn about functions that might be candidates for attributes
4605 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4606 functions visible in other compilation units or (in the case of @code{pure} and
4607 @code{const}) if it cannot prove that the function returns normally. A function
4608 returns normally if it doesn't contain an infinite loop or return abnormally
4609 by throwing, calling @code{abort} or trapping. This analysis requires option
4610 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4611 higher. Higher optimization levels improve the accuracy of the analysis.
4612
4613 @item -Wsuggest-attribute=format
4614 @itemx -Wmissing-format-attribute
4615 @opindex Wsuggest-attribute=format
4616 @opindex Wmissing-format-attribute
4617 @opindex Wno-suggest-attribute=format
4618 @opindex Wno-missing-format-attribute
4619 @opindex Wformat
4620 @opindex Wno-format
4621
4622 Warn about function pointers that might be candidates for @code{format}
4623 attributes. Note these are only possible candidates, not absolute ones.
4624 GCC guesses that function pointers with @code{format} attributes that
4625 are used in assignment, initialization, parameter passing or return
4626 statements should have a corresponding @code{format} attribute in the
4627 resulting type. I.e.@: the left-hand side of the assignment or
4628 initialization, the type of the parameter variable, or the return type
4629 of the containing function respectively should also have a @code{format}
4630 attribute to avoid the warning.
4631
4632 GCC also warns about function definitions that might be
4633 candidates for @code{format} attributes. Again, these are only
4634 possible candidates. GCC guesses that @code{format} attributes
4635 might be appropriate for any function that calls a function like
4636 @code{vprintf} or @code{vscanf}, but this might not always be the
4637 case, and some functions for which @code{format} attributes are
4638 appropriate may not be detected.
4639 @end table
4640
4641 @item -Wsuggest-final-types
4642 @opindex Wno-suggest-final-types
4643 @opindex Wsuggest-final-types
4644 Warn about types with virtual methods where code quality would be improved
4645 if the type were declared with the C++11 @code{final} specifier,
4646 or, if possible,
4647 declared in an anonymous namespace. This allows GCC to more aggressively
4648 devirtualize the polymorphic calls. This warning is more effective with link
4649 time optimization, where the information about the class hierarchy graph is
4650 more complete.
4651
4652 @item -Wsuggest-final-methods
4653 @opindex Wno-suggest-final-methods
4654 @opindex Wsuggest-final-methods
4655 Warn about virtual methods where code quality would be improved if the method
4656 were declared with the C++11 @code{final} specifier,
4657 or, if possible, its type were
4658 declared in an anonymous namespace or with the @code{final} specifier.
4659 This warning is
4660 more effective with link time optimization, where the information about the
4661 class hierarchy graph is more complete. It is recommended to first consider
4662 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4663 annotations.
4664
4665 @item -Wsuggest-override
4666 Warn about overriding virtual functions that are not marked with the override
4667 keyword.
4668
4669 @item -Warray-bounds
4670 @itemx -Warray-bounds=@var{n}
4671 @opindex Wno-array-bounds
4672 @opindex Warray-bounds
4673 This option is only active when @option{-ftree-vrp} is active
4674 (default for @option{-O2} and above). It warns about subscripts to arrays
4675 that are always out of bounds. This warning is enabled by @option{-Wall}.
4676
4677 @table @gcctabopt
4678 @item -Warray-bounds=1
4679 This is the warning level of @option{-Warray-bounds} and is enabled
4680 by @option{-Wall}; higher levels are not, and must be explicitly requested.
4681
4682 @item -Warray-bounds=2
4683 This warning level also warns about out of bounds access for
4684 arrays at the end of a struct and for arrays accessed through
4685 pointers. This warning level may give a larger number of
4686 false positives and is deactivated by default.
4687 @end table
4688
4689 @item -Wbool-compare
4690 @opindex Wno-bool-compare
4691 @opindex Wbool-compare
4692 Warn about boolean expression compared with an integer value different from
4693 @code{true}/@code{false}. For instance, the following comparison is
4694 always false:
4695 @smallexample
4696 int n = 5;
4697 @dots{}
4698 if ((n > 1) == 2) @{ @dots{} @}
4699 @end smallexample
4700 This warning is enabled by @option{-Wall}.
4701
4702 @item -Wduplicated-cond
4703 @opindex Wno-duplicated-cond
4704 @opindex Wduplicated-cond
4705 Warn about duplicated conditions in an if-else-if chain. For instance,
4706 warn for the following code:
4707 @smallexample
4708 if (p->q != NULL) @{ @dots{} @}
4709 else if (p->q != NULL) @{ @dots{} @}
4710 @end smallexample
4711
4712 @item -Wframe-address
4713 @opindex Wno-frame-address
4714 @opindex Wframe-address
4715 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
4716 is called with an argument greater than 0. Such calls may return indeterminate
4717 values or crash the program. The warning is included in @option{-Wall}.
4718
4719 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
4720 @opindex Wno-discarded-qualifiers
4721 @opindex Wdiscarded-qualifiers
4722 Do not warn if type qualifiers on pointers are being discarded.
4723 Typically, the compiler warns if a @code{const char *} variable is
4724 passed to a function that takes a @code{char *} parameter. This option
4725 can be used to suppress such a warning.
4726
4727 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
4728 @opindex Wno-discarded-array-qualifiers
4729 @opindex Wdiscarded-array-qualifiers
4730 Do not warn if type qualifiers on arrays which are pointer targets
4731 are being discarded. Typically, the compiler warns if a
4732 @code{const int (*)[]} variable is passed to a function that
4733 takes a @code{int (*)[]} parameter. This option can be used to
4734 suppress such a warning.
4735
4736 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
4737 @opindex Wno-incompatible-pointer-types
4738 @opindex Wincompatible-pointer-types
4739 Do not warn when there is a conversion between pointers that have incompatible
4740 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
4741 which warns for pointer argument passing or assignment with different
4742 signedness.
4743
4744 @item -Wno-int-conversion @r{(C and Objective-C only)}
4745 @opindex Wno-int-conversion
4746 @opindex Wint-conversion
4747 Do not warn about incompatible integer to pointer and pointer to integer
4748 conversions. This warning is about implicit conversions; for explicit
4749 conversions the warnings @option{-Wno-int-to-pointer-cast} and
4750 @option{-Wno-pointer-to-int-cast} may be used.
4751
4752 @item -Wno-div-by-zero
4753 @opindex Wno-div-by-zero
4754 @opindex Wdiv-by-zero
4755 Do not warn about compile-time integer division by zero. Floating-point
4756 division by zero is not warned about, as it can be a legitimate way of
4757 obtaining infinities and NaNs.
4758
4759 @item -Wsystem-headers
4760 @opindex Wsystem-headers
4761 @opindex Wno-system-headers
4762 @cindex warnings from system headers
4763 @cindex system headers, warnings from
4764 Print warning messages for constructs found in system header files.
4765 Warnings from system headers are normally suppressed, on the assumption
4766 that they usually do not indicate real problems and would only make the
4767 compiler output harder to read. Using this command-line option tells
4768 GCC to emit warnings from system headers as if they occurred in user
4769 code. However, note that using @option{-Wall} in conjunction with this
4770 option does @emph{not} warn about unknown pragmas in system
4771 headers---for that, @option{-Wunknown-pragmas} must also be used.
4772
4773 @item -Wtautological-compare
4774 @opindex Wtautological-compare
4775 @opindex Wno-tautological-compare
4776 Warn if a self-comparison always evaluates to true or false. This
4777 warning detects various mistakes such as:
4778 @smallexample
4779 int i = 1;
4780 @dots{}
4781 if (i > i) @{ @dots{} @}
4782 @end smallexample
4783 This warning is enabled by @option{-Wall}.
4784
4785 @item -Wtrampolines
4786 @opindex Wtrampolines
4787 @opindex Wno-trampolines
4788 Warn about trampolines generated for pointers to nested functions.
4789 A trampoline is a small piece of data or code that is created at run
4790 time on the stack when the address of a nested function is taken, and is
4791 used to call the nested function indirectly. For some targets, it is
4792 made up of data only and thus requires no special treatment. But, for
4793 most targets, it is made up of code and thus requires the stack to be
4794 made executable in order for the program to work properly.
4795
4796 @item -Wfloat-equal
4797 @opindex Wfloat-equal
4798 @opindex Wno-float-equal
4799 Warn if floating-point values are used in equality comparisons.
4800
4801 The idea behind this is that sometimes it is convenient (for the
4802 programmer) to consider floating-point values as approximations to
4803 infinitely precise real numbers. If you are doing this, then you need
4804 to compute (by analyzing the code, or in some other way) the maximum or
4805 likely maximum error that the computation introduces, and allow for it
4806 when performing comparisons (and when producing output, but that's a
4807 different problem). In particular, instead of testing for equality, you
4808 should check to see whether the two values have ranges that overlap; and
4809 this is done with the relational operators, so equality comparisons are
4810 probably mistaken.
4811
4812 @item -Wtraditional @r{(C and Objective-C only)}
4813 @opindex Wtraditional
4814 @opindex Wno-traditional
4815 Warn about certain constructs that behave differently in traditional and
4816 ISO C@. Also warn about ISO C constructs that have no traditional C
4817 equivalent, and/or problematic constructs that should be avoided.
4818
4819 @itemize @bullet
4820 @item
4821 Macro parameters that appear within string literals in the macro body.
4822 In traditional C macro replacement takes place within string literals,
4823 but in ISO C it does not.
4824
4825 @item
4826 In traditional C, some preprocessor directives did not exist.
4827 Traditional preprocessors only considered a line to be a directive
4828 if the @samp{#} appeared in column 1 on the line. Therefore
4829 @option{-Wtraditional} warns about directives that traditional C
4830 understands but ignores because the @samp{#} does not appear as the
4831 first character on the line. It also suggests you hide directives like
4832 @code{#pragma} not understood by traditional C by indenting them. Some
4833 traditional implementations do not recognize @code{#elif}, so this option
4834 suggests avoiding it altogether.
4835
4836 @item
4837 A function-like macro that appears without arguments.
4838
4839 @item
4840 The unary plus operator.
4841
4842 @item
4843 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4844 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
4845 constants.) Note, these suffixes appear in macros defined in the system
4846 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4847 Use of these macros in user code might normally lead to spurious
4848 warnings, however GCC's integrated preprocessor has enough context to
4849 avoid warning in these cases.
4850
4851 @item
4852 A function declared external in one block and then used after the end of
4853 the block.
4854
4855 @item
4856 A @code{switch} statement has an operand of type @code{long}.
4857
4858 @item
4859 A non-@code{static} function declaration follows a @code{static} one.
4860 This construct is not accepted by some traditional C compilers.
4861
4862 @item
4863 The ISO type of an integer constant has a different width or
4864 signedness from its traditional type. This warning is only issued if
4865 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
4866 typically represent bit patterns, are not warned about.
4867
4868 @item
4869 Usage of ISO string concatenation is detected.
4870
4871 @item
4872 Initialization of automatic aggregates.
4873
4874 @item
4875 Identifier conflicts with labels. Traditional C lacks a separate
4876 namespace for labels.
4877
4878 @item
4879 Initialization of unions. If the initializer is zero, the warning is
4880 omitted. This is done under the assumption that the zero initializer in
4881 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4882 initializer warnings and relies on default initialization to zero in the
4883 traditional C case.
4884
4885 @item
4886 Conversions by prototypes between fixed/floating-point values and vice
4887 versa. The absence of these prototypes when compiling with traditional
4888 C causes serious problems. This is a subset of the possible
4889 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4890
4891 @item
4892 Use of ISO C style function definitions. This warning intentionally is
4893 @emph{not} issued for prototype declarations or variadic functions
4894 because these ISO C features appear in your code when using
4895 libiberty's traditional C compatibility macros, @code{PARAMS} and
4896 @code{VPARAMS}. This warning is also bypassed for nested functions
4897 because that feature is already a GCC extension and thus not relevant to
4898 traditional C compatibility.
4899 @end itemize
4900
4901 @item -Wtraditional-conversion @r{(C and Objective-C only)}
4902 @opindex Wtraditional-conversion
4903 @opindex Wno-traditional-conversion
4904 Warn if a prototype causes a type conversion that is different from what
4905 would happen to the same argument in the absence of a prototype. This
4906 includes conversions of fixed point to floating and vice versa, and
4907 conversions changing the width or signedness of a fixed-point argument
4908 except when the same as the default promotion.
4909
4910 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4911 @opindex Wdeclaration-after-statement
4912 @opindex Wno-declaration-after-statement
4913 Warn when a declaration is found after a statement in a block. This
4914 construct, known from C++, was introduced with ISO C99 and is by default
4915 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
4916
4917 @item -Wundef
4918 @opindex Wundef
4919 @opindex Wno-undef
4920 Warn if an undefined identifier is evaluated in an @code{#if} directive.
4921
4922 @item -Wno-endif-labels
4923 @opindex Wno-endif-labels
4924 @opindex Wendif-labels
4925 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
4926
4927 @item -Wshadow
4928 @opindex Wshadow
4929 @opindex Wno-shadow
4930 Warn whenever a local variable or type declaration shadows another
4931 variable, parameter, type, class member (in C++), or instance variable
4932 (in Objective-C) or whenever a built-in function is shadowed. Note
4933 that in C++, the compiler warns if a local variable shadows an
4934 explicit typedef, but not if it shadows a struct/class/enum.
4935
4936 @item -Wno-shadow-ivar @r{(Objective-C only)}
4937 @opindex Wno-shadow-ivar
4938 @opindex Wshadow-ivar
4939 Do not warn whenever a local variable shadows an instance variable in an
4940 Objective-C method.
4941
4942 @item -Wlarger-than=@var{len}
4943 @opindex Wlarger-than=@var{len}
4944 @opindex Wlarger-than-@var{len}
4945 Warn whenever an object of larger than @var{len} bytes is defined.
4946
4947 @item -Wframe-larger-than=@var{len}
4948 @opindex Wframe-larger-than
4949 Warn if the size of a function frame is larger than @var{len} bytes.
4950 The computation done to determine the stack frame size is approximate
4951 and not conservative.
4952 The actual requirements may be somewhat greater than @var{len}
4953 even if you do not get a warning. In addition, any space allocated
4954 via @code{alloca}, variable-length arrays, or related constructs
4955 is not included by the compiler when determining
4956 whether or not to issue a warning.
4957
4958 @item -Wno-free-nonheap-object
4959 @opindex Wno-free-nonheap-object
4960 @opindex Wfree-nonheap-object
4961 Do not warn when attempting to free an object that was not allocated
4962 on the heap.
4963
4964 @item -Wstack-usage=@var{len}
4965 @opindex Wstack-usage
4966 Warn if the stack usage of a function might be larger than @var{len} bytes.
4967 The computation done to determine the stack usage is conservative.
4968 Any space allocated via @code{alloca}, variable-length arrays, or related
4969 constructs is included by the compiler when determining whether or not to
4970 issue a warning.
4971
4972 The message is in keeping with the output of @option{-fstack-usage}.
4973
4974 @itemize
4975 @item
4976 If the stack usage is fully static but exceeds the specified amount, it's:
4977
4978 @smallexample
4979 warning: stack usage is 1120 bytes
4980 @end smallexample
4981 @item
4982 If the stack usage is (partly) dynamic but bounded, it's:
4983
4984 @smallexample
4985 warning: stack usage might be 1648 bytes
4986 @end smallexample
4987 @item
4988 If the stack usage is (partly) dynamic and not bounded, it's:
4989
4990 @smallexample
4991 warning: stack usage might be unbounded
4992 @end smallexample
4993 @end itemize
4994
4995 @item -Wunsafe-loop-optimizations
4996 @opindex Wunsafe-loop-optimizations
4997 @opindex Wno-unsafe-loop-optimizations
4998 Warn if the loop cannot be optimized because the compiler cannot
4999 assume anything on the bounds of the loop indices. With
5000 @option{-funsafe-loop-optimizations} warn if the compiler makes
5001 such assumptions.
5002
5003 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
5004 @opindex Wno-pedantic-ms-format
5005 @opindex Wpedantic-ms-format
5006 When used in combination with @option{-Wformat}
5007 and @option{-pedantic} without GNU extensions, this option
5008 disables the warnings about non-ISO @code{printf} / @code{scanf} format
5009 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
5010 which depend on the MS runtime.
5011
5012 @item -Wplacement-new
5013 @itemx -Wplacement-new=@var{n}
5014 @opindex Wplacement-new
5015 @opindex Wno-placement-new
5016 Warn about placement new expressions with undefined behavior, such as
5017 constructing an object in a buffer that is smaller than the type of
5018 the object. For example, the placement new expression below is diagnosed
5019 because it attempts to construct an array of 64 integers in a buffer only
5020 64 bytes large.
5021 @smallexample
5022 char buf [64];
5023 new (buf) int[64];
5024 @end smallexample
5025 This warning is enabled by default.
5026
5027 @table @gcctabopt
5028 @item -Wplacement-new=1
5029 This is the default warning level of @option{-Wplacement-new}. At this
5030 level the warning is not issued for some strictly undefined constructs that
5031 GCC allows as extensions for compatibility with legacy code. For example,
5032 the following @code{new} expression is not diagnosed at this level even
5033 though it has undefined behavior according to the C++ standard because
5034 it writes past the end of the one-element array.
5035 @smallexample
5036 struct S @{ int n, a[1]; @};
5037 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5038 new (s->a)int [32]();
5039 @end smallexample
5040
5041 @item -Wplacement-new=2
5042 At this level, in addition to diagnosing all the same constructs as at level
5043 1, a diagnostic is also issued for placement new expressions that construct
5044 an object in the last member of structure whose type is an array of a single
5045 element and whose size is less than the size of the object being constructed.
5046 While the previous example would be diagnosed, the following construct makes
5047 use of the flexible member array extension to avoid the warning at level 2.
5048 @smallexample
5049 struct S @{ int n, a[]; @};
5050 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5051 new (s->a)int [32]();
5052 @end smallexample
5053
5054 @end table
5055
5056 @item -Wpointer-arith
5057 @opindex Wpointer-arith
5058 @opindex Wno-pointer-arith
5059 Warn about anything that depends on the ``size of'' a function type or
5060 of @code{void}. GNU C assigns these types a size of 1, for
5061 convenience in calculations with @code{void *} pointers and pointers
5062 to functions. In C++, warn also when an arithmetic operation involves
5063 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
5064
5065 @item -Wtype-limits
5066 @opindex Wtype-limits
5067 @opindex Wno-type-limits
5068 Warn if a comparison is always true or always false due to the limited
5069 range of the data type, but do not warn for constant expressions. For
5070 example, warn if an unsigned variable is compared against zero with
5071 @code{<} or @code{>=}. This warning is also enabled by
5072 @option{-Wextra}.
5073
5074 @item -Wbad-function-cast @r{(C and Objective-C only)}
5075 @opindex Wbad-function-cast
5076 @opindex Wno-bad-function-cast
5077 Warn when a function call is cast to a non-matching type.
5078 For example, warn if a call to a function returning an integer type
5079 is cast to a pointer type.
5080
5081 @item -Wc90-c99-compat @r{(C and Objective-C only)}
5082 @opindex Wc90-c99-compat
5083 @opindex Wno-c90-c99-compat
5084 Warn about features not present in ISO C90, but present in ISO C99.
5085 For instance, warn about use of variable length arrays, @code{long long}
5086 type, @code{bool} type, compound literals, designated initializers, and so
5087 on. This option is independent of the standards mode. Warnings are disabled
5088 in the expression that follows @code{__extension__}.
5089
5090 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5091 @opindex Wc99-c11-compat
5092 @opindex Wno-c99-c11-compat
5093 Warn about features not present in ISO C99, but present in ISO C11.
5094 For instance, warn about use of anonymous structures and unions,
5095 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5096 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5097 and so on. This option is independent of the standards mode. Warnings are
5098 disabled in the expression that follows @code{__extension__}.
5099
5100 @item -Wc++-compat @r{(C and Objective-C only)}
5101 @opindex Wc++-compat
5102 Warn about ISO C constructs that are outside of the common subset of
5103 ISO C and ISO C++, e.g.@: request for implicit conversion from
5104 @code{void *} to a pointer to non-@code{void} type.
5105
5106 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5107 @opindex Wc++11-compat
5108 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5109 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5110 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5111 enabled by @option{-Wall}.
5112
5113 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5114 @opindex Wc++14-compat
5115 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5116 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5117
5118 @item -Wcast-qual
5119 @opindex Wcast-qual
5120 @opindex Wno-cast-qual
5121 Warn whenever a pointer is cast so as to remove a type qualifier from
5122 the target type. For example, warn if a @code{const char *} is cast
5123 to an ordinary @code{char *}.
5124
5125 Also warn when making a cast that introduces a type qualifier in an
5126 unsafe way. For example, casting @code{char **} to @code{const char **}
5127 is unsafe, as in this example:
5128
5129 @smallexample
5130 /* p is char ** value. */
5131 const char **q = (const char **) p;
5132 /* Assignment of readonly string to const char * is OK. */
5133 *q = "string";
5134 /* Now char** pointer points to read-only memory. */
5135 **p = 'b';
5136 @end smallexample
5137
5138 @item -Wcast-align
5139 @opindex Wcast-align
5140 @opindex Wno-cast-align
5141 Warn whenever a pointer is cast such that the required alignment of the
5142 target is increased. For example, warn if a @code{char *} is cast to
5143 an @code{int *} on machines where integers can only be accessed at
5144 two- or four-byte boundaries.
5145
5146 @item -Wwrite-strings
5147 @opindex Wwrite-strings
5148 @opindex Wno-write-strings
5149 When compiling C, give string constants the type @code{const
5150 char[@var{length}]} so that copying the address of one into a
5151 non-@code{const} @code{char *} pointer produces a warning. These
5152 warnings help you find at compile time code that can try to write
5153 into a string constant, but only if you have been very careful about
5154 using @code{const} in declarations and prototypes. Otherwise, it is
5155 just a nuisance. This is why we did not make @option{-Wall} request
5156 these warnings.
5157
5158 When compiling C++, warn about the deprecated conversion from string
5159 literals to @code{char *}. This warning is enabled by default for C++
5160 programs.
5161
5162 @item -Wclobbered
5163 @opindex Wclobbered
5164 @opindex Wno-clobbered
5165 Warn for variables that might be changed by @code{longjmp} or
5166 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5167
5168 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5169 @opindex Wconditionally-supported
5170 @opindex Wno-conditionally-supported
5171 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5172
5173 @item -Wconversion
5174 @opindex Wconversion
5175 @opindex Wno-conversion
5176 Warn for implicit conversions that may alter a value. This includes
5177 conversions between real and integer, like @code{abs (x)} when
5178 @code{x} is @code{double}; conversions between signed and unsigned,
5179 like @code{unsigned ui = -1}; and conversions to smaller types, like
5180 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5181 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5182 changed by the conversion like in @code{abs (2.0)}. Warnings about
5183 conversions between signed and unsigned integers can be disabled by
5184 using @option{-Wno-sign-conversion}.
5185
5186 For C++, also warn for confusing overload resolution for user-defined
5187 conversions; and conversions that never use a type conversion
5188 operator: conversions to @code{void}, the same type, a base class or a
5189 reference to them. Warnings about conversions between signed and
5190 unsigned integers are disabled by default in C++ unless
5191 @option{-Wsign-conversion} is explicitly enabled.
5192
5193 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5194 @opindex Wconversion-null
5195 @opindex Wno-conversion-null
5196 Do not warn for conversions between @code{NULL} and non-pointer
5197 types. @option{-Wconversion-null} is enabled by default.
5198
5199 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5200 @opindex Wzero-as-null-pointer-constant
5201 @opindex Wno-zero-as-null-pointer-constant
5202 Warn when a literal @samp{0} is used as null pointer constant. This can
5203 be useful to facilitate the conversion to @code{nullptr} in C++11.
5204
5205 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5206 @opindex Wsubobject-linkage
5207 @opindex Wno-subobject-linkage
5208 Warn if a class type has a base or a field whose type uses the anonymous
5209 namespace or depends on a type with no linkage. If a type A depends on
5210 a type B with no or internal linkage, defining it in multiple
5211 translation units would be an ODR violation because the meaning of B
5212 is different in each translation unit. If A only appears in a single
5213 translation unit, the best way to silence the warning is to give it
5214 internal linkage by putting it in an anonymous namespace as well. The
5215 compiler doesn't give this warning for types defined in the main .C
5216 file, as those are unlikely to have multiple definitions.
5217 @option{-Wsubobject-linkage} is enabled by default.
5218
5219 @item -Wdangling-else
5220 @opindex Wdangling-else
5221 @opindex Wno-dangling-else
5222 Warn about constructions where there may be confusion to which
5223 @code{if} statement an @code{else} branch belongs. Here is an example of
5224 such a case:
5225
5226 @smallexample
5227 @group
5228 @{
5229 if (a)
5230 if (b)
5231 foo ();
5232 else
5233 bar ();
5234 @}
5235 @end group
5236 @end smallexample
5237
5238 In C/C++, every @code{else} branch belongs to the innermost possible
5239 @code{if} statement, which in this example is @code{if (b)}. This is
5240 often not what the programmer expected, as illustrated in the above
5241 example by indentation the programmer chose. When there is the
5242 potential for this confusion, GCC issues a warning when this flag
5243 is specified. To eliminate the warning, add explicit braces around
5244 the innermost @code{if} statement so there is no way the @code{else}
5245 can belong to the enclosing @code{if}. The resulting code
5246 looks like this:
5247
5248 @smallexample
5249 @group
5250 @{
5251 if (a)
5252 @{
5253 if (b)
5254 foo ();
5255 else
5256 bar ();
5257 @}
5258 @}
5259 @end group
5260 @end smallexample
5261
5262 This warning is enabled by @option{-Wparentheses}.
5263
5264 @item -Wdate-time
5265 @opindex Wdate-time
5266 @opindex Wno-date-time
5267 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5268 are encountered as they might prevent bit-wise-identical reproducible
5269 compilations.
5270
5271 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5272 @opindex Wdelete-incomplete
5273 @opindex Wno-delete-incomplete
5274 Warn when deleting a pointer to incomplete type, which may cause
5275 undefined behavior at runtime. This warning is enabled by default.
5276
5277 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5278 @opindex Wuseless-cast
5279 @opindex Wno-useless-cast
5280 Warn when an expression is casted to its own type.
5281
5282 @item -Wempty-body
5283 @opindex Wempty-body
5284 @opindex Wno-empty-body
5285 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5286 while} statement. This warning is also enabled by @option{-Wextra}.
5287
5288 @item -Wenum-compare
5289 @opindex Wenum-compare
5290 @opindex Wno-enum-compare
5291 Warn about a comparison between values of different enumerated types.
5292 In C++ enumeral mismatches in conditional expressions are also
5293 diagnosed and the warning is enabled by default. In C this warning is
5294 enabled by @option{-Wall}.
5295
5296 @item -Wjump-misses-init @r{(C, Objective-C only)}
5297 @opindex Wjump-misses-init
5298 @opindex Wno-jump-misses-init
5299 Warn if a @code{goto} statement or a @code{switch} statement jumps
5300 forward across the initialization of a variable, or jumps backward to a
5301 label after the variable has been initialized. This only warns about
5302 variables that are initialized when they are declared. This warning is
5303 only supported for C and Objective-C; in C++ this sort of branch is an
5304 error in any case.
5305
5306 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5307 can be disabled with the @option{-Wno-jump-misses-init} option.
5308
5309 @item -Wsign-compare
5310 @opindex Wsign-compare
5311 @opindex Wno-sign-compare
5312 @cindex warning for comparison of signed and unsigned values
5313 @cindex comparison of signed and unsigned values, warning
5314 @cindex signed and unsigned values, comparison warning
5315 Warn when a comparison between signed and unsigned values could produce
5316 an incorrect result when the signed value is converted to unsigned.
5317 In C++, this warning is also enabled by @option{-Wall}. In C, it is
5318 also enabled by @option{-Wextra}.
5319
5320 @item -Wsign-conversion
5321 @opindex Wsign-conversion
5322 @opindex Wno-sign-conversion
5323 Warn for implicit conversions that may change the sign of an integer
5324 value, like assigning a signed integer expression to an unsigned
5325 integer variable. An explicit cast silences the warning. In C, this
5326 option is enabled also by @option{-Wconversion}.
5327
5328 @item -Wfloat-conversion
5329 @opindex Wfloat-conversion
5330 @opindex Wno-float-conversion
5331 Warn for implicit conversions that reduce the precision of a real value.
5332 This includes conversions from real to integer, and from higher precision
5333 real to lower precision real values. This option is also enabled by
5334 @option{-Wconversion}.
5335
5336 @item -Wno-scalar-storage-order
5337 @opindex -Wno-scalar-storage-order
5338 @opindex -Wscalar-storage-order
5339 Do not warn on suspicious constructs involving reverse scalar storage order.
5340
5341 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
5342 @opindex Wsized-deallocation
5343 @opindex Wno-sized-deallocation
5344 Warn about a definition of an unsized deallocation function
5345 @smallexample
5346 void operator delete (void *) noexcept;
5347 void operator delete[] (void *) noexcept;
5348 @end smallexample
5349 without a definition of the corresponding sized deallocation function
5350 @smallexample
5351 void operator delete (void *, std::size_t) noexcept;
5352 void operator delete[] (void *, std::size_t) noexcept;
5353 @end smallexample
5354 or vice versa. Enabled by @option{-Wextra} along with
5355 @option{-fsized-deallocation}.
5356
5357 @item -Wsizeof-pointer-memaccess
5358 @opindex Wsizeof-pointer-memaccess
5359 @opindex Wno-sizeof-pointer-memaccess
5360 Warn for suspicious length parameters to certain string and memory built-in
5361 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
5362 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
5363 but a pointer, and suggests a possible fix, or about
5364 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
5365 @option{-Wall}.
5366
5367 @item -Wsizeof-array-argument
5368 @opindex Wsizeof-array-argument
5369 @opindex Wno-sizeof-array-argument
5370 Warn when the @code{sizeof} operator is applied to a parameter that is
5371 declared as an array in a function definition. This warning is enabled by
5372 default for C and C++ programs.
5373
5374 @item -Wmemset-elt-size
5375 @opindex Wmemset-elt-size
5376 @opindex Wno-memset-elt-size
5377 Warn for suspicious calls to the @code{memset} built-in function, if the
5378 first argument references an array, and the third argument is a number
5379 equal to the number of elements, but not equal to the size of the array
5380 in memory. This indicates that the user has omitted a multiplication by
5381 the element size. This warning is enabled by @option{-Wall}.
5382
5383 @item -Wmemset-transposed-args
5384 @opindex Wmemset-transposed-args
5385 @opindex Wno-memset-transposed-args
5386 Warn for suspicious calls to the @code{memset} built-in function, if the
5387 second argument is not zero and the third argument is zero. This warns e.g.@
5388 about @code{memset (buf, sizeof buf, 0)} where most probably
5389 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
5390 is only emitted if the third argument is literal zero. If it is some
5391 expression that is folded to zero, a cast of zero to some type, etc.,
5392 it is far less likely that the user has mistakenly exchanged the arguments
5393 and no warning is emitted. This warning is enabled by @option{-Wall}.
5394
5395 @item -Waddress
5396 @opindex Waddress
5397 @opindex Wno-address
5398 Warn about suspicious uses of memory addresses. These include using
5399 the address of a function in a conditional expression, such as
5400 @code{void func(void); if (func)}, and comparisons against the memory
5401 address of a string literal, such as @code{if (x == "abc")}. Such
5402 uses typically indicate a programmer error: the address of a function
5403 always evaluates to true, so their use in a conditional usually
5404 indicate that the programmer forgot the parentheses in a function
5405 call; and comparisons against string literals result in unspecified
5406 behavior and are not portable in C, so they usually indicate that the
5407 programmer intended to use @code{strcmp}. This warning is enabled by
5408 @option{-Wall}.
5409
5410 @item -Wlogical-op
5411 @opindex Wlogical-op
5412 @opindex Wno-logical-op
5413 Warn about suspicious uses of logical operators in expressions.
5414 This includes using logical operators in contexts where a
5415 bit-wise operator is likely to be expected. Also warns when
5416 the operands of a logical operator are the same:
5417 @smallexample
5418 extern int a;
5419 if (a < 0 && a < 0) @{ @dots{} @}
5420 @end smallexample
5421
5422 @item -Wlogical-not-parentheses
5423 @opindex Wlogical-not-parentheses
5424 @opindex Wno-logical-not-parentheses
5425 Warn about logical not used on the left hand side operand of a comparison.
5426 This option does not warn if the RHS operand is of a boolean type. Its
5427 purpose is to detect suspicious code like the following:
5428 @smallexample
5429 int a;
5430 @dots{}
5431 if (!a > 1) @{ @dots{} @}
5432 @end smallexample
5433
5434 It is possible to suppress the warning by wrapping the LHS into
5435 parentheses:
5436 @smallexample
5437 if ((!a) > 1) @{ @dots{} @}
5438 @end smallexample
5439
5440 This warning is enabled by @option{-Wall}.
5441
5442 @item -Waggregate-return
5443 @opindex Waggregate-return
5444 @opindex Wno-aggregate-return
5445 Warn if any functions that return structures or unions are defined or
5446 called. (In languages where you can return an array, this also elicits
5447 a warning.)
5448
5449 @item -Wno-aggressive-loop-optimizations
5450 @opindex Wno-aggressive-loop-optimizations
5451 @opindex Waggressive-loop-optimizations
5452 Warn if in a loop with constant number of iterations the compiler detects
5453 undefined behavior in some statement during one or more of the iterations.
5454
5455 @item -Wno-attributes
5456 @opindex Wno-attributes
5457 @opindex Wattributes
5458 Do not warn if an unexpected @code{__attribute__} is used, such as
5459 unrecognized attributes, function attributes applied to variables,
5460 etc. This does not stop errors for incorrect use of supported
5461 attributes.
5462
5463 @item -Wno-builtin-macro-redefined
5464 @opindex Wno-builtin-macro-redefined
5465 @opindex Wbuiltin-macro-redefined
5466 Do not warn if certain built-in macros are redefined. This suppresses
5467 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
5468 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
5469
5470 @item -Wstrict-prototypes @r{(C and Objective-C only)}
5471 @opindex Wstrict-prototypes
5472 @opindex Wno-strict-prototypes
5473 Warn if a function is declared or defined without specifying the
5474 argument types. (An old-style function definition is permitted without
5475 a warning if preceded by a declaration that specifies the argument
5476 types.)
5477
5478 @item -Wold-style-declaration @r{(C and Objective-C only)}
5479 @opindex Wold-style-declaration
5480 @opindex Wno-old-style-declaration
5481 Warn for obsolescent usages, according to the C Standard, in a
5482 declaration. For example, warn if storage-class specifiers like
5483 @code{static} are not the first things in a declaration. This warning
5484 is also enabled by @option{-Wextra}.
5485
5486 @item -Wold-style-definition @r{(C and Objective-C only)}
5487 @opindex Wold-style-definition
5488 @opindex Wno-old-style-definition
5489 Warn if an old-style function definition is used. A warning is given
5490 even if there is a previous prototype.
5491
5492 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5493 @opindex Wmissing-parameter-type
5494 @opindex Wno-missing-parameter-type
5495 A function parameter is declared without a type specifier in K&R-style
5496 functions:
5497
5498 @smallexample
5499 void foo(bar) @{ @}
5500 @end smallexample
5501
5502 This warning is also enabled by @option{-Wextra}.
5503
5504 @item -Wmissing-prototypes @r{(C and Objective-C only)}
5505 @opindex Wmissing-prototypes
5506 @opindex Wno-missing-prototypes
5507 Warn if a global function is defined without a previous prototype
5508 declaration. This warning is issued even if the definition itself
5509 provides a prototype. Use this option to detect global functions
5510 that do not have a matching prototype declaration in a header file.
5511 This option is not valid for C++ because all function declarations
5512 provide prototypes and a non-matching declaration declares an
5513 overload rather than conflict with an earlier declaration.
5514 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
5515
5516 @item -Wmissing-declarations
5517 @opindex Wmissing-declarations
5518 @opindex Wno-missing-declarations
5519 Warn if a global function is defined without a previous declaration.
5520 Do so even if the definition itself provides a prototype.
5521 Use this option to detect global functions that are not declared in
5522 header files. In C, no warnings are issued for functions with previous
5523 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
5524 missing prototypes. In C++, no warnings are issued for function templates,
5525 or for inline functions, or for functions in anonymous namespaces.
5526
5527 @item -Wmissing-field-initializers
5528 @opindex Wmissing-field-initializers
5529 @opindex Wno-missing-field-initializers
5530 @opindex W
5531 @opindex Wextra
5532 @opindex Wno-extra
5533 Warn if a structure's initializer has some fields missing. For
5534 example, the following code causes such a warning, because
5535 @code{x.h} is implicitly zero:
5536
5537 @smallexample
5538 struct s @{ int f, g, h; @};
5539 struct s x = @{ 3, 4 @};
5540 @end smallexample
5541
5542 This option does not warn about designated initializers, so the following
5543 modification does not trigger a warning:
5544
5545 @smallexample
5546 struct s @{ int f, g, h; @};
5547 struct s x = @{ .f = 3, .g = 4 @};
5548 @end smallexample
5549
5550 In C++ this option does not warn either about the empty @{ @}
5551 initializer, for example:
5552
5553 @smallexample
5554 struct s @{ int f, g, h; @};
5555 s x = @{ @};
5556 @end smallexample
5557
5558 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
5559 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
5560
5561 @item -Wno-multichar
5562 @opindex Wno-multichar
5563 @opindex Wmultichar
5564 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
5565 Usually they indicate a typo in the user's code, as they have
5566 implementation-defined values, and should not be used in portable code.
5567
5568 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
5569 @opindex Wnormalized=
5570 @opindex Wnormalized
5571 @opindex Wno-normalized
5572 @cindex NFC
5573 @cindex NFKC
5574 @cindex character set, input normalization
5575 In ISO C and ISO C++, two identifiers are different if they are
5576 different sequences of characters. However, sometimes when characters
5577 outside the basic ASCII character set are used, you can have two
5578 different character sequences that look the same. To avoid confusion,
5579 the ISO 10646 standard sets out some @dfn{normalization rules} which
5580 when applied ensure that two sequences that look the same are turned into
5581 the same sequence. GCC can warn you if you are using identifiers that
5582 have not been normalized; this option controls that warning.
5583
5584 There are four levels of warning supported by GCC@. The default is
5585 @option{-Wnormalized=nfc}, which warns about any identifier that is
5586 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
5587 recommended form for most uses. It is equivalent to
5588 @option{-Wnormalized}.
5589
5590 Unfortunately, there are some characters allowed in identifiers by
5591 ISO C and ISO C++ that, when turned into NFC, are not allowed in
5592 identifiers. That is, there's no way to use these symbols in portable
5593 ISO C or C++ and have all your identifiers in NFC@.
5594 @option{-Wnormalized=id} suppresses the warning for these characters.
5595 It is hoped that future versions of the standards involved will correct
5596 this, which is why this option is not the default.
5597
5598 You can switch the warning off for all characters by writing
5599 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
5600 only do this if you are using some other normalization scheme (like
5601 ``D''), because otherwise you can easily create bugs that are
5602 literally impossible to see.
5603
5604 Some characters in ISO 10646 have distinct meanings but look identical
5605 in some fonts or display methodologies, especially once formatting has
5606 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
5607 LETTER N'', displays just like a regular @code{n} that has been
5608 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
5609 normalization scheme to convert all these into a standard form as
5610 well, and GCC warns if your code is not in NFKC if you use
5611 @option{-Wnormalized=nfkc}. This warning is comparable to warning
5612 about every identifier that contains the letter O because it might be
5613 confused with the digit 0, and so is not the default, but may be
5614 useful as a local coding convention if the programming environment
5615 cannot be fixed to display these characters distinctly.
5616
5617 @item -Wno-deprecated
5618 @opindex Wno-deprecated
5619 @opindex Wdeprecated
5620 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
5621
5622 @item -Wno-deprecated-declarations
5623 @opindex Wno-deprecated-declarations
5624 @opindex Wdeprecated-declarations
5625 Do not warn about uses of functions (@pxref{Function Attributes}),
5626 variables (@pxref{Variable Attributes}), and types (@pxref{Type
5627 Attributes}) marked as deprecated by using the @code{deprecated}
5628 attribute.
5629
5630 @item -Wno-overflow
5631 @opindex Wno-overflow
5632 @opindex Woverflow
5633 Do not warn about compile-time overflow in constant expressions.
5634
5635 @item -Wno-odr
5636 @opindex Wno-odr
5637 @opindex Wodr
5638 Warn about One Definition Rule violations during link-time optimization.
5639 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
5640
5641 @item -Wopenmp-simd
5642 @opindex Wopenm-simd
5643 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
5644 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
5645 option can be used to relax the cost model.
5646
5647 @item -Woverride-init @r{(C and Objective-C only)}
5648 @opindex Woverride-init
5649 @opindex Wno-override-init
5650 @opindex W
5651 @opindex Wextra
5652 @opindex Wno-extra
5653 Warn if an initialized field without side effects is overridden when
5654 using designated initializers (@pxref{Designated Inits, , Designated
5655 Initializers}).
5656
5657 This warning is included in @option{-Wextra}. To get other
5658 @option{-Wextra} warnings without this one, use @option{-Wextra
5659 -Wno-override-init}.
5660
5661 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
5662 @opindex Woverride-init-side-effects
5663 @opindex Wno-override-init-side-effects
5664 Warn if an initialized field with side effects is overridden when
5665 using designated initializers (@pxref{Designated Inits, , Designated
5666 Initializers}). This warning is enabled by default.
5667
5668 @item -Wpacked
5669 @opindex Wpacked
5670 @opindex Wno-packed
5671 Warn if a structure is given the packed attribute, but the packed
5672 attribute has no effect on the layout or size of the structure.
5673 Such structures may be mis-aligned for little benefit. For
5674 instance, in this code, the variable @code{f.x} in @code{struct bar}
5675 is misaligned even though @code{struct bar} does not itself
5676 have the packed attribute:
5677
5678 @smallexample
5679 @group
5680 struct foo @{
5681 int x;
5682 char a, b, c, d;
5683 @} __attribute__((packed));
5684 struct bar @{
5685 char z;
5686 struct foo f;
5687 @};
5688 @end group
5689 @end smallexample
5690
5691 @item -Wpacked-bitfield-compat
5692 @opindex Wpacked-bitfield-compat
5693 @opindex Wno-packed-bitfield-compat
5694 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
5695 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
5696 the change can lead to differences in the structure layout. GCC
5697 informs you when the offset of such a field has changed in GCC 4.4.
5698 For example there is no longer a 4-bit padding between field @code{a}
5699 and @code{b} in this structure:
5700
5701 @smallexample
5702 struct foo
5703 @{
5704 char a:4;
5705 char b:8;
5706 @} __attribute__ ((packed));
5707 @end smallexample
5708
5709 This warning is enabled by default. Use
5710 @option{-Wno-packed-bitfield-compat} to disable this warning.
5711
5712 @item -Wpadded
5713 @opindex Wpadded
5714 @opindex Wno-padded
5715 Warn if padding is included in a structure, either to align an element
5716 of the structure or to align the whole structure. Sometimes when this
5717 happens it is possible to rearrange the fields of the structure to
5718 reduce the padding and so make the structure smaller.
5719
5720 @item -Wredundant-decls
5721 @opindex Wredundant-decls
5722 @opindex Wno-redundant-decls
5723 Warn if anything is declared more than once in the same scope, even in
5724 cases where multiple declaration is valid and changes nothing.
5725
5726 @item -Wnested-externs @r{(C and Objective-C only)}
5727 @opindex Wnested-externs
5728 @opindex Wno-nested-externs
5729 Warn if an @code{extern} declaration is encountered within a function.
5730
5731 @item -Wno-inherited-variadic-ctor
5732 @opindex Winherited-variadic-ctor
5733 @opindex Wno-inherited-variadic-ctor
5734 Suppress warnings about use of C++11 inheriting constructors when the
5735 base class inherited from has a C variadic constructor; the warning is
5736 on by default because the ellipsis is not inherited.
5737
5738 @item -Winline
5739 @opindex Winline
5740 @opindex Wno-inline
5741 Warn if a function that is declared as inline cannot be inlined.
5742 Even with this option, the compiler does not warn about failures to
5743 inline functions declared in system headers.
5744
5745 The compiler uses a variety of heuristics to determine whether or not
5746 to inline a function. For example, the compiler takes into account
5747 the size of the function being inlined and the amount of inlining
5748 that has already been done in the current function. Therefore,
5749 seemingly insignificant changes in the source program can cause the
5750 warnings produced by @option{-Winline} to appear or disappear.
5751
5752 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
5753 @opindex Wno-invalid-offsetof
5754 @opindex Winvalid-offsetof
5755 Suppress warnings from applying the @code{offsetof} macro to a non-POD
5756 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
5757 to a non-standard-layout type is undefined. In existing C++ implementations,
5758 however, @code{offsetof} typically gives meaningful results.
5759 This flag is for users who are aware that they are
5760 writing nonportable code and who have deliberately chosen to ignore the
5761 warning about it.
5762
5763 The restrictions on @code{offsetof} may be relaxed in a future version
5764 of the C++ standard.
5765
5766 @item -Wno-int-to-pointer-cast
5767 @opindex Wno-int-to-pointer-cast
5768 @opindex Wint-to-pointer-cast
5769 Suppress warnings from casts to pointer type of an integer of a
5770 different size. In C++, casting to a pointer type of smaller size is
5771 an error. @option{Wint-to-pointer-cast} is enabled by default.
5772
5773
5774 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
5775 @opindex Wno-pointer-to-int-cast
5776 @opindex Wpointer-to-int-cast
5777 Suppress warnings from casts from a pointer to an integer type of a
5778 different size.
5779
5780 @item -Winvalid-pch
5781 @opindex Winvalid-pch
5782 @opindex Wno-invalid-pch
5783 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
5784 the search path but can't be used.
5785
5786 @item -Wlong-long
5787 @opindex Wlong-long
5788 @opindex Wno-long-long
5789 Warn if @code{long long} type is used. This is enabled by either
5790 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
5791 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
5792
5793 @item -Wvariadic-macros
5794 @opindex Wvariadic-macros
5795 @opindex Wno-variadic-macros
5796 Warn if variadic macros are used in ISO C90 mode, or if the GNU
5797 alternate syntax is used in ISO C99 mode. This is enabled by either
5798 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
5799 messages, use @option{-Wno-variadic-macros}.
5800
5801 @item -Wvarargs
5802 @opindex Wvarargs
5803 @opindex Wno-varargs
5804 Warn upon questionable usage of the macros used to handle variable
5805 arguments like @code{va_start}. This is default. To inhibit the
5806 warning messages, use @option{-Wno-varargs}.
5807
5808 @item -Wvector-operation-performance
5809 @opindex Wvector-operation-performance
5810 @opindex Wno-vector-operation-performance
5811 Warn if vector operation is not implemented via SIMD capabilities of the
5812 architecture. Mainly useful for the performance tuning.
5813 Vector operation can be implemented @code{piecewise}, which means that the
5814 scalar operation is performed on every vector element;
5815 @code{in parallel}, which means that the vector operation is implemented
5816 using scalars of wider type, which normally is more performance efficient;
5817 and @code{as a single scalar}, which means that vector fits into a
5818 scalar type.
5819
5820 @item -Wno-virtual-move-assign
5821 @opindex Wvirtual-move-assign
5822 @opindex Wno-virtual-move-assign
5823 Suppress warnings about inheriting from a virtual base with a
5824 non-trivial C++11 move assignment operator. This is dangerous because
5825 if the virtual base is reachable along more than one path, it is
5826 moved multiple times, which can mean both objects end up in the
5827 moved-from state. If the move assignment operator is written to avoid
5828 moving from a moved-from object, this warning can be disabled.
5829
5830 @item -Wvla
5831 @opindex Wvla
5832 @opindex Wno-vla
5833 Warn if variable length array is used in the code.
5834 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
5835 the variable length array.
5836
5837 @item -Wvolatile-register-var
5838 @opindex Wvolatile-register-var
5839 @opindex Wno-volatile-register-var
5840 Warn if a register variable is declared volatile. The volatile
5841 modifier does not inhibit all optimizations that may eliminate reads
5842 and/or writes to register variables. This warning is enabled by
5843 @option{-Wall}.
5844
5845 @item -Wdisabled-optimization
5846 @opindex Wdisabled-optimization
5847 @opindex Wno-disabled-optimization
5848 Warn if a requested optimization pass is disabled. This warning does
5849 not generally indicate that there is anything wrong with your code; it
5850 merely indicates that GCC's optimizers are unable to handle the code
5851 effectively. Often, the problem is that your code is too big or too
5852 complex; GCC refuses to optimize programs when the optimization
5853 itself is likely to take inordinate amounts of time.
5854
5855 @item -Wpointer-sign @r{(C and Objective-C only)}
5856 @opindex Wpointer-sign
5857 @opindex Wno-pointer-sign
5858 Warn for pointer argument passing or assignment with different signedness.
5859 This option is only supported for C and Objective-C@. It is implied by
5860 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
5861 @option{-Wno-pointer-sign}.
5862
5863 @item -Wstack-protector
5864 @opindex Wstack-protector
5865 @opindex Wno-stack-protector
5866 This option is only active when @option{-fstack-protector} is active. It
5867 warns about functions that are not protected against stack smashing.
5868
5869 @item -Woverlength-strings
5870 @opindex Woverlength-strings
5871 @opindex Wno-overlength-strings
5872 Warn about string constants that are longer than the ``minimum
5873 maximum'' length specified in the C standard. Modern compilers
5874 generally allow string constants that are much longer than the
5875 standard's minimum limit, but very portable programs should avoid
5876 using longer strings.
5877
5878 The limit applies @emph{after} string constant concatenation, and does
5879 not count the trailing NUL@. In C90, the limit was 509 characters; in
5880 C99, it was raised to 4095. C++98 does not specify a normative
5881 minimum maximum, so we do not diagnose overlength strings in C++@.
5882
5883 This option is implied by @option{-Wpedantic}, and can be disabled with
5884 @option{-Wno-overlength-strings}.
5885
5886 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
5887 @opindex Wunsuffixed-float-constants
5888
5889 Issue a warning for any floating constant that does not have
5890 a suffix. When used together with @option{-Wsystem-headers} it
5891 warns about such constants in system header files. This can be useful
5892 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
5893 from the decimal floating-point extension to C99.
5894
5895 @item -Wno-designated-init @r{(C and Objective-C only)}
5896 Suppress warnings when a positional initializer is used to initialize
5897 a structure that has been marked with the @code{designated_init}
5898 attribute.
5899
5900 @item -Whsa
5901 Issue a warning when HSAIL cannot be emitted for the compiled function or
5902 OpenMP construct.
5903
5904 @end table
5905
5906 @node Debugging Options
5907 @section Options for Debugging Your Program
5908 @cindex options, debugging
5909 @cindex debugging information options
5910
5911 To tell GCC to emit extra information for use by a debugger, in almost
5912 all cases you need only to add @option{-g} to your other options.
5913
5914 GCC allows you to use @option{-g} with
5915 @option{-O}. The shortcuts taken by optimized code may occasionally
5916 be surprising: some variables you declared may not exist
5917 at all; flow of control may briefly move where you did not expect it;
5918 some statements may not be executed because they compute constant
5919 results or their values are already at hand; some statements may
5920 execute in different places because they have been moved out of loops.
5921 Nevertheless it is possible to debug optimized output. This makes
5922 it reasonable to use the optimizer for programs that might have bugs.
5923
5924 If you are not using some other optimization option, consider
5925 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
5926 With no @option{-O} option at all, some compiler passes that collect
5927 information useful for debugging do not run at all, so that
5928 @option{-Og} may result in a better debugging experience.
5929
5930 @table @gcctabopt
5931 @item -g
5932 @opindex g
5933 Produce debugging information in the operating system's native format
5934 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
5935 information.
5936
5937 On most systems that use stabs format, @option{-g} enables use of extra
5938 debugging information that only GDB can use; this extra information
5939 makes debugging work better in GDB but probably makes other debuggers
5940 crash or
5941 refuse to read the program. If you want to control for certain whether
5942 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
5943 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
5944
5945 @item -ggdb
5946 @opindex ggdb
5947 Produce debugging information for use by GDB@. This means to use the
5948 most expressive format available (DWARF, stabs, or the native format
5949 if neither of those are supported), including GDB extensions if at all
5950 possible.
5951
5952 @item -gdwarf
5953 @itemx -gdwarf-@var{version}
5954 @opindex gdwarf
5955 Produce debugging information in DWARF format (if that is supported).
5956 The value of @var{version} may be either 2, 3, 4 or 5; the default version
5957 for most targets is 4. DWARF Version 5 is only experimental.
5958
5959 Note that with DWARF Version 2, some ports require and always
5960 use some non-conflicting DWARF 3 extensions in the unwind tables.
5961
5962 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
5963 for maximum benefit.
5964
5965 GCC no longer supports DWARF Version 1, which is substantially
5966 different than Version 2 and later. For historical reasons, some
5967 other DWARF-related options (including @option{-feliminate-dwarf2-dups}
5968 and @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
5969 in their names, but apply to all currently-supported versions of DWARF.
5970
5971 @item -gstabs
5972 @opindex gstabs
5973 Produce debugging information in stabs format (if that is supported),
5974 without GDB extensions. This is the format used by DBX on most BSD
5975 systems. On MIPS, Alpha and System V Release 4 systems this option
5976 produces stabs debugging output that is not understood by DBX or SDB@.
5977 On System V Release 4 systems this option requires the GNU assembler.
5978
5979 @item -gstabs+
5980 @opindex gstabs+
5981 Produce debugging information in stabs format (if that is supported),
5982 using GNU extensions understood only by the GNU debugger (GDB)@. The
5983 use of these extensions is likely to make other debuggers crash or
5984 refuse to read the program.
5985
5986 @item -gcoff
5987 @opindex gcoff
5988 Produce debugging information in COFF format (if that is supported).
5989 This is the format used by SDB on most System V systems prior to
5990 System V Release 4.
5991
5992 @item -gxcoff
5993 @opindex gxcoff
5994 Produce debugging information in XCOFF format (if that is supported).
5995 This is the format used by the DBX debugger on IBM RS/6000 systems.
5996
5997 @item -gxcoff+
5998 @opindex gxcoff+
5999 Produce debugging information in XCOFF format (if that is supported),
6000 using GNU extensions understood only by the GNU debugger (GDB)@. The
6001 use of these extensions is likely to make other debuggers crash or
6002 refuse to read the program, and may cause assemblers other than the GNU
6003 assembler (GAS) to fail with an error.
6004
6005 @item -gvms
6006 @opindex gvms
6007 Produce debugging information in Alpha/VMS debug format (if that is
6008 supported). This is the format used by DEBUG on Alpha/VMS systems.
6009
6010 @item -g@var{level}
6011 @itemx -ggdb@var{level}
6012 @itemx -gstabs@var{level}
6013 @itemx -gcoff@var{level}
6014 @itemx -gxcoff@var{level}
6015 @itemx -gvms@var{level}
6016 Request debugging information and also use @var{level} to specify how
6017 much information. The default level is 2.
6018
6019 Level 0 produces no debug information at all. Thus, @option{-g0} negates
6020 @option{-g}.
6021
6022 Level 1 produces minimal information, enough for making backtraces in
6023 parts of the program that you don't plan to debug. This includes
6024 descriptions of functions and external variables, and line number
6025 tables, but no information about local variables.
6026
6027 Level 3 includes extra information, such as all the macro definitions
6028 present in the program. Some debuggers support macro expansion when
6029 you use @option{-g3}.
6030
6031 @option{-gdwarf} does not accept a concatenated debug level, to avoid
6032 confusion with @option{-gdwarf-@var{level}}.
6033 Instead use an additional @option{-g@var{level}} option to change the
6034 debug level for DWARF.
6035
6036 @item -feliminate-unused-debug-symbols
6037 @opindex feliminate-unused-debug-symbols
6038 Produce debugging information in stabs format (if that is supported),
6039 for only symbols that are actually used.
6040
6041 @item -femit-class-debug-always
6042 @opindex femit-class-debug-always
6043 Instead of emitting debugging information for a C++ class in only one
6044 object file, emit it in all object files using the class. This option
6045 should be used only with debuggers that are unable to handle the way GCC
6046 normally emits debugging information for classes because using this
6047 option increases the size of debugging information by as much as a
6048 factor of two.
6049
6050 @item -fno-merge-debug-strings
6051 @opindex fmerge-debug-strings
6052 @opindex fno-merge-debug-strings
6053 Direct the linker to not merge together strings in the debugging
6054 information that are identical in different object files. Merging is
6055 not supported by all assemblers or linkers. Merging decreases the size
6056 of the debug information in the output file at the cost of increasing
6057 link processing time. Merging is enabled by default.
6058
6059 @item -fdebug-prefix-map=@var{old}=@var{new}
6060 @opindex fdebug-prefix-map
6061 When compiling files in directory @file{@var{old}}, record debugging
6062 information describing them as in @file{@var{new}} instead.
6063
6064 @item -fvar-tracking
6065 @opindex fvar-tracking
6066 Run variable tracking pass. It computes where variables are stored at each
6067 position in code. Better debugging information is then generated
6068 (if the debugging information format supports this information).
6069
6070 It is enabled by default when compiling with optimization (@option{-Os},
6071 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6072 the debug info format supports it.
6073
6074 @item -fvar-tracking-assignments
6075 @opindex fvar-tracking-assignments
6076 @opindex fno-var-tracking-assignments
6077 Annotate assignments to user variables early in the compilation and
6078 attempt to carry the annotations over throughout the compilation all the
6079 way to the end, in an attempt to improve debug information while
6080 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6081
6082 It can be enabled even if var-tracking is disabled, in which case
6083 annotations are created and maintained, but discarded at the end.
6084 By default, this flag is enabled together with @option{-fvar-tracking},
6085 except when selective scheduling is enabled.
6086
6087 @item -gsplit-dwarf
6088 @opindex gsplit-dwarf
6089 Separate as much DWARF debugging information as possible into a
6090 separate output file with the extension @file{.dwo}. This option allows
6091 the build system to avoid linking files with debug information. To
6092 be useful, this option requires a debugger capable of reading @file{.dwo}
6093 files.
6094
6095 @item -gpubnames
6096 @opindex gpubnames
6097 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
6098
6099 @item -ggnu-pubnames
6100 @opindex ggnu-pubnames
6101 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
6102 suitable for conversion into a GDB@ index. This option is only useful
6103 with a linker that can produce GDB@ index version 7.
6104
6105 @item -fdebug-types-section
6106 @opindex fdebug-types-section
6107 @opindex fno-debug-types-section
6108 When using DWARF Version 4 or higher, type DIEs can be put into
6109 their own @code{.debug_types} section instead of making them part of the
6110 @code{.debug_info} section. It is more efficient to put them in a separate
6111 comdat sections since the linker can then remove duplicates.
6112 But not all DWARF consumers support @code{.debug_types} sections yet
6113 and on some objects @code{.debug_types} produces larger instead of smaller
6114 debugging information.
6115
6116 @item -grecord-gcc-switches
6117 @item -gno-record-gcc-switches
6118 @opindex grecord-gcc-switches
6119 @opindex gno-record-gcc-switches
6120 This switch causes the command-line options used to invoke the
6121 compiler that may affect code generation to be appended to the
6122 DW_AT_producer attribute in DWARF debugging information. The options
6123 are concatenated with spaces separating them from each other and from
6124 the compiler version.
6125 It is enabled by default.
6126 See also @option{-frecord-gcc-switches} for another
6127 way of storing compiler options into the object file.
6128
6129 @item -gstrict-dwarf
6130 @opindex gstrict-dwarf
6131 Disallow using extensions of later DWARF standard version than selected
6132 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
6133 DWARF extensions from later standard versions is allowed.
6134
6135 @item -gno-strict-dwarf
6136 @opindex gno-strict-dwarf
6137 Allow using extensions of later DWARF standard version than selected with
6138 @option{-gdwarf-@var{version}}.
6139
6140 @item -gz@r{[}=@var{type}@r{]}
6141 @opindex gz
6142 Produce compressed debug sections in DWARF format, if that is supported.
6143 If @var{type} is not given, the default type depends on the capabilities
6144 of the assembler and linker used. @var{type} may be one of
6145 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
6146 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
6147 compression in traditional GNU format). If the linker doesn't support
6148 writing compressed debug sections, the option is rejected. Otherwise,
6149 if the assembler does not support them, @option{-gz} is silently ignored
6150 when producing object files.
6151
6152 @item -feliminate-dwarf2-dups
6153 @opindex feliminate-dwarf2-dups
6154 Compress DWARF debugging information by eliminating duplicated
6155 information about each symbol. This option only makes sense when
6156 generating DWARF debugging information.
6157
6158 @item -femit-struct-debug-baseonly
6159 @opindex femit-struct-debug-baseonly
6160 Emit debug information for struct-like types
6161 only when the base name of the compilation source file
6162 matches the base name of file in which the struct is defined.
6163
6164 This option substantially reduces the size of debugging information,
6165 but at significant potential loss in type information to the debugger.
6166 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6167 See @option{-femit-struct-debug-detailed} for more detailed control.
6168
6169 This option works only with DWARF debug output.
6170
6171 @item -femit-struct-debug-reduced
6172 @opindex femit-struct-debug-reduced
6173 Emit debug information for struct-like types
6174 only when the base name of the compilation source file
6175 matches the base name of file in which the type is defined,
6176 unless the struct is a template or defined in a system header.
6177
6178 This option significantly reduces the size of debugging information,
6179 with some potential loss in type information to the debugger.
6180 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6181 See @option{-femit-struct-debug-detailed} for more detailed control.
6182
6183 This option works only with DWARF debug output.
6184
6185 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6186 @opindex femit-struct-debug-detailed
6187 Specify the struct-like types
6188 for which the compiler generates debug information.
6189 The intent is to reduce duplicate struct debug information
6190 between different object files within the same program.
6191
6192 This option is a detailed version of
6193 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6194 which serves for most needs.
6195
6196 A specification has the syntax@*
6197 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6198
6199 The optional first word limits the specification to
6200 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6201 A struct type is used directly when it is the type of a variable, member.
6202 Indirect uses arise through pointers to structs.
6203 That is, when use of an incomplete struct is valid, the use is indirect.
6204 An example is
6205 @samp{struct one direct; struct two * indirect;}.
6206
6207 The optional second word limits the specification to
6208 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6209 Generic structs are a bit complicated to explain.
6210 For C++, these are non-explicit specializations of template classes,
6211 or non-template classes within the above.
6212 Other programming languages have generics,
6213 but @option{-femit-struct-debug-detailed} does not yet implement them.
6214
6215 The third word specifies the source files for those
6216 structs for which the compiler should emit debug information.
6217 The values @samp{none} and @samp{any} have the normal meaning.
6218 The value @samp{base} means that
6219 the base of name of the file in which the type declaration appears
6220 must match the base of the name of the main compilation file.
6221 In practice, this means that when compiling @file{foo.c}, debug information
6222 is generated for types declared in that file and @file{foo.h},
6223 but not other header files.
6224 The value @samp{sys} means those types satisfying @samp{base}
6225 or declared in system or compiler headers.
6226
6227 You may need to experiment to determine the best settings for your application.
6228
6229 The default is @option{-femit-struct-debug-detailed=all}.
6230
6231 This option works only with DWARF debug output.
6232
6233 @item -fno-dwarf2-cfi-asm
6234 @opindex fdwarf2-cfi-asm
6235 @opindex fno-dwarf2-cfi-asm
6236 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
6237 instead of using GAS @code{.cfi_*} directives.
6238
6239 @item -fno-eliminate-unused-debug-types
6240 @opindex feliminate-unused-debug-types
6241 @opindex fno-eliminate-unused-debug-types
6242 Normally, when producing DWARF output, GCC avoids producing debug symbol
6243 output for types that are nowhere used in the source file being compiled.
6244 Sometimes it is useful to have GCC emit debugging
6245 information for all types declared in a compilation
6246 unit, regardless of whether or not they are actually used
6247 in that compilation unit, for example
6248 if, in the debugger, you want to cast a value to a type that is
6249 not actually used in your program (but is declared). More often,
6250 however, this results in a significant amount of wasted space.
6251 @end table
6252
6253 @node Optimize Options
6254 @section Options That Control Optimization
6255 @cindex optimize options
6256 @cindex options, optimization
6257
6258 These options control various sorts of optimizations.
6259
6260 Without any optimization option, the compiler's goal is to reduce the
6261 cost of compilation and to make debugging produce the expected
6262 results. Statements are independent: if you stop the program with a
6263 breakpoint between statements, you can then assign a new value to any
6264 variable or change the program counter to any other statement in the
6265 function and get exactly the results you expect from the source
6266 code.
6267
6268 Turning on optimization flags makes the compiler attempt to improve
6269 the performance and/or code size at the expense of compilation time
6270 and possibly the ability to debug the program.
6271
6272 The compiler performs optimization based on the knowledge it has of the
6273 program. Compiling multiple files at once to a single output file mode allows
6274 the compiler to use information gained from all of the files when compiling
6275 each of them.
6276
6277 Not all optimizations are controlled directly by a flag. Only
6278 optimizations that have a flag are listed in this section.
6279
6280 Most optimizations are only enabled if an @option{-O} level is set on
6281 the command line. Otherwise they are disabled, even if individual
6282 optimization flags are specified.
6283
6284 Depending on the target and how GCC was configured, a slightly different
6285 set of optimizations may be enabled at each @option{-O} level than
6286 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6287 to find out the exact set of optimizations that are enabled at each level.
6288 @xref{Overall Options}, for examples.
6289
6290 @table @gcctabopt
6291 @item -O
6292 @itemx -O1
6293 @opindex O
6294 @opindex O1
6295 Optimize. Optimizing compilation takes somewhat more time, and a lot
6296 more memory for a large function.
6297
6298 With @option{-O}, the compiler tries to reduce code size and execution
6299 time, without performing any optimizations that take a great deal of
6300 compilation time.
6301
6302 @option{-O} turns on the following optimization flags:
6303 @gccoptlist{
6304 -fauto-inc-dec @gol
6305 -fbranch-count-reg @gol
6306 -fcombine-stack-adjustments @gol
6307 -fcompare-elim @gol
6308 -fcprop-registers @gol
6309 -fdce @gol
6310 -fdefer-pop @gol
6311 -fdelayed-branch @gol
6312 -fdse @gol
6313 -fforward-propagate @gol
6314 -fguess-branch-probability @gol
6315 -fif-conversion2 @gol
6316 -fif-conversion @gol
6317 -finline-functions-called-once @gol
6318 -fipa-pure-const @gol
6319 -fipa-profile @gol
6320 -fipa-reference @gol
6321 -fmerge-constants @gol
6322 -fmove-loop-invariants @gol
6323 -freorder-blocks @gol
6324 -fshrink-wrap @gol
6325 -fsplit-wide-types @gol
6326 -fssa-backprop @gol
6327 -fssa-phiopt @gol
6328 -ftree-bit-ccp @gol
6329 -ftree-ccp @gol
6330 -ftree-ch @gol
6331 -ftree-coalesce-vars @gol
6332 -ftree-copy-prop @gol
6333 -ftree-dce @gol
6334 -ftree-dominator-opts @gol
6335 -ftree-dse @gol
6336 -ftree-forwprop @gol
6337 -ftree-fre @gol
6338 -ftree-phiprop @gol
6339 -ftree-sink @gol
6340 -ftree-slsr @gol
6341 -ftree-sra @gol
6342 -ftree-pta @gol
6343 -ftree-ter @gol
6344 -funit-at-a-time}
6345
6346 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6347 where doing so does not interfere with debugging.
6348
6349 @item -O2
6350 @opindex O2
6351 Optimize even more. GCC performs nearly all supported optimizations
6352 that do not involve a space-speed tradeoff.
6353 As compared to @option{-O}, this option increases both compilation time
6354 and the performance of the generated code.
6355
6356 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6357 also turns on the following optimization flags:
6358 @gccoptlist{-fthread-jumps @gol
6359 -falign-functions -falign-jumps @gol
6360 -falign-loops -falign-labels @gol
6361 -fcaller-saves @gol
6362 -fcrossjumping @gol
6363 -fcse-follow-jumps -fcse-skip-blocks @gol
6364 -fdelete-null-pointer-checks @gol
6365 -fdevirtualize -fdevirtualize-speculatively @gol
6366 -fexpensive-optimizations @gol
6367 -fgcse -fgcse-lm @gol
6368 -fhoist-adjacent-loads @gol
6369 -finline-small-functions @gol
6370 -findirect-inlining @gol
6371 -fipa-cp @gol
6372 -fipa-cp-alignment @gol
6373 -fipa-sra @gol
6374 -fipa-icf @gol
6375 -fisolate-erroneous-paths-dereference @gol
6376 -flra-remat @gol
6377 -foptimize-sibling-calls @gol
6378 -foptimize-strlen @gol
6379 -fpartial-inlining @gol
6380 -fpeephole2 @gol
6381 -freorder-blocks-algorithm=stc @gol
6382 -freorder-blocks-and-partition -freorder-functions @gol
6383 -frerun-cse-after-loop @gol
6384 -fsched-interblock -fsched-spec @gol
6385 -fschedule-insns -fschedule-insns2 @gol
6386 -fstrict-aliasing -fstrict-overflow @gol
6387 -ftree-builtin-call-dce @gol
6388 -ftree-switch-conversion -ftree-tail-merge @gol
6389 -fcode-hoisting @gol
6390 -ftree-pre @gol
6391 -ftree-vrp @gol
6392 -fipa-ra}
6393
6394 Please note the warning under @option{-fgcse} about
6395 invoking @option{-O2} on programs that use computed gotos.
6396
6397 @item -O3
6398 @opindex O3
6399 Optimize yet more. @option{-O3} turns on all optimizations specified
6400 by @option{-O2} and also turns on the @option{-finline-functions},
6401 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6402 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
6403 @option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
6404 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
6405 @option{-ftree-partial-pre}, @option{-fpeel-loops}
6406 and @option{-fipa-cp-clone} options.
6407
6408 @item -O0
6409 @opindex O0
6410 Reduce compilation time and make debugging produce the expected
6411 results. This is the default.
6412
6413 @item -Os
6414 @opindex Os
6415 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6416 do not typically increase code size. It also performs further
6417 optimizations designed to reduce code size.
6418
6419 @option{-Os} disables the following optimization flags:
6420 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6421 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
6422 -freorder-blocks-and-partition -fprefetch-loop-arrays}
6423
6424 @item -Ofast
6425 @opindex Ofast
6426 Disregard strict standards compliance. @option{-Ofast} enables all
6427 @option{-O3} optimizations. It also enables optimizations that are not
6428 valid for all standard-compliant programs.
6429 It turns on @option{-ffast-math} and the Fortran-specific
6430 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6431
6432 @item -Og
6433 @opindex Og
6434 Optimize debugging experience. @option{-Og} enables optimizations
6435 that do not interfere with debugging. It should be the optimization
6436 level of choice for the standard edit-compile-debug cycle, offering
6437 a reasonable level of optimization while maintaining fast compilation
6438 and a good debugging experience.
6439 @end table
6440
6441 If you use multiple @option{-O} options, with or without level numbers,
6442 the last such option is the one that is effective.
6443
6444 Options of the form @option{-f@var{flag}} specify machine-independent
6445 flags. Most flags have both positive and negative forms; the negative
6446 form of @option{-ffoo} is @option{-fno-foo}. In the table
6447 below, only one of the forms is listed---the one you typically
6448 use. You can figure out the other form by either removing @samp{no-}
6449 or adding it.
6450
6451 The following options control specific optimizations. They are either
6452 activated by @option{-O} options or are related to ones that are. You
6453 can use the following flags in the rare cases when ``fine-tuning'' of
6454 optimizations to be performed is desired.
6455
6456 @table @gcctabopt
6457 @item -fno-defer-pop
6458 @opindex fno-defer-pop
6459 Always pop the arguments to each function call as soon as that function
6460 returns. For machines that must pop arguments after a function call,
6461 the compiler normally lets arguments accumulate on the stack for several
6462 function calls and pops them all at once.
6463
6464 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6465
6466 @item -fforward-propagate
6467 @opindex fforward-propagate
6468 Perform a forward propagation pass on RTL@. The pass tries to combine two
6469 instructions and checks if the result can be simplified. If loop unrolling
6470 is active, two passes are performed and the second is scheduled after
6471 loop unrolling.
6472
6473 This option is enabled by default at optimization levels @option{-O},
6474 @option{-O2}, @option{-O3}, @option{-Os}.
6475
6476 @item -ffp-contract=@var{style}
6477 @opindex ffp-contract
6478 @option{-ffp-contract=off} disables floating-point expression contraction.
6479 @option{-ffp-contract=fast} enables floating-point expression contraction
6480 such as forming of fused multiply-add operations if the target has
6481 native support for them.
6482 @option{-ffp-contract=on} enables floating-point expression contraction
6483 if allowed by the language standard. This is currently not implemented
6484 and treated equal to @option{-ffp-contract=off}.
6485
6486 The default is @option{-ffp-contract=fast}.
6487
6488 @item -fomit-frame-pointer
6489 @opindex fomit-frame-pointer
6490 Don't keep the frame pointer in a register for functions that
6491 don't need one. This avoids the instructions to save, set up and
6492 restore frame pointers; it also makes an extra register available
6493 in many functions. @strong{It also makes debugging impossible on
6494 some machines.}
6495
6496 On some machines, such as the VAX, this flag has no effect, because
6497 the standard calling sequence automatically handles the frame pointer
6498 and nothing is saved by pretending it doesn't exist. The
6499 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6500 whether a target machine supports this flag. @xref{Registers,,Register
6501 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6502
6503 The default setting (when not optimizing for
6504 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
6505 @option{-fomit-frame-pointer}. You can configure GCC with the
6506 @option{--enable-frame-pointer} configure option to change the default.
6507
6508 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6509
6510 @item -foptimize-sibling-calls
6511 @opindex foptimize-sibling-calls
6512 Optimize sibling and tail recursive calls.
6513
6514 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6515
6516 @item -foptimize-strlen
6517 @opindex foptimize-strlen
6518 Optimize various standard C string functions (e.g. @code{strlen},
6519 @code{strchr} or @code{strcpy}) and
6520 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
6521
6522 Enabled at levels @option{-O2}, @option{-O3}.
6523
6524 @item -fno-inline
6525 @opindex fno-inline
6526 Do not expand any functions inline apart from those marked with
6527 the @code{always_inline} attribute. This is the default when not
6528 optimizing.
6529
6530 Single functions can be exempted from inlining by marking them
6531 with the @code{noinline} attribute.
6532
6533 @item -finline-small-functions
6534 @opindex finline-small-functions
6535 Integrate functions into their callers when their body is smaller than expected
6536 function call code (so overall size of program gets smaller). The compiler
6537 heuristically decides which functions are simple enough to be worth integrating
6538 in this way. This inlining applies to all functions, even those not declared
6539 inline.
6540
6541 Enabled at level @option{-O2}.
6542
6543 @item -findirect-inlining
6544 @opindex findirect-inlining
6545 Inline also indirect calls that are discovered to be known at compile
6546 time thanks to previous inlining. This option has any effect only
6547 when inlining itself is turned on by the @option{-finline-functions}
6548 or @option{-finline-small-functions} options.
6549
6550 Enabled at level @option{-O2}.
6551
6552 @item -finline-functions
6553 @opindex finline-functions
6554 Consider all functions for inlining, even if they are not declared inline.
6555 The compiler heuristically decides which functions are worth integrating
6556 in this way.
6557
6558 If all calls to a given function are integrated, and the function is
6559 declared @code{static}, then the function is normally not output as
6560 assembler code in its own right.
6561
6562 Enabled at level @option{-O3}.
6563
6564 @item -finline-functions-called-once
6565 @opindex finline-functions-called-once
6566 Consider all @code{static} functions called once for inlining into their
6567 caller even if they are not marked @code{inline}. If a call to a given
6568 function is integrated, then the function is not output as assembler code
6569 in its own right.
6570
6571 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6572
6573 @item -fearly-inlining
6574 @opindex fearly-inlining
6575 Inline functions marked by @code{always_inline} and functions whose body seems
6576 smaller than the function call overhead early before doing
6577 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
6578 makes profiling significantly cheaper and usually inlining faster on programs
6579 having large chains of nested wrapper functions.
6580
6581 Enabled by default.
6582
6583 @item -fipa-sra
6584 @opindex fipa-sra
6585 Perform interprocedural scalar replacement of aggregates, removal of
6586 unused parameters and replacement of parameters passed by reference
6587 by parameters passed by value.
6588
6589 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6590
6591 @item -finline-limit=@var{n}
6592 @opindex finline-limit
6593 By default, GCC limits the size of functions that can be inlined. This flag
6594 allows coarse control of this limit. @var{n} is the size of functions that
6595 can be inlined in number of pseudo instructions.
6596
6597 Inlining is actually controlled by a number of parameters, which may be
6598 specified individually by using @option{--param @var{name}=@var{value}}.
6599 The @option{-finline-limit=@var{n}} option sets some of these parameters
6600 as follows:
6601
6602 @table @gcctabopt
6603 @item max-inline-insns-single
6604 is set to @var{n}/2.
6605 @item max-inline-insns-auto
6606 is set to @var{n}/2.
6607 @end table
6608
6609 See below for a documentation of the individual
6610 parameters controlling inlining and for the defaults of these parameters.
6611
6612 @emph{Note:} there may be no value to @option{-finline-limit} that results
6613 in default behavior.
6614
6615 @emph{Note:} pseudo instruction represents, in this particular context, an
6616 abstract measurement of function's size. In no way does it represent a count
6617 of assembly instructions and as such its exact meaning might change from one
6618 release to an another.
6619
6620 @item -fno-keep-inline-dllexport
6621 @opindex fno-keep-inline-dllexport
6622 This is a more fine-grained version of @option{-fkeep-inline-functions},
6623 which applies only to functions that are declared using the @code{dllexport}
6624 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6625 Functions}.)
6626
6627 @item -fkeep-inline-functions
6628 @opindex fkeep-inline-functions
6629 In C, emit @code{static} functions that are declared @code{inline}
6630 into the object file, even if the function has been inlined into all
6631 of its callers. This switch does not affect functions using the
6632 @code{extern inline} extension in GNU C90@. In C++, emit any and all
6633 inline functions into the object file.
6634
6635 @item -fkeep-static-functions
6636 @opindex fkeep-static-functions
6637 Emit @code{static} functions into the object file, even if the function
6638 is never used.
6639
6640 @item -fkeep-static-consts
6641 @opindex fkeep-static-consts
6642 Emit variables declared @code{static const} when optimization isn't turned
6643 on, even if the variables aren't referenced.
6644
6645 GCC enables this option by default. If you want to force the compiler to
6646 check if a variable is referenced, regardless of whether or not
6647 optimization is turned on, use the @option{-fno-keep-static-consts} option.
6648
6649 @item -fmerge-constants
6650 @opindex fmerge-constants
6651 Attempt to merge identical constants (string constants and floating-point
6652 constants) across compilation units.
6653
6654 This option is the default for optimized compilation if the assembler and
6655 linker support it. Use @option{-fno-merge-constants} to inhibit this
6656 behavior.
6657
6658 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6659
6660 @item -fmerge-all-constants
6661 @opindex fmerge-all-constants
6662 Attempt to merge identical constants and identical variables.
6663
6664 This option implies @option{-fmerge-constants}. In addition to
6665 @option{-fmerge-constants} this considers e.g.@: even constant initialized
6666 arrays or initialized constant variables with integral or floating-point
6667 types. Languages like C or C++ require each variable, including multiple
6668 instances of the same variable in recursive calls, to have distinct locations,
6669 so using this option results in non-conforming
6670 behavior.
6671
6672 @item -fmodulo-sched
6673 @opindex fmodulo-sched
6674 Perform swing modulo scheduling immediately before the first scheduling
6675 pass. This pass looks at innermost loops and reorders their
6676 instructions by overlapping different iterations.
6677
6678 @item -fmodulo-sched-allow-regmoves
6679 @opindex fmodulo-sched-allow-regmoves
6680 Perform more aggressive SMS-based modulo scheduling with register moves
6681 allowed. By setting this flag certain anti-dependences edges are
6682 deleted, which triggers the generation of reg-moves based on the
6683 life-range analysis. This option is effective only with
6684 @option{-fmodulo-sched} enabled.
6685
6686 @item -fno-branch-count-reg
6687 @opindex fno-branch-count-reg
6688 Avoid running a pass scanning for opportunities to use ``decrement and
6689 branch'' instructions on a count register instead of generating sequences
6690 of instructions that decrement a register, compare it against zero, and
6691 then branch based upon the result. This option is only meaningful on
6692 architectures that support such instructions, which include x86, PowerPC,
6693 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
6694 doesn't remove the decrement and branch instructions from the generated
6695 instruction stream introduced by other optimization passes.
6696
6697 Enabled by default at @option{-O1} and higher.
6698
6699 The default is @option{-fbranch-count-reg}.
6700
6701 @item -fno-function-cse
6702 @opindex fno-function-cse
6703 Do not put function addresses in registers; make each instruction that
6704 calls a constant function contain the function's address explicitly.
6705
6706 This option results in less efficient code, but some strange hacks
6707 that alter the assembler output may be confused by the optimizations
6708 performed when this option is not used.
6709
6710 The default is @option{-ffunction-cse}
6711
6712 @item -fno-zero-initialized-in-bss
6713 @opindex fno-zero-initialized-in-bss
6714 If the target supports a BSS section, GCC by default puts variables that
6715 are initialized to zero into BSS@. This can save space in the resulting
6716 code.
6717
6718 This option turns off this behavior because some programs explicitly
6719 rely on variables going to the data section---e.g., so that the
6720 resulting executable can find the beginning of that section and/or make
6721 assumptions based on that.
6722
6723 The default is @option{-fzero-initialized-in-bss}.
6724
6725 @item -fthread-jumps
6726 @opindex fthread-jumps
6727 Perform optimizations that check to see if a jump branches to a
6728 location where another comparison subsumed by the first is found. If
6729 so, the first branch is redirected to either the destination of the
6730 second branch or a point immediately following it, depending on whether
6731 the condition is known to be true or false.
6732
6733 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6734
6735 @item -fsplit-wide-types
6736 @opindex fsplit-wide-types
6737 When using a type that occupies multiple registers, such as @code{long
6738 long} on a 32-bit system, split the registers apart and allocate them
6739 independently. This normally generates better code for those types,
6740 but may make debugging more difficult.
6741
6742 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6743 @option{-Os}.
6744
6745 @item -fcse-follow-jumps
6746 @opindex fcse-follow-jumps
6747 In common subexpression elimination (CSE), scan through jump instructions
6748 when the target of the jump is not reached by any other path. For
6749 example, when CSE encounters an @code{if} statement with an
6750 @code{else} clause, CSE follows the jump when the condition
6751 tested is false.
6752
6753 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6754
6755 @item -fcse-skip-blocks
6756 @opindex fcse-skip-blocks
6757 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6758 follow jumps that conditionally skip over blocks. When CSE
6759 encounters a simple @code{if} statement with no else clause,
6760 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
6761 body of the @code{if}.
6762
6763 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6764
6765 @item -frerun-cse-after-loop
6766 @opindex frerun-cse-after-loop
6767 Re-run common subexpression elimination after loop optimizations are
6768 performed.
6769
6770 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6771
6772 @item -fgcse
6773 @opindex fgcse
6774 Perform a global common subexpression elimination pass.
6775 This pass also performs global constant and copy propagation.
6776
6777 @emph{Note:} When compiling a program using computed gotos, a GCC
6778 extension, you may get better run-time performance if you disable
6779 the global common subexpression elimination pass by adding
6780 @option{-fno-gcse} to the command line.
6781
6782 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6783
6784 @item -fgcse-lm
6785 @opindex fgcse-lm
6786 When @option{-fgcse-lm} is enabled, global common subexpression elimination
6787 attempts to move loads that are only killed by stores into themselves. This
6788 allows a loop containing a load/store sequence to be changed to a load outside
6789 the loop, and a copy/store within the loop.
6790
6791 Enabled by default when @option{-fgcse} is enabled.
6792
6793 @item -fgcse-sm
6794 @opindex fgcse-sm
6795 When @option{-fgcse-sm} is enabled, a store motion pass is run after
6796 global common subexpression elimination. This pass attempts to move
6797 stores out of loops. When used in conjunction with @option{-fgcse-lm},
6798 loops containing a load/store sequence can be changed to a load before
6799 the loop and a store after the loop.
6800
6801 Not enabled at any optimization level.
6802
6803 @item -fgcse-las
6804 @opindex fgcse-las
6805 When @option{-fgcse-las} is enabled, the global common subexpression
6806 elimination pass eliminates redundant loads that come after stores to the
6807 same memory location (both partial and full redundancies).
6808
6809 Not enabled at any optimization level.
6810
6811 @item -fgcse-after-reload
6812 @opindex fgcse-after-reload
6813 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6814 pass is performed after reload. The purpose of this pass is to clean up
6815 redundant spilling.
6816
6817 @item -faggressive-loop-optimizations
6818 @opindex faggressive-loop-optimizations
6819 This option tells the loop optimizer to use language constraints to
6820 derive bounds for the number of iterations of a loop. This assumes that
6821 loop code does not invoke undefined behavior by for example causing signed
6822 integer overflows or out-of-bound array accesses. The bounds for the
6823 number of iterations of a loop are used to guide loop unrolling and peeling
6824 and loop exit test optimizations.
6825 This option is enabled by default.
6826
6827 @item -funconstrained-commons
6828 @opindex funconstrained-commons
6829 This option tells the compiler that variables declared in common blocks
6830 (e.g. Fortran) may later be overridden with longer trailing arrays. This
6831 prevents certain optimizations that depend on knowing the array bounds.
6832
6833 @item -fcrossjumping
6834 @opindex fcrossjumping
6835 Perform cross-jumping transformation.
6836 This transformation unifies equivalent code and saves code size. The
6837 resulting code may or may not perform better than without cross-jumping.
6838
6839 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6840
6841 @item -fauto-inc-dec
6842 @opindex fauto-inc-dec
6843 Combine increments or decrements of addresses with memory accesses.
6844 This pass is always skipped on architectures that do not have
6845 instructions to support this. Enabled by default at @option{-O} and
6846 higher on architectures that support this.
6847
6848 @item -fdce
6849 @opindex fdce
6850 Perform dead code elimination (DCE) on RTL@.
6851 Enabled by default at @option{-O} and higher.
6852
6853 @item -fdse
6854 @opindex fdse
6855 Perform dead store elimination (DSE) on RTL@.
6856 Enabled by default at @option{-O} and higher.
6857
6858 @item -fif-conversion
6859 @opindex fif-conversion
6860 Attempt to transform conditional jumps into branch-less equivalents. This
6861 includes use of conditional moves, min, max, set flags and abs instructions, and
6862 some tricks doable by standard arithmetics. The use of conditional execution
6863 on chips where it is available is controlled by @option{-fif-conversion2}.
6864
6865 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6866
6867 @item -fif-conversion2
6868 @opindex fif-conversion2
6869 Use conditional execution (where available) to transform conditional jumps into
6870 branch-less equivalents.
6871
6872 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6873
6874 @item -fdeclone-ctor-dtor
6875 @opindex fdeclone-ctor-dtor
6876 The C++ ABI requires multiple entry points for constructors and
6877 destructors: one for a base subobject, one for a complete object, and
6878 one for a virtual destructor that calls operator delete afterwards.
6879 For a hierarchy with virtual bases, the base and complete variants are
6880 clones, which means two copies of the function. With this option, the
6881 base and complete variants are changed to be thunks that call a common
6882 implementation.
6883
6884 Enabled by @option{-Os}.
6885
6886 @item -fdelete-null-pointer-checks
6887 @opindex fdelete-null-pointer-checks
6888 Assume that programs cannot safely dereference null pointers, and that
6889 no code or data element resides at address zero.
6890 This option enables simple constant
6891 folding optimizations at all optimization levels. In addition, other
6892 optimization passes in GCC use this flag to control global dataflow
6893 analyses that eliminate useless checks for null pointers; these assume
6894 that a memory access to address zero always results in a trap, so
6895 that if a pointer is checked after it has already been dereferenced,
6896 it cannot be null.
6897
6898 Note however that in some environments this assumption is not true.
6899 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
6900 for programs that depend on that behavior.
6901
6902 This option is enabled by default on most targets. On Nios II ELF, it
6903 defaults to off. On AVR and CR16, this option is completely disabled.
6904
6905 Passes that use the dataflow information
6906 are enabled independently at different optimization levels.
6907
6908 @item -fdevirtualize
6909 @opindex fdevirtualize
6910 Attempt to convert calls to virtual functions to direct calls. This
6911 is done both within a procedure and interprocedurally as part of
6912 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
6913 propagation (@option{-fipa-cp}).
6914 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6915
6916 @item -fdevirtualize-speculatively
6917 @opindex fdevirtualize-speculatively
6918 Attempt to convert calls to virtual functions to speculative direct calls.
6919 Based on the analysis of the type inheritance graph, determine for a given call
6920 the set of likely targets. If the set is small, preferably of size 1, change
6921 the call into a conditional deciding between direct and indirect calls. The
6922 speculative calls enable more optimizations, such as inlining. When they seem
6923 useless after further optimization, they are converted back into original form.
6924
6925 @item -fdevirtualize-at-ltrans
6926 @opindex fdevirtualize-at-ltrans
6927 Stream extra information needed for aggressive devirtualization when running
6928 the link-time optimizer in local transformation mode.
6929 This option enables more devirtualization but
6930 significantly increases the size of streamed data. For this reason it is
6931 disabled by default.
6932
6933 @item -fexpensive-optimizations
6934 @opindex fexpensive-optimizations
6935 Perform a number of minor optimizations that are relatively expensive.
6936
6937 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6938
6939 @item -free
6940 @opindex free
6941 Attempt to remove redundant extension instructions. This is especially
6942 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
6943 registers after writing to their lower 32-bit half.
6944
6945 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
6946 @option{-O3}, @option{-Os}.
6947
6948 @item -fno-lifetime-dse
6949 @opindex fno-lifetime-dse
6950 In C++ the value of an object is only affected by changes within its
6951 lifetime: when the constructor begins, the object has an indeterminate
6952 value, and any changes during the lifetime of the object are dead when
6953 the object is destroyed. Normally dead store elimination will take
6954 advantage of this; if your code relies on the value of the object
6955 storage persisting beyond the lifetime of the object, you can use this
6956 flag to disable this optimization. To preserve stores before the
6957 constructor starts (e.g. because your operator new clears the object
6958 storage) but still treat the object as dead after the destructor you,
6959 can use @option{-flifetime-dse=1}. The default behavior can be
6960 explicitly selected with @option{-flifetime-dse=2}.
6961 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
6962
6963 @item -flive-range-shrinkage
6964 @opindex flive-range-shrinkage
6965 Attempt to decrease register pressure through register live range
6966 shrinkage. This is helpful for fast processors with small or moderate
6967 size register sets.
6968
6969 @item -fira-algorithm=@var{algorithm}
6970 @opindex fira-algorithm
6971 Use the specified coloring algorithm for the integrated register
6972 allocator. The @var{algorithm} argument can be @samp{priority}, which
6973 specifies Chow's priority coloring, or @samp{CB}, which specifies
6974 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
6975 for all architectures, but for those targets that do support it, it is
6976 the default because it generates better code.
6977
6978 @item -fira-region=@var{region}
6979 @opindex fira-region
6980 Use specified regions for the integrated register allocator. The
6981 @var{region} argument should be one of the following:
6982
6983 @table @samp
6984
6985 @item all
6986 Use all loops as register allocation regions.
6987 This can give the best results for machines with a small and/or
6988 irregular register set.
6989
6990 @item mixed
6991 Use all loops except for loops with small register pressure
6992 as the regions. This value usually gives
6993 the best results in most cases and for most architectures,
6994 and is enabled by default when compiling with optimization for speed
6995 (@option{-O}, @option{-O2}, @dots{}).
6996
6997 @item one
6998 Use all functions as a single region.
6999 This typically results in the smallest code size, and is enabled by default for
7000 @option{-Os} or @option{-O0}.
7001
7002 @end table
7003
7004 @item -fira-hoist-pressure
7005 @opindex fira-hoist-pressure
7006 Use IRA to evaluate register pressure in the code hoisting pass for
7007 decisions to hoist expressions. This option usually results in smaller
7008 code, but it can slow the compiler down.
7009
7010 This option is enabled at level @option{-Os} for all targets.
7011
7012 @item -fira-loop-pressure
7013 @opindex fira-loop-pressure
7014 Use IRA to evaluate register pressure in loops for decisions to move
7015 loop invariants. This option usually results in generation
7016 of faster and smaller code on machines with large register files (>= 32
7017 registers), but it can slow the compiler down.
7018
7019 This option is enabled at level @option{-O3} for some targets.
7020
7021 @item -fno-ira-share-save-slots
7022 @opindex fno-ira-share-save-slots
7023 Disable sharing of stack slots used for saving call-used hard
7024 registers living through a call. Each hard register gets a
7025 separate stack slot, and as a result function stack frames are
7026 larger.
7027
7028 @item -fno-ira-share-spill-slots
7029 @opindex fno-ira-share-spill-slots
7030 Disable sharing of stack slots allocated for pseudo-registers. Each
7031 pseudo-register that does not get a hard register gets a separate
7032 stack slot, and as a result function stack frames are larger.
7033
7034 @item -flra-remat
7035 @opindex flra-remat
7036 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7037 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7038 values if it is profitable.
7039
7040 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7041
7042 @item -fdelayed-branch
7043 @opindex fdelayed-branch
7044 If supported for the target machine, attempt to reorder instructions
7045 to exploit instruction slots available after delayed branch
7046 instructions.
7047
7048 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7049
7050 @item -fschedule-insns
7051 @opindex fschedule-insns
7052 If supported for the target machine, attempt to reorder instructions to
7053 eliminate execution stalls due to required data being unavailable. This
7054 helps machines that have slow floating point or memory load instructions
7055 by allowing other instructions to be issued until the result of the load
7056 or floating-point instruction is required.
7057
7058 Enabled at levels @option{-O2}, @option{-O3}.
7059
7060 @item -fschedule-insns2
7061 @opindex fschedule-insns2
7062 Similar to @option{-fschedule-insns}, but requests an additional pass of
7063 instruction scheduling after register allocation has been done. This is
7064 especially useful on machines with a relatively small number of
7065 registers and where memory load instructions take more than one cycle.
7066
7067 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7068
7069 @item -fno-sched-interblock
7070 @opindex fno-sched-interblock
7071 Don't schedule instructions across basic blocks. This is normally
7072 enabled by default when scheduling before register allocation, i.e.@:
7073 with @option{-fschedule-insns} or at @option{-O2} or higher.
7074
7075 @item -fno-sched-spec
7076 @opindex fno-sched-spec
7077 Don't allow speculative motion of non-load instructions. This is normally
7078 enabled by default when scheduling before register allocation, i.e.@:
7079 with @option{-fschedule-insns} or at @option{-O2} or higher.
7080
7081 @item -fsched-pressure
7082 @opindex fsched-pressure
7083 Enable register pressure sensitive insn scheduling before register
7084 allocation. This only makes sense when scheduling before register
7085 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7086 @option{-O2} or higher. Usage of this option can improve the
7087 generated code and decrease its size by preventing register pressure
7088 increase above the number of available hard registers and subsequent
7089 spills in register allocation.
7090
7091 @item -fsched-spec-load
7092 @opindex fsched-spec-load
7093 Allow speculative motion of some load instructions. This only makes
7094 sense when scheduling before register allocation, i.e.@: with
7095 @option{-fschedule-insns} or at @option{-O2} or higher.
7096
7097 @item -fsched-spec-load-dangerous
7098 @opindex fsched-spec-load-dangerous
7099 Allow speculative motion of more load instructions. This only makes
7100 sense when scheduling before register allocation, i.e.@: with
7101 @option{-fschedule-insns} or at @option{-O2} or higher.
7102
7103 @item -fsched-stalled-insns
7104 @itemx -fsched-stalled-insns=@var{n}
7105 @opindex fsched-stalled-insns
7106 Define how many insns (if any) can be moved prematurely from the queue
7107 of stalled insns into the ready list during the second scheduling pass.
7108 @option{-fno-sched-stalled-insns} means that no insns are moved
7109 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7110 on how many queued insns can be moved prematurely.
7111 @option{-fsched-stalled-insns} without a value is equivalent to
7112 @option{-fsched-stalled-insns=1}.
7113
7114 @item -fsched-stalled-insns-dep
7115 @itemx -fsched-stalled-insns-dep=@var{n}
7116 @opindex fsched-stalled-insns-dep
7117 Define how many insn groups (cycles) are examined for a dependency
7118 on a stalled insn that is a candidate for premature removal from the queue
7119 of stalled insns. This has an effect only during the second scheduling pass,
7120 and only if @option{-fsched-stalled-insns} is used.
7121 @option{-fno-sched-stalled-insns-dep} is equivalent to
7122 @option{-fsched-stalled-insns-dep=0}.
7123 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7124 @option{-fsched-stalled-insns-dep=1}.
7125
7126 @item -fsched2-use-superblocks
7127 @opindex fsched2-use-superblocks
7128 When scheduling after register allocation, use superblock scheduling.
7129 This allows motion across basic block boundaries,
7130 resulting in faster schedules. This option is experimental, as not all machine
7131 descriptions used by GCC model the CPU closely enough to avoid unreliable
7132 results from the algorithm.
7133
7134 This only makes sense when scheduling after register allocation, i.e.@: with
7135 @option{-fschedule-insns2} or at @option{-O2} or higher.
7136
7137 @item -fsched-group-heuristic
7138 @opindex fsched-group-heuristic
7139 Enable the group heuristic in the scheduler. This heuristic favors
7140 the instruction that belongs to a schedule group. This is enabled
7141 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7142 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7143
7144 @item -fsched-critical-path-heuristic
7145 @opindex fsched-critical-path-heuristic
7146 Enable the critical-path heuristic in the scheduler. This heuristic favors
7147 instructions on the critical path. This is enabled by default when
7148 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7149 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7150
7151 @item -fsched-spec-insn-heuristic
7152 @opindex fsched-spec-insn-heuristic
7153 Enable the speculative instruction heuristic in the scheduler. This
7154 heuristic favors speculative instructions with greater dependency weakness.
7155 This is enabled by default when scheduling is enabled, i.e.@:
7156 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7157 or at @option{-O2} or higher.
7158
7159 @item -fsched-rank-heuristic
7160 @opindex fsched-rank-heuristic
7161 Enable the rank heuristic in the scheduler. This heuristic favors
7162 the instruction belonging to a basic block with greater size or frequency.
7163 This is enabled by default when scheduling is enabled, i.e.@:
7164 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7165 at @option{-O2} or higher.
7166
7167 @item -fsched-last-insn-heuristic
7168 @opindex fsched-last-insn-heuristic
7169 Enable the last-instruction heuristic in the scheduler. This heuristic
7170 favors the instruction that is less dependent on the last instruction
7171 scheduled. This is enabled by default when scheduling is enabled,
7172 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7173 at @option{-O2} or higher.
7174
7175 @item -fsched-dep-count-heuristic
7176 @opindex fsched-dep-count-heuristic
7177 Enable the dependent-count heuristic in the scheduler. This heuristic
7178 favors the instruction that has more instructions depending on it.
7179 This is enabled by default when scheduling is enabled, i.e.@:
7180 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7181 at @option{-O2} or higher.
7182
7183 @item -freschedule-modulo-scheduled-loops
7184 @opindex freschedule-modulo-scheduled-loops
7185 Modulo scheduling is performed before traditional scheduling. If a loop
7186 is modulo scheduled, later scheduling passes may change its schedule.
7187 Use this option to control that behavior.
7188
7189 @item -fselective-scheduling
7190 @opindex fselective-scheduling
7191 Schedule instructions using selective scheduling algorithm. Selective
7192 scheduling runs instead of the first scheduler pass.
7193
7194 @item -fselective-scheduling2
7195 @opindex fselective-scheduling2
7196 Schedule instructions using selective scheduling algorithm. Selective
7197 scheduling runs instead of the second scheduler pass.
7198
7199 @item -fsel-sched-pipelining
7200 @opindex fsel-sched-pipelining
7201 Enable software pipelining of innermost loops during selective scheduling.
7202 This option has no effect unless one of @option{-fselective-scheduling} or
7203 @option{-fselective-scheduling2} is turned on.
7204
7205 @item -fsel-sched-pipelining-outer-loops
7206 @opindex fsel-sched-pipelining-outer-loops
7207 When pipelining loops during selective scheduling, also pipeline outer loops.
7208 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7209
7210 @item -fsemantic-interposition
7211 @opindex fsemantic-interposition
7212 Some object formats, like ELF, allow interposing of symbols by the
7213 dynamic linker.
7214 This means that for symbols exported from the DSO, the compiler cannot perform
7215 interprocedural propagation, inlining and other optimizations in anticipation
7216 that the function or variable in question may change. While this feature is
7217 useful, for example, to rewrite memory allocation functions by a debugging
7218 implementation, it is expensive in the terms of code quality.
7219 With @option{-fno-semantic-interposition} the compiler assumes that
7220 if interposition happens for functions the overwriting function will have
7221 precisely the same semantics (and side effects).
7222 Similarly if interposition happens
7223 for variables, the constructor of the variable will be the same. The flag
7224 has no effect for functions explicitly declared inline
7225 (where it is never allowed for interposition to change semantics)
7226 and for symbols explicitly declared weak.
7227
7228 @item -fshrink-wrap
7229 @opindex fshrink-wrap
7230 Emit function prologues only before parts of the function that need it,
7231 rather than at the top of the function. This flag is enabled by default at
7232 @option{-O} and higher.
7233
7234 @item -fcaller-saves
7235 @opindex fcaller-saves
7236 Enable allocation of values to registers that are clobbered by
7237 function calls, by emitting extra instructions to save and restore the
7238 registers around such calls. Such allocation is done only when it
7239 seems to result in better code.
7240
7241 This option is always enabled by default on certain machines, usually
7242 those which have no call-preserved registers to use instead.
7243
7244 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7245
7246 @item -fcombine-stack-adjustments
7247 @opindex fcombine-stack-adjustments
7248 Tracks stack adjustments (pushes and pops) and stack memory references
7249 and then tries to find ways to combine them.
7250
7251 Enabled by default at @option{-O1} and higher.
7252
7253 @item -fipa-ra
7254 @opindex fipa-ra
7255 Use caller save registers for allocation if those registers are not used by
7256 any called function. In that case it is not necessary to save and restore
7257 them around calls. This is only possible if called functions are part of
7258 same compilation unit as current function and they are compiled before it.
7259
7260 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
7261 is disabled if generated code will be instrumented for profiling
7262 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
7263 exactly (this happens on targets that do not expose prologues
7264 and epilogues in RTL).
7265
7266 @item -fconserve-stack
7267 @opindex fconserve-stack
7268 Attempt to minimize stack usage. The compiler attempts to use less
7269 stack space, even if that makes the program slower. This option
7270 implies setting the @option{large-stack-frame} parameter to 100
7271 and the @option{large-stack-frame-growth} parameter to 400.
7272
7273 @item -ftree-reassoc
7274 @opindex ftree-reassoc
7275 Perform reassociation on trees. This flag is enabled by default
7276 at @option{-O} and higher.
7277
7278 @item -fcode-hoisting
7279 @opindex fcode-hoisting
7280 Perform code hoisting. Code hoisting tries to move the
7281 evaluation of expressions executed on all paths to the function exit
7282 as early as possible. This is especially useful as a code size
7283 optimization, but it often helps for code speed as well.
7284 This flag is enabled by default at @option{-O2} and higher.
7285
7286 @item -ftree-pre
7287 @opindex ftree-pre
7288 Perform partial redundancy elimination (PRE) on trees. This flag is
7289 enabled by default at @option{-O2} and @option{-O3}.
7290
7291 @item -ftree-partial-pre
7292 @opindex ftree-partial-pre
7293 Make partial redundancy elimination (PRE) more aggressive. This flag is
7294 enabled by default at @option{-O3}.
7295
7296 @item -ftree-forwprop
7297 @opindex ftree-forwprop
7298 Perform forward propagation on trees. This flag is enabled by default
7299 at @option{-O} and higher.
7300
7301 @item -ftree-fre
7302 @opindex ftree-fre
7303 Perform full redundancy elimination (FRE) on trees. The difference
7304 between FRE and PRE is that FRE only considers expressions
7305 that are computed on all paths leading to the redundant computation.
7306 This analysis is faster than PRE, though it exposes fewer redundancies.
7307 This flag is enabled by default at @option{-O} and higher.
7308
7309 @item -ftree-phiprop
7310 @opindex ftree-phiprop
7311 Perform hoisting of loads from conditional pointers on trees. This
7312 pass is enabled by default at @option{-O} and higher.
7313
7314 @item -fhoist-adjacent-loads
7315 @opindex fhoist-adjacent-loads
7316 Speculatively hoist loads from both branches of an if-then-else if the
7317 loads are from adjacent locations in the same structure and the target
7318 architecture has a conditional move instruction. This flag is enabled
7319 by default at @option{-O2} and higher.
7320
7321 @item -ftree-copy-prop
7322 @opindex ftree-copy-prop
7323 Perform copy propagation on trees. This pass eliminates unnecessary
7324 copy operations. This flag is enabled by default at @option{-O} and
7325 higher.
7326
7327 @item -fipa-pure-const
7328 @opindex fipa-pure-const
7329 Discover which functions are pure or constant.
7330 Enabled by default at @option{-O} and higher.
7331
7332 @item -fipa-reference
7333 @opindex fipa-reference
7334 Discover which static variables do not escape the
7335 compilation unit.
7336 Enabled by default at @option{-O} and higher.
7337
7338 @item -fipa-pta
7339 @opindex fipa-pta
7340 Perform interprocedural pointer analysis and interprocedural modification
7341 and reference analysis. This option can cause excessive memory and
7342 compile-time usage on large compilation units. It is not enabled by
7343 default at any optimization level.
7344
7345 @item -fipa-profile
7346 @opindex fipa-profile
7347 Perform interprocedural profile propagation. The functions called only from
7348 cold functions are marked as cold. Also functions executed once (such as
7349 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7350 functions and loop less parts of functions executed once are then optimized for
7351 size.
7352 Enabled by default at @option{-O} and higher.
7353
7354 @item -fipa-cp
7355 @opindex fipa-cp
7356 Perform interprocedural constant propagation.
7357 This optimization analyzes the program to determine when values passed
7358 to functions are constants and then optimizes accordingly.
7359 This optimization can substantially increase performance
7360 if the application has constants passed to functions.
7361 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7362
7363 @item -fipa-cp-clone
7364 @opindex fipa-cp-clone
7365 Perform function cloning to make interprocedural constant propagation stronger.
7366 When enabled, interprocedural constant propagation performs function cloning
7367 when externally visible function can be called with constant arguments.
7368 Because this optimization can create multiple copies of functions,
7369 it may significantly increase code size
7370 (see @option{--param ipcp-unit-growth=@var{value}}).
7371 This flag is enabled by default at @option{-O3}.
7372
7373 @item -fipa-cp-alignment
7374 @opindex -fipa-cp-alignment
7375 When enabled, this optimization propagates alignment of function
7376 parameters to support better vectorization and string operations.
7377
7378 This flag is enabled by default at @option{-O2} and @option{-Os}. It
7379 requires that @option{-fipa-cp} is enabled.
7380
7381 @item -fipa-icf
7382 @opindex fipa-icf
7383 Perform Identical Code Folding for functions and read-only variables.
7384 The optimization reduces code size and may disturb unwind stacks by replacing
7385 a function by equivalent one with a different name. The optimization works
7386 more effectively with link time optimization enabled.
7387
7388 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
7389 works on different levels and thus the optimizations are not same - there are
7390 equivalences that are found only by GCC and equivalences found only by Gold.
7391
7392 This flag is enabled by default at @option{-O2} and @option{-Os}.
7393
7394 @item -fisolate-erroneous-paths-dereference
7395 @opindex fisolate-erroneous-paths-dereference
7396 Detect paths that trigger erroneous or undefined behavior due to
7397 dereferencing a null pointer. Isolate those paths from the main control
7398 flow and turn the statement with erroneous or undefined behavior into a trap.
7399 This flag is enabled by default at @option{-O2} and higher and depends on
7400 @option{-fdelete-null-pointer-checks} also being enabled.
7401
7402 @item -fisolate-erroneous-paths-attribute
7403 @opindex fisolate-erroneous-paths-attribute
7404 Detect paths that trigger erroneous or undefined behavior due a null value
7405 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
7406 attribute. Isolate those paths from the main control flow and turn the
7407 statement with erroneous or undefined behavior into a trap. This is not
7408 currently enabled, but may be enabled by @option{-O2} in the future.
7409
7410 @item -ftree-sink
7411 @opindex ftree-sink
7412 Perform forward store motion on trees. This flag is
7413 enabled by default at @option{-O} and higher.
7414
7415 @item -ftree-bit-ccp
7416 @opindex ftree-bit-ccp
7417 Perform sparse conditional bit constant propagation on trees and propagate
7418 pointer alignment information.
7419 This pass only operates on local scalar variables and is enabled by default
7420 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7421
7422 @item -ftree-ccp
7423 @opindex ftree-ccp
7424 Perform sparse conditional constant propagation (CCP) on trees. This
7425 pass only operates on local scalar variables and is enabled by default
7426 at @option{-O} and higher.
7427
7428 @item -fssa-backprop
7429 @opindex fssa-backprop
7430 Propagate information about uses of a value up the definition chain
7431 in order to simplify the definitions. For example, this pass strips
7432 sign operations if the sign of a value never matters. The flag is
7433 enabled by default at @option{-O} and higher.
7434
7435 @item -fssa-phiopt
7436 @opindex fssa-phiopt
7437 Perform pattern matching on SSA PHI nodes to optimize conditional
7438 code. This pass is enabled by default at @option{-O} and higher.
7439
7440 @item -ftree-switch-conversion
7441 @opindex ftree-switch-conversion
7442 Perform conversion of simple initializations in a switch to
7443 initializations from a scalar array. This flag is enabled by default
7444 at @option{-O2} and higher.
7445
7446 @item -ftree-tail-merge
7447 @opindex ftree-tail-merge
7448 Look for identical code sequences. When found, replace one with a jump to the
7449 other. This optimization is known as tail merging or cross jumping. This flag
7450 is enabled by default at @option{-O2} and higher. The compilation time
7451 in this pass can
7452 be limited using @option{max-tail-merge-comparisons} parameter and
7453 @option{max-tail-merge-iterations} parameter.
7454
7455 @item -ftree-dce
7456 @opindex ftree-dce
7457 Perform dead code elimination (DCE) on trees. This flag is enabled by
7458 default at @option{-O} and higher.
7459
7460 @item -ftree-builtin-call-dce
7461 @opindex ftree-builtin-call-dce
7462 Perform conditional dead code elimination (DCE) for calls to built-in functions
7463 that may set @code{errno} but are otherwise side-effect free. This flag is
7464 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7465 specified.
7466
7467 @item -ftree-dominator-opts
7468 @opindex ftree-dominator-opts
7469 Perform a variety of simple scalar cleanups (constant/copy
7470 propagation, redundancy elimination, range propagation and expression
7471 simplification) based on a dominator tree traversal. This also
7472 performs jump threading (to reduce jumps to jumps). This flag is
7473 enabled by default at @option{-O} and higher.
7474
7475 @item -ftree-dse
7476 @opindex ftree-dse
7477 Perform dead store elimination (DSE) on trees. A dead store is a store into
7478 a memory location that is later overwritten by another store without
7479 any intervening loads. In this case the earlier store can be deleted. This
7480 flag is enabled by default at @option{-O} and higher.
7481
7482 @item -ftree-ch
7483 @opindex ftree-ch
7484 Perform loop header copying on trees. This is beneficial since it increases
7485 effectiveness of code motion optimizations. It also saves one jump. This flag
7486 is enabled by default at @option{-O} and higher. It is not enabled
7487 for @option{-Os}, since it usually increases code size.
7488
7489 @item -ftree-loop-optimize
7490 @opindex ftree-loop-optimize
7491 Perform loop optimizations on trees. This flag is enabled by default
7492 at @option{-O} and higher.
7493
7494 @item -ftree-loop-linear
7495 @itemx -floop-interchange
7496 @itemx -floop-strip-mine
7497 @itemx -floop-block
7498 @itemx -floop-unroll-and-jam
7499 @opindex ftree-loop-linear
7500 @opindex floop-interchange
7501 @opindex floop-strip-mine
7502 @opindex floop-block
7503 @opindex floop-unroll-and-jam
7504 Perform loop nest optimizations. Same as
7505 @option{-floop-nest-optimize}. To use this code transformation, GCC has
7506 to be configured with @option{--with-isl} to enable the Graphite loop
7507 transformation infrastructure.
7508
7509 @item -fgraphite-identity
7510 @opindex fgraphite-identity
7511 Enable the identity transformation for graphite. For every SCoP we generate
7512 the polyhedral representation and transform it back to gimple. Using
7513 @option{-fgraphite-identity} we can check the costs or benefits of the
7514 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
7515 are also performed by the code generator isl, like index splitting and
7516 dead code elimination in loops.
7517
7518 @item -floop-nest-optimize
7519 @opindex floop-nest-optimize
7520 Enable the isl based loop nest optimizer. This is a generic loop nest
7521 optimizer based on the Pluto optimization algorithms. It calculates a loop
7522 structure optimized for data-locality and parallelism. This option
7523 is experimental.
7524
7525 @item -floop-parallelize-all
7526 @opindex floop-parallelize-all
7527 Use the Graphite data dependence analysis to identify loops that can
7528 be parallelized. Parallelize all the loops that can be analyzed to
7529 not contain loop carried dependences without checking that it is
7530 profitable to parallelize the loops.
7531
7532 @item -ftree-coalesce-vars
7533 @opindex ftree-coalesce-vars
7534 While transforming the program out of the SSA representation, attempt to
7535 reduce copying by coalescing versions of different user-defined
7536 variables, instead of just compiler temporaries. This may severely
7537 limit the ability to debug an optimized program compiled with
7538 @option{-fno-var-tracking-assignments}. In the negated form, this flag
7539 prevents SSA coalescing of user variables. This option is enabled by
7540 default if optimization is enabled, and it does very little otherwise.
7541
7542 @item -ftree-loop-if-convert
7543 @opindex ftree-loop-if-convert
7544 Attempt to transform conditional jumps in the innermost loops to
7545 branch-less equivalents. The intent is to remove control-flow from
7546 the innermost loops in order to improve the ability of the
7547 vectorization pass to handle these loops. This is enabled by default
7548 if vectorization is enabled.
7549
7550 @item -ftree-loop-if-convert-stores
7551 @opindex ftree-loop-if-convert-stores
7552 Attempt to also if-convert conditional jumps containing memory writes.
7553 This transformation can be unsafe for multi-threaded programs as it
7554 transforms conditional memory writes into unconditional memory writes.
7555 For example,
7556 @smallexample
7557 for (i = 0; i < N; i++)
7558 if (cond)
7559 A[i] = expr;
7560 @end smallexample
7561 is transformed to
7562 @smallexample
7563 for (i = 0; i < N; i++)
7564 A[i] = cond ? expr : A[i];
7565 @end smallexample
7566 potentially producing data races.
7567
7568 @item -ftree-loop-distribution
7569 @opindex ftree-loop-distribution
7570 Perform loop distribution. This flag can improve cache performance on
7571 big loop bodies and allow further loop optimizations, like
7572 parallelization or vectorization, to take place. For example, the loop
7573 @smallexample
7574 DO I = 1, N
7575 A(I) = B(I) + C
7576 D(I) = E(I) * F
7577 ENDDO
7578 @end smallexample
7579 is transformed to
7580 @smallexample
7581 DO I = 1, N
7582 A(I) = B(I) + C
7583 ENDDO
7584 DO I = 1, N
7585 D(I) = E(I) * F
7586 ENDDO
7587 @end smallexample
7588
7589 @item -ftree-loop-distribute-patterns
7590 @opindex ftree-loop-distribute-patterns
7591 Perform loop distribution of patterns that can be code generated with
7592 calls to a library. This flag is enabled by default at @option{-O3}.
7593
7594 This pass distributes the initialization loops and generates a call to
7595 memset zero. For example, the loop
7596 @smallexample
7597 DO I = 1, N
7598 A(I) = 0
7599 B(I) = A(I) + I
7600 ENDDO
7601 @end smallexample
7602 is transformed to
7603 @smallexample
7604 DO I = 1, N
7605 A(I) = 0
7606 ENDDO
7607 DO I = 1, N
7608 B(I) = A(I) + I
7609 ENDDO
7610 @end smallexample
7611 and the initialization loop is transformed into a call to memset zero.
7612
7613 @item -ftree-loop-im
7614 @opindex ftree-loop-im
7615 Perform loop invariant motion on trees. This pass moves only invariants that
7616 are hard to handle at RTL level (function calls, operations that expand to
7617 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
7618 operands of conditions that are invariant out of the loop, so that we can use
7619 just trivial invariantness analysis in loop unswitching. The pass also includes
7620 store motion.
7621
7622 @item -ftree-loop-ivcanon
7623 @opindex ftree-loop-ivcanon
7624 Create a canonical counter for number of iterations in loops for which
7625 determining number of iterations requires complicated analysis. Later
7626 optimizations then may determine the number easily. Useful especially
7627 in connection with unrolling.
7628
7629 @item -fivopts
7630 @opindex fivopts
7631 Perform induction variable optimizations (strength reduction, induction
7632 variable merging and induction variable elimination) on trees.
7633
7634 @item -ftree-parallelize-loops=n
7635 @opindex ftree-parallelize-loops
7636 Parallelize loops, i.e., split their iteration space to run in n threads.
7637 This is only possible for loops whose iterations are independent
7638 and can be arbitrarily reordered. The optimization is only
7639 profitable on multiprocessor machines, for loops that are CPU-intensive,
7640 rather than constrained e.g.@: by memory bandwidth. This option
7641 implies @option{-pthread}, and thus is only supported on targets
7642 that have support for @option{-pthread}.
7643
7644 @item -ftree-pta
7645 @opindex ftree-pta
7646 Perform function-local points-to analysis on trees. This flag is
7647 enabled by default at @option{-O} and higher.
7648
7649 @item -ftree-sra
7650 @opindex ftree-sra
7651 Perform scalar replacement of aggregates. This pass replaces structure
7652 references with scalars to prevent committing structures to memory too
7653 early. This flag is enabled by default at @option{-O} and higher.
7654
7655 @item -ftree-ter
7656 @opindex ftree-ter
7657 Perform temporary expression replacement during the SSA->normal phase. Single
7658 use/single def temporaries are replaced at their use location with their
7659 defining expression. This results in non-GIMPLE code, but gives the expanders
7660 much more complex trees to work on resulting in better RTL generation. This is
7661 enabled by default at @option{-O} and higher.
7662
7663 @item -ftree-slsr
7664 @opindex ftree-slsr
7665 Perform straight-line strength reduction on trees. This recognizes related
7666 expressions involving multiplications and replaces them by less expensive
7667 calculations when possible. This is enabled by default at @option{-O} and
7668 higher.
7669
7670 @item -ftree-vectorize
7671 @opindex ftree-vectorize
7672 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
7673 and @option{-ftree-slp-vectorize} if not explicitly specified.
7674
7675 @item -ftree-loop-vectorize
7676 @opindex ftree-loop-vectorize
7677 Perform loop vectorization on trees. This flag is enabled by default at
7678 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7679
7680 @item -ftree-slp-vectorize
7681 @opindex ftree-slp-vectorize
7682 Perform basic block vectorization on trees. This flag is enabled by default at
7683 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7684
7685 @item -fvect-cost-model=@var{model}
7686 @opindex fvect-cost-model
7687 Alter the cost model used for vectorization. The @var{model} argument
7688 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
7689 With the @samp{unlimited} model the vectorized code-path is assumed
7690 to be profitable while with the @samp{dynamic} model a runtime check
7691 guards the vectorized code-path to enable it only for iteration
7692 counts that will likely execute faster than when executing the original
7693 scalar loop. The @samp{cheap} model disables vectorization of
7694 loops where doing so would be cost prohibitive for example due to
7695 required runtime checks for data dependence or alignment but otherwise
7696 is equal to the @samp{dynamic} model.
7697 The default cost model depends on other optimization flags and is
7698 either @samp{dynamic} or @samp{cheap}.
7699
7700 @item -fsimd-cost-model=@var{model}
7701 @opindex fsimd-cost-model
7702 Alter the cost model used for vectorization of loops marked with the OpenMP
7703 or Cilk Plus simd directive. The @var{model} argument should be one of
7704 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
7705 have the same meaning as described in @option{-fvect-cost-model} and by
7706 default a cost model defined with @option{-fvect-cost-model} is used.
7707
7708 @item -ftree-vrp
7709 @opindex ftree-vrp
7710 Perform Value Range Propagation on trees. This is similar to the
7711 constant propagation pass, but instead of values, ranges of values are
7712 propagated. This allows the optimizers to remove unnecessary range
7713 checks like array bound checks and null pointer checks. This is
7714 enabled by default at @option{-O2} and higher. Null pointer check
7715 elimination is only done if @option{-fdelete-null-pointer-checks} is
7716 enabled.
7717
7718 @item -fsplit-paths
7719 @opindex fsplit-paths
7720 Split paths leading to loop backedges. This can improve dead code
7721 elimination and common subexpression elimination. This is enabled by
7722 default at @option{-O2} and above.
7723
7724 @item -fsplit-ivs-in-unroller
7725 @opindex fsplit-ivs-in-unroller
7726 Enables expression of values of induction variables in later iterations
7727 of the unrolled loop using the value in the first iteration. This breaks
7728 long dependency chains, thus improving efficiency of the scheduling passes.
7729
7730 A combination of @option{-fweb} and CSE is often sufficient to obtain the
7731 same effect. However, that is not reliable in cases where the loop body
7732 is more complicated than a single basic block. It also does not work at all
7733 on some architectures due to restrictions in the CSE pass.
7734
7735 This optimization is enabled by default.
7736
7737 @item -fvariable-expansion-in-unroller
7738 @opindex fvariable-expansion-in-unroller
7739 With this option, the compiler creates multiple copies of some
7740 local variables when unrolling a loop, which can result in superior code.
7741
7742 @item -fpartial-inlining
7743 @opindex fpartial-inlining
7744 Inline parts of functions. This option has any effect only
7745 when inlining itself is turned on by the @option{-finline-functions}
7746 or @option{-finline-small-functions} options.
7747
7748 Enabled at level @option{-O2}.
7749
7750 @item -fpredictive-commoning
7751 @opindex fpredictive-commoning
7752 Perform predictive commoning optimization, i.e., reusing computations
7753 (especially memory loads and stores) performed in previous
7754 iterations of loops.
7755
7756 This option is enabled at level @option{-O3}.
7757
7758 @item -fprefetch-loop-arrays
7759 @opindex fprefetch-loop-arrays
7760 If supported by the target machine, generate instructions to prefetch
7761 memory to improve the performance of loops that access large arrays.
7762
7763 This option may generate better or worse code; results are highly
7764 dependent on the structure of loops within the source code.
7765
7766 Disabled at level @option{-Os}.
7767
7768 @item -fno-peephole
7769 @itemx -fno-peephole2
7770 @opindex fno-peephole
7771 @opindex fno-peephole2
7772 Disable any machine-specific peephole optimizations. The difference
7773 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
7774 are implemented in the compiler; some targets use one, some use the
7775 other, a few use both.
7776
7777 @option{-fpeephole} is enabled by default.
7778 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7779
7780 @item -fno-guess-branch-probability
7781 @opindex fno-guess-branch-probability
7782 Do not guess branch probabilities using heuristics.
7783
7784 GCC uses heuristics to guess branch probabilities if they are
7785 not provided by profiling feedback (@option{-fprofile-arcs}). These
7786 heuristics are based on the control flow graph. If some branch probabilities
7787 are specified by @code{__builtin_expect}, then the heuristics are
7788 used to guess branch probabilities for the rest of the control flow graph,
7789 taking the @code{__builtin_expect} info into account. The interactions
7790 between the heuristics and @code{__builtin_expect} can be complex, and in
7791 some cases, it may be useful to disable the heuristics so that the effects
7792 of @code{__builtin_expect} are easier to understand.
7793
7794 The default is @option{-fguess-branch-probability} at levels
7795 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7796
7797 @item -freorder-blocks
7798 @opindex freorder-blocks
7799 Reorder basic blocks in the compiled function in order to reduce number of
7800 taken branches and improve code locality.
7801
7802 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7803
7804 @item -freorder-blocks-algorithm=@var{algorithm}
7805 @opindex freorder-blocks-algorithm
7806 Use the specified algorithm for basic block reordering. The
7807 @var{algorithm} argument can be @samp{simple}, which does not increase
7808 code size (except sometimes due to secondary effects like alignment),
7809 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
7810 put all often executed code together, minimizing the number of branches
7811 executed by making extra copies of code.
7812
7813 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
7814 @samp{stc} at levels @option{-O2}, @option{-O3}.
7815
7816 @item -freorder-blocks-and-partition
7817 @opindex freorder-blocks-and-partition
7818 In addition to reordering basic blocks in the compiled function, in order
7819 to reduce number of taken branches, partitions hot and cold basic blocks
7820 into separate sections of the assembly and @file{.o} files, to improve
7821 paging and cache locality performance.
7822
7823 This optimization is automatically turned off in the presence of
7824 exception handling, for linkonce sections, for functions with a user-defined
7825 section attribute and on any architecture that does not support named
7826 sections.
7827
7828 Enabled for x86 at levels @option{-O2}, @option{-O3}.
7829
7830 @item -freorder-functions
7831 @opindex freorder-functions
7832 Reorder functions in the object file in order to
7833 improve code locality. This is implemented by using special
7834 subsections @code{.text.hot} for most frequently executed functions and
7835 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
7836 the linker so object file format must support named sections and linker must
7837 place them in a reasonable way.
7838
7839 Also profile feedback must be available to make this option effective. See
7840 @option{-fprofile-arcs} for details.
7841
7842 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7843
7844 @item -fstrict-aliasing
7845 @opindex fstrict-aliasing
7846 Allow the compiler to assume the strictest aliasing rules applicable to
7847 the language being compiled. For C (and C++), this activates
7848 optimizations based on the type of expressions. In particular, an
7849 object of one type is assumed never to reside at the same address as an
7850 object of a different type, unless the types are almost the same. For
7851 example, an @code{unsigned int} can alias an @code{int}, but not a
7852 @code{void*} or a @code{double}. A character type may alias any other
7853 type.
7854
7855 @anchor{Type-punning}Pay special attention to code like this:
7856 @smallexample
7857 union a_union @{
7858 int i;
7859 double d;
7860 @};
7861
7862 int f() @{
7863 union a_union t;
7864 t.d = 3.0;
7865 return t.i;
7866 @}
7867 @end smallexample
7868 The practice of reading from a different union member than the one most
7869 recently written to (called ``type-punning'') is common. Even with
7870 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
7871 is accessed through the union type. So, the code above works as
7872 expected. @xref{Structures unions enumerations and bit-fields
7873 implementation}. However, this code might not:
7874 @smallexample
7875 int f() @{
7876 union a_union t;
7877 int* ip;
7878 t.d = 3.0;
7879 ip = &t.i;
7880 return *ip;
7881 @}
7882 @end smallexample
7883
7884 Similarly, access by taking the address, casting the resulting pointer
7885 and dereferencing the result has undefined behavior, even if the cast
7886 uses a union type, e.g.:
7887 @smallexample
7888 int f() @{
7889 double d = 3.0;
7890 return ((union a_union *) &d)->i;
7891 @}
7892 @end smallexample
7893
7894 The @option{-fstrict-aliasing} option is enabled at levels
7895 @option{-O2}, @option{-O3}, @option{-Os}.
7896
7897 @item -fstrict-overflow
7898 @opindex fstrict-overflow
7899 Allow the compiler to assume strict signed overflow rules, depending
7900 on the language being compiled. For C (and C++) this means that
7901 overflow when doing arithmetic with signed numbers is undefined, which
7902 means that the compiler may assume that it does not happen. This
7903 permits various optimizations. For example, the compiler assumes
7904 that an expression like @code{i + 10 > i} is always true for
7905 signed @code{i}. This assumption is only valid if signed overflow is
7906 undefined, as the expression is false if @code{i + 10} overflows when
7907 using twos complement arithmetic. When this option is in effect any
7908 attempt to determine whether an operation on signed numbers
7909 overflows must be written carefully to not actually involve overflow.
7910
7911 This option also allows the compiler to assume strict pointer
7912 semantics: given a pointer to an object, if adding an offset to that
7913 pointer does not produce a pointer to the same object, the addition is
7914 undefined. This permits the compiler to conclude that @code{p + u >
7915 p} is always true for a pointer @code{p} and unsigned integer
7916 @code{u}. This assumption is only valid because pointer wraparound is
7917 undefined, as the expression is false if @code{p + u} overflows using
7918 twos complement arithmetic.
7919
7920 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
7921 that integer signed overflow is fully defined: it wraps. When
7922 @option{-fwrapv} is used, there is no difference between
7923 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
7924 integers. With @option{-fwrapv} certain types of overflow are
7925 permitted. For example, if the compiler gets an overflow when doing
7926 arithmetic on constants, the overflowed value can still be used with
7927 @option{-fwrapv}, but not otherwise.
7928
7929 The @option{-fstrict-overflow} option is enabled at levels
7930 @option{-O2}, @option{-O3}, @option{-Os}.
7931
7932 @item -falign-functions
7933 @itemx -falign-functions=@var{n}
7934 @opindex falign-functions
7935 Align the start of functions to the next power-of-two greater than
7936 @var{n}, skipping up to @var{n} bytes. For instance,
7937 @option{-falign-functions=32} aligns functions to the next 32-byte
7938 boundary, but @option{-falign-functions=24} aligns to the next
7939 32-byte boundary only if this can be done by skipping 23 bytes or less.
7940
7941 @option{-fno-align-functions} and @option{-falign-functions=1} are
7942 equivalent and mean that functions are not aligned.
7943
7944 Some assemblers only support this flag when @var{n} is a power of two;
7945 in that case, it is rounded up.
7946
7947 If @var{n} is not specified or is zero, use a machine-dependent default.
7948
7949 Enabled at levels @option{-O2}, @option{-O3}.
7950
7951 @item -falign-labels
7952 @itemx -falign-labels=@var{n}
7953 @opindex falign-labels
7954 Align all branch targets to a power-of-two boundary, skipping up to
7955 @var{n} bytes like @option{-falign-functions}. This option can easily
7956 make code slower, because it must insert dummy operations for when the
7957 branch target is reached in the usual flow of the code.
7958
7959 @option{-fno-align-labels} and @option{-falign-labels=1} are
7960 equivalent and mean that labels are not aligned.
7961
7962 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
7963 are greater than this value, then their values are used instead.
7964
7965 If @var{n} is not specified or is zero, use a machine-dependent default
7966 which is very likely to be @samp{1}, meaning no alignment.
7967
7968 Enabled at levels @option{-O2}, @option{-O3}.
7969
7970 @item -falign-loops
7971 @itemx -falign-loops=@var{n}
7972 @opindex falign-loops
7973 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
7974 like @option{-falign-functions}. If the loops are
7975 executed many times, this makes up for any execution of the dummy
7976 operations.
7977
7978 @option{-fno-align-loops} and @option{-falign-loops=1} are
7979 equivalent and mean that loops are not aligned.
7980
7981 If @var{n} is not specified or is zero, use a machine-dependent default.
7982
7983 Enabled at levels @option{-O2}, @option{-O3}.
7984
7985 @item -falign-jumps
7986 @itemx -falign-jumps=@var{n}
7987 @opindex falign-jumps
7988 Align branch targets to a power-of-two boundary, for branch targets
7989 where the targets can only be reached by jumping, skipping up to @var{n}
7990 bytes like @option{-falign-functions}. In this case, no dummy operations
7991 need be executed.
7992
7993 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
7994 equivalent and mean that loops are not aligned.
7995
7996 If @var{n} is not specified or is zero, use a machine-dependent default.
7997
7998 Enabled at levels @option{-O2}, @option{-O3}.
7999
8000 @item -funit-at-a-time
8001 @opindex funit-at-a-time
8002 This option is left for compatibility reasons. @option{-funit-at-a-time}
8003 has no effect, while @option{-fno-unit-at-a-time} implies
8004 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8005
8006 Enabled by default.
8007
8008 @item -fno-toplevel-reorder
8009 @opindex fno-toplevel-reorder
8010 Do not reorder top-level functions, variables, and @code{asm}
8011 statements. Output them in the same order that they appear in the
8012 input file. When this option is used, unreferenced static variables
8013 are not removed. This option is intended to support existing code
8014 that relies on a particular ordering. For new code, it is better to
8015 use attributes when possible.
8016
8017 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8018 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8019 targets.
8020
8021 @item -fweb
8022 @opindex fweb
8023 Constructs webs as commonly used for register allocation purposes and assign
8024 each web individual pseudo register. This allows the register allocation pass
8025 to operate on pseudos directly, but also strengthens several other optimization
8026 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8027 however, make debugging impossible, since variables no longer stay in a
8028 ``home register''.
8029
8030 Enabled by default with @option{-funroll-loops}.
8031
8032 @item -fwhole-program
8033 @opindex fwhole-program
8034 Assume that the current compilation unit represents the whole program being
8035 compiled. All public functions and variables with the exception of @code{main}
8036 and those merged by attribute @code{externally_visible} become static functions
8037 and in effect are optimized more aggressively by interprocedural optimizers.
8038
8039 This option should not be used in combination with @option{-flto}.
8040 Instead relying on a linker plugin should provide safer and more precise
8041 information.
8042
8043 @item -flto[=@var{n}]
8044 @opindex flto
8045 This option runs the standard link-time optimizer. When invoked
8046 with source code, it generates GIMPLE (one of GCC's internal
8047 representations) and writes it to special ELF sections in the object
8048 file. When the object files are linked together, all the function
8049 bodies are read from these ELF sections and instantiated as if they
8050 had been part of the same translation unit.
8051
8052 To use the link-time optimizer, @option{-flto} and optimization
8053 options should be specified at compile time and during the final link.
8054 It is recommended that you compile all the files participating in the
8055 same link with the same options and also specify those options at
8056 link time.
8057 For example:
8058
8059 @smallexample
8060 gcc -c -O2 -flto foo.c
8061 gcc -c -O2 -flto bar.c
8062 gcc -o myprog -flto -O2 foo.o bar.o
8063 @end smallexample
8064
8065 The first two invocations to GCC save a bytecode representation
8066 of GIMPLE into special ELF sections inside @file{foo.o} and
8067 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8068 @file{foo.o} and @file{bar.o}, merges the two files into a single
8069 internal image, and compiles the result as usual. Since both
8070 @file{foo.o} and @file{bar.o} are merged into a single image, this
8071 causes all the interprocedural analyses and optimizations in GCC to
8072 work across the two files as if they were a single one. This means,
8073 for example, that the inliner is able to inline functions in
8074 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8075
8076 Another (simpler) way to enable link-time optimization is:
8077
8078 @smallexample
8079 gcc -o myprog -flto -O2 foo.c bar.c
8080 @end smallexample
8081
8082 The above generates bytecode for @file{foo.c} and @file{bar.c},
8083 merges them together into a single GIMPLE representation and optimizes
8084 them as usual to produce @file{myprog}.
8085
8086 The only important thing to keep in mind is that to enable link-time
8087 optimizations you need to use the GCC driver to perform the link step.
8088 GCC then automatically performs link-time optimization if any of the
8089 objects involved were compiled with the @option{-flto} command-line option.
8090 You generally
8091 should specify the optimization options to be used for link-time
8092 optimization though GCC tries to be clever at guessing an
8093 optimization level to use from the options used at compile time
8094 if you fail to specify one at link time. You can always override
8095 the automatic decision to do link-time optimization at link time
8096 by passing @option{-fno-lto} to the link command.
8097
8098 To make whole program optimization effective, it is necessary to make
8099 certain whole program assumptions. The compiler needs to know
8100 what functions and variables can be accessed by libraries and runtime
8101 outside of the link-time optimized unit. When supported by the linker,
8102 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8103 to the compiler about used and externally visible symbols. When
8104 the linker plugin is not available, @option{-fwhole-program} should be
8105 used to allow the compiler to make these assumptions, which leads
8106 to more aggressive optimization decisions.
8107
8108 When @option{-fuse-linker-plugin} is not enabled, when a file is
8109 compiled with @option{-flto}, the generated object file is larger than
8110 a regular object file because it contains GIMPLE bytecodes and the usual
8111 final code (see @option{-ffat-lto-objects}. This means that
8112 object files with LTO information can be linked as normal object
8113 files; if @option{-fno-lto} is passed to the linker, no
8114 interprocedural optimizations are applied. Note that when
8115 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
8116 but you cannot perform a regular, non-LTO link on them.
8117
8118 Additionally, the optimization flags used to compile individual files
8119 are not necessarily related to those used at link time. For instance,
8120
8121 @smallexample
8122 gcc -c -O0 -ffat-lto-objects -flto foo.c
8123 gcc -c -O0 -ffat-lto-objects -flto bar.c
8124 gcc -o myprog -O3 foo.o bar.o
8125 @end smallexample
8126
8127 This produces individual object files with unoptimized assembler
8128 code, but the resulting binary @file{myprog} is optimized at
8129 @option{-O3}. If, instead, the final binary is generated with
8130 @option{-fno-lto}, then @file{myprog} is not optimized.
8131
8132 When producing the final binary, GCC only
8133 applies link-time optimizations to those files that contain bytecode.
8134 Therefore, you can mix and match object files and libraries with
8135 GIMPLE bytecodes and final object code. GCC automatically selects
8136 which files to optimize in LTO mode and which files to link without
8137 further processing.
8138
8139 There are some code generation flags preserved by GCC when
8140 generating bytecodes, as they need to be used during the final link
8141 stage. Generally options specified at link time override those
8142 specified at compile time.
8143
8144 If you do not specify an optimization level option @option{-O} at
8145 link time, then GCC uses the highest optimization level
8146 used when compiling the object files.
8147
8148 Currently, the following options and their settings are taken from
8149 the first object file that explicitly specifies them:
8150 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8151 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8152 and all the @option{-m} target flags.
8153
8154 Certain ABI-changing flags are required to match in all compilation units,
8155 and trying to override this at link time with a conflicting value
8156 is ignored. This includes options such as @option{-freg-struct-return}
8157 and @option{-fpcc-struct-return}.
8158
8159 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8160 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8161 are passed through to the link stage and merged conservatively for
8162 conflicting translation units. Specifically
8163 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8164 precedence; and for example @option{-ffp-contract=off} takes precedence
8165 over @option{-ffp-contract=fast}. You can override them at link time.
8166
8167 If LTO encounters objects with C linkage declared with incompatible
8168 types in separate translation units to be linked together (undefined
8169 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8170 issued. The behavior is still undefined at run time. Similar
8171 diagnostics may be raised for other languages.
8172
8173 Another feature of LTO is that it is possible to apply interprocedural
8174 optimizations on files written in different languages:
8175
8176 @smallexample
8177 gcc -c -flto foo.c
8178 g++ -c -flto bar.cc
8179 gfortran -c -flto baz.f90
8180 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8181 @end smallexample
8182
8183 Notice that the final link is done with @command{g++} to get the C++
8184 runtime libraries and @option{-lgfortran} is added to get the Fortran
8185 runtime libraries. In general, when mixing languages in LTO mode, you
8186 should use the same link command options as when mixing languages in a
8187 regular (non-LTO) compilation.
8188
8189 If object files containing GIMPLE bytecode are stored in a library archive, say
8190 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8191 are using a linker with plugin support. To create static libraries suitable
8192 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8193 and @command{ranlib};
8194 to show the symbols of object files with GIMPLE bytecode, use
8195 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8196 and @command{nm} have been compiled with plugin support. At link time, use the the
8197 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8198 the LTO optimization process:
8199
8200 @smallexample
8201 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8202 @end smallexample
8203
8204 With the linker plugin enabled, the linker extracts the needed
8205 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8206 to make them part of the aggregated GIMPLE image to be optimized.
8207
8208 If you are not using a linker with plugin support and/or do not
8209 enable the linker plugin, then the objects inside @file{libfoo.a}
8210 are extracted and linked as usual, but they do not participate
8211 in the LTO optimization process. In order to make a static library suitable
8212 for both LTO optimization and usual linkage, compile its object files with
8213 @option{-flto} @option{-ffat-lto-objects}.
8214
8215 Link-time optimizations do not require the presence of the whole program to
8216 operate. If the program does not require any symbols to be exported, it is
8217 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8218 the interprocedural optimizers to use more aggressive assumptions which may
8219 lead to improved optimization opportunities.
8220 Use of @option{-fwhole-program} is not needed when linker plugin is
8221 active (see @option{-fuse-linker-plugin}).
8222
8223 The current implementation of LTO makes no
8224 attempt to generate bytecode that is portable between different
8225 types of hosts. The bytecode files are versioned and there is a
8226 strict version check, so bytecode files generated in one version of
8227 GCC do not work with an older or newer version of GCC.
8228
8229 Link-time optimization does not work well with generation of debugging
8230 information. Combining @option{-flto} with
8231 @option{-g} is currently experimental and expected to produce unexpected
8232 results.
8233
8234 If you specify the optional @var{n}, the optimization and code
8235 generation done at link time is executed in parallel using @var{n}
8236 parallel jobs by utilizing an installed @command{make} program. The
8237 environment variable @env{MAKE} may be used to override the program
8238 used. The default value for @var{n} is 1.
8239
8240 You can also specify @option{-flto=jobserver} to use GNU make's
8241 job server mode to determine the number of parallel jobs. This
8242 is useful when the Makefile calling GCC is already executing in parallel.
8243 You must prepend a @samp{+} to the command recipe in the parent Makefile
8244 for this to work. This option likely only works if @env{MAKE} is
8245 GNU make.
8246
8247 @item -flto-partition=@var{alg}
8248 @opindex flto-partition
8249 Specify the partitioning algorithm used by the link-time optimizer.
8250 The value is either @samp{1to1} to specify a partitioning mirroring
8251 the original source files or @samp{balanced} to specify partitioning
8252 into equally sized chunks (whenever possible) or @samp{max} to create
8253 new partition for every symbol where possible. Specifying @samp{none}
8254 as an algorithm disables partitioning and streaming completely.
8255 The default value is @samp{balanced}. While @samp{1to1} can be used
8256 as an workaround for various code ordering issues, the @samp{max}
8257 partitioning is intended for internal testing only.
8258 The value @samp{one} specifies that exactly one partition should be
8259 used while the value @samp{none} bypasses partitioning and executes
8260 the link-time optimization step directly from the WPA phase.
8261
8262 @item -flto-odr-type-merging
8263 @opindex flto-odr-type-merging
8264 Enable streaming of mangled types names of C++ types and their unification
8265 at link time. This increases size of LTO object files, but enables
8266 diagnostics about One Definition Rule violations.
8267
8268 @item -flto-compression-level=@var{n}
8269 @opindex flto-compression-level
8270 This option specifies the level of compression used for intermediate
8271 language written to LTO object files, and is only meaningful in
8272 conjunction with LTO mode (@option{-flto}). Valid
8273 values are 0 (no compression) to 9 (maximum compression). Values
8274 outside this range are clamped to either 0 or 9. If the option is not
8275 given, a default balanced compression setting is used.
8276
8277 @item -fuse-linker-plugin
8278 @opindex fuse-linker-plugin
8279 Enables the use of a linker plugin during link-time optimization. This
8280 option relies on plugin support in the linker, which is available in gold
8281 or in GNU ld 2.21 or newer.
8282
8283 This option enables the extraction of object files with GIMPLE bytecode out
8284 of library archives. This improves the quality of optimization by exposing
8285 more code to the link-time optimizer. This information specifies what
8286 symbols can be accessed externally (by non-LTO object or during dynamic
8287 linking). Resulting code quality improvements on binaries (and shared
8288 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
8289 See @option{-flto} for a description of the effect of this flag and how to
8290 use it.
8291
8292 This option is enabled by default when LTO support in GCC is enabled
8293 and GCC was configured for use with
8294 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8295
8296 @item -ffat-lto-objects
8297 @opindex ffat-lto-objects
8298 Fat LTO objects are object files that contain both the intermediate language
8299 and the object code. This makes them usable for both LTO linking and normal
8300 linking. This option is effective only when compiling with @option{-flto}
8301 and is ignored at link time.
8302
8303 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8304 requires the complete toolchain to be aware of LTO. It requires a linker with
8305 linker plugin support for basic functionality. Additionally,
8306 @command{nm}, @command{ar} and @command{ranlib}
8307 need to support linker plugins to allow a full-featured build environment
8308 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
8309 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8310 to these tools. With non fat LTO makefiles need to be modified to use them.
8311
8312 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
8313 support.
8314
8315 @item -fcompare-elim
8316 @opindex fcompare-elim
8317 After register allocation and post-register allocation instruction splitting,
8318 identify arithmetic instructions that compute processor flags similar to a
8319 comparison operation based on that arithmetic. If possible, eliminate the
8320 explicit comparison operation.
8321
8322 This pass only applies to certain targets that cannot explicitly represent
8323 the comparison operation before register allocation is complete.
8324
8325 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8326
8327 @item -fcprop-registers
8328 @opindex fcprop-registers
8329 After register allocation and post-register allocation instruction splitting,
8330 perform a copy-propagation pass to try to reduce scheduling dependencies
8331 and occasionally eliminate the copy.
8332
8333 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8334
8335 @item -fprofile-correction
8336 @opindex fprofile-correction
8337 Profiles collected using an instrumented binary for multi-threaded programs may
8338 be inconsistent due to missed counter updates. When this option is specified,
8339 GCC uses heuristics to correct or smooth out such inconsistencies. By
8340 default, GCC emits an error message when an inconsistent profile is detected.
8341
8342 @item -fprofile-use
8343 @itemx -fprofile-use=@var{path}
8344 @opindex fprofile-use
8345 Enable profile feedback-directed optimizations,
8346 and the following optimizations
8347 which are generally profitable only with profile feedback available:
8348 @option{-fbranch-probabilities}, @option{-fvpt},
8349 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8350 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
8351
8352 Before you can use this option, you must first generate profiling information.
8353 @xref{Optimize Options}, for information about the @option{-fprofile-generate}
8354 option.
8355
8356 By default, GCC emits an error message if the feedback profiles do not
8357 match the source code. This error can be turned into a warning by using
8358 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8359 code.
8360
8361 If @var{path} is specified, GCC looks at the @var{path} to find
8362 the profile feedback data files. See @option{-fprofile-dir}.
8363
8364 @item -fauto-profile
8365 @itemx -fauto-profile=@var{path}
8366 @opindex fauto-profile
8367 Enable sampling-based feedback-directed optimizations,
8368 and the following optimizations
8369 which are generally profitable only with profile feedback available:
8370 @option{-fbranch-probabilities}, @option{-fvpt},
8371 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8372 @option{-ftree-vectorize},
8373 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
8374 @option{-fpredictive-commoning}, @option{-funswitch-loops},
8375 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
8376
8377 @var{path} is the name of a file containing AutoFDO profile information.
8378 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
8379
8380 Producing an AutoFDO profile data file requires running your program
8381 with the @command{perf} utility on a supported GNU/Linux target system.
8382 For more information, see @uref{https://perf.wiki.kernel.org/}.
8383
8384 E.g.
8385 @smallexample
8386 perf record -e br_inst_retired:near_taken -b -o perf.data \
8387 -- your_program
8388 @end smallexample
8389
8390 Then use the @command{create_gcov} tool to convert the raw profile data
8391 to a format that can be used by GCC.@ You must also supply the
8392 unstripped binary for your program to this tool.
8393 See @uref{https://github.com/google/autofdo}.
8394
8395 E.g.
8396 @smallexample
8397 create_gcov --binary=your_program.unstripped --profile=perf.data \
8398 --gcov=profile.afdo
8399 @end smallexample
8400 @end table
8401
8402 The following options control compiler behavior regarding floating-point
8403 arithmetic. These options trade off between speed and
8404 correctness. All must be specifically enabled.
8405
8406 @table @gcctabopt
8407 @item -ffloat-store
8408 @opindex ffloat-store
8409 Do not store floating-point variables in registers, and inhibit other
8410 options that might change whether a floating-point value is taken from a
8411 register or memory.
8412
8413 @cindex floating-point precision
8414 This option prevents undesirable excess precision on machines such as
8415 the 68000 where the floating registers (of the 68881) keep more
8416 precision than a @code{double} is supposed to have. Similarly for the
8417 x86 architecture. For most programs, the excess precision does only
8418 good, but a few programs rely on the precise definition of IEEE floating
8419 point. Use @option{-ffloat-store} for such programs, after modifying
8420 them to store all pertinent intermediate computations into variables.
8421
8422 @item -fexcess-precision=@var{style}
8423 @opindex fexcess-precision
8424 This option allows further control over excess precision on machines
8425 where floating-point registers have more precision than the IEEE
8426 @code{float} and @code{double} types and the processor does not
8427 support operations rounding to those types. By default,
8428 @option{-fexcess-precision=fast} is in effect; this means that
8429 operations are carried out in the precision of the registers and that
8430 it is unpredictable when rounding to the types specified in the source
8431 code takes place. When compiling C, if
8432 @option{-fexcess-precision=standard} is specified then excess
8433 precision follows the rules specified in ISO C99; in particular,
8434 both casts and assignments cause values to be rounded to their
8435 semantic types (whereas @option{-ffloat-store} only affects
8436 assignments). This option is enabled by default for C if a strict
8437 conformance option such as @option{-std=c99} is used.
8438
8439 @opindex mfpmath
8440 @option{-fexcess-precision=standard} is not implemented for languages
8441 other than C, and has no effect if
8442 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8443 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8444 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8445 semantics apply without excess precision, and in the latter, rounding
8446 is unpredictable.
8447
8448 @item -ffast-math
8449 @opindex ffast-math
8450 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8451 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8452 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8453
8454 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8455
8456 This option is not turned on by any @option{-O} option besides
8457 @option{-Ofast} since it can result in incorrect output for programs
8458 that depend on an exact implementation of IEEE or ISO rules/specifications
8459 for math functions. It may, however, yield faster code for programs
8460 that do not require the guarantees of these specifications.
8461
8462 @item -fno-math-errno
8463 @opindex fno-math-errno
8464 Do not set @code{errno} after calling math functions that are executed
8465 with a single instruction, e.g., @code{sqrt}. A program that relies on
8466 IEEE exceptions for math error handling may want to use this flag
8467 for speed while maintaining IEEE arithmetic compatibility.
8468
8469 This option is not turned on by any @option{-O} option since
8470 it can result in incorrect output for programs that depend on
8471 an exact implementation of IEEE or ISO rules/specifications for
8472 math functions. It may, however, yield faster code for programs
8473 that do not require the guarantees of these specifications.
8474
8475 The default is @option{-fmath-errno}.
8476
8477 On Darwin systems, the math library never sets @code{errno}. There is
8478 therefore no reason for the compiler to consider the possibility that
8479 it might, and @option{-fno-math-errno} is the default.
8480
8481 @item -funsafe-math-optimizations
8482 @opindex funsafe-math-optimizations
8483
8484 Allow optimizations for floating-point arithmetic that (a) assume
8485 that arguments and results are valid and (b) may violate IEEE or
8486 ANSI standards. When used at link time, it may include libraries
8487 or startup files that change the default FPU control word or other
8488 similar optimizations.
8489
8490 This option is not turned on by any @option{-O} option since
8491 it can result in incorrect output for programs that depend on
8492 an exact implementation of IEEE or ISO rules/specifications for
8493 math functions. It may, however, yield faster code for programs
8494 that do not require the guarantees of these specifications.
8495 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
8496 @option{-fassociative-math} and @option{-freciprocal-math}.
8497
8498 The default is @option{-fno-unsafe-math-optimizations}.
8499
8500 @item -fassociative-math
8501 @opindex fassociative-math
8502
8503 Allow re-association of operands in series of floating-point operations.
8504 This violates the ISO C and C++ language standard by possibly changing
8505 computation result. NOTE: re-ordering may change the sign of zero as
8506 well as ignore NaNs and inhibit or create underflow or overflow (and
8507 thus cannot be used on code that relies on rounding behavior like
8508 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
8509 and thus may not be used when ordered comparisons are required.
8510 This option requires that both @option{-fno-signed-zeros} and
8511 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
8512 much sense with @option{-frounding-math}. For Fortran the option
8513 is automatically enabled when both @option{-fno-signed-zeros} and
8514 @option{-fno-trapping-math} are in effect.
8515
8516 The default is @option{-fno-associative-math}.
8517
8518 @item -freciprocal-math
8519 @opindex freciprocal-math
8520
8521 Allow the reciprocal of a value to be used instead of dividing by
8522 the value if this enables optimizations. For example @code{x / y}
8523 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
8524 is subject to common subexpression elimination. Note that this loses
8525 precision and increases the number of flops operating on the value.
8526
8527 The default is @option{-fno-reciprocal-math}.
8528
8529 @item -ffinite-math-only
8530 @opindex ffinite-math-only
8531 Allow optimizations for floating-point arithmetic that assume
8532 that arguments and results are not NaNs or +-Infs.
8533
8534 This option is not turned on by any @option{-O} option since
8535 it can result in incorrect output for programs that depend on
8536 an exact implementation of IEEE or ISO rules/specifications for
8537 math functions. It may, however, yield faster code for programs
8538 that do not require the guarantees of these specifications.
8539
8540 The default is @option{-fno-finite-math-only}.
8541
8542 @item -fno-signed-zeros
8543 @opindex fno-signed-zeros
8544 Allow optimizations for floating-point arithmetic that ignore the
8545 signedness of zero. IEEE arithmetic specifies the behavior of
8546 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
8547 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
8548 This option implies that the sign of a zero result isn't significant.
8549
8550 The default is @option{-fsigned-zeros}.
8551
8552 @item -fno-trapping-math
8553 @opindex fno-trapping-math
8554 Compile code assuming that floating-point operations cannot generate
8555 user-visible traps. These traps include division by zero, overflow,
8556 underflow, inexact result and invalid operation. This option requires
8557 that @option{-fno-signaling-nans} be in effect. Setting this option may
8558 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
8559
8560 This option should never be turned on by any @option{-O} option since
8561 it can result in incorrect output for programs that depend on
8562 an exact implementation of IEEE or ISO rules/specifications for
8563 math functions.
8564
8565 The default is @option{-ftrapping-math}.
8566
8567 @item -frounding-math
8568 @opindex frounding-math
8569 Disable transformations and optimizations that assume default floating-point
8570 rounding behavior. This is round-to-zero for all floating point
8571 to integer conversions, and round-to-nearest for all other arithmetic
8572 truncations. This option should be specified for programs that change
8573 the FP rounding mode dynamically, or that may be executed with a
8574 non-default rounding mode. This option disables constant folding of
8575 floating-point expressions at compile time (which may be affected by
8576 rounding mode) and arithmetic transformations that are unsafe in the
8577 presence of sign-dependent rounding modes.
8578
8579 The default is @option{-fno-rounding-math}.
8580
8581 This option is experimental and does not currently guarantee to
8582 disable all GCC optimizations that are affected by rounding mode.
8583 Future versions of GCC may provide finer control of this setting
8584 using C99's @code{FENV_ACCESS} pragma. This command-line option
8585 will be used to specify the default state for @code{FENV_ACCESS}.
8586
8587 @item -fsignaling-nans
8588 @opindex fsignaling-nans
8589 Compile code assuming that IEEE signaling NaNs may generate user-visible
8590 traps during floating-point operations. Setting this option disables
8591 optimizations that may change the number of exceptions visible with
8592 signaling NaNs. This option implies @option{-ftrapping-math}.
8593
8594 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
8595 be defined.
8596
8597 The default is @option{-fno-signaling-nans}.
8598
8599 This option is experimental and does not currently guarantee to
8600 disable all GCC optimizations that affect signaling NaN behavior.
8601
8602 @item -fno-fp-int-builtin-inexact
8603 @opindex fno-fp-int-builtin-inexact
8604 Do not allow the built-in functions @code{ceil}, @code{floor},
8605 @code{round} and @code{trunc}, and their @code{float} and @code{long
8606 double} variants, to generate code that raises the ``inexact''
8607 floating-point exception for noninteger arguments. ISO C99 and C11
8608 allow these functions to raise the ``inexact'' exception, but ISO/IEC
8609 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
8610 functions to do so.
8611
8612 The default is @option{-ffp-int-builtin-inexact}, allowing the
8613 exception to be raised. This option does nothing unless
8614 @option{-ftrapping-math} is in effect.
8615
8616 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
8617 generate a call to a library function then the ``inexact'' exception
8618 may be raised if the library implementation does not follow TS 18661.
8619
8620 @item -fsingle-precision-constant
8621 @opindex fsingle-precision-constant
8622 Treat floating-point constants as single precision instead of
8623 implicitly converting them to double-precision constants.
8624
8625 @item -fcx-limited-range
8626 @opindex fcx-limited-range
8627 When enabled, this option states that a range reduction step is not
8628 needed when performing complex division. Also, there is no checking
8629 whether the result of a complex multiplication or division is @code{NaN
8630 + I*NaN}, with an attempt to rescue the situation in that case. The
8631 default is @option{-fno-cx-limited-range}, but is enabled by
8632 @option{-ffast-math}.
8633
8634 This option controls the default setting of the ISO C99
8635 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
8636 all languages.
8637
8638 @item -fcx-fortran-rules
8639 @opindex fcx-fortran-rules
8640 Complex multiplication and division follow Fortran rules. Range
8641 reduction is done as part of complex division, but there is no checking
8642 whether the result of a complex multiplication or division is @code{NaN
8643 + I*NaN}, with an attempt to rescue the situation in that case.
8644
8645 The default is @option{-fno-cx-fortran-rules}.
8646
8647 @end table
8648
8649 The following options control optimizations that may improve
8650 performance, but are not enabled by any @option{-O} options. This
8651 section includes experimental options that may produce broken code.
8652
8653 @table @gcctabopt
8654 @item -fbranch-probabilities
8655 @opindex fbranch-probabilities
8656 After running a program compiled with @option{-fprofile-arcs}
8657 (@pxref{Instrumentation Options}),
8658 you can compile it a second time using
8659 @option{-fbranch-probabilities}, to improve optimizations based on
8660 the number of times each branch was taken. When a program
8661 compiled with @option{-fprofile-arcs} exits, it saves arc execution
8662 counts to a file called @file{@var{sourcename}.gcda} for each source
8663 file. The information in this data file is very dependent on the
8664 structure of the generated code, so you must use the same source code
8665 and the same optimization options for both compilations.
8666
8667 With @option{-fbranch-probabilities}, GCC puts a
8668 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8669 These can be used to improve optimization. Currently, they are only
8670 used in one place: in @file{reorg.c}, instead of guessing which path a
8671 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8672 exactly determine which path is taken more often.
8673
8674 @item -fprofile-values
8675 @opindex fprofile-values
8676 If combined with @option{-fprofile-arcs}, it adds code so that some
8677 data about values of expressions in the program is gathered.
8678
8679 With @option{-fbranch-probabilities}, it reads back the data gathered
8680 from profiling values of expressions for usage in optimizations.
8681
8682 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8683
8684 @item -fprofile-reorder-functions
8685 @opindex fprofile-reorder-functions
8686 Function reordering based on profile instrumentation collects
8687 first time of execution of a function and orders these functions
8688 in ascending order.
8689
8690 Enabled with @option{-fprofile-use}.
8691
8692 @item -fvpt
8693 @opindex fvpt
8694 If combined with @option{-fprofile-arcs}, this option instructs the compiler
8695 to add code to gather information about values of expressions.
8696
8697 With @option{-fbranch-probabilities}, it reads back the data gathered
8698 and actually performs the optimizations based on them.
8699 Currently the optimizations include specialization of division operations
8700 using the knowledge about the value of the denominator.
8701
8702 @item -frename-registers
8703 @opindex frename-registers
8704 Attempt to avoid false dependencies in scheduled code by making use
8705 of registers left over after register allocation. This optimization
8706 most benefits processors with lots of registers. Depending on the
8707 debug information format adopted by the target, however, it can
8708 make debugging impossible, since variables no longer stay in
8709 a ``home register''.
8710
8711 Enabled by default with @option{-funroll-loops}.
8712
8713 @item -fschedule-fusion
8714 @opindex fschedule-fusion
8715 Performs a target dependent pass over the instruction stream to schedule
8716 instructions of same type together because target machine can execute them
8717 more efficiently if they are adjacent to each other in the instruction flow.
8718
8719 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8720
8721 @item -ftracer
8722 @opindex ftracer
8723 Perform tail duplication to enlarge superblock size. This transformation
8724 simplifies the control flow of the function allowing other optimizations to do
8725 a better job.
8726
8727 Enabled with @option{-fprofile-use}.
8728
8729 @item -funroll-loops
8730 @opindex funroll-loops
8731 Unroll loops whose number of iterations can be determined at compile time or
8732 upon entry to the loop. @option{-funroll-loops} implies
8733 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
8734 It also turns on complete loop peeling (i.e.@: complete removal of loops with
8735 a small constant number of iterations). This option makes code larger, and may
8736 or may not make it run faster.
8737
8738 Enabled with @option{-fprofile-use}.
8739
8740 @item -funroll-all-loops
8741 @opindex funroll-all-loops
8742 Unroll all loops, even if their number of iterations is uncertain when
8743 the loop is entered. This usually makes programs run more slowly.
8744 @option{-funroll-all-loops} implies the same options as
8745 @option{-funroll-loops}.
8746
8747 @item -fpeel-loops
8748 @opindex fpeel-loops
8749 Peels loops for which there is enough information that they do not
8750 roll much (from profile feedback or static analysis). It also turns on
8751 complete loop peeling (i.e.@: complete removal of loops with small constant
8752 number of iterations).
8753
8754 Enabled with @option{-O3} and/or @option{-fprofile-use}.
8755
8756 @item -fmove-loop-invariants
8757 @opindex fmove-loop-invariants
8758 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
8759 at level @option{-O1}
8760
8761 @item -funswitch-loops
8762 @opindex funswitch-loops
8763 Move branches with loop invariant conditions out of the loop, with duplicates
8764 of the loop on both branches (modified according to result of the condition).
8765
8766 @item -ffunction-sections
8767 @itemx -fdata-sections
8768 @opindex ffunction-sections
8769 @opindex fdata-sections
8770 Place each function or data item into its own section in the output
8771 file if the target supports arbitrary sections. The name of the
8772 function or the name of the data item determines the section's name
8773 in the output file.
8774
8775 Use these options on systems where the linker can perform optimizations
8776 to improve locality of reference in the instruction space. Most systems
8777 using the ELF object format and SPARC processors running Solaris 2 have
8778 linkers with such optimizations. AIX may have these optimizations in
8779 the future.
8780
8781 Only use these options when there are significant benefits from doing
8782 so. When you specify these options, the assembler and linker
8783 create larger object and executable files and are also slower.
8784 You cannot use @command{gprof} on all systems if you
8785 specify this option, and you may have problems with debugging if
8786 you specify both this option and @option{-g}.
8787
8788 @item -fbranch-target-load-optimize
8789 @opindex fbranch-target-load-optimize
8790 Perform branch target register load optimization before prologue / epilogue
8791 threading.
8792 The use of target registers can typically be exposed only during reload,
8793 thus hoisting loads out of loops and doing inter-block scheduling needs
8794 a separate optimization pass.
8795
8796 @item -fbranch-target-load-optimize2
8797 @opindex fbranch-target-load-optimize2
8798 Perform branch target register load optimization after prologue / epilogue
8799 threading.
8800
8801 @item -fbtr-bb-exclusive
8802 @opindex fbtr-bb-exclusive
8803 When performing branch target register load optimization, don't reuse
8804 branch target registers within any basic block.
8805
8806 @item -fstdarg-opt
8807 @opindex fstdarg-opt
8808 Optimize the prologue of variadic argument functions with respect to usage of
8809 those arguments.
8810
8811 @item -fsection-anchors
8812 @opindex fsection-anchors
8813 Try to reduce the number of symbolic address calculations by using
8814 shared ``anchor'' symbols to address nearby objects. This transformation
8815 can help to reduce the number of GOT entries and GOT accesses on some
8816 targets.
8817
8818 For example, the implementation of the following function @code{foo}:
8819
8820 @smallexample
8821 static int a, b, c;
8822 int foo (void) @{ return a + b + c; @}
8823 @end smallexample
8824
8825 @noindent
8826 usually calculates the addresses of all three variables, but if you
8827 compile it with @option{-fsection-anchors}, it accesses the variables
8828 from a common anchor point instead. The effect is similar to the
8829 following pseudocode (which isn't valid C):
8830
8831 @smallexample
8832 int foo (void)
8833 @{
8834 register int *xr = &x;
8835 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8836 @}
8837 @end smallexample
8838
8839 Not all targets support this option.
8840
8841 @item --param @var{name}=@var{value}
8842 @opindex param
8843 In some places, GCC uses various constants to control the amount of
8844 optimization that is done. For example, GCC does not inline functions
8845 that contain more than a certain number of instructions. You can
8846 control some of these constants on the command line using the
8847 @option{--param} option.
8848
8849 The names of specific parameters, and the meaning of the values, are
8850 tied to the internals of the compiler, and are subject to change
8851 without notice in future releases.
8852
8853 In each case, the @var{value} is an integer. The allowable choices for
8854 @var{name} are:
8855
8856 @table @gcctabopt
8857 @item predictable-branch-outcome
8858 When branch is predicted to be taken with probability lower than this threshold
8859 (in percent), then it is considered well predictable. The default is 10.
8860
8861 @item max-rtl-if-conversion-insns
8862 RTL if-conversion tries to remove conditional branches around a block and
8863 replace them with conditionally executed instructions. This parameter
8864 gives the maximum number of instructions in a block which should be
8865 considered for if-conversion. The default is 10, though the compiler will
8866 also use other heuristics to decide whether if-conversion is likely to be
8867 profitable.
8868
8869 @item max-rtl-if-conversion-predictable-cost
8870 @item max-rtl-if-conversion-unpredictable-cost
8871 RTL if-conversion will try to remove conditional branches around a block
8872 and replace them with conditionally executed instructions. These parameters
8873 give the maximum permissible cost for the sequence that would be generated
8874 by if-conversion depending on whether the branch is statically determined
8875 to be predictable or not. The units for this parameter are the same as
8876 those for the GCC internal seq_cost metric. The compiler will try to
8877 provide a reasonable default for this parameter using the BRANCH_COST
8878 target macro.
8879
8880 @item max-crossjump-edges
8881 The maximum number of incoming edges to consider for cross-jumping.
8882 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
8883 the number of edges incoming to each block. Increasing values mean
8884 more aggressive optimization, making the compilation time increase with
8885 probably small improvement in executable size.
8886
8887 @item min-crossjump-insns
8888 The minimum number of instructions that must be matched at the end
8889 of two blocks before cross-jumping is performed on them. This
8890 value is ignored in the case where all instructions in the block being
8891 cross-jumped from are matched. The default value is 5.
8892
8893 @item max-grow-copy-bb-insns
8894 The maximum code size expansion factor when copying basic blocks
8895 instead of jumping. The expansion is relative to a jump instruction.
8896 The default value is 8.
8897
8898 @item max-goto-duplication-insns
8899 The maximum number of instructions to duplicate to a block that jumps
8900 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
8901 passes, GCC factors computed gotos early in the compilation process,
8902 and unfactors them as late as possible. Only computed jumps at the
8903 end of a basic blocks with no more than max-goto-duplication-insns are
8904 unfactored. The default value is 8.
8905
8906 @item max-delay-slot-insn-search
8907 The maximum number of instructions to consider when looking for an
8908 instruction to fill a delay slot. If more than this arbitrary number of
8909 instructions are searched, the time savings from filling the delay slot
8910 are minimal, so stop searching. Increasing values mean more
8911 aggressive optimization, making the compilation time increase with probably
8912 small improvement in execution time.
8913
8914 @item max-delay-slot-live-search
8915 When trying to fill delay slots, the maximum number of instructions to
8916 consider when searching for a block with valid live register
8917 information. Increasing this arbitrarily chosen value means more
8918 aggressive optimization, increasing the compilation time. This parameter
8919 should be removed when the delay slot code is rewritten to maintain the
8920 control-flow graph.
8921
8922 @item max-gcse-memory
8923 The approximate maximum amount of memory that can be allocated in
8924 order to perform the global common subexpression elimination
8925 optimization. If more memory than specified is required, the
8926 optimization is not done.
8927
8928 @item max-gcse-insertion-ratio
8929 If the ratio of expression insertions to deletions is larger than this value
8930 for any expression, then RTL PRE inserts or removes the expression and thus
8931 leaves partially redundant computations in the instruction stream. The default value is 20.
8932
8933 @item max-pending-list-length
8934 The maximum number of pending dependencies scheduling allows
8935 before flushing the current state and starting over. Large functions
8936 with few branches or calls can create excessively large lists which
8937 needlessly consume memory and resources.
8938
8939 @item max-modulo-backtrack-attempts
8940 The maximum number of backtrack attempts the scheduler should make
8941 when modulo scheduling a loop. Larger values can exponentially increase
8942 compilation time.
8943
8944 @item max-inline-insns-single
8945 Several parameters control the tree inliner used in GCC@.
8946 This number sets the maximum number of instructions (counted in GCC's
8947 internal representation) in a single function that the tree inliner
8948 considers for inlining. This only affects functions declared
8949 inline and methods implemented in a class declaration (C++).
8950 The default value is 400.
8951
8952 @item max-inline-insns-auto
8953 When you use @option{-finline-functions} (included in @option{-O3}),
8954 a lot of functions that would otherwise not be considered for inlining
8955 by the compiler are investigated. To those functions, a different
8956 (more restrictive) limit compared to functions declared inline can
8957 be applied.
8958 The default value is 40.
8959
8960 @item inline-min-speedup
8961 When estimated performance improvement of caller + callee runtime exceeds this
8962 threshold (in precent), the function can be inlined regardless the limit on
8963 @option{--param max-inline-insns-single} and @option{--param
8964 max-inline-insns-auto}.
8965
8966 @item large-function-insns
8967 The limit specifying really large functions. For functions larger than this
8968 limit after inlining, inlining is constrained by
8969 @option{--param large-function-growth}. This parameter is useful primarily
8970 to avoid extreme compilation time caused by non-linear algorithms used by the
8971 back end.
8972 The default value is 2700.
8973
8974 @item large-function-growth
8975 Specifies maximal growth of large function caused by inlining in percents.
8976 The default value is 100 which limits large function growth to 2.0 times
8977 the original size.
8978
8979 @item large-unit-insns
8980 The limit specifying large translation unit. Growth caused by inlining of
8981 units larger than this limit is limited by @option{--param inline-unit-growth}.
8982 For small units this might be too tight.
8983 For example, consider a unit consisting of function A
8984 that is inline and B that just calls A three times. If B is small relative to
8985 A, the growth of unit is 300\% and yet such inlining is very sane. For very
8986 large units consisting of small inlineable functions, however, the overall unit
8987 growth limit is needed to avoid exponential explosion of code size. Thus for
8988 smaller units, the size is increased to @option{--param large-unit-insns}
8989 before applying @option{--param inline-unit-growth}. The default is 10000.
8990
8991 @item inline-unit-growth
8992 Specifies maximal overall growth of the compilation unit caused by inlining.
8993 The default value is 20 which limits unit growth to 1.2 times the original
8994 size. Cold functions (either marked cold via an attribute or by profile
8995 feedback) are not accounted into the unit size.
8996
8997 @item ipcp-unit-growth
8998 Specifies maximal overall growth of the compilation unit caused by
8999 interprocedural constant propagation. The default value is 10 which limits
9000 unit growth to 1.1 times the original size.
9001
9002 @item large-stack-frame
9003 The limit specifying large stack frames. While inlining the algorithm is trying
9004 to not grow past this limit too much. The default value is 256 bytes.
9005
9006 @item large-stack-frame-growth
9007 Specifies maximal growth of large stack frames caused by inlining in percents.
9008 The default value is 1000 which limits large stack frame growth to 11 times
9009 the original size.
9010
9011 @item max-inline-insns-recursive
9012 @itemx max-inline-insns-recursive-auto
9013 Specifies the maximum number of instructions an out-of-line copy of a
9014 self-recursive inline
9015 function can grow into by performing recursive inlining.
9016
9017 @option{--param max-inline-insns-recursive} applies to functions
9018 declared inline.
9019 For functions not declared inline, recursive inlining
9020 happens only when @option{-finline-functions} (included in @option{-O3}) is
9021 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
9022 default value is 450.
9023
9024 @item max-inline-recursive-depth
9025 @itemx max-inline-recursive-depth-auto
9026 Specifies the maximum recursion depth used for recursive inlining.
9027
9028 @option{--param max-inline-recursive-depth} applies to functions
9029 declared inline. For functions not declared inline, recursive inlining
9030 happens only when @option{-finline-functions} (included in @option{-O3}) is
9031 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
9032 default value is 8.
9033
9034 @item min-inline-recursive-probability
9035 Recursive inlining is profitable only for function having deep recursion
9036 in average and can hurt for function having little recursion depth by
9037 increasing the prologue size or complexity of function body to other
9038 optimizers.
9039
9040 When profile feedback is available (see @option{-fprofile-generate}) the actual
9041 recursion depth can be guessed from probability that function recurses via a
9042 given call expression. This parameter limits inlining only to call expressions
9043 whose probability exceeds the given threshold (in percents).
9044 The default value is 10.
9045
9046 @item early-inlining-insns
9047 Specify growth that the early inliner can make. In effect it increases
9048 the amount of inlining for code having a large abstraction penalty.
9049 The default value is 14.
9050
9051 @item max-early-inliner-iterations
9052 Limit of iterations of the early inliner. This basically bounds
9053 the number of nested indirect calls the early inliner can resolve.
9054 Deeper chains are still handled by late inlining.
9055
9056 @item comdat-sharing-probability
9057 Probability (in percent) that C++ inline function with comdat visibility
9058 are shared across multiple compilation units. The default value is 20.
9059
9060 @item profile-func-internal-id
9061 A parameter to control whether to use function internal id in profile
9062 database lookup. If the value is 0, the compiler uses an id that
9063 is based on function assembler name and filename, which makes old profile
9064 data more tolerant to source changes such as function reordering etc.
9065 The default value is 0.
9066
9067 @item min-vect-loop-bound
9068 The minimum number of iterations under which loops are not vectorized
9069 when @option{-ftree-vectorize} is used. The number of iterations after
9070 vectorization needs to be greater than the value specified by this option
9071 to allow vectorization. The default value is 0.
9072
9073 @item gcse-cost-distance-ratio
9074 Scaling factor in calculation of maximum distance an expression
9075 can be moved by GCSE optimizations. This is currently supported only in the
9076 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9077 is with simple expressions, i.e., the expressions that have cost
9078 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9079 hoisting of simple expressions. The default value is 10.
9080
9081 @item gcse-unrestricted-cost
9082 Cost, roughly measured as the cost of a single typical machine
9083 instruction, at which GCSE optimizations do not constrain
9084 the distance an expression can travel. This is currently
9085 supported only in the code hoisting pass. The lesser the cost,
9086 the more aggressive code hoisting is. Specifying 0
9087 allows all expressions to travel unrestricted distances.
9088 The default value is 3.
9089
9090 @item max-hoist-depth
9091 The depth of search in the dominator tree for expressions to hoist.
9092 This is used to avoid quadratic behavior in hoisting algorithm.
9093 The value of 0 does not limit on the search, but may slow down compilation
9094 of huge functions. The default value is 30.
9095
9096 @item max-tail-merge-comparisons
9097 The maximum amount of similar bbs to compare a bb with. This is used to
9098 avoid quadratic behavior in tree tail merging. The default value is 10.
9099
9100 @item max-tail-merge-iterations
9101 The maximum amount of iterations of the pass over the function. This is used to
9102 limit compilation time in tree tail merging. The default value is 2.
9103
9104 @item max-unrolled-insns
9105 The maximum number of instructions that a loop may have to be unrolled.
9106 If a loop is unrolled, this parameter also determines how many times
9107 the loop code is unrolled.
9108
9109 @item max-average-unrolled-insns
9110 The maximum number of instructions biased by probabilities of their execution
9111 that a loop may have to be unrolled. If a loop is unrolled,
9112 this parameter also determines how many times the loop code is unrolled.
9113
9114 @item max-unroll-times
9115 The maximum number of unrollings of a single loop.
9116
9117 @item max-peeled-insns
9118 The maximum number of instructions that a loop may have to be peeled.
9119 If a loop is peeled, this parameter also determines how many times
9120 the loop code is peeled.
9121
9122 @item max-peel-times
9123 The maximum number of peelings of a single loop.
9124
9125 @item max-peel-branches
9126 The maximum number of branches on the hot path through the peeled sequence.
9127
9128 @item max-completely-peeled-insns
9129 The maximum number of insns of a completely peeled loop.
9130
9131 @item max-completely-peel-times
9132 The maximum number of iterations of a loop to be suitable for complete peeling.
9133
9134 @item max-completely-peel-loop-nest-depth
9135 The maximum depth of a loop nest suitable for complete peeling.
9136
9137 @item max-unswitch-insns
9138 The maximum number of insns of an unswitched loop.
9139
9140 @item max-unswitch-level
9141 The maximum number of branches unswitched in a single loop.
9142
9143 @item max-loop-headers-insns
9144 The maximum number of insns in loop header duplicated by he copy loop headers
9145 pass.
9146
9147 @item lim-expensive
9148 The minimum cost of an expensive expression in the loop invariant motion.
9149
9150 @item iv-consider-all-candidates-bound
9151 Bound on number of candidates for induction variables, below which
9152 all candidates are considered for each use in induction variable
9153 optimizations. If there are more candidates than this,
9154 only the most relevant ones are considered to avoid quadratic time complexity.
9155
9156 @item iv-max-considered-uses
9157 The induction variable optimizations give up on loops that contain more
9158 induction variable uses.
9159
9160 @item iv-always-prune-cand-set-bound
9161 If the number of candidates in the set is smaller than this value,
9162 always try to remove unnecessary ivs from the set
9163 when adding a new one.
9164
9165 @item avg-loop-niter
9166 Average number of iterations of a loop.
9167
9168 @item scev-max-expr-size
9169 Bound on size of expressions used in the scalar evolutions analyzer.
9170 Large expressions slow the analyzer.
9171
9172 @item scev-max-expr-complexity
9173 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9174 Complex expressions slow the analyzer.
9175
9176 @item max-tree-if-conversion-phi-args
9177 Maximum number of arguments in a PHI supported by TREE if conversion
9178 unless the loop is marked with simd pragma.
9179
9180 @item vect-max-version-for-alignment-checks
9181 The maximum number of run-time checks that can be performed when
9182 doing loop versioning for alignment in the vectorizer.
9183
9184 @item vect-max-version-for-alias-checks
9185 The maximum number of run-time checks that can be performed when
9186 doing loop versioning for alias in the vectorizer.
9187
9188 @item vect-max-peeling-for-alignment
9189 The maximum number of loop peels to enhance access alignment
9190 for vectorizer. Value -1 means no limit.
9191
9192 @item max-iterations-to-track
9193 The maximum number of iterations of a loop the brute-force algorithm
9194 for analysis of the number of iterations of the loop tries to evaluate.
9195
9196 @item hot-bb-count-ws-permille
9197 A basic block profile count is considered hot if it contributes to
9198 the given permillage (i.e. 0...1000) of the entire profiled execution.
9199
9200 @item hot-bb-frequency-fraction
9201 Select fraction of the entry block frequency of executions of basic block in
9202 function given basic block needs to have to be considered hot.
9203
9204 @item max-predicted-iterations
9205 The maximum number of loop iterations we predict statically. This is useful
9206 in cases where a function contains a single loop with known bound and
9207 another loop with unknown bound.
9208 The known number of iterations is predicted correctly, while
9209 the unknown number of iterations average to roughly 10. This means that the
9210 loop without bounds appears artificially cold relative to the other one.
9211
9212 @item builtin-expect-probability
9213 Control the probability of the expression having the specified value. This
9214 parameter takes a percentage (i.e. 0 ... 100) as input.
9215 The default probability of 90 is obtained empirically.
9216
9217 @item align-threshold
9218
9219 Select fraction of the maximal frequency of executions of a basic block in
9220 a function to align the basic block.
9221
9222 @item align-loop-iterations
9223
9224 A loop expected to iterate at least the selected number of iterations is
9225 aligned.
9226
9227 @item tracer-dynamic-coverage
9228 @itemx tracer-dynamic-coverage-feedback
9229
9230 This value is used to limit superblock formation once the given percentage of
9231 executed instructions is covered. This limits unnecessary code size
9232 expansion.
9233
9234 The @option{tracer-dynamic-coverage-feedback} parameter
9235 is used only when profile
9236 feedback is available. The real profiles (as opposed to statically estimated
9237 ones) are much less balanced allowing the threshold to be larger value.
9238
9239 @item tracer-max-code-growth
9240 Stop tail duplication once code growth has reached given percentage. This is
9241 a rather artificial limit, as most of the duplicates are eliminated later in
9242 cross jumping, so it may be set to much higher values than is the desired code
9243 growth.
9244
9245 @item tracer-min-branch-ratio
9246
9247 Stop reverse growth when the reverse probability of best edge is less than this
9248 threshold (in percent).
9249
9250 @item tracer-min-branch-probability
9251 @itemx tracer-min-branch-probability-feedback
9252
9253 Stop forward growth if the best edge has probability lower than this
9254 threshold.
9255
9256 Similarly to @option{tracer-dynamic-coverage} two parameters are
9257 provided. @option{tracer-min-branch-probability-feedback} is used for
9258 compilation with profile feedback and @option{tracer-min-branch-probability}
9259 compilation without. The value for compilation with profile feedback
9260 needs to be more conservative (higher) in order to make tracer
9261 effective.
9262
9263 @item max-cse-path-length
9264
9265 The maximum number of basic blocks on path that CSE considers.
9266 The default is 10.
9267
9268 @item max-cse-insns
9269 The maximum number of instructions CSE processes before flushing.
9270 The default is 1000.
9271
9272 @item ggc-min-expand
9273
9274 GCC uses a garbage collector to manage its own memory allocation. This
9275 parameter specifies the minimum percentage by which the garbage
9276 collector's heap should be allowed to expand between collections.
9277 Tuning this may improve compilation speed; it has no effect on code
9278 generation.
9279
9280 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9281 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9282 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9283 GCC is not able to calculate RAM on a particular platform, the lower
9284 bound of 30% is used. Setting this parameter and
9285 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9286 every opportunity. This is extremely slow, but can be useful for
9287 debugging.
9288
9289 @item ggc-min-heapsize
9290
9291 Minimum size of the garbage collector's heap before it begins bothering
9292 to collect garbage. The first collection occurs after the heap expands
9293 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9294 tuning this may improve compilation speed, and has no effect on code
9295 generation.
9296
9297 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9298 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9299 with a lower bound of 4096 (four megabytes) and an upper bound of
9300 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9301 particular platform, the lower bound is used. Setting this parameter
9302 very large effectively disables garbage collection. Setting this
9303 parameter and @option{ggc-min-expand} to zero causes a full collection
9304 to occur at every opportunity.
9305
9306 @item max-reload-search-insns
9307 The maximum number of instruction reload should look backward for equivalent
9308 register. Increasing values mean more aggressive optimization, making the
9309 compilation time increase with probably slightly better performance.
9310 The default value is 100.
9311
9312 @item max-cselib-memory-locations
9313 The maximum number of memory locations cselib should take into account.
9314 Increasing values mean more aggressive optimization, making the compilation time
9315 increase with probably slightly better performance. The default value is 500.
9316
9317 @item max-sched-ready-insns
9318 The maximum number of instructions ready to be issued the scheduler should
9319 consider at any given time during the first scheduling pass. Increasing
9320 values mean more thorough searches, making the compilation time increase
9321 with probably little benefit. The default value is 100.
9322
9323 @item max-sched-region-blocks
9324 The maximum number of blocks in a region to be considered for
9325 interblock scheduling. The default value is 10.
9326
9327 @item max-pipeline-region-blocks
9328 The maximum number of blocks in a region to be considered for
9329 pipelining in the selective scheduler. The default value is 15.
9330
9331 @item max-sched-region-insns
9332 The maximum number of insns in a region to be considered for
9333 interblock scheduling. The default value is 100.
9334
9335 @item max-pipeline-region-insns
9336 The maximum number of insns in a region to be considered for
9337 pipelining in the selective scheduler. The default value is 200.
9338
9339 @item min-spec-prob
9340 The minimum probability (in percents) of reaching a source block
9341 for interblock speculative scheduling. The default value is 40.
9342
9343 @item max-sched-extend-regions-iters
9344 The maximum number of iterations through CFG to extend regions.
9345 A value of 0 (the default) disables region extensions.
9346
9347 @item max-sched-insn-conflict-delay
9348 The maximum conflict delay for an insn to be considered for speculative motion.
9349 The default value is 3.
9350
9351 @item sched-spec-prob-cutoff
9352 The minimal probability of speculation success (in percents), so that
9353 speculative insns are scheduled.
9354 The default value is 40.
9355
9356 @item sched-state-edge-prob-cutoff
9357 The minimum probability an edge must have for the scheduler to save its
9358 state across it.
9359 The default value is 10.
9360
9361 @item sched-mem-true-dep-cost
9362 Minimal distance (in CPU cycles) between store and load targeting same
9363 memory locations. The default value is 1.
9364
9365 @item selsched-max-lookahead
9366 The maximum size of the lookahead window of selective scheduling. It is a
9367 depth of search for available instructions.
9368 The default value is 50.
9369
9370 @item selsched-max-sched-times
9371 The maximum number of times that an instruction is scheduled during
9372 selective scheduling. This is the limit on the number of iterations
9373 through which the instruction may be pipelined. The default value is 2.
9374
9375 @item selsched-insns-to-rename
9376 The maximum number of best instructions in the ready list that are considered
9377 for renaming in the selective scheduler. The default value is 2.
9378
9379 @item sms-min-sc
9380 The minimum value of stage count that swing modulo scheduler
9381 generates. The default value is 2.
9382
9383 @item max-last-value-rtl
9384 The maximum size measured as number of RTLs that can be recorded in an expression
9385 in combiner for a pseudo register as last known value of that register. The default
9386 is 10000.
9387
9388 @item max-combine-insns
9389 The maximum number of instructions the RTL combiner tries to combine.
9390 The default value is 2 at @option{-Og} and 4 otherwise.
9391
9392 @item integer-share-limit
9393 Small integer constants can use a shared data structure, reducing the
9394 compiler's memory usage and increasing its speed. This sets the maximum
9395 value of a shared integer constant. The default value is 256.
9396
9397 @item ssp-buffer-size
9398 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9399 protection when @option{-fstack-protection} is used.
9400
9401 @item min-size-for-stack-sharing
9402 The minimum size of variables taking part in stack slot sharing when not
9403 optimizing. The default value is 32.
9404
9405 @item max-jump-thread-duplication-stmts
9406 Maximum number of statements allowed in a block that needs to be
9407 duplicated when threading jumps.
9408
9409 @item max-fields-for-field-sensitive
9410 Maximum number of fields in a structure treated in
9411 a field sensitive manner during pointer analysis. The default is zero
9412 for @option{-O0} and @option{-O1},
9413 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9414
9415 @item prefetch-latency
9416 Estimate on average number of instructions that are executed before
9417 prefetch finishes. The distance prefetched ahead is proportional
9418 to this constant. Increasing this number may also lead to less
9419 streams being prefetched (see @option{simultaneous-prefetches}).
9420
9421 @item simultaneous-prefetches
9422 Maximum number of prefetches that can run at the same time.
9423
9424 @item l1-cache-line-size
9425 The size of cache line in L1 cache, in bytes.
9426
9427 @item l1-cache-size
9428 The size of L1 cache, in kilobytes.
9429
9430 @item l2-cache-size
9431 The size of L2 cache, in kilobytes.
9432
9433 @item min-insn-to-prefetch-ratio
9434 The minimum ratio between the number of instructions and the
9435 number of prefetches to enable prefetching in a loop.
9436
9437 @item prefetch-min-insn-to-mem-ratio
9438 The minimum ratio between the number of instructions and the
9439 number of memory references to enable prefetching in a loop.
9440
9441 @item use-canonical-types
9442 Whether the compiler should use the ``canonical'' type system. By
9443 default, this should always be 1, which uses a more efficient internal
9444 mechanism for comparing types in C++ and Objective-C++. However, if
9445 bugs in the canonical type system are causing compilation failures,
9446 set this value to 0 to disable canonical types.
9447
9448 @item switch-conversion-max-branch-ratio
9449 Switch initialization conversion refuses to create arrays that are
9450 bigger than @option{switch-conversion-max-branch-ratio} times the number of
9451 branches in the switch.
9452
9453 @item max-partial-antic-length
9454 Maximum length of the partial antic set computed during the tree
9455 partial redundancy elimination optimization (@option{-ftree-pre}) when
9456 optimizing at @option{-O3} and above. For some sorts of source code
9457 the enhanced partial redundancy elimination optimization can run away,
9458 consuming all of the memory available on the host machine. This
9459 parameter sets a limit on the length of the sets that are computed,
9460 which prevents the runaway behavior. Setting a value of 0 for
9461 this parameter allows an unlimited set length.
9462
9463 @item sccvn-max-scc-size
9464 Maximum size of a strongly connected component (SCC) during SCCVN
9465 processing. If this limit is hit, SCCVN processing for the whole
9466 function is not done and optimizations depending on it are
9467 disabled. The default maximum SCC size is 10000.
9468
9469 @item sccvn-max-alias-queries-per-access
9470 Maximum number of alias-oracle queries we perform when looking for
9471 redundancies for loads and stores. If this limit is hit the search
9472 is aborted and the load or store is not considered redundant. The
9473 number of queries is algorithmically limited to the number of
9474 stores on all paths from the load to the function entry.
9475 The default maximum number of queries is 1000.
9476
9477 @item ira-max-loops-num
9478 IRA uses regional register allocation by default. If a function
9479 contains more loops than the number given by this parameter, only at most
9480 the given number of the most frequently-executed loops form regions
9481 for regional register allocation. The default value of the
9482 parameter is 100.
9483
9484 @item ira-max-conflict-table-size
9485 Although IRA uses a sophisticated algorithm to compress the conflict
9486 table, the table can still require excessive amounts of memory for
9487 huge functions. If the conflict table for a function could be more
9488 than the size in MB given by this parameter, the register allocator
9489 instead uses a faster, simpler, and lower-quality
9490 algorithm that does not require building a pseudo-register conflict table.
9491 The default value of the parameter is 2000.
9492
9493 @item ira-loop-reserved-regs
9494 IRA can be used to evaluate more accurate register pressure in loops
9495 for decisions to move loop invariants (see @option{-O3}). The number
9496 of available registers reserved for some other purposes is given
9497 by this parameter. The default value of the parameter is 2, which is
9498 the minimal number of registers needed by typical instructions.
9499 This value is the best found from numerous experiments.
9500
9501 @item lra-inheritance-ebb-probability-cutoff
9502 LRA tries to reuse values reloaded in registers in subsequent insns.
9503 This optimization is called inheritance. EBB is used as a region to
9504 do this optimization. The parameter defines a minimal fall-through
9505 edge probability in percentage used to add BB to inheritance EBB in
9506 LRA. The default value of the parameter is 40. The value was chosen
9507 from numerous runs of SPEC2000 on x86-64.
9508
9509 @item loop-invariant-max-bbs-in-loop
9510 Loop invariant motion can be very expensive, both in compilation time and
9511 in amount of needed compile-time memory, with very large loops. Loops
9512 with more basic blocks than this parameter won't have loop invariant
9513 motion optimization performed on them. The default value of the
9514 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
9515
9516 @item loop-max-datarefs-for-datadeps
9517 Building data dependencies is expensive for very large loops. This
9518 parameter limits the number of data references in loops that are
9519 considered for data dependence analysis. These large loops are no
9520 handled by the optimizations using loop data dependencies.
9521 The default value is 1000.
9522
9523 @item max-vartrack-size
9524 Sets a maximum number of hash table slots to use during variable
9525 tracking dataflow analysis of any function. If this limit is exceeded
9526 with variable tracking at assignments enabled, analysis for that
9527 function is retried without it, after removing all debug insns from
9528 the function. If the limit is exceeded even without debug insns, var
9529 tracking analysis is completely disabled for the function. Setting
9530 the parameter to zero makes it unlimited.
9531
9532 @item max-vartrack-expr-depth
9533 Sets a maximum number of recursion levels when attempting to map
9534 variable names or debug temporaries to value expressions. This trades
9535 compilation time for more complete debug information. If this is set too
9536 low, value expressions that are available and could be represented in
9537 debug information may end up not being used; setting this higher may
9538 enable the compiler to find more complex debug expressions, but compile
9539 time and memory use may grow. The default is 12.
9540
9541 @item min-nondebug-insn-uid
9542 Use uids starting at this parameter for nondebug insns. The range below
9543 the parameter is reserved exclusively for debug insns created by
9544 @option{-fvar-tracking-assignments}, but debug insns may get
9545 (non-overlapping) uids above it if the reserved range is exhausted.
9546
9547 @item ipa-sra-ptr-growth-factor
9548 IPA-SRA replaces a pointer to an aggregate with one or more new
9549 parameters only when their cumulative size is less or equal to
9550 @option{ipa-sra-ptr-growth-factor} times the size of the original
9551 pointer parameter.
9552
9553 @item sra-max-scalarization-size-Ospeed
9554 @item sra-max-scalarization-size-Osize
9555 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
9556 replace scalar parts of aggregates with uses of independent scalar
9557 variables. These parameters control the maximum size, in storage units,
9558 of aggregate which is considered for replacement when compiling for
9559 speed
9560 (@option{sra-max-scalarization-size-Ospeed}) or size
9561 (@option{sra-max-scalarization-size-Osize}) respectively.
9562
9563 @item tm-max-aggregate-size
9564 When making copies of thread-local variables in a transaction, this
9565 parameter specifies the size in bytes after which variables are
9566 saved with the logging functions as opposed to save/restore code
9567 sequence pairs. This option only applies when using
9568 @option{-fgnu-tm}.
9569
9570 @item graphite-max-nb-scop-params
9571 To avoid exponential effects in the Graphite loop transforms, the
9572 number of parameters in a Static Control Part (SCoP) is bounded. The
9573 default value is 10 parameters. A variable whose value is unknown at
9574 compilation time and defined outside a SCoP is a parameter of the SCoP.
9575
9576 @item graphite-max-bbs-per-function
9577 To avoid exponential effects in the detection of SCoPs, the size of
9578 the functions analyzed by Graphite is bounded. The default value is
9579 100 basic blocks.
9580
9581 @item loop-block-tile-size
9582 Loop blocking or strip mining transforms, enabled with
9583 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
9584 loop in the loop nest by a given number of iterations. The strip
9585 length can be changed using the @option{loop-block-tile-size}
9586 parameter. The default value is 51 iterations.
9587
9588 @item loop-unroll-jam-size
9589 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
9590 default value is 4.
9591
9592 @item loop-unroll-jam-depth
9593 Specify the dimension to be unrolled (counting from the most inner loop)
9594 for the @option{-floop-unroll-and-jam}. The default value is 2.
9595
9596 @item ipa-cp-value-list-size
9597 IPA-CP attempts to track all possible values and types passed to a function's
9598 parameter in order to propagate them and perform devirtualization.
9599 @option{ipa-cp-value-list-size} is the maximum number of values and types it
9600 stores per one formal parameter of a function.
9601
9602 @item ipa-cp-eval-threshold
9603 IPA-CP calculates its own score of cloning profitability heuristics
9604 and performs those cloning opportunities with scores that exceed
9605 @option{ipa-cp-eval-threshold}.
9606
9607 @item ipa-cp-recursion-penalty
9608 Percentage penalty the recursive functions will receive when they
9609 are evaluated for cloning.
9610
9611 @item ipa-cp-single-call-penalty
9612 Percentage penalty functions containg a single call to another
9613 function will receive when they are evaluated for cloning.
9614
9615
9616 @item ipa-max-agg-items
9617 IPA-CP is also capable to propagate a number of scalar values passed
9618 in an aggregate. @option{ipa-max-agg-items} controls the maximum
9619 number of such values per one parameter.
9620
9621 @item ipa-cp-loop-hint-bonus
9622 When IPA-CP determines that a cloning candidate would make the number
9623 of iterations of a loop known, it adds a bonus of
9624 @option{ipa-cp-loop-hint-bonus} to the profitability score of
9625 the candidate.
9626
9627 @item ipa-cp-array-index-hint-bonus
9628 When IPA-CP determines that a cloning candidate would make the index of
9629 an array access known, it adds a bonus of
9630 @option{ipa-cp-array-index-hint-bonus} to the profitability
9631 score of the candidate.
9632
9633 @item ipa-max-aa-steps
9634 During its analysis of function bodies, IPA-CP employs alias analysis
9635 in order to track values pointed to by function parameters. In order
9636 not spend too much time analyzing huge functions, it gives up and
9637 consider all memory clobbered after examining
9638 @option{ipa-max-aa-steps} statements modifying memory.
9639
9640 @item lto-partitions
9641 Specify desired number of partitions produced during WHOPR compilation.
9642 The number of partitions should exceed the number of CPUs used for compilation.
9643 The default value is 32.
9644
9645 @item lto-min-partition
9646 Size of minimal partition for WHOPR (in estimated instructions).
9647 This prevents expenses of splitting very small programs into too many
9648 partitions.
9649
9650 @item lto-max-partition
9651 Size of max partition for WHOPR (in estimated instructions).
9652 to provide an upper bound for individual size of partition.
9653 Meant to be used only with balanced partitioning.
9654
9655 @item cxx-max-namespaces-for-diagnostic-help
9656 The maximum number of namespaces to consult for suggestions when C++
9657 name lookup fails for an identifier. The default is 1000.
9658
9659 @item sink-frequency-threshold
9660 The maximum relative execution frequency (in percents) of the target block
9661 relative to a statement's original block to allow statement sinking of a
9662 statement. Larger numbers result in more aggressive statement sinking.
9663 The default value is 75. A small positive adjustment is applied for
9664 statements with memory operands as those are even more profitable so sink.
9665
9666 @item max-stores-to-sink
9667 The maximum number of conditional store pairs that can be sunk. Set to 0
9668 if either vectorization (@option{-ftree-vectorize}) or if-conversion
9669 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
9670
9671 @item allow-store-data-races
9672 Allow optimizers to introduce new data races on stores.
9673 Set to 1 to allow, otherwise to 0. This option is enabled by default
9674 at optimization level @option{-Ofast}.
9675
9676 @item case-values-threshold
9677 The smallest number of different values for which it is best to use a
9678 jump-table instead of a tree of conditional branches. If the value is
9679 0, use the default for the machine. The default is 0.
9680
9681 @item tree-reassoc-width
9682 Set the maximum number of instructions executed in parallel in
9683 reassociated tree. This parameter overrides target dependent
9684 heuristics used by default if has non zero value.
9685
9686 @item sched-pressure-algorithm
9687 Choose between the two available implementations of
9688 @option{-fsched-pressure}. Algorithm 1 is the original implementation
9689 and is the more likely to prevent instructions from being reordered.
9690 Algorithm 2 was designed to be a compromise between the relatively
9691 conservative approach taken by algorithm 1 and the rather aggressive
9692 approach taken by the default scheduler. It relies more heavily on
9693 having a regular register file and accurate register pressure classes.
9694 See @file{haifa-sched.c} in the GCC sources for more details.
9695
9696 The default choice depends on the target.
9697
9698 @item max-slsr-cand-scan
9699 Set the maximum number of existing candidates that are considered when
9700 seeking a basis for a new straight-line strength reduction candidate.
9701
9702 @item asan-globals
9703 Enable buffer overflow detection for global objects. This kind
9704 of protection is enabled by default if you are using
9705 @option{-fsanitize=address} option.
9706 To disable global objects protection use @option{--param asan-globals=0}.
9707
9708 @item asan-stack
9709 Enable buffer overflow detection for stack objects. This kind of
9710 protection is enabled by default when using @option{-fsanitize=address}.
9711 To disable stack protection use @option{--param asan-stack=0} option.
9712
9713 @item asan-instrument-reads
9714 Enable buffer overflow detection for memory reads. This kind of
9715 protection is enabled by default when using @option{-fsanitize=address}.
9716 To disable memory reads protection use
9717 @option{--param asan-instrument-reads=0}.
9718
9719 @item asan-instrument-writes
9720 Enable buffer overflow detection for memory writes. This kind of
9721 protection is enabled by default when using @option{-fsanitize=address}.
9722 To disable memory writes protection use
9723 @option{--param asan-instrument-writes=0} option.
9724
9725 @item asan-memintrin
9726 Enable detection for built-in functions. This kind of protection
9727 is enabled by default when using @option{-fsanitize=address}.
9728 To disable built-in functions protection use
9729 @option{--param asan-memintrin=0}.
9730
9731 @item asan-use-after-return
9732 Enable detection of use-after-return. This kind of protection
9733 is enabled by default when using @option{-fsanitize=address} option.
9734 To disable use-after-return detection use
9735 @option{--param asan-use-after-return=0}.
9736
9737 @item asan-instrumentation-with-call-threshold
9738 If number of memory accesses in function being instrumented
9739 is greater or equal to this number, use callbacks instead of inline checks.
9740 E.g. to disable inline code use
9741 @option{--param asan-instrumentation-with-call-threshold=0}.
9742
9743 @item chkp-max-ctor-size
9744 Static constructors generated by Pointer Bounds Checker may become very
9745 large and significantly increase compile time at optimization level
9746 @option{-O1} and higher. This parameter is a maximum nubmer of statements
9747 in a single generated constructor. Default value is 5000.
9748
9749 @item max-fsm-thread-path-insns
9750 Maximum number of instructions to copy when duplicating blocks on a
9751 finite state automaton jump thread path. The default is 100.
9752
9753 @item max-fsm-thread-length
9754 Maximum number of basic blocks on a finite state automaton jump thread
9755 path. The default is 10.
9756
9757 @item max-fsm-thread-paths
9758 Maximum number of new jump thread paths to create for a finite state
9759 automaton. The default is 50.
9760
9761 @item parloops-chunk-size
9762 Chunk size of omp schedule for loops parallelized by parloops. The default
9763 is 0.
9764
9765 @item parloops-schedule
9766 Schedule type of omp schedule for loops parallelized by parloops (static,
9767 dynamic, guided, auto, runtime). The default is static.
9768
9769 @item max-ssa-name-query-depth
9770 Maximum depth of recursion when querying properties of SSA names in things
9771 like fold routines. One level of recursion corresponds to following a
9772 use-def chain.
9773
9774 @item hsa-gen-debug-stores
9775 Enable emission of special debug stores within HSA kernels which are
9776 then read and reported by libgomp plugin. Generation of these stores
9777 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
9778 enable it.
9779
9780 @item max-speculative-devirt-maydefs
9781 The maximum number of may-defs we analyze when looking for a must-def
9782 specifying the dynamic type of an object that invokes a virtual call
9783 we may be able to devirtualize speculatively.
9784
9785 @item max-vrp-switch-assertions
9786 The maximum number of assertions to add along the default edge of a switch
9787 statement during VRP. The default is 10.
9788 @end table
9789 @end table
9790
9791 @node Instrumentation Options
9792 @section Program Instrumentation Options
9793 @cindex instrumentation options
9794 @cindex program instrumentation options
9795 @cindex run-time error checking options
9796 @cindex profiling options
9797 @cindex options, program instrumentation
9798 @cindex options, run-time error checking
9799 @cindex options, profiling
9800
9801 GCC supports a number of command-line options that control adding
9802 run-time instrumentation to the code it normally generates.
9803 For example, one purpose of instrumentation is collect profiling
9804 statistics for use in finding program hot spots, code coverage
9805 analysis, or profile-guided optimizations.
9806 Another class of program instrumentation is adding run-time checking
9807 to detect programming errors like invalid pointer
9808 dereferences or out-of-bounds array accesses, as well as deliberately
9809 hostile attacks such as stack smashing or C++ vtable hijacking.
9810 There is also a general hook which can be used to implement other
9811 forms of tracing or function-level instrumentation for debug or
9812 program analysis purposes.
9813
9814 @table @gcctabopt
9815 @cindex @command{prof}
9816 @item -p
9817 @opindex p
9818 Generate extra code to write profile information suitable for the
9819 analysis program @command{prof}. You must use this option when compiling
9820 the source files you want data about, and you must also use it when
9821 linking.
9822
9823 @cindex @command{gprof}
9824 @item -pg
9825 @opindex pg
9826 Generate extra code to write profile information suitable for the
9827 analysis program @command{gprof}. You must use this option when compiling
9828 the source files you want data about, and you must also use it when
9829 linking.
9830
9831 @item -fprofile-arcs
9832 @opindex fprofile-arcs
9833 Add code so that program flow @dfn{arcs} are instrumented. During
9834 execution the program records how many times each branch and call is
9835 executed and how many times it is taken or returns. When the compiled
9836 program exits it saves this data to a file called
9837 @file{@var{auxname}.gcda} for each source file. The data may be used for
9838 profile-directed optimizations (@option{-fbranch-probabilities}), or for
9839 test coverage analysis (@option{-ftest-coverage}). Each object file's
9840 @var{auxname} is generated from the name of the output file, if
9841 explicitly specified and it is not the final executable, otherwise it is
9842 the basename of the source file. In both cases any suffix is removed
9843 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
9844 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
9845 @xref{Cross-profiling}.
9846
9847 @cindex @command{gcov}
9848 @item --coverage
9849 @opindex coverage
9850
9851 This option is used to compile and link code instrumented for coverage
9852 analysis. The option is a synonym for @option{-fprofile-arcs}
9853 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
9854 linking). See the documentation for those options for more details.
9855
9856 @itemize
9857
9858 @item
9859 Compile the source files with @option{-fprofile-arcs} plus optimization
9860 and code generation options. For test coverage analysis, use the
9861 additional @option{-ftest-coverage} option. You do not need to profile
9862 every source file in a program.
9863
9864 @item
9865 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
9866 (the latter implies the former).
9867
9868 @item
9869 Run the program on a representative workload to generate the arc profile
9870 information. This may be repeated any number of times. You can run
9871 concurrent instances of your program, and provided that the file system
9872 supports locking, the data files will be correctly updated. Also
9873 @code{fork} calls are detected and correctly handled (double counting
9874 will not happen).
9875
9876 @item
9877 For profile-directed optimizations, compile the source files again with
9878 the same optimization and code generation options plus
9879 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
9880 Control Optimization}).
9881
9882 @item
9883 For test coverage analysis, use @command{gcov} to produce human readable
9884 information from the @file{.gcno} and @file{.gcda} files. Refer to the
9885 @command{gcov} documentation for further information.
9886
9887 @end itemize
9888
9889 With @option{-fprofile-arcs}, for each function of your program GCC
9890 creates a program flow graph, then finds a spanning tree for the graph.
9891 Only arcs that are not on the spanning tree have to be instrumented: the
9892 compiler adds code to count the number of times that these arcs are
9893 executed. When an arc is the only exit or only entrance to a block, the
9894 instrumentation code can be added to the block; otherwise, a new basic
9895 block must be created to hold the instrumentation code.
9896
9897 @need 2000
9898 @item -ftest-coverage
9899 @opindex ftest-coverage
9900 Produce a notes file that the @command{gcov} code-coverage utility
9901 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
9902 show program coverage. Each source file's note file is called
9903 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
9904 above for a description of @var{auxname} and instructions on how to
9905 generate test coverage data. Coverage data matches the source files
9906 more closely if you do not optimize.
9907
9908 @item -fprofile-dir=@var{path}
9909 @opindex fprofile-dir
9910
9911 Set the directory to search for the profile data files in to @var{path}.
9912 This option affects only the profile data generated by
9913 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
9914 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
9915 and its related options. Both absolute and relative paths can be used.
9916 By default, GCC uses the current directory as @var{path}, thus the
9917 profile data file appears in the same directory as the object file.
9918
9919 @item -fprofile-generate
9920 @itemx -fprofile-generate=@var{path}
9921 @opindex fprofile-generate
9922
9923 Enable options usually used for instrumenting application to produce
9924 profile useful for later recompilation with profile feedback based
9925 optimization. You must use @option{-fprofile-generate} both when
9926 compiling and when linking your program.
9927
9928 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
9929
9930 If @var{path} is specified, GCC looks at the @var{path} to find
9931 the profile feedback data files. See @option{-fprofile-dir}.
9932
9933 To optimize the program based on the collected profile information, use
9934 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
9935
9936 @item -fprofile-update=@var{method}
9937 @opindex fprofile-update
9938
9939 Alter the update method for an application instrumented for profile
9940 feedback based optimization. The @var{method} argument should be one of
9941 @samp{single} or @samp{atomic}. The first one is useful for single-threaded
9942 applications, while the second one prevents profile corruption by emitting
9943 thread-safe code.
9944
9945 @strong{Warning:} When an application does not properly join all threads
9946 (or creates an detached thread), a profile file can be still corrupted.
9947
9948 @item -fsanitize=address
9949 @opindex fsanitize=address
9950 Enable AddressSanitizer, a fast memory error detector.
9951 Memory access instructions are instrumented to detect
9952 out-of-bounds and use-after-free bugs.
9953 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
9954 more details. The run-time behavior can be influenced using the
9955 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
9956 the available options are shown at startup of the instrumented program. See
9957 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
9958 for a list of supported options.
9959
9960 @item -fsanitize=kernel-address
9961 @opindex fsanitize=kernel-address
9962 Enable AddressSanitizer for Linux kernel.
9963 See @uref{https://github.com/google/kasan/wiki} for more details.
9964
9965 @item -fsanitize=thread
9966 @opindex fsanitize=thread
9967 Enable ThreadSanitizer, a fast data race detector.
9968 Memory access instructions are instrumented to detect
9969 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
9970 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
9971 environment variable; see
9972 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
9973 supported options.
9974
9975 @item -fsanitize=leak
9976 @opindex fsanitize=leak
9977 Enable LeakSanitizer, a memory leak detector.
9978 This option only matters for linking of executables and if neither
9979 @option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that
9980 case the executable is linked against a library that overrides @code{malloc}
9981 and other allocator functions. See
9982 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
9983 details. The run-time behavior can be influenced using the
9984 @env{LSAN_OPTIONS} environment variable.
9985
9986 @item -fsanitize=undefined
9987 @opindex fsanitize=undefined
9988 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
9989 Various computations are instrumented to detect undefined behavior
9990 at runtime. Current suboptions are:
9991
9992 @table @gcctabopt
9993
9994 @item -fsanitize=shift
9995 @opindex fsanitize=shift
9996 This option enables checking that the result of a shift operation is
9997 not undefined. Note that what exactly is considered undefined differs
9998 slightly between C and C++, as well as between ISO C90 and C99, etc.
9999
10000 @item -fsanitize=integer-divide-by-zero
10001 @opindex fsanitize=integer-divide-by-zero
10002 Detect integer division by zero as well as @code{INT_MIN / -1} division.
10003
10004 @item -fsanitize=unreachable
10005 @opindex fsanitize=unreachable
10006 With this option, the compiler turns the @code{__builtin_unreachable}
10007 call into a diagnostics message call instead. When reaching the
10008 @code{__builtin_unreachable} call, the behavior is undefined.
10009
10010 @item -fsanitize=vla-bound
10011 @opindex fsanitize=vla-bound
10012 This option instructs the compiler to check that the size of a variable
10013 length array is positive.
10014
10015 @item -fsanitize=null
10016 @opindex fsanitize=null
10017 This option enables pointer checking. Particularly, the application
10018 built with this option turned on will issue an error message when it
10019 tries to dereference a NULL pointer, or if a reference (possibly an
10020 rvalue reference) is bound to a NULL pointer, or if a method is invoked
10021 on an object pointed by a NULL pointer.
10022
10023 @item -fsanitize=return
10024 @opindex fsanitize=return
10025 This option enables return statement checking. Programs
10026 built with this option turned on will issue an error message
10027 when the end of a non-void function is reached without actually
10028 returning a value. This option works in C++ only.
10029
10030 @item -fsanitize=signed-integer-overflow
10031 @opindex fsanitize=signed-integer-overflow
10032 This option enables signed integer overflow checking. We check that
10033 the result of @code{+}, @code{*}, and both unary and binary @code{-}
10034 does not overflow in the signed arithmetics. Note, integer promotion
10035 rules must be taken into account. That is, the following is not an
10036 overflow:
10037 @smallexample
10038 signed char a = SCHAR_MAX;
10039 a++;
10040 @end smallexample
10041
10042 @item -fsanitize=bounds
10043 @opindex fsanitize=bounds
10044 This option enables instrumentation of array bounds. Various out of bounds
10045 accesses are detected. Flexible array members, flexible array member-like
10046 arrays, and initializers of variables with static storage are not instrumented.
10047
10048 @item -fsanitize=bounds-strict
10049 @opindex fsanitize=bounds-strict
10050 This option enables strict instrumentation of array bounds. Most out of bounds
10051 accesses are detected, including flexible array members and flexible array
10052 member-like arrays. Initializers of variables with static storage are not
10053 instrumented.
10054
10055 @item -fsanitize=alignment
10056 @opindex fsanitize=alignment
10057
10058 This option enables checking of alignment of pointers when they are
10059 dereferenced, or when a reference is bound to insufficiently aligned target,
10060 or when a method or constructor is invoked on insufficiently aligned object.
10061
10062 @item -fsanitize=object-size
10063 @opindex fsanitize=object-size
10064 This option enables instrumentation of memory references using the
10065 @code{__builtin_object_size} function. Various out of bounds pointer
10066 accesses are detected.
10067
10068 @item -fsanitize=float-divide-by-zero
10069 @opindex fsanitize=float-divide-by-zero
10070 Detect floating-point division by zero. Unlike other similar options,
10071 @option{-fsanitize=float-divide-by-zero} is not enabled by
10072 @option{-fsanitize=undefined}, since floating-point division by zero can
10073 be a legitimate way of obtaining infinities and NaNs.
10074
10075 @item -fsanitize=float-cast-overflow
10076 @opindex fsanitize=float-cast-overflow
10077 This option enables floating-point type to integer conversion checking.
10078 We check that the result of the conversion does not overflow.
10079 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
10080 not enabled by @option{-fsanitize=undefined}.
10081 This option does not work well with @code{FE_INVALID} exceptions enabled.
10082
10083 @item -fsanitize=nonnull-attribute
10084 @opindex fsanitize=nonnull-attribute
10085
10086 This option enables instrumentation of calls, checking whether null values
10087 are not passed to arguments marked as requiring a non-null value by the
10088 @code{nonnull} function attribute.
10089
10090 @item -fsanitize=returns-nonnull-attribute
10091 @opindex fsanitize=returns-nonnull-attribute
10092
10093 This option enables instrumentation of return statements in functions
10094 marked with @code{returns_nonnull} function attribute, to detect returning
10095 of null values from such functions.
10096
10097 @item -fsanitize=bool
10098 @opindex fsanitize=bool
10099
10100 This option enables instrumentation of loads from bool. If a value other
10101 than 0/1 is loaded, a run-time error is issued.
10102
10103 @item -fsanitize=enum
10104 @opindex fsanitize=enum
10105
10106 This option enables instrumentation of loads from an enum type. If
10107 a value outside the range of values for the enum type is loaded,
10108 a run-time error is issued.
10109
10110 @item -fsanitize=vptr
10111 @opindex fsanitize=vptr
10112
10113 This option enables instrumentation of C++ member function calls, member
10114 accesses and some conversions between pointers to base and derived classes,
10115 to verify the referenced object has the correct dynamic type.
10116
10117 @end table
10118
10119 While @option{-ftrapv} causes traps for signed overflows to be emitted,
10120 @option{-fsanitize=undefined} gives a diagnostic message.
10121 This currently works only for the C family of languages.
10122
10123 @item -fno-sanitize=all
10124 @opindex fno-sanitize=all
10125
10126 This option disables all previously enabled sanitizers.
10127 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
10128 together.
10129
10130 @item -fasan-shadow-offset=@var{number}
10131 @opindex fasan-shadow-offset
10132 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
10133 It is useful for experimenting with different shadow memory layouts in
10134 Kernel AddressSanitizer.
10135
10136 @item -fsanitize-sections=@var{s1},@var{s2},...
10137 @opindex fsanitize-sections
10138 Sanitize global variables in selected user-defined sections. @var{si} may
10139 contain wildcards.
10140
10141 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
10142 @opindex fsanitize-recover
10143 @opindex fno-sanitize-recover
10144 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
10145 mentioned in comma-separated list of @var{opts}. Enabling this option
10146 for a sanitizer component causes it to attempt to continue
10147 running the program as if no error happened. This means multiple
10148 runtime errors can be reported in a single program run, and the exit
10149 code of the program may indicate success even when errors
10150 have been reported. The @option{-fno-sanitize-recover=} option
10151 can be used to alter
10152 this behavior: only the first detected error is reported
10153 and program then exits with a non-zero exit code.
10154
10155 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
10156 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
10157 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
10158 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
10159 For these sanitizers error recovery is turned on by default, except @option{-fsanitize=address},
10160 for which this feature is experimental.
10161 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
10162 accepted, the former enables recovery for all sanitizers that support it,
10163 the latter disables recovery for all sanitizers that support it.
10164
10165 Even if a recovery mode is turned on the compiler side, it needs to be also
10166 enabled on the runtime library side, otherwise the failures are still fatal.
10167 The runtime library defaults to @code{halt_on_error=0} for
10168 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
10169 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
10170 setting the @code{halt_on_error} flag in the corresponding environment variable.
10171
10172 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
10173 @smallexample
10174 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10175 @end smallexample
10176 @noindent
10177 Similarly @option{-fno-sanitize-recover} is equivalent to
10178 @smallexample
10179 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10180 @end smallexample
10181
10182 @item -fsanitize-undefined-trap-on-error
10183 @opindex fsanitize-undefined-trap-on-error
10184 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
10185 report undefined behavior using @code{__builtin_trap} rather than
10186 a @code{libubsan} library routine. The advantage of this is that the
10187 @code{libubsan} library is not needed and is not linked in, so this
10188 is usable even in freestanding environments.
10189
10190 @item -fsanitize-coverage=trace-pc
10191 @opindex fsanitize-coverage=trace-pc
10192 Enable coverage-guided fuzzing code instrumentation.
10193 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
10194
10195 @item -fbounds-check
10196 @opindex fbounds-check
10197 For front ends that support it, generate additional code to check that
10198 indices used to access arrays are within the declared range. This is
10199 currently only supported by the Java and Fortran front ends, where
10200 this option defaults to true and false respectively.
10201
10202 @item -fcheck-pointer-bounds
10203 @opindex fcheck-pointer-bounds
10204 @opindex fno-check-pointer-bounds
10205 @cindex Pointer Bounds Checker options
10206 Enable Pointer Bounds Checker instrumentation. Each memory reference
10207 is instrumented with checks of the pointer used for memory access against
10208 bounds associated with that pointer.
10209
10210 Currently there
10211 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
10212 and @option{-mmpx} are required to enable this feature.
10213 MPX-based instrumentation requires
10214 a runtime library to enable MPX in hardware and handle bounds
10215 violation signals. By default when @option{-fcheck-pointer-bounds}
10216 and @option{-mmpx} options are used to link a program, the GCC driver
10217 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
10218 Bounds checking on calls to dynamic libraries requires a linker
10219 with @option{-z bndplt} support; if GCC was configured with a linker
10220 without support for this option (including the Gold linker and older
10221 versions of ld), a warning is given if you link with @option{-mmpx}
10222 without also specifying @option{-static}, since the overall effectiveness
10223 of the bounds checking protection is reduced.
10224 See also @option{-static-libmpxwrappers}.
10225
10226 MPX-based instrumentation
10227 may be used for debugging and also may be included in production code
10228 to increase program security. Depending on usage, you may
10229 have different requirements for the runtime library. The current version
10230 of the MPX runtime library is more oriented for use as a debugging
10231 tool. MPX runtime library usage implies @option{-lpthread}. See
10232 also @option{-static-libmpx}. The runtime library behavior can be
10233 influenced using various @env{CHKP_RT_*} environment variables. See
10234 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
10235 for more details.
10236
10237 Generated instrumentation may be controlled by various
10238 @option{-fchkp-*} options and by the @code{bnd_variable_size}
10239 structure field attribute (@pxref{Type Attributes}) and
10240 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
10241 (@pxref{Function Attributes}). GCC also provides a number of built-in
10242 functions for controlling the Pointer Bounds Checker. @xref{Pointer
10243 Bounds Checker builtins}, for more information.
10244
10245 @item -fchkp-check-incomplete-type
10246 @opindex fchkp-check-incomplete-type
10247 @opindex fno-chkp-check-incomplete-type
10248 Generate pointer bounds checks for variables with incomplete type.
10249 Enabled by default.
10250
10251 @item -fchkp-narrow-bounds
10252 @opindex fchkp-narrow-bounds
10253 @opindex fno-chkp-narrow-bounds
10254 Controls bounds used by Pointer Bounds Checker for pointers to object
10255 fields. If narrowing is enabled then field bounds are used. Otherwise
10256 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
10257 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
10258
10259 @item -fchkp-first-field-has-own-bounds
10260 @opindex fchkp-first-field-has-own-bounds
10261 @opindex fno-chkp-first-field-has-own-bounds
10262 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
10263 first field in the structure. By default a pointer to the first field has
10264 the same bounds as a pointer to the whole structure.
10265
10266 @item -fchkp-narrow-to-innermost-array
10267 @opindex fchkp-narrow-to-innermost-array
10268 @opindex fno-chkp-narrow-to-innermost-array
10269 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
10270 case of nested static array access. By default this option is disabled and
10271 bounds of the outermost array are used.
10272
10273 @item -fchkp-optimize
10274 @opindex fchkp-optimize
10275 @opindex fno-chkp-optimize
10276 Enables Pointer Bounds Checker optimizations. Enabled by default at
10277 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
10278
10279 @item -fchkp-use-fast-string-functions
10280 @opindex fchkp-use-fast-string-functions
10281 @opindex fno-chkp-use-fast-string-functions
10282 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
10283 by Pointer Bounds Checker. Disabled by default.
10284
10285 @item -fchkp-use-nochk-string-functions
10286 @opindex fchkp-use-nochk-string-functions
10287 @opindex fno-chkp-use-nochk-string-functions
10288 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
10289 by Pointer Bounds Checker. Disabled by default.
10290
10291 @item -fchkp-use-static-bounds
10292 @opindex fchkp-use-static-bounds
10293 @opindex fno-chkp-use-static-bounds
10294 Allow Pointer Bounds Checker to generate static bounds holding
10295 bounds of static variables. Enabled by default.
10296
10297 @item -fchkp-use-static-const-bounds
10298 @opindex fchkp-use-static-const-bounds
10299 @opindex fno-chkp-use-static-const-bounds
10300 Use statically-initialized bounds for constant bounds instead of
10301 generating them each time they are required. By default enabled when
10302 @option{-fchkp-use-static-bounds} is enabled.
10303
10304 @item -fchkp-treat-zero-dynamic-size-as-infinite
10305 @opindex fchkp-treat-zero-dynamic-size-as-infinite
10306 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
10307 With this option, objects with incomplete type whose
10308 dynamically-obtained size is zero are treated as having infinite size
10309 instead by Pointer Bounds
10310 Checker. This option may be helpful if a program is linked with a library
10311 missing size information for some symbols. Disabled by default.
10312
10313 @item -fchkp-check-read
10314 @opindex fchkp-check-read
10315 @opindex fno-chkp-check-read
10316 Instructs Pointer Bounds Checker to generate checks for all read
10317 accesses to memory. Enabled by default.
10318
10319 @item -fchkp-check-write
10320 @opindex fchkp-check-write
10321 @opindex fno-chkp-check-write
10322 Instructs Pointer Bounds Checker to generate checks for all write
10323 accesses to memory. Enabled by default.
10324
10325 @item -fchkp-store-bounds
10326 @opindex fchkp-store-bounds
10327 @opindex fno-chkp-store-bounds
10328 Instructs Pointer Bounds Checker to generate bounds stores for
10329 pointer writes. Enabled by default.
10330
10331 @item -fchkp-instrument-calls
10332 @opindex fchkp-instrument-calls
10333 @opindex fno-chkp-instrument-calls
10334 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
10335 Enabled by default.
10336
10337 @item -fchkp-instrument-marked-only
10338 @opindex fchkp-instrument-marked-only
10339 @opindex fno-chkp-instrument-marked-only
10340 Instructs Pointer Bounds Checker to instrument only functions
10341 marked with the @code{bnd_instrument} attribute
10342 (@pxref{Function Attributes}). Disabled by default.
10343
10344 @item -fchkp-use-wrappers
10345 @opindex fchkp-use-wrappers
10346 @opindex fno-chkp-use-wrappers
10347 Allows Pointer Bounds Checker to replace calls to built-in functions
10348 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
10349 is used to link a program, the GCC driver automatically links
10350 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
10351 Enabled by default.
10352
10353 @item -fstack-protector
10354 @opindex fstack-protector
10355 Emit extra code to check for buffer overflows, such as stack smashing
10356 attacks. This is done by adding a guard variable to functions with
10357 vulnerable objects. This includes functions that call @code{alloca}, and
10358 functions with buffers larger than 8 bytes. The guards are initialized
10359 when a function is entered and then checked when the function exits.
10360 If a guard check fails, an error message is printed and the program exits.
10361
10362 @item -fstack-protector-all
10363 @opindex fstack-protector-all
10364 Like @option{-fstack-protector} except that all functions are protected.
10365
10366 @item -fstack-protector-strong
10367 @opindex fstack-protector-strong
10368 Like @option{-fstack-protector} but includes additional functions to
10369 be protected --- those that have local array definitions, or have
10370 references to local frame addresses.
10371
10372 @item -fstack-protector-explicit
10373 @opindex fstack-protector-explicit
10374 Like @option{-fstack-protector} but only protects those functions which
10375 have the @code{stack_protect} attribute.
10376
10377 @item -fstack-check
10378 @opindex fstack-check
10379 Generate code to verify that you do not go beyond the boundary of the
10380 stack. You should specify this flag if you are running in an
10381 environment with multiple threads, but you only rarely need to specify it in
10382 a single-threaded environment since stack overflow is automatically
10383 detected on nearly all systems if there is only one stack.
10384
10385 Note that this switch does not actually cause checking to be done; the
10386 operating system or the language runtime must do that. The switch causes
10387 generation of code to ensure that they see the stack being extended.
10388
10389 You can additionally specify a string parameter: @samp{no} means no
10390 checking, @samp{generic} means force the use of old-style checking,
10391 @samp{specific} means use the best checking method and is equivalent
10392 to bare @option{-fstack-check}.
10393
10394 Old-style checking is a generic mechanism that requires no specific
10395 target support in the compiler but comes with the following drawbacks:
10396
10397 @enumerate
10398 @item
10399 Modified allocation strategy for large objects: they are always
10400 allocated dynamically if their size exceeds a fixed threshold.
10401
10402 @item
10403 Fixed limit on the size of the static frame of functions: when it is
10404 topped by a particular function, stack checking is not reliable and
10405 a warning is issued by the compiler.
10406
10407 @item
10408 Inefficiency: because of both the modified allocation strategy and the
10409 generic implementation, code performance is hampered.
10410 @end enumerate
10411
10412 Note that old-style stack checking is also the fallback method for
10413 @samp{specific} if no target support has been added in the compiler.
10414
10415 @item -fstack-limit-register=@var{reg}
10416 @itemx -fstack-limit-symbol=@var{sym}
10417 @itemx -fno-stack-limit
10418 @opindex fstack-limit-register
10419 @opindex fstack-limit-symbol
10420 @opindex fno-stack-limit
10421 Generate code to ensure that the stack does not grow beyond a certain value,
10422 either the value of a register or the address of a symbol. If a larger
10423 stack is required, a signal is raised at run time. For most targets,
10424 the signal is raised before the stack overruns the boundary, so
10425 it is possible to catch the signal without taking special precautions.
10426
10427 For instance, if the stack starts at absolute address @samp{0x80000000}
10428 and grows downwards, you can use the flags
10429 @option{-fstack-limit-symbol=__stack_limit} and
10430 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10431 of 128KB@. Note that this may only work with the GNU linker.
10432
10433 You can locally override stack limit checking by using the
10434 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
10435
10436 @item -fsplit-stack
10437 @opindex fsplit-stack
10438 Generate code to automatically split the stack before it overflows.
10439 The resulting program has a discontiguous stack which can only
10440 overflow if the program is unable to allocate any more memory. This
10441 is most useful when running threaded programs, as it is no longer
10442 necessary to calculate a good stack size to use for each thread. This
10443 is currently only implemented for the x86 targets running
10444 GNU/Linux.
10445
10446 When code compiled with @option{-fsplit-stack} calls code compiled
10447 without @option{-fsplit-stack}, there may not be much stack space
10448 available for the latter code to run. If compiling all code,
10449 including library code, with @option{-fsplit-stack} is not an option,
10450 then the linker can fix up these calls so that the code compiled
10451 without @option{-fsplit-stack} always has a large stack. Support for
10452 this is implemented in the gold linker in GNU binutils release 2.21
10453 and later.
10454
10455 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
10456 @opindex fvtable-verify
10457 This option is only available when compiling C++ code.
10458 It turns on (or off, if using @option{-fvtable-verify=none}) the security
10459 feature that verifies at run time, for every virtual call, that
10460 the vtable pointer through which the call is made is valid for the type of
10461 the object, and has not been corrupted or overwritten. If an invalid vtable
10462 pointer is detected at run time, an error is reported and execution of the
10463 program is immediately halted.
10464
10465 This option causes run-time data structures to be built at program startup,
10466 which are used for verifying the vtable pointers.
10467 The options @samp{std} and @samp{preinit}
10468 control the timing of when these data structures are built. In both cases the
10469 data structures are built before execution reaches @code{main}. Using
10470 @option{-fvtable-verify=std} causes the data structures to be built after
10471 shared libraries have been loaded and initialized.
10472 @option{-fvtable-verify=preinit} causes them to be built before shared
10473 libraries have been loaded and initialized.
10474
10475 If this option appears multiple times in the command line with different
10476 values specified, @samp{none} takes highest priority over both @samp{std} and
10477 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
10478
10479 @item -fvtv-debug
10480 @opindex fvtv-debug
10481 When used in conjunction with @option{-fvtable-verify=std} or
10482 @option{-fvtable-verify=preinit}, causes debug versions of the
10483 runtime functions for the vtable verification feature to be called.
10484 This flag also causes the compiler to log information about which
10485 vtable pointers it finds for each class.
10486 This information is written to a file named @file{vtv_set_ptr_data.log}
10487 in the directory named by the environment variable @env{VTV_LOGS_DIR}
10488 if that is defined or the current working directory otherwise.
10489
10490 Note: This feature @emph{appends} data to the log file. If you want a fresh log
10491 file, be sure to delete any existing one.
10492
10493 @item -fvtv-counts
10494 @opindex fvtv-counts
10495 This is a debugging flag. When used in conjunction with
10496 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
10497 causes the compiler to keep track of the total number of virtual calls
10498 it encounters and the number of verifications it inserts. It also
10499 counts the number of calls to certain run-time library functions
10500 that it inserts and logs this information for each compilation unit.
10501 The compiler writes this information to a file named
10502 @file{vtv_count_data.log} in the directory named by the environment
10503 variable @env{VTV_LOGS_DIR} if that is defined or the current working
10504 directory otherwise. It also counts the size of the vtable pointer sets
10505 for each class, and writes this information to @file{vtv_class_set_sizes.log}
10506 in the same directory.
10507
10508 Note: This feature @emph{appends} data to the log files. To get fresh log
10509 files, be sure to delete any existing ones.
10510
10511 @item -finstrument-functions
10512 @opindex finstrument-functions
10513 Generate instrumentation calls for entry and exit to functions. Just
10514 after function entry and just before function exit, the following
10515 profiling functions are called with the address of the current
10516 function and its call site. (On some platforms,
10517 @code{__builtin_return_address} does not work beyond the current
10518 function, so the call site information may not be available to the
10519 profiling functions otherwise.)
10520
10521 @smallexample
10522 void __cyg_profile_func_enter (void *this_fn,
10523 void *call_site);
10524 void __cyg_profile_func_exit (void *this_fn,
10525 void *call_site);
10526 @end smallexample
10527
10528 The first argument is the address of the start of the current function,
10529 which may be looked up exactly in the symbol table.
10530
10531 This instrumentation is also done for functions expanded inline in other
10532 functions. The profiling calls indicate where, conceptually, the
10533 inline function is entered and exited. This means that addressable
10534 versions of such functions must be available. If all your uses of a
10535 function are expanded inline, this may mean an additional expansion of
10536 code size. If you use @code{extern inline} in your C code, an
10537 addressable version of such functions must be provided. (This is
10538 normally the case anyway, but if you get lucky and the optimizer always
10539 expands the functions inline, you might have gotten away without
10540 providing static copies.)
10541
10542 A function may be given the attribute @code{no_instrument_function}, in
10543 which case this instrumentation is not done. This can be used, for
10544 example, for the profiling functions listed above, high-priority
10545 interrupt routines, and any functions from which the profiling functions
10546 cannot safely be called (perhaps signal handlers, if the profiling
10547 routines generate output or allocate memory).
10548
10549 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
10550 @opindex finstrument-functions-exclude-file-list
10551
10552 Set the list of functions that are excluded from instrumentation (see
10553 the description of @option{-finstrument-functions}). If the file that
10554 contains a function definition matches with one of @var{file}, then
10555 that function is not instrumented. The match is done on substrings:
10556 if the @var{file} parameter is a substring of the file name, it is
10557 considered to be a match.
10558
10559 For example:
10560
10561 @smallexample
10562 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
10563 @end smallexample
10564
10565 @noindent
10566 excludes any inline function defined in files whose pathnames
10567 contain @file{/bits/stl} or @file{include/sys}.
10568
10569 If, for some reason, you want to include letter @samp{,} in one of
10570 @var{sym}, write @samp{\,}. For example,
10571 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
10572 (note the single quote surrounding the option).
10573
10574 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
10575 @opindex finstrument-functions-exclude-function-list
10576
10577 This is similar to @option{-finstrument-functions-exclude-file-list},
10578 but this option sets the list of function names to be excluded from
10579 instrumentation. The function name to be matched is its user-visible
10580 name, such as @code{vector<int> blah(const vector<int> &)}, not the
10581 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
10582 match is done on substrings: if the @var{sym} parameter is a substring
10583 of the function name, it is considered to be a match. For C99 and C++
10584 extended identifiers, the function name must be given in UTF-8, not
10585 using universal character names.
10586
10587 @end table
10588
10589
10590 @node Preprocessor Options
10591 @section Options Controlling the Preprocessor
10592 @cindex preprocessor options
10593 @cindex options, preprocessor
10594
10595 These options control the C preprocessor, which is run on each C source
10596 file before actual compilation.
10597
10598 If you use the @option{-E} option, nothing is done except preprocessing.
10599 Some of these options make sense only together with @option{-E} because
10600 they cause the preprocessor output to be unsuitable for actual
10601 compilation.
10602
10603 @table @gcctabopt
10604 @item -Wp,@var{option}
10605 @opindex Wp
10606 You can use @option{-Wp,@var{option}} to bypass the compiler driver
10607 and pass @var{option} directly through to the preprocessor. If
10608 @var{option} contains commas, it is split into multiple options at the
10609 commas. However, many options are modified, translated or interpreted
10610 by the compiler driver before being passed to the preprocessor, and
10611 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
10612 interface is undocumented and subject to change, so whenever possible
10613 you should avoid using @option{-Wp} and let the driver handle the
10614 options instead.
10615
10616 @item -Xpreprocessor @var{option}
10617 @opindex Xpreprocessor
10618 Pass @var{option} as an option to the preprocessor. You can use this to
10619 supply system-specific preprocessor options that GCC does not
10620 recognize.
10621
10622 If you want to pass an option that takes an argument, you must use
10623 @option{-Xpreprocessor} twice, once for the option and once for the argument.
10624
10625 @item -no-integrated-cpp
10626 @opindex no-integrated-cpp
10627 Perform preprocessing as a separate pass before compilation.
10628 By default, GCC performs preprocessing as an integrated part of
10629 input tokenization and parsing.
10630 If this option is provided, the appropriate language front end
10631 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
10632 and Objective-C, respectively) is instead invoked twice,
10633 once for preprocessing only and once for actual compilation
10634 of the preprocessed input.
10635 This option may be useful in conjunction with the @option{-B} or
10636 @option{-wrapper} options to specify an alternate preprocessor or
10637 perform additional processing of the program source between
10638 normal preprocessing and compilation.
10639 @end table
10640
10641 @include cppopts.texi
10642
10643 @node Assembler Options
10644 @section Passing Options to the Assembler
10645
10646 @c prevent bad page break with this line
10647 You can pass options to the assembler.
10648
10649 @table @gcctabopt
10650 @item -Wa,@var{option}
10651 @opindex Wa
10652 Pass @var{option} as an option to the assembler. If @var{option}
10653 contains commas, it is split into multiple options at the commas.
10654
10655 @item -Xassembler @var{option}
10656 @opindex Xassembler
10657 Pass @var{option} as an option to the assembler. You can use this to
10658 supply system-specific assembler options that GCC does not
10659 recognize.
10660
10661 If you want to pass an option that takes an argument, you must use
10662 @option{-Xassembler} twice, once for the option and once for the argument.
10663
10664 @end table
10665
10666 @node Link Options
10667 @section Options for Linking
10668 @cindex link options
10669 @cindex options, linking
10670
10671 These options come into play when the compiler links object files into
10672 an executable output file. They are meaningless if the compiler is
10673 not doing a link step.
10674
10675 @table @gcctabopt
10676 @cindex file names
10677 @item @var{object-file-name}
10678 A file name that does not end in a special recognized suffix is
10679 considered to name an object file or library. (Object files are
10680 distinguished from libraries by the linker according to the file
10681 contents.) If linking is done, these object files are used as input
10682 to the linker.
10683
10684 @item -c
10685 @itemx -S
10686 @itemx -E
10687 @opindex c
10688 @opindex S
10689 @opindex E
10690 If any of these options is used, then the linker is not run, and
10691 object file names should not be used as arguments. @xref{Overall
10692 Options}.
10693
10694 @item -fuse-ld=bfd
10695 @opindex fuse-ld=bfd
10696 Use the @command{bfd} linker instead of the default linker.
10697
10698 @item -fuse-ld=gold
10699 @opindex fuse-ld=gold
10700 Use the @command{gold} linker instead of the default linker.
10701
10702 @cindex Libraries
10703 @item -l@var{library}
10704 @itemx -l @var{library}
10705 @opindex l
10706 Search the library named @var{library} when linking. (The second
10707 alternative with the library as a separate argument is only for
10708 POSIX compliance and is not recommended.)
10709
10710 It makes a difference where in the command you write this option; the
10711 linker searches and processes libraries and object files in the order they
10712 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
10713 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
10714 to functions in @samp{z}, those functions may not be loaded.
10715
10716 The linker searches a standard list of directories for the library,
10717 which is actually a file named @file{lib@var{library}.a}. The linker
10718 then uses this file as if it had been specified precisely by name.
10719
10720 The directories searched include several standard system directories
10721 plus any that you specify with @option{-L}.
10722
10723 Normally the files found this way are library files---archive files
10724 whose members are object files. The linker handles an archive file by
10725 scanning through it for members which define symbols that have so far
10726 been referenced but not defined. But if the file that is found is an
10727 ordinary object file, it is linked in the usual fashion. The only
10728 difference between using an @option{-l} option and specifying a file name
10729 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
10730 and searches several directories.
10731
10732 @item -lobjc
10733 @opindex lobjc
10734 You need this special case of the @option{-l} option in order to
10735 link an Objective-C or Objective-C++ program.
10736
10737 @item -nostartfiles
10738 @opindex nostartfiles
10739 Do not use the standard system startup files when linking.
10740 The standard system libraries are used normally, unless @option{-nostdlib}
10741 or @option{-nodefaultlibs} is used.
10742
10743 @item -nodefaultlibs
10744 @opindex nodefaultlibs
10745 Do not use the standard system libraries when linking.
10746 Only the libraries you specify are passed to the linker, and options
10747 specifying linkage of the system libraries, such as @option{-static-libgcc}
10748 or @option{-shared-libgcc}, are ignored.
10749 The standard startup files are used normally, unless @option{-nostartfiles}
10750 is used.
10751
10752 The compiler may generate calls to @code{memcmp},
10753 @code{memset}, @code{memcpy} and @code{memmove}.
10754 These entries are usually resolved by entries in
10755 libc. These entry points should be supplied through some other
10756 mechanism when this option is specified.
10757
10758 @item -nostdlib
10759 @opindex nostdlib
10760 Do not use the standard system startup files or libraries when linking.
10761 No startup files and only the libraries you specify are passed to
10762 the linker, and options specifying linkage of the system libraries, such as
10763 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
10764
10765 The compiler may generate calls to @code{memcmp}, @code{memset},
10766 @code{memcpy} and @code{memmove}.
10767 These entries are usually resolved by entries in
10768 libc. These entry points should be supplied through some other
10769 mechanism when this option is specified.
10770
10771 @cindex @option{-lgcc}, use with @option{-nostdlib}
10772 @cindex @option{-nostdlib} and unresolved references
10773 @cindex unresolved references and @option{-nostdlib}
10774 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
10775 @cindex @option{-nodefaultlibs} and unresolved references
10776 @cindex unresolved references and @option{-nodefaultlibs}
10777 One of the standard libraries bypassed by @option{-nostdlib} and
10778 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
10779 which GCC uses to overcome shortcomings of particular machines, or special
10780 needs for some languages.
10781 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
10782 Collection (GCC) Internals},
10783 for more discussion of @file{libgcc.a}.)
10784 In most cases, you need @file{libgcc.a} even when you want to avoid
10785 other standard libraries. In other words, when you specify @option{-nostdlib}
10786 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
10787 This ensures that you have no unresolved references to internal GCC
10788 library subroutines.
10789 (An example of such an internal subroutine is @code{__main}, used to ensure C++
10790 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
10791 GNU Compiler Collection (GCC) Internals}.)
10792
10793 @item -pie
10794 @opindex pie
10795 Produce a position independent executable on targets that support it.
10796 For predictable results, you must also specify the same set of options
10797 used for compilation (@option{-fpie}, @option{-fPIE},
10798 or model suboptions) when you specify this linker option.
10799
10800 @item -no-pie
10801 @opindex no-pie
10802 Don't produce a position independent executable.
10803
10804 @item -rdynamic
10805 @opindex rdynamic
10806 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
10807 that support it. This instructs the linker to add all symbols, not
10808 only used ones, to the dynamic symbol table. This option is needed
10809 for some uses of @code{dlopen} or to allow obtaining backtraces
10810 from within a program.
10811
10812 @item -s
10813 @opindex s
10814 Remove all symbol table and relocation information from the executable.
10815
10816 @item -static
10817 @opindex static
10818 On systems that support dynamic linking, this prevents linking with the shared
10819 libraries. On other systems, this option has no effect.
10820
10821 @item -shared
10822 @opindex shared
10823 Produce a shared object which can then be linked with other objects to
10824 form an executable. Not all systems support this option. For predictable
10825 results, you must also specify the same set of options used for compilation
10826 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
10827 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
10828 needs to build supplementary stub code for constructors to work. On
10829 multi-libbed systems, @samp{gcc -shared} must select the correct support
10830 libraries to link against. Failing to supply the correct flags may lead
10831 to subtle defects. Supplying them in cases where they are not necessary
10832 is innocuous.}
10833
10834 @item -shared-libgcc
10835 @itemx -static-libgcc
10836 @opindex shared-libgcc
10837 @opindex static-libgcc
10838 On systems that provide @file{libgcc} as a shared library, these options
10839 force the use of either the shared or static version, respectively.
10840 If no shared version of @file{libgcc} was built when the compiler was
10841 configured, these options have no effect.
10842
10843 There are several situations in which an application should use the
10844 shared @file{libgcc} instead of the static version. The most common
10845 of these is when the application wishes to throw and catch exceptions
10846 across different shared libraries. In that case, each of the libraries
10847 as well as the application itself should use the shared @file{libgcc}.
10848
10849 Therefore, the G++ and GCJ drivers automatically add
10850 @option{-shared-libgcc} whenever you build a shared library or a main
10851 executable, because C++ and Java programs typically use exceptions, so
10852 this is the right thing to do.
10853
10854 If, instead, you use the GCC driver to create shared libraries, you may
10855 find that they are not always linked with the shared @file{libgcc}.
10856 If GCC finds, at its configuration time, that you have a non-GNU linker
10857 or a GNU linker that does not support option @option{--eh-frame-hdr},
10858 it links the shared version of @file{libgcc} into shared libraries
10859 by default. Otherwise, it takes advantage of the linker and optimizes
10860 away the linking with the shared version of @file{libgcc}, linking with
10861 the static version of libgcc by default. This allows exceptions to
10862 propagate through such shared libraries, without incurring relocation
10863 costs at library load time.
10864
10865 However, if a library or main executable is supposed to throw or catch
10866 exceptions, you must link it using the G++ or GCJ driver, as appropriate
10867 for the languages used in the program, or using the option
10868 @option{-shared-libgcc}, such that it is linked with the shared
10869 @file{libgcc}.
10870
10871 @item -static-libasan
10872 @opindex static-libasan
10873 When the @option{-fsanitize=address} option is used to link a program,
10874 the GCC driver automatically links against @option{libasan}. If
10875 @file{libasan} is available as a shared library, and the @option{-static}
10876 option is not used, then this links against the shared version of
10877 @file{libasan}. The @option{-static-libasan} option directs the GCC
10878 driver to link @file{libasan} statically, without necessarily linking
10879 other libraries statically.
10880
10881 @item -static-libtsan
10882 @opindex static-libtsan
10883 When the @option{-fsanitize=thread} option is used to link a program,
10884 the GCC driver automatically links against @option{libtsan}. If
10885 @file{libtsan} is available as a shared library, and the @option{-static}
10886 option is not used, then this links against the shared version of
10887 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
10888 driver to link @file{libtsan} statically, without necessarily linking
10889 other libraries statically.
10890
10891 @item -static-liblsan
10892 @opindex static-liblsan
10893 When the @option{-fsanitize=leak} option is used to link a program,
10894 the GCC driver automatically links against @option{liblsan}. If
10895 @file{liblsan} is available as a shared library, and the @option{-static}
10896 option is not used, then this links against the shared version of
10897 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
10898 driver to link @file{liblsan} statically, without necessarily linking
10899 other libraries statically.
10900
10901 @item -static-libubsan
10902 @opindex static-libubsan
10903 When the @option{-fsanitize=undefined} option is used to link a program,
10904 the GCC driver automatically links against @option{libubsan}. If
10905 @file{libubsan} is available as a shared library, and the @option{-static}
10906 option is not used, then this links against the shared version of
10907 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
10908 driver to link @file{libubsan} statically, without necessarily linking
10909 other libraries statically.
10910
10911 @item -static-libmpx
10912 @opindex static-libmpx
10913 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
10914 used to link a program, the GCC driver automatically links against
10915 @file{libmpx}. If @file{libmpx} is available as a shared library,
10916 and the @option{-static} option is not used, then this links against
10917 the shared version of @file{libmpx}. The @option{-static-libmpx}
10918 option directs the GCC driver to link @file{libmpx} statically,
10919 without necessarily linking other libraries statically.
10920
10921 @item -static-libmpxwrappers
10922 @opindex static-libmpxwrappers
10923 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
10924 to link a program without also using @option{-fno-chkp-use-wrappers}, the
10925 GCC driver automatically links against @file{libmpxwrappers}. If
10926 @file{libmpxwrappers} is available as a shared library, and the
10927 @option{-static} option is not used, then this links against the shared
10928 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
10929 option directs the GCC driver to link @file{libmpxwrappers} statically,
10930 without necessarily linking other libraries statically.
10931
10932 @item -static-libstdc++
10933 @opindex static-libstdc++
10934 When the @command{g++} program is used to link a C++ program, it
10935 normally automatically links against @option{libstdc++}. If
10936 @file{libstdc++} is available as a shared library, and the
10937 @option{-static} option is not used, then this links against the
10938 shared version of @file{libstdc++}. That is normally fine. However, it
10939 is sometimes useful to freeze the version of @file{libstdc++} used by
10940 the program without going all the way to a fully static link. The
10941 @option{-static-libstdc++} option directs the @command{g++} driver to
10942 link @file{libstdc++} statically, without necessarily linking other
10943 libraries statically.
10944
10945 @item -symbolic
10946 @opindex symbolic
10947 Bind references to global symbols when building a shared object. Warn
10948 about any unresolved references (unless overridden by the link editor
10949 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
10950 this option.
10951
10952 @item -T @var{script}
10953 @opindex T
10954 @cindex linker script
10955 Use @var{script} as the linker script. This option is supported by most
10956 systems using the GNU linker. On some targets, such as bare-board
10957 targets without an operating system, the @option{-T} option may be required
10958 when linking to avoid references to undefined symbols.
10959
10960 @item -Xlinker @var{option}
10961 @opindex Xlinker
10962 Pass @var{option} as an option to the linker. You can use this to
10963 supply system-specific linker options that GCC does not recognize.
10964
10965 If you want to pass an option that takes a separate argument, you must use
10966 @option{-Xlinker} twice, once for the option and once for the argument.
10967 For example, to pass @option{-assert definitions}, you must write
10968 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
10969 @option{-Xlinker "-assert definitions"}, because this passes the entire
10970 string as a single argument, which is not what the linker expects.
10971
10972 When using the GNU linker, it is usually more convenient to pass
10973 arguments to linker options using the @option{@var{option}=@var{value}}
10974 syntax than as separate arguments. For example, you can specify
10975 @option{-Xlinker -Map=output.map} rather than
10976 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
10977 this syntax for command-line options.
10978
10979 @item -Wl,@var{option}
10980 @opindex Wl
10981 Pass @var{option} as an option to the linker. If @var{option} contains
10982 commas, it is split into multiple options at the commas. You can use this
10983 syntax to pass an argument to the option.
10984 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
10985 linker. When using the GNU linker, you can also get the same effect with
10986 @option{-Wl,-Map=output.map}.
10987
10988 @item -u @var{symbol}
10989 @opindex u
10990 Pretend the symbol @var{symbol} is undefined, to force linking of
10991 library modules to define it. You can use @option{-u} multiple times with
10992 different symbols to force loading of additional library modules.
10993
10994 @item -z @var{keyword}
10995 @opindex z
10996 @option{-z} is passed directly on to the linker along with the keyword
10997 @var{keyword}. See the section in the documentation of your linker for
10998 permitted values and their meanings.
10999 @end table
11000
11001 @node Directory Options
11002 @section Options for Directory Search
11003 @cindex directory options
11004 @cindex options, directory search
11005 @cindex search path
11006
11007 These options specify directories to search for header files, for
11008 libraries and for parts of the compiler:
11009
11010 @table @gcctabopt
11011 @item -I@var{dir}
11012 @opindex I
11013 Add the directory @var{dir} to the head of the list of directories to be
11014 searched for header files. This can be used to override a system header
11015 file, substituting your own version, since these directories are
11016 searched before the system header file directories. However, you should
11017 not use this option to add directories that contain vendor-supplied
11018 system header files (use @option{-isystem} for that). If you use more than
11019 one @option{-I} option, the directories are scanned in left-to-right
11020 order; the standard system directories come after.
11021
11022 If a standard system include directory, or a directory specified with
11023 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
11024 option is ignored. The directory is still searched but as a
11025 system directory at its normal position in the system include chain.
11026 This is to ensure that GCC's procedure to fix buggy system headers and
11027 the ordering for the @code{include_next} directive are not inadvertently changed.
11028 If you really need to change the search order for system directories,
11029 use the @option{-nostdinc} and/or @option{-isystem} options.
11030
11031 @item -iplugindir=@var{dir}
11032 @opindex iplugindir=
11033 Set the directory to search for plugins that are passed
11034 by @option{-fplugin=@var{name}} instead of
11035 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
11036 to be used by the user, but only passed by the driver.
11037
11038 @item -iquote@var{dir}
11039 @opindex iquote
11040 Add the directory @var{dir} to the head of the list of directories to
11041 be searched for header files only for the case of @code{#include
11042 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
11043 otherwise just like @option{-I}.
11044
11045 @item -L@var{dir}
11046 @opindex L
11047 Add directory @var{dir} to the list of directories to be searched
11048 for @option{-l}.
11049
11050 @item -B@var{prefix}
11051 @opindex B
11052 This option specifies where to find the executables, libraries,
11053 include files, and data files of the compiler itself.
11054
11055 The compiler driver program runs one or more of the subprograms
11056 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
11057 @var{prefix} as a prefix for each program it tries to run, both with and
11058 without @samp{@var{machine}/@var{version}/} for the corresponding target
11059 machine and compiler version.
11060
11061 For each subprogram to be run, the compiler driver first tries the
11062 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
11063 is not specified, the driver tries two standard prefixes,
11064 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
11065 those results in a file name that is found, the unmodified program
11066 name is searched for using the directories specified in your
11067 @env{PATH} environment variable.
11068
11069 The compiler checks to see if the path provided by @option{-B}
11070 refers to a directory, and if necessary it adds a directory
11071 separator character at the end of the path.
11072
11073 @option{-B} prefixes that effectively specify directory names also apply
11074 to libraries in the linker, because the compiler translates these
11075 options into @option{-L} options for the linker. They also apply to
11076 include files in the preprocessor, because the compiler translates these
11077 options into @option{-isystem} options for the preprocessor. In this case,
11078 the compiler appends @samp{include} to the prefix.
11079
11080 The runtime support file @file{libgcc.a} can also be searched for using
11081 the @option{-B} prefix, if needed. If it is not found there, the two
11082 standard prefixes above are tried, and that is all. The file is left
11083 out of the link if it is not found by those means.
11084
11085 Another way to specify a prefix much like the @option{-B} prefix is to use
11086 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
11087 Variables}.
11088
11089 As a special kludge, if the path provided by @option{-B} is
11090 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
11091 9, then it is replaced by @file{[dir/]include}. This is to help
11092 with boot-strapping the compiler.
11093
11094 @item -no-canonical-prefixes
11095 @opindex no-canonical-prefixes
11096 Do not expand any symbolic links, resolve references to @samp{/../}
11097 or @samp{/./}, or make the path absolute when generating a relative
11098 prefix.
11099
11100 @item --sysroot=@var{dir}
11101 @opindex sysroot
11102 Use @var{dir} as the logical root directory for headers and libraries.
11103 For example, if the compiler normally searches for headers in
11104 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
11105 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
11106
11107 If you use both this option and the @option{-isysroot} option, then
11108 the @option{--sysroot} option applies to libraries, but the
11109 @option{-isysroot} option applies to header files.
11110
11111 The GNU linker (beginning with version 2.16) has the necessary support
11112 for this option. If your linker does not support this option, the
11113 header file aspect of @option{--sysroot} still works, but the
11114 library aspect does not.
11115
11116 @item --no-sysroot-suffix
11117 @opindex no-sysroot-suffix
11118 For some targets, a suffix is added to the root directory specified
11119 with @option{--sysroot}, depending on the other options used, so that
11120 headers may for example be found in
11121 @file{@var{dir}/@var{suffix}/usr/include} instead of
11122 @file{@var{dir}/usr/include}. This option disables the addition of
11123 such a suffix.
11124
11125 @item -I-
11126 @opindex I-
11127 This option has been deprecated. Please use @option{-iquote} instead for
11128 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
11129 option.
11130 Any directories you specify with @option{-I} options before the @option{-I-}
11131 option are searched only for the case of @code{#include "@var{file}"};
11132 they are not searched for @code{#include <@var{file}>}.
11133
11134 If additional directories are specified with @option{-I} options after
11135 the @option{-I-} option, these directories are searched for all @code{#include}
11136 directives. (Ordinarily @emph{all} @option{-I} directories are used
11137 this way.)
11138
11139 In addition, the @option{-I-} option inhibits the use of the current
11140 directory (where the current input file came from) as the first search
11141 directory for @code{#include "@var{file}"}. There is no way to
11142 override this effect of @option{-I-}. With @option{-I.} you can specify
11143 searching the directory that is current when the compiler is
11144 invoked. That is not exactly the same as what the preprocessor does
11145 by default, but it is often satisfactory.
11146
11147 @option{-I-} does not inhibit the use of the standard system directories
11148 for header files. Thus, @option{-I-} and @option{-nostdinc} are
11149 independent.
11150 @end table
11151
11152 @node Code Gen Options
11153 @section Options for Code Generation Conventions
11154 @cindex code generation conventions
11155 @cindex options, code generation
11156 @cindex run-time options
11157
11158 These machine-independent options control the interface conventions
11159 used in code generation.
11160
11161 Most of them have both positive and negative forms; the negative form
11162 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
11163 one of the forms is listed---the one that is not the default. You
11164 can figure out the other form by either removing @samp{no-} or adding
11165 it.
11166
11167 @table @gcctabopt
11168 @item -fstack-reuse=@var{reuse-level}
11169 @opindex fstack_reuse
11170 This option controls stack space reuse for user declared local/auto variables
11171 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
11172 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
11173 local variables and temporaries, @samp{named_vars} enables the reuse only for
11174 user defined local variables with names, and @samp{none} disables stack reuse
11175 completely. The default value is @samp{all}. The option is needed when the
11176 program extends the lifetime of a scoped local variable or a compiler generated
11177 temporary beyond the end point defined by the language. When a lifetime of
11178 a variable ends, and if the variable lives in memory, the optimizing compiler
11179 has the freedom to reuse its stack space with other temporaries or scoped
11180 local variables whose live range does not overlap with it. Legacy code extending
11181 local lifetime is likely to break with the stack reuse optimization.
11182
11183 For example,
11184
11185 @smallexample
11186 int *p;
11187 @{
11188 int local1;
11189
11190 p = &local1;
11191 local1 = 10;
11192 ....
11193 @}
11194 @{
11195 int local2;
11196 local2 = 20;
11197 ...
11198 @}
11199
11200 if (*p == 10) // out of scope use of local1
11201 @{
11202
11203 @}
11204 @end smallexample
11205
11206 Another example:
11207 @smallexample
11208
11209 struct A
11210 @{
11211 A(int k) : i(k), j(k) @{ @}
11212 int i;
11213 int j;
11214 @};
11215
11216 A *ap;
11217
11218 void foo(const A& ar)
11219 @{
11220 ap = &ar;
11221 @}
11222
11223 void bar()
11224 @{
11225 foo(A(10)); // temp object's lifetime ends when foo returns
11226
11227 @{
11228 A a(20);
11229 ....
11230 @}
11231 ap->i+= 10; // ap references out of scope temp whose space
11232 // is reused with a. What is the value of ap->i?
11233 @}
11234
11235 @end smallexample
11236
11237 The lifetime of a compiler generated temporary is well defined by the C++
11238 standard. When a lifetime of a temporary ends, and if the temporary lives
11239 in memory, the optimizing compiler has the freedom to reuse its stack
11240 space with other temporaries or scoped local variables whose live range
11241 does not overlap with it. However some of the legacy code relies on
11242 the behavior of older compilers in which temporaries' stack space is
11243 not reused, the aggressive stack reuse can lead to runtime errors. This
11244 option is used to control the temporary stack reuse optimization.
11245
11246 @item -ftrapv
11247 @opindex ftrapv
11248 This option generates traps for signed overflow on addition, subtraction,
11249 multiplication operations.
11250 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11251 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11252 @option{-fwrapv} being effective. Note that only active options override, so
11253 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11254 results in @option{-ftrapv} being effective.
11255
11256 @item -fwrapv
11257 @opindex fwrapv
11258 This option instructs the compiler to assume that signed arithmetic
11259 overflow of addition, subtraction and multiplication wraps around
11260 using twos-complement representation. This flag enables some optimizations
11261 and disables others. This option is enabled by default for the Java
11262 front end, as required by the Java language specification.
11263 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11264 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11265 @option{-fwrapv} being effective. Note that only active options override, so
11266 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11267 results in @option{-ftrapv} being effective.
11268
11269 @item -fexceptions
11270 @opindex fexceptions
11271 Enable exception handling. Generates extra code needed to propagate
11272 exceptions. For some targets, this implies GCC generates frame
11273 unwind information for all functions, which can produce significant data
11274 size overhead, although it does not affect execution. If you do not
11275 specify this option, GCC enables it by default for languages like
11276 C++ that normally require exception handling, and disables it for
11277 languages like C that do not normally require it. However, you may need
11278 to enable this option when compiling C code that needs to interoperate
11279 properly with exception handlers written in C++. You may also wish to
11280 disable this option if you are compiling older C++ programs that don't
11281 use exception handling.
11282
11283 @item -fnon-call-exceptions
11284 @opindex fnon-call-exceptions
11285 Generate code that allows trapping instructions to throw exceptions.
11286 Note that this requires platform-specific runtime support that does
11287 not exist everywhere. Moreover, it only allows @emph{trapping}
11288 instructions to throw exceptions, i.e.@: memory references or floating-point
11289 instructions. It does not allow exceptions to be thrown from
11290 arbitrary signal handlers such as @code{SIGALRM}.
11291
11292 @item -fdelete-dead-exceptions
11293 @opindex fdelete-dead-exceptions
11294 Consider that instructions that may throw exceptions but don't otherwise
11295 contribute to the execution of the program can be optimized away.
11296 This option is enabled by default for the Ada front end, as permitted by
11297 the Ada language specification.
11298 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
11299
11300 @item -funwind-tables
11301 @opindex funwind-tables
11302 Similar to @option{-fexceptions}, except that it just generates any needed
11303 static data, but does not affect the generated code in any other way.
11304 You normally do not need to enable this option; instead, a language processor
11305 that needs this handling enables it on your behalf.
11306
11307 @item -fasynchronous-unwind-tables
11308 @opindex fasynchronous-unwind-tables
11309 Generate unwind table in DWARF format, if supported by target machine. The
11310 table is exact at each instruction boundary, so it can be used for stack
11311 unwinding from asynchronous events (such as debugger or garbage collector).
11312
11313 @item -fno-gnu-unique
11314 @opindex fno-gnu-unique
11315 On systems with recent GNU assembler and C library, the C++ compiler
11316 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
11317 of template static data members and static local variables in inline
11318 functions are unique even in the presence of @code{RTLD_LOCAL}; this
11319 is necessary to avoid problems with a library used by two different
11320 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
11321 therefore disagreeing with the other one about the binding of the
11322 symbol. But this causes @code{dlclose} to be ignored for affected
11323 DSOs; if your program relies on reinitialization of a DSO via
11324 @code{dlclose} and @code{dlopen}, you can use
11325 @option{-fno-gnu-unique}.
11326
11327 @item -fpcc-struct-return
11328 @opindex fpcc-struct-return
11329 Return ``short'' @code{struct} and @code{union} values in memory like
11330 longer ones, rather than in registers. This convention is less
11331 efficient, but it has the advantage of allowing intercallability between
11332 GCC-compiled files and files compiled with other compilers, particularly
11333 the Portable C Compiler (pcc).
11334
11335 The precise convention for returning structures in memory depends
11336 on the target configuration macros.
11337
11338 Short structures and unions are those whose size and alignment match
11339 that of some integer type.
11340
11341 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11342 switch is not binary compatible with code compiled with the
11343 @option{-freg-struct-return} switch.
11344 Use it to conform to a non-default application binary interface.
11345
11346 @item -freg-struct-return
11347 @opindex freg-struct-return
11348 Return @code{struct} and @code{union} values in registers when possible.
11349 This is more efficient for small structures than
11350 @option{-fpcc-struct-return}.
11351
11352 If you specify neither @option{-fpcc-struct-return} nor
11353 @option{-freg-struct-return}, GCC defaults to whichever convention is
11354 standard for the target. If there is no standard convention, GCC
11355 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11356 the principal compiler. In those cases, we can choose the standard, and
11357 we chose the more efficient register return alternative.
11358
11359 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11360 switch is not binary compatible with code compiled with the
11361 @option{-fpcc-struct-return} switch.
11362 Use it to conform to a non-default application binary interface.
11363
11364 @item -fshort-enums
11365 @opindex fshort-enums
11366 Allocate to an @code{enum} type only as many bytes as it needs for the
11367 declared range of possible values. Specifically, the @code{enum} type
11368 is equivalent to the smallest integer type that has enough room.
11369
11370 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11371 code that is not binary compatible with code generated without that switch.
11372 Use it to conform to a non-default application binary interface.
11373
11374 @item -fshort-wchar
11375 @opindex fshort-wchar
11376 Override the underlying type for @code{wchar_t} to be @code{short
11377 unsigned int} instead of the default for the target. This option is
11378 useful for building programs to run under WINE@.
11379
11380 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11381 code that is not binary compatible with code generated without that switch.
11382 Use it to conform to a non-default application binary interface.
11383
11384 @item -fno-common
11385 @opindex fno-common
11386 In C code, controls the placement of uninitialized global variables.
11387 Unix C compilers have traditionally permitted multiple definitions of
11388 such variables in different compilation units by placing the variables
11389 in a common block.
11390 This is the behavior specified by @option{-fcommon}, and is the default
11391 for GCC on most targets.
11392 On the other hand, this behavior is not required by ISO C, and on some
11393 targets may carry a speed or code size penalty on variable references.
11394 The @option{-fno-common} option specifies that the compiler should place
11395 uninitialized global variables in the data section of the object file,
11396 rather than generating them as common blocks.
11397 This has the effect that if the same variable is declared
11398 (without @code{extern}) in two different compilations,
11399 you get a multiple-definition error when you link them.
11400 In this case, you must compile with @option{-fcommon} instead.
11401 Compiling with @option{-fno-common} is useful on targets for which
11402 it provides better performance, or if you wish to verify that the
11403 program will work on other systems that always treat uninitialized
11404 variable declarations this way.
11405
11406 @item -fno-ident
11407 @opindex fno-ident
11408 Ignore the @code{#ident} directive.
11409
11410 @item -finhibit-size-directive
11411 @opindex finhibit-size-directive
11412 Don't output a @code{.size} assembler directive, or anything else that
11413 would cause trouble if the function is split in the middle, and the
11414 two halves are placed at locations far apart in memory. This option is
11415 used when compiling @file{crtstuff.c}; you should not need to use it
11416 for anything else.
11417
11418 @item -fverbose-asm
11419 @opindex fverbose-asm
11420 Put extra commentary information in the generated assembly code to
11421 make it more readable. This option is generally only of use to those
11422 who actually need to read the generated assembly code (perhaps while
11423 debugging the compiler itself).
11424
11425 @option{-fno-verbose-asm}, the default, causes the
11426 extra information to be omitted and is useful when comparing two assembler
11427 files.
11428
11429 @item -frecord-gcc-switches
11430 @opindex frecord-gcc-switches
11431 This switch causes the command line used to invoke the
11432 compiler to be recorded into the object file that is being created.
11433 This switch is only implemented on some targets and the exact format
11434 of the recording is target and binary file format dependent, but it
11435 usually takes the form of a section containing ASCII text. This
11436 switch is related to the @option{-fverbose-asm} switch, but that
11437 switch only records information in the assembler output file as
11438 comments, so it never reaches the object file.
11439 See also @option{-grecord-gcc-switches} for another
11440 way of storing compiler options into the object file.
11441
11442 @item -fpic
11443 @opindex fpic
11444 @cindex global offset table
11445 @cindex PIC
11446 Generate position-independent code (PIC) suitable for use in a shared
11447 library, if supported for the target machine. Such code accesses all
11448 constant addresses through a global offset table (GOT)@. The dynamic
11449 loader resolves the GOT entries when the program starts (the dynamic
11450 loader is not part of GCC; it is part of the operating system). If
11451 the GOT size for the linked executable exceeds a machine-specific
11452 maximum size, you get an error message from the linker indicating that
11453 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
11454 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
11455 on the m68k and RS/6000. The x86 has no such limit.)
11456
11457 Position-independent code requires special support, and therefore works
11458 only on certain machines. For the x86, GCC supports PIC for System V
11459 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
11460 position-independent.
11461
11462 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11463 are defined to 1.
11464
11465 @item -fPIC
11466 @opindex fPIC
11467 If supported for the target machine, emit position-independent code,
11468 suitable for dynamic linking and avoiding any limit on the size of the
11469 global offset table. This option makes a difference on AArch64, m68k,
11470 PowerPC and SPARC@.
11471
11472 Position-independent code requires special support, and therefore works
11473 only on certain machines.
11474
11475 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11476 are defined to 2.
11477
11478 @item -fpie
11479 @itemx -fPIE
11480 @opindex fpie
11481 @opindex fPIE
11482 These options are similar to @option{-fpic} and @option{-fPIC}, but
11483 generated position independent code can be only linked into executables.
11484 Usually these options are used when @option{-pie} GCC option is
11485 used during linking.
11486
11487 @option{-fpie} and @option{-fPIE} both define the macros
11488 @code{__pie__} and @code{__PIE__}. The macros have the value 1
11489 for @option{-fpie} and 2 for @option{-fPIE}.
11490
11491 @item -fno-plt
11492 @opindex fno-plt
11493 Do not use the PLT for external function calls in position-independent code.
11494 Instead, load the callee address at call sites from the GOT and branch to it.
11495 This leads to more efficient code by eliminating PLT stubs and exposing
11496 GOT loads to optimizations. On architectures such as 32-bit x86 where
11497 PLT stubs expect the GOT pointer in a specific register, this gives more
11498 register allocation freedom to the compiler.
11499 Lazy binding requires use of the PLT;
11500 with @option{-fno-plt} all external symbols are resolved at load time.
11501
11502 Alternatively, the function attribute @code{noplt} can be used to avoid calls
11503 through the PLT for specific external functions.
11504
11505 In position-dependent code, a few targets also convert calls to
11506 functions that are marked to not use the PLT to use the GOT instead.
11507
11508 @item -fno-jump-tables
11509 @opindex fno-jump-tables
11510 Do not use jump tables for switch statements even where it would be
11511 more efficient than other code generation strategies. This option is
11512 of use in conjunction with @option{-fpic} or @option{-fPIC} for
11513 building code that forms part of a dynamic linker and cannot
11514 reference the address of a jump table. On some targets, jump tables
11515 do not require a GOT and this option is not needed.
11516
11517 @item -ffixed-@var{reg}
11518 @opindex ffixed
11519 Treat the register named @var{reg} as a fixed register; generated code
11520 should never refer to it (except perhaps as a stack pointer, frame
11521 pointer or in some other fixed role).
11522
11523 @var{reg} must be the name of a register. The register names accepted
11524 are machine-specific and are defined in the @code{REGISTER_NAMES}
11525 macro in the machine description macro file.
11526
11527 This flag does not have a negative form, because it specifies a
11528 three-way choice.
11529
11530 @item -fcall-used-@var{reg}
11531 @opindex fcall-used
11532 Treat the register named @var{reg} as an allocable register that is
11533 clobbered by function calls. It may be allocated for temporaries or
11534 variables that do not live across a call. Functions compiled this way
11535 do not save and restore the register @var{reg}.
11536
11537 It is an error to use this flag with the frame pointer or stack pointer.
11538 Use of this flag for other registers that have fixed pervasive roles in
11539 the machine's execution model produces disastrous results.
11540
11541 This flag does not have a negative form, because it specifies a
11542 three-way choice.
11543
11544 @item -fcall-saved-@var{reg}
11545 @opindex fcall-saved
11546 Treat the register named @var{reg} as an allocable register saved by
11547 functions. It may be allocated even for temporaries or variables that
11548 live across a call. Functions compiled this way save and restore
11549 the register @var{reg} if they use it.
11550
11551 It is an error to use this flag with the frame pointer or stack pointer.
11552 Use of this flag for other registers that have fixed pervasive roles in
11553 the machine's execution model produces disastrous results.
11554
11555 A different sort of disaster results from the use of this flag for
11556 a register in which function values may be returned.
11557
11558 This flag does not have a negative form, because it specifies a
11559 three-way choice.
11560
11561 @item -fpack-struct[=@var{n}]
11562 @opindex fpack-struct
11563 Without a value specified, pack all structure members together without
11564 holes. When a value is specified (which must be a small power of two), pack
11565 structure members according to this value, representing the maximum
11566 alignment (that is, objects with default alignment requirements larger than
11567 this are output potentially unaligned at the next fitting location.
11568
11569 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11570 code that is not binary compatible with code generated without that switch.
11571 Additionally, it makes the code suboptimal.
11572 Use it to conform to a non-default application binary interface.
11573
11574 @item -fleading-underscore
11575 @opindex fleading-underscore
11576 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11577 change the way C symbols are represented in the object file. One use
11578 is to help link with legacy assembly code.
11579
11580 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11581 generate code that is not binary compatible with code generated without that
11582 switch. Use it to conform to a non-default application binary interface.
11583 Not all targets provide complete support for this switch.
11584
11585 @item -ftls-model=@var{model}
11586 @opindex ftls-model
11587 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11588 The @var{model} argument should be one of @samp{global-dynamic},
11589 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
11590 Note that the choice is subject to optimization: the compiler may use
11591 a more efficient model for symbols not visible outside of the translation
11592 unit, or if @option{-fpic} is not given on the command line.
11593
11594 The default without @option{-fpic} is @samp{initial-exec}; with
11595 @option{-fpic} the default is @samp{global-dynamic}.
11596
11597 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
11598 @opindex fvisibility
11599 Set the default ELF image symbol visibility to the specified option---all
11600 symbols are marked with this unless overridden within the code.
11601 Using this feature can very substantially improve linking and
11602 load times of shared object libraries, produce more optimized
11603 code, provide near-perfect API export and prevent symbol clashes.
11604 It is @strong{strongly} recommended that you use this in any shared objects
11605 you distribute.
11606
11607 Despite the nomenclature, @samp{default} always means public; i.e.,
11608 available to be linked against from outside the shared object.
11609 @samp{protected} and @samp{internal} are pretty useless in real-world
11610 usage so the only other commonly used option is @samp{hidden}.
11611 The default if @option{-fvisibility} isn't specified is
11612 @samp{default}, i.e., make every symbol public.
11613
11614 A good explanation of the benefits offered by ensuring ELF
11615 symbols have the correct visibility is given by ``How To Write
11616 Shared Libraries'' by Ulrich Drepper (which can be found at
11617 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
11618 solution made possible by this option to marking things hidden when
11619 the default is public is to make the default hidden and mark things
11620 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
11621 and @code{__attribute__ ((visibility("default")))} instead of
11622 @code{__declspec(dllexport)} you get almost identical semantics with
11623 identical syntax. This is a great boon to those working with
11624 cross-platform projects.
11625
11626 For those adding visibility support to existing code, you may find
11627 @code{#pragma GCC visibility} of use. This works by you enclosing
11628 the declarations you wish to set visibility for with (for example)
11629 @code{#pragma GCC visibility push(hidden)} and
11630 @code{#pragma GCC visibility pop}.
11631 Bear in mind that symbol visibility should be viewed @strong{as
11632 part of the API interface contract} and thus all new code should
11633 always specify visibility when it is not the default; i.e., declarations
11634 only for use within the local DSO should @strong{always} be marked explicitly
11635 as hidden as so to avoid PLT indirection overheads---making this
11636 abundantly clear also aids readability and self-documentation of the code.
11637 Note that due to ISO C++ specification requirements, @code{operator new} and
11638 @code{operator delete} must always be of default visibility.
11639
11640 Be aware that headers from outside your project, in particular system
11641 headers and headers from any other library you use, may not be
11642 expecting to be compiled with visibility other than the default. You
11643 may need to explicitly say @code{#pragma GCC visibility push(default)}
11644 before including any such headers.
11645
11646 @code{extern} declarations are not affected by @option{-fvisibility}, so
11647 a lot of code can be recompiled with @option{-fvisibility=hidden} with
11648 no modifications. However, this means that calls to @code{extern}
11649 functions with no explicit visibility use the PLT, so it is more
11650 effective to use @code{__attribute ((visibility))} and/or
11651 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
11652 declarations should be treated as hidden.
11653
11654 Note that @option{-fvisibility} does affect C++ vague linkage
11655 entities. This means that, for instance, an exception class that is
11656 be thrown between DSOs must be explicitly marked with default
11657 visibility so that the @samp{type_info} nodes are unified between
11658 the DSOs.
11659
11660 An overview of these techniques, their benefits and how to use them
11661 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
11662
11663 @item -fstrict-volatile-bitfields
11664 @opindex fstrict-volatile-bitfields
11665 This option should be used if accesses to volatile bit-fields (or other
11666 structure fields, although the compiler usually honors those types
11667 anyway) should use a single access of the width of the
11668 field's type, aligned to a natural alignment if possible. For
11669 example, targets with memory-mapped peripheral registers might require
11670 all such accesses to be 16 bits wide; with this flag you can
11671 declare all peripheral bit-fields as @code{unsigned short} (assuming short
11672 is 16 bits on these targets) to force GCC to use 16-bit accesses
11673 instead of, perhaps, a more efficient 32-bit access.
11674
11675 If this option is disabled, the compiler uses the most efficient
11676 instruction. In the previous example, that might be a 32-bit load
11677 instruction, even though that accesses bytes that do not contain
11678 any portion of the bit-field, or memory-mapped registers unrelated to
11679 the one being updated.
11680
11681 In some cases, such as when the @code{packed} attribute is applied to a
11682 structure field, it may not be possible to access the field with a single
11683 read or write that is correctly aligned for the target machine. In this
11684 case GCC falls back to generating multiple accesses rather than code that
11685 will fault or truncate the result at run time.
11686
11687 Note: Due to restrictions of the C/C++11 memory model, write accesses are
11688 not allowed to touch non bit-field members. It is therefore recommended
11689 to define all bits of the field's type as bit-field members.
11690
11691 The default value of this option is determined by the application binary
11692 interface for the target processor.
11693
11694 @item -fsync-libcalls
11695 @opindex fsync-libcalls
11696 This option controls whether any out-of-line instance of the @code{__sync}
11697 family of functions may be used to implement the C++11 @code{__atomic}
11698 family of functions.
11699
11700 The default value of this option is enabled, thus the only useful form
11701 of the option is @option{-fno-sync-libcalls}. This option is used in
11702 the implementation of the @file{libatomic} runtime library.
11703
11704 @end table
11705
11706 @node Developer Options
11707 @section GCC Developer Options
11708 @cindex developer options
11709 @cindex debugging GCC
11710 @cindex debug dump options
11711 @cindex dump options
11712 @cindex compilation statistics
11713
11714 This section describes command-line options that are primarily of
11715 interest to GCC developers, including options to support compiler
11716 testing and investigation of compiler bugs and compile-time
11717 performance problems. This includes options that produce debug dumps
11718 at various points in the compilation; that print statistics such as
11719 memory use and execution time; and that print information about GCC's
11720 configuration, such as where it searches for libraries. You should
11721 rarely need to use any of these options for ordinary compilation and
11722 linking tasks.
11723
11724 @table @gcctabopt
11725
11726 @item -d@var{letters}
11727 @itemx -fdump-rtl-@var{pass}
11728 @itemx -fdump-rtl-@var{pass}=@var{filename}
11729 @opindex d
11730 @opindex fdump-rtl-@var{pass}
11731 Says to make debugging dumps during compilation at times specified by
11732 @var{letters}. This is used for debugging the RTL-based passes of the
11733 compiler. The file names for most of the dumps are made by appending
11734 a pass number and a word to the @var{dumpname}, and the files are
11735 created in the directory of the output file. In case of
11736 @option{=@var{filename}} option, the dump is output on the given file
11737 instead of the pass numbered dump files. Note that the pass number is
11738 assigned as passes are registered into the pass manager. Most passes
11739 are registered in the order that they will execute and for these passes
11740 the number corresponds to the pass execution order. However, passes
11741 registered by plugins, passes specific to compilation targets, or
11742 passes that are otherwise registered after all the other passes are
11743 numbered higher than a pass named "final", even if they are executed
11744 earlier. @var{dumpname} is generated from the name of the output
11745 file if explicitly specified and not an executable, otherwise it is
11746 the basename of the source file. These switches may have different
11747 effects when @option{-E} is used for preprocessing.
11748
11749 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
11750 @option{-d} option @var{letters}. Here are the possible
11751 letters for use in @var{pass} and @var{letters}, and their meanings:
11752
11753 @table @gcctabopt
11754
11755 @item -fdump-rtl-alignments
11756 @opindex fdump-rtl-alignments
11757 Dump after branch alignments have been computed.
11758
11759 @item -fdump-rtl-asmcons
11760 @opindex fdump-rtl-asmcons
11761 Dump after fixing rtl statements that have unsatisfied in/out constraints.
11762
11763 @item -fdump-rtl-auto_inc_dec
11764 @opindex fdump-rtl-auto_inc_dec
11765 Dump after auto-inc-dec discovery. This pass is only run on
11766 architectures that have auto inc or auto dec instructions.
11767
11768 @item -fdump-rtl-barriers
11769 @opindex fdump-rtl-barriers
11770 Dump after cleaning up the barrier instructions.
11771
11772 @item -fdump-rtl-bbpart
11773 @opindex fdump-rtl-bbpart
11774 Dump after partitioning hot and cold basic blocks.
11775
11776 @item -fdump-rtl-bbro
11777 @opindex fdump-rtl-bbro
11778 Dump after block reordering.
11779
11780 @item -fdump-rtl-btl1
11781 @itemx -fdump-rtl-btl2
11782 @opindex fdump-rtl-btl2
11783 @opindex fdump-rtl-btl2
11784 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
11785 after the two branch
11786 target load optimization passes.
11787
11788 @item -fdump-rtl-bypass
11789 @opindex fdump-rtl-bypass
11790 Dump after jump bypassing and control flow optimizations.
11791
11792 @item -fdump-rtl-combine
11793 @opindex fdump-rtl-combine
11794 Dump after the RTL instruction combination pass.
11795
11796 @item -fdump-rtl-compgotos
11797 @opindex fdump-rtl-compgotos
11798 Dump after duplicating the computed gotos.
11799
11800 @item -fdump-rtl-ce1
11801 @itemx -fdump-rtl-ce2
11802 @itemx -fdump-rtl-ce3
11803 @opindex fdump-rtl-ce1
11804 @opindex fdump-rtl-ce2
11805 @opindex fdump-rtl-ce3
11806 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
11807 @option{-fdump-rtl-ce3} enable dumping after the three
11808 if conversion passes.
11809
11810 @item -fdump-rtl-cprop_hardreg
11811 @opindex fdump-rtl-cprop_hardreg
11812 Dump after hard register copy propagation.
11813
11814 @item -fdump-rtl-csa
11815 @opindex fdump-rtl-csa
11816 Dump after combining stack adjustments.
11817
11818 @item -fdump-rtl-cse1
11819 @itemx -fdump-rtl-cse2
11820 @opindex fdump-rtl-cse1
11821 @opindex fdump-rtl-cse2
11822 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
11823 the two common subexpression elimination passes.
11824
11825 @item -fdump-rtl-dce
11826 @opindex fdump-rtl-dce
11827 Dump after the standalone dead code elimination passes.
11828
11829 @item -fdump-rtl-dbr
11830 @opindex fdump-rtl-dbr
11831 Dump after delayed branch scheduling.
11832
11833 @item -fdump-rtl-dce1
11834 @itemx -fdump-rtl-dce2
11835 @opindex fdump-rtl-dce1
11836 @opindex fdump-rtl-dce2
11837 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
11838 the two dead store elimination passes.
11839
11840 @item -fdump-rtl-eh
11841 @opindex fdump-rtl-eh
11842 Dump after finalization of EH handling code.
11843
11844 @item -fdump-rtl-eh_ranges
11845 @opindex fdump-rtl-eh_ranges
11846 Dump after conversion of EH handling range regions.
11847
11848 @item -fdump-rtl-expand
11849 @opindex fdump-rtl-expand
11850 Dump after RTL generation.
11851
11852 @item -fdump-rtl-fwprop1
11853 @itemx -fdump-rtl-fwprop2
11854 @opindex fdump-rtl-fwprop1
11855 @opindex fdump-rtl-fwprop2
11856 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
11857 dumping after the two forward propagation passes.
11858
11859 @item -fdump-rtl-gcse1
11860 @itemx -fdump-rtl-gcse2
11861 @opindex fdump-rtl-gcse1
11862 @opindex fdump-rtl-gcse2
11863 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
11864 after global common subexpression elimination.
11865
11866 @item -fdump-rtl-init-regs
11867 @opindex fdump-rtl-init-regs
11868 Dump after the initialization of the registers.
11869
11870 @item -fdump-rtl-initvals
11871 @opindex fdump-rtl-initvals
11872 Dump after the computation of the initial value sets.
11873
11874 @item -fdump-rtl-into_cfglayout
11875 @opindex fdump-rtl-into_cfglayout
11876 Dump after converting to cfglayout mode.
11877
11878 @item -fdump-rtl-ira
11879 @opindex fdump-rtl-ira
11880 Dump after iterated register allocation.
11881
11882 @item -fdump-rtl-jump
11883 @opindex fdump-rtl-jump
11884 Dump after the second jump optimization.
11885
11886 @item -fdump-rtl-loop2
11887 @opindex fdump-rtl-loop2
11888 @option{-fdump-rtl-loop2} enables dumping after the rtl
11889 loop optimization passes.
11890
11891 @item -fdump-rtl-mach
11892 @opindex fdump-rtl-mach
11893 Dump after performing the machine dependent reorganization pass, if that
11894 pass exists.
11895
11896 @item -fdump-rtl-mode_sw
11897 @opindex fdump-rtl-mode_sw
11898 Dump after removing redundant mode switches.
11899
11900 @item -fdump-rtl-rnreg
11901 @opindex fdump-rtl-rnreg
11902 Dump after register renumbering.
11903
11904 @item -fdump-rtl-outof_cfglayout
11905 @opindex fdump-rtl-outof_cfglayout
11906 Dump after converting from cfglayout mode.
11907
11908 @item -fdump-rtl-peephole2
11909 @opindex fdump-rtl-peephole2
11910 Dump after the peephole pass.
11911
11912 @item -fdump-rtl-postreload
11913 @opindex fdump-rtl-postreload
11914 Dump after post-reload optimizations.
11915
11916 @item -fdump-rtl-pro_and_epilogue
11917 @opindex fdump-rtl-pro_and_epilogue
11918 Dump after generating the function prologues and epilogues.
11919
11920 @item -fdump-rtl-sched1
11921 @itemx -fdump-rtl-sched2
11922 @opindex fdump-rtl-sched1
11923 @opindex fdump-rtl-sched2
11924 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
11925 after the basic block scheduling passes.
11926
11927 @item -fdump-rtl-ree
11928 @opindex fdump-rtl-ree
11929 Dump after sign/zero extension elimination.
11930
11931 @item -fdump-rtl-seqabstr
11932 @opindex fdump-rtl-seqabstr
11933 Dump after common sequence discovery.
11934
11935 @item -fdump-rtl-shorten
11936 @opindex fdump-rtl-shorten
11937 Dump after shortening branches.
11938
11939 @item -fdump-rtl-sibling
11940 @opindex fdump-rtl-sibling
11941 Dump after sibling call optimizations.
11942
11943 @item -fdump-rtl-split1
11944 @itemx -fdump-rtl-split2
11945 @itemx -fdump-rtl-split3
11946 @itemx -fdump-rtl-split4
11947 @itemx -fdump-rtl-split5
11948 @opindex fdump-rtl-split1
11949 @opindex fdump-rtl-split2
11950 @opindex fdump-rtl-split3
11951 @opindex fdump-rtl-split4
11952 @opindex fdump-rtl-split5
11953 These options enable dumping after five rounds of
11954 instruction splitting.
11955
11956 @item -fdump-rtl-sms
11957 @opindex fdump-rtl-sms
11958 Dump after modulo scheduling. This pass is only run on some
11959 architectures.
11960
11961 @item -fdump-rtl-stack
11962 @opindex fdump-rtl-stack
11963 Dump after conversion from GCC's ``flat register file'' registers to the
11964 x87's stack-like registers. This pass is only run on x86 variants.
11965
11966 @item -fdump-rtl-subreg1
11967 @itemx -fdump-rtl-subreg2
11968 @opindex fdump-rtl-subreg1
11969 @opindex fdump-rtl-subreg2
11970 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
11971 the two subreg expansion passes.
11972
11973 @item -fdump-rtl-unshare
11974 @opindex fdump-rtl-unshare
11975 Dump after all rtl has been unshared.
11976
11977 @item -fdump-rtl-vartrack
11978 @opindex fdump-rtl-vartrack
11979 Dump after variable tracking.
11980
11981 @item -fdump-rtl-vregs
11982 @opindex fdump-rtl-vregs
11983 Dump after converting virtual registers to hard registers.
11984
11985 @item -fdump-rtl-web
11986 @opindex fdump-rtl-web
11987 Dump after live range splitting.
11988
11989 @item -fdump-rtl-regclass
11990 @itemx -fdump-rtl-subregs_of_mode_init
11991 @itemx -fdump-rtl-subregs_of_mode_finish
11992 @itemx -fdump-rtl-dfinit
11993 @itemx -fdump-rtl-dfinish
11994 @opindex fdump-rtl-regclass
11995 @opindex fdump-rtl-subregs_of_mode_init
11996 @opindex fdump-rtl-subregs_of_mode_finish
11997 @opindex fdump-rtl-dfinit
11998 @opindex fdump-rtl-dfinish
11999 These dumps are defined but always produce empty files.
12000
12001 @item -da
12002 @itemx -fdump-rtl-all
12003 @opindex da
12004 @opindex fdump-rtl-all
12005 Produce all the dumps listed above.
12006
12007 @item -dA
12008 @opindex dA
12009 Annotate the assembler output with miscellaneous debugging information.
12010
12011 @item -dD
12012 @opindex dD
12013 Dump all macro definitions, at the end of preprocessing, in addition to
12014 normal output.
12015
12016 @item -dH
12017 @opindex dH
12018 Produce a core dump whenever an error occurs.
12019
12020 @item -dp
12021 @opindex dp
12022 Annotate the assembler output with a comment indicating which
12023 pattern and alternative is used. The length of each instruction is
12024 also printed.
12025
12026 @item -dP
12027 @opindex dP
12028 Dump the RTL in the assembler output as a comment before each instruction.
12029 Also turns on @option{-dp} annotation.
12030
12031 @item -dx
12032 @opindex dx
12033 Just generate RTL for a function instead of compiling it. Usually used
12034 with @option{-fdump-rtl-expand}.
12035 @end table
12036
12037 @item -fdump-noaddr
12038 @opindex fdump-noaddr
12039 When doing debugging dumps, suppress address output. This makes it more
12040 feasible to use diff on debugging dumps for compiler invocations with
12041 different compiler binaries and/or different
12042 text / bss / data / heap / stack / dso start locations.
12043
12044 @item -freport-bug
12045 @opindex freport-bug
12046 Collect and dump debug information into a temporary file if an
12047 internal compiler error (ICE) occurs.
12048
12049 @item -fdump-unnumbered
12050 @opindex fdump-unnumbered
12051 When doing debugging dumps, suppress instruction numbers and address output.
12052 This makes it more feasible to use diff on debugging dumps for compiler
12053 invocations with different options, in particular with and without
12054 @option{-g}.
12055
12056 @item -fdump-unnumbered-links
12057 @opindex fdump-unnumbered-links
12058 When doing debugging dumps (see @option{-d} option above), suppress
12059 instruction numbers for the links to the previous and next instructions
12060 in a sequence.
12061
12062 @item -fdump-translation-unit @r{(C++ only)}
12063 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
12064 @opindex fdump-translation-unit
12065 Dump a representation of the tree structure for the entire translation
12066 unit to a file. The file name is made by appending @file{.tu} to the
12067 source file name, and the file is created in the same directory as the
12068 output file. If the @samp{-@var{options}} form is used, @var{options}
12069 controls the details of the dump as described for the
12070 @option{-fdump-tree} options.
12071
12072 @item -fdump-class-hierarchy @r{(C++ only)}
12073 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
12074 @opindex fdump-class-hierarchy
12075 Dump a representation of each class's hierarchy and virtual function
12076 table layout to a file. The file name is made by appending
12077 @file{.class} to the source file name, and the file is created in the
12078 same directory as the output file. If the @samp{-@var{options}} form
12079 is used, @var{options} controls the details of the dump as described
12080 for the @option{-fdump-tree} options.
12081
12082 @item -fdump-ipa-@var{switch}
12083 @opindex fdump-ipa
12084 Control the dumping at various stages of inter-procedural analysis
12085 language tree to a file. The file name is generated by appending a
12086 switch specific suffix to the source file name, and the file is created
12087 in the same directory as the output file. The following dumps are
12088 possible:
12089
12090 @table @samp
12091 @item all
12092 Enables all inter-procedural analysis dumps.
12093
12094 @item cgraph
12095 Dumps information about call-graph optimization, unused function removal,
12096 and inlining decisions.
12097
12098 @item inline
12099 Dump after function inlining.
12100
12101 @end table
12102
12103 @item -fdump-passes
12104 @opindex fdump-passes
12105 Dump the list of optimization passes that are turned on and off by
12106 the current command-line options.
12107
12108 @item -fdump-statistics-@var{option}
12109 @opindex fdump-statistics
12110 Enable and control dumping of pass statistics in a separate file. The
12111 file name is generated by appending a suffix ending in
12112 @samp{.statistics} to the source file name, and the file is created in
12113 the same directory as the output file. If the @samp{-@var{option}}
12114 form is used, @samp{-stats} causes counters to be summed over the
12115 whole compilation unit while @samp{-details} dumps every event as
12116 the passes generate them. The default with no option is to sum
12117 counters for each function compiled.
12118
12119 @item -fdump-tree-@var{switch}
12120 @itemx -fdump-tree-@var{switch}-@var{options}
12121 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
12122 @opindex fdump-tree
12123 Control the dumping at various stages of processing the intermediate
12124 language tree to a file. The file name is generated by appending a
12125 switch-specific suffix to the source file name, and the file is
12126 created in the same directory as the output file. In case of
12127 @option{=@var{filename}} option, the dump is output on the given file
12128 instead of the auto named dump files. If the @samp{-@var{options}}
12129 form is used, @var{options} is a list of @samp{-} separated options
12130 which control the details of the dump. Not all options are applicable
12131 to all dumps; those that are not meaningful are ignored. The
12132 following options are available
12133
12134 @table @samp
12135 @item address
12136 Print the address of each node. Usually this is not meaningful as it
12137 changes according to the environment and source file. Its primary use
12138 is for tying up a dump file with a debug environment.
12139 @item asmname
12140 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
12141 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
12142 use working backward from mangled names in the assembly file.
12143 @item slim
12144 When dumping front-end intermediate representations, inhibit dumping
12145 of members of a scope or body of a function merely because that scope
12146 has been reached. Only dump such items when they are directly reachable
12147 by some other path.
12148
12149 When dumping pretty-printed trees, this option inhibits dumping the
12150 bodies of control structures.
12151
12152 When dumping RTL, print the RTL in slim (condensed) form instead of
12153 the default LISP-like representation.
12154 @item raw
12155 Print a raw representation of the tree. By default, trees are
12156 pretty-printed into a C-like representation.
12157 @item details
12158 Enable more detailed dumps (not honored by every dump option). Also
12159 include information from the optimization passes.
12160 @item stats
12161 Enable dumping various statistics about the pass (not honored by every dump
12162 option).
12163 @item blocks
12164 Enable showing basic block boundaries (disabled in raw dumps).
12165 @item graph
12166 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
12167 dump a representation of the control flow graph suitable for viewing with
12168 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
12169 the file is pretty-printed as a subgraph, so that GraphViz can render them
12170 all in a single plot.
12171
12172 This option currently only works for RTL dumps, and the RTL is always
12173 dumped in slim form.
12174 @item vops
12175 Enable showing virtual operands for every statement.
12176 @item lineno
12177 Enable showing line numbers for statements.
12178 @item uid
12179 Enable showing the unique ID (@code{DECL_UID}) for each variable.
12180 @item verbose
12181 Enable showing the tree dump for each statement.
12182 @item eh
12183 Enable showing the EH region number holding each statement.
12184 @item scev
12185 Enable showing scalar evolution analysis details.
12186 @item optimized
12187 Enable showing optimization information (only available in certain
12188 passes).
12189 @item missed
12190 Enable showing missed optimization information (only available in certain
12191 passes).
12192 @item note
12193 Enable other detailed optimization information (only available in
12194 certain passes).
12195 @item =@var{filename}
12196 Instead of an auto named dump file, output into the given file
12197 name. The file names @file{stdout} and @file{stderr} are treated
12198 specially and are considered already open standard streams. For
12199 example,
12200
12201 @smallexample
12202 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
12203 -fdump-tree-pre=stderr file.c
12204 @end smallexample
12205
12206 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
12207 output on to @file{stderr}. If two conflicting dump filenames are
12208 given for the same pass, then the latter option overrides the earlier
12209 one.
12210
12211 @item split-paths
12212 @opindex fdump-tree-split-paths
12213 Dump each function after splitting paths to loop backedges. The file
12214 name is made by appending @file{.split-paths} to the source file name.
12215
12216 @item all
12217 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
12218 and @option{lineno}.
12219
12220 @item optall
12221 Turn on all optimization options, i.e., @option{optimized},
12222 @option{missed}, and @option{note}.
12223 @end table
12224
12225 The following tree dumps are possible:
12226 @table @samp
12227
12228 @item original
12229 @opindex fdump-tree-original
12230 Dump before any tree based optimization, to @file{@var{file}.original}.
12231
12232 @item optimized
12233 @opindex fdump-tree-optimized
12234 Dump after all tree based optimization, to @file{@var{file}.optimized}.
12235
12236 @item gimple
12237 @opindex fdump-tree-gimple
12238 Dump each function before and after the gimplification pass to a file. The
12239 file name is made by appending @file{.gimple} to the source file name.
12240
12241 @item cfg
12242 @opindex fdump-tree-cfg
12243 Dump the control flow graph of each function to a file. The file name is
12244 made by appending @file{.cfg} to the source file name.
12245
12246 @item ch
12247 @opindex fdump-tree-ch
12248 Dump each function after copying loop headers. The file name is made by
12249 appending @file{.ch} to the source file name.
12250
12251 @item ssa
12252 @opindex fdump-tree-ssa
12253 Dump SSA related information to a file. The file name is made by appending
12254 @file{.ssa} to the source file name.
12255
12256 @item alias
12257 @opindex fdump-tree-alias
12258 Dump aliasing information for each function. The file name is made by
12259 appending @file{.alias} to the source file name.
12260
12261 @item ccp
12262 @opindex fdump-tree-ccp
12263 Dump each function after CCP@. The file name is made by appending
12264 @file{.ccp} to the source file name.
12265
12266 @item storeccp
12267 @opindex fdump-tree-storeccp
12268 Dump each function after STORE-CCP@. The file name is made by appending
12269 @file{.storeccp} to the source file name.
12270
12271 @item pre
12272 @opindex fdump-tree-pre
12273 Dump trees after partial redundancy elimination and/or code hoisting.
12274 The file name is made by appending @file{.pre} to the source file name.
12275
12276 @item fre
12277 @opindex fdump-tree-fre
12278 Dump trees after full redundancy elimination. The file name is made
12279 by appending @file{.fre} to the source file name.
12280
12281 @item copyprop
12282 @opindex fdump-tree-copyprop
12283 Dump trees after copy propagation. The file name is made
12284 by appending @file{.copyprop} to the source file name.
12285
12286 @item store_copyprop
12287 @opindex fdump-tree-store_copyprop
12288 Dump trees after store copy-propagation. The file name is made
12289 by appending @file{.store_copyprop} to the source file name.
12290
12291 @item dce
12292 @opindex fdump-tree-dce
12293 Dump each function after dead code elimination. The file name is made by
12294 appending @file{.dce} to the source file name.
12295
12296 @item sra
12297 @opindex fdump-tree-sra
12298 Dump each function after performing scalar replacement of aggregates. The
12299 file name is made by appending @file{.sra} to the source file name.
12300
12301 @item sink
12302 @opindex fdump-tree-sink
12303 Dump each function after performing code sinking. The file name is made
12304 by appending @file{.sink} to the source file name.
12305
12306 @item dom
12307 @opindex fdump-tree-dom
12308 Dump each function after applying dominator tree optimizations. The file
12309 name is made by appending @file{.dom} to the source file name.
12310
12311 @item dse
12312 @opindex fdump-tree-dse
12313 Dump each function after applying dead store elimination. The file
12314 name is made by appending @file{.dse} to the source file name.
12315
12316 @item phiopt
12317 @opindex fdump-tree-phiopt
12318 Dump each function after optimizing PHI nodes into straightline code. The file
12319 name is made by appending @file{.phiopt} to the source file name.
12320
12321 @item backprop
12322 @opindex fdump-tree-backprop
12323 Dump each function after back-propagating use information up the definition
12324 chain. The file name is made by appending @file{.backprop} to the
12325 source file name.
12326
12327 @item forwprop
12328 @opindex fdump-tree-forwprop
12329 Dump each function after forward propagating single use variables. The file
12330 name is made by appending @file{.forwprop} to the source file name.
12331
12332 @item nrv
12333 @opindex fdump-tree-nrv
12334 Dump each function after applying the named return value optimization on
12335 generic trees. The file name is made by appending @file{.nrv} to the source
12336 file name.
12337
12338 @item vect
12339 @opindex fdump-tree-vect
12340 Dump each function after applying vectorization of loops. The file name is
12341 made by appending @file{.vect} to the source file name.
12342
12343 @item slp
12344 @opindex fdump-tree-slp
12345 Dump each function after applying vectorization of basic blocks. The file name
12346 is made by appending @file{.slp} to the source file name.
12347
12348 @item vrp
12349 @opindex fdump-tree-vrp
12350 Dump each function after Value Range Propagation (VRP). The file name
12351 is made by appending @file{.vrp} to the source file name.
12352
12353 @item oaccdevlow
12354 @opindex fdump-tree-oaccdevlow
12355 Dump each function after applying device-specific OpenACC transformations.
12356 The file name is made by appending @file{.oaccdevlow} to the source file name.
12357
12358 @item all
12359 @opindex fdump-tree-all
12360 Enable all the available tree dumps with the flags provided in this option.
12361 @end table
12362
12363 @item -fopt-info
12364 @itemx -fopt-info-@var{options}
12365 @itemx -fopt-info-@var{options}=@var{filename}
12366 @opindex fopt-info
12367 Controls optimization dumps from various optimization passes. If the
12368 @samp{-@var{options}} form is used, @var{options} is a list of
12369 @samp{-} separated option keywords to select the dump details and
12370 optimizations.
12371
12372 The @var{options} can be divided into two groups: options describing the
12373 verbosity of the dump, and options describing which optimizations
12374 should be included. The options from both the groups can be freely
12375 mixed as they are non-overlapping. However, in case of any conflicts,
12376 the later options override the earlier options on the command
12377 line.
12378
12379 The following options control the dump verbosity:
12380
12381 @table @samp
12382 @item optimized
12383 Print information when an optimization is successfully applied. It is
12384 up to a pass to decide which information is relevant. For example, the
12385 vectorizer passes print the source location of loops which are
12386 successfully vectorized.
12387 @item missed
12388 Print information about missed optimizations. Individual passes
12389 control which information to include in the output.
12390 @item note
12391 Print verbose information about optimizations, such as certain
12392 transformations, more detailed messages about decisions etc.
12393 @item all
12394 Print detailed optimization information. This includes
12395 @samp{optimized}, @samp{missed}, and @samp{note}.
12396 @end table
12397
12398 One or more of the following option keywords can be used to describe a
12399 group of optimizations:
12400
12401 @table @samp
12402 @item ipa
12403 Enable dumps from all interprocedural optimizations.
12404 @item loop
12405 Enable dumps from all loop optimizations.
12406 @item inline
12407 Enable dumps from all inlining optimizations.
12408 @item vec
12409 Enable dumps from all vectorization optimizations.
12410 @item optall
12411 Enable dumps from all optimizations. This is a superset of
12412 the optimization groups listed above.
12413 @end table
12414
12415 If @var{options} is
12416 omitted, it defaults to @samp{optimized-optall}, which means to dump all
12417 info about successful optimizations from all the passes.
12418
12419 If the @var{filename} is provided, then the dumps from all the
12420 applicable optimizations are concatenated into the @var{filename}.
12421 Otherwise the dump is output onto @file{stderr}. Though multiple
12422 @option{-fopt-info} options are accepted, only one of them can include
12423 a @var{filename}. If other filenames are provided then all but the
12424 first such option are ignored.
12425
12426 Note that the output @var{filename} is overwritten
12427 in case of multiple translation units. If a combined output from
12428 multiple translation units is desired, @file{stderr} should be used
12429 instead.
12430
12431 In the following example, the optimization info is output to
12432 @file{stderr}:
12433
12434 @smallexample
12435 gcc -O3 -fopt-info
12436 @end smallexample
12437
12438 This example:
12439 @smallexample
12440 gcc -O3 -fopt-info-missed=missed.all
12441 @end smallexample
12442
12443 @noindent
12444 outputs missed optimization report from all the passes into
12445 @file{missed.all}, and this one:
12446
12447 @smallexample
12448 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
12449 @end smallexample
12450
12451 @noindent
12452 prints information about missed optimization opportunities from
12453 vectorization passes on @file{stderr}.
12454 Note that @option{-fopt-info-vec-missed} is equivalent to
12455 @option{-fopt-info-missed-vec}.
12456
12457 As another example,
12458 @smallexample
12459 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
12460 @end smallexample
12461
12462 @noindent
12463 outputs information about missed optimizations as well as
12464 optimized locations from all the inlining passes into
12465 @file{inline.txt}.
12466
12467 Finally, consider:
12468
12469 @smallexample
12470 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
12471 @end smallexample
12472
12473 @noindent
12474 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
12475 in conflict since only one output file is allowed. In this case, only
12476 the first option takes effect and the subsequent options are
12477 ignored. Thus only @file{vec.miss} is produced which contains
12478 dumps from the vectorizer about missed opportunities.
12479
12480 @item -fsched-verbose=@var{n}
12481 @opindex fsched-verbose
12482 On targets that use instruction scheduling, this option controls the
12483 amount of debugging output the scheduler prints to the dump files.
12484
12485 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
12486 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
12487 For @var{n} greater than one, it also output basic block probabilities,
12488 detailed ready list information and unit/insn info. For @var{n} greater
12489 than two, it includes RTL at abort point, control-flow and regions info.
12490 And for @var{n} over four, @option{-fsched-verbose} also includes
12491 dependence info.
12492
12493
12494
12495 @item -fenable-@var{kind}-@var{pass}
12496 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
12497 @opindex fdisable-
12498 @opindex fenable-
12499
12500 This is a set of options that are used to explicitly disable/enable
12501 optimization passes. These options are intended for use for debugging GCC.
12502 Compiler users should use regular options for enabling/disabling
12503 passes instead.
12504
12505 @table @gcctabopt
12506
12507 @item -fdisable-ipa-@var{pass}
12508 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12509 statically invoked in the compiler multiple times, the pass name should be
12510 appended with a sequential number starting from 1.
12511
12512 @item -fdisable-rtl-@var{pass}
12513 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
12514 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
12515 statically invoked in the compiler multiple times, the pass name should be
12516 appended with a sequential number starting from 1. @var{range-list} is a
12517 comma-separated list of function ranges or assembler names. Each range is a number
12518 pair separated by a colon. The range is inclusive in both ends. If the range
12519 is trivial, the number pair can be simplified as a single number. If the
12520 function's call graph node's @var{uid} falls within one of the specified ranges,
12521 the @var{pass} is disabled for that function. The @var{uid} is shown in the
12522 function header of a dump file, and the pass names can be dumped by using
12523 option @option{-fdump-passes}.
12524
12525 @item -fdisable-tree-@var{pass}
12526 @itemx -fdisable-tree-@var{pass}=@var{range-list}
12527 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
12528 option arguments.
12529
12530 @item -fenable-ipa-@var{pass}
12531 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12532 statically invoked in the compiler multiple times, the pass name should be
12533 appended with a sequential number starting from 1.
12534
12535 @item -fenable-rtl-@var{pass}
12536 @itemx -fenable-rtl-@var{pass}=@var{range-list}
12537 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
12538 description and examples.
12539
12540 @item -fenable-tree-@var{pass}
12541 @itemx -fenable-tree-@var{pass}=@var{range-list}
12542 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
12543 of option arguments.
12544
12545 @end table
12546
12547 Here are some examples showing uses of these options.
12548
12549 @smallexample
12550
12551 # disable ccp1 for all functions
12552 -fdisable-tree-ccp1
12553 # disable complete unroll for function whose cgraph node uid is 1
12554 -fenable-tree-cunroll=1
12555 # disable gcse2 for functions at the following ranges [1,1],
12556 # [300,400], and [400,1000]
12557 # disable gcse2 for functions foo and foo2
12558 -fdisable-rtl-gcse2=foo,foo2
12559 # disable early inlining
12560 -fdisable-tree-einline
12561 # disable ipa inlining
12562 -fdisable-ipa-inline
12563 # enable tree full unroll
12564 -fenable-tree-unroll
12565
12566 @end smallexample
12567
12568 @item -fchecking
12569 @itemx -fchecking=@var{n}
12570 @opindex fchecking
12571 @opindex fno-checking
12572 Enable internal consistency checking. The default depends on
12573 the compiler configuration. @option{-fchecking=2} enables further
12574 internal consistency checking that might affect code generation.
12575
12576 @item -frandom-seed=@var{string}
12577 @opindex frandom-seed
12578 This option provides a seed that GCC uses in place of
12579 random numbers in generating certain symbol names
12580 that have to be different in every compiled file. It is also used to
12581 place unique stamps in coverage data files and the object files that
12582 produce them. You can use the @option{-frandom-seed} option to produce
12583 reproducibly identical object files.
12584
12585 The @var{string} can either be a number (decimal, octal or hex) or an
12586 arbitrary string (in which case it's converted to a number by
12587 computing CRC32).
12588
12589 The @var{string} should be different for every file you compile.
12590
12591 @item -save-temps
12592 @itemx -save-temps=cwd
12593 @opindex save-temps
12594 Store the usual ``temporary'' intermediate files permanently; place them
12595 in the current directory and name them based on the source file. Thus,
12596 compiling @file{foo.c} with @option{-c -save-temps} produces files
12597 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
12598 preprocessed @file{foo.i} output file even though the compiler now
12599 normally uses an integrated preprocessor.
12600
12601 When used in combination with the @option{-x} command-line option,
12602 @option{-save-temps} is sensible enough to avoid over writing an
12603 input source file with the same extension as an intermediate file.
12604 The corresponding intermediate file may be obtained by renaming the
12605 source file before using @option{-save-temps}.
12606
12607 If you invoke GCC in parallel, compiling several different source
12608 files that share a common base name in different subdirectories or the
12609 same source file compiled for multiple output destinations, it is
12610 likely that the different parallel compilers will interfere with each
12611 other, and overwrite the temporary files. For instance:
12612
12613 @smallexample
12614 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
12615 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
12616 @end smallexample
12617
12618 may result in @file{foo.i} and @file{foo.o} being written to
12619 simultaneously by both compilers.
12620
12621 @item -save-temps=obj
12622 @opindex save-temps=obj
12623 Store the usual ``temporary'' intermediate files permanently. If the
12624 @option{-o} option is used, the temporary files are based on the
12625 object file. If the @option{-o} option is not used, the
12626 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
12627
12628 For example:
12629
12630 @smallexample
12631 gcc -save-temps=obj -c foo.c
12632 gcc -save-temps=obj -c bar.c -o dir/xbar.o
12633 gcc -save-temps=obj foobar.c -o dir2/yfoobar
12634 @end smallexample
12635
12636 @noindent
12637 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
12638 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
12639 @file{dir2/yfoobar.o}.
12640
12641 @item -time@r{[}=@var{file}@r{]}
12642 @opindex time
12643 Report the CPU time taken by each subprocess in the compilation
12644 sequence. For C source files, this is the compiler proper and assembler
12645 (plus the linker if linking is done).
12646
12647 Without the specification of an output file, the output looks like this:
12648
12649 @smallexample
12650 # cc1 0.12 0.01
12651 # as 0.00 0.01
12652 @end smallexample
12653
12654 The first number on each line is the ``user time'', that is time spent
12655 executing the program itself. The second number is ``system time'',
12656 time spent executing operating system routines on behalf of the program.
12657 Both numbers are in seconds.
12658
12659 With the specification of an output file, the output is appended to the
12660 named file, and it looks like this:
12661
12662 @smallexample
12663 0.12 0.01 cc1 @var{options}
12664 0.00 0.01 as @var{options}
12665 @end smallexample
12666
12667 The ``user time'' and the ``system time'' are moved before the program
12668 name, and the options passed to the program are displayed, so that one
12669 can later tell what file was being compiled, and with which options.
12670
12671 @item -fdump-final-insns@r{[}=@var{file}@r{]}
12672 @opindex fdump-final-insns
12673 Dump the final internal representation (RTL) to @var{file}. If the
12674 optional argument is omitted (or if @var{file} is @code{.}), the name
12675 of the dump file is determined by appending @code{.gkd} to the
12676 compilation output file name.
12677
12678 @item -fcompare-debug@r{[}=@var{opts}@r{]}
12679 @opindex fcompare-debug
12680 @opindex fno-compare-debug
12681 If no error occurs during compilation, run the compiler a second time,
12682 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
12683 passed to the second compilation. Dump the final internal
12684 representation in both compilations, and print an error if they differ.
12685
12686 If the equal sign is omitted, the default @option{-gtoggle} is used.
12687
12688 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
12689 and nonzero, implicitly enables @option{-fcompare-debug}. If
12690 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
12691 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
12692 is used.
12693
12694 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
12695 is equivalent to @option{-fno-compare-debug}, which disables the dumping
12696 of the final representation and the second compilation, preventing even
12697 @env{GCC_COMPARE_DEBUG} from taking effect.
12698
12699 To verify full coverage during @option{-fcompare-debug} testing, set
12700 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
12701 which GCC rejects as an invalid option in any actual compilation
12702 (rather than preprocessing, assembly or linking). To get just a
12703 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
12704 not overridden} will do.
12705
12706 @item -fcompare-debug-second
12707 @opindex fcompare-debug-second
12708 This option is implicitly passed to the compiler for the second
12709 compilation requested by @option{-fcompare-debug}, along with options to
12710 silence warnings, and omitting other options that would cause
12711 side-effect compiler outputs to files or to the standard output. Dump
12712 files and preserved temporary files are renamed so as to contain the
12713 @code{.gk} additional extension during the second compilation, to avoid
12714 overwriting those generated by the first.
12715
12716 When this option is passed to the compiler driver, it causes the
12717 @emph{first} compilation to be skipped, which makes it useful for little
12718 other than debugging the compiler proper.
12719
12720 @item -gtoggle
12721 @opindex gtoggle
12722 Turn off generation of debug info, if leaving out this option
12723 generates it, or turn it on at level 2 otherwise. The position of this
12724 argument in the command line does not matter; it takes effect after all
12725 other options are processed, and it does so only once, no matter how
12726 many times it is given. This is mainly intended to be used with
12727 @option{-fcompare-debug}.
12728
12729 @item -fvar-tracking-assignments-toggle
12730 @opindex fvar-tracking-assignments-toggle
12731 @opindex fno-var-tracking-assignments-toggle
12732 Toggle @option{-fvar-tracking-assignments}, in the same way that
12733 @option{-gtoggle} toggles @option{-g}.
12734
12735 @item -Q
12736 @opindex Q
12737 Makes the compiler print out each function name as it is compiled, and
12738 print some statistics about each pass when it finishes.
12739
12740 @item -ftime-report
12741 @opindex ftime-report
12742 Makes the compiler print some statistics about the time consumed by each
12743 pass when it finishes.
12744
12745 @item -fira-verbose=@var{n}
12746 @opindex fira-verbose
12747 Control the verbosity of the dump file for the integrated register allocator.
12748 The default value is 5. If the value @var{n} is greater or equal to 10,
12749 the dump output is sent to stderr using the same format as @var{n} minus 10.
12750
12751 @item -flto-report
12752 @opindex flto-report
12753 Prints a report with internal details on the workings of the link-time
12754 optimizer. The contents of this report vary from version to version.
12755 It is meant to be useful to GCC developers when processing object
12756 files in LTO mode (via @option{-flto}).
12757
12758 Disabled by default.
12759
12760 @item -flto-report-wpa
12761 @opindex flto-report-wpa
12762 Like @option{-flto-report}, but only print for the WPA phase of Link
12763 Time Optimization.
12764
12765 @item -fmem-report
12766 @opindex fmem-report
12767 Makes the compiler print some statistics about permanent memory
12768 allocation when it finishes.
12769
12770 @item -fmem-report-wpa
12771 @opindex fmem-report-wpa
12772 Makes the compiler print some statistics about permanent memory
12773 allocation for the WPA phase only.
12774
12775 @item -fpre-ipa-mem-report
12776 @opindex fpre-ipa-mem-report
12777 @item -fpost-ipa-mem-report
12778 @opindex fpost-ipa-mem-report
12779 Makes the compiler print some statistics about permanent memory
12780 allocation before or after interprocedural optimization.
12781
12782 @item -fprofile-report
12783 @opindex fprofile-report
12784 Makes the compiler print some statistics about consistency of the
12785 (estimated) profile and effect of individual passes.
12786
12787 @item -fstack-usage
12788 @opindex fstack-usage
12789 Makes the compiler output stack usage information for the program, on a
12790 per-function basis. The filename for the dump is made by appending
12791 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
12792 the output file, if explicitly specified and it is not an executable,
12793 otherwise it is the basename of the source file. An entry is made up
12794 of three fields:
12795
12796 @itemize
12797 @item
12798 The name of the function.
12799 @item
12800 A number of bytes.
12801 @item
12802 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
12803 @end itemize
12804
12805 The qualifier @code{static} means that the function manipulates the stack
12806 statically: a fixed number of bytes are allocated for the frame on function
12807 entry and released on function exit; no stack adjustments are otherwise made
12808 in the function. The second field is this fixed number of bytes.
12809
12810 The qualifier @code{dynamic} means that the function manipulates the stack
12811 dynamically: in addition to the static allocation described above, stack
12812 adjustments are made in the body of the function, for example to push/pop
12813 arguments around function calls. If the qualifier @code{bounded} is also
12814 present, the amount of these adjustments is bounded at compile time and
12815 the second field is an upper bound of the total amount of stack used by
12816 the function. If it is not present, the amount of these adjustments is
12817 not bounded at compile time and the second field only represents the
12818 bounded part.
12819
12820 @item -fstats
12821 @opindex fstats
12822 Emit statistics about front-end processing at the end of the compilation.
12823 This option is supported only by the C++ front end, and
12824 the information is generally only useful to the G++ development team.
12825
12826 @item -fdbg-cnt-list
12827 @opindex fdbg-cnt-list
12828 Print the name and the counter upper bound for all debug counters.
12829
12830
12831 @item -fdbg-cnt=@var{counter-value-list}
12832 @opindex fdbg-cnt
12833 Set the internal debug counter upper bound. @var{counter-value-list}
12834 is a comma-separated list of @var{name}:@var{value} pairs
12835 which sets the upper bound of each debug counter @var{name} to @var{value}.
12836 All debug counters have the initial upper bound of @code{UINT_MAX};
12837 thus @code{dbg_cnt} returns true always unless the upper bound
12838 is set by this option.
12839 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
12840 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
12841
12842 @item -print-file-name=@var{library}
12843 @opindex print-file-name
12844 Print the full absolute name of the library file @var{library} that
12845 would be used when linking---and don't do anything else. With this
12846 option, GCC does not compile or link anything; it just prints the
12847 file name.
12848
12849 @item -print-multi-directory
12850 @opindex print-multi-directory
12851 Print the directory name corresponding to the multilib selected by any
12852 other switches present in the command line. This directory is supposed
12853 to exist in @env{GCC_EXEC_PREFIX}.
12854
12855 @item -print-multi-lib
12856 @opindex print-multi-lib
12857 Print the mapping from multilib directory names to compiler switches
12858 that enable them. The directory name is separated from the switches by
12859 @samp{;}, and each switch starts with an @samp{@@} instead of the
12860 @samp{-}, without spaces between multiple switches. This is supposed to
12861 ease shell processing.
12862
12863 @item -print-multi-os-directory
12864 @opindex print-multi-os-directory
12865 Print the path to OS libraries for the selected
12866 multilib, relative to some @file{lib} subdirectory. If OS libraries are
12867 present in the @file{lib} subdirectory and no multilibs are used, this is
12868 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
12869 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
12870 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
12871 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
12872
12873 @item -print-multiarch
12874 @opindex print-multiarch
12875 Print the path to OS libraries for the selected multiarch,
12876 relative to some @file{lib} subdirectory.
12877
12878 @item -print-prog-name=@var{program}
12879 @opindex print-prog-name
12880 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
12881
12882 @item -print-libgcc-file-name
12883 @opindex print-libgcc-file-name
12884 Same as @option{-print-file-name=libgcc.a}.
12885
12886 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
12887 but you do want to link with @file{libgcc.a}. You can do:
12888
12889 @smallexample
12890 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
12891 @end smallexample
12892
12893 @item -print-search-dirs
12894 @opindex print-search-dirs
12895 Print the name of the configured installation directory and a list of
12896 program and library directories @command{gcc} searches---and don't do anything else.
12897
12898 This is useful when @command{gcc} prints the error message
12899 @samp{installation problem, cannot exec cpp0: No such file or directory}.
12900 To resolve this you either need to put @file{cpp0} and the other compiler
12901 components where @command{gcc} expects to find them, or you can set the environment
12902 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
12903 Don't forget the trailing @samp{/}.
12904 @xref{Environment Variables}.
12905
12906 @item -print-sysroot
12907 @opindex print-sysroot
12908 Print the target sysroot directory that is used during
12909 compilation. This is the target sysroot specified either at configure
12910 time or using the @option{--sysroot} option, possibly with an extra
12911 suffix that depends on compilation options. If no target sysroot is
12912 specified, the option prints nothing.
12913
12914 @item -print-sysroot-headers-suffix
12915 @opindex print-sysroot-headers-suffix
12916 Print the suffix added to the target sysroot when searching for
12917 headers, or give an error if the compiler is not configured with such
12918 a suffix---and don't do anything else.
12919
12920 @item -dumpmachine
12921 @opindex dumpmachine
12922 Print the compiler's target machine (for example,
12923 @samp{i686-pc-linux-gnu})---and don't do anything else.
12924
12925 @item -dumpversion
12926 @opindex dumpversion
12927 Print the compiler version (for example, @code{3.0})---and don't do
12928 anything else.
12929
12930 @item -dumpspecs
12931 @opindex dumpspecs
12932 Print the compiler's built-in specs---and don't do anything else. (This
12933 is used when GCC itself is being built.) @xref{Spec Files}.
12934 @end table
12935
12936 @node Submodel Options
12937 @section Machine-Dependent Options
12938 @cindex submodel options
12939 @cindex specifying hardware config
12940 @cindex hardware models and configurations, specifying
12941 @cindex target-dependent options
12942 @cindex machine-dependent options
12943
12944 Each target machine supported by GCC can have its own options---for
12945 example, to allow you to compile for a particular processor variant or
12946 ABI, or to control optimizations specific to that machine. By
12947 convention, the names of machine-specific options start with
12948 @samp{-m}.
12949
12950 Some configurations of the compiler also support additional target-specific
12951 options, usually for compatibility with other compilers on the same
12952 platform.
12953
12954 @c This list is ordered alphanumerically by subsection name.
12955 @c It should be the same order and spelling as these options are listed
12956 @c in Machine Dependent Options
12957
12958 @menu
12959 * AArch64 Options::
12960 * Adapteva Epiphany Options::
12961 * ARC Options::
12962 * ARM Options::
12963 * AVR Options::
12964 * Blackfin Options::
12965 * C6X Options::
12966 * CRIS Options::
12967 * CR16 Options::
12968 * Darwin Options::
12969 * DEC Alpha Options::
12970 * FR30 Options::
12971 * FT32 Options::
12972 * FRV Options::
12973 * GNU/Linux Options::
12974 * H8/300 Options::
12975 * HPPA Options::
12976 * IA-64 Options::
12977 * LM32 Options::
12978 * M32C Options::
12979 * M32R/D Options::
12980 * M680x0 Options::
12981 * MCore Options::
12982 * MeP Options::
12983 * MicroBlaze Options::
12984 * MIPS Options::
12985 * MMIX Options::
12986 * MN10300 Options::
12987 * Moxie Options::
12988 * MSP430 Options::
12989 * NDS32 Options::
12990 * Nios II Options::
12991 * Nvidia PTX Options::
12992 * PDP-11 Options::
12993 * picoChip Options::
12994 * PowerPC Options::
12995 * RL78 Options::
12996 * RS/6000 and PowerPC Options::
12997 * RX Options::
12998 * S/390 and zSeries Options::
12999 * Score Options::
13000 * SH Options::
13001 * Solaris 2 Options::
13002 * SPARC Options::
13003 * SPU Options::
13004 * System V Options::
13005 * TILE-Gx Options::
13006 * TILEPro Options::
13007 * V850 Options::
13008 * VAX Options::
13009 * Visium Options::
13010 * VMS Options::
13011 * VxWorks Options::
13012 * x86 Options::
13013 * x86 Windows Options::
13014 * Xstormy16 Options::
13015 * Xtensa Options::
13016 * zSeries Options::
13017 @end menu
13018
13019 @node AArch64 Options
13020 @subsection AArch64 Options
13021 @cindex AArch64 Options
13022
13023 These options are defined for AArch64 implementations:
13024
13025 @table @gcctabopt
13026
13027 @item -mabi=@var{name}
13028 @opindex mabi
13029 Generate code for the specified data model. Permissible values
13030 are @samp{ilp32} for SysV-like data model where int, long int and pointers
13031 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
13032 but long int and pointers are 64 bits.
13033
13034 The default depends on the specific target configuration. Note that
13035 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
13036 entire program with the same ABI, and link with a compatible set of libraries.
13037
13038 @item -mbig-endian
13039 @opindex mbig-endian
13040 Generate big-endian code. This is the default when GCC is configured for an
13041 @samp{aarch64_be-*-*} target.
13042
13043 @item -mgeneral-regs-only
13044 @opindex mgeneral-regs-only
13045 Generate code which uses only the general-purpose registers. This will prevent
13046 the compiler from using floating-point and Advanced SIMD registers but will not
13047 impose any restrictions on the assembler.
13048
13049 @item -mlittle-endian
13050 @opindex mlittle-endian
13051 Generate little-endian code. This is the default when GCC is configured for an
13052 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
13053
13054 @item -mcmodel=tiny
13055 @opindex mcmodel=tiny
13056 Generate code for the tiny code model. The program and its statically defined
13057 symbols must be within 1MB of each other. Programs can be statically or
13058 dynamically linked.
13059
13060 @item -mcmodel=small
13061 @opindex mcmodel=small
13062 Generate code for the small code model. The program and its statically defined
13063 symbols must be within 4GB of each other. Programs can be statically or
13064 dynamically linked. This is the default code model.
13065
13066 @item -mcmodel=large
13067 @opindex mcmodel=large
13068 Generate code for the large code model. This makes no assumptions about
13069 addresses and sizes of sections. Programs can be statically linked only.
13070
13071 @item -mstrict-align
13072 @opindex mstrict-align
13073 Avoid generating memory accesses that may not be aligned on a natural object
13074 boundary as described in the architecture specification.
13075
13076 @item -momit-leaf-frame-pointer
13077 @itemx -mno-omit-leaf-frame-pointer
13078 @opindex momit-leaf-frame-pointer
13079 @opindex mno-omit-leaf-frame-pointer
13080 Omit or keep the frame pointer in leaf functions. The former behavior is the
13081 default.
13082
13083 @item -mtls-dialect=desc
13084 @opindex mtls-dialect=desc
13085 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
13086 of TLS variables. This is the default.
13087
13088 @item -mtls-dialect=traditional
13089 @opindex mtls-dialect=traditional
13090 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
13091 of TLS variables.
13092
13093 @item -mtls-size=@var{size}
13094 @opindex mtls-size
13095 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
13096 This option requires binutils 2.26 or newer.
13097
13098 @item -mfix-cortex-a53-835769
13099 @itemx -mno-fix-cortex-a53-835769
13100 @opindex mfix-cortex-a53-835769
13101 @opindex mno-fix-cortex-a53-835769
13102 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
13103 This involves inserting a NOP instruction between memory instructions and
13104 64-bit integer multiply-accumulate instructions.
13105
13106 @item -mfix-cortex-a53-843419
13107 @itemx -mno-fix-cortex-a53-843419
13108 @opindex mfix-cortex-a53-843419
13109 @opindex mno-fix-cortex-a53-843419
13110 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
13111 This erratum workaround is made at link time and this will only pass the
13112 corresponding flag to the linker.
13113
13114 @item -mlow-precision-recip-sqrt
13115 @item -mno-low-precision-recip-sqrt
13116 @opindex mlow-precision-recip-sqrt
13117 @opindex mno-low-precision-recip-sqrt
13118 Enable or disable the reciprocal square root approximation.
13119 This option only has an effect if @option{-ffast-math} or
13120 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13121 precision of reciprocal square root results to about 16 bits for
13122 single precision and to 32 bits for double precision.
13123
13124 @item -mlow-precision-sqrt
13125 @item -mno-low-precision-sqrt
13126 @opindex -mlow-precision-sqrt
13127 @opindex -mno-low-precision-sqrt
13128 Enable or disable the square root approximation.
13129 This option only has an effect if @option{-ffast-math} or
13130 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13131 precision of square root results to about 16 bits for
13132 single precision and to 32 bits for double precision.
13133 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
13134
13135 @item -mlow-precision-div
13136 @item -mno-low-precision-div
13137 @opindex -mlow-precision-div
13138 @opindex -mno-low-precision-div
13139 Enable or disable the division approximation.
13140 This option only has an effect if @option{-ffast-math} or
13141 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13142 precision of division results to about 16 bits for
13143 single precision and to 32 bits for double precision.
13144
13145 @item -march=@var{name}
13146 @opindex march
13147 Specify the name of the target architecture and, optionally, one or
13148 more feature modifiers. This option has the form
13149 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
13150
13151 The permissible values for @var{arch} are @samp{armv8-a},
13152 @samp{armv8.1-a}, @samp{armv8.2-a} or @var{native}.
13153
13154 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
13155 support for the ARMv8.2-A architecture extensions.
13156
13157 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
13158 support for the ARMv8.1-A architecture extension. In particular, it
13159 enables the @samp{+crc} and @samp{+lse} features.
13160
13161 The value @samp{native} is available on native AArch64 GNU/Linux and
13162 causes the compiler to pick the architecture of the host system. This
13163 option has no effect if the compiler is unable to recognize the
13164 architecture of the host system,
13165
13166 The permissible values for @var{feature} are listed in the sub-section
13167 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13168 Feature Modifiers}. Where conflicting feature modifiers are
13169 specified, the right-most feature is used.
13170
13171 GCC uses @var{name} to determine what kind of instructions it can emit
13172 when generating assembly code. If @option{-march} is specified
13173 without either of @option{-mtune} or @option{-mcpu} also being
13174 specified, the code is tuned to perform well across a range of target
13175 processors implementing the target architecture.
13176
13177 @item -mtune=@var{name}
13178 @opindex mtune
13179 Specify the name of the target processor for which GCC should tune the
13180 performance of the code. Permissible values for this option are:
13181 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
13182 @samp{cortex-a72}, @samp{cortex-a73}, @samp{exynos-m1}, @samp{qdf24xx},
13183 @samp{thunderx}, @samp{xgene1}, @samp{vulcan}, @samp{cortex-a57.cortex-a53},
13184 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
13185 @samp{cortex-a73.cortex-a53}, @samp{native}.
13186
13187 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
13188 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}
13189 specify that GCC should tune for a big.LITTLE system.
13190
13191 Additionally on native AArch64 GNU/Linux systems the value
13192 @samp{native} tunes performance to the host system. This option has no effect
13193 if the compiler is unable to recognize the processor of the host system.
13194
13195 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
13196 are specified, the code is tuned to perform well across a range
13197 of target processors.
13198
13199 This option cannot be suffixed by feature modifiers.
13200
13201 @item -mcpu=@var{name}
13202 @opindex mcpu
13203 Specify the name of the target processor, optionally suffixed by one
13204 or more feature modifiers. This option has the form
13205 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
13206 the permissible values for @var{cpu} are the same as those available
13207 for @option{-mtune}. The permissible values for @var{feature} are
13208 documented in the sub-section on
13209 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13210 Feature Modifiers}. Where conflicting feature modifiers are
13211 specified, the right-most feature is used.
13212
13213 GCC uses @var{name} to determine what kind of instructions it can emit when
13214 generating assembly code (as if by @option{-march}) and to determine
13215 the target processor for which to tune for performance (as if
13216 by @option{-mtune}). Where this option is used in conjunction
13217 with @option{-march} or @option{-mtune}, those options take precedence
13218 over the appropriate part of this option.
13219
13220 @item -moverride=@var{string}
13221 @opindex moverride
13222 Override tuning decisions made by the back-end in response to a
13223 @option{-mtune=} switch. The syntax, semantics, and accepted values
13224 for @var{string} in this option are not guaranteed to be consistent
13225 across releases.
13226
13227 This option is only intended to be useful when developing GCC.
13228
13229 @item -mpc-relative-literal-loads
13230 @opindex mpc-relative-literal-loads
13231 Enable PC-relative literal loads. With this option literal pools are
13232 accessed using a single instruction and emitted after each function. This
13233 limits the maximum size of functions to 1MB. This is enabled by default for
13234 @option{-mcmodel=tiny}.
13235
13236 @end table
13237
13238 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
13239 @anchor{aarch64-feature-modifiers}
13240 @cindex @option{-march} feature modifiers
13241 @cindex @option{-mcpu} feature modifiers
13242 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
13243 the following and their inverses @option{no@var{feature}}:
13244
13245 @table @samp
13246 @item crc
13247 Enable CRC extension. This is on by default for
13248 @option{-march=armv8.1-a}.
13249 @item crypto
13250 Enable Crypto extension. This also enables Advanced SIMD and floating-point
13251 instructions.
13252 @item fp
13253 Enable floating-point instructions. This is on by default for all possible
13254 values for options @option{-march} and @option{-mcpu}.
13255 @item simd
13256 Enable Advanced SIMD instructions. This also enables floating-point
13257 instructions. This is on by default for all possible values for options
13258 @option{-march} and @option{-mcpu}.
13259 @item lse
13260 Enable Large System Extension instructions. This is on by default for
13261 @option{-march=armv8.1-a}.
13262 @item fp16
13263 Enable FP16 extension. This also enables floating-point instructions.
13264
13265 @end table
13266
13267 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
13268 Conversely, @option{nofp} implies @option{nosimd}, which implies
13269 @option{nocrypto}.
13270
13271 @node Adapteva Epiphany Options
13272 @subsection Adapteva Epiphany Options
13273
13274 These @samp{-m} options are defined for Adapteva Epiphany:
13275
13276 @table @gcctabopt
13277 @item -mhalf-reg-file
13278 @opindex mhalf-reg-file
13279 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
13280 That allows code to run on hardware variants that lack these registers.
13281
13282 @item -mprefer-short-insn-regs
13283 @opindex mprefer-short-insn-regs
13284 Preferentially allocate registers that allow short instruction generation.
13285 This can result in increased instruction count, so this may either reduce or
13286 increase overall code size.
13287
13288 @item -mbranch-cost=@var{num}
13289 @opindex mbranch-cost
13290 Set the cost of branches to roughly @var{num} ``simple'' instructions.
13291 This cost is only a heuristic and is not guaranteed to produce
13292 consistent results across releases.
13293
13294 @item -mcmove
13295 @opindex mcmove
13296 Enable the generation of conditional moves.
13297
13298 @item -mnops=@var{num}
13299 @opindex mnops
13300 Emit @var{num} NOPs before every other generated instruction.
13301
13302 @item -mno-soft-cmpsf
13303 @opindex mno-soft-cmpsf
13304 For single-precision floating-point comparisons, emit an @code{fsub} instruction
13305 and test the flags. This is faster than a software comparison, but can
13306 get incorrect results in the presence of NaNs, or when two different small
13307 numbers are compared such that their difference is calculated as zero.
13308 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
13309 software comparisons.
13310
13311 @item -mstack-offset=@var{num}
13312 @opindex mstack-offset
13313 Set the offset between the top of the stack and the stack pointer.
13314 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
13315 can be used by leaf functions without stack allocation.
13316 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
13317 Note also that this option changes the ABI; compiling a program with a
13318 different stack offset than the libraries have been compiled with
13319 generally does not work.
13320 This option can be useful if you want to evaluate if a different stack
13321 offset would give you better code, but to actually use a different stack
13322 offset to build working programs, it is recommended to configure the
13323 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
13324
13325 @item -mno-round-nearest
13326 @opindex mno-round-nearest
13327 Make the scheduler assume that the rounding mode has been set to
13328 truncating. The default is @option{-mround-nearest}.
13329
13330 @item -mlong-calls
13331 @opindex mlong-calls
13332 If not otherwise specified by an attribute, assume all calls might be beyond
13333 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
13334 function address into a register before performing a (otherwise direct) call.
13335 This is the default.
13336
13337 @item -mshort-calls
13338 @opindex short-calls
13339 If not otherwise specified by an attribute, assume all direct calls are
13340 in the range of the @code{b} / @code{bl} instructions, so use these instructions
13341 for direct calls. The default is @option{-mlong-calls}.
13342
13343 @item -msmall16
13344 @opindex msmall16
13345 Assume addresses can be loaded as 16-bit unsigned values. This does not
13346 apply to function addresses for which @option{-mlong-calls} semantics
13347 are in effect.
13348
13349 @item -mfp-mode=@var{mode}
13350 @opindex mfp-mode
13351 Set the prevailing mode of the floating-point unit.
13352 This determines the floating-point mode that is provided and expected
13353 at function call and return time. Making this mode match the mode you
13354 predominantly need at function start can make your programs smaller and
13355 faster by avoiding unnecessary mode switches.
13356
13357 @var{mode} can be set to one the following values:
13358
13359 @table @samp
13360 @item caller
13361 Any mode at function entry is valid, and retained or restored when
13362 the function returns, and when it calls other functions.
13363 This mode is useful for compiling libraries or other compilation units
13364 you might want to incorporate into different programs with different
13365 prevailing FPU modes, and the convenience of being able to use a single
13366 object file outweighs the size and speed overhead for any extra
13367 mode switching that might be needed, compared with what would be needed
13368 with a more specific choice of prevailing FPU mode.
13369
13370 @item truncate
13371 This is the mode used for floating-point calculations with
13372 truncating (i.e.@: round towards zero) rounding mode. That includes
13373 conversion from floating point to integer.
13374
13375 @item round-nearest
13376 This is the mode used for floating-point calculations with
13377 round-to-nearest-or-even rounding mode.
13378
13379 @item int
13380 This is the mode used to perform integer calculations in the FPU, e.g.@:
13381 integer multiply, or integer multiply-and-accumulate.
13382 @end table
13383
13384 The default is @option{-mfp-mode=caller}
13385
13386 @item -mnosplit-lohi
13387 @itemx -mno-postinc
13388 @itemx -mno-postmodify
13389 @opindex mnosplit-lohi
13390 @opindex mno-postinc
13391 @opindex mno-postmodify
13392 Code generation tweaks that disable, respectively, splitting of 32-bit
13393 loads, generation of post-increment addresses, and generation of
13394 post-modify addresses. The defaults are @option{msplit-lohi},
13395 @option{-mpost-inc}, and @option{-mpost-modify}.
13396
13397 @item -mnovect-double
13398 @opindex mno-vect-double
13399 Change the preferred SIMD mode to SImode. The default is
13400 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
13401
13402 @item -max-vect-align=@var{num}
13403 @opindex max-vect-align
13404 The maximum alignment for SIMD vector mode types.
13405 @var{num} may be 4 or 8. The default is 8.
13406 Note that this is an ABI change, even though many library function
13407 interfaces are unaffected if they don't use SIMD vector modes
13408 in places that affect size and/or alignment of relevant types.
13409
13410 @item -msplit-vecmove-early
13411 @opindex msplit-vecmove-early
13412 Split vector moves into single word moves before reload. In theory this
13413 can give better register allocation, but so far the reverse seems to be
13414 generally the case.
13415
13416 @item -m1reg-@var{reg}
13417 @opindex m1reg-
13418 Specify a register to hold the constant @minus{}1, which makes loading small negative
13419 constants and certain bitmasks faster.
13420 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
13421 which specify use of that register as a fixed register,
13422 and @samp{none}, which means that no register is used for this
13423 purpose. The default is @option{-m1reg-none}.
13424
13425 @end table
13426
13427 @node ARC Options
13428 @subsection ARC Options
13429 @cindex ARC options
13430
13431 The following options control the architecture variant for which code
13432 is being compiled:
13433
13434 @c architecture variants
13435 @table @gcctabopt
13436
13437 @item -mbarrel-shifter
13438 @opindex mbarrel-shifter
13439 Generate instructions supported by barrel shifter. This is the default
13440 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
13441
13442 @item -mcpu=@var{cpu}
13443 @opindex mcpu
13444 Set architecture type, register usage, and instruction scheduling
13445 parameters for @var{cpu}. There are also shortcut alias options
13446 available for backward compatibility and convenience. Supported
13447 values for @var{cpu} are
13448
13449 @table @samp
13450 @opindex mA6
13451 @opindex mARC600
13452 @item ARC600
13453 @item arc600
13454 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
13455
13456 @item ARC601
13457 @item arc601
13458 @opindex mARC601
13459 Compile for ARC601. Alias: @option{-mARC601}.
13460
13461 @item ARC700
13462 @item arc700
13463 @opindex mA7
13464 @opindex mARC700
13465 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
13466 This is the default when configured with @option{--with-cpu=arc700}@.
13467
13468 @item ARCEM
13469 @item arcem
13470 Compile for ARC EM.
13471
13472 @item ARCHS
13473 @item archs
13474 Compile for ARC HS.
13475 @end table
13476
13477 @item -mdpfp
13478 @opindex mdpfp
13479 @itemx -mdpfp-compact
13480 @opindex mdpfp-compact
13481 FPX: Generate Double Precision FPX instructions, tuned for the compact
13482 implementation.
13483
13484 @item -mdpfp-fast
13485 @opindex mdpfp-fast
13486 FPX: Generate Double Precision FPX instructions, tuned for the fast
13487 implementation.
13488
13489 @item -mno-dpfp-lrsr
13490 @opindex mno-dpfp-lrsr
13491 Disable LR and SR instructions from using FPX extension aux registers.
13492
13493 @item -mea
13494 @opindex mea
13495 Generate Extended arithmetic instructions. Currently only
13496 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
13497 supported. This is always enabled for @option{-mcpu=ARC700}.
13498
13499 @item -mno-mpy
13500 @opindex mno-mpy
13501 Do not generate mpy instructions for ARC700.
13502
13503 @item -mmul32x16
13504 @opindex mmul32x16
13505 Generate 32x16 bit multiply and mac instructions.
13506
13507 @item -mmul64
13508 @opindex mmul64
13509 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
13510
13511 @item -mnorm
13512 @opindex mnorm
13513 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
13514 is in effect.
13515
13516 @item -mspfp
13517 @opindex mspfp
13518 @itemx -mspfp-compact
13519 @opindex mspfp-compact
13520 FPX: Generate Single Precision FPX instructions, tuned for the compact
13521 implementation.
13522
13523 @item -mspfp-fast
13524 @opindex mspfp-fast
13525 FPX: Generate Single Precision FPX instructions, tuned for the fast
13526 implementation.
13527
13528 @item -msimd
13529 @opindex msimd
13530 Enable generation of ARC SIMD instructions via target-specific
13531 builtins. Only valid for @option{-mcpu=ARC700}.
13532
13533 @item -msoft-float
13534 @opindex msoft-float
13535 This option ignored; it is provided for compatibility purposes only.
13536 Software floating point code is emitted by default, and this default
13537 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
13538 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
13539 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
13540
13541 @item -mswap
13542 @opindex mswap
13543 Generate swap instructions.
13544
13545 @item -matomic
13546 @opindex matomic
13547 This enables Locked Load/Store Conditional extension to implement
13548 atomic memopry built-in functions. Not available for ARC 6xx or ARC
13549 EM cores.
13550
13551 @item -mdiv-rem
13552 @opindex mdiv-rem
13553 Enable DIV/REM instructions for ARCv2 cores.
13554
13555 @item -mcode-density
13556 @opindex mcode-density
13557 Enable code density instructions for ARC EM, default on for ARC HS.
13558
13559 @item -mll64
13560 @opindex mll64
13561 Enable double load/store operations for ARC HS cores.
13562
13563 @item -mtp-regno=@var{regno}
13564 @opindex mtp-regno
13565 Specify thread pointer register number.
13566
13567 @item -mmpy-option=@var{multo}
13568 @opindex mmpy-option
13569 Compile ARCv2 code with a multiplier design option. @samp{wlh1} is
13570 the default value. The recognized values for @var{multo} are:
13571
13572 @table @samp
13573 @item 0
13574 No multiplier available.
13575
13576 @item 1
13577 @opindex w
13578 The multiply option is set to w: 16x16 multiplier, fully pipelined.
13579 The following instructions are enabled: MPYW, and MPYUW.
13580
13581 @item 2
13582 @opindex wlh1
13583 The multiply option is set to wlh1: 32x32 multiplier, fully
13584 pipelined (1 stage). The following instructions are additionally
13585 enabled: MPY, MPYU, MPYM, MPYMU, and MPY_S.
13586
13587 @item 3
13588 @opindex wlh2
13589 The multiply option is set to wlh2: 32x32 multiplier, fully pipelined
13590 (2 stages). The following instructions are additionally enabled: MPY,
13591 MPYU, MPYM, MPYMU, and MPY_S.
13592
13593 @item 4
13594 @opindex wlh3
13595 The multiply option is set to wlh3: Two 16x16 multiplier, blocking,
13596 sequential. The following instructions are additionally enabled: MPY,
13597 MPYU, MPYM, MPYMU, and MPY_S.
13598
13599 @item 5
13600 @opindex wlh4
13601 The multiply option is set to wlh4: One 16x16 multiplier, blocking,
13602 sequential. The following instructions are additionally enabled: MPY,
13603 MPYU, MPYM, MPYMU, and MPY_S.
13604
13605 @item 6
13606 @opindex wlh5
13607 The multiply option is set to wlh5: One 32x4 multiplier, blocking,
13608 sequential. The following instructions are additionally enabled: MPY,
13609 MPYU, MPYM, MPYMU, and MPY_S.
13610
13611 @end table
13612
13613 This option is only available for ARCv2 cores@.
13614
13615 @item -mfpu=@var{fpu}
13616 @opindex mfpu
13617 Enables specific floating-point hardware extension for ARCv2
13618 core. Supported values for @var{fpu} are:
13619
13620 @table @samp
13621
13622 @item fpus
13623 @opindex fpus
13624 Enables support for single precision floating point hardware
13625 extensions@.
13626
13627 @item fpud
13628 @opindex fpud
13629 Enables support for double precision floating point hardware
13630 extensions. The single precision floating point extension is also
13631 enabled. Not available for ARC EM@.
13632
13633 @item fpuda
13634 @opindex fpuda
13635 Enables support for double precision floating point hardware
13636 extensions using double precision assist instructions. The single
13637 precision floating point extension is also enabled. This option is
13638 only available for ARC EM@.
13639
13640 @item fpuda_div
13641 @opindex fpuda_div
13642 Enables support for double precision floating point hardware
13643 extensions using double precision assist instructions, and simple
13644 precision square-root and divide hardware extensions. The single
13645 precision floating point extension is also enabled. This option is
13646 only available for ARC EM@.
13647
13648 @item fpuda_fma
13649 @opindex fpuda_fma
13650 Enables support for double precision floating point hardware
13651 extensions using double precision assist instructions, and simple
13652 precision fused multiple and add hardware extension. The single
13653 precision floating point extension is also enabled. This option is
13654 only available for ARC EM@.
13655
13656 @item fpuda_all
13657 @opindex fpuda_all
13658 Enables support for double precision floating point hardware
13659 extensions using double precision assist instructions, and all simple
13660 precision hardware extensions. The single precision floating point
13661 extension is also enabled. This option is only available for ARC EM@.
13662
13663 @item fpus_div
13664 @opindex fpus_div
13665 Enables support for single precision floating point, and single
13666 precision square-root and divide hardware extensions@.
13667
13668 @item fpud_div
13669 @opindex fpud_div
13670 Enables support for double precision floating point, and double
13671 precision square-root and divide hardware extensions. This option
13672 includes option @samp{fpus_div}. Not available for ARC EM@.
13673
13674 @item fpus_fma
13675 @opindex fpus_fma
13676 Enables support for single precision floating point, and single
13677 precision fused multiple and add hardware extensions@.
13678
13679 @item fpud_fma
13680 @opindex fpud_fma
13681 Enables support for double precision floating point, and double
13682 precision fused multiple and add hardware extensions. This option
13683 includes option @samp{fpus_fma}. Not available for ARC EM@.
13684
13685 @item fpus_all
13686 @opindex fpus_all
13687 Enables support for all single precision floating point hardware
13688 extensions@.
13689
13690 @item fpud_all
13691 @opindex fpud_all
13692 Enables support for all single and double precision floating point
13693 hardware extensions. Not available for ARC EM@.
13694
13695 @end table
13696
13697 @end table
13698
13699 The following options are passed through to the assembler, and also
13700 define preprocessor macro symbols.
13701
13702 @c Flags used by the assembler, but for which we define preprocessor
13703 @c macro symbols as well.
13704 @table @gcctabopt
13705 @item -mdsp-packa
13706 @opindex mdsp-packa
13707 Passed down to the assembler to enable the DSP Pack A extensions.
13708 Also sets the preprocessor symbol @code{__Xdsp_packa}.
13709
13710 @item -mdvbf
13711 @opindex mdvbf
13712 Passed down to the assembler to enable the dual viterbi butterfly
13713 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
13714
13715 @c ARC700 4.10 extension instruction
13716 @item -mlock
13717 @opindex mlock
13718 Passed down to the assembler to enable the Locked Load/Store
13719 Conditional extension. Also sets the preprocessor symbol
13720 @code{__Xlock}.
13721
13722 @item -mmac-d16
13723 @opindex mmac-d16
13724 Passed down to the assembler. Also sets the preprocessor symbol
13725 @code{__Xxmac_d16}.
13726
13727 @item -mmac-24
13728 @opindex mmac-24
13729 Passed down to the assembler. Also sets the preprocessor symbol
13730 @code{__Xxmac_24}.
13731
13732 @c ARC700 4.10 extension instruction
13733 @item -mrtsc
13734 @opindex mrtsc
13735 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
13736 extension instruction. Also sets the preprocessor symbol
13737 @code{__Xrtsc}.
13738
13739 @c ARC700 4.10 extension instruction
13740 @item -mswape
13741 @opindex mswape
13742 Passed down to the assembler to enable the swap byte ordering
13743 extension instruction. Also sets the preprocessor symbol
13744 @code{__Xswape}.
13745
13746 @item -mtelephony
13747 @opindex mtelephony
13748 Passed down to the assembler to enable dual and single operand
13749 instructions for telephony. Also sets the preprocessor symbol
13750 @code{__Xtelephony}.
13751
13752 @item -mxy
13753 @opindex mxy
13754 Passed down to the assembler to enable the XY Memory extension. Also
13755 sets the preprocessor symbol @code{__Xxy}.
13756
13757 @end table
13758
13759 The following options control how the assembly code is annotated:
13760
13761 @c Assembly annotation options
13762 @table @gcctabopt
13763 @item -misize
13764 @opindex misize
13765 Annotate assembler instructions with estimated addresses.
13766
13767 @item -mannotate-align
13768 @opindex mannotate-align
13769 Explain what alignment considerations lead to the decision to make an
13770 instruction short or long.
13771
13772 @end table
13773
13774 The following options are passed through to the linker:
13775
13776 @c options passed through to the linker
13777 @table @gcctabopt
13778 @item -marclinux
13779 @opindex marclinux
13780 Passed through to the linker, to specify use of the @code{arclinux} emulation.
13781 This option is enabled by default in tool chains built for
13782 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
13783 when profiling is not requested.
13784
13785 @item -marclinux_prof
13786 @opindex marclinux_prof
13787 Passed through to the linker, to specify use of the
13788 @code{arclinux_prof} emulation. This option is enabled by default in
13789 tool chains built for @w{@code{arc-linux-uclibc}} and
13790 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
13791
13792 @end table
13793
13794 The following options control the semantics of generated code:
13795
13796 @c semantically relevant code generation options
13797 @table @gcctabopt
13798 @item -mlong-calls
13799 @opindex mlong-calls
13800 Generate call insns as register indirect calls, thus providing access
13801 to the full 32-bit address range.
13802
13803 @item -mmedium-calls
13804 @opindex mmedium-calls
13805 Don't use less than 25 bit addressing range for calls, which is the
13806 offset available for an unconditional branch-and-link
13807 instruction. Conditional execution of function calls is suppressed, to
13808 allow use of the 25-bit range, rather than the 21-bit range with
13809 conditional branch-and-link. This is the default for tool chains built
13810 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
13811
13812 @item -mno-sdata
13813 @opindex mno-sdata
13814 Do not generate sdata references. This is the default for tool chains
13815 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
13816 targets.
13817
13818 @item -mucb-mcount
13819 @opindex mucb-mcount
13820 Instrument with mcount calls as used in UCB code. I.e. do the
13821 counting in the callee, not the caller. By default ARC instrumentation
13822 counts in the caller.
13823
13824 @item -mvolatile-cache
13825 @opindex mvolatile-cache
13826 Use ordinarily cached memory accesses for volatile references. This is the
13827 default.
13828
13829 @item -mno-volatile-cache
13830 @opindex mno-volatile-cache
13831 Enable cache bypass for volatile references.
13832
13833 @end table
13834
13835 The following options fine tune code generation:
13836 @c code generation tuning options
13837 @table @gcctabopt
13838 @item -malign-call
13839 @opindex malign-call
13840 Do alignment optimizations for call instructions.
13841
13842 @item -mauto-modify-reg
13843 @opindex mauto-modify-reg
13844 Enable the use of pre/post modify with register displacement.
13845
13846 @item -mbbit-peephole
13847 @opindex mbbit-peephole
13848 Enable bbit peephole2.
13849
13850 @item -mno-brcc
13851 @opindex mno-brcc
13852 This option disables a target-specific pass in @file{arc_reorg} to
13853 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
13854 generation driven by the combiner pass.
13855
13856 @item -mcase-vector-pcrel
13857 @opindex mcase-vector-pcrel
13858 Use pc-relative switch case tables - this enables case table shortening.
13859 This is the default for @option{-Os}.
13860
13861 @item -mcompact-casesi
13862 @opindex mcompact-casesi
13863 Enable compact casesi pattern.
13864 This is the default for @option{-Os}.
13865
13866 @item -mno-cond-exec
13867 @opindex mno-cond-exec
13868 Disable ARCompact specific pass to generate conditional execution instructions.
13869 Due to delay slot scheduling and interactions between operand numbers,
13870 literal sizes, instruction lengths, and the support for conditional execution,
13871 the target-independent pass to generate conditional execution is often lacking,
13872 so the ARC port has kept a special pass around that tries to find more
13873 conditional execution generating opportunities after register allocation,
13874 branch shortening, and delay slot scheduling have been done. This pass
13875 generally, but not always, improves performance and code size, at the cost of
13876 extra compilation time, which is why there is an option to switch it off.
13877 If you have a problem with call instructions exceeding their allowable
13878 offset range because they are conditionalized, you should consider using
13879 @option{-mmedium-calls} instead.
13880
13881 @item -mearly-cbranchsi
13882 @opindex mearly-cbranchsi
13883 Enable pre-reload use of the cbranchsi pattern.
13884
13885 @item -mexpand-adddi
13886 @opindex mexpand-adddi
13887 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
13888 @code{add.f}, @code{adc} etc.
13889
13890 @item -mindexed-loads
13891 @opindex mindexed-loads
13892 Enable the use of indexed loads. This can be problematic because some
13893 optimizers then assume that indexed stores exist, which is not
13894 the case.
13895
13896 @opindex mlra
13897 Enable Local Register Allocation. This is still experimental for ARC,
13898 so by default the compiler uses standard reload
13899 (i.e. @option{-mno-lra}).
13900
13901 @item -mlra-priority-none
13902 @opindex mlra-priority-none
13903 Don't indicate any priority for target registers.
13904
13905 @item -mlra-priority-compact
13906 @opindex mlra-priority-compact
13907 Indicate target register priority for r0..r3 / r12..r15.
13908
13909 @item -mlra-priority-noncompact
13910 @opindex mlra-priority-noncompact
13911 Reduce target register priority for r0..r3 / r12..r15.
13912
13913 @item -mno-millicode
13914 @opindex mno-millicode
13915 When optimizing for size (using @option{-Os}), prologues and epilogues
13916 that have to save or restore a large number of registers are often
13917 shortened by using call to a special function in libgcc; this is
13918 referred to as a @emph{millicode} call. As these calls can pose
13919 performance issues, and/or cause linking issues when linking in a
13920 nonstandard way, this option is provided to turn off millicode call
13921 generation.
13922
13923 @item -mmixed-code
13924 @opindex mmixed-code
13925 Tweak register allocation to help 16-bit instruction generation.
13926 This generally has the effect of decreasing the average instruction size
13927 while increasing the instruction count.
13928
13929 @item -mq-class
13930 @opindex mq-class
13931 Enable 'q' instruction alternatives.
13932 This is the default for @option{-Os}.
13933
13934 @item -mRcq
13935 @opindex mRcq
13936 Enable Rcq constraint handling - most short code generation depends on this.
13937 This is the default.
13938
13939 @item -mRcw
13940 @opindex mRcw
13941 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
13942 This is the default.
13943
13944 @item -msize-level=@var{level}
13945 @opindex msize-level
13946 Fine-tune size optimization with regards to instruction lengths and alignment.
13947 The recognized values for @var{level} are:
13948 @table @samp
13949 @item 0
13950 No size optimization. This level is deprecated and treated like @samp{1}.
13951
13952 @item 1
13953 Short instructions are used opportunistically.
13954
13955 @item 2
13956 In addition, alignment of loops and of code after barriers are dropped.
13957
13958 @item 3
13959 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
13960
13961 @end table
13962
13963 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
13964 the behavior when this is not set is equivalent to level @samp{1}.
13965
13966 @item -mtune=@var{cpu}
13967 @opindex mtune
13968 Set instruction scheduling parameters for @var{cpu}, overriding any implied
13969 by @option{-mcpu=}.
13970
13971 Supported values for @var{cpu} are
13972
13973 @table @samp
13974 @item ARC600
13975 Tune for ARC600 cpu.
13976
13977 @item ARC601
13978 Tune for ARC601 cpu.
13979
13980 @item ARC700
13981 Tune for ARC700 cpu with standard multiplier block.
13982
13983 @item ARC700-xmac
13984 Tune for ARC700 cpu with XMAC block.
13985
13986 @item ARC725D
13987 Tune for ARC725D cpu.
13988
13989 @item ARC750D
13990 Tune for ARC750D cpu.
13991
13992 @end table
13993
13994 @item -mmultcost=@var{num}
13995 @opindex mmultcost
13996 Cost to assume for a multiply instruction, with @samp{4} being equal to a
13997 normal instruction.
13998
13999 @item -munalign-prob-threshold=@var{probability}
14000 @opindex munalign-prob-threshold
14001 Set probability threshold for unaligning branches.
14002 When tuning for @samp{ARC700} and optimizing for speed, branches without
14003 filled delay slot are preferably emitted unaligned and long, unless
14004 profiling indicates that the probability for the branch to be taken
14005 is below @var{probability}. @xref{Cross-profiling}.
14006 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
14007
14008 @end table
14009
14010 The following options are maintained for backward compatibility, but
14011 are now deprecated and will be removed in a future release:
14012
14013 @c Deprecated options
14014 @table @gcctabopt
14015
14016 @item -margonaut
14017 @opindex margonaut
14018 Obsolete FPX.
14019
14020 @item -mbig-endian
14021 @opindex mbig-endian
14022 @itemx -EB
14023 @opindex EB
14024 Compile code for big endian targets. Use of these options is now
14025 deprecated. Users wanting big-endian code, should use the
14026 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
14027 building the tool chain, for which big-endian is the default.
14028
14029 @item -mlittle-endian
14030 @opindex mlittle-endian
14031 @itemx -EL
14032 @opindex EL
14033 Compile code for little endian targets. Use of these options is now
14034 deprecated. Users wanting little-endian code should use the
14035 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
14036 building the tool chain, for which little-endian is the default.
14037
14038 @item -mbarrel_shifter
14039 @opindex mbarrel_shifter
14040 Replaced by @option{-mbarrel-shifter}.
14041
14042 @item -mdpfp_compact
14043 @opindex mdpfp_compact
14044 Replaced by @option{-mdpfp-compact}.
14045
14046 @item -mdpfp_fast
14047 @opindex mdpfp_fast
14048 Replaced by @option{-mdpfp-fast}.
14049
14050 @item -mdsp_packa
14051 @opindex mdsp_packa
14052 Replaced by @option{-mdsp-packa}.
14053
14054 @item -mEA
14055 @opindex mEA
14056 Replaced by @option{-mea}.
14057
14058 @item -mmac_24
14059 @opindex mmac_24
14060 Replaced by @option{-mmac-24}.
14061
14062 @item -mmac_d16
14063 @opindex mmac_d16
14064 Replaced by @option{-mmac-d16}.
14065
14066 @item -mspfp_compact
14067 @opindex mspfp_compact
14068 Replaced by @option{-mspfp-compact}.
14069
14070 @item -mspfp_fast
14071 @opindex mspfp_fast
14072 Replaced by @option{-mspfp-fast}.
14073
14074 @item -mtune=@var{cpu}
14075 @opindex mtune
14076 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
14077 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
14078 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
14079
14080 @item -multcost=@var{num}
14081 @opindex multcost
14082 Replaced by @option{-mmultcost}.
14083
14084 @end table
14085
14086 @node ARM Options
14087 @subsection ARM Options
14088 @cindex ARM options
14089
14090 These @samp{-m} options are defined for the ARM port:
14091
14092 @table @gcctabopt
14093 @item -mabi=@var{name}
14094 @opindex mabi
14095 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
14096 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
14097
14098 @item -mapcs-frame
14099 @opindex mapcs-frame
14100 Generate a stack frame that is compliant with the ARM Procedure Call
14101 Standard for all functions, even if this is not strictly necessary for
14102 correct execution of the code. Specifying @option{-fomit-frame-pointer}
14103 with this option causes the stack frames not to be generated for
14104 leaf functions. The default is @option{-mno-apcs-frame}.
14105 This option is deprecated.
14106
14107 @item -mapcs
14108 @opindex mapcs
14109 This is a synonym for @option{-mapcs-frame} and is deprecated.
14110
14111 @ignore
14112 @c not currently implemented
14113 @item -mapcs-stack-check
14114 @opindex mapcs-stack-check
14115 Generate code to check the amount of stack space available upon entry to
14116 every function (that actually uses some stack space). If there is
14117 insufficient space available then either the function
14118 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
14119 called, depending upon the amount of stack space required. The runtime
14120 system is required to provide these functions. The default is
14121 @option{-mno-apcs-stack-check}, since this produces smaller code.
14122
14123 @c not currently implemented
14124 @item -mapcs-float
14125 @opindex mapcs-float
14126 Pass floating-point arguments using the floating-point registers. This is
14127 one of the variants of the APCS@. This option is recommended if the
14128 target hardware has a floating-point unit or if a lot of floating-point
14129 arithmetic is going to be performed by the code. The default is
14130 @option{-mno-apcs-float}, since the size of integer-only code is
14131 slightly increased if @option{-mapcs-float} is used.
14132
14133 @c not currently implemented
14134 @item -mapcs-reentrant
14135 @opindex mapcs-reentrant
14136 Generate reentrant, position-independent code. The default is
14137 @option{-mno-apcs-reentrant}.
14138 @end ignore
14139
14140 @item -mthumb-interwork
14141 @opindex mthumb-interwork
14142 Generate code that supports calling between the ARM and Thumb
14143 instruction sets. Without this option, on pre-v5 architectures, the
14144 two instruction sets cannot be reliably used inside one program. The
14145 default is @option{-mno-thumb-interwork}, since slightly larger code
14146 is generated when @option{-mthumb-interwork} is specified. In AAPCS
14147 configurations this option is meaningless.
14148
14149 @item -mno-sched-prolog
14150 @opindex mno-sched-prolog
14151 Prevent the reordering of instructions in the function prologue, or the
14152 merging of those instruction with the instructions in the function's
14153 body. This means that all functions start with a recognizable set
14154 of instructions (or in fact one of a choice from a small set of
14155 different function prologues), and this information can be used to
14156 locate the start of functions inside an executable piece of code. The
14157 default is @option{-msched-prolog}.
14158
14159 @item -mfloat-abi=@var{name}
14160 @opindex mfloat-abi
14161 Specifies which floating-point ABI to use. Permissible values
14162 are: @samp{soft}, @samp{softfp} and @samp{hard}.
14163
14164 Specifying @samp{soft} causes GCC to generate output containing
14165 library calls for floating-point operations.
14166 @samp{softfp} allows the generation of code using hardware floating-point
14167 instructions, but still uses the soft-float calling conventions.
14168 @samp{hard} allows generation of floating-point instructions
14169 and uses FPU-specific calling conventions.
14170
14171 The default depends on the specific target configuration. Note that
14172 the hard-float and soft-float ABIs are not link-compatible; you must
14173 compile your entire program with the same ABI, and link with a
14174 compatible set of libraries.
14175
14176 @item -mlittle-endian
14177 @opindex mlittle-endian
14178 Generate code for a processor running in little-endian mode. This is
14179 the default for all standard configurations.
14180
14181 @item -mbig-endian
14182 @opindex mbig-endian
14183 Generate code for a processor running in big-endian mode; the default is
14184 to compile code for a little-endian processor.
14185
14186 @item -march=@var{name}
14187 @opindex march
14188 This specifies the name of the target ARM architecture. GCC uses this
14189 name to determine what kind of instructions it can emit when generating
14190 assembly code. This option can be used in conjunction with or instead
14191 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
14192 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
14193 @samp{armv5}, @samp{armv5e}, @samp{armv5t}, @samp{armv5te},
14194 @samp{armv6}, @samp{armv6-m}, @samp{armv6j}, @samp{armv6k},
14195 @samp{armv6kz}, @samp{armv6s-m},
14196 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk},
14197 @samp{armv7}, @samp{armv7-a}, @samp{armv7-m}, @samp{armv7-r}, @samp{armv7e-m},
14198 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
14199 @samp{armv8.1-a+crc}, @samp{armv8-m.base}, @samp{armv8-m.main},
14200 @samp{armv8-m.main+dsp}, @samp{iwmmxt}, @samp{iwmmxt2}.
14201
14202 Architecture revisions older than @samp{armv4t} are deprecated.
14203
14204 @option{-march=armv6s-m} is the @samp{armv6-m} architecture with support for
14205 the (now mandatory) SVC instruction.
14206
14207 @option{-march=armv6zk} is an alias for @samp{armv6kz}, existing for backwards
14208 compatibility.
14209
14210 @option{-march=armv7ve} is the @samp{armv7-a} architecture with virtualization
14211 extensions.
14212
14213 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
14214 architecture together with the optional CRC32 extensions.
14215
14216 @option{-march=native} causes the compiler to auto-detect the architecture
14217 of the build computer. At present, this feature is only supported on
14218 GNU/Linux, and not all architectures are recognized. If the auto-detect
14219 is unsuccessful the option has no effect.
14220
14221 @item -mtune=@var{name}
14222 @opindex mtune
14223 This option specifies the name of the target ARM processor for
14224 which GCC should tune the performance of the code.
14225 For some ARM implementations better performance can be obtained by using
14226 this option.
14227 Permissible names are: @samp{arm2}, @samp{arm250},
14228 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
14229 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
14230 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
14231 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
14232 @samp{arm720},
14233 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
14234 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
14235 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
14236 @samp{strongarm1110},
14237 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
14238 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
14239 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
14240 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
14241 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
14242 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
14243 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
14244 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
14245 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
14246 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
14247 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-r4},
14248 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
14249 @samp{cortex-m7},
14250 @samp{cortex-m4},
14251 @samp{cortex-m3},
14252 @samp{cortex-m1},
14253 @samp{cortex-m0},
14254 @samp{cortex-m0plus},
14255 @samp{cortex-m1.small-multiply},
14256 @samp{cortex-m0.small-multiply},
14257 @samp{cortex-m0plus.small-multiply},
14258 @samp{exynos-m1},
14259 @samp{qdf24xx},
14260 @samp{marvell-pj4},
14261 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
14262 @samp{fa526}, @samp{fa626},
14263 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
14264 @samp{xgene1}.
14265
14266 Additionally, this option can specify that GCC should tune the performance
14267 of the code for a big.LITTLE system. Permissible names are:
14268 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
14269 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14270 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}.
14271
14272 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
14273 performance for a blend of processors within architecture @var{arch}.
14274 The aim is to generate code that run well on the current most popular
14275 processors, balancing between optimizations that benefit some CPUs in the
14276 range, and avoiding performance pitfalls of other CPUs. The effects of
14277 this option may change in future GCC versions as CPU models come and go.
14278
14279 @option{-mtune=native} causes the compiler to auto-detect the CPU
14280 of the build computer. At present, this feature is only supported on
14281 GNU/Linux, and not all architectures are recognized. If the auto-detect is
14282 unsuccessful the option has no effect.
14283
14284 @item -mcpu=@var{name}
14285 @opindex mcpu
14286 This specifies the name of the target ARM processor. GCC uses this name
14287 to derive the name of the target ARM architecture (as if specified
14288 by @option{-march}) and the ARM processor type for which to tune for
14289 performance (as if specified by @option{-mtune}). Where this option
14290 is used in conjunction with @option{-march} or @option{-mtune},
14291 those options take precedence over the appropriate part of this option.
14292
14293 Permissible names for this option are the same as those for
14294 @option{-mtune}.
14295
14296 @option{-mcpu=generic-@var{arch}} is also permissible, and is
14297 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
14298 See @option{-mtune} for more information.
14299
14300 @option{-mcpu=native} causes the compiler to auto-detect the CPU
14301 of the build computer. At present, this feature is only supported on
14302 GNU/Linux, and not all architectures are recognized. If the auto-detect
14303 is unsuccessful the option has no effect.
14304
14305 @item -mfpu=@var{name}
14306 @opindex mfpu
14307 This specifies what floating-point hardware (or hardware emulation) is
14308 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
14309 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
14310 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
14311 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
14312 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
14313 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
14314
14315 If @option{-msoft-float} is specified this specifies the format of
14316 floating-point values.
14317
14318 If the selected floating-point hardware includes the NEON extension
14319 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
14320 operations are not generated by GCC's auto-vectorization pass unless
14321 @option{-funsafe-math-optimizations} is also specified. This is
14322 because NEON hardware does not fully implement the IEEE 754 standard for
14323 floating-point arithmetic (in particular denormal values are treated as
14324 zero), so the use of NEON instructions may lead to a loss of precision.
14325
14326 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}).
14327
14328 @item -mfp16-format=@var{name}
14329 @opindex mfp16-format
14330 Specify the format of the @code{__fp16} half-precision floating-point type.
14331 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
14332 the default is @samp{none}, in which case the @code{__fp16} type is not
14333 defined. @xref{Half-Precision}, for more information.
14334
14335 @item -mstructure-size-boundary=@var{n}
14336 @opindex mstructure-size-boundary
14337 The sizes of all structures and unions are rounded up to a multiple
14338 of the number of bits set by this option. Permissible values are 8, 32
14339 and 64. The default value varies for different toolchains. For the COFF
14340 targeted toolchain the default value is 8. A value of 64 is only allowed
14341 if the underlying ABI supports it.
14342
14343 Specifying a larger number can produce faster, more efficient code, but
14344 can also increase the size of the program. Different values are potentially
14345 incompatible. Code compiled with one value cannot necessarily expect to
14346 work with code or libraries compiled with another value, if they exchange
14347 information using structures or unions.
14348
14349 @item -mabort-on-noreturn
14350 @opindex mabort-on-noreturn
14351 Generate a call to the function @code{abort} at the end of a
14352 @code{noreturn} function. It is executed if the function tries to
14353 return.
14354
14355 @item -mlong-calls
14356 @itemx -mno-long-calls
14357 @opindex mlong-calls
14358 @opindex mno-long-calls
14359 Tells the compiler to perform function calls by first loading the
14360 address of the function into a register and then performing a subroutine
14361 call on this register. This switch is needed if the target function
14362 lies outside of the 64-megabyte addressing range of the offset-based
14363 version of subroutine call instruction.
14364
14365 Even if this switch is enabled, not all function calls are turned
14366 into long calls. The heuristic is that static functions, functions
14367 that have the @code{short_call} attribute, functions that are inside
14368 the scope of a @code{#pragma no_long_calls} directive, and functions whose
14369 definitions have already been compiled within the current compilation
14370 unit are not turned into long calls. The exceptions to this rule are
14371 that weak function definitions, functions with the @code{long_call}
14372 attribute or the @code{section} attribute, and functions that are within
14373 the scope of a @code{#pragma long_calls} directive are always
14374 turned into long calls.
14375
14376 This feature is not enabled by default. Specifying
14377 @option{-mno-long-calls} restores the default behavior, as does
14378 placing the function calls within the scope of a @code{#pragma
14379 long_calls_off} directive. Note these switches have no effect on how
14380 the compiler generates code to handle function calls via function
14381 pointers.
14382
14383 @item -msingle-pic-base
14384 @opindex msingle-pic-base
14385 Treat the register used for PIC addressing as read-only, rather than
14386 loading it in the prologue for each function. The runtime system is
14387 responsible for initializing this register with an appropriate value
14388 before execution begins.
14389
14390 @item -mpic-register=@var{reg}
14391 @opindex mpic-register
14392 Specify the register to be used for PIC addressing.
14393 For standard PIC base case, the default is any suitable register
14394 determined by compiler. For single PIC base case, the default is
14395 @samp{R9} if target is EABI based or stack-checking is enabled,
14396 otherwise the default is @samp{R10}.
14397
14398 @item -mpic-data-is-text-relative
14399 @opindex mpic-data-is-text-relative
14400 Assume that the displacement between the text and data segments is fixed
14401 at static link time. This permits using PC-relative addressing
14402 operations to access data known to be in the data segment. For
14403 non-VxWorks RTP targets, this option is enabled by default. When
14404 disabled on such targets, it will enable @option{-msingle-pic-base} by
14405 default.
14406
14407 @item -mpoke-function-name
14408 @opindex mpoke-function-name
14409 Write the name of each function into the text section, directly
14410 preceding the function prologue. The generated code is similar to this:
14411
14412 @smallexample
14413 t0
14414 .ascii "arm_poke_function_name", 0
14415 .align
14416 t1
14417 .word 0xff000000 + (t1 - t0)
14418 arm_poke_function_name
14419 mov ip, sp
14420 stmfd sp!, @{fp, ip, lr, pc@}
14421 sub fp, ip, #4
14422 @end smallexample
14423
14424 When performing a stack backtrace, code can inspect the value of
14425 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
14426 location @code{pc - 12} and the top 8 bits are set, then we know that
14427 there is a function name embedded immediately preceding this location
14428 and has length @code{((pc[-3]) & 0xff000000)}.
14429
14430 @item -mthumb
14431 @itemx -marm
14432 @opindex marm
14433 @opindex mthumb
14434
14435 Select between generating code that executes in ARM and Thumb
14436 states. The default for most configurations is to generate code
14437 that executes in ARM state, but the default can be changed by
14438 configuring GCC with the @option{--with-mode=}@var{state}
14439 configure option.
14440
14441 You can also override the ARM and Thumb mode for each function
14442 by using the @code{target("thumb")} and @code{target("arm")} function attributes
14443 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
14444
14445 @item -mtpcs-frame
14446 @opindex mtpcs-frame
14447 Generate a stack frame that is compliant with the Thumb Procedure Call
14448 Standard for all non-leaf functions. (A leaf function is one that does
14449 not call any other functions.) The default is @option{-mno-tpcs-frame}.
14450
14451 @item -mtpcs-leaf-frame
14452 @opindex mtpcs-leaf-frame
14453 Generate a stack frame that is compliant with the Thumb Procedure Call
14454 Standard for all leaf functions. (A leaf function is one that does
14455 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
14456
14457 @item -mcallee-super-interworking
14458 @opindex mcallee-super-interworking
14459 Gives all externally visible functions in the file being compiled an ARM
14460 instruction set header which switches to Thumb mode before executing the
14461 rest of the function. This allows these functions to be called from
14462 non-interworking code. This option is not valid in AAPCS configurations
14463 because interworking is enabled by default.
14464
14465 @item -mcaller-super-interworking
14466 @opindex mcaller-super-interworking
14467 Allows calls via function pointers (including virtual functions) to
14468 execute correctly regardless of whether the target code has been
14469 compiled for interworking or not. There is a small overhead in the cost
14470 of executing a function pointer if this option is enabled. This option
14471 is not valid in AAPCS configurations because interworking is enabled
14472 by default.
14473
14474 @item -mtp=@var{name}
14475 @opindex mtp
14476 Specify the access model for the thread local storage pointer. The valid
14477 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
14478 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
14479 (supported in the arm6k architecture), and @samp{auto}, which uses the
14480 best available method for the selected processor. The default setting is
14481 @samp{auto}.
14482
14483 @item -mtls-dialect=@var{dialect}
14484 @opindex mtls-dialect
14485 Specify the dialect to use for accessing thread local storage. Two
14486 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
14487 @samp{gnu} dialect selects the original GNU scheme for supporting
14488 local and global dynamic TLS models. The @samp{gnu2} dialect
14489 selects the GNU descriptor scheme, which provides better performance
14490 for shared libraries. The GNU descriptor scheme is compatible with
14491 the original scheme, but does require new assembler, linker and
14492 library support. Initial and local exec TLS models are unaffected by
14493 this option and always use the original scheme.
14494
14495 @item -mword-relocations
14496 @opindex mword-relocations
14497 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
14498 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
14499 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
14500 is specified.
14501
14502 @item -mfix-cortex-m3-ldrd
14503 @opindex mfix-cortex-m3-ldrd
14504 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
14505 with overlapping destination and base registers are used. This option avoids
14506 generating these instructions. This option is enabled by default when
14507 @option{-mcpu=cortex-m3} is specified.
14508
14509 @item -munaligned-access
14510 @itemx -mno-unaligned-access
14511 @opindex munaligned-access
14512 @opindex mno-unaligned-access
14513 Enables (or disables) reading and writing of 16- and 32- bit values
14514 from addresses that are not 16- or 32- bit aligned. By default
14515 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
14516 ARMv8-M Baseline architectures, and enabled for all other
14517 architectures. If unaligned access is not enabled then words in packed
14518 data structures are accessed a byte at a time.
14519
14520 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
14521 generated object file to either true or false, depending upon the
14522 setting of this option. If unaligned access is enabled then the
14523 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
14524 defined.
14525
14526 @item -mneon-for-64bits
14527 @opindex mneon-for-64bits
14528 Enables using Neon to handle scalar 64-bits operations. This is
14529 disabled by default since the cost of moving data from core registers
14530 to Neon is high.
14531
14532 @item -mslow-flash-data
14533 @opindex mslow-flash-data
14534 Assume loading data from flash is slower than fetching instruction.
14535 Therefore literal load is minimized for better performance.
14536 This option is only supported when compiling for ARMv7 M-profile and
14537 off by default.
14538
14539 @item -masm-syntax-unified
14540 @opindex masm-syntax-unified
14541 Assume inline assembler is using unified asm syntax. The default is
14542 currently off which implies divided syntax. This option has no impact
14543 on Thumb2. However, this may change in future releases of GCC.
14544 Divided syntax should be considered deprecated.
14545
14546 @item -mrestrict-it
14547 @opindex mrestrict-it
14548 Restricts generation of IT blocks to conform to the rules of ARMv8.
14549 IT blocks can only contain a single 16-bit instruction from a select
14550 set of instructions. This option is on by default for ARMv8 Thumb mode.
14551
14552 @item -mprint-tune-info
14553 @opindex mprint-tune-info
14554 Print CPU tuning information as comment in assembler file. This is
14555 an option used only for regression testing of the compiler and not
14556 intended for ordinary use in compiling code. This option is disabled
14557 by default.
14558 @end table
14559
14560 @node AVR Options
14561 @subsection AVR Options
14562 @cindex AVR Options
14563
14564 These options are defined for AVR implementations:
14565
14566 @table @gcctabopt
14567 @item -mmcu=@var{mcu}
14568 @opindex mmcu
14569 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
14570
14571 The default for this option is@tie{}@samp{avr2}.
14572
14573 GCC supports the following AVR devices and ISAs:
14574
14575 @include avr-mmcu.texi
14576
14577 @item -maccumulate-args
14578 @opindex maccumulate-args
14579 Accumulate outgoing function arguments and acquire/release the needed
14580 stack space for outgoing function arguments once in function
14581 prologue/epilogue. Without this option, outgoing arguments are pushed
14582 before calling a function and popped afterwards.
14583
14584 Popping the arguments after the function call can be expensive on
14585 AVR so that accumulating the stack space might lead to smaller
14586 executables because arguments need not to be removed from the
14587 stack after such a function call.
14588
14589 This option can lead to reduced code size for functions that perform
14590 several calls to functions that get their arguments on the stack like
14591 calls to printf-like functions.
14592
14593 @item -mbranch-cost=@var{cost}
14594 @opindex mbranch-cost
14595 Set the branch costs for conditional branch instructions to
14596 @var{cost}. Reasonable values for @var{cost} are small, non-negative
14597 integers. The default branch cost is 0.
14598
14599 @item -mcall-prologues
14600 @opindex mcall-prologues
14601 Functions prologues/epilogues are expanded as calls to appropriate
14602 subroutines. Code size is smaller.
14603
14604 @item -mint8
14605 @opindex mint8
14606 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
14607 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
14608 and @code{long long} is 4 bytes. Please note that this option does not
14609 conform to the C standards, but it results in smaller code
14610 size.
14611
14612 @item -mn-flash=@var{num}
14613 @opindex mn-flash
14614 Assume that the flash memory has a size of
14615 @var{num} times 64@tie{}KiB.
14616
14617 @item -mno-interrupts
14618 @opindex mno-interrupts
14619 Generated code is not compatible with hardware interrupts.
14620 Code size is smaller.
14621
14622 @item -mrelax
14623 @opindex mrelax
14624 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
14625 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
14626 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
14627 the assembler's command line and the @option{--relax} option to the
14628 linker's command line.
14629
14630 Jump relaxing is performed by the linker because jump offsets are not
14631 known before code is located. Therefore, the assembler code generated by the
14632 compiler is the same, but the instructions in the executable may
14633 differ from instructions in the assembler code.
14634
14635 Relaxing must be turned on if linker stubs are needed, see the
14636 section on @code{EIND} and linker stubs below.
14637
14638 @item -mrmw
14639 @opindex mrmw
14640 Assume that the device supports the Read-Modify-Write
14641 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
14642
14643 @item -msp8
14644 @opindex msp8
14645 Treat the stack pointer register as an 8-bit register,
14646 i.e.@: assume the high byte of the stack pointer is zero.
14647 In general, you don't need to set this option by hand.
14648
14649 This option is used internally by the compiler to select and
14650 build multilibs for architectures @code{avr2} and @code{avr25}.
14651 These architectures mix devices with and without @code{SPH}.
14652 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
14653 the compiler driver adds or removes this option from the compiler
14654 proper's command line, because the compiler then knows if the device
14655 or architecture has an 8-bit stack pointer and thus no @code{SPH}
14656 register or not.
14657
14658 @item -mstrict-X
14659 @opindex mstrict-X
14660 Use address register @code{X} in a way proposed by the hardware. This means
14661 that @code{X} is only used in indirect, post-increment or
14662 pre-decrement addressing.
14663
14664 Without this option, the @code{X} register may be used in the same way
14665 as @code{Y} or @code{Z} which then is emulated by additional
14666 instructions.
14667 For example, loading a value with @code{X+const} addressing with a
14668 small non-negative @code{const < 64} to a register @var{Rn} is
14669 performed as
14670
14671 @example
14672 adiw r26, const ; X += const
14673 ld @var{Rn}, X ; @var{Rn} = *X
14674 sbiw r26, const ; X -= const
14675 @end example
14676
14677 @item -mtiny-stack
14678 @opindex mtiny-stack
14679 Only change the lower 8@tie{}bits of the stack pointer.
14680
14681 @item -mfract-convert-truncate
14682 @opindex mfract-convert-truncate
14683 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
14684
14685 @item -nodevicelib
14686 @opindex nodevicelib
14687 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
14688
14689 @item -Waddr-space-convert
14690 @opindex Waddr-space-convert
14691 Warn about conversions between address spaces in the case where the
14692 resulting address space is not contained in the incoming address space.
14693
14694 @item -Wmisspelled-isr
14695 @opindex Wmisspelled-isr
14696 Warn if the ISR is misspelled, i.e. without __vector prefix.
14697 Enabled by default.
14698 @end table
14699
14700 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
14701 @cindex @code{EIND}
14702 Pointers in the implementation are 16@tie{}bits wide.
14703 The address of a function or label is represented as word address so
14704 that indirect jumps and calls can target any code address in the
14705 range of 64@tie{}Ki words.
14706
14707 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
14708 bytes of program memory space, there is a special function register called
14709 @code{EIND} that serves as most significant part of the target address
14710 when @code{EICALL} or @code{EIJMP} instructions are used.
14711
14712 Indirect jumps and calls on these devices are handled as follows by
14713 the compiler and are subject to some limitations:
14714
14715 @itemize @bullet
14716
14717 @item
14718 The compiler never sets @code{EIND}.
14719
14720 @item
14721 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
14722 instructions or might read @code{EIND} directly in order to emulate an
14723 indirect call/jump by means of a @code{RET} instruction.
14724
14725 @item
14726 The compiler assumes that @code{EIND} never changes during the startup
14727 code or during the application. In particular, @code{EIND} is not
14728 saved/restored in function or interrupt service routine
14729 prologue/epilogue.
14730
14731 @item
14732 For indirect calls to functions and computed goto, the linker
14733 generates @emph{stubs}. Stubs are jump pads sometimes also called
14734 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
14735 The stub contains a direct jump to the desired address.
14736
14737 @item
14738 Linker relaxation must be turned on so that the linker generates
14739 the stubs correctly in all situations. See the compiler option
14740 @option{-mrelax} and the linker option @option{--relax}.
14741 There are corner cases where the linker is supposed to generate stubs
14742 but aborts without relaxation and without a helpful error message.
14743
14744 @item
14745 The default linker script is arranged for code with @code{EIND = 0}.
14746 If code is supposed to work for a setup with @code{EIND != 0}, a custom
14747 linker script has to be used in order to place the sections whose
14748 name start with @code{.trampolines} into the segment where @code{EIND}
14749 points to.
14750
14751 @item
14752 The startup code from libgcc never sets @code{EIND}.
14753 Notice that startup code is a blend of code from libgcc and AVR-LibC.
14754 For the impact of AVR-LibC on @code{EIND}, see the
14755 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
14756
14757 @item
14758 It is legitimate for user-specific startup code to set up @code{EIND}
14759 early, for example by means of initialization code located in
14760 section @code{.init3}. Such code runs prior to general startup code
14761 that initializes RAM and calls constructors, but after the bit
14762 of startup code from AVR-LibC that sets @code{EIND} to the segment
14763 where the vector table is located.
14764 @example
14765 #include <avr/io.h>
14766
14767 static void
14768 __attribute__((section(".init3"),naked,used,no_instrument_function))
14769 init3_set_eind (void)
14770 @{
14771 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
14772 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
14773 @}
14774 @end example
14775
14776 @noindent
14777 The @code{__trampolines_start} symbol is defined in the linker script.
14778
14779 @item
14780 Stubs are generated automatically by the linker if
14781 the following two conditions are met:
14782 @itemize @minus
14783
14784 @item The address of a label is taken by means of the @code{gs} modifier
14785 (short for @emph{generate stubs}) like so:
14786 @example
14787 LDI r24, lo8(gs(@var{func}))
14788 LDI r25, hi8(gs(@var{func}))
14789 @end example
14790 @item The final location of that label is in a code segment
14791 @emph{outside} the segment where the stubs are located.
14792 @end itemize
14793
14794 @item
14795 The compiler emits such @code{gs} modifiers for code labels in the
14796 following situations:
14797 @itemize @minus
14798 @item Taking address of a function or code label.
14799 @item Computed goto.
14800 @item If prologue-save function is used, see @option{-mcall-prologues}
14801 command-line option.
14802 @item Switch/case dispatch tables. If you do not want such dispatch
14803 tables you can specify the @option{-fno-jump-tables} command-line option.
14804 @item C and C++ constructors/destructors called during startup/shutdown.
14805 @item If the tools hit a @code{gs()} modifier explained above.
14806 @end itemize
14807
14808 @item
14809 Jumping to non-symbolic addresses like so is @emph{not} supported:
14810
14811 @example
14812 int main (void)
14813 @{
14814 /* Call function at word address 0x2 */
14815 return ((int(*)(void)) 0x2)();
14816 @}
14817 @end example
14818
14819 Instead, a stub has to be set up, i.e.@: the function has to be called
14820 through a symbol (@code{func_4} in the example):
14821
14822 @example
14823 int main (void)
14824 @{
14825 extern int func_4 (void);
14826
14827 /* Call function at byte address 0x4 */
14828 return func_4();
14829 @}
14830 @end example
14831
14832 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
14833 Alternatively, @code{func_4} can be defined in the linker script.
14834 @end itemize
14835
14836 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
14837 @cindex @code{RAMPD}
14838 @cindex @code{RAMPX}
14839 @cindex @code{RAMPY}
14840 @cindex @code{RAMPZ}
14841 Some AVR devices support memories larger than the 64@tie{}KiB range
14842 that can be accessed with 16-bit pointers. To access memory locations
14843 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
14844 register is used as high part of the address:
14845 The @code{X}, @code{Y}, @code{Z} address register is concatenated
14846 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
14847 register, respectively, to get a wide address. Similarly,
14848 @code{RAMPD} is used together with direct addressing.
14849
14850 @itemize
14851 @item
14852 The startup code initializes the @code{RAMP} special function
14853 registers with zero.
14854
14855 @item
14856 If a @ref{AVR Named Address Spaces,named address space} other than
14857 generic or @code{__flash} is used, then @code{RAMPZ} is set
14858 as needed before the operation.
14859
14860 @item
14861 If the device supports RAM larger than 64@tie{}KiB and the compiler
14862 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
14863 is reset to zero after the operation.
14864
14865 @item
14866 If the device comes with a specific @code{RAMP} register, the ISR
14867 prologue/epilogue saves/restores that SFR and initializes it with
14868 zero in case the ISR code might (implicitly) use it.
14869
14870 @item
14871 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
14872 If you use inline assembler to read from locations outside the
14873 16-bit address range and change one of the @code{RAMP} registers,
14874 you must reset it to zero after the access.
14875
14876 @end itemize
14877
14878 @subsubsection AVR Built-in Macros
14879
14880 GCC defines several built-in macros so that the user code can test
14881 for the presence or absence of features. Almost any of the following
14882 built-in macros are deduced from device capabilities and thus
14883 triggered by the @option{-mmcu=} command-line option.
14884
14885 For even more AVR-specific built-in macros see
14886 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
14887
14888 @table @code
14889
14890 @item __AVR_ARCH__
14891 Build-in macro that resolves to a decimal number that identifies the
14892 architecture and depends on the @option{-mmcu=@var{mcu}} option.
14893 Possible values are:
14894
14895 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
14896 @code{4}, @code{5}, @code{51}, @code{6}
14897
14898 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
14899 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
14900
14901 respectively and
14902
14903 @code{100}, @code{102}, @code{104},
14904 @code{105}, @code{106}, @code{107}
14905
14906 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
14907 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
14908 If @var{mcu} specifies a device, this built-in macro is set
14909 accordingly. For example, with @option{-mmcu=atmega8} the macro is
14910 defined to @code{4}.
14911
14912 @item __AVR_@var{Device}__
14913 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
14914 the device's name. For example, @option{-mmcu=atmega8} defines the
14915 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
14916 @code{__AVR_ATtiny261A__}, etc.
14917
14918 The built-in macros' names follow
14919 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
14920 the device name as from the AVR user manual. The difference between
14921 @var{Device} in the built-in macro and @var{device} in
14922 @option{-mmcu=@var{device}} is that the latter is always lowercase.
14923
14924 If @var{device} is not a device but only a core architecture like
14925 @samp{avr51}, this macro is not defined.
14926
14927 @item __AVR_DEVICE_NAME__
14928 Setting @option{-mmcu=@var{device}} defines this built-in macro to
14929 the device's name. For example, with @option{-mmcu=atmega8} the macro
14930 is defined to @code{atmega8}.
14931
14932 If @var{device} is not a device but only a core architecture like
14933 @samp{avr51}, this macro is not defined.
14934
14935 @item __AVR_XMEGA__
14936 The device / architecture belongs to the XMEGA family of devices.
14937
14938 @item __AVR_HAVE_ELPM__
14939 The device has the @code{ELPM} instruction.
14940
14941 @item __AVR_HAVE_ELPMX__
14942 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
14943 R@var{n},Z+} instructions.
14944
14945 @item __AVR_HAVE_MOVW__
14946 The device has the @code{MOVW} instruction to perform 16-bit
14947 register-register moves.
14948
14949 @item __AVR_HAVE_LPMX__
14950 The device has the @code{LPM R@var{n},Z} and
14951 @code{LPM R@var{n},Z+} instructions.
14952
14953 @item __AVR_HAVE_MUL__
14954 The device has a hardware multiplier.
14955
14956 @item __AVR_HAVE_JMP_CALL__
14957 The device has the @code{JMP} and @code{CALL} instructions.
14958 This is the case for devices with at least 16@tie{}KiB of program
14959 memory.
14960
14961 @item __AVR_HAVE_EIJMP_EICALL__
14962 @itemx __AVR_3_BYTE_PC__
14963 The device has the @code{EIJMP} and @code{EICALL} instructions.
14964 This is the case for devices with more than 128@tie{}KiB of program memory.
14965 This also means that the program counter
14966 (PC) is 3@tie{}bytes wide.
14967
14968 @item __AVR_2_BYTE_PC__
14969 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
14970 with up to 128@tie{}KiB of program memory.
14971
14972 @item __AVR_HAVE_8BIT_SP__
14973 @itemx __AVR_HAVE_16BIT_SP__
14974 The stack pointer (SP) register is treated as 8-bit respectively
14975 16-bit register by the compiler.
14976 The definition of these macros is affected by @option{-mtiny-stack}.
14977
14978 @item __AVR_HAVE_SPH__
14979 @itemx __AVR_SP8__
14980 The device has the SPH (high part of stack pointer) special function
14981 register or has an 8-bit stack pointer, respectively.
14982 The definition of these macros is affected by @option{-mmcu=} and
14983 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
14984 by @option{-msp8}.
14985
14986 @item __AVR_HAVE_RAMPD__
14987 @itemx __AVR_HAVE_RAMPX__
14988 @itemx __AVR_HAVE_RAMPY__
14989 @itemx __AVR_HAVE_RAMPZ__
14990 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
14991 @code{RAMPZ} special function register, respectively.
14992
14993 @item __NO_INTERRUPTS__
14994 This macro reflects the @option{-mno-interrupts} command-line option.
14995
14996 @item __AVR_ERRATA_SKIP__
14997 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
14998 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
14999 instructions because of a hardware erratum. Skip instructions are
15000 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
15001 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
15002 set.
15003
15004 @item __AVR_ISA_RMW__
15005 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
15006
15007 @item __AVR_SFR_OFFSET__=@var{offset}
15008 Instructions that can address I/O special function registers directly
15009 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
15010 address as if addressed by an instruction to access RAM like @code{LD}
15011 or @code{STS}. This offset depends on the device architecture and has
15012 to be subtracted from the RAM address in order to get the
15013 respective I/O@tie{}address.
15014
15015 @item __WITH_AVRLIBC__
15016 The compiler is configured to be used together with AVR-Libc.
15017 See the @option{--with-avrlibc} configure option.
15018
15019 @end table
15020
15021 @node Blackfin Options
15022 @subsection Blackfin Options
15023 @cindex Blackfin Options
15024
15025 @table @gcctabopt
15026 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
15027 @opindex mcpu=
15028 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
15029 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
15030 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
15031 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
15032 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
15033 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
15034 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
15035 @samp{bf561}, @samp{bf592}.
15036
15037 The optional @var{sirevision} specifies the silicon revision of the target
15038 Blackfin processor. Any workarounds available for the targeted silicon revision
15039 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
15040 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
15041 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
15042 hexadecimal digits representing the major and minor numbers in the silicon
15043 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
15044 is not defined. If @var{sirevision} is @samp{any}, the
15045 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
15046 If this optional @var{sirevision} is not used, GCC assumes the latest known
15047 silicon revision of the targeted Blackfin processor.
15048
15049 GCC defines a preprocessor macro for the specified @var{cpu}.
15050 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
15051 provided by libgloss to be linked in if @option{-msim} is not given.
15052
15053 Without this option, @samp{bf532} is used as the processor by default.
15054
15055 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
15056 only the preprocessor macro is defined.
15057
15058 @item -msim
15059 @opindex msim
15060 Specifies that the program will be run on the simulator. This causes
15061 the simulator BSP provided by libgloss to be linked in. This option
15062 has effect only for @samp{bfin-elf} toolchain.
15063 Certain other options, such as @option{-mid-shared-library} and
15064 @option{-mfdpic}, imply @option{-msim}.
15065
15066 @item -momit-leaf-frame-pointer
15067 @opindex momit-leaf-frame-pointer
15068 Don't keep the frame pointer in a register for leaf functions. This
15069 avoids the instructions to save, set up and restore frame pointers and
15070 makes an extra register available in leaf functions. The option
15071 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
15072 which might make debugging harder.
15073
15074 @item -mspecld-anomaly
15075 @opindex mspecld-anomaly
15076 When enabled, the compiler ensures that the generated code does not
15077 contain speculative loads after jump instructions. If this option is used,
15078 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
15079
15080 @item -mno-specld-anomaly
15081 @opindex mno-specld-anomaly
15082 Don't generate extra code to prevent speculative loads from occurring.
15083
15084 @item -mcsync-anomaly
15085 @opindex mcsync-anomaly
15086 When enabled, the compiler ensures that the generated code does not
15087 contain CSYNC or SSYNC instructions too soon after conditional branches.
15088 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
15089
15090 @item -mno-csync-anomaly
15091 @opindex mno-csync-anomaly
15092 Don't generate extra code to prevent CSYNC or SSYNC instructions from
15093 occurring too soon after a conditional branch.
15094
15095 @item -mlow-64k
15096 @opindex mlow-64k
15097 When enabled, the compiler is free to take advantage of the knowledge that
15098 the entire program fits into the low 64k of memory.
15099
15100 @item -mno-low-64k
15101 @opindex mno-low-64k
15102 Assume that the program is arbitrarily large. This is the default.
15103
15104 @item -mstack-check-l1
15105 @opindex mstack-check-l1
15106 Do stack checking using information placed into L1 scratchpad memory by the
15107 uClinux kernel.
15108
15109 @item -mid-shared-library
15110 @opindex mid-shared-library
15111 Generate code that supports shared libraries via the library ID method.
15112 This allows for execute in place and shared libraries in an environment
15113 without virtual memory management. This option implies @option{-fPIC}.
15114 With a @samp{bfin-elf} target, this option implies @option{-msim}.
15115
15116 @item -mno-id-shared-library
15117 @opindex mno-id-shared-library
15118 Generate code that doesn't assume ID-based shared libraries are being used.
15119 This is the default.
15120
15121 @item -mleaf-id-shared-library
15122 @opindex mleaf-id-shared-library
15123 Generate code that supports shared libraries via the library ID method,
15124 but assumes that this library or executable won't link against any other
15125 ID shared libraries. That allows the compiler to use faster code for jumps
15126 and calls.
15127
15128 @item -mno-leaf-id-shared-library
15129 @opindex mno-leaf-id-shared-library
15130 Do not assume that the code being compiled won't link against any ID shared
15131 libraries. Slower code is generated for jump and call insns.
15132
15133 @item -mshared-library-id=n
15134 @opindex mshared-library-id
15135 Specifies the identification number of the ID-based shared library being
15136 compiled. Specifying a value of 0 generates more compact code; specifying
15137 other values forces the allocation of that number to the current
15138 library but is no more space- or time-efficient than omitting this option.
15139
15140 @item -msep-data
15141 @opindex msep-data
15142 Generate code that allows the data segment to be located in a different
15143 area of memory from the text segment. This allows for execute in place in
15144 an environment without virtual memory management by eliminating relocations
15145 against the text section.
15146
15147 @item -mno-sep-data
15148 @opindex mno-sep-data
15149 Generate code that assumes that the data segment follows the text segment.
15150 This is the default.
15151
15152 @item -mlong-calls
15153 @itemx -mno-long-calls
15154 @opindex mlong-calls
15155 @opindex mno-long-calls
15156 Tells the compiler to perform function calls by first loading the
15157 address of the function into a register and then performing a subroutine
15158 call on this register. This switch is needed if the target function
15159 lies outside of the 24-bit addressing range of the offset-based
15160 version of subroutine call instruction.
15161
15162 This feature is not enabled by default. Specifying
15163 @option{-mno-long-calls} restores the default behavior. Note these
15164 switches have no effect on how the compiler generates code to handle
15165 function calls via function pointers.
15166
15167 @item -mfast-fp
15168 @opindex mfast-fp
15169 Link with the fast floating-point library. This library relaxes some of
15170 the IEEE floating-point standard's rules for checking inputs against
15171 Not-a-Number (NAN), in the interest of performance.
15172
15173 @item -minline-plt
15174 @opindex minline-plt
15175 Enable inlining of PLT entries in function calls to functions that are
15176 not known to bind locally. It has no effect without @option{-mfdpic}.
15177
15178 @item -mmulticore
15179 @opindex mmulticore
15180 Build a standalone application for multicore Blackfin processors.
15181 This option causes proper start files and link scripts supporting
15182 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
15183 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
15184
15185 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
15186 selects the one-application-per-core programming model. Without
15187 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
15188 programming model is used. In this model, the main function of Core B
15189 should be named as @code{coreb_main}.
15190
15191 If this option is not used, the single-core application programming
15192 model is used.
15193
15194 @item -mcorea
15195 @opindex mcorea
15196 Build a standalone application for Core A of BF561 when using
15197 the one-application-per-core programming model. Proper start files
15198 and link scripts are used to support Core A, and the macro
15199 @code{__BFIN_COREA} is defined.
15200 This option can only be used in conjunction with @option{-mmulticore}.
15201
15202 @item -mcoreb
15203 @opindex mcoreb
15204 Build a standalone application for Core B of BF561 when using
15205 the one-application-per-core programming model. Proper start files
15206 and link scripts are used to support Core B, and the macro
15207 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
15208 should be used instead of @code{main}.
15209 This option can only be used in conjunction with @option{-mmulticore}.
15210
15211 @item -msdram
15212 @opindex msdram
15213 Build a standalone application for SDRAM. Proper start files and
15214 link scripts are used to put the application into SDRAM, and the macro
15215 @code{__BFIN_SDRAM} is defined.
15216 The loader should initialize SDRAM before loading the application.
15217
15218 @item -micplb
15219 @opindex micplb
15220 Assume that ICPLBs are enabled at run time. This has an effect on certain
15221 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
15222 are enabled; for standalone applications the default is off.
15223 @end table
15224
15225 @node C6X Options
15226 @subsection C6X Options
15227 @cindex C6X Options
15228
15229 @table @gcctabopt
15230 @item -march=@var{name}
15231 @opindex march
15232 This specifies the name of the target architecture. GCC uses this
15233 name to determine what kind of instructions it can emit when generating
15234 assembly code. Permissible names are: @samp{c62x},
15235 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
15236
15237 @item -mbig-endian
15238 @opindex mbig-endian
15239 Generate code for a big-endian target.
15240
15241 @item -mlittle-endian
15242 @opindex mlittle-endian
15243 Generate code for a little-endian target. This is the default.
15244
15245 @item -msim
15246 @opindex msim
15247 Choose startup files and linker script suitable for the simulator.
15248
15249 @item -msdata=default
15250 @opindex msdata=default
15251 Put small global and static data in the @code{.neardata} section,
15252 which is pointed to by register @code{B14}. Put small uninitialized
15253 global and static data in the @code{.bss} section, which is adjacent
15254 to the @code{.neardata} section. Put small read-only data into the
15255 @code{.rodata} section. The corresponding sections used for large
15256 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
15257
15258 @item -msdata=all
15259 @opindex msdata=all
15260 Put all data, not just small objects, into the sections reserved for
15261 small data, and use addressing relative to the @code{B14} register to
15262 access them.
15263
15264 @item -msdata=none
15265 @opindex msdata=none
15266 Make no use of the sections reserved for small data, and use absolute
15267 addresses to access all data. Put all initialized global and static
15268 data in the @code{.fardata} section, and all uninitialized data in the
15269 @code{.far} section. Put all constant data into the @code{.const}
15270 section.
15271 @end table
15272
15273 @node CRIS Options
15274 @subsection CRIS Options
15275 @cindex CRIS Options
15276
15277 These options are defined specifically for the CRIS ports.
15278
15279 @table @gcctabopt
15280 @item -march=@var{architecture-type}
15281 @itemx -mcpu=@var{architecture-type}
15282 @opindex march
15283 @opindex mcpu
15284 Generate code for the specified architecture. The choices for
15285 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
15286 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
15287 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
15288 @samp{v10}.
15289
15290 @item -mtune=@var{architecture-type}
15291 @opindex mtune
15292 Tune to @var{architecture-type} everything applicable about the generated
15293 code, except for the ABI and the set of available instructions. The
15294 choices for @var{architecture-type} are the same as for
15295 @option{-march=@var{architecture-type}}.
15296
15297 @item -mmax-stack-frame=@var{n}
15298 @opindex mmax-stack-frame
15299 Warn when the stack frame of a function exceeds @var{n} bytes.
15300
15301 @item -metrax4
15302 @itemx -metrax100
15303 @opindex metrax4
15304 @opindex metrax100
15305 The options @option{-metrax4} and @option{-metrax100} are synonyms for
15306 @option{-march=v3} and @option{-march=v8} respectively.
15307
15308 @item -mmul-bug-workaround
15309 @itemx -mno-mul-bug-workaround
15310 @opindex mmul-bug-workaround
15311 @opindex mno-mul-bug-workaround
15312 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
15313 models where it applies. This option is active by default.
15314
15315 @item -mpdebug
15316 @opindex mpdebug
15317 Enable CRIS-specific verbose debug-related information in the assembly
15318 code. This option also has the effect of turning off the @samp{#NO_APP}
15319 formatted-code indicator to the assembler at the beginning of the
15320 assembly file.
15321
15322 @item -mcc-init
15323 @opindex mcc-init
15324 Do not use condition-code results from previous instruction; always emit
15325 compare and test instructions before use of condition codes.
15326
15327 @item -mno-side-effects
15328 @opindex mno-side-effects
15329 Do not emit instructions with side effects in addressing modes other than
15330 post-increment.
15331
15332 @item -mstack-align
15333 @itemx -mno-stack-align
15334 @itemx -mdata-align
15335 @itemx -mno-data-align
15336 @itemx -mconst-align
15337 @itemx -mno-const-align
15338 @opindex mstack-align
15339 @opindex mno-stack-align
15340 @opindex mdata-align
15341 @opindex mno-data-align
15342 @opindex mconst-align
15343 @opindex mno-const-align
15344 These options (@samp{no-} options) arrange (eliminate arrangements) for the
15345 stack frame, individual data and constants to be aligned for the maximum
15346 single data access size for the chosen CPU model. The default is to
15347 arrange for 32-bit alignment. ABI details such as structure layout are
15348 not affected by these options.
15349
15350 @item -m32-bit
15351 @itemx -m16-bit
15352 @itemx -m8-bit
15353 @opindex m32-bit
15354 @opindex m16-bit
15355 @opindex m8-bit
15356 Similar to the stack- data- and const-align options above, these options
15357 arrange for stack frame, writable data and constants to all be 32-bit,
15358 16-bit or 8-bit aligned. The default is 32-bit alignment.
15359
15360 @item -mno-prologue-epilogue
15361 @itemx -mprologue-epilogue
15362 @opindex mno-prologue-epilogue
15363 @opindex mprologue-epilogue
15364 With @option{-mno-prologue-epilogue}, the normal function prologue and
15365 epilogue which set up the stack frame are omitted and no return
15366 instructions or return sequences are generated in the code. Use this
15367 option only together with visual inspection of the compiled code: no
15368 warnings or errors are generated when call-saved registers must be saved,
15369 or storage for local variables needs to be allocated.
15370
15371 @item -mno-gotplt
15372 @itemx -mgotplt
15373 @opindex mno-gotplt
15374 @opindex mgotplt
15375 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
15376 instruction sequences that load addresses for functions from the PLT part
15377 of the GOT rather than (traditional on other architectures) calls to the
15378 PLT@. The default is @option{-mgotplt}.
15379
15380 @item -melf
15381 @opindex melf
15382 Legacy no-op option only recognized with the cris-axis-elf and
15383 cris-axis-linux-gnu targets.
15384
15385 @item -mlinux
15386 @opindex mlinux
15387 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
15388
15389 @item -sim
15390 @opindex sim
15391 This option, recognized for the cris-axis-elf, arranges
15392 to link with input-output functions from a simulator library. Code,
15393 initialized data and zero-initialized data are allocated consecutively.
15394
15395 @item -sim2
15396 @opindex sim2
15397 Like @option{-sim}, but pass linker options to locate initialized data at
15398 0x40000000 and zero-initialized data at 0x80000000.
15399 @end table
15400
15401 @node CR16 Options
15402 @subsection CR16 Options
15403 @cindex CR16 Options
15404
15405 These options are defined specifically for the CR16 ports.
15406
15407 @table @gcctabopt
15408
15409 @item -mmac
15410 @opindex mmac
15411 Enable the use of multiply-accumulate instructions. Disabled by default.
15412
15413 @item -mcr16cplus
15414 @itemx -mcr16c
15415 @opindex mcr16cplus
15416 @opindex mcr16c
15417 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
15418 is default.
15419
15420 @item -msim
15421 @opindex msim
15422 Links the library libsim.a which is in compatible with simulator. Applicable
15423 to ELF compiler only.
15424
15425 @item -mint32
15426 @opindex mint32
15427 Choose integer type as 32-bit wide.
15428
15429 @item -mbit-ops
15430 @opindex mbit-ops
15431 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
15432
15433 @item -mdata-model=@var{model}
15434 @opindex mdata-model
15435 Choose a data model. The choices for @var{model} are @samp{near},
15436 @samp{far} or @samp{medium}. @samp{medium} is default.
15437 However, @samp{far} is not valid with @option{-mcr16c}, as the
15438 CR16C architecture does not support the far data model.
15439 @end table
15440
15441 @node Darwin Options
15442 @subsection Darwin Options
15443 @cindex Darwin options
15444
15445 These options are defined for all architectures running the Darwin operating
15446 system.
15447
15448 FSF GCC on Darwin does not create ``fat'' object files; it creates
15449 an object file for the single architecture that GCC was built to
15450 target. Apple's GCC on Darwin does create ``fat'' files if multiple
15451 @option{-arch} options are used; it does so by running the compiler or
15452 linker multiple times and joining the results together with
15453 @file{lipo}.
15454
15455 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
15456 @samp{i686}) is determined by the flags that specify the ISA
15457 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
15458 @option{-force_cpusubtype_ALL} option can be used to override this.
15459
15460 The Darwin tools vary in their behavior when presented with an ISA
15461 mismatch. The assembler, @file{as}, only permits instructions to
15462 be used that are valid for the subtype of the file it is generating,
15463 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
15464 The linker for shared libraries, @file{/usr/bin/libtool}, fails
15465 and prints an error if asked to create a shared library with a less
15466 restrictive subtype than its input files (for instance, trying to put
15467 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
15468 for executables, @command{ld}, quietly gives the executable the most
15469 restrictive subtype of any of its input files.
15470
15471 @table @gcctabopt
15472 @item -F@var{dir}
15473 @opindex F
15474 Add the framework directory @var{dir} to the head of the list of
15475 directories to be searched for header files. These directories are
15476 interleaved with those specified by @option{-I} options and are
15477 scanned in a left-to-right order.
15478
15479 A framework directory is a directory with frameworks in it. A
15480 framework is a directory with a @file{Headers} and/or
15481 @file{PrivateHeaders} directory contained directly in it that ends
15482 in @file{.framework}. The name of a framework is the name of this
15483 directory excluding the @file{.framework}. Headers associated with
15484 the framework are found in one of those two directories, with
15485 @file{Headers} being searched first. A subframework is a framework
15486 directory that is in a framework's @file{Frameworks} directory.
15487 Includes of subframework headers can only appear in a header of a
15488 framework that contains the subframework, or in a sibling subframework
15489 header. Two subframeworks are siblings if they occur in the same
15490 framework. A subframework should not have the same name as a
15491 framework; a warning is issued if this is violated. Currently a
15492 subframework cannot have subframeworks; in the future, the mechanism
15493 may be extended to support this. The standard frameworks can be found
15494 in @file{/System/Library/Frameworks} and
15495 @file{/Library/Frameworks}. An example include looks like
15496 @code{#include <Framework/header.h>}, where @file{Framework} denotes
15497 the name of the framework and @file{header.h} is found in the
15498 @file{PrivateHeaders} or @file{Headers} directory.
15499
15500 @item -iframework@var{dir}
15501 @opindex iframework
15502 Like @option{-F} except the directory is a treated as a system
15503 directory. The main difference between this @option{-iframework} and
15504 @option{-F} is that with @option{-iframework} the compiler does not
15505 warn about constructs contained within header files found via
15506 @var{dir}. This option is valid only for the C family of languages.
15507
15508 @item -gused
15509 @opindex gused
15510 Emit debugging information for symbols that are used. For stabs
15511 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
15512 This is by default ON@.
15513
15514 @item -gfull
15515 @opindex gfull
15516 Emit debugging information for all symbols and types.
15517
15518 @item -mmacosx-version-min=@var{version}
15519 The earliest version of MacOS X that this executable will run on
15520 is @var{version}. Typical values of @var{version} include @code{10.1},
15521 @code{10.2}, and @code{10.3.9}.
15522
15523 If the compiler was built to use the system's headers by default,
15524 then the default for this option is the system version on which the
15525 compiler is running, otherwise the default is to make choices that
15526 are compatible with as many systems and code bases as possible.
15527
15528 @item -mkernel
15529 @opindex mkernel
15530 Enable kernel development mode. The @option{-mkernel} option sets
15531 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
15532 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
15533 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
15534 applicable. This mode also sets @option{-mno-altivec},
15535 @option{-msoft-float}, @option{-fno-builtin} and
15536 @option{-mlong-branch} for PowerPC targets.
15537
15538 @item -mone-byte-bool
15539 @opindex mone-byte-bool
15540 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
15541 By default @code{sizeof(bool)} is @code{4} when compiling for
15542 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
15543 option has no effect on x86.
15544
15545 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
15546 to generate code that is not binary compatible with code generated
15547 without that switch. Using this switch may require recompiling all
15548 other modules in a program, including system libraries. Use this
15549 switch to conform to a non-default data model.
15550
15551 @item -mfix-and-continue
15552 @itemx -ffix-and-continue
15553 @itemx -findirect-data
15554 @opindex mfix-and-continue
15555 @opindex ffix-and-continue
15556 @opindex findirect-data
15557 Generate code suitable for fast turnaround development, such as to
15558 allow GDB to dynamically load @file{.o} files into already-running
15559 programs. @option{-findirect-data} and @option{-ffix-and-continue}
15560 are provided for backwards compatibility.
15561
15562 @item -all_load
15563 @opindex all_load
15564 Loads all members of static archive libraries.
15565 See man ld(1) for more information.
15566
15567 @item -arch_errors_fatal
15568 @opindex arch_errors_fatal
15569 Cause the errors having to do with files that have the wrong architecture
15570 to be fatal.
15571
15572 @item -bind_at_load
15573 @opindex bind_at_load
15574 Causes the output file to be marked such that the dynamic linker will
15575 bind all undefined references when the file is loaded or launched.
15576
15577 @item -bundle
15578 @opindex bundle
15579 Produce a Mach-o bundle format file.
15580 See man ld(1) for more information.
15581
15582 @item -bundle_loader @var{executable}
15583 @opindex bundle_loader
15584 This option specifies the @var{executable} that will load the build
15585 output file being linked. See man ld(1) for more information.
15586
15587 @item -dynamiclib
15588 @opindex dynamiclib
15589 When passed this option, GCC produces a dynamic library instead of
15590 an executable when linking, using the Darwin @file{libtool} command.
15591
15592 @item -force_cpusubtype_ALL
15593 @opindex force_cpusubtype_ALL
15594 This causes GCC's output file to have the @samp{ALL} subtype, instead of
15595 one controlled by the @option{-mcpu} or @option{-march} option.
15596
15597 @item -allowable_client @var{client_name}
15598 @itemx -client_name
15599 @itemx -compatibility_version
15600 @itemx -current_version
15601 @itemx -dead_strip
15602 @itemx -dependency-file
15603 @itemx -dylib_file
15604 @itemx -dylinker_install_name
15605 @itemx -dynamic
15606 @itemx -exported_symbols_list
15607 @itemx -filelist
15608 @need 800
15609 @itemx -flat_namespace
15610 @itemx -force_flat_namespace
15611 @itemx -headerpad_max_install_names
15612 @itemx -image_base
15613 @itemx -init
15614 @itemx -install_name
15615 @itemx -keep_private_externs
15616 @itemx -multi_module
15617 @itemx -multiply_defined
15618 @itemx -multiply_defined_unused
15619 @need 800
15620 @itemx -noall_load
15621 @itemx -no_dead_strip_inits_and_terms
15622 @itemx -nofixprebinding
15623 @itemx -nomultidefs
15624 @itemx -noprebind
15625 @itemx -noseglinkedit
15626 @itemx -pagezero_size
15627 @itemx -prebind
15628 @itemx -prebind_all_twolevel_modules
15629 @itemx -private_bundle
15630 @need 800
15631 @itemx -read_only_relocs
15632 @itemx -sectalign
15633 @itemx -sectobjectsymbols
15634 @itemx -whyload
15635 @itemx -seg1addr
15636 @itemx -sectcreate
15637 @itemx -sectobjectsymbols
15638 @itemx -sectorder
15639 @itemx -segaddr
15640 @itemx -segs_read_only_addr
15641 @need 800
15642 @itemx -segs_read_write_addr
15643 @itemx -seg_addr_table
15644 @itemx -seg_addr_table_filename
15645 @itemx -seglinkedit
15646 @itemx -segprot
15647 @itemx -segs_read_only_addr
15648 @itemx -segs_read_write_addr
15649 @itemx -single_module
15650 @itemx -static
15651 @itemx -sub_library
15652 @need 800
15653 @itemx -sub_umbrella
15654 @itemx -twolevel_namespace
15655 @itemx -umbrella
15656 @itemx -undefined
15657 @itemx -unexported_symbols_list
15658 @itemx -weak_reference_mismatches
15659 @itemx -whatsloaded
15660 @opindex allowable_client
15661 @opindex client_name
15662 @opindex compatibility_version
15663 @opindex current_version
15664 @opindex dead_strip
15665 @opindex dependency-file
15666 @opindex dylib_file
15667 @opindex dylinker_install_name
15668 @opindex dynamic
15669 @opindex exported_symbols_list
15670 @opindex filelist
15671 @opindex flat_namespace
15672 @opindex force_flat_namespace
15673 @opindex headerpad_max_install_names
15674 @opindex image_base
15675 @opindex init
15676 @opindex install_name
15677 @opindex keep_private_externs
15678 @opindex multi_module
15679 @opindex multiply_defined
15680 @opindex multiply_defined_unused
15681 @opindex noall_load
15682 @opindex no_dead_strip_inits_and_terms
15683 @opindex nofixprebinding
15684 @opindex nomultidefs
15685 @opindex noprebind
15686 @opindex noseglinkedit
15687 @opindex pagezero_size
15688 @opindex prebind
15689 @opindex prebind_all_twolevel_modules
15690 @opindex private_bundle
15691 @opindex read_only_relocs
15692 @opindex sectalign
15693 @opindex sectobjectsymbols
15694 @opindex whyload
15695 @opindex seg1addr
15696 @opindex sectcreate
15697 @opindex sectobjectsymbols
15698 @opindex sectorder
15699 @opindex segaddr
15700 @opindex segs_read_only_addr
15701 @opindex segs_read_write_addr
15702 @opindex seg_addr_table
15703 @opindex seg_addr_table_filename
15704 @opindex seglinkedit
15705 @opindex segprot
15706 @opindex segs_read_only_addr
15707 @opindex segs_read_write_addr
15708 @opindex single_module
15709 @opindex static
15710 @opindex sub_library
15711 @opindex sub_umbrella
15712 @opindex twolevel_namespace
15713 @opindex umbrella
15714 @opindex undefined
15715 @opindex unexported_symbols_list
15716 @opindex weak_reference_mismatches
15717 @opindex whatsloaded
15718 These options are passed to the Darwin linker. The Darwin linker man page
15719 describes them in detail.
15720 @end table
15721
15722 @node DEC Alpha Options
15723 @subsection DEC Alpha Options
15724
15725 These @samp{-m} options are defined for the DEC Alpha implementations:
15726
15727 @table @gcctabopt
15728 @item -mno-soft-float
15729 @itemx -msoft-float
15730 @opindex mno-soft-float
15731 @opindex msoft-float
15732 Use (do not use) the hardware floating-point instructions for
15733 floating-point operations. When @option{-msoft-float} is specified,
15734 functions in @file{libgcc.a} are used to perform floating-point
15735 operations. Unless they are replaced by routines that emulate the
15736 floating-point operations, or compiled in such a way as to call such
15737 emulations routines, these routines issue floating-point
15738 operations. If you are compiling for an Alpha without floating-point
15739 operations, you must ensure that the library is built so as not to call
15740 them.
15741
15742 Note that Alpha implementations without floating-point operations are
15743 required to have floating-point registers.
15744
15745 @item -mfp-reg
15746 @itemx -mno-fp-regs
15747 @opindex mfp-reg
15748 @opindex mno-fp-regs
15749 Generate code that uses (does not use) the floating-point register set.
15750 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
15751 register set is not used, floating-point operands are passed in integer
15752 registers as if they were integers and floating-point results are passed
15753 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
15754 so any function with a floating-point argument or return value called by code
15755 compiled with @option{-mno-fp-regs} must also be compiled with that
15756 option.
15757
15758 A typical use of this option is building a kernel that does not use,
15759 and hence need not save and restore, any floating-point registers.
15760
15761 @item -mieee
15762 @opindex mieee
15763 The Alpha architecture implements floating-point hardware optimized for
15764 maximum performance. It is mostly compliant with the IEEE floating-point
15765 standard. However, for full compliance, software assistance is
15766 required. This option generates code fully IEEE-compliant code
15767 @emph{except} that the @var{inexact-flag} is not maintained (see below).
15768 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
15769 defined during compilation. The resulting code is less efficient but is
15770 able to correctly support denormalized numbers and exceptional IEEE
15771 values such as not-a-number and plus/minus infinity. Other Alpha
15772 compilers call this option @option{-ieee_with_no_inexact}.
15773
15774 @item -mieee-with-inexact
15775 @opindex mieee-with-inexact
15776 This is like @option{-mieee} except the generated code also maintains
15777 the IEEE @var{inexact-flag}. Turning on this option causes the
15778 generated code to implement fully-compliant IEEE math. In addition to
15779 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
15780 macro. On some Alpha implementations the resulting code may execute
15781 significantly slower than the code generated by default. Since there is
15782 very little code that depends on the @var{inexact-flag}, you should
15783 normally not specify this option. Other Alpha compilers call this
15784 option @option{-ieee_with_inexact}.
15785
15786 @item -mfp-trap-mode=@var{trap-mode}
15787 @opindex mfp-trap-mode
15788 This option controls what floating-point related traps are enabled.
15789 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
15790 The trap mode can be set to one of four values:
15791
15792 @table @samp
15793 @item n
15794 This is the default (normal) setting. The only traps that are enabled
15795 are the ones that cannot be disabled in software (e.g., division by zero
15796 trap).
15797
15798 @item u
15799 In addition to the traps enabled by @samp{n}, underflow traps are enabled
15800 as well.
15801
15802 @item su
15803 Like @samp{u}, but the instructions are marked to be safe for software
15804 completion (see Alpha architecture manual for details).
15805
15806 @item sui
15807 Like @samp{su}, but inexact traps are enabled as well.
15808 @end table
15809
15810 @item -mfp-rounding-mode=@var{rounding-mode}
15811 @opindex mfp-rounding-mode
15812 Selects the IEEE rounding mode. Other Alpha compilers call this option
15813 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
15814 of:
15815
15816 @table @samp
15817 @item n
15818 Normal IEEE rounding mode. Floating-point numbers are rounded towards
15819 the nearest machine number or towards the even machine number in case
15820 of a tie.
15821
15822 @item m
15823 Round towards minus infinity.
15824
15825 @item c
15826 Chopped rounding mode. Floating-point numbers are rounded towards zero.
15827
15828 @item d
15829 Dynamic rounding mode. A field in the floating-point control register
15830 (@var{fpcr}, see Alpha architecture reference manual) controls the
15831 rounding mode in effect. The C library initializes this register for
15832 rounding towards plus infinity. Thus, unless your program modifies the
15833 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
15834 @end table
15835
15836 @item -mtrap-precision=@var{trap-precision}
15837 @opindex mtrap-precision
15838 In the Alpha architecture, floating-point traps are imprecise. This
15839 means without software assistance it is impossible to recover from a
15840 floating trap and program execution normally needs to be terminated.
15841 GCC can generate code that can assist operating system trap handlers
15842 in determining the exact location that caused a floating-point trap.
15843 Depending on the requirements of an application, different levels of
15844 precisions can be selected:
15845
15846 @table @samp
15847 @item p
15848 Program precision. This option is the default and means a trap handler
15849 can only identify which program caused a floating-point exception.
15850
15851 @item f
15852 Function precision. The trap handler can determine the function that
15853 caused a floating-point exception.
15854
15855 @item i
15856 Instruction precision. The trap handler can determine the exact
15857 instruction that caused a floating-point exception.
15858 @end table
15859
15860 Other Alpha compilers provide the equivalent options called
15861 @option{-scope_safe} and @option{-resumption_safe}.
15862
15863 @item -mieee-conformant
15864 @opindex mieee-conformant
15865 This option marks the generated code as IEEE conformant. You must not
15866 use this option unless you also specify @option{-mtrap-precision=i} and either
15867 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
15868 is to emit the line @samp{.eflag 48} in the function prologue of the
15869 generated assembly file.
15870
15871 @item -mbuild-constants
15872 @opindex mbuild-constants
15873 Normally GCC examines a 32- or 64-bit integer constant to
15874 see if it can construct it from smaller constants in two or three
15875 instructions. If it cannot, it outputs the constant as a literal and
15876 generates code to load it from the data segment at run time.
15877
15878 Use this option to require GCC to construct @emph{all} integer constants
15879 using code, even if it takes more instructions (the maximum is six).
15880
15881 You typically use this option to build a shared library dynamic
15882 loader. Itself a shared library, it must relocate itself in memory
15883 before it can find the variables and constants in its own data segment.
15884
15885 @item -mbwx
15886 @itemx -mno-bwx
15887 @itemx -mcix
15888 @itemx -mno-cix
15889 @itemx -mfix
15890 @itemx -mno-fix
15891 @itemx -mmax
15892 @itemx -mno-max
15893 @opindex mbwx
15894 @opindex mno-bwx
15895 @opindex mcix
15896 @opindex mno-cix
15897 @opindex mfix
15898 @opindex mno-fix
15899 @opindex mmax
15900 @opindex mno-max
15901 Indicate whether GCC should generate code to use the optional BWX,
15902 CIX, FIX and MAX instruction sets. The default is to use the instruction
15903 sets supported by the CPU type specified via @option{-mcpu=} option or that
15904 of the CPU on which GCC was built if none is specified.
15905
15906 @item -mfloat-vax
15907 @itemx -mfloat-ieee
15908 @opindex mfloat-vax
15909 @opindex mfloat-ieee
15910 Generate code that uses (does not use) VAX F and G floating-point
15911 arithmetic instead of IEEE single and double precision.
15912
15913 @item -mexplicit-relocs
15914 @itemx -mno-explicit-relocs
15915 @opindex mexplicit-relocs
15916 @opindex mno-explicit-relocs
15917 Older Alpha assemblers provided no way to generate symbol relocations
15918 except via assembler macros. Use of these macros does not allow
15919 optimal instruction scheduling. GNU binutils as of version 2.12
15920 supports a new syntax that allows the compiler to explicitly mark
15921 which relocations should apply to which instructions. This option
15922 is mostly useful for debugging, as GCC detects the capabilities of
15923 the assembler when it is built and sets the default accordingly.
15924
15925 @item -msmall-data
15926 @itemx -mlarge-data
15927 @opindex msmall-data
15928 @opindex mlarge-data
15929 When @option{-mexplicit-relocs} is in effect, static data is
15930 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
15931 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
15932 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
15933 16-bit relocations off of the @code{$gp} register. This limits the
15934 size of the small data area to 64KB, but allows the variables to be
15935 directly accessed via a single instruction.
15936
15937 The default is @option{-mlarge-data}. With this option the data area
15938 is limited to just below 2GB@. Programs that require more than 2GB of
15939 data must use @code{malloc} or @code{mmap} to allocate the data in the
15940 heap instead of in the program's data segment.
15941
15942 When generating code for shared libraries, @option{-fpic} implies
15943 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
15944
15945 @item -msmall-text
15946 @itemx -mlarge-text
15947 @opindex msmall-text
15948 @opindex mlarge-text
15949 When @option{-msmall-text} is used, the compiler assumes that the
15950 code of the entire program (or shared library) fits in 4MB, and is
15951 thus reachable with a branch instruction. When @option{-msmall-data}
15952 is used, the compiler can assume that all local symbols share the
15953 same @code{$gp} value, and thus reduce the number of instructions
15954 required for a function call from 4 to 1.
15955
15956 The default is @option{-mlarge-text}.
15957
15958 @item -mcpu=@var{cpu_type}
15959 @opindex mcpu
15960 Set the instruction set and instruction scheduling parameters for
15961 machine type @var{cpu_type}. You can specify either the @samp{EV}
15962 style name or the corresponding chip number. GCC supports scheduling
15963 parameters for the EV4, EV5 and EV6 family of processors and
15964 chooses the default values for the instruction set from the processor
15965 you specify. If you do not specify a processor type, GCC defaults
15966 to the processor on which the compiler was built.
15967
15968 Supported values for @var{cpu_type} are
15969
15970 @table @samp
15971 @item ev4
15972 @itemx ev45
15973 @itemx 21064
15974 Schedules as an EV4 and has no instruction set extensions.
15975
15976 @item ev5
15977 @itemx 21164
15978 Schedules as an EV5 and has no instruction set extensions.
15979
15980 @item ev56
15981 @itemx 21164a
15982 Schedules as an EV5 and supports the BWX extension.
15983
15984 @item pca56
15985 @itemx 21164pc
15986 @itemx 21164PC
15987 Schedules as an EV5 and supports the BWX and MAX extensions.
15988
15989 @item ev6
15990 @itemx 21264
15991 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
15992
15993 @item ev67
15994 @itemx 21264a
15995 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
15996 @end table
15997
15998 Native toolchains also support the value @samp{native},
15999 which selects the best architecture option for the host processor.
16000 @option{-mcpu=native} has no effect if GCC does not recognize
16001 the processor.
16002
16003 @item -mtune=@var{cpu_type}
16004 @opindex mtune
16005 Set only the instruction scheduling parameters for machine type
16006 @var{cpu_type}. The instruction set is not changed.
16007
16008 Native toolchains also support the value @samp{native},
16009 which selects the best architecture option for the host processor.
16010 @option{-mtune=native} has no effect if GCC does not recognize
16011 the processor.
16012
16013 @item -mmemory-latency=@var{time}
16014 @opindex mmemory-latency
16015 Sets the latency the scheduler should assume for typical memory
16016 references as seen by the application. This number is highly
16017 dependent on the memory access patterns used by the application
16018 and the size of the external cache on the machine.
16019
16020 Valid options for @var{time} are
16021
16022 @table @samp
16023 @item @var{number}
16024 A decimal number representing clock cycles.
16025
16026 @item L1
16027 @itemx L2
16028 @itemx L3
16029 @itemx main
16030 The compiler contains estimates of the number of clock cycles for
16031 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
16032 (also called Dcache, Scache, and Bcache), as well as to main memory.
16033 Note that L3 is only valid for EV5.
16034
16035 @end table
16036 @end table
16037
16038 @node FR30 Options
16039 @subsection FR30 Options
16040 @cindex FR30 Options
16041
16042 These options are defined specifically for the FR30 port.
16043
16044 @table @gcctabopt
16045
16046 @item -msmall-model
16047 @opindex msmall-model
16048 Use the small address space model. This can produce smaller code, but
16049 it does assume that all symbolic values and addresses fit into a
16050 20-bit range.
16051
16052 @item -mno-lsim
16053 @opindex mno-lsim
16054 Assume that runtime support has been provided and so there is no need
16055 to include the simulator library (@file{libsim.a}) on the linker
16056 command line.
16057
16058 @end table
16059
16060 @node FT32 Options
16061 @subsection FT32 Options
16062 @cindex FT32 Options
16063
16064 These options are defined specifically for the FT32 port.
16065
16066 @table @gcctabopt
16067
16068 @item -msim
16069 @opindex msim
16070 Specifies that the program will be run on the simulator. This causes
16071 an alternate runtime startup and library to be linked.
16072 You must not use this option when generating programs that will run on
16073 real hardware; you must provide your own runtime library for whatever
16074 I/O functions are needed.
16075
16076 @item -mlra
16077 @opindex mlra
16078 Enable Local Register Allocation. This is still experimental for FT32,
16079 so by default the compiler uses standard reload.
16080
16081 @item -mnodiv
16082 @opindex mnodiv
16083 Do not use div and mod instructions.
16084
16085 @end table
16086
16087 @node FRV Options
16088 @subsection FRV Options
16089 @cindex FRV Options
16090
16091 @table @gcctabopt
16092 @item -mgpr-32
16093 @opindex mgpr-32
16094
16095 Only use the first 32 general-purpose registers.
16096
16097 @item -mgpr-64
16098 @opindex mgpr-64
16099
16100 Use all 64 general-purpose registers.
16101
16102 @item -mfpr-32
16103 @opindex mfpr-32
16104
16105 Use only the first 32 floating-point registers.
16106
16107 @item -mfpr-64
16108 @opindex mfpr-64
16109
16110 Use all 64 floating-point registers.
16111
16112 @item -mhard-float
16113 @opindex mhard-float
16114
16115 Use hardware instructions for floating-point operations.
16116
16117 @item -msoft-float
16118 @opindex msoft-float
16119
16120 Use library routines for floating-point operations.
16121
16122 @item -malloc-cc
16123 @opindex malloc-cc
16124
16125 Dynamically allocate condition code registers.
16126
16127 @item -mfixed-cc
16128 @opindex mfixed-cc
16129
16130 Do not try to dynamically allocate condition code registers, only
16131 use @code{icc0} and @code{fcc0}.
16132
16133 @item -mdword
16134 @opindex mdword
16135
16136 Change ABI to use double word insns.
16137
16138 @item -mno-dword
16139 @opindex mno-dword
16140
16141 Do not use double word instructions.
16142
16143 @item -mdouble
16144 @opindex mdouble
16145
16146 Use floating-point double instructions.
16147
16148 @item -mno-double
16149 @opindex mno-double
16150
16151 Do not use floating-point double instructions.
16152
16153 @item -mmedia
16154 @opindex mmedia
16155
16156 Use media instructions.
16157
16158 @item -mno-media
16159 @opindex mno-media
16160
16161 Do not use media instructions.
16162
16163 @item -mmuladd
16164 @opindex mmuladd
16165
16166 Use multiply and add/subtract instructions.
16167
16168 @item -mno-muladd
16169 @opindex mno-muladd
16170
16171 Do not use multiply and add/subtract instructions.
16172
16173 @item -mfdpic
16174 @opindex mfdpic
16175
16176 Select the FDPIC ABI, which uses function descriptors to represent
16177 pointers to functions. Without any PIC/PIE-related options, it
16178 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
16179 assumes GOT entries and small data are within a 12-bit range from the
16180 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
16181 are computed with 32 bits.
16182 With a @samp{bfin-elf} target, this option implies @option{-msim}.
16183
16184 @item -minline-plt
16185 @opindex minline-plt
16186
16187 Enable inlining of PLT entries in function calls to functions that are
16188 not known to bind locally. It has no effect without @option{-mfdpic}.
16189 It's enabled by default if optimizing for speed and compiling for
16190 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
16191 optimization option such as @option{-O3} or above is present in the
16192 command line.
16193
16194 @item -mTLS
16195 @opindex mTLS
16196
16197 Assume a large TLS segment when generating thread-local code.
16198
16199 @item -mtls
16200 @opindex mtls
16201
16202 Do not assume a large TLS segment when generating thread-local code.
16203
16204 @item -mgprel-ro
16205 @opindex mgprel-ro
16206
16207 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
16208 that is known to be in read-only sections. It's enabled by default,
16209 except for @option{-fpic} or @option{-fpie}: even though it may help
16210 make the global offset table smaller, it trades 1 instruction for 4.
16211 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
16212 one of which may be shared by multiple symbols, and it avoids the need
16213 for a GOT entry for the referenced symbol, so it's more likely to be a
16214 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
16215
16216 @item -multilib-library-pic
16217 @opindex multilib-library-pic
16218
16219 Link with the (library, not FD) pic libraries. It's implied by
16220 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
16221 @option{-fpic} without @option{-mfdpic}. You should never have to use
16222 it explicitly.
16223
16224 @item -mlinked-fp
16225 @opindex mlinked-fp
16226
16227 Follow the EABI requirement of always creating a frame pointer whenever
16228 a stack frame is allocated. This option is enabled by default and can
16229 be disabled with @option{-mno-linked-fp}.
16230
16231 @item -mlong-calls
16232 @opindex mlong-calls
16233
16234 Use indirect addressing to call functions outside the current
16235 compilation unit. This allows the functions to be placed anywhere
16236 within the 32-bit address space.
16237
16238 @item -malign-labels
16239 @opindex malign-labels
16240
16241 Try to align labels to an 8-byte boundary by inserting NOPs into the
16242 previous packet. This option only has an effect when VLIW packing
16243 is enabled. It doesn't create new packets; it merely adds NOPs to
16244 existing ones.
16245
16246 @item -mlibrary-pic
16247 @opindex mlibrary-pic
16248
16249 Generate position-independent EABI code.
16250
16251 @item -macc-4
16252 @opindex macc-4
16253
16254 Use only the first four media accumulator registers.
16255
16256 @item -macc-8
16257 @opindex macc-8
16258
16259 Use all eight media accumulator registers.
16260
16261 @item -mpack
16262 @opindex mpack
16263
16264 Pack VLIW instructions.
16265
16266 @item -mno-pack
16267 @opindex mno-pack
16268
16269 Do not pack VLIW instructions.
16270
16271 @item -mno-eflags
16272 @opindex mno-eflags
16273
16274 Do not mark ABI switches in e_flags.
16275
16276 @item -mcond-move
16277 @opindex mcond-move
16278
16279 Enable the use of conditional-move instructions (default).
16280
16281 This switch is mainly for debugging the compiler and will likely be removed
16282 in a future version.
16283
16284 @item -mno-cond-move
16285 @opindex mno-cond-move
16286
16287 Disable the use of conditional-move instructions.
16288
16289 This switch is mainly for debugging the compiler and will likely be removed
16290 in a future version.
16291
16292 @item -mscc
16293 @opindex mscc
16294
16295 Enable the use of conditional set instructions (default).
16296
16297 This switch is mainly for debugging the compiler and will likely be removed
16298 in a future version.
16299
16300 @item -mno-scc
16301 @opindex mno-scc
16302
16303 Disable the use of conditional set instructions.
16304
16305 This switch is mainly for debugging the compiler and will likely be removed
16306 in a future version.
16307
16308 @item -mcond-exec
16309 @opindex mcond-exec
16310
16311 Enable the use of conditional execution (default).
16312
16313 This switch is mainly for debugging the compiler and will likely be removed
16314 in a future version.
16315
16316 @item -mno-cond-exec
16317 @opindex mno-cond-exec
16318
16319 Disable the use of conditional execution.
16320
16321 This switch is mainly for debugging the compiler and will likely be removed
16322 in a future version.
16323
16324 @item -mvliw-branch
16325 @opindex mvliw-branch
16326
16327 Run a pass to pack branches into VLIW instructions (default).
16328
16329 This switch is mainly for debugging the compiler and will likely be removed
16330 in a future version.
16331
16332 @item -mno-vliw-branch
16333 @opindex mno-vliw-branch
16334
16335 Do not run a pass to pack branches into VLIW instructions.
16336
16337 This switch is mainly for debugging the compiler and will likely be removed
16338 in a future version.
16339
16340 @item -mmulti-cond-exec
16341 @opindex mmulti-cond-exec
16342
16343 Enable optimization of @code{&&} and @code{||} in conditional execution
16344 (default).
16345
16346 This switch is mainly for debugging the compiler and will likely be removed
16347 in a future version.
16348
16349 @item -mno-multi-cond-exec
16350 @opindex mno-multi-cond-exec
16351
16352 Disable optimization of @code{&&} and @code{||} in conditional execution.
16353
16354 This switch is mainly for debugging the compiler and will likely be removed
16355 in a future version.
16356
16357 @item -mnested-cond-exec
16358 @opindex mnested-cond-exec
16359
16360 Enable nested conditional execution optimizations (default).
16361
16362 This switch is mainly for debugging the compiler and will likely be removed
16363 in a future version.
16364
16365 @item -mno-nested-cond-exec
16366 @opindex mno-nested-cond-exec
16367
16368 Disable nested conditional execution optimizations.
16369
16370 This switch is mainly for debugging the compiler and will likely be removed
16371 in a future version.
16372
16373 @item -moptimize-membar
16374 @opindex moptimize-membar
16375
16376 This switch removes redundant @code{membar} instructions from the
16377 compiler-generated code. It is enabled by default.
16378
16379 @item -mno-optimize-membar
16380 @opindex mno-optimize-membar
16381
16382 This switch disables the automatic removal of redundant @code{membar}
16383 instructions from the generated code.
16384
16385 @item -mtomcat-stats
16386 @opindex mtomcat-stats
16387
16388 Cause gas to print out tomcat statistics.
16389
16390 @item -mcpu=@var{cpu}
16391 @opindex mcpu
16392
16393 Select the processor type for which to generate code. Possible values are
16394 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
16395 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
16396
16397 @end table
16398
16399 @node GNU/Linux Options
16400 @subsection GNU/Linux Options
16401
16402 These @samp{-m} options are defined for GNU/Linux targets:
16403
16404 @table @gcctabopt
16405 @item -mglibc
16406 @opindex mglibc
16407 Use the GNU C library. This is the default except
16408 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
16409 @samp{*-*-linux-*android*} targets.
16410
16411 @item -muclibc
16412 @opindex muclibc
16413 Use uClibc C library. This is the default on
16414 @samp{*-*-linux-*uclibc*} targets.
16415
16416 @item -mmusl
16417 @opindex mmusl
16418 Use the musl C library. This is the default on
16419 @samp{*-*-linux-*musl*} targets.
16420
16421 @item -mbionic
16422 @opindex mbionic
16423 Use Bionic C library. This is the default on
16424 @samp{*-*-linux-*android*} targets.
16425
16426 @item -mandroid
16427 @opindex mandroid
16428 Compile code compatible with Android platform. This is the default on
16429 @samp{*-*-linux-*android*} targets.
16430
16431 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
16432 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
16433 this option makes the GCC driver pass Android-specific options to the linker.
16434 Finally, this option causes the preprocessor macro @code{__ANDROID__}
16435 to be defined.
16436
16437 @item -tno-android-cc
16438 @opindex tno-android-cc
16439 Disable compilation effects of @option{-mandroid}, i.e., do not enable
16440 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
16441 @option{-fno-rtti} by default.
16442
16443 @item -tno-android-ld
16444 @opindex tno-android-ld
16445 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
16446 linking options to the linker.
16447
16448 @end table
16449
16450 @node H8/300 Options
16451 @subsection H8/300 Options
16452
16453 These @samp{-m} options are defined for the H8/300 implementations:
16454
16455 @table @gcctabopt
16456 @item -mrelax
16457 @opindex mrelax
16458 Shorten some address references at link time, when possible; uses the
16459 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
16460 ld, Using ld}, for a fuller description.
16461
16462 @item -mh
16463 @opindex mh
16464 Generate code for the H8/300H@.
16465
16466 @item -ms
16467 @opindex ms
16468 Generate code for the H8S@.
16469
16470 @item -mn
16471 @opindex mn
16472 Generate code for the H8S and H8/300H in the normal mode. This switch
16473 must be used either with @option{-mh} or @option{-ms}.
16474
16475 @item -ms2600
16476 @opindex ms2600
16477 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
16478
16479 @item -mexr
16480 @opindex mexr
16481 Extended registers are stored on stack before execution of function
16482 with monitor attribute. Default option is @option{-mexr}.
16483 This option is valid only for H8S targets.
16484
16485 @item -mno-exr
16486 @opindex mno-exr
16487 Extended registers are not stored on stack before execution of function
16488 with monitor attribute. Default option is @option{-mno-exr}.
16489 This option is valid only for H8S targets.
16490
16491 @item -mint32
16492 @opindex mint32
16493 Make @code{int} data 32 bits by default.
16494
16495 @item -malign-300
16496 @opindex malign-300
16497 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
16498 The default for the H8/300H and H8S is to align longs and floats on
16499 4-byte boundaries.
16500 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
16501 This option has no effect on the H8/300.
16502 @end table
16503
16504 @node HPPA Options
16505 @subsection HPPA Options
16506 @cindex HPPA Options
16507
16508 These @samp{-m} options are defined for the HPPA family of computers:
16509
16510 @table @gcctabopt
16511 @item -march=@var{architecture-type}
16512 @opindex march
16513 Generate code for the specified architecture. The choices for
16514 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
16515 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
16516 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
16517 architecture option for your machine. Code compiled for lower numbered
16518 architectures runs on higher numbered architectures, but not the
16519 other way around.
16520
16521 @item -mpa-risc-1-0
16522 @itemx -mpa-risc-1-1
16523 @itemx -mpa-risc-2-0
16524 @opindex mpa-risc-1-0
16525 @opindex mpa-risc-1-1
16526 @opindex mpa-risc-2-0
16527 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
16528
16529 @item -mjump-in-delay
16530 @opindex mjump-in-delay
16531 This option is ignored and provided for compatibility purposes only.
16532
16533 @item -mdisable-fpregs
16534 @opindex mdisable-fpregs
16535 Prevent floating-point registers from being used in any manner. This is
16536 necessary for compiling kernels that perform lazy context switching of
16537 floating-point registers. If you use this option and attempt to perform
16538 floating-point operations, the compiler aborts.
16539
16540 @item -mdisable-indexing
16541 @opindex mdisable-indexing
16542 Prevent the compiler from using indexing address modes. This avoids some
16543 rather obscure problems when compiling MIG generated code under MACH@.
16544
16545 @item -mno-space-regs
16546 @opindex mno-space-regs
16547 Generate code that assumes the target has no space registers. This allows
16548 GCC to generate faster indirect calls and use unscaled index address modes.
16549
16550 Such code is suitable for level 0 PA systems and kernels.
16551
16552 @item -mfast-indirect-calls
16553 @opindex mfast-indirect-calls
16554 Generate code that assumes calls never cross space boundaries. This
16555 allows GCC to emit code that performs faster indirect calls.
16556
16557 This option does not work in the presence of shared libraries or nested
16558 functions.
16559
16560 @item -mfixed-range=@var{register-range}
16561 @opindex mfixed-range
16562 Generate code treating the given register range as fixed registers.
16563 A fixed register is one that the register allocator cannot use. This is
16564 useful when compiling kernel code. A register range is specified as
16565 two registers separated by a dash. Multiple register ranges can be
16566 specified separated by a comma.
16567
16568 @item -mlong-load-store
16569 @opindex mlong-load-store
16570 Generate 3-instruction load and store sequences as sometimes required by
16571 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
16572 the HP compilers.
16573
16574 @item -mportable-runtime
16575 @opindex mportable-runtime
16576 Use the portable calling conventions proposed by HP for ELF systems.
16577
16578 @item -mgas
16579 @opindex mgas
16580 Enable the use of assembler directives only GAS understands.
16581
16582 @item -mschedule=@var{cpu-type}
16583 @opindex mschedule
16584 Schedule code according to the constraints for the machine type
16585 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
16586 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
16587 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
16588 proper scheduling option for your machine. The default scheduling is
16589 @samp{8000}.
16590
16591 @item -mlinker-opt
16592 @opindex mlinker-opt
16593 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
16594 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
16595 linkers in which they give bogus error messages when linking some programs.
16596
16597 @item -msoft-float
16598 @opindex msoft-float
16599 Generate output containing library calls for floating point.
16600 @strong{Warning:} the requisite libraries are not available for all HPPA
16601 targets. Normally the facilities of the machine's usual C compiler are
16602 used, but this cannot be done directly in cross-compilation. You must make
16603 your own arrangements to provide suitable library functions for
16604 cross-compilation.
16605
16606 @option{-msoft-float} changes the calling convention in the output file;
16607 therefore, it is only useful if you compile @emph{all} of a program with
16608 this option. In particular, you need to compile @file{libgcc.a}, the
16609 library that comes with GCC, with @option{-msoft-float} in order for
16610 this to work.
16611
16612 @item -msio
16613 @opindex msio
16614 Generate the predefine, @code{_SIO}, for server IO@. The default is
16615 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
16616 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
16617 options are available under HP-UX and HI-UX@.
16618
16619 @item -mgnu-ld
16620 @opindex mgnu-ld
16621 Use options specific to GNU @command{ld}.
16622 This passes @option{-shared} to @command{ld} when
16623 building a shared library. It is the default when GCC is configured,
16624 explicitly or implicitly, with the GNU linker. This option does not
16625 affect which @command{ld} is called; it only changes what parameters
16626 are passed to that @command{ld}.
16627 The @command{ld} that is called is determined by the
16628 @option{--with-ld} configure option, GCC's program search path, and
16629 finally by the user's @env{PATH}. The linker used by GCC can be printed
16630 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
16631 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16632
16633 @item -mhp-ld
16634 @opindex mhp-ld
16635 Use options specific to HP @command{ld}.
16636 This passes @option{-b} to @command{ld} when building
16637 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
16638 links. It is the default when GCC is configured, explicitly or
16639 implicitly, with the HP linker. This option does not affect
16640 which @command{ld} is called; it only changes what parameters are passed to that
16641 @command{ld}.
16642 The @command{ld} that is called is determined by the @option{--with-ld}
16643 configure option, GCC's program search path, and finally by the user's
16644 @env{PATH}. The linker used by GCC can be printed using @samp{which
16645 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
16646 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16647
16648 @item -mlong-calls
16649 @opindex mno-long-calls
16650 Generate code that uses long call sequences. This ensures that a call
16651 is always able to reach linker generated stubs. The default is to generate
16652 long calls only when the distance from the call site to the beginning
16653 of the function or translation unit, as the case may be, exceeds a
16654 predefined limit set by the branch type being used. The limits for
16655 normal calls are 7,600,000 and 240,000 bytes, respectively for the
16656 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
16657 240,000 bytes.
16658
16659 Distances are measured from the beginning of functions when using the
16660 @option{-ffunction-sections} option, or when using the @option{-mgas}
16661 and @option{-mno-portable-runtime} options together under HP-UX with
16662 the SOM linker.
16663
16664 It is normally not desirable to use this option as it degrades
16665 performance. However, it may be useful in large applications,
16666 particularly when partial linking is used to build the application.
16667
16668 The types of long calls used depends on the capabilities of the
16669 assembler and linker, and the type of code being generated. The
16670 impact on systems that support long absolute calls, and long pic
16671 symbol-difference or pc-relative calls should be relatively small.
16672 However, an indirect call is used on 32-bit ELF systems in pic code
16673 and it is quite long.
16674
16675 @item -munix=@var{unix-std}
16676 @opindex march
16677 Generate compiler predefines and select a startfile for the specified
16678 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
16679 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
16680 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
16681 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
16682 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
16683 and later.
16684
16685 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
16686 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
16687 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
16688 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
16689 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
16690 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
16691
16692 It is @emph{important} to note that this option changes the interfaces
16693 for various library routines. It also affects the operational behavior
16694 of the C library. Thus, @emph{extreme} care is needed in using this
16695 option.
16696
16697 Library code that is intended to operate with more than one UNIX
16698 standard must test, set and restore the variable @code{__xpg4_extended_mask}
16699 as appropriate. Most GNU software doesn't provide this capability.
16700
16701 @item -nolibdld
16702 @opindex nolibdld
16703 Suppress the generation of link options to search libdld.sl when the
16704 @option{-static} option is specified on HP-UX 10 and later.
16705
16706 @item -static
16707 @opindex static
16708 The HP-UX implementation of setlocale in libc has a dependency on
16709 libdld.sl. There isn't an archive version of libdld.sl. Thus,
16710 when the @option{-static} option is specified, special link options
16711 are needed to resolve this dependency.
16712
16713 On HP-UX 10 and later, the GCC driver adds the necessary options to
16714 link with libdld.sl when the @option{-static} option is specified.
16715 This causes the resulting binary to be dynamic. On the 64-bit port,
16716 the linkers generate dynamic binaries by default in any case. The
16717 @option{-nolibdld} option can be used to prevent the GCC driver from
16718 adding these link options.
16719
16720 @item -threads
16721 @opindex threads
16722 Add support for multithreading with the @dfn{dce thread} library
16723 under HP-UX@. This option sets flags for both the preprocessor and
16724 linker.
16725 @end table
16726
16727 @node IA-64 Options
16728 @subsection IA-64 Options
16729 @cindex IA-64 Options
16730
16731 These are the @samp{-m} options defined for the Intel IA-64 architecture.
16732
16733 @table @gcctabopt
16734 @item -mbig-endian
16735 @opindex mbig-endian
16736 Generate code for a big-endian target. This is the default for HP-UX@.
16737
16738 @item -mlittle-endian
16739 @opindex mlittle-endian
16740 Generate code for a little-endian target. This is the default for AIX5
16741 and GNU/Linux.
16742
16743 @item -mgnu-as
16744 @itemx -mno-gnu-as
16745 @opindex mgnu-as
16746 @opindex mno-gnu-as
16747 Generate (or don't) code for the GNU assembler. This is the default.
16748 @c Also, this is the default if the configure option @option{--with-gnu-as}
16749 @c is used.
16750
16751 @item -mgnu-ld
16752 @itemx -mno-gnu-ld
16753 @opindex mgnu-ld
16754 @opindex mno-gnu-ld
16755 Generate (or don't) code for the GNU linker. This is the default.
16756 @c Also, this is the default if the configure option @option{--with-gnu-ld}
16757 @c is used.
16758
16759 @item -mno-pic
16760 @opindex mno-pic
16761 Generate code that does not use a global pointer register. The result
16762 is not position independent code, and violates the IA-64 ABI@.
16763
16764 @item -mvolatile-asm-stop
16765 @itemx -mno-volatile-asm-stop
16766 @opindex mvolatile-asm-stop
16767 @opindex mno-volatile-asm-stop
16768 Generate (or don't) a stop bit immediately before and after volatile asm
16769 statements.
16770
16771 @item -mregister-names
16772 @itemx -mno-register-names
16773 @opindex mregister-names
16774 @opindex mno-register-names
16775 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
16776 the stacked registers. This may make assembler output more readable.
16777
16778 @item -mno-sdata
16779 @itemx -msdata
16780 @opindex mno-sdata
16781 @opindex msdata
16782 Disable (or enable) optimizations that use the small data section. This may
16783 be useful for working around optimizer bugs.
16784
16785 @item -mconstant-gp
16786 @opindex mconstant-gp
16787 Generate code that uses a single constant global pointer value. This is
16788 useful when compiling kernel code.
16789
16790 @item -mauto-pic
16791 @opindex mauto-pic
16792 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
16793 This is useful when compiling firmware code.
16794
16795 @item -minline-float-divide-min-latency
16796 @opindex minline-float-divide-min-latency
16797 Generate code for inline divides of floating-point values
16798 using the minimum latency algorithm.
16799
16800 @item -minline-float-divide-max-throughput
16801 @opindex minline-float-divide-max-throughput
16802 Generate code for inline divides of floating-point values
16803 using the maximum throughput algorithm.
16804
16805 @item -mno-inline-float-divide
16806 @opindex mno-inline-float-divide
16807 Do not generate inline code for divides of floating-point values.
16808
16809 @item -minline-int-divide-min-latency
16810 @opindex minline-int-divide-min-latency
16811 Generate code for inline divides of integer values
16812 using the minimum latency algorithm.
16813
16814 @item -minline-int-divide-max-throughput
16815 @opindex minline-int-divide-max-throughput
16816 Generate code for inline divides of integer values
16817 using the maximum throughput algorithm.
16818
16819 @item -mno-inline-int-divide
16820 @opindex mno-inline-int-divide
16821 Do not generate inline code for divides of integer values.
16822
16823 @item -minline-sqrt-min-latency
16824 @opindex minline-sqrt-min-latency
16825 Generate code for inline square roots
16826 using the minimum latency algorithm.
16827
16828 @item -minline-sqrt-max-throughput
16829 @opindex minline-sqrt-max-throughput
16830 Generate code for inline square roots
16831 using the maximum throughput algorithm.
16832
16833 @item -mno-inline-sqrt
16834 @opindex mno-inline-sqrt
16835 Do not generate inline code for @code{sqrt}.
16836
16837 @item -mfused-madd
16838 @itemx -mno-fused-madd
16839 @opindex mfused-madd
16840 @opindex mno-fused-madd
16841 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
16842 instructions. The default is to use these instructions.
16843
16844 @item -mno-dwarf2-asm
16845 @itemx -mdwarf2-asm
16846 @opindex mno-dwarf2-asm
16847 @opindex mdwarf2-asm
16848 Don't (or do) generate assembler code for the DWARF line number debugging
16849 info. This may be useful when not using the GNU assembler.
16850
16851 @item -mearly-stop-bits
16852 @itemx -mno-early-stop-bits
16853 @opindex mearly-stop-bits
16854 @opindex mno-early-stop-bits
16855 Allow stop bits to be placed earlier than immediately preceding the
16856 instruction that triggered the stop bit. This can improve instruction
16857 scheduling, but does not always do so.
16858
16859 @item -mfixed-range=@var{register-range}
16860 @opindex mfixed-range
16861 Generate code treating the given register range as fixed registers.
16862 A fixed register is one that the register allocator cannot use. This is
16863 useful when compiling kernel code. A register range is specified as
16864 two registers separated by a dash. Multiple register ranges can be
16865 specified separated by a comma.
16866
16867 @item -mtls-size=@var{tls-size}
16868 @opindex mtls-size
16869 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
16870 64.
16871
16872 @item -mtune=@var{cpu-type}
16873 @opindex mtune
16874 Tune the instruction scheduling for a particular CPU, Valid values are
16875 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
16876 and @samp{mckinley}.
16877
16878 @item -milp32
16879 @itemx -mlp64
16880 @opindex milp32
16881 @opindex mlp64
16882 Generate code for a 32-bit or 64-bit environment.
16883 The 32-bit environment sets int, long and pointer to 32 bits.
16884 The 64-bit environment sets int to 32 bits and long and pointer
16885 to 64 bits. These are HP-UX specific flags.
16886
16887 @item -mno-sched-br-data-spec
16888 @itemx -msched-br-data-spec
16889 @opindex mno-sched-br-data-spec
16890 @opindex msched-br-data-spec
16891 (Dis/En)able data speculative scheduling before reload.
16892 This results in generation of @code{ld.a} instructions and
16893 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16894 The default setting is disabled.
16895
16896 @item -msched-ar-data-spec
16897 @itemx -mno-sched-ar-data-spec
16898 @opindex msched-ar-data-spec
16899 @opindex mno-sched-ar-data-spec
16900 (En/Dis)able data speculative scheduling after reload.
16901 This results in generation of @code{ld.a} instructions and
16902 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16903 The default setting is enabled.
16904
16905 @item -mno-sched-control-spec
16906 @itemx -msched-control-spec
16907 @opindex mno-sched-control-spec
16908 @opindex msched-control-spec
16909 (Dis/En)able control speculative scheduling. This feature is
16910 available only during region scheduling (i.e.@: before reload).
16911 This results in generation of the @code{ld.s} instructions and
16912 the corresponding check instructions @code{chk.s}.
16913 The default setting is disabled.
16914
16915 @item -msched-br-in-data-spec
16916 @itemx -mno-sched-br-in-data-spec
16917 @opindex msched-br-in-data-spec
16918 @opindex mno-sched-br-in-data-spec
16919 (En/Dis)able speculative scheduling of the instructions that
16920 are dependent on the data speculative loads before reload.
16921 This is effective only with @option{-msched-br-data-spec} enabled.
16922 The default setting is enabled.
16923
16924 @item -msched-ar-in-data-spec
16925 @itemx -mno-sched-ar-in-data-spec
16926 @opindex msched-ar-in-data-spec
16927 @opindex mno-sched-ar-in-data-spec
16928 (En/Dis)able speculative scheduling of the instructions that
16929 are dependent on the data speculative loads after reload.
16930 This is effective only with @option{-msched-ar-data-spec} enabled.
16931 The default setting is enabled.
16932
16933 @item -msched-in-control-spec
16934 @itemx -mno-sched-in-control-spec
16935 @opindex msched-in-control-spec
16936 @opindex mno-sched-in-control-spec
16937 (En/Dis)able speculative scheduling of the instructions that
16938 are dependent on the control speculative loads.
16939 This is effective only with @option{-msched-control-spec} enabled.
16940 The default setting is enabled.
16941
16942 @item -mno-sched-prefer-non-data-spec-insns
16943 @itemx -msched-prefer-non-data-spec-insns
16944 @opindex mno-sched-prefer-non-data-spec-insns
16945 @opindex msched-prefer-non-data-spec-insns
16946 If enabled, data-speculative instructions are chosen for schedule
16947 only if there are no other choices at the moment. This makes
16948 the use of the data speculation much more conservative.
16949 The default setting is disabled.
16950
16951 @item -mno-sched-prefer-non-control-spec-insns
16952 @itemx -msched-prefer-non-control-spec-insns
16953 @opindex mno-sched-prefer-non-control-spec-insns
16954 @opindex msched-prefer-non-control-spec-insns
16955 If enabled, control-speculative instructions are chosen for schedule
16956 only if there are no other choices at the moment. This makes
16957 the use of the control speculation much more conservative.
16958 The default setting is disabled.
16959
16960 @item -mno-sched-count-spec-in-critical-path
16961 @itemx -msched-count-spec-in-critical-path
16962 @opindex mno-sched-count-spec-in-critical-path
16963 @opindex msched-count-spec-in-critical-path
16964 If enabled, speculative dependencies are considered during
16965 computation of the instructions priorities. This makes the use of the
16966 speculation a bit more conservative.
16967 The default setting is disabled.
16968
16969 @item -msched-spec-ldc
16970 @opindex msched-spec-ldc
16971 Use a simple data speculation check. This option is on by default.
16972
16973 @item -msched-control-spec-ldc
16974 @opindex msched-spec-ldc
16975 Use a simple check for control speculation. This option is on by default.
16976
16977 @item -msched-stop-bits-after-every-cycle
16978 @opindex msched-stop-bits-after-every-cycle
16979 Place a stop bit after every cycle when scheduling. This option is on
16980 by default.
16981
16982 @item -msched-fp-mem-deps-zero-cost
16983 @opindex msched-fp-mem-deps-zero-cost
16984 Assume that floating-point stores and loads are not likely to cause a conflict
16985 when placed into the same instruction group. This option is disabled by
16986 default.
16987
16988 @item -msel-sched-dont-check-control-spec
16989 @opindex msel-sched-dont-check-control-spec
16990 Generate checks for control speculation in selective scheduling.
16991 This flag is disabled by default.
16992
16993 @item -msched-max-memory-insns=@var{max-insns}
16994 @opindex msched-max-memory-insns
16995 Limit on the number of memory insns per instruction group, giving lower
16996 priority to subsequent memory insns attempting to schedule in the same
16997 instruction group. Frequently useful to prevent cache bank conflicts.
16998 The default value is 1.
16999
17000 @item -msched-max-memory-insns-hard-limit
17001 @opindex msched-max-memory-insns-hard-limit
17002 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
17003 disallowing more than that number in an instruction group.
17004 Otherwise, the limit is ``soft'', meaning that non-memory operations
17005 are preferred when the limit is reached, but memory operations may still
17006 be scheduled.
17007
17008 @end table
17009
17010 @node LM32 Options
17011 @subsection LM32 Options
17012 @cindex LM32 options
17013
17014 These @option{-m} options are defined for the LatticeMico32 architecture:
17015
17016 @table @gcctabopt
17017 @item -mbarrel-shift-enabled
17018 @opindex mbarrel-shift-enabled
17019 Enable barrel-shift instructions.
17020
17021 @item -mdivide-enabled
17022 @opindex mdivide-enabled
17023 Enable divide and modulus instructions.
17024
17025 @item -mmultiply-enabled
17026 @opindex multiply-enabled
17027 Enable multiply instructions.
17028
17029 @item -msign-extend-enabled
17030 @opindex msign-extend-enabled
17031 Enable sign extend instructions.
17032
17033 @item -muser-enabled
17034 @opindex muser-enabled
17035 Enable user-defined instructions.
17036
17037 @end table
17038
17039 @node M32C Options
17040 @subsection M32C Options
17041 @cindex M32C options
17042
17043 @table @gcctabopt
17044 @item -mcpu=@var{name}
17045 @opindex mcpu=
17046 Select the CPU for which code is generated. @var{name} may be one of
17047 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
17048 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
17049 the M32C/80 series.
17050
17051 @item -msim
17052 @opindex msim
17053 Specifies that the program will be run on the simulator. This causes
17054 an alternate runtime library to be linked in which supports, for
17055 example, file I/O@. You must not use this option when generating
17056 programs that will run on real hardware; you must provide your own
17057 runtime library for whatever I/O functions are needed.
17058
17059 @item -memregs=@var{number}
17060 @opindex memregs=
17061 Specifies the number of memory-based pseudo-registers GCC uses
17062 during code generation. These pseudo-registers are used like real
17063 registers, so there is a tradeoff between GCC's ability to fit the
17064 code into available registers, and the performance penalty of using
17065 memory instead of registers. Note that all modules in a program must
17066 be compiled with the same value for this option. Because of that, you
17067 must not use this option with GCC's default runtime libraries.
17068
17069 @end table
17070
17071 @node M32R/D Options
17072 @subsection M32R/D Options
17073 @cindex M32R/D options
17074
17075 These @option{-m} options are defined for Renesas M32R/D architectures:
17076
17077 @table @gcctabopt
17078 @item -m32r2
17079 @opindex m32r2
17080 Generate code for the M32R/2@.
17081
17082 @item -m32rx
17083 @opindex m32rx
17084 Generate code for the M32R/X@.
17085
17086 @item -m32r
17087 @opindex m32r
17088 Generate code for the M32R@. This is the default.
17089
17090 @item -mmodel=small
17091 @opindex mmodel=small
17092 Assume all objects live in the lower 16MB of memory (so that their addresses
17093 can be loaded with the @code{ld24} instruction), and assume all subroutines
17094 are reachable with the @code{bl} instruction.
17095 This is the default.
17096
17097 The addressability of a particular object can be set with the
17098 @code{model} attribute.
17099
17100 @item -mmodel=medium
17101 @opindex mmodel=medium
17102 Assume objects may be anywhere in the 32-bit address space (the compiler
17103 generates @code{seth/add3} instructions to load their addresses), and
17104 assume all subroutines are reachable with the @code{bl} instruction.
17105
17106 @item -mmodel=large
17107 @opindex mmodel=large
17108 Assume objects may be anywhere in the 32-bit address space (the compiler
17109 generates @code{seth/add3} instructions to load their addresses), and
17110 assume subroutines may not be reachable with the @code{bl} instruction
17111 (the compiler generates the much slower @code{seth/add3/jl}
17112 instruction sequence).
17113
17114 @item -msdata=none
17115 @opindex msdata=none
17116 Disable use of the small data area. Variables are put into
17117 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
17118 @code{section} attribute has been specified).
17119 This is the default.
17120
17121 The small data area consists of sections @code{.sdata} and @code{.sbss}.
17122 Objects may be explicitly put in the small data area with the
17123 @code{section} attribute using one of these sections.
17124
17125 @item -msdata=sdata
17126 @opindex msdata=sdata
17127 Put small global and static data in the small data area, but do not
17128 generate special code to reference them.
17129
17130 @item -msdata=use
17131 @opindex msdata=use
17132 Put small global and static data in the small data area, and generate
17133 special instructions to reference them.
17134
17135 @item -G @var{num}
17136 @opindex G
17137 @cindex smaller data references
17138 Put global and static objects less than or equal to @var{num} bytes
17139 into the small data or BSS sections instead of the normal data or BSS
17140 sections. The default value of @var{num} is 8.
17141 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
17142 for this option to have any effect.
17143
17144 All modules should be compiled with the same @option{-G @var{num}} value.
17145 Compiling with different values of @var{num} may or may not work; if it
17146 doesn't the linker gives an error message---incorrect code is not
17147 generated.
17148
17149 @item -mdebug
17150 @opindex mdebug
17151 Makes the M32R-specific code in the compiler display some statistics
17152 that might help in debugging programs.
17153
17154 @item -malign-loops
17155 @opindex malign-loops
17156 Align all loops to a 32-byte boundary.
17157
17158 @item -mno-align-loops
17159 @opindex mno-align-loops
17160 Do not enforce a 32-byte alignment for loops. This is the default.
17161
17162 @item -missue-rate=@var{number}
17163 @opindex missue-rate=@var{number}
17164 Issue @var{number} instructions per cycle. @var{number} can only be 1
17165 or 2.
17166
17167 @item -mbranch-cost=@var{number}
17168 @opindex mbranch-cost=@var{number}
17169 @var{number} can only be 1 or 2. If it is 1 then branches are
17170 preferred over conditional code, if it is 2, then the opposite applies.
17171
17172 @item -mflush-trap=@var{number}
17173 @opindex mflush-trap=@var{number}
17174 Specifies the trap number to use to flush the cache. The default is
17175 12. Valid numbers are between 0 and 15 inclusive.
17176
17177 @item -mno-flush-trap
17178 @opindex mno-flush-trap
17179 Specifies that the cache cannot be flushed by using a trap.
17180
17181 @item -mflush-func=@var{name}
17182 @opindex mflush-func=@var{name}
17183 Specifies the name of the operating system function to call to flush
17184 the cache. The default is @samp{_flush_cache}, but a function call
17185 is only used if a trap is not available.
17186
17187 @item -mno-flush-func
17188 @opindex mno-flush-func
17189 Indicates that there is no OS function for flushing the cache.
17190
17191 @end table
17192
17193 @node M680x0 Options
17194 @subsection M680x0 Options
17195 @cindex M680x0 options
17196
17197 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
17198 The default settings depend on which architecture was selected when
17199 the compiler was configured; the defaults for the most common choices
17200 are given below.
17201
17202 @table @gcctabopt
17203 @item -march=@var{arch}
17204 @opindex march
17205 Generate code for a specific M680x0 or ColdFire instruction set
17206 architecture. Permissible values of @var{arch} for M680x0
17207 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
17208 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
17209 architectures are selected according to Freescale's ISA classification
17210 and the permissible values are: @samp{isaa}, @samp{isaaplus},
17211 @samp{isab} and @samp{isac}.
17212
17213 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
17214 code for a ColdFire target. The @var{arch} in this macro is one of the
17215 @option{-march} arguments given above.
17216
17217 When used together, @option{-march} and @option{-mtune} select code
17218 that runs on a family of similar processors but that is optimized
17219 for a particular microarchitecture.
17220
17221 @item -mcpu=@var{cpu}
17222 @opindex mcpu
17223 Generate code for a specific M680x0 or ColdFire processor.
17224 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
17225 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
17226 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
17227 below, which also classifies the CPUs into families:
17228
17229 @multitable @columnfractions 0.20 0.80
17230 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
17231 @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}
17232 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
17233 @item @samp{5206e} @tab @samp{5206e}
17234 @item @samp{5208} @tab @samp{5207} @samp{5208}
17235 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
17236 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
17237 @item @samp{5216} @tab @samp{5214} @samp{5216}
17238 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
17239 @item @samp{5225} @tab @samp{5224} @samp{5225}
17240 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
17241 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
17242 @item @samp{5249} @tab @samp{5249}
17243 @item @samp{5250} @tab @samp{5250}
17244 @item @samp{5271} @tab @samp{5270} @samp{5271}
17245 @item @samp{5272} @tab @samp{5272}
17246 @item @samp{5275} @tab @samp{5274} @samp{5275}
17247 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
17248 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
17249 @item @samp{5307} @tab @samp{5307}
17250 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
17251 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
17252 @item @samp{5407} @tab @samp{5407}
17253 @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}
17254 @end multitable
17255
17256 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
17257 @var{arch} is compatible with @var{cpu}. Other combinations of
17258 @option{-mcpu} and @option{-march} are rejected.
17259
17260 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
17261 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
17262 where the value of @var{family} is given by the table above.
17263
17264 @item -mtune=@var{tune}
17265 @opindex mtune
17266 Tune the code for a particular microarchitecture within the
17267 constraints set by @option{-march} and @option{-mcpu}.
17268 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
17269 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
17270 and @samp{cpu32}. The ColdFire microarchitectures
17271 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
17272
17273 You can also use @option{-mtune=68020-40} for code that needs
17274 to run relatively well on 68020, 68030 and 68040 targets.
17275 @option{-mtune=68020-60} is similar but includes 68060 targets
17276 as well. These two options select the same tuning decisions as
17277 @option{-m68020-40} and @option{-m68020-60} respectively.
17278
17279 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
17280 when tuning for 680x0 architecture @var{arch}. It also defines
17281 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
17282 option is used. If GCC is tuning for a range of architectures,
17283 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
17284 it defines the macros for every architecture in the range.
17285
17286 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
17287 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
17288 of the arguments given above.
17289
17290 @item -m68000
17291 @itemx -mc68000
17292 @opindex m68000
17293 @opindex mc68000
17294 Generate output for a 68000. This is the default
17295 when the compiler is configured for 68000-based systems.
17296 It is equivalent to @option{-march=68000}.
17297
17298 Use this option for microcontrollers with a 68000 or EC000 core,
17299 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
17300
17301 @item -m68010
17302 @opindex m68010
17303 Generate output for a 68010. This is the default
17304 when the compiler is configured for 68010-based systems.
17305 It is equivalent to @option{-march=68010}.
17306
17307 @item -m68020
17308 @itemx -mc68020
17309 @opindex m68020
17310 @opindex mc68020
17311 Generate output for a 68020. This is the default
17312 when the compiler is configured for 68020-based systems.
17313 It is equivalent to @option{-march=68020}.
17314
17315 @item -m68030
17316 @opindex m68030
17317 Generate output for a 68030. This is the default when the compiler is
17318 configured for 68030-based systems. It is equivalent to
17319 @option{-march=68030}.
17320
17321 @item -m68040
17322 @opindex m68040
17323 Generate output for a 68040. This is the default when the compiler is
17324 configured for 68040-based systems. It is equivalent to
17325 @option{-march=68040}.
17326
17327 This option inhibits the use of 68881/68882 instructions that have to be
17328 emulated by software on the 68040. Use this option if your 68040 does not
17329 have code to emulate those instructions.
17330
17331 @item -m68060
17332 @opindex m68060
17333 Generate output for a 68060. This is the default when the compiler is
17334 configured for 68060-based systems. It is equivalent to
17335 @option{-march=68060}.
17336
17337 This option inhibits the use of 68020 and 68881/68882 instructions that
17338 have to be emulated by software on the 68060. Use this option if your 68060
17339 does not have code to emulate those instructions.
17340
17341 @item -mcpu32
17342 @opindex mcpu32
17343 Generate output for a CPU32. This is the default
17344 when the compiler is configured for CPU32-based systems.
17345 It is equivalent to @option{-march=cpu32}.
17346
17347 Use this option for microcontrollers with a
17348 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
17349 68336, 68340, 68341, 68349 and 68360.
17350
17351 @item -m5200
17352 @opindex m5200
17353 Generate output for a 520X ColdFire CPU@. This is the default
17354 when the compiler is configured for 520X-based systems.
17355 It is equivalent to @option{-mcpu=5206}, and is now deprecated
17356 in favor of that option.
17357
17358 Use this option for microcontroller with a 5200 core, including
17359 the MCF5202, MCF5203, MCF5204 and MCF5206.
17360
17361 @item -m5206e
17362 @opindex m5206e
17363 Generate output for a 5206e ColdFire CPU@. The option is now
17364 deprecated in favor of the equivalent @option{-mcpu=5206e}.
17365
17366 @item -m528x
17367 @opindex m528x
17368 Generate output for a member of the ColdFire 528X family.
17369 The option is now deprecated in favor of the equivalent
17370 @option{-mcpu=528x}.
17371
17372 @item -m5307
17373 @opindex m5307
17374 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
17375 in favor of the equivalent @option{-mcpu=5307}.
17376
17377 @item -m5407
17378 @opindex m5407
17379 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
17380 in favor of the equivalent @option{-mcpu=5407}.
17381
17382 @item -mcfv4e
17383 @opindex mcfv4e
17384 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
17385 This includes use of hardware floating-point instructions.
17386 The option is equivalent to @option{-mcpu=547x}, and is now
17387 deprecated in favor of that option.
17388
17389 @item -m68020-40
17390 @opindex m68020-40
17391 Generate output for a 68040, without using any of the new instructions.
17392 This results in code that can run relatively efficiently on either a
17393 68020/68881 or a 68030 or a 68040. The generated code does use the
17394 68881 instructions that are emulated on the 68040.
17395
17396 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
17397
17398 @item -m68020-60
17399 @opindex m68020-60
17400 Generate output for a 68060, without using any of the new instructions.
17401 This results in code that can run relatively efficiently on either a
17402 68020/68881 or a 68030 or a 68040. The generated code does use the
17403 68881 instructions that are emulated on the 68060.
17404
17405 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
17406
17407 @item -mhard-float
17408 @itemx -m68881
17409 @opindex mhard-float
17410 @opindex m68881
17411 Generate floating-point instructions. This is the default for 68020
17412 and above, and for ColdFire devices that have an FPU@. It defines the
17413 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
17414 on ColdFire targets.
17415
17416 @item -msoft-float
17417 @opindex msoft-float
17418 Do not generate floating-point instructions; use library calls instead.
17419 This is the default for 68000, 68010, and 68832 targets. It is also
17420 the default for ColdFire devices that have no FPU.
17421
17422 @item -mdiv
17423 @itemx -mno-div
17424 @opindex mdiv
17425 @opindex mno-div
17426 Generate (do not generate) ColdFire hardware divide and remainder
17427 instructions. If @option{-march} is used without @option{-mcpu},
17428 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
17429 architectures. Otherwise, the default is taken from the target CPU
17430 (either the default CPU, or the one specified by @option{-mcpu}). For
17431 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
17432 @option{-mcpu=5206e}.
17433
17434 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
17435
17436 @item -mshort
17437 @opindex mshort
17438 Consider type @code{int} to be 16 bits wide, like @code{short int}.
17439 Additionally, parameters passed on the stack are also aligned to a
17440 16-bit boundary even on targets whose API mandates promotion to 32-bit.
17441
17442 @item -mno-short
17443 @opindex mno-short
17444 Do not consider type @code{int} to be 16 bits wide. This is the default.
17445
17446 @item -mnobitfield
17447 @itemx -mno-bitfield
17448 @opindex mnobitfield
17449 @opindex mno-bitfield
17450 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
17451 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
17452
17453 @item -mbitfield
17454 @opindex mbitfield
17455 Do use the bit-field instructions. The @option{-m68020} option implies
17456 @option{-mbitfield}. This is the default if you use a configuration
17457 designed for a 68020.
17458
17459 @item -mrtd
17460 @opindex mrtd
17461 Use a different function-calling convention, in which functions
17462 that take a fixed number of arguments return with the @code{rtd}
17463 instruction, which pops their arguments while returning. This
17464 saves one instruction in the caller since there is no need to pop
17465 the arguments there.
17466
17467 This calling convention is incompatible with the one normally
17468 used on Unix, so you cannot use it if you need to call libraries
17469 compiled with the Unix compiler.
17470
17471 Also, you must provide function prototypes for all functions that
17472 take variable numbers of arguments (including @code{printf});
17473 otherwise incorrect code is generated for calls to those
17474 functions.
17475
17476 In addition, seriously incorrect code results if you call a
17477 function with too many arguments. (Normally, extra arguments are
17478 harmlessly ignored.)
17479
17480 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
17481 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
17482
17483 @item -mno-rtd
17484 @opindex mno-rtd
17485 Do not use the calling conventions selected by @option{-mrtd}.
17486 This is the default.
17487
17488 @item -malign-int
17489 @itemx -mno-align-int
17490 @opindex malign-int
17491 @opindex mno-align-int
17492 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
17493 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
17494 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
17495 Aligning variables on 32-bit boundaries produces code that runs somewhat
17496 faster on processors with 32-bit busses at the expense of more memory.
17497
17498 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
17499 aligns structures containing the above types differently than
17500 most published application binary interface specifications for the m68k.
17501
17502 @item -mpcrel
17503 @opindex mpcrel
17504 Use the pc-relative addressing mode of the 68000 directly, instead of
17505 using a global offset table. At present, this option implies @option{-fpic},
17506 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
17507 not presently supported with @option{-mpcrel}, though this could be supported for
17508 68020 and higher processors.
17509
17510 @item -mno-strict-align
17511 @itemx -mstrict-align
17512 @opindex mno-strict-align
17513 @opindex mstrict-align
17514 Do not (do) assume that unaligned memory references are handled by
17515 the system.
17516
17517 @item -msep-data
17518 Generate code that allows the data segment to be located in a different
17519 area of memory from the text segment. This allows for execute-in-place in
17520 an environment without virtual memory management. This option implies
17521 @option{-fPIC}.
17522
17523 @item -mno-sep-data
17524 Generate code that assumes that the data segment follows the text segment.
17525 This is the default.
17526
17527 @item -mid-shared-library
17528 Generate code that supports shared libraries via the library ID method.
17529 This allows for execute-in-place and shared libraries in an environment
17530 without virtual memory management. This option implies @option{-fPIC}.
17531
17532 @item -mno-id-shared-library
17533 Generate code that doesn't assume ID-based shared libraries are being used.
17534 This is the default.
17535
17536 @item -mshared-library-id=n
17537 Specifies the identification number of the ID-based shared library being
17538 compiled. Specifying a value of 0 generates more compact code; specifying
17539 other values forces the allocation of that number to the current
17540 library, but is no more space- or time-efficient than omitting this option.
17541
17542 @item -mxgot
17543 @itemx -mno-xgot
17544 @opindex mxgot
17545 @opindex mno-xgot
17546 When generating position-independent code for ColdFire, generate code
17547 that works if the GOT has more than 8192 entries. This code is
17548 larger and slower than code generated without this option. On M680x0
17549 processors, this option is not needed; @option{-fPIC} suffices.
17550
17551 GCC normally uses a single instruction to load values from the GOT@.
17552 While this is relatively efficient, it only works if the GOT
17553 is smaller than about 64k. Anything larger causes the linker
17554 to report an error such as:
17555
17556 @cindex relocation truncated to fit (ColdFire)
17557 @smallexample
17558 relocation truncated to fit: R_68K_GOT16O foobar
17559 @end smallexample
17560
17561 If this happens, you should recompile your code with @option{-mxgot}.
17562 It should then work with very large GOTs. However, code generated with
17563 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
17564 the value of a global symbol.
17565
17566 Note that some linkers, including newer versions of the GNU linker,
17567 can create multiple GOTs and sort GOT entries. If you have such a linker,
17568 you should only need to use @option{-mxgot} when compiling a single
17569 object file that accesses more than 8192 GOT entries. Very few do.
17570
17571 These options have no effect unless GCC is generating
17572 position-independent code.
17573
17574 @end table
17575
17576 @node MCore Options
17577 @subsection MCore Options
17578 @cindex MCore options
17579
17580 These are the @samp{-m} options defined for the Motorola M*Core
17581 processors.
17582
17583 @table @gcctabopt
17584
17585 @item -mhardlit
17586 @itemx -mno-hardlit
17587 @opindex mhardlit
17588 @opindex mno-hardlit
17589 Inline constants into the code stream if it can be done in two
17590 instructions or less.
17591
17592 @item -mdiv
17593 @itemx -mno-div
17594 @opindex mdiv
17595 @opindex mno-div
17596 Use the divide instruction. (Enabled by default).
17597
17598 @item -mrelax-immediate
17599 @itemx -mno-relax-immediate
17600 @opindex mrelax-immediate
17601 @opindex mno-relax-immediate
17602 Allow arbitrary-sized immediates in bit operations.
17603
17604 @item -mwide-bitfields
17605 @itemx -mno-wide-bitfields
17606 @opindex mwide-bitfields
17607 @opindex mno-wide-bitfields
17608 Always treat bit-fields as @code{int}-sized.
17609
17610 @item -m4byte-functions
17611 @itemx -mno-4byte-functions
17612 @opindex m4byte-functions
17613 @opindex mno-4byte-functions
17614 Force all functions to be aligned to a 4-byte boundary.
17615
17616 @item -mcallgraph-data
17617 @itemx -mno-callgraph-data
17618 @opindex mcallgraph-data
17619 @opindex mno-callgraph-data
17620 Emit callgraph information.
17621
17622 @item -mslow-bytes
17623 @itemx -mno-slow-bytes
17624 @opindex mslow-bytes
17625 @opindex mno-slow-bytes
17626 Prefer word access when reading byte quantities.
17627
17628 @item -mlittle-endian
17629 @itemx -mbig-endian
17630 @opindex mlittle-endian
17631 @opindex mbig-endian
17632 Generate code for a little-endian target.
17633
17634 @item -m210
17635 @itemx -m340
17636 @opindex m210
17637 @opindex m340
17638 Generate code for the 210 processor.
17639
17640 @item -mno-lsim
17641 @opindex mno-lsim
17642 Assume that runtime support has been provided and so omit the
17643 simulator library (@file{libsim.a)} from the linker command line.
17644
17645 @item -mstack-increment=@var{size}
17646 @opindex mstack-increment
17647 Set the maximum amount for a single stack increment operation. Large
17648 values can increase the speed of programs that contain functions
17649 that need a large amount of stack space, but they can also trigger a
17650 segmentation fault if the stack is extended too much. The default
17651 value is 0x1000.
17652
17653 @end table
17654
17655 @node MeP Options
17656 @subsection MeP Options
17657 @cindex MeP options
17658
17659 @table @gcctabopt
17660
17661 @item -mabsdiff
17662 @opindex mabsdiff
17663 Enables the @code{abs} instruction, which is the absolute difference
17664 between two registers.
17665
17666 @item -mall-opts
17667 @opindex mall-opts
17668 Enables all the optional instructions---average, multiply, divide, bit
17669 operations, leading zero, absolute difference, min/max, clip, and
17670 saturation.
17671
17672
17673 @item -maverage
17674 @opindex maverage
17675 Enables the @code{ave} instruction, which computes the average of two
17676 registers.
17677
17678 @item -mbased=@var{n}
17679 @opindex mbased=
17680 Variables of size @var{n} bytes or smaller are placed in the
17681 @code{.based} section by default. Based variables use the @code{$tp}
17682 register as a base register, and there is a 128-byte limit to the
17683 @code{.based} section.
17684
17685 @item -mbitops
17686 @opindex mbitops
17687 Enables the bit operation instructions---bit test (@code{btstm}), set
17688 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
17689 test-and-set (@code{tas}).
17690
17691 @item -mc=@var{name}
17692 @opindex mc=
17693 Selects which section constant data is placed in. @var{name} may
17694 be @samp{tiny}, @samp{near}, or @samp{far}.
17695
17696 @item -mclip
17697 @opindex mclip
17698 Enables the @code{clip} instruction. Note that @option{-mclip} is not
17699 useful unless you also provide @option{-mminmax}.
17700
17701 @item -mconfig=@var{name}
17702 @opindex mconfig=
17703 Selects one of the built-in core configurations. Each MeP chip has
17704 one or more modules in it; each module has a core CPU and a variety of
17705 coprocessors, optional instructions, and peripherals. The
17706 @code{MeP-Integrator} tool, not part of GCC, provides these
17707 configurations through this option; using this option is the same as
17708 using all the corresponding command-line options. The default
17709 configuration is @samp{default}.
17710
17711 @item -mcop
17712 @opindex mcop
17713 Enables the coprocessor instructions. By default, this is a 32-bit
17714 coprocessor. Note that the coprocessor is normally enabled via the
17715 @option{-mconfig=} option.
17716
17717 @item -mcop32
17718 @opindex mcop32
17719 Enables the 32-bit coprocessor's instructions.
17720
17721 @item -mcop64
17722 @opindex mcop64
17723 Enables the 64-bit coprocessor's instructions.
17724
17725 @item -mivc2
17726 @opindex mivc2
17727 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
17728
17729 @item -mdc
17730 @opindex mdc
17731 Causes constant variables to be placed in the @code{.near} section.
17732
17733 @item -mdiv
17734 @opindex mdiv
17735 Enables the @code{div} and @code{divu} instructions.
17736
17737 @item -meb
17738 @opindex meb
17739 Generate big-endian code.
17740
17741 @item -mel
17742 @opindex mel
17743 Generate little-endian code.
17744
17745 @item -mio-volatile
17746 @opindex mio-volatile
17747 Tells the compiler that any variable marked with the @code{io}
17748 attribute is to be considered volatile.
17749
17750 @item -ml
17751 @opindex ml
17752 Causes variables to be assigned to the @code{.far} section by default.
17753
17754 @item -mleadz
17755 @opindex mleadz
17756 Enables the @code{leadz} (leading zero) instruction.
17757
17758 @item -mm
17759 @opindex mm
17760 Causes variables to be assigned to the @code{.near} section by default.
17761
17762 @item -mminmax
17763 @opindex mminmax
17764 Enables the @code{min} and @code{max} instructions.
17765
17766 @item -mmult
17767 @opindex mmult
17768 Enables the multiplication and multiply-accumulate instructions.
17769
17770 @item -mno-opts
17771 @opindex mno-opts
17772 Disables all the optional instructions enabled by @option{-mall-opts}.
17773
17774 @item -mrepeat
17775 @opindex mrepeat
17776 Enables the @code{repeat} and @code{erepeat} instructions, used for
17777 low-overhead looping.
17778
17779 @item -ms
17780 @opindex ms
17781 Causes all variables to default to the @code{.tiny} section. Note
17782 that there is a 65536-byte limit to this section. Accesses to these
17783 variables use the @code{%gp} base register.
17784
17785 @item -msatur
17786 @opindex msatur
17787 Enables the saturation instructions. Note that the compiler does not
17788 currently generate these itself, but this option is included for
17789 compatibility with other tools, like @code{as}.
17790
17791 @item -msdram
17792 @opindex msdram
17793 Link the SDRAM-based runtime instead of the default ROM-based runtime.
17794
17795 @item -msim
17796 @opindex msim
17797 Link the simulator run-time libraries.
17798
17799 @item -msimnovec
17800 @opindex msimnovec
17801 Link the simulator runtime libraries, excluding built-in support
17802 for reset and exception vectors and tables.
17803
17804 @item -mtf
17805 @opindex mtf
17806 Causes all functions to default to the @code{.far} section. Without
17807 this option, functions default to the @code{.near} section.
17808
17809 @item -mtiny=@var{n}
17810 @opindex mtiny=
17811 Variables that are @var{n} bytes or smaller are allocated to the
17812 @code{.tiny} section. These variables use the @code{$gp} base
17813 register. The default for this option is 4, but note that there's a
17814 65536-byte limit to the @code{.tiny} section.
17815
17816 @end table
17817
17818 @node MicroBlaze Options
17819 @subsection MicroBlaze Options
17820 @cindex MicroBlaze Options
17821
17822 @table @gcctabopt
17823
17824 @item -msoft-float
17825 @opindex msoft-float
17826 Use software emulation for floating point (default).
17827
17828 @item -mhard-float
17829 @opindex mhard-float
17830 Use hardware floating-point instructions.
17831
17832 @item -mmemcpy
17833 @opindex mmemcpy
17834 Do not optimize block moves, use @code{memcpy}.
17835
17836 @item -mno-clearbss
17837 @opindex mno-clearbss
17838 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
17839
17840 @item -mcpu=@var{cpu-type}
17841 @opindex mcpu=
17842 Use features of, and schedule code for, the given CPU.
17843 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
17844 where @var{X} is a major version, @var{YY} is the minor version, and
17845 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
17846 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
17847
17848 @item -mxl-soft-mul
17849 @opindex mxl-soft-mul
17850 Use software multiply emulation (default).
17851
17852 @item -mxl-soft-div
17853 @opindex mxl-soft-div
17854 Use software emulation for divides (default).
17855
17856 @item -mxl-barrel-shift
17857 @opindex mxl-barrel-shift
17858 Use the hardware barrel shifter.
17859
17860 @item -mxl-pattern-compare
17861 @opindex mxl-pattern-compare
17862 Use pattern compare instructions.
17863
17864 @item -msmall-divides
17865 @opindex msmall-divides
17866 Use table lookup optimization for small signed integer divisions.
17867
17868 @item -mxl-stack-check
17869 @opindex mxl-stack-check
17870 This option is deprecated. Use @option{-fstack-check} instead.
17871
17872 @item -mxl-gp-opt
17873 @opindex mxl-gp-opt
17874 Use GP-relative @code{.sdata}/@code{.sbss} sections.
17875
17876 @item -mxl-multiply-high
17877 @opindex mxl-multiply-high
17878 Use multiply high instructions for high part of 32x32 multiply.
17879
17880 @item -mxl-float-convert
17881 @opindex mxl-float-convert
17882 Use hardware floating-point conversion instructions.
17883
17884 @item -mxl-float-sqrt
17885 @opindex mxl-float-sqrt
17886 Use hardware floating-point square root instruction.
17887
17888 @item -mbig-endian
17889 @opindex mbig-endian
17890 Generate code for a big-endian target.
17891
17892 @item -mlittle-endian
17893 @opindex mlittle-endian
17894 Generate code for a little-endian target.
17895
17896 @item -mxl-reorder
17897 @opindex mxl-reorder
17898 Use reorder instructions (swap and byte reversed load/store).
17899
17900 @item -mxl-mode-@var{app-model}
17901 Select application model @var{app-model}. Valid models are
17902 @table @samp
17903 @item executable
17904 normal executable (default), uses startup code @file{crt0.o}.
17905
17906 @item xmdstub
17907 for use with Xilinx Microprocessor Debugger (XMD) based
17908 software intrusive debug agent called xmdstub. This uses startup file
17909 @file{crt1.o} and sets the start address of the program to 0x800.
17910
17911 @item bootstrap
17912 for applications that are loaded using a bootloader.
17913 This model uses startup file @file{crt2.o} which does not contain a processor
17914 reset vector handler. This is suitable for transferring control on a
17915 processor reset to the bootloader rather than the application.
17916
17917 @item novectors
17918 for applications that do not require any of the
17919 MicroBlaze vectors. This option may be useful for applications running
17920 within a monitoring application. This model uses @file{crt3.o} as a startup file.
17921 @end table
17922
17923 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
17924 @option{-mxl-mode-@var{app-model}}.
17925
17926 @end table
17927
17928 @node MIPS Options
17929 @subsection MIPS Options
17930 @cindex MIPS options
17931
17932 @table @gcctabopt
17933
17934 @item -EB
17935 @opindex EB
17936 Generate big-endian code.
17937
17938 @item -EL
17939 @opindex EL
17940 Generate little-endian code. This is the default for @samp{mips*el-*-*}
17941 configurations.
17942
17943 @item -march=@var{arch}
17944 @opindex march
17945 Generate code that runs on @var{arch}, which can be the name of a
17946 generic MIPS ISA, or the name of a particular processor.
17947 The ISA names are:
17948 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
17949 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
17950 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
17951 @samp{mips64r5} and @samp{mips64r6}.
17952 The processor names are:
17953 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
17954 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
17955 @samp{5kc}, @samp{5kf},
17956 @samp{20kc},
17957 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
17958 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
17959 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
17960 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
17961 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
17962 @samp{i6400},
17963 @samp{interaptiv},
17964 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
17965 @samp{m4k},
17966 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
17967 @samp{m5100}, @samp{m5101},
17968 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
17969 @samp{orion},
17970 @samp{p5600},
17971 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
17972 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
17973 @samp{rm7000}, @samp{rm9000},
17974 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
17975 @samp{sb1},
17976 @samp{sr71000},
17977 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
17978 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
17979 @samp{xlr} and @samp{xlp}.
17980 The special value @samp{from-abi} selects the
17981 most compatible architecture for the selected ABI (that is,
17982 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
17983
17984 The native Linux/GNU toolchain also supports the value @samp{native},
17985 which selects the best architecture option for the host processor.
17986 @option{-march=native} has no effect if GCC does not recognize
17987 the processor.
17988
17989 In processor names, a final @samp{000} can be abbreviated as @samp{k}
17990 (for example, @option{-march=r2k}). Prefixes are optional, and
17991 @samp{vr} may be written @samp{r}.
17992
17993 Names of the form @samp{@var{n}f2_1} refer to processors with
17994 FPUs clocked at half the rate of the core, names of the form
17995 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
17996 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
17997 processors with FPUs clocked a ratio of 3:2 with respect to the core.
17998 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
17999 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
18000 accepted as synonyms for @samp{@var{n}f1_1}.
18001
18002 GCC defines two macros based on the value of this option. The first
18003 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
18004 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
18005 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
18006 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
18007 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
18008
18009 Note that the @code{_MIPS_ARCH} macro uses the processor names given
18010 above. In other words, it has the full prefix and does not
18011 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
18012 the macro names the resolved architecture (either @code{"mips1"} or
18013 @code{"mips3"}). It names the default architecture when no
18014 @option{-march} option is given.
18015
18016 @item -mtune=@var{arch}
18017 @opindex mtune
18018 Optimize for @var{arch}. Among other things, this option controls
18019 the way instructions are scheduled, and the perceived cost of arithmetic
18020 operations. The list of @var{arch} values is the same as for
18021 @option{-march}.
18022
18023 When this option is not used, GCC optimizes for the processor
18024 specified by @option{-march}. By using @option{-march} and
18025 @option{-mtune} together, it is possible to generate code that
18026 runs on a family of processors, but optimize the code for one
18027 particular member of that family.
18028
18029 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
18030 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
18031 @option{-march} ones described above.
18032
18033 @item -mips1
18034 @opindex mips1
18035 Equivalent to @option{-march=mips1}.
18036
18037 @item -mips2
18038 @opindex mips2
18039 Equivalent to @option{-march=mips2}.
18040
18041 @item -mips3
18042 @opindex mips3
18043 Equivalent to @option{-march=mips3}.
18044
18045 @item -mips4
18046 @opindex mips4
18047 Equivalent to @option{-march=mips4}.
18048
18049 @item -mips32
18050 @opindex mips32
18051 Equivalent to @option{-march=mips32}.
18052
18053 @item -mips32r3
18054 @opindex mips32r3
18055 Equivalent to @option{-march=mips32r3}.
18056
18057 @item -mips32r5
18058 @opindex mips32r5
18059 Equivalent to @option{-march=mips32r5}.
18060
18061 @item -mips32r6
18062 @opindex mips32r6
18063 Equivalent to @option{-march=mips32r6}.
18064
18065 @item -mips64
18066 @opindex mips64
18067 Equivalent to @option{-march=mips64}.
18068
18069 @item -mips64r2
18070 @opindex mips64r2
18071 Equivalent to @option{-march=mips64r2}.
18072
18073 @item -mips64r3
18074 @opindex mips64r3
18075 Equivalent to @option{-march=mips64r3}.
18076
18077 @item -mips64r5
18078 @opindex mips64r5
18079 Equivalent to @option{-march=mips64r5}.
18080
18081 @item -mips64r6
18082 @opindex mips64r6
18083 Equivalent to @option{-march=mips64r6}.
18084
18085 @item -mips16
18086 @itemx -mno-mips16
18087 @opindex mips16
18088 @opindex mno-mips16
18089 Generate (do not generate) MIPS16 code. If GCC is targeting a
18090 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
18091
18092 MIPS16 code generation can also be controlled on a per-function basis
18093 by means of @code{mips16} and @code{nomips16} attributes.
18094 @xref{Function Attributes}, for more information.
18095
18096 @item -mflip-mips16
18097 @opindex mflip-mips16
18098 Generate MIPS16 code on alternating functions. This option is provided
18099 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
18100 not intended for ordinary use in compiling user code.
18101
18102 @item -minterlink-compressed
18103 @item -mno-interlink-compressed
18104 @opindex minterlink-compressed
18105 @opindex mno-interlink-compressed
18106 Require (do not require) that code using the standard (uncompressed) MIPS ISA
18107 be link-compatible with MIPS16 and microMIPS code, and vice versa.
18108
18109 For example, code using the standard ISA encoding cannot jump directly
18110 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
18111 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
18112 knows that the target of the jump is not compressed.
18113
18114 @item -minterlink-mips16
18115 @itemx -mno-interlink-mips16
18116 @opindex minterlink-mips16
18117 @opindex mno-interlink-mips16
18118 Aliases of @option{-minterlink-compressed} and
18119 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
18120 and are retained for backwards compatibility.
18121
18122 @item -mabi=32
18123 @itemx -mabi=o64
18124 @itemx -mabi=n32
18125 @itemx -mabi=64
18126 @itemx -mabi=eabi
18127 @opindex mabi=32
18128 @opindex mabi=o64
18129 @opindex mabi=n32
18130 @opindex mabi=64
18131 @opindex mabi=eabi
18132 Generate code for the given ABI@.
18133
18134 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
18135 generates 64-bit code when you select a 64-bit architecture, but you
18136 can use @option{-mgp32} to get 32-bit code instead.
18137
18138 For information about the O64 ABI, see
18139 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
18140
18141 GCC supports a variant of the o32 ABI in which floating-point registers
18142 are 64 rather than 32 bits wide. You can select this combination with
18143 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
18144 and @code{mfhc1} instructions and is therefore only supported for
18145 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
18146
18147 The register assignments for arguments and return values remain the
18148 same, but each scalar value is passed in a single 64-bit register
18149 rather than a pair of 32-bit registers. For example, scalar
18150 floating-point values are returned in @samp{$f0} only, not a
18151 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
18152 remains the same in that the even-numbered double-precision registers
18153 are saved.
18154
18155 Two additional variants of the o32 ABI are supported to enable
18156 a transition from 32-bit to 64-bit registers. These are FPXX
18157 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
18158 The FPXX extension mandates that all code must execute correctly
18159 when run using 32-bit or 64-bit registers. The code can be interlinked
18160 with either FP32 or FP64, but not both.
18161 The FP64A extension is similar to the FP64 extension but forbids the
18162 use of odd-numbered single-precision registers. This can be used
18163 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
18164 processors and allows both FP32 and FP64A code to interlink and
18165 run in the same process without changing FPU modes.
18166
18167 @item -mabicalls
18168 @itemx -mno-abicalls
18169 @opindex mabicalls
18170 @opindex mno-abicalls
18171 Generate (do not generate) code that is suitable for SVR4-style
18172 dynamic objects. @option{-mabicalls} is the default for SVR4-based
18173 systems.
18174
18175 @item -mshared
18176 @itemx -mno-shared
18177 Generate (do not generate) code that is fully position-independent,
18178 and that can therefore be linked into shared libraries. This option
18179 only affects @option{-mabicalls}.
18180
18181 All @option{-mabicalls} code has traditionally been position-independent,
18182 regardless of options like @option{-fPIC} and @option{-fpic}. However,
18183 as an extension, the GNU toolchain allows executables to use absolute
18184 accesses for locally-binding symbols. It can also use shorter GP
18185 initialization sequences and generate direct calls to locally-defined
18186 functions. This mode is selected by @option{-mno-shared}.
18187
18188 @option{-mno-shared} depends on binutils 2.16 or higher and generates
18189 objects that can only be linked by the GNU linker. However, the option
18190 does not affect the ABI of the final executable; it only affects the ABI
18191 of relocatable objects. Using @option{-mno-shared} generally makes
18192 executables both smaller and quicker.
18193
18194 @option{-mshared} is the default.
18195
18196 @item -mplt
18197 @itemx -mno-plt
18198 @opindex mplt
18199 @opindex mno-plt
18200 Assume (do not assume) that the static and dynamic linkers
18201 support PLTs and copy relocations. This option only affects
18202 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
18203 has no effect without @option{-msym32}.
18204
18205 You can make @option{-mplt} the default by configuring
18206 GCC with @option{--with-mips-plt}. The default is
18207 @option{-mno-plt} otherwise.
18208
18209 @item -mxgot
18210 @itemx -mno-xgot
18211 @opindex mxgot
18212 @opindex mno-xgot
18213 Lift (do not lift) the usual restrictions on the size of the global
18214 offset table.
18215
18216 GCC normally uses a single instruction to load values from the GOT@.
18217 While this is relatively efficient, it only works if the GOT
18218 is smaller than about 64k. Anything larger causes the linker
18219 to report an error such as:
18220
18221 @cindex relocation truncated to fit (MIPS)
18222 @smallexample
18223 relocation truncated to fit: R_MIPS_GOT16 foobar
18224 @end smallexample
18225
18226 If this happens, you should recompile your code with @option{-mxgot}.
18227 This works with very large GOTs, although the code is also
18228 less efficient, since it takes three instructions to fetch the
18229 value of a global symbol.
18230
18231 Note that some linkers can create multiple GOTs. If you have such a
18232 linker, you should only need to use @option{-mxgot} when a single object
18233 file accesses more than 64k's worth of GOT entries. Very few do.
18234
18235 These options have no effect unless GCC is generating position
18236 independent code.
18237
18238 @item -mgp32
18239 @opindex mgp32
18240 Assume that general-purpose registers are 32 bits wide.
18241
18242 @item -mgp64
18243 @opindex mgp64
18244 Assume that general-purpose registers are 64 bits wide.
18245
18246 @item -mfp32
18247 @opindex mfp32
18248 Assume that floating-point registers are 32 bits wide.
18249
18250 @item -mfp64
18251 @opindex mfp64
18252 Assume that floating-point registers are 64 bits wide.
18253
18254 @item -mfpxx
18255 @opindex mfpxx
18256 Do not assume the width of floating-point registers.
18257
18258 @item -mhard-float
18259 @opindex mhard-float
18260 Use floating-point coprocessor instructions.
18261
18262 @item -msoft-float
18263 @opindex msoft-float
18264 Do not use floating-point coprocessor instructions. Implement
18265 floating-point calculations using library calls instead.
18266
18267 @item -mno-float
18268 @opindex mno-float
18269 Equivalent to @option{-msoft-float}, but additionally asserts that the
18270 program being compiled does not perform any floating-point operations.
18271 This option is presently supported only by some bare-metal MIPS
18272 configurations, where it may select a special set of libraries
18273 that lack all floating-point support (including, for example, the
18274 floating-point @code{printf} formats).
18275 If code compiled with @option{-mno-float} accidentally contains
18276 floating-point operations, it is likely to suffer a link-time
18277 or run-time failure.
18278
18279 @item -msingle-float
18280 @opindex msingle-float
18281 Assume that the floating-point coprocessor only supports single-precision
18282 operations.
18283
18284 @item -mdouble-float
18285 @opindex mdouble-float
18286 Assume that the floating-point coprocessor supports double-precision
18287 operations. This is the default.
18288
18289 @item -modd-spreg
18290 @itemx -mno-odd-spreg
18291 @opindex modd-spreg
18292 @opindex mno-odd-spreg
18293 Enable the use of odd-numbered single-precision floating-point registers
18294 for the o32 ABI. This is the default for processors that are known to
18295 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
18296 is set by default.
18297
18298 @item -mabs=2008
18299 @itemx -mabs=legacy
18300 @opindex mabs=2008
18301 @opindex mabs=legacy
18302 These options control the treatment of the special not-a-number (NaN)
18303 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
18304 @code{neg.@i{fmt}} machine instructions.
18305
18306 By default or when @option{-mabs=legacy} is used the legacy
18307 treatment is selected. In this case these instructions are considered
18308 arithmetic and avoided where correct operation is required and the
18309 input operand might be a NaN. A longer sequence of instructions that
18310 manipulate the sign bit of floating-point datum manually is used
18311 instead unless the @option{-ffinite-math-only} option has also been
18312 specified.
18313
18314 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
18315 this case these instructions are considered non-arithmetic and therefore
18316 operating correctly in all cases, including in particular where the
18317 input operand is a NaN. These instructions are therefore always used
18318 for the respective operations.
18319
18320 @item -mnan=2008
18321 @itemx -mnan=legacy
18322 @opindex mnan=2008
18323 @opindex mnan=legacy
18324 These options control the encoding of the special not-a-number (NaN)
18325 IEEE 754 floating-point data.
18326
18327 The @option{-mnan=legacy} option selects the legacy encoding. In this
18328 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
18329 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
18330 by the first bit of their trailing significand field being 1.
18331
18332 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
18333 this case qNaNs are denoted by the first bit of their trailing
18334 significand field being 1, whereas sNaNs are denoted by the first bit of
18335 their trailing significand field being 0.
18336
18337 The default is @option{-mnan=legacy} unless GCC has been configured with
18338 @option{--with-nan=2008}.
18339
18340 @item -mllsc
18341 @itemx -mno-llsc
18342 @opindex mllsc
18343 @opindex mno-llsc
18344 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
18345 implement atomic memory built-in functions. When neither option is
18346 specified, GCC uses the instructions if the target architecture
18347 supports them.
18348
18349 @option{-mllsc} is useful if the runtime environment can emulate the
18350 instructions and @option{-mno-llsc} can be useful when compiling for
18351 nonstandard ISAs. You can make either option the default by
18352 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
18353 respectively. @option{--with-llsc} is the default for some
18354 configurations; see the installation documentation for details.
18355
18356 @item -mdsp
18357 @itemx -mno-dsp
18358 @opindex mdsp
18359 @opindex mno-dsp
18360 Use (do not use) revision 1 of the MIPS DSP ASE@.
18361 @xref{MIPS DSP Built-in Functions}. This option defines the
18362 preprocessor macro @code{__mips_dsp}. It also defines
18363 @code{__mips_dsp_rev} to 1.
18364
18365 @item -mdspr2
18366 @itemx -mno-dspr2
18367 @opindex mdspr2
18368 @opindex mno-dspr2
18369 Use (do not use) revision 2 of the MIPS DSP ASE@.
18370 @xref{MIPS DSP Built-in Functions}. This option defines the
18371 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
18372 It also defines @code{__mips_dsp_rev} to 2.
18373
18374 @item -msmartmips
18375 @itemx -mno-smartmips
18376 @opindex msmartmips
18377 @opindex mno-smartmips
18378 Use (do not use) the MIPS SmartMIPS ASE.
18379
18380 @item -mpaired-single
18381 @itemx -mno-paired-single
18382 @opindex mpaired-single
18383 @opindex mno-paired-single
18384 Use (do not use) paired-single floating-point instructions.
18385 @xref{MIPS Paired-Single Support}. This option requires
18386 hardware floating-point support to be enabled.
18387
18388 @item -mdmx
18389 @itemx -mno-mdmx
18390 @opindex mdmx
18391 @opindex mno-mdmx
18392 Use (do not use) MIPS Digital Media Extension instructions.
18393 This option can only be used when generating 64-bit code and requires
18394 hardware floating-point support to be enabled.
18395
18396 @item -mips3d
18397 @itemx -mno-mips3d
18398 @opindex mips3d
18399 @opindex mno-mips3d
18400 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
18401 The option @option{-mips3d} implies @option{-mpaired-single}.
18402
18403 @item -mmicromips
18404 @itemx -mno-micromips
18405 @opindex mmicromips
18406 @opindex mno-mmicromips
18407 Generate (do not generate) microMIPS code.
18408
18409 MicroMIPS code generation can also be controlled on a per-function basis
18410 by means of @code{micromips} and @code{nomicromips} attributes.
18411 @xref{Function Attributes}, for more information.
18412
18413 @item -mmt
18414 @itemx -mno-mt
18415 @opindex mmt
18416 @opindex mno-mt
18417 Use (do not use) MT Multithreading instructions.
18418
18419 @item -mmcu
18420 @itemx -mno-mcu
18421 @opindex mmcu
18422 @opindex mno-mcu
18423 Use (do not use) the MIPS MCU ASE instructions.
18424
18425 @item -meva
18426 @itemx -mno-eva
18427 @opindex meva
18428 @opindex mno-eva
18429 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
18430
18431 @item -mvirt
18432 @itemx -mno-virt
18433 @opindex mvirt
18434 @opindex mno-virt
18435 Use (do not use) the MIPS Virtualization Application Specific instructions.
18436
18437 @item -mxpa
18438 @itemx -mno-xpa
18439 @opindex mxpa
18440 @opindex mno-xpa
18441 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
18442
18443 @item -mlong64
18444 @opindex mlong64
18445 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
18446 an explanation of the default and the way that the pointer size is
18447 determined.
18448
18449 @item -mlong32
18450 @opindex mlong32
18451 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
18452
18453 The default size of @code{int}s, @code{long}s and pointers depends on
18454 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
18455 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
18456 32-bit @code{long}s. Pointers are the same size as @code{long}s,
18457 or the same size as integer registers, whichever is smaller.
18458
18459 @item -msym32
18460 @itemx -mno-sym32
18461 @opindex msym32
18462 @opindex mno-sym32
18463 Assume (do not assume) that all symbols have 32-bit values, regardless
18464 of the selected ABI@. This option is useful in combination with
18465 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
18466 to generate shorter and faster references to symbolic addresses.
18467
18468 @item -G @var{num}
18469 @opindex G
18470 Put definitions of externally-visible data in a small data section
18471 if that data is no bigger than @var{num} bytes. GCC can then generate
18472 more efficient accesses to the data; see @option{-mgpopt} for details.
18473
18474 The default @option{-G} option depends on the configuration.
18475
18476 @item -mlocal-sdata
18477 @itemx -mno-local-sdata
18478 @opindex mlocal-sdata
18479 @opindex mno-local-sdata
18480 Extend (do not extend) the @option{-G} behavior to local data too,
18481 such as to static variables in C@. @option{-mlocal-sdata} is the
18482 default for all configurations.
18483
18484 If the linker complains that an application is using too much small data,
18485 you might want to try rebuilding the less performance-critical parts with
18486 @option{-mno-local-sdata}. You might also want to build large
18487 libraries with @option{-mno-local-sdata}, so that the libraries leave
18488 more room for the main program.
18489
18490 @item -mextern-sdata
18491 @itemx -mno-extern-sdata
18492 @opindex mextern-sdata
18493 @opindex mno-extern-sdata
18494 Assume (do not assume) that externally-defined data is in
18495 a small data section if the size of that data is within the @option{-G} limit.
18496 @option{-mextern-sdata} is the default for all configurations.
18497
18498 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
18499 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
18500 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
18501 is placed in a small data section. If @var{Var} is defined by another
18502 module, you must either compile that module with a high-enough
18503 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
18504 definition. If @var{Var} is common, you must link the application
18505 with a high-enough @option{-G} setting.
18506
18507 The easiest way of satisfying these restrictions is to compile
18508 and link every module with the same @option{-G} option. However,
18509 you may wish to build a library that supports several different
18510 small data limits. You can do this by compiling the library with
18511 the highest supported @option{-G} setting and additionally using
18512 @option{-mno-extern-sdata} to stop the library from making assumptions
18513 about externally-defined data.
18514
18515 @item -mgpopt
18516 @itemx -mno-gpopt
18517 @opindex mgpopt
18518 @opindex mno-gpopt
18519 Use (do not use) GP-relative accesses for symbols that are known to be
18520 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
18521 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
18522 configurations.
18523
18524 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
18525 might not hold the value of @code{_gp}. For example, if the code is
18526 part of a library that might be used in a boot monitor, programs that
18527 call boot monitor routines pass an unknown value in @code{$gp}.
18528 (In such situations, the boot monitor itself is usually compiled
18529 with @option{-G0}.)
18530
18531 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
18532 @option{-mno-extern-sdata}.
18533
18534 @item -membedded-data
18535 @itemx -mno-embedded-data
18536 @opindex membedded-data
18537 @opindex mno-embedded-data
18538 Allocate variables to the read-only data section first if possible, then
18539 next in the small data section if possible, otherwise in data. This gives
18540 slightly slower code than the default, but reduces the amount of RAM required
18541 when executing, and thus may be preferred for some embedded systems.
18542
18543 @item -muninit-const-in-rodata
18544 @itemx -mno-uninit-const-in-rodata
18545 @opindex muninit-const-in-rodata
18546 @opindex mno-uninit-const-in-rodata
18547 Put uninitialized @code{const} variables in the read-only data section.
18548 This option is only meaningful in conjunction with @option{-membedded-data}.
18549
18550 @item -mcode-readable=@var{setting}
18551 @opindex mcode-readable
18552 Specify whether GCC may generate code that reads from executable sections.
18553 There are three possible settings:
18554
18555 @table @gcctabopt
18556 @item -mcode-readable=yes
18557 Instructions may freely access executable sections. This is the
18558 default setting.
18559
18560 @item -mcode-readable=pcrel
18561 MIPS16 PC-relative load instructions can access executable sections,
18562 but other instructions must not do so. This option is useful on 4KSc
18563 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
18564 It is also useful on processors that can be configured to have a dual
18565 instruction/data SRAM interface and that, like the M4K, automatically
18566 redirect PC-relative loads to the instruction RAM.
18567
18568 @item -mcode-readable=no
18569 Instructions must not access executable sections. This option can be
18570 useful on targets that are configured to have a dual instruction/data
18571 SRAM interface but that (unlike the M4K) do not automatically redirect
18572 PC-relative loads to the instruction RAM.
18573 @end table
18574
18575 @item -msplit-addresses
18576 @itemx -mno-split-addresses
18577 @opindex msplit-addresses
18578 @opindex mno-split-addresses
18579 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
18580 relocation operators. This option has been superseded by
18581 @option{-mexplicit-relocs} but is retained for backwards compatibility.
18582
18583 @item -mexplicit-relocs
18584 @itemx -mno-explicit-relocs
18585 @opindex mexplicit-relocs
18586 @opindex mno-explicit-relocs
18587 Use (do not use) assembler relocation operators when dealing with symbolic
18588 addresses. The alternative, selected by @option{-mno-explicit-relocs},
18589 is to use assembler macros instead.
18590
18591 @option{-mexplicit-relocs} is the default if GCC was configured
18592 to use an assembler that supports relocation operators.
18593
18594 @item -mcheck-zero-division
18595 @itemx -mno-check-zero-division
18596 @opindex mcheck-zero-division
18597 @opindex mno-check-zero-division
18598 Trap (do not trap) on integer division by zero.
18599
18600 The default is @option{-mcheck-zero-division}.
18601
18602 @item -mdivide-traps
18603 @itemx -mdivide-breaks
18604 @opindex mdivide-traps
18605 @opindex mdivide-breaks
18606 MIPS systems check for division by zero by generating either a
18607 conditional trap or a break instruction. Using traps results in
18608 smaller code, but is only supported on MIPS II and later. Also, some
18609 versions of the Linux kernel have a bug that prevents trap from
18610 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
18611 allow conditional traps on architectures that support them and
18612 @option{-mdivide-breaks} to force the use of breaks.
18613
18614 The default is usually @option{-mdivide-traps}, but this can be
18615 overridden at configure time using @option{--with-divide=breaks}.
18616 Divide-by-zero checks can be completely disabled using
18617 @option{-mno-check-zero-division}.
18618
18619 @item -mmemcpy
18620 @itemx -mno-memcpy
18621 @opindex mmemcpy
18622 @opindex mno-memcpy
18623 Force (do not force) the use of @code{memcpy} for non-trivial block
18624 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
18625 most constant-sized copies.
18626
18627 @item -mlong-calls
18628 @itemx -mno-long-calls
18629 @opindex mlong-calls
18630 @opindex mno-long-calls
18631 Disable (do not disable) use of the @code{jal} instruction. Calling
18632 functions using @code{jal} is more efficient but requires the caller
18633 and callee to be in the same 256 megabyte segment.
18634
18635 This option has no effect on abicalls code. The default is
18636 @option{-mno-long-calls}.
18637
18638 @item -mmad
18639 @itemx -mno-mad
18640 @opindex mmad
18641 @opindex mno-mad
18642 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
18643 instructions, as provided by the R4650 ISA@.
18644
18645 @item -mimadd
18646 @itemx -mno-imadd
18647 @opindex mimadd
18648 @opindex mno-imadd
18649 Enable (disable) use of the @code{madd} and @code{msub} integer
18650 instructions. The default is @option{-mimadd} on architectures
18651 that support @code{madd} and @code{msub} except for the 74k
18652 architecture where it was found to generate slower code.
18653
18654 @item -mfused-madd
18655 @itemx -mno-fused-madd
18656 @opindex mfused-madd
18657 @opindex mno-fused-madd
18658 Enable (disable) use of the floating-point multiply-accumulate
18659 instructions, when they are available. The default is
18660 @option{-mfused-madd}.
18661
18662 On the R8000 CPU when multiply-accumulate instructions are used,
18663 the intermediate product is calculated to infinite precision
18664 and is not subject to the FCSR Flush to Zero bit. This may be
18665 undesirable in some circumstances. On other processors the result
18666 is numerically identical to the equivalent computation using
18667 separate multiply, add, subtract and negate instructions.
18668
18669 @item -nocpp
18670 @opindex nocpp
18671 Tell the MIPS assembler to not run its preprocessor over user
18672 assembler files (with a @samp{.s} suffix) when assembling them.
18673
18674 @item -mfix-24k
18675 @item -mno-fix-24k
18676 @opindex mfix-24k
18677 @opindex mno-fix-24k
18678 Work around the 24K E48 (lost data on stores during refill) errata.
18679 The workarounds are implemented by the assembler rather than by GCC@.
18680
18681 @item -mfix-r4000
18682 @itemx -mno-fix-r4000
18683 @opindex mfix-r4000
18684 @opindex mno-fix-r4000
18685 Work around certain R4000 CPU errata:
18686 @itemize @minus
18687 @item
18688 A double-word or a variable shift may give an incorrect result if executed
18689 immediately after starting an integer division.
18690 @item
18691 A double-word or a variable shift may give an incorrect result if executed
18692 while an integer multiplication is in progress.
18693 @item
18694 An integer division may give an incorrect result if started in a delay slot
18695 of a taken branch or a jump.
18696 @end itemize
18697
18698 @item -mfix-r4400
18699 @itemx -mno-fix-r4400
18700 @opindex mfix-r4400
18701 @opindex mno-fix-r4400
18702 Work around certain R4400 CPU errata:
18703 @itemize @minus
18704 @item
18705 A double-word or a variable shift may give an incorrect result if executed
18706 immediately after starting an integer division.
18707 @end itemize
18708
18709 @item -mfix-r10000
18710 @itemx -mno-fix-r10000
18711 @opindex mfix-r10000
18712 @opindex mno-fix-r10000
18713 Work around certain R10000 errata:
18714 @itemize @minus
18715 @item
18716 @code{ll}/@code{sc} sequences may not behave atomically on revisions
18717 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
18718 @end itemize
18719
18720 This option can only be used if the target architecture supports
18721 branch-likely instructions. @option{-mfix-r10000} is the default when
18722 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
18723 otherwise.
18724
18725 @item -mfix-rm7000
18726 @itemx -mno-fix-rm7000
18727 @opindex mfix-rm7000
18728 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
18729 workarounds are implemented by the assembler rather than by GCC@.
18730
18731 @item -mfix-vr4120
18732 @itemx -mno-fix-vr4120
18733 @opindex mfix-vr4120
18734 Work around certain VR4120 errata:
18735 @itemize @minus
18736 @item
18737 @code{dmultu} does not always produce the correct result.
18738 @item
18739 @code{div} and @code{ddiv} do not always produce the correct result if one
18740 of the operands is negative.
18741 @end itemize
18742 The workarounds for the division errata rely on special functions in
18743 @file{libgcc.a}. At present, these functions are only provided by
18744 the @code{mips64vr*-elf} configurations.
18745
18746 Other VR4120 errata require a NOP to be inserted between certain pairs of
18747 instructions. These errata are handled by the assembler, not by GCC itself.
18748
18749 @item -mfix-vr4130
18750 @opindex mfix-vr4130
18751 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
18752 workarounds are implemented by the assembler rather than by GCC,
18753 although GCC avoids using @code{mflo} and @code{mfhi} if the
18754 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
18755 instructions are available instead.
18756
18757 @item -mfix-sb1
18758 @itemx -mno-fix-sb1
18759 @opindex mfix-sb1
18760 Work around certain SB-1 CPU core errata.
18761 (This flag currently works around the SB-1 revision 2
18762 ``F1'' and ``F2'' floating-point errata.)
18763
18764 @item -mr10k-cache-barrier=@var{setting}
18765 @opindex mr10k-cache-barrier
18766 Specify whether GCC should insert cache barriers to avoid the
18767 side-effects of speculation on R10K processors.
18768
18769 In common with many processors, the R10K tries to predict the outcome
18770 of a conditional branch and speculatively executes instructions from
18771 the ``taken'' branch. It later aborts these instructions if the
18772 predicted outcome is wrong. However, on the R10K, even aborted
18773 instructions can have side effects.
18774
18775 This problem only affects kernel stores and, depending on the system,
18776 kernel loads. As an example, a speculatively-executed store may load
18777 the target memory into cache and mark the cache line as dirty, even if
18778 the store itself is later aborted. If a DMA operation writes to the
18779 same area of memory before the ``dirty'' line is flushed, the cached
18780 data overwrites the DMA-ed data. See the R10K processor manual
18781 for a full description, including other potential problems.
18782
18783 One workaround is to insert cache barrier instructions before every memory
18784 access that might be speculatively executed and that might have side
18785 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
18786 controls GCC's implementation of this workaround. It assumes that
18787 aborted accesses to any byte in the following regions does not have
18788 side effects:
18789
18790 @enumerate
18791 @item
18792 the memory occupied by the current function's stack frame;
18793
18794 @item
18795 the memory occupied by an incoming stack argument;
18796
18797 @item
18798 the memory occupied by an object with a link-time-constant address.
18799 @end enumerate
18800
18801 It is the kernel's responsibility to ensure that speculative
18802 accesses to these regions are indeed safe.
18803
18804 If the input program contains a function declaration such as:
18805
18806 @smallexample
18807 void foo (void);
18808 @end smallexample
18809
18810 then the implementation of @code{foo} must allow @code{j foo} and
18811 @code{jal foo} to be executed speculatively. GCC honors this
18812 restriction for functions it compiles itself. It expects non-GCC
18813 functions (such as hand-written assembly code) to do the same.
18814
18815 The option has three forms:
18816
18817 @table @gcctabopt
18818 @item -mr10k-cache-barrier=load-store
18819 Insert a cache barrier before a load or store that might be
18820 speculatively executed and that might have side effects even
18821 if aborted.
18822
18823 @item -mr10k-cache-barrier=store
18824 Insert a cache barrier before a store that might be speculatively
18825 executed and that might have side effects even if aborted.
18826
18827 @item -mr10k-cache-barrier=none
18828 Disable the insertion of cache barriers. This is the default setting.
18829 @end table
18830
18831 @item -mflush-func=@var{func}
18832 @itemx -mno-flush-func
18833 @opindex mflush-func
18834 Specifies the function to call to flush the I and D caches, or to not
18835 call any such function. If called, the function must take the same
18836 arguments as the common @code{_flush_func}, that is, the address of the
18837 memory range for which the cache is being flushed, the size of the
18838 memory range, and the number 3 (to flush both caches). The default
18839 depends on the target GCC was configured for, but commonly is either
18840 @code{_flush_func} or @code{__cpu_flush}.
18841
18842 @item mbranch-cost=@var{num}
18843 @opindex mbranch-cost
18844 Set the cost of branches to roughly @var{num} ``simple'' instructions.
18845 This cost is only a heuristic and is not guaranteed to produce
18846 consistent results across releases. A zero cost redundantly selects
18847 the default, which is based on the @option{-mtune} setting.
18848
18849 @item -mbranch-likely
18850 @itemx -mno-branch-likely
18851 @opindex mbranch-likely
18852 @opindex mno-branch-likely
18853 Enable or disable use of Branch Likely instructions, regardless of the
18854 default for the selected architecture. By default, Branch Likely
18855 instructions may be generated if they are supported by the selected
18856 architecture. An exception is for the MIPS32 and MIPS64 architectures
18857 and processors that implement those architectures; for those, Branch
18858 Likely instructions are not be generated by default because the MIPS32
18859 and MIPS64 architectures specifically deprecate their use.
18860
18861 @item -mcompact-branches=never
18862 @itemx -mcompact-branches=optimal
18863 @itemx -mcompact-branches=always
18864 @opindex mcompact-branches=never
18865 @opindex mcompact-branches=optimal
18866 @opindex mcompact-branches=always
18867 These options control which form of branches will be generated. The
18868 default is @option{-mcompact-branches=optimal}.
18869
18870 The @option{-mcompact-branches=never} option ensures that compact branch
18871 instructions will never be generated.
18872
18873 The @option{-mcompact-branches=always} option ensures that a compact
18874 branch instruction will be generated if available. If a compact branch
18875 instruction is not available, a delay slot form of the branch will be
18876 used instead.
18877
18878 This option is supported from MIPS Release 6 onwards.
18879
18880 The @option{-mcompact-branches=optimal} option will cause a delay slot
18881 branch to be used if one is available in the current ISA and the delay
18882 slot is successfully filled. If the delay slot is not filled, a compact
18883 branch will be chosen if one is available.
18884
18885 @item -mfp-exceptions
18886 @itemx -mno-fp-exceptions
18887 @opindex mfp-exceptions
18888 Specifies whether FP exceptions are enabled. This affects how
18889 FP instructions are scheduled for some processors.
18890 The default is that FP exceptions are
18891 enabled.
18892
18893 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
18894 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
18895 FP pipe.
18896
18897 @item -mvr4130-align
18898 @itemx -mno-vr4130-align
18899 @opindex mvr4130-align
18900 The VR4130 pipeline is two-way superscalar, but can only issue two
18901 instructions together if the first one is 8-byte aligned. When this
18902 option is enabled, GCC aligns pairs of instructions that it
18903 thinks should execute in parallel.
18904
18905 This option only has an effect when optimizing for the VR4130.
18906 It normally makes code faster, but at the expense of making it bigger.
18907 It is enabled by default at optimization level @option{-O3}.
18908
18909 @item -msynci
18910 @itemx -mno-synci
18911 @opindex msynci
18912 Enable (disable) generation of @code{synci} instructions on
18913 architectures that support it. The @code{synci} instructions (if
18914 enabled) are generated when @code{__builtin___clear_cache} is
18915 compiled.
18916
18917 This option defaults to @option{-mno-synci}, but the default can be
18918 overridden by configuring GCC with @option{--with-synci}.
18919
18920 When compiling code for single processor systems, it is generally safe
18921 to use @code{synci}. However, on many multi-core (SMP) systems, it
18922 does not invalidate the instruction caches on all cores and may lead
18923 to undefined behavior.
18924
18925 @item -mrelax-pic-calls
18926 @itemx -mno-relax-pic-calls
18927 @opindex mrelax-pic-calls
18928 Try to turn PIC calls that are normally dispatched via register
18929 @code{$25} into direct calls. This is only possible if the linker can
18930 resolve the destination at link time and if the destination is within
18931 range for a direct call.
18932
18933 @option{-mrelax-pic-calls} is the default if GCC was configured to use
18934 an assembler and a linker that support the @code{.reloc} assembly
18935 directive and @option{-mexplicit-relocs} is in effect. With
18936 @option{-mno-explicit-relocs}, this optimization can be performed by the
18937 assembler and the linker alone without help from the compiler.
18938
18939 @item -mmcount-ra-address
18940 @itemx -mno-mcount-ra-address
18941 @opindex mmcount-ra-address
18942 @opindex mno-mcount-ra-address
18943 Emit (do not emit) code that allows @code{_mcount} to modify the
18944 calling function's return address. When enabled, this option extends
18945 the usual @code{_mcount} interface with a new @var{ra-address}
18946 parameter, which has type @code{intptr_t *} and is passed in register
18947 @code{$12}. @code{_mcount} can then modify the return address by
18948 doing both of the following:
18949 @itemize
18950 @item
18951 Returning the new address in register @code{$31}.
18952 @item
18953 Storing the new address in @code{*@var{ra-address}},
18954 if @var{ra-address} is nonnull.
18955 @end itemize
18956
18957 The default is @option{-mno-mcount-ra-address}.
18958
18959 @item -mframe-header-opt
18960 @itemx -mno-frame-header-opt
18961 @opindex mframe-header-opt
18962 Enable (disable) frame header optimization in the o32 ABI. When using the
18963 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
18964 function to write out register arguments. When enabled, this optimization
18965 will suppress the allocation of the frame header if it can be determined that
18966 it is unused.
18967
18968 This optimization is off by default at all optimization levels.
18969
18970 @end table
18971
18972 @node MMIX Options
18973 @subsection MMIX Options
18974 @cindex MMIX Options
18975
18976 These options are defined for the MMIX:
18977
18978 @table @gcctabopt
18979 @item -mlibfuncs
18980 @itemx -mno-libfuncs
18981 @opindex mlibfuncs
18982 @opindex mno-libfuncs
18983 Specify that intrinsic library functions are being compiled, passing all
18984 values in registers, no matter the size.
18985
18986 @item -mepsilon
18987 @itemx -mno-epsilon
18988 @opindex mepsilon
18989 @opindex mno-epsilon
18990 Generate floating-point comparison instructions that compare with respect
18991 to the @code{rE} epsilon register.
18992
18993 @item -mabi=mmixware
18994 @itemx -mabi=gnu
18995 @opindex mabi=mmixware
18996 @opindex mabi=gnu
18997 Generate code that passes function parameters and return values that (in
18998 the called function) are seen as registers @code{$0} and up, as opposed to
18999 the GNU ABI which uses global registers @code{$231} and up.
19000
19001 @item -mzero-extend
19002 @itemx -mno-zero-extend
19003 @opindex mzero-extend
19004 @opindex mno-zero-extend
19005 When reading data from memory in sizes shorter than 64 bits, use (do not
19006 use) zero-extending load instructions by default, rather than
19007 sign-extending ones.
19008
19009 @item -mknuthdiv
19010 @itemx -mno-knuthdiv
19011 @opindex mknuthdiv
19012 @opindex mno-knuthdiv
19013 Make the result of a division yielding a remainder have the same sign as
19014 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
19015 remainder follows the sign of the dividend. Both methods are
19016 arithmetically valid, the latter being almost exclusively used.
19017
19018 @item -mtoplevel-symbols
19019 @itemx -mno-toplevel-symbols
19020 @opindex mtoplevel-symbols
19021 @opindex mno-toplevel-symbols
19022 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
19023 code can be used with the @code{PREFIX} assembly directive.
19024
19025 @item -melf
19026 @opindex melf
19027 Generate an executable in the ELF format, rather than the default
19028 @samp{mmo} format used by the @command{mmix} simulator.
19029
19030 @item -mbranch-predict
19031 @itemx -mno-branch-predict
19032 @opindex mbranch-predict
19033 @opindex mno-branch-predict
19034 Use (do not use) the probable-branch instructions, when static branch
19035 prediction indicates a probable branch.
19036
19037 @item -mbase-addresses
19038 @itemx -mno-base-addresses
19039 @opindex mbase-addresses
19040 @opindex mno-base-addresses
19041 Generate (do not generate) code that uses @emph{base addresses}. Using a
19042 base address automatically generates a request (handled by the assembler
19043 and the linker) for a constant to be set up in a global register. The
19044 register is used for one or more base address requests within the range 0
19045 to 255 from the value held in the register. The generally leads to short
19046 and fast code, but the number of different data items that can be
19047 addressed is limited. This means that a program that uses lots of static
19048 data may require @option{-mno-base-addresses}.
19049
19050 @item -msingle-exit
19051 @itemx -mno-single-exit
19052 @opindex msingle-exit
19053 @opindex mno-single-exit
19054 Force (do not force) generated code to have a single exit point in each
19055 function.
19056 @end table
19057
19058 @node MN10300 Options
19059 @subsection MN10300 Options
19060 @cindex MN10300 options
19061
19062 These @option{-m} options are defined for Matsushita MN10300 architectures:
19063
19064 @table @gcctabopt
19065 @item -mmult-bug
19066 @opindex mmult-bug
19067 Generate code to avoid bugs in the multiply instructions for the MN10300
19068 processors. This is the default.
19069
19070 @item -mno-mult-bug
19071 @opindex mno-mult-bug
19072 Do not generate code to avoid bugs in the multiply instructions for the
19073 MN10300 processors.
19074
19075 @item -mam33
19076 @opindex mam33
19077 Generate code using features specific to the AM33 processor.
19078
19079 @item -mno-am33
19080 @opindex mno-am33
19081 Do not generate code using features specific to the AM33 processor. This
19082 is the default.
19083
19084 @item -mam33-2
19085 @opindex mam33-2
19086 Generate code using features specific to the AM33/2.0 processor.
19087
19088 @item -mam34
19089 @opindex mam34
19090 Generate code using features specific to the AM34 processor.
19091
19092 @item -mtune=@var{cpu-type}
19093 @opindex mtune
19094 Use the timing characteristics of the indicated CPU type when
19095 scheduling instructions. This does not change the targeted processor
19096 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
19097 @samp{am33-2} or @samp{am34}.
19098
19099 @item -mreturn-pointer-on-d0
19100 @opindex mreturn-pointer-on-d0
19101 When generating a function that returns a pointer, return the pointer
19102 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
19103 only in @code{a0}, and attempts to call such functions without a prototype
19104 result in errors. Note that this option is on by default; use
19105 @option{-mno-return-pointer-on-d0} to disable it.
19106
19107 @item -mno-crt0
19108 @opindex mno-crt0
19109 Do not link in the C run-time initialization object file.
19110
19111 @item -mrelax
19112 @opindex mrelax
19113 Indicate to the linker that it should perform a relaxation optimization pass
19114 to shorten branches, calls and absolute memory addresses. This option only
19115 has an effect when used on the command line for the final link step.
19116
19117 This option makes symbolic debugging impossible.
19118
19119 @item -mliw
19120 @opindex mliw
19121 Allow the compiler to generate @emph{Long Instruction Word}
19122 instructions if the target is the @samp{AM33} or later. This is the
19123 default. This option defines the preprocessor macro @code{__LIW__}.
19124
19125 @item -mnoliw
19126 @opindex mnoliw
19127 Do not allow the compiler to generate @emph{Long Instruction Word}
19128 instructions. This option defines the preprocessor macro
19129 @code{__NO_LIW__}.
19130
19131 @item -msetlb
19132 @opindex msetlb
19133 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
19134 instructions if the target is the @samp{AM33} or later. This is the
19135 default. This option defines the preprocessor macro @code{__SETLB__}.
19136
19137 @item -mnosetlb
19138 @opindex mnosetlb
19139 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
19140 instructions. This option defines the preprocessor macro
19141 @code{__NO_SETLB__}.
19142
19143 @end table
19144
19145 @node Moxie Options
19146 @subsection Moxie Options
19147 @cindex Moxie Options
19148
19149 @table @gcctabopt
19150
19151 @item -meb
19152 @opindex meb
19153 Generate big-endian code. This is the default for @samp{moxie-*-*}
19154 configurations.
19155
19156 @item -mel
19157 @opindex mel
19158 Generate little-endian code.
19159
19160 @item -mmul.x
19161 @opindex mmul.x
19162 Generate mul.x and umul.x instructions. This is the default for
19163 @samp{moxiebox-*-*} configurations.
19164
19165 @item -mno-crt0
19166 @opindex mno-crt0
19167 Do not link in the C run-time initialization object file.
19168
19169 @end table
19170
19171 @node MSP430 Options
19172 @subsection MSP430 Options
19173 @cindex MSP430 Options
19174
19175 These options are defined for the MSP430:
19176
19177 @table @gcctabopt
19178
19179 @item -masm-hex
19180 @opindex masm-hex
19181 Force assembly output to always use hex constants. Normally such
19182 constants are signed decimals, but this option is available for
19183 testsuite and/or aesthetic purposes.
19184
19185 @item -mmcu=
19186 @opindex mmcu=
19187 Select the MCU to target. This is used to create a C preprocessor
19188 symbol based upon the MCU name, converted to upper case and pre- and
19189 post-fixed with @samp{__}. This in turn is used by the
19190 @file{msp430.h} header file to select an MCU-specific supplementary
19191 header file.
19192
19193 The option also sets the ISA to use. If the MCU name is one that is
19194 known to only support the 430 ISA then that is selected, otherwise the
19195 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
19196 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
19197 name selects the 430X ISA.
19198
19199 In addition an MCU-specific linker script is added to the linker
19200 command line. The script's name is the name of the MCU with
19201 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
19202 command line defines the C preprocessor symbol @code{__XXX__} and
19203 cause the linker to search for a script called @file{xxx.ld}.
19204
19205 This option is also passed on to the assembler.
19206
19207 @item -mwarn-mcu
19208 @itemx -mno-warn-mcu
19209 @opindex mwarn-mcu
19210 @opindex mno-warn-mcu
19211 This option enables or disables warnings about conflicts between the
19212 MCU name specified by the @option{-mmcu} option and the ISA set by the
19213 @option{-mcpu} option and/or the hardware multiply support set by the
19214 @option{-mhwmult} option. It also toggles warnings about unrecognized
19215 MCU names. This option is on by default.
19216
19217 @item -mcpu=
19218 @opindex mcpu=
19219 Specifies the ISA to use. Accepted values are @samp{msp430},
19220 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
19221 @option{-mmcu=} option should be used to select the ISA.
19222
19223 @item -msim
19224 @opindex msim
19225 Link to the simulator runtime libraries and linker script. Overrides
19226 any scripts that would be selected by the @option{-mmcu=} option.
19227
19228 @item -mlarge
19229 @opindex mlarge
19230 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
19231
19232 @item -msmall
19233 @opindex msmall
19234 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
19235
19236 @item -mrelax
19237 @opindex mrelax
19238 This option is passed to the assembler and linker, and allows the
19239 linker to perform certain optimizations that cannot be done until
19240 the final link.
19241
19242 @item mhwmult=
19243 @opindex mhwmult=
19244 Describes the type of hardware multiply supported by the target.
19245 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
19246 for the original 16-bit-only multiply supported by early MCUs.
19247 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
19248 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
19249 A value of @samp{auto} can also be given. This tells GCC to deduce
19250 the hardware multiply support based upon the MCU name provided by the
19251 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
19252 the MCU name is not recognized then no hardware multiply support is
19253 assumed. @code{auto} is the default setting.
19254
19255 Hardware multiplies are normally performed by calling a library
19256 routine. This saves space in the generated code. When compiling at
19257 @option{-O3} or higher however the hardware multiplier is invoked
19258 inline. This makes for bigger, but faster code.
19259
19260 The hardware multiply routines disable interrupts whilst running and
19261 restore the previous interrupt state when they finish. This makes
19262 them safe to use inside interrupt handlers as well as in normal code.
19263
19264 @item -minrt
19265 @opindex minrt
19266 Enable the use of a minimum runtime environment - no static
19267 initializers or constructors. This is intended for memory-constrained
19268 devices. The compiler includes special symbols in some objects
19269 that tell the linker and runtime which code fragments are required.
19270
19271 @item -mcode-region=
19272 @itemx -mdata-region=
19273 @opindex mcode-region
19274 @opindex mdata-region
19275 These options tell the compiler where to place functions and data that
19276 do not have one of the @code{lower}, @code{upper}, @code{either} or
19277 @code{section} attributes. Possible values are @code{lower},
19278 @code{upper}, @code{either} or @code{any}. The first three behave
19279 like the corresponding attribute. The fourth possible value -
19280 @code{any} - is the default. It leaves placement entirely up to the
19281 linker script and how it assigns the standard sections
19282 (@code{.text}, @code{.data}, etc) to the memory regions.
19283
19284 @item -msilicon-errata=
19285 @opindex msilicon-errata
19286 This option passes on a request to assembler to enable the fixes for
19287 the named silicon errata.
19288
19289 @item -msilicon-errata-warn=
19290 @opindex msilicon-errata-warn
19291 This option passes on a request to the assembler to enable warning
19292 messages when a silicon errata might need to be applied.
19293
19294 @end table
19295
19296 @node NDS32 Options
19297 @subsection NDS32 Options
19298 @cindex NDS32 Options
19299
19300 These options are defined for NDS32 implementations:
19301
19302 @table @gcctabopt
19303
19304 @item -mbig-endian
19305 @opindex mbig-endian
19306 Generate code in big-endian mode.
19307
19308 @item -mlittle-endian
19309 @opindex mlittle-endian
19310 Generate code in little-endian mode.
19311
19312 @item -mreduced-regs
19313 @opindex mreduced-regs
19314 Use reduced-set registers for register allocation.
19315
19316 @item -mfull-regs
19317 @opindex mfull-regs
19318 Use full-set registers for register allocation.
19319
19320 @item -mcmov
19321 @opindex mcmov
19322 Generate conditional move instructions.
19323
19324 @item -mno-cmov
19325 @opindex mno-cmov
19326 Do not generate conditional move instructions.
19327
19328 @item -mperf-ext
19329 @opindex mperf-ext
19330 Generate performance extension instructions.
19331
19332 @item -mno-perf-ext
19333 @opindex mno-perf-ext
19334 Do not generate performance extension instructions.
19335
19336 @item -mv3push
19337 @opindex mv3push
19338 Generate v3 push25/pop25 instructions.
19339
19340 @item -mno-v3push
19341 @opindex mno-v3push
19342 Do not generate v3 push25/pop25 instructions.
19343
19344 @item -m16-bit
19345 @opindex m16-bit
19346 Generate 16-bit instructions.
19347
19348 @item -mno-16-bit
19349 @opindex mno-16-bit
19350 Do not generate 16-bit instructions.
19351
19352 @item -misr-vector-size=@var{num}
19353 @opindex misr-vector-size
19354 Specify the size of each interrupt vector, which must be 4 or 16.
19355
19356 @item -mcache-block-size=@var{num}
19357 @opindex mcache-block-size
19358 Specify the size of each cache block,
19359 which must be a power of 2 between 4 and 512.
19360
19361 @item -march=@var{arch}
19362 @opindex march
19363 Specify the name of the target architecture.
19364
19365 @item -mcmodel=@var{code-model}
19366 @opindex mcmodel
19367 Set the code model to one of
19368 @table @asis
19369 @item @samp{small}
19370 All the data and read-only data segments must be within 512KB addressing space.
19371 The text segment must be within 16MB addressing space.
19372 @item @samp{medium}
19373 The data segment must be within 512KB while the read-only data segment can be
19374 within 4GB addressing space. The text segment should be still within 16MB
19375 addressing space.
19376 @item @samp{large}
19377 All the text and data segments can be within 4GB addressing space.
19378 @end table
19379
19380 @item -mctor-dtor
19381 @opindex mctor-dtor
19382 Enable constructor/destructor feature.
19383
19384 @item -mrelax
19385 @opindex mrelax
19386 Guide linker to relax instructions.
19387
19388 @end table
19389
19390 @node Nios II Options
19391 @subsection Nios II Options
19392 @cindex Nios II options
19393 @cindex Altera Nios II options
19394
19395 These are the options defined for the Altera Nios II processor.
19396
19397 @table @gcctabopt
19398
19399 @item -G @var{num}
19400 @opindex G
19401 @cindex smaller data references
19402 Put global and static objects less than or equal to @var{num} bytes
19403 into the small data or BSS sections instead of the normal data or BSS
19404 sections. The default value of @var{num} is 8.
19405
19406 @item -mgpopt=@var{option}
19407 @item -mgpopt
19408 @itemx -mno-gpopt
19409 @opindex mgpopt
19410 @opindex mno-gpopt
19411 Generate (do not generate) GP-relative accesses. The following
19412 @var{option} names are recognized:
19413
19414 @table @samp
19415
19416 @item none
19417 Do not generate GP-relative accesses.
19418
19419 @item local
19420 Generate GP-relative accesses for small data objects that are not
19421 external, weak, or uninitialized common symbols.
19422 Also use GP-relative addressing for objects that
19423 have been explicitly placed in a small data section via a @code{section}
19424 attribute.
19425
19426 @item global
19427 As for @samp{local}, but also generate GP-relative accesses for
19428 small data objects that are external, weak, or common. If you use this option,
19429 you must ensure that all parts of your program (including libraries) are
19430 compiled with the same @option{-G} setting.
19431
19432 @item data
19433 Generate GP-relative accesses for all data objects in the program. If you
19434 use this option, the entire data and BSS segments
19435 of your program must fit in 64K of memory and you must use an appropriate
19436 linker script to allocate them within the addressable range of the
19437 global pointer.
19438
19439 @item all
19440 Generate GP-relative addresses for function pointers as well as data
19441 pointers. If you use this option, the entire text, data, and BSS segments
19442 of your program must fit in 64K of memory and you must use an appropriate
19443 linker script to allocate them within the addressable range of the
19444 global pointer.
19445
19446 @end table
19447
19448 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
19449 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
19450
19451 The default is @option{-mgpopt} except when @option{-fpic} or
19452 @option{-fPIC} is specified to generate position-independent code.
19453 Note that the Nios II ABI does not permit GP-relative accesses from
19454 shared libraries.
19455
19456 You may need to specify @option{-mno-gpopt} explicitly when building
19457 programs that include large amounts of small data, including large
19458 GOT data sections. In this case, the 16-bit offset for GP-relative
19459 addressing may not be large enough to allow access to the entire
19460 small data section.
19461
19462 @item -mel
19463 @itemx -meb
19464 @opindex mel
19465 @opindex meb
19466 Generate little-endian (default) or big-endian (experimental) code,
19467 respectively.
19468
19469 @item -march=@var{arch}
19470 @opindex march
19471 This specifies the name of the target Nios II architecture. GCC uses this
19472 name to determine what kind of instructions it can emit when generating
19473 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
19474
19475 The preprocessor macro @code{__nios2_arch__} is available to programs,
19476 with value 1 or 2, indicating the targeted ISA level.
19477
19478 @item -mbypass-cache
19479 @itemx -mno-bypass-cache
19480 @opindex mno-bypass-cache
19481 @opindex mbypass-cache
19482 Force all load and store instructions to always bypass cache by
19483 using I/O variants of the instructions. The default is not to
19484 bypass the cache.
19485
19486 @item -mno-cache-volatile
19487 @itemx -mcache-volatile
19488 @opindex mcache-volatile
19489 @opindex mno-cache-volatile
19490 Volatile memory access bypass the cache using the I/O variants of
19491 the load and store instructions. The default is not to bypass the cache.
19492
19493 @item -mno-fast-sw-div
19494 @itemx -mfast-sw-div
19495 @opindex mno-fast-sw-div
19496 @opindex mfast-sw-div
19497 Do not use table-based fast divide for small numbers. The default
19498 is to use the fast divide at @option{-O3} and above.
19499
19500 @item -mno-hw-mul
19501 @itemx -mhw-mul
19502 @itemx -mno-hw-mulx
19503 @itemx -mhw-mulx
19504 @itemx -mno-hw-div
19505 @itemx -mhw-div
19506 @opindex mno-hw-mul
19507 @opindex mhw-mul
19508 @opindex mno-hw-mulx
19509 @opindex mhw-mulx
19510 @opindex mno-hw-div
19511 @opindex mhw-div
19512 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
19513 instructions by the compiler. The default is to emit @code{mul}
19514 and not emit @code{div} and @code{mulx}.
19515
19516 @item -mbmx
19517 @itemx -mno-bmx
19518 @itemx -mcdx
19519 @itemx -mno-cdx
19520 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
19521 CDX (code density) instructions. Enabling these instructions also
19522 requires @option{-march=r2}. Since these instructions are optional
19523 extensions to the R2 architecture, the default is not to emit them.
19524
19525 @item -mcustom-@var{insn}=@var{N}
19526 @itemx -mno-custom-@var{insn}
19527 @opindex mcustom-@var{insn}
19528 @opindex mno-custom-@var{insn}
19529 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
19530 custom instruction with encoding @var{N} when generating code that uses
19531 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
19532 instruction 253 for single-precision floating-point add operations instead
19533 of the default behavior of using a library call.
19534
19535 The following values of @var{insn} are supported. Except as otherwise
19536 noted, floating-point operations are expected to be implemented with
19537 normal IEEE 754 semantics and correspond directly to the C operators or the
19538 equivalent GCC built-in functions (@pxref{Other Builtins}).
19539
19540 Single-precision floating point:
19541 @table @asis
19542
19543 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
19544 Binary arithmetic operations.
19545
19546 @item @samp{fnegs}
19547 Unary negation.
19548
19549 @item @samp{fabss}
19550 Unary absolute value.
19551
19552 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
19553 Comparison operations.
19554
19555 @item @samp{fmins}, @samp{fmaxs}
19556 Floating-point minimum and maximum. These instructions are only
19557 generated if @option{-ffinite-math-only} is specified.
19558
19559 @item @samp{fsqrts}
19560 Unary square root operation.
19561
19562 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
19563 Floating-point trigonometric and exponential functions. These instructions
19564 are only generated if @option{-funsafe-math-optimizations} is also specified.
19565
19566 @end table
19567
19568 Double-precision floating point:
19569 @table @asis
19570
19571 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
19572 Binary arithmetic operations.
19573
19574 @item @samp{fnegd}
19575 Unary negation.
19576
19577 @item @samp{fabsd}
19578 Unary absolute value.
19579
19580 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
19581 Comparison operations.
19582
19583 @item @samp{fmind}, @samp{fmaxd}
19584 Double-precision minimum and maximum. These instructions are only
19585 generated if @option{-ffinite-math-only} is specified.
19586
19587 @item @samp{fsqrtd}
19588 Unary square root operation.
19589
19590 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
19591 Double-precision trigonometric and exponential functions. These instructions
19592 are only generated if @option{-funsafe-math-optimizations} is also specified.
19593
19594 @end table
19595
19596 Conversions:
19597 @table @asis
19598 @item @samp{fextsd}
19599 Conversion from single precision to double precision.
19600
19601 @item @samp{ftruncds}
19602 Conversion from double precision to single precision.
19603
19604 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
19605 Conversion from floating point to signed or unsigned integer types, with
19606 truncation towards zero.
19607
19608 @item @samp{round}
19609 Conversion from single-precision floating point to signed integer,
19610 rounding to the nearest integer and ties away from zero.
19611 This corresponds to the @code{__builtin_lroundf} function when
19612 @option{-fno-math-errno} is used.
19613
19614 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
19615 Conversion from signed or unsigned integer types to floating-point types.
19616
19617 @end table
19618
19619 In addition, all of the following transfer instructions for internal
19620 registers X and Y must be provided to use any of the double-precision
19621 floating-point instructions. Custom instructions taking two
19622 double-precision source operands expect the first operand in the
19623 64-bit register X. The other operand (or only operand of a unary
19624 operation) is given to the custom arithmetic instruction with the
19625 least significant half in source register @var{src1} and the most
19626 significant half in @var{src2}. A custom instruction that returns a
19627 double-precision result returns the most significant 32 bits in the
19628 destination register and the other half in 32-bit register Y.
19629 GCC automatically generates the necessary code sequences to write
19630 register X and/or read register Y when double-precision floating-point
19631 instructions are used.
19632
19633 @table @asis
19634
19635 @item @samp{fwrx}
19636 Write @var{src1} into the least significant half of X and @var{src2} into
19637 the most significant half of X.
19638
19639 @item @samp{fwry}
19640 Write @var{src1} into Y.
19641
19642 @item @samp{frdxhi}, @samp{frdxlo}
19643 Read the most or least (respectively) significant half of X and store it in
19644 @var{dest}.
19645
19646 @item @samp{frdy}
19647 Read the value of Y and store it into @var{dest}.
19648 @end table
19649
19650 Note that you can gain more local control over generation of Nios II custom
19651 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
19652 and @code{target("no-custom-@var{insn}")} function attributes
19653 (@pxref{Function Attributes})
19654 or pragmas (@pxref{Function Specific Option Pragmas}).
19655
19656 @item -mcustom-fpu-cfg=@var{name}
19657 @opindex mcustom-fpu-cfg
19658
19659 This option enables a predefined, named set of custom instruction encodings
19660 (see @option{-mcustom-@var{insn}} above).
19661 Currently, the following sets are defined:
19662
19663 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
19664 @gccoptlist{-mcustom-fmuls=252 @gol
19665 -mcustom-fadds=253 @gol
19666 -mcustom-fsubs=254 @gol
19667 -fsingle-precision-constant}
19668
19669 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
19670 @gccoptlist{-mcustom-fmuls=252 @gol
19671 -mcustom-fadds=253 @gol
19672 -mcustom-fsubs=254 @gol
19673 -mcustom-fdivs=255 @gol
19674 -fsingle-precision-constant}
19675
19676 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
19677 @gccoptlist{-mcustom-floatus=243 @gol
19678 -mcustom-fixsi=244 @gol
19679 -mcustom-floatis=245 @gol
19680 -mcustom-fcmpgts=246 @gol
19681 -mcustom-fcmples=249 @gol
19682 -mcustom-fcmpeqs=250 @gol
19683 -mcustom-fcmpnes=251 @gol
19684 -mcustom-fmuls=252 @gol
19685 -mcustom-fadds=253 @gol
19686 -mcustom-fsubs=254 @gol
19687 -mcustom-fdivs=255 @gol
19688 -fsingle-precision-constant}
19689
19690 Custom instruction assignments given by individual
19691 @option{-mcustom-@var{insn}=} options override those given by
19692 @option{-mcustom-fpu-cfg=}, regardless of the
19693 order of the options on the command line.
19694
19695 Note that you can gain more local control over selection of a FPU
19696 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
19697 function attribute (@pxref{Function Attributes})
19698 or pragma (@pxref{Function Specific Option Pragmas}).
19699
19700 @end table
19701
19702 These additional @samp{-m} options are available for the Altera Nios II
19703 ELF (bare-metal) target:
19704
19705 @table @gcctabopt
19706
19707 @item -mhal
19708 @opindex mhal
19709 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
19710 startup and termination code, and is typically used in conjunction with
19711 @option{-msys-crt0=} to specify the location of the alternate startup code
19712 provided by the HAL BSP.
19713
19714 @item -msmallc
19715 @opindex msmallc
19716 Link with a limited version of the C library, @option{-lsmallc}, rather than
19717 Newlib.
19718
19719 @item -msys-crt0=@var{startfile}
19720 @opindex msys-crt0
19721 @var{startfile} is the file name of the startfile (crt0) to use
19722 when linking. This option is only useful in conjunction with @option{-mhal}.
19723
19724 @item -msys-lib=@var{systemlib}
19725 @opindex msys-lib
19726 @var{systemlib} is the library name of the library that provides
19727 low-level system calls required by the C library,
19728 e.g. @code{read} and @code{write}.
19729 This option is typically used to link with a library provided by a HAL BSP.
19730
19731 @end table
19732
19733 @node Nvidia PTX Options
19734 @subsection Nvidia PTX Options
19735 @cindex Nvidia PTX options
19736 @cindex nvptx options
19737
19738 These options are defined for Nvidia PTX:
19739
19740 @table @gcctabopt
19741
19742 @item -m32
19743 @itemx -m64
19744 @opindex m32
19745 @opindex m64
19746 Generate code for 32-bit or 64-bit ABI.
19747
19748 @item -mmainkernel
19749 @opindex mmainkernel
19750 Link in code for a __main kernel. This is for stand-alone instead of
19751 offloading execution.
19752
19753 @item -moptimize
19754 @opindex moptimize
19755 Apply partitioned execution optimizations. This is the default when any
19756 level of optimization is selected.
19757
19758 @end table
19759
19760 @node PDP-11 Options
19761 @subsection PDP-11 Options
19762 @cindex PDP-11 Options
19763
19764 These options are defined for the PDP-11:
19765
19766 @table @gcctabopt
19767 @item -mfpu
19768 @opindex mfpu
19769 Use hardware FPP floating point. This is the default. (FIS floating
19770 point on the PDP-11/40 is not supported.)
19771
19772 @item -msoft-float
19773 @opindex msoft-float
19774 Do not use hardware floating point.
19775
19776 @item -mac0
19777 @opindex mac0
19778 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
19779
19780 @item -mno-ac0
19781 @opindex mno-ac0
19782 Return floating-point results in memory. This is the default.
19783
19784 @item -m40
19785 @opindex m40
19786 Generate code for a PDP-11/40.
19787
19788 @item -m45
19789 @opindex m45
19790 Generate code for a PDP-11/45. This is the default.
19791
19792 @item -m10
19793 @opindex m10
19794 Generate code for a PDP-11/10.
19795
19796 @item -mbcopy-builtin
19797 @opindex mbcopy-builtin
19798 Use inline @code{movmemhi} patterns for copying memory. This is the
19799 default.
19800
19801 @item -mbcopy
19802 @opindex mbcopy
19803 Do not use inline @code{movmemhi} patterns for copying memory.
19804
19805 @item -mint16
19806 @itemx -mno-int32
19807 @opindex mint16
19808 @opindex mno-int32
19809 Use 16-bit @code{int}. This is the default.
19810
19811 @item -mint32
19812 @itemx -mno-int16
19813 @opindex mint32
19814 @opindex mno-int16
19815 Use 32-bit @code{int}.
19816
19817 @item -mfloat64
19818 @itemx -mno-float32
19819 @opindex mfloat64
19820 @opindex mno-float32
19821 Use 64-bit @code{float}. This is the default.
19822
19823 @item -mfloat32
19824 @itemx -mno-float64
19825 @opindex mfloat32
19826 @opindex mno-float64
19827 Use 32-bit @code{float}.
19828
19829 @item -mabshi
19830 @opindex mabshi
19831 Use @code{abshi2} pattern. This is the default.
19832
19833 @item -mno-abshi
19834 @opindex mno-abshi
19835 Do not use @code{abshi2} pattern.
19836
19837 @item -mbranch-expensive
19838 @opindex mbranch-expensive
19839 Pretend that branches are expensive. This is for experimenting with
19840 code generation only.
19841
19842 @item -mbranch-cheap
19843 @opindex mbranch-cheap
19844 Do not pretend that branches are expensive. This is the default.
19845
19846 @item -munix-asm
19847 @opindex munix-asm
19848 Use Unix assembler syntax. This is the default when configured for
19849 @samp{pdp11-*-bsd}.
19850
19851 @item -mdec-asm
19852 @opindex mdec-asm
19853 Use DEC assembler syntax. This is the default when configured for any
19854 PDP-11 target other than @samp{pdp11-*-bsd}.
19855 @end table
19856
19857 @node picoChip Options
19858 @subsection picoChip Options
19859 @cindex picoChip options
19860
19861 These @samp{-m} options are defined for picoChip implementations:
19862
19863 @table @gcctabopt
19864
19865 @item -mae=@var{ae_type}
19866 @opindex mcpu
19867 Set the instruction set, register set, and instruction scheduling
19868 parameters for array element type @var{ae_type}. Supported values
19869 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
19870
19871 @option{-mae=ANY} selects a completely generic AE type. Code
19872 generated with this option runs on any of the other AE types. The
19873 code is not as efficient as it would be if compiled for a specific
19874 AE type, and some types of operation (e.g., multiplication) do not
19875 work properly on all types of AE.
19876
19877 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
19878 for compiled code, and is the default.
19879
19880 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
19881 option may suffer from poor performance of byte (char) manipulation,
19882 since the DSP AE does not provide hardware support for byte load/stores.
19883
19884 @item -msymbol-as-address
19885 Enable the compiler to directly use a symbol name as an address in a
19886 load/store instruction, without first loading it into a
19887 register. Typically, the use of this option generates larger
19888 programs, which run faster than when the option isn't used. However, the
19889 results vary from program to program, so it is left as a user option,
19890 rather than being permanently enabled.
19891
19892 @item -mno-inefficient-warnings
19893 Disables warnings about the generation of inefficient code. These
19894 warnings can be generated, for example, when compiling code that
19895 performs byte-level memory operations on the MAC AE type. The MAC AE has
19896 no hardware support for byte-level memory operations, so all byte
19897 load/stores must be synthesized from word load/store operations. This is
19898 inefficient and a warning is generated to indicate
19899 that you should rewrite the code to avoid byte operations, or to target
19900 an AE type that has the necessary hardware support. This option disables
19901 these warnings.
19902
19903 @end table
19904
19905 @node PowerPC Options
19906 @subsection PowerPC Options
19907 @cindex PowerPC options
19908
19909 These are listed under @xref{RS/6000 and PowerPC Options}.
19910
19911 @node RL78 Options
19912 @subsection RL78 Options
19913 @cindex RL78 Options
19914
19915 @table @gcctabopt
19916
19917 @item -msim
19918 @opindex msim
19919 Links in additional target libraries to support operation within a
19920 simulator.
19921
19922 @item -mmul=none
19923 @itemx -mmul=g10
19924 @itemx -mmul=g13
19925 @itemx -mmul=g14
19926 @itemx -mmul=rl78
19927 @opindex mmul
19928 Specifies the type of hardware multiplication and division support to
19929 be used. The simplest is @code{none}, which uses software for both
19930 multiplication and division. This is the default. The @code{g13}
19931 value is for the hardware multiply/divide peripheral found on the
19932 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
19933 the multiplication and division instructions supported by the RL78/G14
19934 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
19935 the value @code{mg10} is an alias for @code{none}.
19936
19937 In addition a C preprocessor macro is defined, based upon the setting
19938 of this option. Possible values are: @code{__RL78_MUL_NONE__},
19939 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
19940
19941 @item -mcpu=g10
19942 @itemx -mcpu=g13
19943 @itemx -mcpu=g14
19944 @itemx -mcpu=rl78
19945 @opindex mcpu
19946 Specifies the RL78 core to target. The default is the G14 core, also
19947 known as an S3 core or just RL78. The G13 or S2 core does not have
19948 multiply or divide instructions, instead it uses a hardware peripheral
19949 for these operations. The G10 or S1 core does not have register
19950 banks, so it uses a different calling convention.
19951
19952 If this option is set it also selects the type of hardware multiply
19953 support to use, unless this is overridden by an explicit
19954 @option{-mmul=none} option on the command line. Thus specifying
19955 @option{-mcpu=g13} enables the use of the G13 hardware multiply
19956 peripheral and specifying @option{-mcpu=g10} disables the use of
19957 hardware multiplications altogether.
19958
19959 Note, although the RL78/G14 core is the default target, specifying
19960 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
19961 change the behavior of the toolchain since it also enables G14
19962 hardware multiply support. If these options are not specified on the
19963 command line then software multiplication routines will be used even
19964 though the code targets the RL78 core. This is for backwards
19965 compatibility with older toolchains which did not have hardware
19966 multiply and divide support.
19967
19968 In addition a C preprocessor macro is defined, based upon the setting
19969 of this option. Possible values are: @code{__RL78_G10__},
19970 @code{__RL78_G13__} or @code{__RL78_G14__}.
19971
19972 @item -mg10
19973 @itemx -mg13
19974 @itemx -mg14
19975 @itemx -mrl78
19976 @opindex mg10
19977 @opindex mg13
19978 @opindex mg14
19979 @opindex mrl78
19980 These are aliases for the corresponding @option{-mcpu=} option. They
19981 are provided for backwards compatibility.
19982
19983 @item -mallregs
19984 @opindex mallregs
19985 Allow the compiler to use all of the available registers. By default
19986 registers @code{r24..r31} are reserved for use in interrupt handlers.
19987 With this option enabled these registers can be used in ordinary
19988 functions as well.
19989
19990 @item -m64bit-doubles
19991 @itemx -m32bit-doubles
19992 @opindex m64bit-doubles
19993 @opindex m32bit-doubles
19994 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
19995 or 32 bits (@option{-m32bit-doubles}) in size. The default is
19996 @option{-m32bit-doubles}.
19997
19998 @item -msave-mduc-in-interrupts
19999 @item -mno-save-mduc-in-interrupts
20000 @opindex msave-mduc-in-interrupts
20001 @opindex mno-save-mduc-in-interrupts
20002 Specifies that interrupt handler functions should preserve the
20003 MDUC registers. This is only necessary if normal code might use
20004 the MDUC registers, for example because it performs multiplication
20005 and division operations. The default is to ignore the MDUC registers
20006 as this makes the interrupt handlers faster. The target option -mg13
20007 needs to be passed for this to work as this feature is only available
20008 on the G13 target (S2 core). The MDUC registers will only be saved
20009 if the interrupt handler performs a multiplication or division
20010 operation or it calls another function.
20011
20012 @end table
20013
20014 @node RS/6000 and PowerPC Options
20015 @subsection IBM RS/6000 and PowerPC Options
20016 @cindex RS/6000 and PowerPC Options
20017 @cindex IBM RS/6000 and PowerPC Options
20018
20019 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
20020 @table @gcctabopt
20021 @item -mpowerpc-gpopt
20022 @itemx -mno-powerpc-gpopt
20023 @itemx -mpowerpc-gfxopt
20024 @itemx -mno-powerpc-gfxopt
20025 @need 800
20026 @itemx -mpowerpc64
20027 @itemx -mno-powerpc64
20028 @itemx -mmfcrf
20029 @itemx -mno-mfcrf
20030 @itemx -mpopcntb
20031 @itemx -mno-popcntb
20032 @itemx -mpopcntd
20033 @itemx -mno-popcntd
20034 @itemx -mfprnd
20035 @itemx -mno-fprnd
20036 @need 800
20037 @itemx -mcmpb
20038 @itemx -mno-cmpb
20039 @itemx -mmfpgpr
20040 @itemx -mno-mfpgpr
20041 @itemx -mhard-dfp
20042 @itemx -mno-hard-dfp
20043 @opindex mpowerpc-gpopt
20044 @opindex mno-powerpc-gpopt
20045 @opindex mpowerpc-gfxopt
20046 @opindex mno-powerpc-gfxopt
20047 @opindex mpowerpc64
20048 @opindex mno-powerpc64
20049 @opindex mmfcrf
20050 @opindex mno-mfcrf
20051 @opindex mpopcntb
20052 @opindex mno-popcntb
20053 @opindex mpopcntd
20054 @opindex mno-popcntd
20055 @opindex mfprnd
20056 @opindex mno-fprnd
20057 @opindex mcmpb
20058 @opindex mno-cmpb
20059 @opindex mmfpgpr
20060 @opindex mno-mfpgpr
20061 @opindex mhard-dfp
20062 @opindex mno-hard-dfp
20063 You use these options to specify which instructions are available on the
20064 processor you are using. The default value of these options is
20065 determined when configuring GCC@. Specifying the
20066 @option{-mcpu=@var{cpu_type}} overrides the specification of these
20067 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
20068 rather than the options listed above.
20069
20070 Specifying @option{-mpowerpc-gpopt} allows
20071 GCC to use the optional PowerPC architecture instructions in the
20072 General Purpose group, including floating-point square root. Specifying
20073 @option{-mpowerpc-gfxopt} allows GCC to
20074 use the optional PowerPC architecture instructions in the Graphics
20075 group, including floating-point select.
20076
20077 The @option{-mmfcrf} option allows GCC to generate the move from
20078 condition register field instruction implemented on the POWER4
20079 processor and other processors that support the PowerPC V2.01
20080 architecture.
20081 The @option{-mpopcntb} option allows GCC to generate the popcount and
20082 double-precision FP reciprocal estimate instruction implemented on the
20083 POWER5 processor and other processors that support the PowerPC V2.02
20084 architecture.
20085 The @option{-mpopcntd} option allows GCC to generate the popcount
20086 instruction implemented on the POWER7 processor and other processors
20087 that support the PowerPC V2.06 architecture.
20088 The @option{-mfprnd} option allows GCC to generate the FP round to
20089 integer instructions implemented on the POWER5+ processor and other
20090 processors that support the PowerPC V2.03 architecture.
20091 The @option{-mcmpb} option allows GCC to generate the compare bytes
20092 instruction implemented on the POWER6 processor and other processors
20093 that support the PowerPC V2.05 architecture.
20094 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
20095 general-purpose register instructions implemented on the POWER6X
20096 processor and other processors that support the extended PowerPC V2.05
20097 architecture.
20098 The @option{-mhard-dfp} option allows GCC to generate the decimal
20099 floating-point instructions implemented on some POWER processors.
20100
20101 The @option{-mpowerpc64} option allows GCC to generate the additional
20102 64-bit instructions that are found in the full PowerPC64 architecture
20103 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
20104 @option{-mno-powerpc64}.
20105
20106 @item -mcpu=@var{cpu_type}
20107 @opindex mcpu
20108 Set architecture type, register usage, and
20109 instruction scheduling parameters for machine type @var{cpu_type}.
20110 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
20111 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
20112 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
20113 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
20114 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
20115 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
20116 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
20117 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
20118 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
20119 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
20120 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
20121 and @samp{rs64}.
20122
20123 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
20124 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
20125 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
20126 architecture machine types, with an appropriate, generic processor
20127 model assumed for scheduling purposes.
20128
20129 The other options specify a specific processor. Code generated under
20130 those options runs best on that processor, and may not run at all on
20131 others.
20132
20133 The @option{-mcpu} options automatically enable or disable the
20134 following options:
20135
20136 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
20137 -mpopcntb -mpopcntd -mpowerpc64 @gol
20138 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
20139 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
20140 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
20141 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
20142
20143 The particular options set for any particular CPU varies between
20144 compiler versions, depending on what setting seems to produce optimal
20145 code for that CPU; it doesn't necessarily reflect the actual hardware's
20146 capabilities. If you wish to set an individual option to a particular
20147 value, you may specify it after the @option{-mcpu} option, like
20148 @option{-mcpu=970 -mno-altivec}.
20149
20150 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
20151 not enabled or disabled by the @option{-mcpu} option at present because
20152 AIX does not have full support for these options. You may still
20153 enable or disable them individually if you're sure it'll work in your
20154 environment.
20155
20156 @item -mtune=@var{cpu_type}
20157 @opindex mtune
20158 Set the instruction scheduling parameters for machine type
20159 @var{cpu_type}, but do not set the architecture type or register usage,
20160 as @option{-mcpu=@var{cpu_type}} does. The same
20161 values for @var{cpu_type} are used for @option{-mtune} as for
20162 @option{-mcpu}. If both are specified, the code generated uses the
20163 architecture and registers set by @option{-mcpu}, but the
20164 scheduling parameters set by @option{-mtune}.
20165
20166 @item -mcmodel=small
20167 @opindex mcmodel=small
20168 Generate PowerPC64 code for the small model: The TOC is limited to
20169 64k.
20170
20171 @item -mcmodel=medium
20172 @opindex mcmodel=medium
20173 Generate PowerPC64 code for the medium model: The TOC and other static
20174 data may be up to a total of 4G in size.
20175
20176 @item -mcmodel=large
20177 @opindex mcmodel=large
20178 Generate PowerPC64 code for the large model: The TOC may be up to 4G
20179 in size. Other data and code is only limited by the 64-bit address
20180 space.
20181
20182 @item -maltivec
20183 @itemx -mno-altivec
20184 @opindex maltivec
20185 @opindex mno-altivec
20186 Generate code that uses (does not use) AltiVec instructions, and also
20187 enable the use of built-in functions that allow more direct access to
20188 the AltiVec instruction set. You may also need to set
20189 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
20190 enhancements.
20191
20192 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
20193 @option{-maltivec=be}, the element order for AltiVec intrinsics such
20194 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
20195 match array element order corresponding to the endianness of the
20196 target. That is, element zero identifies the leftmost element in a
20197 vector register when targeting a big-endian platform, and identifies
20198 the rightmost element in a vector register when targeting a
20199 little-endian platform.
20200
20201 @item -maltivec=be
20202 @opindex maltivec=be
20203 Generate AltiVec instructions using big-endian element order,
20204 regardless of whether the target is big- or little-endian. This is
20205 the default when targeting a big-endian platform.
20206
20207 The element order is used to interpret element numbers in AltiVec
20208 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20209 @code{vec_insert}. By default, these match array element order
20210 corresponding to the endianness for the target.
20211
20212 @item -maltivec=le
20213 @opindex maltivec=le
20214 Generate AltiVec instructions using little-endian element order,
20215 regardless of whether the target is big- or little-endian. This is
20216 the default when targeting a little-endian platform. This option is
20217 currently ignored when targeting a big-endian platform.
20218
20219 The element order is used to interpret element numbers in AltiVec
20220 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20221 @code{vec_insert}. By default, these match array element order
20222 corresponding to the endianness for the target.
20223
20224 @item -mvrsave
20225 @itemx -mno-vrsave
20226 @opindex mvrsave
20227 @opindex mno-vrsave
20228 Generate VRSAVE instructions when generating AltiVec code.
20229
20230 @item -mgen-cell-microcode
20231 @opindex mgen-cell-microcode
20232 Generate Cell microcode instructions.
20233
20234 @item -mwarn-cell-microcode
20235 @opindex mwarn-cell-microcode
20236 Warn when a Cell microcode instruction is emitted. An example
20237 of a Cell microcode instruction is a variable shift.
20238
20239 @item -msecure-plt
20240 @opindex msecure-plt
20241 Generate code that allows @command{ld} and @command{ld.so}
20242 to build executables and shared
20243 libraries with non-executable @code{.plt} and @code{.got} sections.
20244 This is a PowerPC
20245 32-bit SYSV ABI option.
20246
20247 @item -mbss-plt
20248 @opindex mbss-plt
20249 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
20250 fills in, and
20251 requires @code{.plt} and @code{.got}
20252 sections that are both writable and executable.
20253 This is a PowerPC 32-bit SYSV ABI option.
20254
20255 @item -misel
20256 @itemx -mno-isel
20257 @opindex misel
20258 @opindex mno-isel
20259 This switch enables or disables the generation of ISEL instructions.
20260
20261 @item -misel=@var{yes/no}
20262 This switch has been deprecated. Use @option{-misel} and
20263 @option{-mno-isel} instead.
20264
20265 @item -mlra
20266 @opindex mlra
20267 Enable Local Register Allocation. This is still experimental for PowerPC,
20268 so by default the compiler uses standard reload
20269 (i.e. @option{-mno-lra}).
20270
20271 @item -mspe
20272 @itemx -mno-spe
20273 @opindex mspe
20274 @opindex mno-spe
20275 This switch enables or disables the generation of SPE simd
20276 instructions.
20277
20278 @item -mpaired
20279 @itemx -mno-paired
20280 @opindex mpaired
20281 @opindex mno-paired
20282 This switch enables or disables the generation of PAIRED simd
20283 instructions.
20284
20285 @item -mspe=@var{yes/no}
20286 This option has been deprecated. Use @option{-mspe} and
20287 @option{-mno-spe} instead.
20288
20289 @item -mvsx
20290 @itemx -mno-vsx
20291 @opindex mvsx
20292 @opindex mno-vsx
20293 Generate code that uses (does not use) vector/scalar (VSX)
20294 instructions, and also enable the use of built-in functions that allow
20295 more direct access to the VSX instruction set.
20296
20297 @item -mcrypto
20298 @itemx -mno-crypto
20299 @opindex mcrypto
20300 @opindex mno-crypto
20301 Enable the use (disable) of the built-in functions that allow direct
20302 access to the cryptographic instructions that were added in version
20303 2.07 of the PowerPC ISA.
20304
20305 @item -mdirect-move
20306 @itemx -mno-direct-move
20307 @opindex mdirect-move
20308 @opindex mno-direct-move
20309 Generate code that uses (does not use) the instructions to move data
20310 between the general purpose registers and the vector/scalar (VSX)
20311 registers that were added in version 2.07 of the PowerPC ISA.
20312
20313 @item -mhtm
20314 @itemx -mno-htm
20315 @opindex mhtm
20316 @opindex mno-htm
20317 Enable (disable) the use of the built-in functions that allow direct
20318 access to the Hardware Transactional Memory (HTM) instructions that
20319 were added in version 2.07 of the PowerPC ISA.
20320
20321 @item -mpower8-fusion
20322 @itemx -mno-power8-fusion
20323 @opindex mpower8-fusion
20324 @opindex mno-power8-fusion
20325 Generate code that keeps (does not keeps) some integer operations
20326 adjacent so that the instructions can be fused together on power8 and
20327 later processors.
20328
20329 @item -mpower8-vector
20330 @itemx -mno-power8-vector
20331 @opindex mpower8-vector
20332 @opindex mno-power8-vector
20333 Generate code that uses (does not use) the vector and scalar
20334 instructions that were added in version 2.07 of the PowerPC ISA. Also
20335 enable the use of built-in functions that allow more direct access to
20336 the vector instructions.
20337
20338 @item -mquad-memory
20339 @itemx -mno-quad-memory
20340 @opindex mquad-memory
20341 @opindex mno-quad-memory
20342 Generate code that uses (does not use) the non-atomic quad word memory
20343 instructions. The @option{-mquad-memory} option requires use of
20344 64-bit mode.
20345
20346 @item -mquad-memory-atomic
20347 @itemx -mno-quad-memory-atomic
20348 @opindex mquad-memory-atomic
20349 @opindex mno-quad-memory-atomic
20350 Generate code that uses (does not use) the atomic quad word memory
20351 instructions. The @option{-mquad-memory-atomic} option requires use of
20352 64-bit mode.
20353
20354 @item -mupper-regs-di
20355 @itemx -mno-upper-regs-di
20356 @opindex mupper-regs-di
20357 @opindex mno-upper-regs-di
20358 Generate code that uses (does not use) the scalar instructions that
20359 target all 64 registers in the vector/scalar floating point register
20360 set that were added in version 2.06 of the PowerPC ISA when processing
20361 integers. @option{-mupper-regs-di} is turned on by default if you use
20362 any of the @option{-mcpu=power7}, @option{-mcpu=power8},
20363 @option{-mcpu=power9}, or @option{-mvsx} options.
20364
20365 @item -mupper-regs-df
20366 @itemx -mno-upper-regs-df
20367 @opindex mupper-regs-df
20368 @opindex mno-upper-regs-df
20369 Generate code that uses (does not use) the scalar double precision
20370 instructions that target all 64 registers in the vector/scalar
20371 floating point register set that were added in version 2.06 of the
20372 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
20373 use any of the @option{-mcpu=power7}, @option{-mcpu=power8},
20374 @option{-mcpu=power9}, or @option{-mvsx} options.
20375
20376 @item -mupper-regs-sf
20377 @itemx -mno-upper-regs-sf
20378 @opindex mupper-regs-sf
20379 @opindex mno-upper-regs-sf
20380 Generate code that uses (does not use) the scalar single precision
20381 instructions that target all 64 registers in the vector/scalar
20382 floating point register set that were added in version 2.07 of the
20383 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
20384 use either of the @option{-mcpu=power8}, @option{-mpower8-vector}, or
20385 @option{-mcpu=power9} options.
20386
20387 @item -mupper-regs
20388 @itemx -mno-upper-regs
20389 @opindex mupper-regs
20390 @opindex mno-upper-regs
20391 Generate code that uses (does not use) the scalar
20392 instructions that target all 64 registers in the vector/scalar
20393 floating point register set, depending on the model of the machine.
20394
20395 If the @option{-mno-upper-regs} option is used, it turns off both
20396 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
20397
20398 @item -mfloat128
20399 @itemx -mno-float128
20400 @opindex mfloat128
20401 @opindex mno-float128
20402 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
20403 and use either software emulation for IEEE 128-bit floating point or
20404 hardware instructions.
20405
20406 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
20407 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
20408 option. The @option{-mfloat128} option only works on PowerPC 64-bit
20409 Linux systems.
20410
20411 If you use the ISA 3.0 instruction set (@option{-mcpu=power9}), the
20412 @option{-mfloat128} option will also enable the generation of ISA 3.0
20413 IEEE 128-bit floating point instructions. Otherwise, IEEE 128-bit
20414 floating point will be done with software emulation.
20415
20416 @item -mfloat128-hardware
20417 @itemx -mno-float128-hardware
20418 @opindex mfloat128-hardware
20419 @opindex mno-float128-hardware
20420 Enable/disable using ISA 3.0 hardware instructions to support the
20421 @var{__float128} data type.
20422
20423 If you use @option{-mfloat128-hardware}, it will enable the option
20424 @option{-mfloat128} as well.
20425
20426 If you select ISA 3.0 instructions with @option{-mcpu=power9}, but do
20427 not use either @option{-mfloat128} or @option{-mfloat128-hardware},
20428 the IEEE 128-bit floating point support will not be enabled.
20429
20430 @item -mfloat-gprs=@var{yes/single/double/no}
20431 @itemx -mfloat-gprs
20432 @opindex mfloat-gprs
20433 This switch enables or disables the generation of floating-point
20434 operations on the general-purpose registers for architectures that
20435 support it.
20436
20437 The argument @samp{yes} or @samp{single} enables the use of
20438 single-precision floating-point operations.
20439
20440 The argument @samp{double} enables the use of single and
20441 double-precision floating-point operations.
20442
20443 The argument @samp{no} disables floating-point operations on the
20444 general-purpose registers.
20445
20446 This option is currently only available on the MPC854x.
20447
20448 @item -m32
20449 @itemx -m64
20450 @opindex m32
20451 @opindex m64
20452 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
20453 targets (including GNU/Linux). The 32-bit environment sets int, long
20454 and pointer to 32 bits and generates code that runs on any PowerPC
20455 variant. The 64-bit environment sets int to 32 bits and long and
20456 pointer to 64 bits, and generates code for PowerPC64, as for
20457 @option{-mpowerpc64}.
20458
20459 @item -mfull-toc
20460 @itemx -mno-fp-in-toc
20461 @itemx -mno-sum-in-toc
20462 @itemx -mminimal-toc
20463 @opindex mfull-toc
20464 @opindex mno-fp-in-toc
20465 @opindex mno-sum-in-toc
20466 @opindex mminimal-toc
20467 Modify generation of the TOC (Table Of Contents), which is created for
20468 every executable file. The @option{-mfull-toc} option is selected by
20469 default. In that case, GCC allocates at least one TOC entry for
20470 each unique non-automatic variable reference in your program. GCC
20471 also places floating-point constants in the TOC@. However, only
20472 16,384 entries are available in the TOC@.
20473
20474 If you receive a linker error message that saying you have overflowed
20475 the available TOC space, you can reduce the amount of TOC space used
20476 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
20477 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
20478 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
20479 generate code to calculate the sum of an address and a constant at
20480 run time instead of putting that sum into the TOC@. You may specify one
20481 or both of these options. Each causes GCC to produce very slightly
20482 slower and larger code at the expense of conserving TOC space.
20483
20484 If you still run out of space in the TOC even when you specify both of
20485 these options, specify @option{-mminimal-toc} instead. This option causes
20486 GCC to make only one TOC entry for every file. When you specify this
20487 option, GCC produces code that is slower and larger but which
20488 uses extremely little TOC space. You may wish to use this option
20489 only on files that contain less frequently-executed code.
20490
20491 @item -maix64
20492 @itemx -maix32
20493 @opindex maix64
20494 @opindex maix32
20495 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
20496 @code{long} type, and the infrastructure needed to support them.
20497 Specifying @option{-maix64} implies @option{-mpowerpc64},
20498 while @option{-maix32} disables the 64-bit ABI and
20499 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
20500
20501 @item -mxl-compat
20502 @itemx -mno-xl-compat
20503 @opindex mxl-compat
20504 @opindex mno-xl-compat
20505 Produce code that conforms more closely to IBM XL compiler semantics
20506 when using AIX-compatible ABI@. Pass floating-point arguments to
20507 prototyped functions beyond the register save area (RSA) on the stack
20508 in addition to argument FPRs. Do not assume that most significant
20509 double in 128-bit long double value is properly rounded when comparing
20510 values and converting to double. Use XL symbol names for long double
20511 support routines.
20512
20513 The AIX calling convention was extended but not initially documented to
20514 handle an obscure K&R C case of calling a function that takes the
20515 address of its arguments with fewer arguments than declared. IBM XL
20516 compilers access floating-point arguments that do not fit in the
20517 RSA from the stack when a subroutine is compiled without
20518 optimization. Because always storing floating-point arguments on the
20519 stack is inefficient and rarely needed, this option is not enabled by
20520 default and only is necessary when calling subroutines compiled by IBM
20521 XL compilers without optimization.
20522
20523 @item -mpe
20524 @opindex mpe
20525 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
20526 application written to use message passing with special startup code to
20527 enable the application to run. The system must have PE installed in the
20528 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
20529 must be overridden with the @option{-specs=} option to specify the
20530 appropriate directory location. The Parallel Environment does not
20531 support threads, so the @option{-mpe} option and the @option{-pthread}
20532 option are incompatible.
20533
20534 @item -malign-natural
20535 @itemx -malign-power
20536 @opindex malign-natural
20537 @opindex malign-power
20538 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
20539 @option{-malign-natural} overrides the ABI-defined alignment of larger
20540 types, such as floating-point doubles, on their natural size-based boundary.
20541 The option @option{-malign-power} instructs GCC to follow the ABI-specified
20542 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
20543
20544 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
20545 is not supported.
20546
20547 @item -msoft-float
20548 @itemx -mhard-float
20549 @opindex msoft-float
20550 @opindex mhard-float
20551 Generate code that does not use (uses) the floating-point register set.
20552 Software floating-point emulation is provided if you use the
20553 @option{-msoft-float} option, and pass the option to GCC when linking.
20554
20555 @item -msingle-float
20556 @itemx -mdouble-float
20557 @opindex msingle-float
20558 @opindex mdouble-float
20559 Generate code for single- or double-precision floating-point operations.
20560 @option{-mdouble-float} implies @option{-msingle-float}.
20561
20562 @item -msimple-fpu
20563 @opindex msimple-fpu
20564 Do not generate @code{sqrt} and @code{div} instructions for hardware
20565 floating-point unit.
20566
20567 @item -mfpu=@var{name}
20568 @opindex mfpu
20569 Specify type of floating-point unit. Valid values for @var{name} are
20570 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
20571 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
20572 @samp{sp_full} (equivalent to @option{-msingle-float}),
20573 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
20574
20575 @item -mxilinx-fpu
20576 @opindex mxilinx-fpu
20577 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
20578
20579 @item -mmultiple
20580 @itemx -mno-multiple
20581 @opindex mmultiple
20582 @opindex mno-multiple
20583 Generate code that uses (does not use) the load multiple word
20584 instructions and the store multiple word instructions. These
20585 instructions are generated by default on POWER systems, and not
20586 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
20587 PowerPC systems, since those instructions do not work when the
20588 processor is in little-endian mode. The exceptions are PPC740 and
20589 PPC750 which permit these instructions in little-endian mode.
20590
20591 @item -mstring
20592 @itemx -mno-string
20593 @opindex mstring
20594 @opindex mno-string
20595 Generate code that uses (does not use) the load string instructions
20596 and the store string word instructions to save multiple registers and
20597 do small block moves. These instructions are generated by default on
20598 POWER systems, and not generated on PowerPC systems. Do not use
20599 @option{-mstring} on little-endian PowerPC systems, since those
20600 instructions do not work when the processor is in little-endian mode.
20601 The exceptions are PPC740 and PPC750 which permit these instructions
20602 in little-endian mode.
20603
20604 @item -mupdate
20605 @itemx -mno-update
20606 @opindex mupdate
20607 @opindex mno-update
20608 Generate code that uses (does not use) the load or store instructions
20609 that update the base register to the address of the calculated memory
20610 location. These instructions are generated by default. If you use
20611 @option{-mno-update}, there is a small window between the time that the
20612 stack pointer is updated and the address of the previous frame is
20613 stored, which means code that walks the stack frame across interrupts or
20614 signals may get corrupted data.
20615
20616 @item -mavoid-indexed-addresses
20617 @itemx -mno-avoid-indexed-addresses
20618 @opindex mavoid-indexed-addresses
20619 @opindex mno-avoid-indexed-addresses
20620 Generate code that tries to avoid (not avoid) the use of indexed load
20621 or store instructions. These instructions can incur a performance
20622 penalty on Power6 processors in certain situations, such as when
20623 stepping through large arrays that cross a 16M boundary. This option
20624 is enabled by default when targeting Power6 and disabled otherwise.
20625
20626 @item -mfused-madd
20627 @itemx -mno-fused-madd
20628 @opindex mfused-madd
20629 @opindex mno-fused-madd
20630 Generate code that uses (does not use) the floating-point multiply and
20631 accumulate instructions. These instructions are generated by default
20632 if hardware floating point is used. The machine-dependent
20633 @option{-mfused-madd} option is now mapped to the machine-independent
20634 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
20635 mapped to @option{-ffp-contract=off}.
20636
20637 @item -mmulhw
20638 @itemx -mno-mulhw
20639 @opindex mmulhw
20640 @opindex mno-mulhw
20641 Generate code that uses (does not use) the half-word multiply and
20642 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
20643 These instructions are generated by default when targeting those
20644 processors.
20645
20646 @item -mdlmzb
20647 @itemx -mno-dlmzb
20648 @opindex mdlmzb
20649 @opindex mno-dlmzb
20650 Generate code that uses (does not use) the string-search @samp{dlmzb}
20651 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
20652 generated by default when targeting those processors.
20653
20654 @item -mno-bit-align
20655 @itemx -mbit-align
20656 @opindex mno-bit-align
20657 @opindex mbit-align
20658 On System V.4 and embedded PowerPC systems do not (do) force structures
20659 and unions that contain bit-fields to be aligned to the base type of the
20660 bit-field.
20661
20662 For example, by default a structure containing nothing but 8
20663 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
20664 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
20665 the structure is aligned to a 1-byte boundary and is 1 byte in
20666 size.
20667
20668 @item -mno-strict-align
20669 @itemx -mstrict-align
20670 @opindex mno-strict-align
20671 @opindex mstrict-align
20672 On System V.4 and embedded PowerPC systems do not (do) assume that
20673 unaligned memory references are handled by the system.
20674
20675 @item -mrelocatable
20676 @itemx -mno-relocatable
20677 @opindex mrelocatable
20678 @opindex mno-relocatable
20679 Generate code that allows (does not allow) a static executable to be
20680 relocated to a different address at run time. A simple embedded
20681 PowerPC system loader should relocate the entire contents of
20682 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
20683 a table of 32-bit addresses generated by this option. For this to
20684 work, all objects linked together must be compiled with
20685 @option{-mrelocatable} or @option{-mrelocatable-lib}.
20686 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
20687
20688 @item -mrelocatable-lib
20689 @itemx -mno-relocatable-lib
20690 @opindex mrelocatable-lib
20691 @opindex mno-relocatable-lib
20692 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
20693 @code{.fixup} section to allow static executables to be relocated at
20694 run time, but @option{-mrelocatable-lib} does not use the smaller stack
20695 alignment of @option{-mrelocatable}. Objects compiled with
20696 @option{-mrelocatable-lib} may be linked with objects compiled with
20697 any combination of the @option{-mrelocatable} options.
20698
20699 @item -mno-toc
20700 @itemx -mtoc
20701 @opindex mno-toc
20702 @opindex mtoc
20703 On System V.4 and embedded PowerPC systems do not (do) assume that
20704 register 2 contains a pointer to a global area pointing to the addresses
20705 used in the program.
20706
20707 @item -mlittle
20708 @itemx -mlittle-endian
20709 @opindex mlittle
20710 @opindex mlittle-endian
20711 On System V.4 and embedded PowerPC systems compile code for the
20712 processor in little-endian mode. The @option{-mlittle-endian} option is
20713 the same as @option{-mlittle}.
20714
20715 @item -mbig
20716 @itemx -mbig-endian
20717 @opindex mbig
20718 @opindex mbig-endian
20719 On System V.4 and embedded PowerPC systems compile code for the
20720 processor in big-endian mode. The @option{-mbig-endian} option is
20721 the same as @option{-mbig}.
20722
20723 @item -mdynamic-no-pic
20724 @opindex mdynamic-no-pic
20725 On Darwin and Mac OS X systems, compile code so that it is not
20726 relocatable, but that its external references are relocatable. The
20727 resulting code is suitable for applications, but not shared
20728 libraries.
20729
20730 @item -msingle-pic-base
20731 @opindex msingle-pic-base
20732 Treat the register used for PIC addressing as read-only, rather than
20733 loading it in the prologue for each function. The runtime system is
20734 responsible for initializing this register with an appropriate value
20735 before execution begins.
20736
20737 @item -mprioritize-restricted-insns=@var{priority}
20738 @opindex mprioritize-restricted-insns
20739 This option controls the priority that is assigned to
20740 dispatch-slot restricted instructions during the second scheduling
20741 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
20742 or @samp{2} to assign no, highest, or second-highest (respectively)
20743 priority to dispatch-slot restricted
20744 instructions.
20745
20746 @item -msched-costly-dep=@var{dependence_type}
20747 @opindex msched-costly-dep
20748 This option controls which dependences are considered costly
20749 by the target during instruction scheduling. The argument
20750 @var{dependence_type} takes one of the following values:
20751
20752 @table @asis
20753 @item @samp{no}
20754 No dependence is costly.
20755
20756 @item @samp{all}
20757 All dependences are costly.
20758
20759 @item @samp{true_store_to_load}
20760 A true dependence from store to load is costly.
20761
20762 @item @samp{store_to_load}
20763 Any dependence from store to load is costly.
20764
20765 @item @var{number}
20766 Any dependence for which the latency is greater than or equal to
20767 @var{number} is costly.
20768 @end table
20769
20770 @item -minsert-sched-nops=@var{scheme}
20771 @opindex minsert-sched-nops
20772 This option controls which NOP insertion scheme is used during
20773 the second scheduling pass. The argument @var{scheme} takes one of the
20774 following values:
20775
20776 @table @asis
20777 @item @samp{no}
20778 Don't insert NOPs.
20779
20780 @item @samp{pad}
20781 Pad with NOPs any dispatch group that has vacant issue slots,
20782 according to the scheduler's grouping.
20783
20784 @item @samp{regroup_exact}
20785 Insert NOPs to force costly dependent insns into
20786 separate groups. Insert exactly as many NOPs as needed to force an insn
20787 to a new group, according to the estimated processor grouping.
20788
20789 @item @var{number}
20790 Insert NOPs to force costly dependent insns into
20791 separate groups. Insert @var{number} NOPs to force an insn to a new group.
20792 @end table
20793
20794 @item -mcall-sysv
20795 @opindex mcall-sysv
20796 On System V.4 and embedded PowerPC systems compile code using calling
20797 conventions that adhere to the March 1995 draft of the System V
20798 Application Binary Interface, PowerPC processor supplement. This is the
20799 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
20800
20801 @item -mcall-sysv-eabi
20802 @itemx -mcall-eabi
20803 @opindex mcall-sysv-eabi
20804 @opindex mcall-eabi
20805 Specify both @option{-mcall-sysv} and @option{-meabi} options.
20806
20807 @item -mcall-sysv-noeabi
20808 @opindex mcall-sysv-noeabi
20809 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
20810
20811 @item -mcall-aixdesc
20812 @opindex m
20813 On System V.4 and embedded PowerPC systems compile code for the AIX
20814 operating system.
20815
20816 @item -mcall-linux
20817 @opindex mcall-linux
20818 On System V.4 and embedded PowerPC systems compile code for the
20819 Linux-based GNU system.
20820
20821 @item -mcall-freebsd
20822 @opindex mcall-freebsd
20823 On System V.4 and embedded PowerPC systems compile code for the
20824 FreeBSD operating system.
20825
20826 @item -mcall-netbsd
20827 @opindex mcall-netbsd
20828 On System V.4 and embedded PowerPC systems compile code for the
20829 NetBSD operating system.
20830
20831 @item -mcall-openbsd
20832 @opindex mcall-netbsd
20833 On System V.4 and embedded PowerPC systems compile code for the
20834 OpenBSD operating system.
20835
20836 @item -maix-struct-return
20837 @opindex maix-struct-return
20838 Return all structures in memory (as specified by the AIX ABI)@.
20839
20840 @item -msvr4-struct-return
20841 @opindex msvr4-struct-return
20842 Return structures smaller than 8 bytes in registers (as specified by the
20843 SVR4 ABI)@.
20844
20845 @item -mabi=@var{abi-type}
20846 @opindex mabi
20847 Extend the current ABI with a particular extension, or remove such extension.
20848 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
20849 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
20850 @samp{elfv1}, @samp{elfv2}@.
20851
20852 @item -mabi=spe
20853 @opindex mabi=spe
20854 Extend the current ABI with SPE ABI extensions. This does not change
20855 the default ABI, instead it adds the SPE ABI extensions to the current
20856 ABI@.
20857
20858 @item -mabi=no-spe
20859 @opindex mabi=no-spe
20860 Disable Book-E SPE ABI extensions for the current ABI@.
20861
20862 @item -mabi=ibmlongdouble
20863 @opindex mabi=ibmlongdouble
20864 Change the current ABI to use IBM extended-precision long double.
20865 This is a PowerPC 32-bit SYSV ABI option.
20866
20867 @item -mabi=ieeelongdouble
20868 @opindex mabi=ieeelongdouble
20869 Change the current ABI to use IEEE extended-precision long double.
20870 This is a PowerPC 32-bit Linux ABI option.
20871
20872 @item -mabi=elfv1
20873 @opindex mabi=elfv1
20874 Change the current ABI to use the ELFv1 ABI.
20875 This is the default ABI for big-endian PowerPC 64-bit Linux.
20876 Overriding the default ABI requires special system support and is
20877 likely to fail in spectacular ways.
20878
20879 @item -mabi=elfv2
20880 @opindex mabi=elfv2
20881 Change the current ABI to use the ELFv2 ABI.
20882 This is the default ABI for little-endian PowerPC 64-bit Linux.
20883 Overriding the default ABI requires special system support and is
20884 likely to fail in spectacular ways.
20885
20886 @item -mprototype
20887 @itemx -mno-prototype
20888 @opindex mprototype
20889 @opindex mno-prototype
20890 On System V.4 and embedded PowerPC systems assume that all calls to
20891 variable argument functions are properly prototyped. Otherwise, the
20892 compiler must insert an instruction before every non-prototyped call to
20893 set or clear bit 6 of the condition code register (@code{CR}) to
20894 indicate whether floating-point values are passed in the floating-point
20895 registers in case the function takes variable arguments. With
20896 @option{-mprototype}, only calls to prototyped variable argument functions
20897 set or clear the bit.
20898
20899 @item -msim
20900 @opindex msim
20901 On embedded PowerPC systems, assume that the startup module is called
20902 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
20903 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
20904 configurations.
20905
20906 @item -mmvme
20907 @opindex mmvme
20908 On embedded PowerPC systems, assume that the startup module is called
20909 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
20910 @file{libc.a}.
20911
20912 @item -mads
20913 @opindex mads
20914 On embedded PowerPC systems, assume that the startup module is called
20915 @file{crt0.o} and the standard C libraries are @file{libads.a} and
20916 @file{libc.a}.
20917
20918 @item -myellowknife
20919 @opindex myellowknife
20920 On embedded PowerPC systems, assume that the startup module is called
20921 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
20922 @file{libc.a}.
20923
20924 @item -mvxworks
20925 @opindex mvxworks
20926 On System V.4 and embedded PowerPC systems, specify that you are
20927 compiling for a VxWorks system.
20928
20929 @item -memb
20930 @opindex memb
20931 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
20932 header to indicate that @samp{eabi} extended relocations are used.
20933
20934 @item -meabi
20935 @itemx -mno-eabi
20936 @opindex meabi
20937 @opindex mno-eabi
20938 On System V.4 and embedded PowerPC systems do (do not) adhere to the
20939 Embedded Applications Binary Interface (EABI), which is a set of
20940 modifications to the System V.4 specifications. Selecting @option{-meabi}
20941 means that the stack is aligned to an 8-byte boundary, a function
20942 @code{__eabi} is called from @code{main} to set up the EABI
20943 environment, and the @option{-msdata} option can use both @code{r2} and
20944 @code{r13} to point to two separate small data areas. Selecting
20945 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
20946 no EABI initialization function is called from @code{main}, and the
20947 @option{-msdata} option only uses @code{r13} to point to a single
20948 small data area. The @option{-meabi} option is on by default if you
20949 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
20950
20951 @item -msdata=eabi
20952 @opindex msdata=eabi
20953 On System V.4 and embedded PowerPC systems, put small initialized
20954 @code{const} global and static data in the @code{.sdata2} section, which
20955 is pointed to by register @code{r2}. Put small initialized
20956 non-@code{const} global and static data in the @code{.sdata} section,
20957 which is pointed to by register @code{r13}. Put small uninitialized
20958 global and static data in the @code{.sbss} section, which is adjacent to
20959 the @code{.sdata} section. The @option{-msdata=eabi} option is
20960 incompatible with the @option{-mrelocatable} option. The
20961 @option{-msdata=eabi} option also sets the @option{-memb} option.
20962
20963 @item -msdata=sysv
20964 @opindex msdata=sysv
20965 On System V.4 and embedded PowerPC systems, put small global and static
20966 data in the @code{.sdata} section, which is pointed to by register
20967 @code{r13}. Put small uninitialized global and static data in the
20968 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
20969 The @option{-msdata=sysv} option is incompatible with the
20970 @option{-mrelocatable} option.
20971
20972 @item -msdata=default
20973 @itemx -msdata
20974 @opindex msdata=default
20975 @opindex msdata
20976 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
20977 compile code the same as @option{-msdata=eabi}, otherwise compile code the
20978 same as @option{-msdata=sysv}.
20979
20980 @item -msdata=data
20981 @opindex msdata=data
20982 On System V.4 and embedded PowerPC systems, put small global
20983 data in the @code{.sdata} section. Put small uninitialized global
20984 data in the @code{.sbss} section. Do not use register @code{r13}
20985 to address small data however. This is the default behavior unless
20986 other @option{-msdata} options are used.
20987
20988 @item -msdata=none
20989 @itemx -mno-sdata
20990 @opindex msdata=none
20991 @opindex mno-sdata
20992 On embedded PowerPC systems, put all initialized global and static data
20993 in the @code{.data} section, and all uninitialized data in the
20994 @code{.bss} section.
20995
20996 @item -mblock-move-inline-limit=@var{num}
20997 @opindex mblock-move-inline-limit
20998 Inline all block moves (such as calls to @code{memcpy} or structure
20999 copies) less than or equal to @var{num} bytes. The minimum value for
21000 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
21001 targets. The default value is target-specific.
21002
21003 @item -G @var{num}
21004 @opindex G
21005 @cindex smaller data references (PowerPC)
21006 @cindex .sdata/.sdata2 references (PowerPC)
21007 On embedded PowerPC systems, put global and static items less than or
21008 equal to @var{num} bytes into the small data or BSS sections instead of
21009 the normal data or BSS section. By default, @var{num} is 8. The
21010 @option{-G @var{num}} switch is also passed to the linker.
21011 All modules should be compiled with the same @option{-G @var{num}} value.
21012
21013 @item -mregnames
21014 @itemx -mno-regnames
21015 @opindex mregnames
21016 @opindex mno-regnames
21017 On System V.4 and embedded PowerPC systems do (do not) emit register
21018 names in the assembly language output using symbolic forms.
21019
21020 @item -mlongcall
21021 @itemx -mno-longcall
21022 @opindex mlongcall
21023 @opindex mno-longcall
21024 By default assume that all calls are far away so that a longer and more
21025 expensive calling sequence is required. This is required for calls
21026 farther than 32 megabytes (33,554,432 bytes) from the current location.
21027 A short call is generated if the compiler knows
21028 the call cannot be that far away. This setting can be overridden by
21029 the @code{shortcall} function attribute, or by @code{#pragma
21030 longcall(0)}.
21031
21032 Some linkers are capable of detecting out-of-range calls and generating
21033 glue code on the fly. On these systems, long calls are unnecessary and
21034 generate slower code. As of this writing, the AIX linker can do this,
21035 as can the GNU linker for PowerPC/64. It is planned to add this feature
21036 to the GNU linker for 32-bit PowerPC systems as well.
21037
21038 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
21039 callee, L42}, plus a @dfn{branch island} (glue code). The two target
21040 addresses represent the callee and the branch island. The
21041 Darwin/PPC linker prefers the first address and generates a @code{bl
21042 callee} if the PPC @code{bl} instruction reaches the callee directly;
21043 otherwise, the linker generates @code{bl L42} to call the branch
21044 island. The branch island is appended to the body of the
21045 calling function; it computes the full 32-bit address of the callee
21046 and jumps to it.
21047
21048 On Mach-O (Darwin) systems, this option directs the compiler emit to
21049 the glue for every direct call, and the Darwin linker decides whether
21050 to use or discard it.
21051
21052 In the future, GCC may ignore all longcall specifications
21053 when the linker is known to generate glue.
21054
21055 @item -mtls-markers
21056 @itemx -mno-tls-markers
21057 @opindex mtls-markers
21058 @opindex mno-tls-markers
21059 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
21060 specifying the function argument. The relocation allows the linker to
21061 reliably associate function call with argument setup instructions for
21062 TLS optimization, which in turn allows GCC to better schedule the
21063 sequence.
21064
21065 @item -pthread
21066 @opindex pthread
21067 Adds support for multithreading with the @dfn{pthreads} library.
21068 This option sets flags for both the preprocessor and linker.
21069
21070 @item -mrecip
21071 @itemx -mno-recip
21072 @opindex mrecip
21073 This option enables use of the reciprocal estimate and
21074 reciprocal square root estimate instructions with additional
21075 Newton-Raphson steps to increase precision instead of doing a divide or
21076 square root and divide for floating-point arguments. You should use
21077 the @option{-ffast-math} option when using @option{-mrecip} (or at
21078 least @option{-funsafe-math-optimizations},
21079 @option{-ffinite-math-only}, @option{-freciprocal-math} and
21080 @option{-fno-trapping-math}). Note that while the throughput of the
21081 sequence is generally higher than the throughput of the non-reciprocal
21082 instruction, the precision of the sequence can be decreased by up to 2
21083 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
21084 roots.
21085
21086 @item -mrecip=@var{opt}
21087 @opindex mrecip=opt
21088 This option controls which reciprocal estimate instructions
21089 may be used. @var{opt} is a comma-separated list of options, which may
21090 be preceded by a @code{!} to invert the option:
21091
21092 @table @samp
21093
21094 @item all
21095 Enable all estimate instructions.
21096
21097 @item default
21098 Enable the default instructions, equivalent to @option{-mrecip}.
21099
21100 @item none
21101 Disable all estimate instructions, equivalent to @option{-mno-recip}.
21102
21103 @item div
21104 Enable the reciprocal approximation instructions for both
21105 single and double precision.
21106
21107 @item divf
21108 Enable the single-precision reciprocal approximation instructions.
21109
21110 @item divd
21111 Enable the double-precision reciprocal approximation instructions.
21112
21113 @item rsqrt
21114 Enable the reciprocal square root approximation instructions for both
21115 single and double precision.
21116
21117 @item rsqrtf
21118 Enable the single-precision reciprocal square root approximation instructions.
21119
21120 @item rsqrtd
21121 Enable the double-precision reciprocal square root approximation instructions.
21122
21123 @end table
21124
21125 So, for example, @option{-mrecip=all,!rsqrtd} enables
21126 all of the reciprocal estimate instructions, except for the
21127 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
21128 which handle the double-precision reciprocal square root calculations.
21129
21130 @item -mrecip-precision
21131 @itemx -mno-recip-precision
21132 @opindex mrecip-precision
21133 Assume (do not assume) that the reciprocal estimate instructions
21134 provide higher-precision estimates than is mandated by the PowerPC
21135 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
21136 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
21137 The double-precision square root estimate instructions are not generated by
21138 default on low-precision machines, since they do not provide an
21139 estimate that converges after three steps.
21140
21141 @item -mveclibabi=@var{type}
21142 @opindex mveclibabi
21143 Specifies the ABI type to use for vectorizing intrinsics using an
21144 external library. The only type supported at present is @samp{mass},
21145 which specifies to use IBM's Mathematical Acceleration Subsystem
21146 (MASS) libraries for vectorizing intrinsics using external libraries.
21147 GCC currently emits calls to @code{acosd2}, @code{acosf4},
21148 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
21149 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
21150 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
21151 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
21152 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
21153 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
21154 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
21155 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
21156 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
21157 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
21158 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
21159 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
21160 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
21161 for power7. Both @option{-ftree-vectorize} and
21162 @option{-funsafe-math-optimizations} must also be enabled. The MASS
21163 libraries must be specified at link time.
21164
21165 @item -mfriz
21166 @itemx -mno-friz
21167 @opindex mfriz
21168 Generate (do not generate) the @code{friz} instruction when the
21169 @option{-funsafe-math-optimizations} option is used to optimize
21170 rounding of floating-point values to 64-bit integer and back to floating
21171 point. The @code{friz} instruction does not return the same value if
21172 the floating-point number is too large to fit in an integer.
21173
21174 @item -mpointers-to-nested-functions
21175 @itemx -mno-pointers-to-nested-functions
21176 @opindex mpointers-to-nested-functions
21177 Generate (do not generate) code to load up the static chain register
21178 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
21179 systems where a function pointer points to a 3-word descriptor giving
21180 the function address, TOC value to be loaded in register @code{r2}, and
21181 static chain value to be loaded in register @code{r11}. The
21182 @option{-mpointers-to-nested-functions} is on by default. You cannot
21183 call through pointers to nested functions or pointers
21184 to functions compiled in other languages that use the static chain if
21185 you use @option{-mno-pointers-to-nested-functions}.
21186
21187 @item -msave-toc-indirect
21188 @itemx -mno-save-toc-indirect
21189 @opindex msave-toc-indirect
21190 Generate (do not generate) code to save the TOC value in the reserved
21191 stack location in the function prologue if the function calls through
21192 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
21193 saved in the prologue, it is saved just before the call through the
21194 pointer. The @option{-mno-save-toc-indirect} option is the default.
21195
21196 @item -mcompat-align-parm
21197 @itemx -mno-compat-align-parm
21198 @opindex mcompat-align-parm
21199 Generate (do not generate) code to pass structure parameters with a
21200 maximum alignment of 64 bits, for compatibility with older versions
21201 of GCC.
21202
21203 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
21204 structure parameter on a 128-bit boundary when that structure contained
21205 a member requiring 128-bit alignment. This is corrected in more
21206 recent versions of GCC. This option may be used to generate code
21207 that is compatible with functions compiled with older versions of
21208 GCC.
21209
21210 The @option{-mno-compat-align-parm} option is the default.
21211 @end table
21212
21213 @node RX Options
21214 @subsection RX Options
21215 @cindex RX Options
21216
21217 These command-line options are defined for RX targets:
21218
21219 @table @gcctabopt
21220 @item -m64bit-doubles
21221 @itemx -m32bit-doubles
21222 @opindex m64bit-doubles
21223 @opindex m32bit-doubles
21224 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
21225 or 32 bits (@option{-m32bit-doubles}) in size. The default is
21226 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
21227 works on 32-bit values, which is why the default is
21228 @option{-m32bit-doubles}.
21229
21230 @item -fpu
21231 @itemx -nofpu
21232 @opindex fpu
21233 @opindex nofpu
21234 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
21235 floating-point hardware. The default is enabled for the RX600
21236 series and disabled for the RX200 series.
21237
21238 Floating-point instructions are only generated for 32-bit floating-point
21239 values, however, so the FPU hardware is not used for doubles if the
21240 @option{-m64bit-doubles} option is used.
21241
21242 @emph{Note} If the @option{-fpu} option is enabled then
21243 @option{-funsafe-math-optimizations} is also enabled automatically.
21244 This is because the RX FPU instructions are themselves unsafe.
21245
21246 @item -mcpu=@var{name}
21247 @opindex mcpu
21248 Selects the type of RX CPU to be targeted. Currently three types are
21249 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
21250 the specific @samp{RX610} CPU. The default is @samp{RX600}.
21251
21252 The only difference between @samp{RX600} and @samp{RX610} is that the
21253 @samp{RX610} does not support the @code{MVTIPL} instruction.
21254
21255 The @samp{RX200} series does not have a hardware floating-point unit
21256 and so @option{-nofpu} is enabled by default when this type is
21257 selected.
21258
21259 @item -mbig-endian-data
21260 @itemx -mlittle-endian-data
21261 @opindex mbig-endian-data
21262 @opindex mlittle-endian-data
21263 Store data (but not code) in the big-endian format. The default is
21264 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
21265 format.
21266
21267 @item -msmall-data-limit=@var{N}
21268 @opindex msmall-data-limit
21269 Specifies the maximum size in bytes of global and static variables
21270 which can be placed into the small data area. Using the small data
21271 area can lead to smaller and faster code, but the size of area is
21272 limited and it is up to the programmer to ensure that the area does
21273 not overflow. Also when the small data area is used one of the RX's
21274 registers (usually @code{r13}) is reserved for use pointing to this
21275 area, so it is no longer available for use by the compiler. This
21276 could result in slower and/or larger code if variables are pushed onto
21277 the stack instead of being held in this register.
21278
21279 Note, common variables (variables that have not been initialized) and
21280 constants are not placed into the small data area as they are assigned
21281 to other sections in the output executable.
21282
21283 The default value is zero, which disables this feature. Note, this
21284 feature is not enabled by default with higher optimization levels
21285 (@option{-O2} etc) because of the potentially detrimental effects of
21286 reserving a register. It is up to the programmer to experiment and
21287 discover whether this feature is of benefit to their program. See the
21288 description of the @option{-mpid} option for a description of how the
21289 actual register to hold the small data area pointer is chosen.
21290
21291 @item -msim
21292 @itemx -mno-sim
21293 @opindex msim
21294 @opindex mno-sim
21295 Use the simulator runtime. The default is to use the libgloss
21296 board-specific runtime.
21297
21298 @item -mas100-syntax
21299 @itemx -mno-as100-syntax
21300 @opindex mas100-syntax
21301 @opindex mno-as100-syntax
21302 When generating assembler output use a syntax that is compatible with
21303 Renesas's AS100 assembler. This syntax can also be handled by the GAS
21304 assembler, but it has some restrictions so it is not generated by default.
21305
21306 @item -mmax-constant-size=@var{N}
21307 @opindex mmax-constant-size
21308 Specifies the maximum size, in bytes, of a constant that can be used as
21309 an operand in a RX instruction. Although the RX instruction set does
21310 allow constants of up to 4 bytes in length to be used in instructions,
21311 a longer value equates to a longer instruction. Thus in some
21312 circumstances it can be beneficial to restrict the size of constants
21313 that are used in instructions. Constants that are too big are instead
21314 placed into a constant pool and referenced via register indirection.
21315
21316 The value @var{N} can be between 0 and 4. A value of 0 (the default)
21317 or 4 means that constants of any size are allowed.
21318
21319 @item -mrelax
21320 @opindex mrelax
21321 Enable linker relaxation. Linker relaxation is a process whereby the
21322 linker attempts to reduce the size of a program by finding shorter
21323 versions of various instructions. Disabled by default.
21324
21325 @item -mint-register=@var{N}
21326 @opindex mint-register
21327 Specify the number of registers to reserve for fast interrupt handler
21328 functions. The value @var{N} can be between 0 and 4. A value of 1
21329 means that register @code{r13} is reserved for the exclusive use
21330 of fast interrupt handlers. A value of 2 reserves @code{r13} and
21331 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
21332 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
21333 A value of 0, the default, does not reserve any registers.
21334
21335 @item -msave-acc-in-interrupts
21336 @opindex msave-acc-in-interrupts
21337 Specifies that interrupt handler functions should preserve the
21338 accumulator register. This is only necessary if normal code might use
21339 the accumulator register, for example because it performs 64-bit
21340 multiplications. The default is to ignore the accumulator as this
21341 makes the interrupt handlers faster.
21342
21343 @item -mpid
21344 @itemx -mno-pid
21345 @opindex mpid
21346 @opindex mno-pid
21347 Enables the generation of position independent data. When enabled any
21348 access to constant data is done via an offset from a base address
21349 held in a register. This allows the location of constant data to be
21350 determined at run time without requiring the executable to be
21351 relocated, which is a benefit to embedded applications with tight
21352 memory constraints. Data that can be modified is not affected by this
21353 option.
21354
21355 Note, using this feature reserves a register, usually @code{r13}, for
21356 the constant data base address. This can result in slower and/or
21357 larger code, especially in complicated functions.
21358
21359 The actual register chosen to hold the constant data base address
21360 depends upon whether the @option{-msmall-data-limit} and/or the
21361 @option{-mint-register} command-line options are enabled. Starting
21362 with register @code{r13} and proceeding downwards, registers are
21363 allocated first to satisfy the requirements of @option{-mint-register},
21364 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
21365 is possible for the small data area register to be @code{r8} if both
21366 @option{-mint-register=4} and @option{-mpid} are specified on the
21367 command line.
21368
21369 By default this feature is not enabled. The default can be restored
21370 via the @option{-mno-pid} command-line option.
21371
21372 @item -mno-warn-multiple-fast-interrupts
21373 @itemx -mwarn-multiple-fast-interrupts
21374 @opindex mno-warn-multiple-fast-interrupts
21375 @opindex mwarn-multiple-fast-interrupts
21376 Prevents GCC from issuing a warning message if it finds more than one
21377 fast interrupt handler when it is compiling a file. The default is to
21378 issue a warning for each extra fast interrupt handler found, as the RX
21379 only supports one such interrupt.
21380
21381 @item -mallow-string-insns
21382 @itemx -mno-allow-string-insns
21383 @opindex mallow-string-insns
21384 @opindex mno-allow-string-insns
21385 Enables or disables the use of the string manipulation instructions
21386 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
21387 @code{SWHILE} and also the @code{RMPA} instruction. These
21388 instructions may prefetch data, which is not safe to do if accessing
21389 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
21390 for more information).
21391
21392 The default is to allow these instructions, but it is not possible for
21393 GCC to reliably detect all circumstances where a string instruction
21394 might be used to access an I/O register, so their use cannot be
21395 disabled automatically. Instead it is reliant upon the programmer to
21396 use the @option{-mno-allow-string-insns} option if their program
21397 accesses I/O space.
21398
21399 When the instructions are enabled GCC defines the C preprocessor
21400 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
21401 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
21402
21403 @item -mjsr
21404 @itemx -mno-jsr
21405 @opindex mjsr
21406 @opindex mno-jsr
21407 Use only (or not only) @code{JSR} instructions to access functions.
21408 This option can be used when code size exceeds the range of @code{BSR}
21409 instructions. Note that @option{-mno-jsr} does not mean to not use
21410 @code{JSR} but instead means that any type of branch may be used.
21411 @end table
21412
21413 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
21414 has special significance to the RX port when used with the
21415 @code{interrupt} function attribute. This attribute indicates a
21416 function intended to process fast interrupts. GCC ensures
21417 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
21418 and/or @code{r13} and only provided that the normal use of the
21419 corresponding registers have been restricted via the
21420 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
21421 options.
21422
21423 @node S/390 and zSeries Options
21424 @subsection S/390 and zSeries Options
21425 @cindex S/390 and zSeries Options
21426
21427 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
21428
21429 @table @gcctabopt
21430 @item -mhard-float
21431 @itemx -msoft-float
21432 @opindex mhard-float
21433 @opindex msoft-float
21434 Use (do not use) the hardware floating-point instructions and registers
21435 for floating-point operations. When @option{-msoft-float} is specified,
21436 functions in @file{libgcc.a} are used to perform floating-point
21437 operations. When @option{-mhard-float} is specified, the compiler
21438 generates IEEE floating-point instructions. This is the default.
21439
21440 @item -mhard-dfp
21441 @itemx -mno-hard-dfp
21442 @opindex mhard-dfp
21443 @opindex mno-hard-dfp
21444 Use (do not use) the hardware decimal-floating-point instructions for
21445 decimal-floating-point operations. When @option{-mno-hard-dfp} is
21446 specified, functions in @file{libgcc.a} are used to perform
21447 decimal-floating-point operations. When @option{-mhard-dfp} is
21448 specified, the compiler generates decimal-floating-point hardware
21449 instructions. This is the default for @option{-march=z9-ec} or higher.
21450
21451 @item -mlong-double-64
21452 @itemx -mlong-double-128
21453 @opindex mlong-double-64
21454 @opindex mlong-double-128
21455 These switches control the size of @code{long double} type. A size
21456 of 64 bits makes the @code{long double} type equivalent to the @code{double}
21457 type. This is the default.
21458
21459 @item -mbackchain
21460 @itemx -mno-backchain
21461 @opindex mbackchain
21462 @opindex mno-backchain
21463 Store (do not store) the address of the caller's frame as backchain pointer
21464 into the callee's stack frame.
21465 A backchain may be needed to allow debugging using tools that do not understand
21466 DWARF call frame information.
21467 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
21468 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
21469 the backchain is placed into the topmost word of the 96/160 byte register
21470 save area.
21471
21472 In general, code compiled with @option{-mbackchain} is call-compatible with
21473 code compiled with @option{-mmo-backchain}; however, use of the backchain
21474 for debugging purposes usually requires that the whole binary is built with
21475 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
21476 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21477 to build a linux kernel use @option{-msoft-float}.
21478
21479 The default is to not maintain the backchain.
21480
21481 @item -mpacked-stack
21482 @itemx -mno-packed-stack
21483 @opindex mpacked-stack
21484 @opindex mno-packed-stack
21485 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
21486 specified, the compiler uses the all fields of the 96/160 byte register save
21487 area only for their default purpose; unused fields still take up stack space.
21488 When @option{-mpacked-stack} is specified, register save slots are densely
21489 packed at the top of the register save area; unused space is reused for other
21490 purposes, allowing for more efficient use of the available stack space.
21491 However, when @option{-mbackchain} is also in effect, the topmost word of
21492 the save area is always used to store the backchain, and the return address
21493 register is always saved two words below the backchain.
21494
21495 As long as the stack frame backchain is not used, code generated with
21496 @option{-mpacked-stack} is call-compatible with code generated with
21497 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
21498 S/390 or zSeries generated code that uses the stack frame backchain at run
21499 time, not just for debugging purposes. Such code is not call-compatible
21500 with code compiled with @option{-mpacked-stack}. Also, note that the
21501 combination of @option{-mbackchain},
21502 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21503 to build a linux kernel use @option{-msoft-float}.
21504
21505 The default is to not use the packed stack layout.
21506
21507 @item -msmall-exec
21508 @itemx -mno-small-exec
21509 @opindex msmall-exec
21510 @opindex mno-small-exec
21511 Generate (or do not generate) code using the @code{bras} instruction
21512 to do subroutine calls.
21513 This only works reliably if the total executable size does not
21514 exceed 64k. The default is to use the @code{basr} instruction instead,
21515 which does not have this limitation.
21516
21517 @item -m64
21518 @itemx -m31
21519 @opindex m64
21520 @opindex m31
21521 When @option{-m31} is specified, generate code compliant to the
21522 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
21523 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
21524 particular to generate 64-bit instructions. For the @samp{s390}
21525 targets, the default is @option{-m31}, while the @samp{s390x}
21526 targets default to @option{-m64}.
21527
21528 @item -mzarch
21529 @itemx -mesa
21530 @opindex mzarch
21531 @opindex mesa
21532 When @option{-mzarch} is specified, generate code using the
21533 instructions available on z/Architecture.
21534 When @option{-mesa} is specified, generate code using the
21535 instructions available on ESA/390. Note that @option{-mesa} is
21536 not possible with @option{-m64}.
21537 When generating code compliant to the GNU/Linux for S/390 ABI,
21538 the default is @option{-mesa}. When generating code compliant
21539 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
21540
21541 @item -mhtm
21542 @itemx -mno-htm
21543 @opindex mhtm
21544 @opindex mno-htm
21545 The @option{-mhtm} option enables a set of builtins making use of
21546 instructions available with the transactional execution facility
21547 introduced with the IBM zEnterprise EC12 machine generation
21548 @ref{S/390 System z Built-in Functions}.
21549 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
21550
21551 @item -mvx
21552 @itemx -mno-vx
21553 @opindex mvx
21554 @opindex mno-vx
21555 When @option{-mvx} is specified, generate code using the instructions
21556 available with the vector extension facility introduced with the IBM
21557 z13 machine generation.
21558 This option changes the ABI for some vector type values with regard to
21559 alignment and calling conventions. In case vector type values are
21560 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
21561 command will be added to mark the resulting binary with the ABI used.
21562 @option{-mvx} is enabled by default when using @option{-march=z13}.
21563
21564 @item -mzvector
21565 @itemx -mno-zvector
21566 @opindex mzvector
21567 @opindex mno-zvector
21568 The @option{-mzvector} option enables vector language extensions and
21569 builtins using instructions available with the vector extension
21570 facility introduced with the IBM z13 machine generation.
21571 This option adds support for @samp{vector} to be used as a keyword to
21572 define vector type variables and arguments. @samp{vector} is only
21573 available when GNU extensions are enabled. It will not be expanded
21574 when requesting strict standard compliance e.g. with @option{-std=c99}.
21575 In addition to the GCC low-level builtins @option{-mzvector} enables
21576 a set of builtins added for compatibility with AltiVec-style
21577 implementations like Power and Cell. In order to make use of these
21578 builtins the header file @file{vecintrin.h} needs to be included.
21579 @option{-mzvector} is disabled by default.
21580
21581 @item -mmvcle
21582 @itemx -mno-mvcle
21583 @opindex mmvcle
21584 @opindex mno-mvcle
21585 Generate (or do not generate) code using the @code{mvcle} instruction
21586 to perform block moves. When @option{-mno-mvcle} is specified,
21587 use a @code{mvc} loop instead. This is the default unless optimizing for
21588 size.
21589
21590 @item -mdebug
21591 @itemx -mno-debug
21592 @opindex mdebug
21593 @opindex mno-debug
21594 Print (or do not print) additional debug information when compiling.
21595 The default is to not print debug information.
21596
21597 @item -march=@var{cpu-type}
21598 @opindex march
21599 Generate code that runs on @var{cpu-type}, which is the name of a
21600 system representing a certain processor type. Possible values for
21601 @var{cpu-type} are @samp{z900}, @samp{z990}, @samp{z9-109},
21602 @samp{z9-ec}, @samp{z10}, @samp{z196}, @samp{zEC12}, and @samp{z13}.
21603 The default is @option{-march=z900}. @samp{g5} and @samp{g6} are
21604 deprecated and will be removed with future releases.
21605
21606 @item -mtune=@var{cpu-type}
21607 @opindex mtune
21608 Tune to @var{cpu-type} everything applicable about the generated code,
21609 except for the ABI and the set of available instructions.
21610 The list of @var{cpu-type} values is the same as for @option{-march}.
21611 The default is the value used for @option{-march}.
21612
21613 @item -mtpf-trace
21614 @itemx -mno-tpf-trace
21615 @opindex mtpf-trace
21616 @opindex mno-tpf-trace
21617 Generate code that adds (does not add) in TPF OS specific branches to trace
21618 routines in the operating system. This option is off by default, even
21619 when compiling for the TPF OS@.
21620
21621 @item -mfused-madd
21622 @itemx -mno-fused-madd
21623 @opindex mfused-madd
21624 @opindex mno-fused-madd
21625 Generate code that uses (does not use) the floating-point multiply and
21626 accumulate instructions. These instructions are generated by default if
21627 hardware floating point is used.
21628
21629 @item -mwarn-framesize=@var{framesize}
21630 @opindex mwarn-framesize
21631 Emit a warning if the current function exceeds the given frame size. Because
21632 this is a compile-time check it doesn't need to be a real problem when the program
21633 runs. It is intended to identify functions that most probably cause
21634 a stack overflow. It is useful to be used in an environment with limited stack
21635 size e.g.@: the linux kernel.
21636
21637 @item -mwarn-dynamicstack
21638 @opindex mwarn-dynamicstack
21639 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
21640 arrays. This is generally a bad idea with a limited stack size.
21641
21642 @item -mstack-guard=@var{stack-guard}
21643 @itemx -mstack-size=@var{stack-size}
21644 @opindex mstack-guard
21645 @opindex mstack-size
21646 If these options are provided the S/390 back end emits additional instructions in
21647 the function prologue that trigger a trap if the stack size is @var{stack-guard}
21648 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
21649 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
21650 the frame size of the compiled function is chosen.
21651 These options are intended to be used to help debugging stack overflow problems.
21652 The additionally emitted code causes only little overhead and hence can also be
21653 used in production-like systems without greater performance degradation. The given
21654 values have to be exact powers of 2 and @var{stack-size} has to be greater than
21655 @var{stack-guard} without exceeding 64k.
21656 In order to be efficient the extra code makes the assumption that the stack starts
21657 at an address aligned to the value given by @var{stack-size}.
21658 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
21659
21660 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
21661 @opindex mhotpatch
21662 If the hotpatch option is enabled, a ``hot-patching'' function
21663 prologue is generated for all functions in the compilation unit.
21664 The funtion label is prepended with the given number of two-byte
21665 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
21666 the label, 2 * @var{post-halfwords} bytes are appended, using the
21667 largest NOP like instructions the architecture allows (maximum
21668 1000000).
21669
21670 If both arguments are zero, hotpatching is disabled.
21671
21672 This option can be overridden for individual functions with the
21673 @code{hotpatch} attribute.
21674 @end table
21675
21676 @node Score Options
21677 @subsection Score Options
21678 @cindex Score Options
21679
21680 These options are defined for Score implementations:
21681
21682 @table @gcctabopt
21683 @item -meb
21684 @opindex meb
21685 Compile code for big-endian mode. This is the default.
21686
21687 @item -mel
21688 @opindex mel
21689 Compile code for little-endian mode.
21690
21691 @item -mnhwloop
21692 @opindex mnhwloop
21693 Disable generation of @code{bcnz} instructions.
21694
21695 @item -muls
21696 @opindex muls
21697 Enable generation of unaligned load and store instructions.
21698
21699 @item -mmac
21700 @opindex mmac
21701 Enable the use of multiply-accumulate instructions. Disabled by default.
21702
21703 @item -mscore5
21704 @opindex mscore5
21705 Specify the SCORE5 as the target architecture.
21706
21707 @item -mscore5u
21708 @opindex mscore5u
21709 Specify the SCORE5U of the target architecture.
21710
21711 @item -mscore7
21712 @opindex mscore7
21713 Specify the SCORE7 as the target architecture. This is the default.
21714
21715 @item -mscore7d
21716 @opindex mscore7d
21717 Specify the SCORE7D as the target architecture.
21718 @end table
21719
21720 @node SH Options
21721 @subsection SH Options
21722
21723 These @samp{-m} options are defined for the SH implementations:
21724
21725 @table @gcctabopt
21726 @item -m1
21727 @opindex m1
21728 Generate code for the SH1.
21729
21730 @item -m2
21731 @opindex m2
21732 Generate code for the SH2.
21733
21734 @item -m2e
21735 Generate code for the SH2e.
21736
21737 @item -m2a-nofpu
21738 @opindex m2a-nofpu
21739 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
21740 that the floating-point unit is not used.
21741
21742 @item -m2a-single-only
21743 @opindex m2a-single-only
21744 Generate code for the SH2a-FPU, in such a way that no double-precision
21745 floating-point operations are used.
21746
21747 @item -m2a-single
21748 @opindex m2a-single
21749 Generate code for the SH2a-FPU assuming the floating-point unit is in
21750 single-precision mode by default.
21751
21752 @item -m2a
21753 @opindex m2a
21754 Generate code for the SH2a-FPU assuming the floating-point unit is in
21755 double-precision mode by default.
21756
21757 @item -m3
21758 @opindex m3
21759 Generate code for the SH3.
21760
21761 @item -m3e
21762 @opindex m3e
21763 Generate code for the SH3e.
21764
21765 @item -m4-nofpu
21766 @opindex m4-nofpu
21767 Generate code for the SH4 without a floating-point unit.
21768
21769 @item -m4-single-only
21770 @opindex m4-single-only
21771 Generate code for the SH4 with a floating-point unit that only
21772 supports single-precision arithmetic.
21773
21774 @item -m4-single
21775 @opindex m4-single
21776 Generate code for the SH4 assuming the floating-point unit is in
21777 single-precision mode by default.
21778
21779 @item -m4
21780 @opindex m4
21781 Generate code for the SH4.
21782
21783 @item -m4-100
21784 @opindex m4-100
21785 Generate code for SH4-100.
21786
21787 @item -m4-100-nofpu
21788 @opindex m4-100-nofpu
21789 Generate code for SH4-100 in such a way that the
21790 floating-point unit is not used.
21791
21792 @item -m4-100-single
21793 @opindex m4-100-single
21794 Generate code for SH4-100 assuming the floating-point unit is in
21795 single-precision mode by default.
21796
21797 @item -m4-100-single-only
21798 @opindex m4-100-single-only
21799 Generate code for SH4-100 in such a way that no double-precision
21800 floating-point operations are used.
21801
21802 @item -m4-200
21803 @opindex m4-200
21804 Generate code for SH4-200.
21805
21806 @item -m4-200-nofpu
21807 @opindex m4-200-nofpu
21808 Generate code for SH4-200 without in such a way that the
21809 floating-point unit is not used.
21810
21811 @item -m4-200-single
21812 @opindex m4-200-single
21813 Generate code for SH4-200 assuming the floating-point unit is in
21814 single-precision mode by default.
21815
21816 @item -m4-200-single-only
21817 @opindex m4-200-single-only
21818 Generate code for SH4-200 in such a way that no double-precision
21819 floating-point operations are used.
21820
21821 @item -m4-300
21822 @opindex m4-300
21823 Generate code for SH4-300.
21824
21825 @item -m4-300-nofpu
21826 @opindex m4-300-nofpu
21827 Generate code for SH4-300 without in such a way that the
21828 floating-point unit is not used.
21829
21830 @item -m4-300-single
21831 @opindex m4-300-single
21832 Generate code for SH4-300 in such a way that no double-precision
21833 floating-point operations are used.
21834
21835 @item -m4-300-single-only
21836 @opindex m4-300-single-only
21837 Generate code for SH4-300 in such a way that no double-precision
21838 floating-point operations are used.
21839
21840 @item -m4-340
21841 @opindex m4-340
21842 Generate code for SH4-340 (no MMU, no FPU).
21843
21844 @item -m4-500
21845 @opindex m4-500
21846 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
21847 assembler.
21848
21849 @item -m4a-nofpu
21850 @opindex m4a-nofpu
21851 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
21852 floating-point unit is not used.
21853
21854 @item -m4a-single-only
21855 @opindex m4a-single-only
21856 Generate code for the SH4a, in such a way that no double-precision
21857 floating-point operations are used.
21858
21859 @item -m4a-single
21860 @opindex m4a-single
21861 Generate code for the SH4a assuming the floating-point unit is in
21862 single-precision mode by default.
21863
21864 @item -m4a
21865 @opindex m4a
21866 Generate code for the SH4a.
21867
21868 @item -m4al
21869 @opindex m4al
21870 Same as @option{-m4a-nofpu}, except that it implicitly passes
21871 @option{-dsp} to the assembler. GCC doesn't generate any DSP
21872 instructions at the moment.
21873
21874 @item -mb
21875 @opindex mb
21876 Compile code for the processor in big-endian mode.
21877
21878 @item -ml
21879 @opindex ml
21880 Compile code for the processor in little-endian mode.
21881
21882 @item -mdalign
21883 @opindex mdalign
21884 Align doubles at 64-bit boundaries. Note that this changes the calling
21885 conventions, and thus some functions from the standard C library do
21886 not work unless you recompile it first with @option{-mdalign}.
21887
21888 @item -mrelax
21889 @opindex mrelax
21890 Shorten some address references at link time, when possible; uses the
21891 linker option @option{-relax}.
21892
21893 @item -mbigtable
21894 @opindex mbigtable
21895 Use 32-bit offsets in @code{switch} tables. The default is to use
21896 16-bit offsets.
21897
21898 @item -mbitops
21899 @opindex mbitops
21900 Enable the use of bit manipulation instructions on SH2A.
21901
21902 @item -mfmovd
21903 @opindex mfmovd
21904 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
21905 alignment constraints.
21906
21907 @item -mrenesas
21908 @opindex mrenesas
21909 Comply with the calling conventions defined by Renesas.
21910
21911 @item -mno-renesas
21912 @opindex mno-renesas
21913 Comply with the calling conventions defined for GCC before the Renesas
21914 conventions were available. This option is the default for all
21915 targets of the SH toolchain.
21916
21917 @item -mnomacsave
21918 @opindex mnomacsave
21919 Mark the @code{MAC} register as call-clobbered, even if
21920 @option{-mrenesas} is given.
21921
21922 @item -mieee
21923 @itemx -mno-ieee
21924 @opindex mieee
21925 @opindex mno-ieee
21926 Control the IEEE compliance of floating-point comparisons, which affects the
21927 handling of cases where the result of a comparison is unordered. By default
21928 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
21929 enabled @option{-mno-ieee} is implicitly set, which results in faster
21930 floating-point greater-equal and less-equal comparisons. The implicit settings
21931 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
21932
21933 @item -minline-ic_invalidate
21934 @opindex minline-ic_invalidate
21935 Inline code to invalidate instruction cache entries after setting up
21936 nested function trampolines.
21937 This option has no effect if @option{-musermode} is in effect and the selected
21938 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
21939 instruction.
21940 If the selected code generation option does not allow the use of the @code{icbi}
21941 instruction, and @option{-musermode} is not in effect, the inlined code
21942 manipulates the instruction cache address array directly with an associative
21943 write. This not only requires privileged mode at run time, but it also
21944 fails if the cache line had been mapped via the TLB and has become unmapped.
21945
21946 @item -misize
21947 @opindex misize
21948 Dump instruction size and location in the assembly code.
21949
21950 @item -mpadstruct
21951 @opindex mpadstruct
21952 This option is deprecated. It pads structures to multiple of 4 bytes,
21953 which is incompatible with the SH ABI@.
21954
21955 @item -matomic-model=@var{model}
21956 @opindex matomic-model=@var{model}
21957 Sets the model of atomic operations and additional parameters as a comma
21958 separated list. For details on the atomic built-in functions see
21959 @ref{__atomic Builtins}. The following models and parameters are supported:
21960
21961 @table @samp
21962
21963 @item none
21964 Disable compiler generated atomic sequences and emit library calls for atomic
21965 operations. This is the default if the target is not @code{sh*-*-linux*}.
21966
21967 @item soft-gusa
21968 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
21969 built-in functions. The generated atomic sequences require additional support
21970 from the interrupt/exception handling code of the system and are only suitable
21971 for SH3* and SH4* single-core systems. This option is enabled by default when
21972 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
21973 this option also partially utilizes the hardware atomic instructions
21974 @code{movli.l} and @code{movco.l} to create more efficient code, unless
21975 @samp{strict} is specified.
21976
21977 @item soft-tcb
21978 Generate software atomic sequences that use a variable in the thread control
21979 block. This is a variation of the gUSA sequences which can also be used on
21980 SH1* and SH2* targets. The generated atomic sequences require additional
21981 support from the interrupt/exception handling code of the system and are only
21982 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
21983 parameter has to be specified as well.
21984
21985 @item soft-imask
21986 Generate software atomic sequences that temporarily disable interrupts by
21987 setting @code{SR.IMASK = 1111}. This model works only when the program runs
21988 in privileged mode and is only suitable for single-core systems. Additional
21989 support from the interrupt/exception handling code of the system is not
21990 required. This model is enabled by default when the target is
21991 @code{sh*-*-linux*} and SH1* or SH2*.
21992
21993 @item hard-llcs
21994 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
21995 instructions only. This is only available on SH4A and is suitable for
21996 multi-core systems. Since the hardware instructions support only 32 bit atomic
21997 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
21998 Code compiled with this option is also compatible with other software
21999 atomic model interrupt/exception handling systems if executed on an SH4A
22000 system. Additional support from the interrupt/exception handling code of the
22001 system is not required for this model.
22002
22003 @item gbr-offset=
22004 This parameter specifies the offset in bytes of the variable in the thread
22005 control block structure that should be used by the generated atomic sequences
22006 when the @samp{soft-tcb} model has been selected. For other models this
22007 parameter is ignored. The specified value must be an integer multiple of four
22008 and in the range 0-1020.
22009
22010 @item strict
22011 This parameter prevents mixed usage of multiple atomic models, even if they
22012 are compatible, and makes the compiler generate atomic sequences of the
22013 specified model only.
22014
22015 @end table
22016
22017 @item -mtas
22018 @opindex mtas
22019 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
22020 Notice that depending on the particular hardware and software configuration
22021 this can degrade overall performance due to the operand cache line flushes
22022 that are implied by the @code{tas.b} instruction. On multi-core SH4A
22023 processors the @code{tas.b} instruction must be used with caution since it
22024 can result in data corruption for certain cache configurations.
22025
22026 @item -mprefergot
22027 @opindex mprefergot
22028 When generating position-independent code, emit function calls using
22029 the Global Offset Table instead of the Procedure Linkage Table.
22030
22031 @item -musermode
22032 @itemx -mno-usermode
22033 @opindex musermode
22034 @opindex mno-usermode
22035 Don't allow (allow) the compiler generating privileged mode code. Specifying
22036 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
22037 inlined code would not work in user mode. @option{-musermode} is the default
22038 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
22039 @option{-musermode} has no effect, since there is no user mode.
22040
22041 @item -multcost=@var{number}
22042 @opindex multcost=@var{number}
22043 Set the cost to assume for a multiply insn.
22044
22045 @item -mdiv=@var{strategy}
22046 @opindex mdiv=@var{strategy}
22047 Set the division strategy to be used for integer division operations.
22048 @var{strategy} can be one of:
22049
22050 @table @samp
22051
22052 @item call-div1
22053 Calls a library function that uses the single-step division instruction
22054 @code{div1} to perform the operation. Division by zero calculates an
22055 unspecified result and does not trap. This is the default except for SH4,
22056 SH2A and SHcompact.
22057
22058 @item call-fp
22059 Calls a library function that performs the operation in double precision
22060 floating point. Division by zero causes a floating-point exception. This is
22061 the default for SHcompact with FPU. Specifying this for targets that do not
22062 have a double precision FPU defaults to @code{call-div1}.
22063
22064 @item call-table
22065 Calls a library function that uses a lookup table for small divisors and
22066 the @code{div1} instruction with case distinction for larger divisors. Division
22067 by zero calculates an unspecified result and does not trap. This is the default
22068 for SH4. Specifying this for targets that do not have dynamic shift
22069 instructions defaults to @code{call-div1}.
22070
22071 @end table
22072
22073 When a division strategy has not been specified the default strategy is
22074 selected based on the current target. For SH2A the default strategy is to
22075 use the @code{divs} and @code{divu} instructions instead of library function
22076 calls.
22077
22078 @item -maccumulate-outgoing-args
22079 @opindex maccumulate-outgoing-args
22080 Reserve space once for outgoing arguments in the function prologue rather
22081 than around each call. Generally beneficial for performance and size. Also
22082 needed for unwinding to avoid changing the stack frame around conditional code.
22083
22084 @item -mdivsi3_libfunc=@var{name}
22085 @opindex mdivsi3_libfunc=@var{name}
22086 Set the name of the library function used for 32-bit signed division to
22087 @var{name}.
22088 This only affects the name used in the @samp{call} division strategies, and
22089 the compiler still expects the same sets of input/output/clobbered registers as
22090 if this option were not present.
22091
22092 @item -mfixed-range=@var{register-range}
22093 @opindex mfixed-range
22094 Generate code treating the given register range as fixed registers.
22095 A fixed register is one that the register allocator can not use. This is
22096 useful when compiling kernel code. A register range is specified as
22097 two registers separated by a dash. Multiple register ranges can be
22098 specified separated by a comma.
22099
22100 @item -mbranch-cost=@var{num}
22101 @opindex mbranch-cost=@var{num}
22102 Assume @var{num} to be the cost for a branch instruction. Higher numbers
22103 make the compiler try to generate more branch-free code if possible.
22104 If not specified the value is selected depending on the processor type that
22105 is being compiled for.
22106
22107 @item -mzdcbranch
22108 @itemx -mno-zdcbranch
22109 @opindex mzdcbranch
22110 @opindex mno-zdcbranch
22111 Assume (do not assume) that zero displacement conditional branch instructions
22112 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
22113 compiler prefers zero displacement branch code sequences. This is
22114 enabled by default when generating code for SH4 and SH4A. It can be explicitly
22115 disabled by specifying @option{-mno-zdcbranch}.
22116
22117 @item -mcbranch-force-delay-slot
22118 @opindex mcbranch-force-delay-slot
22119 Force the usage of delay slots for conditional branches, which stuffs the delay
22120 slot with a @code{nop} if a suitable instruction can't be found. By default
22121 this option is disabled. It can be enabled to work around hardware bugs as
22122 found in the original SH7055.
22123
22124 @item -mfused-madd
22125 @itemx -mno-fused-madd
22126 @opindex mfused-madd
22127 @opindex mno-fused-madd
22128 Generate code that uses (does not use) the floating-point multiply and
22129 accumulate instructions. These instructions are generated by default
22130 if hardware floating point is used. The machine-dependent
22131 @option{-mfused-madd} option is now mapped to the machine-independent
22132 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22133 mapped to @option{-ffp-contract=off}.
22134
22135 @item -mfsca
22136 @itemx -mno-fsca
22137 @opindex mfsca
22138 @opindex mno-fsca
22139 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
22140 and cosine approximations. The option @option{-mfsca} must be used in
22141 combination with @option{-funsafe-math-optimizations}. It is enabled by default
22142 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
22143 approximations even if @option{-funsafe-math-optimizations} is in effect.
22144
22145 @item -mfsrra
22146 @itemx -mno-fsrra
22147 @opindex mfsrra
22148 @opindex mno-fsrra
22149 Allow or disallow the compiler to emit the @code{fsrra} instruction for
22150 reciprocal square root approximations. The option @option{-mfsrra} must be used
22151 in combination with @option{-funsafe-math-optimizations} and
22152 @option{-ffinite-math-only}. It is enabled by default when generating code for
22153 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
22154 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
22155 in effect.
22156
22157 @item -mpretend-cmove
22158 @opindex mpretend-cmove
22159 Prefer zero-displacement conditional branches for conditional move instruction
22160 patterns. This can result in faster code on the SH4 processor.
22161
22162 @item -mfdpic
22163 @opindex fdpic
22164 Generate code using the FDPIC ABI.
22165
22166 @end table
22167
22168 @node Solaris 2 Options
22169 @subsection Solaris 2 Options
22170 @cindex Solaris 2 options
22171
22172 These @samp{-m} options are supported on Solaris 2:
22173
22174 @table @gcctabopt
22175 @item -mclear-hwcap
22176 @opindex mclear-hwcap
22177 @option{-mclear-hwcap} tells the compiler to remove the hardware
22178 capabilities generated by the Solaris assembler. This is only necessary
22179 when object files use ISA extensions not supported by the current
22180 machine, but check at runtime whether or not to use them.
22181
22182 @item -mimpure-text
22183 @opindex mimpure-text
22184 @option{-mimpure-text}, used in addition to @option{-shared}, tells
22185 the compiler to not pass @option{-z text} to the linker when linking a
22186 shared object. Using this option, you can link position-dependent
22187 code into a shared object.
22188
22189 @option{-mimpure-text} suppresses the ``relocations remain against
22190 allocatable but non-writable sections'' linker error message.
22191 However, the necessary relocations trigger copy-on-write, and the
22192 shared object is not actually shared across processes. Instead of
22193 using @option{-mimpure-text}, you should compile all source code with
22194 @option{-fpic} or @option{-fPIC}.
22195
22196 @end table
22197
22198 These switches are supported in addition to the above on Solaris 2:
22199
22200 @table @gcctabopt
22201 @item -pthreads
22202 @opindex pthreads
22203 Add support for multithreading using the POSIX threads library. This
22204 option sets flags for both the preprocessor and linker. This option does
22205 not affect the thread safety of object code produced by the compiler or
22206 that of libraries supplied with it.
22207
22208 @item -pthread
22209 @opindex pthread
22210 This is a synonym for @option{-pthreads}.
22211 @end table
22212
22213 @node SPARC Options
22214 @subsection SPARC Options
22215 @cindex SPARC options
22216
22217 These @samp{-m} options are supported on the SPARC:
22218
22219 @table @gcctabopt
22220 @item -mno-app-regs
22221 @itemx -mapp-regs
22222 @opindex mno-app-regs
22223 @opindex mapp-regs
22224 Specify @option{-mapp-regs} to generate output using the global registers
22225 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
22226 global register 1, each global register 2 through 4 is then treated as an
22227 allocable register that is clobbered by function calls. This is the default.
22228
22229 To be fully SVR4 ABI-compliant at the cost of some performance loss,
22230 specify @option{-mno-app-regs}. You should compile libraries and system
22231 software with this option.
22232
22233 @item -mflat
22234 @itemx -mno-flat
22235 @opindex mflat
22236 @opindex mno-flat
22237 With @option{-mflat}, the compiler does not generate save/restore instructions
22238 and uses a ``flat'' or single register window model. This model is compatible
22239 with the regular register window model. The local registers and the input
22240 registers (0--5) are still treated as ``call-saved'' registers and are
22241 saved on the stack as needed.
22242
22243 With @option{-mno-flat} (the default), the compiler generates save/restore
22244 instructions (except for leaf functions). This is the normal operating mode.
22245
22246 @item -mfpu
22247 @itemx -mhard-float
22248 @opindex mfpu
22249 @opindex mhard-float
22250 Generate output containing floating-point instructions. This is the
22251 default.
22252
22253 @item -mno-fpu
22254 @itemx -msoft-float
22255 @opindex mno-fpu
22256 @opindex msoft-float
22257 Generate output containing library calls for floating point.
22258 @strong{Warning:} the requisite libraries are not available for all SPARC
22259 targets. Normally the facilities of the machine's usual C compiler are
22260 used, but this cannot be done directly in cross-compilation. You must make
22261 your own arrangements to provide suitable library functions for
22262 cross-compilation. The embedded targets @samp{sparc-*-aout} and
22263 @samp{sparclite-*-*} do provide software floating-point support.
22264
22265 @option{-msoft-float} changes the calling convention in the output file;
22266 therefore, it is only useful if you compile @emph{all} of a program with
22267 this option. In particular, you need to compile @file{libgcc.a}, the
22268 library that comes with GCC, with @option{-msoft-float} in order for
22269 this to work.
22270
22271 @item -mhard-quad-float
22272 @opindex mhard-quad-float
22273 Generate output containing quad-word (long double) floating-point
22274 instructions.
22275
22276 @item -msoft-quad-float
22277 @opindex msoft-quad-float
22278 Generate output containing library calls for quad-word (long double)
22279 floating-point instructions. The functions called are those specified
22280 in the SPARC ABI@. This is the default.
22281
22282 As of this writing, there are no SPARC implementations that have hardware
22283 support for the quad-word floating-point instructions. They all invoke
22284 a trap handler for one of these instructions, and then the trap handler
22285 emulates the effect of the instruction. Because of the trap handler overhead,
22286 this is much slower than calling the ABI library routines. Thus the
22287 @option{-msoft-quad-float} option is the default.
22288
22289 @item -mno-unaligned-doubles
22290 @itemx -munaligned-doubles
22291 @opindex mno-unaligned-doubles
22292 @opindex munaligned-doubles
22293 Assume that doubles have 8-byte alignment. This is the default.
22294
22295 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
22296 alignment only if they are contained in another type, or if they have an
22297 absolute address. Otherwise, it assumes they have 4-byte alignment.
22298 Specifying this option avoids some rare compatibility problems with code
22299 generated by other compilers. It is not the default because it results
22300 in a performance loss, especially for floating-point code.
22301
22302 @item -muser-mode
22303 @itemx -mno-user-mode
22304 @opindex muser-mode
22305 @opindex mno-user-mode
22306 Do not generate code that can only run in supervisor mode. This is relevant
22307 only for the @code{casa} instruction emitted for the LEON3 processor. This
22308 is the default.
22309
22310 @item -mfaster-structs
22311 @itemx -mno-faster-structs
22312 @opindex mfaster-structs
22313 @opindex mno-faster-structs
22314 With @option{-mfaster-structs}, the compiler assumes that structures
22315 should have 8-byte alignment. This enables the use of pairs of
22316 @code{ldd} and @code{std} instructions for copies in structure
22317 assignment, in place of twice as many @code{ld} and @code{st} pairs.
22318 However, the use of this changed alignment directly violates the SPARC
22319 ABI@. Thus, it's intended only for use on targets where the developer
22320 acknowledges that their resulting code is not directly in line with
22321 the rules of the ABI@.
22322
22323 @item -mstd-struct-return
22324 @itemx -mno-std-struct-return
22325 @opindex mstd-struct-return
22326 @opindex mno-std-struct-return
22327 With @option{-mstd-struct-return}, the compiler generates checking code
22328 in functions returning structures or unions to detect size mismatches
22329 between the two sides of function calls, as per the 32-bit ABI@.
22330
22331 The default is @option{-mno-std-struct-return}. This option has no effect
22332 in 64-bit mode.
22333
22334 @item -mcpu=@var{cpu_type}
22335 @opindex mcpu
22336 Set the instruction set, register set, and instruction scheduling parameters
22337 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22338 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
22339 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
22340 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
22341 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
22342 @samp{niagara3}, @samp{niagara4} and @samp{niagara7}.
22343
22344 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
22345 which selects the best architecture option for the host processor.
22346 @option{-mcpu=native} has no effect if GCC does not recognize
22347 the processor.
22348
22349 Default instruction scheduling parameters are used for values that select
22350 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
22351 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
22352
22353 Here is a list of each supported architecture and their supported
22354 implementations.
22355
22356 @table @asis
22357 @item v7
22358 cypress, leon3v7
22359
22360 @item v8
22361 supersparc, hypersparc, leon, leon3
22362
22363 @item sparclite
22364 f930, f934, sparclite86x
22365
22366 @item sparclet
22367 tsc701
22368
22369 @item v9
22370 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7
22371 @end table
22372
22373 By default (unless configured otherwise), GCC generates code for the V7
22374 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
22375 additionally optimizes it for the Cypress CY7C602 chip, as used in the
22376 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
22377 SPARCStation 1, 2, IPX etc.
22378
22379 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
22380 architecture. The only difference from V7 code is that the compiler emits
22381 the integer multiply and integer divide instructions which exist in SPARC-V8
22382 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
22383 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
22384 2000 series.
22385
22386 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
22387 the SPARC architecture. This adds the integer multiply, integer divide step
22388 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
22389 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
22390 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
22391 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
22392 MB86934 chip, which is the more recent SPARClite with FPU@.
22393
22394 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
22395 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
22396 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
22397 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
22398 optimizes it for the TEMIC SPARClet chip.
22399
22400 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
22401 architecture. This adds 64-bit integer and floating-point move instructions,
22402 3 additional floating-point condition code registers and conditional move
22403 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
22404 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
22405 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
22406 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
22407 @option{-mcpu=niagara}, the compiler additionally optimizes it for
22408 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
22409 additionally optimizes it for Sun UltraSPARC T2 chips. With
22410 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
22411 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
22412 additionally optimizes it for Sun UltraSPARC T4 chips. With
22413 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
22414 Oracle SPARC M7 chips.
22415
22416 @item -mtune=@var{cpu_type}
22417 @opindex mtune
22418 Set the instruction scheduling parameters for machine type
22419 @var{cpu_type}, but do not set the instruction set or register set that the
22420 option @option{-mcpu=@var{cpu_type}} does.
22421
22422 The same values for @option{-mcpu=@var{cpu_type}} can be used for
22423 @option{-mtune=@var{cpu_type}}, but the only useful values are those
22424 that select a particular CPU implementation. Those are
22425 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
22426 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
22427 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
22428 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
22429 @samp{niagara4} and @samp{niagara7}. With native Solaris and
22430 GNU/Linux toolchains, @samp{native} can also be used.
22431
22432 @item -mv8plus
22433 @itemx -mno-v8plus
22434 @opindex mv8plus
22435 @opindex mno-v8plus
22436 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
22437 difference from the V8 ABI is that the global and out registers are
22438 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
22439 mode for all SPARC-V9 processors.
22440
22441 @item -mvis
22442 @itemx -mno-vis
22443 @opindex mvis
22444 @opindex mno-vis
22445 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
22446 Visual Instruction Set extensions. The default is @option{-mno-vis}.
22447
22448 @item -mvis2
22449 @itemx -mno-vis2
22450 @opindex mvis2
22451 @opindex mno-vis2
22452 With @option{-mvis2}, GCC generates code that takes advantage of
22453 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
22454 default is @option{-mvis2} when targeting a cpu that supports such
22455 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
22456 also sets @option{-mvis}.
22457
22458 @item -mvis3
22459 @itemx -mno-vis3
22460 @opindex mvis3
22461 @opindex mno-vis3
22462 With @option{-mvis3}, GCC generates code that takes advantage of
22463 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
22464 default is @option{-mvis3} when targeting a cpu that supports such
22465 instructions, such as niagara-3 and later. Setting @option{-mvis3}
22466 also sets @option{-mvis2} and @option{-mvis}.
22467
22468 @item -mvis4
22469 @itemx -mno-vis4
22470 @opindex mvis4
22471 @opindex mno-vis4
22472 With @option{-mvis4}, GCC generates code that takes advantage of
22473 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
22474 default is @option{-mvis4} when targeting a cpu that supports such
22475 instructions, such as niagara-7 and later. Setting @option{-mvis4}
22476 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
22477
22478 @item -mcbcond
22479 @itemx -mno-cbcond
22480 @opindex mcbcond
22481 @opindex mno-cbcond
22482 With @option{-mcbcond}, GCC generates code that takes advantage of
22483 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
22484 The default is @option{-mcbcond} when targeting a cpu that supports such
22485 instructions, such as niagara-4 and later.
22486
22487 @item -mpopc
22488 @itemx -mno-popc
22489 @opindex mpopc
22490 @opindex mno-popc
22491 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
22492 population count instruction. The default is @option{-mpopc}
22493 when targeting a cpu that supports such instructions, such as Niagara-2 and
22494 later.
22495
22496 @item -mfmaf
22497 @itemx -mno-fmaf
22498 @opindex mfmaf
22499 @opindex mno-fmaf
22500 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
22501 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
22502 when targeting a cpu that supports such instructions, such as Niagara-3 and
22503 later.
22504
22505 @item -mfix-at697f
22506 @opindex mfix-at697f
22507 Enable the documented workaround for the single erratum of the Atmel AT697F
22508 processor (which corresponds to erratum #13 of the AT697E processor).
22509
22510 @item -mfix-ut699
22511 @opindex mfix-ut699
22512 Enable the documented workarounds for the floating-point errata and the data
22513 cache nullify errata of the UT699 processor.
22514 @end table
22515
22516 These @samp{-m} options are supported in addition to the above
22517 on SPARC-V9 processors in 64-bit environments:
22518
22519 @table @gcctabopt
22520 @item -m32
22521 @itemx -m64
22522 @opindex m32
22523 @opindex m64
22524 Generate code for a 32-bit or 64-bit environment.
22525 The 32-bit environment sets int, long and pointer to 32 bits.
22526 The 64-bit environment sets int to 32 bits and long and pointer
22527 to 64 bits.
22528
22529 @item -mcmodel=@var{which}
22530 @opindex mcmodel
22531 Set the code model to one of
22532
22533 @table @samp
22534 @item medlow
22535 The Medium/Low code model: 64-bit addresses, programs
22536 must be linked in the low 32 bits of memory. Programs can be statically
22537 or dynamically linked.
22538
22539 @item medmid
22540 The Medium/Middle code model: 64-bit addresses, programs
22541 must be linked in the low 44 bits of memory, the text and data segments must
22542 be less than 2GB in size and the data segment must be located within 2GB of
22543 the text segment.
22544
22545 @item medany
22546 The Medium/Anywhere code model: 64-bit addresses, programs
22547 may be linked anywhere in memory, the text and data segments must be less
22548 than 2GB in size and the data segment must be located within 2GB of the
22549 text segment.
22550
22551 @item embmedany
22552 The Medium/Anywhere code model for embedded systems:
22553 64-bit addresses, the text and data segments must be less than 2GB in
22554 size, both starting anywhere in memory (determined at link time). The
22555 global register %g4 points to the base of the data segment. Programs
22556 are statically linked and PIC is not supported.
22557 @end table
22558
22559 @item -mmemory-model=@var{mem-model}
22560 @opindex mmemory-model
22561 Set the memory model in force on the processor to one of
22562
22563 @table @samp
22564 @item default
22565 The default memory model for the processor and operating system.
22566
22567 @item rmo
22568 Relaxed Memory Order
22569
22570 @item pso
22571 Partial Store Order
22572
22573 @item tso
22574 Total Store Order
22575
22576 @item sc
22577 Sequential Consistency
22578 @end table
22579
22580 These memory models are formally defined in Appendix D of the Sparc V9
22581 architecture manual, as set in the processor's @code{PSTATE.MM} field.
22582
22583 @item -mstack-bias
22584 @itemx -mno-stack-bias
22585 @opindex mstack-bias
22586 @opindex mno-stack-bias
22587 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
22588 frame pointer if present, are offset by @minus{}2047 which must be added back
22589 when making stack frame references. This is the default in 64-bit mode.
22590 Otherwise, assume no such offset is present.
22591 @end table
22592
22593 @node SPU Options
22594 @subsection SPU Options
22595 @cindex SPU options
22596
22597 These @samp{-m} options are supported on the SPU:
22598
22599 @table @gcctabopt
22600 @item -mwarn-reloc
22601 @itemx -merror-reloc
22602 @opindex mwarn-reloc
22603 @opindex merror-reloc
22604
22605 The loader for SPU does not handle dynamic relocations. By default, GCC
22606 gives an error when it generates code that requires a dynamic
22607 relocation. @option{-mno-error-reloc} disables the error,
22608 @option{-mwarn-reloc} generates a warning instead.
22609
22610 @item -msafe-dma
22611 @itemx -munsafe-dma
22612 @opindex msafe-dma
22613 @opindex munsafe-dma
22614
22615 Instructions that initiate or test completion of DMA must not be
22616 reordered with respect to loads and stores of the memory that is being
22617 accessed.
22618 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
22619 memory accesses, but that can lead to inefficient code in places where the
22620 memory is known to not change. Rather than mark the memory as volatile,
22621 you can use @option{-msafe-dma} to tell the compiler to treat
22622 the DMA instructions as potentially affecting all memory.
22623
22624 @item -mbranch-hints
22625 @opindex mbranch-hints
22626
22627 By default, GCC generates a branch hint instruction to avoid
22628 pipeline stalls for always-taken or probably-taken branches. A hint
22629 is not generated closer than 8 instructions away from its branch.
22630 There is little reason to disable them, except for debugging purposes,
22631 or to make an object a little bit smaller.
22632
22633 @item -msmall-mem
22634 @itemx -mlarge-mem
22635 @opindex msmall-mem
22636 @opindex mlarge-mem
22637
22638 By default, GCC generates code assuming that addresses are never larger
22639 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
22640 a full 32-bit address.
22641
22642 @item -mstdmain
22643 @opindex mstdmain
22644
22645 By default, GCC links against startup code that assumes the SPU-style
22646 main function interface (which has an unconventional parameter list).
22647 With @option{-mstdmain}, GCC links your program against startup
22648 code that assumes a C99-style interface to @code{main}, including a
22649 local copy of @code{argv} strings.
22650
22651 @item -mfixed-range=@var{register-range}
22652 @opindex mfixed-range
22653 Generate code treating the given register range as fixed registers.
22654 A fixed register is one that the register allocator cannot use. This is
22655 useful when compiling kernel code. A register range is specified as
22656 two registers separated by a dash. Multiple register ranges can be
22657 specified separated by a comma.
22658
22659 @item -mea32
22660 @itemx -mea64
22661 @opindex mea32
22662 @opindex mea64
22663 Compile code assuming that pointers to the PPU address space accessed
22664 via the @code{__ea} named address space qualifier are either 32 or 64
22665 bits wide. The default is 32 bits. As this is an ABI-changing option,
22666 all object code in an executable must be compiled with the same setting.
22667
22668 @item -maddress-space-conversion
22669 @itemx -mno-address-space-conversion
22670 @opindex maddress-space-conversion
22671 @opindex mno-address-space-conversion
22672 Allow/disallow treating the @code{__ea} address space as superset
22673 of the generic address space. This enables explicit type casts
22674 between @code{__ea} and generic pointer as well as implicit
22675 conversions of generic pointers to @code{__ea} pointers. The
22676 default is to allow address space pointer conversions.
22677
22678 @item -mcache-size=@var{cache-size}
22679 @opindex mcache-size
22680 This option controls the version of libgcc that the compiler links to an
22681 executable and selects a software-managed cache for accessing variables
22682 in the @code{__ea} address space with a particular cache size. Possible
22683 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
22684 and @samp{128}. The default cache size is 64KB.
22685
22686 @item -matomic-updates
22687 @itemx -mno-atomic-updates
22688 @opindex matomic-updates
22689 @opindex mno-atomic-updates
22690 This option controls the version of libgcc that the compiler links to an
22691 executable and selects whether atomic updates to the software-managed
22692 cache of PPU-side variables are used. If you use atomic updates, changes
22693 to a PPU variable from SPU code using the @code{__ea} named address space
22694 qualifier do not interfere with changes to other PPU variables residing
22695 in the same cache line from PPU code. If you do not use atomic updates,
22696 such interference may occur; however, writing back cache lines is
22697 more efficient. The default behavior is to use atomic updates.
22698
22699 @item -mdual-nops
22700 @itemx -mdual-nops=@var{n}
22701 @opindex mdual-nops
22702 By default, GCC inserts nops to increase dual issue when it expects
22703 it to increase performance. @var{n} can be a value from 0 to 10. A
22704 smaller @var{n} inserts fewer nops. 10 is the default, 0 is the
22705 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
22706
22707 @item -mhint-max-nops=@var{n}
22708 @opindex mhint-max-nops
22709 Maximum number of nops to insert for a branch hint. A branch hint must
22710 be at least 8 instructions away from the branch it is affecting. GCC
22711 inserts up to @var{n} nops to enforce this, otherwise it does not
22712 generate the branch hint.
22713
22714 @item -mhint-max-distance=@var{n}
22715 @opindex mhint-max-distance
22716 The encoding of the branch hint instruction limits the hint to be within
22717 256 instructions of the branch it is affecting. By default, GCC makes
22718 sure it is within 125.
22719
22720 @item -msafe-hints
22721 @opindex msafe-hints
22722 Work around a hardware bug that causes the SPU to stall indefinitely.
22723 By default, GCC inserts the @code{hbrp} instruction to make sure
22724 this stall won't happen.
22725
22726 @end table
22727
22728 @node System V Options
22729 @subsection Options for System V
22730
22731 These additional options are available on System V Release 4 for
22732 compatibility with other compilers on those systems:
22733
22734 @table @gcctabopt
22735 @item -G
22736 @opindex G
22737 Create a shared object.
22738 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
22739
22740 @item -Qy
22741 @opindex Qy
22742 Identify the versions of each tool used by the compiler, in a
22743 @code{.ident} assembler directive in the output.
22744
22745 @item -Qn
22746 @opindex Qn
22747 Refrain from adding @code{.ident} directives to the output file (this is
22748 the default).
22749
22750 @item -YP,@var{dirs}
22751 @opindex YP
22752 Search the directories @var{dirs}, and no others, for libraries
22753 specified with @option{-l}.
22754
22755 @item -Ym,@var{dir}
22756 @opindex Ym
22757 Look in the directory @var{dir} to find the M4 preprocessor.
22758 The assembler uses this option.
22759 @c This is supposed to go with a -Yd for predefined M4 macro files, but
22760 @c the generic assembler that comes with Solaris takes just -Ym.
22761 @end table
22762
22763 @node TILE-Gx Options
22764 @subsection TILE-Gx Options
22765 @cindex TILE-Gx options
22766
22767 These @samp{-m} options are supported on the TILE-Gx:
22768
22769 @table @gcctabopt
22770 @item -mcmodel=small
22771 @opindex mcmodel=small
22772 Generate code for the small model. The distance for direct calls is
22773 limited to 500M in either direction. PC-relative addresses are 32
22774 bits. Absolute addresses support the full address range.
22775
22776 @item -mcmodel=large
22777 @opindex mcmodel=large
22778 Generate code for the large model. There is no limitation on call
22779 distance, pc-relative addresses, or absolute addresses.
22780
22781 @item -mcpu=@var{name}
22782 @opindex mcpu
22783 Selects the type of CPU to be targeted. Currently the only supported
22784 type is @samp{tilegx}.
22785
22786 @item -m32
22787 @itemx -m64
22788 @opindex m32
22789 @opindex m64
22790 Generate code for a 32-bit or 64-bit environment. The 32-bit
22791 environment sets int, long, and pointer to 32 bits. The 64-bit
22792 environment sets int to 32 bits and long and pointer to 64 bits.
22793
22794 @item -mbig-endian
22795 @itemx -mlittle-endian
22796 @opindex mbig-endian
22797 @opindex mlittle-endian
22798 Generate code in big/little endian mode, respectively.
22799 @end table
22800
22801 @node TILEPro Options
22802 @subsection TILEPro Options
22803 @cindex TILEPro options
22804
22805 These @samp{-m} options are supported on the TILEPro:
22806
22807 @table @gcctabopt
22808 @item -mcpu=@var{name}
22809 @opindex mcpu
22810 Selects the type of CPU to be targeted. Currently the only supported
22811 type is @samp{tilepro}.
22812
22813 @item -m32
22814 @opindex m32
22815 Generate code for a 32-bit environment, which sets int, long, and
22816 pointer to 32 bits. This is the only supported behavior so the flag
22817 is essentially ignored.
22818 @end table
22819
22820 @node V850 Options
22821 @subsection V850 Options
22822 @cindex V850 Options
22823
22824 These @samp{-m} options are defined for V850 implementations:
22825
22826 @table @gcctabopt
22827 @item -mlong-calls
22828 @itemx -mno-long-calls
22829 @opindex mlong-calls
22830 @opindex mno-long-calls
22831 Treat all calls as being far away (near). If calls are assumed to be
22832 far away, the compiler always loads the function's address into a
22833 register, and calls indirect through the pointer.
22834
22835 @item -mno-ep
22836 @itemx -mep
22837 @opindex mno-ep
22838 @opindex mep
22839 Do not optimize (do optimize) basic blocks that use the same index
22840 pointer 4 or more times to copy pointer into the @code{ep} register, and
22841 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
22842 option is on by default if you optimize.
22843
22844 @item -mno-prolog-function
22845 @itemx -mprolog-function
22846 @opindex mno-prolog-function
22847 @opindex mprolog-function
22848 Do not use (do use) external functions to save and restore registers
22849 at the prologue and epilogue of a function. The external functions
22850 are slower, but use less code space if more than one function saves
22851 the same number of registers. The @option{-mprolog-function} option
22852 is on by default if you optimize.
22853
22854 @item -mspace
22855 @opindex mspace
22856 Try to make the code as small as possible. At present, this just turns
22857 on the @option{-mep} and @option{-mprolog-function} options.
22858
22859 @item -mtda=@var{n}
22860 @opindex mtda
22861 Put static or global variables whose size is @var{n} bytes or less into
22862 the tiny data area that register @code{ep} points to. The tiny data
22863 area can hold up to 256 bytes in total (128 bytes for byte references).
22864
22865 @item -msda=@var{n}
22866 @opindex msda
22867 Put static or global variables whose size is @var{n} bytes or less into
22868 the small data area that register @code{gp} points to. The small data
22869 area can hold up to 64 kilobytes.
22870
22871 @item -mzda=@var{n}
22872 @opindex mzda
22873 Put static or global variables whose size is @var{n} bytes or less into
22874 the first 32 kilobytes of memory.
22875
22876 @item -mv850
22877 @opindex mv850
22878 Specify that the target processor is the V850.
22879
22880 @item -mv850e3v5
22881 @opindex mv850e3v5
22882 Specify that the target processor is the V850E3V5. The preprocessor
22883 constant @code{__v850e3v5__} is defined if this option is used.
22884
22885 @item -mv850e2v4
22886 @opindex mv850e2v4
22887 Specify that the target processor is the V850E3V5. This is an alias for
22888 the @option{-mv850e3v5} option.
22889
22890 @item -mv850e2v3
22891 @opindex mv850e2v3
22892 Specify that the target processor is the V850E2V3. The preprocessor
22893 constant @code{__v850e2v3__} is defined if this option is used.
22894
22895 @item -mv850e2
22896 @opindex mv850e2
22897 Specify that the target processor is the V850E2. The preprocessor
22898 constant @code{__v850e2__} is defined if this option is used.
22899
22900 @item -mv850e1
22901 @opindex mv850e1
22902 Specify that the target processor is the V850E1. The preprocessor
22903 constants @code{__v850e1__} and @code{__v850e__} are defined if
22904 this option is used.
22905
22906 @item -mv850es
22907 @opindex mv850es
22908 Specify that the target processor is the V850ES. This is an alias for
22909 the @option{-mv850e1} option.
22910
22911 @item -mv850e
22912 @opindex mv850e
22913 Specify that the target processor is the V850E@. The preprocessor
22914 constant @code{__v850e__} is defined if this option is used.
22915
22916 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
22917 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
22918 are defined then a default target processor is chosen and the
22919 relevant @samp{__v850*__} preprocessor constant is defined.
22920
22921 The preprocessor constants @code{__v850} and @code{__v851__} are always
22922 defined, regardless of which processor variant is the target.
22923
22924 @item -mdisable-callt
22925 @itemx -mno-disable-callt
22926 @opindex mdisable-callt
22927 @opindex mno-disable-callt
22928 This option suppresses generation of the @code{CALLT} instruction for the
22929 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
22930 architecture.
22931
22932 This option is enabled by default when the RH850 ABI is
22933 in use (see @option{-mrh850-abi}), and disabled by default when the
22934 GCC ABI is in use. If @code{CALLT} instructions are being generated
22935 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
22936
22937 @item -mrelax
22938 @itemx -mno-relax
22939 @opindex mrelax
22940 @opindex mno-relax
22941 Pass on (or do not pass on) the @option{-mrelax} command-line option
22942 to the assembler.
22943
22944 @item -mlong-jumps
22945 @itemx -mno-long-jumps
22946 @opindex mlong-jumps
22947 @opindex mno-long-jumps
22948 Disable (or re-enable) the generation of PC-relative jump instructions.
22949
22950 @item -msoft-float
22951 @itemx -mhard-float
22952 @opindex msoft-float
22953 @opindex mhard-float
22954 Disable (or re-enable) the generation of hardware floating point
22955 instructions. This option is only significant when the target
22956 architecture is @samp{V850E2V3} or higher. If hardware floating point
22957 instructions are being generated then the C preprocessor symbol
22958 @code{__FPU_OK__} is defined, otherwise the symbol
22959 @code{__NO_FPU__} is defined.
22960
22961 @item -mloop
22962 @opindex mloop
22963 Enables the use of the e3v5 LOOP instruction. The use of this
22964 instruction is not enabled by default when the e3v5 architecture is
22965 selected because its use is still experimental.
22966
22967 @item -mrh850-abi
22968 @itemx -mghs
22969 @opindex mrh850-abi
22970 @opindex mghs
22971 Enables support for the RH850 version of the V850 ABI. This is the
22972 default. With this version of the ABI the following rules apply:
22973
22974 @itemize
22975 @item
22976 Integer sized structures and unions are returned via a memory pointer
22977 rather than a register.
22978
22979 @item
22980 Large structures and unions (more than 8 bytes in size) are passed by
22981 value.
22982
22983 @item
22984 Functions are aligned to 16-bit boundaries.
22985
22986 @item
22987 The @option{-m8byte-align} command-line option is supported.
22988
22989 @item
22990 The @option{-mdisable-callt} command-line option is enabled by
22991 default. The @option{-mno-disable-callt} command-line option is not
22992 supported.
22993 @end itemize
22994
22995 When this version of the ABI is enabled the C preprocessor symbol
22996 @code{__V850_RH850_ABI__} is defined.
22997
22998 @item -mgcc-abi
22999 @opindex mgcc-abi
23000 Enables support for the old GCC version of the V850 ABI. With this
23001 version of the ABI the following rules apply:
23002
23003 @itemize
23004 @item
23005 Integer sized structures and unions are returned in register @code{r10}.
23006
23007 @item
23008 Large structures and unions (more than 8 bytes in size) are passed by
23009 reference.
23010
23011 @item
23012 Functions are aligned to 32-bit boundaries, unless optimizing for
23013 size.
23014
23015 @item
23016 The @option{-m8byte-align} command-line option is not supported.
23017
23018 @item
23019 The @option{-mdisable-callt} command-line option is supported but not
23020 enabled by default.
23021 @end itemize
23022
23023 When this version of the ABI is enabled the C preprocessor symbol
23024 @code{__V850_GCC_ABI__} is defined.
23025
23026 @item -m8byte-align
23027 @itemx -mno-8byte-align
23028 @opindex m8byte-align
23029 @opindex mno-8byte-align
23030 Enables support for @code{double} and @code{long long} types to be
23031 aligned on 8-byte boundaries. The default is to restrict the
23032 alignment of all objects to at most 4-bytes. When
23033 @option{-m8byte-align} is in effect the C preprocessor symbol
23034 @code{__V850_8BYTE_ALIGN__} is defined.
23035
23036 @item -mbig-switch
23037 @opindex mbig-switch
23038 Generate code suitable for big switch tables. Use this option only if
23039 the assembler/linker complain about out of range branches within a switch
23040 table.
23041
23042 @item -mapp-regs
23043 @opindex mapp-regs
23044 This option causes r2 and r5 to be used in the code generated by
23045 the compiler. This setting is the default.
23046
23047 @item -mno-app-regs
23048 @opindex mno-app-regs
23049 This option causes r2 and r5 to be treated as fixed registers.
23050
23051 @end table
23052
23053 @node VAX Options
23054 @subsection VAX Options
23055 @cindex VAX options
23056
23057 These @samp{-m} options are defined for the VAX:
23058
23059 @table @gcctabopt
23060 @item -munix
23061 @opindex munix
23062 Do not output certain jump instructions (@code{aobleq} and so on)
23063 that the Unix assembler for the VAX cannot handle across long
23064 ranges.
23065
23066 @item -mgnu
23067 @opindex mgnu
23068 Do output those jump instructions, on the assumption that the
23069 GNU assembler is being used.
23070
23071 @item -mg
23072 @opindex mg
23073 Output code for G-format floating-point numbers instead of D-format.
23074 @end table
23075
23076 @node Visium Options
23077 @subsection Visium Options
23078 @cindex Visium options
23079
23080 @table @gcctabopt
23081
23082 @item -mdebug
23083 @opindex mdebug
23084 A program which performs file I/O and is destined to run on an MCM target
23085 should be linked with this option. It causes the libraries libc.a and
23086 libdebug.a to be linked. The program should be run on the target under
23087 the control of the GDB remote debugging stub.
23088
23089 @item -msim
23090 @opindex msim
23091 A program which performs file I/O and is destined to run on the simulator
23092 should be linked with option. This causes libraries libc.a and libsim.a to
23093 be linked.
23094
23095 @item -mfpu
23096 @itemx -mhard-float
23097 @opindex mfpu
23098 @opindex mhard-float
23099 Generate code containing floating-point instructions. This is the
23100 default.
23101
23102 @item -mno-fpu
23103 @itemx -msoft-float
23104 @opindex mno-fpu
23105 @opindex msoft-float
23106 Generate code containing library calls for floating-point.
23107
23108 @option{-msoft-float} changes the calling convention in the output file;
23109 therefore, it is only useful if you compile @emph{all} of a program with
23110 this option. In particular, you need to compile @file{libgcc.a}, the
23111 library that comes with GCC, with @option{-msoft-float} in order for
23112 this to work.
23113
23114 @item -mcpu=@var{cpu_type}
23115 @opindex mcpu
23116 Set the instruction set, register set, and instruction scheduling parameters
23117 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23118 @samp{mcm}, @samp{gr5} and @samp{gr6}.
23119
23120 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
23121
23122 By default (unless configured otherwise), GCC generates code for the GR5
23123 variant of the Visium architecture.
23124
23125 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
23126 architecture. The only difference from GR5 code is that the compiler will
23127 generate block move instructions.
23128
23129 @item -mtune=@var{cpu_type}
23130 @opindex mtune
23131 Set the instruction scheduling parameters for machine type @var{cpu_type},
23132 but do not set the instruction set or register set that the option
23133 @option{-mcpu=@var{cpu_type}} would.
23134
23135 @item -msv-mode
23136 @opindex msv-mode
23137 Generate code for the supervisor mode, where there are no restrictions on
23138 the access to general registers. This is the default.
23139
23140 @item -muser-mode
23141 @opindex muser-mode
23142 Generate code for the user mode, where the access to some general registers
23143 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
23144 mode; on the GR6, only registers r29 to r31 are affected.
23145 @end table
23146
23147 @node VMS Options
23148 @subsection VMS Options
23149
23150 These @samp{-m} options are defined for the VMS implementations:
23151
23152 @table @gcctabopt
23153 @item -mvms-return-codes
23154 @opindex mvms-return-codes
23155 Return VMS condition codes from @code{main}. The default is to return POSIX-style
23156 condition (e.g.@ error) codes.
23157
23158 @item -mdebug-main=@var{prefix}
23159 @opindex mdebug-main=@var{prefix}
23160 Flag the first routine whose name starts with @var{prefix} as the main
23161 routine for the debugger.
23162
23163 @item -mmalloc64
23164 @opindex mmalloc64
23165 Default to 64-bit memory allocation routines.
23166
23167 @item -mpointer-size=@var{size}
23168 @opindex mpointer-size=@var{size}
23169 Set the default size of pointers. Possible options for @var{size} are
23170 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
23171 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
23172 The later option disables @code{pragma pointer_size}.
23173 @end table
23174
23175 @node VxWorks Options
23176 @subsection VxWorks Options
23177 @cindex VxWorks Options
23178
23179 The options in this section are defined for all VxWorks targets.
23180 Options specific to the target hardware are listed with the other
23181 options for that target.
23182
23183 @table @gcctabopt
23184 @item -mrtp
23185 @opindex mrtp
23186 GCC can generate code for both VxWorks kernels and real time processes
23187 (RTPs). This option switches from the former to the latter. It also
23188 defines the preprocessor macro @code{__RTP__}.
23189
23190 @item -non-static
23191 @opindex non-static
23192 Link an RTP executable against shared libraries rather than static
23193 libraries. The options @option{-static} and @option{-shared} can
23194 also be used for RTPs (@pxref{Link Options}); @option{-static}
23195 is the default.
23196
23197 @item -Bstatic
23198 @itemx -Bdynamic
23199 @opindex Bstatic
23200 @opindex Bdynamic
23201 These options are passed down to the linker. They are defined for
23202 compatibility with Diab.
23203
23204 @item -Xbind-lazy
23205 @opindex Xbind-lazy
23206 Enable lazy binding of function calls. This option is equivalent to
23207 @option{-Wl,-z,now} and is defined for compatibility with Diab.
23208
23209 @item -Xbind-now
23210 @opindex Xbind-now
23211 Disable lazy binding of function calls. This option is the default and
23212 is defined for compatibility with Diab.
23213 @end table
23214
23215 @node x86 Options
23216 @subsection x86 Options
23217 @cindex x86 Options
23218
23219 These @samp{-m} options are defined for the x86 family of computers.
23220
23221 @table @gcctabopt
23222
23223 @item -march=@var{cpu-type}
23224 @opindex march
23225 Generate instructions for the machine type @var{cpu-type}. In contrast to
23226 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
23227 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
23228 to generate code that may not run at all on processors other than the one
23229 indicated. Specifying @option{-march=@var{cpu-type}} implies
23230 @option{-mtune=@var{cpu-type}}.
23231
23232 The choices for @var{cpu-type} are:
23233
23234 @table @samp
23235 @item native
23236 This selects the CPU to generate code for at compilation time by determining
23237 the processor type of the compiling machine. Using @option{-march=native}
23238 enables all instruction subsets supported by the local machine (hence
23239 the result might not run on different machines). Using @option{-mtune=native}
23240 produces code optimized for the local machine under the constraints
23241 of the selected instruction set.
23242
23243 @item i386
23244 Original Intel i386 CPU@.
23245
23246 @item i486
23247 Intel i486 CPU@. (No scheduling is implemented for this chip.)
23248
23249 @item i586
23250 @itemx pentium
23251 Intel Pentium CPU with no MMX support.
23252
23253 @item lakemont
23254 Intel Lakemont MCU, based on Intel Pentium CPU.
23255
23256 @item pentium-mmx
23257 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
23258
23259 @item pentiumpro
23260 Intel Pentium Pro CPU@.
23261
23262 @item i686
23263 When used with @option{-march}, the Pentium Pro
23264 instruction set is used, so the code runs on all i686 family chips.
23265 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
23266
23267 @item pentium2
23268 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
23269 support.
23270
23271 @item pentium3
23272 @itemx pentium3m
23273 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
23274 set support.
23275
23276 @item pentium-m
23277 Intel Pentium M; low-power version of Intel Pentium III CPU
23278 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
23279
23280 @item pentium4
23281 @itemx pentium4m
23282 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
23283
23284 @item prescott
23285 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
23286 set support.
23287
23288 @item nocona
23289 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
23290 SSE2 and SSE3 instruction set support.
23291
23292 @item core2
23293 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
23294 instruction set support.
23295
23296 @item nehalem
23297 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23298 SSE4.1, SSE4.2 and POPCNT instruction set support.
23299
23300 @item westmere
23301 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23302 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
23303
23304 @item sandybridge
23305 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23306 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
23307
23308 @item ivybridge
23309 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23310 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
23311 instruction set support.
23312
23313 @item haswell
23314 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23315 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23316 BMI, BMI2 and F16C instruction set support.
23317
23318 @item broadwell
23319 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23320 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23321 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
23322
23323 @item skylake
23324 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23325 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23326 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
23327 XSAVES instruction set support.
23328
23329 @item bonnell
23330 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
23331 instruction set support.
23332
23333 @item silvermont
23334 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23335 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
23336
23337 @item knl
23338 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23339 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23340 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
23341 AVX512CD instruction set support.
23342
23343 @item skylake-avx512
23344 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23345 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23346 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
23347 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
23348
23349 @item k6
23350 AMD K6 CPU with MMX instruction set support.
23351
23352 @item k6-2
23353 @itemx k6-3
23354 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
23355
23356 @item athlon
23357 @itemx athlon-tbird
23358 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
23359 support.
23360
23361 @item athlon-4
23362 @itemx athlon-xp
23363 @itemx athlon-mp
23364 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
23365 instruction set support.
23366
23367 @item k8
23368 @itemx opteron
23369 @itemx athlon64
23370 @itemx athlon-fx
23371 Processors based on the AMD K8 core with x86-64 instruction set support,
23372 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
23373 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
23374 instruction set extensions.)
23375
23376 @item k8-sse3
23377 @itemx opteron-sse3
23378 @itemx athlon64-sse3
23379 Improved versions of AMD K8 cores with SSE3 instruction set support.
23380
23381 @item amdfam10
23382 @itemx barcelona
23383 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
23384 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
23385 instruction set extensions.)
23386
23387 @item bdver1
23388 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
23389 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
23390 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
23391 @item bdver2
23392 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23393 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
23394 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
23395 extensions.)
23396 @item bdver3
23397 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23398 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
23399 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
23400 64-bit instruction set extensions.
23401 @item bdver4
23402 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23403 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
23404 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
23405 SSE4.2, ABM and 64-bit instruction set extensions.
23406
23407 @item znver1
23408 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
23409 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
23410 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
23411 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
23412 instruction set extensions.
23413
23414 @item btver1
23415 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
23416 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
23417 instruction set extensions.)
23418
23419 @item btver2
23420 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
23421 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
23422 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
23423
23424 @item winchip-c6
23425 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
23426 set support.
23427
23428 @item winchip2
23429 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
23430 instruction set support.
23431
23432 @item c3
23433 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
23434 (No scheduling is implemented for this chip.)
23435
23436 @item c3-2
23437 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
23438 (No scheduling is implemented for this chip.)
23439
23440 @item c7
23441 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
23442 (No scheduling is implemented for this chip.)
23443
23444 @item samuel-2
23445 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
23446 (No scheduling is implemented for this chip.)
23447
23448 @item nehemiah
23449 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
23450 (No scheduling is implemented for this chip.)
23451
23452 @item esther
23453 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
23454 (No scheduling is implemented for this chip.)
23455
23456 @item eden-x2
23457 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
23458 (No scheduling is implemented for this chip.)
23459
23460 @item eden-x4
23461 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
23462 AVX and AVX2 instruction set support.
23463 (No scheduling is implemented for this chip.)
23464
23465 @item nano
23466 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23467 instruction set support.
23468 (No scheduling is implemented for this chip.)
23469
23470 @item nano-1000
23471 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23472 instruction set support.
23473 (No scheduling is implemented for this chip.)
23474
23475 @item nano-2000
23476 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23477 instruction set support.
23478 (No scheduling is implemented for this chip.)
23479
23480 @item nano-3000
23481 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23482 instruction set support.
23483 (No scheduling is implemented for this chip.)
23484
23485 @item nano-x2
23486 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23487 instruction set support.
23488 (No scheduling is implemented for this chip.)
23489
23490 @item nano-x4
23491 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23492 instruction set support.
23493 (No scheduling is implemented for this chip.)
23494
23495 @item geode
23496 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
23497 @end table
23498
23499 @item -mtune=@var{cpu-type}
23500 @opindex mtune
23501 Tune to @var{cpu-type} everything applicable about the generated code, except
23502 for the ABI and the set of available instructions.
23503 While picking a specific @var{cpu-type} schedules things appropriately
23504 for that particular chip, the compiler does not generate any code that
23505 cannot run on the default machine type unless you use a
23506 @option{-march=@var{cpu-type}} option.
23507 For example, if GCC is configured for i686-pc-linux-gnu
23508 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
23509 but still runs on i686 machines.
23510
23511 The choices for @var{cpu-type} are the same as for @option{-march}.
23512 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
23513
23514 @table @samp
23515 @item generic
23516 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
23517 If you know the CPU on which your code will run, then you should use
23518 the corresponding @option{-mtune} or @option{-march} option instead of
23519 @option{-mtune=generic}. But, if you do not know exactly what CPU users
23520 of your application will have, then you should use this option.
23521
23522 As new processors are deployed in the marketplace, the behavior of this
23523 option will change. Therefore, if you upgrade to a newer version of
23524 GCC, code generation controlled by this option will change to reflect
23525 the processors
23526 that are most common at the time that version of GCC is released.
23527
23528 There is no @option{-march=generic} option because @option{-march}
23529 indicates the instruction set the compiler can use, and there is no
23530 generic instruction set applicable to all processors. In contrast,
23531 @option{-mtune} indicates the processor (or, in this case, collection of
23532 processors) for which the code is optimized.
23533
23534 @item intel
23535 Produce code optimized for the most current Intel processors, which are
23536 Haswell and Silvermont for this version of GCC. If you know the CPU
23537 on which your code will run, then you should use the corresponding
23538 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
23539 But, if you want your application performs better on both Haswell and
23540 Silvermont, then you should use this option.
23541
23542 As new Intel processors are deployed in the marketplace, the behavior of
23543 this option will change. Therefore, if you upgrade to a newer version of
23544 GCC, code generation controlled by this option will change to reflect
23545 the most current Intel processors at the time that version of GCC is
23546 released.
23547
23548 There is no @option{-march=intel} option because @option{-march} indicates
23549 the instruction set the compiler can use, and there is no common
23550 instruction set applicable to all processors. In contrast,
23551 @option{-mtune} indicates the processor (or, in this case, collection of
23552 processors) for which the code is optimized.
23553 @end table
23554
23555 @item -mcpu=@var{cpu-type}
23556 @opindex mcpu
23557 A deprecated synonym for @option{-mtune}.
23558
23559 @item -mfpmath=@var{unit}
23560 @opindex mfpmath
23561 Generate floating-point arithmetic for selected unit @var{unit}. The choices
23562 for @var{unit} are:
23563
23564 @table @samp
23565 @item 387
23566 Use the standard 387 floating-point coprocessor present on the majority of chips and
23567 emulated otherwise. Code compiled with this option runs almost everywhere.
23568 The temporary results are computed in 80-bit precision instead of the precision
23569 specified by the type, resulting in slightly different results compared to most
23570 of other chips. See @option{-ffloat-store} for more detailed description.
23571
23572 This is the default choice for x86-32 targets.
23573
23574 @item sse
23575 Use scalar floating-point instructions present in the SSE instruction set.
23576 This instruction set is supported by Pentium III and newer chips,
23577 and in the AMD line
23578 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
23579 instruction set supports only single-precision arithmetic, thus the double and
23580 extended-precision arithmetic are still done using 387. A later version, present
23581 only in Pentium 4 and AMD x86-64 chips, supports double-precision
23582 arithmetic too.
23583
23584 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
23585 or @option{-msse2} switches to enable SSE extensions and make this option
23586 effective. For the x86-64 compiler, these extensions are enabled by default.
23587
23588 The resulting code should be considerably faster in the majority of cases and avoid
23589 the numerical instability problems of 387 code, but may break some existing
23590 code that expects temporaries to be 80 bits.
23591
23592 This is the default choice for the x86-64 compiler.
23593
23594 @item sse,387
23595 @itemx sse+387
23596 @itemx both
23597 Attempt to utilize both instruction sets at once. This effectively doubles the
23598 amount of available registers, and on chips with separate execution units for
23599 387 and SSE the execution resources too. Use this option with care, as it is
23600 still experimental, because the GCC register allocator does not model separate
23601 functional units well, resulting in unstable performance.
23602 @end table
23603
23604 @item -masm=@var{dialect}
23605 @opindex masm=@var{dialect}
23606 Output assembly instructions using selected @var{dialect}. Also affects
23607 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
23608 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
23609 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
23610 not support @samp{intel}.
23611
23612 @item -mieee-fp
23613 @itemx -mno-ieee-fp
23614 @opindex mieee-fp
23615 @opindex mno-ieee-fp
23616 Control whether or not the compiler uses IEEE floating-point
23617 comparisons. These correctly handle the case where the result of a
23618 comparison is unordered.
23619
23620 @item -m80387
23621 @item -mhard-float
23622 @opindex 80387
23623 @opindex mhard-float
23624 Generate output containing 80387 instructions for floating point.
23625
23626 @item -mno-80387
23627 @item -msoft-float
23628 @opindex no-80387
23629 @opindex msoft-float
23630 Generate output containing library calls for floating point.
23631
23632 @strong{Warning:} the requisite libraries are not part of GCC@.
23633 Normally the facilities of the machine's usual C compiler are used, but
23634 this can't be done directly in cross-compilation. You must make your
23635 own arrangements to provide suitable library functions for
23636 cross-compilation.
23637
23638 On machines where a function returns floating-point results in the 80387
23639 register stack, some floating-point opcodes may be emitted even if
23640 @option{-msoft-float} is used.
23641
23642 @item -mno-fp-ret-in-387
23643 @opindex mno-fp-ret-in-387
23644 Do not use the FPU registers for return values of functions.
23645
23646 The usual calling convention has functions return values of types
23647 @code{float} and @code{double} in an FPU register, even if there
23648 is no FPU@. The idea is that the operating system should emulate
23649 an FPU@.
23650
23651 The option @option{-mno-fp-ret-in-387} causes such values to be returned
23652 in ordinary CPU registers instead.
23653
23654 @item -mno-fancy-math-387
23655 @opindex mno-fancy-math-387
23656 Some 387 emulators do not support the @code{sin}, @code{cos} and
23657 @code{sqrt} instructions for the 387. Specify this option to avoid
23658 generating those instructions. This option is the default on
23659 OpenBSD and NetBSD@. This option is overridden when @option{-march}
23660 indicates that the target CPU always has an FPU and so the
23661 instruction does not need emulation. These
23662 instructions are not generated unless you also use the
23663 @option{-funsafe-math-optimizations} switch.
23664
23665 @item -malign-double
23666 @itemx -mno-align-double
23667 @opindex malign-double
23668 @opindex mno-align-double
23669 Control whether GCC aligns @code{double}, @code{long double}, and
23670 @code{long long} variables on a two-word boundary or a one-word
23671 boundary. Aligning @code{double} variables on a two-word boundary
23672 produces code that runs somewhat faster on a Pentium at the
23673 expense of more memory.
23674
23675 On x86-64, @option{-malign-double} is enabled by default.
23676
23677 @strong{Warning:} if you use the @option{-malign-double} switch,
23678 structures containing the above types are aligned differently than
23679 the published application binary interface specifications for the x86-32
23680 and are not binary compatible with structures in code compiled
23681 without that switch.
23682
23683 @item -m96bit-long-double
23684 @itemx -m128bit-long-double
23685 @opindex m96bit-long-double
23686 @opindex m128bit-long-double
23687 These switches control the size of @code{long double} type. The x86-32
23688 application binary interface specifies the size to be 96 bits,
23689 so @option{-m96bit-long-double} is the default in 32-bit mode.
23690
23691 Modern architectures (Pentium and newer) prefer @code{long double}
23692 to be aligned to an 8- or 16-byte boundary. In arrays or structures
23693 conforming to the ABI, this is not possible. So specifying
23694 @option{-m128bit-long-double} aligns @code{long double}
23695 to a 16-byte boundary by padding the @code{long double} with an additional
23696 32-bit zero.
23697
23698 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
23699 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
23700
23701 Notice that neither of these options enable any extra precision over the x87
23702 standard of 80 bits for a @code{long double}.
23703
23704 @strong{Warning:} if you override the default value for your target ABI, this
23705 changes the size of
23706 structures and arrays containing @code{long double} variables,
23707 as well as modifying the function calling convention for functions taking
23708 @code{long double}. Hence they are not binary-compatible
23709 with code compiled without that switch.
23710
23711 @item -mlong-double-64
23712 @itemx -mlong-double-80
23713 @itemx -mlong-double-128
23714 @opindex mlong-double-64
23715 @opindex mlong-double-80
23716 @opindex mlong-double-128
23717 These switches control the size of @code{long double} type. A size
23718 of 64 bits makes the @code{long double} type equivalent to the @code{double}
23719 type. This is the default for 32-bit Bionic C library. A size
23720 of 128 bits makes the @code{long double} type equivalent to the
23721 @code{__float128} type. This is the default for 64-bit Bionic C library.
23722
23723 @strong{Warning:} if you override the default value for your target ABI, this
23724 changes the size of
23725 structures and arrays containing @code{long double} variables,
23726 as well as modifying the function calling convention for functions taking
23727 @code{long double}. Hence they are not binary-compatible
23728 with code compiled without that switch.
23729
23730 @item -malign-data=@var{type}
23731 @opindex malign-data
23732 Control how GCC aligns variables. Supported values for @var{type} are
23733 @samp{compat} uses increased alignment value compatible uses GCC 4.8
23734 and earlier, @samp{abi} uses alignment value as specified by the
23735 psABI, and @samp{cacheline} uses increased alignment value to match
23736 the cache line size. @samp{compat} is the default.
23737
23738 @item -mlarge-data-threshold=@var{threshold}
23739 @opindex mlarge-data-threshold
23740 When @option{-mcmodel=medium} is specified, data objects larger than
23741 @var{threshold} are placed in the large data section. This value must be the
23742 same across all objects linked into the binary, and defaults to 65535.
23743
23744 @item -mrtd
23745 @opindex mrtd
23746 Use a different function-calling convention, in which functions that
23747 take a fixed number of arguments return with the @code{ret @var{num}}
23748 instruction, which pops their arguments while returning. This saves one
23749 instruction in the caller since there is no need to pop the arguments
23750 there.
23751
23752 You can specify that an individual function is called with this calling
23753 sequence with the function attribute @code{stdcall}. You can also
23754 override the @option{-mrtd} option by using the function attribute
23755 @code{cdecl}. @xref{Function Attributes}.
23756
23757 @strong{Warning:} this calling convention is incompatible with the one
23758 normally used on Unix, so you cannot use it if you need to call
23759 libraries compiled with the Unix compiler.
23760
23761 Also, you must provide function prototypes for all functions that
23762 take variable numbers of arguments (including @code{printf});
23763 otherwise incorrect code is generated for calls to those
23764 functions.
23765
23766 In addition, seriously incorrect code results if you call a
23767 function with too many arguments. (Normally, extra arguments are
23768 harmlessly ignored.)
23769
23770 @item -mregparm=@var{num}
23771 @opindex mregparm
23772 Control how many registers are used to pass integer arguments. By
23773 default, no registers are used to pass arguments, and at most 3
23774 registers can be used. You can control this behavior for a specific
23775 function by using the function attribute @code{regparm}.
23776 @xref{Function Attributes}.
23777
23778 @strong{Warning:} if you use this switch, and
23779 @var{num} is nonzero, then you must build all modules with the same
23780 value, including any libraries. This includes the system libraries and
23781 startup modules.
23782
23783 @item -msseregparm
23784 @opindex msseregparm
23785 Use SSE register passing conventions for float and double arguments
23786 and return values. You can control this behavior for a specific
23787 function by using the function attribute @code{sseregparm}.
23788 @xref{Function Attributes}.
23789
23790 @strong{Warning:} if you use this switch then you must build all
23791 modules with the same value, including any libraries. This includes
23792 the system libraries and startup modules.
23793
23794 @item -mvect8-ret-in-mem
23795 @opindex mvect8-ret-in-mem
23796 Return 8-byte vectors in memory instead of MMX registers. This is the
23797 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
23798 Studio compilers until version 12. Later compiler versions (starting
23799 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
23800 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
23801 you need to remain compatible with existing code produced by those
23802 previous compiler versions or older versions of GCC@.
23803
23804 @item -mpc32
23805 @itemx -mpc64
23806 @itemx -mpc80
23807 @opindex mpc32
23808 @opindex mpc64
23809 @opindex mpc80
23810
23811 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
23812 is specified, the significands of results of floating-point operations are
23813 rounded to 24 bits (single precision); @option{-mpc64} rounds the
23814 significands of results of floating-point operations to 53 bits (double
23815 precision) and @option{-mpc80} rounds the significands of results of
23816 floating-point operations to 64 bits (extended double precision), which is
23817 the default. When this option is used, floating-point operations in higher
23818 precisions are not available to the programmer without setting the FPU
23819 control word explicitly.
23820
23821 Setting the rounding of floating-point operations to less than the default
23822 80 bits can speed some programs by 2% or more. Note that some mathematical
23823 libraries assume that extended-precision (80-bit) floating-point operations
23824 are enabled by default; routines in such libraries could suffer significant
23825 loss of accuracy, typically through so-called ``catastrophic cancellation'',
23826 when this option is used to set the precision to less than extended precision.
23827
23828 @item -mstackrealign
23829 @opindex mstackrealign
23830 Realign the stack at entry. On the x86, the @option{-mstackrealign}
23831 option generates an alternate prologue and epilogue that realigns the
23832 run-time stack if necessary. This supports mixing legacy codes that keep
23833 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
23834 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
23835 applicable to individual functions.
23836
23837 @item -mpreferred-stack-boundary=@var{num}
23838 @opindex mpreferred-stack-boundary
23839 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23840 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23841 the default is 4 (16 bytes or 128 bits).
23842
23843 @strong{Warning:} When generating code for the x86-64 architecture with
23844 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
23845 used to keep the stack boundary aligned to 8 byte boundary. Since
23846 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
23847 intended to be used in controlled environment where stack space is
23848 important limitation. This option leads to wrong code when functions
23849 compiled with 16 byte stack alignment (such as functions from a standard
23850 library) are called with misaligned stack. In this case, SSE
23851 instructions may lead to misaligned memory access traps. In addition,
23852 variable arguments are handled incorrectly for 16 byte aligned
23853 objects (including x87 long double and __int128), leading to wrong
23854 results. You must build all modules with
23855 @option{-mpreferred-stack-boundary=3}, including any libraries. This
23856 includes the system libraries and startup modules.
23857
23858 @item -mincoming-stack-boundary=@var{num}
23859 @opindex mincoming-stack-boundary
23860 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
23861 boundary. If @option{-mincoming-stack-boundary} is not specified,
23862 the one specified by @option{-mpreferred-stack-boundary} is used.
23863
23864 On Pentium and Pentium Pro, @code{double} and @code{long double} values
23865 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
23866 suffer significant run time performance penalties. On Pentium III, the
23867 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
23868 properly if it is not 16-byte aligned.
23869
23870 To ensure proper alignment of this values on the stack, the stack boundary
23871 must be as aligned as that required by any value stored on the stack.
23872 Further, every function must be generated such that it keeps the stack
23873 aligned. Thus calling a function compiled with a higher preferred
23874 stack boundary from a function compiled with a lower preferred stack
23875 boundary most likely misaligns the stack. It is recommended that
23876 libraries that use callbacks always use the default setting.
23877
23878 This extra alignment does consume extra stack space, and generally
23879 increases code size. Code that is sensitive to stack space usage, such
23880 as embedded systems and operating system kernels, may want to reduce the
23881 preferred alignment to @option{-mpreferred-stack-boundary=2}.
23882
23883 @need 200
23884 @item -mmmx
23885 @opindex mmmx
23886 @need 200
23887 @itemx -msse
23888 @opindex msse
23889 @need 200
23890 @itemx -msse2
23891 @opindex msse2
23892 @need 200
23893 @itemx -msse3
23894 @opindex msse3
23895 @need 200
23896 @itemx -mssse3
23897 @opindex mssse3
23898 @need 200
23899 @itemx -msse4
23900 @opindex msse4
23901 @need 200
23902 @itemx -msse4a
23903 @opindex msse4a
23904 @need 200
23905 @itemx -msse4.1
23906 @opindex msse4.1
23907 @need 200
23908 @itemx -msse4.2
23909 @opindex msse4.2
23910 @need 200
23911 @itemx -mavx
23912 @opindex mavx
23913 @need 200
23914 @itemx -mavx2
23915 @opindex mavx2
23916 @need 200
23917 @itemx -mavx512f
23918 @opindex mavx512f
23919 @need 200
23920 @itemx -mavx512pf
23921 @opindex mavx512pf
23922 @need 200
23923 @itemx -mavx512er
23924 @opindex mavx512er
23925 @need 200
23926 @itemx -mavx512cd
23927 @opindex mavx512cd
23928 @need 200
23929 @itemx -mavx512vl
23930 @opindex mavx512vl
23931 @need 200
23932 @itemx -mavx512bw
23933 @opindex mavx512bw
23934 @need 200
23935 @itemx -mavx512dq
23936 @opindex mavx512dq
23937 @need 200
23938 @itemx -mavx512ifma
23939 @opindex mavx512ifma
23940 @need 200
23941 @itemx -mavx512vbmi
23942 @opindex mavx512vbmi
23943 @need 200
23944 @itemx -msha
23945 @opindex msha
23946 @need 200
23947 @itemx -maes
23948 @opindex maes
23949 @need 200
23950 @itemx -mpclmul
23951 @opindex mpclmul
23952 @need 200
23953 @itemx -mclfushopt
23954 @opindex mclfushopt
23955 @need 200
23956 @itemx -mfsgsbase
23957 @opindex mfsgsbase
23958 @need 200
23959 @itemx -mrdrnd
23960 @opindex mrdrnd
23961 @need 200
23962 @itemx -mf16c
23963 @opindex mf16c
23964 @need 200
23965 @itemx -mfma
23966 @opindex mfma
23967 @need 200
23968 @itemx -mfma4
23969 @opindex mfma4
23970 @need 200
23971 @itemx -mprefetchwt1
23972 @opindex mprefetchwt1
23973 @need 200
23974 @itemx -mxop
23975 @opindex mxop
23976 @need 200
23977 @itemx -mlwp
23978 @opindex mlwp
23979 @need 200
23980 @itemx -m3dnow
23981 @opindex m3dnow
23982 @need 200
23983 @itemx -mpopcnt
23984 @opindex mpopcnt
23985 @need 200
23986 @itemx -mabm
23987 @opindex mabm
23988 @need 200
23989 @itemx -mbmi
23990 @opindex mbmi
23991 @need 200
23992 @itemx -mbmi2
23993 @need 200
23994 @itemx -mlzcnt
23995 @opindex mlzcnt
23996 @need 200
23997 @itemx -mfxsr
23998 @opindex mfxsr
23999 @need 200
24000 @itemx -mxsave
24001 @opindex mxsave
24002 @need 200
24003 @itemx -mxsaveopt
24004 @opindex mxsaveopt
24005 @need 200
24006 @itemx -mxsavec
24007 @opindex mxsavec
24008 @need 200
24009 @itemx -mxsaves
24010 @opindex mxsaves
24011 @need 200
24012 @itemx -mrtm
24013 @opindex mrtm
24014 @need 200
24015 @itemx -mtbm
24016 @opindex mtbm
24017 @need 200
24018 @itemx -mmpx
24019 @opindex mmpx
24020 @need 200
24021 @itemx -mmwaitx
24022 @opindex mmwaitx
24023 @need 200
24024 @itemx -mclzero
24025 @opindex mclzero
24026 @itemx -mpku
24027 @opindex mpku
24028 These switches enable the use of instructions in the MMX, SSE,
24029 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
24030 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
24031 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
24032 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU or 3DNow!@:
24033 extended instruction sets. Each has a corresponding @option{-mno-} option
24034 to disable use of these instructions.
24035
24036 These extensions are also available as built-in functions: see
24037 @ref{x86 Built-in Functions}, for details of the functions enabled and
24038 disabled by these switches.
24039
24040 To generate SSE/SSE2 instructions automatically from floating-point
24041 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
24042
24043 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
24044 generates new AVX instructions or AVX equivalence for all SSEx instructions
24045 when needed.
24046
24047 These options enable GCC to use these extended instructions in
24048 generated code, even without @option{-mfpmath=sse}. Applications that
24049 perform run-time CPU detection must compile separate files for each
24050 supported architecture, using the appropriate flags. In particular,
24051 the file containing the CPU detection code should be compiled without
24052 these options.
24053
24054 @item -mdump-tune-features
24055 @opindex mdump-tune-features
24056 This option instructs GCC to dump the names of the x86 performance
24057 tuning features and default settings. The names can be used in
24058 @option{-mtune-ctrl=@var{feature-list}}.
24059
24060 @item -mtune-ctrl=@var{feature-list}
24061 @opindex mtune-ctrl=@var{feature-list}
24062 This option is used to do fine grain control of x86 code generation features.
24063 @var{feature-list} is a comma separated list of @var{feature} names. See also
24064 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
24065 on if it is not preceded with @samp{^}, otherwise, it is turned off.
24066 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
24067 developers. Using it may lead to code paths not covered by testing and can
24068 potentially result in compiler ICEs or runtime errors.
24069
24070 @item -mno-default
24071 @opindex mno-default
24072 This option instructs GCC to turn off all tunable features. See also
24073 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
24074
24075 @item -mcld
24076 @opindex mcld
24077 This option instructs GCC to emit a @code{cld} instruction in the prologue
24078 of functions that use string instructions. String instructions depend on
24079 the DF flag to select between autoincrement or autodecrement mode. While the
24080 ABI specifies the DF flag to be cleared on function entry, some operating
24081 systems violate this specification by not clearing the DF flag in their
24082 exception dispatchers. The exception handler can be invoked with the DF flag
24083 set, which leads to wrong direction mode when string instructions are used.
24084 This option can be enabled by default on 32-bit x86 targets by configuring
24085 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
24086 instructions can be suppressed with the @option{-mno-cld} compiler option
24087 in this case.
24088
24089 @item -mvzeroupper
24090 @opindex mvzeroupper
24091 This option instructs GCC to emit a @code{vzeroupper} instruction
24092 before a transfer of control flow out of the function to minimize
24093 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
24094 intrinsics.
24095
24096 @item -mprefer-avx128
24097 @opindex mprefer-avx128
24098 This option instructs GCC to use 128-bit AVX instructions instead of
24099 256-bit AVX instructions in the auto-vectorizer.
24100
24101 @item -mcx16
24102 @opindex mcx16
24103 This option enables GCC to generate @code{CMPXCHG16B} instructions.
24104 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
24105 (or oword) data types.
24106 This is useful for high-resolution counters that can be updated
24107 by multiple processors (or cores). This instruction is generated as part of
24108 atomic built-in functions: see @ref{__sync Builtins} or
24109 @ref{__atomic Builtins} for details.
24110
24111 @item -msahf
24112 @opindex msahf
24113 This option enables generation of @code{SAHF} instructions in 64-bit code.
24114 Early Intel Pentium 4 CPUs with Intel 64 support,
24115 prior to the introduction of Pentium 4 G1 step in December 2005,
24116 lacked the @code{LAHF} and @code{SAHF} instructions
24117 which are supported by AMD64.
24118 These are load and store instructions, respectively, for certain status flags.
24119 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
24120 @code{drem}, and @code{remainder} built-in functions;
24121 see @ref{Other Builtins} for details.
24122
24123 @item -mmovbe
24124 @opindex mmovbe
24125 This option enables use of the @code{movbe} instruction to implement
24126 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
24127
24128 @item -mcrc32
24129 @opindex mcrc32
24130 This option enables built-in functions @code{__builtin_ia32_crc32qi},
24131 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
24132 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
24133
24134 @item -mrecip
24135 @opindex mrecip
24136 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
24137 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
24138 with an additional Newton-Raphson step
24139 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
24140 (and their vectorized
24141 variants) for single-precision floating-point arguments. These instructions
24142 are generated only when @option{-funsafe-math-optimizations} is enabled
24143 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
24144 Note that while the throughput of the sequence is higher than the throughput
24145 of the non-reciprocal instruction, the precision of the sequence can be
24146 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
24147
24148 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
24149 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
24150 combination), and doesn't need @option{-mrecip}.
24151
24152 Also note that GCC emits the above sequence with additional Newton-Raphson step
24153 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
24154 already with @option{-ffast-math} (or the above option combination), and
24155 doesn't need @option{-mrecip}.
24156
24157 @item -mrecip=@var{opt}
24158 @opindex mrecip=opt
24159 This option controls which reciprocal estimate instructions
24160 may be used. @var{opt} is a comma-separated list of options, which may
24161 be preceded by a @samp{!} to invert the option:
24162
24163 @table @samp
24164 @item all
24165 Enable all estimate instructions.
24166
24167 @item default
24168 Enable the default instructions, equivalent to @option{-mrecip}.
24169
24170 @item none
24171 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24172
24173 @item div
24174 Enable the approximation for scalar division.
24175
24176 @item vec-div
24177 Enable the approximation for vectorized division.
24178
24179 @item sqrt
24180 Enable the approximation for scalar square root.
24181
24182 @item vec-sqrt
24183 Enable the approximation for vectorized square root.
24184 @end table
24185
24186 So, for example, @option{-mrecip=all,!sqrt} enables
24187 all of the reciprocal approximations, except for square root.
24188
24189 @item -mveclibabi=@var{type}
24190 @opindex mveclibabi
24191 Specifies the ABI type to use for vectorizing intrinsics using an
24192 external library. Supported values for @var{type} are @samp{svml}
24193 for the Intel short
24194 vector math library and @samp{acml} for the AMD math core library.
24195 To use this option, both @option{-ftree-vectorize} and
24196 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
24197 ABI-compatible library must be specified at link time.
24198
24199 GCC currently emits calls to @code{vmldExp2},
24200 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
24201 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
24202 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
24203 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
24204 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
24205 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
24206 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
24207 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
24208 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
24209 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
24210 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
24211 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
24212 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
24213 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
24214 when @option{-mveclibabi=acml} is used.
24215
24216 @item -mabi=@var{name}
24217 @opindex mabi
24218 Generate code for the specified calling convention. Permissible values
24219 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
24220 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
24221 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
24222 You can control this behavior for specific functions by
24223 using the function attributes @code{ms_abi} and @code{sysv_abi}.
24224 @xref{Function Attributes}.
24225
24226 @item -mtls-dialect=@var{type}
24227 @opindex mtls-dialect
24228 Generate code to access thread-local storage using the @samp{gnu} or
24229 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
24230 @samp{gnu2} is more efficient, but it may add compile- and run-time
24231 requirements that cannot be satisfied on all systems.
24232
24233 @item -mpush-args
24234 @itemx -mno-push-args
24235 @opindex mpush-args
24236 @opindex mno-push-args
24237 Use PUSH operations to store outgoing parameters. This method is shorter
24238 and usually equally fast as method using SUB/MOV operations and is enabled
24239 by default. In some cases disabling it may improve performance because of
24240 improved scheduling and reduced dependencies.
24241
24242 @item -maccumulate-outgoing-args
24243 @opindex maccumulate-outgoing-args
24244 If enabled, the maximum amount of space required for outgoing arguments is
24245 computed in the function prologue. This is faster on most modern CPUs
24246 because of reduced dependencies, improved scheduling and reduced stack usage
24247 when the preferred stack boundary is not equal to 2. The drawback is a notable
24248 increase in code size. This switch implies @option{-mno-push-args}.
24249
24250 @item -mthreads
24251 @opindex mthreads
24252 Support thread-safe exception handling on MinGW. Programs that rely
24253 on thread-safe exception handling must compile and link all code with the
24254 @option{-mthreads} option. When compiling, @option{-mthreads} defines
24255 @option{-D_MT}; when linking, it links in a special thread helper library
24256 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
24257
24258 @item -mms-bitfields
24259 @itemx -mno-ms-bitfields
24260 @opindex mms-bitfields
24261 @opindex mno-ms-bitfields
24262
24263 Enable/disable bit-field layout compatible with the native Microsoft
24264 Windows compiler.
24265
24266 If @code{packed} is used on a structure, or if bit-fields are used,
24267 it may be that the Microsoft ABI lays out the structure differently
24268 than the way GCC normally does. Particularly when moving packed
24269 data between functions compiled with GCC and the native Microsoft compiler
24270 (either via function call or as data in a file), it may be necessary to access
24271 either format.
24272
24273 This option is enabled by default for Microsoft Windows
24274 targets. This behavior can also be controlled locally by use of variable
24275 or type attributes. For more information, see @ref{x86 Variable Attributes}
24276 and @ref{x86 Type Attributes}.
24277
24278 The Microsoft structure layout algorithm is fairly simple with the exception
24279 of the bit-field packing.
24280 The padding and alignment of members of structures and whether a bit-field
24281 can straddle a storage-unit boundary are determine by these rules:
24282
24283 @enumerate
24284 @item Structure members are stored sequentially in the order in which they are
24285 declared: the first member has the lowest memory address and the last member
24286 the highest.
24287
24288 @item Every data object has an alignment requirement. The alignment requirement
24289 for all data except structures, unions, and arrays is either the size of the
24290 object or the current packing size (specified with either the
24291 @code{aligned} attribute or the @code{pack} pragma),
24292 whichever is less. For structures, unions, and arrays,
24293 the alignment requirement is the largest alignment requirement of its members.
24294 Every object is allocated an offset so that:
24295
24296 @smallexample
24297 offset % alignment_requirement == 0
24298 @end smallexample
24299
24300 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
24301 unit if the integral types are the same size and if the next bit-field fits
24302 into the current allocation unit without crossing the boundary imposed by the
24303 common alignment requirements of the bit-fields.
24304 @end enumerate
24305
24306 MSVC interprets zero-length bit-fields in the following ways:
24307
24308 @enumerate
24309 @item If a zero-length bit-field is inserted between two bit-fields that
24310 are normally coalesced, the bit-fields are not coalesced.
24311
24312 For example:
24313
24314 @smallexample
24315 struct
24316 @{
24317 unsigned long bf_1 : 12;
24318 unsigned long : 0;
24319 unsigned long bf_2 : 12;
24320 @} t1;
24321 @end smallexample
24322
24323 @noindent
24324 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
24325 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
24326
24327 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
24328 alignment of the zero-length bit-field is greater than the member that follows it,
24329 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
24330
24331 For example:
24332
24333 @smallexample
24334 struct
24335 @{
24336 char foo : 4;
24337 short : 0;
24338 char bar;
24339 @} t2;
24340
24341 struct
24342 @{
24343 char foo : 4;
24344 short : 0;
24345 double bar;
24346 @} t3;
24347 @end smallexample
24348
24349 @noindent
24350 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
24351 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
24352 bit-field does not affect the alignment of @code{bar} or, as a result, the size
24353 of the structure.
24354
24355 Taking this into account, it is important to note the following:
24356
24357 @enumerate
24358 @item If a zero-length bit-field follows a normal bit-field, the type of the
24359 zero-length bit-field may affect the alignment of the structure as whole. For
24360 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
24361 normal bit-field, and is of type short.
24362
24363 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
24364 still affect the alignment of the structure:
24365
24366 @smallexample
24367 struct
24368 @{
24369 char foo : 6;
24370 long : 0;
24371 @} t4;
24372 @end smallexample
24373
24374 @noindent
24375 Here, @code{t4} takes up 4 bytes.
24376 @end enumerate
24377
24378 @item Zero-length bit-fields following non-bit-field members are ignored:
24379
24380 @smallexample
24381 struct
24382 @{
24383 char foo;
24384 long : 0;
24385 char bar;
24386 @} t5;
24387 @end smallexample
24388
24389 @noindent
24390 Here, @code{t5} takes up 2 bytes.
24391 @end enumerate
24392
24393
24394 @item -mno-align-stringops
24395 @opindex mno-align-stringops
24396 Do not align the destination of inlined string operations. This switch reduces
24397 code size and improves performance in case the destination is already aligned,
24398 but GCC doesn't know about it.
24399
24400 @item -minline-all-stringops
24401 @opindex minline-all-stringops
24402 By default GCC inlines string operations only when the destination is
24403 known to be aligned to least a 4-byte boundary.
24404 This enables more inlining and increases code
24405 size, but may improve performance of code that depends on fast
24406 @code{memcpy}, @code{strlen},
24407 and @code{memset} for short lengths.
24408
24409 @item -minline-stringops-dynamically
24410 @opindex minline-stringops-dynamically
24411 For string operations of unknown size, use run-time checks with
24412 inline code for small blocks and a library call for large blocks.
24413
24414 @item -mstringop-strategy=@var{alg}
24415 @opindex mstringop-strategy=@var{alg}
24416 Override the internal decision heuristic for the particular algorithm to use
24417 for inlining string operations. The allowed values for @var{alg} are:
24418
24419 @table @samp
24420 @item rep_byte
24421 @itemx rep_4byte
24422 @itemx rep_8byte
24423 Expand using i386 @code{rep} prefix of the specified size.
24424
24425 @item byte_loop
24426 @itemx loop
24427 @itemx unrolled_loop
24428 Expand into an inline loop.
24429
24430 @item libcall
24431 Always use a library call.
24432 @end table
24433
24434 @item -mmemcpy-strategy=@var{strategy}
24435 @opindex mmemcpy-strategy=@var{strategy}
24436 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
24437 should be inlined and what inline algorithm to use when the expected size
24438 of the copy operation is known. @var{strategy}
24439 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
24440 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
24441 the max byte size with which inline algorithm @var{alg} is allowed. For the last
24442 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
24443 in the list must be specified in increasing order. The minimal byte size for
24444 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
24445 preceding range.
24446
24447 @item -mmemset-strategy=@var{strategy}
24448 @opindex mmemset-strategy=@var{strategy}
24449 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
24450 @code{__builtin_memset} expansion.
24451
24452 @item -momit-leaf-frame-pointer
24453 @opindex momit-leaf-frame-pointer
24454 Don't keep the frame pointer in a register for leaf functions. This
24455 avoids the instructions to save, set up, and restore frame pointers and
24456 makes an extra register available in leaf functions. The option
24457 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
24458 which might make debugging harder.
24459
24460 @item -mtls-direct-seg-refs
24461 @itemx -mno-tls-direct-seg-refs
24462 @opindex mtls-direct-seg-refs
24463 Controls whether TLS variables may be accessed with offsets from the
24464 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
24465 or whether the thread base pointer must be added. Whether or not this
24466 is valid depends on the operating system, and whether it maps the
24467 segment to cover the entire TLS area.
24468
24469 For systems that use the GNU C Library, the default is on.
24470
24471 @item -msse2avx
24472 @itemx -mno-sse2avx
24473 @opindex msse2avx
24474 Specify that the assembler should encode SSE instructions with VEX
24475 prefix. The option @option{-mavx} turns this on by default.
24476
24477 @item -mfentry
24478 @itemx -mno-fentry
24479 @opindex mfentry
24480 If profiling is active (@option{-pg}), put the profiling
24481 counter call before the prologue.
24482 Note: On x86 architectures the attribute @code{ms_hook_prologue}
24483 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
24484
24485 @item -mrecord-mcount
24486 @itemx -mno-record-mcount
24487 @opindex mrecord-mcount
24488 If profiling is active (@option{-pg}), generate a __mcount_loc section
24489 that contains pointers to each profiling call. This is useful for
24490 automatically patching and out calls.
24491
24492 @item -mnop-mcount
24493 @itemx -mno-nop-mcount
24494 @opindex mnop-mcount
24495 If profiling is active (@option{-pg}), generate the calls to
24496 the profiling functions as nops. This is useful when they
24497 should be patched in later dynamically. This is likely only
24498 useful together with @option{-mrecord-mcount}.
24499
24500 @item -mskip-rax-setup
24501 @itemx -mno-skip-rax-setup
24502 @opindex mskip-rax-setup
24503 When generating code for the x86-64 architecture with SSE extensions
24504 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
24505 register when there are no variable arguments passed in vector registers.
24506
24507 @strong{Warning:} Since RAX register is used to avoid unnecessarily
24508 saving vector registers on stack when passing variable arguments, the
24509 impacts of this option are callees may waste some stack space,
24510 misbehave or jump to a random location. GCC 4.4 or newer don't have
24511 those issues, regardless the RAX register value.
24512
24513 @item -m8bit-idiv
24514 @itemx -mno-8bit-idiv
24515 @opindex m8bit-idiv
24516 On some processors, like Intel Atom, 8-bit unsigned integer divide is
24517 much faster than 32-bit/64-bit integer divide. This option generates a
24518 run-time check. If both dividend and divisor are within range of 0
24519 to 255, 8-bit unsigned integer divide is used instead of
24520 32-bit/64-bit integer divide.
24521
24522 @item -mavx256-split-unaligned-load
24523 @itemx -mavx256-split-unaligned-store
24524 @opindex mavx256-split-unaligned-load
24525 @opindex mavx256-split-unaligned-store
24526 Split 32-byte AVX unaligned load and store.
24527
24528 @item -mstack-protector-guard=@var{guard}
24529 @opindex mstack-protector-guard=@var{guard}
24530 Generate stack protection code using canary at @var{guard}. Supported
24531 locations are @samp{global} for global canary or @samp{tls} for per-thread
24532 canary in the TLS block (the default). This option has effect only when
24533 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
24534
24535 @item -mmitigate-rop
24536 @opindex mmitigate-rop
24537 Try to avoid generating code sequences that contain unintended return
24538 opcodes, to mitigate against certain forms of attack. At the moment,
24539 this option is limited in what it can do and should not be relied
24540 on to provide serious protection.
24541
24542 @item -mgeneral-regs-only
24543 @opindex mgeneral-regs-only
24544 Generate code that uses only the general-purpose registers. This
24545 prevents the compiler from using floating-point, vector, mask and bound
24546 registers.
24547
24548 @end table
24549
24550 These @samp{-m} switches are supported in addition to the above
24551 on x86-64 processors in 64-bit environments.
24552
24553 @table @gcctabopt
24554 @item -m32
24555 @itemx -m64
24556 @itemx -mx32
24557 @itemx -m16
24558 @itemx -miamcu
24559 @opindex m32
24560 @opindex m64
24561 @opindex mx32
24562 @opindex m16
24563 @opindex miamcu
24564 Generate code for a 16-bit, 32-bit or 64-bit environment.
24565 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
24566 to 32 bits, and
24567 generates code that runs on any i386 system.
24568
24569 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
24570 types to 64 bits, and generates code for the x86-64 architecture.
24571 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
24572 and @option{-mdynamic-no-pic} options.
24573
24574 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
24575 to 32 bits, and
24576 generates code for the x86-64 architecture.
24577
24578 The @option{-m16} option is the same as @option{-m32}, except for that
24579 it outputs the @code{.code16gcc} assembly directive at the beginning of
24580 the assembly output so that the binary can run in 16-bit mode.
24581
24582 The @option{-miamcu} option generates code which conforms to Intel MCU
24583 psABI. It requires the @option{-m32} option to be turned on.
24584
24585 @item -mno-red-zone
24586 @opindex mno-red-zone
24587 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
24588 by the x86-64 ABI; it is a 128-byte area beyond the location of the
24589 stack pointer that is not modified by signal or interrupt handlers
24590 and therefore can be used for temporary data without adjusting the stack
24591 pointer. The flag @option{-mno-red-zone} disables this red zone.
24592
24593 @item -mcmodel=small
24594 @opindex mcmodel=small
24595 Generate code for the small code model: the program and its symbols must
24596 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
24597 Programs can be statically or dynamically linked. This is the default
24598 code model.
24599
24600 @item -mcmodel=kernel
24601 @opindex mcmodel=kernel
24602 Generate code for the kernel code model. The kernel runs in the
24603 negative 2 GB of the address space.
24604 This model has to be used for Linux kernel code.
24605
24606 @item -mcmodel=medium
24607 @opindex mcmodel=medium
24608 Generate code for the medium model: the program is linked in the lower 2
24609 GB of the address space. Small symbols are also placed there. Symbols
24610 with sizes larger than @option{-mlarge-data-threshold} are put into
24611 large data or BSS sections and can be located above 2GB. Programs can
24612 be statically or dynamically linked.
24613
24614 @item -mcmodel=large
24615 @opindex mcmodel=large
24616 Generate code for the large model. This model makes no assumptions
24617 about addresses and sizes of sections.
24618
24619 @item -maddress-mode=long
24620 @opindex maddress-mode=long
24621 Generate code for long address mode. This is only supported for 64-bit
24622 and x32 environments. It is the default address mode for 64-bit
24623 environments.
24624
24625 @item -maddress-mode=short
24626 @opindex maddress-mode=short
24627 Generate code for short address mode. This is only supported for 32-bit
24628 and x32 environments. It is the default address mode for 32-bit and
24629 x32 environments.
24630 @end table
24631
24632 @node x86 Windows Options
24633 @subsection x86 Windows Options
24634 @cindex x86 Windows Options
24635 @cindex Windows Options for x86
24636
24637 These additional options are available for Microsoft Windows targets:
24638
24639 @table @gcctabopt
24640 @item -mconsole
24641 @opindex mconsole
24642 This option
24643 specifies that a console application is to be generated, by
24644 instructing the linker to set the PE header subsystem type
24645 required for console applications.
24646 This option is available for Cygwin and MinGW targets and is
24647 enabled by default on those targets.
24648
24649 @item -mdll
24650 @opindex mdll
24651 This option is available for Cygwin and MinGW targets. It
24652 specifies that a DLL---a dynamic link library---is to be
24653 generated, enabling the selection of the required runtime
24654 startup object and entry point.
24655
24656 @item -mnop-fun-dllimport
24657 @opindex mnop-fun-dllimport
24658 This option is available for Cygwin and MinGW targets. It
24659 specifies that the @code{dllimport} attribute should be ignored.
24660
24661 @item -mthread
24662 @opindex mthread
24663 This option is available for MinGW targets. It specifies
24664 that MinGW-specific thread support is to be used.
24665
24666 @item -municode
24667 @opindex municode
24668 This option is available for MinGW-w64 targets. It causes
24669 the @code{UNICODE} preprocessor macro to be predefined, and
24670 chooses Unicode-capable runtime startup code.
24671
24672 @item -mwin32
24673 @opindex mwin32
24674 This option is available for Cygwin and MinGW targets. It
24675 specifies that the typical Microsoft Windows predefined macros are to
24676 be set in the pre-processor, but does not influence the choice
24677 of runtime library/startup code.
24678
24679 @item -mwindows
24680 @opindex mwindows
24681 This option is available for Cygwin and MinGW targets. It
24682 specifies that a GUI application is to be generated by
24683 instructing the linker to set the PE header subsystem type
24684 appropriately.
24685
24686 @item -fno-set-stack-executable
24687 @opindex fno-set-stack-executable
24688 This option is available for MinGW targets. It specifies that
24689 the executable flag for the stack used by nested functions isn't
24690 set. This is necessary for binaries running in kernel mode of
24691 Microsoft Windows, as there the User32 API, which is used to set executable
24692 privileges, isn't available.
24693
24694 @item -fwritable-relocated-rdata
24695 @opindex fno-writable-relocated-rdata
24696 This option is available for MinGW and Cygwin targets. It specifies
24697 that relocated-data in read-only section is put into the @code{.data}
24698 section. This is a necessary for older runtimes not supporting
24699 modification of @code{.rdata} sections for pseudo-relocation.
24700
24701 @item -mpe-aligned-commons
24702 @opindex mpe-aligned-commons
24703 This option is available for Cygwin and MinGW targets. It
24704 specifies that the GNU extension to the PE file format that
24705 permits the correct alignment of COMMON variables should be
24706 used when generating code. It is enabled by default if
24707 GCC detects that the target assembler found during configuration
24708 supports the feature.
24709 @end table
24710
24711 See also under @ref{x86 Options} for standard options.
24712
24713 @node Xstormy16 Options
24714 @subsection Xstormy16 Options
24715 @cindex Xstormy16 Options
24716
24717 These options are defined for Xstormy16:
24718
24719 @table @gcctabopt
24720 @item -msim
24721 @opindex msim
24722 Choose startup files and linker script suitable for the simulator.
24723 @end table
24724
24725 @node Xtensa Options
24726 @subsection Xtensa Options
24727 @cindex Xtensa Options
24728
24729 These options are supported for Xtensa targets:
24730
24731 @table @gcctabopt
24732 @item -mconst16
24733 @itemx -mno-const16
24734 @opindex mconst16
24735 @opindex mno-const16
24736 Enable or disable use of @code{CONST16} instructions for loading
24737 constant values. The @code{CONST16} instruction is currently not a
24738 standard option from Tensilica. When enabled, @code{CONST16}
24739 instructions are always used in place of the standard @code{L32R}
24740 instructions. The use of @code{CONST16} is enabled by default only if
24741 the @code{L32R} instruction is not available.
24742
24743 @item -mfused-madd
24744 @itemx -mno-fused-madd
24745 @opindex mfused-madd
24746 @opindex mno-fused-madd
24747 Enable or disable use of fused multiply/add and multiply/subtract
24748 instructions in the floating-point option. This has no effect if the
24749 floating-point option is not also enabled. Disabling fused multiply/add
24750 and multiply/subtract instructions forces the compiler to use separate
24751 instructions for the multiply and add/subtract operations. This may be
24752 desirable in some cases where strict IEEE 754-compliant results are
24753 required: the fused multiply add/subtract instructions do not round the
24754 intermediate result, thereby producing results with @emph{more} bits of
24755 precision than specified by the IEEE standard. Disabling fused multiply
24756 add/subtract instructions also ensures that the program output is not
24757 sensitive to the compiler's ability to combine multiply and add/subtract
24758 operations.
24759
24760 @item -mserialize-volatile
24761 @itemx -mno-serialize-volatile
24762 @opindex mserialize-volatile
24763 @opindex mno-serialize-volatile
24764 When this option is enabled, GCC inserts @code{MEMW} instructions before
24765 @code{volatile} memory references to guarantee sequential consistency.
24766 The default is @option{-mserialize-volatile}. Use
24767 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
24768
24769 @item -mforce-no-pic
24770 @opindex mforce-no-pic
24771 For targets, like GNU/Linux, where all user-mode Xtensa code must be
24772 position-independent code (PIC), this option disables PIC for compiling
24773 kernel code.
24774
24775 @item -mtext-section-literals
24776 @itemx -mno-text-section-literals
24777 @opindex mtext-section-literals
24778 @opindex mno-text-section-literals
24779 These options control the treatment of literal pools. The default is
24780 @option{-mno-text-section-literals}, which places literals in a separate
24781 section in the output file. This allows the literal pool to be placed
24782 in a data RAM/ROM, and it also allows the linker to combine literal
24783 pools from separate object files to remove redundant literals and
24784 improve code size. With @option{-mtext-section-literals}, the literals
24785 are interspersed in the text section in order to keep them as close as
24786 possible to their references. This may be necessary for large assembly
24787 files. Literals for each function are placed right before that function.
24788
24789 @item -mauto-litpools
24790 @itemx -mno-auto-litpools
24791 @opindex mauto-litpools
24792 @opindex mno-auto-litpools
24793 These options control the treatment of literal pools. The default is
24794 @option{-mno-auto-litpools}, which places literals in a separate
24795 section in the output file unless @option{-mtext-section-literals} is
24796 used. With @option{-mauto-litpools} the literals are interspersed in
24797 the text section by the assembler. Compiler does not produce explicit
24798 @code{.literal} directives and loads literals into registers with
24799 @code{MOVI} instructions instead of @code{L32R} to let the assembler
24800 do relaxation and place literals as necessary. This option allows
24801 assembler to create several literal pools per function and assemble
24802 very big functions, which may not be possible with
24803 @option{-mtext-section-literals}.
24804
24805 @item -mtarget-align
24806 @itemx -mno-target-align
24807 @opindex mtarget-align
24808 @opindex mno-target-align
24809 When this option is enabled, GCC instructs the assembler to
24810 automatically align instructions to reduce branch penalties at the
24811 expense of some code density. The assembler attempts to widen density
24812 instructions to align branch targets and the instructions following call
24813 instructions. If there are not enough preceding safe density
24814 instructions to align a target, no widening is performed. The
24815 default is @option{-mtarget-align}. These options do not affect the
24816 treatment of auto-aligned instructions like @code{LOOP}, which the
24817 assembler always aligns, either by widening density instructions or
24818 by inserting NOP instructions.
24819
24820 @item -mlongcalls
24821 @itemx -mno-longcalls
24822 @opindex mlongcalls
24823 @opindex mno-longcalls
24824 When this option is enabled, GCC instructs the assembler to translate
24825 direct calls to indirect calls unless it can determine that the target
24826 of a direct call is in the range allowed by the call instruction. This
24827 translation typically occurs for calls to functions in other source
24828 files. Specifically, the assembler translates a direct @code{CALL}
24829 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
24830 The default is @option{-mno-longcalls}. This option should be used in
24831 programs where the call target can potentially be out of range. This
24832 option is implemented in the assembler, not the compiler, so the
24833 assembly code generated by GCC still shows direct call
24834 instructions---look at the disassembled object code to see the actual
24835 instructions. Note that the assembler uses an indirect call for
24836 every cross-file call, not just those that really are out of range.
24837 @end table
24838
24839 @node zSeries Options
24840 @subsection zSeries Options
24841 @cindex zSeries options
24842
24843 These are listed under @xref{S/390 and zSeries Options}.
24844
24845
24846 @c man end
24847
24848 @node Spec Files
24849 @section Specifying Subprocesses and the Switches to Pass to Them
24850 @cindex Spec Files
24851
24852 @command{gcc} is a driver program. It performs its job by invoking a
24853 sequence of other programs to do the work of compiling, assembling and
24854 linking. GCC interprets its command-line parameters and uses these to
24855 deduce which programs it should invoke, and which command-line options
24856 it ought to place on their command lines. This behavior is controlled
24857 by @dfn{spec strings}. In most cases there is one spec string for each
24858 program that GCC can invoke, but a few programs have multiple spec
24859 strings to control their behavior. The spec strings built into GCC can
24860 be overridden by using the @option{-specs=} command-line switch to specify
24861 a spec file.
24862
24863 @dfn{Spec files} are plain-text files that are used to construct spec
24864 strings. They consist of a sequence of directives separated by blank
24865 lines. The type of directive is determined by the first non-whitespace
24866 character on the line, which can be one of the following:
24867
24868 @table @code
24869 @item %@var{command}
24870 Issues a @var{command} to the spec file processor. The commands that can
24871 appear here are:
24872
24873 @table @code
24874 @item %include <@var{file}>
24875 @cindex @code{%include}
24876 Search for @var{file} and insert its text at the current point in the
24877 specs file.
24878
24879 @item %include_noerr <@var{file}>
24880 @cindex @code{%include_noerr}
24881 Just like @samp{%include}, but do not generate an error message if the include
24882 file cannot be found.
24883
24884 @item %rename @var{old_name} @var{new_name}
24885 @cindex @code{%rename}
24886 Rename the spec string @var{old_name} to @var{new_name}.
24887
24888 @end table
24889
24890 @item *[@var{spec_name}]:
24891 This tells the compiler to create, override or delete the named spec
24892 string. All lines after this directive up to the next directive or
24893 blank line are considered to be the text for the spec string. If this
24894 results in an empty string then the spec is deleted. (Or, if the
24895 spec did not exist, then nothing happens.) Otherwise, if the spec
24896 does not currently exist a new spec is created. If the spec does
24897 exist then its contents are overridden by the text of this
24898 directive, unless the first character of that text is the @samp{+}
24899 character, in which case the text is appended to the spec.
24900
24901 @item [@var{suffix}]:
24902 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
24903 and up to the next directive or blank line are considered to make up the
24904 spec string for the indicated suffix. When the compiler encounters an
24905 input file with the named suffix, it processes the spec string in
24906 order to work out how to compile that file. For example:
24907
24908 @smallexample
24909 .ZZ:
24910 z-compile -input %i
24911 @end smallexample
24912
24913 This says that any input file whose name ends in @samp{.ZZ} should be
24914 passed to the program @samp{z-compile}, which should be invoked with the
24915 command-line switch @option{-input} and with the result of performing the
24916 @samp{%i} substitution. (See below.)
24917
24918 As an alternative to providing a spec string, the text following a
24919 suffix directive can be one of the following:
24920
24921 @table @code
24922 @item @@@var{language}
24923 This says that the suffix is an alias for a known @var{language}. This is
24924 similar to using the @option{-x} command-line switch to GCC to specify a
24925 language explicitly. For example:
24926
24927 @smallexample
24928 .ZZ:
24929 @@c++
24930 @end smallexample
24931
24932 Says that .ZZ files are, in fact, C++ source files.
24933
24934 @item #@var{name}
24935 This causes an error messages saying:
24936
24937 @smallexample
24938 @var{name} compiler not installed on this system.
24939 @end smallexample
24940 @end table
24941
24942 GCC already has an extensive list of suffixes built into it.
24943 This directive adds an entry to the end of the list of suffixes, but
24944 since the list is searched from the end backwards, it is effectively
24945 possible to override earlier entries using this technique.
24946
24947 @end table
24948
24949 GCC has the following spec strings built into it. Spec files can
24950 override these strings or create their own. Note that individual
24951 targets can also add their own spec strings to this list.
24952
24953 @smallexample
24954 asm Options to pass to the assembler
24955 asm_final Options to pass to the assembler post-processor
24956 cpp Options to pass to the C preprocessor
24957 cc1 Options to pass to the C compiler
24958 cc1plus Options to pass to the C++ compiler
24959 endfile Object files to include at the end of the link
24960 link Options to pass to the linker
24961 lib Libraries to include on the command line to the linker
24962 libgcc Decides which GCC support library to pass to the linker
24963 linker Sets the name of the linker
24964 predefines Defines to be passed to the C preprocessor
24965 signed_char Defines to pass to CPP to say whether @code{char} is signed
24966 by default
24967 startfile Object files to include at the start of the link
24968 @end smallexample
24969
24970 Here is a small example of a spec file:
24971
24972 @smallexample
24973 %rename lib old_lib
24974
24975 *lib:
24976 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
24977 @end smallexample
24978
24979 This example renames the spec called @samp{lib} to @samp{old_lib} and
24980 then overrides the previous definition of @samp{lib} with a new one.
24981 The new definition adds in some extra command-line options before
24982 including the text of the old definition.
24983
24984 @dfn{Spec strings} are a list of command-line options to be passed to their
24985 corresponding program. In addition, the spec strings can contain
24986 @samp{%}-prefixed sequences to substitute variable text or to
24987 conditionally insert text into the command line. Using these constructs
24988 it is possible to generate quite complex command lines.
24989
24990 Here is a table of all defined @samp{%}-sequences for spec
24991 strings. Note that spaces are not generated automatically around the
24992 results of expanding these sequences. Therefore you can concatenate them
24993 together or combine them with constant text in a single argument.
24994
24995 @table @code
24996 @item %%
24997 Substitute one @samp{%} into the program name or argument.
24998
24999 @item %i
25000 Substitute the name of the input file being processed.
25001
25002 @item %b
25003 Substitute the basename of the input file being processed.
25004 This is the substring up to (and not including) the last period
25005 and not including the directory.
25006
25007 @item %B
25008 This is the same as @samp{%b}, but include the file suffix (text after
25009 the last period).
25010
25011 @item %d
25012 Marks the argument containing or following the @samp{%d} as a
25013 temporary file name, so that that file is deleted if GCC exits
25014 successfully. Unlike @samp{%g}, this contributes no text to the
25015 argument.
25016
25017 @item %g@var{suffix}
25018 Substitute a file name that has suffix @var{suffix} and is chosen
25019 once per compilation, and mark the argument in the same way as
25020 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
25021 name is now chosen in a way that is hard to predict even when previously
25022 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
25023 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
25024 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
25025 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
25026 was simply substituted with a file name chosen once per compilation,
25027 without regard to any appended suffix (which was therefore treated
25028 just like ordinary text), making such attacks more likely to succeed.
25029
25030 @item %u@var{suffix}
25031 Like @samp{%g}, but generates a new temporary file name
25032 each time it appears instead of once per compilation.
25033
25034 @item %U@var{suffix}
25035 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
25036 new one if there is no such last file name. In the absence of any
25037 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
25038 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
25039 involves the generation of two distinct file names, one
25040 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
25041 simply substituted with a file name chosen for the previous @samp{%u},
25042 without regard to any appended suffix.
25043
25044 @item %j@var{suffix}
25045 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
25046 writable, and if @option{-save-temps} is not used;
25047 otherwise, substitute the name
25048 of a temporary file, just like @samp{%u}. This temporary file is not
25049 meant for communication between processes, but rather as a junk
25050 disposal mechanism.
25051
25052 @item %|@var{suffix}
25053 @itemx %m@var{suffix}
25054 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
25055 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
25056 all. These are the two most common ways to instruct a program that it
25057 should read from standard input or write to standard output. If you
25058 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
25059 construct: see for example @file{f/lang-specs.h}.
25060
25061 @item %.@var{SUFFIX}
25062 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
25063 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
25064 terminated by the next space or %.
25065
25066 @item %w
25067 Marks the argument containing or following the @samp{%w} as the
25068 designated output file of this compilation. This puts the argument
25069 into the sequence of arguments that @samp{%o} substitutes.
25070
25071 @item %o
25072 Substitutes the names of all the output files, with spaces
25073 automatically placed around them. You should write spaces
25074 around the @samp{%o} as well or the results are undefined.
25075 @samp{%o} is for use in the specs for running the linker.
25076 Input files whose names have no recognized suffix are not compiled
25077 at all, but they are included among the output files, so they are
25078 linked.
25079
25080 @item %O
25081 Substitutes the suffix for object files. Note that this is
25082 handled specially when it immediately follows @samp{%g, %u, or %U},
25083 because of the need for those to form complete file names. The
25084 handling is such that @samp{%O} is treated exactly as if it had already
25085 been substituted, except that @samp{%g, %u, and %U} do not currently
25086 support additional @var{suffix} characters following @samp{%O} as they do
25087 following, for example, @samp{.o}.
25088
25089 @item %p
25090 Substitutes the standard macro predefinitions for the
25091 current target machine. Use this when running @command{cpp}.
25092
25093 @item %P
25094 Like @samp{%p}, but puts @samp{__} before and after the name of each
25095 predefined macro, except for macros that start with @samp{__} or with
25096 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
25097 C@.
25098
25099 @item %I
25100 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
25101 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
25102 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
25103 and @option{-imultilib} as necessary.
25104
25105 @item %s
25106 Current argument is the name of a library or startup file of some sort.
25107 Search for that file in a standard list of directories and substitute
25108 the full name found. The current working directory is included in the
25109 list of directories scanned.
25110
25111 @item %T
25112 Current argument is the name of a linker script. Search for that file
25113 in the current list of directories to scan for libraries. If the file
25114 is located insert a @option{--script} option into the command line
25115 followed by the full path name found. If the file is not found then
25116 generate an error message. Note: the current working directory is not
25117 searched.
25118
25119 @item %e@var{str}
25120 Print @var{str} as an error message. @var{str} is terminated by a newline.
25121 Use this when inconsistent options are detected.
25122
25123 @item %(@var{name})
25124 Substitute the contents of spec string @var{name} at this point.
25125
25126 @item %x@{@var{option}@}
25127 Accumulate an option for @samp{%X}.
25128
25129 @item %X
25130 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
25131 spec string.
25132
25133 @item %Y
25134 Output the accumulated assembler options specified by @option{-Wa}.
25135
25136 @item %Z
25137 Output the accumulated preprocessor options specified by @option{-Wp}.
25138
25139 @item %a
25140 Process the @code{asm} spec. This is used to compute the
25141 switches to be passed to the assembler.
25142
25143 @item %A
25144 Process the @code{asm_final} spec. This is a spec string for
25145 passing switches to an assembler post-processor, if such a program is
25146 needed.
25147
25148 @item %l
25149 Process the @code{link} spec. This is the spec for computing the
25150 command line passed to the linker. Typically it makes use of the
25151 @samp{%L %G %S %D and %E} sequences.
25152
25153 @item %D
25154 Dump out a @option{-L} option for each directory that GCC believes might
25155 contain startup files. If the target supports multilibs then the
25156 current multilib directory is prepended to each of these paths.
25157
25158 @item %L
25159 Process the @code{lib} spec. This is a spec string for deciding which
25160 libraries are included on the command line to the linker.
25161
25162 @item %G
25163 Process the @code{libgcc} spec. This is a spec string for deciding
25164 which GCC support library is included on the command line to the linker.
25165
25166 @item %S
25167 Process the @code{startfile} spec. This is a spec for deciding which
25168 object files are the first ones passed to the linker. Typically
25169 this might be a file named @file{crt0.o}.
25170
25171 @item %E
25172 Process the @code{endfile} spec. This is a spec string that specifies
25173 the last object files that are passed to the linker.
25174
25175 @item %C
25176 Process the @code{cpp} spec. This is used to construct the arguments
25177 to be passed to the C preprocessor.
25178
25179 @item %1
25180 Process the @code{cc1} spec. This is used to construct the options to be
25181 passed to the actual C compiler (@command{cc1}).
25182
25183 @item %2
25184 Process the @code{cc1plus} spec. This is used to construct the options to be
25185 passed to the actual C++ compiler (@command{cc1plus}).
25186
25187 @item %*
25188 Substitute the variable part of a matched option. See below.
25189 Note that each comma in the substituted string is replaced by
25190 a single space.
25191
25192 @item %<@code{S}
25193 Remove all occurrences of @code{-S} from the command line. Note---this
25194 command is position dependent. @samp{%} commands in the spec string
25195 before this one see @code{-S}, @samp{%} commands in the spec string
25196 after this one do not.
25197
25198 @item %:@var{function}(@var{args})
25199 Call the named function @var{function}, passing it @var{args}.
25200 @var{args} is first processed as a nested spec string, then split
25201 into an argument vector in the usual fashion. The function returns
25202 a string which is processed as if it had appeared literally as part
25203 of the current spec.
25204
25205 The following built-in spec functions are provided:
25206
25207 @table @code
25208 @item @code{getenv}
25209 The @code{getenv} spec function takes two arguments: an environment
25210 variable name and a string. If the environment variable is not
25211 defined, a fatal error is issued. Otherwise, the return value is the
25212 value of the environment variable concatenated with the string. For
25213 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
25214
25215 @smallexample
25216 %:getenv(TOPDIR /include)
25217 @end smallexample
25218
25219 expands to @file{/path/to/top/include}.
25220
25221 @item @code{if-exists}
25222 The @code{if-exists} spec function takes one argument, an absolute
25223 pathname to a file. If the file exists, @code{if-exists} returns the
25224 pathname. Here is a small example of its usage:
25225
25226 @smallexample
25227 *startfile:
25228 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
25229 @end smallexample
25230
25231 @item @code{if-exists-else}
25232 The @code{if-exists-else} spec function is similar to the @code{if-exists}
25233 spec function, except that it takes two arguments. The first argument is
25234 an absolute pathname to a file. If the file exists, @code{if-exists-else}
25235 returns the pathname. If it does not exist, it returns the second argument.
25236 This way, @code{if-exists-else} can be used to select one file or another,
25237 based on the existence of the first. Here is a small example of its usage:
25238
25239 @smallexample
25240 *startfile:
25241 crt0%O%s %:if-exists(crti%O%s) \
25242 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
25243 @end smallexample
25244
25245 @item @code{replace-outfile}
25246 The @code{replace-outfile} spec function takes two arguments. It looks for the
25247 first argument in the outfiles array and replaces it with the second argument. Here
25248 is a small example of its usage:
25249
25250 @smallexample
25251 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
25252 @end smallexample
25253
25254 @item @code{remove-outfile}
25255 The @code{remove-outfile} spec function takes one argument. It looks for the
25256 first argument in the outfiles array and removes it. Here is a small example
25257 its usage:
25258
25259 @smallexample
25260 %:remove-outfile(-lm)
25261 @end smallexample
25262
25263 @item @code{pass-through-libs}
25264 The @code{pass-through-libs} spec function takes any number of arguments. It
25265 finds any @option{-l} options and any non-options ending in @file{.a} (which it
25266 assumes are the names of linker input library archive files) and returns a
25267 result containing all the found arguments each prepended by
25268 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
25269 intended to be passed to the LTO linker plugin.
25270
25271 @smallexample
25272 %:pass-through-libs(%G %L %G)
25273 @end smallexample
25274
25275 @item @code{print-asm-header}
25276 The @code{print-asm-header} function takes no arguments and simply
25277 prints a banner like:
25278
25279 @smallexample
25280 Assembler options
25281 =================
25282
25283 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
25284 @end smallexample
25285
25286 It is used to separate compiler options from assembler options
25287 in the @option{--target-help} output.
25288 @end table
25289
25290 @item %@{@code{S}@}
25291 Substitutes the @code{-S} switch, if that switch is given to GCC@.
25292 If that switch is not specified, this substitutes nothing. Note that
25293 the leading dash is omitted when specifying this option, and it is
25294 automatically inserted if the substitution is performed. Thus the spec
25295 string @samp{%@{foo@}} matches the command-line option @option{-foo}
25296 and outputs the command-line option @option{-foo}.
25297
25298 @item %W@{@code{S}@}
25299 Like %@{@code{S}@} but mark last argument supplied within as a file to be
25300 deleted on failure.
25301
25302 @item %@{@code{S}*@}
25303 Substitutes all the switches specified to GCC whose names start
25304 with @code{-S}, but which also take an argument. This is used for
25305 switches like @option{-o}, @option{-D}, @option{-I}, etc.
25306 GCC considers @option{-o foo} as being
25307 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
25308 text, including the space. Thus two arguments are generated.
25309
25310 @item %@{@code{S}*&@code{T}*@}
25311 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
25312 (the order of @code{S} and @code{T} in the spec is not significant).
25313 There can be any number of ampersand-separated variables; for each the
25314 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
25315
25316 @item %@{@code{S}:@code{X}@}
25317 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
25318
25319 @item %@{!@code{S}:@code{X}@}
25320 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
25321
25322 @item %@{@code{S}*:@code{X}@}
25323 Substitutes @code{X} if one or more switches whose names start with
25324 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
25325 once, no matter how many such switches appeared. However, if @code{%*}
25326 appears somewhere in @code{X}, then @code{X} is substituted once
25327 for each matching switch, with the @code{%*} replaced by the part of
25328 that switch matching the @code{*}.
25329
25330 If @code{%*} appears as the last part of a spec sequence then a space
25331 is added after the end of the last substitution. If there is more
25332 text in the sequence, however, then a space is not generated. This
25333 allows the @code{%*} substitution to be used as part of a larger
25334 string. For example, a spec string like this:
25335
25336 @smallexample
25337 %@{mcu=*:--script=%*/memory.ld@}
25338 @end smallexample
25339
25340 @noindent
25341 when matching an option like @option{-mcu=newchip} produces:
25342
25343 @smallexample
25344 --script=newchip/memory.ld
25345 @end smallexample
25346
25347 @item %@{.@code{S}:@code{X}@}
25348 Substitutes @code{X}, if processing a file with suffix @code{S}.
25349
25350 @item %@{!.@code{S}:@code{X}@}
25351 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
25352
25353 @item %@{,@code{S}:@code{X}@}
25354 Substitutes @code{X}, if processing a file for language @code{S}.
25355
25356 @item %@{!,@code{S}:@code{X}@}
25357 Substitutes @code{X}, if not processing a file for language @code{S}.
25358
25359 @item %@{@code{S}|@code{P}:@code{X}@}
25360 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
25361 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
25362 @code{*} sequences as well, although they have a stronger binding than
25363 the @samp{|}. If @code{%*} appears in @code{X}, all of the
25364 alternatives must be starred, and only the first matching alternative
25365 is substituted.
25366
25367 For example, a spec string like this:
25368
25369 @smallexample
25370 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
25371 @end smallexample
25372
25373 @noindent
25374 outputs the following command-line options from the following input
25375 command-line options:
25376
25377 @smallexample
25378 fred.c -foo -baz
25379 jim.d -bar -boggle
25380 -d fred.c -foo -baz -boggle
25381 -d jim.d -bar -baz -boggle
25382 @end smallexample
25383
25384 @item %@{S:X; T:Y; :D@}
25385
25386 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
25387 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
25388 be as many clauses as you need. This may be combined with @code{.},
25389 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
25390
25391
25392 @end table
25393
25394 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
25395 construct may contain other nested @samp{%} constructs or spaces, or
25396 even newlines. They are processed as usual, as described above.
25397 Trailing white space in @code{X} is ignored. White space may also
25398 appear anywhere on the left side of the colon in these constructs,
25399 except between @code{.} or @code{*} and the corresponding word.
25400
25401 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
25402 handled specifically in these constructs. If another value of
25403 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
25404 @option{-W} switch is found later in the command line, the earlier
25405 switch value is ignored, except with @{@code{S}*@} where @code{S} is
25406 just one letter, which passes all matching options.
25407
25408 The character @samp{|} at the beginning of the predicate text is used to
25409 indicate that a command should be piped to the following command, but
25410 only if @option{-pipe} is specified.
25411
25412 It is built into GCC which switches take arguments and which do not.
25413 (You might think it would be useful to generalize this to allow each
25414 compiler's spec to say which switches take arguments. But this cannot
25415 be done in a consistent fashion. GCC cannot even decide which input
25416 files have been specified without knowing which switches take arguments,
25417 and it must know which input files to compile in order to tell which
25418 compilers to run).
25419
25420 GCC also knows implicitly that arguments starting in @option{-l} are to be
25421 treated as compiler output files, and passed to the linker in their
25422 proper position among the other output files.
25423
25424 @node Environment Variables
25425 @section Environment Variables Affecting GCC
25426 @cindex environment variables
25427
25428 @c man begin ENVIRONMENT
25429 This section describes several environment variables that affect how GCC
25430 operates. Some of them work by specifying directories or prefixes to use
25431 when searching for various kinds of files. Some are used to specify other
25432 aspects of the compilation environment.
25433
25434 Note that you can also specify places to search using options such as
25435 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
25436 take precedence over places specified using environment variables, which
25437 in turn take precedence over those specified by the configuration of GCC@.
25438 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
25439 GNU Compiler Collection (GCC) Internals}.
25440
25441 @table @env
25442 @item LANG
25443 @itemx LC_CTYPE
25444 @c @itemx LC_COLLATE
25445 @itemx LC_MESSAGES
25446 @c @itemx LC_MONETARY
25447 @c @itemx LC_NUMERIC
25448 @c @itemx LC_TIME
25449 @itemx LC_ALL
25450 @findex LANG
25451 @findex LC_CTYPE
25452 @c @findex LC_COLLATE
25453 @findex LC_MESSAGES
25454 @c @findex LC_MONETARY
25455 @c @findex LC_NUMERIC
25456 @c @findex LC_TIME
25457 @findex LC_ALL
25458 @cindex locale
25459 These environment variables control the way that GCC uses
25460 localization information which allows GCC to work with different
25461 national conventions. GCC inspects the locale categories
25462 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
25463 so. These locale categories can be set to any value supported by your
25464 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
25465 Kingdom encoded in UTF-8.
25466
25467 The @env{LC_CTYPE} environment variable specifies character
25468 classification. GCC uses it to determine the character boundaries in
25469 a string; this is needed for some multibyte encodings that contain quote
25470 and escape characters that are otherwise interpreted as a string
25471 end or escape.
25472
25473 The @env{LC_MESSAGES} environment variable specifies the language to
25474 use in diagnostic messages.
25475
25476 If the @env{LC_ALL} environment variable is set, it overrides the value
25477 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
25478 and @env{LC_MESSAGES} default to the value of the @env{LANG}
25479 environment variable. If none of these variables are set, GCC
25480 defaults to traditional C English behavior.
25481
25482 @item TMPDIR
25483 @findex TMPDIR
25484 If @env{TMPDIR} is set, it specifies the directory to use for temporary
25485 files. GCC uses temporary files to hold the output of one stage of
25486 compilation which is to be used as input to the next stage: for example,
25487 the output of the preprocessor, which is the input to the compiler
25488 proper.
25489
25490 @item GCC_COMPARE_DEBUG
25491 @findex GCC_COMPARE_DEBUG
25492 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
25493 @option{-fcompare-debug} to the compiler driver. See the documentation
25494 of this option for more details.
25495
25496 @item GCC_EXEC_PREFIX
25497 @findex GCC_EXEC_PREFIX
25498 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
25499 names of the subprograms executed by the compiler. No slash is added
25500 when this prefix is combined with the name of a subprogram, but you can
25501 specify a prefix that ends with a slash if you wish.
25502
25503 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
25504 an appropriate prefix to use based on the pathname it is invoked with.
25505
25506 If GCC cannot find the subprogram using the specified prefix, it
25507 tries looking in the usual places for the subprogram.
25508
25509 The default value of @env{GCC_EXEC_PREFIX} is
25510 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
25511 the installed compiler. In many cases @var{prefix} is the value
25512 of @code{prefix} when you ran the @file{configure} script.
25513
25514 Other prefixes specified with @option{-B} take precedence over this prefix.
25515
25516 This prefix is also used for finding files such as @file{crt0.o} that are
25517 used for linking.
25518
25519 In addition, the prefix is used in an unusual way in finding the
25520 directories to search for header files. For each of the standard
25521 directories whose name normally begins with @samp{/usr/local/lib/gcc}
25522 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
25523 replacing that beginning with the specified prefix to produce an
25524 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
25525 @file{foo/bar} just before it searches the standard directory
25526 @file{/usr/local/lib/bar}.
25527 If a standard directory begins with the configured
25528 @var{prefix} then the value of @var{prefix} is replaced by
25529 @env{GCC_EXEC_PREFIX} when looking for header files.
25530
25531 @item COMPILER_PATH
25532 @findex COMPILER_PATH
25533 The value of @env{COMPILER_PATH} is a colon-separated list of
25534 directories, much like @env{PATH}. GCC tries the directories thus
25535 specified when searching for subprograms, if it can't find the
25536 subprograms using @env{GCC_EXEC_PREFIX}.
25537
25538 @item LIBRARY_PATH
25539 @findex LIBRARY_PATH
25540 The value of @env{LIBRARY_PATH} is a colon-separated list of
25541 directories, much like @env{PATH}. When configured as a native compiler,
25542 GCC tries the directories thus specified when searching for special
25543 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
25544 using GCC also uses these directories when searching for ordinary
25545 libraries for the @option{-l} option (but directories specified with
25546 @option{-L} come first).
25547
25548 @item LANG
25549 @findex LANG
25550 @cindex locale definition
25551 This variable is used to pass locale information to the compiler. One way in
25552 which this information is used is to determine the character set to be used
25553 when character literals, string literals and comments are parsed in C and C++.
25554 When the compiler is configured to allow multibyte characters,
25555 the following values for @env{LANG} are recognized:
25556
25557 @table @samp
25558 @item C-JIS
25559 Recognize JIS characters.
25560 @item C-SJIS
25561 Recognize SJIS characters.
25562 @item C-EUCJP
25563 Recognize EUCJP characters.
25564 @end table
25565
25566 If @env{LANG} is not defined, or if it has some other value, then the
25567 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
25568 recognize and translate multibyte characters.
25569 @end table
25570
25571 @noindent
25572 Some additional environment variables affect the behavior of the
25573 preprocessor.
25574
25575 @include cppenv.texi
25576
25577 @c man end
25578
25579 @node Precompiled Headers
25580 @section Using Precompiled Headers
25581 @cindex precompiled headers
25582 @cindex speed of compilation
25583
25584 Often large projects have many header files that are included in every
25585 source file. The time the compiler takes to process these header files
25586 over and over again can account for nearly all of the time required to
25587 build the project. To make builds faster, GCC allows you to
25588 @dfn{precompile} a header file.
25589
25590 To create a precompiled header file, simply compile it as you would any
25591 other file, if necessary using the @option{-x} option to make the driver
25592 treat it as a C or C++ header file. You may want to use a
25593 tool like @command{make} to keep the precompiled header up-to-date when
25594 the headers it contains change.
25595
25596 A precompiled header file is searched for when @code{#include} is
25597 seen in the compilation. As it searches for the included file
25598 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
25599 compiler looks for a precompiled header in each directory just before it
25600 looks for the include file in that directory. The name searched for is
25601 the name specified in the @code{#include} with @samp{.gch} appended. If
25602 the precompiled header file can't be used, it is ignored.
25603
25604 For instance, if you have @code{#include "all.h"}, and you have
25605 @file{all.h.gch} in the same directory as @file{all.h}, then the
25606 precompiled header file is used if possible, and the original
25607 header is used otherwise.
25608
25609 Alternatively, you might decide to put the precompiled header file in a
25610 directory and use @option{-I} to ensure that directory is searched
25611 before (or instead of) the directory containing the original header.
25612 Then, if you want to check that the precompiled header file is always
25613 used, you can put a file of the same name as the original header in this
25614 directory containing an @code{#error} command.
25615
25616 This also works with @option{-include}. So yet another way to use
25617 precompiled headers, good for projects not designed with precompiled
25618 header files in mind, is to simply take most of the header files used by
25619 a project, include them from another header file, precompile that header
25620 file, and @option{-include} the precompiled header. If the header files
25621 have guards against multiple inclusion, they are skipped because
25622 they've already been included (in the precompiled header).
25623
25624 If you need to precompile the same header file for different
25625 languages, targets, or compiler options, you can instead make a
25626 @emph{directory} named like @file{all.h.gch}, and put each precompiled
25627 header in the directory, perhaps using @option{-o}. It doesn't matter
25628 what you call the files in the directory; every precompiled header in
25629 the directory is considered. The first precompiled header
25630 encountered in the directory that is valid for this compilation is
25631 used; they're searched in no particular order.
25632
25633 There are many other possibilities, limited only by your imagination,
25634 good sense, and the constraints of your build system.
25635
25636 A precompiled header file can be used only when these conditions apply:
25637
25638 @itemize
25639 @item
25640 Only one precompiled header can be used in a particular compilation.
25641
25642 @item
25643 A precompiled header can't be used once the first C token is seen. You
25644 can have preprocessor directives before a precompiled header; you cannot
25645 include a precompiled header from inside another header.
25646
25647 @item
25648 The precompiled header file must be produced for the same language as
25649 the current compilation. You can't use a C precompiled header for a C++
25650 compilation.
25651
25652 @item
25653 The precompiled header file must have been produced by the same compiler
25654 binary as the current compilation is using.
25655
25656 @item
25657 Any macros defined before the precompiled header is included must
25658 either be defined in the same way as when the precompiled header was
25659 generated, or must not affect the precompiled header, which usually
25660 means that they don't appear in the precompiled header at all.
25661
25662 The @option{-D} option is one way to define a macro before a
25663 precompiled header is included; using a @code{#define} can also do it.
25664 There are also some options that define macros implicitly, like
25665 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
25666 defined this way.
25667
25668 @item If debugging information is output when using the precompiled
25669 header, using @option{-g} or similar, the same kind of debugging information
25670 must have been output when building the precompiled header. However,
25671 a precompiled header built using @option{-g} can be used in a compilation
25672 when no debugging information is being output.
25673
25674 @item The same @option{-m} options must generally be used when building
25675 and using the precompiled header. @xref{Submodel Options},
25676 for any cases where this rule is relaxed.
25677
25678 @item Each of the following options must be the same when building and using
25679 the precompiled header:
25680
25681 @gccoptlist{-fexceptions}
25682
25683 @item
25684 Some other command-line options starting with @option{-f},
25685 @option{-p}, or @option{-O} must be defined in the same way as when
25686 the precompiled header was generated. At present, it's not clear
25687 which options are safe to change and which are not; the safest choice
25688 is to use exactly the same options when generating and using the
25689 precompiled header. The following are known to be safe:
25690
25691 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
25692 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
25693 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
25694 -pedantic-errors}
25695
25696 @end itemize
25697
25698 For all of these except the last, the compiler automatically
25699 ignores the precompiled header if the conditions aren't met. If you
25700 find an option combination that doesn't work and doesn't cause the
25701 precompiled header to be ignored, please consider filing a bug report,
25702 see @ref{Bugs}.
25703
25704 If you do use differing options when generating and using the
25705 precompiled header, the actual behavior is a mixture of the
25706 behavior for the options. For instance, if you use @option{-g} to
25707 generate the precompiled header but not when using it, you may or may
25708 not get debugging information for routines in the precompiled header.
This page took 1.146274 seconds and 6 git commands to generate.