arm-arches.def (armv8-m.base): Define new architecture.
[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} -ffriend-injection @gol
195 -fno-elide-constructors @gol
196 -fno-enforce-eh-specs @gol
197 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
198 -fno-implicit-templates @gol
199 -fno-implicit-inline-templates @gol
200 -fno-implement-inlines -fms-extensions @gol
201 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
202 -fno-optional-diags -fpermissive @gol
203 -fno-pretty-templates @gol
204 -frepo -fno-rtti -fsized-deallocation @gol
205 -ftemplate-backtrace-limit=@var{n} @gol
206 -ftemplate-depth=@var{n} @gol
207 -fno-threadsafe-statics -fuse-cxa-atexit @gol
208 -fno-weak -nostdinc++ @gol
209 -fvisibility-inlines-hidden @gol
210 -fvisibility-ms-compat @gol
211 -fext-numeric-literals @gol
212 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
213 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
214 -Wnamespaces -Wnarrowing @gol
215 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
216 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
217 -Wno-non-template-friend -Wold-style-cast @gol
218 -Woverloaded-virtual -Wno-pmf-conversions @gol
219 -Wsign-promo -Wvirtual-inheritance}
220
221 @item Objective-C and Objective-C++ Language Options
222 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
223 Objective-C and Objective-C++ Dialects}.
224 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
225 -fgnu-runtime -fnext-runtime @gol
226 -fno-nil-receivers @gol
227 -fobjc-abi-version=@var{n} @gol
228 -fobjc-call-cxx-cdtors @gol
229 -fobjc-direct-dispatch @gol
230 -fobjc-exceptions @gol
231 -fobjc-gc @gol
232 -fobjc-nilcheck @gol
233 -fobjc-std=objc1 @gol
234 -fno-local-ivars @gol
235 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
236 -freplace-objc-classes @gol
237 -fzero-link @gol
238 -gen-decls @gol
239 -Wassign-intercept @gol
240 -Wno-protocol -Wselector @gol
241 -Wstrict-selector-match @gol
242 -Wundeclared-selector}
243
244 @item Diagnostic Message Formatting Options
245 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
246 @gccoptlist{-fmessage-length=@var{n} @gol
247 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
248 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
249 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
250 -fdiagnostics-parseable-fixits}
251
252 @item Warning Options
253 @xref{Warning Options,,Options to Request or Suppress Warnings}.
254 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
255 -pedantic-errors @gol
256 -w -Wextra -Wall -Waddress -Waggregate-return @gol
257 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
258 -Wno-attributes -Wbool-compare -Wno-builtin-macro-redefined @gol
259 -Wc90-c99-compat -Wc99-c11-compat @gol
260 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
261 -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
262 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
263 -Wdelete-incomplete @gol
264 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
265 -Wdisabled-optimization @gol
266 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
267 -Wno-div-by-zero -Wdouble-promotion -Wduplicated-cond @gol
268 -Wempty-body -Wenum-compare -Wno-endif-labels @gol
269 -Werror -Werror=* -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
270 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
271 -Wformat-security -Wformat-signedness -Wformat-y2k -Wframe-address @gol
272 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
273 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
274 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
275 -Winit-self -Winline -Wno-int-conversion @gol
276 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
277 -Winvalid-pch -Wlarger-than=@var{len} @gol
278 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
279 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
280 -Wmisleading-indentation -Wmissing-braces @gol
281 -Wmissing-field-initializers -Wmissing-include-dirs @gol
282 -Wno-multichar -Wnonnull -Wnonnull-compare @gol
283 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
284 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
285 -Woverride-init-side-effects -Woverlength-strings @gol
286 -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
287 -Wparentheses -Wno-pedantic-ms-format @gol
288 -Wplacement-new -Wplacement-new=@var{n} @gol
289 -Wpointer-arith -Wno-pointer-to-int-cast @gol
290 -Wno-pragmas -Wredundant-decls -Wno-return-local-addr @gol
291 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
292 -Wshift-overflow -Wshift-overflow=@var{n} @gol
293 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
294 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
295 -Wno-scalar-storage-order @gol
296 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
297 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
298 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
299 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
300 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
301 -Wmissing-format-attribute -Wsubobject-linkage @gol
302 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
303 -Wswitch-unreachable -Wsync-nand @gol
304 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
305 -Wtype-limits -Wundef @gol
306 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
307 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
308 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
309 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
310 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
311 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
312 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
313 -Wvla -Wvolatile-register-var -Wwrite-strings @gol
314 -Wzero-as-null-pointer-constant -Whsa}
315
316 @item C and Objective-C-only Warning Options
317 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
318 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
319 -Wold-style-declaration -Wold-style-definition @gol
320 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
321 -Wdeclaration-after-statement -Wpointer-sign}
322
323 @item Debugging Options
324 @xref{Debugging Options,,Options for Debugging Your Program}.
325 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
326 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
327 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
328 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
329 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
330 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
331 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
332 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
333 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
334 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
335 -fvar-tracking -fvar-tracking-assignments}
336
337 @item Optimization Options
338 @xref{Optimize Options,,Options that Control Optimization}.
339 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
340 -falign-jumps[=@var{n}] @gol
341 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
342 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
343 -fauto-inc-dec -fbranch-probabilities @gol
344 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
345 -fbtr-bb-exclusive -fcaller-saves @gol
346 -fcombine-stack-adjustments -fconserve-stack @gol
347 -fcompare-elim -fcprop-registers -fcrossjumping @gol
348 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
349 -fcx-limited-range @gol
350 -fdata-sections -fdce -fdelayed-branch @gol
351 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
352 -fdevirtualize-at-ltrans -fdse @gol
353 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
354 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
355 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
356 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
357 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
358 -fif-conversion2 -findirect-inlining @gol
359 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
360 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment @gol
361 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
362 -fira-algorithm=@var{algorithm} @gol
363 -fira-region=@var{region} -fira-hoist-pressure @gol
364 -fira-loop-pressure -fno-ira-share-save-slots @gol
365 -fno-ira-share-spill-slots @gol
366 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
367 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
368 -fkeep-static-consts -flive-range-shrinkage @gol
369 -floop-block -floop-interchange -floop-strip-mine @gol
370 -floop-unroll-and-jam -floop-nest-optimize @gol
371 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
372 -flto-partition=@var{alg} -fmerge-all-constants @gol
373 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
374 -fmove-loop-invariants -fno-branch-count-reg @gol
375 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
376 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
377 -fno-peephole2 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
378 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
379 -fomit-frame-pointer -foptimize-sibling-calls @gol
380 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
381 -fprefetch-loop-arrays @gol
382 -fprofile-correction @gol
383 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
384 -fprofile-reorder-functions @gol
385 -freciprocal-math -free -frename-registers -freorder-blocks @gol
386 -freorder-blocks-algorithm=@var{algorithm} @gol
387 -freorder-blocks-and-partition -freorder-functions @gol
388 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
389 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
390 -fsched-spec-load -fsched-spec-load-dangerous @gol
391 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
392 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
393 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
394 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
395 -fschedule-fusion @gol
396 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
397 -fselective-scheduling -fselective-scheduling2 @gol
398 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
399 -fsemantic-interposition -fshrink-wrap -fsignaling-nans @gol
400 -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
401 -fsplit-paths @gol
402 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
403 -fstdarg-opt -fstrict-aliasing @gol
404 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
405 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
406 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
407 -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
408 -ftree-loop-if-convert-stores -ftree-loop-im @gol
409 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
410 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
411 -ftree-loop-vectorize @gol
412 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
413 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
414 -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
415 -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
416 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
417 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
418 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
419 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
420 --param @var{name}=@var{value}
421 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
422
423 @item Program Instrumentation Options
424 @xref{Instrumentation Options,,Program Instrumentation Options}.
425 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
426 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
427 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
428 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
429 -fsanitize-undefined-trap-on-error -fbounds-check @gol
430 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
431 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
432 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
433 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
434 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
435 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
436 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
437 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
438 -fchkp-use-wrappers @gol
439 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
440 -fstack-protector-explicit -fstack-check @gol
441 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
442 -fno-stack-limit -fsplit-stack @gol
443 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
444 -fvtv-counts -fvtv-debug @gol
445 -finstrument-functions @gol
446 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
447 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
448
449 @item Preprocessor Options
450 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
451 @gccoptlist{-A@var{question}=@var{answer} @gol
452 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
453 -C -dD -dI -dM -dN @gol
454 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
455 -idirafter @var{dir} @gol
456 -include @var{file} -imacros @var{file} @gol
457 -iprefix @var{file} -iwithprefix @var{dir} @gol
458 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
459 -imultilib @var{dir} -isysroot @var{dir} @gol
460 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
461 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
462 -remap -trigraphs -undef -U@var{macro} @gol
463 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
464
465 @item Assembler Option
466 @xref{Assembler Options,,Passing Options to the Assembler}.
467 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
468
469 @item Linker Options
470 @xref{Link Options,,Options for Linking}.
471 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
472 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
473 -s -static -static-libgcc -static-libstdc++ @gol
474 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
475 -static-libmpx -static-libmpxwrappers @gol
476 -shared -shared-libgcc -symbolic @gol
477 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
478 -u @var{symbol} -z @var{keyword}}
479
480 @item Directory Options
481 @xref{Directory Options,,Options for Directory Search}.
482 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
483 -iquote@var{dir} -L@var{dir} -no-canonical-prefixes -I- @gol
484 --sysroot=@var{dir} --no-sysroot-suffix}
485
486 @item Code Generation Options
487 @xref{Code Gen Options,,Options for Code Generation Conventions}.
488 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
489 -ffixed-@var{reg} -fexceptions @gol
490 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
491 -fasynchronous-unwind-tables @gol
492 -fno-gnu-unique @gol
493 -finhibit-size-directive -fno-common -fno-ident @gol
494 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
495 -fno-jump-tables @gol
496 -frecord-gcc-switches @gol
497 -freg-struct-return -fshort-enums -fshort-wchar @gol
498 -fverbose-asm -fpack-struct[=@var{n}] @gol
499 -fleading-underscore -ftls-model=@var{model} @gol
500 -fstack-reuse=@var{reuse_level} @gol
501 -ftrapv -fwrapv @gol
502 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
503 -fstrict-volatile-bitfields -fsync-libcalls}
504
505 @item Developer Options
506 @xref{Developer Options,,GCC Developer Options}.
507 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
508 -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
509 -fdbg-cnt=@var{counter-value-list} @gol
510 -fdisable-ipa-@var{pass_name} @gol
511 -fdisable-rtl-@var{pass_name} @gol
512 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
513 -fdisable-tree-@var{pass_name} @gol
514 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
515 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
516 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
517 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
518 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
519 -fdump-passes @gol
520 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
521 -fdump-statistics @gol
522 -fdump-tree-all @gol
523 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
524 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
525 -fdump-tree-cfg -fdump-tree-alias @gol
526 -fdump-tree-ch @gol
527 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
528 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
529 -fdump-tree-gimple@r{[}-raw@r{]} @gol
530 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
531 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
532 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
533 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
534 -fdump-tree-backprop@r{[}-@var{n}@r{]} @gol
535 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
536 -fdump-tree-nrv -fdump-tree-vect @gol
537 -fdump-tree-sink @gol
538 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
539 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
540 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
541 -fdump-tree-vtable-verify @gol
542 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
543 -fdump-tree-split-paths@r{[}-@var{n}@r{]} @gol
544 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
545 -fdump-final-insns=@var{file} @gol
546 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
547 -fenable-@var{kind}-@var{pass} @gol
548 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
549 -fira-verbose=@var{n} @gol
550 -flto-report -flto-report-wpa -fmem-report-wpa @gol
551 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
552 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
553 -fprofile-report @gol
554 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
555 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
556 -fstats -fstack-usage -ftime-report @gol
557 -fvar-tracking-assignments-toggle -gtoggle @gol
558 -print-file-name=@var{library} -print-libgcc-file-name @gol
559 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
560 -print-prog-name=@var{program} -print-search-dirs -Q @gol
561 -print-sysroot -print-sysroot-headers-suffix @gol
562 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
563
564 @item Machine-Dependent Options
565 @xref{Submodel Options,,Machine-Dependent Options}.
566 @c This list is ordered alphanumerically by subsection name.
567 @c Try and put the significant identifier (CPU or system) first,
568 @c so users have a clue at guessing where the ones they want will be.
569
570 @emph{AArch64 Options}
571 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
572 -mgeneral-regs-only @gol
573 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
574 -mstrict-align @gol
575 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
576 -mtls-dialect=desc -mtls-dialect=traditional @gol
577 -mtls-size=@var{size} @gol
578 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
579 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol
580 -mlow-precision-recip-sqrt -mno-low-precision-recip-sqrt@gol
581 -mlow-precision-sqrt -mno-low-precision-sqrt@gol
582 -mlow-precision-div -mno-low-precision-div @gol
583 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
584
585 @emph{Adapteva Epiphany Options}
586 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
587 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
588 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
589 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
590 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
591 -msplit-vecmove-early -m1reg-@var{reg}}
592
593 @emph{ARC Options}
594 @gccoptlist{-mbarrel-shifter @gol
595 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
596 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
597 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
598 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
599 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
600 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
601 -mlong-calls -mmedium-calls -msdata @gol
602 -mucb-mcount -mvolatile-cache -mtp-regno=@var{regno} @gol
603 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
604 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
605 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
606 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
607 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
608 -mtune=@var{cpu} -mmultcost=@var{num} @gol
609 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
610 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
611
612 @emph{ARM Options}
613 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
614 -mabi=@var{name} @gol
615 -mapcs-stack-check -mno-apcs-stack-check @gol
616 -mapcs-float -mno-apcs-float @gol
617 -mapcs-reentrant -mno-apcs-reentrant @gol
618 -msched-prolog -mno-sched-prolog @gol
619 -mlittle-endian -mbig-endian @gol
620 -mfloat-abi=@var{name} @gol
621 -mfp16-format=@var{name}
622 -mthumb-interwork -mno-thumb-interwork @gol
623 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
624 -mtune=@var{name} -mprint-tune-info @gol
625 -mstructure-size-boundary=@var{n} @gol
626 -mabort-on-noreturn @gol
627 -mlong-calls -mno-long-calls @gol
628 -msingle-pic-base -mno-single-pic-base @gol
629 -mpic-register=@var{reg} @gol
630 -mnop-fun-dllimport @gol
631 -mpoke-function-name @gol
632 -mthumb -marm @gol
633 -mtpcs-frame -mtpcs-leaf-frame @gol
634 -mcaller-super-interworking -mcallee-super-interworking @gol
635 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
636 -mword-relocations @gol
637 -mfix-cortex-m3-ldrd @gol
638 -munaligned-access @gol
639 -mneon-for-64bits @gol
640 -mslow-flash-data @gol
641 -masm-syntax-unified @gol
642 -mrestrict-it}
643
644 @emph{AVR Options}
645 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
646 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
647 -mrelax -mrmw -mstrict-X -mtiny-stack -mfract-convert-truncate -nodevicelib @gol
648 -Waddr-space-convert -Wmisspelled-isr}
649
650 @emph{Blackfin Options}
651 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
652 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
653 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
654 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
655 -mno-id-shared-library -mshared-library-id=@var{n} @gol
656 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
657 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
658 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
659 -micplb}
660
661 @emph{C6X Options}
662 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
663 -msim -msdata=@var{sdata-type}}
664
665 @emph{CRIS Options}
666 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
667 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
668 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
669 -mstack-align -mdata-align -mconst-align @gol
670 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
671 -melf -maout -melinux -mlinux -sim -sim2 @gol
672 -mmul-bug-workaround -mno-mul-bug-workaround}
673
674 @emph{CR16 Options}
675 @gccoptlist{-mmac @gol
676 -mcr16cplus -mcr16c @gol
677 -msim -mint32 -mbit-ops
678 -mdata-model=@var{model}}
679
680 @emph{Darwin Options}
681 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
682 -arch_only -bind_at_load -bundle -bundle_loader @gol
683 -client_name -compatibility_version -current_version @gol
684 -dead_strip @gol
685 -dependency-file -dylib_file -dylinker_install_name @gol
686 -dynamic -dynamiclib -exported_symbols_list @gol
687 -filelist -flat_namespace -force_cpusubtype_ALL @gol
688 -force_flat_namespace -headerpad_max_install_names @gol
689 -iframework @gol
690 -image_base -init -install_name -keep_private_externs @gol
691 -multi_module -multiply_defined -multiply_defined_unused @gol
692 -noall_load -no_dead_strip_inits_and_terms @gol
693 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
694 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
695 -private_bundle -read_only_relocs -sectalign @gol
696 -sectobjectsymbols -whyload -seg1addr @gol
697 -sectcreate -sectobjectsymbols -sectorder @gol
698 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
699 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
700 -segprot -segs_read_only_addr -segs_read_write_addr @gol
701 -single_module -static -sub_library -sub_umbrella @gol
702 -twolevel_namespace -umbrella -undefined @gol
703 -unexported_symbols_list -weak_reference_mismatches @gol
704 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
705 -mkernel -mone-byte-bool}
706
707 @emph{DEC Alpha Options}
708 @gccoptlist{-mno-fp-regs -msoft-float @gol
709 -mieee -mieee-with-inexact -mieee-conformant @gol
710 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
711 -mtrap-precision=@var{mode} -mbuild-constants @gol
712 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
713 -mbwx -mmax -mfix -mcix @gol
714 -mfloat-vax -mfloat-ieee @gol
715 -mexplicit-relocs -msmall-data -mlarge-data @gol
716 -msmall-text -mlarge-text @gol
717 -mmemory-latency=@var{time}}
718
719 @emph{FR30 Options}
720 @gccoptlist{-msmall-model -mno-lsim}
721
722 @emph{FT32 Options}
723 @gccoptlist{-msim -mlra -mnodiv}
724
725 @emph{FRV Options}
726 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
727 -mhard-float -msoft-float @gol
728 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
729 -mdouble -mno-double @gol
730 -mmedia -mno-media -mmuladd -mno-muladd @gol
731 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
732 -mlinked-fp -mlong-calls -malign-labels @gol
733 -mlibrary-pic -macc-4 -macc-8 @gol
734 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
735 -moptimize-membar -mno-optimize-membar @gol
736 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
737 -mvliw-branch -mno-vliw-branch @gol
738 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
739 -mno-nested-cond-exec -mtomcat-stats @gol
740 -mTLS -mtls @gol
741 -mcpu=@var{cpu}}
742
743 @emph{GNU/Linux Options}
744 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
745 -tno-android-cc -tno-android-ld}
746
747 @emph{H8/300 Options}
748 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
749
750 @emph{HPPA Options}
751 @gccoptlist{-march=@var{architecture-type} @gol
752 -mdisable-fpregs -mdisable-indexing @gol
753 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
754 -mfixed-range=@var{register-range} @gol
755 -mjump-in-delay -mlinker-opt -mlong-calls @gol
756 -mlong-load-store -mno-disable-fpregs @gol
757 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
758 -mno-jump-in-delay -mno-long-load-store @gol
759 -mno-portable-runtime -mno-soft-float @gol
760 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
761 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
762 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
763 -munix=@var{unix-std} -nolibdld -static -threads}
764
765 @emph{IA-64 Options}
766 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
767 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
768 -mconstant-gp -mauto-pic -mfused-madd @gol
769 -minline-float-divide-min-latency @gol
770 -minline-float-divide-max-throughput @gol
771 -mno-inline-float-divide @gol
772 -minline-int-divide-min-latency @gol
773 -minline-int-divide-max-throughput @gol
774 -mno-inline-int-divide @gol
775 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
776 -mno-inline-sqrt @gol
777 -mdwarf2-asm -mearly-stop-bits @gol
778 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
779 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
780 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
781 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
782 -msched-spec-ldc -msched-spec-control-ldc @gol
783 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
784 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
785 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
786 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
787
788 @emph{LM32 Options}
789 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
790 -msign-extend-enabled -muser-enabled}
791
792 @emph{M32R/D Options}
793 @gccoptlist{-m32r2 -m32rx -m32r @gol
794 -mdebug @gol
795 -malign-loops -mno-align-loops @gol
796 -missue-rate=@var{number} @gol
797 -mbranch-cost=@var{number} @gol
798 -mmodel=@var{code-size-model-type} @gol
799 -msdata=@var{sdata-type} @gol
800 -mno-flush-func -mflush-func=@var{name} @gol
801 -mno-flush-trap -mflush-trap=@var{number} @gol
802 -G @var{num}}
803
804 @emph{M32C Options}
805 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
806
807 @emph{M680x0 Options}
808 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
809 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
810 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
811 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
812 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
813 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
814 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
815 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
816 -mxgot -mno-xgot}
817
818 @emph{MCore Options}
819 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
820 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
821 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
822 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
823 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
824
825 @emph{MeP Options}
826 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
827 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
828 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
829 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
830 -mtiny=@var{n}}
831
832 @emph{MicroBlaze Options}
833 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
834 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
835 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
836 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
837 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
838
839 @emph{MIPS Options}
840 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
841 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
842 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
843 -mips16 -mno-mips16 -mflip-mips16 @gol
844 -minterlink-compressed -mno-interlink-compressed @gol
845 -minterlink-mips16 -mno-interlink-mips16 @gol
846 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
847 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
848 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
849 -mno-float -msingle-float -mdouble-float @gol
850 -modd-spreg -mno-odd-spreg @gol
851 -mabs=@var{mode} -mnan=@var{encoding} @gol
852 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
853 -mmcu -mmno-mcu @gol
854 -meva -mno-eva @gol
855 -mvirt -mno-virt @gol
856 -mxpa -mno-xpa @gol
857 -mmicromips -mno-micromips @gol
858 -mmsa -mno-msa @gol
859 -mfpu=@var{fpu-type} @gol
860 -msmartmips -mno-smartmips @gol
861 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
862 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
863 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
864 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
865 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
866 -membedded-data -mno-embedded-data @gol
867 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
868 -mcode-readable=@var{setting} @gol
869 -msplit-addresses -mno-split-addresses @gol
870 -mexplicit-relocs -mno-explicit-relocs @gol
871 -mcheck-zero-division -mno-check-zero-division @gol
872 -mdivide-traps -mdivide-breaks @gol
873 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
874 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
875 -mfix-24k -mno-fix-24k @gol
876 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
877 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
878 -mfix-vr4120 -mno-fix-vr4120 @gol
879 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
880 -mflush-func=@var{func} -mno-flush-func @gol
881 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
882 -mcompact-branches=@var{policy} @gol
883 -mfp-exceptions -mno-fp-exceptions @gol
884 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
885 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
886 -mframe-header-opt -mno-frame-header-opt}
887
888 @emph{MMIX Options}
889 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
890 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
891 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
892 -mno-base-addresses -msingle-exit -mno-single-exit}
893
894 @emph{MN10300 Options}
895 @gccoptlist{-mmult-bug -mno-mult-bug @gol
896 -mno-am33 -mam33 -mam33-2 -mam34 @gol
897 -mtune=@var{cpu-type} @gol
898 -mreturn-pointer-on-d0 @gol
899 -mno-crt0 -mrelax -mliw -msetlb}
900
901 @emph{Moxie Options}
902 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
903
904 @emph{MSP430 Options}
905 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
906 -mwarn-mcu @gol
907 -mcode-region= -mdata-region= @gol
908 -msilicon-errata= -msilicon-errata-warn= @gol
909 -mhwmult= -minrt}
910
911 @emph{NDS32 Options}
912 @gccoptlist{-mbig-endian -mlittle-endian @gol
913 -mreduced-regs -mfull-regs @gol
914 -mcmov -mno-cmov @gol
915 -mperf-ext -mno-perf-ext @gol
916 -mv3push -mno-v3push @gol
917 -m16bit -mno-16bit @gol
918 -misr-vector-size=@var{num} @gol
919 -mcache-block-size=@var{num} @gol
920 -march=@var{arch} @gol
921 -mcmodel=@var{code-model} @gol
922 -mctor-dtor -mrelax}
923
924 @emph{Nios II Options}
925 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
926 -mel -meb @gol
927 -mno-bypass-cache -mbypass-cache @gol
928 -mno-cache-volatile -mcache-volatile @gol
929 -mno-fast-sw-div -mfast-sw-div @gol
930 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
931 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
932 -mcustom-fpu-cfg=@var{name} @gol
933 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
934 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
935
936 @emph{Nvidia PTX Options}
937 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
938
939 @emph{PDP-11 Options}
940 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
941 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
942 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
943 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
944 -mbranch-expensive -mbranch-cheap @gol
945 -munix-asm -mdec-asm}
946
947 @emph{picoChip Options}
948 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
949 -msymbol-as-address -mno-inefficient-warnings}
950
951 @emph{PowerPC Options}
952 See RS/6000 and PowerPC Options.
953
954 @emph{RL78 Options}
955 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
956 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
957 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
958
959 @emph{RS/6000 and PowerPC Options}
960 @gccoptlist{-mcpu=@var{cpu-type} @gol
961 -mtune=@var{cpu-type} @gol
962 -mcmodel=@var{code-model} @gol
963 -mpowerpc64 @gol
964 -maltivec -mno-altivec @gol
965 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
966 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
967 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
968 -mfprnd -mno-fprnd @gol
969 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
970 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
971 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
972 -malign-power -malign-natural @gol
973 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
974 -msingle-float -mdouble-float -msimple-fpu @gol
975 -mstring -mno-string -mupdate -mno-update @gol
976 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
977 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
978 -mstrict-align -mno-strict-align -mrelocatable @gol
979 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
980 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
981 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
982 -mprioritize-restricted-insns=@var{priority} @gol
983 -msched-costly-dep=@var{dependence_type} @gol
984 -minsert-sched-nops=@var{scheme} @gol
985 -mcall-sysv -mcall-netbsd @gol
986 -maix-struct-return -msvr4-struct-return @gol
987 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
988 -mblock-move-inline-limit=@var{num} @gol
989 -misel -mno-isel @gol
990 -misel=yes -misel=no @gol
991 -mspe -mno-spe @gol
992 -mspe=yes -mspe=no @gol
993 -mpaired @gol
994 -mgen-cell-microcode -mwarn-cell-microcode @gol
995 -mvrsave -mno-vrsave @gol
996 -mmulhw -mno-mulhw @gol
997 -mdlmzb -mno-dlmzb @gol
998 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
999 -mprototype -mno-prototype @gol
1000 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1001 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
1002 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1003 -mno-recip-precision @gol
1004 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1005 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1006 -msave-toc-indirect -mno-save-toc-indirect @gol
1007 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1008 -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol
1009 -mquad-memory -mno-quad-memory @gol
1010 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1011 -mcompat-align-parm -mno-compat-align-parm @gol
1012 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
1013 -mupper-regs-di -mno-upper-regs-di @gol
1014 -mupper-regs -mno-upper-regs -mmodulo -mno-modulo @gol
1015 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1016 -mpower9-fusion -mno-mpower9-fusion -mpower9-vector -mno-power9-vector @gol
1017 -mpower9-dform -mno-power9-dform -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 -fargs-in-order
2241 @opindex fargs-in-order
2242 Evaluate function arguments and operands of some binary expressions in
2243 left-to-right order, and evaluate the right side of an assignment
2244 before the left side, as proposed in P0145R2. Enabled by default with
2245 @option{-std=c++1z}. @option{-fargs-in-order=1} implements all of the
2246 ordering requirements except function arguments.
2247
2248 @item -fcheck-new
2249 @opindex fcheck-new
2250 Check that the pointer returned by @code{operator new} is non-null
2251 before attempting to modify the storage allocated. This check is
2252 normally unnecessary because the C++ standard specifies that
2253 @code{operator new} only returns @code{0} if it is declared
2254 @code{throw()}, in which case the compiler always checks the
2255 return value even without this option. In all other cases, when
2256 @code{operator new} has a non-empty exception specification, memory
2257 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2258 @samp{new (nothrow)}.
2259
2260 @item -fconcepts
2261 @opindex fconcepts
2262 Enable support for the C++ Extensions for Concepts Technical
2263 Specification, ISO 19217 (2015), which allows code like
2264
2265 @smallexample
2266 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2267 template <Addable T> T add (T a, T b) @{ return a + b; @}
2268 @end smallexample
2269
2270 @item -fconstexpr-depth=@var{n}
2271 @opindex fconstexpr-depth
2272 Set the maximum nested evaluation depth for C++11 constexpr functions
2273 to @var{n}. A limit is needed to detect endless recursion during
2274 constant expression evaluation. The minimum specified by the standard
2275 is 512.
2276
2277 @item -fdeduce-init-list
2278 @opindex fdeduce-init-list
2279 Enable deduction of a template type parameter as
2280 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2281
2282 @smallexample
2283 template <class T> auto forward(T t) -> decltype (realfn (t))
2284 @{
2285 return realfn (t);
2286 @}
2287
2288 void f()
2289 @{
2290 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2291 @}
2292 @end smallexample
2293
2294 This deduction was implemented as a possible extension to the
2295 originally proposed semantics for the C++11 standard, but was not part
2296 of the final standard, so it is disabled by default. This option is
2297 deprecated, and may be removed in a future version of G++.
2298
2299 @item -ffriend-injection
2300 @opindex ffriend-injection
2301 Inject friend functions into the enclosing namespace, so that they are
2302 visible outside the scope of the class in which they are declared.
2303 Friend functions were documented to work this way in the old Annotated
2304 C++ Reference Manual.
2305 However, in ISO C++ a friend function that is not declared
2306 in an enclosing scope can only be found using argument dependent
2307 lookup. GCC defaults to the standard behavior.
2308
2309 This option is for compatibility, and may be removed in a future
2310 release of G++.
2311
2312 @item -fno-elide-constructors
2313 @opindex fno-elide-constructors
2314 The C++ standard allows an implementation to omit creating a temporary
2315 that is only used to initialize another object of the same type.
2316 Specifying this option disables that optimization, and forces G++ to
2317 call the copy constructor in all cases.
2318
2319 @item -fno-enforce-eh-specs
2320 @opindex fno-enforce-eh-specs
2321 Don't generate code to check for violation of exception specifications
2322 at run time. This option violates the C++ standard, but may be useful
2323 for reducing code size in production builds, much like defining
2324 @code{NDEBUG}. This does not give user code permission to throw
2325 exceptions in violation of the exception specifications; the compiler
2326 still optimizes based on the specifications, so throwing an
2327 unexpected exception results in undefined behavior at run time.
2328
2329 @item -fextern-tls-init
2330 @itemx -fno-extern-tls-init
2331 @opindex fextern-tls-init
2332 @opindex fno-extern-tls-init
2333 The C++11 and OpenMP standards allow @code{thread_local} and
2334 @code{threadprivate} variables to have dynamic (runtime)
2335 initialization. To support this, any use of such a variable goes
2336 through a wrapper function that performs any necessary initialization.
2337 When the use and definition of the variable are in the same
2338 translation unit, this overhead can be optimized away, but when the
2339 use is in a different translation unit there is significant overhead
2340 even if the variable doesn't actually need dynamic initialization. If
2341 the programmer can be sure that no use of the variable in a
2342 non-defining TU needs to trigger dynamic initialization (either
2343 because the variable is statically initialized, or a use of the
2344 variable in the defining TU will be executed before any uses in
2345 another TU), they can avoid this overhead with the
2346 @option{-fno-extern-tls-init} option.
2347
2348 On targets that support symbol aliases, the default is
2349 @option{-fextern-tls-init}. On targets that do not support symbol
2350 aliases, the default is @option{-fno-extern-tls-init}.
2351
2352 @item -ffor-scope
2353 @itemx -fno-for-scope
2354 @opindex ffor-scope
2355 @opindex fno-for-scope
2356 If @option{-ffor-scope} is specified, the scope of variables declared in
2357 a @i{for-init-statement} is limited to the @code{for} loop itself,
2358 as specified by the C++ standard.
2359 If @option{-fno-for-scope} is specified, the scope of variables declared in
2360 a @i{for-init-statement} extends to the end of the enclosing scope,
2361 as was the case in old versions of G++, and other (traditional)
2362 implementations of C++.
2363
2364 If neither flag is given, the default is to follow the standard,
2365 but to allow and give a warning for old-style code that would
2366 otherwise be invalid, or have different behavior.
2367
2368 @item -fno-gnu-keywords
2369 @opindex fno-gnu-keywords
2370 Do not recognize @code{typeof} as a keyword, so that code can use this
2371 word as an identifier. You can use the keyword @code{__typeof__} instead.
2372 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2373 @option{-std=c++98}, @option{-std=c++11}, etc.
2374
2375 @item -fno-implicit-templates
2376 @opindex fno-implicit-templates
2377 Never emit code for non-inline templates that are instantiated
2378 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2379 @xref{Template Instantiation}, for more information.
2380
2381 @item -fno-implicit-inline-templates
2382 @opindex fno-implicit-inline-templates
2383 Don't emit code for implicit instantiations of inline templates, either.
2384 The default is to handle inlines differently so that compiles with and
2385 without optimization need the same set of explicit instantiations.
2386
2387 @item -fno-implement-inlines
2388 @opindex fno-implement-inlines
2389 To save space, do not emit out-of-line copies of inline functions
2390 controlled by @code{#pragma implementation}. This causes linker
2391 errors if these functions are not inlined everywhere they are called.
2392
2393 @item -fms-extensions
2394 @opindex fms-extensions
2395 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2396 int and getting a pointer to member function via non-standard syntax.
2397
2398 @item -fno-nonansi-builtins
2399 @opindex fno-nonansi-builtins
2400 Disable built-in declarations of functions that are not mandated by
2401 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2402 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2403
2404 @item -fnothrow-opt
2405 @opindex fnothrow-opt
2406 Treat a @code{throw()} exception specification as if it were a
2407 @code{noexcept} specification to reduce or eliminate the text size
2408 overhead relative to a function with no exception specification. If
2409 the function has local variables of types with non-trivial
2410 destructors, the exception specification actually makes the
2411 function smaller because the EH cleanups for those variables can be
2412 optimized away. The semantic effect is that an exception thrown out of
2413 a function with such an exception specification results in a call
2414 to @code{terminate} rather than @code{unexpected}.
2415
2416 @item -fno-operator-names
2417 @opindex fno-operator-names
2418 Do not treat the operator name keywords @code{and}, @code{bitand},
2419 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2420 synonyms as keywords.
2421
2422 @item -fno-optional-diags
2423 @opindex fno-optional-diags
2424 Disable diagnostics that the standard says a compiler does not need to
2425 issue. Currently, the only such diagnostic issued by G++ is the one for
2426 a name having multiple meanings within a class.
2427
2428 @item -fpermissive
2429 @opindex fpermissive
2430 Downgrade some diagnostics about nonconformant code from errors to
2431 warnings. Thus, using @option{-fpermissive} allows some
2432 nonconforming code to compile.
2433
2434 @item -fno-pretty-templates
2435 @opindex fno-pretty-templates
2436 When an error message refers to a specialization of a function
2437 template, the compiler normally prints the signature of the
2438 template followed by the template arguments and any typedefs or
2439 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2440 rather than @code{void f(int)}) so that it's clear which template is
2441 involved. When an error message refers to a specialization of a class
2442 template, the compiler omits any template arguments that match
2443 the default template arguments for that template. If either of these
2444 behaviors make it harder to understand the error message rather than
2445 easier, you can use @option{-fno-pretty-templates} to disable them.
2446
2447 @item -frepo
2448 @opindex frepo
2449 Enable automatic template instantiation at link time. This option also
2450 implies @option{-fno-implicit-templates}. @xref{Template
2451 Instantiation}, for more information.
2452
2453 @item -fno-rtti
2454 @opindex fno-rtti
2455 Disable generation of information about every class with virtual
2456 functions for use by the C++ run-time type identification features
2457 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2458 of the language, you can save some space by using this flag. Note that
2459 exception handling uses the same information, but G++ generates it as
2460 needed. The @code{dynamic_cast} operator can still be used for casts that
2461 do not require run-time type information, i.e.@: casts to @code{void *} or to
2462 unambiguous base classes.
2463
2464 @item -fsized-deallocation
2465 @opindex fsized-deallocation
2466 Enable the built-in global declarations
2467 @smallexample
2468 void operator delete (void *, std::size_t) noexcept;
2469 void operator delete[] (void *, std::size_t) noexcept;
2470 @end smallexample
2471 as introduced in C++14. This is useful for user-defined replacement
2472 deallocation functions that, for example, use the size of the object
2473 to make deallocation faster. Enabled by default under
2474 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2475 warns about places that might want to add a definition.
2476
2477 @item -fstrict-enums
2478 @opindex fstrict-enums
2479 Allow the compiler to optimize using the assumption that a value of
2480 enumerated type can only be one of the values of the enumeration (as
2481 defined in the C++ standard; basically, a value that can be
2482 represented in the minimum number of bits needed to represent all the
2483 enumerators). This assumption may not be valid if the program uses a
2484 cast to convert an arbitrary integer value to the enumerated type.
2485
2486 @item -ftemplate-backtrace-limit=@var{n}
2487 @opindex ftemplate-backtrace-limit
2488 Set the maximum number of template instantiation notes for a single
2489 warning or error to @var{n}. The default value is 10.
2490
2491 @item -ftemplate-depth=@var{n}
2492 @opindex ftemplate-depth
2493 Set the maximum instantiation depth for template classes to @var{n}.
2494 A limit on the template instantiation depth is needed to detect
2495 endless recursions during template class instantiation. ANSI/ISO C++
2496 conforming programs must not rely on a maximum depth greater than 17
2497 (changed to 1024 in C++11). The default value is 900, as the compiler
2498 can run out of stack space before hitting 1024 in some situations.
2499
2500 @item -fno-threadsafe-statics
2501 @opindex fno-threadsafe-statics
2502 Do not emit the extra code to use the routines specified in the C++
2503 ABI for thread-safe initialization of local statics. You can use this
2504 option to reduce code size slightly in code that doesn't need to be
2505 thread-safe.
2506
2507 @item -fuse-cxa-atexit
2508 @opindex fuse-cxa-atexit
2509 Register destructors for objects with static storage duration with the
2510 @code{__cxa_atexit} function rather than the @code{atexit} function.
2511 This option is required for fully standards-compliant handling of static
2512 destructors, but only works if your C library supports
2513 @code{__cxa_atexit}.
2514
2515 @item -fno-use-cxa-get-exception-ptr
2516 @opindex fno-use-cxa-get-exception-ptr
2517 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2518 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2519 if the runtime routine is not available.
2520
2521 @item -fvisibility-inlines-hidden
2522 @opindex fvisibility-inlines-hidden
2523 This switch declares that the user does not attempt to compare
2524 pointers to inline functions or methods where the addresses of the two functions
2525 are taken in different shared objects.
2526
2527 The effect of this is that GCC may, effectively, mark inline methods with
2528 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2529 appear in the export table of a DSO and do not require a PLT indirection
2530 when used within the DSO@. Enabling this option can have a dramatic effect
2531 on load and link times of a DSO as it massively reduces the size of the
2532 dynamic export table when the library makes heavy use of templates.
2533
2534 The behavior of this switch is not quite the same as marking the
2535 methods as hidden directly, because it does not affect static variables
2536 local to the function or cause the compiler to deduce that
2537 the function is defined in only one shared object.
2538
2539 You may mark a method as having a visibility explicitly to negate the
2540 effect of the switch for that method. For example, if you do want to
2541 compare pointers to a particular inline method, you might mark it as
2542 having default visibility. Marking the enclosing class with explicit
2543 visibility has no effect.
2544
2545 Explicitly instantiated inline methods are unaffected by this option
2546 as their linkage might otherwise cross a shared library boundary.
2547 @xref{Template Instantiation}.
2548
2549 @item -fvisibility-ms-compat
2550 @opindex fvisibility-ms-compat
2551 This flag attempts to use visibility settings to make GCC's C++
2552 linkage model compatible with that of Microsoft Visual Studio.
2553
2554 The flag makes these changes to GCC's linkage model:
2555
2556 @enumerate
2557 @item
2558 It sets the default visibility to @code{hidden}, like
2559 @option{-fvisibility=hidden}.
2560
2561 @item
2562 Types, but not their members, are not hidden by default.
2563
2564 @item
2565 The One Definition Rule is relaxed for types without explicit
2566 visibility specifications that are defined in more than one
2567 shared object: those declarations are permitted if they are
2568 permitted when this option is not used.
2569 @end enumerate
2570
2571 In new code it is better to use @option{-fvisibility=hidden} and
2572 export those classes that are intended to be externally visible.
2573 Unfortunately it is possible for code to rely, perhaps accidentally,
2574 on the Visual Studio behavior.
2575
2576 Among the consequences of these changes are that static data members
2577 of the same type with the same name but defined in different shared
2578 objects are different, so changing one does not change the other;
2579 and that pointers to function members defined in different shared
2580 objects may not compare equal. When this flag is given, it is a
2581 violation of the ODR to define types with the same name differently.
2582
2583 @item -fno-weak
2584 @opindex fno-weak
2585 Do not use weak symbol support, even if it is provided by the linker.
2586 By default, G++ uses weak symbols if they are available. This
2587 option exists only for testing, and should not be used by end-users;
2588 it results in inferior code and has no benefits. This option may
2589 be removed in a future release of G++.
2590
2591 @item -nostdinc++
2592 @opindex nostdinc++
2593 Do not search for header files in the standard directories specific to
2594 C++, but do still search the other standard directories. (This option
2595 is used when building the C++ library.)
2596 @end table
2597
2598 In addition, these optimization, warning, and code generation options
2599 have meanings only for C++ programs:
2600
2601 @table @gcctabopt
2602 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2603 @opindex Wabi
2604 @opindex Wno-abi
2605 Warn when G++ it generates code that is probably not compatible with
2606 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2607 ABI with each major release, normally @option{-Wabi} will warn only if
2608 there is a check added later in a release series for an ABI issue
2609 discovered since the initial release. @option{-Wabi} will warn about
2610 more things if an older ABI version is selected (with
2611 @option{-fabi-version=@var{n}}).
2612
2613 @option{-Wabi} can also be used with an explicit version number to
2614 warn about compatibility with a particular @option{-fabi-version}
2615 level, e.g. @option{-Wabi=2} to warn about changes relative to
2616 @option{-fabi-version=2}.
2617
2618 If an explicit version number is provided and
2619 @option{-fabi-compat-version} is not specified, the version number
2620 from this option is used for compatibility aliases. If no explicit
2621 version number is provided with this option, but
2622 @option{-fabi-compat-version} is specified, that version number is
2623 used for ABI warnings.
2624
2625 Although an effort has been made to warn about
2626 all such cases, there are probably some cases that are not warned about,
2627 even though G++ is generating incompatible code. There may also be
2628 cases where warnings are emitted even though the code that is generated
2629 is compatible.
2630
2631 You should rewrite your code to avoid these warnings if you are
2632 concerned about the fact that code generated by G++ may not be binary
2633 compatible with code generated by other compilers.
2634
2635 Known incompatibilities in @option{-fabi-version=2} (which was the
2636 default from GCC 3.4 to 4.9) include:
2637
2638 @itemize @bullet
2639
2640 @item
2641 A template with a non-type template parameter of reference type was
2642 mangled incorrectly:
2643 @smallexample
2644 extern int N;
2645 template <int &> struct S @{@};
2646 void n (S<N>) @{2@}
2647 @end smallexample
2648
2649 This was fixed in @option{-fabi-version=3}.
2650
2651 @item
2652 SIMD vector types declared using @code{__attribute ((vector_size))} were
2653 mangled in a non-standard way that does not allow for overloading of
2654 functions taking vectors of different sizes.
2655
2656 The mangling was changed in @option{-fabi-version=4}.
2657
2658 @item
2659 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2660 qualifiers, and @code{decltype} of a plain declaration was folded away.
2661
2662 These mangling issues were fixed in @option{-fabi-version=5}.
2663
2664 @item
2665 Scoped enumerators passed as arguments to a variadic function are
2666 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2667 On most targets this does not actually affect the parameter passing
2668 ABI, as there is no way to pass an argument smaller than @code{int}.
2669
2670 Also, the ABI changed the mangling of template argument packs,
2671 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2672 a class scope function used as a template argument.
2673
2674 These issues were corrected in @option{-fabi-version=6}.
2675
2676 @item
2677 Lambdas in default argument scope were mangled incorrectly, and the
2678 ABI changed the mangling of @code{nullptr_t}.
2679
2680 These issues were corrected in @option{-fabi-version=7}.
2681
2682 @item
2683 When mangling a function type with function-cv-qualifiers, the
2684 un-qualified function type was incorrectly treated as a substitution
2685 candidate.
2686
2687 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2688
2689 @item
2690 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2691 unaligned accesses. Note that this did not affect the ABI of a
2692 function with a @code{nullptr_t} parameter, as parameters have a
2693 minimum alignment.
2694
2695 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2696
2697 @item
2698 Target-specific attributes that affect the identity of a type, such as
2699 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2700 did not affect the mangled name, leading to name collisions when
2701 function pointers were used as template arguments.
2702
2703 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2704
2705 @end itemize
2706
2707 It also warns about psABI-related changes. The known psABI changes at this
2708 point include:
2709
2710 @itemize @bullet
2711
2712 @item
2713 For SysV/x86-64, unions with @code{long double} members are
2714 passed in memory as specified in psABI. For example:
2715
2716 @smallexample
2717 union U @{
2718 long double ld;
2719 int i;
2720 @};
2721 @end smallexample
2722
2723 @noindent
2724 @code{union U} is always passed in memory.
2725
2726 @end itemize
2727
2728 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2729 @opindex Wabi-tag
2730 @opindex -Wabi-tag
2731 Warn when a type with an ABI tag is used in a context that does not
2732 have that ABI tag. See @ref{C++ Attributes} for more information
2733 about ABI tags.
2734
2735 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2736 @opindex Wctor-dtor-privacy
2737 @opindex Wno-ctor-dtor-privacy
2738 Warn when a class seems unusable because all the constructors or
2739 destructors in that class are private, and it has neither friends nor
2740 public static member functions. Also warn if there are no non-private
2741 methods, and there's at least one private member function that isn't
2742 a constructor or destructor.
2743
2744 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2745 @opindex Wdelete-non-virtual-dtor
2746 @opindex Wno-delete-non-virtual-dtor
2747 Warn when @code{delete} is used to destroy an instance of a class that
2748 has virtual functions and non-virtual destructor. It is unsafe to delete
2749 an instance of a derived class through a pointer to a base class if the
2750 base class does not have a virtual destructor. This warning is enabled
2751 by @option{-Wall}.
2752
2753 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2754 @opindex Wliteral-suffix
2755 @opindex Wno-literal-suffix
2756 Warn when a string or character literal is followed by a ud-suffix which does
2757 not begin with an underscore. As a conforming extension, GCC treats such
2758 suffixes as separate preprocessing tokens in order to maintain backwards
2759 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2760 For example:
2761
2762 @smallexample
2763 #define __STDC_FORMAT_MACROS
2764 #include <inttypes.h>
2765 #include <stdio.h>
2766
2767 int main() @{
2768 int64_t i64 = 123;
2769 printf("My int64: %" PRId64"\n", i64);
2770 @}
2771 @end smallexample
2772
2773 In this case, @code{PRId64} is treated as a separate preprocessing token.
2774
2775 This warning is enabled by default.
2776
2777 @item -Wlto-type-mismatch
2778 @opindex Wlto-type-mismatch
2779 @opindex Wno-lto-type-mismatch
2780
2781 During the link-time optimization warn about type mismatches in
2782 global declarations from different compilation units.
2783 Requires @option{-flto} to be enabled. Enabled by default.
2784
2785 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2786 @opindex Wnarrowing
2787 @opindex Wno-narrowing
2788 With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing
2789 conversion prohibited by C++11 occurs within
2790 @samp{@{ @}}, e.g.
2791
2792 @smallexample
2793 int i = @{ 2.2 @}; // error: narrowing from double to int
2794 @end smallexample
2795
2796 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2797
2798 When a later standard is in effect, e.g. when using @option{-std=c++11},
2799 narrowing conversions are diagnosed by default, as required by the standard.
2800 A narrowing conversion from a constant produces an error,
2801 and a narrowing conversion from a non-constant produces a warning,
2802 but @option{-Wno-narrowing} suppresses the diagnostic.
2803 Note that this does not affect the meaning of well-formed code;
2804 narrowing conversions are still considered ill-formed in SFINAE contexts.
2805
2806 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2807 @opindex Wnoexcept
2808 @opindex Wno-noexcept
2809 Warn when a noexcept-expression evaluates to false because of a call
2810 to a function that does not have a non-throwing exception
2811 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2812 the compiler to never throw an exception.
2813
2814 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2815 @opindex Wnon-virtual-dtor
2816 @opindex Wno-non-virtual-dtor
2817 Warn when a class has virtual functions and an accessible non-virtual
2818 destructor itself or in an accessible polymorphic base class, in which
2819 case it is possible but unsafe to delete an instance of a derived
2820 class through a pointer to the class itself or base class. This
2821 warning is automatically enabled if @option{-Weffc++} is specified.
2822
2823 @item -Wreorder @r{(C++ and Objective-C++ only)}
2824 @opindex Wreorder
2825 @opindex Wno-reorder
2826 @cindex reordering, warning
2827 @cindex warning for reordering of member initializers
2828 Warn when the order of member initializers given in the code does not
2829 match the order in which they must be executed. For instance:
2830
2831 @smallexample
2832 struct A @{
2833 int i;
2834 int j;
2835 A(): j (0), i (1) @{ @}
2836 @};
2837 @end smallexample
2838
2839 @noindent
2840 The compiler rearranges the member initializers for @code{i}
2841 and @code{j} to match the declaration order of the members, emitting
2842 a warning to that effect. This warning is enabled by @option{-Wall}.
2843
2844 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2845 @opindex fext-numeric-literals
2846 @opindex fno-ext-numeric-literals
2847 Accept imaginary, fixed-point, or machine-defined
2848 literal number suffixes as GNU extensions.
2849 When this option is turned off these suffixes are treated
2850 as C++11 user-defined literal numeric suffixes.
2851 This is on by default for all pre-C++11 dialects and all GNU dialects:
2852 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2853 @option{-std=gnu++14}.
2854 This option is off by default
2855 for ISO C++11 onwards (@option{-std=c++11}, ...).
2856 @end table
2857
2858 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2859
2860 @table @gcctabopt
2861 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2862 @opindex Weffc++
2863 @opindex Wno-effc++
2864 Warn about violations of the following style guidelines from Scott Meyers'
2865 @cite{Effective C++} series of books:
2866
2867 @itemize @bullet
2868 @item
2869 Define a copy constructor and an assignment operator for classes
2870 with dynamically-allocated memory.
2871
2872 @item
2873 Prefer initialization to assignment in constructors.
2874
2875 @item
2876 Have @code{operator=} return a reference to @code{*this}.
2877
2878 @item
2879 Don't try to return a reference when you must return an object.
2880
2881 @item
2882 Distinguish between prefix and postfix forms of increment and
2883 decrement operators.
2884
2885 @item
2886 Never overload @code{&&}, @code{||}, or @code{,}.
2887
2888 @end itemize
2889
2890 This option also enables @option{-Wnon-virtual-dtor}, which is also
2891 one of the effective C++ recommendations. However, the check is
2892 extended to warn about the lack of virtual destructor in accessible
2893 non-polymorphic bases classes too.
2894
2895 When selecting this option, be aware that the standard library
2896 headers do not obey all of these guidelines; use @samp{grep -v}
2897 to filter out those warnings.
2898
2899 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2900 @opindex Wstrict-null-sentinel
2901 @opindex Wno-strict-null-sentinel
2902 Warn about the use of an uncasted @code{NULL} as sentinel. When
2903 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2904 to @code{__null}. Although it is a null pointer constant rather than a
2905 null pointer, it is guaranteed to be of the same size as a pointer.
2906 But this use is not portable across different compilers.
2907
2908 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2909 @opindex Wno-non-template-friend
2910 @opindex Wnon-template-friend
2911 Disable warnings when non-templatized friend functions are declared
2912 within a template. Since the advent of explicit template specification
2913 support in G++, if the name of the friend is an unqualified-id (i.e.,
2914 @samp{friend foo(int)}), the C++ language specification demands that the
2915 friend declare or define an ordinary, nontemplate function. (Section
2916 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2917 could be interpreted as a particular specialization of a templatized
2918 function. Because this non-conforming behavior is no longer the default
2919 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2920 check existing code for potential trouble spots and is on by default.
2921 This new compiler behavior can be turned off with
2922 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2923 but disables the helpful warning.
2924
2925 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2926 @opindex Wold-style-cast
2927 @opindex Wno-old-style-cast
2928 Warn if an old-style (C-style) cast to a non-void type is used within
2929 a C++ program. The new-style casts (@code{dynamic_cast},
2930 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
2931 less vulnerable to unintended effects and much easier to search for.
2932
2933 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2934 @opindex Woverloaded-virtual
2935 @opindex Wno-overloaded-virtual
2936 @cindex overloaded virtual function, warning
2937 @cindex warning for overloaded virtual function
2938 Warn when a function declaration hides virtual functions from a
2939 base class. For example, in:
2940
2941 @smallexample
2942 struct A @{
2943 virtual void f();
2944 @};
2945
2946 struct B: public A @{
2947 void f(int);
2948 @};
2949 @end smallexample
2950
2951 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2952 like:
2953
2954 @smallexample
2955 B* b;
2956 b->f();
2957 @end smallexample
2958
2959 @noindent
2960 fails to compile.
2961
2962 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2963 @opindex Wno-pmf-conversions
2964 @opindex Wpmf-conversions
2965 Disable the diagnostic for converting a bound pointer to member function
2966 to a plain pointer.
2967
2968 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2969 @opindex Wsign-promo
2970 @opindex Wno-sign-promo
2971 Warn when overload resolution chooses a promotion from unsigned or
2972 enumerated type to a signed type, over a conversion to an unsigned type of
2973 the same size. Previous versions of G++ tried to preserve
2974 unsignedness, but the standard mandates the current behavior.
2975
2976 @item -Wtemplates @r{(C++ and Objective-C++ only)}
2977 @opindex Wtemplates
2978 Warn when a primary template declaration is encountered. Some coding
2979 rules disallow templates, and this may be used to enforce that rule.
2980 The warning is inactive inside a system header file, such as the STL, so
2981 one can still use the STL. One may also instantiate or specialize
2982 templates.
2983
2984 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
2985 @opindex Wmultiple-inheritance
2986 Warn when a class is defined with multiple direct base classes. Some
2987 coding rules disallow multiple inheritance, and this may be used to
2988 enforce that rule. The warning is inactive inside a system header file,
2989 such as the STL, so one can still use the STL. One may also define
2990 classes that indirectly use multiple inheritance.
2991
2992 @item -Wvirtual-inheritance
2993 @opindex Wvirtual-inheritance
2994 Warn when a class is defined with a virtual direct base classe. Some
2995 coding rules disallow multiple inheritance, and this may be used to
2996 enforce that rule. The warning is inactive inside a system header file,
2997 such as the STL, so one can still use the STL. One may also define
2998 classes that indirectly use virtual inheritance.
2999
3000 @item -Wnamespaces
3001 @opindex Wnamespaces
3002 Warn when a namespace definition is opened. Some coding rules disallow
3003 namespaces, and this may be used to enforce that rule. The warning is
3004 inactive inside a system header file, such as the STL, so one can still
3005 use the STL. One may also use using directives and qualified names.
3006
3007 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3008 @opindex Wterminate
3009 @opindex Wno-terminate
3010 Disable the warning about a throw-expression that will immediately
3011 result in a call to @code{terminate}.
3012 @end table
3013
3014 @node Objective-C and Objective-C++ Dialect Options
3015 @section Options Controlling Objective-C and Objective-C++ Dialects
3016
3017 @cindex compiler options, Objective-C and Objective-C++
3018 @cindex Objective-C and Objective-C++ options, command-line
3019 @cindex options, Objective-C and Objective-C++
3020 (NOTE: This manual does not describe the Objective-C and Objective-C++
3021 languages themselves. @xref{Standards,,Language Standards
3022 Supported by GCC}, for references.)
3023
3024 This section describes the command-line options that are only meaningful
3025 for Objective-C and Objective-C++ programs. You can also use most of
3026 the language-independent GNU compiler options.
3027 For example, you might compile a file @file{some_class.m} like this:
3028
3029 @smallexample
3030 gcc -g -fgnu-runtime -O -c some_class.m
3031 @end smallexample
3032
3033 @noindent
3034 In this example, @option{-fgnu-runtime} is an option meant only for
3035 Objective-C and Objective-C++ programs; you can use the other options with
3036 any language supported by GCC@.
3037
3038 Note that since Objective-C is an extension of the C language, Objective-C
3039 compilations may also use options specific to the C front-end (e.g.,
3040 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3041 C++-specific options (e.g., @option{-Wabi}).
3042
3043 Here is a list of options that are @emph{only} for compiling Objective-C
3044 and Objective-C++ programs:
3045
3046 @table @gcctabopt
3047 @item -fconstant-string-class=@var{class-name}
3048 @opindex fconstant-string-class
3049 Use @var{class-name} as the name of the class to instantiate for each
3050 literal string specified with the syntax @code{@@"@dots{}"}. The default
3051 class name is @code{NXConstantString} if the GNU runtime is being used, and
3052 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3053 @option{-fconstant-cfstrings} option, if also present, overrides the
3054 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3055 to be laid out as constant CoreFoundation strings.
3056
3057 @item -fgnu-runtime
3058 @opindex fgnu-runtime
3059 Generate object code compatible with the standard GNU Objective-C
3060 runtime. This is the default for most types of systems.
3061
3062 @item -fnext-runtime
3063 @opindex fnext-runtime
3064 Generate output compatible with the NeXT runtime. This is the default
3065 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3066 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3067 used.
3068
3069 @item -fno-nil-receivers
3070 @opindex fno-nil-receivers
3071 Assume that all Objective-C message dispatches (@code{[receiver
3072 message:arg]}) in this translation unit ensure that the receiver is
3073 not @code{nil}. This allows for more efficient entry points in the
3074 runtime to be used. This option is only available in conjunction with
3075 the NeXT runtime and ABI version 0 or 1.
3076
3077 @item -fobjc-abi-version=@var{n}
3078 @opindex fobjc-abi-version
3079 Use version @var{n} of the Objective-C ABI for the selected runtime.
3080 This option is currently supported only for the NeXT runtime. In that
3081 case, Version 0 is the traditional (32-bit) ABI without support for
3082 properties and other Objective-C 2.0 additions. Version 1 is the
3083 traditional (32-bit) ABI with support for properties and other
3084 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3085 nothing is specified, the default is Version 0 on 32-bit target
3086 machines, and Version 2 on 64-bit target machines.
3087
3088 @item -fobjc-call-cxx-cdtors
3089 @opindex fobjc-call-cxx-cdtors
3090 For each Objective-C class, check if any of its instance variables is a
3091 C++ object with a non-trivial default constructor. If so, synthesize a
3092 special @code{- (id) .cxx_construct} instance method which runs
3093 non-trivial default constructors on any such instance variables, in order,
3094 and then return @code{self}. Similarly, check if any instance variable
3095 is a C++ object with a non-trivial destructor, and if so, synthesize a
3096 special @code{- (void) .cxx_destruct} method which runs
3097 all such default destructors, in reverse order.
3098
3099 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3100 methods thusly generated only operate on instance variables
3101 declared in the current Objective-C class, and not those inherited
3102 from superclasses. It is the responsibility of the Objective-C
3103 runtime to invoke all such methods in an object's inheritance
3104 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3105 by the runtime immediately after a new object instance is allocated;
3106 the @code{- (void) .cxx_destruct} methods are invoked immediately
3107 before the runtime deallocates an object instance.
3108
3109 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3110 support for invoking the @code{- (id) .cxx_construct} and
3111 @code{- (void) .cxx_destruct} methods.
3112
3113 @item -fobjc-direct-dispatch
3114 @opindex fobjc-direct-dispatch
3115 Allow fast jumps to the message dispatcher. On Darwin this is
3116 accomplished via the comm page.
3117
3118 @item -fobjc-exceptions
3119 @opindex fobjc-exceptions
3120 Enable syntactic support for structured exception handling in
3121 Objective-C, similar to what is offered by C++ and Java. This option
3122 is required to use the Objective-C keywords @code{@@try},
3123 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3124 @code{@@synchronized}. This option is available with both the GNU
3125 runtime and the NeXT runtime (but not available in conjunction with
3126 the NeXT runtime on Mac OS X 10.2 and earlier).
3127
3128 @item -fobjc-gc
3129 @opindex fobjc-gc
3130 Enable garbage collection (GC) in Objective-C and Objective-C++
3131 programs. This option is only available with the NeXT runtime; the
3132 GNU runtime has a different garbage collection implementation that
3133 does not require special compiler flags.
3134
3135 @item -fobjc-nilcheck
3136 @opindex fobjc-nilcheck
3137 For the NeXT runtime with version 2 of the ABI, check for a nil
3138 receiver in method invocations before doing the actual method call.
3139 This is the default and can be disabled using
3140 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3141 checked for nil in this way no matter what this flag is set to.
3142 Currently this flag does nothing when the GNU runtime, or an older
3143 version of the NeXT runtime ABI, is used.
3144
3145 @item -fobjc-std=objc1
3146 @opindex fobjc-std
3147 Conform to the language syntax of Objective-C 1.0, the language
3148 recognized by GCC 4.0. This only affects the Objective-C additions to
3149 the C/C++ language; it does not affect conformance to C/C++ standards,
3150 which is controlled by the separate C/C++ dialect option flags. When
3151 this option is used with the Objective-C or Objective-C++ compiler,
3152 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3153 This is useful if you need to make sure that your Objective-C code can
3154 be compiled with older versions of GCC@.
3155
3156 @item -freplace-objc-classes
3157 @opindex freplace-objc-classes
3158 Emit a special marker instructing @command{ld(1)} not to statically link in
3159 the resulting object file, and allow @command{dyld(1)} to load it in at
3160 run time instead. This is used in conjunction with the Fix-and-Continue
3161 debugging mode, where the object file in question may be recompiled and
3162 dynamically reloaded in the course of program execution, without the need
3163 to restart the program itself. Currently, Fix-and-Continue functionality
3164 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3165 and later.
3166
3167 @item -fzero-link
3168 @opindex fzero-link
3169 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3170 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3171 compile time) with static class references that get initialized at load time,
3172 which improves run-time performance. Specifying the @option{-fzero-link} flag
3173 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3174 to be retained. This is useful in Zero-Link debugging mode, since it allows
3175 for individual class implementations to be modified during program execution.
3176 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3177 regardless of command-line options.
3178
3179 @item -fno-local-ivars
3180 @opindex fno-local-ivars
3181 @opindex flocal-ivars
3182 By default instance variables in Objective-C can be accessed as if
3183 they were local variables from within the methods of the class they're
3184 declared in. This can lead to shadowing between instance variables
3185 and other variables declared either locally inside a class method or
3186 globally with the same name. Specifying the @option{-fno-local-ivars}
3187 flag disables this behavior thus avoiding variable shadowing issues.
3188
3189 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3190 @opindex fivar-visibility
3191 Set the default instance variable visibility to the specified option
3192 so that instance variables declared outside the scope of any access
3193 modifier directives default to the specified visibility.
3194
3195 @item -gen-decls
3196 @opindex gen-decls
3197 Dump interface declarations for all classes seen in the source file to a
3198 file named @file{@var{sourcename}.decl}.
3199
3200 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3201 @opindex Wassign-intercept
3202 @opindex Wno-assign-intercept
3203 Warn whenever an Objective-C assignment is being intercepted by the
3204 garbage collector.
3205
3206 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3207 @opindex Wno-protocol
3208 @opindex Wprotocol
3209 If a class is declared to implement a protocol, a warning is issued for
3210 every method in the protocol that is not implemented by the class. The
3211 default behavior is to issue a warning for every method not explicitly
3212 implemented in the class, even if a method implementation is inherited
3213 from the superclass. If you use the @option{-Wno-protocol} option, then
3214 methods inherited from the superclass are considered to be implemented,
3215 and no warning is issued for them.
3216
3217 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3218 @opindex Wselector
3219 @opindex Wno-selector
3220 Warn if multiple methods of different types for the same selector are
3221 found during compilation. The check is performed on the list of methods
3222 in the final stage of compilation. Additionally, a check is performed
3223 for each selector appearing in a @code{@@selector(@dots{})}
3224 expression, and a corresponding method for that selector has been found
3225 during compilation. Because these checks scan the method table only at
3226 the end of compilation, these warnings are not produced if the final
3227 stage of compilation is not reached, for example because an error is
3228 found during compilation, or because the @option{-fsyntax-only} option is
3229 being used.
3230
3231 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3232 @opindex Wstrict-selector-match
3233 @opindex Wno-strict-selector-match
3234 Warn if multiple methods with differing argument and/or return types are
3235 found for a given selector when attempting to send a message using this
3236 selector to a receiver of type @code{id} or @code{Class}. When this flag
3237 is off (which is the default behavior), the compiler omits such warnings
3238 if any differences found are confined to types that share the same size
3239 and alignment.
3240
3241 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3242 @opindex Wundeclared-selector
3243 @opindex Wno-undeclared-selector
3244 Warn if a @code{@@selector(@dots{})} expression referring to an
3245 undeclared selector is found. A selector is considered undeclared if no
3246 method with that name has been declared before the
3247 @code{@@selector(@dots{})} expression, either explicitly in an
3248 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3249 an @code{@@implementation} section. This option always performs its
3250 checks as soon as a @code{@@selector(@dots{})} expression is found,
3251 while @option{-Wselector} only performs its checks in the final stage of
3252 compilation. This also enforces the coding style convention
3253 that methods and selectors must be declared before being used.
3254
3255 @item -print-objc-runtime-info
3256 @opindex print-objc-runtime-info
3257 Generate C header describing the largest structure that is passed by
3258 value, if any.
3259
3260 @end table
3261
3262 @node Diagnostic Message Formatting Options
3263 @section Options to Control Diagnostic Messages Formatting
3264 @cindex options to control diagnostics formatting
3265 @cindex diagnostic messages
3266 @cindex message formatting
3267
3268 Traditionally, diagnostic messages have been formatted irrespective of
3269 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3270 options described below
3271 to control the formatting algorithm for diagnostic messages,
3272 e.g.@: how many characters per line, how often source location
3273 information should be reported. Note that some language front ends may not
3274 honor these options.
3275
3276 @table @gcctabopt
3277 @item -fmessage-length=@var{n}
3278 @opindex fmessage-length
3279 Try to format error messages so that they fit on lines of about
3280 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3281 done; each error message appears on a single line. This is the
3282 default for all front ends.
3283
3284 @item -fdiagnostics-show-location=once
3285 @opindex fdiagnostics-show-location
3286 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3287 reporter to emit source location information @emph{once}; that is, in
3288 case the message is too long to fit on a single physical line and has to
3289 be wrapped, the source location won't be emitted (as prefix) again,
3290 over and over, in subsequent continuation lines. This is the default
3291 behavior.
3292
3293 @item -fdiagnostics-show-location=every-line
3294 Only meaningful in line-wrapping mode. Instructs the diagnostic
3295 messages reporter to emit the same source location information (as
3296 prefix) for physical lines that result from the process of breaking
3297 a message which is too long to fit on a single line.
3298
3299 @item -fdiagnostics-color[=@var{WHEN}]
3300 @itemx -fno-diagnostics-color
3301 @opindex fdiagnostics-color
3302 @cindex highlight, color
3303 @vindex GCC_COLORS @r{environment variable}
3304 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3305 or @samp{auto}. The default depends on how the compiler has been configured,
3306 it can be any of the above @var{WHEN} options or also @samp{never}
3307 if @env{GCC_COLORS} environment variable isn't present in the environment,
3308 and @samp{auto} otherwise.
3309 @samp{auto} means to use color only when the standard error is a terminal.
3310 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3311 aliases for @option{-fdiagnostics-color=always} and
3312 @option{-fdiagnostics-color=never}, respectively.
3313
3314 The colors are defined by the environment variable @env{GCC_COLORS}.
3315 Its value is a colon-separated list of capabilities and Select Graphic
3316 Rendition (SGR) substrings. SGR commands are interpreted by the
3317 terminal or terminal emulator. (See the section in the documentation
3318 of your text terminal for permitted values and their meanings as
3319 character attributes.) These substring values are integers in decimal
3320 representation and can be concatenated with semicolons.
3321 Common values to concatenate include
3322 @samp{1} for bold,
3323 @samp{4} for underline,
3324 @samp{5} for blink,
3325 @samp{7} for inverse,
3326 @samp{39} for default foreground color,
3327 @samp{30} to @samp{37} for foreground colors,
3328 @samp{90} to @samp{97} for 16-color mode foreground colors,
3329 @samp{38;5;0} to @samp{38;5;255}
3330 for 88-color and 256-color modes foreground colors,
3331 @samp{49} for default background color,
3332 @samp{40} to @samp{47} for background colors,
3333 @samp{100} to @samp{107} for 16-color mode background colors,
3334 and @samp{48;5;0} to @samp{48;5;255}
3335 for 88-color and 256-color modes background colors.
3336
3337 The default @env{GCC_COLORS} is
3338 @smallexample
3339 error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01
3340 @end smallexample
3341 @noindent
3342 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3343 @samp{01;36} is bold cyan, @samp{01;32} is bold green and
3344 @samp{01} is bold. Setting @env{GCC_COLORS} to the empty
3345 string disables colors.
3346 Supported capabilities are as follows.
3347
3348 @table @code
3349 @item error=
3350 @vindex error GCC_COLORS @r{capability}
3351 SGR substring for error: markers.
3352
3353 @item warning=
3354 @vindex warning GCC_COLORS @r{capability}
3355 SGR substring for warning: markers.
3356
3357 @item note=
3358 @vindex note GCC_COLORS @r{capability}
3359 SGR substring for note: markers.
3360
3361 @item caret=
3362 @vindex caret GCC_COLORS @r{capability}
3363 SGR substring for caret line.
3364
3365 @item locus=
3366 @vindex locus GCC_COLORS @r{capability}
3367 SGR substring for location information, @samp{file:line} or
3368 @samp{file:line:column} etc.
3369
3370 @item quote=
3371 @vindex quote GCC_COLORS @r{capability}
3372 SGR substring for information printed within quotes.
3373 @end table
3374
3375 @item -fno-diagnostics-show-option
3376 @opindex fno-diagnostics-show-option
3377 @opindex fdiagnostics-show-option
3378 By default, each diagnostic emitted includes text indicating the
3379 command-line option that directly controls the diagnostic (if such an
3380 option is known to the diagnostic machinery). Specifying the
3381 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3382
3383 @item -fno-diagnostics-show-caret
3384 @opindex fno-diagnostics-show-caret
3385 @opindex fdiagnostics-show-caret
3386 By default, each diagnostic emitted includes the original source line
3387 and a caret @samp{^} indicating the column. This option suppresses this
3388 information. The source line is truncated to @var{n} characters, if
3389 the @option{-fmessage-length=n} option is given. When the output is done
3390 to the terminal, the width is limited to the width given by the
3391 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3392
3393 @item -fdiagnostics-parseable-fixits
3394 @opindex fdiagnostics-parseable-fixits
3395 Emit fix-it hints in a machine-parseable format, suitable for consumption
3396 by IDEs. For each fix-it, a line will be printed after the relevant
3397 diagnostic, starting with the string ``fix-it:''. For example:
3398
3399 @smallexample
3400 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3401 @end smallexample
3402
3403 The location is expressed as a half-open range, expressed as a count of
3404 bytes, starting at byte 1 for the initial column. In the above example,
3405 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3406 given string:
3407
3408 @smallexample
3409 00000000011111111112222222222
3410 12345678901234567890123456789
3411 gtk_widget_showall (dlg);
3412 ^^^^^^^^^^^^^^^^^^
3413 gtk_widget_show_all
3414 @end smallexample
3415
3416 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3417 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3418 (e.g. vertical tab as ``\013'').
3419
3420 An empty replacement string indicates that the given range is to be removed.
3421 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3422 be inserted at the given position.
3423
3424 @end table
3425
3426 @node Warning Options
3427 @section Options to Request or Suppress Warnings
3428 @cindex options to control warnings
3429 @cindex warning messages
3430 @cindex messages, warning
3431 @cindex suppressing warnings
3432
3433 Warnings are diagnostic messages that report constructions that
3434 are not inherently erroneous but that are risky or suggest there
3435 may have been an error.
3436
3437 The following language-independent options do not enable specific
3438 warnings but control the kinds of diagnostics produced by GCC@.
3439
3440 @table @gcctabopt
3441 @cindex syntax checking
3442 @item -fsyntax-only
3443 @opindex fsyntax-only
3444 Check the code for syntax errors, but don't do anything beyond that.
3445
3446 @item -fmax-errors=@var{n}
3447 @opindex fmax-errors
3448 Limits the maximum number of error messages to @var{n}, at which point
3449 GCC bails out rather than attempting to continue processing the source
3450 code. If @var{n} is 0 (the default), there is no limit on the number
3451 of error messages produced. If @option{-Wfatal-errors} is also
3452 specified, then @option{-Wfatal-errors} takes precedence over this
3453 option.
3454
3455 @item -w
3456 @opindex w
3457 Inhibit all warning messages.
3458
3459 @item -Werror
3460 @opindex Werror
3461 @opindex Wno-error
3462 Make all warnings into errors.
3463
3464 @item -Werror=
3465 @opindex Werror=
3466 @opindex Wno-error=
3467 Make the specified warning into an error. The specifier for a warning
3468 is appended; for example @option{-Werror=switch} turns the warnings
3469 controlled by @option{-Wswitch} into errors. This switch takes a
3470 negative form, to be used to negate @option{-Werror} for specific
3471 warnings; for example @option{-Wno-error=switch} makes
3472 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3473 is in effect.
3474
3475 The warning message for each controllable warning includes the
3476 option that controls the warning. That option can then be used with
3477 @option{-Werror=} and @option{-Wno-error=} as described above.
3478 (Printing of the option in the warning message can be disabled using the
3479 @option{-fno-diagnostics-show-option} flag.)
3480
3481 Note that specifying @option{-Werror=}@var{foo} automatically implies
3482 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3483 imply anything.
3484
3485 @item -Wfatal-errors
3486 @opindex Wfatal-errors
3487 @opindex Wno-fatal-errors
3488 This option causes the compiler to abort compilation on the first error
3489 occurred rather than trying to keep going and printing further error
3490 messages.
3491
3492 @end table
3493
3494 You can request many specific warnings with options beginning with
3495 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3496 implicit declarations. Each of these specific warning options also
3497 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3498 example, @option{-Wno-implicit}. This manual lists only one of the
3499 two forms, whichever is not the default. For further
3500 language-specific options also refer to @ref{C++ Dialect Options} and
3501 @ref{Objective-C and Objective-C++ Dialect Options}.
3502
3503 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3504 options, such as @option{-Wunused}, which may turn on further options,
3505 such as @option{-Wunused-value}. The combined effect of positive and
3506 negative forms is that more specific options have priority over less
3507 specific ones, independently of their position in the command-line. For
3508 options of the same specificity, the last one takes effect. Options
3509 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3510 as if they appeared at the end of the command-line.
3511
3512 When an unrecognized warning option is requested (e.g.,
3513 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3514 that the option is not recognized. However, if the @option{-Wno-} form
3515 is used, the behavior is slightly different: no diagnostic is
3516 produced for @option{-Wno-unknown-warning} unless other diagnostics
3517 are being produced. This allows the use of new @option{-Wno-} options
3518 with old compilers, but if something goes wrong, the compiler
3519 warns that an unrecognized option is present.
3520
3521 @table @gcctabopt
3522 @item -Wpedantic
3523 @itemx -pedantic
3524 @opindex pedantic
3525 @opindex Wpedantic
3526 Issue all the warnings demanded by strict ISO C and ISO C++;
3527 reject all programs that use forbidden extensions, and some other
3528 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3529 version of the ISO C standard specified by any @option{-std} option used.
3530
3531 Valid ISO C and ISO C++ programs should compile properly with or without
3532 this option (though a rare few require @option{-ansi} or a
3533 @option{-std} option specifying the required version of ISO C)@. However,
3534 without this option, certain GNU extensions and traditional C and C++
3535 features are supported as well. With this option, they are rejected.
3536
3537 @option{-Wpedantic} does not cause warning messages for use of the
3538 alternate keywords whose names begin and end with @samp{__}. Pedantic
3539 warnings are also disabled in the expression that follows
3540 @code{__extension__}. However, only system header files should use
3541 these escape routes; application programs should avoid them.
3542 @xref{Alternate Keywords}.
3543
3544 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3545 C conformance. They soon find that it does not do quite what they want:
3546 it finds some non-ISO practices, but not all---only those for which
3547 ISO C @emph{requires} a diagnostic, and some others for which
3548 diagnostics have been added.
3549
3550 A feature to report any failure to conform to ISO C might be useful in
3551 some instances, but would require considerable additional work and would
3552 be quite different from @option{-Wpedantic}. We don't have plans to
3553 support such a feature in the near future.
3554
3555 Where the standard specified with @option{-std} represents a GNU
3556 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3557 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3558 extended dialect is based. Warnings from @option{-Wpedantic} are given
3559 where they are required by the base standard. (It does not make sense
3560 for such warnings to be given only for features not in the specified GNU
3561 C dialect, since by definition the GNU dialects of C include all
3562 features the compiler supports with the given option, and there would be
3563 nothing to warn about.)
3564
3565 @item -pedantic-errors
3566 @opindex pedantic-errors
3567 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3568 requires a diagnostic, in some cases where there is undefined behavior
3569 at compile-time and in some other cases that do not prevent compilation
3570 of programs that are valid according to the standard. This is not
3571 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3572 by this option and not enabled by the latter and vice versa.
3573
3574 @item -Wall
3575 @opindex Wall
3576 @opindex Wno-all
3577 This enables all the warnings about constructions that some users
3578 consider questionable, and that are easy to avoid (or modify to
3579 prevent the warning), even in conjunction with macros. This also
3580 enables some language-specific warnings described in @ref{C++ Dialect
3581 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3582
3583 @option{-Wall} turns on the following warning flags:
3584
3585 @gccoptlist{-Waddress @gol
3586 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3587 -Wbool-compare @gol
3588 -Wc++11-compat -Wc++14-compat@gol
3589 -Wchar-subscripts @gol
3590 -Wcomment @gol
3591 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3592 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3593 -Wformat @gol
3594 -Wimplicit @r{(C and Objective-C only)} @gol
3595 -Wimplicit-int @r{(C and Objective-C only)} @gol
3596 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3597 -Winit-self @r{(only for C++)} @gol
3598 -Wlogical-not-parentheses
3599 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3600 -Wmaybe-uninitialized @gol
3601 -Wmemset-elt-size @gol
3602 -Wmemset-transposed-args @gol
3603 -Wmisleading-indentation @r{(only for C/C++)} @gol
3604 -Wmissing-braces @r{(only for C/ObjC)} @gol
3605 -Wnarrowing @r{(only for C++)} @gol
3606 -Wnonnull @gol
3607 -Wnonnull-compare @gol
3608 -Wopenmp-simd @gol
3609 -Wparentheses @gol
3610 -Wpointer-sign @gol
3611 -Wreorder @gol
3612 -Wreturn-type @gol
3613 -Wsequence-point @gol
3614 -Wsign-compare @r{(only in C++)} @gol
3615 -Wsizeof-pointer-memaccess @gol
3616 -Wstrict-aliasing @gol
3617 -Wstrict-overflow=1 @gol
3618 -Wswitch @gol
3619 -Wtautological-compare @gol
3620 -Wtrigraphs @gol
3621 -Wuninitialized @gol
3622 -Wunknown-pragmas @gol
3623 -Wunused-function @gol
3624 -Wunused-label @gol
3625 -Wunused-value @gol
3626 -Wunused-variable @gol
3627 -Wvolatile-register-var @gol
3628 }
3629
3630 Note that some warning flags are not implied by @option{-Wall}. Some of
3631 them warn about constructions that users generally do not consider
3632 questionable, but which occasionally you might wish to check for;
3633 others warn about constructions that are necessary or hard to avoid in
3634 some cases, and there is no simple way to modify the code to suppress
3635 the warning. Some of them are enabled by @option{-Wextra} but many of
3636 them must be enabled individually.
3637
3638 @item -Wextra
3639 @opindex W
3640 @opindex Wextra
3641 @opindex Wno-extra
3642 This enables some extra warning flags that are not enabled by
3643 @option{-Wall}. (This option used to be called @option{-W}. The older
3644 name is still supported, but the newer name is more descriptive.)
3645
3646 @gccoptlist{-Wclobbered @gol
3647 -Wempty-body @gol
3648 -Wignored-qualifiers @gol
3649 -Wmissing-field-initializers @gol
3650 -Wmissing-parameter-type @r{(C only)} @gol
3651 -Wold-style-declaration @r{(C only)} @gol
3652 -Woverride-init @gol
3653 -Wsign-compare @r{(C only)} @gol
3654 -Wtype-limits @gol
3655 -Wuninitialized @gol
3656 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3657 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3658 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3659 }
3660
3661 The option @option{-Wextra} also prints warning messages for the
3662 following cases:
3663
3664 @itemize @bullet
3665
3666 @item
3667 A pointer is compared against integer zero with @code{<}, @code{<=},
3668 @code{>}, or @code{>=}.
3669
3670 @item
3671 (C++ only) An enumerator and a non-enumerator both appear in a
3672 conditional expression.
3673
3674 @item
3675 (C++ only) Ambiguous virtual bases.
3676
3677 @item
3678 (C++ only) Subscripting an array that has been declared @code{register}.
3679
3680 @item
3681 (C++ only) Taking the address of a variable that has been declared
3682 @code{register}.
3683
3684 @item
3685 (C++ only) A base class is not initialized in a derived class's copy
3686 constructor.
3687
3688 @end itemize
3689
3690 @item -Wchar-subscripts
3691 @opindex Wchar-subscripts
3692 @opindex Wno-char-subscripts
3693 Warn if an array subscript has type @code{char}. This is a common cause
3694 of error, as programmers often forget that this type is signed on some
3695 machines.
3696 This warning is enabled by @option{-Wall}.
3697
3698 @item -Wcomment
3699 @opindex Wcomment
3700 @opindex Wno-comment
3701 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3702 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3703 This warning is enabled by @option{-Wall}.
3704
3705 @item -Wno-coverage-mismatch
3706 @opindex Wno-coverage-mismatch
3707 Warn if feedback profiles do not match when using the
3708 @option{-fprofile-use} option.
3709 If a source file is changed between compiling with @option{-fprofile-gen} and
3710 with @option{-fprofile-use}, the files with the profile feedback can fail
3711 to match the source file and GCC cannot use the profile feedback
3712 information. By default, this warning is enabled and is treated as an
3713 error. @option{-Wno-coverage-mismatch} can be used to disable the
3714 warning or @option{-Wno-error=coverage-mismatch} can be used to
3715 disable the error. Disabling the error for this warning can result in
3716 poorly optimized code and is useful only in the
3717 case of very minor changes such as bug fixes to an existing code-base.
3718 Completely disabling the warning is not recommended.
3719
3720 @item -Wno-cpp
3721 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3722
3723 Suppress warning messages emitted by @code{#warning} directives.
3724
3725 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3726 @opindex Wdouble-promotion
3727 @opindex Wno-double-promotion
3728 Give a warning when a value of type @code{float} is implicitly
3729 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3730 floating-point unit implement @code{float} in hardware, but emulate
3731 @code{double} in software. On such a machine, doing computations
3732 using @code{double} values is much more expensive because of the
3733 overhead required for software emulation.
3734
3735 It is easy to accidentally do computations with @code{double} because
3736 floating-point literals are implicitly of type @code{double}. For
3737 example, in:
3738 @smallexample
3739 @group
3740 float area(float radius)
3741 @{
3742 return 3.14159 * radius * radius;
3743 @}
3744 @end group
3745 @end smallexample
3746 the compiler performs the entire computation with @code{double}
3747 because the floating-point literal is a @code{double}.
3748
3749 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
3750 @opindex Wduplicate-decl-specifier
3751 @opindex Wno-duplicate-decl-specifier
3752 Warn if a declaration has duplicate @code{const}, @code{volatile},
3753 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
3754 @option{-Wall}.
3755
3756 @item -Wformat
3757 @itemx -Wformat=@var{n}
3758 @opindex Wformat
3759 @opindex Wno-format
3760 @opindex ffreestanding
3761 @opindex fno-builtin
3762 @opindex Wformat=
3763 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3764 the arguments supplied have types appropriate to the format string
3765 specified, and that the conversions specified in the format string make
3766 sense. This includes standard functions, and others specified by format
3767 attributes (@pxref{Function Attributes}), in the @code{printf},
3768 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3769 not in the C standard) families (or other target-specific families).
3770 Which functions are checked without format attributes having been
3771 specified depends on the standard version selected, and such checks of
3772 functions without the attribute specified are disabled by
3773 @option{-ffreestanding} or @option{-fno-builtin}.
3774
3775 The formats are checked against the format features supported by GNU
3776 libc version 2.2. These include all ISO C90 and C99 features, as well
3777 as features from the Single Unix Specification and some BSD and GNU
3778 extensions. Other library implementations may not support all these
3779 features; GCC does not support warning about features that go beyond a
3780 particular library's limitations. However, if @option{-Wpedantic} is used
3781 with @option{-Wformat}, warnings are given about format features not
3782 in the selected standard version (but not for @code{strfmon} formats,
3783 since those are not in any version of the C standard). @xref{C Dialect
3784 Options,,Options Controlling C Dialect}.
3785
3786 @table @gcctabopt
3787 @item -Wformat=1
3788 @itemx -Wformat
3789 @opindex Wformat
3790 @opindex Wformat=1
3791 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3792 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3793 @option{-Wformat} also checks for null format arguments for several
3794 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3795 aspects of this level of format checking can be disabled by the
3796 options: @option{-Wno-format-contains-nul},
3797 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3798 @option{-Wformat} is enabled by @option{-Wall}.
3799
3800 @item -Wno-format-contains-nul
3801 @opindex Wno-format-contains-nul
3802 @opindex Wformat-contains-nul
3803 If @option{-Wformat} is specified, do not warn about format strings that
3804 contain NUL bytes.
3805
3806 @item -Wno-format-extra-args
3807 @opindex Wno-format-extra-args
3808 @opindex Wformat-extra-args
3809 If @option{-Wformat} is specified, do not warn about excess arguments to a
3810 @code{printf} or @code{scanf} format function. The C standard specifies
3811 that such arguments are ignored.
3812
3813 Where the unused arguments lie between used arguments that are
3814 specified with @samp{$} operand number specifications, normally
3815 warnings are still given, since the implementation could not know what
3816 type to pass to @code{va_arg} to skip the unused arguments. However,
3817 in the case of @code{scanf} formats, this option suppresses the
3818 warning if the unused arguments are all pointers, since the Single
3819 Unix Specification says that such unused arguments are allowed.
3820
3821 @item -Wno-format-zero-length
3822 @opindex Wno-format-zero-length
3823 @opindex Wformat-zero-length
3824 If @option{-Wformat} is specified, do not warn about zero-length formats.
3825 The C standard specifies that zero-length formats are allowed.
3826
3827
3828 @item -Wformat=2
3829 @opindex Wformat=2
3830 Enable @option{-Wformat} plus additional format checks. Currently
3831 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3832 -Wformat-y2k}.
3833
3834 @item -Wformat-nonliteral
3835 @opindex Wformat-nonliteral
3836 @opindex Wno-format-nonliteral
3837 If @option{-Wformat} is specified, also warn if the format string is not a
3838 string literal and so cannot be checked, unless the format function
3839 takes its format arguments as a @code{va_list}.
3840
3841 @item -Wformat-security
3842 @opindex Wformat-security
3843 @opindex Wno-format-security
3844 If @option{-Wformat} is specified, also warn about uses of format
3845 functions that represent possible security problems. At present, this
3846 warns about calls to @code{printf} and @code{scanf} functions where the
3847 format string is not a string literal and there are no format arguments,
3848 as in @code{printf (foo);}. This may be a security hole if the format
3849 string came from untrusted input and contains @samp{%n}. (This is
3850 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3851 in future warnings may be added to @option{-Wformat-security} that are not
3852 included in @option{-Wformat-nonliteral}.)
3853
3854 @item -Wformat-signedness
3855 @opindex Wformat-signedness
3856 @opindex Wno-format-signedness
3857 If @option{-Wformat} is specified, also warn if the format string
3858 requires an unsigned argument and the argument is signed and vice versa.
3859
3860 @item -Wformat-y2k
3861 @opindex Wformat-y2k
3862 @opindex Wno-format-y2k
3863 If @option{-Wformat} is specified, also warn about @code{strftime}
3864 formats that may yield only a two-digit year.
3865 @end table
3866
3867 @item -Wnonnull
3868 @opindex Wnonnull
3869 @opindex Wno-nonnull
3870 Warn about passing a null pointer for arguments marked as
3871 requiring a non-null value by the @code{nonnull} function attribute.
3872
3873 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3874 can be disabled with the @option{-Wno-nonnull} option.
3875
3876 @item -Wnonnull-compare
3877 @opindex Wnonnull-compare
3878 @opindex Wno-nonnull-compare
3879 Warn when comparing an argument marked with the @code{nonnull}
3880 function attribute against null inside the function.
3881
3882 @option{-Wnonnull-compare} is included in @option{-Wall}. It
3883 can be disabled with the @option{-Wno-nonnull-compare} option.
3884
3885 @item -Wnull-dereference
3886 @opindex Wnull-dereference
3887 @opindex Wno-null-dereference
3888 Warn if the compiler detects paths that trigger erroneous or
3889 undefined behavior due to dereferencing a null pointer. This option
3890 is only active when @option{-fdelete-null-pointer-checks} is active,
3891 which is enabled by optimizations in most targets. The precision of
3892 the warnings depends on the optimization options used.
3893
3894 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3895 @opindex Winit-self
3896 @opindex Wno-init-self
3897 Warn about uninitialized variables that are initialized with themselves.
3898 Note this option can only be used with the @option{-Wuninitialized} option.
3899
3900 For example, GCC warns about @code{i} being uninitialized in the
3901 following snippet only when @option{-Winit-self} has been specified:
3902 @smallexample
3903 @group
3904 int f()
3905 @{
3906 int i = i;
3907 return i;
3908 @}
3909 @end group
3910 @end smallexample
3911
3912 This warning is enabled by @option{-Wall} in C++.
3913
3914 @item -Wimplicit-int @r{(C and Objective-C only)}
3915 @opindex Wimplicit-int
3916 @opindex Wno-implicit-int
3917 Warn when a declaration does not specify a type.
3918 This warning is enabled by @option{-Wall}.
3919
3920 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3921 @opindex Wimplicit-function-declaration
3922 @opindex Wno-implicit-function-declaration
3923 Give a warning whenever a function is used before being declared. In
3924 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3925 enabled by default and it is made into an error by
3926 @option{-pedantic-errors}. This warning is also enabled by
3927 @option{-Wall}.
3928
3929 @item -Wimplicit @r{(C and Objective-C only)}
3930 @opindex Wimplicit
3931 @opindex Wno-implicit
3932 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3933 This warning is enabled by @option{-Wall}.
3934
3935 @item -Wignored-qualifiers @r{(C and C++ only)}
3936 @opindex Wignored-qualifiers
3937 @opindex Wno-ignored-qualifiers
3938 Warn if the return type of a function has a type qualifier
3939 such as @code{const}. For ISO C such a type qualifier has no effect,
3940 since the value returned by a function is not an lvalue.
3941 For C++, the warning is only emitted for scalar types or @code{void}.
3942 ISO C prohibits qualified @code{void} return types on function
3943 definitions, so such return types always receive a warning
3944 even without this option.
3945
3946 This warning is also enabled by @option{-Wextra}.
3947
3948 @item -Wignored-attributes @r{(C and C++ only)}
3949 @opindex Wignored-attributes
3950 @opindex Wno-ignored-attributes
3951 Warn when an attribute is ignored. This is different from the
3952 @option{-Wattributes} option in that it warns whenever the compiler decides
3953 to drop an attribute, not that the attribute is either unknown, used in a
3954 wrong place, etc. This warning is enabled by default.
3955
3956 @item -Wmain
3957 @opindex Wmain
3958 @opindex Wno-main
3959 Warn if the type of @code{main} is suspicious. @code{main} should be
3960 a function with external linkage, returning int, taking either zero
3961 arguments, two, or three arguments of appropriate types. This warning
3962 is enabled by default in C++ and is enabled by either @option{-Wall}
3963 or @option{-Wpedantic}.
3964
3965 @item -Wmisleading-indentation @r{(C and C++ only)}
3966 @opindex Wmisleading-indentation
3967 @opindex Wno-misleading-indentation
3968 Warn when the indentation of the code does not reflect the block structure.
3969 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
3970 @code{for} clauses with a guarded statement that does not use braces,
3971 followed by an unguarded statement with the same indentation.
3972
3973 In the following example, the call to ``bar'' is misleadingly indented as
3974 if it were guarded by the ``if'' conditional.
3975
3976 @smallexample
3977 if (some_condition ())
3978 foo ();
3979 bar (); /* Gotcha: this is not guarded by the "if". */
3980 @end smallexample
3981
3982 In the case of mixed tabs and spaces, the warning uses the
3983 @option{-ftabstop=} option to determine if the statements line up
3984 (defaulting to 8).
3985
3986 The warning is not issued for code involving multiline preprocessor logic
3987 such as the following example.
3988
3989 @smallexample
3990 if (flagA)
3991 foo (0);
3992 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
3993 if (flagB)
3994 #endif
3995 foo (1);
3996 @end smallexample
3997
3998 The warning is not issued after a @code{#line} directive, since this
3999 typically indicates autogenerated code, and no assumptions can be made
4000 about the layout of the file that the directive references.
4001
4002 This warning is enabled by @option{-Wall} in C and C++.
4003
4004 @item -Wmissing-braces
4005 @opindex Wmissing-braces
4006 @opindex Wno-missing-braces
4007 Warn if an aggregate or union initializer is not fully bracketed. In
4008 the following example, the initializer for @code{a} is not fully
4009 bracketed, but that for @code{b} is fully bracketed. This warning is
4010 enabled by @option{-Wall} in C.
4011
4012 @smallexample
4013 int a[2][2] = @{ 0, 1, 2, 3 @};
4014 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4015 @end smallexample
4016
4017 This warning is enabled by @option{-Wall}.
4018
4019 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4020 @opindex Wmissing-include-dirs
4021 @opindex Wno-missing-include-dirs
4022 Warn if a user-supplied include directory does not exist.
4023
4024 @item -Wparentheses
4025 @opindex Wparentheses
4026 @opindex Wno-parentheses
4027 Warn if parentheses are omitted in certain contexts, such
4028 as when there is an assignment in a context where a truth value
4029 is expected, or when operators are nested whose precedence people
4030 often get confused about.
4031
4032 Also warn if a comparison like @code{x<=y<=z} appears; this is
4033 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4034 interpretation from that of ordinary mathematical notation.
4035
4036 Also warn for dangerous uses of the GNU extension to
4037 @code{?:} with omitted middle operand. When the condition
4038 in the @code{?}: operator is a boolean expression, the omitted value is
4039 always 1. Often programmers expect it to be a value computed
4040 inside the conditional expression instead.
4041
4042 This warning is enabled by @option{-Wall}.
4043
4044 @item -Wsequence-point
4045 @opindex Wsequence-point
4046 @opindex Wno-sequence-point
4047 Warn about code that may have undefined semantics because of violations
4048 of sequence point rules in the C and C++ standards.
4049
4050 The C and C++ standards define the order in which expressions in a C/C++
4051 program are evaluated in terms of @dfn{sequence points}, which represent
4052 a partial ordering between the execution of parts of the program: those
4053 executed before the sequence point, and those executed after it. These
4054 occur after the evaluation of a full expression (one which is not part
4055 of a larger expression), after the evaluation of the first operand of a
4056 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4057 function is called (but after the evaluation of its arguments and the
4058 expression denoting the called function), and in certain other places.
4059 Other than as expressed by the sequence point rules, the order of
4060 evaluation of subexpressions of an expression is not specified. All
4061 these rules describe only a partial order rather than a total order,
4062 since, for example, if two functions are called within one expression
4063 with no sequence point between them, the order in which the functions
4064 are called is not specified. However, the standards committee have
4065 ruled that function calls do not overlap.
4066
4067 It is not specified when between sequence points modifications to the
4068 values of objects take effect. Programs whose behavior depends on this
4069 have undefined behavior; the C and C++ standards specify that ``Between
4070 the previous and next sequence point an object shall have its stored
4071 value modified at most once by the evaluation of an expression.
4072 Furthermore, the prior value shall be read only to determine the value
4073 to be stored.''. If a program breaks these rules, the results on any
4074 particular implementation are entirely unpredictable.
4075
4076 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4077 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4078 diagnosed by this option, and it may give an occasional false positive
4079 result, but in general it has been found fairly effective at detecting
4080 this sort of problem in programs.
4081
4082 The standard is worded confusingly, therefore there is some debate
4083 over the precise meaning of the sequence point rules in subtle cases.
4084 Links to discussions of the problem, including proposed formal
4085 definitions, may be found on the GCC readings page, at
4086 @uref{http://gcc.gnu.org/@/readings.html}.
4087
4088 This warning is enabled by @option{-Wall} for C and C++.
4089
4090 @item -Wno-return-local-addr
4091 @opindex Wno-return-local-addr
4092 @opindex Wreturn-local-addr
4093 Do not warn about returning a pointer (or in C++, a reference) to a
4094 variable that goes out of scope after the function returns.
4095
4096 @item -Wreturn-type
4097 @opindex Wreturn-type
4098 @opindex Wno-return-type
4099 Warn whenever a function is defined with a return type that defaults
4100 to @code{int}. Also warn about any @code{return} statement with no
4101 return value in a function whose return type is not @code{void}
4102 (falling off the end of the function body is considered returning
4103 without a value).
4104
4105 For C only, warn about a @code{return} statement with an expression in a
4106 function whose return type is @code{void}, unless the expression type is
4107 also @code{void}. As a GNU extension, the latter case is accepted
4108 without a warning unless @option{-Wpedantic} is used.
4109
4110 For C++, a function without return type always produces a diagnostic
4111 message, even when @option{-Wno-return-type} is specified. The only
4112 exceptions are @code{main} and functions defined in system headers.
4113
4114 This warning is enabled by @option{-Wall}.
4115
4116 @item -Wshift-count-negative
4117 @opindex Wshift-count-negative
4118 @opindex Wno-shift-count-negative
4119 Warn if shift count is negative. This warning is enabled by default.
4120
4121 @item -Wshift-count-overflow
4122 @opindex Wshift-count-overflow
4123 @opindex Wno-shift-count-overflow
4124 Warn if shift count >= width of type. This warning is enabled by default.
4125
4126 @item -Wshift-negative-value
4127 @opindex Wshift-negative-value
4128 @opindex Wno-shift-negative-value
4129 Warn if left shifting a negative value. This warning is enabled by
4130 @option{-Wextra} in C99 and C++11 modes (and newer).
4131
4132 @item -Wshift-overflow
4133 @itemx -Wshift-overflow=@var{n}
4134 @opindex Wshift-overflow
4135 @opindex Wno-shift-overflow
4136 Warn about left shift overflows. This warning is enabled by
4137 default in C99 and C++11 modes (and newer).
4138
4139 @table @gcctabopt
4140 @item -Wshift-overflow=1
4141 This is the warning level of @option{-Wshift-overflow} and is enabled
4142 by default in C99 and C++11 modes (and newer). This warning level does
4143 not warn about left-shifting 1 into the sign bit. (However, in C, such
4144 an overflow is still rejected in contexts where an integer constant expression
4145 is required.)
4146
4147 @item -Wshift-overflow=2
4148 This warning level also warns about left-shifting 1 into the sign bit,
4149 unless C++14 mode is active.
4150 @end table
4151
4152 @item -Wswitch
4153 @opindex Wswitch
4154 @opindex Wno-switch
4155 Warn whenever a @code{switch} statement has an index of enumerated type
4156 and lacks a @code{case} for one or more of the named codes of that
4157 enumeration. (The presence of a @code{default} label prevents this
4158 warning.) @code{case} labels outside the enumeration range also
4159 provoke warnings when this option is used (even if there is a
4160 @code{default} label).
4161 This warning is enabled by @option{-Wall}.
4162
4163 @item -Wswitch-default
4164 @opindex Wswitch-default
4165 @opindex Wno-switch-default
4166 Warn whenever a @code{switch} statement does not have a @code{default}
4167 case.
4168
4169 @item -Wswitch-enum
4170 @opindex Wswitch-enum
4171 @opindex Wno-switch-enum
4172 Warn whenever a @code{switch} statement has an index of enumerated type
4173 and lacks a @code{case} for one or more of the named codes of that
4174 enumeration. @code{case} labels outside the enumeration range also
4175 provoke warnings when this option is used. The only difference
4176 between @option{-Wswitch} and this option is that this option gives a
4177 warning about an omitted enumeration code even if there is a
4178 @code{default} label.
4179
4180 @item -Wswitch-bool
4181 @opindex Wswitch-bool
4182 @opindex Wno-switch-bool
4183 Warn whenever a @code{switch} statement has an index of boolean type
4184 and the case values are outside the range of a boolean type.
4185 It is possible to suppress this warning by casting the controlling
4186 expression to a type other than @code{bool}. For example:
4187 @smallexample
4188 @group
4189 switch ((int) (a == 4))
4190 @{
4191 @dots{}
4192 @}
4193 @end group
4194 @end smallexample
4195 This warning is enabled by default for C and C++ programs.
4196
4197 @item -Wswitch-unreachable
4198 @opindex Wswitch-unreachable
4199 @opindex Wno-switch-unreachable
4200 Warn whenever a @code{switch} statement contains statements between the
4201 controlling expression and the first case label, which will never be
4202 executed. For example:
4203 @smallexample
4204 @group
4205 switch (cond)
4206 @{
4207 i = 15;
4208 @dots{}
4209 case 5:
4210 @dots{}
4211 @}
4212 @end group
4213 @end smallexample
4214 @option{-Wswitch-unreachable} does not warn if the statement between the
4215 controlling expression and the first case label is just a declaration:
4216 @smallexample
4217 @group
4218 switch (cond)
4219 @{
4220 int i;
4221 @dots{}
4222 case 5:
4223 i = 5;
4224 @dots{}
4225 @}
4226 @end group
4227 @end smallexample
4228 This warning is enabled by default for C and C++ programs.
4229
4230 @item -Wsync-nand @r{(C and C++ only)}
4231 @opindex Wsync-nand
4232 @opindex Wno-sync-nand
4233 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4234 built-in functions are used. These functions changed semantics in GCC 4.4.
4235
4236 @item -Wtrigraphs
4237 @opindex Wtrigraphs
4238 @opindex Wno-trigraphs
4239 Warn if any trigraphs are encountered that might change the meaning of
4240 the program (trigraphs within comments are not warned about).
4241 This warning is enabled by @option{-Wall}.
4242
4243 @item -Wunused-but-set-parameter
4244 @opindex Wunused-but-set-parameter
4245 @opindex Wno-unused-but-set-parameter
4246 Warn whenever a function parameter is assigned to, but otherwise unused
4247 (aside from its declaration).
4248
4249 To suppress this warning use the @code{unused} attribute
4250 (@pxref{Variable Attributes}).
4251
4252 This warning is also enabled by @option{-Wunused} together with
4253 @option{-Wextra}.
4254
4255 @item -Wunused-but-set-variable
4256 @opindex Wunused-but-set-variable
4257 @opindex Wno-unused-but-set-variable
4258 Warn whenever a local variable is assigned to, but otherwise unused
4259 (aside from its declaration).
4260 This warning is enabled by @option{-Wall}.
4261
4262 To suppress this warning use the @code{unused} attribute
4263 (@pxref{Variable Attributes}).
4264
4265 This warning is also enabled by @option{-Wunused}, which is enabled
4266 by @option{-Wall}.
4267
4268 @item -Wunused-function
4269 @opindex Wunused-function
4270 @opindex Wno-unused-function
4271 Warn whenever a static function is declared but not defined or a
4272 non-inline static function is unused.
4273 This warning is enabled by @option{-Wall}.
4274
4275 @item -Wunused-label
4276 @opindex Wunused-label
4277 @opindex Wno-unused-label
4278 Warn whenever a label is declared but not used.
4279 This warning is enabled by @option{-Wall}.
4280
4281 To suppress this warning use the @code{unused} attribute
4282 (@pxref{Variable Attributes}).
4283
4284 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4285 @opindex Wunused-local-typedefs
4286 Warn when a typedef locally defined in a function is not used.
4287 This warning is enabled by @option{-Wall}.
4288
4289 @item -Wunused-parameter
4290 @opindex Wunused-parameter
4291 @opindex Wno-unused-parameter
4292 Warn whenever a function parameter is unused aside from its declaration.
4293
4294 To suppress this warning use the @code{unused} attribute
4295 (@pxref{Variable Attributes}).
4296
4297 @item -Wno-unused-result
4298 @opindex Wunused-result
4299 @opindex Wno-unused-result
4300 Do not warn if a caller of a function marked with attribute
4301 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4302 its return value. The default is @option{-Wunused-result}.
4303
4304 @item -Wunused-variable
4305 @opindex Wunused-variable
4306 @opindex Wno-unused-variable
4307 Warn whenever a local or static variable is unused aside from its
4308 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4309 but not for C++. This warning is enabled by @option{-Wall}.
4310
4311 To suppress this warning use the @code{unused} attribute
4312 (@pxref{Variable Attributes}).
4313
4314 @item -Wunused-const-variable
4315 @itemx -Wunused-const-variable=@var{n}
4316 @opindex Wunused-const-variable
4317 @opindex Wno-unused-const-variable
4318 Warn whenever a constant static variable is unused aside from its declaration.
4319 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4320 for C, but not for C++. In C this declares variable storage, but in C++ this
4321 is not an error since const variables take the place of @code{#define}s.
4322
4323 To suppress this warning use the @code{unused} attribute
4324 (@pxref{Variable Attributes}).
4325
4326 @table @gcctabopt
4327 @item -Wunused-const-variable=1
4328 This is the warning level that is enabled by @option{-Wunused-variable} for
4329 C. It warns only about unused static const variables defined in the main
4330 compilation unit, but not about static const variables declared in any
4331 header included.
4332
4333 @item -Wunused-const-variable=2
4334 This warning level also warns for unused constant static variables in
4335 headers (excluding system headers). This is the warning level of
4336 @option{-Wunused-const-variable} and must be explicitly requested since
4337 in C++ this isn't an error and in C it might be harder to clean up all
4338 headers included.
4339 @end table
4340
4341 @item -Wunused-value
4342 @opindex Wunused-value
4343 @opindex Wno-unused-value
4344 Warn whenever a statement computes a result that is explicitly not
4345 used. To suppress this warning cast the unused expression to
4346 @code{void}. This includes an expression-statement or the left-hand
4347 side of a comma expression that contains no side effects. For example,
4348 an expression such as @code{x[i,j]} causes a warning, while
4349 @code{x[(void)i,j]} does not.
4350
4351 This warning is enabled by @option{-Wall}.
4352
4353 @item -Wunused
4354 @opindex Wunused
4355 @opindex Wno-unused
4356 All the above @option{-Wunused} options combined.
4357
4358 In order to get a warning about an unused function parameter, you must
4359 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4360 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4361
4362 @item -Wuninitialized
4363 @opindex Wuninitialized
4364 @opindex Wno-uninitialized
4365 Warn if an automatic variable is used without first being initialized
4366 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4367 warn if a non-static reference or non-static @code{const} member
4368 appears in a class without constructors.
4369
4370 If you want to warn about code that uses the uninitialized value of the
4371 variable in its own initializer, use the @option{-Winit-self} option.
4372
4373 These warnings occur for individual uninitialized or clobbered
4374 elements of structure, union or array variables as well as for
4375 variables that are uninitialized or clobbered as a whole. They do
4376 not occur for variables or elements declared @code{volatile}. Because
4377 these warnings depend on optimization, the exact variables or elements
4378 for which there are warnings depends on the precise optimization
4379 options and version of GCC used.
4380
4381 Note that there may be no warning about a variable that is used only
4382 to compute a value that itself is never used, because such
4383 computations may be deleted by data flow analysis before the warnings
4384 are printed.
4385
4386 @item -Winvalid-memory-model
4387 @opindex Winvalid-memory-model
4388 @opindex Wno-invalid-memory-model
4389 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4390 and the C11 atomic generic functions with a memory consistency argument
4391 that is either invalid for the operation or outside the range of values
4392 of the @code{memory_order} enumeration. For example, since the
4393 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4394 defined for the relaxed, release, and sequentially consistent memory
4395 orders the following code is diagnosed:
4396
4397 @smallexample
4398 void store (int *i)
4399 @{
4400 __atomic_store_n (i, 0, memory_order_consume);
4401 @}
4402 @end smallexample
4403
4404 @option{-Winvalid-memory-model} is enabled by default.
4405
4406 @item -Wmaybe-uninitialized
4407 @opindex Wmaybe-uninitialized
4408 @opindex Wno-maybe-uninitialized
4409 For an automatic variable, if there exists a path from the function
4410 entry to a use of the variable that is initialized, but there exist
4411 some other paths for which the variable is not initialized, the compiler
4412 emits a warning if it cannot prove the uninitialized paths are not
4413 executed at run time. These warnings are made optional because GCC is
4414 not smart enough to see all the reasons why the code might be correct
4415 in spite of appearing to have an error. Here is one example of how
4416 this can happen:
4417
4418 @smallexample
4419 @group
4420 @{
4421 int x;
4422 switch (y)
4423 @{
4424 case 1: x = 1;
4425 break;
4426 case 2: x = 4;
4427 break;
4428 case 3: x = 5;
4429 @}
4430 foo (x);
4431 @}
4432 @end group
4433 @end smallexample
4434
4435 @noindent
4436 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4437 always initialized, but GCC doesn't know this. To suppress the
4438 warning, you need to provide a default case with assert(0) or
4439 similar code.
4440
4441 @cindex @code{longjmp} warnings
4442 This option also warns when a non-volatile automatic variable might be
4443 changed by a call to @code{longjmp}. These warnings as well are possible
4444 only in optimizing compilation.
4445
4446 The compiler sees only the calls to @code{setjmp}. It cannot know
4447 where @code{longjmp} will be called; in fact, a signal handler could
4448 call it at any point in the code. As a result, you may get a warning
4449 even when there is in fact no problem because @code{longjmp} cannot
4450 in fact be called at the place that would cause a problem.
4451
4452 Some spurious warnings can be avoided if you declare all the functions
4453 you use that never return as @code{noreturn}. @xref{Function
4454 Attributes}.
4455
4456 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4457
4458 @item -Wunknown-pragmas
4459 @opindex Wunknown-pragmas
4460 @opindex Wno-unknown-pragmas
4461 @cindex warning for unknown pragmas
4462 @cindex unknown pragmas, warning
4463 @cindex pragmas, warning of unknown
4464 Warn when a @code{#pragma} directive is encountered that is not understood by
4465 GCC@. If this command-line option is used, warnings are even issued
4466 for unknown pragmas in system header files. This is not the case if
4467 the warnings are only enabled by the @option{-Wall} command-line option.
4468
4469 @item -Wno-pragmas
4470 @opindex Wno-pragmas
4471 @opindex Wpragmas
4472 Do not warn about misuses of pragmas, such as incorrect parameters,
4473 invalid syntax, or conflicts between pragmas. See also
4474 @option{-Wunknown-pragmas}.
4475
4476 @item -Wstrict-aliasing
4477 @opindex Wstrict-aliasing
4478 @opindex Wno-strict-aliasing
4479 This option is only active when @option{-fstrict-aliasing} is active.
4480 It warns about code that might break the strict aliasing rules that the
4481 compiler is using for optimization. The warning does not catch all
4482 cases, but does attempt to catch the more common pitfalls. It is
4483 included in @option{-Wall}.
4484 It is equivalent to @option{-Wstrict-aliasing=3}
4485
4486 @item -Wstrict-aliasing=n
4487 @opindex Wstrict-aliasing=n
4488 This option is only active when @option{-fstrict-aliasing} is active.
4489 It warns about code that might break the strict aliasing rules that the
4490 compiler is using for optimization.
4491 Higher levels correspond to higher accuracy (fewer false positives).
4492 Higher levels also correspond to more effort, similar to the way @option{-O}
4493 works.
4494 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4495
4496 Level 1: Most aggressive, quick, least accurate.
4497 Possibly useful when higher levels
4498 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4499 false negatives. However, it has many false positives.
4500 Warns for all pointer conversions between possibly incompatible types,
4501 even if never dereferenced. Runs in the front end only.
4502
4503 Level 2: Aggressive, quick, not too precise.
4504 May still have many false positives (not as many as level 1 though),
4505 and few false negatives (but possibly more than level 1).
4506 Unlike level 1, it only warns when an address is taken. Warns about
4507 incomplete types. Runs in the front end only.
4508
4509 Level 3 (default for @option{-Wstrict-aliasing}):
4510 Should have very few false positives and few false
4511 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4512 Takes care of the common pun+dereference pattern in the front end:
4513 @code{*(int*)&some_float}.
4514 If optimization is enabled, it also runs in the back end, where it deals
4515 with multiple statement cases using flow-sensitive points-to information.
4516 Only warns when the converted pointer is dereferenced.
4517 Does not warn about incomplete types.
4518
4519 @item -Wstrict-overflow
4520 @itemx -Wstrict-overflow=@var{n}
4521 @opindex Wstrict-overflow
4522 @opindex Wno-strict-overflow
4523 This option is only active when @option{-fstrict-overflow} is active.
4524 It warns about cases where the compiler optimizes based on the
4525 assumption that signed overflow does not occur. Note that it does not
4526 warn about all cases where the code might overflow: it only warns
4527 about cases where the compiler implements some optimization. Thus
4528 this warning depends on the optimization level.
4529
4530 An optimization that assumes that signed overflow does not occur is
4531 perfectly safe if the values of the variables involved are such that
4532 overflow never does, in fact, occur. Therefore this warning can
4533 easily give a false positive: a warning about code that is not
4534 actually a problem. To help focus on important issues, several
4535 warning levels are defined. No warnings are issued for the use of
4536 undefined signed overflow when estimating how many iterations a loop
4537 requires, in particular when determining whether a loop will be
4538 executed at all.
4539
4540 @table @gcctabopt
4541 @item -Wstrict-overflow=1
4542 Warn about cases that are both questionable and easy to avoid. For
4543 example, with @option{-fstrict-overflow}, the compiler simplifies
4544 @code{x + 1 > x} to @code{1}. This level of
4545 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4546 are not, and must be explicitly requested.
4547
4548 @item -Wstrict-overflow=2
4549 Also warn about other cases where a comparison is simplified to a
4550 constant. For example: @code{abs (x) >= 0}. This can only be
4551 simplified when @option{-fstrict-overflow} is in effect, because
4552 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4553 zero. @option{-Wstrict-overflow} (with no level) is the same as
4554 @option{-Wstrict-overflow=2}.
4555
4556 @item -Wstrict-overflow=3
4557 Also warn about other cases where a comparison is simplified. For
4558 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4559
4560 @item -Wstrict-overflow=4
4561 Also warn about other simplifications not covered by the above cases.
4562 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4563
4564 @item -Wstrict-overflow=5
4565 Also warn about cases where the compiler reduces the magnitude of a
4566 constant involved in a comparison. For example: @code{x + 2 > y} is
4567 simplified to @code{x + 1 >= y}. This is reported only at the
4568 highest warning level because this simplification applies to many
4569 comparisons, so this warning level gives a very large number of
4570 false positives.
4571 @end table
4572
4573 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4574 @opindex Wsuggest-attribute=
4575 @opindex Wno-suggest-attribute=
4576 Warn for cases where adding an attribute may be beneficial. The
4577 attributes currently supported are listed below.
4578
4579 @table @gcctabopt
4580 @item -Wsuggest-attribute=pure
4581 @itemx -Wsuggest-attribute=const
4582 @itemx -Wsuggest-attribute=noreturn
4583 @opindex Wsuggest-attribute=pure
4584 @opindex Wno-suggest-attribute=pure
4585 @opindex Wsuggest-attribute=const
4586 @opindex Wno-suggest-attribute=const
4587 @opindex Wsuggest-attribute=noreturn
4588 @opindex Wno-suggest-attribute=noreturn
4589
4590 Warn about functions that might be candidates for attributes
4591 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4592 functions visible in other compilation units or (in the case of @code{pure} and
4593 @code{const}) if it cannot prove that the function returns normally. A function
4594 returns normally if it doesn't contain an infinite loop or return abnormally
4595 by throwing, calling @code{abort} or trapping. This analysis requires option
4596 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4597 higher. Higher optimization levels improve the accuracy of the analysis.
4598
4599 @item -Wsuggest-attribute=format
4600 @itemx -Wmissing-format-attribute
4601 @opindex Wsuggest-attribute=format
4602 @opindex Wmissing-format-attribute
4603 @opindex Wno-suggest-attribute=format
4604 @opindex Wno-missing-format-attribute
4605 @opindex Wformat
4606 @opindex Wno-format
4607
4608 Warn about function pointers that might be candidates for @code{format}
4609 attributes. Note these are only possible candidates, not absolute ones.
4610 GCC guesses that function pointers with @code{format} attributes that
4611 are used in assignment, initialization, parameter passing or return
4612 statements should have a corresponding @code{format} attribute in the
4613 resulting type. I.e.@: the left-hand side of the assignment or
4614 initialization, the type of the parameter variable, or the return type
4615 of the containing function respectively should also have a @code{format}
4616 attribute to avoid the warning.
4617
4618 GCC also warns about function definitions that might be
4619 candidates for @code{format} attributes. Again, these are only
4620 possible candidates. GCC guesses that @code{format} attributes
4621 might be appropriate for any function that calls a function like
4622 @code{vprintf} or @code{vscanf}, but this might not always be the
4623 case, and some functions for which @code{format} attributes are
4624 appropriate may not be detected.
4625 @end table
4626
4627 @item -Wsuggest-final-types
4628 @opindex Wno-suggest-final-types
4629 @opindex Wsuggest-final-types
4630 Warn about types with virtual methods where code quality would be improved
4631 if the type were declared with the C++11 @code{final} specifier,
4632 or, if possible,
4633 declared in an anonymous namespace. This allows GCC to more aggressively
4634 devirtualize the polymorphic calls. This warning is more effective with link
4635 time optimization, where the information about the class hierarchy graph is
4636 more complete.
4637
4638 @item -Wsuggest-final-methods
4639 @opindex Wno-suggest-final-methods
4640 @opindex Wsuggest-final-methods
4641 Warn about virtual methods where code quality would be improved if the method
4642 were declared with the C++11 @code{final} specifier,
4643 or, if possible, its type were
4644 declared in an anonymous namespace or with the @code{final} specifier.
4645 This warning is
4646 more effective with link time optimization, where the information about the
4647 class hierarchy graph is more complete. It is recommended to first consider
4648 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4649 annotations.
4650
4651 @item -Wsuggest-override
4652 Warn about overriding virtual functions that are not marked with the override
4653 keyword.
4654
4655 @item -Warray-bounds
4656 @itemx -Warray-bounds=@var{n}
4657 @opindex Wno-array-bounds
4658 @opindex Warray-bounds
4659 This option is only active when @option{-ftree-vrp} is active
4660 (default for @option{-O2} and above). It warns about subscripts to arrays
4661 that are always out of bounds. This warning is enabled by @option{-Wall}.
4662
4663 @table @gcctabopt
4664 @item -Warray-bounds=1
4665 This is the warning level of @option{-Warray-bounds} and is enabled
4666 by @option{-Wall}; higher levels are not, and must be explicitly requested.
4667
4668 @item -Warray-bounds=2
4669 This warning level also warns about out of bounds access for
4670 arrays at the end of a struct and for arrays accessed through
4671 pointers. This warning level may give a larger number of
4672 false positives and is deactivated by default.
4673 @end table
4674
4675 @item -Wbool-compare
4676 @opindex Wno-bool-compare
4677 @opindex Wbool-compare
4678 Warn about boolean expression compared with an integer value different from
4679 @code{true}/@code{false}. For instance, the following comparison is
4680 always false:
4681 @smallexample
4682 int n = 5;
4683 @dots{}
4684 if ((n > 1) == 2) @{ @dots{} @}
4685 @end smallexample
4686 This warning is enabled by @option{-Wall}.
4687
4688 @item -Wduplicated-cond
4689 @opindex Wno-duplicated-cond
4690 @opindex Wduplicated-cond
4691 Warn about duplicated conditions in an if-else-if chain. For instance,
4692 warn for the following code:
4693 @smallexample
4694 if (p->q != NULL) @{ @dots{} @}
4695 else if (p->q != NULL) @{ @dots{} @}
4696 @end smallexample
4697
4698 @item -Wframe-address
4699 @opindex Wno-frame-address
4700 @opindex Wframe-address
4701 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
4702 is called with an argument greater than 0. Such calls may return indeterminate
4703 values or crash the program. The warning is included in @option{-Wall}.
4704
4705 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
4706 @opindex Wno-discarded-qualifiers
4707 @opindex Wdiscarded-qualifiers
4708 Do not warn if type qualifiers on pointers are being discarded.
4709 Typically, the compiler warns if a @code{const char *} variable is
4710 passed to a function that takes a @code{char *} parameter. This option
4711 can be used to suppress such a warning.
4712
4713 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
4714 @opindex Wno-discarded-array-qualifiers
4715 @opindex Wdiscarded-array-qualifiers
4716 Do not warn if type qualifiers on arrays which are pointer targets
4717 are being discarded. Typically, the compiler warns if a
4718 @code{const int (*)[]} variable is passed to a function that
4719 takes a @code{int (*)[]} parameter. This option can be used to
4720 suppress such a warning.
4721
4722 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
4723 @opindex Wno-incompatible-pointer-types
4724 @opindex Wincompatible-pointer-types
4725 Do not warn when there is a conversion between pointers that have incompatible
4726 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
4727 which warns for pointer argument passing or assignment with different
4728 signedness.
4729
4730 @item -Wno-int-conversion @r{(C and Objective-C only)}
4731 @opindex Wno-int-conversion
4732 @opindex Wint-conversion
4733 Do not warn about incompatible integer to pointer and pointer to integer
4734 conversions. This warning is about implicit conversions; for explicit
4735 conversions the warnings @option{-Wno-int-to-pointer-cast} and
4736 @option{-Wno-pointer-to-int-cast} may be used.
4737
4738 @item -Wno-div-by-zero
4739 @opindex Wno-div-by-zero
4740 @opindex Wdiv-by-zero
4741 Do not warn about compile-time integer division by zero. Floating-point
4742 division by zero is not warned about, as it can be a legitimate way of
4743 obtaining infinities and NaNs.
4744
4745 @item -Wsystem-headers
4746 @opindex Wsystem-headers
4747 @opindex Wno-system-headers
4748 @cindex warnings from system headers
4749 @cindex system headers, warnings from
4750 Print warning messages for constructs found in system header files.
4751 Warnings from system headers are normally suppressed, on the assumption
4752 that they usually do not indicate real problems and would only make the
4753 compiler output harder to read. Using this command-line option tells
4754 GCC to emit warnings from system headers as if they occurred in user
4755 code. However, note that using @option{-Wall} in conjunction with this
4756 option does @emph{not} warn about unknown pragmas in system
4757 headers---for that, @option{-Wunknown-pragmas} must also be used.
4758
4759 @item -Wtautological-compare
4760 @opindex Wtautological-compare
4761 @opindex Wno-tautological-compare
4762 Warn if a self-comparison always evaluates to true or false. This
4763 warning detects various mistakes such as:
4764 @smallexample
4765 int i = 1;
4766 @dots{}
4767 if (i > i) @{ @dots{} @}
4768 @end smallexample
4769 This warning is enabled by @option{-Wall}.
4770
4771 @item -Wtrampolines
4772 @opindex Wtrampolines
4773 @opindex Wno-trampolines
4774 Warn about trampolines generated for pointers to nested functions.
4775 A trampoline is a small piece of data or code that is created at run
4776 time on the stack when the address of a nested function is taken, and is
4777 used to call the nested function indirectly. For some targets, it is
4778 made up of data only and thus requires no special treatment. But, for
4779 most targets, it is made up of code and thus requires the stack to be
4780 made executable in order for the program to work properly.
4781
4782 @item -Wfloat-equal
4783 @opindex Wfloat-equal
4784 @opindex Wno-float-equal
4785 Warn if floating-point values are used in equality comparisons.
4786
4787 The idea behind this is that sometimes it is convenient (for the
4788 programmer) to consider floating-point values as approximations to
4789 infinitely precise real numbers. If you are doing this, then you need
4790 to compute (by analyzing the code, or in some other way) the maximum or
4791 likely maximum error that the computation introduces, and allow for it
4792 when performing comparisons (and when producing output, but that's a
4793 different problem). In particular, instead of testing for equality, you
4794 should check to see whether the two values have ranges that overlap; and
4795 this is done with the relational operators, so equality comparisons are
4796 probably mistaken.
4797
4798 @item -Wtraditional @r{(C and Objective-C only)}
4799 @opindex Wtraditional
4800 @opindex Wno-traditional
4801 Warn about certain constructs that behave differently in traditional and
4802 ISO C@. Also warn about ISO C constructs that have no traditional C
4803 equivalent, and/or problematic constructs that should be avoided.
4804
4805 @itemize @bullet
4806 @item
4807 Macro parameters that appear within string literals in the macro body.
4808 In traditional C macro replacement takes place within string literals,
4809 but in ISO C it does not.
4810
4811 @item
4812 In traditional C, some preprocessor directives did not exist.
4813 Traditional preprocessors only considered a line to be a directive
4814 if the @samp{#} appeared in column 1 on the line. Therefore
4815 @option{-Wtraditional} warns about directives that traditional C
4816 understands but ignores because the @samp{#} does not appear as the
4817 first character on the line. It also suggests you hide directives like
4818 @code{#pragma} not understood by traditional C by indenting them. Some
4819 traditional implementations do not recognize @code{#elif}, so this option
4820 suggests avoiding it altogether.
4821
4822 @item
4823 A function-like macro that appears without arguments.
4824
4825 @item
4826 The unary plus operator.
4827
4828 @item
4829 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4830 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
4831 constants.) Note, these suffixes appear in macros defined in the system
4832 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4833 Use of these macros in user code might normally lead to spurious
4834 warnings, however GCC's integrated preprocessor has enough context to
4835 avoid warning in these cases.
4836
4837 @item
4838 A function declared external in one block and then used after the end of
4839 the block.
4840
4841 @item
4842 A @code{switch} statement has an operand of type @code{long}.
4843
4844 @item
4845 A non-@code{static} function declaration follows a @code{static} one.
4846 This construct is not accepted by some traditional C compilers.
4847
4848 @item
4849 The ISO type of an integer constant has a different width or
4850 signedness from its traditional type. This warning is only issued if
4851 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
4852 typically represent bit patterns, are not warned about.
4853
4854 @item
4855 Usage of ISO string concatenation is detected.
4856
4857 @item
4858 Initialization of automatic aggregates.
4859
4860 @item
4861 Identifier conflicts with labels. Traditional C lacks a separate
4862 namespace for labels.
4863
4864 @item
4865 Initialization of unions. If the initializer is zero, the warning is
4866 omitted. This is done under the assumption that the zero initializer in
4867 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4868 initializer warnings and relies on default initialization to zero in the
4869 traditional C case.
4870
4871 @item
4872 Conversions by prototypes between fixed/floating-point values and vice
4873 versa. The absence of these prototypes when compiling with traditional
4874 C causes serious problems. This is a subset of the possible
4875 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4876
4877 @item
4878 Use of ISO C style function definitions. This warning intentionally is
4879 @emph{not} issued for prototype declarations or variadic functions
4880 because these ISO C features appear in your code when using
4881 libiberty's traditional C compatibility macros, @code{PARAMS} and
4882 @code{VPARAMS}. This warning is also bypassed for nested functions
4883 because that feature is already a GCC extension and thus not relevant to
4884 traditional C compatibility.
4885 @end itemize
4886
4887 @item -Wtraditional-conversion @r{(C and Objective-C only)}
4888 @opindex Wtraditional-conversion
4889 @opindex Wno-traditional-conversion
4890 Warn if a prototype causes a type conversion that is different from what
4891 would happen to the same argument in the absence of a prototype. This
4892 includes conversions of fixed point to floating and vice versa, and
4893 conversions changing the width or signedness of a fixed-point argument
4894 except when the same as the default promotion.
4895
4896 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4897 @opindex Wdeclaration-after-statement
4898 @opindex Wno-declaration-after-statement
4899 Warn when a declaration is found after a statement in a block. This
4900 construct, known from C++, was introduced with ISO C99 and is by default
4901 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
4902
4903 @item -Wundef
4904 @opindex Wundef
4905 @opindex Wno-undef
4906 Warn if an undefined identifier is evaluated in an @code{#if} directive.
4907
4908 @item -Wno-endif-labels
4909 @opindex Wno-endif-labels
4910 @opindex Wendif-labels
4911 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
4912
4913 @item -Wshadow
4914 @opindex Wshadow
4915 @opindex Wno-shadow
4916 Warn whenever a local variable or type declaration shadows another
4917 variable, parameter, type, class member (in C++), or instance variable
4918 (in Objective-C) or whenever a built-in function is shadowed. Note
4919 that in C++, the compiler warns if a local variable shadows an
4920 explicit typedef, but not if it shadows a struct/class/enum.
4921
4922 @item -Wno-shadow-ivar @r{(Objective-C only)}
4923 @opindex Wno-shadow-ivar
4924 @opindex Wshadow-ivar
4925 Do not warn whenever a local variable shadows an instance variable in an
4926 Objective-C method.
4927
4928 @item -Wlarger-than=@var{len}
4929 @opindex Wlarger-than=@var{len}
4930 @opindex Wlarger-than-@var{len}
4931 Warn whenever an object of larger than @var{len} bytes is defined.
4932
4933 @item -Wframe-larger-than=@var{len}
4934 @opindex Wframe-larger-than
4935 Warn if the size of a function frame is larger than @var{len} bytes.
4936 The computation done to determine the stack frame size is approximate
4937 and not conservative.
4938 The actual requirements may be somewhat greater than @var{len}
4939 even if you do not get a warning. In addition, any space allocated
4940 via @code{alloca}, variable-length arrays, or related constructs
4941 is not included by the compiler when determining
4942 whether or not to issue a warning.
4943
4944 @item -Wno-free-nonheap-object
4945 @opindex Wno-free-nonheap-object
4946 @opindex Wfree-nonheap-object
4947 Do not warn when attempting to free an object that was not allocated
4948 on the heap.
4949
4950 @item -Wstack-usage=@var{len}
4951 @opindex Wstack-usage
4952 Warn if the stack usage of a function might be larger than @var{len} bytes.
4953 The computation done to determine the stack usage is conservative.
4954 Any space allocated via @code{alloca}, variable-length arrays, or related
4955 constructs is included by the compiler when determining whether or not to
4956 issue a warning.
4957
4958 The message is in keeping with the output of @option{-fstack-usage}.
4959
4960 @itemize
4961 @item
4962 If the stack usage is fully static but exceeds the specified amount, it's:
4963
4964 @smallexample
4965 warning: stack usage is 1120 bytes
4966 @end smallexample
4967 @item
4968 If the stack usage is (partly) dynamic but bounded, it's:
4969
4970 @smallexample
4971 warning: stack usage might be 1648 bytes
4972 @end smallexample
4973 @item
4974 If the stack usage is (partly) dynamic and not bounded, it's:
4975
4976 @smallexample
4977 warning: stack usage might be unbounded
4978 @end smallexample
4979 @end itemize
4980
4981 @item -Wunsafe-loop-optimizations
4982 @opindex Wunsafe-loop-optimizations
4983 @opindex Wno-unsafe-loop-optimizations
4984 Warn if the loop cannot be optimized because the compiler cannot
4985 assume anything on the bounds of the loop indices. With
4986 @option{-funsafe-loop-optimizations} warn if the compiler makes
4987 such assumptions.
4988
4989 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
4990 @opindex Wno-pedantic-ms-format
4991 @opindex Wpedantic-ms-format
4992 When used in combination with @option{-Wformat}
4993 and @option{-pedantic} without GNU extensions, this option
4994 disables the warnings about non-ISO @code{printf} / @code{scanf} format
4995 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
4996 which depend on the MS runtime.
4997
4998 @item -Wplacement-new
4999 @itemx -Wplacement-new=@var{n}
5000 @opindex Wplacement-new
5001 @opindex Wno-placement-new
5002 Warn about placement new expressions with undefined behavior, such as
5003 constructing an object in a buffer that is smaller than the type of
5004 the object. For example, the placement new expression below is diagnosed
5005 because it attempts to construct an array of 64 integers in a buffer only
5006 64 bytes large.
5007 @smallexample
5008 char buf [64];
5009 new (buf) int[64];
5010 @end smallexample
5011 This warning is enabled by default.
5012
5013 @table @gcctabopt
5014 @item -Wplacement-new=1
5015 This is the default warning level of @option{-Wplacement-new}. At this
5016 level the warning is not issued for some strictly undefined constructs that
5017 GCC allows as extensions for compatibility with legacy code. For example,
5018 the following @code{new} expression is not diagnosed at this level even
5019 though it has undefined behavior according to the C++ standard because
5020 it writes past the end of the one-element array.
5021 @smallexample
5022 struct S @{ int n, a[1]; @};
5023 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5024 new (s->a)int [32]();
5025 @end smallexample
5026
5027 @item -Wplacement-new=2
5028 At this level, in addition to diagnosing all the same constructs as at level
5029 1, a diagnostic is also issued for placement new expressions that construct
5030 an object in the last member of structure whose type is an array of a single
5031 element and whose size is less than the size of the object being constructed.
5032 While the previous example would be diagnosed, the following construct makes
5033 use of the flexible member array extension to avoid the warning at level 2.
5034 @smallexample
5035 struct S @{ int n, a[]; @};
5036 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5037 new (s->a)int [32]();
5038 @end smallexample
5039
5040 @end table
5041
5042 @item -Wpointer-arith
5043 @opindex Wpointer-arith
5044 @opindex Wno-pointer-arith
5045 Warn about anything that depends on the ``size of'' a function type or
5046 of @code{void}. GNU C assigns these types a size of 1, for
5047 convenience in calculations with @code{void *} pointers and pointers
5048 to functions. In C++, warn also when an arithmetic operation involves
5049 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
5050
5051 @item -Wtype-limits
5052 @opindex Wtype-limits
5053 @opindex Wno-type-limits
5054 Warn if a comparison is always true or always false due to the limited
5055 range of the data type, but do not warn for constant expressions. For
5056 example, warn if an unsigned variable is compared against zero with
5057 @code{<} or @code{>=}. This warning is also enabled by
5058 @option{-Wextra}.
5059
5060 @item -Wbad-function-cast @r{(C and Objective-C only)}
5061 @opindex Wbad-function-cast
5062 @opindex Wno-bad-function-cast
5063 Warn when a function call is cast to a non-matching type.
5064 For example, warn if a call to a function returning an integer type
5065 is cast to a pointer type.
5066
5067 @item -Wc90-c99-compat @r{(C and Objective-C only)}
5068 @opindex Wc90-c99-compat
5069 @opindex Wno-c90-c99-compat
5070 Warn about features not present in ISO C90, but present in ISO C99.
5071 For instance, warn about use of variable length arrays, @code{long long}
5072 type, @code{bool} type, compound literals, designated initializers, and so
5073 on. This option is independent of the standards mode. Warnings are disabled
5074 in the expression that follows @code{__extension__}.
5075
5076 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5077 @opindex Wc99-c11-compat
5078 @opindex Wno-c99-c11-compat
5079 Warn about features not present in ISO C99, but present in ISO C11.
5080 For instance, warn about use of anonymous structures and unions,
5081 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5082 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5083 and so on. This option is independent of the standards mode. Warnings are
5084 disabled in the expression that follows @code{__extension__}.
5085
5086 @item -Wc++-compat @r{(C and Objective-C only)}
5087 @opindex Wc++-compat
5088 Warn about ISO C constructs that are outside of the common subset of
5089 ISO C and ISO C++, e.g.@: request for implicit conversion from
5090 @code{void *} to a pointer to non-@code{void} type.
5091
5092 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5093 @opindex Wc++11-compat
5094 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5095 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5096 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5097 enabled by @option{-Wall}.
5098
5099 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5100 @opindex Wc++14-compat
5101 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5102 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5103
5104 @item -Wcast-qual
5105 @opindex Wcast-qual
5106 @opindex Wno-cast-qual
5107 Warn whenever a pointer is cast so as to remove a type qualifier from
5108 the target type. For example, warn if a @code{const char *} is cast
5109 to an ordinary @code{char *}.
5110
5111 Also warn when making a cast that introduces a type qualifier in an
5112 unsafe way. For example, casting @code{char **} to @code{const char **}
5113 is unsafe, as in this example:
5114
5115 @smallexample
5116 /* p is char ** value. */
5117 const char **q = (const char **) p;
5118 /* Assignment of readonly string to const char * is OK. */
5119 *q = "string";
5120 /* Now char** pointer points to read-only memory. */
5121 **p = 'b';
5122 @end smallexample
5123
5124 @item -Wcast-align
5125 @opindex Wcast-align
5126 @opindex Wno-cast-align
5127 Warn whenever a pointer is cast such that the required alignment of the
5128 target is increased. For example, warn if a @code{char *} is cast to
5129 an @code{int *} on machines where integers can only be accessed at
5130 two- or four-byte boundaries.
5131
5132 @item -Wwrite-strings
5133 @opindex Wwrite-strings
5134 @opindex Wno-write-strings
5135 When compiling C, give string constants the type @code{const
5136 char[@var{length}]} so that copying the address of one into a
5137 non-@code{const} @code{char *} pointer produces a warning. These
5138 warnings help you find at compile time code that can try to write
5139 into a string constant, but only if you have been very careful about
5140 using @code{const} in declarations and prototypes. Otherwise, it is
5141 just a nuisance. This is why we did not make @option{-Wall} request
5142 these warnings.
5143
5144 When compiling C++, warn about the deprecated conversion from string
5145 literals to @code{char *}. This warning is enabled by default for C++
5146 programs.
5147
5148 @item -Wclobbered
5149 @opindex Wclobbered
5150 @opindex Wno-clobbered
5151 Warn for variables that might be changed by @code{longjmp} or
5152 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5153
5154 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5155 @opindex Wconditionally-supported
5156 @opindex Wno-conditionally-supported
5157 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5158
5159 @item -Wconversion
5160 @opindex Wconversion
5161 @opindex Wno-conversion
5162 Warn for implicit conversions that may alter a value. This includes
5163 conversions between real and integer, like @code{abs (x)} when
5164 @code{x} is @code{double}; conversions between signed and unsigned,
5165 like @code{unsigned ui = -1}; and conversions to smaller types, like
5166 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5167 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5168 changed by the conversion like in @code{abs (2.0)}. Warnings about
5169 conversions between signed and unsigned integers can be disabled by
5170 using @option{-Wno-sign-conversion}.
5171
5172 For C++, also warn for confusing overload resolution for user-defined
5173 conversions; and conversions that never use a type conversion
5174 operator: conversions to @code{void}, the same type, a base class or a
5175 reference to them. Warnings about conversions between signed and
5176 unsigned integers are disabled by default in C++ unless
5177 @option{-Wsign-conversion} is explicitly enabled.
5178
5179 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5180 @opindex Wconversion-null
5181 @opindex Wno-conversion-null
5182 Do not warn for conversions between @code{NULL} and non-pointer
5183 types. @option{-Wconversion-null} is enabled by default.
5184
5185 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5186 @opindex Wzero-as-null-pointer-constant
5187 @opindex Wno-zero-as-null-pointer-constant
5188 Warn when a literal @samp{0} is used as null pointer constant. This can
5189 be useful to facilitate the conversion to @code{nullptr} in C++11.
5190
5191 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5192 @opindex Wsubobject-linkage
5193 @opindex Wno-subobject-linkage
5194 Warn if a class type has a base or a field whose type uses the anonymous
5195 namespace or depends on a type with no linkage. If a type A depends on
5196 a type B with no or internal linkage, defining it in multiple
5197 translation units would be an ODR violation because the meaning of B
5198 is different in each translation unit. If A only appears in a single
5199 translation unit, the best way to silence the warning is to give it
5200 internal linkage by putting it in an anonymous namespace as well. The
5201 compiler doesn't give this warning for types defined in the main .C
5202 file, as those are unlikely to have multiple definitions.
5203 @option{-Wsubobject-linkage} is enabled by default.
5204
5205 @item -Wdangling-else
5206 @opindex Wdangling-else
5207 @opindex Wno-dangling-else
5208 Warn about constructions where there may be confusion to which
5209 @code{if} statement an @code{else} branch belongs. Here is an example of
5210 such a case:
5211
5212 @smallexample
5213 @group
5214 @{
5215 if (a)
5216 if (b)
5217 foo ();
5218 else
5219 bar ();
5220 @}
5221 @end group
5222 @end smallexample
5223
5224 In C/C++, every @code{else} branch belongs to the innermost possible
5225 @code{if} statement, which in this example is @code{if (b)}. This is
5226 often not what the programmer expected, as illustrated in the above
5227 example by indentation the programmer chose. When there is the
5228 potential for this confusion, GCC issues a warning when this flag
5229 is specified. To eliminate the warning, add explicit braces around
5230 the innermost @code{if} statement so there is no way the @code{else}
5231 can belong to the enclosing @code{if}. The resulting code
5232 looks like this:
5233
5234 @smallexample
5235 @group
5236 @{
5237 if (a)
5238 @{
5239 if (b)
5240 foo ();
5241 else
5242 bar ();
5243 @}
5244 @}
5245 @end group
5246 @end smallexample
5247
5248 This warning is enabled by @option{-Wparentheses}.
5249
5250 @item -Wdate-time
5251 @opindex Wdate-time
5252 @opindex Wno-date-time
5253 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5254 are encountered as they might prevent bit-wise-identical reproducible
5255 compilations.
5256
5257 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5258 @opindex Wdelete-incomplete
5259 @opindex Wno-delete-incomplete
5260 Warn when deleting a pointer to incomplete type, which may cause
5261 undefined behavior at runtime. This warning is enabled by default.
5262
5263 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5264 @opindex Wuseless-cast
5265 @opindex Wno-useless-cast
5266 Warn when an expression is casted to its own type.
5267
5268 @item -Wempty-body
5269 @opindex Wempty-body
5270 @opindex Wno-empty-body
5271 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5272 while} statement. This warning is also enabled by @option{-Wextra}.
5273
5274 @item -Wenum-compare
5275 @opindex Wenum-compare
5276 @opindex Wno-enum-compare
5277 Warn about a comparison between values of different enumerated types.
5278 In C++ enumeral mismatches in conditional expressions are also
5279 diagnosed and the warning is enabled by default. In C this warning is
5280 enabled by @option{-Wall}.
5281
5282 @item -Wjump-misses-init @r{(C, Objective-C only)}
5283 @opindex Wjump-misses-init
5284 @opindex Wno-jump-misses-init
5285 Warn if a @code{goto} statement or a @code{switch} statement jumps
5286 forward across the initialization of a variable, or jumps backward to a
5287 label after the variable has been initialized. This only warns about
5288 variables that are initialized when they are declared. This warning is
5289 only supported for C and Objective-C; in C++ this sort of branch is an
5290 error in any case.
5291
5292 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5293 can be disabled with the @option{-Wno-jump-misses-init} option.
5294
5295 @item -Wsign-compare
5296 @opindex Wsign-compare
5297 @opindex Wno-sign-compare
5298 @cindex warning for comparison of signed and unsigned values
5299 @cindex comparison of signed and unsigned values, warning
5300 @cindex signed and unsigned values, comparison warning
5301 Warn when a comparison between signed and unsigned values could produce
5302 an incorrect result when the signed value is converted to unsigned.
5303 In C++, this warning is also enabled by @option{-Wall}. In C, it is
5304 also enabled by @option{-Wextra}.
5305
5306 @item -Wsign-conversion
5307 @opindex Wsign-conversion
5308 @opindex Wno-sign-conversion
5309 Warn for implicit conversions that may change the sign of an integer
5310 value, like assigning a signed integer expression to an unsigned
5311 integer variable. An explicit cast silences the warning. In C, this
5312 option is enabled also by @option{-Wconversion}.
5313
5314 @item -Wfloat-conversion
5315 @opindex Wfloat-conversion
5316 @opindex Wno-float-conversion
5317 Warn for implicit conversions that reduce the precision of a real value.
5318 This includes conversions from real to integer, and from higher precision
5319 real to lower precision real values. This option is also enabled by
5320 @option{-Wconversion}.
5321
5322 @item -Wno-scalar-storage-order
5323 @opindex -Wno-scalar-storage-order
5324 @opindex -Wscalar-storage-order
5325 Do not warn on suspicious constructs involving reverse scalar storage order.
5326
5327 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
5328 @opindex Wsized-deallocation
5329 @opindex Wno-sized-deallocation
5330 Warn about a definition of an unsized deallocation function
5331 @smallexample
5332 void operator delete (void *) noexcept;
5333 void operator delete[] (void *) noexcept;
5334 @end smallexample
5335 without a definition of the corresponding sized deallocation function
5336 @smallexample
5337 void operator delete (void *, std::size_t) noexcept;
5338 void operator delete[] (void *, std::size_t) noexcept;
5339 @end smallexample
5340 or vice versa. Enabled by @option{-Wextra} along with
5341 @option{-fsized-deallocation}.
5342
5343 @item -Wsizeof-pointer-memaccess
5344 @opindex Wsizeof-pointer-memaccess
5345 @opindex Wno-sizeof-pointer-memaccess
5346 Warn for suspicious length parameters to certain string and memory built-in
5347 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
5348 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
5349 but a pointer, and suggests a possible fix, or about
5350 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
5351 @option{-Wall}.
5352
5353 @item -Wsizeof-array-argument
5354 @opindex Wsizeof-array-argument
5355 @opindex Wno-sizeof-array-argument
5356 Warn when the @code{sizeof} operator is applied to a parameter that is
5357 declared as an array in a function definition. This warning is enabled by
5358 default for C and C++ programs.
5359
5360 @item -Wmemset-elt-size
5361 @opindex Wmemset-elt-size
5362 @opindex Wno-memset-elt-size
5363 Warn for suspicious calls to the @code{memset} built-in function, if the
5364 first argument references an array, and the third argument is a number
5365 equal to the number of elements, but not equal to the size of the array
5366 in memory. This indicates that the user has omitted a multiplication by
5367 the element size. This warning is enabled by @option{-Wall}.
5368
5369 @item -Wmemset-transposed-args
5370 @opindex Wmemset-transposed-args
5371 @opindex Wno-memset-transposed-args
5372 Warn for suspicious calls to the @code{memset} built-in function, if the
5373 second argument is not zero and the third argument is zero. This warns e.g.@
5374 about @code{memset (buf, sizeof buf, 0)} where most probably
5375 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
5376 is only emitted if the third argument is literal zero. If it is some
5377 expression that is folded to zero, a cast of zero to some type, etc.,
5378 it is far less likely that the user has mistakenly exchanged the arguments
5379 and no warning is emitted. This warning is enabled by @option{-Wall}.
5380
5381 @item -Waddress
5382 @opindex Waddress
5383 @opindex Wno-address
5384 Warn about suspicious uses of memory addresses. These include using
5385 the address of a function in a conditional expression, such as
5386 @code{void func(void); if (func)}, and comparisons against the memory
5387 address of a string literal, such as @code{if (x == "abc")}. Such
5388 uses typically indicate a programmer error: the address of a function
5389 always evaluates to true, so their use in a conditional usually
5390 indicate that the programmer forgot the parentheses in a function
5391 call; and comparisons against string literals result in unspecified
5392 behavior and are not portable in C, so they usually indicate that the
5393 programmer intended to use @code{strcmp}. This warning is enabled by
5394 @option{-Wall}.
5395
5396 @item -Wlogical-op
5397 @opindex Wlogical-op
5398 @opindex Wno-logical-op
5399 Warn about suspicious uses of logical operators in expressions.
5400 This includes using logical operators in contexts where a
5401 bit-wise operator is likely to be expected. Also warns when
5402 the operands of a logical operator are the same:
5403 @smallexample
5404 extern int a;
5405 if (a < 0 && a < 0) @{ @dots{} @}
5406 @end smallexample
5407
5408 @item -Wlogical-not-parentheses
5409 @opindex Wlogical-not-parentheses
5410 @opindex Wno-logical-not-parentheses
5411 Warn about logical not used on the left hand side operand of a comparison.
5412 This option does not warn if the RHS operand is of a boolean type. Its
5413 purpose is to detect suspicious code like the following:
5414 @smallexample
5415 int a;
5416 @dots{}
5417 if (!a > 1) @{ @dots{} @}
5418 @end smallexample
5419
5420 It is possible to suppress the warning by wrapping the LHS into
5421 parentheses:
5422 @smallexample
5423 if ((!a) > 1) @{ @dots{} @}
5424 @end smallexample
5425
5426 This warning is enabled by @option{-Wall}.
5427
5428 @item -Waggregate-return
5429 @opindex Waggregate-return
5430 @opindex Wno-aggregate-return
5431 Warn if any functions that return structures or unions are defined or
5432 called. (In languages where you can return an array, this also elicits
5433 a warning.)
5434
5435 @item -Wno-aggressive-loop-optimizations
5436 @opindex Wno-aggressive-loop-optimizations
5437 @opindex Waggressive-loop-optimizations
5438 Warn if in a loop with constant number of iterations the compiler detects
5439 undefined behavior in some statement during one or more of the iterations.
5440
5441 @item -Wno-attributes
5442 @opindex Wno-attributes
5443 @opindex Wattributes
5444 Do not warn if an unexpected @code{__attribute__} is used, such as
5445 unrecognized attributes, function attributes applied to variables,
5446 etc. This does not stop errors for incorrect use of supported
5447 attributes.
5448
5449 @item -Wno-builtin-macro-redefined
5450 @opindex Wno-builtin-macro-redefined
5451 @opindex Wbuiltin-macro-redefined
5452 Do not warn if certain built-in macros are redefined. This suppresses
5453 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
5454 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
5455
5456 @item -Wstrict-prototypes @r{(C and Objective-C only)}
5457 @opindex Wstrict-prototypes
5458 @opindex Wno-strict-prototypes
5459 Warn if a function is declared or defined without specifying the
5460 argument types. (An old-style function definition is permitted without
5461 a warning if preceded by a declaration that specifies the argument
5462 types.)
5463
5464 @item -Wold-style-declaration @r{(C and Objective-C only)}
5465 @opindex Wold-style-declaration
5466 @opindex Wno-old-style-declaration
5467 Warn for obsolescent usages, according to the C Standard, in a
5468 declaration. For example, warn if storage-class specifiers like
5469 @code{static} are not the first things in a declaration. This warning
5470 is also enabled by @option{-Wextra}.
5471
5472 @item -Wold-style-definition @r{(C and Objective-C only)}
5473 @opindex Wold-style-definition
5474 @opindex Wno-old-style-definition
5475 Warn if an old-style function definition is used. A warning is given
5476 even if there is a previous prototype.
5477
5478 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5479 @opindex Wmissing-parameter-type
5480 @opindex Wno-missing-parameter-type
5481 A function parameter is declared without a type specifier in K&R-style
5482 functions:
5483
5484 @smallexample
5485 void foo(bar) @{ @}
5486 @end smallexample
5487
5488 This warning is also enabled by @option{-Wextra}.
5489
5490 @item -Wmissing-prototypes @r{(C and Objective-C only)}
5491 @opindex Wmissing-prototypes
5492 @opindex Wno-missing-prototypes
5493 Warn if a global function is defined without a previous prototype
5494 declaration. This warning is issued even if the definition itself
5495 provides a prototype. Use this option to detect global functions
5496 that do not have a matching prototype declaration in a header file.
5497 This option is not valid for C++ because all function declarations
5498 provide prototypes and a non-matching declaration declares an
5499 overload rather than conflict with an earlier declaration.
5500 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
5501
5502 @item -Wmissing-declarations
5503 @opindex Wmissing-declarations
5504 @opindex Wno-missing-declarations
5505 Warn if a global function is defined without a previous declaration.
5506 Do so even if the definition itself provides a prototype.
5507 Use this option to detect global functions that are not declared in
5508 header files. In C, no warnings are issued for functions with previous
5509 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
5510 missing prototypes. In C++, no warnings are issued for function templates,
5511 or for inline functions, or for functions in anonymous namespaces.
5512
5513 @item -Wmissing-field-initializers
5514 @opindex Wmissing-field-initializers
5515 @opindex Wno-missing-field-initializers
5516 @opindex W
5517 @opindex Wextra
5518 @opindex Wno-extra
5519 Warn if a structure's initializer has some fields missing. For
5520 example, the following code causes such a warning, because
5521 @code{x.h} is implicitly zero:
5522
5523 @smallexample
5524 struct s @{ int f, g, h; @};
5525 struct s x = @{ 3, 4 @};
5526 @end smallexample
5527
5528 This option does not warn about designated initializers, so the following
5529 modification does not trigger a warning:
5530
5531 @smallexample
5532 struct s @{ int f, g, h; @};
5533 struct s x = @{ .f = 3, .g = 4 @};
5534 @end smallexample
5535
5536 In C++ this option does not warn either about the empty @{ @}
5537 initializer, for example:
5538
5539 @smallexample
5540 struct s @{ int f, g, h; @};
5541 s x = @{ @};
5542 @end smallexample
5543
5544 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
5545 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
5546
5547 @item -Wno-multichar
5548 @opindex Wno-multichar
5549 @opindex Wmultichar
5550 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
5551 Usually they indicate a typo in the user's code, as they have
5552 implementation-defined values, and should not be used in portable code.
5553
5554 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
5555 @opindex Wnormalized=
5556 @opindex Wnormalized
5557 @opindex Wno-normalized
5558 @cindex NFC
5559 @cindex NFKC
5560 @cindex character set, input normalization
5561 In ISO C and ISO C++, two identifiers are different if they are
5562 different sequences of characters. However, sometimes when characters
5563 outside the basic ASCII character set are used, you can have two
5564 different character sequences that look the same. To avoid confusion,
5565 the ISO 10646 standard sets out some @dfn{normalization rules} which
5566 when applied ensure that two sequences that look the same are turned into
5567 the same sequence. GCC can warn you if you are using identifiers that
5568 have not been normalized; this option controls that warning.
5569
5570 There are four levels of warning supported by GCC@. The default is
5571 @option{-Wnormalized=nfc}, which warns about any identifier that is
5572 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
5573 recommended form for most uses. It is equivalent to
5574 @option{-Wnormalized}.
5575
5576 Unfortunately, there are some characters allowed in identifiers by
5577 ISO C and ISO C++ that, when turned into NFC, are not allowed in
5578 identifiers. That is, there's no way to use these symbols in portable
5579 ISO C or C++ and have all your identifiers in NFC@.
5580 @option{-Wnormalized=id} suppresses the warning for these characters.
5581 It is hoped that future versions of the standards involved will correct
5582 this, which is why this option is not the default.
5583
5584 You can switch the warning off for all characters by writing
5585 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
5586 only do this if you are using some other normalization scheme (like
5587 ``D''), because otherwise you can easily create bugs that are
5588 literally impossible to see.
5589
5590 Some characters in ISO 10646 have distinct meanings but look identical
5591 in some fonts or display methodologies, especially once formatting has
5592 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
5593 LETTER N'', displays just like a regular @code{n} that has been
5594 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
5595 normalization scheme to convert all these into a standard form as
5596 well, and GCC warns if your code is not in NFKC if you use
5597 @option{-Wnormalized=nfkc}. This warning is comparable to warning
5598 about every identifier that contains the letter O because it might be
5599 confused with the digit 0, and so is not the default, but may be
5600 useful as a local coding convention if the programming environment
5601 cannot be fixed to display these characters distinctly.
5602
5603 @item -Wno-deprecated
5604 @opindex Wno-deprecated
5605 @opindex Wdeprecated
5606 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
5607
5608 @item -Wno-deprecated-declarations
5609 @opindex Wno-deprecated-declarations
5610 @opindex Wdeprecated-declarations
5611 Do not warn about uses of functions (@pxref{Function Attributes}),
5612 variables (@pxref{Variable Attributes}), and types (@pxref{Type
5613 Attributes}) marked as deprecated by using the @code{deprecated}
5614 attribute.
5615
5616 @item -Wno-overflow
5617 @opindex Wno-overflow
5618 @opindex Woverflow
5619 Do not warn about compile-time overflow in constant expressions.
5620
5621 @item -Wno-odr
5622 @opindex Wno-odr
5623 @opindex Wodr
5624 Warn about One Definition Rule violations during link-time optimization.
5625 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
5626
5627 @item -Wopenmp-simd
5628 @opindex Wopenm-simd
5629 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
5630 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
5631 option can be used to relax the cost model.
5632
5633 @item -Woverride-init @r{(C and Objective-C only)}
5634 @opindex Woverride-init
5635 @opindex Wno-override-init
5636 @opindex W
5637 @opindex Wextra
5638 @opindex Wno-extra
5639 Warn if an initialized field without side effects is overridden when
5640 using designated initializers (@pxref{Designated Inits, , Designated
5641 Initializers}).
5642
5643 This warning is included in @option{-Wextra}. To get other
5644 @option{-Wextra} warnings without this one, use @option{-Wextra
5645 -Wno-override-init}.
5646
5647 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
5648 @opindex Woverride-init-side-effects
5649 @opindex Wno-override-init-side-effects
5650 Warn if an initialized field with side effects is overridden when
5651 using designated initializers (@pxref{Designated Inits, , Designated
5652 Initializers}). This warning is enabled by default.
5653
5654 @item -Wpacked
5655 @opindex Wpacked
5656 @opindex Wno-packed
5657 Warn if a structure is given the packed attribute, but the packed
5658 attribute has no effect on the layout or size of the structure.
5659 Such structures may be mis-aligned for little benefit. For
5660 instance, in this code, the variable @code{f.x} in @code{struct bar}
5661 is misaligned even though @code{struct bar} does not itself
5662 have the packed attribute:
5663
5664 @smallexample
5665 @group
5666 struct foo @{
5667 int x;
5668 char a, b, c, d;
5669 @} __attribute__((packed));
5670 struct bar @{
5671 char z;
5672 struct foo f;
5673 @};
5674 @end group
5675 @end smallexample
5676
5677 @item -Wpacked-bitfield-compat
5678 @opindex Wpacked-bitfield-compat
5679 @opindex Wno-packed-bitfield-compat
5680 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
5681 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
5682 the change can lead to differences in the structure layout. GCC
5683 informs you when the offset of such a field has changed in GCC 4.4.
5684 For example there is no longer a 4-bit padding between field @code{a}
5685 and @code{b} in this structure:
5686
5687 @smallexample
5688 struct foo
5689 @{
5690 char a:4;
5691 char b:8;
5692 @} __attribute__ ((packed));
5693 @end smallexample
5694
5695 This warning is enabled by default. Use
5696 @option{-Wno-packed-bitfield-compat} to disable this warning.
5697
5698 @item -Wpadded
5699 @opindex Wpadded
5700 @opindex Wno-padded
5701 Warn if padding is included in a structure, either to align an element
5702 of the structure or to align the whole structure. Sometimes when this
5703 happens it is possible to rearrange the fields of the structure to
5704 reduce the padding and so make the structure smaller.
5705
5706 @item -Wredundant-decls
5707 @opindex Wredundant-decls
5708 @opindex Wno-redundant-decls
5709 Warn if anything is declared more than once in the same scope, even in
5710 cases where multiple declaration is valid and changes nothing.
5711
5712 @item -Wnested-externs @r{(C and Objective-C only)}
5713 @opindex Wnested-externs
5714 @opindex Wno-nested-externs
5715 Warn if an @code{extern} declaration is encountered within a function.
5716
5717 @item -Wno-inherited-variadic-ctor
5718 @opindex Winherited-variadic-ctor
5719 @opindex Wno-inherited-variadic-ctor
5720 Suppress warnings about use of C++11 inheriting constructors when the
5721 base class inherited from has a C variadic constructor; the warning is
5722 on by default because the ellipsis is not inherited.
5723
5724 @item -Winline
5725 @opindex Winline
5726 @opindex Wno-inline
5727 Warn if a function that is declared as inline cannot be inlined.
5728 Even with this option, the compiler does not warn about failures to
5729 inline functions declared in system headers.
5730
5731 The compiler uses a variety of heuristics to determine whether or not
5732 to inline a function. For example, the compiler takes into account
5733 the size of the function being inlined and the amount of inlining
5734 that has already been done in the current function. Therefore,
5735 seemingly insignificant changes in the source program can cause the
5736 warnings produced by @option{-Winline} to appear or disappear.
5737
5738 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
5739 @opindex Wno-invalid-offsetof
5740 @opindex Winvalid-offsetof
5741 Suppress warnings from applying the @code{offsetof} macro to a non-POD
5742 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
5743 to a non-standard-layout type is undefined. In existing C++ implementations,
5744 however, @code{offsetof} typically gives meaningful results.
5745 This flag is for users who are aware that they are
5746 writing nonportable code and who have deliberately chosen to ignore the
5747 warning about it.
5748
5749 The restrictions on @code{offsetof} may be relaxed in a future version
5750 of the C++ standard.
5751
5752 @item -Wno-int-to-pointer-cast
5753 @opindex Wno-int-to-pointer-cast
5754 @opindex Wint-to-pointer-cast
5755 Suppress warnings from casts to pointer type of an integer of a
5756 different size. In C++, casting to a pointer type of smaller size is
5757 an error. @option{Wint-to-pointer-cast} is enabled by default.
5758
5759
5760 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
5761 @opindex Wno-pointer-to-int-cast
5762 @opindex Wpointer-to-int-cast
5763 Suppress warnings from casts from a pointer to an integer type of a
5764 different size.
5765
5766 @item -Winvalid-pch
5767 @opindex Winvalid-pch
5768 @opindex Wno-invalid-pch
5769 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
5770 the search path but can't be used.
5771
5772 @item -Wlong-long
5773 @opindex Wlong-long
5774 @opindex Wno-long-long
5775 Warn if @code{long long} type is used. This is enabled by either
5776 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
5777 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
5778
5779 @item -Wvariadic-macros
5780 @opindex Wvariadic-macros
5781 @opindex Wno-variadic-macros
5782 Warn if variadic macros are used in ISO C90 mode, or if the GNU
5783 alternate syntax is used in ISO C99 mode. This is enabled by either
5784 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
5785 messages, use @option{-Wno-variadic-macros}.
5786
5787 @item -Wvarargs
5788 @opindex Wvarargs
5789 @opindex Wno-varargs
5790 Warn upon questionable usage of the macros used to handle variable
5791 arguments like @code{va_start}. This is default. To inhibit the
5792 warning messages, use @option{-Wno-varargs}.
5793
5794 @item -Wvector-operation-performance
5795 @opindex Wvector-operation-performance
5796 @opindex Wno-vector-operation-performance
5797 Warn if vector operation is not implemented via SIMD capabilities of the
5798 architecture. Mainly useful for the performance tuning.
5799 Vector operation can be implemented @code{piecewise}, which means that the
5800 scalar operation is performed on every vector element;
5801 @code{in parallel}, which means that the vector operation is implemented
5802 using scalars of wider type, which normally is more performance efficient;
5803 and @code{as a single scalar}, which means that vector fits into a
5804 scalar type.
5805
5806 @item -Wno-virtual-move-assign
5807 @opindex Wvirtual-move-assign
5808 @opindex Wno-virtual-move-assign
5809 Suppress warnings about inheriting from a virtual base with a
5810 non-trivial C++11 move assignment operator. This is dangerous because
5811 if the virtual base is reachable along more than one path, it is
5812 moved multiple times, which can mean both objects end up in the
5813 moved-from state. If the move assignment operator is written to avoid
5814 moving from a moved-from object, this warning can be disabled.
5815
5816 @item -Wvla
5817 @opindex Wvla
5818 @opindex Wno-vla
5819 Warn if variable length array is used in the code.
5820 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
5821 the variable length array.
5822
5823 @item -Wvolatile-register-var
5824 @opindex Wvolatile-register-var
5825 @opindex Wno-volatile-register-var
5826 Warn if a register variable is declared volatile. The volatile
5827 modifier does not inhibit all optimizations that may eliminate reads
5828 and/or writes to register variables. This warning is enabled by
5829 @option{-Wall}.
5830
5831 @item -Wdisabled-optimization
5832 @opindex Wdisabled-optimization
5833 @opindex Wno-disabled-optimization
5834 Warn if a requested optimization pass is disabled. This warning does
5835 not generally indicate that there is anything wrong with your code; it
5836 merely indicates that GCC's optimizers are unable to handle the code
5837 effectively. Often, the problem is that your code is too big or too
5838 complex; GCC refuses to optimize programs when the optimization
5839 itself is likely to take inordinate amounts of time.
5840
5841 @item -Wpointer-sign @r{(C and Objective-C only)}
5842 @opindex Wpointer-sign
5843 @opindex Wno-pointer-sign
5844 Warn for pointer argument passing or assignment with different signedness.
5845 This option is only supported for C and Objective-C@. It is implied by
5846 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
5847 @option{-Wno-pointer-sign}.
5848
5849 @item -Wstack-protector
5850 @opindex Wstack-protector
5851 @opindex Wno-stack-protector
5852 This option is only active when @option{-fstack-protector} is active. It
5853 warns about functions that are not protected against stack smashing.
5854
5855 @item -Woverlength-strings
5856 @opindex Woverlength-strings
5857 @opindex Wno-overlength-strings
5858 Warn about string constants that are longer than the ``minimum
5859 maximum'' length specified in the C standard. Modern compilers
5860 generally allow string constants that are much longer than the
5861 standard's minimum limit, but very portable programs should avoid
5862 using longer strings.
5863
5864 The limit applies @emph{after} string constant concatenation, and does
5865 not count the trailing NUL@. In C90, the limit was 509 characters; in
5866 C99, it was raised to 4095. C++98 does not specify a normative
5867 minimum maximum, so we do not diagnose overlength strings in C++@.
5868
5869 This option is implied by @option{-Wpedantic}, and can be disabled with
5870 @option{-Wno-overlength-strings}.
5871
5872 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
5873 @opindex Wunsuffixed-float-constants
5874
5875 Issue a warning for any floating constant that does not have
5876 a suffix. When used together with @option{-Wsystem-headers} it
5877 warns about such constants in system header files. This can be useful
5878 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
5879 from the decimal floating-point extension to C99.
5880
5881 @item -Wno-designated-init @r{(C and Objective-C only)}
5882 Suppress warnings when a positional initializer is used to initialize
5883 a structure that has been marked with the @code{designated_init}
5884 attribute.
5885
5886 @item -Whsa
5887 Issue a warning when HSAIL cannot be emitted for the compiled function or
5888 OpenMP construct.
5889
5890 @end table
5891
5892 @node Debugging Options
5893 @section Options for Debugging Your Program
5894 @cindex options, debugging
5895 @cindex debugging information options
5896
5897 To tell GCC to emit extra information for use by a debugger, in almost
5898 all cases you need only to add @option{-g} to your other options.
5899
5900 GCC allows you to use @option{-g} with
5901 @option{-O}. The shortcuts taken by optimized code may occasionally
5902 be surprising: some variables you declared may not exist
5903 at all; flow of control may briefly move where you did not expect it;
5904 some statements may not be executed because they compute constant
5905 results or their values are already at hand; some statements may
5906 execute in different places because they have been moved out of loops.
5907 Nevertheless it is possible to debug optimized output. This makes
5908 it reasonable to use the optimizer for programs that might have bugs.
5909
5910 If you are not using some other optimization option, consider
5911 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
5912 With no @option{-O} option at all, some compiler passes that collect
5913 information useful for debugging do not run at all, so that
5914 @option{-Og} may result in a better debugging experience.
5915
5916 @table @gcctabopt
5917 @item -g
5918 @opindex g
5919 Produce debugging information in the operating system's native format
5920 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
5921 information.
5922
5923 On most systems that use stabs format, @option{-g} enables use of extra
5924 debugging information that only GDB can use; this extra information
5925 makes debugging work better in GDB but probably makes other debuggers
5926 crash or
5927 refuse to read the program. If you want to control for certain whether
5928 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
5929 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
5930
5931 @item -ggdb
5932 @opindex ggdb
5933 Produce debugging information for use by GDB@. This means to use the
5934 most expressive format available (DWARF, stabs, or the native format
5935 if neither of those are supported), including GDB extensions if at all
5936 possible.
5937
5938 @item -gdwarf
5939 @itemx -gdwarf-@var{version}
5940 @opindex gdwarf
5941 Produce debugging information in DWARF format (if that is supported).
5942 The value of @var{version} may be either 2, 3, 4 or 5; the default version
5943 for most targets is 4. DWARF Version 5 is only experimental.
5944
5945 Note that with DWARF Version 2, some ports require and always
5946 use some non-conflicting DWARF 3 extensions in the unwind tables.
5947
5948 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
5949 for maximum benefit.
5950
5951 GCC no longer supports DWARF Version 1, which is substantially
5952 different than Version 2 and later. For historical reasons, some
5953 other DWARF-related options (including @option{-feliminate-dwarf2-dups}
5954 and @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
5955 in their names, but apply to all currently-supported versions of DWARF.
5956
5957 @item -gstabs
5958 @opindex gstabs
5959 Produce debugging information in stabs format (if that is supported),
5960 without GDB extensions. This is the format used by DBX on most BSD
5961 systems. On MIPS, Alpha and System V Release 4 systems this option
5962 produces stabs debugging output that is not understood by DBX or SDB@.
5963 On System V Release 4 systems this option requires the GNU assembler.
5964
5965 @item -gstabs+
5966 @opindex gstabs+
5967 Produce debugging information in stabs format (if that is supported),
5968 using GNU extensions understood only by the GNU debugger (GDB)@. The
5969 use of these extensions is likely to make other debuggers crash or
5970 refuse to read the program.
5971
5972 @item -gcoff
5973 @opindex gcoff
5974 Produce debugging information in COFF format (if that is supported).
5975 This is the format used by SDB on most System V systems prior to
5976 System V Release 4.
5977
5978 @item -gxcoff
5979 @opindex gxcoff
5980 Produce debugging information in XCOFF format (if that is supported).
5981 This is the format used by the DBX debugger on IBM RS/6000 systems.
5982
5983 @item -gxcoff+
5984 @opindex gxcoff+
5985 Produce debugging information in XCOFF format (if that is supported),
5986 using GNU extensions understood only by the GNU debugger (GDB)@. The
5987 use of these extensions is likely to make other debuggers crash or
5988 refuse to read the program, and may cause assemblers other than the GNU
5989 assembler (GAS) to fail with an error.
5990
5991 @item -gvms
5992 @opindex gvms
5993 Produce debugging information in Alpha/VMS debug format (if that is
5994 supported). This is the format used by DEBUG on Alpha/VMS systems.
5995
5996 @item -g@var{level}
5997 @itemx -ggdb@var{level}
5998 @itemx -gstabs@var{level}
5999 @itemx -gcoff@var{level}
6000 @itemx -gxcoff@var{level}
6001 @itemx -gvms@var{level}
6002 Request debugging information and also use @var{level} to specify how
6003 much information. The default level is 2.
6004
6005 Level 0 produces no debug information at all. Thus, @option{-g0} negates
6006 @option{-g}.
6007
6008 Level 1 produces minimal information, enough for making backtraces in
6009 parts of the program that you don't plan to debug. This includes
6010 descriptions of functions and external variables, and line number
6011 tables, but no information about local variables.
6012
6013 Level 3 includes extra information, such as all the macro definitions
6014 present in the program. Some debuggers support macro expansion when
6015 you use @option{-g3}.
6016
6017 @option{-gdwarf} does not accept a concatenated debug level, to avoid
6018 confusion with @option{-gdwarf-@var{level}}.
6019 Instead use an additional @option{-g@var{level}} option to change the
6020 debug level for DWARF.
6021
6022 @item -feliminate-unused-debug-symbols
6023 @opindex feliminate-unused-debug-symbols
6024 Produce debugging information in stabs format (if that is supported),
6025 for only symbols that are actually used.
6026
6027 @item -femit-class-debug-always
6028 @opindex femit-class-debug-always
6029 Instead of emitting debugging information for a C++ class in only one
6030 object file, emit it in all object files using the class. This option
6031 should be used only with debuggers that are unable to handle the way GCC
6032 normally emits debugging information for classes because using this
6033 option increases the size of debugging information by as much as a
6034 factor of two.
6035
6036 @item -fno-merge-debug-strings
6037 @opindex fmerge-debug-strings
6038 @opindex fno-merge-debug-strings
6039 Direct the linker to not merge together strings in the debugging
6040 information that are identical in different object files. Merging is
6041 not supported by all assemblers or linkers. Merging decreases the size
6042 of the debug information in the output file at the cost of increasing
6043 link processing time. Merging is enabled by default.
6044
6045 @item -fdebug-prefix-map=@var{old}=@var{new}
6046 @opindex fdebug-prefix-map
6047 When compiling files in directory @file{@var{old}}, record debugging
6048 information describing them as in @file{@var{new}} instead.
6049
6050 @item -fvar-tracking
6051 @opindex fvar-tracking
6052 Run variable tracking pass. It computes where variables are stored at each
6053 position in code. Better debugging information is then generated
6054 (if the debugging information format supports this information).
6055
6056 It is enabled by default when compiling with optimization (@option{-Os},
6057 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6058 the debug info format supports it.
6059
6060 @item -fvar-tracking-assignments
6061 @opindex fvar-tracking-assignments
6062 @opindex fno-var-tracking-assignments
6063 Annotate assignments to user variables early in the compilation and
6064 attempt to carry the annotations over throughout the compilation all the
6065 way to the end, in an attempt to improve debug information while
6066 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6067
6068 It can be enabled even if var-tracking is disabled, in which case
6069 annotations are created and maintained, but discarded at the end.
6070 By default, this flag is enabled together with @option{-fvar-tracking},
6071 except when selective scheduling is enabled.
6072
6073 @item -gsplit-dwarf
6074 @opindex gsplit-dwarf
6075 Separate as much DWARF debugging information as possible into a
6076 separate output file with the extension @file{.dwo}. This option allows
6077 the build system to avoid linking files with debug information. To
6078 be useful, this option requires a debugger capable of reading @file{.dwo}
6079 files.
6080
6081 @item -gpubnames
6082 @opindex gpubnames
6083 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
6084
6085 @item -ggnu-pubnames
6086 @opindex ggnu-pubnames
6087 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
6088 suitable for conversion into a GDB@ index. This option is only useful
6089 with a linker that can produce GDB@ index version 7.
6090
6091 @item -fdebug-types-section
6092 @opindex fdebug-types-section
6093 @opindex fno-debug-types-section
6094 When using DWARF Version 4 or higher, type DIEs can be put into
6095 their own @code{.debug_types} section instead of making them part of the
6096 @code{.debug_info} section. It is more efficient to put them in a separate
6097 comdat sections since the linker can then remove duplicates.
6098 But not all DWARF consumers support @code{.debug_types} sections yet
6099 and on some objects @code{.debug_types} produces larger instead of smaller
6100 debugging information.
6101
6102 @item -grecord-gcc-switches
6103 @item -gno-record-gcc-switches
6104 @opindex grecord-gcc-switches
6105 @opindex gno-record-gcc-switches
6106 This switch causes the command-line options used to invoke the
6107 compiler that may affect code generation to be appended to the
6108 DW_AT_producer attribute in DWARF debugging information. The options
6109 are concatenated with spaces separating them from each other and from
6110 the compiler version.
6111 It is enabled by default.
6112 See also @option{-frecord-gcc-switches} for another
6113 way of storing compiler options into the object file.
6114
6115 @item -gstrict-dwarf
6116 @opindex gstrict-dwarf
6117 Disallow using extensions of later DWARF standard version than selected
6118 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
6119 DWARF extensions from later standard versions is allowed.
6120
6121 @item -gno-strict-dwarf
6122 @opindex gno-strict-dwarf
6123 Allow using extensions of later DWARF standard version than selected with
6124 @option{-gdwarf-@var{version}}.
6125
6126 @item -gz@r{[}=@var{type}@r{]}
6127 @opindex gz
6128 Produce compressed debug sections in DWARF format, if that is supported.
6129 If @var{type} is not given, the default type depends on the capabilities
6130 of the assembler and linker used. @var{type} may be one of
6131 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
6132 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
6133 compression in traditional GNU format). If the linker doesn't support
6134 writing compressed debug sections, the option is rejected. Otherwise,
6135 if the assembler does not support them, @option{-gz} is silently ignored
6136 when producing object files.
6137
6138 @item -feliminate-dwarf2-dups
6139 @opindex feliminate-dwarf2-dups
6140 Compress DWARF debugging information by eliminating duplicated
6141 information about each symbol. This option only makes sense when
6142 generating DWARF debugging information.
6143
6144 @item -femit-struct-debug-baseonly
6145 @opindex femit-struct-debug-baseonly
6146 Emit debug information for struct-like types
6147 only when the base name of the compilation source file
6148 matches the base name of file in which the struct is defined.
6149
6150 This option substantially reduces the size of debugging information,
6151 but at significant potential loss in type information to the debugger.
6152 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6153 See @option{-femit-struct-debug-detailed} for more detailed control.
6154
6155 This option works only with DWARF debug output.
6156
6157 @item -femit-struct-debug-reduced
6158 @opindex femit-struct-debug-reduced
6159 Emit debug information for struct-like types
6160 only when the base name of the compilation source file
6161 matches the base name of file in which the type is defined,
6162 unless the struct is a template or defined in a system header.
6163
6164 This option significantly reduces the size of debugging information,
6165 with some potential loss in type information to the debugger.
6166 See @option{-femit-struct-debug-baseonly} for a more 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-detailed@r{[}=@var{spec-list}@r{]}
6172 @opindex femit-struct-debug-detailed
6173 Specify the struct-like types
6174 for which the compiler generates debug information.
6175 The intent is to reduce duplicate struct debug information
6176 between different object files within the same program.
6177
6178 This option is a detailed version of
6179 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6180 which serves for most needs.
6181
6182 A specification has the syntax@*
6183 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6184
6185 The optional first word limits the specification to
6186 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6187 A struct type is used directly when it is the type of a variable, member.
6188 Indirect uses arise through pointers to structs.
6189 That is, when use of an incomplete struct is valid, the use is indirect.
6190 An example is
6191 @samp{struct one direct; struct two * indirect;}.
6192
6193 The optional second word limits the specification to
6194 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6195 Generic structs are a bit complicated to explain.
6196 For C++, these are non-explicit specializations of template classes,
6197 or non-template classes within the above.
6198 Other programming languages have generics,
6199 but @option{-femit-struct-debug-detailed} does not yet implement them.
6200
6201 The third word specifies the source files for those
6202 structs for which the compiler should emit debug information.
6203 The values @samp{none} and @samp{any} have the normal meaning.
6204 The value @samp{base} means that
6205 the base of name of the file in which the type declaration appears
6206 must match the base of the name of the main compilation file.
6207 In practice, this means that when compiling @file{foo.c}, debug information
6208 is generated for types declared in that file and @file{foo.h},
6209 but not other header files.
6210 The value @samp{sys} means those types satisfying @samp{base}
6211 or declared in system or compiler headers.
6212
6213 You may need to experiment to determine the best settings for your application.
6214
6215 The default is @option{-femit-struct-debug-detailed=all}.
6216
6217 This option works only with DWARF debug output.
6218
6219 @item -fno-dwarf2-cfi-asm
6220 @opindex fdwarf2-cfi-asm
6221 @opindex fno-dwarf2-cfi-asm
6222 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
6223 instead of using GAS @code{.cfi_*} directives.
6224
6225 @item -fno-eliminate-unused-debug-types
6226 @opindex feliminate-unused-debug-types
6227 @opindex fno-eliminate-unused-debug-types
6228 Normally, when producing DWARF output, GCC avoids producing debug symbol
6229 output for types that are nowhere used in the source file being compiled.
6230 Sometimes it is useful to have GCC emit debugging
6231 information for all types declared in a compilation
6232 unit, regardless of whether or not they are actually used
6233 in that compilation unit, for example
6234 if, in the debugger, you want to cast a value to a type that is
6235 not actually used in your program (but is declared). More often,
6236 however, this results in a significant amount of wasted space.
6237 @end table
6238
6239 @node Optimize Options
6240 @section Options That Control Optimization
6241 @cindex optimize options
6242 @cindex options, optimization
6243
6244 These options control various sorts of optimizations.
6245
6246 Without any optimization option, the compiler's goal is to reduce the
6247 cost of compilation and to make debugging produce the expected
6248 results. Statements are independent: if you stop the program with a
6249 breakpoint between statements, you can then assign a new value to any
6250 variable or change the program counter to any other statement in the
6251 function and get exactly the results you expect from the source
6252 code.
6253
6254 Turning on optimization flags makes the compiler attempt to improve
6255 the performance and/or code size at the expense of compilation time
6256 and possibly the ability to debug the program.
6257
6258 The compiler performs optimization based on the knowledge it has of the
6259 program. Compiling multiple files at once to a single output file mode allows
6260 the compiler to use information gained from all of the files when compiling
6261 each of them.
6262
6263 Not all optimizations are controlled directly by a flag. Only
6264 optimizations that have a flag are listed in this section.
6265
6266 Most optimizations are only enabled if an @option{-O} level is set on
6267 the command line. Otherwise they are disabled, even if individual
6268 optimization flags are specified.
6269
6270 Depending on the target and how GCC was configured, a slightly different
6271 set of optimizations may be enabled at each @option{-O} level than
6272 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6273 to find out the exact set of optimizations that are enabled at each level.
6274 @xref{Overall Options}, for examples.
6275
6276 @table @gcctabopt
6277 @item -O
6278 @itemx -O1
6279 @opindex O
6280 @opindex O1
6281 Optimize. Optimizing compilation takes somewhat more time, and a lot
6282 more memory for a large function.
6283
6284 With @option{-O}, the compiler tries to reduce code size and execution
6285 time, without performing any optimizations that take a great deal of
6286 compilation time.
6287
6288 @option{-O} turns on the following optimization flags:
6289 @gccoptlist{
6290 -fauto-inc-dec @gol
6291 -fbranch-count-reg @gol
6292 -fcombine-stack-adjustments @gol
6293 -fcompare-elim @gol
6294 -fcprop-registers @gol
6295 -fdce @gol
6296 -fdefer-pop @gol
6297 -fdelayed-branch @gol
6298 -fdse @gol
6299 -fforward-propagate @gol
6300 -fguess-branch-probability @gol
6301 -fif-conversion2 @gol
6302 -fif-conversion @gol
6303 -finline-functions-called-once @gol
6304 -fipa-pure-const @gol
6305 -fipa-profile @gol
6306 -fipa-reference @gol
6307 -fmerge-constants @gol
6308 -fmove-loop-invariants @gol
6309 -freorder-blocks @gol
6310 -fshrink-wrap @gol
6311 -fsplit-wide-types @gol
6312 -fssa-backprop @gol
6313 -fssa-phiopt @gol
6314 -ftree-bit-ccp @gol
6315 -ftree-ccp @gol
6316 -ftree-ch @gol
6317 -ftree-coalesce-vars @gol
6318 -ftree-copy-prop @gol
6319 -ftree-dce @gol
6320 -ftree-dominator-opts @gol
6321 -ftree-dse @gol
6322 -ftree-forwprop @gol
6323 -ftree-fre @gol
6324 -ftree-phiprop @gol
6325 -ftree-sink @gol
6326 -ftree-slsr @gol
6327 -ftree-sra @gol
6328 -ftree-pta @gol
6329 -ftree-ter @gol
6330 -funit-at-a-time}
6331
6332 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6333 where doing so does not interfere with debugging.
6334
6335 @item -O2
6336 @opindex O2
6337 Optimize even more. GCC performs nearly all supported optimizations
6338 that do not involve a space-speed tradeoff.
6339 As compared to @option{-O}, this option increases both compilation time
6340 and the performance of the generated code.
6341
6342 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6343 also turns on the following optimization flags:
6344 @gccoptlist{-fthread-jumps @gol
6345 -falign-functions -falign-jumps @gol
6346 -falign-loops -falign-labels @gol
6347 -fcaller-saves @gol
6348 -fcrossjumping @gol
6349 -fcse-follow-jumps -fcse-skip-blocks @gol
6350 -fdelete-null-pointer-checks @gol
6351 -fdevirtualize -fdevirtualize-speculatively @gol
6352 -fexpensive-optimizations @gol
6353 -fgcse -fgcse-lm @gol
6354 -fhoist-adjacent-loads @gol
6355 -finline-small-functions @gol
6356 -findirect-inlining @gol
6357 -fipa-cp @gol
6358 -fipa-cp-alignment @gol
6359 -fipa-sra @gol
6360 -fipa-icf @gol
6361 -fisolate-erroneous-paths-dereference @gol
6362 -flra-remat @gol
6363 -foptimize-sibling-calls @gol
6364 -foptimize-strlen @gol
6365 -fpartial-inlining @gol
6366 -fpeephole2 @gol
6367 -freorder-blocks-algorithm=stc @gol
6368 -freorder-blocks-and-partition -freorder-functions @gol
6369 -frerun-cse-after-loop @gol
6370 -fsched-interblock -fsched-spec @gol
6371 -fschedule-insns -fschedule-insns2 @gol
6372 -fstrict-aliasing -fstrict-overflow @gol
6373 -ftree-builtin-call-dce @gol
6374 -ftree-switch-conversion -ftree-tail-merge @gol
6375 -ftree-pre @gol
6376 -ftree-vrp @gol
6377 -fipa-ra}
6378
6379 Please note the warning under @option{-fgcse} about
6380 invoking @option{-O2} on programs that use computed gotos.
6381
6382 @item -O3
6383 @opindex O3
6384 Optimize yet more. @option{-O3} turns on all optimizations specified
6385 by @option{-O2} and also turns on the @option{-finline-functions},
6386 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6387 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
6388 @option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
6389 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
6390 @option{-ftree-partial-pre}, @option{-fpeel-loops}
6391 and @option{-fipa-cp-clone} options.
6392
6393 @item -O0
6394 @opindex O0
6395 Reduce compilation time and make debugging produce the expected
6396 results. This is the default.
6397
6398 @item -Os
6399 @opindex Os
6400 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6401 do not typically increase code size. It also performs further
6402 optimizations designed to reduce code size.
6403
6404 @option{-Os} disables the following optimization flags:
6405 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6406 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
6407 -freorder-blocks-and-partition -fprefetch-loop-arrays}
6408
6409 @item -Ofast
6410 @opindex Ofast
6411 Disregard strict standards compliance. @option{-Ofast} enables all
6412 @option{-O3} optimizations. It also enables optimizations that are not
6413 valid for all standard-compliant programs.
6414 It turns on @option{-ffast-math} and the Fortran-specific
6415 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6416
6417 @item -Og
6418 @opindex Og
6419 Optimize debugging experience. @option{-Og} enables optimizations
6420 that do not interfere with debugging. It should be the optimization
6421 level of choice for the standard edit-compile-debug cycle, offering
6422 a reasonable level of optimization while maintaining fast compilation
6423 and a good debugging experience.
6424 @end table
6425
6426 If you use multiple @option{-O} options, with or without level numbers,
6427 the last such option is the one that is effective.
6428
6429 Options of the form @option{-f@var{flag}} specify machine-independent
6430 flags. Most flags have both positive and negative forms; the negative
6431 form of @option{-ffoo} is @option{-fno-foo}. In the table
6432 below, only one of the forms is listed---the one you typically
6433 use. You can figure out the other form by either removing @samp{no-}
6434 or adding it.
6435
6436 The following options control specific optimizations. They are either
6437 activated by @option{-O} options or are related to ones that are. You
6438 can use the following flags in the rare cases when ``fine-tuning'' of
6439 optimizations to be performed is desired.
6440
6441 @table @gcctabopt
6442 @item -fno-defer-pop
6443 @opindex fno-defer-pop
6444 Always pop the arguments to each function call as soon as that function
6445 returns. For machines that must pop arguments after a function call,
6446 the compiler normally lets arguments accumulate on the stack for several
6447 function calls and pops them all at once.
6448
6449 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6450
6451 @item -fforward-propagate
6452 @opindex fforward-propagate
6453 Perform a forward propagation pass on RTL@. The pass tries to combine two
6454 instructions and checks if the result can be simplified. If loop unrolling
6455 is active, two passes are performed and the second is scheduled after
6456 loop unrolling.
6457
6458 This option is enabled by default at optimization levels @option{-O},
6459 @option{-O2}, @option{-O3}, @option{-Os}.
6460
6461 @item -ffp-contract=@var{style}
6462 @opindex ffp-contract
6463 @option{-ffp-contract=off} disables floating-point expression contraction.
6464 @option{-ffp-contract=fast} enables floating-point expression contraction
6465 such as forming of fused multiply-add operations if the target has
6466 native support for them.
6467 @option{-ffp-contract=on} enables floating-point expression contraction
6468 if allowed by the language standard. This is currently not implemented
6469 and treated equal to @option{-ffp-contract=off}.
6470
6471 The default is @option{-ffp-contract=fast}.
6472
6473 @item -fomit-frame-pointer
6474 @opindex fomit-frame-pointer
6475 Don't keep the frame pointer in a register for functions that
6476 don't need one. This avoids the instructions to save, set up and
6477 restore frame pointers; it also makes an extra register available
6478 in many functions. @strong{It also makes debugging impossible on
6479 some machines.}
6480
6481 On some machines, such as the VAX, this flag has no effect, because
6482 the standard calling sequence automatically handles the frame pointer
6483 and nothing is saved by pretending it doesn't exist. The
6484 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6485 whether a target machine supports this flag. @xref{Registers,,Register
6486 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6487
6488 The default setting (when not optimizing for
6489 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
6490 @option{-fomit-frame-pointer}. You can configure GCC with the
6491 @option{--enable-frame-pointer} configure option to change the default.
6492
6493 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6494
6495 @item -foptimize-sibling-calls
6496 @opindex foptimize-sibling-calls
6497 Optimize sibling and tail recursive calls.
6498
6499 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6500
6501 @item -foptimize-strlen
6502 @opindex foptimize-strlen
6503 Optimize various standard C string functions (e.g. @code{strlen},
6504 @code{strchr} or @code{strcpy}) and
6505 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
6506
6507 Enabled at levels @option{-O2}, @option{-O3}.
6508
6509 @item -fno-inline
6510 @opindex fno-inline
6511 Do not expand any functions inline apart from those marked with
6512 the @code{always_inline} attribute. This is the default when not
6513 optimizing.
6514
6515 Single functions can be exempted from inlining by marking them
6516 with the @code{noinline} attribute.
6517
6518 @item -finline-small-functions
6519 @opindex finline-small-functions
6520 Integrate functions into their callers when their body is smaller than expected
6521 function call code (so overall size of program gets smaller). The compiler
6522 heuristically decides which functions are simple enough to be worth integrating
6523 in this way. This inlining applies to all functions, even those not declared
6524 inline.
6525
6526 Enabled at level @option{-O2}.
6527
6528 @item -findirect-inlining
6529 @opindex findirect-inlining
6530 Inline also indirect calls that are discovered to be known at compile
6531 time thanks to previous inlining. This option has any effect only
6532 when inlining itself is turned on by the @option{-finline-functions}
6533 or @option{-finline-small-functions} options.
6534
6535 Enabled at level @option{-O2}.
6536
6537 @item -finline-functions
6538 @opindex finline-functions
6539 Consider all functions for inlining, even if they are not declared inline.
6540 The compiler heuristically decides which functions are worth integrating
6541 in this way.
6542
6543 If all calls to a given function are integrated, and the function is
6544 declared @code{static}, then the function is normally not output as
6545 assembler code in its own right.
6546
6547 Enabled at level @option{-O3}.
6548
6549 @item -finline-functions-called-once
6550 @opindex finline-functions-called-once
6551 Consider all @code{static} functions called once for inlining into their
6552 caller even if they are not marked @code{inline}. If a call to a given
6553 function is integrated, then the function is not output as assembler code
6554 in its own right.
6555
6556 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6557
6558 @item -fearly-inlining
6559 @opindex fearly-inlining
6560 Inline functions marked by @code{always_inline} and functions whose body seems
6561 smaller than the function call overhead early before doing
6562 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
6563 makes profiling significantly cheaper and usually inlining faster on programs
6564 having large chains of nested wrapper functions.
6565
6566 Enabled by default.
6567
6568 @item -fipa-sra
6569 @opindex fipa-sra
6570 Perform interprocedural scalar replacement of aggregates, removal of
6571 unused parameters and replacement of parameters passed by reference
6572 by parameters passed by value.
6573
6574 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6575
6576 @item -finline-limit=@var{n}
6577 @opindex finline-limit
6578 By default, GCC limits the size of functions that can be inlined. This flag
6579 allows coarse control of this limit. @var{n} is the size of functions that
6580 can be inlined in number of pseudo instructions.
6581
6582 Inlining is actually controlled by a number of parameters, which may be
6583 specified individually by using @option{--param @var{name}=@var{value}}.
6584 The @option{-finline-limit=@var{n}} option sets some of these parameters
6585 as follows:
6586
6587 @table @gcctabopt
6588 @item max-inline-insns-single
6589 is set to @var{n}/2.
6590 @item max-inline-insns-auto
6591 is set to @var{n}/2.
6592 @end table
6593
6594 See below for a documentation of the individual
6595 parameters controlling inlining and for the defaults of these parameters.
6596
6597 @emph{Note:} there may be no value to @option{-finline-limit} that results
6598 in default behavior.
6599
6600 @emph{Note:} pseudo instruction represents, in this particular context, an
6601 abstract measurement of function's size. In no way does it represent a count
6602 of assembly instructions and as such its exact meaning might change from one
6603 release to an another.
6604
6605 @item -fno-keep-inline-dllexport
6606 @opindex fno-keep-inline-dllexport
6607 This is a more fine-grained version of @option{-fkeep-inline-functions},
6608 which applies only to functions that are declared using the @code{dllexport}
6609 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6610 Functions}.)
6611
6612 @item -fkeep-inline-functions
6613 @opindex fkeep-inline-functions
6614 In C, emit @code{static} functions that are declared @code{inline}
6615 into the object file, even if the function has been inlined into all
6616 of its callers. This switch does not affect functions using the
6617 @code{extern inline} extension in GNU C90@. In C++, emit any and all
6618 inline functions into the object file.
6619
6620 @item -fkeep-static-functions
6621 @opindex fkeep-static-functions
6622 Emit @code{static} functions into the object file, even if the function
6623 is never used.
6624
6625 @item -fkeep-static-consts
6626 @opindex fkeep-static-consts
6627 Emit variables declared @code{static const} when optimization isn't turned
6628 on, even if the variables aren't referenced.
6629
6630 GCC enables this option by default. If you want to force the compiler to
6631 check if a variable is referenced, regardless of whether or not
6632 optimization is turned on, use the @option{-fno-keep-static-consts} option.
6633
6634 @item -fmerge-constants
6635 @opindex fmerge-constants
6636 Attempt to merge identical constants (string constants and floating-point
6637 constants) across compilation units.
6638
6639 This option is the default for optimized compilation if the assembler and
6640 linker support it. Use @option{-fno-merge-constants} to inhibit this
6641 behavior.
6642
6643 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6644
6645 @item -fmerge-all-constants
6646 @opindex fmerge-all-constants
6647 Attempt to merge identical constants and identical variables.
6648
6649 This option implies @option{-fmerge-constants}. In addition to
6650 @option{-fmerge-constants} this considers e.g.@: even constant initialized
6651 arrays or initialized constant variables with integral or floating-point
6652 types. Languages like C or C++ require each variable, including multiple
6653 instances of the same variable in recursive calls, to have distinct locations,
6654 so using this option results in non-conforming
6655 behavior.
6656
6657 @item -fmodulo-sched
6658 @opindex fmodulo-sched
6659 Perform swing modulo scheduling immediately before the first scheduling
6660 pass. This pass looks at innermost loops and reorders their
6661 instructions by overlapping different iterations.
6662
6663 @item -fmodulo-sched-allow-regmoves
6664 @opindex fmodulo-sched-allow-regmoves
6665 Perform more aggressive SMS-based modulo scheduling with register moves
6666 allowed. By setting this flag certain anti-dependences edges are
6667 deleted, which triggers the generation of reg-moves based on the
6668 life-range analysis. This option is effective only with
6669 @option{-fmodulo-sched} enabled.
6670
6671 @item -fno-branch-count-reg
6672 @opindex fno-branch-count-reg
6673 Avoid running a pass scanning for opportunities to use ``decrement and
6674 branch'' instructions on a count register instead of generating sequences
6675 of instructions that decrement a register, compare it against zero, and
6676 then branch based upon the result. This option is only meaningful on
6677 architectures that support such instructions, which include x86, PowerPC,
6678 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
6679 doesn't remove the decrement and branch instructions from the generated
6680 instruction stream introduced by other optimization passes.
6681
6682 Enabled by default at @option{-O1} and higher.
6683
6684 The default is @option{-fbranch-count-reg}.
6685
6686 @item -fno-function-cse
6687 @opindex fno-function-cse
6688 Do not put function addresses in registers; make each instruction that
6689 calls a constant function contain the function's address explicitly.
6690
6691 This option results in less efficient code, but some strange hacks
6692 that alter the assembler output may be confused by the optimizations
6693 performed when this option is not used.
6694
6695 The default is @option{-ffunction-cse}
6696
6697 @item -fno-zero-initialized-in-bss
6698 @opindex fno-zero-initialized-in-bss
6699 If the target supports a BSS section, GCC by default puts variables that
6700 are initialized to zero into BSS@. This can save space in the resulting
6701 code.
6702
6703 This option turns off this behavior because some programs explicitly
6704 rely on variables going to the data section---e.g., so that the
6705 resulting executable can find the beginning of that section and/or make
6706 assumptions based on that.
6707
6708 The default is @option{-fzero-initialized-in-bss}.
6709
6710 @item -fthread-jumps
6711 @opindex fthread-jumps
6712 Perform optimizations that check to see if a jump branches to a
6713 location where another comparison subsumed by the first is found. If
6714 so, the first branch is redirected to either the destination of the
6715 second branch or a point immediately following it, depending on whether
6716 the condition is known to be true or false.
6717
6718 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6719
6720 @item -fsplit-wide-types
6721 @opindex fsplit-wide-types
6722 When using a type that occupies multiple registers, such as @code{long
6723 long} on a 32-bit system, split the registers apart and allocate them
6724 independently. This normally generates better code for those types,
6725 but may make debugging more difficult.
6726
6727 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6728 @option{-Os}.
6729
6730 @item -fcse-follow-jumps
6731 @opindex fcse-follow-jumps
6732 In common subexpression elimination (CSE), scan through jump instructions
6733 when the target of the jump is not reached by any other path. For
6734 example, when CSE encounters an @code{if} statement with an
6735 @code{else} clause, CSE follows the jump when the condition
6736 tested is false.
6737
6738 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6739
6740 @item -fcse-skip-blocks
6741 @opindex fcse-skip-blocks
6742 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6743 follow jumps that conditionally skip over blocks. When CSE
6744 encounters a simple @code{if} statement with no else clause,
6745 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
6746 body of the @code{if}.
6747
6748 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6749
6750 @item -frerun-cse-after-loop
6751 @opindex frerun-cse-after-loop
6752 Re-run common subexpression elimination after loop optimizations are
6753 performed.
6754
6755 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6756
6757 @item -fgcse
6758 @opindex fgcse
6759 Perform a global common subexpression elimination pass.
6760 This pass also performs global constant and copy propagation.
6761
6762 @emph{Note:} When compiling a program using computed gotos, a GCC
6763 extension, you may get better run-time performance if you disable
6764 the global common subexpression elimination pass by adding
6765 @option{-fno-gcse} to the command line.
6766
6767 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6768
6769 @item -fgcse-lm
6770 @opindex fgcse-lm
6771 When @option{-fgcse-lm} is enabled, global common subexpression elimination
6772 attempts to move loads that are only killed by stores into themselves. This
6773 allows a loop containing a load/store sequence to be changed to a load outside
6774 the loop, and a copy/store within the loop.
6775
6776 Enabled by default when @option{-fgcse} is enabled.
6777
6778 @item -fgcse-sm
6779 @opindex fgcse-sm
6780 When @option{-fgcse-sm} is enabled, a store motion pass is run after
6781 global common subexpression elimination. This pass attempts to move
6782 stores out of loops. When used in conjunction with @option{-fgcse-lm},
6783 loops containing a load/store sequence can be changed to a load before
6784 the loop and a store after the loop.
6785
6786 Not enabled at any optimization level.
6787
6788 @item -fgcse-las
6789 @opindex fgcse-las
6790 When @option{-fgcse-las} is enabled, the global common subexpression
6791 elimination pass eliminates redundant loads that come after stores to the
6792 same memory location (both partial and full redundancies).
6793
6794 Not enabled at any optimization level.
6795
6796 @item -fgcse-after-reload
6797 @opindex fgcse-after-reload
6798 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6799 pass is performed after reload. The purpose of this pass is to clean up
6800 redundant spilling.
6801
6802 @item -faggressive-loop-optimizations
6803 @opindex faggressive-loop-optimizations
6804 This option tells the loop optimizer to use language constraints to
6805 derive bounds for the number of iterations of a loop. This assumes that
6806 loop code does not invoke undefined behavior by for example causing signed
6807 integer overflows or out-of-bound array accesses. The bounds for the
6808 number of iterations of a loop are used to guide loop unrolling and peeling
6809 and loop exit test optimizations.
6810 This option is enabled by default.
6811
6812 @item -funsafe-loop-optimizations
6813 @opindex funsafe-loop-optimizations
6814 This option tells the loop optimizer to assume that loop indices do not
6815 overflow, and that loops with nontrivial exit condition are not
6816 infinite. This enables a wider range of loop optimizations even if
6817 the loop optimizer itself cannot prove that these assumptions are valid.
6818 If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you
6819 if it finds this kind of loop.
6820
6821 @item -funconstrained-commons
6822 @opindex funconstrained-commons
6823 This option tells the compiler that variables declared in common blocks
6824 (e.g. Fortran) may later be overridden with longer trailing arrays. This
6825 prevents certain optimizations that depend on knowing the array bounds.
6826
6827 @item -fcrossjumping
6828 @opindex fcrossjumping
6829 Perform cross-jumping transformation.
6830 This transformation unifies equivalent code and saves code size. The
6831 resulting code may or may not perform better than without cross-jumping.
6832
6833 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6834
6835 @item -fauto-inc-dec
6836 @opindex fauto-inc-dec
6837 Combine increments or decrements of addresses with memory accesses.
6838 This pass is always skipped on architectures that do not have
6839 instructions to support this. Enabled by default at @option{-O} and
6840 higher on architectures that support this.
6841
6842 @item -fdce
6843 @opindex fdce
6844 Perform dead code elimination (DCE) on RTL@.
6845 Enabled by default at @option{-O} and higher.
6846
6847 @item -fdse
6848 @opindex fdse
6849 Perform dead store elimination (DSE) on RTL@.
6850 Enabled by default at @option{-O} and higher.
6851
6852 @item -fif-conversion
6853 @opindex fif-conversion
6854 Attempt to transform conditional jumps into branch-less equivalents. This
6855 includes use of conditional moves, min, max, set flags and abs instructions, and
6856 some tricks doable by standard arithmetics. The use of conditional execution
6857 on chips where it is available is controlled by @option{-fif-conversion2}.
6858
6859 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6860
6861 @item -fif-conversion2
6862 @opindex fif-conversion2
6863 Use conditional execution (where available) to transform conditional jumps into
6864 branch-less equivalents.
6865
6866 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6867
6868 @item -fdeclone-ctor-dtor
6869 @opindex fdeclone-ctor-dtor
6870 The C++ ABI requires multiple entry points for constructors and
6871 destructors: one for a base subobject, one for a complete object, and
6872 one for a virtual destructor that calls operator delete afterwards.
6873 For a hierarchy with virtual bases, the base and complete variants are
6874 clones, which means two copies of the function. With this option, the
6875 base and complete variants are changed to be thunks that call a common
6876 implementation.
6877
6878 Enabled by @option{-Os}.
6879
6880 @item -fdelete-null-pointer-checks
6881 @opindex fdelete-null-pointer-checks
6882 Assume that programs cannot safely dereference null pointers, and that
6883 no code or data element resides at address zero.
6884 This option enables simple constant
6885 folding optimizations at all optimization levels. In addition, other
6886 optimization passes in GCC use this flag to control global dataflow
6887 analyses that eliminate useless checks for null pointers; these assume
6888 that a memory access to address zero always results in a trap, so
6889 that if a pointer is checked after it has already been dereferenced,
6890 it cannot be null.
6891
6892 Note however that in some environments this assumption is not true.
6893 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
6894 for programs that depend on that behavior.
6895
6896 This option is enabled by default on most targets. On Nios II ELF, it
6897 defaults to off. On AVR and CR16, this option is completely disabled.
6898
6899 Passes that use the dataflow information
6900 are enabled independently at different optimization levels.
6901
6902 @item -fdevirtualize
6903 @opindex fdevirtualize
6904 Attempt to convert calls to virtual functions to direct calls. This
6905 is done both within a procedure and interprocedurally as part of
6906 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
6907 propagation (@option{-fipa-cp}).
6908 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6909
6910 @item -fdevirtualize-speculatively
6911 @opindex fdevirtualize-speculatively
6912 Attempt to convert calls to virtual functions to speculative direct calls.
6913 Based on the analysis of the type inheritance graph, determine for a given call
6914 the set of likely targets. If the set is small, preferably of size 1, change
6915 the call into a conditional deciding between direct and indirect calls. The
6916 speculative calls enable more optimizations, such as inlining. When they seem
6917 useless after further optimization, they are converted back into original form.
6918
6919 @item -fdevirtualize-at-ltrans
6920 @opindex fdevirtualize-at-ltrans
6921 Stream extra information needed for aggressive devirtualization when running
6922 the link-time optimizer in local transformation mode.
6923 This option enables more devirtualization but
6924 significantly increases the size of streamed data. For this reason it is
6925 disabled by default.
6926
6927 @item -fexpensive-optimizations
6928 @opindex fexpensive-optimizations
6929 Perform a number of minor optimizations that are relatively expensive.
6930
6931 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6932
6933 @item -free
6934 @opindex free
6935 Attempt to remove redundant extension instructions. This is especially
6936 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
6937 registers after writing to their lower 32-bit half.
6938
6939 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
6940 @option{-O3}, @option{-Os}.
6941
6942 @item -fno-lifetime-dse
6943 @opindex fno-lifetime-dse
6944 In C++ the value of an object is only affected by changes within its
6945 lifetime: when the constructor begins, the object has an indeterminate
6946 value, and any changes during the lifetime of the object are dead when
6947 the object is destroyed. Normally dead store elimination will take
6948 advantage of this; if your code relies on the value of the object
6949 storage persisting beyond the lifetime of the object, you can use this
6950 flag to disable this optimization. To preserve stores before the
6951 constructor starts (e.g. because your operator new clears the object
6952 storage) but still treat the object as dead after the destructor you,
6953 can use @option{-flifetime-dse=1}. The default behavior can be
6954 explicitly selected with @option{-flifetime-dse=2}.
6955 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
6956
6957 @item -flive-range-shrinkage
6958 @opindex flive-range-shrinkage
6959 Attempt to decrease register pressure through register live range
6960 shrinkage. This is helpful for fast processors with small or moderate
6961 size register sets.
6962
6963 @item -fira-algorithm=@var{algorithm}
6964 @opindex fira-algorithm
6965 Use the specified coloring algorithm for the integrated register
6966 allocator. The @var{algorithm} argument can be @samp{priority}, which
6967 specifies Chow's priority coloring, or @samp{CB}, which specifies
6968 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
6969 for all architectures, but for those targets that do support it, it is
6970 the default because it generates better code.
6971
6972 @item -fira-region=@var{region}
6973 @opindex fira-region
6974 Use specified regions for the integrated register allocator. The
6975 @var{region} argument should be one of the following:
6976
6977 @table @samp
6978
6979 @item all
6980 Use all loops as register allocation regions.
6981 This can give the best results for machines with a small and/or
6982 irregular register set.
6983
6984 @item mixed
6985 Use all loops except for loops with small register pressure
6986 as the regions. This value usually gives
6987 the best results in most cases and for most architectures,
6988 and is enabled by default when compiling with optimization for speed
6989 (@option{-O}, @option{-O2}, @dots{}).
6990
6991 @item one
6992 Use all functions as a single region.
6993 This typically results in the smallest code size, and is enabled by default for
6994 @option{-Os} or @option{-O0}.
6995
6996 @end table
6997
6998 @item -fira-hoist-pressure
6999 @opindex fira-hoist-pressure
7000 Use IRA to evaluate register pressure in the code hoisting pass for
7001 decisions to hoist expressions. This option usually results in smaller
7002 code, but it can slow the compiler down.
7003
7004 This option is enabled at level @option{-Os} for all targets.
7005
7006 @item -fira-loop-pressure
7007 @opindex fira-loop-pressure
7008 Use IRA to evaluate register pressure in loops for decisions to move
7009 loop invariants. This option usually results in generation
7010 of faster and smaller code on machines with large register files (>= 32
7011 registers), but it can slow the compiler down.
7012
7013 This option is enabled at level @option{-O3} for some targets.
7014
7015 @item -fno-ira-share-save-slots
7016 @opindex fno-ira-share-save-slots
7017 Disable sharing of stack slots used for saving call-used hard
7018 registers living through a call. Each hard register gets a
7019 separate stack slot, and as a result function stack frames are
7020 larger.
7021
7022 @item -fno-ira-share-spill-slots
7023 @opindex fno-ira-share-spill-slots
7024 Disable sharing of stack slots allocated for pseudo-registers. Each
7025 pseudo-register that does not get a hard register gets a separate
7026 stack slot, and as a result function stack frames are larger.
7027
7028 @item -flra-remat
7029 @opindex flra-remat
7030 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7031 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7032 values if it is profitable.
7033
7034 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7035
7036 @item -fdelayed-branch
7037 @opindex fdelayed-branch
7038 If supported for the target machine, attempt to reorder instructions
7039 to exploit instruction slots available after delayed branch
7040 instructions.
7041
7042 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7043
7044 @item -fschedule-insns
7045 @opindex fschedule-insns
7046 If supported for the target machine, attempt to reorder instructions to
7047 eliminate execution stalls due to required data being unavailable. This
7048 helps machines that have slow floating point or memory load instructions
7049 by allowing other instructions to be issued until the result of the load
7050 or floating-point instruction is required.
7051
7052 Enabled at levels @option{-O2}, @option{-O3}.
7053
7054 @item -fschedule-insns2
7055 @opindex fschedule-insns2
7056 Similar to @option{-fschedule-insns}, but requests an additional pass of
7057 instruction scheduling after register allocation has been done. This is
7058 especially useful on machines with a relatively small number of
7059 registers and where memory load instructions take more than one cycle.
7060
7061 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7062
7063 @item -fno-sched-interblock
7064 @opindex fno-sched-interblock
7065 Don't schedule instructions across basic blocks. This is normally
7066 enabled by default when scheduling before register allocation, i.e.@:
7067 with @option{-fschedule-insns} or at @option{-O2} or higher.
7068
7069 @item -fno-sched-spec
7070 @opindex fno-sched-spec
7071 Don't allow speculative motion of non-load instructions. 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 -fsched-pressure
7076 @opindex fsched-pressure
7077 Enable register pressure sensitive insn scheduling before register
7078 allocation. This only makes sense when scheduling before register
7079 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7080 @option{-O2} or higher. Usage of this option can improve the
7081 generated code and decrease its size by preventing register pressure
7082 increase above the number of available hard registers and subsequent
7083 spills in register allocation.
7084
7085 @item -fsched-spec-load
7086 @opindex fsched-spec-load
7087 Allow speculative motion of some load instructions. This only makes
7088 sense when scheduling before register allocation, i.e.@: with
7089 @option{-fschedule-insns} or at @option{-O2} or higher.
7090
7091 @item -fsched-spec-load-dangerous
7092 @opindex fsched-spec-load-dangerous
7093 Allow speculative motion of more 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-stalled-insns
7098 @itemx -fsched-stalled-insns=@var{n}
7099 @opindex fsched-stalled-insns
7100 Define how many insns (if any) can be moved prematurely from the queue
7101 of stalled insns into the ready list during the second scheduling pass.
7102 @option{-fno-sched-stalled-insns} means that no insns are moved
7103 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7104 on how many queued insns can be moved prematurely.
7105 @option{-fsched-stalled-insns} without a value is equivalent to
7106 @option{-fsched-stalled-insns=1}.
7107
7108 @item -fsched-stalled-insns-dep
7109 @itemx -fsched-stalled-insns-dep=@var{n}
7110 @opindex fsched-stalled-insns-dep
7111 Define how many insn groups (cycles) are examined for a dependency
7112 on a stalled insn that is a candidate for premature removal from the queue
7113 of stalled insns. This has an effect only during the second scheduling pass,
7114 and only if @option{-fsched-stalled-insns} is used.
7115 @option{-fno-sched-stalled-insns-dep} is equivalent to
7116 @option{-fsched-stalled-insns-dep=0}.
7117 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7118 @option{-fsched-stalled-insns-dep=1}.
7119
7120 @item -fsched2-use-superblocks
7121 @opindex fsched2-use-superblocks
7122 When scheduling after register allocation, use superblock scheduling.
7123 This allows motion across basic block boundaries,
7124 resulting in faster schedules. This option is experimental, as not all machine
7125 descriptions used by GCC model the CPU closely enough to avoid unreliable
7126 results from the algorithm.
7127
7128 This only makes sense when scheduling after register allocation, i.e.@: with
7129 @option{-fschedule-insns2} or at @option{-O2} or higher.
7130
7131 @item -fsched-group-heuristic
7132 @opindex fsched-group-heuristic
7133 Enable the group heuristic in the scheduler. This heuristic favors
7134 the instruction that belongs to a schedule group. This is enabled
7135 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7136 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7137
7138 @item -fsched-critical-path-heuristic
7139 @opindex fsched-critical-path-heuristic
7140 Enable the critical-path heuristic in the scheduler. This heuristic favors
7141 instructions on the critical path. This is enabled by default when
7142 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7143 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7144
7145 @item -fsched-spec-insn-heuristic
7146 @opindex fsched-spec-insn-heuristic
7147 Enable the speculative instruction heuristic in the scheduler. This
7148 heuristic favors speculative instructions with greater dependency weakness.
7149 This is enabled by default when scheduling is enabled, i.e.@:
7150 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7151 or at @option{-O2} or higher.
7152
7153 @item -fsched-rank-heuristic
7154 @opindex fsched-rank-heuristic
7155 Enable the rank heuristic in the scheduler. This heuristic favors
7156 the instruction belonging to a basic block with greater size or frequency.
7157 This is enabled by default when scheduling is enabled, i.e.@:
7158 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7159 at @option{-O2} or higher.
7160
7161 @item -fsched-last-insn-heuristic
7162 @opindex fsched-last-insn-heuristic
7163 Enable the last-instruction heuristic in the scheduler. This heuristic
7164 favors the instruction that is less dependent on the last instruction
7165 scheduled. This is enabled by default when scheduling is enabled,
7166 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7167 at @option{-O2} or higher.
7168
7169 @item -fsched-dep-count-heuristic
7170 @opindex fsched-dep-count-heuristic
7171 Enable the dependent-count heuristic in the scheduler. This heuristic
7172 favors the instruction that has more instructions depending on it.
7173 This is enabled by default when scheduling is enabled, i.e.@:
7174 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7175 at @option{-O2} or higher.
7176
7177 @item -freschedule-modulo-scheduled-loops
7178 @opindex freschedule-modulo-scheduled-loops
7179 Modulo scheduling is performed before traditional scheduling. If a loop
7180 is modulo scheduled, later scheduling passes may change its schedule.
7181 Use this option to control that behavior.
7182
7183 @item -fselective-scheduling
7184 @opindex fselective-scheduling
7185 Schedule instructions using selective scheduling algorithm. Selective
7186 scheduling runs instead of the first scheduler pass.
7187
7188 @item -fselective-scheduling2
7189 @opindex fselective-scheduling2
7190 Schedule instructions using selective scheduling algorithm. Selective
7191 scheduling runs instead of the second scheduler pass.
7192
7193 @item -fsel-sched-pipelining
7194 @opindex fsel-sched-pipelining
7195 Enable software pipelining of innermost loops during selective scheduling.
7196 This option has no effect unless one of @option{-fselective-scheduling} or
7197 @option{-fselective-scheduling2} is turned on.
7198
7199 @item -fsel-sched-pipelining-outer-loops
7200 @opindex fsel-sched-pipelining-outer-loops
7201 When pipelining loops during selective scheduling, also pipeline outer loops.
7202 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7203
7204 @item -fsemantic-interposition
7205 @opindex fsemantic-interposition
7206 Some object formats, like ELF, allow interposing of symbols by the
7207 dynamic linker.
7208 This means that for symbols exported from the DSO, the compiler cannot perform
7209 interprocedural propagation, inlining and other optimizations in anticipation
7210 that the function or variable in question may change. While this feature is
7211 useful, for example, to rewrite memory allocation functions by a debugging
7212 implementation, it is expensive in the terms of code quality.
7213 With @option{-fno-semantic-interposition} the compiler assumes that
7214 if interposition happens for functions the overwriting function will have
7215 precisely the same semantics (and side effects).
7216 Similarly if interposition happens
7217 for variables, the constructor of the variable will be the same. The flag
7218 has no effect for functions explicitly declared inline
7219 (where it is never allowed for interposition to change semantics)
7220 and for symbols explicitly declared weak.
7221
7222 @item -fshrink-wrap
7223 @opindex fshrink-wrap
7224 Emit function prologues only before parts of the function that need it,
7225 rather than at the top of the function. This flag is enabled by default at
7226 @option{-O} and higher.
7227
7228 @item -fcaller-saves
7229 @opindex fcaller-saves
7230 Enable allocation of values to registers that are clobbered by
7231 function calls, by emitting extra instructions to save and restore the
7232 registers around such calls. Such allocation is done only when it
7233 seems to result in better code.
7234
7235 This option is always enabled by default on certain machines, usually
7236 those which have no call-preserved registers to use instead.
7237
7238 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7239
7240 @item -fcombine-stack-adjustments
7241 @opindex fcombine-stack-adjustments
7242 Tracks stack adjustments (pushes and pops) and stack memory references
7243 and then tries to find ways to combine them.
7244
7245 Enabled by default at @option{-O1} and higher.
7246
7247 @item -fipa-ra
7248 @opindex fipa-ra
7249 Use caller save registers for allocation if those registers are not used by
7250 any called function. In that case it is not necessary to save and restore
7251 them around calls. This is only possible if called functions are part of
7252 same compilation unit as current function and they are compiled before it.
7253
7254 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7255
7256 @item -fconserve-stack
7257 @opindex fconserve-stack
7258 Attempt to minimize stack usage. The compiler attempts to use less
7259 stack space, even if that makes the program slower. This option
7260 implies setting the @option{large-stack-frame} parameter to 100
7261 and the @option{large-stack-frame-growth} parameter to 400.
7262
7263 @item -ftree-reassoc
7264 @opindex ftree-reassoc
7265 Perform reassociation on trees. This flag is enabled by default
7266 at @option{-O} and higher.
7267
7268 @item -ftree-pre
7269 @opindex ftree-pre
7270 Perform partial redundancy elimination (PRE) on trees. This flag is
7271 enabled by default at @option{-O2} and @option{-O3}.
7272
7273 @item -ftree-partial-pre
7274 @opindex ftree-partial-pre
7275 Make partial redundancy elimination (PRE) more aggressive. This flag is
7276 enabled by default at @option{-O3}.
7277
7278 @item -ftree-forwprop
7279 @opindex ftree-forwprop
7280 Perform forward propagation on trees. This flag is enabled by default
7281 at @option{-O} and higher.
7282
7283 @item -ftree-fre
7284 @opindex ftree-fre
7285 Perform full redundancy elimination (FRE) on trees. The difference
7286 between FRE and PRE is that FRE only considers expressions
7287 that are computed on all paths leading to the redundant computation.
7288 This analysis is faster than PRE, though it exposes fewer redundancies.
7289 This flag is enabled by default at @option{-O} and higher.
7290
7291 @item -ftree-phiprop
7292 @opindex ftree-phiprop
7293 Perform hoisting of loads from conditional pointers on trees. This
7294 pass is enabled by default at @option{-O} and higher.
7295
7296 @item -fhoist-adjacent-loads
7297 @opindex fhoist-adjacent-loads
7298 Speculatively hoist loads from both branches of an if-then-else if the
7299 loads are from adjacent locations in the same structure and the target
7300 architecture has a conditional move instruction. This flag is enabled
7301 by default at @option{-O2} and higher.
7302
7303 @item -ftree-copy-prop
7304 @opindex ftree-copy-prop
7305 Perform copy propagation on trees. This pass eliminates unnecessary
7306 copy operations. This flag is enabled by default at @option{-O} and
7307 higher.
7308
7309 @item -fipa-pure-const
7310 @opindex fipa-pure-const
7311 Discover which functions are pure or constant.
7312 Enabled by default at @option{-O} and higher.
7313
7314 @item -fipa-reference
7315 @opindex fipa-reference
7316 Discover which static variables do not escape the
7317 compilation unit.
7318 Enabled by default at @option{-O} and higher.
7319
7320 @item -fipa-pta
7321 @opindex fipa-pta
7322 Perform interprocedural pointer analysis and interprocedural modification
7323 and reference analysis. This option can cause excessive memory and
7324 compile-time usage on large compilation units. It is not enabled by
7325 default at any optimization level.
7326
7327 @item -fipa-profile
7328 @opindex fipa-profile
7329 Perform interprocedural profile propagation. The functions called only from
7330 cold functions are marked as cold. Also functions executed once (such as
7331 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7332 functions and loop less parts of functions executed once are then optimized for
7333 size.
7334 Enabled by default at @option{-O} and higher.
7335
7336 @item -fipa-cp
7337 @opindex fipa-cp
7338 Perform interprocedural constant propagation.
7339 This optimization analyzes the program to determine when values passed
7340 to functions are constants and then optimizes accordingly.
7341 This optimization can substantially increase performance
7342 if the application has constants passed to functions.
7343 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7344
7345 @item -fipa-cp-clone
7346 @opindex fipa-cp-clone
7347 Perform function cloning to make interprocedural constant propagation stronger.
7348 When enabled, interprocedural constant propagation performs function cloning
7349 when externally visible function can be called with constant arguments.
7350 Because this optimization can create multiple copies of functions,
7351 it may significantly increase code size
7352 (see @option{--param ipcp-unit-growth=@var{value}}).
7353 This flag is enabled by default at @option{-O3}.
7354
7355 @item -fipa-cp-alignment
7356 @opindex -fipa-cp-alignment
7357 When enabled, this optimization propagates alignment of function
7358 parameters to support better vectorization and string operations.
7359
7360 This flag is enabled by default at @option{-O2} and @option{-Os}. It
7361 requires that @option{-fipa-cp} is enabled.
7362
7363 @item -fipa-icf
7364 @opindex fipa-icf
7365 Perform Identical Code Folding for functions and read-only variables.
7366 The optimization reduces code size and may disturb unwind stacks by replacing
7367 a function by equivalent one with a different name. The optimization works
7368 more effectively with link time optimization enabled.
7369
7370 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
7371 works on different levels and thus the optimizations are not same - there are
7372 equivalences that are found only by GCC and equivalences found only by Gold.
7373
7374 This flag is enabled by default at @option{-O2} and @option{-Os}.
7375
7376 @item -fisolate-erroneous-paths-dereference
7377 @opindex fisolate-erroneous-paths-dereference
7378 Detect paths that trigger erroneous or undefined behavior due to
7379 dereferencing a null pointer. Isolate those paths from the main control
7380 flow and turn the statement with erroneous or undefined behavior into a trap.
7381 This flag is enabled by default at @option{-O2} and higher and depends on
7382 @option{-fdelete-null-pointer-checks} also being enabled.
7383
7384 @item -fisolate-erroneous-paths-attribute
7385 @opindex fisolate-erroneous-paths-attribute
7386 Detect paths that trigger erroneous or undefined behavior due a null value
7387 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
7388 attribute. Isolate those paths from the main control flow and turn the
7389 statement with erroneous or undefined behavior into a trap. This is not
7390 currently enabled, but may be enabled by @option{-O2} in the future.
7391
7392 @item -ftree-sink
7393 @opindex ftree-sink
7394 Perform forward store motion on trees. This flag is
7395 enabled by default at @option{-O} and higher.
7396
7397 @item -ftree-bit-ccp
7398 @opindex ftree-bit-ccp
7399 Perform sparse conditional bit constant propagation on trees and propagate
7400 pointer alignment information.
7401 This pass only operates on local scalar variables and is enabled by default
7402 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7403
7404 @item -ftree-ccp
7405 @opindex ftree-ccp
7406 Perform sparse conditional constant propagation (CCP) on trees. This
7407 pass only operates on local scalar variables and is enabled by default
7408 at @option{-O} and higher.
7409
7410 @item -fssa-backprop
7411 @opindex fssa-backprop
7412 Propagate information about uses of a value up the definition chain
7413 in order to simplify the definitions. For example, this pass strips
7414 sign operations if the sign of a value never matters. The flag is
7415 enabled by default at @option{-O} and higher.
7416
7417 @item -fssa-phiopt
7418 @opindex fssa-phiopt
7419 Perform pattern matching on SSA PHI nodes to optimize conditional
7420 code. This pass is enabled by default at @option{-O} and higher.
7421
7422 @item -ftree-switch-conversion
7423 @opindex ftree-switch-conversion
7424 Perform conversion of simple initializations in a switch to
7425 initializations from a scalar array. This flag is enabled by default
7426 at @option{-O2} and higher.
7427
7428 @item -ftree-tail-merge
7429 @opindex ftree-tail-merge
7430 Look for identical code sequences. When found, replace one with a jump to the
7431 other. This optimization is known as tail merging or cross jumping. This flag
7432 is enabled by default at @option{-O2} and higher. The compilation time
7433 in this pass can
7434 be limited using @option{max-tail-merge-comparisons} parameter and
7435 @option{max-tail-merge-iterations} parameter.
7436
7437 @item -ftree-dce
7438 @opindex ftree-dce
7439 Perform dead code elimination (DCE) on trees. This flag is enabled by
7440 default at @option{-O} and higher.
7441
7442 @item -ftree-builtin-call-dce
7443 @opindex ftree-builtin-call-dce
7444 Perform conditional dead code elimination (DCE) for calls to built-in functions
7445 that may set @code{errno} but are otherwise side-effect free. This flag is
7446 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7447 specified.
7448
7449 @item -ftree-dominator-opts
7450 @opindex ftree-dominator-opts
7451 Perform a variety of simple scalar cleanups (constant/copy
7452 propagation, redundancy elimination, range propagation and expression
7453 simplification) based on a dominator tree traversal. This also
7454 performs jump threading (to reduce jumps to jumps). This flag is
7455 enabled by default at @option{-O} and higher.
7456
7457 @item -ftree-dse
7458 @opindex ftree-dse
7459 Perform dead store elimination (DSE) on trees. A dead store is a store into
7460 a memory location that is later overwritten by another store without
7461 any intervening loads. In this case the earlier store can be deleted. This
7462 flag is enabled by default at @option{-O} and higher.
7463
7464 @item -ftree-ch
7465 @opindex ftree-ch
7466 Perform loop header copying on trees. This is beneficial since it increases
7467 effectiveness of code motion optimizations. It also saves one jump. This flag
7468 is enabled by default at @option{-O} and higher. It is not enabled
7469 for @option{-Os}, since it usually increases code size.
7470
7471 @item -ftree-loop-optimize
7472 @opindex ftree-loop-optimize
7473 Perform loop optimizations on trees. This flag is enabled by default
7474 at @option{-O} and higher.
7475
7476 @item -ftree-loop-linear
7477 @itemx -floop-interchange
7478 @itemx -floop-strip-mine
7479 @itemx -floop-block
7480 @itemx -floop-unroll-and-jam
7481 @opindex ftree-loop-linear
7482 @opindex floop-interchange
7483 @opindex floop-strip-mine
7484 @opindex floop-block
7485 @opindex floop-unroll-and-jam
7486 Perform loop nest optimizations. Same as
7487 @option{-floop-nest-optimize}. To use this code transformation, GCC has
7488 to be configured with @option{--with-isl} to enable the Graphite loop
7489 transformation infrastructure.
7490
7491 @item -fgraphite-identity
7492 @opindex fgraphite-identity
7493 Enable the identity transformation for graphite. For every SCoP we generate
7494 the polyhedral representation and transform it back to gimple. Using
7495 @option{-fgraphite-identity} we can check the costs or benefits of the
7496 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
7497 are also performed by the code generator isl, like index splitting and
7498 dead code elimination in loops.
7499
7500 @item -floop-nest-optimize
7501 @opindex floop-nest-optimize
7502 Enable the isl based loop nest optimizer. This is a generic loop nest
7503 optimizer based on the Pluto optimization algorithms. It calculates a loop
7504 structure optimized for data-locality and parallelism. This option
7505 is experimental.
7506
7507 @item -floop-parallelize-all
7508 @opindex floop-parallelize-all
7509 Use the Graphite data dependence analysis to identify loops that can
7510 be parallelized. Parallelize all the loops that can be analyzed to
7511 not contain loop carried dependences without checking that it is
7512 profitable to parallelize the loops.
7513
7514 @item -ftree-coalesce-vars
7515 @opindex ftree-coalesce-vars
7516 While transforming the program out of the SSA representation, attempt to
7517 reduce copying by coalescing versions of different user-defined
7518 variables, instead of just compiler temporaries. This may severely
7519 limit the ability to debug an optimized program compiled with
7520 @option{-fno-var-tracking-assignments}. In the negated form, this flag
7521 prevents SSA coalescing of user variables. This option is enabled by
7522 default if optimization is enabled, and it does very little otherwise.
7523
7524 @item -ftree-loop-if-convert
7525 @opindex ftree-loop-if-convert
7526 Attempt to transform conditional jumps in the innermost loops to
7527 branch-less equivalents. The intent is to remove control-flow from
7528 the innermost loops in order to improve the ability of the
7529 vectorization pass to handle these loops. This is enabled by default
7530 if vectorization is enabled.
7531
7532 @item -ftree-loop-if-convert-stores
7533 @opindex ftree-loop-if-convert-stores
7534 Attempt to also if-convert conditional jumps containing memory writes.
7535 This transformation can be unsafe for multi-threaded programs as it
7536 transforms conditional memory writes into unconditional memory writes.
7537 For example,
7538 @smallexample
7539 for (i = 0; i < N; i++)
7540 if (cond)
7541 A[i] = expr;
7542 @end smallexample
7543 is transformed to
7544 @smallexample
7545 for (i = 0; i < N; i++)
7546 A[i] = cond ? expr : A[i];
7547 @end smallexample
7548 potentially producing data races.
7549
7550 @item -ftree-loop-distribution
7551 @opindex ftree-loop-distribution
7552 Perform loop distribution. This flag can improve cache performance on
7553 big loop bodies and allow further loop optimizations, like
7554 parallelization or vectorization, to take place. For example, the loop
7555 @smallexample
7556 DO I = 1, N
7557 A(I) = B(I) + C
7558 D(I) = E(I) * F
7559 ENDDO
7560 @end smallexample
7561 is transformed to
7562 @smallexample
7563 DO I = 1, N
7564 A(I) = B(I) + C
7565 ENDDO
7566 DO I = 1, N
7567 D(I) = E(I) * F
7568 ENDDO
7569 @end smallexample
7570
7571 @item -ftree-loop-distribute-patterns
7572 @opindex ftree-loop-distribute-patterns
7573 Perform loop distribution of patterns that can be code generated with
7574 calls to a library. This flag is enabled by default at @option{-O3}.
7575
7576 This pass distributes the initialization loops and generates a call to
7577 memset zero. For example, the loop
7578 @smallexample
7579 DO I = 1, N
7580 A(I) = 0
7581 B(I) = A(I) + I
7582 ENDDO
7583 @end smallexample
7584 is transformed to
7585 @smallexample
7586 DO I = 1, N
7587 A(I) = 0
7588 ENDDO
7589 DO I = 1, N
7590 B(I) = A(I) + I
7591 ENDDO
7592 @end smallexample
7593 and the initialization loop is transformed into a call to memset zero.
7594
7595 @item -ftree-loop-im
7596 @opindex ftree-loop-im
7597 Perform loop invariant motion on trees. This pass moves only invariants that
7598 are hard to handle at RTL level (function calls, operations that expand to
7599 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
7600 operands of conditions that are invariant out of the loop, so that we can use
7601 just trivial invariantness analysis in loop unswitching. The pass also includes
7602 store motion.
7603
7604 @item -ftree-loop-ivcanon
7605 @opindex ftree-loop-ivcanon
7606 Create a canonical counter for number of iterations in loops for which
7607 determining number of iterations requires complicated analysis. Later
7608 optimizations then may determine the number easily. Useful especially
7609 in connection with unrolling.
7610
7611 @item -fivopts
7612 @opindex fivopts
7613 Perform induction variable optimizations (strength reduction, induction
7614 variable merging and induction variable elimination) on trees.
7615
7616 @item -ftree-parallelize-loops=n
7617 @opindex ftree-parallelize-loops
7618 Parallelize loops, i.e., split their iteration space to run in n threads.
7619 This is only possible for loops whose iterations are independent
7620 and can be arbitrarily reordered. The optimization is only
7621 profitable on multiprocessor machines, for loops that are CPU-intensive,
7622 rather than constrained e.g.@: by memory bandwidth. This option
7623 implies @option{-pthread}, and thus is only supported on targets
7624 that have support for @option{-pthread}.
7625
7626 @item -ftree-pta
7627 @opindex ftree-pta
7628 Perform function-local points-to analysis on trees. This flag is
7629 enabled by default at @option{-O} and higher.
7630
7631 @item -ftree-sra
7632 @opindex ftree-sra
7633 Perform scalar replacement of aggregates. This pass replaces structure
7634 references with scalars to prevent committing structures to memory too
7635 early. This flag is enabled by default at @option{-O} and higher.
7636
7637 @item -ftree-ter
7638 @opindex ftree-ter
7639 Perform temporary expression replacement during the SSA->normal phase. Single
7640 use/single def temporaries are replaced at their use location with their
7641 defining expression. This results in non-GIMPLE code, but gives the expanders
7642 much more complex trees to work on resulting in better RTL generation. This is
7643 enabled by default at @option{-O} and higher.
7644
7645 @item -ftree-slsr
7646 @opindex ftree-slsr
7647 Perform straight-line strength reduction on trees. This recognizes related
7648 expressions involving multiplications and replaces them by less expensive
7649 calculations when possible. This is enabled by default at @option{-O} and
7650 higher.
7651
7652 @item -ftree-vectorize
7653 @opindex ftree-vectorize
7654 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
7655 and @option{-ftree-slp-vectorize} if not explicitly specified.
7656
7657 @item -ftree-loop-vectorize
7658 @opindex ftree-loop-vectorize
7659 Perform loop vectorization on trees. This flag is enabled by default at
7660 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7661
7662 @item -ftree-slp-vectorize
7663 @opindex ftree-slp-vectorize
7664 Perform basic block vectorization on trees. This flag is enabled by default at
7665 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7666
7667 @item -fvect-cost-model=@var{model}
7668 @opindex fvect-cost-model
7669 Alter the cost model used for vectorization. The @var{model} argument
7670 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
7671 With the @samp{unlimited} model the vectorized code-path is assumed
7672 to be profitable while with the @samp{dynamic} model a runtime check
7673 guards the vectorized code-path to enable it only for iteration
7674 counts that will likely execute faster than when executing the original
7675 scalar loop. The @samp{cheap} model disables vectorization of
7676 loops where doing so would be cost prohibitive for example due to
7677 required runtime checks for data dependence or alignment but otherwise
7678 is equal to the @samp{dynamic} model.
7679 The default cost model depends on other optimization flags and is
7680 either @samp{dynamic} or @samp{cheap}.
7681
7682 @item -fsimd-cost-model=@var{model}
7683 @opindex fsimd-cost-model
7684 Alter the cost model used for vectorization of loops marked with the OpenMP
7685 or Cilk Plus simd directive. The @var{model} argument should be one of
7686 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
7687 have the same meaning as described in @option{-fvect-cost-model} and by
7688 default a cost model defined with @option{-fvect-cost-model} is used.
7689
7690 @item -ftree-vrp
7691 @opindex ftree-vrp
7692 Perform Value Range Propagation on trees. This is similar to the
7693 constant propagation pass, but instead of values, ranges of values are
7694 propagated. This allows the optimizers to remove unnecessary range
7695 checks like array bound checks and null pointer checks. This is
7696 enabled by default at @option{-O2} and higher. Null pointer check
7697 elimination is only done if @option{-fdelete-null-pointer-checks} is
7698 enabled.
7699
7700 @item -fsplit-paths
7701 @opindex fsplit-paths
7702 Split paths leading to loop backedges. This can improve dead code
7703 elimination and common subexpression elimination. This is enabled by
7704 default at @option{-O2} and above.
7705
7706 @item -fsplit-ivs-in-unroller
7707 @opindex fsplit-ivs-in-unroller
7708 Enables expression of values of induction variables in later iterations
7709 of the unrolled loop using the value in the first iteration. This breaks
7710 long dependency chains, thus improving efficiency of the scheduling passes.
7711
7712 A combination of @option{-fweb} and CSE is often sufficient to obtain the
7713 same effect. However, that is not reliable in cases where the loop body
7714 is more complicated than a single basic block. It also does not work at all
7715 on some architectures due to restrictions in the CSE pass.
7716
7717 This optimization is enabled by default.
7718
7719 @item -fvariable-expansion-in-unroller
7720 @opindex fvariable-expansion-in-unroller
7721 With this option, the compiler creates multiple copies of some
7722 local variables when unrolling a loop, which can result in superior code.
7723
7724 @item -fpartial-inlining
7725 @opindex fpartial-inlining
7726 Inline parts of functions. This option has any effect only
7727 when inlining itself is turned on by the @option{-finline-functions}
7728 or @option{-finline-small-functions} options.
7729
7730 Enabled at level @option{-O2}.
7731
7732 @item -fpredictive-commoning
7733 @opindex fpredictive-commoning
7734 Perform predictive commoning optimization, i.e., reusing computations
7735 (especially memory loads and stores) performed in previous
7736 iterations of loops.
7737
7738 This option is enabled at level @option{-O3}.
7739
7740 @item -fprefetch-loop-arrays
7741 @opindex fprefetch-loop-arrays
7742 If supported by the target machine, generate instructions to prefetch
7743 memory to improve the performance of loops that access large arrays.
7744
7745 This option may generate better or worse code; results are highly
7746 dependent on the structure of loops within the source code.
7747
7748 Disabled at level @option{-Os}.
7749
7750 @item -fno-peephole
7751 @itemx -fno-peephole2
7752 @opindex fno-peephole
7753 @opindex fno-peephole2
7754 Disable any machine-specific peephole optimizations. The difference
7755 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
7756 are implemented in the compiler; some targets use one, some use the
7757 other, a few use both.
7758
7759 @option{-fpeephole} is enabled by default.
7760 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7761
7762 @item -fno-guess-branch-probability
7763 @opindex fno-guess-branch-probability
7764 Do not guess branch probabilities using heuristics.
7765
7766 GCC uses heuristics to guess branch probabilities if they are
7767 not provided by profiling feedback (@option{-fprofile-arcs}). These
7768 heuristics are based on the control flow graph. If some branch probabilities
7769 are specified by @code{__builtin_expect}, then the heuristics are
7770 used to guess branch probabilities for the rest of the control flow graph,
7771 taking the @code{__builtin_expect} info into account. The interactions
7772 between the heuristics and @code{__builtin_expect} can be complex, and in
7773 some cases, it may be useful to disable the heuristics so that the effects
7774 of @code{__builtin_expect} are easier to understand.
7775
7776 The default is @option{-fguess-branch-probability} at levels
7777 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7778
7779 @item -freorder-blocks
7780 @opindex freorder-blocks
7781 Reorder basic blocks in the compiled function in order to reduce number of
7782 taken branches and improve code locality.
7783
7784 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7785
7786 @item -freorder-blocks-algorithm=@var{algorithm}
7787 @opindex freorder-blocks-algorithm
7788 Use the specified algorithm for basic block reordering. The
7789 @var{algorithm} argument can be @samp{simple}, which does not increase
7790 code size (except sometimes due to secondary effects like alignment),
7791 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
7792 put all often executed code together, minimizing the number of branches
7793 executed by making extra copies of code.
7794
7795 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
7796 @samp{stc} at levels @option{-O2}, @option{-O3}.
7797
7798 @item -freorder-blocks-and-partition
7799 @opindex freorder-blocks-and-partition
7800 In addition to reordering basic blocks in the compiled function, in order
7801 to reduce number of taken branches, partitions hot and cold basic blocks
7802 into separate sections of the assembly and @file{.o} files, to improve
7803 paging and cache locality performance.
7804
7805 This optimization is automatically turned off in the presence of
7806 exception handling, for linkonce sections, for functions with a user-defined
7807 section attribute and on any architecture that does not support named
7808 sections.
7809
7810 Enabled for x86 at levels @option{-O2}, @option{-O3}.
7811
7812 @item -freorder-functions
7813 @opindex freorder-functions
7814 Reorder functions in the object file in order to
7815 improve code locality. This is implemented by using special
7816 subsections @code{.text.hot} for most frequently executed functions and
7817 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
7818 the linker so object file format must support named sections and linker must
7819 place them in a reasonable way.
7820
7821 Also profile feedback must be available to make this option effective. See
7822 @option{-fprofile-arcs} for details.
7823
7824 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7825
7826 @item -fstrict-aliasing
7827 @opindex fstrict-aliasing
7828 Allow the compiler to assume the strictest aliasing rules applicable to
7829 the language being compiled. For C (and C++), this activates
7830 optimizations based on the type of expressions. In particular, an
7831 object of one type is assumed never to reside at the same address as an
7832 object of a different type, unless the types are almost the same. For
7833 example, an @code{unsigned int} can alias an @code{int}, but not a
7834 @code{void*} or a @code{double}. A character type may alias any other
7835 type.
7836
7837 @anchor{Type-punning}Pay special attention to code like this:
7838 @smallexample
7839 union a_union @{
7840 int i;
7841 double d;
7842 @};
7843
7844 int f() @{
7845 union a_union t;
7846 t.d = 3.0;
7847 return t.i;
7848 @}
7849 @end smallexample
7850 The practice of reading from a different union member than the one most
7851 recently written to (called ``type-punning'') is common. Even with
7852 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
7853 is accessed through the union type. So, the code above works as
7854 expected. @xref{Structures unions enumerations and bit-fields
7855 implementation}. However, this code might not:
7856 @smallexample
7857 int f() @{
7858 union a_union t;
7859 int* ip;
7860 t.d = 3.0;
7861 ip = &t.i;
7862 return *ip;
7863 @}
7864 @end smallexample
7865
7866 Similarly, access by taking the address, casting the resulting pointer
7867 and dereferencing the result has undefined behavior, even if the cast
7868 uses a union type, e.g.:
7869 @smallexample
7870 int f() @{
7871 double d = 3.0;
7872 return ((union a_union *) &d)->i;
7873 @}
7874 @end smallexample
7875
7876 The @option{-fstrict-aliasing} option is enabled at levels
7877 @option{-O2}, @option{-O3}, @option{-Os}.
7878
7879 @item -fstrict-overflow
7880 @opindex fstrict-overflow
7881 Allow the compiler to assume strict signed overflow rules, depending
7882 on the language being compiled. For C (and C++) this means that
7883 overflow when doing arithmetic with signed numbers is undefined, which
7884 means that the compiler may assume that it does not happen. This
7885 permits various optimizations. For example, the compiler assumes
7886 that an expression like @code{i + 10 > i} is always true for
7887 signed @code{i}. This assumption is only valid if signed overflow is
7888 undefined, as the expression is false if @code{i + 10} overflows when
7889 using twos complement arithmetic. When this option is in effect any
7890 attempt to determine whether an operation on signed numbers
7891 overflows must be written carefully to not actually involve overflow.
7892
7893 This option also allows the compiler to assume strict pointer
7894 semantics: given a pointer to an object, if adding an offset to that
7895 pointer does not produce a pointer to the same object, the addition is
7896 undefined. This permits the compiler to conclude that @code{p + u >
7897 p} is always true for a pointer @code{p} and unsigned integer
7898 @code{u}. This assumption is only valid because pointer wraparound is
7899 undefined, as the expression is false if @code{p + u} overflows using
7900 twos complement arithmetic.
7901
7902 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
7903 that integer signed overflow is fully defined: it wraps. When
7904 @option{-fwrapv} is used, there is no difference between
7905 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
7906 integers. With @option{-fwrapv} certain types of overflow are
7907 permitted. For example, if the compiler gets an overflow when doing
7908 arithmetic on constants, the overflowed value can still be used with
7909 @option{-fwrapv}, but not otherwise.
7910
7911 The @option{-fstrict-overflow} option is enabled at levels
7912 @option{-O2}, @option{-O3}, @option{-Os}.
7913
7914 @item -falign-functions
7915 @itemx -falign-functions=@var{n}
7916 @opindex falign-functions
7917 Align the start of functions to the next power-of-two greater than
7918 @var{n}, skipping up to @var{n} bytes. For instance,
7919 @option{-falign-functions=32} aligns functions to the next 32-byte
7920 boundary, but @option{-falign-functions=24} aligns to the next
7921 32-byte boundary only if this can be done by skipping 23 bytes or less.
7922
7923 @option{-fno-align-functions} and @option{-falign-functions=1} are
7924 equivalent and mean that functions are not aligned.
7925
7926 Some assemblers only support this flag when @var{n} is a power of two;
7927 in that case, it is rounded up.
7928
7929 If @var{n} is not specified or is zero, use a machine-dependent default.
7930
7931 Enabled at levels @option{-O2}, @option{-O3}.
7932
7933 @item -falign-labels
7934 @itemx -falign-labels=@var{n}
7935 @opindex falign-labels
7936 Align all branch targets to a power-of-two boundary, skipping up to
7937 @var{n} bytes like @option{-falign-functions}. This option can easily
7938 make code slower, because it must insert dummy operations for when the
7939 branch target is reached in the usual flow of the code.
7940
7941 @option{-fno-align-labels} and @option{-falign-labels=1} are
7942 equivalent and mean that labels are not aligned.
7943
7944 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
7945 are greater than this value, then their values are used instead.
7946
7947 If @var{n} is not specified or is zero, use a machine-dependent default
7948 which is very likely to be @samp{1}, meaning no alignment.
7949
7950 Enabled at levels @option{-O2}, @option{-O3}.
7951
7952 @item -falign-loops
7953 @itemx -falign-loops=@var{n}
7954 @opindex falign-loops
7955 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
7956 like @option{-falign-functions}. If the loops are
7957 executed many times, this makes up for any execution of the dummy
7958 operations.
7959
7960 @option{-fno-align-loops} and @option{-falign-loops=1} are
7961 equivalent and mean that loops are not aligned.
7962
7963 If @var{n} is not specified or is zero, use a machine-dependent default.
7964
7965 Enabled at levels @option{-O2}, @option{-O3}.
7966
7967 @item -falign-jumps
7968 @itemx -falign-jumps=@var{n}
7969 @opindex falign-jumps
7970 Align branch targets to a power-of-two boundary, for branch targets
7971 where the targets can only be reached by jumping, skipping up to @var{n}
7972 bytes like @option{-falign-functions}. In this case, no dummy operations
7973 need be executed.
7974
7975 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
7976 equivalent and mean that loops are not aligned.
7977
7978 If @var{n} is not specified or is zero, use a machine-dependent default.
7979
7980 Enabled at levels @option{-O2}, @option{-O3}.
7981
7982 @item -funit-at-a-time
7983 @opindex funit-at-a-time
7984 This option is left for compatibility reasons. @option{-funit-at-a-time}
7985 has no effect, while @option{-fno-unit-at-a-time} implies
7986 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
7987
7988 Enabled by default.
7989
7990 @item -fno-toplevel-reorder
7991 @opindex fno-toplevel-reorder
7992 Do not reorder top-level functions, variables, and @code{asm}
7993 statements. Output them in the same order that they appear in the
7994 input file. When this option is used, unreferenced static variables
7995 are not removed. This option is intended to support existing code
7996 that relies on a particular ordering. For new code, it is better to
7997 use attributes when possible.
7998
7999 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8000 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8001 targets.
8002
8003 @item -fweb
8004 @opindex fweb
8005 Constructs webs as commonly used for register allocation purposes and assign
8006 each web individual pseudo register. This allows the register allocation pass
8007 to operate on pseudos directly, but also strengthens several other optimization
8008 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8009 however, make debugging impossible, since variables no longer stay in a
8010 ``home register''.
8011
8012 Enabled by default with @option{-funroll-loops}.
8013
8014 @item -fwhole-program
8015 @opindex fwhole-program
8016 Assume that the current compilation unit represents the whole program being
8017 compiled. All public functions and variables with the exception of @code{main}
8018 and those merged by attribute @code{externally_visible} become static functions
8019 and in effect are optimized more aggressively by interprocedural optimizers.
8020
8021 This option should not be used in combination with @option{-flto}.
8022 Instead relying on a linker plugin should provide safer and more precise
8023 information.
8024
8025 @item -flto[=@var{n}]
8026 @opindex flto
8027 This option runs the standard link-time optimizer. When invoked
8028 with source code, it generates GIMPLE (one of GCC's internal
8029 representations) and writes it to special ELF sections in the object
8030 file. When the object files are linked together, all the function
8031 bodies are read from these ELF sections and instantiated as if they
8032 had been part of the same translation unit.
8033
8034 To use the link-time optimizer, @option{-flto} and optimization
8035 options should be specified at compile time and during the final link.
8036 It is recommended that you compile all the files participating in the
8037 same link with the same options and also specify those options at
8038 link time.
8039 For example:
8040
8041 @smallexample
8042 gcc -c -O2 -flto foo.c
8043 gcc -c -O2 -flto bar.c
8044 gcc -o myprog -flto -O2 foo.o bar.o
8045 @end smallexample
8046
8047 The first two invocations to GCC save a bytecode representation
8048 of GIMPLE into special ELF sections inside @file{foo.o} and
8049 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8050 @file{foo.o} and @file{bar.o}, merges the two files into a single
8051 internal image, and compiles the result as usual. Since both
8052 @file{foo.o} and @file{bar.o} are merged into a single image, this
8053 causes all the interprocedural analyses and optimizations in GCC to
8054 work across the two files as if they were a single one. This means,
8055 for example, that the inliner is able to inline functions in
8056 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8057
8058 Another (simpler) way to enable link-time optimization is:
8059
8060 @smallexample
8061 gcc -o myprog -flto -O2 foo.c bar.c
8062 @end smallexample
8063
8064 The above generates bytecode for @file{foo.c} and @file{bar.c},
8065 merges them together into a single GIMPLE representation and optimizes
8066 them as usual to produce @file{myprog}.
8067
8068 The only important thing to keep in mind is that to enable link-time
8069 optimizations you need to use the GCC driver to perform the link step.
8070 GCC then automatically performs link-time optimization if any of the
8071 objects involved were compiled with the @option{-flto} command-line option.
8072 You generally
8073 should specify the optimization options to be used for link-time
8074 optimization though GCC tries to be clever at guessing an
8075 optimization level to use from the options used at compile time
8076 if you fail to specify one at link time. You can always override
8077 the automatic decision to do link-time optimization at link time
8078 by passing @option{-fno-lto} to the link command.
8079
8080 To make whole program optimization effective, it is necessary to make
8081 certain whole program assumptions. The compiler needs to know
8082 what functions and variables can be accessed by libraries and runtime
8083 outside of the link-time optimized unit. When supported by the linker,
8084 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8085 to the compiler about used and externally visible symbols. When
8086 the linker plugin is not available, @option{-fwhole-program} should be
8087 used to allow the compiler to make these assumptions, which leads
8088 to more aggressive optimization decisions.
8089
8090 When @option{-fuse-linker-plugin} is not enabled, when a file is
8091 compiled with @option{-flto}, the generated object file is larger than
8092 a regular object file because it contains GIMPLE bytecodes and the usual
8093 final code (see @option{-ffat-lto-objects}. This means that
8094 object files with LTO information can be linked as normal object
8095 files; if @option{-fno-lto} is passed to the linker, no
8096 interprocedural optimizations are applied. Note that when
8097 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
8098 but you cannot perform a regular, non-LTO link on them.
8099
8100 Additionally, the optimization flags used to compile individual files
8101 are not necessarily related to those used at link time. For instance,
8102
8103 @smallexample
8104 gcc -c -O0 -ffat-lto-objects -flto foo.c
8105 gcc -c -O0 -ffat-lto-objects -flto bar.c
8106 gcc -o myprog -O3 foo.o bar.o
8107 @end smallexample
8108
8109 This produces individual object files with unoptimized assembler
8110 code, but the resulting binary @file{myprog} is optimized at
8111 @option{-O3}. If, instead, the final binary is generated with
8112 @option{-fno-lto}, then @file{myprog} is not optimized.
8113
8114 When producing the final binary, GCC only
8115 applies link-time optimizations to those files that contain bytecode.
8116 Therefore, you can mix and match object files and libraries with
8117 GIMPLE bytecodes and final object code. GCC automatically selects
8118 which files to optimize in LTO mode and which files to link without
8119 further processing.
8120
8121 There are some code generation flags preserved by GCC when
8122 generating bytecodes, as they need to be used during the final link
8123 stage. Generally options specified at link time override those
8124 specified at compile time.
8125
8126 If you do not specify an optimization level option @option{-O} at
8127 link time, then GCC uses the highest optimization level
8128 used when compiling the object files.
8129
8130 Currently, the following options and their settings are taken from
8131 the first object file that explicitly specifies them:
8132 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8133 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8134 and all the @option{-m} target flags.
8135
8136 Certain ABI-changing flags are required to match in all compilation units,
8137 and trying to override this at link time with a conflicting value
8138 is ignored. This includes options such as @option{-freg-struct-return}
8139 and @option{-fpcc-struct-return}.
8140
8141 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8142 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8143 are passed through to the link stage and merged conservatively for
8144 conflicting translation units. Specifically
8145 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8146 precedence; and for example @option{-ffp-contract=off} takes precedence
8147 over @option{-ffp-contract=fast}. You can override them at link time.
8148
8149 If LTO encounters objects with C linkage declared with incompatible
8150 types in separate translation units to be linked together (undefined
8151 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8152 issued. The behavior is still undefined at run time. Similar
8153 diagnostics may be raised for other languages.
8154
8155 Another feature of LTO is that it is possible to apply interprocedural
8156 optimizations on files written in different languages:
8157
8158 @smallexample
8159 gcc -c -flto foo.c
8160 g++ -c -flto bar.cc
8161 gfortran -c -flto baz.f90
8162 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8163 @end smallexample
8164
8165 Notice that the final link is done with @command{g++} to get the C++
8166 runtime libraries and @option{-lgfortran} is added to get the Fortran
8167 runtime libraries. In general, when mixing languages in LTO mode, you
8168 should use the same link command options as when mixing languages in a
8169 regular (non-LTO) compilation.
8170
8171 If object files containing GIMPLE bytecode are stored in a library archive, say
8172 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8173 are using a linker with plugin support. To create static libraries suitable
8174 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8175 and @command{ranlib};
8176 to show the symbols of object files with GIMPLE bytecode, use
8177 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8178 and @command{nm} have been compiled with plugin support. At link time, use the the
8179 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8180 the LTO optimization process:
8181
8182 @smallexample
8183 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8184 @end smallexample
8185
8186 With the linker plugin enabled, the linker extracts the needed
8187 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8188 to make them part of the aggregated GIMPLE image to be optimized.
8189
8190 If you are not using a linker with plugin support and/or do not
8191 enable the linker plugin, then the objects inside @file{libfoo.a}
8192 are extracted and linked as usual, but they do not participate
8193 in the LTO optimization process. In order to make a static library suitable
8194 for both LTO optimization and usual linkage, compile its object files with
8195 @option{-flto} @option{-ffat-lto-objects}.
8196
8197 Link-time optimizations do not require the presence of the whole program to
8198 operate. If the program does not require any symbols to be exported, it is
8199 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8200 the interprocedural optimizers to use more aggressive assumptions which may
8201 lead to improved optimization opportunities.
8202 Use of @option{-fwhole-program} is not needed when linker plugin is
8203 active (see @option{-fuse-linker-plugin}).
8204
8205 The current implementation of LTO makes no
8206 attempt to generate bytecode that is portable between different
8207 types of hosts. The bytecode files are versioned and there is a
8208 strict version check, so bytecode files generated in one version of
8209 GCC do not work with an older or newer version of GCC.
8210
8211 Link-time optimization does not work well with generation of debugging
8212 information. Combining @option{-flto} with
8213 @option{-g} is currently experimental and expected to produce unexpected
8214 results.
8215
8216 If you specify the optional @var{n}, the optimization and code
8217 generation done at link time is executed in parallel using @var{n}
8218 parallel jobs by utilizing an installed @command{make} program. The
8219 environment variable @env{MAKE} may be used to override the program
8220 used. The default value for @var{n} is 1.
8221
8222 You can also specify @option{-flto=jobserver} to use GNU make's
8223 job server mode to determine the number of parallel jobs. This
8224 is useful when the Makefile calling GCC is already executing in parallel.
8225 You must prepend a @samp{+} to the command recipe in the parent Makefile
8226 for this to work. This option likely only works if @env{MAKE} is
8227 GNU make.
8228
8229 @item -flto-partition=@var{alg}
8230 @opindex flto-partition
8231 Specify the partitioning algorithm used by the link-time optimizer.
8232 The value is either @samp{1to1} to specify a partitioning mirroring
8233 the original source files or @samp{balanced} to specify partitioning
8234 into equally sized chunks (whenever possible) or @samp{max} to create
8235 new partition for every symbol where possible. Specifying @samp{none}
8236 as an algorithm disables partitioning and streaming completely.
8237 The default value is @samp{balanced}. While @samp{1to1} can be used
8238 as an workaround for various code ordering issues, the @samp{max}
8239 partitioning is intended for internal testing only.
8240 The value @samp{one} specifies that exactly one partition should be
8241 used while the value @samp{none} bypasses partitioning and executes
8242 the link-time optimization step directly from the WPA phase.
8243
8244 @item -flto-odr-type-merging
8245 @opindex flto-odr-type-merging
8246 Enable streaming of mangled types names of C++ types and their unification
8247 at link time. This increases size of LTO object files, but enables
8248 diagnostics about One Definition Rule violations.
8249
8250 @item -flto-compression-level=@var{n}
8251 @opindex flto-compression-level
8252 This option specifies the level of compression used for intermediate
8253 language written to LTO object files, and is only meaningful in
8254 conjunction with LTO mode (@option{-flto}). Valid
8255 values are 0 (no compression) to 9 (maximum compression). Values
8256 outside this range are clamped to either 0 or 9. If the option is not
8257 given, a default balanced compression setting is used.
8258
8259 @item -fuse-linker-plugin
8260 @opindex fuse-linker-plugin
8261 Enables the use of a linker plugin during link-time optimization. This
8262 option relies on plugin support in the linker, which is available in gold
8263 or in GNU ld 2.21 or newer.
8264
8265 This option enables the extraction of object files with GIMPLE bytecode out
8266 of library archives. This improves the quality of optimization by exposing
8267 more code to the link-time optimizer. This information specifies what
8268 symbols can be accessed externally (by non-LTO object or during dynamic
8269 linking). Resulting code quality improvements on binaries (and shared
8270 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
8271 See @option{-flto} for a description of the effect of this flag and how to
8272 use it.
8273
8274 This option is enabled by default when LTO support in GCC is enabled
8275 and GCC was configured for use with
8276 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8277
8278 @item -ffat-lto-objects
8279 @opindex ffat-lto-objects
8280 Fat LTO objects are object files that contain both the intermediate language
8281 and the object code. This makes them usable for both LTO linking and normal
8282 linking. This option is effective only when compiling with @option{-flto}
8283 and is ignored at link time.
8284
8285 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8286 requires the complete toolchain to be aware of LTO. It requires a linker with
8287 linker plugin support for basic functionality. Additionally,
8288 @command{nm}, @command{ar} and @command{ranlib}
8289 need to support linker plugins to allow a full-featured build environment
8290 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
8291 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8292 to these tools. With non fat LTO makefiles need to be modified to use them.
8293
8294 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
8295 support.
8296
8297 @item -fcompare-elim
8298 @opindex fcompare-elim
8299 After register allocation and post-register allocation instruction splitting,
8300 identify arithmetic instructions that compute processor flags similar to a
8301 comparison operation based on that arithmetic. If possible, eliminate the
8302 explicit comparison operation.
8303
8304 This pass only applies to certain targets that cannot explicitly represent
8305 the comparison operation before register allocation is complete.
8306
8307 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8308
8309 @item -fcprop-registers
8310 @opindex fcprop-registers
8311 After register allocation and post-register allocation instruction splitting,
8312 perform a copy-propagation pass to try to reduce scheduling dependencies
8313 and occasionally eliminate the copy.
8314
8315 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8316
8317 @item -fprofile-correction
8318 @opindex fprofile-correction
8319 Profiles collected using an instrumented binary for multi-threaded programs may
8320 be inconsistent due to missed counter updates. When this option is specified,
8321 GCC uses heuristics to correct or smooth out such inconsistencies. By
8322 default, GCC emits an error message when an inconsistent profile is detected.
8323
8324 @item -fprofile-use
8325 @itemx -fprofile-use=@var{path}
8326 @opindex fprofile-use
8327 Enable profile feedback-directed optimizations,
8328 and the following optimizations
8329 which are generally profitable only with profile feedback available:
8330 @option{-fbranch-probabilities}, @option{-fvpt},
8331 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8332 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
8333
8334 Before you can use this option, you must first generate profiling information.
8335 @xref{Optimize Options}, for information about the @option{-fprofile-generate}
8336 option.
8337
8338 By default, GCC emits an error message if the feedback profiles do not
8339 match the source code. This error can be turned into a warning by using
8340 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8341 code.
8342
8343 If @var{path} is specified, GCC looks at the @var{path} to find
8344 the profile feedback data files. See @option{-fprofile-dir}.
8345
8346 @item -fauto-profile
8347 @itemx -fauto-profile=@var{path}
8348 @opindex fauto-profile
8349 Enable sampling-based feedback-directed optimizations,
8350 and the following optimizations
8351 which are generally profitable only with profile feedback available:
8352 @option{-fbranch-probabilities}, @option{-fvpt},
8353 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8354 @option{-ftree-vectorize},
8355 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
8356 @option{-fpredictive-commoning}, @option{-funswitch-loops},
8357 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
8358
8359 @var{path} is the name of a file containing AutoFDO profile information.
8360 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
8361
8362 Producing an AutoFDO profile data file requires running your program
8363 with the @command{perf} utility on a supported GNU/Linux target system.
8364 For more information, see @uref{https://perf.wiki.kernel.org/}.
8365
8366 E.g.
8367 @smallexample
8368 perf record -e br_inst_retired:near_taken -b -o perf.data \
8369 -- your_program
8370 @end smallexample
8371
8372 Then use the @command{create_gcov} tool to convert the raw profile data
8373 to a format that can be used by GCC.@ You must also supply the
8374 unstripped binary for your program to this tool.
8375 See @uref{https://github.com/google/autofdo}.
8376
8377 E.g.
8378 @smallexample
8379 create_gcov --binary=your_program.unstripped --profile=perf.data \
8380 --gcov=profile.afdo
8381 @end smallexample
8382 @end table
8383
8384 The following options control compiler behavior regarding floating-point
8385 arithmetic. These options trade off between speed and
8386 correctness. All must be specifically enabled.
8387
8388 @table @gcctabopt
8389 @item -ffloat-store
8390 @opindex ffloat-store
8391 Do not store floating-point variables in registers, and inhibit other
8392 options that might change whether a floating-point value is taken from a
8393 register or memory.
8394
8395 @cindex floating-point precision
8396 This option prevents undesirable excess precision on machines such as
8397 the 68000 where the floating registers (of the 68881) keep more
8398 precision than a @code{double} is supposed to have. Similarly for the
8399 x86 architecture. For most programs, the excess precision does only
8400 good, but a few programs rely on the precise definition of IEEE floating
8401 point. Use @option{-ffloat-store} for such programs, after modifying
8402 them to store all pertinent intermediate computations into variables.
8403
8404 @item -fexcess-precision=@var{style}
8405 @opindex fexcess-precision
8406 This option allows further control over excess precision on machines
8407 where floating-point registers have more precision than the IEEE
8408 @code{float} and @code{double} types and the processor does not
8409 support operations rounding to those types. By default,
8410 @option{-fexcess-precision=fast} is in effect; this means that
8411 operations are carried out in the precision of the registers and that
8412 it is unpredictable when rounding to the types specified in the source
8413 code takes place. When compiling C, if
8414 @option{-fexcess-precision=standard} is specified then excess
8415 precision follows the rules specified in ISO C99; in particular,
8416 both casts and assignments cause values to be rounded to their
8417 semantic types (whereas @option{-ffloat-store} only affects
8418 assignments). This option is enabled by default for C if a strict
8419 conformance option such as @option{-std=c99} is used.
8420
8421 @opindex mfpmath
8422 @option{-fexcess-precision=standard} is not implemented for languages
8423 other than C, and has no effect if
8424 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8425 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8426 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8427 semantics apply without excess precision, and in the latter, rounding
8428 is unpredictable.
8429
8430 @item -ffast-math
8431 @opindex ffast-math
8432 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8433 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8434 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8435
8436 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8437
8438 This option is not turned on by any @option{-O} option besides
8439 @option{-Ofast} since it can result in incorrect output for programs
8440 that depend on an exact implementation of IEEE or ISO rules/specifications
8441 for math functions. It may, however, yield faster code for programs
8442 that do not require the guarantees of these specifications.
8443
8444 @item -fno-math-errno
8445 @opindex fno-math-errno
8446 Do not set @code{errno} after calling math functions that are executed
8447 with a single instruction, e.g., @code{sqrt}. A program that relies on
8448 IEEE exceptions for math error handling may want to use this flag
8449 for speed while maintaining IEEE arithmetic compatibility.
8450
8451 This option is not turned on by any @option{-O} option since
8452 it can result in incorrect output for programs that depend on
8453 an exact implementation of IEEE or ISO rules/specifications for
8454 math functions. It may, however, yield faster code for programs
8455 that do not require the guarantees of these specifications.
8456
8457 The default is @option{-fmath-errno}.
8458
8459 On Darwin systems, the math library never sets @code{errno}. There is
8460 therefore no reason for the compiler to consider the possibility that
8461 it might, and @option{-fno-math-errno} is the default.
8462
8463 @item -funsafe-math-optimizations
8464 @opindex funsafe-math-optimizations
8465
8466 Allow optimizations for floating-point arithmetic that (a) assume
8467 that arguments and results are valid and (b) may violate IEEE or
8468 ANSI standards. When used at link time, it may include libraries
8469 or startup files that change the default FPU control word or other
8470 similar optimizations.
8471
8472 This option is not turned on by any @option{-O} option since
8473 it can result in incorrect output for programs that depend on
8474 an exact implementation of IEEE or ISO rules/specifications for
8475 math functions. It may, however, yield faster code for programs
8476 that do not require the guarantees of these specifications.
8477 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
8478 @option{-fassociative-math} and @option{-freciprocal-math}.
8479
8480 The default is @option{-fno-unsafe-math-optimizations}.
8481
8482 @item -fassociative-math
8483 @opindex fassociative-math
8484
8485 Allow re-association of operands in series of floating-point operations.
8486 This violates the ISO C and C++ language standard by possibly changing
8487 computation result. NOTE: re-ordering may change the sign of zero as
8488 well as ignore NaNs and inhibit or create underflow or overflow (and
8489 thus cannot be used on code that relies on rounding behavior like
8490 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
8491 and thus may not be used when ordered comparisons are required.
8492 This option requires that both @option{-fno-signed-zeros} and
8493 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
8494 much sense with @option{-frounding-math}. For Fortran the option
8495 is automatically enabled when both @option{-fno-signed-zeros} and
8496 @option{-fno-trapping-math} are in effect.
8497
8498 The default is @option{-fno-associative-math}.
8499
8500 @item -freciprocal-math
8501 @opindex freciprocal-math
8502
8503 Allow the reciprocal of a value to be used instead of dividing by
8504 the value if this enables optimizations. For example @code{x / y}
8505 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
8506 is subject to common subexpression elimination. Note that this loses
8507 precision and increases the number of flops operating on the value.
8508
8509 The default is @option{-fno-reciprocal-math}.
8510
8511 @item -ffinite-math-only
8512 @opindex ffinite-math-only
8513 Allow optimizations for floating-point arithmetic that assume
8514 that arguments and results are not NaNs or +-Infs.
8515
8516 This option is not turned on by any @option{-O} option since
8517 it can result in incorrect output for programs that depend on
8518 an exact implementation of IEEE or ISO rules/specifications for
8519 math functions. It may, however, yield faster code for programs
8520 that do not require the guarantees of these specifications.
8521
8522 The default is @option{-fno-finite-math-only}.
8523
8524 @item -fno-signed-zeros
8525 @opindex fno-signed-zeros
8526 Allow optimizations for floating-point arithmetic that ignore the
8527 signedness of zero. IEEE arithmetic specifies the behavior of
8528 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
8529 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
8530 This option implies that the sign of a zero result isn't significant.
8531
8532 The default is @option{-fsigned-zeros}.
8533
8534 @item -fno-trapping-math
8535 @opindex fno-trapping-math
8536 Compile code assuming that floating-point operations cannot generate
8537 user-visible traps. These traps include division by zero, overflow,
8538 underflow, inexact result and invalid operation. This option requires
8539 that @option{-fno-signaling-nans} be in effect. Setting this option may
8540 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
8541
8542 This option should never be turned on by any @option{-O} option since
8543 it can result in incorrect output for programs that depend on
8544 an exact implementation of IEEE or ISO rules/specifications for
8545 math functions.
8546
8547 The default is @option{-ftrapping-math}.
8548
8549 @item -frounding-math
8550 @opindex frounding-math
8551 Disable transformations and optimizations that assume default floating-point
8552 rounding behavior. This is round-to-zero for all floating point
8553 to integer conversions, and round-to-nearest for all other arithmetic
8554 truncations. This option should be specified for programs that change
8555 the FP rounding mode dynamically, or that may be executed with a
8556 non-default rounding mode. This option disables constant folding of
8557 floating-point expressions at compile time (which may be affected by
8558 rounding mode) and arithmetic transformations that are unsafe in the
8559 presence of sign-dependent rounding modes.
8560
8561 The default is @option{-fno-rounding-math}.
8562
8563 This option is experimental and does not currently guarantee to
8564 disable all GCC optimizations that are affected by rounding mode.
8565 Future versions of GCC may provide finer control of this setting
8566 using C99's @code{FENV_ACCESS} pragma. This command-line option
8567 will be used to specify the default state for @code{FENV_ACCESS}.
8568
8569 @item -fsignaling-nans
8570 @opindex fsignaling-nans
8571 Compile code assuming that IEEE signaling NaNs may generate user-visible
8572 traps during floating-point operations. Setting this option disables
8573 optimizations that may change the number of exceptions visible with
8574 signaling NaNs. This option implies @option{-ftrapping-math}.
8575
8576 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
8577 be defined.
8578
8579 The default is @option{-fno-signaling-nans}.
8580
8581 This option is experimental and does not currently guarantee to
8582 disable all GCC optimizations that affect signaling NaN behavior.
8583
8584 @item -fno-fp-int-builtin-inexact
8585 @opindex fno-fp-int-builtin-inexact
8586 Do not allow the built-in functions @code{ceil}, @code{floor},
8587 @code{round} and @code{trunc}, and their @code{float} and @code{long
8588 double} variants, to generate code that raises the ``inexact''
8589 floating-point exception for noninteger arguments. ISO C99 and C11
8590 allow these functions to raise the ``inexact'' exception, but ISO/IEC
8591 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
8592 functions to do so.
8593
8594 The default is @option{-ffp-int-builtin-inexact}, allowing the
8595 exception to be raised. This option does nothing unless
8596 @option{-ftrapping-math} is in effect.
8597
8598 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
8599 generate a call to a library function then the ``inexact'' exception
8600 may be raised if the library implementation does not follow TS 18661.
8601
8602 @item -fsingle-precision-constant
8603 @opindex fsingle-precision-constant
8604 Treat floating-point constants as single precision instead of
8605 implicitly converting them to double-precision constants.
8606
8607 @item -fcx-limited-range
8608 @opindex fcx-limited-range
8609 When enabled, this option states that a range reduction step is not
8610 needed when performing complex division. Also, there is no checking
8611 whether the result of a complex multiplication or division is @code{NaN
8612 + I*NaN}, with an attempt to rescue the situation in that case. The
8613 default is @option{-fno-cx-limited-range}, but is enabled by
8614 @option{-ffast-math}.
8615
8616 This option controls the default setting of the ISO C99
8617 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
8618 all languages.
8619
8620 @item -fcx-fortran-rules
8621 @opindex fcx-fortran-rules
8622 Complex multiplication and division follow Fortran rules. Range
8623 reduction is done as part of complex division, but there is no checking
8624 whether the result of a complex multiplication or division is @code{NaN
8625 + I*NaN}, with an attempt to rescue the situation in that case.
8626
8627 The default is @option{-fno-cx-fortran-rules}.
8628
8629 @end table
8630
8631 The following options control optimizations that may improve
8632 performance, but are not enabled by any @option{-O} options. This
8633 section includes experimental options that may produce broken code.
8634
8635 @table @gcctabopt
8636 @item -fbranch-probabilities
8637 @opindex fbranch-probabilities
8638 After running a program compiled with @option{-fprofile-arcs}
8639 (@pxref{Instrumentation Options}),
8640 you can compile it a second time using
8641 @option{-fbranch-probabilities}, to improve optimizations based on
8642 the number of times each branch was taken. When a program
8643 compiled with @option{-fprofile-arcs} exits, it saves arc execution
8644 counts to a file called @file{@var{sourcename}.gcda} for each source
8645 file. The information in this data file is very dependent on the
8646 structure of the generated code, so you must use the same source code
8647 and the same optimization options for both compilations.
8648
8649 With @option{-fbranch-probabilities}, GCC puts a
8650 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8651 These can be used to improve optimization. Currently, they are only
8652 used in one place: in @file{reorg.c}, instead of guessing which path a
8653 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8654 exactly determine which path is taken more often.
8655
8656 @item -fprofile-values
8657 @opindex fprofile-values
8658 If combined with @option{-fprofile-arcs}, it adds code so that some
8659 data about values of expressions in the program is gathered.
8660
8661 With @option{-fbranch-probabilities}, it reads back the data gathered
8662 from profiling values of expressions for usage in optimizations.
8663
8664 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8665
8666 @item -fprofile-reorder-functions
8667 @opindex fprofile-reorder-functions
8668 Function reordering based on profile instrumentation collects
8669 first time of execution of a function and orders these functions
8670 in ascending order.
8671
8672 Enabled with @option{-fprofile-use}.
8673
8674 @item -fvpt
8675 @opindex fvpt
8676 If combined with @option{-fprofile-arcs}, this option instructs the compiler
8677 to add code to gather information about values of expressions.
8678
8679 With @option{-fbranch-probabilities}, it reads back the data gathered
8680 and actually performs the optimizations based on them.
8681 Currently the optimizations include specialization of division operations
8682 using the knowledge about the value of the denominator.
8683
8684 @item -frename-registers
8685 @opindex frename-registers
8686 Attempt to avoid false dependencies in scheduled code by making use
8687 of registers left over after register allocation. This optimization
8688 most benefits processors with lots of registers. Depending on the
8689 debug information format adopted by the target, however, it can
8690 make debugging impossible, since variables no longer stay in
8691 a ``home register''.
8692
8693 Enabled by default with @option{-funroll-loops}.
8694
8695 @item -fschedule-fusion
8696 @opindex fschedule-fusion
8697 Performs a target dependent pass over the instruction stream to schedule
8698 instructions of same type together because target machine can execute them
8699 more efficiently if they are adjacent to each other in the instruction flow.
8700
8701 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8702
8703 @item -ftracer
8704 @opindex ftracer
8705 Perform tail duplication to enlarge superblock size. This transformation
8706 simplifies the control flow of the function allowing other optimizations to do
8707 a better job.
8708
8709 Enabled with @option{-fprofile-use}.
8710
8711 @item -funroll-loops
8712 @opindex funroll-loops
8713 Unroll loops whose number of iterations can be determined at compile time or
8714 upon entry to the loop. @option{-funroll-loops} implies
8715 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
8716 It also turns on complete loop peeling (i.e.@: complete removal of loops with
8717 a small constant number of iterations). This option makes code larger, and may
8718 or may not make it run faster.
8719
8720 Enabled with @option{-fprofile-use}.
8721
8722 @item -funroll-all-loops
8723 @opindex funroll-all-loops
8724 Unroll all loops, even if their number of iterations is uncertain when
8725 the loop is entered. This usually makes programs run more slowly.
8726 @option{-funroll-all-loops} implies the same options as
8727 @option{-funroll-loops}.
8728
8729 @item -fpeel-loops
8730 @opindex fpeel-loops
8731 Peels loops for which there is enough information that they do not
8732 roll much (from profile feedback or static analysis). It also turns on
8733 complete loop peeling (i.e.@: complete removal of loops with small constant
8734 number of iterations).
8735
8736 Enabled with @option{-O3} and/or @option{-fprofile-use}.
8737
8738 @item -fmove-loop-invariants
8739 @opindex fmove-loop-invariants
8740 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
8741 at level @option{-O1}
8742
8743 @item -funswitch-loops
8744 @opindex funswitch-loops
8745 Move branches with loop invariant conditions out of the loop, with duplicates
8746 of the loop on both branches (modified according to result of the condition).
8747
8748 @item -ffunction-sections
8749 @itemx -fdata-sections
8750 @opindex ffunction-sections
8751 @opindex fdata-sections
8752 Place each function or data item into its own section in the output
8753 file if the target supports arbitrary sections. The name of the
8754 function or the name of the data item determines the section's name
8755 in the output file.
8756
8757 Use these options on systems where the linker can perform optimizations
8758 to improve locality of reference in the instruction space. Most systems
8759 using the ELF object format and SPARC processors running Solaris 2 have
8760 linkers with such optimizations. AIX may have these optimizations in
8761 the future.
8762
8763 Only use these options when there are significant benefits from doing
8764 so. When you specify these options, the assembler and linker
8765 create larger object and executable files and are also slower.
8766 You cannot use @command{gprof} on all systems if you
8767 specify this option, and you may have problems with debugging if
8768 you specify both this option and @option{-g}.
8769
8770 @item -fbranch-target-load-optimize
8771 @opindex fbranch-target-load-optimize
8772 Perform branch target register load optimization before prologue / epilogue
8773 threading.
8774 The use of target registers can typically be exposed only during reload,
8775 thus hoisting loads out of loops and doing inter-block scheduling needs
8776 a separate optimization pass.
8777
8778 @item -fbranch-target-load-optimize2
8779 @opindex fbranch-target-load-optimize2
8780 Perform branch target register load optimization after prologue / epilogue
8781 threading.
8782
8783 @item -fbtr-bb-exclusive
8784 @opindex fbtr-bb-exclusive
8785 When performing branch target register load optimization, don't reuse
8786 branch target registers within any basic block.
8787
8788 @item -fstdarg-opt
8789 @opindex fstdarg-opt
8790 Optimize the prologue of variadic argument functions with respect to usage of
8791 those arguments.
8792
8793 @item -fsection-anchors
8794 @opindex fsection-anchors
8795 Try to reduce the number of symbolic address calculations by using
8796 shared ``anchor'' symbols to address nearby objects. This transformation
8797 can help to reduce the number of GOT entries and GOT accesses on some
8798 targets.
8799
8800 For example, the implementation of the following function @code{foo}:
8801
8802 @smallexample
8803 static int a, b, c;
8804 int foo (void) @{ return a + b + c; @}
8805 @end smallexample
8806
8807 @noindent
8808 usually calculates the addresses of all three variables, but if you
8809 compile it with @option{-fsection-anchors}, it accesses the variables
8810 from a common anchor point instead. The effect is similar to the
8811 following pseudocode (which isn't valid C):
8812
8813 @smallexample
8814 int foo (void)
8815 @{
8816 register int *xr = &x;
8817 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8818 @}
8819 @end smallexample
8820
8821 Not all targets support this option.
8822
8823 @item --param @var{name}=@var{value}
8824 @opindex param
8825 In some places, GCC uses various constants to control the amount of
8826 optimization that is done. For example, GCC does not inline functions
8827 that contain more than a certain number of instructions. You can
8828 control some of these constants on the command line using the
8829 @option{--param} option.
8830
8831 The names of specific parameters, and the meaning of the values, are
8832 tied to the internals of the compiler, and are subject to change
8833 without notice in future releases.
8834
8835 In each case, the @var{value} is an integer. The allowable choices for
8836 @var{name} are:
8837
8838 @table @gcctabopt
8839 @item predictable-branch-outcome
8840 When branch is predicted to be taken with probability lower than this threshold
8841 (in percent), then it is considered well predictable. The default is 10.
8842
8843 @item max-rtl-if-conversion-insns
8844 RTL if-conversion tries to remove conditional branches around a block and
8845 replace them with conditionally executed instructions. This parameter
8846 gives the maximum number of instructions in a block which should be
8847 considered for if-conversion. The default is 10, though the compiler will
8848 also use other heuristics to decide whether if-conversion is likely to be
8849 profitable.
8850
8851 @item max-crossjump-edges
8852 The maximum number of incoming edges to consider for cross-jumping.
8853 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
8854 the number of edges incoming to each block. Increasing values mean
8855 more aggressive optimization, making the compilation time increase with
8856 probably small improvement in executable size.
8857
8858 @item min-crossjump-insns
8859 The minimum number of instructions that must be matched at the end
8860 of two blocks before cross-jumping is performed on them. This
8861 value is ignored in the case where all instructions in the block being
8862 cross-jumped from are matched. The default value is 5.
8863
8864 @item max-grow-copy-bb-insns
8865 The maximum code size expansion factor when copying basic blocks
8866 instead of jumping. The expansion is relative to a jump instruction.
8867 The default value is 8.
8868
8869 @item max-goto-duplication-insns
8870 The maximum number of instructions to duplicate to a block that jumps
8871 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
8872 passes, GCC factors computed gotos early in the compilation process,
8873 and unfactors them as late as possible. Only computed jumps at the
8874 end of a basic blocks with no more than max-goto-duplication-insns are
8875 unfactored. The default value is 8.
8876
8877 @item max-delay-slot-insn-search
8878 The maximum number of instructions to consider when looking for an
8879 instruction to fill a delay slot. If more than this arbitrary number of
8880 instructions are searched, the time savings from filling the delay slot
8881 are minimal, so stop searching. Increasing values mean more
8882 aggressive optimization, making the compilation time increase with probably
8883 small improvement in execution time.
8884
8885 @item max-delay-slot-live-search
8886 When trying to fill delay slots, the maximum number of instructions to
8887 consider when searching for a block with valid live register
8888 information. Increasing this arbitrarily chosen value means more
8889 aggressive optimization, increasing the compilation time. This parameter
8890 should be removed when the delay slot code is rewritten to maintain the
8891 control-flow graph.
8892
8893 @item max-gcse-memory
8894 The approximate maximum amount of memory that can be allocated in
8895 order to perform the global common subexpression elimination
8896 optimization. If more memory than specified is required, the
8897 optimization is not done.
8898
8899 @item max-gcse-insertion-ratio
8900 If the ratio of expression insertions to deletions is larger than this value
8901 for any expression, then RTL PRE inserts or removes the expression and thus
8902 leaves partially redundant computations in the instruction stream. The default value is 20.
8903
8904 @item max-pending-list-length
8905 The maximum number of pending dependencies scheduling allows
8906 before flushing the current state and starting over. Large functions
8907 with few branches or calls can create excessively large lists which
8908 needlessly consume memory and resources.
8909
8910 @item max-modulo-backtrack-attempts
8911 The maximum number of backtrack attempts the scheduler should make
8912 when modulo scheduling a loop. Larger values can exponentially increase
8913 compilation time.
8914
8915 @item max-inline-insns-single
8916 Several parameters control the tree inliner used in GCC@.
8917 This number sets the maximum number of instructions (counted in GCC's
8918 internal representation) in a single function that the tree inliner
8919 considers for inlining. This only affects functions declared
8920 inline and methods implemented in a class declaration (C++).
8921 The default value is 400.
8922
8923 @item max-inline-insns-auto
8924 When you use @option{-finline-functions} (included in @option{-O3}),
8925 a lot of functions that would otherwise not be considered for inlining
8926 by the compiler are investigated. To those functions, a different
8927 (more restrictive) limit compared to functions declared inline can
8928 be applied.
8929 The default value is 40.
8930
8931 @item inline-min-speedup
8932 When estimated performance improvement of caller + callee runtime exceeds this
8933 threshold (in precent), the function can be inlined regardless the limit on
8934 @option{--param max-inline-insns-single} and @option{--param
8935 max-inline-insns-auto}.
8936
8937 @item large-function-insns
8938 The limit specifying really large functions. For functions larger than this
8939 limit after inlining, inlining is constrained by
8940 @option{--param large-function-growth}. This parameter is useful primarily
8941 to avoid extreme compilation time caused by non-linear algorithms used by the
8942 back end.
8943 The default value is 2700.
8944
8945 @item large-function-growth
8946 Specifies maximal growth of large function caused by inlining in percents.
8947 The default value is 100 which limits large function growth to 2.0 times
8948 the original size.
8949
8950 @item large-unit-insns
8951 The limit specifying large translation unit. Growth caused by inlining of
8952 units larger than this limit is limited by @option{--param inline-unit-growth}.
8953 For small units this might be too tight.
8954 For example, consider a unit consisting of function A
8955 that is inline and B that just calls A three times. If B is small relative to
8956 A, the growth of unit is 300\% and yet such inlining is very sane. For very
8957 large units consisting of small inlineable functions, however, the overall unit
8958 growth limit is needed to avoid exponential explosion of code size. Thus for
8959 smaller units, the size is increased to @option{--param large-unit-insns}
8960 before applying @option{--param inline-unit-growth}. The default is 10000.
8961
8962 @item inline-unit-growth
8963 Specifies maximal overall growth of the compilation unit caused by inlining.
8964 The default value is 20 which limits unit growth to 1.2 times the original
8965 size. Cold functions (either marked cold via an attribute or by profile
8966 feedback) are not accounted into the unit size.
8967
8968 @item ipcp-unit-growth
8969 Specifies maximal overall growth of the compilation unit caused by
8970 interprocedural constant propagation. The default value is 10 which limits
8971 unit growth to 1.1 times the original size.
8972
8973 @item large-stack-frame
8974 The limit specifying large stack frames. While inlining the algorithm is trying
8975 to not grow past this limit too much. The default value is 256 bytes.
8976
8977 @item large-stack-frame-growth
8978 Specifies maximal growth of large stack frames caused by inlining in percents.
8979 The default value is 1000 which limits large stack frame growth to 11 times
8980 the original size.
8981
8982 @item max-inline-insns-recursive
8983 @itemx max-inline-insns-recursive-auto
8984 Specifies the maximum number of instructions an out-of-line copy of a
8985 self-recursive inline
8986 function can grow into by performing recursive inlining.
8987
8988 @option{--param max-inline-insns-recursive} applies to functions
8989 declared inline.
8990 For functions not declared inline, recursive inlining
8991 happens only when @option{-finline-functions} (included in @option{-O3}) is
8992 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
8993 default value is 450.
8994
8995 @item max-inline-recursive-depth
8996 @itemx max-inline-recursive-depth-auto
8997 Specifies the maximum recursion depth used for recursive inlining.
8998
8999 @option{--param max-inline-recursive-depth} applies to functions
9000 declared inline. For functions not declared inline, recursive inlining
9001 happens only when @option{-finline-functions} (included in @option{-O3}) is
9002 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
9003 default value is 8.
9004
9005 @item min-inline-recursive-probability
9006 Recursive inlining is profitable only for function having deep recursion
9007 in average and can hurt for function having little recursion depth by
9008 increasing the prologue size or complexity of function body to other
9009 optimizers.
9010
9011 When profile feedback is available (see @option{-fprofile-generate}) the actual
9012 recursion depth can be guessed from probability that function recurses via a
9013 given call expression. This parameter limits inlining only to call expressions
9014 whose probability exceeds the given threshold (in percents).
9015 The default value is 10.
9016
9017 @item early-inlining-insns
9018 Specify growth that the early inliner can make. In effect it increases
9019 the amount of inlining for code having a large abstraction penalty.
9020 The default value is 14.
9021
9022 @item max-early-inliner-iterations
9023 Limit of iterations of the early inliner. This basically bounds
9024 the number of nested indirect calls the early inliner can resolve.
9025 Deeper chains are still handled by late inlining.
9026
9027 @item comdat-sharing-probability
9028 Probability (in percent) that C++ inline function with comdat visibility
9029 are shared across multiple compilation units. The default value is 20.
9030
9031 @item profile-func-internal-id
9032 A parameter to control whether to use function internal id in profile
9033 database lookup. If the value is 0, the compiler uses an id that
9034 is based on function assembler name and filename, which makes old profile
9035 data more tolerant to source changes such as function reordering etc.
9036 The default value is 0.
9037
9038 @item min-vect-loop-bound
9039 The minimum number of iterations under which loops are not vectorized
9040 when @option{-ftree-vectorize} is used. The number of iterations after
9041 vectorization needs to be greater than the value specified by this option
9042 to allow vectorization. The default value is 0.
9043
9044 @item gcse-cost-distance-ratio
9045 Scaling factor in calculation of maximum distance an expression
9046 can be moved by GCSE optimizations. This is currently supported only in the
9047 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9048 is with simple expressions, i.e., the expressions that have cost
9049 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9050 hoisting of simple expressions. The default value is 10.
9051
9052 @item gcse-unrestricted-cost
9053 Cost, roughly measured as the cost of a single typical machine
9054 instruction, at which GCSE optimizations do not constrain
9055 the distance an expression can travel. This is currently
9056 supported only in the code hoisting pass. The lesser the cost,
9057 the more aggressive code hoisting is. Specifying 0
9058 allows all expressions to travel unrestricted distances.
9059 The default value is 3.
9060
9061 @item max-hoist-depth
9062 The depth of search in the dominator tree for expressions to hoist.
9063 This is used to avoid quadratic behavior in hoisting algorithm.
9064 The value of 0 does not limit on the search, but may slow down compilation
9065 of huge functions. The default value is 30.
9066
9067 @item max-tail-merge-comparisons
9068 The maximum amount of similar bbs to compare a bb with. This is used to
9069 avoid quadratic behavior in tree tail merging. The default value is 10.
9070
9071 @item max-tail-merge-iterations
9072 The maximum amount of iterations of the pass over the function. This is used to
9073 limit compilation time in tree tail merging. The default value is 2.
9074
9075 @item max-unrolled-insns
9076 The maximum number of instructions that a loop may have to be unrolled.
9077 If a loop is unrolled, this parameter also determines how many times
9078 the loop code is unrolled.
9079
9080 @item max-average-unrolled-insns
9081 The maximum number of instructions biased by probabilities of their execution
9082 that a loop may have to be unrolled. If a loop is unrolled,
9083 this parameter also determines how many times the loop code is unrolled.
9084
9085 @item max-unroll-times
9086 The maximum number of unrollings of a single loop.
9087
9088 @item max-peeled-insns
9089 The maximum number of instructions that a loop may have to be peeled.
9090 If a loop is peeled, this parameter also determines how many times
9091 the loop code is peeled.
9092
9093 @item max-peel-times
9094 The maximum number of peelings of a single loop.
9095
9096 @item max-peel-branches
9097 The maximum number of branches on the hot path through the peeled sequence.
9098
9099 @item max-completely-peeled-insns
9100 The maximum number of insns of a completely peeled loop.
9101
9102 @item max-completely-peel-times
9103 The maximum number of iterations of a loop to be suitable for complete peeling.
9104
9105 @item max-completely-peel-loop-nest-depth
9106 The maximum depth of a loop nest suitable for complete peeling.
9107
9108 @item max-unswitch-insns
9109 The maximum number of insns of an unswitched loop.
9110
9111 @item max-unswitch-level
9112 The maximum number of branches unswitched in a single loop.
9113
9114 @item max-loop-headers-insns
9115 The maximum number of insns in loop header duplicated by he copy loop headers
9116 pass.
9117
9118 @item lim-expensive
9119 The minimum cost of an expensive expression in the loop invariant motion.
9120
9121 @item iv-consider-all-candidates-bound
9122 Bound on number of candidates for induction variables, below which
9123 all candidates are considered for each use in induction variable
9124 optimizations. If there are more candidates than this,
9125 only the most relevant ones are considered to avoid quadratic time complexity.
9126
9127 @item iv-max-considered-uses
9128 The induction variable optimizations give up on loops that contain more
9129 induction variable uses.
9130
9131 @item iv-always-prune-cand-set-bound
9132 If the number of candidates in the set is smaller than this value,
9133 always try to remove unnecessary ivs from the set
9134 when adding a new one.
9135
9136 @item scev-max-expr-size
9137 Bound on size of expressions used in the scalar evolutions analyzer.
9138 Large expressions slow the analyzer.
9139
9140 @item scev-max-expr-complexity
9141 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9142 Complex expressions slow the analyzer.
9143
9144 @item max-tree-if-conversion-phi-args
9145 Maximum number of arguments in a PHI supported by TREE if conversion
9146 unless the loop is marked with simd pragma.
9147
9148 @item vect-max-version-for-alignment-checks
9149 The maximum number of run-time checks that can be performed when
9150 doing loop versioning for alignment in the vectorizer.
9151
9152 @item vect-max-version-for-alias-checks
9153 The maximum number of run-time checks that can be performed when
9154 doing loop versioning for alias in the vectorizer.
9155
9156 @item vect-max-peeling-for-alignment
9157 The maximum number of loop peels to enhance access alignment
9158 for vectorizer. Value -1 means no limit.
9159
9160 @item max-iterations-to-track
9161 The maximum number of iterations of a loop the brute-force algorithm
9162 for analysis of the number of iterations of the loop tries to evaluate.
9163
9164 @item hot-bb-count-ws-permille
9165 A basic block profile count is considered hot if it contributes to
9166 the given permillage (i.e. 0...1000) of the entire profiled execution.
9167
9168 @item hot-bb-frequency-fraction
9169 Select fraction of the entry block frequency of executions of basic block in
9170 function given basic block needs to have to be considered hot.
9171
9172 @item max-predicted-iterations
9173 The maximum number of loop iterations we predict statically. This is useful
9174 in cases where a function contains a single loop with known bound and
9175 another loop with unknown bound.
9176 The known number of iterations is predicted correctly, while
9177 the unknown number of iterations average to roughly 10. This means that the
9178 loop without bounds appears artificially cold relative to the other one.
9179
9180 @item builtin-expect-probability
9181 Control the probability of the expression having the specified value. This
9182 parameter takes a percentage (i.e. 0 ... 100) as input.
9183 The default probability of 90 is obtained empirically.
9184
9185 @item align-threshold
9186
9187 Select fraction of the maximal frequency of executions of a basic block in
9188 a function to align the basic block.
9189
9190 @item align-loop-iterations
9191
9192 A loop expected to iterate at least the selected number of iterations is
9193 aligned.
9194
9195 @item tracer-dynamic-coverage
9196 @itemx tracer-dynamic-coverage-feedback
9197
9198 This value is used to limit superblock formation once the given percentage of
9199 executed instructions is covered. This limits unnecessary code size
9200 expansion.
9201
9202 The @option{tracer-dynamic-coverage-feedback} parameter
9203 is used only when profile
9204 feedback is available. The real profiles (as opposed to statically estimated
9205 ones) are much less balanced allowing the threshold to be larger value.
9206
9207 @item tracer-max-code-growth
9208 Stop tail duplication once code growth has reached given percentage. This is
9209 a rather artificial limit, as most of the duplicates are eliminated later in
9210 cross jumping, so it may be set to much higher values than is the desired code
9211 growth.
9212
9213 @item tracer-min-branch-ratio
9214
9215 Stop reverse growth when the reverse probability of best edge is less than this
9216 threshold (in percent).
9217
9218 @item tracer-min-branch-probability
9219 @itemx tracer-min-branch-probability-feedback
9220
9221 Stop forward growth if the best edge has probability lower than this
9222 threshold.
9223
9224 Similarly to @option{tracer-dynamic-coverage} two parameters are
9225 provided. @option{tracer-min-branch-probability-feedback} is used for
9226 compilation with profile feedback and @option{tracer-min-branch-probability}
9227 compilation without. The value for compilation with profile feedback
9228 needs to be more conservative (higher) in order to make tracer
9229 effective.
9230
9231 @item max-cse-path-length
9232
9233 The maximum number of basic blocks on path that CSE considers.
9234 The default is 10.
9235
9236 @item max-cse-insns
9237 The maximum number of instructions CSE processes before flushing.
9238 The default is 1000.
9239
9240 @item ggc-min-expand
9241
9242 GCC uses a garbage collector to manage its own memory allocation. This
9243 parameter specifies the minimum percentage by which the garbage
9244 collector's heap should be allowed to expand between collections.
9245 Tuning this may improve compilation speed; it has no effect on code
9246 generation.
9247
9248 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9249 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9250 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9251 GCC is not able to calculate RAM on a particular platform, the lower
9252 bound of 30% is used. Setting this parameter and
9253 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9254 every opportunity. This is extremely slow, but can be useful for
9255 debugging.
9256
9257 @item ggc-min-heapsize
9258
9259 Minimum size of the garbage collector's heap before it begins bothering
9260 to collect garbage. The first collection occurs after the heap expands
9261 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9262 tuning this may improve compilation speed, and has no effect on code
9263 generation.
9264
9265 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9266 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9267 with a lower bound of 4096 (four megabytes) and an upper bound of
9268 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9269 particular platform, the lower bound is used. Setting this parameter
9270 very large effectively disables garbage collection. Setting this
9271 parameter and @option{ggc-min-expand} to zero causes a full collection
9272 to occur at every opportunity.
9273
9274 @item max-reload-search-insns
9275 The maximum number of instruction reload should look backward for equivalent
9276 register. Increasing values mean more aggressive optimization, making the
9277 compilation time increase with probably slightly better performance.
9278 The default value is 100.
9279
9280 @item max-cselib-memory-locations
9281 The maximum number of memory locations cselib should take into account.
9282 Increasing values mean more aggressive optimization, making the compilation time
9283 increase with probably slightly better performance. The default value is 500.
9284
9285 @item max-sched-ready-insns
9286 The maximum number of instructions ready to be issued the scheduler should
9287 consider at any given time during the first scheduling pass. Increasing
9288 values mean more thorough searches, making the compilation time increase
9289 with probably little benefit. The default value is 100.
9290
9291 @item max-sched-region-blocks
9292 The maximum number of blocks in a region to be considered for
9293 interblock scheduling. The default value is 10.
9294
9295 @item max-pipeline-region-blocks
9296 The maximum number of blocks in a region to be considered for
9297 pipelining in the selective scheduler. The default value is 15.
9298
9299 @item max-sched-region-insns
9300 The maximum number of insns in a region to be considered for
9301 interblock scheduling. The default value is 100.
9302
9303 @item max-pipeline-region-insns
9304 The maximum number of insns in a region to be considered for
9305 pipelining in the selective scheduler. The default value is 200.
9306
9307 @item min-spec-prob
9308 The minimum probability (in percents) of reaching a source block
9309 for interblock speculative scheduling. The default value is 40.
9310
9311 @item max-sched-extend-regions-iters
9312 The maximum number of iterations through CFG to extend regions.
9313 A value of 0 (the default) disables region extensions.
9314
9315 @item max-sched-insn-conflict-delay
9316 The maximum conflict delay for an insn to be considered for speculative motion.
9317 The default value is 3.
9318
9319 @item sched-spec-prob-cutoff
9320 The minimal probability of speculation success (in percents), so that
9321 speculative insns are scheduled.
9322 The default value is 40.
9323
9324 @item sched-state-edge-prob-cutoff
9325 The minimum probability an edge must have for the scheduler to save its
9326 state across it.
9327 The default value is 10.
9328
9329 @item sched-mem-true-dep-cost
9330 Minimal distance (in CPU cycles) between store and load targeting same
9331 memory locations. The default value is 1.
9332
9333 @item selsched-max-lookahead
9334 The maximum size of the lookahead window of selective scheduling. It is a
9335 depth of search for available instructions.
9336 The default value is 50.
9337
9338 @item selsched-max-sched-times
9339 The maximum number of times that an instruction is scheduled during
9340 selective scheduling. This is the limit on the number of iterations
9341 through which the instruction may be pipelined. The default value is 2.
9342
9343 @item selsched-insns-to-rename
9344 The maximum number of best instructions in the ready list that are considered
9345 for renaming in the selective scheduler. The default value is 2.
9346
9347 @item sms-min-sc
9348 The minimum value of stage count that swing modulo scheduler
9349 generates. The default value is 2.
9350
9351 @item max-last-value-rtl
9352 The maximum size measured as number of RTLs that can be recorded in an expression
9353 in combiner for a pseudo register as last known value of that register. The default
9354 is 10000.
9355
9356 @item max-combine-insns
9357 The maximum number of instructions the RTL combiner tries to combine.
9358 The default value is 2 at @option{-Og} and 4 otherwise.
9359
9360 @item integer-share-limit
9361 Small integer constants can use a shared data structure, reducing the
9362 compiler's memory usage and increasing its speed. This sets the maximum
9363 value of a shared integer constant. The default value is 256.
9364
9365 @item ssp-buffer-size
9366 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9367 protection when @option{-fstack-protection} is used.
9368
9369 @item min-size-for-stack-sharing
9370 The minimum size of variables taking part in stack slot sharing when not
9371 optimizing. The default value is 32.
9372
9373 @item max-jump-thread-duplication-stmts
9374 Maximum number of statements allowed in a block that needs to be
9375 duplicated when threading jumps.
9376
9377 @item max-fields-for-field-sensitive
9378 Maximum number of fields in a structure treated in
9379 a field sensitive manner during pointer analysis. The default is zero
9380 for @option{-O0} and @option{-O1},
9381 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9382
9383 @item prefetch-latency
9384 Estimate on average number of instructions that are executed before
9385 prefetch finishes. The distance prefetched ahead is proportional
9386 to this constant. Increasing this number may also lead to less
9387 streams being prefetched (see @option{simultaneous-prefetches}).
9388
9389 @item simultaneous-prefetches
9390 Maximum number of prefetches that can run at the same time.
9391
9392 @item l1-cache-line-size
9393 The size of cache line in L1 cache, in bytes.
9394
9395 @item l1-cache-size
9396 The size of L1 cache, in kilobytes.
9397
9398 @item l2-cache-size
9399 The size of L2 cache, in kilobytes.
9400
9401 @item min-insn-to-prefetch-ratio
9402 The minimum ratio between the number of instructions and the
9403 number of prefetches to enable prefetching in a loop.
9404
9405 @item prefetch-min-insn-to-mem-ratio
9406 The minimum ratio between the number of instructions and the
9407 number of memory references to enable prefetching in a loop.
9408
9409 @item use-canonical-types
9410 Whether the compiler should use the ``canonical'' type system. By
9411 default, this should always be 1, which uses a more efficient internal
9412 mechanism for comparing types in C++ and Objective-C++. However, if
9413 bugs in the canonical type system are causing compilation failures,
9414 set this value to 0 to disable canonical types.
9415
9416 @item switch-conversion-max-branch-ratio
9417 Switch initialization conversion refuses to create arrays that are
9418 bigger than @option{switch-conversion-max-branch-ratio} times the number of
9419 branches in the switch.
9420
9421 @item max-partial-antic-length
9422 Maximum length of the partial antic set computed during the tree
9423 partial redundancy elimination optimization (@option{-ftree-pre}) when
9424 optimizing at @option{-O3} and above. For some sorts of source code
9425 the enhanced partial redundancy elimination optimization can run away,
9426 consuming all of the memory available on the host machine. This
9427 parameter sets a limit on the length of the sets that are computed,
9428 which prevents the runaway behavior. Setting a value of 0 for
9429 this parameter allows an unlimited set length.
9430
9431 @item sccvn-max-scc-size
9432 Maximum size of a strongly connected component (SCC) during SCCVN
9433 processing. If this limit is hit, SCCVN processing for the whole
9434 function is not done and optimizations depending on it are
9435 disabled. The default maximum SCC size is 10000.
9436
9437 @item sccvn-max-alias-queries-per-access
9438 Maximum number of alias-oracle queries we perform when looking for
9439 redundancies for loads and stores. If this limit is hit the search
9440 is aborted and the load or store is not considered redundant. The
9441 number of queries is algorithmically limited to the number of
9442 stores on all paths from the load to the function entry.
9443 The default maximum number of queries is 1000.
9444
9445 @item ira-max-loops-num
9446 IRA uses regional register allocation by default. If a function
9447 contains more loops than the number given by this parameter, only at most
9448 the given number of the most frequently-executed loops form regions
9449 for regional register allocation. The default value of the
9450 parameter is 100.
9451
9452 @item ira-max-conflict-table-size
9453 Although IRA uses a sophisticated algorithm to compress the conflict
9454 table, the table can still require excessive amounts of memory for
9455 huge functions. If the conflict table for a function could be more
9456 than the size in MB given by this parameter, the register allocator
9457 instead uses a faster, simpler, and lower-quality
9458 algorithm that does not require building a pseudo-register conflict table.
9459 The default value of the parameter is 2000.
9460
9461 @item ira-loop-reserved-regs
9462 IRA can be used to evaluate more accurate register pressure in loops
9463 for decisions to move loop invariants (see @option{-O3}). The number
9464 of available registers reserved for some other purposes is given
9465 by this parameter. The default value of the parameter is 2, which is
9466 the minimal number of registers needed by typical instructions.
9467 This value is the best found from numerous experiments.
9468
9469 @item lra-inheritance-ebb-probability-cutoff
9470 LRA tries to reuse values reloaded in registers in subsequent insns.
9471 This optimization is called inheritance. EBB is used as a region to
9472 do this optimization. The parameter defines a minimal fall-through
9473 edge probability in percentage used to add BB to inheritance EBB in
9474 LRA. The default value of the parameter is 40. The value was chosen
9475 from numerous runs of SPEC2000 on x86-64.
9476
9477 @item loop-invariant-max-bbs-in-loop
9478 Loop invariant motion can be very expensive, both in compilation time and
9479 in amount of needed compile-time memory, with very large loops. Loops
9480 with more basic blocks than this parameter won't have loop invariant
9481 motion optimization performed on them. The default value of the
9482 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
9483
9484 @item loop-max-datarefs-for-datadeps
9485 Building data dependencies is expensive for very large loops. This
9486 parameter limits the number of data references in loops that are
9487 considered for data dependence analysis. These large loops are no
9488 handled by the optimizations using loop data dependencies.
9489 The default value is 1000.
9490
9491 @item max-vartrack-size
9492 Sets a maximum number of hash table slots to use during variable
9493 tracking dataflow analysis of any function. If this limit is exceeded
9494 with variable tracking at assignments enabled, analysis for that
9495 function is retried without it, after removing all debug insns from
9496 the function. If the limit is exceeded even without debug insns, var
9497 tracking analysis is completely disabled for the function. Setting
9498 the parameter to zero makes it unlimited.
9499
9500 @item max-vartrack-expr-depth
9501 Sets a maximum number of recursion levels when attempting to map
9502 variable names or debug temporaries to value expressions. This trades
9503 compilation time for more complete debug information. If this is set too
9504 low, value expressions that are available and could be represented in
9505 debug information may end up not being used; setting this higher may
9506 enable the compiler to find more complex debug expressions, but compile
9507 time and memory use may grow. The default is 12.
9508
9509 @item min-nondebug-insn-uid
9510 Use uids starting at this parameter for nondebug insns. The range below
9511 the parameter is reserved exclusively for debug insns created by
9512 @option{-fvar-tracking-assignments}, but debug insns may get
9513 (non-overlapping) uids above it if the reserved range is exhausted.
9514
9515 @item ipa-sra-ptr-growth-factor
9516 IPA-SRA replaces a pointer to an aggregate with one or more new
9517 parameters only when their cumulative size is less or equal to
9518 @option{ipa-sra-ptr-growth-factor} times the size of the original
9519 pointer parameter.
9520
9521 @item sra-max-scalarization-size-Ospeed
9522 @item sra-max-scalarization-size-Osize
9523 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
9524 replace scalar parts of aggregates with uses of independent scalar
9525 variables. These parameters control the maximum size, in storage units,
9526 of aggregate which is considered for replacement when compiling for
9527 speed
9528 (@option{sra-max-scalarization-size-Ospeed}) or size
9529 (@option{sra-max-scalarization-size-Osize}) respectively.
9530
9531 @item tm-max-aggregate-size
9532 When making copies of thread-local variables in a transaction, this
9533 parameter specifies the size in bytes after which variables are
9534 saved with the logging functions as opposed to save/restore code
9535 sequence pairs. This option only applies when using
9536 @option{-fgnu-tm}.
9537
9538 @item graphite-max-nb-scop-params
9539 To avoid exponential effects in the Graphite loop transforms, the
9540 number of parameters in a Static Control Part (SCoP) is bounded. The
9541 default value is 10 parameters. A variable whose value is unknown at
9542 compilation time and defined outside a SCoP is a parameter of the SCoP.
9543
9544 @item graphite-max-bbs-per-function
9545 To avoid exponential effects in the detection of SCoPs, the size of
9546 the functions analyzed by Graphite is bounded. The default value is
9547 100 basic blocks.
9548
9549 @item loop-block-tile-size
9550 Loop blocking or strip mining transforms, enabled with
9551 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
9552 loop in the loop nest by a given number of iterations. The strip
9553 length can be changed using the @option{loop-block-tile-size}
9554 parameter. The default value is 51 iterations.
9555
9556 @item loop-unroll-jam-size
9557 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
9558 default value is 4.
9559
9560 @item loop-unroll-jam-depth
9561 Specify the dimension to be unrolled (counting from the most inner loop)
9562 for the @option{-floop-unroll-and-jam}. The default value is 2.
9563
9564 @item ipa-cp-value-list-size
9565 IPA-CP attempts to track all possible values and types passed to a function's
9566 parameter in order to propagate them and perform devirtualization.
9567 @option{ipa-cp-value-list-size} is the maximum number of values and types it
9568 stores per one formal parameter of a function.
9569
9570 @item ipa-cp-eval-threshold
9571 IPA-CP calculates its own score of cloning profitability heuristics
9572 and performs those cloning opportunities with scores that exceed
9573 @option{ipa-cp-eval-threshold}.
9574
9575 @item ipa-cp-recursion-penalty
9576 Percentage penalty the recursive functions will receive when they
9577 are evaluated for cloning.
9578
9579 @item ipa-cp-single-call-penalty
9580 Percentage penalty functions containg a single call to another
9581 function will receive when they are evaluated for cloning.
9582
9583
9584 @item ipa-max-agg-items
9585 IPA-CP is also capable to propagate a number of scalar values passed
9586 in an aggregate. @option{ipa-max-agg-items} controls the maximum
9587 number of such values per one parameter.
9588
9589 @item ipa-cp-loop-hint-bonus
9590 When IPA-CP determines that a cloning candidate would make the number
9591 of iterations of a loop known, it adds a bonus of
9592 @option{ipa-cp-loop-hint-bonus} to the profitability score of
9593 the candidate.
9594
9595 @item ipa-cp-array-index-hint-bonus
9596 When IPA-CP determines that a cloning candidate would make the index of
9597 an array access known, it adds a bonus of
9598 @option{ipa-cp-array-index-hint-bonus} to the profitability
9599 score of the candidate.
9600
9601 @item ipa-max-aa-steps
9602 During its analysis of function bodies, IPA-CP employs alias analysis
9603 in order to track values pointed to by function parameters. In order
9604 not spend too much time analyzing huge functions, it gives up and
9605 consider all memory clobbered after examining
9606 @option{ipa-max-aa-steps} statements modifying memory.
9607
9608 @item lto-partitions
9609 Specify desired number of partitions produced during WHOPR compilation.
9610 The number of partitions should exceed the number of CPUs used for compilation.
9611 The default value is 32.
9612
9613 @item lto-min-partition
9614 Size of minimal partition for WHOPR (in estimated instructions).
9615 This prevents expenses of splitting very small programs into too many
9616 partitions.
9617
9618 @item lto-max-partition
9619 Size of max partition for WHOPR (in estimated instructions).
9620 to provide an upper bound for individual size of partition.
9621 Meant to be used only with balanced partitioning.
9622
9623 @item cxx-max-namespaces-for-diagnostic-help
9624 The maximum number of namespaces to consult for suggestions when C++
9625 name lookup fails for an identifier. The default is 1000.
9626
9627 @item sink-frequency-threshold
9628 The maximum relative execution frequency (in percents) of the target block
9629 relative to a statement's original block to allow statement sinking of a
9630 statement. Larger numbers result in more aggressive statement sinking.
9631 The default value is 75. A small positive adjustment is applied for
9632 statements with memory operands as those are even more profitable so sink.
9633
9634 @item max-stores-to-sink
9635 The maximum number of conditional store pairs that can be sunk. Set to 0
9636 if either vectorization (@option{-ftree-vectorize}) or if-conversion
9637 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
9638
9639 @item allow-store-data-races
9640 Allow optimizers to introduce new data races on stores.
9641 Set to 1 to allow, otherwise to 0. This option is enabled by default
9642 at optimization level @option{-Ofast}.
9643
9644 @item case-values-threshold
9645 The smallest number of different values for which it is best to use a
9646 jump-table instead of a tree of conditional branches. If the value is
9647 0, use the default for the machine. The default is 0.
9648
9649 @item tree-reassoc-width
9650 Set the maximum number of instructions executed in parallel in
9651 reassociated tree. This parameter overrides target dependent
9652 heuristics used by default if has non zero value.
9653
9654 @item sched-pressure-algorithm
9655 Choose between the two available implementations of
9656 @option{-fsched-pressure}. Algorithm 1 is the original implementation
9657 and is the more likely to prevent instructions from being reordered.
9658 Algorithm 2 was designed to be a compromise between the relatively
9659 conservative approach taken by algorithm 1 and the rather aggressive
9660 approach taken by the default scheduler. It relies more heavily on
9661 having a regular register file and accurate register pressure classes.
9662 See @file{haifa-sched.c} in the GCC sources for more details.
9663
9664 The default choice depends on the target.
9665
9666 @item max-slsr-cand-scan
9667 Set the maximum number of existing candidates that are considered when
9668 seeking a basis for a new straight-line strength reduction candidate.
9669
9670 @item asan-globals
9671 Enable buffer overflow detection for global objects. This kind
9672 of protection is enabled by default if you are using
9673 @option{-fsanitize=address} option.
9674 To disable global objects protection use @option{--param asan-globals=0}.
9675
9676 @item asan-stack
9677 Enable buffer overflow detection for stack objects. This kind of
9678 protection is enabled by default when using @option{-fsanitize=address}.
9679 To disable stack protection use @option{--param asan-stack=0} option.
9680
9681 @item asan-instrument-reads
9682 Enable buffer overflow detection for memory reads. This kind of
9683 protection is enabled by default when using @option{-fsanitize=address}.
9684 To disable memory reads protection use
9685 @option{--param asan-instrument-reads=0}.
9686
9687 @item asan-instrument-writes
9688 Enable buffer overflow detection for memory writes. This kind of
9689 protection is enabled by default when using @option{-fsanitize=address}.
9690 To disable memory writes protection use
9691 @option{--param asan-instrument-writes=0} option.
9692
9693 @item asan-memintrin
9694 Enable detection for built-in functions. This kind of protection
9695 is enabled by default when using @option{-fsanitize=address}.
9696 To disable built-in functions protection use
9697 @option{--param asan-memintrin=0}.
9698
9699 @item asan-use-after-return
9700 Enable detection of use-after-return. This kind of protection
9701 is enabled by default when using @option{-fsanitize=address} option.
9702 To disable use-after-return detection use
9703 @option{--param asan-use-after-return=0}.
9704
9705 @item asan-instrumentation-with-call-threshold
9706 If number of memory accesses in function being instrumented
9707 is greater or equal to this number, use callbacks instead of inline checks.
9708 E.g. to disable inline code use
9709 @option{--param asan-instrumentation-with-call-threshold=0}.
9710
9711 @item chkp-max-ctor-size
9712 Static constructors generated by Pointer Bounds Checker may become very
9713 large and significantly increase compile time at optimization level
9714 @option{-O1} and higher. This parameter is a maximum nubmer of statements
9715 in a single generated constructor. Default value is 5000.
9716
9717 @item max-fsm-thread-path-insns
9718 Maximum number of instructions to copy when duplicating blocks on a
9719 finite state automaton jump thread path. The default is 100.
9720
9721 @item max-fsm-thread-length
9722 Maximum number of basic blocks on a finite state automaton jump thread
9723 path. The default is 10.
9724
9725 @item max-fsm-thread-paths
9726 Maximum number of new jump thread paths to create for a finite state
9727 automaton. The default is 50.
9728
9729 @item parloops-chunk-size
9730 Chunk size of omp schedule for loops parallelized by parloops. The default
9731 is 0.
9732
9733 @item parloops-schedule
9734 Schedule type of omp schedule for loops parallelized by parloops (static,
9735 dynamic, guided, auto, runtime). The default is static.
9736
9737 @item max-ssa-name-query-depth
9738 Maximum depth of recursion when querying properties of SSA names in things
9739 like fold routines. One level of recursion corresponds to following a
9740 use-def chain.
9741
9742 @item hsa-gen-debug-stores
9743 Enable emission of special debug stores within HSA kernels which are
9744 then read and reported by libgomp plugin. Generation of these stores
9745 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
9746 enable it.
9747
9748 @item max-speculative-devirt-maydefs
9749 The maximum number of may-defs we analyze when looking for a must-def
9750 specifying the dynamic type of an object that invokes a virtual call
9751 we may be able to devirtualize speculatively.
9752 @end table
9753 @end table
9754
9755 @node Instrumentation Options
9756 @section Program Instrumentation Options
9757 @cindex instrumentation options
9758 @cindex program instrumentation options
9759 @cindex run-time error checking options
9760 @cindex profiling options
9761 @cindex options, program instrumentation
9762 @cindex options, run-time error checking
9763 @cindex options, profiling
9764
9765 GCC supports a number of command-line options that control adding
9766 run-time instrumentation to the code it normally generates.
9767 For example, one purpose of instrumentation is collect profiling
9768 statistics for use in finding program hot spots, code coverage
9769 analysis, or profile-guided optimizations.
9770 Another class of program instrumentation is adding run-time checking
9771 to detect programming errors like invalid pointer
9772 dereferences or out-of-bounds array accesses, as well as deliberately
9773 hostile attacks such as stack smashing or C++ vtable hijacking.
9774 There is also a general hook which can be used to implement other
9775 forms of tracing or function-level instrumentation for debug or
9776 program analysis purposes.
9777
9778 @table @gcctabopt
9779 @cindex @command{prof}
9780 @item -p
9781 @opindex p
9782 Generate extra code to write profile information suitable for the
9783 analysis program @command{prof}. You must use this option when compiling
9784 the source files you want data about, and you must also use it when
9785 linking.
9786
9787 @cindex @command{gprof}
9788 @item -pg
9789 @opindex pg
9790 Generate extra code to write profile information suitable for the
9791 analysis program @command{gprof}. You must use this option when compiling
9792 the source files you want data about, and you must also use it when
9793 linking.
9794
9795 @item -fprofile-arcs
9796 @opindex fprofile-arcs
9797 Add code so that program flow @dfn{arcs} are instrumented. During
9798 execution the program records how many times each branch and call is
9799 executed and how many times it is taken or returns. When the compiled
9800 program exits it saves this data to a file called
9801 @file{@var{auxname}.gcda} for each source file. The data may be used for
9802 profile-directed optimizations (@option{-fbranch-probabilities}), or for
9803 test coverage analysis (@option{-ftest-coverage}). Each object file's
9804 @var{auxname} is generated from the name of the output file, if
9805 explicitly specified and it is not the final executable, otherwise it is
9806 the basename of the source file. In both cases any suffix is removed
9807 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
9808 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
9809 @xref{Cross-profiling}.
9810
9811 @cindex @command{gcov}
9812 @item --coverage
9813 @opindex coverage
9814
9815 This option is used to compile and link code instrumented for coverage
9816 analysis. The option is a synonym for @option{-fprofile-arcs}
9817 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
9818 linking). See the documentation for those options for more details.
9819
9820 @itemize
9821
9822 @item
9823 Compile the source files with @option{-fprofile-arcs} plus optimization
9824 and code generation options. For test coverage analysis, use the
9825 additional @option{-ftest-coverage} option. You do not need to profile
9826 every source file in a program.
9827
9828 @item
9829 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
9830 (the latter implies the former).
9831
9832 @item
9833 Run the program on a representative workload to generate the arc profile
9834 information. This may be repeated any number of times. You can run
9835 concurrent instances of your program, and provided that the file system
9836 supports locking, the data files will be correctly updated. Also
9837 @code{fork} calls are detected and correctly handled (double counting
9838 will not happen).
9839
9840 @item
9841 For profile-directed optimizations, compile the source files again with
9842 the same optimization and code generation options plus
9843 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
9844 Control Optimization}).
9845
9846 @item
9847 For test coverage analysis, use @command{gcov} to produce human readable
9848 information from the @file{.gcno} and @file{.gcda} files. Refer to the
9849 @command{gcov} documentation for further information.
9850
9851 @end itemize
9852
9853 With @option{-fprofile-arcs}, for each function of your program GCC
9854 creates a program flow graph, then finds a spanning tree for the graph.
9855 Only arcs that are not on the spanning tree have to be instrumented: the
9856 compiler adds code to count the number of times that these arcs are
9857 executed. When an arc is the only exit or only entrance to a block, the
9858 instrumentation code can be added to the block; otherwise, a new basic
9859 block must be created to hold the instrumentation code.
9860
9861 @need 2000
9862 @item -ftest-coverage
9863 @opindex ftest-coverage
9864 Produce a notes file that the @command{gcov} code-coverage utility
9865 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
9866 show program coverage. Each source file's note file is called
9867 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
9868 above for a description of @var{auxname} and instructions on how to
9869 generate test coverage data. Coverage data matches the source files
9870 more closely if you do not optimize.
9871
9872 @item -fprofile-dir=@var{path}
9873 @opindex fprofile-dir
9874
9875 Set the directory to search for the profile data files in to @var{path}.
9876 This option affects only the profile data generated by
9877 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
9878 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
9879 and its related options. Both absolute and relative paths can be used.
9880 By default, GCC uses the current directory as @var{path}, thus the
9881 profile data file appears in the same directory as the object file.
9882
9883 @item -fprofile-generate
9884 @itemx -fprofile-generate=@var{path}
9885 @opindex fprofile-generate
9886
9887 Enable options usually used for instrumenting application to produce
9888 profile useful for later recompilation with profile feedback based
9889 optimization. You must use @option{-fprofile-generate} both when
9890 compiling and when linking your program.
9891
9892 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
9893
9894 If @var{path} is specified, GCC looks at the @var{path} to find
9895 the profile feedback data files. See @option{-fprofile-dir}.
9896
9897 To optimize the program based on the collected profile information, use
9898 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
9899
9900 @item -fsanitize=address
9901 @opindex fsanitize=address
9902 Enable AddressSanitizer, a fast memory error detector.
9903 Memory access instructions are instrumented to detect
9904 out-of-bounds and use-after-free bugs.
9905 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
9906 more details. The run-time behavior can be influenced using the
9907 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
9908 the available options are shown at startup of the instrumented program. See
9909 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
9910 for a list of supported options.
9911
9912 @item -fsanitize=kernel-address
9913 @opindex fsanitize=kernel-address
9914 Enable AddressSanitizer for Linux kernel.
9915 See @uref{https://github.com/google/kasan/wiki} for more details.
9916
9917 @item -fsanitize=thread
9918 @opindex fsanitize=thread
9919 Enable ThreadSanitizer, a fast data race detector.
9920 Memory access instructions are instrumented to detect
9921 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
9922 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
9923 environment variable; see
9924 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
9925 supported options.
9926
9927 @item -fsanitize=leak
9928 @opindex fsanitize=leak
9929 Enable LeakSanitizer, a memory leak detector.
9930 This option only matters for linking of executables and if neither
9931 @option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that
9932 case the executable is linked against a library that overrides @code{malloc}
9933 and other allocator functions. See
9934 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
9935 details. The run-time behavior can be influenced using the
9936 @env{LSAN_OPTIONS} environment variable.
9937
9938 @item -fsanitize=undefined
9939 @opindex fsanitize=undefined
9940 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
9941 Various computations are instrumented to detect undefined behavior
9942 at runtime. Current suboptions are:
9943
9944 @table @gcctabopt
9945
9946 @item -fsanitize=shift
9947 @opindex fsanitize=shift
9948 This option enables checking that the result of a shift operation is
9949 not undefined. Note that what exactly is considered undefined differs
9950 slightly between C and C++, as well as between ISO C90 and C99, etc.
9951
9952 @item -fsanitize=integer-divide-by-zero
9953 @opindex fsanitize=integer-divide-by-zero
9954 Detect integer division by zero as well as @code{INT_MIN / -1} division.
9955
9956 @item -fsanitize=unreachable
9957 @opindex fsanitize=unreachable
9958 With this option, the compiler turns the @code{__builtin_unreachable}
9959 call into a diagnostics message call instead. When reaching the
9960 @code{__builtin_unreachable} call, the behavior is undefined.
9961
9962 @item -fsanitize=vla-bound
9963 @opindex fsanitize=vla-bound
9964 This option instructs the compiler to check that the size of a variable
9965 length array is positive.
9966
9967 @item -fsanitize=null
9968 @opindex fsanitize=null
9969 This option enables pointer checking. Particularly, the application
9970 built with this option turned on will issue an error message when it
9971 tries to dereference a NULL pointer, or if a reference (possibly an
9972 rvalue reference) is bound to a NULL pointer, or if a method is invoked
9973 on an object pointed by a NULL pointer.
9974
9975 @item -fsanitize=return
9976 @opindex fsanitize=return
9977 This option enables return statement checking. Programs
9978 built with this option turned on will issue an error message
9979 when the end of a non-void function is reached without actually
9980 returning a value. This option works in C++ only.
9981
9982 @item -fsanitize=signed-integer-overflow
9983 @opindex fsanitize=signed-integer-overflow
9984 This option enables signed integer overflow checking. We check that
9985 the result of @code{+}, @code{*}, and both unary and binary @code{-}
9986 does not overflow in the signed arithmetics. Note, integer promotion
9987 rules must be taken into account. That is, the following is not an
9988 overflow:
9989 @smallexample
9990 signed char a = SCHAR_MAX;
9991 a++;
9992 @end smallexample
9993
9994 @item -fsanitize=bounds
9995 @opindex fsanitize=bounds
9996 This option enables instrumentation of array bounds. Various out of bounds
9997 accesses are detected. Flexible array members, flexible array member-like
9998 arrays, and initializers of variables with static storage are not instrumented.
9999
10000 @item -fsanitize=bounds-strict
10001 @opindex fsanitize=bounds-strict
10002 This option enables strict instrumentation of array bounds. Most out of bounds
10003 accesses are detected, including flexible array members and flexible array
10004 member-like arrays. Initializers of variables with static storage are not
10005 instrumented.
10006
10007 @item -fsanitize=alignment
10008 @opindex fsanitize=alignment
10009
10010 This option enables checking of alignment of pointers when they are
10011 dereferenced, or when a reference is bound to insufficiently aligned target,
10012 or when a method or constructor is invoked on insufficiently aligned object.
10013
10014 @item -fsanitize=object-size
10015 @opindex fsanitize=object-size
10016 This option enables instrumentation of memory references using the
10017 @code{__builtin_object_size} function. Various out of bounds pointer
10018 accesses are detected.
10019
10020 @item -fsanitize=float-divide-by-zero
10021 @opindex fsanitize=float-divide-by-zero
10022 Detect floating-point division by zero. Unlike other similar options,
10023 @option{-fsanitize=float-divide-by-zero} is not enabled by
10024 @option{-fsanitize=undefined}, since floating-point division by zero can
10025 be a legitimate way of obtaining infinities and NaNs.
10026
10027 @item -fsanitize=float-cast-overflow
10028 @opindex fsanitize=float-cast-overflow
10029 This option enables floating-point type to integer conversion checking.
10030 We check that the result of the conversion does not overflow.
10031 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
10032 not enabled by @option{-fsanitize=undefined}.
10033 This option does not work well with @code{FE_INVALID} exceptions enabled.
10034
10035 @item -fsanitize=nonnull-attribute
10036 @opindex fsanitize=nonnull-attribute
10037
10038 This option enables instrumentation of calls, checking whether null values
10039 are not passed to arguments marked as requiring a non-null value by the
10040 @code{nonnull} function attribute.
10041
10042 @item -fsanitize=returns-nonnull-attribute
10043 @opindex fsanitize=returns-nonnull-attribute
10044
10045 This option enables instrumentation of return statements in functions
10046 marked with @code{returns_nonnull} function attribute, to detect returning
10047 of null values from such functions.
10048
10049 @item -fsanitize=bool
10050 @opindex fsanitize=bool
10051
10052 This option enables instrumentation of loads from bool. If a value other
10053 than 0/1 is loaded, a run-time error is issued.
10054
10055 @item -fsanitize=enum
10056 @opindex fsanitize=enum
10057
10058 This option enables instrumentation of loads from an enum type. If
10059 a value outside the range of values for the enum type is loaded,
10060 a run-time error is issued.
10061
10062 @item -fsanitize=vptr
10063 @opindex fsanitize=vptr
10064
10065 This option enables instrumentation of C++ member function calls, member
10066 accesses and some conversions between pointers to base and derived classes,
10067 to verify the referenced object has the correct dynamic type.
10068
10069 @end table
10070
10071 While @option{-ftrapv} causes traps for signed overflows to be emitted,
10072 @option{-fsanitize=undefined} gives a diagnostic message.
10073 This currently works only for the C family of languages.
10074
10075 @item -fno-sanitize=all
10076 @opindex fno-sanitize=all
10077
10078 This option disables all previously enabled sanitizers.
10079 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
10080 together.
10081
10082 @item -fasan-shadow-offset=@var{number}
10083 @opindex fasan-shadow-offset
10084 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
10085 It is useful for experimenting with different shadow memory layouts in
10086 Kernel AddressSanitizer.
10087
10088 @item -fsanitize-sections=@var{s1},@var{s2},...
10089 @opindex fsanitize-sections
10090 Sanitize global variables in selected user-defined sections. @var{si} may
10091 contain wildcards.
10092
10093 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
10094 @opindex fsanitize-recover
10095 @opindex fno-sanitize-recover
10096 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
10097 mentioned in comma-separated list of @var{opts}. Enabling this option
10098 for a sanitizer component causes it to attempt to continue
10099 running the program as if no error happened. This means multiple
10100 runtime errors can be reported in a single program run, and the exit
10101 code of the program may indicate success even when errors
10102 have been reported. The @option{-fno-sanitize-recover=} option
10103 can be used to alter
10104 this behavior: only the first detected error is reported
10105 and program then exits with a non-zero exit code.
10106
10107 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
10108 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
10109 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
10110 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
10111 For these sanitizers error recovery is turned on by default, except @option{-fsanitize=address},
10112 for which this feature is experimental.
10113 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
10114 accepted, the former enables recovery for all sanitizers that support it,
10115 the latter disables recovery for all sanitizers that support it.
10116
10117 Even if a recovery mode is turned on the compiler side, it needs to be also
10118 enabled on the runtime library side, otherwise the failures are still fatal.
10119 The runtime library defaults to @code{halt_on_error=0} for
10120 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
10121 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
10122 setting the @code{halt_on_error} flag in the corresponding environment variable.
10123
10124 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
10125 @smallexample
10126 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10127 @end smallexample
10128 @noindent
10129 Similarly @option{-fno-sanitize-recover} is equivalent to
10130 @smallexample
10131 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10132 @end smallexample
10133
10134 @item -fsanitize-undefined-trap-on-error
10135 @opindex fsanitize-undefined-trap-on-error
10136 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
10137 report undefined behavior using @code{__builtin_trap} rather than
10138 a @code{libubsan} library routine. The advantage of this is that the
10139 @code{libubsan} library is not needed and is not linked in, so this
10140 is usable even in freestanding environments.
10141
10142 @item -fsanitize-coverage=trace-pc
10143 @opindex fsanitize-coverage=trace-pc
10144 Enable coverage-guided fuzzing code instrumentation.
10145 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
10146
10147 @item -fbounds-check
10148 @opindex fbounds-check
10149 For front ends that support it, generate additional code to check that
10150 indices used to access arrays are within the declared range. This is
10151 currently only supported by the Java and Fortran front ends, where
10152 this option defaults to true and false respectively.
10153
10154 @item -fcheck-pointer-bounds
10155 @opindex fcheck-pointer-bounds
10156 @opindex fno-check-pointer-bounds
10157 @cindex Pointer Bounds Checker options
10158 Enable Pointer Bounds Checker instrumentation. Each memory reference
10159 is instrumented with checks of the pointer used for memory access against
10160 bounds associated with that pointer.
10161
10162 Currently there
10163 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
10164 and @option{-mmpx} are required to enable this feature.
10165 MPX-based instrumentation requires
10166 a runtime library to enable MPX in hardware and handle bounds
10167 violation signals. By default when @option{-fcheck-pointer-bounds}
10168 and @option{-mmpx} options are used to link a program, the GCC driver
10169 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
10170 Bounds checking on calls to dynamic libraries requires a linker
10171 with @option{-z bndplt} support; if GCC was configured with a linker
10172 without support for this option (including the Gold linker and older
10173 versions of ld), a warning is given if you link with @option{-mmpx}
10174 without also specifying @option{-static}, since the overall effectiveness
10175 of the bounds checking protection is reduced.
10176 See also @option{-static-libmpxwrappers}.
10177
10178 MPX-based instrumentation
10179 may be used for debugging and also may be included in production code
10180 to increase program security. Depending on usage, you may
10181 have different requirements for the runtime library. The current version
10182 of the MPX runtime library is more oriented for use as a debugging
10183 tool. MPX runtime library usage implies @option{-lpthread}. See
10184 also @option{-static-libmpx}. The runtime library behavior can be
10185 influenced using various @env{CHKP_RT_*} environment variables. See
10186 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
10187 for more details.
10188
10189 Generated instrumentation may be controlled by various
10190 @option{-fchkp-*} options and by the @code{bnd_variable_size}
10191 structure field attribute (@pxref{Type Attributes}) and
10192 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
10193 (@pxref{Function Attributes}). GCC also provides a number of built-in
10194 functions for controlling the Pointer Bounds Checker. @xref{Pointer
10195 Bounds Checker builtins}, for more information.
10196
10197 @item -fchkp-check-incomplete-type
10198 @opindex fchkp-check-incomplete-type
10199 @opindex fno-chkp-check-incomplete-type
10200 Generate pointer bounds checks for variables with incomplete type.
10201 Enabled by default.
10202
10203 @item -fchkp-narrow-bounds
10204 @opindex fchkp-narrow-bounds
10205 @opindex fno-chkp-narrow-bounds
10206 Controls bounds used by Pointer Bounds Checker for pointers to object
10207 fields. If narrowing is enabled then field bounds are used. Otherwise
10208 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
10209 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
10210
10211 @item -fchkp-first-field-has-own-bounds
10212 @opindex fchkp-first-field-has-own-bounds
10213 @opindex fno-chkp-first-field-has-own-bounds
10214 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
10215 first field in the structure. By default a pointer to the first field has
10216 the same bounds as a pointer to the whole structure.
10217
10218 @item -fchkp-narrow-to-innermost-array
10219 @opindex fchkp-narrow-to-innermost-array
10220 @opindex fno-chkp-narrow-to-innermost-array
10221 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
10222 case of nested static array access. By default this option is disabled and
10223 bounds of the outermost array are used.
10224
10225 @item -fchkp-optimize
10226 @opindex fchkp-optimize
10227 @opindex fno-chkp-optimize
10228 Enables Pointer Bounds Checker optimizations. Enabled by default at
10229 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
10230
10231 @item -fchkp-use-fast-string-functions
10232 @opindex fchkp-use-fast-string-functions
10233 @opindex fno-chkp-use-fast-string-functions
10234 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
10235 by Pointer Bounds Checker. Disabled by default.
10236
10237 @item -fchkp-use-nochk-string-functions
10238 @opindex fchkp-use-nochk-string-functions
10239 @opindex fno-chkp-use-nochk-string-functions
10240 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
10241 by Pointer Bounds Checker. Disabled by default.
10242
10243 @item -fchkp-use-static-bounds
10244 @opindex fchkp-use-static-bounds
10245 @opindex fno-chkp-use-static-bounds
10246 Allow Pointer Bounds Checker to generate static bounds holding
10247 bounds of static variables. Enabled by default.
10248
10249 @item -fchkp-use-static-const-bounds
10250 @opindex fchkp-use-static-const-bounds
10251 @opindex fno-chkp-use-static-const-bounds
10252 Use statically-initialized bounds for constant bounds instead of
10253 generating them each time they are required. By default enabled when
10254 @option{-fchkp-use-static-bounds} is enabled.
10255
10256 @item -fchkp-treat-zero-dynamic-size-as-infinite
10257 @opindex fchkp-treat-zero-dynamic-size-as-infinite
10258 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
10259 With this option, objects with incomplete type whose
10260 dynamically-obtained size is zero are treated as having infinite size
10261 instead by Pointer Bounds
10262 Checker. This option may be helpful if a program is linked with a library
10263 missing size information for some symbols. Disabled by default.
10264
10265 @item -fchkp-check-read
10266 @opindex fchkp-check-read
10267 @opindex fno-chkp-check-read
10268 Instructs Pointer Bounds Checker to generate checks for all read
10269 accesses to memory. Enabled by default.
10270
10271 @item -fchkp-check-write
10272 @opindex fchkp-check-write
10273 @opindex fno-chkp-check-write
10274 Instructs Pointer Bounds Checker to generate checks for all write
10275 accesses to memory. Enabled by default.
10276
10277 @item -fchkp-store-bounds
10278 @opindex fchkp-store-bounds
10279 @opindex fno-chkp-store-bounds
10280 Instructs Pointer Bounds Checker to generate bounds stores for
10281 pointer writes. Enabled by default.
10282
10283 @item -fchkp-instrument-calls
10284 @opindex fchkp-instrument-calls
10285 @opindex fno-chkp-instrument-calls
10286 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
10287 Enabled by default.
10288
10289 @item -fchkp-instrument-marked-only
10290 @opindex fchkp-instrument-marked-only
10291 @opindex fno-chkp-instrument-marked-only
10292 Instructs Pointer Bounds Checker to instrument only functions
10293 marked with the @code{bnd_instrument} attribute
10294 (@pxref{Function Attributes}). Disabled by default.
10295
10296 @item -fchkp-use-wrappers
10297 @opindex fchkp-use-wrappers
10298 @opindex fno-chkp-use-wrappers
10299 Allows Pointer Bounds Checker to replace calls to built-in functions
10300 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
10301 is used to link a program, the GCC driver automatically links
10302 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
10303 Enabled by default.
10304
10305 @item -fstack-protector
10306 @opindex fstack-protector
10307 Emit extra code to check for buffer overflows, such as stack smashing
10308 attacks. This is done by adding a guard variable to functions with
10309 vulnerable objects. This includes functions that call @code{alloca}, and
10310 functions with buffers larger than 8 bytes. The guards are initialized
10311 when a function is entered and then checked when the function exits.
10312 If a guard check fails, an error message is printed and the program exits.
10313
10314 @item -fstack-protector-all
10315 @opindex fstack-protector-all
10316 Like @option{-fstack-protector} except that all functions are protected.
10317
10318 @item -fstack-protector-strong
10319 @opindex fstack-protector-strong
10320 Like @option{-fstack-protector} but includes additional functions to
10321 be protected --- those that have local array definitions, or have
10322 references to local frame addresses.
10323
10324 @item -fstack-protector-explicit
10325 @opindex fstack-protector-explicit
10326 Like @option{-fstack-protector} but only protects those functions which
10327 have the @code{stack_protect} attribute.
10328
10329 @item -fstack-check
10330 @opindex fstack-check
10331 Generate code to verify that you do not go beyond the boundary of the
10332 stack. You should specify this flag if you are running in an
10333 environment with multiple threads, but you only rarely need to specify it in
10334 a single-threaded environment since stack overflow is automatically
10335 detected on nearly all systems if there is only one stack.
10336
10337 Note that this switch does not actually cause checking to be done; the
10338 operating system or the language runtime must do that. The switch causes
10339 generation of code to ensure that they see the stack being extended.
10340
10341 You can additionally specify a string parameter: @samp{no} means no
10342 checking, @samp{generic} means force the use of old-style checking,
10343 @samp{specific} means use the best checking method and is equivalent
10344 to bare @option{-fstack-check}.
10345
10346 Old-style checking is a generic mechanism that requires no specific
10347 target support in the compiler but comes with the following drawbacks:
10348
10349 @enumerate
10350 @item
10351 Modified allocation strategy for large objects: they are always
10352 allocated dynamically if their size exceeds a fixed threshold.
10353
10354 @item
10355 Fixed limit on the size of the static frame of functions: when it is
10356 topped by a particular function, stack checking is not reliable and
10357 a warning is issued by the compiler.
10358
10359 @item
10360 Inefficiency: because of both the modified allocation strategy and the
10361 generic implementation, code performance is hampered.
10362 @end enumerate
10363
10364 Note that old-style stack checking is also the fallback method for
10365 @samp{specific} if no target support has been added in the compiler.
10366
10367 @item -fstack-limit-register=@var{reg}
10368 @itemx -fstack-limit-symbol=@var{sym}
10369 @itemx -fno-stack-limit
10370 @opindex fstack-limit-register
10371 @opindex fstack-limit-symbol
10372 @opindex fno-stack-limit
10373 Generate code to ensure that the stack does not grow beyond a certain value,
10374 either the value of a register or the address of a symbol. If a larger
10375 stack is required, a signal is raised at run time. For most targets,
10376 the signal is raised before the stack overruns the boundary, so
10377 it is possible to catch the signal without taking special precautions.
10378
10379 For instance, if the stack starts at absolute address @samp{0x80000000}
10380 and grows downwards, you can use the flags
10381 @option{-fstack-limit-symbol=__stack_limit} and
10382 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10383 of 128KB@. Note that this may only work with the GNU linker.
10384
10385 You can locally override stack limit checking by using the
10386 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
10387
10388 @item -fsplit-stack
10389 @opindex fsplit-stack
10390 Generate code to automatically split the stack before it overflows.
10391 The resulting program has a discontiguous stack which can only
10392 overflow if the program is unable to allocate any more memory. This
10393 is most useful when running threaded programs, as it is no longer
10394 necessary to calculate a good stack size to use for each thread. This
10395 is currently only implemented for the x86 targets running
10396 GNU/Linux.
10397
10398 When code compiled with @option{-fsplit-stack} calls code compiled
10399 without @option{-fsplit-stack}, there may not be much stack space
10400 available for the latter code to run. If compiling all code,
10401 including library code, with @option{-fsplit-stack} is not an option,
10402 then the linker can fix up these calls so that the code compiled
10403 without @option{-fsplit-stack} always has a large stack. Support for
10404 this is implemented in the gold linker in GNU binutils release 2.21
10405 and later.
10406
10407 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
10408 @opindex fvtable-verify
10409 This option is only available when compiling C++ code.
10410 It turns on (or off, if using @option{-fvtable-verify=none}) the security
10411 feature that verifies at run time, for every virtual call, that
10412 the vtable pointer through which the call is made is valid for the type of
10413 the object, and has not been corrupted or overwritten. If an invalid vtable
10414 pointer is detected at run time, an error is reported and execution of the
10415 program is immediately halted.
10416
10417 This option causes run-time data structures to be built at program startup,
10418 which are used for verifying the vtable pointers.
10419 The options @samp{std} and @samp{preinit}
10420 control the timing of when these data structures are built. In both cases the
10421 data structures are built before execution reaches @code{main}. Using
10422 @option{-fvtable-verify=std} causes the data structures to be built after
10423 shared libraries have been loaded and initialized.
10424 @option{-fvtable-verify=preinit} causes them to be built before shared
10425 libraries have been loaded and initialized.
10426
10427 If this option appears multiple times in the command line with different
10428 values specified, @samp{none} takes highest priority over both @samp{std} and
10429 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
10430
10431 @item -fvtv-debug
10432 @opindex fvtv-debug
10433 When used in conjunction with @option{-fvtable-verify=std} or
10434 @option{-fvtable-verify=preinit}, causes debug versions of the
10435 runtime functions for the vtable verification feature to be called.
10436 This flag also causes the compiler to log information about which
10437 vtable pointers it finds for each class.
10438 This information is written to a file named @file{vtv_set_ptr_data.log}
10439 in the directory named by the environment variable @env{VTV_LOGS_DIR}
10440 if that is defined or the current working directory otherwise.
10441
10442 Note: This feature @emph{appends} data to the log file. If you want a fresh log
10443 file, be sure to delete any existing one.
10444
10445 @item -fvtv-counts
10446 @opindex fvtv-counts
10447 This is a debugging flag. When used in conjunction with
10448 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
10449 causes the compiler to keep track of the total number of virtual calls
10450 it encounters and the number of verifications it inserts. It also
10451 counts the number of calls to certain run-time library functions
10452 that it inserts and logs this information for each compilation unit.
10453 The compiler writes this information to a file named
10454 @file{vtv_count_data.log} in the directory named by the environment
10455 variable @env{VTV_LOGS_DIR} if that is defined or the current working
10456 directory otherwise. It also counts the size of the vtable pointer sets
10457 for each class, and writes this information to @file{vtv_class_set_sizes.log}
10458 in the same directory.
10459
10460 Note: This feature @emph{appends} data to the log files. To get fresh log
10461 files, be sure to delete any existing ones.
10462
10463 @item -finstrument-functions
10464 @opindex finstrument-functions
10465 Generate instrumentation calls for entry and exit to functions. Just
10466 after function entry and just before function exit, the following
10467 profiling functions are called with the address of the current
10468 function and its call site. (On some platforms,
10469 @code{__builtin_return_address} does not work beyond the current
10470 function, so the call site information may not be available to the
10471 profiling functions otherwise.)
10472
10473 @smallexample
10474 void __cyg_profile_func_enter (void *this_fn,
10475 void *call_site);
10476 void __cyg_profile_func_exit (void *this_fn,
10477 void *call_site);
10478 @end smallexample
10479
10480 The first argument is the address of the start of the current function,
10481 which may be looked up exactly in the symbol table.
10482
10483 This instrumentation is also done for functions expanded inline in other
10484 functions. The profiling calls indicate where, conceptually, the
10485 inline function is entered and exited. This means that addressable
10486 versions of such functions must be available. If all your uses of a
10487 function are expanded inline, this may mean an additional expansion of
10488 code size. If you use @code{extern inline} in your C code, an
10489 addressable version of such functions must be provided. (This is
10490 normally the case anyway, but if you get lucky and the optimizer always
10491 expands the functions inline, you might have gotten away without
10492 providing static copies.)
10493
10494 A function may be given the attribute @code{no_instrument_function}, in
10495 which case this instrumentation is not done. This can be used, for
10496 example, for the profiling functions listed above, high-priority
10497 interrupt routines, and any functions from which the profiling functions
10498 cannot safely be called (perhaps signal handlers, if the profiling
10499 routines generate output or allocate memory).
10500
10501 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
10502 @opindex finstrument-functions-exclude-file-list
10503
10504 Set the list of functions that are excluded from instrumentation (see
10505 the description of @option{-finstrument-functions}). If the file that
10506 contains a function definition matches with one of @var{file}, then
10507 that function is not instrumented. The match is done on substrings:
10508 if the @var{file} parameter is a substring of the file name, it is
10509 considered to be a match.
10510
10511 For example:
10512
10513 @smallexample
10514 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
10515 @end smallexample
10516
10517 @noindent
10518 excludes any inline function defined in files whose pathnames
10519 contain @file{/bits/stl} or @file{include/sys}.
10520
10521 If, for some reason, you want to include letter @samp{,} in one of
10522 @var{sym}, write @samp{\,}. For example,
10523 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
10524 (note the single quote surrounding the option).
10525
10526 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
10527 @opindex finstrument-functions-exclude-function-list
10528
10529 This is similar to @option{-finstrument-functions-exclude-file-list},
10530 but this option sets the list of function names to be excluded from
10531 instrumentation. The function name to be matched is its user-visible
10532 name, such as @code{vector<int> blah(const vector<int> &)}, not the
10533 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
10534 match is done on substrings: if the @var{sym} parameter is a substring
10535 of the function name, it is considered to be a match. For C99 and C++
10536 extended identifiers, the function name must be given in UTF-8, not
10537 using universal character names.
10538
10539 @end table
10540
10541
10542 @node Preprocessor Options
10543 @section Options Controlling the Preprocessor
10544 @cindex preprocessor options
10545 @cindex options, preprocessor
10546
10547 These options control the C preprocessor, which is run on each C source
10548 file before actual compilation.
10549
10550 If you use the @option{-E} option, nothing is done except preprocessing.
10551 Some of these options make sense only together with @option{-E} because
10552 they cause the preprocessor output to be unsuitable for actual
10553 compilation.
10554
10555 @table @gcctabopt
10556 @item -Wp,@var{option}
10557 @opindex Wp
10558 You can use @option{-Wp,@var{option}} to bypass the compiler driver
10559 and pass @var{option} directly through to the preprocessor. If
10560 @var{option} contains commas, it is split into multiple options at the
10561 commas. However, many options are modified, translated or interpreted
10562 by the compiler driver before being passed to the preprocessor, and
10563 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
10564 interface is undocumented and subject to change, so whenever possible
10565 you should avoid using @option{-Wp} and let the driver handle the
10566 options instead.
10567
10568 @item -Xpreprocessor @var{option}
10569 @opindex Xpreprocessor
10570 Pass @var{option} as an option to the preprocessor. You can use this to
10571 supply system-specific preprocessor options that GCC does not
10572 recognize.
10573
10574 If you want to pass an option that takes an argument, you must use
10575 @option{-Xpreprocessor} twice, once for the option and once for the argument.
10576
10577 @item -no-integrated-cpp
10578 @opindex no-integrated-cpp
10579 Perform preprocessing as a separate pass before compilation.
10580 By default, GCC performs preprocessing as an integrated part of
10581 input tokenization and parsing.
10582 If this option is provided, the appropriate language front end
10583 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
10584 and Objective-C, respectively) is instead invoked twice,
10585 once for preprocessing only and once for actual compilation
10586 of the preprocessed input.
10587 This option may be useful in conjunction with the @option{-B} or
10588 @option{-wrapper} options to specify an alternate preprocessor or
10589 perform additional processing of the program source between
10590 normal preprocessing and compilation.
10591 @end table
10592
10593 @include cppopts.texi
10594
10595 @node Assembler Options
10596 @section Passing Options to the Assembler
10597
10598 @c prevent bad page break with this line
10599 You can pass options to the assembler.
10600
10601 @table @gcctabopt
10602 @item -Wa,@var{option}
10603 @opindex Wa
10604 Pass @var{option} as an option to the assembler. If @var{option}
10605 contains commas, it is split into multiple options at the commas.
10606
10607 @item -Xassembler @var{option}
10608 @opindex Xassembler
10609 Pass @var{option} as an option to the assembler. You can use this to
10610 supply system-specific assembler options that GCC does not
10611 recognize.
10612
10613 If you want to pass an option that takes an argument, you must use
10614 @option{-Xassembler} twice, once for the option and once for the argument.
10615
10616 @end table
10617
10618 @node Link Options
10619 @section Options for Linking
10620 @cindex link options
10621 @cindex options, linking
10622
10623 These options come into play when the compiler links object files into
10624 an executable output file. They are meaningless if the compiler is
10625 not doing a link step.
10626
10627 @table @gcctabopt
10628 @cindex file names
10629 @item @var{object-file-name}
10630 A file name that does not end in a special recognized suffix is
10631 considered to name an object file or library. (Object files are
10632 distinguished from libraries by the linker according to the file
10633 contents.) If linking is done, these object files are used as input
10634 to the linker.
10635
10636 @item -c
10637 @itemx -S
10638 @itemx -E
10639 @opindex c
10640 @opindex S
10641 @opindex E
10642 If any of these options is used, then the linker is not run, and
10643 object file names should not be used as arguments. @xref{Overall
10644 Options}.
10645
10646 @item -fuse-ld=bfd
10647 @opindex fuse-ld=bfd
10648 Use the @command{bfd} linker instead of the default linker.
10649
10650 @item -fuse-ld=gold
10651 @opindex fuse-ld=gold
10652 Use the @command{gold} linker instead of the default linker.
10653
10654 @cindex Libraries
10655 @item -l@var{library}
10656 @itemx -l @var{library}
10657 @opindex l
10658 Search the library named @var{library} when linking. (The second
10659 alternative with the library as a separate argument is only for
10660 POSIX compliance and is not recommended.)
10661
10662 It makes a difference where in the command you write this option; the
10663 linker searches and processes libraries and object files in the order they
10664 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
10665 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
10666 to functions in @samp{z}, those functions may not be loaded.
10667
10668 The linker searches a standard list of directories for the library,
10669 which is actually a file named @file{lib@var{library}.a}. The linker
10670 then uses this file as if it had been specified precisely by name.
10671
10672 The directories searched include several standard system directories
10673 plus any that you specify with @option{-L}.
10674
10675 Normally the files found this way are library files---archive files
10676 whose members are object files. The linker handles an archive file by
10677 scanning through it for members which define symbols that have so far
10678 been referenced but not defined. But if the file that is found is an
10679 ordinary object file, it is linked in the usual fashion. The only
10680 difference between using an @option{-l} option and specifying a file name
10681 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
10682 and searches several directories.
10683
10684 @item -lobjc
10685 @opindex lobjc
10686 You need this special case of the @option{-l} option in order to
10687 link an Objective-C or Objective-C++ program.
10688
10689 @item -nostartfiles
10690 @opindex nostartfiles
10691 Do not use the standard system startup files when linking.
10692 The standard system libraries are used normally, unless @option{-nostdlib}
10693 or @option{-nodefaultlibs} is used.
10694
10695 @item -nodefaultlibs
10696 @opindex nodefaultlibs
10697 Do not use the standard system libraries when linking.
10698 Only the libraries you specify are passed to the linker, and options
10699 specifying linkage of the system libraries, such as @option{-static-libgcc}
10700 or @option{-shared-libgcc}, are ignored.
10701 The standard startup files are used normally, unless @option{-nostartfiles}
10702 is used.
10703
10704 The compiler may generate calls to @code{memcmp},
10705 @code{memset}, @code{memcpy} and @code{memmove}.
10706 These entries are usually resolved by entries in
10707 libc. These entry points should be supplied through some other
10708 mechanism when this option is specified.
10709
10710 @item -nostdlib
10711 @opindex nostdlib
10712 Do not use the standard system startup files or libraries when linking.
10713 No startup files and only the libraries you specify are passed to
10714 the linker, and options specifying linkage of the system libraries, such as
10715 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
10716
10717 The compiler may generate calls to @code{memcmp}, @code{memset},
10718 @code{memcpy} and @code{memmove}.
10719 These entries are usually resolved by entries in
10720 libc. These entry points should be supplied through some other
10721 mechanism when this option is specified.
10722
10723 @cindex @option{-lgcc}, use with @option{-nostdlib}
10724 @cindex @option{-nostdlib} and unresolved references
10725 @cindex unresolved references and @option{-nostdlib}
10726 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
10727 @cindex @option{-nodefaultlibs} and unresolved references
10728 @cindex unresolved references and @option{-nodefaultlibs}
10729 One of the standard libraries bypassed by @option{-nostdlib} and
10730 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
10731 which GCC uses to overcome shortcomings of particular machines, or special
10732 needs for some languages.
10733 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
10734 Collection (GCC) Internals},
10735 for more discussion of @file{libgcc.a}.)
10736 In most cases, you need @file{libgcc.a} even when you want to avoid
10737 other standard libraries. In other words, when you specify @option{-nostdlib}
10738 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
10739 This ensures that you have no unresolved references to internal GCC
10740 library subroutines.
10741 (An example of such an internal subroutine is @code{__main}, used to ensure C++
10742 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
10743 GNU Compiler Collection (GCC) Internals}.)
10744
10745 @item -pie
10746 @opindex pie
10747 Produce a position independent executable on targets that support it.
10748 For predictable results, you must also specify the same set of options
10749 used for compilation (@option{-fpie}, @option{-fPIE},
10750 or model suboptions) when you specify this linker option.
10751
10752 @item -no-pie
10753 @opindex no-pie
10754 Don't produce a position independent executable.
10755
10756 @item -rdynamic
10757 @opindex rdynamic
10758 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
10759 that support it. This instructs the linker to add all symbols, not
10760 only used ones, to the dynamic symbol table. This option is needed
10761 for some uses of @code{dlopen} or to allow obtaining backtraces
10762 from within a program.
10763
10764 @item -s
10765 @opindex s
10766 Remove all symbol table and relocation information from the executable.
10767
10768 @item -static
10769 @opindex static
10770 On systems that support dynamic linking, this prevents linking with the shared
10771 libraries. On other systems, this option has no effect.
10772
10773 @item -shared
10774 @opindex shared
10775 Produce a shared object which can then be linked with other objects to
10776 form an executable. Not all systems support this option. For predictable
10777 results, you must also specify the same set of options used for compilation
10778 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
10779 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
10780 needs to build supplementary stub code for constructors to work. On
10781 multi-libbed systems, @samp{gcc -shared} must select the correct support
10782 libraries to link against. Failing to supply the correct flags may lead
10783 to subtle defects. Supplying them in cases where they are not necessary
10784 is innocuous.}
10785
10786 @item -shared-libgcc
10787 @itemx -static-libgcc
10788 @opindex shared-libgcc
10789 @opindex static-libgcc
10790 On systems that provide @file{libgcc} as a shared library, these options
10791 force the use of either the shared or static version, respectively.
10792 If no shared version of @file{libgcc} was built when the compiler was
10793 configured, these options have no effect.
10794
10795 There are several situations in which an application should use the
10796 shared @file{libgcc} instead of the static version. The most common
10797 of these is when the application wishes to throw and catch exceptions
10798 across different shared libraries. In that case, each of the libraries
10799 as well as the application itself should use the shared @file{libgcc}.
10800
10801 Therefore, the G++ and GCJ drivers automatically add
10802 @option{-shared-libgcc} whenever you build a shared library or a main
10803 executable, because C++ and Java programs typically use exceptions, so
10804 this is the right thing to do.
10805
10806 If, instead, you use the GCC driver to create shared libraries, you may
10807 find that they are not always linked with the shared @file{libgcc}.
10808 If GCC finds, at its configuration time, that you have a non-GNU linker
10809 or a GNU linker that does not support option @option{--eh-frame-hdr},
10810 it links the shared version of @file{libgcc} into shared libraries
10811 by default. Otherwise, it takes advantage of the linker and optimizes
10812 away the linking with the shared version of @file{libgcc}, linking with
10813 the static version of libgcc by default. This allows exceptions to
10814 propagate through such shared libraries, without incurring relocation
10815 costs at library load time.
10816
10817 However, if a library or main executable is supposed to throw or catch
10818 exceptions, you must link it using the G++ or GCJ driver, as appropriate
10819 for the languages used in the program, or using the option
10820 @option{-shared-libgcc}, such that it is linked with the shared
10821 @file{libgcc}.
10822
10823 @item -static-libasan
10824 @opindex static-libasan
10825 When the @option{-fsanitize=address} option is used to link a program,
10826 the GCC driver automatically links against @option{libasan}. If
10827 @file{libasan} is available as a shared library, and the @option{-static}
10828 option is not used, then this links against the shared version of
10829 @file{libasan}. The @option{-static-libasan} option directs the GCC
10830 driver to link @file{libasan} statically, without necessarily linking
10831 other libraries statically.
10832
10833 @item -static-libtsan
10834 @opindex static-libtsan
10835 When the @option{-fsanitize=thread} option is used to link a program,
10836 the GCC driver automatically links against @option{libtsan}. If
10837 @file{libtsan} is available as a shared library, and the @option{-static}
10838 option is not used, then this links against the shared version of
10839 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
10840 driver to link @file{libtsan} statically, without necessarily linking
10841 other libraries statically.
10842
10843 @item -static-liblsan
10844 @opindex static-liblsan
10845 When the @option{-fsanitize=leak} option is used to link a program,
10846 the GCC driver automatically links against @option{liblsan}. If
10847 @file{liblsan} is available as a shared library, and the @option{-static}
10848 option is not used, then this links against the shared version of
10849 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
10850 driver to link @file{liblsan} statically, without necessarily linking
10851 other libraries statically.
10852
10853 @item -static-libubsan
10854 @opindex static-libubsan
10855 When the @option{-fsanitize=undefined} option is used to link a program,
10856 the GCC driver automatically links against @option{libubsan}. If
10857 @file{libubsan} is available as a shared library, and the @option{-static}
10858 option is not used, then this links against the shared version of
10859 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
10860 driver to link @file{libubsan} statically, without necessarily linking
10861 other libraries statically.
10862
10863 @item -static-libmpx
10864 @opindex static-libmpx
10865 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
10866 used to link a program, the GCC driver automatically links against
10867 @file{libmpx}. If @file{libmpx} is available as a shared library,
10868 and the @option{-static} option is not used, then this links against
10869 the shared version of @file{libmpx}. The @option{-static-libmpx}
10870 option directs the GCC driver to link @file{libmpx} statically,
10871 without necessarily linking other libraries statically.
10872
10873 @item -static-libmpxwrappers
10874 @opindex static-libmpxwrappers
10875 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
10876 to link a program without also using @option{-fno-chkp-use-wrappers}, the
10877 GCC driver automatically links against @file{libmpxwrappers}. If
10878 @file{libmpxwrappers} is available as a shared library, and the
10879 @option{-static} option is not used, then this links against the shared
10880 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
10881 option directs the GCC driver to link @file{libmpxwrappers} statically,
10882 without necessarily linking other libraries statically.
10883
10884 @item -static-libstdc++
10885 @opindex static-libstdc++
10886 When the @command{g++} program is used to link a C++ program, it
10887 normally automatically links against @option{libstdc++}. If
10888 @file{libstdc++} is available as a shared library, and the
10889 @option{-static} option is not used, then this links against the
10890 shared version of @file{libstdc++}. That is normally fine. However, it
10891 is sometimes useful to freeze the version of @file{libstdc++} used by
10892 the program without going all the way to a fully static link. The
10893 @option{-static-libstdc++} option directs the @command{g++} driver to
10894 link @file{libstdc++} statically, without necessarily linking other
10895 libraries statically.
10896
10897 @item -symbolic
10898 @opindex symbolic
10899 Bind references to global symbols when building a shared object. Warn
10900 about any unresolved references (unless overridden by the link editor
10901 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
10902 this option.
10903
10904 @item -T @var{script}
10905 @opindex T
10906 @cindex linker script
10907 Use @var{script} as the linker script. This option is supported by most
10908 systems using the GNU linker. On some targets, such as bare-board
10909 targets without an operating system, the @option{-T} option may be required
10910 when linking to avoid references to undefined symbols.
10911
10912 @item -Xlinker @var{option}
10913 @opindex Xlinker
10914 Pass @var{option} as an option to the linker. You can use this to
10915 supply system-specific linker options that GCC does not recognize.
10916
10917 If you want to pass an option that takes a separate argument, you must use
10918 @option{-Xlinker} twice, once for the option and once for the argument.
10919 For example, to pass @option{-assert definitions}, you must write
10920 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
10921 @option{-Xlinker "-assert definitions"}, because this passes the entire
10922 string as a single argument, which is not what the linker expects.
10923
10924 When using the GNU linker, it is usually more convenient to pass
10925 arguments to linker options using the @option{@var{option}=@var{value}}
10926 syntax than as separate arguments. For example, you can specify
10927 @option{-Xlinker -Map=output.map} rather than
10928 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
10929 this syntax for command-line options.
10930
10931 @item -Wl,@var{option}
10932 @opindex Wl
10933 Pass @var{option} as an option to the linker. If @var{option} contains
10934 commas, it is split into multiple options at the commas. You can use this
10935 syntax to pass an argument to the option.
10936 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
10937 linker. When using the GNU linker, you can also get the same effect with
10938 @option{-Wl,-Map=output.map}.
10939
10940 @item -u @var{symbol}
10941 @opindex u
10942 Pretend the symbol @var{symbol} is undefined, to force linking of
10943 library modules to define it. You can use @option{-u} multiple times with
10944 different symbols to force loading of additional library modules.
10945
10946 @item -z @var{keyword}
10947 @opindex z
10948 @option{-z} is passed directly on to the linker along with the keyword
10949 @var{keyword}. See the section in the documentation of your linker for
10950 permitted values and their meanings.
10951 @end table
10952
10953 @node Directory Options
10954 @section Options for Directory Search
10955 @cindex directory options
10956 @cindex options, directory search
10957 @cindex search path
10958
10959 These options specify directories to search for header files, for
10960 libraries and for parts of the compiler:
10961
10962 @table @gcctabopt
10963 @item -I@var{dir}
10964 @opindex I
10965 Add the directory @var{dir} to the head of the list of directories to be
10966 searched for header files. This can be used to override a system header
10967 file, substituting your own version, since these directories are
10968 searched before the system header file directories. However, you should
10969 not use this option to add directories that contain vendor-supplied
10970 system header files (use @option{-isystem} for that). If you use more than
10971 one @option{-I} option, the directories are scanned in left-to-right
10972 order; the standard system directories come after.
10973
10974 If a standard system include directory, or a directory specified with
10975 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
10976 option is ignored. The directory is still searched but as a
10977 system directory at its normal position in the system include chain.
10978 This is to ensure that GCC's procedure to fix buggy system headers and
10979 the ordering for the @code{include_next} directive are not inadvertently changed.
10980 If you really need to change the search order for system directories,
10981 use the @option{-nostdinc} and/or @option{-isystem} options.
10982
10983 @item -iplugindir=@var{dir}
10984 @opindex iplugindir=
10985 Set the directory to search for plugins that are passed
10986 by @option{-fplugin=@var{name}} instead of
10987 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
10988 to be used by the user, but only passed by the driver.
10989
10990 @item -iquote@var{dir}
10991 @opindex iquote
10992 Add the directory @var{dir} to the head of the list of directories to
10993 be searched for header files only for the case of @code{#include
10994 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
10995 otherwise just like @option{-I}.
10996
10997 @item -L@var{dir}
10998 @opindex L
10999 Add directory @var{dir} to the list of directories to be searched
11000 for @option{-l}.
11001
11002 @item -B@var{prefix}
11003 @opindex B
11004 This option specifies where to find the executables, libraries,
11005 include files, and data files of the compiler itself.
11006
11007 The compiler driver program runs one or more of the subprograms
11008 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
11009 @var{prefix} as a prefix for each program it tries to run, both with and
11010 without @samp{@var{machine}/@var{version}/} for the corresponding target
11011 machine and compiler version.
11012
11013 For each subprogram to be run, the compiler driver first tries the
11014 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
11015 is not specified, the driver tries two standard prefixes,
11016 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
11017 those results in a file name that is found, the unmodified program
11018 name is searched for using the directories specified in your
11019 @env{PATH} environment variable.
11020
11021 The compiler checks to see if the path provided by @option{-B}
11022 refers to a directory, and if necessary it adds a directory
11023 separator character at the end of the path.
11024
11025 @option{-B} prefixes that effectively specify directory names also apply
11026 to libraries in the linker, because the compiler translates these
11027 options into @option{-L} options for the linker. They also apply to
11028 include files in the preprocessor, because the compiler translates these
11029 options into @option{-isystem} options for the preprocessor. In this case,
11030 the compiler appends @samp{include} to the prefix.
11031
11032 The runtime support file @file{libgcc.a} can also be searched for using
11033 the @option{-B} prefix, if needed. If it is not found there, the two
11034 standard prefixes above are tried, and that is all. The file is left
11035 out of the link if it is not found by those means.
11036
11037 Another way to specify a prefix much like the @option{-B} prefix is to use
11038 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
11039 Variables}.
11040
11041 As a special kludge, if the path provided by @option{-B} is
11042 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
11043 9, then it is replaced by @file{[dir/]include}. This is to help
11044 with boot-strapping the compiler.
11045
11046 @item -no-canonical-prefixes
11047 @opindex no-canonical-prefixes
11048 Do not expand any symbolic links, resolve references to @samp{/../}
11049 or @samp{/./}, or make the path absolute when generating a relative
11050 prefix.
11051
11052 @item --sysroot=@var{dir}
11053 @opindex sysroot
11054 Use @var{dir} as the logical root directory for headers and libraries.
11055 For example, if the compiler normally searches for headers in
11056 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
11057 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
11058
11059 If you use both this option and the @option{-isysroot} option, then
11060 the @option{--sysroot} option applies to libraries, but the
11061 @option{-isysroot} option applies to header files.
11062
11063 The GNU linker (beginning with version 2.16) has the necessary support
11064 for this option. If your linker does not support this option, the
11065 header file aspect of @option{--sysroot} still works, but the
11066 library aspect does not.
11067
11068 @item --no-sysroot-suffix
11069 @opindex no-sysroot-suffix
11070 For some targets, a suffix is added to the root directory specified
11071 with @option{--sysroot}, depending on the other options used, so that
11072 headers may for example be found in
11073 @file{@var{dir}/@var{suffix}/usr/include} instead of
11074 @file{@var{dir}/usr/include}. This option disables the addition of
11075 such a suffix.
11076
11077 @item -I-
11078 @opindex I-
11079 This option has been deprecated. Please use @option{-iquote} instead for
11080 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
11081 option.
11082 Any directories you specify with @option{-I} options before the @option{-I-}
11083 option are searched only for the case of @code{#include "@var{file}"};
11084 they are not searched for @code{#include <@var{file}>}.
11085
11086 If additional directories are specified with @option{-I} options after
11087 the @option{-I-} option, these directories are searched for all @code{#include}
11088 directives. (Ordinarily @emph{all} @option{-I} directories are used
11089 this way.)
11090
11091 In addition, the @option{-I-} option inhibits the use of the current
11092 directory (where the current input file came from) as the first search
11093 directory for @code{#include "@var{file}"}. There is no way to
11094 override this effect of @option{-I-}. With @option{-I.} you can specify
11095 searching the directory that is current when the compiler is
11096 invoked. That is not exactly the same as what the preprocessor does
11097 by default, but it is often satisfactory.
11098
11099 @option{-I-} does not inhibit the use of the standard system directories
11100 for header files. Thus, @option{-I-} and @option{-nostdinc} are
11101 independent.
11102 @end table
11103
11104 @node Code Gen Options
11105 @section Options for Code Generation Conventions
11106 @cindex code generation conventions
11107 @cindex options, code generation
11108 @cindex run-time options
11109
11110 These machine-independent options control the interface conventions
11111 used in code generation.
11112
11113 Most of them have both positive and negative forms; the negative form
11114 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
11115 one of the forms is listed---the one that is not the default. You
11116 can figure out the other form by either removing @samp{no-} or adding
11117 it.
11118
11119 @table @gcctabopt
11120 @item -fstack-reuse=@var{reuse-level}
11121 @opindex fstack_reuse
11122 This option controls stack space reuse for user declared local/auto variables
11123 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
11124 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
11125 local variables and temporaries, @samp{named_vars} enables the reuse only for
11126 user defined local variables with names, and @samp{none} disables stack reuse
11127 completely. The default value is @samp{all}. The option is needed when the
11128 program extends the lifetime of a scoped local variable or a compiler generated
11129 temporary beyond the end point defined by the language. When a lifetime of
11130 a variable ends, and if the variable lives in memory, the optimizing compiler
11131 has the freedom to reuse its stack space with other temporaries or scoped
11132 local variables whose live range does not overlap with it. Legacy code extending
11133 local lifetime is likely to break with the stack reuse optimization.
11134
11135 For example,
11136
11137 @smallexample
11138 int *p;
11139 @{
11140 int local1;
11141
11142 p = &local1;
11143 local1 = 10;
11144 ....
11145 @}
11146 @{
11147 int local2;
11148 local2 = 20;
11149 ...
11150 @}
11151
11152 if (*p == 10) // out of scope use of local1
11153 @{
11154
11155 @}
11156 @end smallexample
11157
11158 Another example:
11159 @smallexample
11160
11161 struct A
11162 @{
11163 A(int k) : i(k), j(k) @{ @}
11164 int i;
11165 int j;
11166 @};
11167
11168 A *ap;
11169
11170 void foo(const A& ar)
11171 @{
11172 ap = &ar;
11173 @}
11174
11175 void bar()
11176 @{
11177 foo(A(10)); // temp object's lifetime ends when foo returns
11178
11179 @{
11180 A a(20);
11181 ....
11182 @}
11183 ap->i+= 10; // ap references out of scope temp whose space
11184 // is reused with a. What is the value of ap->i?
11185 @}
11186
11187 @end smallexample
11188
11189 The lifetime of a compiler generated temporary is well defined by the C++
11190 standard. When a lifetime of a temporary ends, and if the temporary lives
11191 in memory, the optimizing compiler has the freedom to reuse its stack
11192 space with other temporaries or scoped local variables whose live range
11193 does not overlap with it. However some of the legacy code relies on
11194 the behavior of older compilers in which temporaries' stack space is
11195 not reused, the aggressive stack reuse can lead to runtime errors. This
11196 option is used to control the temporary stack reuse optimization.
11197
11198 @item -ftrapv
11199 @opindex ftrapv
11200 This option generates traps for signed overflow on addition, subtraction,
11201 multiplication operations.
11202 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11203 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11204 @option{-fwrapv} being effective. Note that only active options override, so
11205 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11206 results in @option{-ftrapv} being effective.
11207
11208 @item -fwrapv
11209 @opindex fwrapv
11210 This option instructs the compiler to assume that signed arithmetic
11211 overflow of addition, subtraction and multiplication wraps around
11212 using twos-complement representation. This flag enables some optimizations
11213 and disables others. This option is enabled by default for the Java
11214 front end, as required by the Java language specification.
11215 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11216 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11217 @option{-fwrapv} being effective. Note that only active options override, so
11218 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11219 results in @option{-ftrapv} being effective.
11220
11221 @item -fexceptions
11222 @opindex fexceptions
11223 Enable exception handling. Generates extra code needed to propagate
11224 exceptions. For some targets, this implies GCC generates frame
11225 unwind information for all functions, which can produce significant data
11226 size overhead, although it does not affect execution. If you do not
11227 specify this option, GCC enables it by default for languages like
11228 C++ that normally require exception handling, and disables it for
11229 languages like C that do not normally require it. However, you may need
11230 to enable this option when compiling C code that needs to interoperate
11231 properly with exception handlers written in C++. You may also wish to
11232 disable this option if you are compiling older C++ programs that don't
11233 use exception handling.
11234
11235 @item -fnon-call-exceptions
11236 @opindex fnon-call-exceptions
11237 Generate code that allows trapping instructions to throw exceptions.
11238 Note that this requires platform-specific runtime support that does
11239 not exist everywhere. Moreover, it only allows @emph{trapping}
11240 instructions to throw exceptions, i.e.@: memory references or floating-point
11241 instructions. It does not allow exceptions to be thrown from
11242 arbitrary signal handlers such as @code{SIGALRM}.
11243
11244 @item -fdelete-dead-exceptions
11245 @opindex fdelete-dead-exceptions
11246 Consider that instructions that may throw exceptions but don't otherwise
11247 contribute to the execution of the program can be optimized away.
11248 This option is enabled by default for the Ada front end, as permitted by
11249 the Ada language specification.
11250 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
11251
11252 @item -funwind-tables
11253 @opindex funwind-tables
11254 Similar to @option{-fexceptions}, except that it just generates any needed
11255 static data, but does not affect the generated code in any other way.
11256 You normally do not need to enable this option; instead, a language processor
11257 that needs this handling enables it on your behalf.
11258
11259 @item -fasynchronous-unwind-tables
11260 @opindex fasynchronous-unwind-tables
11261 Generate unwind table in DWARF format, if supported by target machine. The
11262 table is exact at each instruction boundary, so it can be used for stack
11263 unwinding from asynchronous events (such as debugger or garbage collector).
11264
11265 @item -fno-gnu-unique
11266 @opindex fno-gnu-unique
11267 On systems with recent GNU assembler and C library, the C++ compiler
11268 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
11269 of template static data members and static local variables in inline
11270 functions are unique even in the presence of @code{RTLD_LOCAL}; this
11271 is necessary to avoid problems with a library used by two different
11272 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
11273 therefore disagreeing with the other one about the binding of the
11274 symbol. But this causes @code{dlclose} to be ignored for affected
11275 DSOs; if your program relies on reinitialization of a DSO via
11276 @code{dlclose} and @code{dlopen}, you can use
11277 @option{-fno-gnu-unique}.
11278
11279 @item -fpcc-struct-return
11280 @opindex fpcc-struct-return
11281 Return ``short'' @code{struct} and @code{union} values in memory like
11282 longer ones, rather than in registers. This convention is less
11283 efficient, but it has the advantage of allowing intercallability between
11284 GCC-compiled files and files compiled with other compilers, particularly
11285 the Portable C Compiler (pcc).
11286
11287 The precise convention for returning structures in memory depends
11288 on the target configuration macros.
11289
11290 Short structures and unions are those whose size and alignment match
11291 that of some integer type.
11292
11293 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11294 switch is not binary compatible with code compiled with the
11295 @option{-freg-struct-return} switch.
11296 Use it to conform to a non-default application binary interface.
11297
11298 @item -freg-struct-return
11299 @opindex freg-struct-return
11300 Return @code{struct} and @code{union} values in registers when possible.
11301 This is more efficient for small structures than
11302 @option{-fpcc-struct-return}.
11303
11304 If you specify neither @option{-fpcc-struct-return} nor
11305 @option{-freg-struct-return}, GCC defaults to whichever convention is
11306 standard for the target. If there is no standard convention, GCC
11307 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11308 the principal compiler. In those cases, we can choose the standard, and
11309 we chose the more efficient register return alternative.
11310
11311 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11312 switch is not binary compatible with code compiled with the
11313 @option{-fpcc-struct-return} switch.
11314 Use it to conform to a non-default application binary interface.
11315
11316 @item -fshort-enums
11317 @opindex fshort-enums
11318 Allocate to an @code{enum} type only as many bytes as it needs for the
11319 declared range of possible values. Specifically, the @code{enum} type
11320 is equivalent to the smallest integer type that has enough room.
11321
11322 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11323 code that is not binary compatible with code generated without that switch.
11324 Use it to conform to a non-default application binary interface.
11325
11326 @item -fshort-wchar
11327 @opindex fshort-wchar
11328 Override the underlying type for @code{wchar_t} to be @code{short
11329 unsigned int} instead of the default for the target. This option is
11330 useful for building programs to run under WINE@.
11331
11332 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11333 code that is not binary compatible with code generated without that switch.
11334 Use it to conform to a non-default application binary interface.
11335
11336 @item -fno-common
11337 @opindex fno-common
11338 In C code, controls the placement of uninitialized global variables.
11339 Unix C compilers have traditionally permitted multiple definitions of
11340 such variables in different compilation units by placing the variables
11341 in a common block.
11342 This is the behavior specified by @option{-fcommon}, and is the default
11343 for GCC on most targets.
11344 On the other hand, this behavior is not required by ISO C, and on some
11345 targets may carry a speed or code size penalty on variable references.
11346 The @option{-fno-common} option specifies that the compiler should place
11347 uninitialized global variables in the data section of the object file,
11348 rather than generating them as common blocks.
11349 This has the effect that if the same variable is declared
11350 (without @code{extern}) in two different compilations,
11351 you get a multiple-definition error when you link them.
11352 In this case, you must compile with @option{-fcommon} instead.
11353 Compiling with @option{-fno-common} is useful on targets for which
11354 it provides better performance, or if you wish to verify that the
11355 program will work on other systems that always treat uninitialized
11356 variable declarations this way.
11357
11358 @item -fno-ident
11359 @opindex fno-ident
11360 Ignore the @code{#ident} directive.
11361
11362 @item -finhibit-size-directive
11363 @opindex finhibit-size-directive
11364 Don't output a @code{.size} assembler directive, or anything else that
11365 would cause trouble if the function is split in the middle, and the
11366 two halves are placed at locations far apart in memory. This option is
11367 used when compiling @file{crtstuff.c}; you should not need to use it
11368 for anything else.
11369
11370 @item -fverbose-asm
11371 @opindex fverbose-asm
11372 Put extra commentary information in the generated assembly code to
11373 make it more readable. This option is generally only of use to those
11374 who actually need to read the generated assembly code (perhaps while
11375 debugging the compiler itself).
11376
11377 @option{-fno-verbose-asm}, the default, causes the
11378 extra information to be omitted and is useful when comparing two assembler
11379 files.
11380
11381 @item -frecord-gcc-switches
11382 @opindex frecord-gcc-switches
11383 This switch causes the command line used to invoke the
11384 compiler to be recorded into the object file that is being created.
11385 This switch is only implemented on some targets and the exact format
11386 of the recording is target and binary file format dependent, but it
11387 usually takes the form of a section containing ASCII text. This
11388 switch is related to the @option{-fverbose-asm} switch, but that
11389 switch only records information in the assembler output file as
11390 comments, so it never reaches the object file.
11391 See also @option{-grecord-gcc-switches} for another
11392 way of storing compiler options into the object file.
11393
11394 @item -fpic
11395 @opindex fpic
11396 @cindex global offset table
11397 @cindex PIC
11398 Generate position-independent code (PIC) suitable for use in a shared
11399 library, if supported for the target machine. Such code accesses all
11400 constant addresses through a global offset table (GOT)@. The dynamic
11401 loader resolves the GOT entries when the program starts (the dynamic
11402 loader is not part of GCC; it is part of the operating system). If
11403 the GOT size for the linked executable exceeds a machine-specific
11404 maximum size, you get an error message from the linker indicating that
11405 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
11406 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
11407 on the m68k and RS/6000. The x86 has no such limit.)
11408
11409 Position-independent code requires special support, and therefore works
11410 only on certain machines. For the x86, GCC supports PIC for System V
11411 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
11412 position-independent.
11413
11414 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11415 are defined to 1.
11416
11417 @item -fPIC
11418 @opindex fPIC
11419 If supported for the target machine, emit position-independent code,
11420 suitable for dynamic linking and avoiding any limit on the size of the
11421 global offset table. This option makes a difference on AArch64, m68k,
11422 PowerPC and SPARC@.
11423
11424 Position-independent code requires special support, and therefore works
11425 only on certain machines.
11426
11427 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11428 are defined to 2.
11429
11430 @item -fpie
11431 @itemx -fPIE
11432 @opindex fpie
11433 @opindex fPIE
11434 These options are similar to @option{-fpic} and @option{-fPIC}, but
11435 generated position independent code can be only linked into executables.
11436 Usually these options are used when @option{-pie} GCC option is
11437 used during linking.
11438
11439 @option{-fpie} and @option{-fPIE} both define the macros
11440 @code{__pie__} and @code{__PIE__}. The macros have the value 1
11441 for @option{-fpie} and 2 for @option{-fPIE}.
11442
11443 @item -fno-plt
11444 @opindex fno-plt
11445 Do not use the PLT for external function calls in position-independent code.
11446 Instead, load the callee address at call sites from the GOT and branch to it.
11447 This leads to more efficient code by eliminating PLT stubs and exposing
11448 GOT loads to optimizations. On architectures such as 32-bit x86 where
11449 PLT stubs expect the GOT pointer in a specific register, this gives more
11450 register allocation freedom to the compiler.
11451 Lazy binding requires use of the PLT;
11452 with @option{-fno-plt} all external symbols are resolved at load time.
11453
11454 Alternatively, the function attribute @code{noplt} can be used to avoid calls
11455 through the PLT for specific external functions.
11456
11457 In position-dependent code, a few targets also convert calls to
11458 functions that are marked to not use the PLT to use the GOT instead.
11459
11460 @item -fno-jump-tables
11461 @opindex fno-jump-tables
11462 Do not use jump tables for switch statements even where it would be
11463 more efficient than other code generation strategies. This option is
11464 of use in conjunction with @option{-fpic} or @option{-fPIC} for
11465 building code that forms part of a dynamic linker and cannot
11466 reference the address of a jump table. On some targets, jump tables
11467 do not require a GOT and this option is not needed.
11468
11469 @item -ffixed-@var{reg}
11470 @opindex ffixed
11471 Treat the register named @var{reg} as a fixed register; generated code
11472 should never refer to it (except perhaps as a stack pointer, frame
11473 pointer or in some other fixed role).
11474
11475 @var{reg} must be the name of a register. The register names accepted
11476 are machine-specific and are defined in the @code{REGISTER_NAMES}
11477 macro in the machine description macro file.
11478
11479 This flag does not have a negative form, because it specifies a
11480 three-way choice.
11481
11482 @item -fcall-used-@var{reg}
11483 @opindex fcall-used
11484 Treat the register named @var{reg} as an allocable register that is
11485 clobbered by function calls. It may be allocated for temporaries or
11486 variables that do not live across a call. Functions compiled this way
11487 do not save and restore the register @var{reg}.
11488
11489 It is an error to use this flag with the frame pointer or stack pointer.
11490 Use of this flag for other registers that have fixed pervasive roles in
11491 the machine's execution model produces disastrous results.
11492
11493 This flag does not have a negative form, because it specifies a
11494 three-way choice.
11495
11496 @item -fcall-saved-@var{reg}
11497 @opindex fcall-saved
11498 Treat the register named @var{reg} as an allocable register saved by
11499 functions. It may be allocated even for temporaries or variables that
11500 live across a call. Functions compiled this way save and restore
11501 the register @var{reg} if they use it.
11502
11503 It is an error to use this flag with the frame pointer or stack pointer.
11504 Use of this flag for other registers that have fixed pervasive roles in
11505 the machine's execution model produces disastrous results.
11506
11507 A different sort of disaster results from the use of this flag for
11508 a register in which function values may be returned.
11509
11510 This flag does not have a negative form, because it specifies a
11511 three-way choice.
11512
11513 @item -fpack-struct[=@var{n}]
11514 @opindex fpack-struct
11515 Without a value specified, pack all structure members together without
11516 holes. When a value is specified (which must be a small power of two), pack
11517 structure members according to this value, representing the maximum
11518 alignment (that is, objects with default alignment requirements larger than
11519 this are output potentially unaligned at the next fitting location.
11520
11521 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11522 code that is not binary compatible with code generated without that switch.
11523 Additionally, it makes the code suboptimal.
11524 Use it to conform to a non-default application binary interface.
11525
11526 @item -fleading-underscore
11527 @opindex fleading-underscore
11528 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11529 change the way C symbols are represented in the object file. One use
11530 is to help link with legacy assembly code.
11531
11532 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11533 generate code that is not binary compatible with code generated without that
11534 switch. Use it to conform to a non-default application binary interface.
11535 Not all targets provide complete support for this switch.
11536
11537 @item -ftls-model=@var{model}
11538 @opindex ftls-model
11539 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11540 The @var{model} argument should be one of @samp{global-dynamic},
11541 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
11542 Note that the choice is subject to optimization: the compiler may use
11543 a more efficient model for symbols not visible outside of the translation
11544 unit, or if @option{-fpic} is not given on the command line.
11545
11546 The default without @option{-fpic} is @samp{initial-exec}; with
11547 @option{-fpic} the default is @samp{global-dynamic}.
11548
11549 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
11550 @opindex fvisibility
11551 Set the default ELF image symbol visibility to the specified option---all
11552 symbols are marked with this unless overridden within the code.
11553 Using this feature can very substantially improve linking and
11554 load times of shared object libraries, produce more optimized
11555 code, provide near-perfect API export and prevent symbol clashes.
11556 It is @strong{strongly} recommended that you use this in any shared objects
11557 you distribute.
11558
11559 Despite the nomenclature, @samp{default} always means public; i.e.,
11560 available to be linked against from outside the shared object.
11561 @samp{protected} and @samp{internal} are pretty useless in real-world
11562 usage so the only other commonly used option is @samp{hidden}.
11563 The default if @option{-fvisibility} isn't specified is
11564 @samp{default}, i.e., make every symbol public.
11565
11566 A good explanation of the benefits offered by ensuring ELF
11567 symbols have the correct visibility is given by ``How To Write
11568 Shared Libraries'' by Ulrich Drepper (which can be found at
11569 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
11570 solution made possible by this option to marking things hidden when
11571 the default is public is to make the default hidden and mark things
11572 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
11573 and @code{__attribute__ ((visibility("default")))} instead of
11574 @code{__declspec(dllexport)} you get almost identical semantics with
11575 identical syntax. This is a great boon to those working with
11576 cross-platform projects.
11577
11578 For those adding visibility support to existing code, you may find
11579 @code{#pragma GCC visibility} of use. This works by you enclosing
11580 the declarations you wish to set visibility for with (for example)
11581 @code{#pragma GCC visibility push(hidden)} and
11582 @code{#pragma GCC visibility pop}.
11583 Bear in mind that symbol visibility should be viewed @strong{as
11584 part of the API interface contract} and thus all new code should
11585 always specify visibility when it is not the default; i.e., declarations
11586 only for use within the local DSO should @strong{always} be marked explicitly
11587 as hidden as so to avoid PLT indirection overheads---making this
11588 abundantly clear also aids readability and self-documentation of the code.
11589 Note that due to ISO C++ specification requirements, @code{operator new} and
11590 @code{operator delete} must always be of default visibility.
11591
11592 Be aware that headers from outside your project, in particular system
11593 headers and headers from any other library you use, may not be
11594 expecting to be compiled with visibility other than the default. You
11595 may need to explicitly say @code{#pragma GCC visibility push(default)}
11596 before including any such headers.
11597
11598 @code{extern} declarations are not affected by @option{-fvisibility}, so
11599 a lot of code can be recompiled with @option{-fvisibility=hidden} with
11600 no modifications. However, this means that calls to @code{extern}
11601 functions with no explicit visibility use the PLT, so it is more
11602 effective to use @code{__attribute ((visibility))} and/or
11603 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
11604 declarations should be treated as hidden.
11605
11606 Note that @option{-fvisibility} does affect C++ vague linkage
11607 entities. This means that, for instance, an exception class that is
11608 be thrown between DSOs must be explicitly marked with default
11609 visibility so that the @samp{type_info} nodes are unified between
11610 the DSOs.
11611
11612 An overview of these techniques, their benefits and how to use them
11613 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
11614
11615 @item -fstrict-volatile-bitfields
11616 @opindex fstrict-volatile-bitfields
11617 This option should be used if accesses to volatile bit-fields (or other
11618 structure fields, although the compiler usually honors those types
11619 anyway) should use a single access of the width of the
11620 field's type, aligned to a natural alignment if possible. For
11621 example, targets with memory-mapped peripheral registers might require
11622 all such accesses to be 16 bits wide; with this flag you can
11623 declare all peripheral bit-fields as @code{unsigned short} (assuming short
11624 is 16 bits on these targets) to force GCC to use 16-bit accesses
11625 instead of, perhaps, a more efficient 32-bit access.
11626
11627 If this option is disabled, the compiler uses the most efficient
11628 instruction. In the previous example, that might be a 32-bit load
11629 instruction, even though that accesses bytes that do not contain
11630 any portion of the bit-field, or memory-mapped registers unrelated to
11631 the one being updated.
11632
11633 In some cases, such as when the @code{packed} attribute is applied to a
11634 structure field, it may not be possible to access the field with a single
11635 read or write that is correctly aligned for the target machine. In this
11636 case GCC falls back to generating multiple accesses rather than code that
11637 will fault or truncate the result at run time.
11638
11639 Note: Due to restrictions of the C/C++11 memory model, write accesses are
11640 not allowed to touch non bit-field members. It is therefore recommended
11641 to define all bits of the field's type as bit-field members.
11642
11643 The default value of this option is determined by the application binary
11644 interface for the target processor.
11645
11646 @item -fsync-libcalls
11647 @opindex fsync-libcalls
11648 This option controls whether any out-of-line instance of the @code{__sync}
11649 family of functions may be used to implement the C++11 @code{__atomic}
11650 family of functions.
11651
11652 The default value of this option is enabled, thus the only useful form
11653 of the option is @option{-fno-sync-libcalls}. This option is used in
11654 the implementation of the @file{libatomic} runtime library.
11655
11656 @end table
11657
11658 @node Developer Options
11659 @section GCC Developer Options
11660 @cindex developer options
11661 @cindex debugging GCC
11662 @cindex debug dump options
11663 @cindex dump options
11664 @cindex compilation statistics
11665
11666 This section describes command-line options that are primarily of
11667 interest to GCC developers, including options to support compiler
11668 testing and investigation of compiler bugs and compile-time
11669 performance problems. This includes options that produce debug dumps
11670 at various points in the compilation; that print statistics such as
11671 memory use and execution time; and that print information about GCC's
11672 configuration, such as where it searches for libraries. You should
11673 rarely need to use any of these options for ordinary compilation and
11674 linking tasks.
11675
11676 @table @gcctabopt
11677
11678 @item -d@var{letters}
11679 @itemx -fdump-rtl-@var{pass}
11680 @itemx -fdump-rtl-@var{pass}=@var{filename}
11681 @opindex d
11682 @opindex fdump-rtl-@var{pass}
11683 Says to make debugging dumps during compilation at times specified by
11684 @var{letters}. This is used for debugging the RTL-based passes of the
11685 compiler. The file names for most of the dumps are made by appending
11686 a pass number and a word to the @var{dumpname}, and the files are
11687 created in the directory of the output file. In case of
11688 @option{=@var{filename}} option, the dump is output on the given file
11689 instead of the pass numbered dump files. Note that the pass number is
11690 assigned as passes are registered into the pass manager. Most passes
11691 are registered in the order that they will execute and for these passes
11692 the number corresponds to the pass execution order. However, passes
11693 registered by plugins, passes specific to compilation targets, or
11694 passes that are otherwise registered after all the other passes are
11695 numbered higher than a pass named "final", even if they are executed
11696 earlier. @var{dumpname} is generated from the name of the output
11697 file if explicitly specified and not an executable, otherwise it is
11698 the basename of the source file. These switches may have different
11699 effects when @option{-E} is used for preprocessing.
11700
11701 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
11702 @option{-d} option @var{letters}. Here are the possible
11703 letters for use in @var{pass} and @var{letters}, and their meanings:
11704
11705 @table @gcctabopt
11706
11707 @item -fdump-rtl-alignments
11708 @opindex fdump-rtl-alignments
11709 Dump after branch alignments have been computed.
11710
11711 @item -fdump-rtl-asmcons
11712 @opindex fdump-rtl-asmcons
11713 Dump after fixing rtl statements that have unsatisfied in/out constraints.
11714
11715 @item -fdump-rtl-auto_inc_dec
11716 @opindex fdump-rtl-auto_inc_dec
11717 Dump after auto-inc-dec discovery. This pass is only run on
11718 architectures that have auto inc or auto dec instructions.
11719
11720 @item -fdump-rtl-barriers
11721 @opindex fdump-rtl-barriers
11722 Dump after cleaning up the barrier instructions.
11723
11724 @item -fdump-rtl-bbpart
11725 @opindex fdump-rtl-bbpart
11726 Dump after partitioning hot and cold basic blocks.
11727
11728 @item -fdump-rtl-bbro
11729 @opindex fdump-rtl-bbro
11730 Dump after block reordering.
11731
11732 @item -fdump-rtl-btl1
11733 @itemx -fdump-rtl-btl2
11734 @opindex fdump-rtl-btl2
11735 @opindex fdump-rtl-btl2
11736 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
11737 after the two branch
11738 target load optimization passes.
11739
11740 @item -fdump-rtl-bypass
11741 @opindex fdump-rtl-bypass
11742 Dump after jump bypassing and control flow optimizations.
11743
11744 @item -fdump-rtl-combine
11745 @opindex fdump-rtl-combine
11746 Dump after the RTL instruction combination pass.
11747
11748 @item -fdump-rtl-compgotos
11749 @opindex fdump-rtl-compgotos
11750 Dump after duplicating the computed gotos.
11751
11752 @item -fdump-rtl-ce1
11753 @itemx -fdump-rtl-ce2
11754 @itemx -fdump-rtl-ce3
11755 @opindex fdump-rtl-ce1
11756 @opindex fdump-rtl-ce2
11757 @opindex fdump-rtl-ce3
11758 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
11759 @option{-fdump-rtl-ce3} enable dumping after the three
11760 if conversion passes.
11761
11762 @item -fdump-rtl-cprop_hardreg
11763 @opindex fdump-rtl-cprop_hardreg
11764 Dump after hard register copy propagation.
11765
11766 @item -fdump-rtl-csa
11767 @opindex fdump-rtl-csa
11768 Dump after combining stack adjustments.
11769
11770 @item -fdump-rtl-cse1
11771 @itemx -fdump-rtl-cse2
11772 @opindex fdump-rtl-cse1
11773 @opindex fdump-rtl-cse2
11774 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
11775 the two common subexpression elimination passes.
11776
11777 @item -fdump-rtl-dce
11778 @opindex fdump-rtl-dce
11779 Dump after the standalone dead code elimination passes.
11780
11781 @item -fdump-rtl-dbr
11782 @opindex fdump-rtl-dbr
11783 Dump after delayed branch scheduling.
11784
11785 @item -fdump-rtl-dce1
11786 @itemx -fdump-rtl-dce2
11787 @opindex fdump-rtl-dce1
11788 @opindex fdump-rtl-dce2
11789 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
11790 the two dead store elimination passes.
11791
11792 @item -fdump-rtl-eh
11793 @opindex fdump-rtl-eh
11794 Dump after finalization of EH handling code.
11795
11796 @item -fdump-rtl-eh_ranges
11797 @opindex fdump-rtl-eh_ranges
11798 Dump after conversion of EH handling range regions.
11799
11800 @item -fdump-rtl-expand
11801 @opindex fdump-rtl-expand
11802 Dump after RTL generation.
11803
11804 @item -fdump-rtl-fwprop1
11805 @itemx -fdump-rtl-fwprop2
11806 @opindex fdump-rtl-fwprop1
11807 @opindex fdump-rtl-fwprop2
11808 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
11809 dumping after the two forward propagation passes.
11810
11811 @item -fdump-rtl-gcse1
11812 @itemx -fdump-rtl-gcse2
11813 @opindex fdump-rtl-gcse1
11814 @opindex fdump-rtl-gcse2
11815 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
11816 after global common subexpression elimination.
11817
11818 @item -fdump-rtl-init-regs
11819 @opindex fdump-rtl-init-regs
11820 Dump after the initialization of the registers.
11821
11822 @item -fdump-rtl-initvals
11823 @opindex fdump-rtl-initvals
11824 Dump after the computation of the initial value sets.
11825
11826 @item -fdump-rtl-into_cfglayout
11827 @opindex fdump-rtl-into_cfglayout
11828 Dump after converting to cfglayout mode.
11829
11830 @item -fdump-rtl-ira
11831 @opindex fdump-rtl-ira
11832 Dump after iterated register allocation.
11833
11834 @item -fdump-rtl-jump
11835 @opindex fdump-rtl-jump
11836 Dump after the second jump optimization.
11837
11838 @item -fdump-rtl-loop2
11839 @opindex fdump-rtl-loop2
11840 @option{-fdump-rtl-loop2} enables dumping after the rtl
11841 loop optimization passes.
11842
11843 @item -fdump-rtl-mach
11844 @opindex fdump-rtl-mach
11845 Dump after performing the machine dependent reorganization pass, if that
11846 pass exists.
11847
11848 @item -fdump-rtl-mode_sw
11849 @opindex fdump-rtl-mode_sw
11850 Dump after removing redundant mode switches.
11851
11852 @item -fdump-rtl-rnreg
11853 @opindex fdump-rtl-rnreg
11854 Dump after register renumbering.
11855
11856 @item -fdump-rtl-outof_cfglayout
11857 @opindex fdump-rtl-outof_cfglayout
11858 Dump after converting from cfglayout mode.
11859
11860 @item -fdump-rtl-peephole2
11861 @opindex fdump-rtl-peephole2
11862 Dump after the peephole pass.
11863
11864 @item -fdump-rtl-postreload
11865 @opindex fdump-rtl-postreload
11866 Dump after post-reload optimizations.
11867
11868 @item -fdump-rtl-pro_and_epilogue
11869 @opindex fdump-rtl-pro_and_epilogue
11870 Dump after generating the function prologues and epilogues.
11871
11872 @item -fdump-rtl-sched1
11873 @itemx -fdump-rtl-sched2
11874 @opindex fdump-rtl-sched1
11875 @opindex fdump-rtl-sched2
11876 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
11877 after the basic block scheduling passes.
11878
11879 @item -fdump-rtl-ree
11880 @opindex fdump-rtl-ree
11881 Dump after sign/zero extension elimination.
11882
11883 @item -fdump-rtl-seqabstr
11884 @opindex fdump-rtl-seqabstr
11885 Dump after common sequence discovery.
11886
11887 @item -fdump-rtl-shorten
11888 @opindex fdump-rtl-shorten
11889 Dump after shortening branches.
11890
11891 @item -fdump-rtl-sibling
11892 @opindex fdump-rtl-sibling
11893 Dump after sibling call optimizations.
11894
11895 @item -fdump-rtl-split1
11896 @itemx -fdump-rtl-split2
11897 @itemx -fdump-rtl-split3
11898 @itemx -fdump-rtl-split4
11899 @itemx -fdump-rtl-split5
11900 @opindex fdump-rtl-split1
11901 @opindex fdump-rtl-split2
11902 @opindex fdump-rtl-split3
11903 @opindex fdump-rtl-split4
11904 @opindex fdump-rtl-split5
11905 These options enable dumping after five rounds of
11906 instruction splitting.
11907
11908 @item -fdump-rtl-sms
11909 @opindex fdump-rtl-sms
11910 Dump after modulo scheduling. This pass is only run on some
11911 architectures.
11912
11913 @item -fdump-rtl-stack
11914 @opindex fdump-rtl-stack
11915 Dump after conversion from GCC's ``flat register file'' registers to the
11916 x87's stack-like registers. This pass is only run on x86 variants.
11917
11918 @item -fdump-rtl-subreg1
11919 @itemx -fdump-rtl-subreg2
11920 @opindex fdump-rtl-subreg1
11921 @opindex fdump-rtl-subreg2
11922 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
11923 the two subreg expansion passes.
11924
11925 @item -fdump-rtl-unshare
11926 @opindex fdump-rtl-unshare
11927 Dump after all rtl has been unshared.
11928
11929 @item -fdump-rtl-vartrack
11930 @opindex fdump-rtl-vartrack
11931 Dump after variable tracking.
11932
11933 @item -fdump-rtl-vregs
11934 @opindex fdump-rtl-vregs
11935 Dump after converting virtual registers to hard registers.
11936
11937 @item -fdump-rtl-web
11938 @opindex fdump-rtl-web
11939 Dump after live range splitting.
11940
11941 @item -fdump-rtl-regclass
11942 @itemx -fdump-rtl-subregs_of_mode_init
11943 @itemx -fdump-rtl-subregs_of_mode_finish
11944 @itemx -fdump-rtl-dfinit
11945 @itemx -fdump-rtl-dfinish
11946 @opindex fdump-rtl-regclass
11947 @opindex fdump-rtl-subregs_of_mode_init
11948 @opindex fdump-rtl-subregs_of_mode_finish
11949 @opindex fdump-rtl-dfinit
11950 @opindex fdump-rtl-dfinish
11951 These dumps are defined but always produce empty files.
11952
11953 @item -da
11954 @itemx -fdump-rtl-all
11955 @opindex da
11956 @opindex fdump-rtl-all
11957 Produce all the dumps listed above.
11958
11959 @item -dA
11960 @opindex dA
11961 Annotate the assembler output with miscellaneous debugging information.
11962
11963 @item -dD
11964 @opindex dD
11965 Dump all macro definitions, at the end of preprocessing, in addition to
11966 normal output.
11967
11968 @item -dH
11969 @opindex dH
11970 Produce a core dump whenever an error occurs.
11971
11972 @item -dp
11973 @opindex dp
11974 Annotate the assembler output with a comment indicating which
11975 pattern and alternative is used. The length of each instruction is
11976 also printed.
11977
11978 @item -dP
11979 @opindex dP
11980 Dump the RTL in the assembler output as a comment before each instruction.
11981 Also turns on @option{-dp} annotation.
11982
11983 @item -dx
11984 @opindex dx
11985 Just generate RTL for a function instead of compiling it. Usually used
11986 with @option{-fdump-rtl-expand}.
11987 @end table
11988
11989 @item -fdump-noaddr
11990 @opindex fdump-noaddr
11991 When doing debugging dumps, suppress address output. This makes it more
11992 feasible to use diff on debugging dumps for compiler invocations with
11993 different compiler binaries and/or different
11994 text / bss / data / heap / stack / dso start locations.
11995
11996 @item -freport-bug
11997 @opindex freport-bug
11998 Collect and dump debug information into a temporary file if an
11999 internal compiler error (ICE) occurs.
12000
12001 @item -fdump-unnumbered
12002 @opindex fdump-unnumbered
12003 When doing debugging dumps, suppress instruction numbers and address output.
12004 This makes it more feasible to use diff on debugging dumps for compiler
12005 invocations with different options, in particular with and without
12006 @option{-g}.
12007
12008 @item -fdump-unnumbered-links
12009 @opindex fdump-unnumbered-links
12010 When doing debugging dumps (see @option{-d} option above), suppress
12011 instruction numbers for the links to the previous and next instructions
12012 in a sequence.
12013
12014 @item -fdump-translation-unit @r{(C++ only)}
12015 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
12016 @opindex fdump-translation-unit
12017 Dump a representation of the tree structure for the entire translation
12018 unit to a file. The file name is made by appending @file{.tu} to the
12019 source file name, and the file is created in the same directory as the
12020 output file. If the @samp{-@var{options}} form is used, @var{options}
12021 controls the details of the dump as described for the
12022 @option{-fdump-tree} options.
12023
12024 @item -fdump-class-hierarchy @r{(C++ only)}
12025 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
12026 @opindex fdump-class-hierarchy
12027 Dump a representation of each class's hierarchy and virtual function
12028 table layout to a file. The file name is made by appending
12029 @file{.class} to the source file name, and the file is created in the
12030 same directory as the output file. If the @samp{-@var{options}} form
12031 is used, @var{options} controls the details of the dump as described
12032 for the @option{-fdump-tree} options.
12033
12034 @item -fdump-ipa-@var{switch}
12035 @opindex fdump-ipa
12036 Control the dumping at various stages of inter-procedural analysis
12037 language tree to a file. The file name is generated by appending a
12038 switch specific suffix to the source file name, and the file is created
12039 in the same directory as the output file. The following dumps are
12040 possible:
12041
12042 @table @samp
12043 @item all
12044 Enables all inter-procedural analysis dumps.
12045
12046 @item cgraph
12047 Dumps information about call-graph optimization, unused function removal,
12048 and inlining decisions.
12049
12050 @item inline
12051 Dump after function inlining.
12052
12053 @end table
12054
12055 @item -fdump-passes
12056 @opindex fdump-passes
12057 Dump the list of optimization passes that are turned on and off by
12058 the current command-line options.
12059
12060 @item -fdump-statistics-@var{option}
12061 @opindex fdump-statistics
12062 Enable and control dumping of pass statistics in a separate file. The
12063 file name is generated by appending a suffix ending in
12064 @samp{.statistics} to the source file name, and the file is created in
12065 the same directory as the output file. If the @samp{-@var{option}}
12066 form is used, @samp{-stats} causes counters to be summed over the
12067 whole compilation unit while @samp{-details} dumps every event as
12068 the passes generate them. The default with no option is to sum
12069 counters for each function compiled.
12070
12071 @item -fdump-tree-@var{switch}
12072 @itemx -fdump-tree-@var{switch}-@var{options}
12073 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
12074 @opindex fdump-tree
12075 Control the dumping at various stages of processing the intermediate
12076 language tree to a file. The file name is generated by appending a
12077 switch-specific suffix to the source file name, and the file is
12078 created in the same directory as the output file. In case of
12079 @option{=@var{filename}} option, the dump is output on the given file
12080 instead of the auto named dump files. If the @samp{-@var{options}}
12081 form is used, @var{options} is a list of @samp{-} separated options
12082 which control the details of the dump. Not all options are applicable
12083 to all dumps; those that are not meaningful are ignored. The
12084 following options are available
12085
12086 @table @samp
12087 @item address
12088 Print the address of each node. Usually this is not meaningful as it
12089 changes according to the environment and source file. Its primary use
12090 is for tying up a dump file with a debug environment.
12091 @item asmname
12092 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
12093 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
12094 use working backward from mangled names in the assembly file.
12095 @item slim
12096 When dumping front-end intermediate representations, inhibit dumping
12097 of members of a scope or body of a function merely because that scope
12098 has been reached. Only dump such items when they are directly reachable
12099 by some other path.
12100
12101 When dumping pretty-printed trees, this option inhibits dumping the
12102 bodies of control structures.
12103
12104 When dumping RTL, print the RTL in slim (condensed) form instead of
12105 the default LISP-like representation.
12106 @item raw
12107 Print a raw representation of the tree. By default, trees are
12108 pretty-printed into a C-like representation.
12109 @item details
12110 Enable more detailed dumps (not honored by every dump option). Also
12111 include information from the optimization passes.
12112 @item stats
12113 Enable dumping various statistics about the pass (not honored by every dump
12114 option).
12115 @item blocks
12116 Enable showing basic block boundaries (disabled in raw dumps).
12117 @item graph
12118 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
12119 dump a representation of the control flow graph suitable for viewing with
12120 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
12121 the file is pretty-printed as a subgraph, so that GraphViz can render them
12122 all in a single plot.
12123
12124 This option currently only works for RTL dumps, and the RTL is always
12125 dumped in slim form.
12126 @item vops
12127 Enable showing virtual operands for every statement.
12128 @item lineno
12129 Enable showing line numbers for statements.
12130 @item uid
12131 Enable showing the unique ID (@code{DECL_UID}) for each variable.
12132 @item verbose
12133 Enable showing the tree dump for each statement.
12134 @item eh
12135 Enable showing the EH region number holding each statement.
12136 @item scev
12137 Enable showing scalar evolution analysis details.
12138 @item optimized
12139 Enable showing optimization information (only available in certain
12140 passes).
12141 @item missed
12142 Enable showing missed optimization information (only available in certain
12143 passes).
12144 @item note
12145 Enable other detailed optimization information (only available in
12146 certain passes).
12147 @item =@var{filename}
12148 Instead of an auto named dump file, output into the given file
12149 name. The file names @file{stdout} and @file{stderr} are treated
12150 specially and are considered already open standard streams. For
12151 example,
12152
12153 @smallexample
12154 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
12155 -fdump-tree-pre=stderr file.c
12156 @end smallexample
12157
12158 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
12159 output on to @file{stderr}. If two conflicting dump filenames are
12160 given for the same pass, then the latter option overrides the earlier
12161 one.
12162
12163 @item split-paths
12164 @opindex fdump-tree-split-paths
12165 Dump each function after splitting paths to loop backedges. The file
12166 name is made by appending @file{.split-paths} to the source file name.
12167
12168 @item all
12169 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
12170 and @option{lineno}.
12171
12172 @item optall
12173 Turn on all optimization options, i.e., @option{optimized},
12174 @option{missed}, and @option{note}.
12175 @end table
12176
12177 The following tree dumps are possible:
12178 @table @samp
12179
12180 @item original
12181 @opindex fdump-tree-original
12182 Dump before any tree based optimization, to @file{@var{file}.original}.
12183
12184 @item optimized
12185 @opindex fdump-tree-optimized
12186 Dump after all tree based optimization, to @file{@var{file}.optimized}.
12187
12188 @item gimple
12189 @opindex fdump-tree-gimple
12190 Dump each function before and after the gimplification pass to a file. The
12191 file name is made by appending @file{.gimple} to the source file name.
12192
12193 @item cfg
12194 @opindex fdump-tree-cfg
12195 Dump the control flow graph of each function to a file. The file name is
12196 made by appending @file{.cfg} to the source file name.
12197
12198 @item ch
12199 @opindex fdump-tree-ch
12200 Dump each function after copying loop headers. The file name is made by
12201 appending @file{.ch} to the source file name.
12202
12203 @item ssa
12204 @opindex fdump-tree-ssa
12205 Dump SSA related information to a file. The file name is made by appending
12206 @file{.ssa} to the source file name.
12207
12208 @item alias
12209 @opindex fdump-tree-alias
12210 Dump aliasing information for each function. The file name is made by
12211 appending @file{.alias} to the source file name.
12212
12213 @item ccp
12214 @opindex fdump-tree-ccp
12215 Dump each function after CCP@. The file name is made by appending
12216 @file{.ccp} to the source file name.
12217
12218 @item storeccp
12219 @opindex fdump-tree-storeccp
12220 Dump each function after STORE-CCP@. The file name is made by appending
12221 @file{.storeccp} to the source file name.
12222
12223 @item pre
12224 @opindex fdump-tree-pre
12225 Dump trees after partial redundancy elimination. The file name is made
12226 by appending @file{.pre} to the source file name.
12227
12228 @item fre
12229 @opindex fdump-tree-fre
12230 Dump trees after full redundancy elimination. The file name is made
12231 by appending @file{.fre} to the source file name.
12232
12233 @item copyprop
12234 @opindex fdump-tree-copyprop
12235 Dump trees after copy propagation. The file name is made
12236 by appending @file{.copyprop} to the source file name.
12237
12238 @item store_copyprop
12239 @opindex fdump-tree-store_copyprop
12240 Dump trees after store copy-propagation. The file name is made
12241 by appending @file{.store_copyprop} to the source file name.
12242
12243 @item dce
12244 @opindex fdump-tree-dce
12245 Dump each function after dead code elimination. The file name is made by
12246 appending @file{.dce} to the source file name.
12247
12248 @item sra
12249 @opindex fdump-tree-sra
12250 Dump each function after performing scalar replacement of aggregates. The
12251 file name is made by appending @file{.sra} to the source file name.
12252
12253 @item sink
12254 @opindex fdump-tree-sink
12255 Dump each function after performing code sinking. The file name is made
12256 by appending @file{.sink} to the source file name.
12257
12258 @item dom
12259 @opindex fdump-tree-dom
12260 Dump each function after applying dominator tree optimizations. The file
12261 name is made by appending @file{.dom} to the source file name.
12262
12263 @item dse
12264 @opindex fdump-tree-dse
12265 Dump each function after applying dead store elimination. The file
12266 name is made by appending @file{.dse} to the source file name.
12267
12268 @item phiopt
12269 @opindex fdump-tree-phiopt
12270 Dump each function after optimizing PHI nodes into straightline code. The file
12271 name is made by appending @file{.phiopt} to the source file name.
12272
12273 @item backprop
12274 @opindex fdump-tree-backprop
12275 Dump each function after back-propagating use information up the definition
12276 chain. The file name is made by appending @file{.backprop} to the
12277 source file name.
12278
12279 @item forwprop
12280 @opindex fdump-tree-forwprop
12281 Dump each function after forward propagating single use variables. The file
12282 name is made by appending @file{.forwprop} to the source file name.
12283
12284 @item nrv
12285 @opindex fdump-tree-nrv
12286 Dump each function after applying the named return value optimization on
12287 generic trees. The file name is made by appending @file{.nrv} to the source
12288 file name.
12289
12290 @item vect
12291 @opindex fdump-tree-vect
12292 Dump each function after applying vectorization of loops. The file name is
12293 made by appending @file{.vect} to the source file name.
12294
12295 @item slp
12296 @opindex fdump-tree-slp
12297 Dump each function after applying vectorization of basic blocks. The file name
12298 is made by appending @file{.slp} to the source file name.
12299
12300 @item vrp
12301 @opindex fdump-tree-vrp
12302 Dump each function after Value Range Propagation (VRP). The file name
12303 is made by appending @file{.vrp} to the source file name.
12304
12305 @item oaccdevlow
12306 @opindex fdump-tree-oaccdevlow
12307 Dump each function after applying device-specific OpenACC transformations.
12308 The file name is made by appending @file{.oaccdevlow} to the source file name.
12309
12310 @item all
12311 @opindex fdump-tree-all
12312 Enable all the available tree dumps with the flags provided in this option.
12313 @end table
12314
12315 @item -fopt-info
12316 @itemx -fopt-info-@var{options}
12317 @itemx -fopt-info-@var{options}=@var{filename}
12318 @opindex fopt-info
12319 Controls optimization dumps from various optimization passes. If the
12320 @samp{-@var{options}} form is used, @var{options} is a list of
12321 @samp{-} separated option keywords to select the dump details and
12322 optimizations.
12323
12324 The @var{options} can be divided into two groups: options describing the
12325 verbosity of the dump, and options describing which optimizations
12326 should be included. The options from both the groups can be freely
12327 mixed as they are non-overlapping. However, in case of any conflicts,
12328 the later options override the earlier options on the command
12329 line.
12330
12331 The following options control the dump verbosity:
12332
12333 @table @samp
12334 @item optimized
12335 Print information when an optimization is successfully applied. It is
12336 up to a pass to decide which information is relevant. For example, the
12337 vectorizer passes print the source location of loops which are
12338 successfully vectorized.
12339 @item missed
12340 Print information about missed optimizations. Individual passes
12341 control which information to include in the output.
12342 @item note
12343 Print verbose information about optimizations, such as certain
12344 transformations, more detailed messages about decisions etc.
12345 @item all
12346 Print detailed optimization information. This includes
12347 @samp{optimized}, @samp{missed}, and @samp{note}.
12348 @end table
12349
12350 One or more of the following option keywords can be used to describe a
12351 group of optimizations:
12352
12353 @table @samp
12354 @item ipa
12355 Enable dumps from all interprocedural optimizations.
12356 @item loop
12357 Enable dumps from all loop optimizations.
12358 @item inline
12359 Enable dumps from all inlining optimizations.
12360 @item vec
12361 Enable dumps from all vectorization optimizations.
12362 @item optall
12363 Enable dumps from all optimizations. This is a superset of
12364 the optimization groups listed above.
12365 @end table
12366
12367 If @var{options} is
12368 omitted, it defaults to @samp{optimized-optall}, which means to dump all
12369 info about successful optimizations from all the passes.
12370
12371 If the @var{filename} is provided, then the dumps from all the
12372 applicable optimizations are concatenated into the @var{filename}.
12373 Otherwise the dump is output onto @file{stderr}. Though multiple
12374 @option{-fopt-info} options are accepted, only one of them can include
12375 a @var{filename}. If other filenames are provided then all but the
12376 first such option are ignored.
12377
12378 Note that the output @var{filename} is overwritten
12379 in case of multiple translation units. If a combined output from
12380 multiple translation units is desired, @file{stderr} should be used
12381 instead.
12382
12383 In the following example, the optimization info is output to
12384 @file{stderr}:
12385
12386 @smallexample
12387 gcc -O3 -fopt-info
12388 @end smallexample
12389
12390 This example:
12391 @smallexample
12392 gcc -O3 -fopt-info-missed=missed.all
12393 @end smallexample
12394
12395 @noindent
12396 outputs missed optimization report from all the passes into
12397 @file{missed.all}, and this one:
12398
12399 @smallexample
12400 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
12401 @end smallexample
12402
12403 @noindent
12404 prints information about missed optimization opportunities from
12405 vectorization passes on @file{stderr}.
12406 Note that @option{-fopt-info-vec-missed} is equivalent to
12407 @option{-fopt-info-missed-vec}.
12408
12409 As another example,
12410 @smallexample
12411 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
12412 @end smallexample
12413
12414 @noindent
12415 outputs information about missed optimizations as well as
12416 optimized locations from all the inlining passes into
12417 @file{inline.txt}.
12418
12419 Finally, consider:
12420
12421 @smallexample
12422 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
12423 @end smallexample
12424
12425 @noindent
12426 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
12427 in conflict since only one output file is allowed. In this case, only
12428 the first option takes effect and the subsequent options are
12429 ignored. Thus only @file{vec.miss} is produced which contains
12430 dumps from the vectorizer about missed opportunities.
12431
12432 @item -fsched-verbose=@var{n}
12433 @opindex fsched-verbose
12434 On targets that use instruction scheduling, this option controls the
12435 amount of debugging output the scheduler prints to the dump files.
12436
12437 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
12438 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
12439 For @var{n} greater than one, it also output basic block probabilities,
12440 detailed ready list information and unit/insn info. For @var{n} greater
12441 than two, it includes RTL at abort point, control-flow and regions info.
12442 And for @var{n} over four, @option{-fsched-verbose} also includes
12443 dependence info.
12444
12445
12446
12447 @item -fenable-@var{kind}-@var{pass}
12448 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
12449 @opindex fdisable-
12450 @opindex fenable-
12451
12452 This is a set of options that are used to explicitly disable/enable
12453 optimization passes. These options are intended for use for debugging GCC.
12454 Compiler users should use regular options for enabling/disabling
12455 passes instead.
12456
12457 @table @gcctabopt
12458
12459 @item -fdisable-ipa-@var{pass}
12460 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12461 statically invoked in the compiler multiple times, the pass name should be
12462 appended with a sequential number starting from 1.
12463
12464 @item -fdisable-rtl-@var{pass}
12465 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
12466 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
12467 statically invoked in the compiler multiple times, the pass name should be
12468 appended with a sequential number starting from 1. @var{range-list} is a
12469 comma-separated list of function ranges or assembler names. Each range is a number
12470 pair separated by a colon. The range is inclusive in both ends. If the range
12471 is trivial, the number pair can be simplified as a single number. If the
12472 function's call graph node's @var{uid} falls within one of the specified ranges,
12473 the @var{pass} is disabled for that function. The @var{uid} is shown in the
12474 function header of a dump file, and the pass names can be dumped by using
12475 option @option{-fdump-passes}.
12476
12477 @item -fdisable-tree-@var{pass}
12478 @itemx -fdisable-tree-@var{pass}=@var{range-list}
12479 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
12480 option arguments.
12481
12482 @item -fenable-ipa-@var{pass}
12483 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12484 statically invoked in the compiler multiple times, the pass name should be
12485 appended with a sequential number starting from 1.
12486
12487 @item -fenable-rtl-@var{pass}
12488 @itemx -fenable-rtl-@var{pass}=@var{range-list}
12489 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
12490 description and examples.
12491
12492 @item -fenable-tree-@var{pass}
12493 @itemx -fenable-tree-@var{pass}=@var{range-list}
12494 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
12495 of option arguments.
12496
12497 @end table
12498
12499 Here are some examples showing uses of these options.
12500
12501 @smallexample
12502
12503 # disable ccp1 for all functions
12504 -fdisable-tree-ccp1
12505 # disable complete unroll for function whose cgraph node uid is 1
12506 -fenable-tree-cunroll=1
12507 # disable gcse2 for functions at the following ranges [1,1],
12508 # [300,400], and [400,1000]
12509 # disable gcse2 for functions foo and foo2
12510 -fdisable-rtl-gcse2=foo,foo2
12511 # disable early inlining
12512 -fdisable-tree-einline
12513 # disable ipa inlining
12514 -fdisable-ipa-inline
12515 # enable tree full unroll
12516 -fenable-tree-unroll
12517
12518 @end smallexample
12519
12520 @item -fchecking
12521 @itemx -fchecking=@var{n}
12522 @opindex fchecking
12523 @opindex fno-checking
12524 Enable internal consistency checking. The default depends on
12525 the compiler configuration. @option{-fchecking=2} enables further
12526 internal consistency checking that might affect code generation.
12527
12528 @item -frandom-seed=@var{string}
12529 @opindex frandom-seed
12530 This option provides a seed that GCC uses in place of
12531 random numbers in generating certain symbol names
12532 that have to be different in every compiled file. It is also used to
12533 place unique stamps in coverage data files and the object files that
12534 produce them. You can use the @option{-frandom-seed} option to produce
12535 reproducibly identical object files.
12536
12537 The @var{string} can either be a number (decimal, octal or hex) or an
12538 arbitrary string (in which case it's converted to a number by
12539 computing CRC32).
12540
12541 The @var{string} should be different for every file you compile.
12542
12543 @item -save-temps
12544 @itemx -save-temps=cwd
12545 @opindex save-temps
12546 Store the usual ``temporary'' intermediate files permanently; place them
12547 in the current directory and name them based on the source file. Thus,
12548 compiling @file{foo.c} with @option{-c -save-temps} produces files
12549 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
12550 preprocessed @file{foo.i} output file even though the compiler now
12551 normally uses an integrated preprocessor.
12552
12553 When used in combination with the @option{-x} command-line option,
12554 @option{-save-temps} is sensible enough to avoid over writing an
12555 input source file with the same extension as an intermediate file.
12556 The corresponding intermediate file may be obtained by renaming the
12557 source file before using @option{-save-temps}.
12558
12559 If you invoke GCC in parallel, compiling several different source
12560 files that share a common base name in different subdirectories or the
12561 same source file compiled for multiple output destinations, it is
12562 likely that the different parallel compilers will interfere with each
12563 other, and overwrite the temporary files. For instance:
12564
12565 @smallexample
12566 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
12567 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
12568 @end smallexample
12569
12570 may result in @file{foo.i} and @file{foo.o} being written to
12571 simultaneously by both compilers.
12572
12573 @item -save-temps=obj
12574 @opindex save-temps=obj
12575 Store the usual ``temporary'' intermediate files permanently. If the
12576 @option{-o} option is used, the temporary files are based on the
12577 object file. If the @option{-o} option is not used, the
12578 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
12579
12580 For example:
12581
12582 @smallexample
12583 gcc -save-temps=obj -c foo.c
12584 gcc -save-temps=obj -c bar.c -o dir/xbar.o
12585 gcc -save-temps=obj foobar.c -o dir2/yfoobar
12586 @end smallexample
12587
12588 @noindent
12589 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
12590 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
12591 @file{dir2/yfoobar.o}.
12592
12593 @item -time@r{[}=@var{file}@r{]}
12594 @opindex time
12595 Report the CPU time taken by each subprocess in the compilation
12596 sequence. For C source files, this is the compiler proper and assembler
12597 (plus the linker if linking is done).
12598
12599 Without the specification of an output file, the output looks like this:
12600
12601 @smallexample
12602 # cc1 0.12 0.01
12603 # as 0.00 0.01
12604 @end smallexample
12605
12606 The first number on each line is the ``user time'', that is time spent
12607 executing the program itself. The second number is ``system time'',
12608 time spent executing operating system routines on behalf of the program.
12609 Both numbers are in seconds.
12610
12611 With the specification of an output file, the output is appended to the
12612 named file, and it looks like this:
12613
12614 @smallexample
12615 0.12 0.01 cc1 @var{options}
12616 0.00 0.01 as @var{options}
12617 @end smallexample
12618
12619 The ``user time'' and the ``system time'' are moved before the program
12620 name, and the options passed to the program are displayed, so that one
12621 can later tell what file was being compiled, and with which options.
12622
12623 @item -fdump-final-insns@r{[}=@var{file}@r{]}
12624 @opindex fdump-final-insns
12625 Dump the final internal representation (RTL) to @var{file}. If the
12626 optional argument is omitted (or if @var{file} is @code{.}), the name
12627 of the dump file is determined by appending @code{.gkd} to the
12628 compilation output file name.
12629
12630 @item -fcompare-debug@r{[}=@var{opts}@r{]}
12631 @opindex fcompare-debug
12632 @opindex fno-compare-debug
12633 If no error occurs during compilation, run the compiler a second time,
12634 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
12635 passed to the second compilation. Dump the final internal
12636 representation in both compilations, and print an error if they differ.
12637
12638 If the equal sign is omitted, the default @option{-gtoggle} is used.
12639
12640 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
12641 and nonzero, implicitly enables @option{-fcompare-debug}. If
12642 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
12643 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
12644 is used.
12645
12646 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
12647 is equivalent to @option{-fno-compare-debug}, which disables the dumping
12648 of the final representation and the second compilation, preventing even
12649 @env{GCC_COMPARE_DEBUG} from taking effect.
12650
12651 To verify full coverage during @option{-fcompare-debug} testing, set
12652 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
12653 which GCC rejects as an invalid option in any actual compilation
12654 (rather than preprocessing, assembly or linking). To get just a
12655 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
12656 not overridden} will do.
12657
12658 @item -fcompare-debug-second
12659 @opindex fcompare-debug-second
12660 This option is implicitly passed to the compiler for the second
12661 compilation requested by @option{-fcompare-debug}, along with options to
12662 silence warnings, and omitting other options that would cause
12663 side-effect compiler outputs to files or to the standard output. Dump
12664 files and preserved temporary files are renamed so as to contain the
12665 @code{.gk} additional extension during the second compilation, to avoid
12666 overwriting those generated by the first.
12667
12668 When this option is passed to the compiler driver, it causes the
12669 @emph{first} compilation to be skipped, which makes it useful for little
12670 other than debugging the compiler proper.
12671
12672 @item -gtoggle
12673 @opindex gtoggle
12674 Turn off generation of debug info, if leaving out this option
12675 generates it, or turn it on at level 2 otherwise. The position of this
12676 argument in the command line does not matter; it takes effect after all
12677 other options are processed, and it does so only once, no matter how
12678 many times it is given. This is mainly intended to be used with
12679 @option{-fcompare-debug}.
12680
12681 @item -fvar-tracking-assignments-toggle
12682 @opindex fvar-tracking-assignments-toggle
12683 @opindex fno-var-tracking-assignments-toggle
12684 Toggle @option{-fvar-tracking-assignments}, in the same way that
12685 @option{-gtoggle} toggles @option{-g}.
12686
12687 @item -Q
12688 @opindex Q
12689 Makes the compiler print out each function name as it is compiled, and
12690 print some statistics about each pass when it finishes.
12691
12692 @item -ftime-report
12693 @opindex ftime-report
12694 Makes the compiler print some statistics about the time consumed by each
12695 pass when it finishes.
12696
12697 @item -fira-verbose=@var{n}
12698 @opindex fira-verbose
12699 Control the verbosity of the dump file for the integrated register allocator.
12700 The default value is 5. If the value @var{n} is greater or equal to 10,
12701 the dump output is sent to stderr using the same format as @var{n} minus 10.
12702
12703 @item -flto-report
12704 @opindex flto-report
12705 Prints a report with internal details on the workings of the link-time
12706 optimizer. The contents of this report vary from version to version.
12707 It is meant to be useful to GCC developers when processing object
12708 files in LTO mode (via @option{-flto}).
12709
12710 Disabled by default.
12711
12712 @item -flto-report-wpa
12713 @opindex flto-report-wpa
12714 Like @option{-flto-report}, but only print for the WPA phase of Link
12715 Time Optimization.
12716
12717 @item -fmem-report
12718 @opindex fmem-report
12719 Makes the compiler print some statistics about permanent memory
12720 allocation when it finishes.
12721
12722 @item -fmem-report-wpa
12723 @opindex fmem-report-wpa
12724 Makes the compiler print some statistics about permanent memory
12725 allocation for the WPA phase only.
12726
12727 @item -fpre-ipa-mem-report
12728 @opindex fpre-ipa-mem-report
12729 @item -fpost-ipa-mem-report
12730 @opindex fpost-ipa-mem-report
12731 Makes the compiler print some statistics about permanent memory
12732 allocation before or after interprocedural optimization.
12733
12734 @item -fprofile-report
12735 @opindex fprofile-report
12736 Makes the compiler print some statistics about consistency of the
12737 (estimated) profile and effect of individual passes.
12738
12739 @item -fstack-usage
12740 @opindex fstack-usage
12741 Makes the compiler output stack usage information for the program, on a
12742 per-function basis. The filename for the dump is made by appending
12743 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
12744 the output file, if explicitly specified and it is not an executable,
12745 otherwise it is the basename of the source file. An entry is made up
12746 of three fields:
12747
12748 @itemize
12749 @item
12750 The name of the function.
12751 @item
12752 A number of bytes.
12753 @item
12754 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
12755 @end itemize
12756
12757 The qualifier @code{static} means that the function manipulates the stack
12758 statically: a fixed number of bytes are allocated for the frame on function
12759 entry and released on function exit; no stack adjustments are otherwise made
12760 in the function. The second field is this fixed number of bytes.
12761
12762 The qualifier @code{dynamic} means that the function manipulates the stack
12763 dynamically: in addition to the static allocation described above, stack
12764 adjustments are made in the body of the function, for example to push/pop
12765 arguments around function calls. If the qualifier @code{bounded} is also
12766 present, the amount of these adjustments is bounded at compile time and
12767 the second field is an upper bound of the total amount of stack used by
12768 the function. If it is not present, the amount of these adjustments is
12769 not bounded at compile time and the second field only represents the
12770 bounded part.
12771
12772 @item -fstats
12773 @opindex fstats
12774 Emit statistics about front-end processing at the end of the compilation.
12775 This option is supported only by the C++ front end, and
12776 the information is generally only useful to the G++ development team.
12777
12778 @item -fdbg-cnt-list
12779 @opindex fdbg-cnt-list
12780 Print the name and the counter upper bound for all debug counters.
12781
12782
12783 @item -fdbg-cnt=@var{counter-value-list}
12784 @opindex fdbg-cnt
12785 Set the internal debug counter upper bound. @var{counter-value-list}
12786 is a comma-separated list of @var{name}:@var{value} pairs
12787 which sets the upper bound of each debug counter @var{name} to @var{value}.
12788 All debug counters have the initial upper bound of @code{UINT_MAX};
12789 thus @code{dbg_cnt} returns true always unless the upper bound
12790 is set by this option.
12791 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
12792 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
12793
12794 @item -print-file-name=@var{library}
12795 @opindex print-file-name
12796 Print the full absolute name of the library file @var{library} that
12797 would be used when linking---and don't do anything else. With this
12798 option, GCC does not compile or link anything; it just prints the
12799 file name.
12800
12801 @item -print-multi-directory
12802 @opindex print-multi-directory
12803 Print the directory name corresponding to the multilib selected by any
12804 other switches present in the command line. This directory is supposed
12805 to exist in @env{GCC_EXEC_PREFIX}.
12806
12807 @item -print-multi-lib
12808 @opindex print-multi-lib
12809 Print the mapping from multilib directory names to compiler switches
12810 that enable them. The directory name is separated from the switches by
12811 @samp{;}, and each switch starts with an @samp{@@} instead of the
12812 @samp{-}, without spaces between multiple switches. This is supposed to
12813 ease shell processing.
12814
12815 @item -print-multi-os-directory
12816 @opindex print-multi-os-directory
12817 Print the path to OS libraries for the selected
12818 multilib, relative to some @file{lib} subdirectory. If OS libraries are
12819 present in the @file{lib} subdirectory and no multilibs are used, this is
12820 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
12821 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
12822 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
12823 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
12824
12825 @item -print-multiarch
12826 @opindex print-multiarch
12827 Print the path to OS libraries for the selected multiarch,
12828 relative to some @file{lib} subdirectory.
12829
12830 @item -print-prog-name=@var{program}
12831 @opindex print-prog-name
12832 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
12833
12834 @item -print-libgcc-file-name
12835 @opindex print-libgcc-file-name
12836 Same as @option{-print-file-name=libgcc.a}.
12837
12838 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
12839 but you do want to link with @file{libgcc.a}. You can do:
12840
12841 @smallexample
12842 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
12843 @end smallexample
12844
12845 @item -print-search-dirs
12846 @opindex print-search-dirs
12847 Print the name of the configured installation directory and a list of
12848 program and library directories @command{gcc} searches---and don't do anything else.
12849
12850 This is useful when @command{gcc} prints the error message
12851 @samp{installation problem, cannot exec cpp0: No such file or directory}.
12852 To resolve this you either need to put @file{cpp0} and the other compiler
12853 components where @command{gcc} expects to find them, or you can set the environment
12854 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
12855 Don't forget the trailing @samp{/}.
12856 @xref{Environment Variables}.
12857
12858 @item -print-sysroot
12859 @opindex print-sysroot
12860 Print the target sysroot directory that is used during
12861 compilation. This is the target sysroot specified either at configure
12862 time or using the @option{--sysroot} option, possibly with an extra
12863 suffix that depends on compilation options. If no target sysroot is
12864 specified, the option prints nothing.
12865
12866 @item -print-sysroot-headers-suffix
12867 @opindex print-sysroot-headers-suffix
12868 Print the suffix added to the target sysroot when searching for
12869 headers, or give an error if the compiler is not configured with such
12870 a suffix---and don't do anything else.
12871
12872 @item -dumpmachine
12873 @opindex dumpmachine
12874 Print the compiler's target machine (for example,
12875 @samp{i686-pc-linux-gnu})---and don't do anything else.
12876
12877 @item -dumpversion
12878 @opindex dumpversion
12879 Print the compiler version (for example, @code{3.0})---and don't do
12880 anything else.
12881
12882 @item -dumpspecs
12883 @opindex dumpspecs
12884 Print the compiler's built-in specs---and don't do anything else. (This
12885 is used when GCC itself is being built.) @xref{Spec Files}.
12886 @end table
12887
12888 @node Submodel Options
12889 @section Machine-Dependent Options
12890 @cindex submodel options
12891 @cindex specifying hardware config
12892 @cindex hardware models and configurations, specifying
12893 @cindex target-dependent options
12894 @cindex machine-dependent options
12895
12896 Each target machine supported by GCC can have its own options---for
12897 example, to allow you to compile for a particular processor variant or
12898 ABI, or to control optimizations specific to that machine. By
12899 convention, the names of machine-specific options start with
12900 @samp{-m}.
12901
12902 Some configurations of the compiler also support additional target-specific
12903 options, usually for compatibility with other compilers on the same
12904 platform.
12905
12906 @c This list is ordered alphanumerically by subsection name.
12907 @c It should be the same order and spelling as these options are listed
12908 @c in Machine Dependent Options
12909
12910 @menu
12911 * AArch64 Options::
12912 * Adapteva Epiphany Options::
12913 * ARC Options::
12914 * ARM Options::
12915 * AVR Options::
12916 * Blackfin Options::
12917 * C6X Options::
12918 * CRIS Options::
12919 * CR16 Options::
12920 * Darwin Options::
12921 * DEC Alpha Options::
12922 * FR30 Options::
12923 * FT32 Options::
12924 * FRV Options::
12925 * GNU/Linux Options::
12926 * H8/300 Options::
12927 * HPPA Options::
12928 * IA-64 Options::
12929 * LM32 Options::
12930 * M32C Options::
12931 * M32R/D Options::
12932 * M680x0 Options::
12933 * MCore Options::
12934 * MeP Options::
12935 * MicroBlaze Options::
12936 * MIPS Options::
12937 * MMIX Options::
12938 * MN10300 Options::
12939 * Moxie Options::
12940 * MSP430 Options::
12941 * NDS32 Options::
12942 * Nios II Options::
12943 * Nvidia PTX Options::
12944 * PDP-11 Options::
12945 * picoChip Options::
12946 * PowerPC Options::
12947 * RL78 Options::
12948 * RS/6000 and PowerPC Options::
12949 * RX Options::
12950 * S/390 and zSeries Options::
12951 * Score Options::
12952 * SH Options::
12953 * Solaris 2 Options::
12954 * SPARC Options::
12955 * SPU Options::
12956 * System V Options::
12957 * TILE-Gx Options::
12958 * TILEPro Options::
12959 * V850 Options::
12960 * VAX Options::
12961 * Visium Options::
12962 * VMS Options::
12963 * VxWorks Options::
12964 * x86 Options::
12965 * x86 Windows Options::
12966 * Xstormy16 Options::
12967 * Xtensa Options::
12968 * zSeries Options::
12969 @end menu
12970
12971 @node AArch64 Options
12972 @subsection AArch64 Options
12973 @cindex AArch64 Options
12974
12975 These options are defined for AArch64 implementations:
12976
12977 @table @gcctabopt
12978
12979 @item -mabi=@var{name}
12980 @opindex mabi
12981 Generate code for the specified data model. Permissible values
12982 are @samp{ilp32} for SysV-like data model where int, long int and pointers
12983 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
12984 but long int and pointers are 64 bits.
12985
12986 The default depends on the specific target configuration. Note that
12987 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
12988 entire program with the same ABI, and link with a compatible set of libraries.
12989
12990 @item -mbig-endian
12991 @opindex mbig-endian
12992 Generate big-endian code. This is the default when GCC is configured for an
12993 @samp{aarch64_be-*-*} target.
12994
12995 @item -mgeneral-regs-only
12996 @opindex mgeneral-regs-only
12997 Generate code which uses only the general-purpose registers. This will prevent
12998 the compiler from using floating-point and Advanced SIMD registers but will not
12999 impose any restrictions on the assembler.
13000
13001 @item -mlittle-endian
13002 @opindex mlittle-endian
13003 Generate little-endian code. This is the default when GCC is configured for an
13004 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
13005
13006 @item -mcmodel=tiny
13007 @opindex mcmodel=tiny
13008 Generate code for the tiny code model. The program and its statically defined
13009 symbols must be within 1MB of each other. Programs can be statically or
13010 dynamically linked.
13011
13012 @item -mcmodel=small
13013 @opindex mcmodel=small
13014 Generate code for the small code model. The program and its statically defined
13015 symbols must be within 4GB of each other. Programs can be statically or
13016 dynamically linked. This is the default code model.
13017
13018 @item -mcmodel=large
13019 @opindex mcmodel=large
13020 Generate code for the large code model. This makes no assumptions about
13021 addresses and sizes of sections. Programs can be statically linked only.
13022
13023 @item -mstrict-align
13024 @opindex mstrict-align
13025 Avoid generating memory accesses that may not be aligned on a natural object
13026 boundary as described in the architecture specification.
13027
13028 @item -momit-leaf-frame-pointer
13029 @itemx -mno-omit-leaf-frame-pointer
13030 @opindex momit-leaf-frame-pointer
13031 @opindex mno-omit-leaf-frame-pointer
13032 Omit or keep the frame pointer in leaf functions. The former behavior is the
13033 default.
13034
13035 @item -mtls-dialect=desc
13036 @opindex mtls-dialect=desc
13037 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
13038 of TLS variables. This is the default.
13039
13040 @item -mtls-dialect=traditional
13041 @opindex mtls-dialect=traditional
13042 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
13043 of TLS variables.
13044
13045 @item -mtls-size=@var{size}
13046 @opindex mtls-size
13047 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
13048 This option requires binutils 2.26 or newer.
13049
13050 @item -mfix-cortex-a53-835769
13051 @itemx -mno-fix-cortex-a53-835769
13052 @opindex mfix-cortex-a53-835769
13053 @opindex mno-fix-cortex-a53-835769
13054 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
13055 This involves inserting a NOP instruction between memory instructions and
13056 64-bit integer multiply-accumulate instructions.
13057
13058 @item -mfix-cortex-a53-843419
13059 @itemx -mno-fix-cortex-a53-843419
13060 @opindex mfix-cortex-a53-843419
13061 @opindex mno-fix-cortex-a53-843419
13062 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
13063 This erratum workaround is made at link time and this will only pass the
13064 corresponding flag to the linker.
13065
13066 @item -mlow-precision-recip-sqrt
13067 @item -mno-low-precision-recip-sqrt
13068 @opindex mlow-precision-recip-sqrt
13069 @opindex mno-low-precision-recip-sqrt
13070 Enable or disable the reciprocal square root approximation.
13071 This option only has an effect if @option{-ffast-math} or
13072 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13073 precision of reciprocal square root results to about 16 bits for
13074 single precision and to 32 bits for double precision.
13075
13076 @item -mlow-precision-sqrt
13077 @item -mno-low-precision-sqrt
13078 @opindex -mlow-precision-sqrt
13079 @opindex -mno-low-precision-sqrt
13080 Enable or disable the square root approximation.
13081 This option only has an effect if @option{-ffast-math} or
13082 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13083 precision of square root results to about 16 bits for
13084 single precision and to 32 bits for double precision.
13085 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
13086
13087 @item -mlow-precision-div
13088 @item -mno-low-precision-div
13089 @opindex -mlow-precision-div
13090 @opindex -mno-low-precision-div
13091 Enable or disable the division approximation.
13092 This option only has an effect if @option{-ffast-math} or
13093 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13094 precision of division results to about 16 bits for
13095 single precision and to 32 bits for double precision.
13096
13097 @item -march=@var{name}
13098 @opindex march
13099 Specify the name of the target architecture and, optionally, one or
13100 more feature modifiers. This option has the form
13101 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
13102
13103 The permissible values for @var{arch} are @samp{armv8-a},
13104 @samp{armv8.1-a}, @samp{armv8.2-a} or @var{native}.
13105
13106 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
13107 support for the ARMv8.2-A architecture extensions.
13108
13109 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
13110 support for the ARMv8.1-A architecture extension. In particular, it
13111 enables the @samp{+crc} and @samp{+lse} features.
13112
13113 The value @samp{native} is available on native AArch64 GNU/Linux and
13114 causes the compiler to pick the architecture of the host system. This
13115 option has no effect if the compiler is unable to recognize the
13116 architecture of the host system,
13117
13118 The permissible values for @var{feature} are listed in the sub-section
13119 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13120 Feature Modifiers}. Where conflicting feature modifiers are
13121 specified, the right-most feature is used.
13122
13123 GCC uses @var{name} to determine what kind of instructions it can emit
13124 when generating assembly code. If @option{-march} is specified
13125 without either of @option{-mtune} or @option{-mcpu} also being
13126 specified, the code is tuned to perform well across a range of target
13127 processors implementing the target architecture.
13128
13129 @item -mtune=@var{name}
13130 @opindex mtune
13131 Specify the name of the target processor for which GCC should tune the
13132 performance of the code. Permissible values for this option are:
13133 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
13134 @samp{cortex-a72}, @samp{cortex-a73}, @samp{exynos-m1}, @samp{qdf24xx},
13135 @samp{thunderx}, @samp{xgene1}, @samp{vulcan}, @samp{cortex-a57.cortex-a53},
13136 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
13137 @samp{cortex-a73.cortex-a53}, @samp{native}.
13138
13139 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
13140 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}
13141 specify that GCC should tune for a big.LITTLE system.
13142
13143 Additionally on native AArch64 GNU/Linux systems the value
13144 @samp{native} tunes performance to the host system. This option has no effect
13145 if the compiler is unable to recognize the processor of the host system.
13146
13147 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
13148 are specified, the code is tuned to perform well across a range
13149 of target processors.
13150
13151 This option cannot be suffixed by feature modifiers.
13152
13153 @item -mcpu=@var{name}
13154 @opindex mcpu
13155 Specify the name of the target processor, optionally suffixed by one
13156 or more feature modifiers. This option has the form
13157 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
13158 the permissible values for @var{cpu} are the same as those available
13159 for @option{-mtune}. The permissible values for @var{feature} are
13160 documented in the sub-section on
13161 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13162 Feature Modifiers}. Where conflicting feature modifiers are
13163 specified, the right-most feature is used.
13164
13165 GCC uses @var{name} to determine what kind of instructions it can emit when
13166 generating assembly code (as if by @option{-march}) and to determine
13167 the target processor for which to tune for performance (as if
13168 by @option{-mtune}). Where this option is used in conjunction
13169 with @option{-march} or @option{-mtune}, those options take precedence
13170 over the appropriate part of this option.
13171
13172 @item -moverride=@var{string}
13173 @opindex moverride
13174 Override tuning decisions made by the back-end in response to a
13175 @option{-mtune=} switch. The syntax, semantics, and accepted values
13176 for @var{string} in this option are not guaranteed to be consistent
13177 across releases.
13178
13179 This option is only intended to be useful when developing GCC.
13180
13181 @item -mpc-relative-literal-loads
13182 @opindex mpc-relative-literal-loads
13183 Enable PC-relative literal loads. With this option literal pools are
13184 accessed using a single instruction and emitted after each function. This
13185 limits the maximum size of functions to 1MB. This is enabled by default for
13186 @option{-mcmodel=tiny}.
13187
13188 @end table
13189
13190 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
13191 @anchor{aarch64-feature-modifiers}
13192 @cindex @option{-march} feature modifiers
13193 @cindex @option{-mcpu} feature modifiers
13194 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
13195 the following and their inverses @option{no@var{feature}}:
13196
13197 @table @samp
13198 @item crc
13199 Enable CRC extension. This is on by default for
13200 @option{-march=armv8.1-a}.
13201 @item crypto
13202 Enable Crypto extension. This also enables Advanced SIMD and floating-point
13203 instructions.
13204 @item fp
13205 Enable floating-point instructions. This is on by default for all possible
13206 values for options @option{-march} and @option{-mcpu}.
13207 @item simd
13208 Enable Advanced SIMD instructions. This also enables floating-point
13209 instructions. This is on by default for all possible values for options
13210 @option{-march} and @option{-mcpu}.
13211 @item lse
13212 Enable Large System Extension instructions. This is on by default for
13213 @option{-march=armv8.1-a}.
13214 @item fp16
13215 Enable FP16 extension. This also enables floating-point instructions.
13216
13217 @end table
13218
13219 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
13220 Conversely, @option{nofp} implies @option{nosimd}, which implies
13221 @option{nocrypto}.
13222
13223 @node Adapteva Epiphany Options
13224 @subsection Adapteva Epiphany Options
13225
13226 These @samp{-m} options are defined for Adapteva Epiphany:
13227
13228 @table @gcctabopt
13229 @item -mhalf-reg-file
13230 @opindex mhalf-reg-file
13231 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
13232 That allows code to run on hardware variants that lack these registers.
13233
13234 @item -mprefer-short-insn-regs
13235 @opindex mprefer-short-insn-regs
13236 Preferentially allocate registers that allow short instruction generation.
13237 This can result in increased instruction count, so this may either reduce or
13238 increase overall code size.
13239
13240 @item -mbranch-cost=@var{num}
13241 @opindex mbranch-cost
13242 Set the cost of branches to roughly @var{num} ``simple'' instructions.
13243 This cost is only a heuristic and is not guaranteed to produce
13244 consistent results across releases.
13245
13246 @item -mcmove
13247 @opindex mcmove
13248 Enable the generation of conditional moves.
13249
13250 @item -mnops=@var{num}
13251 @opindex mnops
13252 Emit @var{num} NOPs before every other generated instruction.
13253
13254 @item -mno-soft-cmpsf
13255 @opindex mno-soft-cmpsf
13256 For single-precision floating-point comparisons, emit an @code{fsub} instruction
13257 and test the flags. This is faster than a software comparison, but can
13258 get incorrect results in the presence of NaNs, or when two different small
13259 numbers are compared such that their difference is calculated as zero.
13260 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
13261 software comparisons.
13262
13263 @item -mstack-offset=@var{num}
13264 @opindex mstack-offset
13265 Set the offset between the top of the stack and the stack pointer.
13266 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
13267 can be used by leaf functions without stack allocation.
13268 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
13269 Note also that this option changes the ABI; compiling a program with a
13270 different stack offset than the libraries have been compiled with
13271 generally does not work.
13272 This option can be useful if you want to evaluate if a different stack
13273 offset would give you better code, but to actually use a different stack
13274 offset to build working programs, it is recommended to configure the
13275 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
13276
13277 @item -mno-round-nearest
13278 @opindex mno-round-nearest
13279 Make the scheduler assume that the rounding mode has been set to
13280 truncating. The default is @option{-mround-nearest}.
13281
13282 @item -mlong-calls
13283 @opindex mlong-calls
13284 If not otherwise specified by an attribute, assume all calls might be beyond
13285 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
13286 function address into a register before performing a (otherwise direct) call.
13287 This is the default.
13288
13289 @item -mshort-calls
13290 @opindex short-calls
13291 If not otherwise specified by an attribute, assume all direct calls are
13292 in the range of the @code{b} / @code{bl} instructions, so use these instructions
13293 for direct calls. The default is @option{-mlong-calls}.
13294
13295 @item -msmall16
13296 @opindex msmall16
13297 Assume addresses can be loaded as 16-bit unsigned values. This does not
13298 apply to function addresses for which @option{-mlong-calls} semantics
13299 are in effect.
13300
13301 @item -mfp-mode=@var{mode}
13302 @opindex mfp-mode
13303 Set the prevailing mode of the floating-point unit.
13304 This determines the floating-point mode that is provided and expected
13305 at function call and return time. Making this mode match the mode you
13306 predominantly need at function start can make your programs smaller and
13307 faster by avoiding unnecessary mode switches.
13308
13309 @var{mode} can be set to one the following values:
13310
13311 @table @samp
13312 @item caller
13313 Any mode at function entry is valid, and retained or restored when
13314 the function returns, and when it calls other functions.
13315 This mode is useful for compiling libraries or other compilation units
13316 you might want to incorporate into different programs with different
13317 prevailing FPU modes, and the convenience of being able to use a single
13318 object file outweighs the size and speed overhead for any extra
13319 mode switching that might be needed, compared with what would be needed
13320 with a more specific choice of prevailing FPU mode.
13321
13322 @item truncate
13323 This is the mode used for floating-point calculations with
13324 truncating (i.e.@: round towards zero) rounding mode. That includes
13325 conversion from floating point to integer.
13326
13327 @item round-nearest
13328 This is the mode used for floating-point calculations with
13329 round-to-nearest-or-even rounding mode.
13330
13331 @item int
13332 This is the mode used to perform integer calculations in the FPU, e.g.@:
13333 integer multiply, or integer multiply-and-accumulate.
13334 @end table
13335
13336 The default is @option{-mfp-mode=caller}
13337
13338 @item -mnosplit-lohi
13339 @itemx -mno-postinc
13340 @itemx -mno-postmodify
13341 @opindex mnosplit-lohi
13342 @opindex mno-postinc
13343 @opindex mno-postmodify
13344 Code generation tweaks that disable, respectively, splitting of 32-bit
13345 loads, generation of post-increment addresses, and generation of
13346 post-modify addresses. The defaults are @option{msplit-lohi},
13347 @option{-mpost-inc}, and @option{-mpost-modify}.
13348
13349 @item -mnovect-double
13350 @opindex mno-vect-double
13351 Change the preferred SIMD mode to SImode. The default is
13352 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
13353
13354 @item -max-vect-align=@var{num}
13355 @opindex max-vect-align
13356 The maximum alignment for SIMD vector mode types.
13357 @var{num} may be 4 or 8. The default is 8.
13358 Note that this is an ABI change, even though many library function
13359 interfaces are unaffected if they don't use SIMD vector modes
13360 in places that affect size and/or alignment of relevant types.
13361
13362 @item -msplit-vecmove-early
13363 @opindex msplit-vecmove-early
13364 Split vector moves into single word moves before reload. In theory this
13365 can give better register allocation, but so far the reverse seems to be
13366 generally the case.
13367
13368 @item -m1reg-@var{reg}
13369 @opindex m1reg-
13370 Specify a register to hold the constant @minus{}1, which makes loading small negative
13371 constants and certain bitmasks faster.
13372 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
13373 which specify use of that register as a fixed register,
13374 and @samp{none}, which means that no register is used for this
13375 purpose. The default is @option{-m1reg-none}.
13376
13377 @end table
13378
13379 @node ARC Options
13380 @subsection ARC Options
13381 @cindex ARC options
13382
13383 The following options control the architecture variant for which code
13384 is being compiled:
13385
13386 @c architecture variants
13387 @table @gcctabopt
13388
13389 @item -mbarrel-shifter
13390 @opindex mbarrel-shifter
13391 Generate instructions supported by barrel shifter. This is the default
13392 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
13393
13394 @item -mcpu=@var{cpu}
13395 @opindex mcpu
13396 Set architecture type, register usage, and instruction scheduling
13397 parameters for @var{cpu}. There are also shortcut alias options
13398 available for backward compatibility and convenience. Supported
13399 values for @var{cpu} are
13400
13401 @table @samp
13402 @opindex mA6
13403 @opindex mARC600
13404 @item ARC600
13405 @item arc600
13406 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
13407
13408 @item ARC601
13409 @item arc601
13410 @opindex mARC601
13411 Compile for ARC601. Alias: @option{-mARC601}.
13412
13413 @item ARC700
13414 @item arc700
13415 @opindex mA7
13416 @opindex mARC700
13417 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
13418 This is the default when configured with @option{--with-cpu=arc700}@.
13419
13420 @item ARCEM
13421 @item arcem
13422 Compile for ARC EM.
13423
13424 @item ARCHS
13425 @item archs
13426 Compile for ARC HS.
13427 @end table
13428
13429 @item -mdpfp
13430 @opindex mdpfp
13431 @itemx -mdpfp-compact
13432 @opindex mdpfp-compact
13433 FPX: Generate Double Precision FPX instructions, tuned for the compact
13434 implementation.
13435
13436 @item -mdpfp-fast
13437 @opindex mdpfp-fast
13438 FPX: Generate Double Precision FPX instructions, tuned for the fast
13439 implementation.
13440
13441 @item -mno-dpfp-lrsr
13442 @opindex mno-dpfp-lrsr
13443 Disable LR and SR instructions from using FPX extension aux registers.
13444
13445 @item -mea
13446 @opindex mea
13447 Generate Extended arithmetic instructions. Currently only
13448 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
13449 supported. This is always enabled for @option{-mcpu=ARC700}.
13450
13451 @item -mno-mpy
13452 @opindex mno-mpy
13453 Do not generate mpy instructions for ARC700.
13454
13455 @item -mmul32x16
13456 @opindex mmul32x16
13457 Generate 32x16 bit multiply and mac instructions.
13458
13459 @item -mmul64
13460 @opindex mmul64
13461 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
13462
13463 @item -mnorm
13464 @opindex mnorm
13465 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
13466 is in effect.
13467
13468 @item -mspfp
13469 @opindex mspfp
13470 @itemx -mspfp-compact
13471 @opindex mspfp-compact
13472 FPX: Generate Single Precision FPX instructions, tuned for the compact
13473 implementation.
13474
13475 @item -mspfp-fast
13476 @opindex mspfp-fast
13477 FPX: Generate Single Precision FPX instructions, tuned for the fast
13478 implementation.
13479
13480 @item -msimd
13481 @opindex msimd
13482 Enable generation of ARC SIMD instructions via target-specific
13483 builtins. Only valid for @option{-mcpu=ARC700}.
13484
13485 @item -msoft-float
13486 @opindex msoft-float
13487 This option ignored; it is provided for compatibility purposes only.
13488 Software floating point code is emitted by default, and this default
13489 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
13490 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
13491 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
13492
13493 @item -mswap
13494 @opindex mswap
13495 Generate swap instructions.
13496
13497 @item -matomic
13498 @opindex matomic
13499 This enables Locked Load/Store Conditional extension to implement
13500 atomic memopry built-in functions. Not available for ARC 6xx or ARC
13501 EM cores.
13502
13503 @item -mdiv-rem
13504 @opindex mdiv-rem
13505 Enable DIV/REM instructions for ARCv2 cores.
13506
13507 @item -mcode-density
13508 @opindex mcode-density
13509 Enable code density instructions for ARC EM, default on for ARC HS.
13510
13511 @item -mll64
13512 @opindex mll64
13513 Enable double load/store operations for ARC HS cores.
13514
13515 @item -mtp-regno=@var{regno}
13516 @opindex mtp-regno
13517 Specify thread pointer register number.
13518
13519 @item -mmpy-option=@var{multo}
13520 @opindex mmpy-option
13521 Compile ARCv2 code with a multiplier design option. @samp{wlh1} is
13522 the default value. The recognized values for @var{multo} are:
13523
13524 @table @samp
13525 @item 0
13526 No multiplier available.
13527
13528 @item 1
13529 @opindex w
13530 The multiply option is set to w: 16x16 multiplier, fully pipelined.
13531 The following instructions are enabled: MPYW, and MPYUW.
13532
13533 @item 2
13534 @opindex wlh1
13535 The multiply option is set to wlh1: 32x32 multiplier, fully
13536 pipelined (1 stage). The following instructions are additionally
13537 enabled: MPY, MPYU, MPYM, MPYMU, and MPY_S.
13538
13539 @item 3
13540 @opindex wlh2
13541 The multiply option is set to wlh2: 32x32 multiplier, fully pipelined
13542 (2 stages). The following instructions are additionally enabled: MPY,
13543 MPYU, MPYM, MPYMU, and MPY_S.
13544
13545 @item 4
13546 @opindex wlh3
13547 The multiply option is set to wlh3: Two 16x16 multiplier, blocking,
13548 sequential. The following instructions are additionally enabled: MPY,
13549 MPYU, MPYM, MPYMU, and MPY_S.
13550
13551 @item 5
13552 @opindex wlh4
13553 The multiply option is set to wlh4: One 16x16 multiplier, blocking,
13554 sequential. The following instructions are additionally enabled: MPY,
13555 MPYU, MPYM, MPYMU, and MPY_S.
13556
13557 @item 6
13558 @opindex wlh5
13559 The multiply option is set to wlh5: One 32x4 multiplier, blocking,
13560 sequential. The following instructions are additionally enabled: MPY,
13561 MPYU, MPYM, MPYMU, and MPY_S.
13562
13563 @end table
13564
13565 This option is only available for ARCv2 cores@.
13566
13567 @item -mfpu=@var{fpu}
13568 @opindex mfpu
13569 Enables specific floating-point hardware extension for ARCv2
13570 core. Supported values for @var{fpu} are:
13571
13572 @table @samp
13573
13574 @item fpus
13575 @opindex fpus
13576 Enables support for single precision floating point hardware
13577 extensions@.
13578
13579 @item fpud
13580 @opindex fpud
13581 Enables support for double precision floating point hardware
13582 extensions. The single precision floating point extension is also
13583 enabled. Not available for ARC EM@.
13584
13585 @item fpuda
13586 @opindex fpuda
13587 Enables support for double precision floating point hardware
13588 extensions using double precision assist instructions. The single
13589 precision floating point extension is also enabled. This option is
13590 only available for ARC EM@.
13591
13592 @item fpuda_div
13593 @opindex fpuda_div
13594 Enables support for double precision floating point hardware
13595 extensions using double precision assist instructions, and simple
13596 precision square-root and divide hardware extensions. The single
13597 precision floating point extension is also enabled. This option is
13598 only available for ARC EM@.
13599
13600 @item fpuda_fma
13601 @opindex fpuda_fma
13602 Enables support for double precision floating point hardware
13603 extensions using double precision assist instructions, and simple
13604 precision fused multiple and add hardware extension. The single
13605 precision floating point extension is also enabled. This option is
13606 only available for ARC EM@.
13607
13608 @item fpuda_all
13609 @opindex fpuda_all
13610 Enables support for double precision floating point hardware
13611 extensions using double precision assist instructions, and all simple
13612 precision hardware extensions. The single precision floating point
13613 extension is also enabled. This option is only available for ARC EM@.
13614
13615 @item fpus_div
13616 @opindex fpus_div
13617 Enables support for single precision floating point, and single
13618 precision square-root and divide hardware extensions@.
13619
13620 @item fpud_div
13621 @opindex fpud_div
13622 Enables support for double precision floating point, and double
13623 precision square-root and divide hardware extensions. This option
13624 includes option @samp{fpus_div}. Not available for ARC EM@.
13625
13626 @item fpus_fma
13627 @opindex fpus_fma
13628 Enables support for single precision floating point, and single
13629 precision fused multiple and add hardware extensions@.
13630
13631 @item fpud_fma
13632 @opindex fpud_fma
13633 Enables support for double precision floating point, and double
13634 precision fused multiple and add hardware extensions. This option
13635 includes option @samp{fpus_fma}. Not available for ARC EM@.
13636
13637 @item fpus_all
13638 @opindex fpus_all
13639 Enables support for all single precision floating point hardware
13640 extensions@.
13641
13642 @item fpud_all
13643 @opindex fpud_all
13644 Enables support for all single and double precision floating point
13645 hardware extensions. Not available for ARC EM@.
13646
13647 @end table
13648
13649 @end table
13650
13651 The following options are passed through to the assembler, and also
13652 define preprocessor macro symbols.
13653
13654 @c Flags used by the assembler, but for which we define preprocessor
13655 @c macro symbols as well.
13656 @table @gcctabopt
13657 @item -mdsp-packa
13658 @opindex mdsp-packa
13659 Passed down to the assembler to enable the DSP Pack A extensions.
13660 Also sets the preprocessor symbol @code{__Xdsp_packa}.
13661
13662 @item -mdvbf
13663 @opindex mdvbf
13664 Passed down to the assembler to enable the dual viterbi butterfly
13665 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
13666
13667 @c ARC700 4.10 extension instruction
13668 @item -mlock
13669 @opindex mlock
13670 Passed down to the assembler to enable the Locked Load/Store
13671 Conditional extension. Also sets the preprocessor symbol
13672 @code{__Xlock}.
13673
13674 @item -mmac-d16
13675 @opindex mmac-d16
13676 Passed down to the assembler. Also sets the preprocessor symbol
13677 @code{__Xxmac_d16}.
13678
13679 @item -mmac-24
13680 @opindex mmac-24
13681 Passed down to the assembler. Also sets the preprocessor symbol
13682 @code{__Xxmac_24}.
13683
13684 @c ARC700 4.10 extension instruction
13685 @item -mrtsc
13686 @opindex mrtsc
13687 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
13688 extension instruction. Also sets the preprocessor symbol
13689 @code{__Xrtsc}.
13690
13691 @c ARC700 4.10 extension instruction
13692 @item -mswape
13693 @opindex mswape
13694 Passed down to the assembler to enable the swap byte ordering
13695 extension instruction. Also sets the preprocessor symbol
13696 @code{__Xswape}.
13697
13698 @item -mtelephony
13699 @opindex mtelephony
13700 Passed down to the assembler to enable dual and single operand
13701 instructions for telephony. Also sets the preprocessor symbol
13702 @code{__Xtelephony}.
13703
13704 @item -mxy
13705 @opindex mxy
13706 Passed down to the assembler to enable the XY Memory extension. Also
13707 sets the preprocessor symbol @code{__Xxy}.
13708
13709 @end table
13710
13711 The following options control how the assembly code is annotated:
13712
13713 @c Assembly annotation options
13714 @table @gcctabopt
13715 @item -misize
13716 @opindex misize
13717 Annotate assembler instructions with estimated addresses.
13718
13719 @item -mannotate-align
13720 @opindex mannotate-align
13721 Explain what alignment considerations lead to the decision to make an
13722 instruction short or long.
13723
13724 @end table
13725
13726 The following options are passed through to the linker:
13727
13728 @c options passed through to the linker
13729 @table @gcctabopt
13730 @item -marclinux
13731 @opindex marclinux
13732 Passed through to the linker, to specify use of the @code{arclinux} emulation.
13733 This option is enabled by default in tool chains built for
13734 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
13735 when profiling is not requested.
13736
13737 @item -marclinux_prof
13738 @opindex marclinux_prof
13739 Passed through to the linker, to specify use of the
13740 @code{arclinux_prof} emulation. This option is enabled by default in
13741 tool chains built for @w{@code{arc-linux-uclibc}} and
13742 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
13743
13744 @end table
13745
13746 The following options control the semantics of generated code:
13747
13748 @c semantically relevant code generation options
13749 @table @gcctabopt
13750 @item -mlong-calls
13751 @opindex mlong-calls
13752 Generate call insns as register indirect calls, thus providing access
13753 to the full 32-bit address range.
13754
13755 @item -mmedium-calls
13756 @opindex mmedium-calls
13757 Don't use less than 25 bit addressing range for calls, which is the
13758 offset available for an unconditional branch-and-link
13759 instruction. Conditional execution of function calls is suppressed, to
13760 allow use of the 25-bit range, rather than the 21-bit range with
13761 conditional branch-and-link. This is the default for tool chains built
13762 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
13763
13764 @item -mno-sdata
13765 @opindex mno-sdata
13766 Do not generate sdata references. This is the default for tool chains
13767 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
13768 targets.
13769
13770 @item -mucb-mcount
13771 @opindex mucb-mcount
13772 Instrument with mcount calls as used in UCB code. I.e. do the
13773 counting in the callee, not the caller. By default ARC instrumentation
13774 counts in the caller.
13775
13776 @item -mvolatile-cache
13777 @opindex mvolatile-cache
13778 Use ordinarily cached memory accesses for volatile references. This is the
13779 default.
13780
13781 @item -mno-volatile-cache
13782 @opindex mno-volatile-cache
13783 Enable cache bypass for volatile references.
13784
13785 @end table
13786
13787 The following options fine tune code generation:
13788 @c code generation tuning options
13789 @table @gcctabopt
13790 @item -malign-call
13791 @opindex malign-call
13792 Do alignment optimizations for call instructions.
13793
13794 @item -mauto-modify-reg
13795 @opindex mauto-modify-reg
13796 Enable the use of pre/post modify with register displacement.
13797
13798 @item -mbbit-peephole
13799 @opindex mbbit-peephole
13800 Enable bbit peephole2.
13801
13802 @item -mno-brcc
13803 @opindex mno-brcc
13804 This option disables a target-specific pass in @file{arc_reorg} to
13805 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
13806 generation driven by the combiner pass.
13807
13808 @item -mcase-vector-pcrel
13809 @opindex mcase-vector-pcrel
13810 Use pc-relative switch case tables - this enables case table shortening.
13811 This is the default for @option{-Os}.
13812
13813 @item -mcompact-casesi
13814 @opindex mcompact-casesi
13815 Enable compact casesi pattern.
13816 This is the default for @option{-Os}.
13817
13818 @item -mno-cond-exec
13819 @opindex mno-cond-exec
13820 Disable ARCompact specific pass to generate conditional execution instructions.
13821 Due to delay slot scheduling and interactions between operand numbers,
13822 literal sizes, instruction lengths, and the support for conditional execution,
13823 the target-independent pass to generate conditional execution is often lacking,
13824 so the ARC port has kept a special pass around that tries to find more
13825 conditional execution generating opportunities after register allocation,
13826 branch shortening, and delay slot scheduling have been done. This pass
13827 generally, but not always, improves performance and code size, at the cost of
13828 extra compilation time, which is why there is an option to switch it off.
13829 If you have a problem with call instructions exceeding their allowable
13830 offset range because they are conditionalized, you should consider using
13831 @option{-mmedium-calls} instead.
13832
13833 @item -mearly-cbranchsi
13834 @opindex mearly-cbranchsi
13835 Enable pre-reload use of the cbranchsi pattern.
13836
13837 @item -mexpand-adddi
13838 @opindex mexpand-adddi
13839 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
13840 @code{add.f}, @code{adc} etc.
13841
13842 @item -mindexed-loads
13843 @opindex mindexed-loads
13844 Enable the use of indexed loads. This can be problematic because some
13845 optimizers then assume that indexed stores exist, which is not
13846 the case.
13847
13848 @opindex mlra
13849 Enable Local Register Allocation. This is still experimental for ARC,
13850 so by default the compiler uses standard reload
13851 (i.e. @option{-mno-lra}).
13852
13853 @item -mlra-priority-none
13854 @opindex mlra-priority-none
13855 Don't indicate any priority for target registers.
13856
13857 @item -mlra-priority-compact
13858 @opindex mlra-priority-compact
13859 Indicate target register priority for r0..r3 / r12..r15.
13860
13861 @item -mlra-priority-noncompact
13862 @opindex mlra-priority-noncompact
13863 Reduce target register priority for r0..r3 / r12..r15.
13864
13865 @item -mno-millicode
13866 @opindex mno-millicode
13867 When optimizing for size (using @option{-Os}), prologues and epilogues
13868 that have to save or restore a large number of registers are often
13869 shortened by using call to a special function in libgcc; this is
13870 referred to as a @emph{millicode} call. As these calls can pose
13871 performance issues, and/or cause linking issues when linking in a
13872 nonstandard way, this option is provided to turn off millicode call
13873 generation.
13874
13875 @item -mmixed-code
13876 @opindex mmixed-code
13877 Tweak register allocation to help 16-bit instruction generation.
13878 This generally has the effect of decreasing the average instruction size
13879 while increasing the instruction count.
13880
13881 @item -mq-class
13882 @opindex mq-class
13883 Enable 'q' instruction alternatives.
13884 This is the default for @option{-Os}.
13885
13886 @item -mRcq
13887 @opindex mRcq
13888 Enable Rcq constraint handling - most short code generation depends on this.
13889 This is the default.
13890
13891 @item -mRcw
13892 @opindex mRcw
13893 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
13894 This is the default.
13895
13896 @item -msize-level=@var{level}
13897 @opindex msize-level
13898 Fine-tune size optimization with regards to instruction lengths and alignment.
13899 The recognized values for @var{level} are:
13900 @table @samp
13901 @item 0
13902 No size optimization. This level is deprecated and treated like @samp{1}.
13903
13904 @item 1
13905 Short instructions are used opportunistically.
13906
13907 @item 2
13908 In addition, alignment of loops and of code after barriers are dropped.
13909
13910 @item 3
13911 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
13912
13913 @end table
13914
13915 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
13916 the behavior when this is not set is equivalent to level @samp{1}.
13917
13918 @item -mtune=@var{cpu}
13919 @opindex mtune
13920 Set instruction scheduling parameters for @var{cpu}, overriding any implied
13921 by @option{-mcpu=}.
13922
13923 Supported values for @var{cpu} are
13924
13925 @table @samp
13926 @item ARC600
13927 Tune for ARC600 cpu.
13928
13929 @item ARC601
13930 Tune for ARC601 cpu.
13931
13932 @item ARC700
13933 Tune for ARC700 cpu with standard multiplier block.
13934
13935 @item ARC700-xmac
13936 Tune for ARC700 cpu with XMAC block.
13937
13938 @item ARC725D
13939 Tune for ARC725D cpu.
13940
13941 @item ARC750D
13942 Tune for ARC750D cpu.
13943
13944 @end table
13945
13946 @item -mmultcost=@var{num}
13947 @opindex mmultcost
13948 Cost to assume for a multiply instruction, with @samp{4} being equal to a
13949 normal instruction.
13950
13951 @item -munalign-prob-threshold=@var{probability}
13952 @opindex munalign-prob-threshold
13953 Set probability threshold for unaligning branches.
13954 When tuning for @samp{ARC700} and optimizing for speed, branches without
13955 filled delay slot are preferably emitted unaligned and long, unless
13956 profiling indicates that the probability for the branch to be taken
13957 is below @var{probability}. @xref{Cross-profiling}.
13958 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
13959
13960 @end table
13961
13962 The following options are maintained for backward compatibility, but
13963 are now deprecated and will be removed in a future release:
13964
13965 @c Deprecated options
13966 @table @gcctabopt
13967
13968 @item -margonaut
13969 @opindex margonaut
13970 Obsolete FPX.
13971
13972 @item -mbig-endian
13973 @opindex mbig-endian
13974 @itemx -EB
13975 @opindex EB
13976 Compile code for big endian targets. Use of these options is now
13977 deprecated. Users wanting big-endian code, should use the
13978 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
13979 building the tool chain, for which big-endian is the default.
13980
13981 @item -mlittle-endian
13982 @opindex mlittle-endian
13983 @itemx -EL
13984 @opindex EL
13985 Compile code for little endian targets. Use of these options is now
13986 deprecated. Users wanting little-endian code should use the
13987 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
13988 building the tool chain, for which little-endian is the default.
13989
13990 @item -mbarrel_shifter
13991 @opindex mbarrel_shifter
13992 Replaced by @option{-mbarrel-shifter}.
13993
13994 @item -mdpfp_compact
13995 @opindex mdpfp_compact
13996 Replaced by @option{-mdpfp-compact}.
13997
13998 @item -mdpfp_fast
13999 @opindex mdpfp_fast
14000 Replaced by @option{-mdpfp-fast}.
14001
14002 @item -mdsp_packa
14003 @opindex mdsp_packa
14004 Replaced by @option{-mdsp-packa}.
14005
14006 @item -mEA
14007 @opindex mEA
14008 Replaced by @option{-mea}.
14009
14010 @item -mmac_24
14011 @opindex mmac_24
14012 Replaced by @option{-mmac-24}.
14013
14014 @item -mmac_d16
14015 @opindex mmac_d16
14016 Replaced by @option{-mmac-d16}.
14017
14018 @item -mspfp_compact
14019 @opindex mspfp_compact
14020 Replaced by @option{-mspfp-compact}.
14021
14022 @item -mspfp_fast
14023 @opindex mspfp_fast
14024 Replaced by @option{-mspfp-fast}.
14025
14026 @item -mtune=@var{cpu}
14027 @opindex mtune
14028 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
14029 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
14030 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
14031
14032 @item -multcost=@var{num}
14033 @opindex multcost
14034 Replaced by @option{-mmultcost}.
14035
14036 @end table
14037
14038 @node ARM Options
14039 @subsection ARM Options
14040 @cindex ARM options
14041
14042 These @samp{-m} options are defined for the ARM port:
14043
14044 @table @gcctabopt
14045 @item -mabi=@var{name}
14046 @opindex mabi
14047 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
14048 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
14049
14050 @item -mapcs-frame
14051 @opindex mapcs-frame
14052 Generate a stack frame that is compliant with the ARM Procedure Call
14053 Standard for all functions, even if this is not strictly necessary for
14054 correct execution of the code. Specifying @option{-fomit-frame-pointer}
14055 with this option causes the stack frames not to be generated for
14056 leaf functions. The default is @option{-mno-apcs-frame}.
14057 This option is deprecated.
14058
14059 @item -mapcs
14060 @opindex mapcs
14061 This is a synonym for @option{-mapcs-frame} and is deprecated.
14062
14063 @ignore
14064 @c not currently implemented
14065 @item -mapcs-stack-check
14066 @opindex mapcs-stack-check
14067 Generate code to check the amount of stack space available upon entry to
14068 every function (that actually uses some stack space). If there is
14069 insufficient space available then either the function
14070 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
14071 called, depending upon the amount of stack space required. The runtime
14072 system is required to provide these functions. The default is
14073 @option{-mno-apcs-stack-check}, since this produces smaller code.
14074
14075 @c not currently implemented
14076 @item -mapcs-float
14077 @opindex mapcs-float
14078 Pass floating-point arguments using the floating-point registers. This is
14079 one of the variants of the APCS@. This option is recommended if the
14080 target hardware has a floating-point unit or if a lot of floating-point
14081 arithmetic is going to be performed by the code. The default is
14082 @option{-mno-apcs-float}, since the size of integer-only code is
14083 slightly increased if @option{-mapcs-float} is used.
14084
14085 @c not currently implemented
14086 @item -mapcs-reentrant
14087 @opindex mapcs-reentrant
14088 Generate reentrant, position-independent code. The default is
14089 @option{-mno-apcs-reentrant}.
14090 @end ignore
14091
14092 @item -mthumb-interwork
14093 @opindex mthumb-interwork
14094 Generate code that supports calling between the ARM and Thumb
14095 instruction sets. Without this option, on pre-v5 architectures, the
14096 two instruction sets cannot be reliably used inside one program. The
14097 default is @option{-mno-thumb-interwork}, since slightly larger code
14098 is generated when @option{-mthumb-interwork} is specified. In AAPCS
14099 configurations this option is meaningless.
14100
14101 @item -mno-sched-prolog
14102 @opindex mno-sched-prolog
14103 Prevent the reordering of instructions in the function prologue, or the
14104 merging of those instruction with the instructions in the function's
14105 body. This means that all functions start with a recognizable set
14106 of instructions (or in fact one of a choice from a small set of
14107 different function prologues), and this information can be used to
14108 locate the start of functions inside an executable piece of code. The
14109 default is @option{-msched-prolog}.
14110
14111 @item -mfloat-abi=@var{name}
14112 @opindex mfloat-abi
14113 Specifies which floating-point ABI to use. Permissible values
14114 are: @samp{soft}, @samp{softfp} and @samp{hard}.
14115
14116 Specifying @samp{soft} causes GCC to generate output containing
14117 library calls for floating-point operations.
14118 @samp{softfp} allows the generation of code using hardware floating-point
14119 instructions, but still uses the soft-float calling conventions.
14120 @samp{hard} allows generation of floating-point instructions
14121 and uses FPU-specific calling conventions.
14122
14123 The default depends on the specific target configuration. Note that
14124 the hard-float and soft-float ABIs are not link-compatible; you must
14125 compile your entire program with the same ABI, and link with a
14126 compatible set of libraries.
14127
14128 @item -mlittle-endian
14129 @opindex mlittle-endian
14130 Generate code for a processor running in little-endian mode. This is
14131 the default for all standard configurations.
14132
14133 @item -mbig-endian
14134 @opindex mbig-endian
14135 Generate code for a processor running in big-endian mode; the default is
14136 to compile code for a little-endian processor.
14137
14138 @item -march=@var{name}
14139 @opindex march
14140 This specifies the name of the target ARM architecture. GCC uses this
14141 name to determine what kind of instructions it can emit when generating
14142 assembly code. This option can be used in conjunction with or instead
14143 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
14144 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
14145 @samp{armv5}, @samp{armv5e}, @samp{armv5t}, @samp{armv5te},
14146 @samp{armv6}, @samp{armv6-m}, @samp{armv6j}, @samp{armv6k},
14147 @samp{armv6kz}, @samp{armv6s-m},
14148 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk},
14149 @samp{armv7}, @samp{armv7-a}, @samp{armv7-m}, @samp{armv7-r}, @samp{armv7e-m},
14150 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
14151 @samp{armv8.1-a+crc}, @samp{armv8-m.base}, @samp{armv8-m.main},
14152 @samp{armv8-m.main+dsp}, @samp{iwmmxt}, @samp{iwmmxt2}.
14153
14154 Architecture revisions older than @samp{armv4t} are deprecated.
14155
14156 @option{-march=armv6s-m} is the @samp{armv6-m} architecture with support for
14157 the (now mandatory) SVC instruction.
14158
14159 @option{-march=armv6zk} is an alias for @samp{armv6kz}, existing for backwards
14160 compatibility.
14161
14162 @option{-march=armv7ve} is the @samp{armv7-a} architecture with virtualization
14163 extensions.
14164
14165 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
14166 architecture together with the optional CRC32 extensions.
14167
14168 @option{-march=native} causes the compiler to auto-detect the architecture
14169 of the build computer. At present, this feature is only supported on
14170 GNU/Linux, and not all architectures are recognized. If the auto-detect
14171 is unsuccessful the option has no effect.
14172
14173 @item -mtune=@var{name}
14174 @opindex mtune
14175 This option specifies the name of the target ARM processor for
14176 which GCC should tune the performance of the code.
14177 For some ARM implementations better performance can be obtained by using
14178 this option.
14179 Permissible names are: @samp{arm2}, @samp{arm250},
14180 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
14181 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
14182 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
14183 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
14184 @samp{arm720},
14185 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
14186 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
14187 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
14188 @samp{strongarm1110},
14189 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
14190 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
14191 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
14192 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
14193 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
14194 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
14195 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
14196 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
14197 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
14198 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
14199 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-r4},
14200 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
14201 @samp{cortex-m7},
14202 @samp{cortex-m4},
14203 @samp{cortex-m3},
14204 @samp{cortex-m1},
14205 @samp{cortex-m0},
14206 @samp{cortex-m0plus},
14207 @samp{cortex-m1.small-multiply},
14208 @samp{cortex-m0.small-multiply},
14209 @samp{cortex-m0plus.small-multiply},
14210 @samp{exynos-m1},
14211 @samp{qdf24xx},
14212 @samp{marvell-pj4},
14213 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
14214 @samp{fa526}, @samp{fa626},
14215 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
14216 @samp{xgene1}.
14217
14218 Additionally, this option can specify that GCC should tune the performance
14219 of the code for a big.LITTLE system. Permissible names are:
14220 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
14221 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14222 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}.
14223
14224 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
14225 performance for a blend of processors within architecture @var{arch}.
14226 The aim is to generate code that run well on the current most popular
14227 processors, balancing between optimizations that benefit some CPUs in the
14228 range, and avoiding performance pitfalls of other CPUs. The effects of
14229 this option may change in future GCC versions as CPU models come and go.
14230
14231 @option{-mtune=native} causes the compiler to auto-detect the CPU
14232 of the build computer. At present, this feature is only supported on
14233 GNU/Linux, and not all architectures are recognized. If the auto-detect is
14234 unsuccessful the option has no effect.
14235
14236 @item -mcpu=@var{name}
14237 @opindex mcpu
14238 This specifies the name of the target ARM processor. GCC uses this name
14239 to derive the name of the target ARM architecture (as if specified
14240 by @option{-march}) and the ARM processor type for which to tune for
14241 performance (as if specified by @option{-mtune}). Where this option
14242 is used in conjunction with @option{-march} or @option{-mtune},
14243 those options take precedence over the appropriate part of this option.
14244
14245 Permissible names for this option are the same as those for
14246 @option{-mtune}.
14247
14248 @option{-mcpu=generic-@var{arch}} is also permissible, and is
14249 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
14250 See @option{-mtune} for more information.
14251
14252 @option{-mcpu=native} causes the compiler to auto-detect the CPU
14253 of the build computer. At present, this feature is only supported on
14254 GNU/Linux, and not all architectures are recognized. If the auto-detect
14255 is unsuccessful the option has no effect.
14256
14257 @item -mfpu=@var{name}
14258 @opindex mfpu
14259 This specifies what floating-point hardware (or hardware emulation) is
14260 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
14261 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
14262 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
14263 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
14264 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
14265 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
14266
14267 If @option{-msoft-float} is specified this specifies the format of
14268 floating-point values.
14269
14270 If the selected floating-point hardware includes the NEON extension
14271 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
14272 operations are not generated by GCC's auto-vectorization pass unless
14273 @option{-funsafe-math-optimizations} is also specified. This is
14274 because NEON hardware does not fully implement the IEEE 754 standard for
14275 floating-point arithmetic (in particular denormal values are treated as
14276 zero), so the use of NEON instructions may lead to a loss of precision.
14277
14278 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}).
14279
14280 @item -mfp16-format=@var{name}
14281 @opindex mfp16-format
14282 Specify the format of the @code{__fp16} half-precision floating-point type.
14283 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
14284 the default is @samp{none}, in which case the @code{__fp16} type is not
14285 defined. @xref{Half-Precision}, for more information.
14286
14287 @item -mstructure-size-boundary=@var{n}
14288 @opindex mstructure-size-boundary
14289 The sizes of all structures and unions are rounded up to a multiple
14290 of the number of bits set by this option. Permissible values are 8, 32
14291 and 64. The default value varies for different toolchains. For the COFF
14292 targeted toolchain the default value is 8. A value of 64 is only allowed
14293 if the underlying ABI supports it.
14294
14295 Specifying a larger number can produce faster, more efficient code, but
14296 can also increase the size of the program. Different values are potentially
14297 incompatible. Code compiled with one value cannot necessarily expect to
14298 work with code or libraries compiled with another value, if they exchange
14299 information using structures or unions.
14300
14301 @item -mabort-on-noreturn
14302 @opindex mabort-on-noreturn
14303 Generate a call to the function @code{abort} at the end of a
14304 @code{noreturn} function. It is executed if the function tries to
14305 return.
14306
14307 @item -mlong-calls
14308 @itemx -mno-long-calls
14309 @opindex mlong-calls
14310 @opindex mno-long-calls
14311 Tells the compiler to perform function calls by first loading the
14312 address of the function into a register and then performing a subroutine
14313 call on this register. This switch is needed if the target function
14314 lies outside of the 64-megabyte addressing range of the offset-based
14315 version of subroutine call instruction.
14316
14317 Even if this switch is enabled, not all function calls are turned
14318 into long calls. The heuristic is that static functions, functions
14319 that have the @code{short_call} attribute, functions that are inside
14320 the scope of a @code{#pragma no_long_calls} directive, and functions whose
14321 definitions have already been compiled within the current compilation
14322 unit are not turned into long calls. The exceptions to this rule are
14323 that weak function definitions, functions with the @code{long_call}
14324 attribute or the @code{section} attribute, and functions that are within
14325 the scope of a @code{#pragma long_calls} directive are always
14326 turned into long calls.
14327
14328 This feature is not enabled by default. Specifying
14329 @option{-mno-long-calls} restores the default behavior, as does
14330 placing the function calls within the scope of a @code{#pragma
14331 long_calls_off} directive. Note these switches have no effect on how
14332 the compiler generates code to handle function calls via function
14333 pointers.
14334
14335 @item -msingle-pic-base
14336 @opindex msingle-pic-base
14337 Treat the register used for PIC addressing as read-only, rather than
14338 loading it in the prologue for each function. The runtime system is
14339 responsible for initializing this register with an appropriate value
14340 before execution begins.
14341
14342 @item -mpic-register=@var{reg}
14343 @opindex mpic-register
14344 Specify the register to be used for PIC addressing.
14345 For standard PIC base case, the default is any suitable register
14346 determined by compiler. For single PIC base case, the default is
14347 @samp{R9} if target is EABI based or stack-checking is enabled,
14348 otherwise the default is @samp{R10}.
14349
14350 @item -mpic-data-is-text-relative
14351 @opindex mpic-data-is-text-relative
14352 Assume that each data segments are relative to text segment at load time.
14353 Therefore, it permits addressing data using PC-relative operations.
14354 This option is on by default for targets other than VxWorks RTP.
14355
14356 @item -mpoke-function-name
14357 @opindex mpoke-function-name
14358 Write the name of each function into the text section, directly
14359 preceding the function prologue. The generated code is similar to this:
14360
14361 @smallexample
14362 t0
14363 .ascii "arm_poke_function_name", 0
14364 .align
14365 t1
14366 .word 0xff000000 + (t1 - t0)
14367 arm_poke_function_name
14368 mov ip, sp
14369 stmfd sp!, @{fp, ip, lr, pc@}
14370 sub fp, ip, #4
14371 @end smallexample
14372
14373 When performing a stack backtrace, code can inspect the value of
14374 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
14375 location @code{pc - 12} and the top 8 bits are set, then we know that
14376 there is a function name embedded immediately preceding this location
14377 and has length @code{((pc[-3]) & 0xff000000)}.
14378
14379 @item -mthumb
14380 @itemx -marm
14381 @opindex marm
14382 @opindex mthumb
14383
14384 Select between generating code that executes in ARM and Thumb
14385 states. The default for most configurations is to generate code
14386 that executes in ARM state, but the default can be changed by
14387 configuring GCC with the @option{--with-mode=}@var{state}
14388 configure option.
14389
14390 You can also override the ARM and Thumb mode for each function
14391 by using the @code{target("thumb")} and @code{target("arm")} function attributes
14392 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
14393
14394 @item -mtpcs-frame
14395 @opindex mtpcs-frame
14396 Generate a stack frame that is compliant with the Thumb Procedure Call
14397 Standard for all non-leaf functions. (A leaf function is one that does
14398 not call any other functions.) The default is @option{-mno-tpcs-frame}.
14399
14400 @item -mtpcs-leaf-frame
14401 @opindex mtpcs-leaf-frame
14402 Generate a stack frame that is compliant with the Thumb Procedure Call
14403 Standard for all leaf functions. (A leaf function is one that does
14404 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
14405
14406 @item -mcallee-super-interworking
14407 @opindex mcallee-super-interworking
14408 Gives all externally visible functions in the file being compiled an ARM
14409 instruction set header which switches to Thumb mode before executing the
14410 rest of the function. This allows these functions to be called from
14411 non-interworking code. This option is not valid in AAPCS configurations
14412 because interworking is enabled by default.
14413
14414 @item -mcaller-super-interworking
14415 @opindex mcaller-super-interworking
14416 Allows calls via function pointers (including virtual functions) to
14417 execute correctly regardless of whether the target code has been
14418 compiled for interworking or not. There is a small overhead in the cost
14419 of executing a function pointer if this option is enabled. This option
14420 is not valid in AAPCS configurations because interworking is enabled
14421 by default.
14422
14423 @item -mtp=@var{name}
14424 @opindex mtp
14425 Specify the access model for the thread local storage pointer. The valid
14426 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
14427 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
14428 (supported in the arm6k architecture), and @samp{auto}, which uses the
14429 best available method for the selected processor. The default setting is
14430 @samp{auto}.
14431
14432 @item -mtls-dialect=@var{dialect}
14433 @opindex mtls-dialect
14434 Specify the dialect to use for accessing thread local storage. Two
14435 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
14436 @samp{gnu} dialect selects the original GNU scheme for supporting
14437 local and global dynamic TLS models. The @samp{gnu2} dialect
14438 selects the GNU descriptor scheme, which provides better performance
14439 for shared libraries. The GNU descriptor scheme is compatible with
14440 the original scheme, but does require new assembler, linker and
14441 library support. Initial and local exec TLS models are unaffected by
14442 this option and always use the original scheme.
14443
14444 @item -mword-relocations
14445 @opindex mword-relocations
14446 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
14447 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
14448 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
14449 is specified.
14450
14451 @item -mfix-cortex-m3-ldrd
14452 @opindex mfix-cortex-m3-ldrd
14453 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
14454 with overlapping destination and base registers are used. This option avoids
14455 generating these instructions. This option is enabled by default when
14456 @option{-mcpu=cortex-m3} is specified.
14457
14458 @item -munaligned-access
14459 @itemx -mno-unaligned-access
14460 @opindex munaligned-access
14461 @opindex mno-unaligned-access
14462 Enables (or disables) reading and writing of 16- and 32- bit values
14463 from addresses that are not 16- or 32- bit aligned. By default
14464 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
14465 ARMv8-M Baseline architectures, and enabled for all other
14466 architectures. If unaligned access is not enabled then words in packed
14467 data structures are accessed a byte at a time.
14468
14469 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
14470 generated object file to either true or false, depending upon the
14471 setting of this option. If unaligned access is enabled then the
14472 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
14473 defined.
14474
14475 @item -mneon-for-64bits
14476 @opindex mneon-for-64bits
14477 Enables using Neon to handle scalar 64-bits operations. This is
14478 disabled by default since the cost of moving data from core registers
14479 to Neon is high.
14480
14481 @item -mslow-flash-data
14482 @opindex mslow-flash-data
14483 Assume loading data from flash is slower than fetching instruction.
14484 Therefore literal load is minimized for better performance.
14485 This option is only supported when compiling for ARMv7 M-profile and
14486 off by default.
14487
14488 @item -masm-syntax-unified
14489 @opindex masm-syntax-unified
14490 Assume inline assembler is using unified asm syntax. The default is
14491 currently off which implies divided syntax. This option has no impact
14492 on Thumb2. However, this may change in future releases of GCC.
14493 Divided syntax should be considered deprecated.
14494
14495 @item -mrestrict-it
14496 @opindex mrestrict-it
14497 Restricts generation of IT blocks to conform to the rules of ARMv8.
14498 IT blocks can only contain a single 16-bit instruction from a select
14499 set of instructions. This option is on by default for ARMv8 Thumb mode.
14500
14501 @item -mprint-tune-info
14502 @opindex mprint-tune-info
14503 Print CPU tuning information as comment in assembler file. This is
14504 an option used only for regression testing of the compiler and not
14505 intended for ordinary use in compiling code. This option is disabled
14506 by default.
14507 @end table
14508
14509 @node AVR Options
14510 @subsection AVR Options
14511 @cindex AVR Options
14512
14513 These options are defined for AVR implementations:
14514
14515 @table @gcctabopt
14516 @item -mmcu=@var{mcu}
14517 @opindex mmcu
14518 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
14519
14520 The default for this option is@tie{}@samp{avr2}.
14521
14522 GCC supports the following AVR devices and ISAs:
14523
14524 @include avr-mmcu.texi
14525
14526 @item -maccumulate-args
14527 @opindex maccumulate-args
14528 Accumulate outgoing function arguments and acquire/release the needed
14529 stack space for outgoing function arguments once in function
14530 prologue/epilogue. Without this option, outgoing arguments are pushed
14531 before calling a function and popped afterwards.
14532
14533 Popping the arguments after the function call can be expensive on
14534 AVR so that accumulating the stack space might lead to smaller
14535 executables because arguments need not to be removed from the
14536 stack after such a function call.
14537
14538 This option can lead to reduced code size for functions that perform
14539 several calls to functions that get their arguments on the stack like
14540 calls to printf-like functions.
14541
14542 @item -mbranch-cost=@var{cost}
14543 @opindex mbranch-cost
14544 Set the branch costs for conditional branch instructions to
14545 @var{cost}. Reasonable values for @var{cost} are small, non-negative
14546 integers. The default branch cost is 0.
14547
14548 @item -mcall-prologues
14549 @opindex mcall-prologues
14550 Functions prologues/epilogues are expanded as calls to appropriate
14551 subroutines. Code size is smaller.
14552
14553 @item -mint8
14554 @opindex mint8
14555 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
14556 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
14557 and @code{long long} is 4 bytes. Please note that this option does not
14558 conform to the C standards, but it results in smaller code
14559 size.
14560
14561 @item -mn-flash=@var{num}
14562 @opindex mn-flash
14563 Assume that the flash memory has a size of
14564 @var{num} times 64@tie{}KiB.
14565
14566 @item -mno-interrupts
14567 @opindex mno-interrupts
14568 Generated code is not compatible with hardware interrupts.
14569 Code size is smaller.
14570
14571 @item -mrelax
14572 @opindex mrelax
14573 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
14574 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
14575 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
14576 the assembler's command line and the @option{--relax} option to the
14577 linker's command line.
14578
14579 Jump relaxing is performed by the linker because jump offsets are not
14580 known before code is located. Therefore, the assembler code generated by the
14581 compiler is the same, but the instructions in the executable may
14582 differ from instructions in the assembler code.
14583
14584 Relaxing must be turned on if linker stubs are needed, see the
14585 section on @code{EIND} and linker stubs below.
14586
14587 @item -mrmw
14588 @opindex mrmw
14589 Assume that the device supports the Read-Modify-Write
14590 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
14591
14592 @item -msp8
14593 @opindex msp8
14594 Treat the stack pointer register as an 8-bit register,
14595 i.e.@: assume the high byte of the stack pointer is zero.
14596 In general, you don't need to set this option by hand.
14597
14598 This option is used internally by the compiler to select and
14599 build multilibs for architectures @code{avr2} and @code{avr25}.
14600 These architectures mix devices with and without @code{SPH}.
14601 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
14602 the compiler driver adds or removes this option from the compiler
14603 proper's command line, because the compiler then knows if the device
14604 or architecture has an 8-bit stack pointer and thus no @code{SPH}
14605 register or not.
14606
14607 @item -mstrict-X
14608 @opindex mstrict-X
14609 Use address register @code{X} in a way proposed by the hardware. This means
14610 that @code{X} is only used in indirect, post-increment or
14611 pre-decrement addressing.
14612
14613 Without this option, the @code{X} register may be used in the same way
14614 as @code{Y} or @code{Z} which then is emulated by additional
14615 instructions.
14616 For example, loading a value with @code{X+const} addressing with a
14617 small non-negative @code{const < 64} to a register @var{Rn} is
14618 performed as
14619
14620 @example
14621 adiw r26, const ; X += const
14622 ld @var{Rn}, X ; @var{Rn} = *X
14623 sbiw r26, const ; X -= const
14624 @end example
14625
14626 @item -mtiny-stack
14627 @opindex mtiny-stack
14628 Only change the lower 8@tie{}bits of the stack pointer.
14629
14630 @item -mfract-convert-truncate
14631 @opindex mfract-convert-truncate
14632 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
14633
14634 @item -nodevicelib
14635 @opindex nodevicelib
14636 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
14637
14638 @item -Waddr-space-convert
14639 @opindex Waddr-space-convert
14640 Warn about conversions between address spaces in the case where the
14641 resulting address space is not contained in the incoming address space.
14642
14643 @item -Wmisspelled-isr
14644 @opindex Wmisspelled-isr
14645 Warn if the ISR is misspelled, i.e. without __vector prefix.
14646 Enabled by default.
14647 @end table
14648
14649 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
14650 @cindex @code{EIND}
14651 Pointers in the implementation are 16@tie{}bits wide.
14652 The address of a function or label is represented as word address so
14653 that indirect jumps and calls can target any code address in the
14654 range of 64@tie{}Ki words.
14655
14656 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
14657 bytes of program memory space, there is a special function register called
14658 @code{EIND} that serves as most significant part of the target address
14659 when @code{EICALL} or @code{EIJMP} instructions are used.
14660
14661 Indirect jumps and calls on these devices are handled as follows by
14662 the compiler and are subject to some limitations:
14663
14664 @itemize @bullet
14665
14666 @item
14667 The compiler never sets @code{EIND}.
14668
14669 @item
14670 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
14671 instructions or might read @code{EIND} directly in order to emulate an
14672 indirect call/jump by means of a @code{RET} instruction.
14673
14674 @item
14675 The compiler assumes that @code{EIND} never changes during the startup
14676 code or during the application. In particular, @code{EIND} is not
14677 saved/restored in function or interrupt service routine
14678 prologue/epilogue.
14679
14680 @item
14681 For indirect calls to functions and computed goto, the linker
14682 generates @emph{stubs}. Stubs are jump pads sometimes also called
14683 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
14684 The stub contains a direct jump to the desired address.
14685
14686 @item
14687 Linker relaxation must be turned on so that the linker generates
14688 the stubs correctly in all situations. See the compiler option
14689 @option{-mrelax} and the linker option @option{--relax}.
14690 There are corner cases where the linker is supposed to generate stubs
14691 but aborts without relaxation and without a helpful error message.
14692
14693 @item
14694 The default linker script is arranged for code with @code{EIND = 0}.
14695 If code is supposed to work for a setup with @code{EIND != 0}, a custom
14696 linker script has to be used in order to place the sections whose
14697 name start with @code{.trampolines} into the segment where @code{EIND}
14698 points to.
14699
14700 @item
14701 The startup code from libgcc never sets @code{EIND}.
14702 Notice that startup code is a blend of code from libgcc and AVR-LibC.
14703 For the impact of AVR-LibC on @code{EIND}, see the
14704 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
14705
14706 @item
14707 It is legitimate for user-specific startup code to set up @code{EIND}
14708 early, for example by means of initialization code located in
14709 section @code{.init3}. Such code runs prior to general startup code
14710 that initializes RAM and calls constructors, but after the bit
14711 of startup code from AVR-LibC that sets @code{EIND} to the segment
14712 where the vector table is located.
14713 @example
14714 #include <avr/io.h>
14715
14716 static void
14717 __attribute__((section(".init3"),naked,used,no_instrument_function))
14718 init3_set_eind (void)
14719 @{
14720 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
14721 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
14722 @}
14723 @end example
14724
14725 @noindent
14726 The @code{__trampolines_start} symbol is defined in the linker script.
14727
14728 @item
14729 Stubs are generated automatically by the linker if
14730 the following two conditions are met:
14731 @itemize @minus
14732
14733 @item The address of a label is taken by means of the @code{gs} modifier
14734 (short for @emph{generate stubs}) like so:
14735 @example
14736 LDI r24, lo8(gs(@var{func}))
14737 LDI r25, hi8(gs(@var{func}))
14738 @end example
14739 @item The final location of that label is in a code segment
14740 @emph{outside} the segment where the stubs are located.
14741 @end itemize
14742
14743 @item
14744 The compiler emits such @code{gs} modifiers for code labels in the
14745 following situations:
14746 @itemize @minus
14747 @item Taking address of a function or code label.
14748 @item Computed goto.
14749 @item If prologue-save function is used, see @option{-mcall-prologues}
14750 command-line option.
14751 @item Switch/case dispatch tables. If you do not want such dispatch
14752 tables you can specify the @option{-fno-jump-tables} command-line option.
14753 @item C and C++ constructors/destructors called during startup/shutdown.
14754 @item If the tools hit a @code{gs()} modifier explained above.
14755 @end itemize
14756
14757 @item
14758 Jumping to non-symbolic addresses like so is @emph{not} supported:
14759
14760 @example
14761 int main (void)
14762 @{
14763 /* Call function at word address 0x2 */
14764 return ((int(*)(void)) 0x2)();
14765 @}
14766 @end example
14767
14768 Instead, a stub has to be set up, i.e.@: the function has to be called
14769 through a symbol (@code{func_4} in the example):
14770
14771 @example
14772 int main (void)
14773 @{
14774 extern int func_4 (void);
14775
14776 /* Call function at byte address 0x4 */
14777 return func_4();
14778 @}
14779 @end example
14780
14781 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
14782 Alternatively, @code{func_4} can be defined in the linker script.
14783 @end itemize
14784
14785 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
14786 @cindex @code{RAMPD}
14787 @cindex @code{RAMPX}
14788 @cindex @code{RAMPY}
14789 @cindex @code{RAMPZ}
14790 Some AVR devices support memories larger than the 64@tie{}KiB range
14791 that can be accessed with 16-bit pointers. To access memory locations
14792 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
14793 register is used as high part of the address:
14794 The @code{X}, @code{Y}, @code{Z} address register is concatenated
14795 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
14796 register, respectively, to get a wide address. Similarly,
14797 @code{RAMPD} is used together with direct addressing.
14798
14799 @itemize
14800 @item
14801 The startup code initializes the @code{RAMP} special function
14802 registers with zero.
14803
14804 @item
14805 If a @ref{AVR Named Address Spaces,named address space} other than
14806 generic or @code{__flash} is used, then @code{RAMPZ} is set
14807 as needed before the operation.
14808
14809 @item
14810 If the device supports RAM larger than 64@tie{}KiB and the compiler
14811 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
14812 is reset to zero after the operation.
14813
14814 @item
14815 If the device comes with a specific @code{RAMP} register, the ISR
14816 prologue/epilogue saves/restores that SFR and initializes it with
14817 zero in case the ISR code might (implicitly) use it.
14818
14819 @item
14820 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
14821 If you use inline assembler to read from locations outside the
14822 16-bit address range and change one of the @code{RAMP} registers,
14823 you must reset it to zero after the access.
14824
14825 @end itemize
14826
14827 @subsubsection AVR Built-in Macros
14828
14829 GCC defines several built-in macros so that the user code can test
14830 for the presence or absence of features. Almost any of the following
14831 built-in macros are deduced from device capabilities and thus
14832 triggered by the @option{-mmcu=} command-line option.
14833
14834 For even more AVR-specific built-in macros see
14835 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
14836
14837 @table @code
14838
14839 @item __AVR_ARCH__
14840 Build-in macro that resolves to a decimal number that identifies the
14841 architecture and depends on the @option{-mmcu=@var{mcu}} option.
14842 Possible values are:
14843
14844 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
14845 @code{4}, @code{5}, @code{51}, @code{6}
14846
14847 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
14848 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
14849
14850 respectively and
14851
14852 @code{100}, @code{102}, @code{104},
14853 @code{105}, @code{106}, @code{107}
14854
14855 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
14856 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
14857 If @var{mcu} specifies a device, this built-in macro is set
14858 accordingly. For example, with @option{-mmcu=atmega8} the macro is
14859 defined to @code{4}.
14860
14861 @item __AVR_@var{Device}__
14862 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
14863 the device's name. For example, @option{-mmcu=atmega8} defines the
14864 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
14865 @code{__AVR_ATtiny261A__}, etc.
14866
14867 The built-in macros' names follow
14868 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
14869 the device name as from the AVR user manual. The difference between
14870 @var{Device} in the built-in macro and @var{device} in
14871 @option{-mmcu=@var{device}} is that the latter is always lowercase.
14872
14873 If @var{device} is not a device but only a core architecture like
14874 @samp{avr51}, this macro is not defined.
14875
14876 @item __AVR_DEVICE_NAME__
14877 Setting @option{-mmcu=@var{device}} defines this built-in macro to
14878 the device's name. For example, with @option{-mmcu=atmega8} the macro
14879 is defined to @code{atmega8}.
14880
14881 If @var{device} is not a device but only a core architecture like
14882 @samp{avr51}, this macro is not defined.
14883
14884 @item __AVR_XMEGA__
14885 The device / architecture belongs to the XMEGA family of devices.
14886
14887 @item __AVR_HAVE_ELPM__
14888 The device has the @code{ELPM} instruction.
14889
14890 @item __AVR_HAVE_ELPMX__
14891 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
14892 R@var{n},Z+} instructions.
14893
14894 @item __AVR_HAVE_MOVW__
14895 The device has the @code{MOVW} instruction to perform 16-bit
14896 register-register moves.
14897
14898 @item __AVR_HAVE_LPMX__
14899 The device has the @code{LPM R@var{n},Z} and
14900 @code{LPM R@var{n},Z+} instructions.
14901
14902 @item __AVR_HAVE_MUL__
14903 The device has a hardware multiplier.
14904
14905 @item __AVR_HAVE_JMP_CALL__
14906 The device has the @code{JMP} and @code{CALL} instructions.
14907 This is the case for devices with at least 16@tie{}KiB of program
14908 memory.
14909
14910 @item __AVR_HAVE_EIJMP_EICALL__
14911 @itemx __AVR_3_BYTE_PC__
14912 The device has the @code{EIJMP} and @code{EICALL} instructions.
14913 This is the case for devices with more than 128@tie{}KiB of program memory.
14914 This also means that the program counter
14915 (PC) is 3@tie{}bytes wide.
14916
14917 @item __AVR_2_BYTE_PC__
14918 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
14919 with up to 128@tie{}KiB of program memory.
14920
14921 @item __AVR_HAVE_8BIT_SP__
14922 @itemx __AVR_HAVE_16BIT_SP__
14923 The stack pointer (SP) register is treated as 8-bit respectively
14924 16-bit register by the compiler.
14925 The definition of these macros is affected by @option{-mtiny-stack}.
14926
14927 @item __AVR_HAVE_SPH__
14928 @itemx __AVR_SP8__
14929 The device has the SPH (high part of stack pointer) special function
14930 register or has an 8-bit stack pointer, respectively.
14931 The definition of these macros is affected by @option{-mmcu=} and
14932 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
14933 by @option{-msp8}.
14934
14935 @item __AVR_HAVE_RAMPD__
14936 @itemx __AVR_HAVE_RAMPX__
14937 @itemx __AVR_HAVE_RAMPY__
14938 @itemx __AVR_HAVE_RAMPZ__
14939 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
14940 @code{RAMPZ} special function register, respectively.
14941
14942 @item __NO_INTERRUPTS__
14943 This macro reflects the @option{-mno-interrupts} command-line option.
14944
14945 @item __AVR_ERRATA_SKIP__
14946 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
14947 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
14948 instructions because of a hardware erratum. Skip instructions are
14949 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
14950 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
14951 set.
14952
14953 @item __AVR_ISA_RMW__
14954 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
14955
14956 @item __AVR_SFR_OFFSET__=@var{offset}
14957 Instructions that can address I/O special function registers directly
14958 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
14959 address as if addressed by an instruction to access RAM like @code{LD}
14960 or @code{STS}. This offset depends on the device architecture and has
14961 to be subtracted from the RAM address in order to get the
14962 respective I/O@tie{}address.
14963
14964 @item __WITH_AVRLIBC__
14965 The compiler is configured to be used together with AVR-Libc.
14966 See the @option{--with-avrlibc} configure option.
14967
14968 @end table
14969
14970 @node Blackfin Options
14971 @subsection Blackfin Options
14972 @cindex Blackfin Options
14973
14974 @table @gcctabopt
14975 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
14976 @opindex mcpu=
14977 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
14978 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
14979 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
14980 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
14981 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
14982 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
14983 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
14984 @samp{bf561}, @samp{bf592}.
14985
14986 The optional @var{sirevision} specifies the silicon revision of the target
14987 Blackfin processor. Any workarounds available for the targeted silicon revision
14988 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
14989 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
14990 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
14991 hexadecimal digits representing the major and minor numbers in the silicon
14992 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
14993 is not defined. If @var{sirevision} is @samp{any}, the
14994 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
14995 If this optional @var{sirevision} is not used, GCC assumes the latest known
14996 silicon revision of the targeted Blackfin processor.
14997
14998 GCC defines a preprocessor macro for the specified @var{cpu}.
14999 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
15000 provided by libgloss to be linked in if @option{-msim} is not given.
15001
15002 Without this option, @samp{bf532} is used as the processor by default.
15003
15004 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
15005 only the preprocessor macro is defined.
15006
15007 @item -msim
15008 @opindex msim
15009 Specifies that the program will be run on the simulator. This causes
15010 the simulator BSP provided by libgloss to be linked in. This option
15011 has effect only for @samp{bfin-elf} toolchain.
15012 Certain other options, such as @option{-mid-shared-library} and
15013 @option{-mfdpic}, imply @option{-msim}.
15014
15015 @item -momit-leaf-frame-pointer
15016 @opindex momit-leaf-frame-pointer
15017 Don't keep the frame pointer in a register for leaf functions. This
15018 avoids the instructions to save, set up and restore frame pointers and
15019 makes an extra register available in leaf functions. The option
15020 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
15021 which might make debugging harder.
15022
15023 @item -mspecld-anomaly
15024 @opindex mspecld-anomaly
15025 When enabled, the compiler ensures that the generated code does not
15026 contain speculative loads after jump instructions. If this option is used,
15027 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
15028
15029 @item -mno-specld-anomaly
15030 @opindex mno-specld-anomaly
15031 Don't generate extra code to prevent speculative loads from occurring.
15032
15033 @item -mcsync-anomaly
15034 @opindex mcsync-anomaly
15035 When enabled, the compiler ensures that the generated code does not
15036 contain CSYNC or SSYNC instructions too soon after conditional branches.
15037 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
15038
15039 @item -mno-csync-anomaly
15040 @opindex mno-csync-anomaly
15041 Don't generate extra code to prevent CSYNC or SSYNC instructions from
15042 occurring too soon after a conditional branch.
15043
15044 @item -mlow-64k
15045 @opindex mlow-64k
15046 When enabled, the compiler is free to take advantage of the knowledge that
15047 the entire program fits into the low 64k of memory.
15048
15049 @item -mno-low-64k
15050 @opindex mno-low-64k
15051 Assume that the program is arbitrarily large. This is the default.
15052
15053 @item -mstack-check-l1
15054 @opindex mstack-check-l1
15055 Do stack checking using information placed into L1 scratchpad memory by the
15056 uClinux kernel.
15057
15058 @item -mid-shared-library
15059 @opindex mid-shared-library
15060 Generate code that supports shared libraries via the library ID method.
15061 This allows for execute in place and shared libraries in an environment
15062 without virtual memory management. This option implies @option{-fPIC}.
15063 With a @samp{bfin-elf} target, this option implies @option{-msim}.
15064
15065 @item -mno-id-shared-library
15066 @opindex mno-id-shared-library
15067 Generate code that doesn't assume ID-based shared libraries are being used.
15068 This is the default.
15069
15070 @item -mleaf-id-shared-library
15071 @opindex mleaf-id-shared-library
15072 Generate code that supports shared libraries via the library ID method,
15073 but assumes that this library or executable won't link against any other
15074 ID shared libraries. That allows the compiler to use faster code for jumps
15075 and calls.
15076
15077 @item -mno-leaf-id-shared-library
15078 @opindex mno-leaf-id-shared-library
15079 Do not assume that the code being compiled won't link against any ID shared
15080 libraries. Slower code is generated for jump and call insns.
15081
15082 @item -mshared-library-id=n
15083 @opindex mshared-library-id
15084 Specifies the identification number of the ID-based shared library being
15085 compiled. Specifying a value of 0 generates more compact code; specifying
15086 other values forces the allocation of that number to the current
15087 library but is no more space- or time-efficient than omitting this option.
15088
15089 @item -msep-data
15090 @opindex msep-data
15091 Generate code that allows the data segment to be located in a different
15092 area of memory from the text segment. This allows for execute in place in
15093 an environment without virtual memory management by eliminating relocations
15094 against the text section.
15095
15096 @item -mno-sep-data
15097 @opindex mno-sep-data
15098 Generate code that assumes that the data segment follows the text segment.
15099 This is the default.
15100
15101 @item -mlong-calls
15102 @itemx -mno-long-calls
15103 @opindex mlong-calls
15104 @opindex mno-long-calls
15105 Tells the compiler to perform function calls by first loading the
15106 address of the function into a register and then performing a subroutine
15107 call on this register. This switch is needed if the target function
15108 lies outside of the 24-bit addressing range of the offset-based
15109 version of subroutine call instruction.
15110
15111 This feature is not enabled by default. Specifying
15112 @option{-mno-long-calls} restores the default behavior. Note these
15113 switches have no effect on how the compiler generates code to handle
15114 function calls via function pointers.
15115
15116 @item -mfast-fp
15117 @opindex mfast-fp
15118 Link with the fast floating-point library. This library relaxes some of
15119 the IEEE floating-point standard's rules for checking inputs against
15120 Not-a-Number (NAN), in the interest of performance.
15121
15122 @item -minline-plt
15123 @opindex minline-plt
15124 Enable inlining of PLT entries in function calls to functions that are
15125 not known to bind locally. It has no effect without @option{-mfdpic}.
15126
15127 @item -mmulticore
15128 @opindex mmulticore
15129 Build a standalone application for multicore Blackfin processors.
15130 This option causes proper start files and link scripts supporting
15131 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
15132 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
15133
15134 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
15135 selects the one-application-per-core programming model. Without
15136 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
15137 programming model is used. In this model, the main function of Core B
15138 should be named as @code{coreb_main}.
15139
15140 If this option is not used, the single-core application programming
15141 model is used.
15142
15143 @item -mcorea
15144 @opindex mcorea
15145 Build a standalone application for Core A of BF561 when using
15146 the one-application-per-core programming model. Proper start files
15147 and link scripts are used to support Core A, and the macro
15148 @code{__BFIN_COREA} is defined.
15149 This option can only be used in conjunction with @option{-mmulticore}.
15150
15151 @item -mcoreb
15152 @opindex mcoreb
15153 Build a standalone application for Core B of BF561 when using
15154 the one-application-per-core programming model. Proper start files
15155 and link scripts are used to support Core B, and the macro
15156 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
15157 should be used instead of @code{main}.
15158 This option can only be used in conjunction with @option{-mmulticore}.
15159
15160 @item -msdram
15161 @opindex msdram
15162 Build a standalone application for SDRAM. Proper start files and
15163 link scripts are used to put the application into SDRAM, and the macro
15164 @code{__BFIN_SDRAM} is defined.
15165 The loader should initialize SDRAM before loading the application.
15166
15167 @item -micplb
15168 @opindex micplb
15169 Assume that ICPLBs are enabled at run time. This has an effect on certain
15170 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
15171 are enabled; for standalone applications the default is off.
15172 @end table
15173
15174 @node C6X Options
15175 @subsection C6X Options
15176 @cindex C6X Options
15177
15178 @table @gcctabopt
15179 @item -march=@var{name}
15180 @opindex march
15181 This specifies the name of the target architecture. GCC uses this
15182 name to determine what kind of instructions it can emit when generating
15183 assembly code. Permissible names are: @samp{c62x},
15184 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
15185
15186 @item -mbig-endian
15187 @opindex mbig-endian
15188 Generate code for a big-endian target.
15189
15190 @item -mlittle-endian
15191 @opindex mlittle-endian
15192 Generate code for a little-endian target. This is the default.
15193
15194 @item -msim
15195 @opindex msim
15196 Choose startup files and linker script suitable for the simulator.
15197
15198 @item -msdata=default
15199 @opindex msdata=default
15200 Put small global and static data in the @code{.neardata} section,
15201 which is pointed to by register @code{B14}. Put small uninitialized
15202 global and static data in the @code{.bss} section, which is adjacent
15203 to the @code{.neardata} section. Put small read-only data into the
15204 @code{.rodata} section. The corresponding sections used for large
15205 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
15206
15207 @item -msdata=all
15208 @opindex msdata=all
15209 Put all data, not just small objects, into the sections reserved for
15210 small data, and use addressing relative to the @code{B14} register to
15211 access them.
15212
15213 @item -msdata=none
15214 @opindex msdata=none
15215 Make no use of the sections reserved for small data, and use absolute
15216 addresses to access all data. Put all initialized global and static
15217 data in the @code{.fardata} section, and all uninitialized data in the
15218 @code{.far} section. Put all constant data into the @code{.const}
15219 section.
15220 @end table
15221
15222 @node CRIS Options
15223 @subsection CRIS Options
15224 @cindex CRIS Options
15225
15226 These options are defined specifically for the CRIS ports.
15227
15228 @table @gcctabopt
15229 @item -march=@var{architecture-type}
15230 @itemx -mcpu=@var{architecture-type}
15231 @opindex march
15232 @opindex mcpu
15233 Generate code for the specified architecture. The choices for
15234 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
15235 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
15236 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
15237 @samp{v10}.
15238
15239 @item -mtune=@var{architecture-type}
15240 @opindex mtune
15241 Tune to @var{architecture-type} everything applicable about the generated
15242 code, except for the ABI and the set of available instructions. The
15243 choices for @var{architecture-type} are the same as for
15244 @option{-march=@var{architecture-type}}.
15245
15246 @item -mmax-stack-frame=@var{n}
15247 @opindex mmax-stack-frame
15248 Warn when the stack frame of a function exceeds @var{n} bytes.
15249
15250 @item -metrax4
15251 @itemx -metrax100
15252 @opindex metrax4
15253 @opindex metrax100
15254 The options @option{-metrax4} and @option{-metrax100} are synonyms for
15255 @option{-march=v3} and @option{-march=v8} respectively.
15256
15257 @item -mmul-bug-workaround
15258 @itemx -mno-mul-bug-workaround
15259 @opindex mmul-bug-workaround
15260 @opindex mno-mul-bug-workaround
15261 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
15262 models where it applies. This option is active by default.
15263
15264 @item -mpdebug
15265 @opindex mpdebug
15266 Enable CRIS-specific verbose debug-related information in the assembly
15267 code. This option also has the effect of turning off the @samp{#NO_APP}
15268 formatted-code indicator to the assembler at the beginning of the
15269 assembly file.
15270
15271 @item -mcc-init
15272 @opindex mcc-init
15273 Do not use condition-code results from previous instruction; always emit
15274 compare and test instructions before use of condition codes.
15275
15276 @item -mno-side-effects
15277 @opindex mno-side-effects
15278 Do not emit instructions with side effects in addressing modes other than
15279 post-increment.
15280
15281 @item -mstack-align
15282 @itemx -mno-stack-align
15283 @itemx -mdata-align
15284 @itemx -mno-data-align
15285 @itemx -mconst-align
15286 @itemx -mno-const-align
15287 @opindex mstack-align
15288 @opindex mno-stack-align
15289 @opindex mdata-align
15290 @opindex mno-data-align
15291 @opindex mconst-align
15292 @opindex mno-const-align
15293 These options (@samp{no-} options) arrange (eliminate arrangements) for the
15294 stack frame, individual data and constants to be aligned for the maximum
15295 single data access size for the chosen CPU model. The default is to
15296 arrange for 32-bit alignment. ABI details such as structure layout are
15297 not affected by these options.
15298
15299 @item -m32-bit
15300 @itemx -m16-bit
15301 @itemx -m8-bit
15302 @opindex m32-bit
15303 @opindex m16-bit
15304 @opindex m8-bit
15305 Similar to the stack- data- and const-align options above, these options
15306 arrange for stack frame, writable data and constants to all be 32-bit,
15307 16-bit or 8-bit aligned. The default is 32-bit alignment.
15308
15309 @item -mno-prologue-epilogue
15310 @itemx -mprologue-epilogue
15311 @opindex mno-prologue-epilogue
15312 @opindex mprologue-epilogue
15313 With @option{-mno-prologue-epilogue}, the normal function prologue and
15314 epilogue which set up the stack frame are omitted and no return
15315 instructions or return sequences are generated in the code. Use this
15316 option only together with visual inspection of the compiled code: no
15317 warnings or errors are generated when call-saved registers must be saved,
15318 or storage for local variables needs to be allocated.
15319
15320 @item -mno-gotplt
15321 @itemx -mgotplt
15322 @opindex mno-gotplt
15323 @opindex mgotplt
15324 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
15325 instruction sequences that load addresses for functions from the PLT part
15326 of the GOT rather than (traditional on other architectures) calls to the
15327 PLT@. The default is @option{-mgotplt}.
15328
15329 @item -melf
15330 @opindex melf
15331 Legacy no-op option only recognized with the cris-axis-elf and
15332 cris-axis-linux-gnu targets.
15333
15334 @item -mlinux
15335 @opindex mlinux
15336 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
15337
15338 @item -sim
15339 @opindex sim
15340 This option, recognized for the cris-axis-elf, arranges
15341 to link with input-output functions from a simulator library. Code,
15342 initialized data and zero-initialized data are allocated consecutively.
15343
15344 @item -sim2
15345 @opindex sim2
15346 Like @option{-sim}, but pass linker options to locate initialized data at
15347 0x40000000 and zero-initialized data at 0x80000000.
15348 @end table
15349
15350 @node CR16 Options
15351 @subsection CR16 Options
15352 @cindex CR16 Options
15353
15354 These options are defined specifically for the CR16 ports.
15355
15356 @table @gcctabopt
15357
15358 @item -mmac
15359 @opindex mmac
15360 Enable the use of multiply-accumulate instructions. Disabled by default.
15361
15362 @item -mcr16cplus
15363 @itemx -mcr16c
15364 @opindex mcr16cplus
15365 @opindex mcr16c
15366 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
15367 is default.
15368
15369 @item -msim
15370 @opindex msim
15371 Links the library libsim.a which is in compatible with simulator. Applicable
15372 to ELF compiler only.
15373
15374 @item -mint32
15375 @opindex mint32
15376 Choose integer type as 32-bit wide.
15377
15378 @item -mbit-ops
15379 @opindex mbit-ops
15380 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
15381
15382 @item -mdata-model=@var{model}
15383 @opindex mdata-model
15384 Choose a data model. The choices for @var{model} are @samp{near},
15385 @samp{far} or @samp{medium}. @samp{medium} is default.
15386 However, @samp{far} is not valid with @option{-mcr16c}, as the
15387 CR16C architecture does not support the far data model.
15388 @end table
15389
15390 @node Darwin Options
15391 @subsection Darwin Options
15392 @cindex Darwin options
15393
15394 These options are defined for all architectures running the Darwin operating
15395 system.
15396
15397 FSF GCC on Darwin does not create ``fat'' object files; it creates
15398 an object file for the single architecture that GCC was built to
15399 target. Apple's GCC on Darwin does create ``fat'' files if multiple
15400 @option{-arch} options are used; it does so by running the compiler or
15401 linker multiple times and joining the results together with
15402 @file{lipo}.
15403
15404 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
15405 @samp{i686}) is determined by the flags that specify the ISA
15406 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
15407 @option{-force_cpusubtype_ALL} option can be used to override this.
15408
15409 The Darwin tools vary in their behavior when presented with an ISA
15410 mismatch. The assembler, @file{as}, only permits instructions to
15411 be used that are valid for the subtype of the file it is generating,
15412 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
15413 The linker for shared libraries, @file{/usr/bin/libtool}, fails
15414 and prints an error if asked to create a shared library with a less
15415 restrictive subtype than its input files (for instance, trying to put
15416 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
15417 for executables, @command{ld}, quietly gives the executable the most
15418 restrictive subtype of any of its input files.
15419
15420 @table @gcctabopt
15421 @item -F@var{dir}
15422 @opindex F
15423 Add the framework directory @var{dir} to the head of the list of
15424 directories to be searched for header files. These directories are
15425 interleaved with those specified by @option{-I} options and are
15426 scanned in a left-to-right order.
15427
15428 A framework directory is a directory with frameworks in it. A
15429 framework is a directory with a @file{Headers} and/or
15430 @file{PrivateHeaders} directory contained directly in it that ends
15431 in @file{.framework}. The name of a framework is the name of this
15432 directory excluding the @file{.framework}. Headers associated with
15433 the framework are found in one of those two directories, with
15434 @file{Headers} being searched first. A subframework is a framework
15435 directory that is in a framework's @file{Frameworks} directory.
15436 Includes of subframework headers can only appear in a header of a
15437 framework that contains the subframework, or in a sibling subframework
15438 header. Two subframeworks are siblings if they occur in the same
15439 framework. A subframework should not have the same name as a
15440 framework; a warning is issued if this is violated. Currently a
15441 subframework cannot have subframeworks; in the future, the mechanism
15442 may be extended to support this. The standard frameworks can be found
15443 in @file{/System/Library/Frameworks} and
15444 @file{/Library/Frameworks}. An example include looks like
15445 @code{#include <Framework/header.h>}, where @file{Framework} denotes
15446 the name of the framework and @file{header.h} is found in the
15447 @file{PrivateHeaders} or @file{Headers} directory.
15448
15449 @item -iframework@var{dir}
15450 @opindex iframework
15451 Like @option{-F} except the directory is a treated as a system
15452 directory. The main difference between this @option{-iframework} and
15453 @option{-F} is that with @option{-iframework} the compiler does not
15454 warn about constructs contained within header files found via
15455 @var{dir}. This option is valid only for the C family of languages.
15456
15457 @item -gused
15458 @opindex gused
15459 Emit debugging information for symbols that are used. For stabs
15460 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
15461 This is by default ON@.
15462
15463 @item -gfull
15464 @opindex gfull
15465 Emit debugging information for all symbols and types.
15466
15467 @item -mmacosx-version-min=@var{version}
15468 The earliest version of MacOS X that this executable will run on
15469 is @var{version}. Typical values of @var{version} include @code{10.1},
15470 @code{10.2}, and @code{10.3.9}.
15471
15472 If the compiler was built to use the system's headers by default,
15473 then the default for this option is the system version on which the
15474 compiler is running, otherwise the default is to make choices that
15475 are compatible with as many systems and code bases as possible.
15476
15477 @item -mkernel
15478 @opindex mkernel
15479 Enable kernel development mode. The @option{-mkernel} option sets
15480 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
15481 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
15482 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
15483 applicable. This mode also sets @option{-mno-altivec},
15484 @option{-msoft-float}, @option{-fno-builtin} and
15485 @option{-mlong-branch} for PowerPC targets.
15486
15487 @item -mone-byte-bool
15488 @opindex mone-byte-bool
15489 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
15490 By default @code{sizeof(bool)} is @code{4} when compiling for
15491 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
15492 option has no effect on x86.
15493
15494 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
15495 to generate code that is not binary compatible with code generated
15496 without that switch. Using this switch may require recompiling all
15497 other modules in a program, including system libraries. Use this
15498 switch to conform to a non-default data model.
15499
15500 @item -mfix-and-continue
15501 @itemx -ffix-and-continue
15502 @itemx -findirect-data
15503 @opindex mfix-and-continue
15504 @opindex ffix-and-continue
15505 @opindex findirect-data
15506 Generate code suitable for fast turnaround development, such as to
15507 allow GDB to dynamically load @file{.o} files into already-running
15508 programs. @option{-findirect-data} and @option{-ffix-and-continue}
15509 are provided for backwards compatibility.
15510
15511 @item -all_load
15512 @opindex all_load
15513 Loads all members of static archive libraries.
15514 See man ld(1) for more information.
15515
15516 @item -arch_errors_fatal
15517 @opindex arch_errors_fatal
15518 Cause the errors having to do with files that have the wrong architecture
15519 to be fatal.
15520
15521 @item -bind_at_load
15522 @opindex bind_at_load
15523 Causes the output file to be marked such that the dynamic linker will
15524 bind all undefined references when the file is loaded or launched.
15525
15526 @item -bundle
15527 @opindex bundle
15528 Produce a Mach-o bundle format file.
15529 See man ld(1) for more information.
15530
15531 @item -bundle_loader @var{executable}
15532 @opindex bundle_loader
15533 This option specifies the @var{executable} that will load the build
15534 output file being linked. See man ld(1) for more information.
15535
15536 @item -dynamiclib
15537 @opindex dynamiclib
15538 When passed this option, GCC produces a dynamic library instead of
15539 an executable when linking, using the Darwin @file{libtool} command.
15540
15541 @item -force_cpusubtype_ALL
15542 @opindex force_cpusubtype_ALL
15543 This causes GCC's output file to have the @samp{ALL} subtype, instead of
15544 one controlled by the @option{-mcpu} or @option{-march} option.
15545
15546 @item -allowable_client @var{client_name}
15547 @itemx -client_name
15548 @itemx -compatibility_version
15549 @itemx -current_version
15550 @itemx -dead_strip
15551 @itemx -dependency-file
15552 @itemx -dylib_file
15553 @itemx -dylinker_install_name
15554 @itemx -dynamic
15555 @itemx -exported_symbols_list
15556 @itemx -filelist
15557 @need 800
15558 @itemx -flat_namespace
15559 @itemx -force_flat_namespace
15560 @itemx -headerpad_max_install_names
15561 @itemx -image_base
15562 @itemx -init
15563 @itemx -install_name
15564 @itemx -keep_private_externs
15565 @itemx -multi_module
15566 @itemx -multiply_defined
15567 @itemx -multiply_defined_unused
15568 @need 800
15569 @itemx -noall_load
15570 @itemx -no_dead_strip_inits_and_terms
15571 @itemx -nofixprebinding
15572 @itemx -nomultidefs
15573 @itemx -noprebind
15574 @itemx -noseglinkedit
15575 @itemx -pagezero_size
15576 @itemx -prebind
15577 @itemx -prebind_all_twolevel_modules
15578 @itemx -private_bundle
15579 @need 800
15580 @itemx -read_only_relocs
15581 @itemx -sectalign
15582 @itemx -sectobjectsymbols
15583 @itemx -whyload
15584 @itemx -seg1addr
15585 @itemx -sectcreate
15586 @itemx -sectobjectsymbols
15587 @itemx -sectorder
15588 @itemx -segaddr
15589 @itemx -segs_read_only_addr
15590 @need 800
15591 @itemx -segs_read_write_addr
15592 @itemx -seg_addr_table
15593 @itemx -seg_addr_table_filename
15594 @itemx -seglinkedit
15595 @itemx -segprot
15596 @itemx -segs_read_only_addr
15597 @itemx -segs_read_write_addr
15598 @itemx -single_module
15599 @itemx -static
15600 @itemx -sub_library
15601 @need 800
15602 @itemx -sub_umbrella
15603 @itemx -twolevel_namespace
15604 @itemx -umbrella
15605 @itemx -undefined
15606 @itemx -unexported_symbols_list
15607 @itemx -weak_reference_mismatches
15608 @itemx -whatsloaded
15609 @opindex allowable_client
15610 @opindex client_name
15611 @opindex compatibility_version
15612 @opindex current_version
15613 @opindex dead_strip
15614 @opindex dependency-file
15615 @opindex dylib_file
15616 @opindex dylinker_install_name
15617 @opindex dynamic
15618 @opindex exported_symbols_list
15619 @opindex filelist
15620 @opindex flat_namespace
15621 @opindex force_flat_namespace
15622 @opindex headerpad_max_install_names
15623 @opindex image_base
15624 @opindex init
15625 @opindex install_name
15626 @opindex keep_private_externs
15627 @opindex multi_module
15628 @opindex multiply_defined
15629 @opindex multiply_defined_unused
15630 @opindex noall_load
15631 @opindex no_dead_strip_inits_and_terms
15632 @opindex nofixprebinding
15633 @opindex nomultidefs
15634 @opindex noprebind
15635 @opindex noseglinkedit
15636 @opindex pagezero_size
15637 @opindex prebind
15638 @opindex prebind_all_twolevel_modules
15639 @opindex private_bundle
15640 @opindex read_only_relocs
15641 @opindex sectalign
15642 @opindex sectobjectsymbols
15643 @opindex whyload
15644 @opindex seg1addr
15645 @opindex sectcreate
15646 @opindex sectobjectsymbols
15647 @opindex sectorder
15648 @opindex segaddr
15649 @opindex segs_read_only_addr
15650 @opindex segs_read_write_addr
15651 @opindex seg_addr_table
15652 @opindex seg_addr_table_filename
15653 @opindex seglinkedit
15654 @opindex segprot
15655 @opindex segs_read_only_addr
15656 @opindex segs_read_write_addr
15657 @opindex single_module
15658 @opindex static
15659 @opindex sub_library
15660 @opindex sub_umbrella
15661 @opindex twolevel_namespace
15662 @opindex umbrella
15663 @opindex undefined
15664 @opindex unexported_symbols_list
15665 @opindex weak_reference_mismatches
15666 @opindex whatsloaded
15667 These options are passed to the Darwin linker. The Darwin linker man page
15668 describes them in detail.
15669 @end table
15670
15671 @node DEC Alpha Options
15672 @subsection DEC Alpha Options
15673
15674 These @samp{-m} options are defined for the DEC Alpha implementations:
15675
15676 @table @gcctabopt
15677 @item -mno-soft-float
15678 @itemx -msoft-float
15679 @opindex mno-soft-float
15680 @opindex msoft-float
15681 Use (do not use) the hardware floating-point instructions for
15682 floating-point operations. When @option{-msoft-float} is specified,
15683 functions in @file{libgcc.a} are used to perform floating-point
15684 operations. Unless they are replaced by routines that emulate the
15685 floating-point operations, or compiled in such a way as to call such
15686 emulations routines, these routines issue floating-point
15687 operations. If you are compiling for an Alpha without floating-point
15688 operations, you must ensure that the library is built so as not to call
15689 them.
15690
15691 Note that Alpha implementations without floating-point operations are
15692 required to have floating-point registers.
15693
15694 @item -mfp-reg
15695 @itemx -mno-fp-regs
15696 @opindex mfp-reg
15697 @opindex mno-fp-regs
15698 Generate code that uses (does not use) the floating-point register set.
15699 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
15700 register set is not used, floating-point operands are passed in integer
15701 registers as if they were integers and floating-point results are passed
15702 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
15703 so any function with a floating-point argument or return value called by code
15704 compiled with @option{-mno-fp-regs} must also be compiled with that
15705 option.
15706
15707 A typical use of this option is building a kernel that does not use,
15708 and hence need not save and restore, any floating-point registers.
15709
15710 @item -mieee
15711 @opindex mieee
15712 The Alpha architecture implements floating-point hardware optimized for
15713 maximum performance. It is mostly compliant with the IEEE floating-point
15714 standard. However, for full compliance, software assistance is
15715 required. This option generates code fully IEEE-compliant code
15716 @emph{except} that the @var{inexact-flag} is not maintained (see below).
15717 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
15718 defined during compilation. The resulting code is less efficient but is
15719 able to correctly support denormalized numbers and exceptional IEEE
15720 values such as not-a-number and plus/minus infinity. Other Alpha
15721 compilers call this option @option{-ieee_with_no_inexact}.
15722
15723 @item -mieee-with-inexact
15724 @opindex mieee-with-inexact
15725 This is like @option{-mieee} except the generated code also maintains
15726 the IEEE @var{inexact-flag}. Turning on this option causes the
15727 generated code to implement fully-compliant IEEE math. In addition to
15728 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
15729 macro. On some Alpha implementations the resulting code may execute
15730 significantly slower than the code generated by default. Since there is
15731 very little code that depends on the @var{inexact-flag}, you should
15732 normally not specify this option. Other Alpha compilers call this
15733 option @option{-ieee_with_inexact}.
15734
15735 @item -mfp-trap-mode=@var{trap-mode}
15736 @opindex mfp-trap-mode
15737 This option controls what floating-point related traps are enabled.
15738 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
15739 The trap mode can be set to one of four values:
15740
15741 @table @samp
15742 @item n
15743 This is the default (normal) setting. The only traps that are enabled
15744 are the ones that cannot be disabled in software (e.g., division by zero
15745 trap).
15746
15747 @item u
15748 In addition to the traps enabled by @samp{n}, underflow traps are enabled
15749 as well.
15750
15751 @item su
15752 Like @samp{u}, but the instructions are marked to be safe for software
15753 completion (see Alpha architecture manual for details).
15754
15755 @item sui
15756 Like @samp{su}, but inexact traps are enabled as well.
15757 @end table
15758
15759 @item -mfp-rounding-mode=@var{rounding-mode}
15760 @opindex mfp-rounding-mode
15761 Selects the IEEE rounding mode. Other Alpha compilers call this option
15762 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
15763 of:
15764
15765 @table @samp
15766 @item n
15767 Normal IEEE rounding mode. Floating-point numbers are rounded towards
15768 the nearest machine number or towards the even machine number in case
15769 of a tie.
15770
15771 @item m
15772 Round towards minus infinity.
15773
15774 @item c
15775 Chopped rounding mode. Floating-point numbers are rounded towards zero.
15776
15777 @item d
15778 Dynamic rounding mode. A field in the floating-point control register
15779 (@var{fpcr}, see Alpha architecture reference manual) controls the
15780 rounding mode in effect. The C library initializes this register for
15781 rounding towards plus infinity. Thus, unless your program modifies the
15782 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
15783 @end table
15784
15785 @item -mtrap-precision=@var{trap-precision}
15786 @opindex mtrap-precision
15787 In the Alpha architecture, floating-point traps are imprecise. This
15788 means without software assistance it is impossible to recover from a
15789 floating trap and program execution normally needs to be terminated.
15790 GCC can generate code that can assist operating system trap handlers
15791 in determining the exact location that caused a floating-point trap.
15792 Depending on the requirements of an application, different levels of
15793 precisions can be selected:
15794
15795 @table @samp
15796 @item p
15797 Program precision. This option is the default and means a trap handler
15798 can only identify which program caused a floating-point exception.
15799
15800 @item f
15801 Function precision. The trap handler can determine the function that
15802 caused a floating-point exception.
15803
15804 @item i
15805 Instruction precision. The trap handler can determine the exact
15806 instruction that caused a floating-point exception.
15807 @end table
15808
15809 Other Alpha compilers provide the equivalent options called
15810 @option{-scope_safe} and @option{-resumption_safe}.
15811
15812 @item -mieee-conformant
15813 @opindex mieee-conformant
15814 This option marks the generated code as IEEE conformant. You must not
15815 use this option unless you also specify @option{-mtrap-precision=i} and either
15816 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
15817 is to emit the line @samp{.eflag 48} in the function prologue of the
15818 generated assembly file.
15819
15820 @item -mbuild-constants
15821 @opindex mbuild-constants
15822 Normally GCC examines a 32- or 64-bit integer constant to
15823 see if it can construct it from smaller constants in two or three
15824 instructions. If it cannot, it outputs the constant as a literal and
15825 generates code to load it from the data segment at run time.
15826
15827 Use this option to require GCC to construct @emph{all} integer constants
15828 using code, even if it takes more instructions (the maximum is six).
15829
15830 You typically use this option to build a shared library dynamic
15831 loader. Itself a shared library, it must relocate itself in memory
15832 before it can find the variables and constants in its own data segment.
15833
15834 @item -mbwx
15835 @itemx -mno-bwx
15836 @itemx -mcix
15837 @itemx -mno-cix
15838 @itemx -mfix
15839 @itemx -mno-fix
15840 @itemx -mmax
15841 @itemx -mno-max
15842 @opindex mbwx
15843 @opindex mno-bwx
15844 @opindex mcix
15845 @opindex mno-cix
15846 @opindex mfix
15847 @opindex mno-fix
15848 @opindex mmax
15849 @opindex mno-max
15850 Indicate whether GCC should generate code to use the optional BWX,
15851 CIX, FIX and MAX instruction sets. The default is to use the instruction
15852 sets supported by the CPU type specified via @option{-mcpu=} option or that
15853 of the CPU on which GCC was built if none is specified.
15854
15855 @item -mfloat-vax
15856 @itemx -mfloat-ieee
15857 @opindex mfloat-vax
15858 @opindex mfloat-ieee
15859 Generate code that uses (does not use) VAX F and G floating-point
15860 arithmetic instead of IEEE single and double precision.
15861
15862 @item -mexplicit-relocs
15863 @itemx -mno-explicit-relocs
15864 @opindex mexplicit-relocs
15865 @opindex mno-explicit-relocs
15866 Older Alpha assemblers provided no way to generate symbol relocations
15867 except via assembler macros. Use of these macros does not allow
15868 optimal instruction scheduling. GNU binutils as of version 2.12
15869 supports a new syntax that allows the compiler to explicitly mark
15870 which relocations should apply to which instructions. This option
15871 is mostly useful for debugging, as GCC detects the capabilities of
15872 the assembler when it is built and sets the default accordingly.
15873
15874 @item -msmall-data
15875 @itemx -mlarge-data
15876 @opindex msmall-data
15877 @opindex mlarge-data
15878 When @option{-mexplicit-relocs} is in effect, static data is
15879 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
15880 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
15881 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
15882 16-bit relocations off of the @code{$gp} register. This limits the
15883 size of the small data area to 64KB, but allows the variables to be
15884 directly accessed via a single instruction.
15885
15886 The default is @option{-mlarge-data}. With this option the data area
15887 is limited to just below 2GB@. Programs that require more than 2GB of
15888 data must use @code{malloc} or @code{mmap} to allocate the data in the
15889 heap instead of in the program's data segment.
15890
15891 When generating code for shared libraries, @option{-fpic} implies
15892 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
15893
15894 @item -msmall-text
15895 @itemx -mlarge-text
15896 @opindex msmall-text
15897 @opindex mlarge-text
15898 When @option{-msmall-text} is used, the compiler assumes that the
15899 code of the entire program (or shared library) fits in 4MB, and is
15900 thus reachable with a branch instruction. When @option{-msmall-data}
15901 is used, the compiler can assume that all local symbols share the
15902 same @code{$gp} value, and thus reduce the number of instructions
15903 required for a function call from 4 to 1.
15904
15905 The default is @option{-mlarge-text}.
15906
15907 @item -mcpu=@var{cpu_type}
15908 @opindex mcpu
15909 Set the instruction set and instruction scheduling parameters for
15910 machine type @var{cpu_type}. You can specify either the @samp{EV}
15911 style name or the corresponding chip number. GCC supports scheduling
15912 parameters for the EV4, EV5 and EV6 family of processors and
15913 chooses the default values for the instruction set from the processor
15914 you specify. If you do not specify a processor type, GCC defaults
15915 to the processor on which the compiler was built.
15916
15917 Supported values for @var{cpu_type} are
15918
15919 @table @samp
15920 @item ev4
15921 @itemx ev45
15922 @itemx 21064
15923 Schedules as an EV4 and has no instruction set extensions.
15924
15925 @item ev5
15926 @itemx 21164
15927 Schedules as an EV5 and has no instruction set extensions.
15928
15929 @item ev56
15930 @itemx 21164a
15931 Schedules as an EV5 and supports the BWX extension.
15932
15933 @item pca56
15934 @itemx 21164pc
15935 @itemx 21164PC
15936 Schedules as an EV5 and supports the BWX and MAX extensions.
15937
15938 @item ev6
15939 @itemx 21264
15940 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
15941
15942 @item ev67
15943 @itemx 21264a
15944 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
15945 @end table
15946
15947 Native toolchains also support the value @samp{native},
15948 which selects the best architecture option for the host processor.
15949 @option{-mcpu=native} has no effect if GCC does not recognize
15950 the processor.
15951
15952 @item -mtune=@var{cpu_type}
15953 @opindex mtune
15954 Set only the instruction scheduling parameters for machine type
15955 @var{cpu_type}. The instruction set is not changed.
15956
15957 Native toolchains also support the value @samp{native},
15958 which selects the best architecture option for the host processor.
15959 @option{-mtune=native} has no effect if GCC does not recognize
15960 the processor.
15961
15962 @item -mmemory-latency=@var{time}
15963 @opindex mmemory-latency
15964 Sets the latency the scheduler should assume for typical memory
15965 references as seen by the application. This number is highly
15966 dependent on the memory access patterns used by the application
15967 and the size of the external cache on the machine.
15968
15969 Valid options for @var{time} are
15970
15971 @table @samp
15972 @item @var{number}
15973 A decimal number representing clock cycles.
15974
15975 @item L1
15976 @itemx L2
15977 @itemx L3
15978 @itemx main
15979 The compiler contains estimates of the number of clock cycles for
15980 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
15981 (also called Dcache, Scache, and Bcache), as well as to main memory.
15982 Note that L3 is only valid for EV5.
15983
15984 @end table
15985 @end table
15986
15987 @node FR30 Options
15988 @subsection FR30 Options
15989 @cindex FR30 Options
15990
15991 These options are defined specifically for the FR30 port.
15992
15993 @table @gcctabopt
15994
15995 @item -msmall-model
15996 @opindex msmall-model
15997 Use the small address space model. This can produce smaller code, but
15998 it does assume that all symbolic values and addresses fit into a
15999 20-bit range.
16000
16001 @item -mno-lsim
16002 @opindex mno-lsim
16003 Assume that runtime support has been provided and so there is no need
16004 to include the simulator library (@file{libsim.a}) on the linker
16005 command line.
16006
16007 @end table
16008
16009 @node FT32 Options
16010 @subsection FT32 Options
16011 @cindex FT32 Options
16012
16013 These options are defined specifically for the FT32 port.
16014
16015 @table @gcctabopt
16016
16017 @item -msim
16018 @opindex msim
16019 Specifies that the program will be run on the simulator. This causes
16020 an alternate runtime startup and library to be linked.
16021 You must not use this option when generating programs that will run on
16022 real hardware; you must provide your own runtime library for whatever
16023 I/O functions are needed.
16024
16025 @item -mlra
16026 @opindex mlra
16027 Enable Local Register Allocation. This is still experimental for FT32,
16028 so by default the compiler uses standard reload.
16029
16030 @item -mnodiv
16031 @opindex mnodiv
16032 Do not use div and mod instructions.
16033
16034 @end table
16035
16036 @node FRV Options
16037 @subsection FRV Options
16038 @cindex FRV Options
16039
16040 @table @gcctabopt
16041 @item -mgpr-32
16042 @opindex mgpr-32
16043
16044 Only use the first 32 general-purpose registers.
16045
16046 @item -mgpr-64
16047 @opindex mgpr-64
16048
16049 Use all 64 general-purpose registers.
16050
16051 @item -mfpr-32
16052 @opindex mfpr-32
16053
16054 Use only the first 32 floating-point registers.
16055
16056 @item -mfpr-64
16057 @opindex mfpr-64
16058
16059 Use all 64 floating-point registers.
16060
16061 @item -mhard-float
16062 @opindex mhard-float
16063
16064 Use hardware instructions for floating-point operations.
16065
16066 @item -msoft-float
16067 @opindex msoft-float
16068
16069 Use library routines for floating-point operations.
16070
16071 @item -malloc-cc
16072 @opindex malloc-cc
16073
16074 Dynamically allocate condition code registers.
16075
16076 @item -mfixed-cc
16077 @opindex mfixed-cc
16078
16079 Do not try to dynamically allocate condition code registers, only
16080 use @code{icc0} and @code{fcc0}.
16081
16082 @item -mdword
16083 @opindex mdword
16084
16085 Change ABI to use double word insns.
16086
16087 @item -mno-dword
16088 @opindex mno-dword
16089
16090 Do not use double word instructions.
16091
16092 @item -mdouble
16093 @opindex mdouble
16094
16095 Use floating-point double instructions.
16096
16097 @item -mno-double
16098 @opindex mno-double
16099
16100 Do not use floating-point double instructions.
16101
16102 @item -mmedia
16103 @opindex mmedia
16104
16105 Use media instructions.
16106
16107 @item -mno-media
16108 @opindex mno-media
16109
16110 Do not use media instructions.
16111
16112 @item -mmuladd
16113 @opindex mmuladd
16114
16115 Use multiply and add/subtract instructions.
16116
16117 @item -mno-muladd
16118 @opindex mno-muladd
16119
16120 Do not use multiply and add/subtract instructions.
16121
16122 @item -mfdpic
16123 @opindex mfdpic
16124
16125 Select the FDPIC ABI, which uses function descriptors to represent
16126 pointers to functions. Without any PIC/PIE-related options, it
16127 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
16128 assumes GOT entries and small data are within a 12-bit range from the
16129 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
16130 are computed with 32 bits.
16131 With a @samp{bfin-elf} target, this option implies @option{-msim}.
16132
16133 @item -minline-plt
16134 @opindex minline-plt
16135
16136 Enable inlining of PLT entries in function calls to functions that are
16137 not known to bind locally. It has no effect without @option{-mfdpic}.
16138 It's enabled by default if optimizing for speed and compiling for
16139 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
16140 optimization option such as @option{-O3} or above is present in the
16141 command line.
16142
16143 @item -mTLS
16144 @opindex mTLS
16145
16146 Assume a large TLS segment when generating thread-local code.
16147
16148 @item -mtls
16149 @opindex mtls
16150
16151 Do not assume a large TLS segment when generating thread-local code.
16152
16153 @item -mgprel-ro
16154 @opindex mgprel-ro
16155
16156 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
16157 that is known to be in read-only sections. It's enabled by default,
16158 except for @option{-fpic} or @option{-fpie}: even though it may help
16159 make the global offset table smaller, it trades 1 instruction for 4.
16160 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
16161 one of which may be shared by multiple symbols, and it avoids the need
16162 for a GOT entry for the referenced symbol, so it's more likely to be a
16163 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
16164
16165 @item -multilib-library-pic
16166 @opindex multilib-library-pic
16167
16168 Link with the (library, not FD) pic libraries. It's implied by
16169 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
16170 @option{-fpic} without @option{-mfdpic}. You should never have to use
16171 it explicitly.
16172
16173 @item -mlinked-fp
16174 @opindex mlinked-fp
16175
16176 Follow the EABI requirement of always creating a frame pointer whenever
16177 a stack frame is allocated. This option is enabled by default and can
16178 be disabled with @option{-mno-linked-fp}.
16179
16180 @item -mlong-calls
16181 @opindex mlong-calls
16182
16183 Use indirect addressing to call functions outside the current
16184 compilation unit. This allows the functions to be placed anywhere
16185 within the 32-bit address space.
16186
16187 @item -malign-labels
16188 @opindex malign-labels
16189
16190 Try to align labels to an 8-byte boundary by inserting NOPs into the
16191 previous packet. This option only has an effect when VLIW packing
16192 is enabled. It doesn't create new packets; it merely adds NOPs to
16193 existing ones.
16194
16195 @item -mlibrary-pic
16196 @opindex mlibrary-pic
16197
16198 Generate position-independent EABI code.
16199
16200 @item -macc-4
16201 @opindex macc-4
16202
16203 Use only the first four media accumulator registers.
16204
16205 @item -macc-8
16206 @opindex macc-8
16207
16208 Use all eight media accumulator registers.
16209
16210 @item -mpack
16211 @opindex mpack
16212
16213 Pack VLIW instructions.
16214
16215 @item -mno-pack
16216 @opindex mno-pack
16217
16218 Do not pack VLIW instructions.
16219
16220 @item -mno-eflags
16221 @opindex mno-eflags
16222
16223 Do not mark ABI switches in e_flags.
16224
16225 @item -mcond-move
16226 @opindex mcond-move
16227
16228 Enable the use of conditional-move instructions (default).
16229
16230 This switch is mainly for debugging the compiler and will likely be removed
16231 in a future version.
16232
16233 @item -mno-cond-move
16234 @opindex mno-cond-move
16235
16236 Disable the use of conditional-move instructions.
16237
16238 This switch is mainly for debugging the compiler and will likely be removed
16239 in a future version.
16240
16241 @item -mscc
16242 @opindex mscc
16243
16244 Enable the use of conditional set instructions (default).
16245
16246 This switch is mainly for debugging the compiler and will likely be removed
16247 in a future version.
16248
16249 @item -mno-scc
16250 @opindex mno-scc
16251
16252 Disable the use of conditional set instructions.
16253
16254 This switch is mainly for debugging the compiler and will likely be removed
16255 in a future version.
16256
16257 @item -mcond-exec
16258 @opindex mcond-exec
16259
16260 Enable the use of conditional execution (default).
16261
16262 This switch is mainly for debugging the compiler and will likely be removed
16263 in a future version.
16264
16265 @item -mno-cond-exec
16266 @opindex mno-cond-exec
16267
16268 Disable the use of conditional execution.
16269
16270 This switch is mainly for debugging the compiler and will likely be removed
16271 in a future version.
16272
16273 @item -mvliw-branch
16274 @opindex mvliw-branch
16275
16276 Run a pass to pack branches into VLIW instructions (default).
16277
16278 This switch is mainly for debugging the compiler and will likely be removed
16279 in a future version.
16280
16281 @item -mno-vliw-branch
16282 @opindex mno-vliw-branch
16283
16284 Do not run a pass to pack branches into VLIW instructions.
16285
16286 This switch is mainly for debugging the compiler and will likely be removed
16287 in a future version.
16288
16289 @item -mmulti-cond-exec
16290 @opindex mmulti-cond-exec
16291
16292 Enable optimization of @code{&&} and @code{||} in conditional execution
16293 (default).
16294
16295 This switch is mainly for debugging the compiler and will likely be removed
16296 in a future version.
16297
16298 @item -mno-multi-cond-exec
16299 @opindex mno-multi-cond-exec
16300
16301 Disable optimization of @code{&&} and @code{||} in conditional execution.
16302
16303 This switch is mainly for debugging the compiler and will likely be removed
16304 in a future version.
16305
16306 @item -mnested-cond-exec
16307 @opindex mnested-cond-exec
16308
16309 Enable nested conditional execution optimizations (default).
16310
16311 This switch is mainly for debugging the compiler and will likely be removed
16312 in a future version.
16313
16314 @item -mno-nested-cond-exec
16315 @opindex mno-nested-cond-exec
16316
16317 Disable nested conditional execution optimizations.
16318
16319 This switch is mainly for debugging the compiler and will likely be removed
16320 in a future version.
16321
16322 @item -moptimize-membar
16323 @opindex moptimize-membar
16324
16325 This switch removes redundant @code{membar} instructions from the
16326 compiler-generated code. It is enabled by default.
16327
16328 @item -mno-optimize-membar
16329 @opindex mno-optimize-membar
16330
16331 This switch disables the automatic removal of redundant @code{membar}
16332 instructions from the generated code.
16333
16334 @item -mtomcat-stats
16335 @opindex mtomcat-stats
16336
16337 Cause gas to print out tomcat statistics.
16338
16339 @item -mcpu=@var{cpu}
16340 @opindex mcpu
16341
16342 Select the processor type for which to generate code. Possible values are
16343 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
16344 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
16345
16346 @end table
16347
16348 @node GNU/Linux Options
16349 @subsection GNU/Linux Options
16350
16351 These @samp{-m} options are defined for GNU/Linux targets:
16352
16353 @table @gcctabopt
16354 @item -mglibc
16355 @opindex mglibc
16356 Use the GNU C library. This is the default except
16357 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
16358 @samp{*-*-linux-*android*} targets.
16359
16360 @item -muclibc
16361 @opindex muclibc
16362 Use uClibc C library. This is the default on
16363 @samp{*-*-linux-*uclibc*} targets.
16364
16365 @item -mmusl
16366 @opindex mmusl
16367 Use the musl C library. This is the default on
16368 @samp{*-*-linux-*musl*} targets.
16369
16370 @item -mbionic
16371 @opindex mbionic
16372 Use Bionic C library. This is the default on
16373 @samp{*-*-linux-*android*} targets.
16374
16375 @item -mandroid
16376 @opindex mandroid
16377 Compile code compatible with Android platform. This is the default on
16378 @samp{*-*-linux-*android*} targets.
16379
16380 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
16381 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
16382 this option makes the GCC driver pass Android-specific options to the linker.
16383 Finally, this option causes the preprocessor macro @code{__ANDROID__}
16384 to be defined.
16385
16386 @item -tno-android-cc
16387 @opindex tno-android-cc
16388 Disable compilation effects of @option{-mandroid}, i.e., do not enable
16389 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
16390 @option{-fno-rtti} by default.
16391
16392 @item -tno-android-ld
16393 @opindex tno-android-ld
16394 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
16395 linking options to the linker.
16396
16397 @end table
16398
16399 @node H8/300 Options
16400 @subsection H8/300 Options
16401
16402 These @samp{-m} options are defined for the H8/300 implementations:
16403
16404 @table @gcctabopt
16405 @item -mrelax
16406 @opindex mrelax
16407 Shorten some address references at link time, when possible; uses the
16408 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
16409 ld, Using ld}, for a fuller description.
16410
16411 @item -mh
16412 @opindex mh
16413 Generate code for the H8/300H@.
16414
16415 @item -ms
16416 @opindex ms
16417 Generate code for the H8S@.
16418
16419 @item -mn
16420 @opindex mn
16421 Generate code for the H8S and H8/300H in the normal mode. This switch
16422 must be used either with @option{-mh} or @option{-ms}.
16423
16424 @item -ms2600
16425 @opindex ms2600
16426 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
16427
16428 @item -mexr
16429 @opindex mexr
16430 Extended registers are stored on stack before execution of function
16431 with monitor attribute. Default option is @option{-mexr}.
16432 This option is valid only for H8S targets.
16433
16434 @item -mno-exr
16435 @opindex mno-exr
16436 Extended registers are not stored on stack before execution of function
16437 with monitor attribute. Default option is @option{-mno-exr}.
16438 This option is valid only for H8S targets.
16439
16440 @item -mint32
16441 @opindex mint32
16442 Make @code{int} data 32 bits by default.
16443
16444 @item -malign-300
16445 @opindex malign-300
16446 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
16447 The default for the H8/300H and H8S is to align longs and floats on
16448 4-byte boundaries.
16449 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
16450 This option has no effect on the H8/300.
16451 @end table
16452
16453 @node HPPA Options
16454 @subsection HPPA Options
16455 @cindex HPPA Options
16456
16457 These @samp{-m} options are defined for the HPPA family of computers:
16458
16459 @table @gcctabopt
16460 @item -march=@var{architecture-type}
16461 @opindex march
16462 Generate code for the specified architecture. The choices for
16463 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
16464 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
16465 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
16466 architecture option for your machine. Code compiled for lower numbered
16467 architectures runs on higher numbered architectures, but not the
16468 other way around.
16469
16470 @item -mpa-risc-1-0
16471 @itemx -mpa-risc-1-1
16472 @itemx -mpa-risc-2-0
16473 @opindex mpa-risc-1-0
16474 @opindex mpa-risc-1-1
16475 @opindex mpa-risc-2-0
16476 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
16477
16478 @item -mjump-in-delay
16479 @opindex mjump-in-delay
16480 This option is ignored and provided for compatibility purposes only.
16481
16482 @item -mdisable-fpregs
16483 @opindex mdisable-fpregs
16484 Prevent floating-point registers from being used in any manner. This is
16485 necessary for compiling kernels that perform lazy context switching of
16486 floating-point registers. If you use this option and attempt to perform
16487 floating-point operations, the compiler aborts.
16488
16489 @item -mdisable-indexing
16490 @opindex mdisable-indexing
16491 Prevent the compiler from using indexing address modes. This avoids some
16492 rather obscure problems when compiling MIG generated code under MACH@.
16493
16494 @item -mno-space-regs
16495 @opindex mno-space-regs
16496 Generate code that assumes the target has no space registers. This allows
16497 GCC to generate faster indirect calls and use unscaled index address modes.
16498
16499 Such code is suitable for level 0 PA systems and kernels.
16500
16501 @item -mfast-indirect-calls
16502 @opindex mfast-indirect-calls
16503 Generate code that assumes calls never cross space boundaries. This
16504 allows GCC to emit code that performs faster indirect calls.
16505
16506 This option does not work in the presence of shared libraries or nested
16507 functions.
16508
16509 @item -mfixed-range=@var{register-range}
16510 @opindex mfixed-range
16511 Generate code treating the given register range as fixed registers.
16512 A fixed register is one that the register allocator cannot use. This is
16513 useful when compiling kernel code. A register range is specified as
16514 two registers separated by a dash. Multiple register ranges can be
16515 specified separated by a comma.
16516
16517 @item -mlong-load-store
16518 @opindex mlong-load-store
16519 Generate 3-instruction load and store sequences as sometimes required by
16520 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
16521 the HP compilers.
16522
16523 @item -mportable-runtime
16524 @opindex mportable-runtime
16525 Use the portable calling conventions proposed by HP for ELF systems.
16526
16527 @item -mgas
16528 @opindex mgas
16529 Enable the use of assembler directives only GAS understands.
16530
16531 @item -mschedule=@var{cpu-type}
16532 @opindex mschedule
16533 Schedule code according to the constraints for the machine type
16534 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
16535 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
16536 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
16537 proper scheduling option for your machine. The default scheduling is
16538 @samp{8000}.
16539
16540 @item -mlinker-opt
16541 @opindex mlinker-opt
16542 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
16543 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
16544 linkers in which they give bogus error messages when linking some programs.
16545
16546 @item -msoft-float
16547 @opindex msoft-float
16548 Generate output containing library calls for floating point.
16549 @strong{Warning:} the requisite libraries are not available for all HPPA
16550 targets. Normally the facilities of the machine's usual C compiler are
16551 used, but this cannot be done directly in cross-compilation. You must make
16552 your own arrangements to provide suitable library functions for
16553 cross-compilation.
16554
16555 @option{-msoft-float} changes the calling convention in the output file;
16556 therefore, it is only useful if you compile @emph{all} of a program with
16557 this option. In particular, you need to compile @file{libgcc.a}, the
16558 library that comes with GCC, with @option{-msoft-float} in order for
16559 this to work.
16560
16561 @item -msio
16562 @opindex msio
16563 Generate the predefine, @code{_SIO}, for server IO@. The default is
16564 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
16565 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
16566 options are available under HP-UX and HI-UX@.
16567
16568 @item -mgnu-ld
16569 @opindex mgnu-ld
16570 Use options specific to GNU @command{ld}.
16571 This passes @option{-shared} to @command{ld} when
16572 building a shared library. It is the default when GCC is configured,
16573 explicitly or implicitly, with the GNU linker. This option does not
16574 affect which @command{ld} is called; it only changes what parameters
16575 are passed to that @command{ld}.
16576 The @command{ld} that is called is determined by the
16577 @option{--with-ld} configure option, GCC's program search path, and
16578 finally by the user's @env{PATH}. The linker used by GCC can be printed
16579 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
16580 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16581
16582 @item -mhp-ld
16583 @opindex mhp-ld
16584 Use options specific to HP @command{ld}.
16585 This passes @option{-b} to @command{ld} when building
16586 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
16587 links. It is the default when GCC is configured, explicitly or
16588 implicitly, with the HP linker. This option does not affect
16589 which @command{ld} is called; it only changes what parameters are passed to that
16590 @command{ld}.
16591 The @command{ld} that is called is determined by the @option{--with-ld}
16592 configure option, GCC's program search path, and finally by the user's
16593 @env{PATH}. The linker used by GCC can be printed using @samp{which
16594 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
16595 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16596
16597 @item -mlong-calls
16598 @opindex mno-long-calls
16599 Generate code that uses long call sequences. This ensures that a call
16600 is always able to reach linker generated stubs. The default is to generate
16601 long calls only when the distance from the call site to the beginning
16602 of the function or translation unit, as the case may be, exceeds a
16603 predefined limit set by the branch type being used. The limits for
16604 normal calls are 7,600,000 and 240,000 bytes, respectively for the
16605 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
16606 240,000 bytes.
16607
16608 Distances are measured from the beginning of functions when using the
16609 @option{-ffunction-sections} option, or when using the @option{-mgas}
16610 and @option{-mno-portable-runtime} options together under HP-UX with
16611 the SOM linker.
16612
16613 It is normally not desirable to use this option as it degrades
16614 performance. However, it may be useful in large applications,
16615 particularly when partial linking is used to build the application.
16616
16617 The types of long calls used depends on the capabilities of the
16618 assembler and linker, and the type of code being generated. The
16619 impact on systems that support long absolute calls, and long pic
16620 symbol-difference or pc-relative calls should be relatively small.
16621 However, an indirect call is used on 32-bit ELF systems in pic code
16622 and it is quite long.
16623
16624 @item -munix=@var{unix-std}
16625 @opindex march
16626 Generate compiler predefines and select a startfile for the specified
16627 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
16628 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
16629 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
16630 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
16631 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
16632 and later.
16633
16634 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
16635 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
16636 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
16637 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
16638 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
16639 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
16640
16641 It is @emph{important} to note that this option changes the interfaces
16642 for various library routines. It also affects the operational behavior
16643 of the C library. Thus, @emph{extreme} care is needed in using this
16644 option.
16645
16646 Library code that is intended to operate with more than one UNIX
16647 standard must test, set and restore the variable @code{__xpg4_extended_mask}
16648 as appropriate. Most GNU software doesn't provide this capability.
16649
16650 @item -nolibdld
16651 @opindex nolibdld
16652 Suppress the generation of link options to search libdld.sl when the
16653 @option{-static} option is specified on HP-UX 10 and later.
16654
16655 @item -static
16656 @opindex static
16657 The HP-UX implementation of setlocale in libc has a dependency on
16658 libdld.sl. There isn't an archive version of libdld.sl. Thus,
16659 when the @option{-static} option is specified, special link options
16660 are needed to resolve this dependency.
16661
16662 On HP-UX 10 and later, the GCC driver adds the necessary options to
16663 link with libdld.sl when the @option{-static} option is specified.
16664 This causes the resulting binary to be dynamic. On the 64-bit port,
16665 the linkers generate dynamic binaries by default in any case. The
16666 @option{-nolibdld} option can be used to prevent the GCC driver from
16667 adding these link options.
16668
16669 @item -threads
16670 @opindex threads
16671 Add support for multithreading with the @dfn{dce thread} library
16672 under HP-UX@. This option sets flags for both the preprocessor and
16673 linker.
16674 @end table
16675
16676 @node IA-64 Options
16677 @subsection IA-64 Options
16678 @cindex IA-64 Options
16679
16680 These are the @samp{-m} options defined for the Intel IA-64 architecture.
16681
16682 @table @gcctabopt
16683 @item -mbig-endian
16684 @opindex mbig-endian
16685 Generate code for a big-endian target. This is the default for HP-UX@.
16686
16687 @item -mlittle-endian
16688 @opindex mlittle-endian
16689 Generate code for a little-endian target. This is the default for AIX5
16690 and GNU/Linux.
16691
16692 @item -mgnu-as
16693 @itemx -mno-gnu-as
16694 @opindex mgnu-as
16695 @opindex mno-gnu-as
16696 Generate (or don't) code for the GNU assembler. This is the default.
16697 @c Also, this is the default if the configure option @option{--with-gnu-as}
16698 @c is used.
16699
16700 @item -mgnu-ld
16701 @itemx -mno-gnu-ld
16702 @opindex mgnu-ld
16703 @opindex mno-gnu-ld
16704 Generate (or don't) code for the GNU linker. This is the default.
16705 @c Also, this is the default if the configure option @option{--with-gnu-ld}
16706 @c is used.
16707
16708 @item -mno-pic
16709 @opindex mno-pic
16710 Generate code that does not use a global pointer register. The result
16711 is not position independent code, and violates the IA-64 ABI@.
16712
16713 @item -mvolatile-asm-stop
16714 @itemx -mno-volatile-asm-stop
16715 @opindex mvolatile-asm-stop
16716 @opindex mno-volatile-asm-stop
16717 Generate (or don't) a stop bit immediately before and after volatile asm
16718 statements.
16719
16720 @item -mregister-names
16721 @itemx -mno-register-names
16722 @opindex mregister-names
16723 @opindex mno-register-names
16724 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
16725 the stacked registers. This may make assembler output more readable.
16726
16727 @item -mno-sdata
16728 @itemx -msdata
16729 @opindex mno-sdata
16730 @opindex msdata
16731 Disable (or enable) optimizations that use the small data section. This may
16732 be useful for working around optimizer bugs.
16733
16734 @item -mconstant-gp
16735 @opindex mconstant-gp
16736 Generate code that uses a single constant global pointer value. This is
16737 useful when compiling kernel code.
16738
16739 @item -mauto-pic
16740 @opindex mauto-pic
16741 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
16742 This is useful when compiling firmware code.
16743
16744 @item -minline-float-divide-min-latency
16745 @opindex minline-float-divide-min-latency
16746 Generate code for inline divides of floating-point values
16747 using the minimum latency algorithm.
16748
16749 @item -minline-float-divide-max-throughput
16750 @opindex minline-float-divide-max-throughput
16751 Generate code for inline divides of floating-point values
16752 using the maximum throughput algorithm.
16753
16754 @item -mno-inline-float-divide
16755 @opindex mno-inline-float-divide
16756 Do not generate inline code for divides of floating-point values.
16757
16758 @item -minline-int-divide-min-latency
16759 @opindex minline-int-divide-min-latency
16760 Generate code for inline divides of integer values
16761 using the minimum latency algorithm.
16762
16763 @item -minline-int-divide-max-throughput
16764 @opindex minline-int-divide-max-throughput
16765 Generate code for inline divides of integer values
16766 using the maximum throughput algorithm.
16767
16768 @item -mno-inline-int-divide
16769 @opindex mno-inline-int-divide
16770 Do not generate inline code for divides of integer values.
16771
16772 @item -minline-sqrt-min-latency
16773 @opindex minline-sqrt-min-latency
16774 Generate code for inline square roots
16775 using the minimum latency algorithm.
16776
16777 @item -minline-sqrt-max-throughput
16778 @opindex minline-sqrt-max-throughput
16779 Generate code for inline square roots
16780 using the maximum throughput algorithm.
16781
16782 @item -mno-inline-sqrt
16783 @opindex mno-inline-sqrt
16784 Do not generate inline code for @code{sqrt}.
16785
16786 @item -mfused-madd
16787 @itemx -mno-fused-madd
16788 @opindex mfused-madd
16789 @opindex mno-fused-madd
16790 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
16791 instructions. The default is to use these instructions.
16792
16793 @item -mno-dwarf2-asm
16794 @itemx -mdwarf2-asm
16795 @opindex mno-dwarf2-asm
16796 @opindex mdwarf2-asm
16797 Don't (or do) generate assembler code for the DWARF line number debugging
16798 info. This may be useful when not using the GNU assembler.
16799
16800 @item -mearly-stop-bits
16801 @itemx -mno-early-stop-bits
16802 @opindex mearly-stop-bits
16803 @opindex mno-early-stop-bits
16804 Allow stop bits to be placed earlier than immediately preceding the
16805 instruction that triggered the stop bit. This can improve instruction
16806 scheduling, but does not always do so.
16807
16808 @item -mfixed-range=@var{register-range}
16809 @opindex mfixed-range
16810 Generate code treating the given register range as fixed registers.
16811 A fixed register is one that the register allocator cannot use. This is
16812 useful when compiling kernel code. A register range is specified as
16813 two registers separated by a dash. Multiple register ranges can be
16814 specified separated by a comma.
16815
16816 @item -mtls-size=@var{tls-size}
16817 @opindex mtls-size
16818 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
16819 64.
16820
16821 @item -mtune=@var{cpu-type}
16822 @opindex mtune
16823 Tune the instruction scheduling for a particular CPU, Valid values are
16824 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
16825 and @samp{mckinley}.
16826
16827 @item -milp32
16828 @itemx -mlp64
16829 @opindex milp32
16830 @opindex mlp64
16831 Generate code for a 32-bit or 64-bit environment.
16832 The 32-bit environment sets int, long and pointer to 32 bits.
16833 The 64-bit environment sets int to 32 bits and long and pointer
16834 to 64 bits. These are HP-UX specific flags.
16835
16836 @item -mno-sched-br-data-spec
16837 @itemx -msched-br-data-spec
16838 @opindex mno-sched-br-data-spec
16839 @opindex msched-br-data-spec
16840 (Dis/En)able data speculative scheduling before reload.
16841 This results in generation of @code{ld.a} instructions and
16842 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16843 The default setting is disabled.
16844
16845 @item -msched-ar-data-spec
16846 @itemx -mno-sched-ar-data-spec
16847 @opindex msched-ar-data-spec
16848 @opindex mno-sched-ar-data-spec
16849 (En/Dis)able data speculative scheduling after reload.
16850 This results in generation of @code{ld.a} instructions and
16851 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16852 The default setting is enabled.
16853
16854 @item -mno-sched-control-spec
16855 @itemx -msched-control-spec
16856 @opindex mno-sched-control-spec
16857 @opindex msched-control-spec
16858 (Dis/En)able control speculative scheduling. This feature is
16859 available only during region scheduling (i.e.@: before reload).
16860 This results in generation of the @code{ld.s} instructions and
16861 the corresponding check instructions @code{chk.s}.
16862 The default setting is disabled.
16863
16864 @item -msched-br-in-data-spec
16865 @itemx -mno-sched-br-in-data-spec
16866 @opindex msched-br-in-data-spec
16867 @opindex mno-sched-br-in-data-spec
16868 (En/Dis)able speculative scheduling of the instructions that
16869 are dependent on the data speculative loads before reload.
16870 This is effective only with @option{-msched-br-data-spec} enabled.
16871 The default setting is enabled.
16872
16873 @item -msched-ar-in-data-spec
16874 @itemx -mno-sched-ar-in-data-spec
16875 @opindex msched-ar-in-data-spec
16876 @opindex mno-sched-ar-in-data-spec
16877 (En/Dis)able speculative scheduling of the instructions that
16878 are dependent on the data speculative loads after reload.
16879 This is effective only with @option{-msched-ar-data-spec} enabled.
16880 The default setting is enabled.
16881
16882 @item -msched-in-control-spec
16883 @itemx -mno-sched-in-control-spec
16884 @opindex msched-in-control-spec
16885 @opindex mno-sched-in-control-spec
16886 (En/Dis)able speculative scheduling of the instructions that
16887 are dependent on the control speculative loads.
16888 This is effective only with @option{-msched-control-spec} enabled.
16889 The default setting is enabled.
16890
16891 @item -mno-sched-prefer-non-data-spec-insns
16892 @itemx -msched-prefer-non-data-spec-insns
16893 @opindex mno-sched-prefer-non-data-spec-insns
16894 @opindex msched-prefer-non-data-spec-insns
16895 If enabled, data-speculative instructions are chosen for schedule
16896 only if there are no other choices at the moment. This makes
16897 the use of the data speculation much more conservative.
16898 The default setting is disabled.
16899
16900 @item -mno-sched-prefer-non-control-spec-insns
16901 @itemx -msched-prefer-non-control-spec-insns
16902 @opindex mno-sched-prefer-non-control-spec-insns
16903 @opindex msched-prefer-non-control-spec-insns
16904 If enabled, control-speculative instructions are chosen for schedule
16905 only if there are no other choices at the moment. This makes
16906 the use of the control speculation much more conservative.
16907 The default setting is disabled.
16908
16909 @item -mno-sched-count-spec-in-critical-path
16910 @itemx -msched-count-spec-in-critical-path
16911 @opindex mno-sched-count-spec-in-critical-path
16912 @opindex msched-count-spec-in-critical-path
16913 If enabled, speculative dependencies are considered during
16914 computation of the instructions priorities. This makes the use of the
16915 speculation a bit more conservative.
16916 The default setting is disabled.
16917
16918 @item -msched-spec-ldc
16919 @opindex msched-spec-ldc
16920 Use a simple data speculation check. This option is on by default.
16921
16922 @item -msched-control-spec-ldc
16923 @opindex msched-spec-ldc
16924 Use a simple check for control speculation. This option is on by default.
16925
16926 @item -msched-stop-bits-after-every-cycle
16927 @opindex msched-stop-bits-after-every-cycle
16928 Place a stop bit after every cycle when scheduling. This option is on
16929 by default.
16930
16931 @item -msched-fp-mem-deps-zero-cost
16932 @opindex msched-fp-mem-deps-zero-cost
16933 Assume that floating-point stores and loads are not likely to cause a conflict
16934 when placed into the same instruction group. This option is disabled by
16935 default.
16936
16937 @item -msel-sched-dont-check-control-spec
16938 @opindex msel-sched-dont-check-control-spec
16939 Generate checks for control speculation in selective scheduling.
16940 This flag is disabled by default.
16941
16942 @item -msched-max-memory-insns=@var{max-insns}
16943 @opindex msched-max-memory-insns
16944 Limit on the number of memory insns per instruction group, giving lower
16945 priority to subsequent memory insns attempting to schedule in the same
16946 instruction group. Frequently useful to prevent cache bank conflicts.
16947 The default value is 1.
16948
16949 @item -msched-max-memory-insns-hard-limit
16950 @opindex msched-max-memory-insns-hard-limit
16951 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
16952 disallowing more than that number in an instruction group.
16953 Otherwise, the limit is ``soft'', meaning that non-memory operations
16954 are preferred when the limit is reached, but memory operations may still
16955 be scheduled.
16956
16957 @end table
16958
16959 @node LM32 Options
16960 @subsection LM32 Options
16961 @cindex LM32 options
16962
16963 These @option{-m} options are defined for the LatticeMico32 architecture:
16964
16965 @table @gcctabopt
16966 @item -mbarrel-shift-enabled
16967 @opindex mbarrel-shift-enabled
16968 Enable barrel-shift instructions.
16969
16970 @item -mdivide-enabled
16971 @opindex mdivide-enabled
16972 Enable divide and modulus instructions.
16973
16974 @item -mmultiply-enabled
16975 @opindex multiply-enabled
16976 Enable multiply instructions.
16977
16978 @item -msign-extend-enabled
16979 @opindex msign-extend-enabled
16980 Enable sign extend instructions.
16981
16982 @item -muser-enabled
16983 @opindex muser-enabled
16984 Enable user-defined instructions.
16985
16986 @end table
16987
16988 @node M32C Options
16989 @subsection M32C Options
16990 @cindex M32C options
16991
16992 @table @gcctabopt
16993 @item -mcpu=@var{name}
16994 @opindex mcpu=
16995 Select the CPU for which code is generated. @var{name} may be one of
16996 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
16997 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
16998 the M32C/80 series.
16999
17000 @item -msim
17001 @opindex msim
17002 Specifies that the program will be run on the simulator. This causes
17003 an alternate runtime library to be linked in which supports, for
17004 example, file I/O@. You must not use this option when generating
17005 programs that will run on real hardware; you must provide your own
17006 runtime library for whatever I/O functions are needed.
17007
17008 @item -memregs=@var{number}
17009 @opindex memregs=
17010 Specifies the number of memory-based pseudo-registers GCC uses
17011 during code generation. These pseudo-registers are used like real
17012 registers, so there is a tradeoff between GCC's ability to fit the
17013 code into available registers, and the performance penalty of using
17014 memory instead of registers. Note that all modules in a program must
17015 be compiled with the same value for this option. Because of that, you
17016 must not use this option with GCC's default runtime libraries.
17017
17018 @end table
17019
17020 @node M32R/D Options
17021 @subsection M32R/D Options
17022 @cindex M32R/D options
17023
17024 These @option{-m} options are defined for Renesas M32R/D architectures:
17025
17026 @table @gcctabopt
17027 @item -m32r2
17028 @opindex m32r2
17029 Generate code for the M32R/2@.
17030
17031 @item -m32rx
17032 @opindex m32rx
17033 Generate code for the M32R/X@.
17034
17035 @item -m32r
17036 @opindex m32r
17037 Generate code for the M32R@. This is the default.
17038
17039 @item -mmodel=small
17040 @opindex mmodel=small
17041 Assume all objects live in the lower 16MB of memory (so that their addresses
17042 can be loaded with the @code{ld24} instruction), and assume all subroutines
17043 are reachable with the @code{bl} instruction.
17044 This is the default.
17045
17046 The addressability of a particular object can be set with the
17047 @code{model} attribute.
17048
17049 @item -mmodel=medium
17050 @opindex mmodel=medium
17051 Assume objects may be anywhere in the 32-bit address space (the compiler
17052 generates @code{seth/add3} instructions to load their addresses), and
17053 assume all subroutines are reachable with the @code{bl} instruction.
17054
17055 @item -mmodel=large
17056 @opindex mmodel=large
17057 Assume objects may be anywhere in the 32-bit address space (the compiler
17058 generates @code{seth/add3} instructions to load their addresses), and
17059 assume subroutines may not be reachable with the @code{bl} instruction
17060 (the compiler generates the much slower @code{seth/add3/jl}
17061 instruction sequence).
17062
17063 @item -msdata=none
17064 @opindex msdata=none
17065 Disable use of the small data area. Variables are put into
17066 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
17067 @code{section} attribute has been specified).
17068 This is the default.
17069
17070 The small data area consists of sections @code{.sdata} and @code{.sbss}.
17071 Objects may be explicitly put in the small data area with the
17072 @code{section} attribute using one of these sections.
17073
17074 @item -msdata=sdata
17075 @opindex msdata=sdata
17076 Put small global and static data in the small data area, but do not
17077 generate special code to reference them.
17078
17079 @item -msdata=use
17080 @opindex msdata=use
17081 Put small global and static data in the small data area, and generate
17082 special instructions to reference them.
17083
17084 @item -G @var{num}
17085 @opindex G
17086 @cindex smaller data references
17087 Put global and static objects less than or equal to @var{num} bytes
17088 into the small data or BSS sections instead of the normal data or BSS
17089 sections. The default value of @var{num} is 8.
17090 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
17091 for this option to have any effect.
17092
17093 All modules should be compiled with the same @option{-G @var{num}} value.
17094 Compiling with different values of @var{num} may or may not work; if it
17095 doesn't the linker gives an error message---incorrect code is not
17096 generated.
17097
17098 @item -mdebug
17099 @opindex mdebug
17100 Makes the M32R-specific code in the compiler display some statistics
17101 that might help in debugging programs.
17102
17103 @item -malign-loops
17104 @opindex malign-loops
17105 Align all loops to a 32-byte boundary.
17106
17107 @item -mno-align-loops
17108 @opindex mno-align-loops
17109 Do not enforce a 32-byte alignment for loops. This is the default.
17110
17111 @item -missue-rate=@var{number}
17112 @opindex missue-rate=@var{number}
17113 Issue @var{number} instructions per cycle. @var{number} can only be 1
17114 or 2.
17115
17116 @item -mbranch-cost=@var{number}
17117 @opindex mbranch-cost=@var{number}
17118 @var{number} can only be 1 or 2. If it is 1 then branches are
17119 preferred over conditional code, if it is 2, then the opposite applies.
17120
17121 @item -mflush-trap=@var{number}
17122 @opindex mflush-trap=@var{number}
17123 Specifies the trap number to use to flush the cache. The default is
17124 12. Valid numbers are between 0 and 15 inclusive.
17125
17126 @item -mno-flush-trap
17127 @opindex mno-flush-trap
17128 Specifies that the cache cannot be flushed by using a trap.
17129
17130 @item -mflush-func=@var{name}
17131 @opindex mflush-func=@var{name}
17132 Specifies the name of the operating system function to call to flush
17133 the cache. The default is @samp{_flush_cache}, but a function call
17134 is only used if a trap is not available.
17135
17136 @item -mno-flush-func
17137 @opindex mno-flush-func
17138 Indicates that there is no OS function for flushing the cache.
17139
17140 @end table
17141
17142 @node M680x0 Options
17143 @subsection M680x0 Options
17144 @cindex M680x0 options
17145
17146 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
17147 The default settings depend on which architecture was selected when
17148 the compiler was configured; the defaults for the most common choices
17149 are given below.
17150
17151 @table @gcctabopt
17152 @item -march=@var{arch}
17153 @opindex march
17154 Generate code for a specific M680x0 or ColdFire instruction set
17155 architecture. Permissible values of @var{arch} for M680x0
17156 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
17157 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
17158 architectures are selected according to Freescale's ISA classification
17159 and the permissible values are: @samp{isaa}, @samp{isaaplus},
17160 @samp{isab} and @samp{isac}.
17161
17162 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
17163 code for a ColdFire target. The @var{arch} in this macro is one of the
17164 @option{-march} arguments given above.
17165
17166 When used together, @option{-march} and @option{-mtune} select code
17167 that runs on a family of similar processors but that is optimized
17168 for a particular microarchitecture.
17169
17170 @item -mcpu=@var{cpu}
17171 @opindex mcpu
17172 Generate code for a specific M680x0 or ColdFire processor.
17173 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
17174 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
17175 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
17176 below, which also classifies the CPUs into families:
17177
17178 @multitable @columnfractions 0.20 0.80
17179 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
17180 @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}
17181 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
17182 @item @samp{5206e} @tab @samp{5206e}
17183 @item @samp{5208} @tab @samp{5207} @samp{5208}
17184 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
17185 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
17186 @item @samp{5216} @tab @samp{5214} @samp{5216}
17187 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
17188 @item @samp{5225} @tab @samp{5224} @samp{5225}
17189 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
17190 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
17191 @item @samp{5249} @tab @samp{5249}
17192 @item @samp{5250} @tab @samp{5250}
17193 @item @samp{5271} @tab @samp{5270} @samp{5271}
17194 @item @samp{5272} @tab @samp{5272}
17195 @item @samp{5275} @tab @samp{5274} @samp{5275}
17196 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
17197 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
17198 @item @samp{5307} @tab @samp{5307}
17199 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
17200 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
17201 @item @samp{5407} @tab @samp{5407}
17202 @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}
17203 @end multitable
17204
17205 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
17206 @var{arch} is compatible with @var{cpu}. Other combinations of
17207 @option{-mcpu} and @option{-march} are rejected.
17208
17209 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
17210 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
17211 where the value of @var{family} is given by the table above.
17212
17213 @item -mtune=@var{tune}
17214 @opindex mtune
17215 Tune the code for a particular microarchitecture within the
17216 constraints set by @option{-march} and @option{-mcpu}.
17217 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
17218 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
17219 and @samp{cpu32}. The ColdFire microarchitectures
17220 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
17221
17222 You can also use @option{-mtune=68020-40} for code that needs
17223 to run relatively well on 68020, 68030 and 68040 targets.
17224 @option{-mtune=68020-60} is similar but includes 68060 targets
17225 as well. These two options select the same tuning decisions as
17226 @option{-m68020-40} and @option{-m68020-60} respectively.
17227
17228 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
17229 when tuning for 680x0 architecture @var{arch}. It also defines
17230 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
17231 option is used. If GCC is tuning for a range of architectures,
17232 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
17233 it defines the macros for every architecture in the range.
17234
17235 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
17236 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
17237 of the arguments given above.
17238
17239 @item -m68000
17240 @itemx -mc68000
17241 @opindex m68000
17242 @opindex mc68000
17243 Generate output for a 68000. This is the default
17244 when the compiler is configured for 68000-based systems.
17245 It is equivalent to @option{-march=68000}.
17246
17247 Use this option for microcontrollers with a 68000 or EC000 core,
17248 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
17249
17250 @item -m68010
17251 @opindex m68010
17252 Generate output for a 68010. This is the default
17253 when the compiler is configured for 68010-based systems.
17254 It is equivalent to @option{-march=68010}.
17255
17256 @item -m68020
17257 @itemx -mc68020
17258 @opindex m68020
17259 @opindex mc68020
17260 Generate output for a 68020. This is the default
17261 when the compiler is configured for 68020-based systems.
17262 It is equivalent to @option{-march=68020}.
17263
17264 @item -m68030
17265 @opindex m68030
17266 Generate output for a 68030. This is the default when the compiler is
17267 configured for 68030-based systems. It is equivalent to
17268 @option{-march=68030}.
17269
17270 @item -m68040
17271 @opindex m68040
17272 Generate output for a 68040. This is the default when the compiler is
17273 configured for 68040-based systems. It is equivalent to
17274 @option{-march=68040}.
17275
17276 This option inhibits the use of 68881/68882 instructions that have to be
17277 emulated by software on the 68040. Use this option if your 68040 does not
17278 have code to emulate those instructions.
17279
17280 @item -m68060
17281 @opindex m68060
17282 Generate output for a 68060. This is the default when the compiler is
17283 configured for 68060-based systems. It is equivalent to
17284 @option{-march=68060}.
17285
17286 This option inhibits the use of 68020 and 68881/68882 instructions that
17287 have to be emulated by software on the 68060. Use this option if your 68060
17288 does not have code to emulate those instructions.
17289
17290 @item -mcpu32
17291 @opindex mcpu32
17292 Generate output for a CPU32. This is the default
17293 when the compiler is configured for CPU32-based systems.
17294 It is equivalent to @option{-march=cpu32}.
17295
17296 Use this option for microcontrollers with a
17297 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
17298 68336, 68340, 68341, 68349 and 68360.
17299
17300 @item -m5200
17301 @opindex m5200
17302 Generate output for a 520X ColdFire CPU@. This is the default
17303 when the compiler is configured for 520X-based systems.
17304 It is equivalent to @option{-mcpu=5206}, and is now deprecated
17305 in favor of that option.
17306
17307 Use this option for microcontroller with a 5200 core, including
17308 the MCF5202, MCF5203, MCF5204 and MCF5206.
17309
17310 @item -m5206e
17311 @opindex m5206e
17312 Generate output for a 5206e ColdFire CPU@. The option is now
17313 deprecated in favor of the equivalent @option{-mcpu=5206e}.
17314
17315 @item -m528x
17316 @opindex m528x
17317 Generate output for a member of the ColdFire 528X family.
17318 The option is now deprecated in favor of the equivalent
17319 @option{-mcpu=528x}.
17320
17321 @item -m5307
17322 @opindex m5307
17323 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
17324 in favor of the equivalent @option{-mcpu=5307}.
17325
17326 @item -m5407
17327 @opindex m5407
17328 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
17329 in favor of the equivalent @option{-mcpu=5407}.
17330
17331 @item -mcfv4e
17332 @opindex mcfv4e
17333 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
17334 This includes use of hardware floating-point instructions.
17335 The option is equivalent to @option{-mcpu=547x}, and is now
17336 deprecated in favor of that option.
17337
17338 @item -m68020-40
17339 @opindex m68020-40
17340 Generate output for a 68040, without using any of the new instructions.
17341 This results in code that can run relatively efficiently on either a
17342 68020/68881 or a 68030 or a 68040. The generated code does use the
17343 68881 instructions that are emulated on the 68040.
17344
17345 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
17346
17347 @item -m68020-60
17348 @opindex m68020-60
17349 Generate output for a 68060, without using any of the new instructions.
17350 This results in code that can run relatively efficiently on either a
17351 68020/68881 or a 68030 or a 68040. The generated code does use the
17352 68881 instructions that are emulated on the 68060.
17353
17354 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
17355
17356 @item -mhard-float
17357 @itemx -m68881
17358 @opindex mhard-float
17359 @opindex m68881
17360 Generate floating-point instructions. This is the default for 68020
17361 and above, and for ColdFire devices that have an FPU@. It defines the
17362 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
17363 on ColdFire targets.
17364
17365 @item -msoft-float
17366 @opindex msoft-float
17367 Do not generate floating-point instructions; use library calls instead.
17368 This is the default for 68000, 68010, and 68832 targets. It is also
17369 the default for ColdFire devices that have no FPU.
17370
17371 @item -mdiv
17372 @itemx -mno-div
17373 @opindex mdiv
17374 @opindex mno-div
17375 Generate (do not generate) ColdFire hardware divide and remainder
17376 instructions. If @option{-march} is used without @option{-mcpu},
17377 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
17378 architectures. Otherwise, the default is taken from the target CPU
17379 (either the default CPU, or the one specified by @option{-mcpu}). For
17380 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
17381 @option{-mcpu=5206e}.
17382
17383 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
17384
17385 @item -mshort
17386 @opindex mshort
17387 Consider type @code{int} to be 16 bits wide, like @code{short int}.
17388 Additionally, parameters passed on the stack are also aligned to a
17389 16-bit boundary even on targets whose API mandates promotion to 32-bit.
17390
17391 @item -mno-short
17392 @opindex mno-short
17393 Do not consider type @code{int} to be 16 bits wide. This is the default.
17394
17395 @item -mnobitfield
17396 @itemx -mno-bitfield
17397 @opindex mnobitfield
17398 @opindex mno-bitfield
17399 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
17400 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
17401
17402 @item -mbitfield
17403 @opindex mbitfield
17404 Do use the bit-field instructions. The @option{-m68020} option implies
17405 @option{-mbitfield}. This is the default if you use a configuration
17406 designed for a 68020.
17407
17408 @item -mrtd
17409 @opindex mrtd
17410 Use a different function-calling convention, in which functions
17411 that take a fixed number of arguments return with the @code{rtd}
17412 instruction, which pops their arguments while returning. This
17413 saves one instruction in the caller since there is no need to pop
17414 the arguments there.
17415
17416 This calling convention is incompatible with the one normally
17417 used on Unix, so you cannot use it if you need to call libraries
17418 compiled with the Unix compiler.
17419
17420 Also, you must provide function prototypes for all functions that
17421 take variable numbers of arguments (including @code{printf});
17422 otherwise incorrect code is generated for calls to those
17423 functions.
17424
17425 In addition, seriously incorrect code results if you call a
17426 function with too many arguments. (Normally, extra arguments are
17427 harmlessly ignored.)
17428
17429 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
17430 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
17431
17432 @item -mno-rtd
17433 @opindex mno-rtd
17434 Do not use the calling conventions selected by @option{-mrtd}.
17435 This is the default.
17436
17437 @item -malign-int
17438 @itemx -mno-align-int
17439 @opindex malign-int
17440 @opindex mno-align-int
17441 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
17442 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
17443 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
17444 Aligning variables on 32-bit boundaries produces code that runs somewhat
17445 faster on processors with 32-bit busses at the expense of more memory.
17446
17447 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
17448 aligns structures containing the above types differently than
17449 most published application binary interface specifications for the m68k.
17450
17451 @item -mpcrel
17452 @opindex mpcrel
17453 Use the pc-relative addressing mode of the 68000 directly, instead of
17454 using a global offset table. At present, this option implies @option{-fpic},
17455 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
17456 not presently supported with @option{-mpcrel}, though this could be supported for
17457 68020 and higher processors.
17458
17459 @item -mno-strict-align
17460 @itemx -mstrict-align
17461 @opindex mno-strict-align
17462 @opindex mstrict-align
17463 Do not (do) assume that unaligned memory references are handled by
17464 the system.
17465
17466 @item -msep-data
17467 Generate code that allows the data segment to be located in a different
17468 area of memory from the text segment. This allows for execute-in-place in
17469 an environment without virtual memory management. This option implies
17470 @option{-fPIC}.
17471
17472 @item -mno-sep-data
17473 Generate code that assumes that the data segment follows the text segment.
17474 This is the default.
17475
17476 @item -mid-shared-library
17477 Generate code that supports shared libraries via the library ID method.
17478 This allows for execute-in-place and shared libraries in an environment
17479 without virtual memory management. This option implies @option{-fPIC}.
17480
17481 @item -mno-id-shared-library
17482 Generate code that doesn't assume ID-based shared libraries are being used.
17483 This is the default.
17484
17485 @item -mshared-library-id=n
17486 Specifies the identification number of the ID-based shared library being
17487 compiled. Specifying a value of 0 generates more compact code; specifying
17488 other values forces the allocation of that number to the current
17489 library, but is no more space- or time-efficient than omitting this option.
17490
17491 @item -mxgot
17492 @itemx -mno-xgot
17493 @opindex mxgot
17494 @opindex mno-xgot
17495 When generating position-independent code for ColdFire, generate code
17496 that works if the GOT has more than 8192 entries. This code is
17497 larger and slower than code generated without this option. On M680x0
17498 processors, this option is not needed; @option{-fPIC} suffices.
17499
17500 GCC normally uses a single instruction to load values from the GOT@.
17501 While this is relatively efficient, it only works if the GOT
17502 is smaller than about 64k. Anything larger causes the linker
17503 to report an error such as:
17504
17505 @cindex relocation truncated to fit (ColdFire)
17506 @smallexample
17507 relocation truncated to fit: R_68K_GOT16O foobar
17508 @end smallexample
17509
17510 If this happens, you should recompile your code with @option{-mxgot}.
17511 It should then work with very large GOTs. However, code generated with
17512 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
17513 the value of a global symbol.
17514
17515 Note that some linkers, including newer versions of the GNU linker,
17516 can create multiple GOTs and sort GOT entries. If you have such a linker,
17517 you should only need to use @option{-mxgot} when compiling a single
17518 object file that accesses more than 8192 GOT entries. Very few do.
17519
17520 These options have no effect unless GCC is generating
17521 position-independent code.
17522
17523 @end table
17524
17525 @node MCore Options
17526 @subsection MCore Options
17527 @cindex MCore options
17528
17529 These are the @samp{-m} options defined for the Motorola M*Core
17530 processors.
17531
17532 @table @gcctabopt
17533
17534 @item -mhardlit
17535 @itemx -mno-hardlit
17536 @opindex mhardlit
17537 @opindex mno-hardlit
17538 Inline constants into the code stream if it can be done in two
17539 instructions or less.
17540
17541 @item -mdiv
17542 @itemx -mno-div
17543 @opindex mdiv
17544 @opindex mno-div
17545 Use the divide instruction. (Enabled by default).
17546
17547 @item -mrelax-immediate
17548 @itemx -mno-relax-immediate
17549 @opindex mrelax-immediate
17550 @opindex mno-relax-immediate
17551 Allow arbitrary-sized immediates in bit operations.
17552
17553 @item -mwide-bitfields
17554 @itemx -mno-wide-bitfields
17555 @opindex mwide-bitfields
17556 @opindex mno-wide-bitfields
17557 Always treat bit-fields as @code{int}-sized.
17558
17559 @item -m4byte-functions
17560 @itemx -mno-4byte-functions
17561 @opindex m4byte-functions
17562 @opindex mno-4byte-functions
17563 Force all functions to be aligned to a 4-byte boundary.
17564
17565 @item -mcallgraph-data
17566 @itemx -mno-callgraph-data
17567 @opindex mcallgraph-data
17568 @opindex mno-callgraph-data
17569 Emit callgraph information.
17570
17571 @item -mslow-bytes
17572 @itemx -mno-slow-bytes
17573 @opindex mslow-bytes
17574 @opindex mno-slow-bytes
17575 Prefer word access when reading byte quantities.
17576
17577 @item -mlittle-endian
17578 @itemx -mbig-endian
17579 @opindex mlittle-endian
17580 @opindex mbig-endian
17581 Generate code for a little-endian target.
17582
17583 @item -m210
17584 @itemx -m340
17585 @opindex m210
17586 @opindex m340
17587 Generate code for the 210 processor.
17588
17589 @item -mno-lsim
17590 @opindex mno-lsim
17591 Assume that runtime support has been provided and so omit the
17592 simulator library (@file{libsim.a)} from the linker command line.
17593
17594 @item -mstack-increment=@var{size}
17595 @opindex mstack-increment
17596 Set the maximum amount for a single stack increment operation. Large
17597 values can increase the speed of programs that contain functions
17598 that need a large amount of stack space, but they can also trigger a
17599 segmentation fault if the stack is extended too much. The default
17600 value is 0x1000.
17601
17602 @end table
17603
17604 @node MeP Options
17605 @subsection MeP Options
17606 @cindex MeP options
17607
17608 @table @gcctabopt
17609
17610 @item -mabsdiff
17611 @opindex mabsdiff
17612 Enables the @code{abs} instruction, which is the absolute difference
17613 between two registers.
17614
17615 @item -mall-opts
17616 @opindex mall-opts
17617 Enables all the optional instructions---average, multiply, divide, bit
17618 operations, leading zero, absolute difference, min/max, clip, and
17619 saturation.
17620
17621
17622 @item -maverage
17623 @opindex maverage
17624 Enables the @code{ave} instruction, which computes the average of two
17625 registers.
17626
17627 @item -mbased=@var{n}
17628 @opindex mbased=
17629 Variables of size @var{n} bytes or smaller are placed in the
17630 @code{.based} section by default. Based variables use the @code{$tp}
17631 register as a base register, and there is a 128-byte limit to the
17632 @code{.based} section.
17633
17634 @item -mbitops
17635 @opindex mbitops
17636 Enables the bit operation instructions---bit test (@code{btstm}), set
17637 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
17638 test-and-set (@code{tas}).
17639
17640 @item -mc=@var{name}
17641 @opindex mc=
17642 Selects which section constant data is placed in. @var{name} may
17643 be @samp{tiny}, @samp{near}, or @samp{far}.
17644
17645 @item -mclip
17646 @opindex mclip
17647 Enables the @code{clip} instruction. Note that @option{-mclip} is not
17648 useful unless you also provide @option{-mminmax}.
17649
17650 @item -mconfig=@var{name}
17651 @opindex mconfig=
17652 Selects one of the built-in core configurations. Each MeP chip has
17653 one or more modules in it; each module has a core CPU and a variety of
17654 coprocessors, optional instructions, and peripherals. The
17655 @code{MeP-Integrator} tool, not part of GCC, provides these
17656 configurations through this option; using this option is the same as
17657 using all the corresponding command-line options. The default
17658 configuration is @samp{default}.
17659
17660 @item -mcop
17661 @opindex mcop
17662 Enables the coprocessor instructions. By default, this is a 32-bit
17663 coprocessor. Note that the coprocessor is normally enabled via the
17664 @option{-mconfig=} option.
17665
17666 @item -mcop32
17667 @opindex mcop32
17668 Enables the 32-bit coprocessor's instructions.
17669
17670 @item -mcop64
17671 @opindex mcop64
17672 Enables the 64-bit coprocessor's instructions.
17673
17674 @item -mivc2
17675 @opindex mivc2
17676 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
17677
17678 @item -mdc
17679 @opindex mdc
17680 Causes constant variables to be placed in the @code{.near} section.
17681
17682 @item -mdiv
17683 @opindex mdiv
17684 Enables the @code{div} and @code{divu} instructions.
17685
17686 @item -meb
17687 @opindex meb
17688 Generate big-endian code.
17689
17690 @item -mel
17691 @opindex mel
17692 Generate little-endian code.
17693
17694 @item -mio-volatile
17695 @opindex mio-volatile
17696 Tells the compiler that any variable marked with the @code{io}
17697 attribute is to be considered volatile.
17698
17699 @item -ml
17700 @opindex ml
17701 Causes variables to be assigned to the @code{.far} section by default.
17702
17703 @item -mleadz
17704 @opindex mleadz
17705 Enables the @code{leadz} (leading zero) instruction.
17706
17707 @item -mm
17708 @opindex mm
17709 Causes variables to be assigned to the @code{.near} section by default.
17710
17711 @item -mminmax
17712 @opindex mminmax
17713 Enables the @code{min} and @code{max} instructions.
17714
17715 @item -mmult
17716 @opindex mmult
17717 Enables the multiplication and multiply-accumulate instructions.
17718
17719 @item -mno-opts
17720 @opindex mno-opts
17721 Disables all the optional instructions enabled by @option{-mall-opts}.
17722
17723 @item -mrepeat
17724 @opindex mrepeat
17725 Enables the @code{repeat} and @code{erepeat} instructions, used for
17726 low-overhead looping.
17727
17728 @item -ms
17729 @opindex ms
17730 Causes all variables to default to the @code{.tiny} section. Note
17731 that there is a 65536-byte limit to this section. Accesses to these
17732 variables use the @code{%gp} base register.
17733
17734 @item -msatur
17735 @opindex msatur
17736 Enables the saturation instructions. Note that the compiler does not
17737 currently generate these itself, but this option is included for
17738 compatibility with other tools, like @code{as}.
17739
17740 @item -msdram
17741 @opindex msdram
17742 Link the SDRAM-based runtime instead of the default ROM-based runtime.
17743
17744 @item -msim
17745 @opindex msim
17746 Link the simulator run-time libraries.
17747
17748 @item -msimnovec
17749 @opindex msimnovec
17750 Link the simulator runtime libraries, excluding built-in support
17751 for reset and exception vectors and tables.
17752
17753 @item -mtf
17754 @opindex mtf
17755 Causes all functions to default to the @code{.far} section. Without
17756 this option, functions default to the @code{.near} section.
17757
17758 @item -mtiny=@var{n}
17759 @opindex mtiny=
17760 Variables that are @var{n} bytes or smaller are allocated to the
17761 @code{.tiny} section. These variables use the @code{$gp} base
17762 register. The default for this option is 4, but note that there's a
17763 65536-byte limit to the @code{.tiny} section.
17764
17765 @end table
17766
17767 @node MicroBlaze Options
17768 @subsection MicroBlaze Options
17769 @cindex MicroBlaze Options
17770
17771 @table @gcctabopt
17772
17773 @item -msoft-float
17774 @opindex msoft-float
17775 Use software emulation for floating point (default).
17776
17777 @item -mhard-float
17778 @opindex mhard-float
17779 Use hardware floating-point instructions.
17780
17781 @item -mmemcpy
17782 @opindex mmemcpy
17783 Do not optimize block moves, use @code{memcpy}.
17784
17785 @item -mno-clearbss
17786 @opindex mno-clearbss
17787 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
17788
17789 @item -mcpu=@var{cpu-type}
17790 @opindex mcpu=
17791 Use features of, and schedule code for, the given CPU.
17792 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
17793 where @var{X} is a major version, @var{YY} is the minor version, and
17794 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
17795 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
17796
17797 @item -mxl-soft-mul
17798 @opindex mxl-soft-mul
17799 Use software multiply emulation (default).
17800
17801 @item -mxl-soft-div
17802 @opindex mxl-soft-div
17803 Use software emulation for divides (default).
17804
17805 @item -mxl-barrel-shift
17806 @opindex mxl-barrel-shift
17807 Use the hardware barrel shifter.
17808
17809 @item -mxl-pattern-compare
17810 @opindex mxl-pattern-compare
17811 Use pattern compare instructions.
17812
17813 @item -msmall-divides
17814 @opindex msmall-divides
17815 Use table lookup optimization for small signed integer divisions.
17816
17817 @item -mxl-stack-check
17818 @opindex mxl-stack-check
17819 This option is deprecated. Use @option{-fstack-check} instead.
17820
17821 @item -mxl-gp-opt
17822 @opindex mxl-gp-opt
17823 Use GP-relative @code{.sdata}/@code{.sbss} sections.
17824
17825 @item -mxl-multiply-high
17826 @opindex mxl-multiply-high
17827 Use multiply high instructions for high part of 32x32 multiply.
17828
17829 @item -mxl-float-convert
17830 @opindex mxl-float-convert
17831 Use hardware floating-point conversion instructions.
17832
17833 @item -mxl-float-sqrt
17834 @opindex mxl-float-sqrt
17835 Use hardware floating-point square root instruction.
17836
17837 @item -mbig-endian
17838 @opindex mbig-endian
17839 Generate code for a big-endian target.
17840
17841 @item -mlittle-endian
17842 @opindex mlittle-endian
17843 Generate code for a little-endian target.
17844
17845 @item -mxl-reorder
17846 @opindex mxl-reorder
17847 Use reorder instructions (swap and byte reversed load/store).
17848
17849 @item -mxl-mode-@var{app-model}
17850 Select application model @var{app-model}. Valid models are
17851 @table @samp
17852 @item executable
17853 normal executable (default), uses startup code @file{crt0.o}.
17854
17855 @item xmdstub
17856 for use with Xilinx Microprocessor Debugger (XMD) based
17857 software intrusive debug agent called xmdstub. This uses startup file
17858 @file{crt1.o} and sets the start address of the program to 0x800.
17859
17860 @item bootstrap
17861 for applications that are loaded using a bootloader.
17862 This model uses startup file @file{crt2.o} which does not contain a processor
17863 reset vector handler. This is suitable for transferring control on a
17864 processor reset to the bootloader rather than the application.
17865
17866 @item novectors
17867 for applications that do not require any of the
17868 MicroBlaze vectors. This option may be useful for applications running
17869 within a monitoring application. This model uses @file{crt3.o} as a startup file.
17870 @end table
17871
17872 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
17873 @option{-mxl-mode-@var{app-model}}.
17874
17875 @end table
17876
17877 @node MIPS Options
17878 @subsection MIPS Options
17879 @cindex MIPS options
17880
17881 @table @gcctabopt
17882
17883 @item -EB
17884 @opindex EB
17885 Generate big-endian code.
17886
17887 @item -EL
17888 @opindex EL
17889 Generate little-endian code. This is the default for @samp{mips*el-*-*}
17890 configurations.
17891
17892 @item -march=@var{arch}
17893 @opindex march
17894 Generate code that runs on @var{arch}, which can be the name of a
17895 generic MIPS ISA, or the name of a particular processor.
17896 The ISA names are:
17897 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
17898 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
17899 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
17900 @samp{mips64r5} and @samp{mips64r6}.
17901 The processor names are:
17902 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
17903 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
17904 @samp{5kc}, @samp{5kf},
17905 @samp{20kc},
17906 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
17907 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
17908 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
17909 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
17910 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
17911 @samp{i6400},
17912 @samp{interaptiv},
17913 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
17914 @samp{m4k},
17915 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
17916 @samp{m5100}, @samp{m5101},
17917 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
17918 @samp{orion},
17919 @samp{p5600},
17920 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
17921 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
17922 @samp{rm7000}, @samp{rm9000},
17923 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
17924 @samp{sb1},
17925 @samp{sr71000},
17926 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
17927 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
17928 @samp{xlr} and @samp{xlp}.
17929 The special value @samp{from-abi} selects the
17930 most compatible architecture for the selected ABI (that is,
17931 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
17932
17933 The native Linux/GNU toolchain also supports the value @samp{native},
17934 which selects the best architecture option for the host processor.
17935 @option{-march=native} has no effect if GCC does not recognize
17936 the processor.
17937
17938 In processor names, a final @samp{000} can be abbreviated as @samp{k}
17939 (for example, @option{-march=r2k}). Prefixes are optional, and
17940 @samp{vr} may be written @samp{r}.
17941
17942 Names of the form @samp{@var{n}f2_1} refer to processors with
17943 FPUs clocked at half the rate of the core, names of the form
17944 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
17945 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
17946 processors with FPUs clocked a ratio of 3:2 with respect to the core.
17947 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
17948 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
17949 accepted as synonyms for @samp{@var{n}f1_1}.
17950
17951 GCC defines two macros based on the value of this option. The first
17952 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
17953 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
17954 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
17955 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
17956 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
17957
17958 Note that the @code{_MIPS_ARCH} macro uses the processor names given
17959 above. In other words, it has the full prefix and does not
17960 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
17961 the macro names the resolved architecture (either @code{"mips1"} or
17962 @code{"mips3"}). It names the default architecture when no
17963 @option{-march} option is given.
17964
17965 @item -mtune=@var{arch}
17966 @opindex mtune
17967 Optimize for @var{arch}. Among other things, this option controls
17968 the way instructions are scheduled, and the perceived cost of arithmetic
17969 operations. The list of @var{arch} values is the same as for
17970 @option{-march}.
17971
17972 When this option is not used, GCC optimizes for the processor
17973 specified by @option{-march}. By using @option{-march} and
17974 @option{-mtune} together, it is possible to generate code that
17975 runs on a family of processors, but optimize the code for one
17976 particular member of that family.
17977
17978 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
17979 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
17980 @option{-march} ones described above.
17981
17982 @item -mips1
17983 @opindex mips1
17984 Equivalent to @option{-march=mips1}.
17985
17986 @item -mips2
17987 @opindex mips2
17988 Equivalent to @option{-march=mips2}.
17989
17990 @item -mips3
17991 @opindex mips3
17992 Equivalent to @option{-march=mips3}.
17993
17994 @item -mips4
17995 @opindex mips4
17996 Equivalent to @option{-march=mips4}.
17997
17998 @item -mips32
17999 @opindex mips32
18000 Equivalent to @option{-march=mips32}.
18001
18002 @item -mips32r3
18003 @opindex mips32r3
18004 Equivalent to @option{-march=mips32r3}.
18005
18006 @item -mips32r5
18007 @opindex mips32r5
18008 Equivalent to @option{-march=mips32r5}.
18009
18010 @item -mips32r6
18011 @opindex mips32r6
18012 Equivalent to @option{-march=mips32r6}.
18013
18014 @item -mips64
18015 @opindex mips64
18016 Equivalent to @option{-march=mips64}.
18017
18018 @item -mips64r2
18019 @opindex mips64r2
18020 Equivalent to @option{-march=mips64r2}.
18021
18022 @item -mips64r3
18023 @opindex mips64r3
18024 Equivalent to @option{-march=mips64r3}.
18025
18026 @item -mips64r5
18027 @opindex mips64r5
18028 Equivalent to @option{-march=mips64r5}.
18029
18030 @item -mips64r6
18031 @opindex mips64r6
18032 Equivalent to @option{-march=mips64r6}.
18033
18034 @item -mips16
18035 @itemx -mno-mips16
18036 @opindex mips16
18037 @opindex mno-mips16
18038 Generate (do not generate) MIPS16 code. If GCC is targeting a
18039 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
18040
18041 MIPS16 code generation can also be controlled on a per-function basis
18042 by means of @code{mips16} and @code{nomips16} attributes.
18043 @xref{Function Attributes}, for more information.
18044
18045 @item -mflip-mips16
18046 @opindex mflip-mips16
18047 Generate MIPS16 code on alternating functions. This option is provided
18048 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
18049 not intended for ordinary use in compiling user code.
18050
18051 @item -minterlink-compressed
18052 @item -mno-interlink-compressed
18053 @opindex minterlink-compressed
18054 @opindex mno-interlink-compressed
18055 Require (do not require) that code using the standard (uncompressed) MIPS ISA
18056 be link-compatible with MIPS16 and microMIPS code, and vice versa.
18057
18058 For example, code using the standard ISA encoding cannot jump directly
18059 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
18060 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
18061 knows that the target of the jump is not compressed.
18062
18063 @item -minterlink-mips16
18064 @itemx -mno-interlink-mips16
18065 @opindex minterlink-mips16
18066 @opindex mno-interlink-mips16
18067 Aliases of @option{-minterlink-compressed} and
18068 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
18069 and are retained for backwards compatibility.
18070
18071 @item -mabi=32
18072 @itemx -mabi=o64
18073 @itemx -mabi=n32
18074 @itemx -mabi=64
18075 @itemx -mabi=eabi
18076 @opindex mabi=32
18077 @opindex mabi=o64
18078 @opindex mabi=n32
18079 @opindex mabi=64
18080 @opindex mabi=eabi
18081 Generate code for the given ABI@.
18082
18083 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
18084 generates 64-bit code when you select a 64-bit architecture, but you
18085 can use @option{-mgp32} to get 32-bit code instead.
18086
18087 For information about the O64 ABI, see
18088 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
18089
18090 GCC supports a variant of the o32 ABI in which floating-point registers
18091 are 64 rather than 32 bits wide. You can select this combination with
18092 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
18093 and @code{mfhc1} instructions and is therefore only supported for
18094 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
18095
18096 The register assignments for arguments and return values remain the
18097 same, but each scalar value is passed in a single 64-bit register
18098 rather than a pair of 32-bit registers. For example, scalar
18099 floating-point values are returned in @samp{$f0} only, not a
18100 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
18101 remains the same in that the even-numbered double-precision registers
18102 are saved.
18103
18104 Two additional variants of the o32 ABI are supported to enable
18105 a transition from 32-bit to 64-bit registers. These are FPXX
18106 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
18107 The FPXX extension mandates that all code must execute correctly
18108 when run using 32-bit or 64-bit registers. The code can be interlinked
18109 with either FP32 or FP64, but not both.
18110 The FP64A extension is similar to the FP64 extension but forbids the
18111 use of odd-numbered single-precision registers. This can be used
18112 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
18113 processors and allows both FP32 and FP64A code to interlink and
18114 run in the same process without changing FPU modes.
18115
18116 @item -mabicalls
18117 @itemx -mno-abicalls
18118 @opindex mabicalls
18119 @opindex mno-abicalls
18120 Generate (do not generate) code that is suitable for SVR4-style
18121 dynamic objects. @option{-mabicalls} is the default for SVR4-based
18122 systems.
18123
18124 @item -mshared
18125 @itemx -mno-shared
18126 Generate (do not generate) code that is fully position-independent,
18127 and that can therefore be linked into shared libraries. This option
18128 only affects @option{-mabicalls}.
18129
18130 All @option{-mabicalls} code has traditionally been position-independent,
18131 regardless of options like @option{-fPIC} and @option{-fpic}. However,
18132 as an extension, the GNU toolchain allows executables to use absolute
18133 accesses for locally-binding symbols. It can also use shorter GP
18134 initialization sequences and generate direct calls to locally-defined
18135 functions. This mode is selected by @option{-mno-shared}.
18136
18137 @option{-mno-shared} depends on binutils 2.16 or higher and generates
18138 objects that can only be linked by the GNU linker. However, the option
18139 does not affect the ABI of the final executable; it only affects the ABI
18140 of relocatable objects. Using @option{-mno-shared} generally makes
18141 executables both smaller and quicker.
18142
18143 @option{-mshared} is the default.
18144
18145 @item -mplt
18146 @itemx -mno-plt
18147 @opindex mplt
18148 @opindex mno-plt
18149 Assume (do not assume) that the static and dynamic linkers
18150 support PLTs and copy relocations. This option only affects
18151 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
18152 has no effect without @option{-msym32}.
18153
18154 You can make @option{-mplt} the default by configuring
18155 GCC with @option{--with-mips-plt}. The default is
18156 @option{-mno-plt} otherwise.
18157
18158 @item -mxgot
18159 @itemx -mno-xgot
18160 @opindex mxgot
18161 @opindex mno-xgot
18162 Lift (do not lift) the usual restrictions on the size of the global
18163 offset table.
18164
18165 GCC normally uses a single instruction to load values from the GOT@.
18166 While this is relatively efficient, it only works if the GOT
18167 is smaller than about 64k. Anything larger causes the linker
18168 to report an error such as:
18169
18170 @cindex relocation truncated to fit (MIPS)
18171 @smallexample
18172 relocation truncated to fit: R_MIPS_GOT16 foobar
18173 @end smallexample
18174
18175 If this happens, you should recompile your code with @option{-mxgot}.
18176 This works with very large GOTs, although the code is also
18177 less efficient, since it takes three instructions to fetch the
18178 value of a global symbol.
18179
18180 Note that some linkers can create multiple GOTs. If you have such a
18181 linker, you should only need to use @option{-mxgot} when a single object
18182 file accesses more than 64k's worth of GOT entries. Very few do.
18183
18184 These options have no effect unless GCC is generating position
18185 independent code.
18186
18187 @item -mgp32
18188 @opindex mgp32
18189 Assume that general-purpose registers are 32 bits wide.
18190
18191 @item -mgp64
18192 @opindex mgp64
18193 Assume that general-purpose registers are 64 bits wide.
18194
18195 @item -mfp32
18196 @opindex mfp32
18197 Assume that floating-point registers are 32 bits wide.
18198
18199 @item -mfp64
18200 @opindex mfp64
18201 Assume that floating-point registers are 64 bits wide.
18202
18203 @item -mfpxx
18204 @opindex mfpxx
18205 Do not assume the width of floating-point registers.
18206
18207 @item -mhard-float
18208 @opindex mhard-float
18209 Use floating-point coprocessor instructions.
18210
18211 @item -msoft-float
18212 @opindex msoft-float
18213 Do not use floating-point coprocessor instructions. Implement
18214 floating-point calculations using library calls instead.
18215
18216 @item -mno-float
18217 @opindex mno-float
18218 Equivalent to @option{-msoft-float}, but additionally asserts that the
18219 program being compiled does not perform any floating-point operations.
18220 This option is presently supported only by some bare-metal MIPS
18221 configurations, where it may select a special set of libraries
18222 that lack all floating-point support (including, for example, the
18223 floating-point @code{printf} formats).
18224 If code compiled with @option{-mno-float} accidentally contains
18225 floating-point operations, it is likely to suffer a link-time
18226 or run-time failure.
18227
18228 @item -msingle-float
18229 @opindex msingle-float
18230 Assume that the floating-point coprocessor only supports single-precision
18231 operations.
18232
18233 @item -mdouble-float
18234 @opindex mdouble-float
18235 Assume that the floating-point coprocessor supports double-precision
18236 operations. This is the default.
18237
18238 @item -modd-spreg
18239 @itemx -mno-odd-spreg
18240 @opindex modd-spreg
18241 @opindex mno-odd-spreg
18242 Enable the use of odd-numbered single-precision floating-point registers
18243 for the o32 ABI. This is the default for processors that are known to
18244 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
18245 is set by default.
18246
18247 @item -mabs=2008
18248 @itemx -mabs=legacy
18249 @opindex mabs=2008
18250 @opindex mabs=legacy
18251 These options control the treatment of the special not-a-number (NaN)
18252 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
18253 @code{neg.@i{fmt}} machine instructions.
18254
18255 By default or when @option{-mabs=legacy} is used the legacy
18256 treatment is selected. In this case these instructions are considered
18257 arithmetic and avoided where correct operation is required and the
18258 input operand might be a NaN. A longer sequence of instructions that
18259 manipulate the sign bit of floating-point datum manually is used
18260 instead unless the @option{-ffinite-math-only} option has also been
18261 specified.
18262
18263 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
18264 this case these instructions are considered non-arithmetic and therefore
18265 operating correctly in all cases, including in particular where the
18266 input operand is a NaN. These instructions are therefore always used
18267 for the respective operations.
18268
18269 @item -mnan=2008
18270 @itemx -mnan=legacy
18271 @opindex mnan=2008
18272 @opindex mnan=legacy
18273 These options control the encoding of the special not-a-number (NaN)
18274 IEEE 754 floating-point data.
18275
18276 The @option{-mnan=legacy} option selects the legacy encoding. In this
18277 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
18278 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
18279 by the first bit of their trailing significand field being 1.
18280
18281 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
18282 this case qNaNs are denoted by the first bit of their trailing
18283 significand field being 1, whereas sNaNs are denoted by the first bit of
18284 their trailing significand field being 0.
18285
18286 The default is @option{-mnan=legacy} unless GCC has been configured with
18287 @option{--with-nan=2008}.
18288
18289 @item -mllsc
18290 @itemx -mno-llsc
18291 @opindex mllsc
18292 @opindex mno-llsc
18293 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
18294 implement atomic memory built-in functions. When neither option is
18295 specified, GCC uses the instructions if the target architecture
18296 supports them.
18297
18298 @option{-mllsc} is useful if the runtime environment can emulate the
18299 instructions and @option{-mno-llsc} can be useful when compiling for
18300 nonstandard ISAs. You can make either option the default by
18301 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
18302 respectively. @option{--with-llsc} is the default for some
18303 configurations; see the installation documentation for details.
18304
18305 @item -mdsp
18306 @itemx -mno-dsp
18307 @opindex mdsp
18308 @opindex mno-dsp
18309 Use (do not use) revision 1 of the MIPS DSP ASE@.
18310 @xref{MIPS DSP Built-in Functions}. This option defines the
18311 preprocessor macro @code{__mips_dsp}. It also defines
18312 @code{__mips_dsp_rev} to 1.
18313
18314 @item -mdspr2
18315 @itemx -mno-dspr2
18316 @opindex mdspr2
18317 @opindex mno-dspr2
18318 Use (do not use) revision 2 of the MIPS DSP ASE@.
18319 @xref{MIPS DSP Built-in Functions}. This option defines the
18320 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
18321 It also defines @code{__mips_dsp_rev} to 2.
18322
18323 @item -msmartmips
18324 @itemx -mno-smartmips
18325 @opindex msmartmips
18326 @opindex mno-smartmips
18327 Use (do not use) the MIPS SmartMIPS ASE.
18328
18329 @item -mpaired-single
18330 @itemx -mno-paired-single
18331 @opindex mpaired-single
18332 @opindex mno-paired-single
18333 Use (do not use) paired-single floating-point instructions.
18334 @xref{MIPS Paired-Single Support}. This option requires
18335 hardware floating-point support to be enabled.
18336
18337 @item -mdmx
18338 @itemx -mno-mdmx
18339 @opindex mdmx
18340 @opindex mno-mdmx
18341 Use (do not use) MIPS Digital Media Extension instructions.
18342 This option can only be used when generating 64-bit code and requires
18343 hardware floating-point support to be enabled.
18344
18345 @item -mips3d
18346 @itemx -mno-mips3d
18347 @opindex mips3d
18348 @opindex mno-mips3d
18349 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
18350 The option @option{-mips3d} implies @option{-mpaired-single}.
18351
18352 @item -mmicromips
18353 @itemx -mno-micromips
18354 @opindex mmicromips
18355 @opindex mno-mmicromips
18356 Generate (do not generate) microMIPS code.
18357
18358 MicroMIPS code generation can also be controlled on a per-function basis
18359 by means of @code{micromips} and @code{nomicromips} attributes.
18360 @xref{Function Attributes}, for more information.
18361
18362 @item -mmt
18363 @itemx -mno-mt
18364 @opindex mmt
18365 @opindex mno-mt
18366 Use (do not use) MT Multithreading instructions.
18367
18368 @item -mmcu
18369 @itemx -mno-mcu
18370 @opindex mmcu
18371 @opindex mno-mcu
18372 Use (do not use) the MIPS MCU ASE instructions.
18373
18374 @item -meva
18375 @itemx -mno-eva
18376 @opindex meva
18377 @opindex mno-eva
18378 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
18379
18380 @item -mvirt
18381 @itemx -mno-virt
18382 @opindex mvirt
18383 @opindex mno-virt
18384 Use (do not use) the MIPS Virtualization Application Specific instructions.
18385
18386 @item -mxpa
18387 @itemx -mno-xpa
18388 @opindex mxpa
18389 @opindex mno-xpa
18390 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
18391
18392 @item -mlong64
18393 @opindex mlong64
18394 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
18395 an explanation of the default and the way that the pointer size is
18396 determined.
18397
18398 @item -mlong32
18399 @opindex mlong32
18400 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
18401
18402 The default size of @code{int}s, @code{long}s and pointers depends on
18403 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
18404 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
18405 32-bit @code{long}s. Pointers are the same size as @code{long}s,
18406 or the same size as integer registers, whichever is smaller.
18407
18408 @item -msym32
18409 @itemx -mno-sym32
18410 @opindex msym32
18411 @opindex mno-sym32
18412 Assume (do not assume) that all symbols have 32-bit values, regardless
18413 of the selected ABI@. This option is useful in combination with
18414 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
18415 to generate shorter and faster references to symbolic addresses.
18416
18417 @item -G @var{num}
18418 @opindex G
18419 Put definitions of externally-visible data in a small data section
18420 if that data is no bigger than @var{num} bytes. GCC can then generate
18421 more efficient accesses to the data; see @option{-mgpopt} for details.
18422
18423 The default @option{-G} option depends on the configuration.
18424
18425 @item -mlocal-sdata
18426 @itemx -mno-local-sdata
18427 @opindex mlocal-sdata
18428 @opindex mno-local-sdata
18429 Extend (do not extend) the @option{-G} behavior to local data too,
18430 such as to static variables in C@. @option{-mlocal-sdata} is the
18431 default for all configurations.
18432
18433 If the linker complains that an application is using too much small data,
18434 you might want to try rebuilding the less performance-critical parts with
18435 @option{-mno-local-sdata}. You might also want to build large
18436 libraries with @option{-mno-local-sdata}, so that the libraries leave
18437 more room for the main program.
18438
18439 @item -mextern-sdata
18440 @itemx -mno-extern-sdata
18441 @opindex mextern-sdata
18442 @opindex mno-extern-sdata
18443 Assume (do not assume) that externally-defined data is in
18444 a small data section if the size of that data is within the @option{-G} limit.
18445 @option{-mextern-sdata} is the default for all configurations.
18446
18447 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
18448 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
18449 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
18450 is placed in a small data section. If @var{Var} is defined by another
18451 module, you must either compile that module with a high-enough
18452 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
18453 definition. If @var{Var} is common, you must link the application
18454 with a high-enough @option{-G} setting.
18455
18456 The easiest way of satisfying these restrictions is to compile
18457 and link every module with the same @option{-G} option. However,
18458 you may wish to build a library that supports several different
18459 small data limits. You can do this by compiling the library with
18460 the highest supported @option{-G} setting and additionally using
18461 @option{-mno-extern-sdata} to stop the library from making assumptions
18462 about externally-defined data.
18463
18464 @item -mgpopt
18465 @itemx -mno-gpopt
18466 @opindex mgpopt
18467 @opindex mno-gpopt
18468 Use (do not use) GP-relative accesses for symbols that are known to be
18469 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
18470 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
18471 configurations.
18472
18473 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
18474 might not hold the value of @code{_gp}. For example, if the code is
18475 part of a library that might be used in a boot monitor, programs that
18476 call boot monitor routines pass an unknown value in @code{$gp}.
18477 (In such situations, the boot monitor itself is usually compiled
18478 with @option{-G0}.)
18479
18480 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
18481 @option{-mno-extern-sdata}.
18482
18483 @item -membedded-data
18484 @itemx -mno-embedded-data
18485 @opindex membedded-data
18486 @opindex mno-embedded-data
18487 Allocate variables to the read-only data section first if possible, then
18488 next in the small data section if possible, otherwise in data. This gives
18489 slightly slower code than the default, but reduces the amount of RAM required
18490 when executing, and thus may be preferred for some embedded systems.
18491
18492 @item -muninit-const-in-rodata
18493 @itemx -mno-uninit-const-in-rodata
18494 @opindex muninit-const-in-rodata
18495 @opindex mno-uninit-const-in-rodata
18496 Put uninitialized @code{const} variables in the read-only data section.
18497 This option is only meaningful in conjunction with @option{-membedded-data}.
18498
18499 @item -mcode-readable=@var{setting}
18500 @opindex mcode-readable
18501 Specify whether GCC may generate code that reads from executable sections.
18502 There are three possible settings:
18503
18504 @table @gcctabopt
18505 @item -mcode-readable=yes
18506 Instructions may freely access executable sections. This is the
18507 default setting.
18508
18509 @item -mcode-readable=pcrel
18510 MIPS16 PC-relative load instructions can access executable sections,
18511 but other instructions must not do so. This option is useful on 4KSc
18512 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
18513 It is also useful on processors that can be configured to have a dual
18514 instruction/data SRAM interface and that, like the M4K, automatically
18515 redirect PC-relative loads to the instruction RAM.
18516
18517 @item -mcode-readable=no
18518 Instructions must not access executable sections. This option can be
18519 useful on targets that are configured to have a dual instruction/data
18520 SRAM interface but that (unlike the M4K) do not automatically redirect
18521 PC-relative loads to the instruction RAM.
18522 @end table
18523
18524 @item -msplit-addresses
18525 @itemx -mno-split-addresses
18526 @opindex msplit-addresses
18527 @opindex mno-split-addresses
18528 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
18529 relocation operators. This option has been superseded by
18530 @option{-mexplicit-relocs} but is retained for backwards compatibility.
18531
18532 @item -mexplicit-relocs
18533 @itemx -mno-explicit-relocs
18534 @opindex mexplicit-relocs
18535 @opindex mno-explicit-relocs
18536 Use (do not use) assembler relocation operators when dealing with symbolic
18537 addresses. The alternative, selected by @option{-mno-explicit-relocs},
18538 is to use assembler macros instead.
18539
18540 @option{-mexplicit-relocs} is the default if GCC was configured
18541 to use an assembler that supports relocation operators.
18542
18543 @item -mcheck-zero-division
18544 @itemx -mno-check-zero-division
18545 @opindex mcheck-zero-division
18546 @opindex mno-check-zero-division
18547 Trap (do not trap) on integer division by zero.
18548
18549 The default is @option{-mcheck-zero-division}.
18550
18551 @item -mdivide-traps
18552 @itemx -mdivide-breaks
18553 @opindex mdivide-traps
18554 @opindex mdivide-breaks
18555 MIPS systems check for division by zero by generating either a
18556 conditional trap or a break instruction. Using traps results in
18557 smaller code, but is only supported on MIPS II and later. Also, some
18558 versions of the Linux kernel have a bug that prevents trap from
18559 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
18560 allow conditional traps on architectures that support them and
18561 @option{-mdivide-breaks} to force the use of breaks.
18562
18563 The default is usually @option{-mdivide-traps}, but this can be
18564 overridden at configure time using @option{--with-divide=breaks}.
18565 Divide-by-zero checks can be completely disabled using
18566 @option{-mno-check-zero-division}.
18567
18568 @item -mmemcpy
18569 @itemx -mno-memcpy
18570 @opindex mmemcpy
18571 @opindex mno-memcpy
18572 Force (do not force) the use of @code{memcpy} for non-trivial block
18573 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
18574 most constant-sized copies.
18575
18576 @item -mlong-calls
18577 @itemx -mno-long-calls
18578 @opindex mlong-calls
18579 @opindex mno-long-calls
18580 Disable (do not disable) use of the @code{jal} instruction. Calling
18581 functions using @code{jal} is more efficient but requires the caller
18582 and callee to be in the same 256 megabyte segment.
18583
18584 This option has no effect on abicalls code. The default is
18585 @option{-mno-long-calls}.
18586
18587 @item -mmad
18588 @itemx -mno-mad
18589 @opindex mmad
18590 @opindex mno-mad
18591 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
18592 instructions, as provided by the R4650 ISA@.
18593
18594 @item -mimadd
18595 @itemx -mno-imadd
18596 @opindex mimadd
18597 @opindex mno-imadd
18598 Enable (disable) use of the @code{madd} and @code{msub} integer
18599 instructions. The default is @option{-mimadd} on architectures
18600 that support @code{madd} and @code{msub} except for the 74k
18601 architecture where it was found to generate slower code.
18602
18603 @item -mfused-madd
18604 @itemx -mno-fused-madd
18605 @opindex mfused-madd
18606 @opindex mno-fused-madd
18607 Enable (disable) use of the floating-point multiply-accumulate
18608 instructions, when they are available. The default is
18609 @option{-mfused-madd}.
18610
18611 On the R8000 CPU when multiply-accumulate instructions are used,
18612 the intermediate product is calculated to infinite precision
18613 and is not subject to the FCSR Flush to Zero bit. This may be
18614 undesirable in some circumstances. On other processors the result
18615 is numerically identical to the equivalent computation using
18616 separate multiply, add, subtract and negate instructions.
18617
18618 @item -nocpp
18619 @opindex nocpp
18620 Tell the MIPS assembler to not run its preprocessor over user
18621 assembler files (with a @samp{.s} suffix) when assembling them.
18622
18623 @item -mfix-24k
18624 @item -mno-fix-24k
18625 @opindex mfix-24k
18626 @opindex mno-fix-24k
18627 Work around the 24K E48 (lost data on stores during refill) errata.
18628 The workarounds are implemented by the assembler rather than by GCC@.
18629
18630 @item -mfix-r4000
18631 @itemx -mno-fix-r4000
18632 @opindex mfix-r4000
18633 @opindex mno-fix-r4000
18634 Work around certain R4000 CPU errata:
18635 @itemize @minus
18636 @item
18637 A double-word or a variable shift may give an incorrect result if executed
18638 immediately after starting an integer division.
18639 @item
18640 A double-word or a variable shift may give an incorrect result if executed
18641 while an integer multiplication is in progress.
18642 @item
18643 An integer division may give an incorrect result if started in a delay slot
18644 of a taken branch or a jump.
18645 @end itemize
18646
18647 @item -mfix-r4400
18648 @itemx -mno-fix-r4400
18649 @opindex mfix-r4400
18650 @opindex mno-fix-r4400
18651 Work around certain R4400 CPU errata:
18652 @itemize @minus
18653 @item
18654 A double-word or a variable shift may give an incorrect result if executed
18655 immediately after starting an integer division.
18656 @end itemize
18657
18658 @item -mfix-r10000
18659 @itemx -mno-fix-r10000
18660 @opindex mfix-r10000
18661 @opindex mno-fix-r10000
18662 Work around certain R10000 errata:
18663 @itemize @minus
18664 @item
18665 @code{ll}/@code{sc} sequences may not behave atomically on revisions
18666 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
18667 @end itemize
18668
18669 This option can only be used if the target architecture supports
18670 branch-likely instructions. @option{-mfix-r10000} is the default when
18671 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
18672 otherwise.
18673
18674 @item -mfix-rm7000
18675 @itemx -mno-fix-rm7000
18676 @opindex mfix-rm7000
18677 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
18678 workarounds are implemented by the assembler rather than by GCC@.
18679
18680 @item -mfix-vr4120
18681 @itemx -mno-fix-vr4120
18682 @opindex mfix-vr4120
18683 Work around certain VR4120 errata:
18684 @itemize @minus
18685 @item
18686 @code{dmultu} does not always produce the correct result.
18687 @item
18688 @code{div} and @code{ddiv} do not always produce the correct result if one
18689 of the operands is negative.
18690 @end itemize
18691 The workarounds for the division errata rely on special functions in
18692 @file{libgcc.a}. At present, these functions are only provided by
18693 the @code{mips64vr*-elf} configurations.
18694
18695 Other VR4120 errata require a NOP to be inserted between certain pairs of
18696 instructions. These errata are handled by the assembler, not by GCC itself.
18697
18698 @item -mfix-vr4130
18699 @opindex mfix-vr4130
18700 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
18701 workarounds are implemented by the assembler rather than by GCC,
18702 although GCC avoids using @code{mflo} and @code{mfhi} if the
18703 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
18704 instructions are available instead.
18705
18706 @item -mfix-sb1
18707 @itemx -mno-fix-sb1
18708 @opindex mfix-sb1
18709 Work around certain SB-1 CPU core errata.
18710 (This flag currently works around the SB-1 revision 2
18711 ``F1'' and ``F2'' floating-point errata.)
18712
18713 @item -mr10k-cache-barrier=@var{setting}
18714 @opindex mr10k-cache-barrier
18715 Specify whether GCC should insert cache barriers to avoid the
18716 side-effects of speculation on R10K processors.
18717
18718 In common with many processors, the R10K tries to predict the outcome
18719 of a conditional branch and speculatively executes instructions from
18720 the ``taken'' branch. It later aborts these instructions if the
18721 predicted outcome is wrong. However, on the R10K, even aborted
18722 instructions can have side effects.
18723
18724 This problem only affects kernel stores and, depending on the system,
18725 kernel loads. As an example, a speculatively-executed store may load
18726 the target memory into cache and mark the cache line as dirty, even if
18727 the store itself is later aborted. If a DMA operation writes to the
18728 same area of memory before the ``dirty'' line is flushed, the cached
18729 data overwrites the DMA-ed data. See the R10K processor manual
18730 for a full description, including other potential problems.
18731
18732 One workaround is to insert cache barrier instructions before every memory
18733 access that might be speculatively executed and that might have side
18734 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
18735 controls GCC's implementation of this workaround. It assumes that
18736 aborted accesses to any byte in the following regions does not have
18737 side effects:
18738
18739 @enumerate
18740 @item
18741 the memory occupied by the current function's stack frame;
18742
18743 @item
18744 the memory occupied by an incoming stack argument;
18745
18746 @item
18747 the memory occupied by an object with a link-time-constant address.
18748 @end enumerate
18749
18750 It is the kernel's responsibility to ensure that speculative
18751 accesses to these regions are indeed safe.
18752
18753 If the input program contains a function declaration such as:
18754
18755 @smallexample
18756 void foo (void);
18757 @end smallexample
18758
18759 then the implementation of @code{foo} must allow @code{j foo} and
18760 @code{jal foo} to be executed speculatively. GCC honors this
18761 restriction for functions it compiles itself. It expects non-GCC
18762 functions (such as hand-written assembly code) to do the same.
18763
18764 The option has three forms:
18765
18766 @table @gcctabopt
18767 @item -mr10k-cache-barrier=load-store
18768 Insert a cache barrier before a load or store that might be
18769 speculatively executed and that might have side effects even
18770 if aborted.
18771
18772 @item -mr10k-cache-barrier=store
18773 Insert a cache barrier before a store that might be speculatively
18774 executed and that might have side effects even if aborted.
18775
18776 @item -mr10k-cache-barrier=none
18777 Disable the insertion of cache barriers. This is the default setting.
18778 @end table
18779
18780 @item -mflush-func=@var{func}
18781 @itemx -mno-flush-func
18782 @opindex mflush-func
18783 Specifies the function to call to flush the I and D caches, or to not
18784 call any such function. If called, the function must take the same
18785 arguments as the common @code{_flush_func}, that is, the address of the
18786 memory range for which the cache is being flushed, the size of the
18787 memory range, and the number 3 (to flush both caches). The default
18788 depends on the target GCC was configured for, but commonly is either
18789 @code{_flush_func} or @code{__cpu_flush}.
18790
18791 @item mbranch-cost=@var{num}
18792 @opindex mbranch-cost
18793 Set the cost of branches to roughly @var{num} ``simple'' instructions.
18794 This cost is only a heuristic and is not guaranteed to produce
18795 consistent results across releases. A zero cost redundantly selects
18796 the default, which is based on the @option{-mtune} setting.
18797
18798 @item -mbranch-likely
18799 @itemx -mno-branch-likely
18800 @opindex mbranch-likely
18801 @opindex mno-branch-likely
18802 Enable or disable use of Branch Likely instructions, regardless of the
18803 default for the selected architecture. By default, Branch Likely
18804 instructions may be generated if they are supported by the selected
18805 architecture. An exception is for the MIPS32 and MIPS64 architectures
18806 and processors that implement those architectures; for those, Branch
18807 Likely instructions are not be generated by default because the MIPS32
18808 and MIPS64 architectures specifically deprecate their use.
18809
18810 @item -mcompact-branches=never
18811 @itemx -mcompact-branches=optimal
18812 @itemx -mcompact-branches=always
18813 @opindex mcompact-branches=never
18814 @opindex mcompact-branches=optimal
18815 @opindex mcompact-branches=always
18816 These options control which form of branches will be generated. The
18817 default is @option{-mcompact-branches=optimal}.
18818
18819 The @option{-mcompact-branches=never} option ensures that compact branch
18820 instructions will never be generated.
18821
18822 The @option{-mcompact-branches=always} option ensures that a compact
18823 branch instruction will be generated if available. If a compact branch
18824 instruction is not available, a delay slot form of the branch will be
18825 used instead.
18826
18827 This option is supported from MIPS Release 6 onwards.
18828
18829 The @option{-mcompact-branches=optimal} option will cause a delay slot
18830 branch to be used if one is available in the current ISA and the delay
18831 slot is successfully filled. If the delay slot is not filled, a compact
18832 branch will be chosen if one is available.
18833
18834 @item -mfp-exceptions
18835 @itemx -mno-fp-exceptions
18836 @opindex mfp-exceptions
18837 Specifies whether FP exceptions are enabled. This affects how
18838 FP instructions are scheduled for some processors.
18839 The default is that FP exceptions are
18840 enabled.
18841
18842 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
18843 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
18844 FP pipe.
18845
18846 @item -mvr4130-align
18847 @itemx -mno-vr4130-align
18848 @opindex mvr4130-align
18849 The VR4130 pipeline is two-way superscalar, but can only issue two
18850 instructions together if the first one is 8-byte aligned. When this
18851 option is enabled, GCC aligns pairs of instructions that it
18852 thinks should execute in parallel.
18853
18854 This option only has an effect when optimizing for the VR4130.
18855 It normally makes code faster, but at the expense of making it bigger.
18856 It is enabled by default at optimization level @option{-O3}.
18857
18858 @item -msynci
18859 @itemx -mno-synci
18860 @opindex msynci
18861 Enable (disable) generation of @code{synci} instructions on
18862 architectures that support it. The @code{synci} instructions (if
18863 enabled) are generated when @code{__builtin___clear_cache} is
18864 compiled.
18865
18866 This option defaults to @option{-mno-synci}, but the default can be
18867 overridden by configuring GCC with @option{--with-synci}.
18868
18869 When compiling code for single processor systems, it is generally safe
18870 to use @code{synci}. However, on many multi-core (SMP) systems, it
18871 does not invalidate the instruction caches on all cores and may lead
18872 to undefined behavior.
18873
18874 @item -mrelax-pic-calls
18875 @itemx -mno-relax-pic-calls
18876 @opindex mrelax-pic-calls
18877 Try to turn PIC calls that are normally dispatched via register
18878 @code{$25} into direct calls. This is only possible if the linker can
18879 resolve the destination at link time and if the destination is within
18880 range for a direct call.
18881
18882 @option{-mrelax-pic-calls} is the default if GCC was configured to use
18883 an assembler and a linker that support the @code{.reloc} assembly
18884 directive and @option{-mexplicit-relocs} is in effect. With
18885 @option{-mno-explicit-relocs}, this optimization can be performed by the
18886 assembler and the linker alone without help from the compiler.
18887
18888 @item -mmcount-ra-address
18889 @itemx -mno-mcount-ra-address
18890 @opindex mmcount-ra-address
18891 @opindex mno-mcount-ra-address
18892 Emit (do not emit) code that allows @code{_mcount} to modify the
18893 calling function's return address. When enabled, this option extends
18894 the usual @code{_mcount} interface with a new @var{ra-address}
18895 parameter, which has type @code{intptr_t *} and is passed in register
18896 @code{$12}. @code{_mcount} can then modify the return address by
18897 doing both of the following:
18898 @itemize
18899 @item
18900 Returning the new address in register @code{$31}.
18901 @item
18902 Storing the new address in @code{*@var{ra-address}},
18903 if @var{ra-address} is nonnull.
18904 @end itemize
18905
18906 The default is @option{-mno-mcount-ra-address}.
18907
18908 @item -mframe-header-opt
18909 @itemx -mno-frame-header-opt
18910 @opindex mframe-header-opt
18911 Enable (disable) frame header optimization in the o32 ABI. When using the
18912 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
18913 function to write out register arguments. When enabled, this optimization
18914 will suppress the allocation of the frame header if it can be determined that
18915 it is unused.
18916
18917 This optimization is off by default at all optimization levels.
18918
18919 @end table
18920
18921 @node MMIX Options
18922 @subsection MMIX Options
18923 @cindex MMIX Options
18924
18925 These options are defined for the MMIX:
18926
18927 @table @gcctabopt
18928 @item -mlibfuncs
18929 @itemx -mno-libfuncs
18930 @opindex mlibfuncs
18931 @opindex mno-libfuncs
18932 Specify that intrinsic library functions are being compiled, passing all
18933 values in registers, no matter the size.
18934
18935 @item -mepsilon
18936 @itemx -mno-epsilon
18937 @opindex mepsilon
18938 @opindex mno-epsilon
18939 Generate floating-point comparison instructions that compare with respect
18940 to the @code{rE} epsilon register.
18941
18942 @item -mabi=mmixware
18943 @itemx -mabi=gnu
18944 @opindex mabi=mmixware
18945 @opindex mabi=gnu
18946 Generate code that passes function parameters and return values that (in
18947 the called function) are seen as registers @code{$0} and up, as opposed to
18948 the GNU ABI which uses global registers @code{$231} and up.
18949
18950 @item -mzero-extend
18951 @itemx -mno-zero-extend
18952 @opindex mzero-extend
18953 @opindex mno-zero-extend
18954 When reading data from memory in sizes shorter than 64 bits, use (do not
18955 use) zero-extending load instructions by default, rather than
18956 sign-extending ones.
18957
18958 @item -mknuthdiv
18959 @itemx -mno-knuthdiv
18960 @opindex mknuthdiv
18961 @opindex mno-knuthdiv
18962 Make the result of a division yielding a remainder have the same sign as
18963 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
18964 remainder follows the sign of the dividend. Both methods are
18965 arithmetically valid, the latter being almost exclusively used.
18966
18967 @item -mtoplevel-symbols
18968 @itemx -mno-toplevel-symbols
18969 @opindex mtoplevel-symbols
18970 @opindex mno-toplevel-symbols
18971 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
18972 code can be used with the @code{PREFIX} assembly directive.
18973
18974 @item -melf
18975 @opindex melf
18976 Generate an executable in the ELF format, rather than the default
18977 @samp{mmo} format used by the @command{mmix} simulator.
18978
18979 @item -mbranch-predict
18980 @itemx -mno-branch-predict
18981 @opindex mbranch-predict
18982 @opindex mno-branch-predict
18983 Use (do not use) the probable-branch instructions, when static branch
18984 prediction indicates a probable branch.
18985
18986 @item -mbase-addresses
18987 @itemx -mno-base-addresses
18988 @opindex mbase-addresses
18989 @opindex mno-base-addresses
18990 Generate (do not generate) code that uses @emph{base addresses}. Using a
18991 base address automatically generates a request (handled by the assembler
18992 and the linker) for a constant to be set up in a global register. The
18993 register is used for one or more base address requests within the range 0
18994 to 255 from the value held in the register. The generally leads to short
18995 and fast code, but the number of different data items that can be
18996 addressed is limited. This means that a program that uses lots of static
18997 data may require @option{-mno-base-addresses}.
18998
18999 @item -msingle-exit
19000 @itemx -mno-single-exit
19001 @opindex msingle-exit
19002 @opindex mno-single-exit
19003 Force (do not force) generated code to have a single exit point in each
19004 function.
19005 @end table
19006
19007 @node MN10300 Options
19008 @subsection MN10300 Options
19009 @cindex MN10300 options
19010
19011 These @option{-m} options are defined for Matsushita MN10300 architectures:
19012
19013 @table @gcctabopt
19014 @item -mmult-bug
19015 @opindex mmult-bug
19016 Generate code to avoid bugs in the multiply instructions for the MN10300
19017 processors. This is the default.
19018
19019 @item -mno-mult-bug
19020 @opindex mno-mult-bug
19021 Do not generate code to avoid bugs in the multiply instructions for the
19022 MN10300 processors.
19023
19024 @item -mam33
19025 @opindex mam33
19026 Generate code using features specific to the AM33 processor.
19027
19028 @item -mno-am33
19029 @opindex mno-am33
19030 Do not generate code using features specific to the AM33 processor. This
19031 is the default.
19032
19033 @item -mam33-2
19034 @opindex mam33-2
19035 Generate code using features specific to the AM33/2.0 processor.
19036
19037 @item -mam34
19038 @opindex mam34
19039 Generate code using features specific to the AM34 processor.
19040
19041 @item -mtune=@var{cpu-type}
19042 @opindex mtune
19043 Use the timing characteristics of the indicated CPU type when
19044 scheduling instructions. This does not change the targeted processor
19045 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
19046 @samp{am33-2} or @samp{am34}.
19047
19048 @item -mreturn-pointer-on-d0
19049 @opindex mreturn-pointer-on-d0
19050 When generating a function that returns a pointer, return the pointer
19051 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
19052 only in @code{a0}, and attempts to call such functions without a prototype
19053 result in errors. Note that this option is on by default; use
19054 @option{-mno-return-pointer-on-d0} to disable it.
19055
19056 @item -mno-crt0
19057 @opindex mno-crt0
19058 Do not link in the C run-time initialization object file.
19059
19060 @item -mrelax
19061 @opindex mrelax
19062 Indicate to the linker that it should perform a relaxation optimization pass
19063 to shorten branches, calls and absolute memory addresses. This option only
19064 has an effect when used on the command line for the final link step.
19065
19066 This option makes symbolic debugging impossible.
19067
19068 @item -mliw
19069 @opindex mliw
19070 Allow the compiler to generate @emph{Long Instruction Word}
19071 instructions if the target is the @samp{AM33} or later. This is the
19072 default. This option defines the preprocessor macro @code{__LIW__}.
19073
19074 @item -mnoliw
19075 @opindex mnoliw
19076 Do not allow the compiler to generate @emph{Long Instruction Word}
19077 instructions. This option defines the preprocessor macro
19078 @code{__NO_LIW__}.
19079
19080 @item -msetlb
19081 @opindex msetlb
19082 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
19083 instructions if the target is the @samp{AM33} or later. This is the
19084 default. This option defines the preprocessor macro @code{__SETLB__}.
19085
19086 @item -mnosetlb
19087 @opindex mnosetlb
19088 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
19089 instructions. This option defines the preprocessor macro
19090 @code{__NO_SETLB__}.
19091
19092 @end table
19093
19094 @node Moxie Options
19095 @subsection Moxie Options
19096 @cindex Moxie Options
19097
19098 @table @gcctabopt
19099
19100 @item -meb
19101 @opindex meb
19102 Generate big-endian code. This is the default for @samp{moxie-*-*}
19103 configurations.
19104
19105 @item -mel
19106 @opindex mel
19107 Generate little-endian code.
19108
19109 @item -mmul.x
19110 @opindex mmul.x
19111 Generate mul.x and umul.x instructions. This is the default for
19112 @samp{moxiebox-*-*} configurations.
19113
19114 @item -mno-crt0
19115 @opindex mno-crt0
19116 Do not link in the C run-time initialization object file.
19117
19118 @end table
19119
19120 @node MSP430 Options
19121 @subsection MSP430 Options
19122 @cindex MSP430 Options
19123
19124 These options are defined for the MSP430:
19125
19126 @table @gcctabopt
19127
19128 @item -masm-hex
19129 @opindex masm-hex
19130 Force assembly output to always use hex constants. Normally such
19131 constants are signed decimals, but this option is available for
19132 testsuite and/or aesthetic purposes.
19133
19134 @item -mmcu=
19135 @opindex mmcu=
19136 Select the MCU to target. This is used to create a C preprocessor
19137 symbol based upon the MCU name, converted to upper case and pre- and
19138 post-fixed with @samp{__}. This in turn is used by the
19139 @file{msp430.h} header file to select an MCU-specific supplementary
19140 header file.
19141
19142 The option also sets the ISA to use. If the MCU name is one that is
19143 known to only support the 430 ISA then that is selected, otherwise the
19144 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
19145 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
19146 name selects the 430X ISA.
19147
19148 In addition an MCU-specific linker script is added to the linker
19149 command line. The script's name is the name of the MCU with
19150 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
19151 command line defines the C preprocessor symbol @code{__XXX__} and
19152 cause the linker to search for a script called @file{xxx.ld}.
19153
19154 This option is also passed on to the assembler.
19155
19156 @item -mwarn-mcu
19157 @itemx -mno-warn-mcu
19158 @opindex mwarn-mcu
19159 @opindex mno-warn-mcu
19160 This option enables or disables warnings about conflicts between the
19161 MCU name specified by the @option{-mmcu} option and the ISA set by the
19162 @option{-mcpu} option and/or the hardware multiply support set by the
19163 @option{-mhwmult} option. It also toggles warnings about unrecognized
19164 MCU names. This option is on by default.
19165
19166 @item -mcpu=
19167 @opindex mcpu=
19168 Specifies the ISA to use. Accepted values are @samp{msp430},
19169 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
19170 @option{-mmcu=} option should be used to select the ISA.
19171
19172 @item -msim
19173 @opindex msim
19174 Link to the simulator runtime libraries and linker script. Overrides
19175 any scripts that would be selected by the @option{-mmcu=} option.
19176
19177 @item -mlarge
19178 @opindex mlarge
19179 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
19180
19181 @item -msmall
19182 @opindex msmall
19183 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
19184
19185 @item -mrelax
19186 @opindex mrelax
19187 This option is passed to the assembler and linker, and allows the
19188 linker to perform certain optimizations that cannot be done until
19189 the final link.
19190
19191 @item mhwmult=
19192 @opindex mhwmult=
19193 Describes the type of hardware multiply supported by the target.
19194 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
19195 for the original 16-bit-only multiply supported by early MCUs.
19196 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
19197 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
19198 A value of @samp{auto} can also be given. This tells GCC to deduce
19199 the hardware multiply support based upon the MCU name provided by the
19200 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
19201 the MCU name is not recognized then no hardware multiply support is
19202 assumed. @code{auto} is the default setting.
19203
19204 Hardware multiplies are normally performed by calling a library
19205 routine. This saves space in the generated code. When compiling at
19206 @option{-O3} or higher however the hardware multiplier is invoked
19207 inline. This makes for bigger, but faster code.
19208
19209 The hardware multiply routines disable interrupts whilst running and
19210 restore the previous interrupt state when they finish. This makes
19211 them safe to use inside interrupt handlers as well as in normal code.
19212
19213 @item -minrt
19214 @opindex minrt
19215 Enable the use of a minimum runtime environment - no static
19216 initializers or constructors. This is intended for memory-constrained
19217 devices. The compiler includes special symbols in some objects
19218 that tell the linker and runtime which code fragments are required.
19219
19220 @item -mcode-region=
19221 @itemx -mdata-region=
19222 @opindex mcode-region
19223 @opindex mdata-region
19224 These options tell the compiler where to place functions and data that
19225 do not have one of the @code{lower}, @code{upper}, @code{either} or
19226 @code{section} attributes. Possible values are @code{lower},
19227 @code{upper}, @code{either} or @code{any}. The first three behave
19228 like the corresponding attribute. The fourth possible value -
19229 @code{any} - is the default. It leaves placement entirely up to the
19230 linker script and how it assigns the standard sections
19231 (@code{.text}, @code{.data}, etc) to the memory regions.
19232
19233 @item -msilicon-errata=
19234 @opindex msilicon-errata
19235 This option passes on a request to assembler to enable the fixes for
19236 the named silicon errata.
19237
19238 @item -msilicon-errata-warn=
19239 @opindex msilicon-errata-warn
19240 This option passes on a request to the assembler to enable warning
19241 messages when a silicon errata might need to be applied.
19242
19243 @end table
19244
19245 @node NDS32 Options
19246 @subsection NDS32 Options
19247 @cindex NDS32 Options
19248
19249 These options are defined for NDS32 implementations:
19250
19251 @table @gcctabopt
19252
19253 @item -mbig-endian
19254 @opindex mbig-endian
19255 Generate code in big-endian mode.
19256
19257 @item -mlittle-endian
19258 @opindex mlittle-endian
19259 Generate code in little-endian mode.
19260
19261 @item -mreduced-regs
19262 @opindex mreduced-regs
19263 Use reduced-set registers for register allocation.
19264
19265 @item -mfull-regs
19266 @opindex mfull-regs
19267 Use full-set registers for register allocation.
19268
19269 @item -mcmov
19270 @opindex mcmov
19271 Generate conditional move instructions.
19272
19273 @item -mno-cmov
19274 @opindex mno-cmov
19275 Do not generate conditional move instructions.
19276
19277 @item -mperf-ext
19278 @opindex mperf-ext
19279 Generate performance extension instructions.
19280
19281 @item -mno-perf-ext
19282 @opindex mno-perf-ext
19283 Do not generate performance extension instructions.
19284
19285 @item -mv3push
19286 @opindex mv3push
19287 Generate v3 push25/pop25 instructions.
19288
19289 @item -mno-v3push
19290 @opindex mno-v3push
19291 Do not generate v3 push25/pop25 instructions.
19292
19293 @item -m16-bit
19294 @opindex m16-bit
19295 Generate 16-bit instructions.
19296
19297 @item -mno-16-bit
19298 @opindex mno-16-bit
19299 Do not generate 16-bit instructions.
19300
19301 @item -misr-vector-size=@var{num}
19302 @opindex misr-vector-size
19303 Specify the size of each interrupt vector, which must be 4 or 16.
19304
19305 @item -mcache-block-size=@var{num}
19306 @opindex mcache-block-size
19307 Specify the size of each cache block,
19308 which must be a power of 2 between 4 and 512.
19309
19310 @item -march=@var{arch}
19311 @opindex march
19312 Specify the name of the target architecture.
19313
19314 @item -mcmodel=@var{code-model}
19315 @opindex mcmodel
19316 Set the code model to one of
19317 @table @asis
19318 @item @samp{small}
19319 All the data and read-only data segments must be within 512KB addressing space.
19320 The text segment must be within 16MB addressing space.
19321 @item @samp{medium}
19322 The data segment must be within 512KB while the read-only data segment can be
19323 within 4GB addressing space. The text segment should be still within 16MB
19324 addressing space.
19325 @item @samp{large}
19326 All the text and data segments can be within 4GB addressing space.
19327 @end table
19328
19329 @item -mctor-dtor
19330 @opindex mctor-dtor
19331 Enable constructor/destructor feature.
19332
19333 @item -mrelax
19334 @opindex mrelax
19335 Guide linker to relax instructions.
19336
19337 @end table
19338
19339 @node Nios II Options
19340 @subsection Nios II Options
19341 @cindex Nios II options
19342 @cindex Altera Nios II options
19343
19344 These are the options defined for the Altera Nios II processor.
19345
19346 @table @gcctabopt
19347
19348 @item -G @var{num}
19349 @opindex G
19350 @cindex smaller data references
19351 Put global and static objects less than or equal to @var{num} bytes
19352 into the small data or BSS sections instead of the normal data or BSS
19353 sections. The default value of @var{num} is 8.
19354
19355 @item -mgpopt=@var{option}
19356 @item -mgpopt
19357 @itemx -mno-gpopt
19358 @opindex mgpopt
19359 @opindex mno-gpopt
19360 Generate (do not generate) GP-relative accesses. The following
19361 @var{option} names are recognized:
19362
19363 @table @samp
19364
19365 @item none
19366 Do not generate GP-relative accesses.
19367
19368 @item local
19369 Generate GP-relative accesses for small data objects that are not
19370 external, weak, or uninitialized common symbols.
19371 Also use GP-relative addressing for objects that
19372 have been explicitly placed in a small data section via a @code{section}
19373 attribute.
19374
19375 @item global
19376 As for @samp{local}, but also generate GP-relative accesses for
19377 small data objects that are external, weak, or common. If you use this option,
19378 you must ensure that all parts of your program (including libraries) are
19379 compiled with the same @option{-G} setting.
19380
19381 @item data
19382 Generate GP-relative accesses for all data objects in the program. If you
19383 use this option, the entire data and BSS segments
19384 of your program must fit in 64K of memory and you must use an appropriate
19385 linker script to allocate them within the addressable range of the
19386 global pointer.
19387
19388 @item all
19389 Generate GP-relative addresses for function pointers as well as data
19390 pointers. If you use this option, the entire text, data, and BSS segments
19391 of your program must fit in 64K of memory and you must use an appropriate
19392 linker script to allocate them within the addressable range of the
19393 global pointer.
19394
19395 @end table
19396
19397 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
19398 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
19399
19400 The default is @option{-mgpopt} except when @option{-fpic} or
19401 @option{-fPIC} is specified to generate position-independent code.
19402 Note that the Nios II ABI does not permit GP-relative accesses from
19403 shared libraries.
19404
19405 You may need to specify @option{-mno-gpopt} explicitly when building
19406 programs that include large amounts of small data, including large
19407 GOT data sections. In this case, the 16-bit offset for GP-relative
19408 addressing may not be large enough to allow access to the entire
19409 small data section.
19410
19411 @item -mel
19412 @itemx -meb
19413 @opindex mel
19414 @opindex meb
19415 Generate little-endian (default) or big-endian (experimental) code,
19416 respectively.
19417
19418 @item -march=@var{arch}
19419 @opindex march
19420 This specifies the name of the target Nios II architecture. GCC uses this
19421 name to determine what kind of instructions it can emit when generating
19422 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
19423
19424 The preprocessor macro @code{__nios2_arch__} is available to programs,
19425 with value 1 or 2, indicating the targeted ISA level.
19426
19427 @item -mbypass-cache
19428 @itemx -mno-bypass-cache
19429 @opindex mno-bypass-cache
19430 @opindex mbypass-cache
19431 Force all load and store instructions to always bypass cache by
19432 using I/O variants of the instructions. The default is not to
19433 bypass the cache.
19434
19435 @item -mno-cache-volatile
19436 @itemx -mcache-volatile
19437 @opindex mcache-volatile
19438 @opindex mno-cache-volatile
19439 Volatile memory access bypass the cache using the I/O variants of
19440 the load and store instructions. The default is not to bypass the cache.
19441
19442 @item -mno-fast-sw-div
19443 @itemx -mfast-sw-div
19444 @opindex mno-fast-sw-div
19445 @opindex mfast-sw-div
19446 Do not use table-based fast divide for small numbers. The default
19447 is to use the fast divide at @option{-O3} and above.
19448
19449 @item -mno-hw-mul
19450 @itemx -mhw-mul
19451 @itemx -mno-hw-mulx
19452 @itemx -mhw-mulx
19453 @itemx -mno-hw-div
19454 @itemx -mhw-div
19455 @opindex mno-hw-mul
19456 @opindex mhw-mul
19457 @opindex mno-hw-mulx
19458 @opindex mhw-mulx
19459 @opindex mno-hw-div
19460 @opindex mhw-div
19461 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
19462 instructions by the compiler. The default is to emit @code{mul}
19463 and not emit @code{div} and @code{mulx}.
19464
19465 @item -mbmx
19466 @itemx -mno-bmx
19467 @itemx -mcdx
19468 @itemx -mno-cdx
19469 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
19470 CDX (code density) instructions. Enabling these instructions also
19471 requires @option{-march=r2}. Since these instructions are optional
19472 extensions to the R2 architecture, the default is not to emit them.
19473
19474 @item -mcustom-@var{insn}=@var{N}
19475 @itemx -mno-custom-@var{insn}
19476 @opindex mcustom-@var{insn}
19477 @opindex mno-custom-@var{insn}
19478 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
19479 custom instruction with encoding @var{N} when generating code that uses
19480 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
19481 instruction 253 for single-precision floating-point add operations instead
19482 of the default behavior of using a library call.
19483
19484 The following values of @var{insn} are supported. Except as otherwise
19485 noted, floating-point operations are expected to be implemented with
19486 normal IEEE 754 semantics and correspond directly to the C operators or the
19487 equivalent GCC built-in functions (@pxref{Other Builtins}).
19488
19489 Single-precision floating point:
19490 @table @asis
19491
19492 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
19493 Binary arithmetic operations.
19494
19495 @item @samp{fnegs}
19496 Unary negation.
19497
19498 @item @samp{fabss}
19499 Unary absolute value.
19500
19501 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
19502 Comparison operations.
19503
19504 @item @samp{fmins}, @samp{fmaxs}
19505 Floating-point minimum and maximum. These instructions are only
19506 generated if @option{-ffinite-math-only} is specified.
19507
19508 @item @samp{fsqrts}
19509 Unary square root operation.
19510
19511 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
19512 Floating-point trigonometric and exponential functions. These instructions
19513 are only generated if @option{-funsafe-math-optimizations} is also specified.
19514
19515 @end table
19516
19517 Double-precision floating point:
19518 @table @asis
19519
19520 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
19521 Binary arithmetic operations.
19522
19523 @item @samp{fnegd}
19524 Unary negation.
19525
19526 @item @samp{fabsd}
19527 Unary absolute value.
19528
19529 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
19530 Comparison operations.
19531
19532 @item @samp{fmind}, @samp{fmaxd}
19533 Double-precision minimum and maximum. These instructions are only
19534 generated if @option{-ffinite-math-only} is specified.
19535
19536 @item @samp{fsqrtd}
19537 Unary square root operation.
19538
19539 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
19540 Double-precision trigonometric and exponential functions. These instructions
19541 are only generated if @option{-funsafe-math-optimizations} is also specified.
19542
19543 @end table
19544
19545 Conversions:
19546 @table @asis
19547 @item @samp{fextsd}
19548 Conversion from single precision to double precision.
19549
19550 @item @samp{ftruncds}
19551 Conversion from double precision to single precision.
19552
19553 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
19554 Conversion from floating point to signed or unsigned integer types, with
19555 truncation towards zero.
19556
19557 @item @samp{round}
19558 Conversion from single-precision floating point to signed integer,
19559 rounding to the nearest integer and ties away from zero.
19560 This corresponds to the @code{__builtin_lroundf} function when
19561 @option{-fno-math-errno} is used.
19562
19563 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
19564 Conversion from signed or unsigned integer types to floating-point types.
19565
19566 @end table
19567
19568 In addition, all of the following transfer instructions for internal
19569 registers X and Y must be provided to use any of the double-precision
19570 floating-point instructions. Custom instructions taking two
19571 double-precision source operands expect the first operand in the
19572 64-bit register X. The other operand (or only operand of a unary
19573 operation) is given to the custom arithmetic instruction with the
19574 least significant half in source register @var{src1} and the most
19575 significant half in @var{src2}. A custom instruction that returns a
19576 double-precision result returns the most significant 32 bits in the
19577 destination register and the other half in 32-bit register Y.
19578 GCC automatically generates the necessary code sequences to write
19579 register X and/or read register Y when double-precision floating-point
19580 instructions are used.
19581
19582 @table @asis
19583
19584 @item @samp{fwrx}
19585 Write @var{src1} into the least significant half of X and @var{src2} into
19586 the most significant half of X.
19587
19588 @item @samp{fwry}
19589 Write @var{src1} into Y.
19590
19591 @item @samp{frdxhi}, @samp{frdxlo}
19592 Read the most or least (respectively) significant half of X and store it in
19593 @var{dest}.
19594
19595 @item @samp{frdy}
19596 Read the value of Y and store it into @var{dest}.
19597 @end table
19598
19599 Note that you can gain more local control over generation of Nios II custom
19600 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
19601 and @code{target("no-custom-@var{insn}")} function attributes
19602 (@pxref{Function Attributes})
19603 or pragmas (@pxref{Function Specific Option Pragmas}).
19604
19605 @item -mcustom-fpu-cfg=@var{name}
19606 @opindex mcustom-fpu-cfg
19607
19608 This option enables a predefined, named set of custom instruction encodings
19609 (see @option{-mcustom-@var{insn}} above).
19610 Currently, the following sets are defined:
19611
19612 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
19613 @gccoptlist{-mcustom-fmuls=252 @gol
19614 -mcustom-fadds=253 @gol
19615 -mcustom-fsubs=254 @gol
19616 -fsingle-precision-constant}
19617
19618 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
19619 @gccoptlist{-mcustom-fmuls=252 @gol
19620 -mcustom-fadds=253 @gol
19621 -mcustom-fsubs=254 @gol
19622 -mcustom-fdivs=255 @gol
19623 -fsingle-precision-constant}
19624
19625 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
19626 @gccoptlist{-mcustom-floatus=243 @gol
19627 -mcustom-fixsi=244 @gol
19628 -mcustom-floatis=245 @gol
19629 -mcustom-fcmpgts=246 @gol
19630 -mcustom-fcmples=249 @gol
19631 -mcustom-fcmpeqs=250 @gol
19632 -mcustom-fcmpnes=251 @gol
19633 -mcustom-fmuls=252 @gol
19634 -mcustom-fadds=253 @gol
19635 -mcustom-fsubs=254 @gol
19636 -mcustom-fdivs=255 @gol
19637 -fsingle-precision-constant}
19638
19639 Custom instruction assignments given by individual
19640 @option{-mcustom-@var{insn}=} options override those given by
19641 @option{-mcustom-fpu-cfg=}, regardless of the
19642 order of the options on the command line.
19643
19644 Note that you can gain more local control over selection of a FPU
19645 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
19646 function attribute (@pxref{Function Attributes})
19647 or pragma (@pxref{Function Specific Option Pragmas}).
19648
19649 @end table
19650
19651 These additional @samp{-m} options are available for the Altera Nios II
19652 ELF (bare-metal) target:
19653
19654 @table @gcctabopt
19655
19656 @item -mhal
19657 @opindex mhal
19658 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
19659 startup and termination code, and is typically used in conjunction with
19660 @option{-msys-crt0=} to specify the location of the alternate startup code
19661 provided by the HAL BSP.
19662
19663 @item -msmallc
19664 @opindex msmallc
19665 Link with a limited version of the C library, @option{-lsmallc}, rather than
19666 Newlib.
19667
19668 @item -msys-crt0=@var{startfile}
19669 @opindex msys-crt0
19670 @var{startfile} is the file name of the startfile (crt0) to use
19671 when linking. This option is only useful in conjunction with @option{-mhal}.
19672
19673 @item -msys-lib=@var{systemlib}
19674 @opindex msys-lib
19675 @var{systemlib} is the library name of the library that provides
19676 low-level system calls required by the C library,
19677 e.g. @code{read} and @code{write}.
19678 This option is typically used to link with a library provided by a HAL BSP.
19679
19680 @end table
19681
19682 @node Nvidia PTX Options
19683 @subsection Nvidia PTX Options
19684 @cindex Nvidia PTX options
19685 @cindex nvptx options
19686
19687 These options are defined for Nvidia PTX:
19688
19689 @table @gcctabopt
19690
19691 @item -m32
19692 @itemx -m64
19693 @opindex m32
19694 @opindex m64
19695 Generate code for 32-bit or 64-bit ABI.
19696
19697 @item -mmainkernel
19698 @opindex mmainkernel
19699 Link in code for a __main kernel. This is for stand-alone instead of
19700 offloading execution.
19701
19702 @item -moptimize
19703 @opindex moptimize
19704 Apply partitioned execution optimizations. This is the default when any
19705 level of optimization is selected.
19706
19707 @end table
19708
19709 @node PDP-11 Options
19710 @subsection PDP-11 Options
19711 @cindex PDP-11 Options
19712
19713 These options are defined for the PDP-11:
19714
19715 @table @gcctabopt
19716 @item -mfpu
19717 @opindex mfpu
19718 Use hardware FPP floating point. This is the default. (FIS floating
19719 point on the PDP-11/40 is not supported.)
19720
19721 @item -msoft-float
19722 @opindex msoft-float
19723 Do not use hardware floating point.
19724
19725 @item -mac0
19726 @opindex mac0
19727 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
19728
19729 @item -mno-ac0
19730 @opindex mno-ac0
19731 Return floating-point results in memory. This is the default.
19732
19733 @item -m40
19734 @opindex m40
19735 Generate code for a PDP-11/40.
19736
19737 @item -m45
19738 @opindex m45
19739 Generate code for a PDP-11/45. This is the default.
19740
19741 @item -m10
19742 @opindex m10
19743 Generate code for a PDP-11/10.
19744
19745 @item -mbcopy-builtin
19746 @opindex mbcopy-builtin
19747 Use inline @code{movmemhi} patterns for copying memory. This is the
19748 default.
19749
19750 @item -mbcopy
19751 @opindex mbcopy
19752 Do not use inline @code{movmemhi} patterns for copying memory.
19753
19754 @item -mint16
19755 @itemx -mno-int32
19756 @opindex mint16
19757 @opindex mno-int32
19758 Use 16-bit @code{int}. This is the default.
19759
19760 @item -mint32
19761 @itemx -mno-int16
19762 @opindex mint32
19763 @opindex mno-int16
19764 Use 32-bit @code{int}.
19765
19766 @item -mfloat64
19767 @itemx -mno-float32
19768 @opindex mfloat64
19769 @opindex mno-float32
19770 Use 64-bit @code{float}. This is the default.
19771
19772 @item -mfloat32
19773 @itemx -mno-float64
19774 @opindex mfloat32
19775 @opindex mno-float64
19776 Use 32-bit @code{float}.
19777
19778 @item -mabshi
19779 @opindex mabshi
19780 Use @code{abshi2} pattern. This is the default.
19781
19782 @item -mno-abshi
19783 @opindex mno-abshi
19784 Do not use @code{abshi2} pattern.
19785
19786 @item -mbranch-expensive
19787 @opindex mbranch-expensive
19788 Pretend that branches are expensive. This is for experimenting with
19789 code generation only.
19790
19791 @item -mbranch-cheap
19792 @opindex mbranch-cheap
19793 Do not pretend that branches are expensive. This is the default.
19794
19795 @item -munix-asm
19796 @opindex munix-asm
19797 Use Unix assembler syntax. This is the default when configured for
19798 @samp{pdp11-*-bsd}.
19799
19800 @item -mdec-asm
19801 @opindex mdec-asm
19802 Use DEC assembler syntax. This is the default when configured for any
19803 PDP-11 target other than @samp{pdp11-*-bsd}.
19804 @end table
19805
19806 @node picoChip Options
19807 @subsection picoChip Options
19808 @cindex picoChip options
19809
19810 These @samp{-m} options are defined for picoChip implementations:
19811
19812 @table @gcctabopt
19813
19814 @item -mae=@var{ae_type}
19815 @opindex mcpu
19816 Set the instruction set, register set, and instruction scheduling
19817 parameters for array element type @var{ae_type}. Supported values
19818 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
19819
19820 @option{-mae=ANY} selects a completely generic AE type. Code
19821 generated with this option runs on any of the other AE types. The
19822 code is not as efficient as it would be if compiled for a specific
19823 AE type, and some types of operation (e.g., multiplication) do not
19824 work properly on all types of AE.
19825
19826 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
19827 for compiled code, and is the default.
19828
19829 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
19830 option may suffer from poor performance of byte (char) manipulation,
19831 since the DSP AE does not provide hardware support for byte load/stores.
19832
19833 @item -msymbol-as-address
19834 Enable the compiler to directly use a symbol name as an address in a
19835 load/store instruction, without first loading it into a
19836 register. Typically, the use of this option generates larger
19837 programs, which run faster than when the option isn't used. However, the
19838 results vary from program to program, so it is left as a user option,
19839 rather than being permanently enabled.
19840
19841 @item -mno-inefficient-warnings
19842 Disables warnings about the generation of inefficient code. These
19843 warnings can be generated, for example, when compiling code that
19844 performs byte-level memory operations on the MAC AE type. The MAC AE has
19845 no hardware support for byte-level memory operations, so all byte
19846 load/stores must be synthesized from word load/store operations. This is
19847 inefficient and a warning is generated to indicate
19848 that you should rewrite the code to avoid byte operations, or to target
19849 an AE type that has the necessary hardware support. This option disables
19850 these warnings.
19851
19852 @end table
19853
19854 @node PowerPC Options
19855 @subsection PowerPC Options
19856 @cindex PowerPC options
19857
19858 These are listed under @xref{RS/6000 and PowerPC Options}.
19859
19860 @node RL78 Options
19861 @subsection RL78 Options
19862 @cindex RL78 Options
19863
19864 @table @gcctabopt
19865
19866 @item -msim
19867 @opindex msim
19868 Links in additional target libraries to support operation within a
19869 simulator.
19870
19871 @item -mmul=none
19872 @itemx -mmul=g10
19873 @itemx -mmul=g13
19874 @itemx -mmul=g14
19875 @itemx -mmul=rl78
19876 @opindex mmul
19877 Specifies the type of hardware multiplication and division support to
19878 be used. The simplest is @code{none}, which uses software for both
19879 multiplication and division. This is the default. The @code{g13}
19880 value is for the hardware multiply/divide peripheral found on the
19881 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
19882 the multiplication and division instructions supported by the RL78/G14
19883 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
19884 the value @code{mg10} is an alias for @code{none}.
19885
19886 In addition a C preprocessor macro is defined, based upon the setting
19887 of this option. Possible values are: @code{__RL78_MUL_NONE__},
19888 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
19889
19890 @item -mcpu=g10
19891 @itemx -mcpu=g13
19892 @itemx -mcpu=g14
19893 @itemx -mcpu=rl78
19894 @opindex mcpu
19895 Specifies the RL78 core to target. The default is the G14 core, also
19896 known as an S3 core or just RL78. The G13 or S2 core does not have
19897 multiply or divide instructions, instead it uses a hardware peripheral
19898 for these operations. The G10 or S1 core does not have register
19899 banks, so it uses a different calling convention.
19900
19901 If this option is set it also selects the type of hardware multiply
19902 support to use, unless this is overridden by an explicit
19903 @option{-mmul=none} option on the command line. Thus specifying
19904 @option{-mcpu=g13} enables the use of the G13 hardware multiply
19905 peripheral and specifying @option{-mcpu=g10} disables the use of
19906 hardware multiplications altogether.
19907
19908 Note, although the RL78/G14 core is the default target, specifying
19909 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
19910 change the behavior of the toolchain since it also enables G14
19911 hardware multiply support. If these options are not specified on the
19912 command line then software multiplication routines will be used even
19913 though the code targets the RL78 core. This is for backwards
19914 compatibility with older toolchains which did not have hardware
19915 multiply and divide support.
19916
19917 In addition a C preprocessor macro is defined, based upon the setting
19918 of this option. Possible values are: @code{__RL78_G10__},
19919 @code{__RL78_G13__} or @code{__RL78_G14__}.
19920
19921 @item -mg10
19922 @itemx -mg13
19923 @itemx -mg14
19924 @itemx -mrl78
19925 @opindex mg10
19926 @opindex mg13
19927 @opindex mg14
19928 @opindex mrl78
19929 These are aliases for the corresponding @option{-mcpu=} option. They
19930 are provided for backwards compatibility.
19931
19932 @item -mallregs
19933 @opindex mallregs
19934 Allow the compiler to use all of the available registers. By default
19935 registers @code{r24..r31} are reserved for use in interrupt handlers.
19936 With this option enabled these registers can be used in ordinary
19937 functions as well.
19938
19939 @item -m64bit-doubles
19940 @itemx -m32bit-doubles
19941 @opindex m64bit-doubles
19942 @opindex m32bit-doubles
19943 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
19944 or 32 bits (@option{-m32bit-doubles}) in size. The default is
19945 @option{-m32bit-doubles}.
19946
19947 @item -msave-mduc-in-interrupts
19948 @item -mno-save-mduc-in-interrupts
19949 @opindex msave-mduc-in-interrupts
19950 @opindex mno-save-mduc-in-interrupts
19951 Specifies that interrupt handler functions should preserve the
19952 MDUC registers. This is only necessary if normal code might use
19953 the MDUC registers, for example because it performs multiplication
19954 and division operations. The default is to ignore the MDUC registers
19955 as this makes the interrupt handlers faster. The target option -mg13
19956 needs to be passed for this to work as this feature is only available
19957 on the G13 target (S2 core). The MDUC registers will only be saved
19958 if the interrupt handler performs a multiplication or division
19959 operation or it calls another function.
19960
19961 @end table
19962
19963 @node RS/6000 and PowerPC Options
19964 @subsection IBM RS/6000 and PowerPC Options
19965 @cindex RS/6000 and PowerPC Options
19966 @cindex IBM RS/6000 and PowerPC Options
19967
19968 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
19969 @table @gcctabopt
19970 @item -mpowerpc-gpopt
19971 @itemx -mno-powerpc-gpopt
19972 @itemx -mpowerpc-gfxopt
19973 @itemx -mno-powerpc-gfxopt
19974 @need 800
19975 @itemx -mpowerpc64
19976 @itemx -mno-powerpc64
19977 @itemx -mmfcrf
19978 @itemx -mno-mfcrf
19979 @itemx -mpopcntb
19980 @itemx -mno-popcntb
19981 @itemx -mpopcntd
19982 @itemx -mno-popcntd
19983 @itemx -mfprnd
19984 @itemx -mno-fprnd
19985 @need 800
19986 @itemx -mcmpb
19987 @itemx -mno-cmpb
19988 @itemx -mmfpgpr
19989 @itemx -mno-mfpgpr
19990 @itemx -mhard-dfp
19991 @itemx -mno-hard-dfp
19992 @opindex mpowerpc-gpopt
19993 @opindex mno-powerpc-gpopt
19994 @opindex mpowerpc-gfxopt
19995 @opindex mno-powerpc-gfxopt
19996 @opindex mpowerpc64
19997 @opindex mno-powerpc64
19998 @opindex mmfcrf
19999 @opindex mno-mfcrf
20000 @opindex mpopcntb
20001 @opindex mno-popcntb
20002 @opindex mpopcntd
20003 @opindex mno-popcntd
20004 @opindex mfprnd
20005 @opindex mno-fprnd
20006 @opindex mcmpb
20007 @opindex mno-cmpb
20008 @opindex mmfpgpr
20009 @opindex mno-mfpgpr
20010 @opindex mhard-dfp
20011 @opindex mno-hard-dfp
20012 You use these options to specify which instructions are available on the
20013 processor you are using. The default value of these options is
20014 determined when configuring GCC@. Specifying the
20015 @option{-mcpu=@var{cpu_type}} overrides the specification of these
20016 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
20017 rather than the options listed above.
20018
20019 Specifying @option{-mpowerpc-gpopt} allows
20020 GCC to use the optional PowerPC architecture instructions in the
20021 General Purpose group, including floating-point square root. Specifying
20022 @option{-mpowerpc-gfxopt} allows GCC to
20023 use the optional PowerPC architecture instructions in the Graphics
20024 group, including floating-point select.
20025
20026 The @option{-mmfcrf} option allows GCC to generate the move from
20027 condition register field instruction implemented on the POWER4
20028 processor and other processors that support the PowerPC V2.01
20029 architecture.
20030 The @option{-mpopcntb} option allows GCC to generate the popcount and
20031 double-precision FP reciprocal estimate instruction implemented on the
20032 POWER5 processor and other processors that support the PowerPC V2.02
20033 architecture.
20034 The @option{-mpopcntd} option allows GCC to generate the popcount
20035 instruction implemented on the POWER7 processor and other processors
20036 that support the PowerPC V2.06 architecture.
20037 The @option{-mfprnd} option allows GCC to generate the FP round to
20038 integer instructions implemented on the POWER5+ processor and other
20039 processors that support the PowerPC V2.03 architecture.
20040 The @option{-mcmpb} option allows GCC to generate the compare bytes
20041 instruction implemented on the POWER6 processor and other processors
20042 that support the PowerPC V2.05 architecture.
20043 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
20044 general-purpose register instructions implemented on the POWER6X
20045 processor and other processors that support the extended PowerPC V2.05
20046 architecture.
20047 The @option{-mhard-dfp} option allows GCC to generate the decimal
20048 floating-point instructions implemented on some POWER processors.
20049
20050 The @option{-mpowerpc64} option allows GCC to generate the additional
20051 64-bit instructions that are found in the full PowerPC64 architecture
20052 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
20053 @option{-mno-powerpc64}.
20054
20055 @item -mcpu=@var{cpu_type}
20056 @opindex mcpu
20057 Set architecture type, register usage, and
20058 instruction scheduling parameters for machine type @var{cpu_type}.
20059 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
20060 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
20061 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
20062 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
20063 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
20064 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
20065 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
20066 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
20067 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
20068 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
20069 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
20070 and @samp{rs64}.
20071
20072 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
20073 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
20074 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
20075 architecture machine types, with an appropriate, generic processor
20076 model assumed for scheduling purposes.
20077
20078 The other options specify a specific processor. Code generated under
20079 those options runs best on that processor, and may not run at all on
20080 others.
20081
20082 The @option{-mcpu} options automatically enable or disable the
20083 following options:
20084
20085 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
20086 -mpopcntb -mpopcntd -mpowerpc64 @gol
20087 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
20088 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
20089 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
20090 -mquad-memory -mquad-memory-atomic -mmodulo -mfloat128 -mfloat128-hardware @gol
20091 -mpower9-fusion -mpower9-vector -mpower9-dform}
20092
20093 The particular options set for any particular CPU varies between
20094 compiler versions, depending on what setting seems to produce optimal
20095 code for that CPU; it doesn't necessarily reflect the actual hardware's
20096 capabilities. If you wish to set an individual option to a particular
20097 value, you may specify it after the @option{-mcpu} option, like
20098 @option{-mcpu=970 -mno-altivec}.
20099
20100 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
20101 not enabled or disabled by the @option{-mcpu} option at present because
20102 AIX does not have full support for these options. You may still
20103 enable or disable them individually if you're sure it'll work in your
20104 environment.
20105
20106 @item -mtune=@var{cpu_type}
20107 @opindex mtune
20108 Set the instruction scheduling parameters for machine type
20109 @var{cpu_type}, but do not set the architecture type or register usage,
20110 as @option{-mcpu=@var{cpu_type}} does. The same
20111 values for @var{cpu_type} are used for @option{-mtune} as for
20112 @option{-mcpu}. If both are specified, the code generated uses the
20113 architecture and registers set by @option{-mcpu}, but the
20114 scheduling parameters set by @option{-mtune}.
20115
20116 @item -mcmodel=small
20117 @opindex mcmodel=small
20118 Generate PowerPC64 code for the small model: The TOC is limited to
20119 64k.
20120
20121 @item -mcmodel=medium
20122 @opindex mcmodel=medium
20123 Generate PowerPC64 code for the medium model: The TOC and other static
20124 data may be up to a total of 4G in size.
20125
20126 @item -mcmodel=large
20127 @opindex mcmodel=large
20128 Generate PowerPC64 code for the large model: The TOC may be up to 4G
20129 in size. Other data and code is only limited by the 64-bit address
20130 space.
20131
20132 @item -maltivec
20133 @itemx -mno-altivec
20134 @opindex maltivec
20135 @opindex mno-altivec
20136 Generate code that uses (does not use) AltiVec instructions, and also
20137 enable the use of built-in functions that allow more direct access to
20138 the AltiVec instruction set. You may also need to set
20139 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
20140 enhancements.
20141
20142 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
20143 @option{-maltivec=be}, the element order for AltiVec intrinsics such
20144 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
20145 match array element order corresponding to the endianness of the
20146 target. That is, element zero identifies the leftmost element in a
20147 vector register when targeting a big-endian platform, and identifies
20148 the rightmost element in a vector register when targeting a
20149 little-endian platform.
20150
20151 @item -maltivec=be
20152 @opindex maltivec=be
20153 Generate AltiVec instructions using big-endian element order,
20154 regardless of whether the target is big- or little-endian. This is
20155 the default when targeting a big-endian platform.
20156
20157 The element order is used to interpret element numbers in AltiVec
20158 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20159 @code{vec_insert}. By default, these match array element order
20160 corresponding to the endianness for the target.
20161
20162 @item -maltivec=le
20163 @opindex maltivec=le
20164 Generate AltiVec instructions using little-endian element order,
20165 regardless of whether the target is big- or little-endian. This is
20166 the default when targeting a little-endian platform. This option is
20167 currently ignored when targeting a big-endian platform.
20168
20169 The element order is used to interpret element numbers in AltiVec
20170 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20171 @code{vec_insert}. By default, these match array element order
20172 corresponding to the endianness for the target.
20173
20174 @item -mvrsave
20175 @itemx -mno-vrsave
20176 @opindex mvrsave
20177 @opindex mno-vrsave
20178 Generate VRSAVE instructions when generating AltiVec code.
20179
20180 @item -mgen-cell-microcode
20181 @opindex mgen-cell-microcode
20182 Generate Cell microcode instructions.
20183
20184 @item -mwarn-cell-microcode
20185 @opindex mwarn-cell-microcode
20186 Warn when a Cell microcode instruction is emitted. An example
20187 of a Cell microcode instruction is a variable shift.
20188
20189 @item -msecure-plt
20190 @opindex msecure-plt
20191 Generate code that allows @command{ld} and @command{ld.so}
20192 to build executables and shared
20193 libraries with non-executable @code{.plt} and @code{.got} sections.
20194 This is a PowerPC
20195 32-bit SYSV ABI option.
20196
20197 @item -mbss-plt
20198 @opindex mbss-plt
20199 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
20200 fills in, and
20201 requires @code{.plt} and @code{.got}
20202 sections that are both writable and executable.
20203 This is a PowerPC 32-bit SYSV ABI option.
20204
20205 @item -misel
20206 @itemx -mno-isel
20207 @opindex misel
20208 @opindex mno-isel
20209 This switch enables or disables the generation of ISEL instructions.
20210
20211 @item -misel=@var{yes/no}
20212 This switch has been deprecated. Use @option{-misel} and
20213 @option{-mno-isel} instead.
20214
20215 @item -mlra
20216 @opindex mlra
20217 Enable Local Register Allocation. This is still experimental for PowerPC,
20218 so by default the compiler uses standard reload
20219 (i.e. @option{-mno-lra}).
20220
20221 @item -mspe
20222 @itemx -mno-spe
20223 @opindex mspe
20224 @opindex mno-spe
20225 This switch enables or disables the generation of SPE simd
20226 instructions.
20227
20228 @item -mpaired
20229 @itemx -mno-paired
20230 @opindex mpaired
20231 @opindex mno-paired
20232 This switch enables or disables the generation of PAIRED simd
20233 instructions.
20234
20235 @item -mspe=@var{yes/no}
20236 This option has been deprecated. Use @option{-mspe} and
20237 @option{-mno-spe} instead.
20238
20239 @item -mvsx
20240 @itemx -mno-vsx
20241 @opindex mvsx
20242 @opindex mno-vsx
20243 Generate code that uses (does not use) vector/scalar (VSX)
20244 instructions, and also enable the use of built-in functions that allow
20245 more direct access to the VSX instruction set.
20246
20247 @item -mcrypto
20248 @itemx -mno-crypto
20249 @opindex mcrypto
20250 @opindex mno-crypto
20251 Enable the use (disable) of the built-in functions that allow direct
20252 access to the cryptographic instructions that were added in version
20253 2.07 of the PowerPC ISA.
20254
20255 @item -mdirect-move
20256 @itemx -mno-direct-move
20257 @opindex mdirect-move
20258 @opindex mno-direct-move
20259 Generate code that uses (does not use) the instructions to move data
20260 between the general purpose registers and the vector/scalar (VSX)
20261 registers that were added in version 2.07 of the PowerPC ISA.
20262
20263 @item -mhtm
20264 @itemx -mno-htm
20265 @opindex mhtm
20266 @opindex mno-htm
20267 Enable (disable) the use of the built-in functions that allow direct
20268 access to the Hardware Transactional Memory (HTM) instructions that
20269 were added in version 2.07 of the PowerPC ISA.
20270
20271 @item -mpower8-fusion
20272 @itemx -mno-power8-fusion
20273 @opindex mpower8-fusion
20274 @opindex mno-power8-fusion
20275 Generate code that keeps (does not keeps) some integer operations
20276 adjacent so that the instructions can be fused together on power8 and
20277 later processors.
20278
20279 @item -mpower8-vector
20280 @itemx -mno-power8-vector
20281 @opindex mpower8-vector
20282 @opindex mno-power8-vector
20283 Generate code that uses (does not use) the vector and scalar
20284 instructions that were added in version 2.07 of the PowerPC ISA. Also
20285 enable the use of built-in functions that allow more direct access to
20286 the vector instructions.
20287
20288 @item -mquad-memory
20289 @itemx -mno-quad-memory
20290 @opindex mquad-memory
20291 @opindex mno-quad-memory
20292 Generate code that uses (does not use) the non-atomic quad word memory
20293 instructions. The @option{-mquad-memory} option requires use of
20294 64-bit mode.
20295
20296 @item -mquad-memory-atomic
20297 @itemx -mno-quad-memory-atomic
20298 @opindex mquad-memory-atomic
20299 @opindex mno-quad-memory-atomic
20300 Generate code that uses (does not use) the atomic quad word memory
20301 instructions. The @option{-mquad-memory-atomic} option requires use of
20302 64-bit mode.
20303
20304 @item -mupper-regs-di
20305 @itemx -mno-upper-regs-di
20306 @opindex mupper-regs-di
20307 @opindex mno-upper-regs-di
20308 Generate code that uses (does not use) the scalar instructions that
20309 target all 64 registers in the vector/scalar floating point register
20310 set that were added in version 2.06 of the PowerPC ISA when processing
20311 integers. @option{-mupper-regs-di} is turned on by default if you use
20312 any of the @option{-mcpu=power7}, @option{-mcpu=power8},
20313 @option{-mcpu=power9}, or @option{-mvsx} options.
20314
20315 @item -mupper-regs-df
20316 @itemx -mno-upper-regs-df
20317 @opindex mupper-regs-df
20318 @opindex mno-upper-regs-df
20319 Generate code that uses (does not use) the scalar double precision
20320 instructions that target all 64 registers in the vector/scalar
20321 floating point register set that were added in version 2.06 of the
20322 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
20323 use any of the @option{-mcpu=power7}, @option{-mcpu=power8},
20324 @option{-mcpu=power9}, or @option{-mvsx} options.
20325
20326 @item -mupper-regs-sf
20327 @itemx -mno-upper-regs-sf
20328 @opindex mupper-regs-sf
20329 @opindex mno-upper-regs-sf
20330 Generate code that uses (does not use) the scalar single precision
20331 instructions that target all 64 registers in the vector/scalar
20332 floating point register set that were added in version 2.07 of the
20333 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
20334 use either of the @option{-mcpu=power8}, @option{-mpower8-vector}, or
20335 @option{-mpower9} options.
20336
20337 @item -mupper-regs
20338 @itemx -mno-upper-regs
20339 @opindex mupper-regs
20340 @opindex mno-upper-regs
20341 Generate code that uses (does not use) the scalar
20342 instructions that target all 64 registers in the vector/scalar
20343 floating point register set, depending on the model of the machine.
20344
20345 If the @option{-mno-upper-regs} option is used, it turns off both
20346 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
20347
20348 @item -mfloat128
20349 @itemx -mno-float128
20350 @opindex mfloat128
20351 @opindex mno-float128
20352 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
20353 and use either software emulation for IEEE 128-bit floating point or
20354 hardware instructions.
20355
20356 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
20357 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
20358 option. The @code{-mfloat128} option only works on PowerPC 64-bit
20359 Linux systems.
20360
20361 @item -mfloat128-hardware
20362 @itemx -mno-float128-hardware
20363 @opindex mfloat128-hardware
20364 @opindex mno-float128-hardware
20365 Enable/disable using ISA 3.0 hardware instructions to support the
20366 @var{__float128} data type.
20367
20368 @item -mmodulo
20369 @itemx -mno-modulo
20370 @opindex mmodulo
20371 @opindex mno-module
20372 Generate code that uses (does not use) the ISA 3.0 integer modulo
20373 instructions. The @option{-mmodulo} option is enabled by default
20374 with the @option{-mcpu=power9} option.
20375
20376 @item -mpower9-fusion
20377 @itemx -mno-power9-fusion
20378 @opindex mpower9-fusion
20379 @opindex mno-power9-fusion
20380 Generate code that keeps (does not keeps) some operations adjacent so
20381 that the instructions can be fused together on power9 and later
20382 processors.
20383
20384 @item -mpower9-vector
20385 @itemx -mno-power9-vector
20386 @opindex mpower9-vector
20387 @opindex mno-power9-vector
20388 Generate code that uses (does not use) the vector and scalar
20389 instructions that were added in version 3.0 of the PowerPC ISA. Also
20390 enable the use of built-in functions that allow more direct access to
20391 the vector instructions.
20392
20393 @item -mpower9-dform
20394 @itemx -mno-power9-dform
20395 @opindex mpower9-dform
20396 @opindex mno-power9-dform
20397 Enable (disable) scalar d-form (register + offset) memory instructions
20398 to load/store traditional Altivec registers. If the @var{LRA} register
20399 allocator is enabled, also enable (disable) vector d-form memory
20400 instructions.
20401
20402 @item -mfloat-gprs=@var{yes/single/double/no}
20403 @itemx -mfloat-gprs
20404 @opindex mfloat-gprs
20405 This switch enables or disables the generation of floating-point
20406 operations on the general-purpose registers for architectures that
20407 support it.
20408
20409 The argument @samp{yes} or @samp{single} enables the use of
20410 single-precision floating-point operations.
20411
20412 The argument @samp{double} enables the use of single and
20413 double-precision floating-point operations.
20414
20415 The argument @samp{no} disables floating-point operations on the
20416 general-purpose registers.
20417
20418 This option is currently only available on the MPC854x.
20419
20420 @item -m32
20421 @itemx -m64
20422 @opindex m32
20423 @opindex m64
20424 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
20425 targets (including GNU/Linux). The 32-bit environment sets int, long
20426 and pointer to 32 bits and generates code that runs on any PowerPC
20427 variant. The 64-bit environment sets int to 32 bits and long and
20428 pointer to 64 bits, and generates code for PowerPC64, as for
20429 @option{-mpowerpc64}.
20430
20431 @item -mfull-toc
20432 @itemx -mno-fp-in-toc
20433 @itemx -mno-sum-in-toc
20434 @itemx -mminimal-toc
20435 @opindex mfull-toc
20436 @opindex mno-fp-in-toc
20437 @opindex mno-sum-in-toc
20438 @opindex mminimal-toc
20439 Modify generation of the TOC (Table Of Contents), which is created for
20440 every executable file. The @option{-mfull-toc} option is selected by
20441 default. In that case, GCC allocates at least one TOC entry for
20442 each unique non-automatic variable reference in your program. GCC
20443 also places floating-point constants in the TOC@. However, only
20444 16,384 entries are available in the TOC@.
20445
20446 If you receive a linker error message that saying you have overflowed
20447 the available TOC space, you can reduce the amount of TOC space used
20448 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
20449 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
20450 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
20451 generate code to calculate the sum of an address and a constant at
20452 run time instead of putting that sum into the TOC@. You may specify one
20453 or both of these options. Each causes GCC to produce very slightly
20454 slower and larger code at the expense of conserving TOC space.
20455
20456 If you still run out of space in the TOC even when you specify both of
20457 these options, specify @option{-mminimal-toc} instead. This option causes
20458 GCC to make only one TOC entry for every file. When you specify this
20459 option, GCC produces code that is slower and larger but which
20460 uses extremely little TOC space. You may wish to use this option
20461 only on files that contain less frequently-executed code.
20462
20463 @item -maix64
20464 @itemx -maix32
20465 @opindex maix64
20466 @opindex maix32
20467 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
20468 @code{long} type, and the infrastructure needed to support them.
20469 Specifying @option{-maix64} implies @option{-mpowerpc64},
20470 while @option{-maix32} disables the 64-bit ABI and
20471 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
20472
20473 @item -mxl-compat
20474 @itemx -mno-xl-compat
20475 @opindex mxl-compat
20476 @opindex mno-xl-compat
20477 Produce code that conforms more closely to IBM XL compiler semantics
20478 when using AIX-compatible ABI@. Pass floating-point arguments to
20479 prototyped functions beyond the register save area (RSA) on the stack
20480 in addition to argument FPRs. Do not assume that most significant
20481 double in 128-bit long double value is properly rounded when comparing
20482 values and converting to double. Use XL symbol names for long double
20483 support routines.
20484
20485 The AIX calling convention was extended but not initially documented to
20486 handle an obscure K&R C case of calling a function that takes the
20487 address of its arguments with fewer arguments than declared. IBM XL
20488 compilers access floating-point arguments that do not fit in the
20489 RSA from the stack when a subroutine is compiled without
20490 optimization. Because always storing floating-point arguments on the
20491 stack is inefficient and rarely needed, this option is not enabled by
20492 default and only is necessary when calling subroutines compiled by IBM
20493 XL compilers without optimization.
20494
20495 @item -mpe
20496 @opindex mpe
20497 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
20498 application written to use message passing with special startup code to
20499 enable the application to run. The system must have PE installed in the
20500 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
20501 must be overridden with the @option{-specs=} option to specify the
20502 appropriate directory location. The Parallel Environment does not
20503 support threads, so the @option{-mpe} option and the @option{-pthread}
20504 option are incompatible.
20505
20506 @item -malign-natural
20507 @itemx -malign-power
20508 @opindex malign-natural
20509 @opindex malign-power
20510 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
20511 @option{-malign-natural} overrides the ABI-defined alignment of larger
20512 types, such as floating-point doubles, on their natural size-based boundary.
20513 The option @option{-malign-power} instructs GCC to follow the ABI-specified
20514 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
20515
20516 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
20517 is not supported.
20518
20519 @item -msoft-float
20520 @itemx -mhard-float
20521 @opindex msoft-float
20522 @opindex mhard-float
20523 Generate code that does not use (uses) the floating-point register set.
20524 Software floating-point emulation is provided if you use the
20525 @option{-msoft-float} option, and pass the option to GCC when linking.
20526
20527 @item -msingle-float
20528 @itemx -mdouble-float
20529 @opindex msingle-float
20530 @opindex mdouble-float
20531 Generate code for single- or double-precision floating-point operations.
20532 @option{-mdouble-float} implies @option{-msingle-float}.
20533
20534 @item -msimple-fpu
20535 @opindex msimple-fpu
20536 Do not generate @code{sqrt} and @code{div} instructions for hardware
20537 floating-point unit.
20538
20539 @item -mfpu=@var{name}
20540 @opindex mfpu
20541 Specify type of floating-point unit. Valid values for @var{name} are
20542 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
20543 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
20544 @samp{sp_full} (equivalent to @option{-msingle-float}),
20545 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
20546
20547 @item -mxilinx-fpu
20548 @opindex mxilinx-fpu
20549 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
20550
20551 @item -mmultiple
20552 @itemx -mno-multiple
20553 @opindex mmultiple
20554 @opindex mno-multiple
20555 Generate code that uses (does not use) the load multiple word
20556 instructions and the store multiple word instructions. These
20557 instructions are generated by default on POWER systems, and not
20558 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
20559 PowerPC systems, since those instructions do not work when the
20560 processor is in little-endian mode. The exceptions are PPC740 and
20561 PPC750 which permit these instructions in little-endian mode.
20562
20563 @item -mstring
20564 @itemx -mno-string
20565 @opindex mstring
20566 @opindex mno-string
20567 Generate code that uses (does not use) the load string instructions
20568 and the store string word instructions to save multiple registers and
20569 do small block moves. These instructions are generated by default on
20570 POWER systems, and not generated on PowerPC systems. Do not use
20571 @option{-mstring} on little-endian PowerPC systems, since those
20572 instructions do not work when the processor is in little-endian mode.
20573 The exceptions are PPC740 and PPC750 which permit these instructions
20574 in little-endian mode.
20575
20576 @item -mupdate
20577 @itemx -mno-update
20578 @opindex mupdate
20579 @opindex mno-update
20580 Generate code that uses (does not use) the load or store instructions
20581 that update the base register to the address of the calculated memory
20582 location. These instructions are generated by default. If you use
20583 @option{-mno-update}, there is a small window between the time that the
20584 stack pointer is updated and the address of the previous frame is
20585 stored, which means code that walks the stack frame across interrupts or
20586 signals may get corrupted data.
20587
20588 @item -mavoid-indexed-addresses
20589 @itemx -mno-avoid-indexed-addresses
20590 @opindex mavoid-indexed-addresses
20591 @opindex mno-avoid-indexed-addresses
20592 Generate code that tries to avoid (not avoid) the use of indexed load
20593 or store instructions. These instructions can incur a performance
20594 penalty on Power6 processors in certain situations, such as when
20595 stepping through large arrays that cross a 16M boundary. This option
20596 is enabled by default when targeting Power6 and disabled otherwise.
20597
20598 @item -mfused-madd
20599 @itemx -mno-fused-madd
20600 @opindex mfused-madd
20601 @opindex mno-fused-madd
20602 Generate code that uses (does not use) the floating-point multiply and
20603 accumulate instructions. These instructions are generated by default
20604 if hardware floating point is used. The machine-dependent
20605 @option{-mfused-madd} option is now mapped to the machine-independent
20606 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
20607 mapped to @option{-ffp-contract=off}.
20608
20609 @item -mmulhw
20610 @itemx -mno-mulhw
20611 @opindex mmulhw
20612 @opindex mno-mulhw
20613 Generate code that uses (does not use) the half-word multiply and
20614 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
20615 These instructions are generated by default when targeting those
20616 processors.
20617
20618 @item -mdlmzb
20619 @itemx -mno-dlmzb
20620 @opindex mdlmzb
20621 @opindex mno-dlmzb
20622 Generate code that uses (does not use) the string-search @samp{dlmzb}
20623 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
20624 generated by default when targeting those processors.
20625
20626 @item -mno-bit-align
20627 @itemx -mbit-align
20628 @opindex mno-bit-align
20629 @opindex mbit-align
20630 On System V.4 and embedded PowerPC systems do not (do) force structures
20631 and unions that contain bit-fields to be aligned to the base type of the
20632 bit-field.
20633
20634 For example, by default a structure containing nothing but 8
20635 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
20636 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
20637 the structure is aligned to a 1-byte boundary and is 1 byte in
20638 size.
20639
20640 @item -mno-strict-align
20641 @itemx -mstrict-align
20642 @opindex mno-strict-align
20643 @opindex mstrict-align
20644 On System V.4 and embedded PowerPC systems do not (do) assume that
20645 unaligned memory references are handled by the system.
20646
20647 @item -mrelocatable
20648 @itemx -mno-relocatable
20649 @opindex mrelocatable
20650 @opindex mno-relocatable
20651 Generate code that allows (does not allow) a static executable to be
20652 relocated to a different address at run time. A simple embedded
20653 PowerPC system loader should relocate the entire contents of
20654 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
20655 a table of 32-bit addresses generated by this option. For this to
20656 work, all objects linked together must be compiled with
20657 @option{-mrelocatable} or @option{-mrelocatable-lib}.
20658 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
20659
20660 @item -mrelocatable-lib
20661 @itemx -mno-relocatable-lib
20662 @opindex mrelocatable-lib
20663 @opindex mno-relocatable-lib
20664 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
20665 @code{.fixup} section to allow static executables to be relocated at
20666 run time, but @option{-mrelocatable-lib} does not use the smaller stack
20667 alignment of @option{-mrelocatable}. Objects compiled with
20668 @option{-mrelocatable-lib} may be linked with objects compiled with
20669 any combination of the @option{-mrelocatable} options.
20670
20671 @item -mno-toc
20672 @itemx -mtoc
20673 @opindex mno-toc
20674 @opindex mtoc
20675 On System V.4 and embedded PowerPC systems do not (do) assume that
20676 register 2 contains a pointer to a global area pointing to the addresses
20677 used in the program.
20678
20679 @item -mlittle
20680 @itemx -mlittle-endian
20681 @opindex mlittle
20682 @opindex mlittle-endian
20683 On System V.4 and embedded PowerPC systems compile code for the
20684 processor in little-endian mode. The @option{-mlittle-endian} option is
20685 the same as @option{-mlittle}.
20686
20687 @item -mbig
20688 @itemx -mbig-endian
20689 @opindex mbig
20690 @opindex mbig-endian
20691 On System V.4 and embedded PowerPC systems compile code for the
20692 processor in big-endian mode. The @option{-mbig-endian} option is
20693 the same as @option{-mbig}.
20694
20695 @item -mdynamic-no-pic
20696 @opindex mdynamic-no-pic
20697 On Darwin and Mac OS X systems, compile code so that it is not
20698 relocatable, but that its external references are relocatable. The
20699 resulting code is suitable for applications, but not shared
20700 libraries.
20701
20702 @item -msingle-pic-base
20703 @opindex msingle-pic-base
20704 Treat the register used for PIC addressing as read-only, rather than
20705 loading it in the prologue for each function. The runtime system is
20706 responsible for initializing this register with an appropriate value
20707 before execution begins.
20708
20709 @item -mprioritize-restricted-insns=@var{priority}
20710 @opindex mprioritize-restricted-insns
20711 This option controls the priority that is assigned to
20712 dispatch-slot restricted instructions during the second scheduling
20713 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
20714 or @samp{2} to assign no, highest, or second-highest (respectively)
20715 priority to dispatch-slot restricted
20716 instructions.
20717
20718 @item -msched-costly-dep=@var{dependence_type}
20719 @opindex msched-costly-dep
20720 This option controls which dependences are considered costly
20721 by the target during instruction scheduling. The argument
20722 @var{dependence_type} takes one of the following values:
20723
20724 @table @asis
20725 @item @samp{no}
20726 No dependence is costly.
20727
20728 @item @samp{all}
20729 All dependences are costly.
20730
20731 @item @samp{true_store_to_load}
20732 A true dependence from store to load is costly.
20733
20734 @item @samp{store_to_load}
20735 Any dependence from store to load is costly.
20736
20737 @item @var{number}
20738 Any dependence for which the latency is greater than or equal to
20739 @var{number} is costly.
20740 @end table
20741
20742 @item -minsert-sched-nops=@var{scheme}
20743 @opindex minsert-sched-nops
20744 This option controls which NOP insertion scheme is used during
20745 the second scheduling pass. The argument @var{scheme} takes one of the
20746 following values:
20747
20748 @table @asis
20749 @item @samp{no}
20750 Don't insert NOPs.
20751
20752 @item @samp{pad}
20753 Pad with NOPs any dispatch group that has vacant issue slots,
20754 according to the scheduler's grouping.
20755
20756 @item @samp{regroup_exact}
20757 Insert NOPs to force costly dependent insns into
20758 separate groups. Insert exactly as many NOPs as needed to force an insn
20759 to a new group, according to the estimated processor grouping.
20760
20761 @item @var{number}
20762 Insert NOPs to force costly dependent insns into
20763 separate groups. Insert @var{number} NOPs to force an insn to a new group.
20764 @end table
20765
20766 @item -mcall-sysv
20767 @opindex mcall-sysv
20768 On System V.4 and embedded PowerPC systems compile code using calling
20769 conventions that adhere to the March 1995 draft of the System V
20770 Application Binary Interface, PowerPC processor supplement. This is the
20771 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
20772
20773 @item -mcall-sysv-eabi
20774 @itemx -mcall-eabi
20775 @opindex mcall-sysv-eabi
20776 @opindex mcall-eabi
20777 Specify both @option{-mcall-sysv} and @option{-meabi} options.
20778
20779 @item -mcall-sysv-noeabi
20780 @opindex mcall-sysv-noeabi
20781 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
20782
20783 @item -mcall-aixdesc
20784 @opindex m
20785 On System V.4 and embedded PowerPC systems compile code for the AIX
20786 operating system.
20787
20788 @item -mcall-linux
20789 @opindex mcall-linux
20790 On System V.4 and embedded PowerPC systems compile code for the
20791 Linux-based GNU system.
20792
20793 @item -mcall-freebsd
20794 @opindex mcall-freebsd
20795 On System V.4 and embedded PowerPC systems compile code for the
20796 FreeBSD operating system.
20797
20798 @item -mcall-netbsd
20799 @opindex mcall-netbsd
20800 On System V.4 and embedded PowerPC systems compile code for the
20801 NetBSD operating system.
20802
20803 @item -mcall-openbsd
20804 @opindex mcall-netbsd
20805 On System V.4 and embedded PowerPC systems compile code for the
20806 OpenBSD operating system.
20807
20808 @item -maix-struct-return
20809 @opindex maix-struct-return
20810 Return all structures in memory (as specified by the AIX ABI)@.
20811
20812 @item -msvr4-struct-return
20813 @opindex msvr4-struct-return
20814 Return structures smaller than 8 bytes in registers (as specified by the
20815 SVR4 ABI)@.
20816
20817 @item -mabi=@var{abi-type}
20818 @opindex mabi
20819 Extend the current ABI with a particular extension, or remove such extension.
20820 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
20821 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
20822 @samp{elfv1}, @samp{elfv2}@.
20823
20824 @item -mabi=spe
20825 @opindex mabi=spe
20826 Extend the current ABI with SPE ABI extensions. This does not change
20827 the default ABI, instead it adds the SPE ABI extensions to the current
20828 ABI@.
20829
20830 @item -mabi=no-spe
20831 @opindex mabi=no-spe
20832 Disable Book-E SPE ABI extensions for the current ABI@.
20833
20834 @item -mabi=ibmlongdouble
20835 @opindex mabi=ibmlongdouble
20836 Change the current ABI to use IBM extended-precision long double.
20837 This is a PowerPC 32-bit SYSV ABI option.
20838
20839 @item -mabi=ieeelongdouble
20840 @opindex mabi=ieeelongdouble
20841 Change the current ABI to use IEEE extended-precision long double.
20842 This is a PowerPC 32-bit Linux ABI option.
20843
20844 @item -mabi=elfv1
20845 @opindex mabi=elfv1
20846 Change the current ABI to use the ELFv1 ABI.
20847 This is the default ABI for big-endian PowerPC 64-bit Linux.
20848 Overriding the default ABI requires special system support and is
20849 likely to fail in spectacular ways.
20850
20851 @item -mabi=elfv2
20852 @opindex mabi=elfv2
20853 Change the current ABI to use the ELFv2 ABI.
20854 This is the default ABI for little-endian PowerPC 64-bit Linux.
20855 Overriding the default ABI requires special system support and is
20856 likely to fail in spectacular ways.
20857
20858 @item -mprototype
20859 @itemx -mno-prototype
20860 @opindex mprototype
20861 @opindex mno-prototype
20862 On System V.4 and embedded PowerPC systems assume that all calls to
20863 variable argument functions are properly prototyped. Otherwise, the
20864 compiler must insert an instruction before every non-prototyped call to
20865 set or clear bit 6 of the condition code register (@code{CR}) to
20866 indicate whether floating-point values are passed in the floating-point
20867 registers in case the function takes variable arguments. With
20868 @option{-mprototype}, only calls to prototyped variable argument functions
20869 set or clear the bit.
20870
20871 @item -msim
20872 @opindex msim
20873 On embedded PowerPC systems, assume that the startup module is called
20874 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
20875 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
20876 configurations.
20877
20878 @item -mmvme
20879 @opindex mmvme
20880 On embedded PowerPC systems, assume that the startup module is called
20881 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
20882 @file{libc.a}.
20883
20884 @item -mads
20885 @opindex mads
20886 On embedded PowerPC systems, assume that the startup module is called
20887 @file{crt0.o} and the standard C libraries are @file{libads.a} and
20888 @file{libc.a}.
20889
20890 @item -myellowknife
20891 @opindex myellowknife
20892 On embedded PowerPC systems, assume that the startup module is called
20893 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
20894 @file{libc.a}.
20895
20896 @item -mvxworks
20897 @opindex mvxworks
20898 On System V.4 and embedded PowerPC systems, specify that you are
20899 compiling for a VxWorks system.
20900
20901 @item -memb
20902 @opindex memb
20903 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
20904 header to indicate that @samp{eabi} extended relocations are used.
20905
20906 @item -meabi
20907 @itemx -mno-eabi
20908 @opindex meabi
20909 @opindex mno-eabi
20910 On System V.4 and embedded PowerPC systems do (do not) adhere to the
20911 Embedded Applications Binary Interface (EABI), which is a set of
20912 modifications to the System V.4 specifications. Selecting @option{-meabi}
20913 means that the stack is aligned to an 8-byte boundary, a function
20914 @code{__eabi} is called from @code{main} to set up the EABI
20915 environment, and the @option{-msdata} option can use both @code{r2} and
20916 @code{r13} to point to two separate small data areas. Selecting
20917 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
20918 no EABI initialization function is called from @code{main}, and the
20919 @option{-msdata} option only uses @code{r13} to point to a single
20920 small data area. The @option{-meabi} option is on by default if you
20921 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
20922
20923 @item -msdata=eabi
20924 @opindex msdata=eabi
20925 On System V.4 and embedded PowerPC systems, put small initialized
20926 @code{const} global and static data in the @code{.sdata2} section, which
20927 is pointed to by register @code{r2}. Put small initialized
20928 non-@code{const} global and static data in the @code{.sdata} section,
20929 which is pointed to by register @code{r13}. Put small uninitialized
20930 global and static data in the @code{.sbss} section, which is adjacent to
20931 the @code{.sdata} section. The @option{-msdata=eabi} option is
20932 incompatible with the @option{-mrelocatable} option. The
20933 @option{-msdata=eabi} option also sets the @option{-memb} option.
20934
20935 @item -msdata=sysv
20936 @opindex msdata=sysv
20937 On System V.4 and embedded PowerPC systems, put small global and static
20938 data in the @code{.sdata} section, which is pointed to by register
20939 @code{r13}. Put small uninitialized global and static data in the
20940 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
20941 The @option{-msdata=sysv} option is incompatible with the
20942 @option{-mrelocatable} option.
20943
20944 @item -msdata=default
20945 @itemx -msdata
20946 @opindex msdata=default
20947 @opindex msdata
20948 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
20949 compile code the same as @option{-msdata=eabi}, otherwise compile code the
20950 same as @option{-msdata=sysv}.
20951
20952 @item -msdata=data
20953 @opindex msdata=data
20954 On System V.4 and embedded PowerPC systems, put small global
20955 data in the @code{.sdata} section. Put small uninitialized global
20956 data in the @code{.sbss} section. Do not use register @code{r13}
20957 to address small data however. This is the default behavior unless
20958 other @option{-msdata} options are used.
20959
20960 @item -msdata=none
20961 @itemx -mno-sdata
20962 @opindex msdata=none
20963 @opindex mno-sdata
20964 On embedded PowerPC systems, put all initialized global and static data
20965 in the @code{.data} section, and all uninitialized data in the
20966 @code{.bss} section.
20967
20968 @item -mblock-move-inline-limit=@var{num}
20969 @opindex mblock-move-inline-limit
20970 Inline all block moves (such as calls to @code{memcpy} or structure
20971 copies) less than or equal to @var{num} bytes. The minimum value for
20972 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
20973 targets. The default value is target-specific.
20974
20975 @item -G @var{num}
20976 @opindex G
20977 @cindex smaller data references (PowerPC)
20978 @cindex .sdata/.sdata2 references (PowerPC)
20979 On embedded PowerPC systems, put global and static items less than or
20980 equal to @var{num} bytes into the small data or BSS sections instead of
20981 the normal data or BSS section. By default, @var{num} is 8. The
20982 @option{-G @var{num}} switch is also passed to the linker.
20983 All modules should be compiled with the same @option{-G @var{num}} value.
20984
20985 @item -mregnames
20986 @itemx -mno-regnames
20987 @opindex mregnames
20988 @opindex mno-regnames
20989 On System V.4 and embedded PowerPC systems do (do not) emit register
20990 names in the assembly language output using symbolic forms.
20991
20992 @item -mlongcall
20993 @itemx -mno-longcall
20994 @opindex mlongcall
20995 @opindex mno-longcall
20996 By default assume that all calls are far away so that a longer and more
20997 expensive calling sequence is required. This is required for calls
20998 farther than 32 megabytes (33,554,432 bytes) from the current location.
20999 A short call is generated if the compiler knows
21000 the call cannot be that far away. This setting can be overridden by
21001 the @code{shortcall} function attribute, or by @code{#pragma
21002 longcall(0)}.
21003
21004 Some linkers are capable of detecting out-of-range calls and generating
21005 glue code on the fly. On these systems, long calls are unnecessary and
21006 generate slower code. As of this writing, the AIX linker can do this,
21007 as can the GNU linker for PowerPC/64. It is planned to add this feature
21008 to the GNU linker for 32-bit PowerPC systems as well.
21009
21010 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
21011 callee, L42}, plus a @dfn{branch island} (glue code). The two target
21012 addresses represent the callee and the branch island. The
21013 Darwin/PPC linker prefers the first address and generates a @code{bl
21014 callee} if the PPC @code{bl} instruction reaches the callee directly;
21015 otherwise, the linker generates @code{bl L42} to call the branch
21016 island. The branch island is appended to the body of the
21017 calling function; it computes the full 32-bit address of the callee
21018 and jumps to it.
21019
21020 On Mach-O (Darwin) systems, this option directs the compiler emit to
21021 the glue for every direct call, and the Darwin linker decides whether
21022 to use or discard it.
21023
21024 In the future, GCC may ignore all longcall specifications
21025 when the linker is known to generate glue.
21026
21027 @item -mtls-markers
21028 @itemx -mno-tls-markers
21029 @opindex mtls-markers
21030 @opindex mno-tls-markers
21031 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
21032 specifying the function argument. The relocation allows the linker to
21033 reliably associate function call with argument setup instructions for
21034 TLS optimization, which in turn allows GCC to better schedule the
21035 sequence.
21036
21037 @item -pthread
21038 @opindex pthread
21039 Adds support for multithreading with the @dfn{pthreads} library.
21040 This option sets flags for both the preprocessor and linker.
21041
21042 @item -mrecip
21043 @itemx -mno-recip
21044 @opindex mrecip
21045 This option enables use of the reciprocal estimate and
21046 reciprocal square root estimate instructions with additional
21047 Newton-Raphson steps to increase precision instead of doing a divide or
21048 square root and divide for floating-point arguments. You should use
21049 the @option{-ffast-math} option when using @option{-mrecip} (or at
21050 least @option{-funsafe-math-optimizations},
21051 @option{-ffinite-math-only}, @option{-freciprocal-math} and
21052 @option{-fno-trapping-math}). Note that while the throughput of the
21053 sequence is generally higher than the throughput of the non-reciprocal
21054 instruction, the precision of the sequence can be decreased by up to 2
21055 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
21056 roots.
21057
21058 @item -mrecip=@var{opt}
21059 @opindex mrecip=opt
21060 This option controls which reciprocal estimate instructions
21061 may be used. @var{opt} is a comma-separated list of options, which may
21062 be preceded by a @code{!} to invert the option:
21063
21064 @table @samp
21065
21066 @item all
21067 Enable all estimate instructions.
21068
21069 @item default
21070 Enable the default instructions, equivalent to @option{-mrecip}.
21071
21072 @item none
21073 Disable all estimate instructions, equivalent to @option{-mno-recip}.
21074
21075 @item div
21076 Enable the reciprocal approximation instructions for both
21077 single and double precision.
21078
21079 @item divf
21080 Enable the single-precision reciprocal approximation instructions.
21081
21082 @item divd
21083 Enable the double-precision reciprocal approximation instructions.
21084
21085 @item rsqrt
21086 Enable the reciprocal square root approximation instructions for both
21087 single and double precision.
21088
21089 @item rsqrtf
21090 Enable the single-precision reciprocal square root approximation instructions.
21091
21092 @item rsqrtd
21093 Enable the double-precision reciprocal square root approximation instructions.
21094
21095 @end table
21096
21097 So, for example, @option{-mrecip=all,!rsqrtd} enables
21098 all of the reciprocal estimate instructions, except for the
21099 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
21100 which handle the double-precision reciprocal square root calculations.
21101
21102 @item -mrecip-precision
21103 @itemx -mno-recip-precision
21104 @opindex mrecip-precision
21105 Assume (do not assume) that the reciprocal estimate instructions
21106 provide higher-precision estimates than is mandated by the PowerPC
21107 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
21108 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
21109 The double-precision square root estimate instructions are not generated by
21110 default on low-precision machines, since they do not provide an
21111 estimate that converges after three steps.
21112
21113 @item -mveclibabi=@var{type}
21114 @opindex mveclibabi
21115 Specifies the ABI type to use for vectorizing intrinsics using an
21116 external library. The only type supported at present is @samp{mass},
21117 which specifies to use IBM's Mathematical Acceleration Subsystem
21118 (MASS) libraries for vectorizing intrinsics using external libraries.
21119 GCC currently emits calls to @code{acosd2}, @code{acosf4},
21120 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
21121 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
21122 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
21123 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
21124 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
21125 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
21126 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
21127 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
21128 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
21129 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
21130 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
21131 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
21132 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
21133 for power7. Both @option{-ftree-vectorize} and
21134 @option{-funsafe-math-optimizations} must also be enabled. The MASS
21135 libraries must be specified at link time.
21136
21137 @item -mfriz
21138 @itemx -mno-friz
21139 @opindex mfriz
21140 Generate (do not generate) the @code{friz} instruction when the
21141 @option{-funsafe-math-optimizations} option is used to optimize
21142 rounding of floating-point values to 64-bit integer and back to floating
21143 point. The @code{friz} instruction does not return the same value if
21144 the floating-point number is too large to fit in an integer.
21145
21146 @item -mpointers-to-nested-functions
21147 @itemx -mno-pointers-to-nested-functions
21148 @opindex mpointers-to-nested-functions
21149 Generate (do not generate) code to load up the static chain register
21150 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
21151 systems where a function pointer points to a 3-word descriptor giving
21152 the function address, TOC value to be loaded in register @code{r2}, and
21153 static chain value to be loaded in register @code{r11}. The
21154 @option{-mpointers-to-nested-functions} is on by default. You cannot
21155 call through pointers to nested functions or pointers
21156 to functions compiled in other languages that use the static chain if
21157 you use @option{-mno-pointers-to-nested-functions}.
21158
21159 @item -msave-toc-indirect
21160 @itemx -mno-save-toc-indirect
21161 @opindex msave-toc-indirect
21162 Generate (do not generate) code to save the TOC value in the reserved
21163 stack location in the function prologue if the function calls through
21164 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
21165 saved in the prologue, it is saved just before the call through the
21166 pointer. The @option{-mno-save-toc-indirect} option is the default.
21167
21168 @item -mcompat-align-parm
21169 @itemx -mno-compat-align-parm
21170 @opindex mcompat-align-parm
21171 Generate (do not generate) code to pass structure parameters with a
21172 maximum alignment of 64 bits, for compatibility with older versions
21173 of GCC.
21174
21175 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
21176 structure parameter on a 128-bit boundary when that structure contained
21177 a member requiring 128-bit alignment. This is corrected in more
21178 recent versions of GCC. This option may be used to generate code
21179 that is compatible with functions compiled with older versions of
21180 GCC.
21181
21182 The @option{-mno-compat-align-parm} option is the default.
21183 @end table
21184
21185 @node RX Options
21186 @subsection RX Options
21187 @cindex RX Options
21188
21189 These command-line options are defined for RX targets:
21190
21191 @table @gcctabopt
21192 @item -m64bit-doubles
21193 @itemx -m32bit-doubles
21194 @opindex m64bit-doubles
21195 @opindex m32bit-doubles
21196 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
21197 or 32 bits (@option{-m32bit-doubles}) in size. The default is
21198 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
21199 works on 32-bit values, which is why the default is
21200 @option{-m32bit-doubles}.
21201
21202 @item -fpu
21203 @itemx -nofpu
21204 @opindex fpu
21205 @opindex nofpu
21206 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
21207 floating-point hardware. The default is enabled for the RX600
21208 series and disabled for the RX200 series.
21209
21210 Floating-point instructions are only generated for 32-bit floating-point
21211 values, however, so the FPU hardware is not used for doubles if the
21212 @option{-m64bit-doubles} option is used.
21213
21214 @emph{Note} If the @option{-fpu} option is enabled then
21215 @option{-funsafe-math-optimizations} is also enabled automatically.
21216 This is because the RX FPU instructions are themselves unsafe.
21217
21218 @item -mcpu=@var{name}
21219 @opindex mcpu
21220 Selects the type of RX CPU to be targeted. Currently three types are
21221 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
21222 the specific @samp{RX610} CPU. The default is @samp{RX600}.
21223
21224 The only difference between @samp{RX600} and @samp{RX610} is that the
21225 @samp{RX610} does not support the @code{MVTIPL} instruction.
21226
21227 The @samp{RX200} series does not have a hardware floating-point unit
21228 and so @option{-nofpu} is enabled by default when this type is
21229 selected.
21230
21231 @item -mbig-endian-data
21232 @itemx -mlittle-endian-data
21233 @opindex mbig-endian-data
21234 @opindex mlittle-endian-data
21235 Store data (but not code) in the big-endian format. The default is
21236 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
21237 format.
21238
21239 @item -msmall-data-limit=@var{N}
21240 @opindex msmall-data-limit
21241 Specifies the maximum size in bytes of global and static variables
21242 which can be placed into the small data area. Using the small data
21243 area can lead to smaller and faster code, but the size of area is
21244 limited and it is up to the programmer to ensure that the area does
21245 not overflow. Also when the small data area is used one of the RX's
21246 registers (usually @code{r13}) is reserved for use pointing to this
21247 area, so it is no longer available for use by the compiler. This
21248 could result in slower and/or larger code if variables are pushed onto
21249 the stack instead of being held in this register.
21250
21251 Note, common variables (variables that have not been initialized) and
21252 constants are not placed into the small data area as they are assigned
21253 to other sections in the output executable.
21254
21255 The default value is zero, which disables this feature. Note, this
21256 feature is not enabled by default with higher optimization levels
21257 (@option{-O2} etc) because of the potentially detrimental effects of
21258 reserving a register. It is up to the programmer to experiment and
21259 discover whether this feature is of benefit to their program. See the
21260 description of the @option{-mpid} option for a description of how the
21261 actual register to hold the small data area pointer is chosen.
21262
21263 @item -msim
21264 @itemx -mno-sim
21265 @opindex msim
21266 @opindex mno-sim
21267 Use the simulator runtime. The default is to use the libgloss
21268 board-specific runtime.
21269
21270 @item -mas100-syntax
21271 @itemx -mno-as100-syntax
21272 @opindex mas100-syntax
21273 @opindex mno-as100-syntax
21274 When generating assembler output use a syntax that is compatible with
21275 Renesas's AS100 assembler. This syntax can also be handled by the GAS
21276 assembler, but it has some restrictions so it is not generated by default.
21277
21278 @item -mmax-constant-size=@var{N}
21279 @opindex mmax-constant-size
21280 Specifies the maximum size, in bytes, of a constant that can be used as
21281 an operand in a RX instruction. Although the RX instruction set does
21282 allow constants of up to 4 bytes in length to be used in instructions,
21283 a longer value equates to a longer instruction. Thus in some
21284 circumstances it can be beneficial to restrict the size of constants
21285 that are used in instructions. Constants that are too big are instead
21286 placed into a constant pool and referenced via register indirection.
21287
21288 The value @var{N} can be between 0 and 4. A value of 0 (the default)
21289 or 4 means that constants of any size are allowed.
21290
21291 @item -mrelax
21292 @opindex mrelax
21293 Enable linker relaxation. Linker relaxation is a process whereby the
21294 linker attempts to reduce the size of a program by finding shorter
21295 versions of various instructions. Disabled by default.
21296
21297 @item -mint-register=@var{N}
21298 @opindex mint-register
21299 Specify the number of registers to reserve for fast interrupt handler
21300 functions. The value @var{N} can be between 0 and 4. A value of 1
21301 means that register @code{r13} is reserved for the exclusive use
21302 of fast interrupt handlers. A value of 2 reserves @code{r13} and
21303 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
21304 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
21305 A value of 0, the default, does not reserve any registers.
21306
21307 @item -msave-acc-in-interrupts
21308 @opindex msave-acc-in-interrupts
21309 Specifies that interrupt handler functions should preserve the
21310 accumulator register. This is only necessary if normal code might use
21311 the accumulator register, for example because it performs 64-bit
21312 multiplications. The default is to ignore the accumulator as this
21313 makes the interrupt handlers faster.
21314
21315 @item -mpid
21316 @itemx -mno-pid
21317 @opindex mpid
21318 @opindex mno-pid
21319 Enables the generation of position independent data. When enabled any
21320 access to constant data is done via an offset from a base address
21321 held in a register. This allows the location of constant data to be
21322 determined at run time without requiring the executable to be
21323 relocated, which is a benefit to embedded applications with tight
21324 memory constraints. Data that can be modified is not affected by this
21325 option.
21326
21327 Note, using this feature reserves a register, usually @code{r13}, for
21328 the constant data base address. This can result in slower and/or
21329 larger code, especially in complicated functions.
21330
21331 The actual register chosen to hold the constant data base address
21332 depends upon whether the @option{-msmall-data-limit} and/or the
21333 @option{-mint-register} command-line options are enabled. Starting
21334 with register @code{r13} and proceeding downwards, registers are
21335 allocated first to satisfy the requirements of @option{-mint-register},
21336 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
21337 is possible for the small data area register to be @code{r8} if both
21338 @option{-mint-register=4} and @option{-mpid} are specified on the
21339 command line.
21340
21341 By default this feature is not enabled. The default can be restored
21342 via the @option{-mno-pid} command-line option.
21343
21344 @item -mno-warn-multiple-fast-interrupts
21345 @itemx -mwarn-multiple-fast-interrupts
21346 @opindex mno-warn-multiple-fast-interrupts
21347 @opindex mwarn-multiple-fast-interrupts
21348 Prevents GCC from issuing a warning message if it finds more than one
21349 fast interrupt handler when it is compiling a file. The default is to
21350 issue a warning for each extra fast interrupt handler found, as the RX
21351 only supports one such interrupt.
21352
21353 @item -mallow-string-insns
21354 @itemx -mno-allow-string-insns
21355 @opindex mallow-string-insns
21356 @opindex mno-allow-string-insns
21357 Enables or disables the use of the string manipulation instructions
21358 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
21359 @code{SWHILE} and also the @code{RMPA} instruction. These
21360 instructions may prefetch data, which is not safe to do if accessing
21361 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
21362 for more information).
21363
21364 The default is to allow these instructions, but it is not possible for
21365 GCC to reliably detect all circumstances where a string instruction
21366 might be used to access an I/O register, so their use cannot be
21367 disabled automatically. Instead it is reliant upon the programmer to
21368 use the @option{-mno-allow-string-insns} option if their program
21369 accesses I/O space.
21370
21371 When the instructions are enabled GCC defines the C preprocessor
21372 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
21373 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
21374
21375 @item -mjsr
21376 @itemx -mno-jsr
21377 @opindex mjsr
21378 @opindex mno-jsr
21379 Use only (or not only) @code{JSR} instructions to access functions.
21380 This option can be used when code size exceeds the range of @code{BSR}
21381 instructions. Note that @option{-mno-jsr} does not mean to not use
21382 @code{JSR} but instead means that any type of branch may be used.
21383 @end table
21384
21385 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
21386 has special significance to the RX port when used with the
21387 @code{interrupt} function attribute. This attribute indicates a
21388 function intended to process fast interrupts. GCC ensures
21389 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
21390 and/or @code{r13} and only provided that the normal use of the
21391 corresponding registers have been restricted via the
21392 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
21393 options.
21394
21395 @node S/390 and zSeries Options
21396 @subsection S/390 and zSeries Options
21397 @cindex S/390 and zSeries Options
21398
21399 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
21400
21401 @table @gcctabopt
21402 @item -mhard-float
21403 @itemx -msoft-float
21404 @opindex mhard-float
21405 @opindex msoft-float
21406 Use (do not use) the hardware floating-point instructions and registers
21407 for floating-point operations. When @option{-msoft-float} is specified,
21408 functions in @file{libgcc.a} are used to perform floating-point
21409 operations. When @option{-mhard-float} is specified, the compiler
21410 generates IEEE floating-point instructions. This is the default.
21411
21412 @item -mhard-dfp
21413 @itemx -mno-hard-dfp
21414 @opindex mhard-dfp
21415 @opindex mno-hard-dfp
21416 Use (do not use) the hardware decimal-floating-point instructions for
21417 decimal-floating-point operations. When @option{-mno-hard-dfp} is
21418 specified, functions in @file{libgcc.a} are used to perform
21419 decimal-floating-point operations. When @option{-mhard-dfp} is
21420 specified, the compiler generates decimal-floating-point hardware
21421 instructions. This is the default for @option{-march=z9-ec} or higher.
21422
21423 @item -mlong-double-64
21424 @itemx -mlong-double-128
21425 @opindex mlong-double-64
21426 @opindex mlong-double-128
21427 These switches control the size of @code{long double} type. A size
21428 of 64 bits makes the @code{long double} type equivalent to the @code{double}
21429 type. This is the default.
21430
21431 @item -mbackchain
21432 @itemx -mno-backchain
21433 @opindex mbackchain
21434 @opindex mno-backchain
21435 Store (do not store) the address of the caller's frame as backchain pointer
21436 into the callee's stack frame.
21437 A backchain may be needed to allow debugging using tools that do not understand
21438 DWARF call frame information.
21439 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
21440 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
21441 the backchain is placed into the topmost word of the 96/160 byte register
21442 save area.
21443
21444 In general, code compiled with @option{-mbackchain} is call-compatible with
21445 code compiled with @option{-mmo-backchain}; however, use of the backchain
21446 for debugging purposes usually requires that the whole binary is built with
21447 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
21448 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21449 to build a linux kernel use @option{-msoft-float}.
21450
21451 The default is to not maintain the backchain.
21452
21453 @item -mpacked-stack
21454 @itemx -mno-packed-stack
21455 @opindex mpacked-stack
21456 @opindex mno-packed-stack
21457 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
21458 specified, the compiler uses the all fields of the 96/160 byte register save
21459 area only for their default purpose; unused fields still take up stack space.
21460 When @option{-mpacked-stack} is specified, register save slots are densely
21461 packed at the top of the register save area; unused space is reused for other
21462 purposes, allowing for more efficient use of the available stack space.
21463 However, when @option{-mbackchain} is also in effect, the topmost word of
21464 the save area is always used to store the backchain, and the return address
21465 register is always saved two words below the backchain.
21466
21467 As long as the stack frame backchain is not used, code generated with
21468 @option{-mpacked-stack} is call-compatible with code generated with
21469 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
21470 S/390 or zSeries generated code that uses the stack frame backchain at run
21471 time, not just for debugging purposes. Such code is not call-compatible
21472 with code compiled with @option{-mpacked-stack}. Also, note that the
21473 combination of @option{-mbackchain},
21474 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21475 to build a linux kernel use @option{-msoft-float}.
21476
21477 The default is to not use the packed stack layout.
21478
21479 @item -msmall-exec
21480 @itemx -mno-small-exec
21481 @opindex msmall-exec
21482 @opindex mno-small-exec
21483 Generate (or do not generate) code using the @code{bras} instruction
21484 to do subroutine calls.
21485 This only works reliably if the total executable size does not
21486 exceed 64k. The default is to use the @code{basr} instruction instead,
21487 which does not have this limitation.
21488
21489 @item -m64
21490 @itemx -m31
21491 @opindex m64
21492 @opindex m31
21493 When @option{-m31} is specified, generate code compliant to the
21494 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
21495 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
21496 particular to generate 64-bit instructions. For the @samp{s390}
21497 targets, the default is @option{-m31}, while the @samp{s390x}
21498 targets default to @option{-m64}.
21499
21500 @item -mzarch
21501 @itemx -mesa
21502 @opindex mzarch
21503 @opindex mesa
21504 When @option{-mzarch} is specified, generate code using the
21505 instructions available on z/Architecture.
21506 When @option{-mesa} is specified, generate code using the
21507 instructions available on ESA/390. Note that @option{-mesa} is
21508 not possible with @option{-m64}.
21509 When generating code compliant to the GNU/Linux for S/390 ABI,
21510 the default is @option{-mesa}. When generating code compliant
21511 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
21512
21513 @item -mhtm
21514 @itemx -mno-htm
21515 @opindex mhtm
21516 @opindex mno-htm
21517 The @option{-mhtm} option enables a set of builtins making use of
21518 instructions available with the transactional execution facility
21519 introduced with the IBM zEnterprise EC12 machine generation
21520 @ref{S/390 System z Built-in Functions}.
21521 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
21522
21523 @item -mvx
21524 @itemx -mno-vx
21525 @opindex mvx
21526 @opindex mno-vx
21527 When @option{-mvx} is specified, generate code using the instructions
21528 available with the vector extension facility introduced with the IBM
21529 z13 machine generation.
21530 This option changes the ABI for some vector type values with regard to
21531 alignment and calling conventions. In case vector type values are
21532 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
21533 command will be added to mark the resulting binary with the ABI used.
21534 @option{-mvx} is enabled by default when using @option{-march=z13}.
21535
21536 @item -mzvector
21537 @itemx -mno-zvector
21538 @opindex mzvector
21539 @opindex mno-zvector
21540 The @option{-mzvector} option enables vector language extensions and
21541 builtins using instructions available with the vector extension
21542 facility introduced with the IBM z13 machine generation.
21543 This option adds support for @samp{vector} to be used as a keyword to
21544 define vector type variables and arguments. @samp{vector} is only
21545 available when GNU extensions are enabled. It will not be expanded
21546 when requesting strict standard compliance e.g. with @option{-std=c99}.
21547 In addition to the GCC low-level builtins @option{-mzvector} enables
21548 a set of builtins added for compatibility with AltiVec-style
21549 implementations like Power and Cell. In order to make use of these
21550 builtins the header file @file{vecintrin.h} needs to be included.
21551 @option{-mzvector} is disabled by default.
21552
21553 @item -mmvcle
21554 @itemx -mno-mvcle
21555 @opindex mmvcle
21556 @opindex mno-mvcle
21557 Generate (or do not generate) code using the @code{mvcle} instruction
21558 to perform block moves. When @option{-mno-mvcle} is specified,
21559 use a @code{mvc} loop instead. This is the default unless optimizing for
21560 size.
21561
21562 @item -mdebug
21563 @itemx -mno-debug
21564 @opindex mdebug
21565 @opindex mno-debug
21566 Print (or do not print) additional debug information when compiling.
21567 The default is to not print debug information.
21568
21569 @item -march=@var{cpu-type}
21570 @opindex march
21571 Generate code that runs on @var{cpu-type}, which is the name of a
21572 system representing a certain processor type. Possible values for
21573 @var{cpu-type} are @samp{z900}, @samp{z990}, @samp{z9-109},
21574 @samp{z9-ec}, @samp{z10}, @samp{z196}, @samp{zEC12}, and @samp{z13}.
21575 The default is @option{-march=z900}. @samp{g5} and @samp{g6} are
21576 deprecated and will be removed with future releases.
21577
21578 @item -mtune=@var{cpu-type}
21579 @opindex mtune
21580 Tune to @var{cpu-type} everything applicable about the generated code,
21581 except for the ABI and the set of available instructions.
21582 The list of @var{cpu-type} values is the same as for @option{-march}.
21583 The default is the value used for @option{-march}.
21584
21585 @item -mtpf-trace
21586 @itemx -mno-tpf-trace
21587 @opindex mtpf-trace
21588 @opindex mno-tpf-trace
21589 Generate code that adds (does not add) in TPF OS specific branches to trace
21590 routines in the operating system. This option is off by default, even
21591 when compiling for the TPF OS@.
21592
21593 @item -mfused-madd
21594 @itemx -mno-fused-madd
21595 @opindex mfused-madd
21596 @opindex mno-fused-madd
21597 Generate code that uses (does not use) the floating-point multiply and
21598 accumulate instructions. These instructions are generated by default if
21599 hardware floating point is used.
21600
21601 @item -mwarn-framesize=@var{framesize}
21602 @opindex mwarn-framesize
21603 Emit a warning if the current function exceeds the given frame size. Because
21604 this is a compile-time check it doesn't need to be a real problem when the program
21605 runs. It is intended to identify functions that most probably cause
21606 a stack overflow. It is useful to be used in an environment with limited stack
21607 size e.g.@: the linux kernel.
21608
21609 @item -mwarn-dynamicstack
21610 @opindex mwarn-dynamicstack
21611 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
21612 arrays. This is generally a bad idea with a limited stack size.
21613
21614 @item -mstack-guard=@var{stack-guard}
21615 @itemx -mstack-size=@var{stack-size}
21616 @opindex mstack-guard
21617 @opindex mstack-size
21618 If these options are provided the S/390 back end emits additional instructions in
21619 the function prologue that trigger a trap if the stack size is @var{stack-guard}
21620 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
21621 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
21622 the frame size of the compiled function is chosen.
21623 These options are intended to be used to help debugging stack overflow problems.
21624 The additionally emitted code causes only little overhead and hence can also be
21625 used in production-like systems without greater performance degradation. The given
21626 values have to be exact powers of 2 and @var{stack-size} has to be greater than
21627 @var{stack-guard} without exceeding 64k.
21628 In order to be efficient the extra code makes the assumption that the stack starts
21629 at an address aligned to the value given by @var{stack-size}.
21630 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
21631
21632 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
21633 @opindex mhotpatch
21634 If the hotpatch option is enabled, a ``hot-patching'' function
21635 prologue is generated for all functions in the compilation unit.
21636 The funtion label is prepended with the given number of two-byte
21637 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
21638 the label, 2 * @var{post-halfwords} bytes are appended, using the
21639 largest NOP like instructions the architecture allows (maximum
21640 1000000).
21641
21642 If both arguments are zero, hotpatching is disabled.
21643
21644 This option can be overridden for individual functions with the
21645 @code{hotpatch} attribute.
21646 @end table
21647
21648 @node Score Options
21649 @subsection Score Options
21650 @cindex Score Options
21651
21652 These options are defined for Score implementations:
21653
21654 @table @gcctabopt
21655 @item -meb
21656 @opindex meb
21657 Compile code for big-endian mode. This is the default.
21658
21659 @item -mel
21660 @opindex mel
21661 Compile code for little-endian mode.
21662
21663 @item -mnhwloop
21664 @opindex mnhwloop
21665 Disable generation of @code{bcnz} instructions.
21666
21667 @item -muls
21668 @opindex muls
21669 Enable generation of unaligned load and store instructions.
21670
21671 @item -mmac
21672 @opindex mmac
21673 Enable the use of multiply-accumulate instructions. Disabled by default.
21674
21675 @item -mscore5
21676 @opindex mscore5
21677 Specify the SCORE5 as the target architecture.
21678
21679 @item -mscore5u
21680 @opindex mscore5u
21681 Specify the SCORE5U of the target architecture.
21682
21683 @item -mscore7
21684 @opindex mscore7
21685 Specify the SCORE7 as the target architecture. This is the default.
21686
21687 @item -mscore7d
21688 @opindex mscore7d
21689 Specify the SCORE7D as the target architecture.
21690 @end table
21691
21692 @node SH Options
21693 @subsection SH Options
21694
21695 These @samp{-m} options are defined for the SH implementations:
21696
21697 @table @gcctabopt
21698 @item -m1
21699 @opindex m1
21700 Generate code for the SH1.
21701
21702 @item -m2
21703 @opindex m2
21704 Generate code for the SH2.
21705
21706 @item -m2e
21707 Generate code for the SH2e.
21708
21709 @item -m2a-nofpu
21710 @opindex m2a-nofpu
21711 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
21712 that the floating-point unit is not used.
21713
21714 @item -m2a-single-only
21715 @opindex m2a-single-only
21716 Generate code for the SH2a-FPU, in such a way that no double-precision
21717 floating-point operations are used.
21718
21719 @item -m2a-single
21720 @opindex m2a-single
21721 Generate code for the SH2a-FPU assuming the floating-point unit is in
21722 single-precision mode by default.
21723
21724 @item -m2a
21725 @opindex m2a
21726 Generate code for the SH2a-FPU assuming the floating-point unit is in
21727 double-precision mode by default.
21728
21729 @item -m3
21730 @opindex m3
21731 Generate code for the SH3.
21732
21733 @item -m3e
21734 @opindex m3e
21735 Generate code for the SH3e.
21736
21737 @item -m4-nofpu
21738 @opindex m4-nofpu
21739 Generate code for the SH4 without a floating-point unit.
21740
21741 @item -m4-single-only
21742 @opindex m4-single-only
21743 Generate code for the SH4 with a floating-point unit that only
21744 supports single-precision arithmetic.
21745
21746 @item -m4-single
21747 @opindex m4-single
21748 Generate code for the SH4 assuming the floating-point unit is in
21749 single-precision mode by default.
21750
21751 @item -m4
21752 @opindex m4
21753 Generate code for the SH4.
21754
21755 @item -m4-100
21756 @opindex m4-100
21757 Generate code for SH4-100.
21758
21759 @item -m4-100-nofpu
21760 @opindex m4-100-nofpu
21761 Generate code for SH4-100 in such a way that the
21762 floating-point unit is not used.
21763
21764 @item -m4-100-single
21765 @opindex m4-100-single
21766 Generate code for SH4-100 assuming the floating-point unit is in
21767 single-precision mode by default.
21768
21769 @item -m4-100-single-only
21770 @opindex m4-100-single-only
21771 Generate code for SH4-100 in such a way that no double-precision
21772 floating-point operations are used.
21773
21774 @item -m4-200
21775 @opindex m4-200
21776 Generate code for SH4-200.
21777
21778 @item -m4-200-nofpu
21779 @opindex m4-200-nofpu
21780 Generate code for SH4-200 without in such a way that the
21781 floating-point unit is not used.
21782
21783 @item -m4-200-single
21784 @opindex m4-200-single
21785 Generate code for SH4-200 assuming the floating-point unit is in
21786 single-precision mode by default.
21787
21788 @item -m4-200-single-only
21789 @opindex m4-200-single-only
21790 Generate code for SH4-200 in such a way that no double-precision
21791 floating-point operations are used.
21792
21793 @item -m4-300
21794 @opindex m4-300
21795 Generate code for SH4-300.
21796
21797 @item -m4-300-nofpu
21798 @opindex m4-300-nofpu
21799 Generate code for SH4-300 without in such a way that the
21800 floating-point unit is not used.
21801
21802 @item -m4-300-single
21803 @opindex m4-300-single
21804 Generate code for SH4-300 in such a way that no double-precision
21805 floating-point operations are used.
21806
21807 @item -m4-300-single-only
21808 @opindex m4-300-single-only
21809 Generate code for SH4-300 in such a way that no double-precision
21810 floating-point operations are used.
21811
21812 @item -m4-340
21813 @opindex m4-340
21814 Generate code for SH4-340 (no MMU, no FPU).
21815
21816 @item -m4-500
21817 @opindex m4-500
21818 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
21819 assembler.
21820
21821 @item -m4a-nofpu
21822 @opindex m4a-nofpu
21823 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
21824 floating-point unit is not used.
21825
21826 @item -m4a-single-only
21827 @opindex m4a-single-only
21828 Generate code for the SH4a, in such a way that no double-precision
21829 floating-point operations are used.
21830
21831 @item -m4a-single
21832 @opindex m4a-single
21833 Generate code for the SH4a assuming the floating-point unit is in
21834 single-precision mode by default.
21835
21836 @item -m4a
21837 @opindex m4a
21838 Generate code for the SH4a.
21839
21840 @item -m4al
21841 @opindex m4al
21842 Same as @option{-m4a-nofpu}, except that it implicitly passes
21843 @option{-dsp} to the assembler. GCC doesn't generate any DSP
21844 instructions at the moment.
21845
21846 @item -mb
21847 @opindex mb
21848 Compile code for the processor in big-endian mode.
21849
21850 @item -ml
21851 @opindex ml
21852 Compile code for the processor in little-endian mode.
21853
21854 @item -mdalign
21855 @opindex mdalign
21856 Align doubles at 64-bit boundaries. Note that this changes the calling
21857 conventions, and thus some functions from the standard C library do
21858 not work unless you recompile it first with @option{-mdalign}.
21859
21860 @item -mrelax
21861 @opindex mrelax
21862 Shorten some address references at link time, when possible; uses the
21863 linker option @option{-relax}.
21864
21865 @item -mbigtable
21866 @opindex mbigtable
21867 Use 32-bit offsets in @code{switch} tables. The default is to use
21868 16-bit offsets.
21869
21870 @item -mbitops
21871 @opindex mbitops
21872 Enable the use of bit manipulation instructions on SH2A.
21873
21874 @item -mfmovd
21875 @opindex mfmovd
21876 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
21877 alignment constraints.
21878
21879 @item -mrenesas
21880 @opindex mrenesas
21881 Comply with the calling conventions defined by Renesas.
21882
21883 @item -mno-renesas
21884 @opindex mno-renesas
21885 Comply with the calling conventions defined for GCC before the Renesas
21886 conventions were available. This option is the default for all
21887 targets of the SH toolchain.
21888
21889 @item -mnomacsave
21890 @opindex mnomacsave
21891 Mark the @code{MAC} register as call-clobbered, even if
21892 @option{-mrenesas} is given.
21893
21894 @item -mieee
21895 @itemx -mno-ieee
21896 @opindex mieee
21897 @opindex mno-ieee
21898 Control the IEEE compliance of floating-point comparisons, which affects the
21899 handling of cases where the result of a comparison is unordered. By default
21900 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
21901 enabled @option{-mno-ieee} is implicitly set, which results in faster
21902 floating-point greater-equal and less-equal comparisons. The implicit settings
21903 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
21904
21905 @item -minline-ic_invalidate
21906 @opindex minline-ic_invalidate
21907 Inline code to invalidate instruction cache entries after setting up
21908 nested function trampolines.
21909 This option has no effect if @option{-musermode} is in effect and the selected
21910 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
21911 instruction.
21912 If the selected code generation option does not allow the use of the @code{icbi}
21913 instruction, and @option{-musermode} is not in effect, the inlined code
21914 manipulates the instruction cache address array directly with an associative
21915 write. This not only requires privileged mode at run time, but it also
21916 fails if the cache line had been mapped via the TLB and has become unmapped.
21917
21918 @item -misize
21919 @opindex misize
21920 Dump instruction size and location in the assembly code.
21921
21922 @item -mpadstruct
21923 @opindex mpadstruct
21924 This option is deprecated. It pads structures to multiple of 4 bytes,
21925 which is incompatible with the SH ABI@.
21926
21927 @item -matomic-model=@var{model}
21928 @opindex matomic-model=@var{model}
21929 Sets the model of atomic operations and additional parameters as a comma
21930 separated list. For details on the atomic built-in functions see
21931 @ref{__atomic Builtins}. The following models and parameters are supported:
21932
21933 @table @samp
21934
21935 @item none
21936 Disable compiler generated atomic sequences and emit library calls for atomic
21937 operations. This is the default if the target is not @code{sh*-*-linux*}.
21938
21939 @item soft-gusa
21940 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
21941 built-in functions. The generated atomic sequences require additional support
21942 from the interrupt/exception handling code of the system and are only suitable
21943 for SH3* and SH4* single-core systems. This option is enabled by default when
21944 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
21945 this option also partially utilizes the hardware atomic instructions
21946 @code{movli.l} and @code{movco.l} to create more efficient code, unless
21947 @samp{strict} is specified.
21948
21949 @item soft-tcb
21950 Generate software atomic sequences that use a variable in the thread control
21951 block. This is a variation of the gUSA sequences which can also be used on
21952 SH1* and SH2* targets. The generated atomic sequences require additional
21953 support from the interrupt/exception handling code of the system and are only
21954 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
21955 parameter has to be specified as well.
21956
21957 @item soft-imask
21958 Generate software atomic sequences that temporarily disable interrupts by
21959 setting @code{SR.IMASK = 1111}. This model works only when the program runs
21960 in privileged mode and is only suitable for single-core systems. Additional
21961 support from the interrupt/exception handling code of the system is not
21962 required. This model is enabled by default when the target is
21963 @code{sh*-*-linux*} and SH1* or SH2*.
21964
21965 @item hard-llcs
21966 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
21967 instructions only. This is only available on SH4A and is suitable for
21968 multi-core systems. Since the hardware instructions support only 32 bit atomic
21969 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
21970 Code compiled with this option is also compatible with other software
21971 atomic model interrupt/exception handling systems if executed on an SH4A
21972 system. Additional support from the interrupt/exception handling code of the
21973 system is not required for this model.
21974
21975 @item gbr-offset=
21976 This parameter specifies the offset in bytes of the variable in the thread
21977 control block structure that should be used by the generated atomic sequences
21978 when the @samp{soft-tcb} model has been selected. For other models this
21979 parameter is ignored. The specified value must be an integer multiple of four
21980 and in the range 0-1020.
21981
21982 @item strict
21983 This parameter prevents mixed usage of multiple atomic models, even if they
21984 are compatible, and makes the compiler generate atomic sequences of the
21985 specified model only.
21986
21987 @end table
21988
21989 @item -mtas
21990 @opindex mtas
21991 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
21992 Notice that depending on the particular hardware and software configuration
21993 this can degrade overall performance due to the operand cache line flushes
21994 that are implied by the @code{tas.b} instruction. On multi-core SH4A
21995 processors the @code{tas.b} instruction must be used with caution since it
21996 can result in data corruption for certain cache configurations.
21997
21998 @item -mprefergot
21999 @opindex mprefergot
22000 When generating position-independent code, emit function calls using
22001 the Global Offset Table instead of the Procedure Linkage Table.
22002
22003 @item -musermode
22004 @itemx -mno-usermode
22005 @opindex musermode
22006 @opindex mno-usermode
22007 Don't allow (allow) the compiler generating privileged mode code. Specifying
22008 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
22009 inlined code would not work in user mode. @option{-musermode} is the default
22010 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
22011 @option{-musermode} has no effect, since there is no user mode.
22012
22013 @item -multcost=@var{number}
22014 @opindex multcost=@var{number}
22015 Set the cost to assume for a multiply insn.
22016
22017 @item -mdiv=@var{strategy}
22018 @opindex mdiv=@var{strategy}
22019 Set the division strategy to be used for integer division operations.
22020 @var{strategy} can be one of:
22021
22022 @table @samp
22023
22024 @item call-div1
22025 Calls a library function that uses the single-step division instruction
22026 @code{div1} to perform the operation. Division by zero calculates an
22027 unspecified result and does not trap. This is the default except for SH4,
22028 SH2A and SHcompact.
22029
22030 @item call-fp
22031 Calls a library function that performs the operation in double precision
22032 floating point. Division by zero causes a floating-point exception. This is
22033 the default for SHcompact with FPU. Specifying this for targets that do not
22034 have a double precision FPU defaults to @code{call-div1}.
22035
22036 @item call-table
22037 Calls a library function that uses a lookup table for small divisors and
22038 the @code{div1} instruction with case distinction for larger divisors. Division
22039 by zero calculates an unspecified result and does not trap. This is the default
22040 for SH4. Specifying this for targets that do not have dynamic shift
22041 instructions defaults to @code{call-div1}.
22042
22043 @end table
22044
22045 When a division strategy has not been specified the default strategy is
22046 selected based on the current target. For SH2A the default strategy is to
22047 use the @code{divs} and @code{divu} instructions instead of library function
22048 calls.
22049
22050 @item -maccumulate-outgoing-args
22051 @opindex maccumulate-outgoing-args
22052 Reserve space once for outgoing arguments in the function prologue rather
22053 than around each call. Generally beneficial for performance and size. Also
22054 needed for unwinding to avoid changing the stack frame around conditional code.
22055
22056 @item -mdivsi3_libfunc=@var{name}
22057 @opindex mdivsi3_libfunc=@var{name}
22058 Set the name of the library function used for 32-bit signed division to
22059 @var{name}.
22060 This only affects the name used in the @samp{call} division strategies, and
22061 the compiler still expects the same sets of input/output/clobbered registers as
22062 if this option were not present.
22063
22064 @item -mfixed-range=@var{register-range}
22065 @opindex mfixed-range
22066 Generate code treating the given register range as fixed registers.
22067 A fixed register is one that the register allocator can not use. This is
22068 useful when compiling kernel code. A register range is specified as
22069 two registers separated by a dash. Multiple register ranges can be
22070 specified separated by a comma.
22071
22072 @item -mbranch-cost=@var{num}
22073 @opindex mbranch-cost=@var{num}
22074 Assume @var{num} to be the cost for a branch instruction. Higher numbers
22075 make the compiler try to generate more branch-free code if possible.
22076 If not specified the value is selected depending on the processor type that
22077 is being compiled for.
22078
22079 @item -mzdcbranch
22080 @itemx -mno-zdcbranch
22081 @opindex mzdcbranch
22082 @opindex mno-zdcbranch
22083 Assume (do not assume) that zero displacement conditional branch instructions
22084 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
22085 compiler prefers zero displacement branch code sequences. This is
22086 enabled by default when generating code for SH4 and SH4A. It can be explicitly
22087 disabled by specifying @option{-mno-zdcbranch}.
22088
22089 @item -mcbranch-force-delay-slot
22090 @opindex mcbranch-force-delay-slot
22091 Force the usage of delay slots for conditional branches, which stuffs the delay
22092 slot with a @code{nop} if a suitable instruction can't be found. By default
22093 this option is disabled. It can be enabled to work around hardware bugs as
22094 found in the original SH7055.
22095
22096 @item -mfused-madd
22097 @itemx -mno-fused-madd
22098 @opindex mfused-madd
22099 @opindex mno-fused-madd
22100 Generate code that uses (does not use) the floating-point multiply and
22101 accumulate instructions. These instructions are generated by default
22102 if hardware floating point is used. The machine-dependent
22103 @option{-mfused-madd} option is now mapped to the machine-independent
22104 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22105 mapped to @option{-ffp-contract=off}.
22106
22107 @item -mfsca
22108 @itemx -mno-fsca
22109 @opindex mfsca
22110 @opindex mno-fsca
22111 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
22112 and cosine approximations. The option @option{-mfsca} must be used in
22113 combination with @option{-funsafe-math-optimizations}. It is enabled by default
22114 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
22115 approximations even if @option{-funsafe-math-optimizations} is in effect.
22116
22117 @item -mfsrra
22118 @itemx -mno-fsrra
22119 @opindex mfsrra
22120 @opindex mno-fsrra
22121 Allow or disallow the compiler to emit the @code{fsrra} instruction for
22122 reciprocal square root approximations. The option @option{-mfsrra} must be used
22123 in combination with @option{-funsafe-math-optimizations} and
22124 @option{-ffinite-math-only}. It is enabled by default when generating code for
22125 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
22126 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
22127 in effect.
22128
22129 @item -mpretend-cmove
22130 @opindex mpretend-cmove
22131 Prefer zero-displacement conditional branches for conditional move instruction
22132 patterns. This can result in faster code on the SH4 processor.
22133
22134 @item -mfdpic
22135 @opindex fdpic
22136 Generate code using the FDPIC ABI.
22137
22138 @end table
22139
22140 @node Solaris 2 Options
22141 @subsection Solaris 2 Options
22142 @cindex Solaris 2 options
22143
22144 These @samp{-m} options are supported on Solaris 2:
22145
22146 @table @gcctabopt
22147 @item -mclear-hwcap
22148 @opindex mclear-hwcap
22149 @option{-mclear-hwcap} tells the compiler to remove the hardware
22150 capabilities generated by the Solaris assembler. This is only necessary
22151 when object files use ISA extensions not supported by the current
22152 machine, but check at runtime whether or not to use them.
22153
22154 @item -mimpure-text
22155 @opindex mimpure-text
22156 @option{-mimpure-text}, used in addition to @option{-shared}, tells
22157 the compiler to not pass @option{-z text} to the linker when linking a
22158 shared object. Using this option, you can link position-dependent
22159 code into a shared object.
22160
22161 @option{-mimpure-text} suppresses the ``relocations remain against
22162 allocatable but non-writable sections'' linker error message.
22163 However, the necessary relocations trigger copy-on-write, and the
22164 shared object is not actually shared across processes. Instead of
22165 using @option{-mimpure-text}, you should compile all source code with
22166 @option{-fpic} or @option{-fPIC}.
22167
22168 @end table
22169
22170 These switches are supported in addition to the above on Solaris 2:
22171
22172 @table @gcctabopt
22173 @item -pthreads
22174 @opindex pthreads
22175 Add support for multithreading using the POSIX threads library. This
22176 option sets flags for both the preprocessor and linker. This option does
22177 not affect the thread safety of object code produced by the compiler or
22178 that of libraries supplied with it.
22179
22180 @item -pthread
22181 @opindex pthread
22182 This is a synonym for @option{-pthreads}.
22183 @end table
22184
22185 @node SPARC Options
22186 @subsection SPARC Options
22187 @cindex SPARC options
22188
22189 These @samp{-m} options are supported on the SPARC:
22190
22191 @table @gcctabopt
22192 @item -mno-app-regs
22193 @itemx -mapp-regs
22194 @opindex mno-app-regs
22195 @opindex mapp-regs
22196 Specify @option{-mapp-regs} to generate output using the global registers
22197 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
22198 global register 1, each global register 2 through 4 is then treated as an
22199 allocable register that is clobbered by function calls. This is the default.
22200
22201 To be fully SVR4 ABI-compliant at the cost of some performance loss,
22202 specify @option{-mno-app-regs}. You should compile libraries and system
22203 software with this option.
22204
22205 @item -mflat
22206 @itemx -mno-flat
22207 @opindex mflat
22208 @opindex mno-flat
22209 With @option{-mflat}, the compiler does not generate save/restore instructions
22210 and uses a ``flat'' or single register window model. This model is compatible
22211 with the regular register window model. The local registers and the input
22212 registers (0--5) are still treated as ``call-saved'' registers and are
22213 saved on the stack as needed.
22214
22215 With @option{-mno-flat} (the default), the compiler generates save/restore
22216 instructions (except for leaf functions). This is the normal operating mode.
22217
22218 @item -mfpu
22219 @itemx -mhard-float
22220 @opindex mfpu
22221 @opindex mhard-float
22222 Generate output containing floating-point instructions. This is the
22223 default.
22224
22225 @item -mno-fpu
22226 @itemx -msoft-float
22227 @opindex mno-fpu
22228 @opindex msoft-float
22229 Generate output containing library calls for floating point.
22230 @strong{Warning:} the requisite libraries are not available for all SPARC
22231 targets. Normally the facilities of the machine's usual C compiler are
22232 used, but this cannot be done directly in cross-compilation. You must make
22233 your own arrangements to provide suitable library functions for
22234 cross-compilation. The embedded targets @samp{sparc-*-aout} and
22235 @samp{sparclite-*-*} do provide software floating-point support.
22236
22237 @option{-msoft-float} changes the calling convention in the output file;
22238 therefore, it is only useful if you compile @emph{all} of a program with
22239 this option. In particular, you need to compile @file{libgcc.a}, the
22240 library that comes with GCC, with @option{-msoft-float} in order for
22241 this to work.
22242
22243 @item -mhard-quad-float
22244 @opindex mhard-quad-float
22245 Generate output containing quad-word (long double) floating-point
22246 instructions.
22247
22248 @item -msoft-quad-float
22249 @opindex msoft-quad-float
22250 Generate output containing library calls for quad-word (long double)
22251 floating-point instructions. The functions called are those specified
22252 in the SPARC ABI@. This is the default.
22253
22254 As of this writing, there are no SPARC implementations that have hardware
22255 support for the quad-word floating-point instructions. They all invoke
22256 a trap handler for one of these instructions, and then the trap handler
22257 emulates the effect of the instruction. Because of the trap handler overhead,
22258 this is much slower than calling the ABI library routines. Thus the
22259 @option{-msoft-quad-float} option is the default.
22260
22261 @item -mno-unaligned-doubles
22262 @itemx -munaligned-doubles
22263 @opindex mno-unaligned-doubles
22264 @opindex munaligned-doubles
22265 Assume that doubles have 8-byte alignment. This is the default.
22266
22267 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
22268 alignment only if they are contained in another type, or if they have an
22269 absolute address. Otherwise, it assumes they have 4-byte alignment.
22270 Specifying this option avoids some rare compatibility problems with code
22271 generated by other compilers. It is not the default because it results
22272 in a performance loss, especially for floating-point code.
22273
22274 @item -muser-mode
22275 @itemx -mno-user-mode
22276 @opindex muser-mode
22277 @opindex mno-user-mode
22278 Do not generate code that can only run in supervisor mode. This is relevant
22279 only for the @code{casa} instruction emitted for the LEON3 processor. This
22280 is the default.
22281
22282 @item -mfaster-structs
22283 @itemx -mno-faster-structs
22284 @opindex mfaster-structs
22285 @opindex mno-faster-structs
22286 With @option{-mfaster-structs}, the compiler assumes that structures
22287 should have 8-byte alignment. This enables the use of pairs of
22288 @code{ldd} and @code{std} instructions for copies in structure
22289 assignment, in place of twice as many @code{ld} and @code{st} pairs.
22290 However, the use of this changed alignment directly violates the SPARC
22291 ABI@. Thus, it's intended only for use on targets where the developer
22292 acknowledges that their resulting code is not directly in line with
22293 the rules of the ABI@.
22294
22295 @item -mstd-struct-return
22296 @itemx -mno-std-struct-return
22297 @opindex mstd-struct-return
22298 @opindex mno-std-struct-return
22299 With @option{-mstd-struct-return}, the compiler generates checking code
22300 in functions returning structures or unions to detect size mismatches
22301 between the two sides of function calls, as per the 32-bit ABI@.
22302
22303 The default is @option{-mno-std-struct-return}. This option has no effect
22304 in 64-bit mode.
22305
22306 @item -mcpu=@var{cpu_type}
22307 @opindex mcpu
22308 Set the instruction set, register set, and instruction scheduling parameters
22309 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22310 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
22311 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
22312 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
22313 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
22314 @samp{niagara3}, @samp{niagara4} and @samp{niagara7}.
22315
22316 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
22317 which selects the best architecture option for the host processor.
22318 @option{-mcpu=native} has no effect if GCC does not recognize
22319 the processor.
22320
22321 Default instruction scheduling parameters are used for values that select
22322 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
22323 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
22324
22325 Here is a list of each supported architecture and their supported
22326 implementations.
22327
22328 @table @asis
22329 @item v7
22330 cypress, leon3v7
22331
22332 @item v8
22333 supersparc, hypersparc, leon, leon3
22334
22335 @item sparclite
22336 f930, f934, sparclite86x
22337
22338 @item sparclet
22339 tsc701
22340
22341 @item v9
22342 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7
22343 @end table
22344
22345 By default (unless configured otherwise), GCC generates code for the V7
22346 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
22347 additionally optimizes it for the Cypress CY7C602 chip, as used in the
22348 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
22349 SPARCStation 1, 2, IPX etc.
22350
22351 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
22352 architecture. The only difference from V7 code is that the compiler emits
22353 the integer multiply and integer divide instructions which exist in SPARC-V8
22354 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
22355 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
22356 2000 series.
22357
22358 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
22359 the SPARC architecture. This adds the integer multiply, integer divide step
22360 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
22361 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
22362 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
22363 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
22364 MB86934 chip, which is the more recent SPARClite with FPU@.
22365
22366 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
22367 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
22368 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
22369 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
22370 optimizes it for the TEMIC SPARClet chip.
22371
22372 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
22373 architecture. This adds 64-bit integer and floating-point move instructions,
22374 3 additional floating-point condition code registers and conditional move
22375 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
22376 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
22377 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
22378 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
22379 @option{-mcpu=niagara}, the compiler additionally optimizes it for
22380 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
22381 additionally optimizes it for Sun UltraSPARC T2 chips. With
22382 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
22383 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
22384 additionally optimizes it for Sun UltraSPARC T4 chips. With
22385 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
22386 Oracle SPARC M7 chips.
22387
22388 @item -mtune=@var{cpu_type}
22389 @opindex mtune
22390 Set the instruction scheduling parameters for machine type
22391 @var{cpu_type}, but do not set the instruction set or register set that the
22392 option @option{-mcpu=@var{cpu_type}} does.
22393
22394 The same values for @option{-mcpu=@var{cpu_type}} can be used for
22395 @option{-mtune=@var{cpu_type}}, but the only useful values are those
22396 that select a particular CPU implementation. Those are
22397 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
22398 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
22399 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
22400 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
22401 @samp{niagara4} and @samp{niagara7}. With native Solaris and
22402 GNU/Linux toolchains, @samp{native} can also be used.
22403
22404 @item -mv8plus
22405 @itemx -mno-v8plus
22406 @opindex mv8plus
22407 @opindex mno-v8plus
22408 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
22409 difference from the V8 ABI is that the global and out registers are
22410 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
22411 mode for all SPARC-V9 processors.
22412
22413 @item -mvis
22414 @itemx -mno-vis
22415 @opindex mvis
22416 @opindex mno-vis
22417 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
22418 Visual Instruction Set extensions. The default is @option{-mno-vis}.
22419
22420 @item -mvis2
22421 @itemx -mno-vis2
22422 @opindex mvis2
22423 @opindex mno-vis2
22424 With @option{-mvis2}, GCC generates code that takes advantage of
22425 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
22426 default is @option{-mvis2} when targeting a cpu that supports such
22427 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
22428 also sets @option{-mvis}.
22429
22430 @item -mvis3
22431 @itemx -mno-vis3
22432 @opindex mvis3
22433 @opindex mno-vis3
22434 With @option{-mvis3}, GCC generates code that takes advantage of
22435 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
22436 default is @option{-mvis3} when targeting a cpu that supports such
22437 instructions, such as niagara-3 and later. Setting @option{-mvis3}
22438 also sets @option{-mvis2} and @option{-mvis}.
22439
22440 @item -mvis4
22441 @itemx -mno-vis4
22442 @opindex mvis4
22443 @opindex mno-vis4
22444 With @option{-mvis4}, GCC generates code that takes advantage of
22445 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
22446 default is @option{-mvis4} when targeting a cpu that supports such
22447 instructions, such as niagara-7 and later. Setting @option{-mvis4}
22448 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
22449
22450 @item -mcbcond
22451 @itemx -mno-cbcond
22452 @opindex mcbcond
22453 @opindex mno-cbcond
22454 With @option{-mcbcond}, GCC generates code that takes advantage of
22455 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
22456 The default is @option{-mcbcond} when targeting a cpu that supports such
22457 instructions, such as niagara-4 and later.
22458
22459 @item -mpopc
22460 @itemx -mno-popc
22461 @opindex mpopc
22462 @opindex mno-popc
22463 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
22464 population count instruction. The default is @option{-mpopc}
22465 when targeting a cpu that supports such instructions, such as Niagara-2 and
22466 later.
22467
22468 @item -mfmaf
22469 @itemx -mno-fmaf
22470 @opindex mfmaf
22471 @opindex mno-fmaf
22472 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
22473 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
22474 when targeting a cpu that supports such instructions, such as Niagara-3 and
22475 later.
22476
22477 @item -mfix-at697f
22478 @opindex mfix-at697f
22479 Enable the documented workaround for the single erratum of the Atmel AT697F
22480 processor (which corresponds to erratum #13 of the AT697E processor).
22481
22482 @item -mfix-ut699
22483 @opindex mfix-ut699
22484 Enable the documented workarounds for the floating-point errata and the data
22485 cache nullify errata of the UT699 processor.
22486 @end table
22487
22488 These @samp{-m} options are supported in addition to the above
22489 on SPARC-V9 processors in 64-bit environments:
22490
22491 @table @gcctabopt
22492 @item -m32
22493 @itemx -m64
22494 @opindex m32
22495 @opindex m64
22496 Generate code for a 32-bit or 64-bit environment.
22497 The 32-bit environment sets int, long and pointer to 32 bits.
22498 The 64-bit environment sets int to 32 bits and long and pointer
22499 to 64 bits.
22500
22501 @item -mcmodel=@var{which}
22502 @opindex mcmodel
22503 Set the code model to one of
22504
22505 @table @samp
22506 @item medlow
22507 The Medium/Low code model: 64-bit addresses, programs
22508 must be linked in the low 32 bits of memory. Programs can be statically
22509 or dynamically linked.
22510
22511 @item medmid
22512 The Medium/Middle code model: 64-bit addresses, programs
22513 must be linked in the low 44 bits of memory, the text and data segments must
22514 be less than 2GB in size and the data segment must be located within 2GB of
22515 the text segment.
22516
22517 @item medany
22518 The Medium/Anywhere code model: 64-bit addresses, programs
22519 may be linked anywhere in memory, the text and data segments must be less
22520 than 2GB in size and the data segment must be located within 2GB of the
22521 text segment.
22522
22523 @item embmedany
22524 The Medium/Anywhere code model for embedded systems:
22525 64-bit addresses, the text and data segments must be less than 2GB in
22526 size, both starting anywhere in memory (determined at link time). The
22527 global register %g4 points to the base of the data segment. Programs
22528 are statically linked and PIC is not supported.
22529 @end table
22530
22531 @item -mmemory-model=@var{mem-model}
22532 @opindex mmemory-model
22533 Set the memory model in force on the processor to one of
22534
22535 @table @samp
22536 @item default
22537 The default memory model for the processor and operating system.
22538
22539 @item rmo
22540 Relaxed Memory Order
22541
22542 @item pso
22543 Partial Store Order
22544
22545 @item tso
22546 Total Store Order
22547
22548 @item sc
22549 Sequential Consistency
22550 @end table
22551
22552 These memory models are formally defined in Appendix D of the Sparc V9
22553 architecture manual, as set in the processor's @code{PSTATE.MM} field.
22554
22555 @item -mstack-bias
22556 @itemx -mno-stack-bias
22557 @opindex mstack-bias
22558 @opindex mno-stack-bias
22559 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
22560 frame pointer if present, are offset by @minus{}2047 which must be added back
22561 when making stack frame references. This is the default in 64-bit mode.
22562 Otherwise, assume no such offset is present.
22563 @end table
22564
22565 @node SPU Options
22566 @subsection SPU Options
22567 @cindex SPU options
22568
22569 These @samp{-m} options are supported on the SPU:
22570
22571 @table @gcctabopt
22572 @item -mwarn-reloc
22573 @itemx -merror-reloc
22574 @opindex mwarn-reloc
22575 @opindex merror-reloc
22576
22577 The loader for SPU does not handle dynamic relocations. By default, GCC
22578 gives an error when it generates code that requires a dynamic
22579 relocation. @option{-mno-error-reloc} disables the error,
22580 @option{-mwarn-reloc} generates a warning instead.
22581
22582 @item -msafe-dma
22583 @itemx -munsafe-dma
22584 @opindex msafe-dma
22585 @opindex munsafe-dma
22586
22587 Instructions that initiate or test completion of DMA must not be
22588 reordered with respect to loads and stores of the memory that is being
22589 accessed.
22590 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
22591 memory accesses, but that can lead to inefficient code in places where the
22592 memory is known to not change. Rather than mark the memory as volatile,
22593 you can use @option{-msafe-dma} to tell the compiler to treat
22594 the DMA instructions as potentially affecting all memory.
22595
22596 @item -mbranch-hints
22597 @opindex mbranch-hints
22598
22599 By default, GCC generates a branch hint instruction to avoid
22600 pipeline stalls for always-taken or probably-taken branches. A hint
22601 is not generated closer than 8 instructions away from its branch.
22602 There is little reason to disable them, except for debugging purposes,
22603 or to make an object a little bit smaller.
22604
22605 @item -msmall-mem
22606 @itemx -mlarge-mem
22607 @opindex msmall-mem
22608 @opindex mlarge-mem
22609
22610 By default, GCC generates code assuming that addresses are never larger
22611 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
22612 a full 32-bit address.
22613
22614 @item -mstdmain
22615 @opindex mstdmain
22616
22617 By default, GCC links against startup code that assumes the SPU-style
22618 main function interface (which has an unconventional parameter list).
22619 With @option{-mstdmain}, GCC links your program against startup
22620 code that assumes a C99-style interface to @code{main}, including a
22621 local copy of @code{argv} strings.
22622
22623 @item -mfixed-range=@var{register-range}
22624 @opindex mfixed-range
22625 Generate code treating the given register range as fixed registers.
22626 A fixed register is one that the register allocator cannot use. This is
22627 useful when compiling kernel code. A register range is specified as
22628 two registers separated by a dash. Multiple register ranges can be
22629 specified separated by a comma.
22630
22631 @item -mea32
22632 @itemx -mea64
22633 @opindex mea32
22634 @opindex mea64
22635 Compile code assuming that pointers to the PPU address space accessed
22636 via the @code{__ea} named address space qualifier are either 32 or 64
22637 bits wide. The default is 32 bits. As this is an ABI-changing option,
22638 all object code in an executable must be compiled with the same setting.
22639
22640 @item -maddress-space-conversion
22641 @itemx -mno-address-space-conversion
22642 @opindex maddress-space-conversion
22643 @opindex mno-address-space-conversion
22644 Allow/disallow treating the @code{__ea} address space as superset
22645 of the generic address space. This enables explicit type casts
22646 between @code{__ea} and generic pointer as well as implicit
22647 conversions of generic pointers to @code{__ea} pointers. The
22648 default is to allow address space pointer conversions.
22649
22650 @item -mcache-size=@var{cache-size}
22651 @opindex mcache-size
22652 This option controls the version of libgcc that the compiler links to an
22653 executable and selects a software-managed cache for accessing variables
22654 in the @code{__ea} address space with a particular cache size. Possible
22655 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
22656 and @samp{128}. The default cache size is 64KB.
22657
22658 @item -matomic-updates
22659 @itemx -mno-atomic-updates
22660 @opindex matomic-updates
22661 @opindex mno-atomic-updates
22662 This option controls the version of libgcc that the compiler links to an
22663 executable and selects whether atomic updates to the software-managed
22664 cache of PPU-side variables are used. If you use atomic updates, changes
22665 to a PPU variable from SPU code using the @code{__ea} named address space
22666 qualifier do not interfere with changes to other PPU variables residing
22667 in the same cache line from PPU code. If you do not use atomic updates,
22668 such interference may occur; however, writing back cache lines is
22669 more efficient. The default behavior is to use atomic updates.
22670
22671 @item -mdual-nops
22672 @itemx -mdual-nops=@var{n}
22673 @opindex mdual-nops
22674 By default, GCC inserts nops to increase dual issue when it expects
22675 it to increase performance. @var{n} can be a value from 0 to 10. A
22676 smaller @var{n} inserts fewer nops. 10 is the default, 0 is the
22677 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
22678
22679 @item -mhint-max-nops=@var{n}
22680 @opindex mhint-max-nops
22681 Maximum number of nops to insert for a branch hint. A branch hint must
22682 be at least 8 instructions away from the branch it is affecting. GCC
22683 inserts up to @var{n} nops to enforce this, otherwise it does not
22684 generate the branch hint.
22685
22686 @item -mhint-max-distance=@var{n}
22687 @opindex mhint-max-distance
22688 The encoding of the branch hint instruction limits the hint to be within
22689 256 instructions of the branch it is affecting. By default, GCC makes
22690 sure it is within 125.
22691
22692 @item -msafe-hints
22693 @opindex msafe-hints
22694 Work around a hardware bug that causes the SPU to stall indefinitely.
22695 By default, GCC inserts the @code{hbrp} instruction to make sure
22696 this stall won't happen.
22697
22698 @end table
22699
22700 @node System V Options
22701 @subsection Options for System V
22702
22703 These additional options are available on System V Release 4 for
22704 compatibility with other compilers on those systems:
22705
22706 @table @gcctabopt
22707 @item -G
22708 @opindex G
22709 Create a shared object.
22710 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
22711
22712 @item -Qy
22713 @opindex Qy
22714 Identify the versions of each tool used by the compiler, in a
22715 @code{.ident} assembler directive in the output.
22716
22717 @item -Qn
22718 @opindex Qn
22719 Refrain from adding @code{.ident} directives to the output file (this is
22720 the default).
22721
22722 @item -YP,@var{dirs}
22723 @opindex YP
22724 Search the directories @var{dirs}, and no others, for libraries
22725 specified with @option{-l}.
22726
22727 @item -Ym,@var{dir}
22728 @opindex Ym
22729 Look in the directory @var{dir} to find the M4 preprocessor.
22730 The assembler uses this option.
22731 @c This is supposed to go with a -Yd for predefined M4 macro files, but
22732 @c the generic assembler that comes with Solaris takes just -Ym.
22733 @end table
22734
22735 @node TILE-Gx Options
22736 @subsection TILE-Gx Options
22737 @cindex TILE-Gx options
22738
22739 These @samp{-m} options are supported on the TILE-Gx:
22740
22741 @table @gcctabopt
22742 @item -mcmodel=small
22743 @opindex mcmodel=small
22744 Generate code for the small model. The distance for direct calls is
22745 limited to 500M in either direction. PC-relative addresses are 32
22746 bits. Absolute addresses support the full address range.
22747
22748 @item -mcmodel=large
22749 @opindex mcmodel=large
22750 Generate code for the large model. There is no limitation on call
22751 distance, pc-relative addresses, or absolute addresses.
22752
22753 @item -mcpu=@var{name}
22754 @opindex mcpu
22755 Selects the type of CPU to be targeted. Currently the only supported
22756 type is @samp{tilegx}.
22757
22758 @item -m32
22759 @itemx -m64
22760 @opindex m32
22761 @opindex m64
22762 Generate code for a 32-bit or 64-bit environment. The 32-bit
22763 environment sets int, long, and pointer to 32 bits. The 64-bit
22764 environment sets int to 32 bits and long and pointer to 64 bits.
22765
22766 @item -mbig-endian
22767 @itemx -mlittle-endian
22768 @opindex mbig-endian
22769 @opindex mlittle-endian
22770 Generate code in big/little endian mode, respectively.
22771 @end table
22772
22773 @node TILEPro Options
22774 @subsection TILEPro Options
22775 @cindex TILEPro options
22776
22777 These @samp{-m} options are supported on the TILEPro:
22778
22779 @table @gcctabopt
22780 @item -mcpu=@var{name}
22781 @opindex mcpu
22782 Selects the type of CPU to be targeted. Currently the only supported
22783 type is @samp{tilepro}.
22784
22785 @item -m32
22786 @opindex m32
22787 Generate code for a 32-bit environment, which sets int, long, and
22788 pointer to 32 bits. This is the only supported behavior so the flag
22789 is essentially ignored.
22790 @end table
22791
22792 @node V850 Options
22793 @subsection V850 Options
22794 @cindex V850 Options
22795
22796 These @samp{-m} options are defined for V850 implementations:
22797
22798 @table @gcctabopt
22799 @item -mlong-calls
22800 @itemx -mno-long-calls
22801 @opindex mlong-calls
22802 @opindex mno-long-calls
22803 Treat all calls as being far away (near). If calls are assumed to be
22804 far away, the compiler always loads the function's address into a
22805 register, and calls indirect through the pointer.
22806
22807 @item -mno-ep
22808 @itemx -mep
22809 @opindex mno-ep
22810 @opindex mep
22811 Do not optimize (do optimize) basic blocks that use the same index
22812 pointer 4 or more times to copy pointer into the @code{ep} register, and
22813 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
22814 option is on by default if you optimize.
22815
22816 @item -mno-prolog-function
22817 @itemx -mprolog-function
22818 @opindex mno-prolog-function
22819 @opindex mprolog-function
22820 Do not use (do use) external functions to save and restore registers
22821 at the prologue and epilogue of a function. The external functions
22822 are slower, but use less code space if more than one function saves
22823 the same number of registers. The @option{-mprolog-function} option
22824 is on by default if you optimize.
22825
22826 @item -mspace
22827 @opindex mspace
22828 Try to make the code as small as possible. At present, this just turns
22829 on the @option{-mep} and @option{-mprolog-function} options.
22830
22831 @item -mtda=@var{n}
22832 @opindex mtda
22833 Put static or global variables whose size is @var{n} bytes or less into
22834 the tiny data area that register @code{ep} points to. The tiny data
22835 area can hold up to 256 bytes in total (128 bytes for byte references).
22836
22837 @item -msda=@var{n}
22838 @opindex msda
22839 Put static or global variables whose size is @var{n} bytes or less into
22840 the small data area that register @code{gp} points to. The small data
22841 area can hold up to 64 kilobytes.
22842
22843 @item -mzda=@var{n}
22844 @opindex mzda
22845 Put static or global variables whose size is @var{n} bytes or less into
22846 the first 32 kilobytes of memory.
22847
22848 @item -mv850
22849 @opindex mv850
22850 Specify that the target processor is the V850.
22851
22852 @item -mv850e3v5
22853 @opindex mv850e3v5
22854 Specify that the target processor is the V850E3V5. The preprocessor
22855 constant @code{__v850e3v5__} is defined if this option is used.
22856
22857 @item -mv850e2v4
22858 @opindex mv850e2v4
22859 Specify that the target processor is the V850E3V5. This is an alias for
22860 the @option{-mv850e3v5} option.
22861
22862 @item -mv850e2v3
22863 @opindex mv850e2v3
22864 Specify that the target processor is the V850E2V3. The preprocessor
22865 constant @code{__v850e2v3__} is defined if this option is used.
22866
22867 @item -mv850e2
22868 @opindex mv850e2
22869 Specify that the target processor is the V850E2. The preprocessor
22870 constant @code{__v850e2__} is defined if this option is used.
22871
22872 @item -mv850e1
22873 @opindex mv850e1
22874 Specify that the target processor is the V850E1. The preprocessor
22875 constants @code{__v850e1__} and @code{__v850e__} are defined if
22876 this option is used.
22877
22878 @item -mv850es
22879 @opindex mv850es
22880 Specify that the target processor is the V850ES. This is an alias for
22881 the @option{-mv850e1} option.
22882
22883 @item -mv850e
22884 @opindex mv850e
22885 Specify that the target processor is the V850E@. The preprocessor
22886 constant @code{__v850e__} is defined if this option is used.
22887
22888 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
22889 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
22890 are defined then a default target processor is chosen and the
22891 relevant @samp{__v850*__} preprocessor constant is defined.
22892
22893 The preprocessor constants @code{__v850} and @code{__v851__} are always
22894 defined, regardless of which processor variant is the target.
22895
22896 @item -mdisable-callt
22897 @itemx -mno-disable-callt
22898 @opindex mdisable-callt
22899 @opindex mno-disable-callt
22900 This option suppresses generation of the @code{CALLT} instruction for the
22901 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
22902 architecture.
22903
22904 This option is enabled by default when the RH850 ABI is
22905 in use (see @option{-mrh850-abi}), and disabled by default when the
22906 GCC ABI is in use. If @code{CALLT} instructions are being generated
22907 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
22908
22909 @item -mrelax
22910 @itemx -mno-relax
22911 @opindex mrelax
22912 @opindex mno-relax
22913 Pass on (or do not pass on) the @option{-mrelax} command-line option
22914 to the assembler.
22915
22916 @item -mlong-jumps
22917 @itemx -mno-long-jumps
22918 @opindex mlong-jumps
22919 @opindex mno-long-jumps
22920 Disable (or re-enable) the generation of PC-relative jump instructions.
22921
22922 @item -msoft-float
22923 @itemx -mhard-float
22924 @opindex msoft-float
22925 @opindex mhard-float
22926 Disable (or re-enable) the generation of hardware floating point
22927 instructions. This option is only significant when the target
22928 architecture is @samp{V850E2V3} or higher. If hardware floating point
22929 instructions are being generated then the C preprocessor symbol
22930 @code{__FPU_OK__} is defined, otherwise the symbol
22931 @code{__NO_FPU__} is defined.
22932
22933 @item -mloop
22934 @opindex mloop
22935 Enables the use of the e3v5 LOOP instruction. The use of this
22936 instruction is not enabled by default when the e3v5 architecture is
22937 selected because its use is still experimental.
22938
22939 @item -mrh850-abi
22940 @itemx -mghs
22941 @opindex mrh850-abi
22942 @opindex mghs
22943 Enables support for the RH850 version of the V850 ABI. This is the
22944 default. With this version of the ABI the following rules apply:
22945
22946 @itemize
22947 @item
22948 Integer sized structures and unions are returned via a memory pointer
22949 rather than a register.
22950
22951 @item
22952 Large structures and unions (more than 8 bytes in size) are passed by
22953 value.
22954
22955 @item
22956 Functions are aligned to 16-bit boundaries.
22957
22958 @item
22959 The @option{-m8byte-align} command-line option is supported.
22960
22961 @item
22962 The @option{-mdisable-callt} command-line option is enabled by
22963 default. The @option{-mno-disable-callt} command-line option is not
22964 supported.
22965 @end itemize
22966
22967 When this version of the ABI is enabled the C preprocessor symbol
22968 @code{__V850_RH850_ABI__} is defined.
22969
22970 @item -mgcc-abi
22971 @opindex mgcc-abi
22972 Enables support for the old GCC version of the V850 ABI. With this
22973 version of the ABI the following rules apply:
22974
22975 @itemize
22976 @item
22977 Integer sized structures and unions are returned in register @code{r10}.
22978
22979 @item
22980 Large structures and unions (more than 8 bytes in size) are passed by
22981 reference.
22982
22983 @item
22984 Functions are aligned to 32-bit boundaries, unless optimizing for
22985 size.
22986
22987 @item
22988 The @option{-m8byte-align} command-line option is not supported.
22989
22990 @item
22991 The @option{-mdisable-callt} command-line option is supported but not
22992 enabled by default.
22993 @end itemize
22994
22995 When this version of the ABI is enabled the C preprocessor symbol
22996 @code{__V850_GCC_ABI__} is defined.
22997
22998 @item -m8byte-align
22999 @itemx -mno-8byte-align
23000 @opindex m8byte-align
23001 @opindex mno-8byte-align
23002 Enables support for @code{double} and @code{long long} types to be
23003 aligned on 8-byte boundaries. The default is to restrict the
23004 alignment of all objects to at most 4-bytes. When
23005 @option{-m8byte-align} is in effect the C preprocessor symbol
23006 @code{__V850_8BYTE_ALIGN__} is defined.
23007
23008 @item -mbig-switch
23009 @opindex mbig-switch
23010 Generate code suitable for big switch tables. Use this option only if
23011 the assembler/linker complain about out of range branches within a switch
23012 table.
23013
23014 @item -mapp-regs
23015 @opindex mapp-regs
23016 This option causes r2 and r5 to be used in the code generated by
23017 the compiler. This setting is the default.
23018
23019 @item -mno-app-regs
23020 @opindex mno-app-regs
23021 This option causes r2 and r5 to be treated as fixed registers.
23022
23023 @end table
23024
23025 @node VAX Options
23026 @subsection VAX Options
23027 @cindex VAX options
23028
23029 These @samp{-m} options are defined for the VAX:
23030
23031 @table @gcctabopt
23032 @item -munix
23033 @opindex munix
23034 Do not output certain jump instructions (@code{aobleq} and so on)
23035 that the Unix assembler for the VAX cannot handle across long
23036 ranges.
23037
23038 @item -mgnu
23039 @opindex mgnu
23040 Do output those jump instructions, on the assumption that the
23041 GNU assembler is being used.
23042
23043 @item -mg
23044 @opindex mg
23045 Output code for G-format floating-point numbers instead of D-format.
23046 @end table
23047
23048 @node Visium Options
23049 @subsection Visium Options
23050 @cindex Visium options
23051
23052 @table @gcctabopt
23053
23054 @item -mdebug
23055 @opindex mdebug
23056 A program which performs file I/O and is destined to run on an MCM target
23057 should be linked with this option. It causes the libraries libc.a and
23058 libdebug.a to be linked. The program should be run on the target under
23059 the control of the GDB remote debugging stub.
23060
23061 @item -msim
23062 @opindex msim
23063 A program which performs file I/O and is destined to run on the simulator
23064 should be linked with option. This causes libraries libc.a and libsim.a to
23065 be linked.
23066
23067 @item -mfpu
23068 @itemx -mhard-float
23069 @opindex mfpu
23070 @opindex mhard-float
23071 Generate code containing floating-point instructions. This is the
23072 default.
23073
23074 @item -mno-fpu
23075 @itemx -msoft-float
23076 @opindex mno-fpu
23077 @opindex msoft-float
23078 Generate code containing library calls for floating-point.
23079
23080 @option{-msoft-float} changes the calling convention in the output file;
23081 therefore, it is only useful if you compile @emph{all} of a program with
23082 this option. In particular, you need to compile @file{libgcc.a}, the
23083 library that comes with GCC, with @option{-msoft-float} in order for
23084 this to work.
23085
23086 @item -mcpu=@var{cpu_type}
23087 @opindex mcpu
23088 Set the instruction set, register set, and instruction scheduling parameters
23089 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23090 @samp{mcm}, @samp{gr5} and @samp{gr6}.
23091
23092 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
23093
23094 By default (unless configured otherwise), GCC generates code for the GR5
23095 variant of the Visium architecture.
23096
23097 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
23098 architecture. The only difference from GR5 code is that the compiler will
23099 generate block move instructions.
23100
23101 @item -mtune=@var{cpu_type}
23102 @opindex mtune
23103 Set the instruction scheduling parameters for machine type @var{cpu_type},
23104 but do not set the instruction set or register set that the option
23105 @option{-mcpu=@var{cpu_type}} would.
23106
23107 @item -msv-mode
23108 @opindex msv-mode
23109 Generate code for the supervisor mode, where there are no restrictions on
23110 the access to general registers. This is the default.
23111
23112 @item -muser-mode
23113 @opindex muser-mode
23114 Generate code for the user mode, where the access to some general registers
23115 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
23116 mode; on the GR6, only registers r29 to r31 are affected.
23117 @end table
23118
23119 @node VMS Options
23120 @subsection VMS Options
23121
23122 These @samp{-m} options are defined for the VMS implementations:
23123
23124 @table @gcctabopt
23125 @item -mvms-return-codes
23126 @opindex mvms-return-codes
23127 Return VMS condition codes from @code{main}. The default is to return POSIX-style
23128 condition (e.g.@ error) codes.
23129
23130 @item -mdebug-main=@var{prefix}
23131 @opindex mdebug-main=@var{prefix}
23132 Flag the first routine whose name starts with @var{prefix} as the main
23133 routine for the debugger.
23134
23135 @item -mmalloc64
23136 @opindex mmalloc64
23137 Default to 64-bit memory allocation routines.
23138
23139 @item -mpointer-size=@var{size}
23140 @opindex mpointer-size=@var{size}
23141 Set the default size of pointers. Possible options for @var{size} are
23142 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
23143 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
23144 The later option disables @code{pragma pointer_size}.
23145 @end table
23146
23147 @node VxWorks Options
23148 @subsection VxWorks Options
23149 @cindex VxWorks Options
23150
23151 The options in this section are defined for all VxWorks targets.
23152 Options specific to the target hardware are listed with the other
23153 options for that target.
23154
23155 @table @gcctabopt
23156 @item -mrtp
23157 @opindex mrtp
23158 GCC can generate code for both VxWorks kernels and real time processes
23159 (RTPs). This option switches from the former to the latter. It also
23160 defines the preprocessor macro @code{__RTP__}.
23161
23162 @item -non-static
23163 @opindex non-static
23164 Link an RTP executable against shared libraries rather than static
23165 libraries. The options @option{-static} and @option{-shared} can
23166 also be used for RTPs (@pxref{Link Options}); @option{-static}
23167 is the default.
23168
23169 @item -Bstatic
23170 @itemx -Bdynamic
23171 @opindex Bstatic
23172 @opindex Bdynamic
23173 These options are passed down to the linker. They are defined for
23174 compatibility with Diab.
23175
23176 @item -Xbind-lazy
23177 @opindex Xbind-lazy
23178 Enable lazy binding of function calls. This option is equivalent to
23179 @option{-Wl,-z,now} and is defined for compatibility with Diab.
23180
23181 @item -Xbind-now
23182 @opindex Xbind-now
23183 Disable lazy binding of function calls. This option is the default and
23184 is defined for compatibility with Diab.
23185 @end table
23186
23187 @node x86 Options
23188 @subsection x86 Options
23189 @cindex x86 Options
23190
23191 These @samp{-m} options are defined for the x86 family of computers.
23192
23193 @table @gcctabopt
23194
23195 @item -march=@var{cpu-type}
23196 @opindex march
23197 Generate instructions for the machine type @var{cpu-type}. In contrast to
23198 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
23199 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
23200 to generate code that may not run at all on processors other than the one
23201 indicated. Specifying @option{-march=@var{cpu-type}} implies
23202 @option{-mtune=@var{cpu-type}}.
23203
23204 The choices for @var{cpu-type} are:
23205
23206 @table @samp
23207 @item native
23208 This selects the CPU to generate code for at compilation time by determining
23209 the processor type of the compiling machine. Using @option{-march=native}
23210 enables all instruction subsets supported by the local machine (hence
23211 the result might not run on different machines). Using @option{-mtune=native}
23212 produces code optimized for the local machine under the constraints
23213 of the selected instruction set.
23214
23215 @item i386
23216 Original Intel i386 CPU@.
23217
23218 @item i486
23219 Intel i486 CPU@. (No scheduling is implemented for this chip.)
23220
23221 @item i586
23222 @itemx pentium
23223 Intel Pentium CPU with no MMX support.
23224
23225 @item lakemont
23226 Intel Lakemont MCU, based on Intel Pentium CPU.
23227
23228 @item pentium-mmx
23229 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
23230
23231 @item pentiumpro
23232 Intel Pentium Pro CPU@.
23233
23234 @item i686
23235 When used with @option{-march}, the Pentium Pro
23236 instruction set is used, so the code runs on all i686 family chips.
23237 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
23238
23239 @item pentium2
23240 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
23241 support.
23242
23243 @item pentium3
23244 @itemx pentium3m
23245 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
23246 set support.
23247
23248 @item pentium-m
23249 Intel Pentium M; low-power version of Intel Pentium III CPU
23250 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
23251
23252 @item pentium4
23253 @itemx pentium4m
23254 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
23255
23256 @item prescott
23257 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
23258 set support.
23259
23260 @item nocona
23261 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
23262 SSE2 and SSE3 instruction set support.
23263
23264 @item core2
23265 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
23266 instruction set support.
23267
23268 @item nehalem
23269 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23270 SSE4.1, SSE4.2 and POPCNT instruction set support.
23271
23272 @item westmere
23273 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23274 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
23275
23276 @item sandybridge
23277 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23278 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
23279
23280 @item ivybridge
23281 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23282 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
23283 instruction set support.
23284
23285 @item haswell
23286 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23287 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23288 BMI, BMI2 and F16C instruction set support.
23289
23290 @item broadwell
23291 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23292 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23293 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
23294
23295 @item skylake
23296 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23297 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23298 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
23299 XSAVES instruction set support.
23300
23301 @item bonnell
23302 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
23303 instruction set support.
23304
23305 @item silvermont
23306 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23307 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
23308
23309 @item knl
23310 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23311 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23312 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
23313 AVX512CD instruction set support.
23314
23315 @item skylake-avx512
23316 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23317 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23318 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
23319 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
23320
23321 @item k6
23322 AMD K6 CPU with MMX instruction set support.
23323
23324 @item k6-2
23325 @itemx k6-3
23326 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
23327
23328 @item athlon
23329 @itemx athlon-tbird
23330 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
23331 support.
23332
23333 @item athlon-4
23334 @itemx athlon-xp
23335 @itemx athlon-mp
23336 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
23337 instruction set support.
23338
23339 @item k8
23340 @itemx opteron
23341 @itemx athlon64
23342 @itemx athlon-fx
23343 Processors based on the AMD K8 core with x86-64 instruction set support,
23344 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
23345 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
23346 instruction set extensions.)
23347
23348 @item k8-sse3
23349 @itemx opteron-sse3
23350 @itemx athlon64-sse3
23351 Improved versions of AMD K8 cores with SSE3 instruction set support.
23352
23353 @item amdfam10
23354 @itemx barcelona
23355 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
23356 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
23357 instruction set extensions.)
23358
23359 @item bdver1
23360 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
23361 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
23362 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
23363 @item bdver2
23364 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23365 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
23366 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
23367 extensions.)
23368 @item bdver3
23369 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23370 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
23371 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
23372 64-bit instruction set extensions.
23373 @item bdver4
23374 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23375 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
23376 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
23377 SSE4.2, ABM and 64-bit instruction set extensions.
23378
23379 @item znver1
23380 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
23381 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
23382 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
23383 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
23384 instruction set extensions.
23385
23386 @item btver1
23387 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
23388 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
23389 instruction set extensions.)
23390
23391 @item btver2
23392 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
23393 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
23394 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
23395
23396 @item winchip-c6
23397 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
23398 set support.
23399
23400 @item winchip2
23401 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
23402 instruction set support.
23403
23404 @item c3
23405 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
23406 (No scheduling is implemented for this chip.)
23407
23408 @item c3-2
23409 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
23410 (No scheduling is implemented for this chip.)
23411
23412 @item c7
23413 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
23414 (No scheduling is implemented for this chip.)
23415
23416 @item samuel-2
23417 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
23418 (No scheduling is implemented for this chip.)
23419
23420 @item nehemiah
23421 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
23422 (No scheduling is implemented for this chip.)
23423
23424 @item esther
23425 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
23426 (No scheduling is implemented for this chip.)
23427
23428 @item eden-x2
23429 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
23430 (No scheduling is implemented for this chip.)
23431
23432 @item eden-x4
23433 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
23434 AVX and AVX2 instruction set support.
23435 (No scheduling is implemented for this chip.)
23436
23437 @item nano
23438 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23439 instruction set support.
23440 (No scheduling is implemented for this chip.)
23441
23442 @item nano-1000
23443 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23444 instruction set support.
23445 (No scheduling is implemented for this chip.)
23446
23447 @item nano-2000
23448 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23449 instruction set support.
23450 (No scheduling is implemented for this chip.)
23451
23452 @item nano-3000
23453 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23454 instruction set support.
23455 (No scheduling is implemented for this chip.)
23456
23457 @item nano-x2
23458 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23459 instruction set support.
23460 (No scheduling is implemented for this chip.)
23461
23462 @item nano-x4
23463 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23464 instruction set support.
23465 (No scheduling is implemented for this chip.)
23466
23467 @item geode
23468 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
23469 @end table
23470
23471 @item -mtune=@var{cpu-type}
23472 @opindex mtune
23473 Tune to @var{cpu-type} everything applicable about the generated code, except
23474 for the ABI and the set of available instructions.
23475 While picking a specific @var{cpu-type} schedules things appropriately
23476 for that particular chip, the compiler does not generate any code that
23477 cannot run on the default machine type unless you use a
23478 @option{-march=@var{cpu-type}} option.
23479 For example, if GCC is configured for i686-pc-linux-gnu
23480 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
23481 but still runs on i686 machines.
23482
23483 The choices for @var{cpu-type} are the same as for @option{-march}.
23484 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
23485
23486 @table @samp
23487 @item generic
23488 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
23489 If you know the CPU on which your code will run, then you should use
23490 the corresponding @option{-mtune} or @option{-march} option instead of
23491 @option{-mtune=generic}. But, if you do not know exactly what CPU users
23492 of your application will have, then you should use this option.
23493
23494 As new processors are deployed in the marketplace, the behavior of this
23495 option will change. Therefore, if you upgrade to a newer version of
23496 GCC, code generation controlled by this option will change to reflect
23497 the processors
23498 that are most common at the time that version of GCC is released.
23499
23500 There is no @option{-march=generic} option because @option{-march}
23501 indicates the instruction set the compiler can use, and there is no
23502 generic instruction set applicable to all processors. In contrast,
23503 @option{-mtune} indicates the processor (or, in this case, collection of
23504 processors) for which the code is optimized.
23505
23506 @item intel
23507 Produce code optimized for the most current Intel processors, which are
23508 Haswell and Silvermont for this version of GCC. If you know the CPU
23509 on which your code will run, then you should use the corresponding
23510 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
23511 But, if you want your application performs better on both Haswell and
23512 Silvermont, then you should use this option.
23513
23514 As new Intel processors are deployed in the marketplace, the behavior of
23515 this option will change. Therefore, if you upgrade to a newer version of
23516 GCC, code generation controlled by this option will change to reflect
23517 the most current Intel processors at the time that version of GCC is
23518 released.
23519
23520 There is no @option{-march=intel} option because @option{-march} indicates
23521 the instruction set the compiler can use, and there is no common
23522 instruction set applicable to all processors. In contrast,
23523 @option{-mtune} indicates the processor (or, in this case, collection of
23524 processors) for which the code is optimized.
23525 @end table
23526
23527 @item -mcpu=@var{cpu-type}
23528 @opindex mcpu
23529 A deprecated synonym for @option{-mtune}.
23530
23531 @item -mfpmath=@var{unit}
23532 @opindex mfpmath
23533 Generate floating-point arithmetic for selected unit @var{unit}. The choices
23534 for @var{unit} are:
23535
23536 @table @samp
23537 @item 387
23538 Use the standard 387 floating-point coprocessor present on the majority of chips and
23539 emulated otherwise. Code compiled with this option runs almost everywhere.
23540 The temporary results are computed in 80-bit precision instead of the precision
23541 specified by the type, resulting in slightly different results compared to most
23542 of other chips. See @option{-ffloat-store} for more detailed description.
23543
23544 This is the default choice for x86-32 targets.
23545
23546 @item sse
23547 Use scalar floating-point instructions present in the SSE instruction set.
23548 This instruction set is supported by Pentium III and newer chips,
23549 and in the AMD line
23550 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
23551 instruction set supports only single-precision arithmetic, thus the double and
23552 extended-precision arithmetic are still done using 387. A later version, present
23553 only in Pentium 4 and AMD x86-64 chips, supports double-precision
23554 arithmetic too.
23555
23556 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
23557 or @option{-msse2} switches to enable SSE extensions and make this option
23558 effective. For the x86-64 compiler, these extensions are enabled by default.
23559
23560 The resulting code should be considerably faster in the majority of cases and avoid
23561 the numerical instability problems of 387 code, but may break some existing
23562 code that expects temporaries to be 80 bits.
23563
23564 This is the default choice for the x86-64 compiler.
23565
23566 @item sse,387
23567 @itemx sse+387
23568 @itemx both
23569 Attempt to utilize both instruction sets at once. This effectively doubles the
23570 amount of available registers, and on chips with separate execution units for
23571 387 and SSE the execution resources too. Use this option with care, as it is
23572 still experimental, because the GCC register allocator does not model separate
23573 functional units well, resulting in unstable performance.
23574 @end table
23575
23576 @item -masm=@var{dialect}
23577 @opindex masm=@var{dialect}
23578 Output assembly instructions using selected @var{dialect}. Also affects
23579 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
23580 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
23581 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
23582 not support @samp{intel}.
23583
23584 @item -mieee-fp
23585 @itemx -mno-ieee-fp
23586 @opindex mieee-fp
23587 @opindex mno-ieee-fp
23588 Control whether or not the compiler uses IEEE floating-point
23589 comparisons. These correctly handle the case where the result of a
23590 comparison is unordered.
23591
23592 @item -m80387
23593 @item -mhard-float
23594 @opindex 80387
23595 @opindex mhard-float
23596 Generate output containing 80387 instructions for floating point.
23597
23598 @item -mno-80387
23599 @item -msoft-float
23600 @opindex no-80387
23601 @opindex msoft-float
23602 Generate output containing library calls for floating point.
23603
23604 @strong{Warning:} the requisite libraries are not part of GCC@.
23605 Normally the facilities of the machine's usual C compiler are used, but
23606 this can't be done directly in cross-compilation. You must make your
23607 own arrangements to provide suitable library functions for
23608 cross-compilation.
23609
23610 On machines where a function returns floating-point results in the 80387
23611 register stack, some floating-point opcodes may be emitted even if
23612 @option{-msoft-float} is used.
23613
23614 @item -mno-fp-ret-in-387
23615 @opindex mno-fp-ret-in-387
23616 Do not use the FPU registers for return values of functions.
23617
23618 The usual calling convention has functions return values of types
23619 @code{float} and @code{double} in an FPU register, even if there
23620 is no FPU@. The idea is that the operating system should emulate
23621 an FPU@.
23622
23623 The option @option{-mno-fp-ret-in-387} causes such values to be returned
23624 in ordinary CPU registers instead.
23625
23626 @item -mno-fancy-math-387
23627 @opindex mno-fancy-math-387
23628 Some 387 emulators do not support the @code{sin}, @code{cos} and
23629 @code{sqrt} instructions for the 387. Specify this option to avoid
23630 generating those instructions. This option is the default on
23631 OpenBSD and NetBSD@. This option is overridden when @option{-march}
23632 indicates that the target CPU always has an FPU and so the
23633 instruction does not need emulation. These
23634 instructions are not generated unless you also use the
23635 @option{-funsafe-math-optimizations} switch.
23636
23637 @item -malign-double
23638 @itemx -mno-align-double
23639 @opindex malign-double
23640 @opindex mno-align-double
23641 Control whether GCC aligns @code{double}, @code{long double}, and
23642 @code{long long} variables on a two-word boundary or a one-word
23643 boundary. Aligning @code{double} variables on a two-word boundary
23644 produces code that runs somewhat faster on a Pentium at the
23645 expense of more memory.
23646
23647 On x86-64, @option{-malign-double} is enabled by default.
23648
23649 @strong{Warning:} if you use the @option{-malign-double} switch,
23650 structures containing the above types are aligned differently than
23651 the published application binary interface specifications for the x86-32
23652 and are not binary compatible with structures in code compiled
23653 without that switch.
23654
23655 @item -m96bit-long-double
23656 @itemx -m128bit-long-double
23657 @opindex m96bit-long-double
23658 @opindex m128bit-long-double
23659 These switches control the size of @code{long double} type. The x86-32
23660 application binary interface specifies the size to be 96 bits,
23661 so @option{-m96bit-long-double} is the default in 32-bit mode.
23662
23663 Modern architectures (Pentium and newer) prefer @code{long double}
23664 to be aligned to an 8- or 16-byte boundary. In arrays or structures
23665 conforming to the ABI, this is not possible. So specifying
23666 @option{-m128bit-long-double} aligns @code{long double}
23667 to a 16-byte boundary by padding the @code{long double} with an additional
23668 32-bit zero.
23669
23670 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
23671 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
23672
23673 Notice that neither of these options enable any extra precision over the x87
23674 standard of 80 bits for a @code{long double}.
23675
23676 @strong{Warning:} if you override the default value for your target ABI, this
23677 changes the size of
23678 structures and arrays containing @code{long double} variables,
23679 as well as modifying the function calling convention for functions taking
23680 @code{long double}. Hence they are not binary-compatible
23681 with code compiled without that switch.
23682
23683 @item -mlong-double-64
23684 @itemx -mlong-double-80
23685 @itemx -mlong-double-128
23686 @opindex mlong-double-64
23687 @opindex mlong-double-80
23688 @opindex mlong-double-128
23689 These switches control the size of @code{long double} type. A size
23690 of 64 bits makes the @code{long double} type equivalent to the @code{double}
23691 type. This is the default for 32-bit Bionic C library. A size
23692 of 128 bits makes the @code{long double} type equivalent to the
23693 @code{__float128} type. This is the default for 64-bit Bionic C library.
23694
23695 @strong{Warning:} if you override the default value for your target ABI, this
23696 changes the size of
23697 structures and arrays containing @code{long double} variables,
23698 as well as modifying the function calling convention for functions taking
23699 @code{long double}. Hence they are not binary-compatible
23700 with code compiled without that switch.
23701
23702 @item -malign-data=@var{type}
23703 @opindex malign-data
23704 Control how GCC aligns variables. Supported values for @var{type} are
23705 @samp{compat} uses increased alignment value compatible uses GCC 4.8
23706 and earlier, @samp{abi} uses alignment value as specified by the
23707 psABI, and @samp{cacheline} uses increased alignment value to match
23708 the cache line size. @samp{compat} is the default.
23709
23710 @item -mlarge-data-threshold=@var{threshold}
23711 @opindex mlarge-data-threshold
23712 When @option{-mcmodel=medium} is specified, data objects larger than
23713 @var{threshold} are placed in the large data section. This value must be the
23714 same across all objects linked into the binary, and defaults to 65535.
23715
23716 @item -mrtd
23717 @opindex mrtd
23718 Use a different function-calling convention, in which functions that
23719 take a fixed number of arguments return with the @code{ret @var{num}}
23720 instruction, which pops their arguments while returning. This saves one
23721 instruction in the caller since there is no need to pop the arguments
23722 there.
23723
23724 You can specify that an individual function is called with this calling
23725 sequence with the function attribute @code{stdcall}. You can also
23726 override the @option{-mrtd} option by using the function attribute
23727 @code{cdecl}. @xref{Function Attributes}.
23728
23729 @strong{Warning:} this calling convention is incompatible with the one
23730 normally used on Unix, so you cannot use it if you need to call
23731 libraries compiled with the Unix compiler.
23732
23733 Also, you must provide function prototypes for all functions that
23734 take variable numbers of arguments (including @code{printf});
23735 otherwise incorrect code is generated for calls to those
23736 functions.
23737
23738 In addition, seriously incorrect code results if you call a
23739 function with too many arguments. (Normally, extra arguments are
23740 harmlessly ignored.)
23741
23742 @item -mregparm=@var{num}
23743 @opindex mregparm
23744 Control how many registers are used to pass integer arguments. By
23745 default, no registers are used to pass arguments, and at most 3
23746 registers can be used. You can control this behavior for a specific
23747 function by using the function attribute @code{regparm}.
23748 @xref{Function Attributes}.
23749
23750 @strong{Warning:} if you use this switch, and
23751 @var{num} is nonzero, then you must build all modules with the same
23752 value, including any libraries. This includes the system libraries and
23753 startup modules.
23754
23755 @item -msseregparm
23756 @opindex msseregparm
23757 Use SSE register passing conventions for float and double arguments
23758 and return values. You can control this behavior for a specific
23759 function by using the function attribute @code{sseregparm}.
23760 @xref{Function Attributes}.
23761
23762 @strong{Warning:} if you use this switch then you must build all
23763 modules with the same value, including any libraries. This includes
23764 the system libraries and startup modules.
23765
23766 @item -mvect8-ret-in-mem
23767 @opindex mvect8-ret-in-mem
23768 Return 8-byte vectors in memory instead of MMX registers. This is the
23769 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
23770 Studio compilers until version 12. Later compiler versions (starting
23771 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
23772 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
23773 you need to remain compatible with existing code produced by those
23774 previous compiler versions or older versions of GCC@.
23775
23776 @item -mpc32
23777 @itemx -mpc64
23778 @itemx -mpc80
23779 @opindex mpc32
23780 @opindex mpc64
23781 @opindex mpc80
23782
23783 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
23784 is specified, the significands of results of floating-point operations are
23785 rounded to 24 bits (single precision); @option{-mpc64} rounds the
23786 significands of results of floating-point operations to 53 bits (double
23787 precision) and @option{-mpc80} rounds the significands of results of
23788 floating-point operations to 64 bits (extended double precision), which is
23789 the default. When this option is used, floating-point operations in higher
23790 precisions are not available to the programmer without setting the FPU
23791 control word explicitly.
23792
23793 Setting the rounding of floating-point operations to less than the default
23794 80 bits can speed some programs by 2% or more. Note that some mathematical
23795 libraries assume that extended-precision (80-bit) floating-point operations
23796 are enabled by default; routines in such libraries could suffer significant
23797 loss of accuracy, typically through so-called ``catastrophic cancellation'',
23798 when this option is used to set the precision to less than extended precision.
23799
23800 @item -mstackrealign
23801 @opindex mstackrealign
23802 Realign the stack at entry. On the x86, the @option{-mstackrealign}
23803 option generates an alternate prologue and epilogue that realigns the
23804 run-time stack if necessary. This supports mixing legacy codes that keep
23805 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
23806 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
23807 applicable to individual functions.
23808
23809 @item -mpreferred-stack-boundary=@var{num}
23810 @opindex mpreferred-stack-boundary
23811 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23812 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23813 the default is 4 (16 bytes or 128 bits).
23814
23815 @strong{Warning:} When generating code for the x86-64 architecture with
23816 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
23817 used to keep the stack boundary aligned to 8 byte boundary. Since
23818 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
23819 intended to be used in controlled environment where stack space is
23820 important limitation. This option leads to wrong code when functions
23821 compiled with 16 byte stack alignment (such as functions from a standard
23822 library) are called with misaligned stack. In this case, SSE
23823 instructions may lead to misaligned memory access traps. In addition,
23824 variable arguments are handled incorrectly for 16 byte aligned
23825 objects (including x87 long double and __int128), leading to wrong
23826 results. You must build all modules with
23827 @option{-mpreferred-stack-boundary=3}, including any libraries. This
23828 includes the system libraries and startup modules.
23829
23830 @item -mincoming-stack-boundary=@var{num}
23831 @opindex mincoming-stack-boundary
23832 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
23833 boundary. If @option{-mincoming-stack-boundary} is not specified,
23834 the one specified by @option{-mpreferred-stack-boundary} is used.
23835
23836 On Pentium and Pentium Pro, @code{double} and @code{long double} values
23837 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
23838 suffer significant run time performance penalties. On Pentium III, the
23839 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
23840 properly if it is not 16-byte aligned.
23841
23842 To ensure proper alignment of this values on the stack, the stack boundary
23843 must be as aligned as that required by any value stored on the stack.
23844 Further, every function must be generated such that it keeps the stack
23845 aligned. Thus calling a function compiled with a higher preferred
23846 stack boundary from a function compiled with a lower preferred stack
23847 boundary most likely misaligns the stack. It is recommended that
23848 libraries that use callbacks always use the default setting.
23849
23850 This extra alignment does consume extra stack space, and generally
23851 increases code size. Code that is sensitive to stack space usage, such
23852 as embedded systems and operating system kernels, may want to reduce the
23853 preferred alignment to @option{-mpreferred-stack-boundary=2}.
23854
23855 @need 200
23856 @item -mmmx
23857 @opindex mmmx
23858 @need 200
23859 @itemx -msse
23860 @opindex msse
23861 @need 200
23862 @itemx -msse2
23863 @opindex msse2
23864 @need 200
23865 @itemx -msse3
23866 @opindex msse3
23867 @need 200
23868 @itemx -mssse3
23869 @opindex mssse3
23870 @need 200
23871 @itemx -msse4
23872 @opindex msse4
23873 @need 200
23874 @itemx -msse4a
23875 @opindex msse4a
23876 @need 200
23877 @itemx -msse4.1
23878 @opindex msse4.1
23879 @need 200
23880 @itemx -msse4.2
23881 @opindex msse4.2
23882 @need 200
23883 @itemx -mavx
23884 @opindex mavx
23885 @need 200
23886 @itemx -mavx2
23887 @opindex mavx2
23888 @need 200
23889 @itemx -mavx512f
23890 @opindex mavx512f
23891 @need 200
23892 @itemx -mavx512pf
23893 @opindex mavx512pf
23894 @need 200
23895 @itemx -mavx512er
23896 @opindex mavx512er
23897 @need 200
23898 @itemx -mavx512cd
23899 @opindex mavx512cd
23900 @need 200
23901 @itemx -mavx512vl
23902 @opindex mavx512vl
23903 @need 200
23904 @itemx -mavx512bw
23905 @opindex mavx512bw
23906 @need 200
23907 @itemx -mavx512dq
23908 @opindex mavx512dq
23909 @need 200
23910 @itemx -mavx512ifma
23911 @opindex mavx512ifma
23912 @need 200
23913 @itemx -mavx512vbmi
23914 @opindex mavx512vbmi
23915 @need 200
23916 @itemx -msha
23917 @opindex msha
23918 @need 200
23919 @itemx -maes
23920 @opindex maes
23921 @need 200
23922 @itemx -mpclmul
23923 @opindex mpclmul
23924 @need 200
23925 @itemx -mclfushopt
23926 @opindex mclfushopt
23927 @need 200
23928 @itemx -mfsgsbase
23929 @opindex mfsgsbase
23930 @need 200
23931 @itemx -mrdrnd
23932 @opindex mrdrnd
23933 @need 200
23934 @itemx -mf16c
23935 @opindex mf16c
23936 @need 200
23937 @itemx -mfma
23938 @opindex mfma
23939 @need 200
23940 @itemx -mfma4
23941 @opindex mfma4
23942 @need 200
23943 @itemx -mprefetchwt1
23944 @opindex mprefetchwt1
23945 @need 200
23946 @itemx -mxop
23947 @opindex mxop
23948 @need 200
23949 @itemx -mlwp
23950 @opindex mlwp
23951 @need 200
23952 @itemx -m3dnow
23953 @opindex m3dnow
23954 @need 200
23955 @itemx -mpopcnt
23956 @opindex mpopcnt
23957 @need 200
23958 @itemx -mabm
23959 @opindex mabm
23960 @need 200
23961 @itemx -mbmi
23962 @opindex mbmi
23963 @need 200
23964 @itemx -mbmi2
23965 @need 200
23966 @itemx -mlzcnt
23967 @opindex mlzcnt
23968 @need 200
23969 @itemx -mfxsr
23970 @opindex mfxsr
23971 @need 200
23972 @itemx -mxsave
23973 @opindex mxsave
23974 @need 200
23975 @itemx -mxsaveopt
23976 @opindex mxsaveopt
23977 @need 200
23978 @itemx -mxsavec
23979 @opindex mxsavec
23980 @need 200
23981 @itemx -mxsaves
23982 @opindex mxsaves
23983 @need 200
23984 @itemx -mrtm
23985 @opindex mrtm
23986 @need 200
23987 @itemx -mtbm
23988 @opindex mtbm
23989 @need 200
23990 @itemx -mmpx
23991 @opindex mmpx
23992 @need 200
23993 @itemx -mmwaitx
23994 @opindex mmwaitx
23995 @need 200
23996 @itemx -mclzero
23997 @opindex mclzero
23998 @itemx -mpku
23999 @opindex mpku
24000 These switches enable the use of instructions in the MMX, SSE,
24001 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
24002 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
24003 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
24004 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU or 3DNow!@:
24005 extended instruction sets. Each has a corresponding @option{-mno-} option
24006 to disable use of these instructions.
24007
24008 These extensions are also available as built-in functions: see
24009 @ref{x86 Built-in Functions}, for details of the functions enabled and
24010 disabled by these switches.
24011
24012 To generate SSE/SSE2 instructions automatically from floating-point
24013 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
24014
24015 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
24016 generates new AVX instructions or AVX equivalence for all SSEx instructions
24017 when needed.
24018
24019 These options enable GCC to use these extended instructions in
24020 generated code, even without @option{-mfpmath=sse}. Applications that
24021 perform run-time CPU detection must compile separate files for each
24022 supported architecture, using the appropriate flags. In particular,
24023 the file containing the CPU detection code should be compiled without
24024 these options.
24025
24026 @item -mdump-tune-features
24027 @opindex mdump-tune-features
24028 This option instructs GCC to dump the names of the x86 performance
24029 tuning features and default settings. The names can be used in
24030 @option{-mtune-ctrl=@var{feature-list}}.
24031
24032 @item -mtune-ctrl=@var{feature-list}
24033 @opindex mtune-ctrl=@var{feature-list}
24034 This option is used to do fine grain control of x86 code generation features.
24035 @var{feature-list} is a comma separated list of @var{feature} names. See also
24036 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
24037 on if it is not preceded with @samp{^}, otherwise, it is turned off.
24038 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
24039 developers. Using it may lead to code paths not covered by testing and can
24040 potentially result in compiler ICEs or runtime errors.
24041
24042 @item -mno-default
24043 @opindex mno-default
24044 This option instructs GCC to turn off all tunable features. See also
24045 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
24046
24047 @item -mcld
24048 @opindex mcld
24049 This option instructs GCC to emit a @code{cld} instruction in the prologue
24050 of functions that use string instructions. String instructions depend on
24051 the DF flag to select between autoincrement or autodecrement mode. While the
24052 ABI specifies the DF flag to be cleared on function entry, some operating
24053 systems violate this specification by not clearing the DF flag in their
24054 exception dispatchers. The exception handler can be invoked with the DF flag
24055 set, which leads to wrong direction mode when string instructions are used.
24056 This option can be enabled by default on 32-bit x86 targets by configuring
24057 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
24058 instructions can be suppressed with the @option{-mno-cld} compiler option
24059 in this case.
24060
24061 @item -mvzeroupper
24062 @opindex mvzeroupper
24063 This option instructs GCC to emit a @code{vzeroupper} instruction
24064 before a transfer of control flow out of the function to minimize
24065 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
24066 intrinsics.
24067
24068 @item -mprefer-avx128
24069 @opindex mprefer-avx128
24070 This option instructs GCC to use 128-bit AVX instructions instead of
24071 256-bit AVX instructions in the auto-vectorizer.
24072
24073 @item -mcx16
24074 @opindex mcx16
24075 This option enables GCC to generate @code{CMPXCHG16B} instructions.
24076 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
24077 (or oword) data types.
24078 This is useful for high-resolution counters that can be updated
24079 by multiple processors (or cores). This instruction is generated as part of
24080 atomic built-in functions: see @ref{__sync Builtins} or
24081 @ref{__atomic Builtins} for details.
24082
24083 @item -msahf
24084 @opindex msahf
24085 This option enables generation of @code{SAHF} instructions in 64-bit code.
24086 Early Intel Pentium 4 CPUs with Intel 64 support,
24087 prior to the introduction of Pentium 4 G1 step in December 2005,
24088 lacked the @code{LAHF} and @code{SAHF} instructions
24089 which are supported by AMD64.
24090 These are load and store instructions, respectively, for certain status flags.
24091 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
24092 @code{drem}, and @code{remainder} built-in functions;
24093 see @ref{Other Builtins} for details.
24094
24095 @item -mmovbe
24096 @opindex mmovbe
24097 This option enables use of the @code{movbe} instruction to implement
24098 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
24099
24100 @item -mcrc32
24101 @opindex mcrc32
24102 This option enables built-in functions @code{__builtin_ia32_crc32qi},
24103 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
24104 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
24105
24106 @item -mrecip
24107 @opindex mrecip
24108 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
24109 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
24110 with an additional Newton-Raphson step
24111 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
24112 (and their vectorized
24113 variants) for single-precision floating-point arguments. These instructions
24114 are generated only when @option{-funsafe-math-optimizations} is enabled
24115 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
24116 Note that while the throughput of the sequence is higher than the throughput
24117 of the non-reciprocal instruction, the precision of the sequence can be
24118 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
24119
24120 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
24121 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
24122 combination), and doesn't need @option{-mrecip}.
24123
24124 Also note that GCC emits the above sequence with additional Newton-Raphson step
24125 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
24126 already with @option{-ffast-math} (or the above option combination), and
24127 doesn't need @option{-mrecip}.
24128
24129 @item -mrecip=@var{opt}
24130 @opindex mrecip=opt
24131 This option controls which reciprocal estimate instructions
24132 may be used. @var{opt} is a comma-separated list of options, which may
24133 be preceded by a @samp{!} to invert the option:
24134
24135 @table @samp
24136 @item all
24137 Enable all estimate instructions.
24138
24139 @item default
24140 Enable the default instructions, equivalent to @option{-mrecip}.
24141
24142 @item none
24143 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24144
24145 @item div
24146 Enable the approximation for scalar division.
24147
24148 @item vec-div
24149 Enable the approximation for vectorized division.
24150
24151 @item sqrt
24152 Enable the approximation for scalar square root.
24153
24154 @item vec-sqrt
24155 Enable the approximation for vectorized square root.
24156 @end table
24157
24158 So, for example, @option{-mrecip=all,!sqrt} enables
24159 all of the reciprocal approximations, except for square root.
24160
24161 @item -mveclibabi=@var{type}
24162 @opindex mveclibabi
24163 Specifies the ABI type to use for vectorizing intrinsics using an
24164 external library. Supported values for @var{type} are @samp{svml}
24165 for the Intel short
24166 vector math library and @samp{acml} for the AMD math core library.
24167 To use this option, both @option{-ftree-vectorize} and
24168 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
24169 ABI-compatible library must be specified at link time.
24170
24171 GCC currently emits calls to @code{vmldExp2},
24172 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
24173 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
24174 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
24175 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
24176 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
24177 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
24178 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
24179 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
24180 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
24181 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
24182 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
24183 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
24184 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
24185 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
24186 when @option{-mveclibabi=acml} is used.
24187
24188 @item -mabi=@var{name}
24189 @opindex mabi
24190 Generate code for the specified calling convention. Permissible values
24191 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
24192 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
24193 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
24194 You can control this behavior for specific functions by
24195 using the function attributes @code{ms_abi} and @code{sysv_abi}.
24196 @xref{Function Attributes}.
24197
24198 @item -mtls-dialect=@var{type}
24199 @opindex mtls-dialect
24200 Generate code to access thread-local storage using the @samp{gnu} or
24201 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
24202 @samp{gnu2} is more efficient, but it may add compile- and run-time
24203 requirements that cannot be satisfied on all systems.
24204
24205 @item -mpush-args
24206 @itemx -mno-push-args
24207 @opindex mpush-args
24208 @opindex mno-push-args
24209 Use PUSH operations to store outgoing parameters. This method is shorter
24210 and usually equally fast as method using SUB/MOV operations and is enabled
24211 by default. In some cases disabling it may improve performance because of
24212 improved scheduling and reduced dependencies.
24213
24214 @item -maccumulate-outgoing-args
24215 @opindex maccumulate-outgoing-args
24216 If enabled, the maximum amount of space required for outgoing arguments is
24217 computed in the function prologue. This is faster on most modern CPUs
24218 because of reduced dependencies, improved scheduling and reduced stack usage
24219 when the preferred stack boundary is not equal to 2. The drawback is a notable
24220 increase in code size. This switch implies @option{-mno-push-args}.
24221
24222 @item -mthreads
24223 @opindex mthreads
24224 Support thread-safe exception handling on MinGW. Programs that rely
24225 on thread-safe exception handling must compile and link all code with the
24226 @option{-mthreads} option. When compiling, @option{-mthreads} defines
24227 @option{-D_MT}; when linking, it links in a special thread helper library
24228 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
24229
24230 @item -mms-bitfields
24231 @itemx -mno-ms-bitfields
24232 @opindex mms-bitfields
24233 @opindex mno-ms-bitfields
24234
24235 Enable/disable bit-field layout compatible with the native Microsoft
24236 Windows compiler.
24237
24238 If @code{packed} is used on a structure, or if bit-fields are used,
24239 it may be that the Microsoft ABI lays out the structure differently
24240 than the way GCC normally does. Particularly when moving packed
24241 data between functions compiled with GCC and the native Microsoft compiler
24242 (either via function call or as data in a file), it may be necessary to access
24243 either format.
24244
24245 This option is enabled by default for Microsoft Windows
24246 targets. This behavior can also be controlled locally by use of variable
24247 or type attributes. For more information, see @ref{x86 Variable Attributes}
24248 and @ref{x86 Type Attributes}.
24249
24250 The Microsoft structure layout algorithm is fairly simple with the exception
24251 of the bit-field packing.
24252 The padding and alignment of members of structures and whether a bit-field
24253 can straddle a storage-unit boundary are determine by these rules:
24254
24255 @enumerate
24256 @item Structure members are stored sequentially in the order in which they are
24257 declared: the first member has the lowest memory address and the last member
24258 the highest.
24259
24260 @item Every data object has an alignment requirement. The alignment requirement
24261 for all data except structures, unions, and arrays is either the size of the
24262 object or the current packing size (specified with either the
24263 @code{aligned} attribute or the @code{pack} pragma),
24264 whichever is less. For structures, unions, and arrays,
24265 the alignment requirement is the largest alignment requirement of its members.
24266 Every object is allocated an offset so that:
24267
24268 @smallexample
24269 offset % alignment_requirement == 0
24270 @end smallexample
24271
24272 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
24273 unit if the integral types are the same size and if the next bit-field fits
24274 into the current allocation unit without crossing the boundary imposed by the
24275 common alignment requirements of the bit-fields.
24276 @end enumerate
24277
24278 MSVC interprets zero-length bit-fields in the following ways:
24279
24280 @enumerate
24281 @item If a zero-length bit-field is inserted between two bit-fields that
24282 are normally coalesced, the bit-fields are not coalesced.
24283
24284 For example:
24285
24286 @smallexample
24287 struct
24288 @{
24289 unsigned long bf_1 : 12;
24290 unsigned long : 0;
24291 unsigned long bf_2 : 12;
24292 @} t1;
24293 @end smallexample
24294
24295 @noindent
24296 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
24297 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
24298
24299 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
24300 alignment of the zero-length bit-field is greater than the member that follows it,
24301 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
24302
24303 For example:
24304
24305 @smallexample
24306 struct
24307 @{
24308 char foo : 4;
24309 short : 0;
24310 char bar;
24311 @} t2;
24312
24313 struct
24314 @{
24315 char foo : 4;
24316 short : 0;
24317 double bar;
24318 @} t3;
24319 @end smallexample
24320
24321 @noindent
24322 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
24323 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
24324 bit-field does not affect the alignment of @code{bar} or, as a result, the size
24325 of the structure.
24326
24327 Taking this into account, it is important to note the following:
24328
24329 @enumerate
24330 @item If a zero-length bit-field follows a normal bit-field, the type of the
24331 zero-length bit-field may affect the alignment of the structure as whole. For
24332 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
24333 normal bit-field, and is of type short.
24334
24335 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
24336 still affect the alignment of the structure:
24337
24338 @smallexample
24339 struct
24340 @{
24341 char foo : 6;
24342 long : 0;
24343 @} t4;
24344 @end smallexample
24345
24346 @noindent
24347 Here, @code{t4} takes up 4 bytes.
24348 @end enumerate
24349
24350 @item Zero-length bit-fields following non-bit-field members are ignored:
24351
24352 @smallexample
24353 struct
24354 @{
24355 char foo;
24356 long : 0;
24357 char bar;
24358 @} t5;
24359 @end smallexample
24360
24361 @noindent
24362 Here, @code{t5} takes up 2 bytes.
24363 @end enumerate
24364
24365
24366 @item -mno-align-stringops
24367 @opindex mno-align-stringops
24368 Do not align the destination of inlined string operations. This switch reduces
24369 code size and improves performance in case the destination is already aligned,
24370 but GCC doesn't know about it.
24371
24372 @item -minline-all-stringops
24373 @opindex minline-all-stringops
24374 By default GCC inlines string operations only when the destination is
24375 known to be aligned to least a 4-byte boundary.
24376 This enables more inlining and increases code
24377 size, but may improve performance of code that depends on fast
24378 @code{memcpy}, @code{strlen},
24379 and @code{memset} for short lengths.
24380
24381 @item -minline-stringops-dynamically
24382 @opindex minline-stringops-dynamically
24383 For string operations of unknown size, use run-time checks with
24384 inline code for small blocks and a library call for large blocks.
24385
24386 @item -mstringop-strategy=@var{alg}
24387 @opindex mstringop-strategy=@var{alg}
24388 Override the internal decision heuristic for the particular algorithm to use
24389 for inlining string operations. The allowed values for @var{alg} are:
24390
24391 @table @samp
24392 @item rep_byte
24393 @itemx rep_4byte
24394 @itemx rep_8byte
24395 Expand using i386 @code{rep} prefix of the specified size.
24396
24397 @item byte_loop
24398 @itemx loop
24399 @itemx unrolled_loop
24400 Expand into an inline loop.
24401
24402 @item libcall
24403 Always use a library call.
24404 @end table
24405
24406 @item -mmemcpy-strategy=@var{strategy}
24407 @opindex mmemcpy-strategy=@var{strategy}
24408 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
24409 should be inlined and what inline algorithm to use when the expected size
24410 of the copy operation is known. @var{strategy}
24411 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
24412 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
24413 the max byte size with which inline algorithm @var{alg} is allowed. For the last
24414 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
24415 in the list must be specified in increasing order. The minimal byte size for
24416 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
24417 preceding range.
24418
24419 @item -mmemset-strategy=@var{strategy}
24420 @opindex mmemset-strategy=@var{strategy}
24421 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
24422 @code{__builtin_memset} expansion.
24423
24424 @item -momit-leaf-frame-pointer
24425 @opindex momit-leaf-frame-pointer
24426 Don't keep the frame pointer in a register for leaf functions. This
24427 avoids the instructions to save, set up, and restore frame pointers and
24428 makes an extra register available in leaf functions. The option
24429 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
24430 which might make debugging harder.
24431
24432 @item -mtls-direct-seg-refs
24433 @itemx -mno-tls-direct-seg-refs
24434 @opindex mtls-direct-seg-refs
24435 Controls whether TLS variables may be accessed with offsets from the
24436 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
24437 or whether the thread base pointer must be added. Whether or not this
24438 is valid depends on the operating system, and whether it maps the
24439 segment to cover the entire TLS area.
24440
24441 For systems that use the GNU C Library, the default is on.
24442
24443 @item -msse2avx
24444 @itemx -mno-sse2avx
24445 @opindex msse2avx
24446 Specify that the assembler should encode SSE instructions with VEX
24447 prefix. The option @option{-mavx} turns this on by default.
24448
24449 @item -mfentry
24450 @itemx -mno-fentry
24451 @opindex mfentry
24452 If profiling is active (@option{-pg}), put the profiling
24453 counter call before the prologue.
24454 Note: On x86 architectures the attribute @code{ms_hook_prologue}
24455 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
24456
24457 @item -mrecord-mcount
24458 @itemx -mno-record-mcount
24459 @opindex mrecord-mcount
24460 If profiling is active (@option{-pg}), generate a __mcount_loc section
24461 that contains pointers to each profiling call. This is useful for
24462 automatically patching and out calls.
24463
24464 @item -mnop-mcount
24465 @itemx -mno-nop-mcount
24466 @opindex mnop-mcount
24467 If profiling is active (@option{-pg}), generate the calls to
24468 the profiling functions as nops. This is useful when they
24469 should be patched in later dynamically. This is likely only
24470 useful together with @option{-mrecord-mcount}.
24471
24472 @item -mskip-rax-setup
24473 @itemx -mno-skip-rax-setup
24474 @opindex mskip-rax-setup
24475 When generating code for the x86-64 architecture with SSE extensions
24476 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
24477 register when there are no variable arguments passed in vector registers.
24478
24479 @strong{Warning:} Since RAX register is used to avoid unnecessarily
24480 saving vector registers on stack when passing variable arguments, the
24481 impacts of this option are callees may waste some stack space,
24482 misbehave or jump to a random location. GCC 4.4 or newer don't have
24483 those issues, regardless the RAX register value.
24484
24485 @item -m8bit-idiv
24486 @itemx -mno-8bit-idiv
24487 @opindex m8bit-idiv
24488 On some processors, like Intel Atom, 8-bit unsigned integer divide is
24489 much faster than 32-bit/64-bit integer divide. This option generates a
24490 run-time check. If both dividend and divisor are within range of 0
24491 to 255, 8-bit unsigned integer divide is used instead of
24492 32-bit/64-bit integer divide.
24493
24494 @item -mavx256-split-unaligned-load
24495 @itemx -mavx256-split-unaligned-store
24496 @opindex mavx256-split-unaligned-load
24497 @opindex mavx256-split-unaligned-store
24498 Split 32-byte AVX unaligned load and store.
24499
24500 @item -mstack-protector-guard=@var{guard}
24501 @opindex mstack-protector-guard=@var{guard}
24502 Generate stack protection code using canary at @var{guard}. Supported
24503 locations are @samp{global} for global canary or @samp{tls} for per-thread
24504 canary in the TLS block (the default). This option has effect only when
24505 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
24506
24507 @item -mmitigate-rop
24508 @opindex mmitigate-rop
24509 Try to avoid generating code sequences that contain unintended return
24510 opcodes, to mitigate against certain forms of attack. At the moment,
24511 this option is limited in what it can do and should not be relied
24512 on to provide serious protection.
24513
24514 @item -mgeneral-regs-only
24515 @opindex mgeneral-regs-only
24516 Generate code that uses only the general-purpose registers. This
24517 prevents the compiler from using floating-point, vector, mask and bound
24518 registers.
24519
24520 @end table
24521
24522 These @samp{-m} switches are supported in addition to the above
24523 on x86-64 processors in 64-bit environments.
24524
24525 @table @gcctabopt
24526 @item -m32
24527 @itemx -m64
24528 @itemx -mx32
24529 @itemx -m16
24530 @itemx -miamcu
24531 @opindex m32
24532 @opindex m64
24533 @opindex mx32
24534 @opindex m16
24535 @opindex miamcu
24536 Generate code for a 16-bit, 32-bit or 64-bit environment.
24537 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
24538 to 32 bits, and
24539 generates code that runs on any i386 system.
24540
24541 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
24542 types to 64 bits, and generates code for the x86-64 architecture.
24543 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
24544 and @option{-mdynamic-no-pic} options.
24545
24546 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
24547 to 32 bits, and
24548 generates code for the x86-64 architecture.
24549
24550 The @option{-m16} option is the same as @option{-m32}, except for that
24551 it outputs the @code{.code16gcc} assembly directive at the beginning of
24552 the assembly output so that the binary can run in 16-bit mode.
24553
24554 The @option{-miamcu} option generates code which conforms to Intel MCU
24555 psABI. It requires the @option{-m32} option to be turned on.
24556
24557 @item -mno-red-zone
24558 @opindex mno-red-zone
24559 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
24560 by the x86-64 ABI; it is a 128-byte area beyond the location of the
24561 stack pointer that is not modified by signal or interrupt handlers
24562 and therefore can be used for temporary data without adjusting the stack
24563 pointer. The flag @option{-mno-red-zone} disables this red zone.
24564
24565 @item -mcmodel=small
24566 @opindex mcmodel=small
24567 Generate code for the small code model: the program and its symbols must
24568 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
24569 Programs can be statically or dynamically linked. This is the default
24570 code model.
24571
24572 @item -mcmodel=kernel
24573 @opindex mcmodel=kernel
24574 Generate code for the kernel code model. The kernel runs in the
24575 negative 2 GB of the address space.
24576 This model has to be used for Linux kernel code.
24577
24578 @item -mcmodel=medium
24579 @opindex mcmodel=medium
24580 Generate code for the medium model: the program is linked in the lower 2
24581 GB of the address space. Small symbols are also placed there. Symbols
24582 with sizes larger than @option{-mlarge-data-threshold} are put into
24583 large data or BSS sections and can be located above 2GB. Programs can
24584 be statically or dynamically linked.
24585
24586 @item -mcmodel=large
24587 @opindex mcmodel=large
24588 Generate code for the large model. This model makes no assumptions
24589 about addresses and sizes of sections.
24590
24591 @item -maddress-mode=long
24592 @opindex maddress-mode=long
24593 Generate code for long address mode. This is only supported for 64-bit
24594 and x32 environments. It is the default address mode for 64-bit
24595 environments.
24596
24597 @item -maddress-mode=short
24598 @opindex maddress-mode=short
24599 Generate code for short address mode. This is only supported for 32-bit
24600 and x32 environments. It is the default address mode for 32-bit and
24601 x32 environments.
24602 @end table
24603
24604 @node x86 Windows Options
24605 @subsection x86 Windows Options
24606 @cindex x86 Windows Options
24607 @cindex Windows Options for x86
24608
24609 These additional options are available for Microsoft Windows targets:
24610
24611 @table @gcctabopt
24612 @item -mconsole
24613 @opindex mconsole
24614 This option
24615 specifies that a console application is to be generated, by
24616 instructing the linker to set the PE header subsystem type
24617 required for console applications.
24618 This option is available for Cygwin and MinGW targets and is
24619 enabled by default on those targets.
24620
24621 @item -mdll
24622 @opindex mdll
24623 This option is available for Cygwin and MinGW targets. It
24624 specifies that a DLL---a dynamic link library---is to be
24625 generated, enabling the selection of the required runtime
24626 startup object and entry point.
24627
24628 @item -mnop-fun-dllimport
24629 @opindex mnop-fun-dllimport
24630 This option is available for Cygwin and MinGW targets. It
24631 specifies that the @code{dllimport} attribute should be ignored.
24632
24633 @item -mthread
24634 @opindex mthread
24635 This option is available for MinGW targets. It specifies
24636 that MinGW-specific thread support is to be used.
24637
24638 @item -municode
24639 @opindex municode
24640 This option is available for MinGW-w64 targets. It causes
24641 the @code{UNICODE} preprocessor macro to be predefined, and
24642 chooses Unicode-capable runtime startup code.
24643
24644 @item -mwin32
24645 @opindex mwin32
24646 This option is available for Cygwin and MinGW targets. It
24647 specifies that the typical Microsoft Windows predefined macros are to
24648 be set in the pre-processor, but does not influence the choice
24649 of runtime library/startup code.
24650
24651 @item -mwindows
24652 @opindex mwindows
24653 This option is available for Cygwin and MinGW targets. It
24654 specifies that a GUI application is to be generated by
24655 instructing the linker to set the PE header subsystem type
24656 appropriately.
24657
24658 @item -fno-set-stack-executable
24659 @opindex fno-set-stack-executable
24660 This option is available for MinGW targets. It specifies that
24661 the executable flag for the stack used by nested functions isn't
24662 set. This is necessary for binaries running in kernel mode of
24663 Microsoft Windows, as there the User32 API, which is used to set executable
24664 privileges, isn't available.
24665
24666 @item -fwritable-relocated-rdata
24667 @opindex fno-writable-relocated-rdata
24668 This option is available for MinGW and Cygwin targets. It specifies
24669 that relocated-data in read-only section is put into the @code{.data}
24670 section. This is a necessary for older runtimes not supporting
24671 modification of @code{.rdata} sections for pseudo-relocation.
24672
24673 @item -mpe-aligned-commons
24674 @opindex mpe-aligned-commons
24675 This option is available for Cygwin and MinGW targets. It
24676 specifies that the GNU extension to the PE file format that
24677 permits the correct alignment of COMMON variables should be
24678 used when generating code. It is enabled by default if
24679 GCC detects that the target assembler found during configuration
24680 supports the feature.
24681 @end table
24682
24683 See also under @ref{x86 Options} for standard options.
24684
24685 @node Xstormy16 Options
24686 @subsection Xstormy16 Options
24687 @cindex Xstormy16 Options
24688
24689 These options are defined for Xstormy16:
24690
24691 @table @gcctabopt
24692 @item -msim
24693 @opindex msim
24694 Choose startup files and linker script suitable for the simulator.
24695 @end table
24696
24697 @node Xtensa Options
24698 @subsection Xtensa Options
24699 @cindex Xtensa Options
24700
24701 These options are supported for Xtensa targets:
24702
24703 @table @gcctabopt
24704 @item -mconst16
24705 @itemx -mno-const16
24706 @opindex mconst16
24707 @opindex mno-const16
24708 Enable or disable use of @code{CONST16} instructions for loading
24709 constant values. The @code{CONST16} instruction is currently not a
24710 standard option from Tensilica. When enabled, @code{CONST16}
24711 instructions are always used in place of the standard @code{L32R}
24712 instructions. The use of @code{CONST16} is enabled by default only if
24713 the @code{L32R} instruction is not available.
24714
24715 @item -mfused-madd
24716 @itemx -mno-fused-madd
24717 @opindex mfused-madd
24718 @opindex mno-fused-madd
24719 Enable or disable use of fused multiply/add and multiply/subtract
24720 instructions in the floating-point option. This has no effect if the
24721 floating-point option is not also enabled. Disabling fused multiply/add
24722 and multiply/subtract instructions forces the compiler to use separate
24723 instructions for the multiply and add/subtract operations. This may be
24724 desirable in some cases where strict IEEE 754-compliant results are
24725 required: the fused multiply add/subtract instructions do not round the
24726 intermediate result, thereby producing results with @emph{more} bits of
24727 precision than specified by the IEEE standard. Disabling fused multiply
24728 add/subtract instructions also ensures that the program output is not
24729 sensitive to the compiler's ability to combine multiply and add/subtract
24730 operations.
24731
24732 @item -mserialize-volatile
24733 @itemx -mno-serialize-volatile
24734 @opindex mserialize-volatile
24735 @opindex mno-serialize-volatile
24736 When this option is enabled, GCC inserts @code{MEMW} instructions before
24737 @code{volatile} memory references to guarantee sequential consistency.
24738 The default is @option{-mserialize-volatile}. Use
24739 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
24740
24741 @item -mforce-no-pic
24742 @opindex mforce-no-pic
24743 For targets, like GNU/Linux, where all user-mode Xtensa code must be
24744 position-independent code (PIC), this option disables PIC for compiling
24745 kernel code.
24746
24747 @item -mtext-section-literals
24748 @itemx -mno-text-section-literals
24749 @opindex mtext-section-literals
24750 @opindex mno-text-section-literals
24751 These options control the treatment of literal pools. The default is
24752 @option{-mno-text-section-literals}, which places literals in a separate
24753 section in the output file. This allows the literal pool to be placed
24754 in a data RAM/ROM, and it also allows the linker to combine literal
24755 pools from separate object files to remove redundant literals and
24756 improve code size. With @option{-mtext-section-literals}, the literals
24757 are interspersed in the text section in order to keep them as close as
24758 possible to their references. This may be necessary for large assembly
24759 files. Literals for each function are placed right before that function.
24760
24761 @item -mauto-litpools
24762 @itemx -mno-auto-litpools
24763 @opindex mauto-litpools
24764 @opindex mno-auto-litpools
24765 These options control the treatment of literal pools. The default is
24766 @option{-mno-auto-litpools}, which places literals in a separate
24767 section in the output file unless @option{-mtext-section-literals} is
24768 used. With @option{-mauto-litpools} the literals are interspersed in
24769 the text section by the assembler. Compiler does not produce explicit
24770 @code{.literal} directives and loads literals into registers with
24771 @code{MOVI} instructions instead of @code{L32R} to let the assembler
24772 do relaxation and place literals as necessary. This option allows
24773 assembler to create several literal pools per function and assemble
24774 very big functions, which may not be possible with
24775 @option{-mtext-section-literals}.
24776
24777 @item -mtarget-align
24778 @itemx -mno-target-align
24779 @opindex mtarget-align
24780 @opindex mno-target-align
24781 When this option is enabled, GCC instructs the assembler to
24782 automatically align instructions to reduce branch penalties at the
24783 expense of some code density. The assembler attempts to widen density
24784 instructions to align branch targets and the instructions following call
24785 instructions. If there are not enough preceding safe density
24786 instructions to align a target, no widening is performed. The
24787 default is @option{-mtarget-align}. These options do not affect the
24788 treatment of auto-aligned instructions like @code{LOOP}, which the
24789 assembler always aligns, either by widening density instructions or
24790 by inserting NOP instructions.
24791
24792 @item -mlongcalls
24793 @itemx -mno-longcalls
24794 @opindex mlongcalls
24795 @opindex mno-longcalls
24796 When this option is enabled, GCC instructs the assembler to translate
24797 direct calls to indirect calls unless it can determine that the target
24798 of a direct call is in the range allowed by the call instruction. This
24799 translation typically occurs for calls to functions in other source
24800 files. Specifically, the assembler translates a direct @code{CALL}
24801 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
24802 The default is @option{-mno-longcalls}. This option should be used in
24803 programs where the call target can potentially be out of range. This
24804 option is implemented in the assembler, not the compiler, so the
24805 assembly code generated by GCC still shows direct call
24806 instructions---look at the disassembled object code to see the actual
24807 instructions. Note that the assembler uses an indirect call for
24808 every cross-file call, not just those that really are out of range.
24809 @end table
24810
24811 @node zSeries Options
24812 @subsection zSeries Options
24813 @cindex zSeries options
24814
24815 These are listed under @xref{S/390 and zSeries Options}.
24816
24817
24818 @c man end
24819
24820 @node Spec Files
24821 @section Specifying Subprocesses and the Switches to Pass to Them
24822 @cindex Spec Files
24823
24824 @command{gcc} is a driver program. It performs its job by invoking a
24825 sequence of other programs to do the work of compiling, assembling and
24826 linking. GCC interprets its command-line parameters and uses these to
24827 deduce which programs it should invoke, and which command-line options
24828 it ought to place on their command lines. This behavior is controlled
24829 by @dfn{spec strings}. In most cases there is one spec string for each
24830 program that GCC can invoke, but a few programs have multiple spec
24831 strings to control their behavior. The spec strings built into GCC can
24832 be overridden by using the @option{-specs=} command-line switch to specify
24833 a spec file.
24834
24835 @dfn{Spec files} are plain-text files that are used to construct spec
24836 strings. They consist of a sequence of directives separated by blank
24837 lines. The type of directive is determined by the first non-whitespace
24838 character on the line, which can be one of the following:
24839
24840 @table @code
24841 @item %@var{command}
24842 Issues a @var{command} to the spec file processor. The commands that can
24843 appear here are:
24844
24845 @table @code
24846 @item %include <@var{file}>
24847 @cindex @code{%include}
24848 Search for @var{file} and insert its text at the current point in the
24849 specs file.
24850
24851 @item %include_noerr <@var{file}>
24852 @cindex @code{%include_noerr}
24853 Just like @samp{%include}, but do not generate an error message if the include
24854 file cannot be found.
24855
24856 @item %rename @var{old_name} @var{new_name}
24857 @cindex @code{%rename}
24858 Rename the spec string @var{old_name} to @var{new_name}.
24859
24860 @end table
24861
24862 @item *[@var{spec_name}]:
24863 This tells the compiler to create, override or delete the named spec
24864 string. All lines after this directive up to the next directive or
24865 blank line are considered to be the text for the spec string. If this
24866 results in an empty string then the spec is deleted. (Or, if the
24867 spec did not exist, then nothing happens.) Otherwise, if the spec
24868 does not currently exist a new spec is created. If the spec does
24869 exist then its contents are overridden by the text of this
24870 directive, unless the first character of that text is the @samp{+}
24871 character, in which case the text is appended to the spec.
24872
24873 @item [@var{suffix}]:
24874 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
24875 and up to the next directive or blank line are considered to make up the
24876 spec string for the indicated suffix. When the compiler encounters an
24877 input file with the named suffix, it processes the spec string in
24878 order to work out how to compile that file. For example:
24879
24880 @smallexample
24881 .ZZ:
24882 z-compile -input %i
24883 @end smallexample
24884
24885 This says that any input file whose name ends in @samp{.ZZ} should be
24886 passed to the program @samp{z-compile}, which should be invoked with the
24887 command-line switch @option{-input} and with the result of performing the
24888 @samp{%i} substitution. (See below.)
24889
24890 As an alternative to providing a spec string, the text following a
24891 suffix directive can be one of the following:
24892
24893 @table @code
24894 @item @@@var{language}
24895 This says that the suffix is an alias for a known @var{language}. This is
24896 similar to using the @option{-x} command-line switch to GCC to specify a
24897 language explicitly. For example:
24898
24899 @smallexample
24900 .ZZ:
24901 @@c++
24902 @end smallexample
24903
24904 Says that .ZZ files are, in fact, C++ source files.
24905
24906 @item #@var{name}
24907 This causes an error messages saying:
24908
24909 @smallexample
24910 @var{name} compiler not installed on this system.
24911 @end smallexample
24912 @end table
24913
24914 GCC already has an extensive list of suffixes built into it.
24915 This directive adds an entry to the end of the list of suffixes, but
24916 since the list is searched from the end backwards, it is effectively
24917 possible to override earlier entries using this technique.
24918
24919 @end table
24920
24921 GCC has the following spec strings built into it. Spec files can
24922 override these strings or create their own. Note that individual
24923 targets can also add their own spec strings to this list.
24924
24925 @smallexample
24926 asm Options to pass to the assembler
24927 asm_final Options to pass to the assembler post-processor
24928 cpp Options to pass to the C preprocessor
24929 cc1 Options to pass to the C compiler
24930 cc1plus Options to pass to the C++ compiler
24931 endfile Object files to include at the end of the link
24932 link Options to pass to the linker
24933 lib Libraries to include on the command line to the linker
24934 libgcc Decides which GCC support library to pass to the linker
24935 linker Sets the name of the linker
24936 predefines Defines to be passed to the C preprocessor
24937 signed_char Defines to pass to CPP to say whether @code{char} is signed
24938 by default
24939 startfile Object files to include at the start of the link
24940 @end smallexample
24941
24942 Here is a small example of a spec file:
24943
24944 @smallexample
24945 %rename lib old_lib
24946
24947 *lib:
24948 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
24949 @end smallexample
24950
24951 This example renames the spec called @samp{lib} to @samp{old_lib} and
24952 then overrides the previous definition of @samp{lib} with a new one.
24953 The new definition adds in some extra command-line options before
24954 including the text of the old definition.
24955
24956 @dfn{Spec strings} are a list of command-line options to be passed to their
24957 corresponding program. In addition, the spec strings can contain
24958 @samp{%}-prefixed sequences to substitute variable text or to
24959 conditionally insert text into the command line. Using these constructs
24960 it is possible to generate quite complex command lines.
24961
24962 Here is a table of all defined @samp{%}-sequences for spec
24963 strings. Note that spaces are not generated automatically around the
24964 results of expanding these sequences. Therefore you can concatenate them
24965 together or combine them with constant text in a single argument.
24966
24967 @table @code
24968 @item %%
24969 Substitute one @samp{%} into the program name or argument.
24970
24971 @item %i
24972 Substitute the name of the input file being processed.
24973
24974 @item %b
24975 Substitute the basename of the input file being processed.
24976 This is the substring up to (and not including) the last period
24977 and not including the directory.
24978
24979 @item %B
24980 This is the same as @samp{%b}, but include the file suffix (text after
24981 the last period).
24982
24983 @item %d
24984 Marks the argument containing or following the @samp{%d} as a
24985 temporary file name, so that that file is deleted if GCC exits
24986 successfully. Unlike @samp{%g}, this contributes no text to the
24987 argument.
24988
24989 @item %g@var{suffix}
24990 Substitute a file name that has suffix @var{suffix} and is chosen
24991 once per compilation, and mark the argument in the same way as
24992 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
24993 name is now chosen in a way that is hard to predict even when previously
24994 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
24995 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
24996 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
24997 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
24998 was simply substituted with a file name chosen once per compilation,
24999 without regard to any appended suffix (which was therefore treated
25000 just like ordinary text), making such attacks more likely to succeed.
25001
25002 @item %u@var{suffix}
25003 Like @samp{%g}, but generates a new temporary file name
25004 each time it appears instead of once per compilation.
25005
25006 @item %U@var{suffix}
25007 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
25008 new one if there is no such last file name. In the absence of any
25009 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
25010 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
25011 involves the generation of two distinct file names, one
25012 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
25013 simply substituted with a file name chosen for the previous @samp{%u},
25014 without regard to any appended suffix.
25015
25016 @item %j@var{suffix}
25017 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
25018 writable, and if @option{-save-temps} is not used;
25019 otherwise, substitute the name
25020 of a temporary file, just like @samp{%u}. This temporary file is not
25021 meant for communication between processes, but rather as a junk
25022 disposal mechanism.
25023
25024 @item %|@var{suffix}
25025 @itemx %m@var{suffix}
25026 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
25027 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
25028 all. These are the two most common ways to instruct a program that it
25029 should read from standard input or write to standard output. If you
25030 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
25031 construct: see for example @file{f/lang-specs.h}.
25032
25033 @item %.@var{SUFFIX}
25034 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
25035 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
25036 terminated by the next space or %.
25037
25038 @item %w
25039 Marks the argument containing or following the @samp{%w} as the
25040 designated output file of this compilation. This puts the argument
25041 into the sequence of arguments that @samp{%o} substitutes.
25042
25043 @item %o
25044 Substitutes the names of all the output files, with spaces
25045 automatically placed around them. You should write spaces
25046 around the @samp{%o} as well or the results are undefined.
25047 @samp{%o} is for use in the specs for running the linker.
25048 Input files whose names have no recognized suffix are not compiled
25049 at all, but they are included among the output files, so they are
25050 linked.
25051
25052 @item %O
25053 Substitutes the suffix for object files. Note that this is
25054 handled specially when it immediately follows @samp{%g, %u, or %U},
25055 because of the need for those to form complete file names. The
25056 handling is such that @samp{%O} is treated exactly as if it had already
25057 been substituted, except that @samp{%g, %u, and %U} do not currently
25058 support additional @var{suffix} characters following @samp{%O} as they do
25059 following, for example, @samp{.o}.
25060
25061 @item %p
25062 Substitutes the standard macro predefinitions for the
25063 current target machine. Use this when running @command{cpp}.
25064
25065 @item %P
25066 Like @samp{%p}, but puts @samp{__} before and after the name of each
25067 predefined macro, except for macros that start with @samp{__} or with
25068 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
25069 C@.
25070
25071 @item %I
25072 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
25073 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
25074 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
25075 and @option{-imultilib} as necessary.
25076
25077 @item %s
25078 Current argument is the name of a library or startup file of some sort.
25079 Search for that file in a standard list of directories and substitute
25080 the full name found. The current working directory is included in the
25081 list of directories scanned.
25082
25083 @item %T
25084 Current argument is the name of a linker script. Search for that file
25085 in the current list of directories to scan for libraries. If the file
25086 is located insert a @option{--script} option into the command line
25087 followed by the full path name found. If the file is not found then
25088 generate an error message. Note: the current working directory is not
25089 searched.
25090
25091 @item %e@var{str}
25092 Print @var{str} as an error message. @var{str} is terminated by a newline.
25093 Use this when inconsistent options are detected.
25094
25095 @item %(@var{name})
25096 Substitute the contents of spec string @var{name} at this point.
25097
25098 @item %x@{@var{option}@}
25099 Accumulate an option for @samp{%X}.
25100
25101 @item %X
25102 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
25103 spec string.
25104
25105 @item %Y
25106 Output the accumulated assembler options specified by @option{-Wa}.
25107
25108 @item %Z
25109 Output the accumulated preprocessor options specified by @option{-Wp}.
25110
25111 @item %a
25112 Process the @code{asm} spec. This is used to compute the
25113 switches to be passed to the assembler.
25114
25115 @item %A
25116 Process the @code{asm_final} spec. This is a spec string for
25117 passing switches to an assembler post-processor, if such a program is
25118 needed.
25119
25120 @item %l
25121 Process the @code{link} spec. This is the spec for computing the
25122 command line passed to the linker. Typically it makes use of the
25123 @samp{%L %G %S %D and %E} sequences.
25124
25125 @item %D
25126 Dump out a @option{-L} option for each directory that GCC believes might
25127 contain startup files. If the target supports multilibs then the
25128 current multilib directory is prepended to each of these paths.
25129
25130 @item %L
25131 Process the @code{lib} spec. This is a spec string for deciding which
25132 libraries are included on the command line to the linker.
25133
25134 @item %G
25135 Process the @code{libgcc} spec. This is a spec string for deciding
25136 which GCC support library is included on the command line to the linker.
25137
25138 @item %S
25139 Process the @code{startfile} spec. This is a spec for deciding which
25140 object files are the first ones passed to the linker. Typically
25141 this might be a file named @file{crt0.o}.
25142
25143 @item %E
25144 Process the @code{endfile} spec. This is a spec string that specifies
25145 the last object files that are passed to the linker.
25146
25147 @item %C
25148 Process the @code{cpp} spec. This is used to construct the arguments
25149 to be passed to the C preprocessor.
25150
25151 @item %1
25152 Process the @code{cc1} spec. This is used to construct the options to be
25153 passed to the actual C compiler (@command{cc1}).
25154
25155 @item %2
25156 Process the @code{cc1plus} spec. This is used to construct the options to be
25157 passed to the actual C++ compiler (@command{cc1plus}).
25158
25159 @item %*
25160 Substitute the variable part of a matched option. See below.
25161 Note that each comma in the substituted string is replaced by
25162 a single space.
25163
25164 @item %<@code{S}
25165 Remove all occurrences of @code{-S} from the command line. Note---this
25166 command is position dependent. @samp{%} commands in the spec string
25167 before this one see @code{-S}, @samp{%} commands in the spec string
25168 after this one do not.
25169
25170 @item %:@var{function}(@var{args})
25171 Call the named function @var{function}, passing it @var{args}.
25172 @var{args} is first processed as a nested spec string, then split
25173 into an argument vector in the usual fashion. The function returns
25174 a string which is processed as if it had appeared literally as part
25175 of the current spec.
25176
25177 The following built-in spec functions are provided:
25178
25179 @table @code
25180 @item @code{getenv}
25181 The @code{getenv} spec function takes two arguments: an environment
25182 variable name and a string. If the environment variable is not
25183 defined, a fatal error is issued. Otherwise, the return value is the
25184 value of the environment variable concatenated with the string. For
25185 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
25186
25187 @smallexample
25188 %:getenv(TOPDIR /include)
25189 @end smallexample
25190
25191 expands to @file{/path/to/top/include}.
25192
25193 @item @code{if-exists}
25194 The @code{if-exists} spec function takes one argument, an absolute
25195 pathname to a file. If the file exists, @code{if-exists} returns the
25196 pathname. Here is a small example of its usage:
25197
25198 @smallexample
25199 *startfile:
25200 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
25201 @end smallexample
25202
25203 @item @code{if-exists-else}
25204 The @code{if-exists-else} spec function is similar to the @code{if-exists}
25205 spec function, except that it takes two arguments. The first argument is
25206 an absolute pathname to a file. If the file exists, @code{if-exists-else}
25207 returns the pathname. If it does not exist, it returns the second argument.
25208 This way, @code{if-exists-else} can be used to select one file or another,
25209 based on the existence of the first. Here is a small example of its usage:
25210
25211 @smallexample
25212 *startfile:
25213 crt0%O%s %:if-exists(crti%O%s) \
25214 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
25215 @end smallexample
25216
25217 @item @code{replace-outfile}
25218 The @code{replace-outfile} spec function takes two arguments. It looks for the
25219 first argument in the outfiles array and replaces it with the second argument. Here
25220 is a small example of its usage:
25221
25222 @smallexample
25223 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
25224 @end smallexample
25225
25226 @item @code{remove-outfile}
25227 The @code{remove-outfile} spec function takes one argument. It looks for the
25228 first argument in the outfiles array and removes it. Here is a small example
25229 its usage:
25230
25231 @smallexample
25232 %:remove-outfile(-lm)
25233 @end smallexample
25234
25235 @item @code{pass-through-libs}
25236 The @code{pass-through-libs} spec function takes any number of arguments. It
25237 finds any @option{-l} options and any non-options ending in @file{.a} (which it
25238 assumes are the names of linker input library archive files) and returns a
25239 result containing all the found arguments each prepended by
25240 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
25241 intended to be passed to the LTO linker plugin.
25242
25243 @smallexample
25244 %:pass-through-libs(%G %L %G)
25245 @end smallexample
25246
25247 @item @code{print-asm-header}
25248 The @code{print-asm-header} function takes no arguments and simply
25249 prints a banner like:
25250
25251 @smallexample
25252 Assembler options
25253 =================
25254
25255 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
25256 @end smallexample
25257
25258 It is used to separate compiler options from assembler options
25259 in the @option{--target-help} output.
25260 @end table
25261
25262 @item %@{@code{S}@}
25263 Substitutes the @code{-S} switch, if that switch is given to GCC@.
25264 If that switch is not specified, this substitutes nothing. Note that
25265 the leading dash is omitted when specifying this option, and it is
25266 automatically inserted if the substitution is performed. Thus the spec
25267 string @samp{%@{foo@}} matches the command-line option @option{-foo}
25268 and outputs the command-line option @option{-foo}.
25269
25270 @item %W@{@code{S}@}
25271 Like %@{@code{S}@} but mark last argument supplied within as a file to be
25272 deleted on failure.
25273
25274 @item %@{@code{S}*@}
25275 Substitutes all the switches specified to GCC whose names start
25276 with @code{-S}, but which also take an argument. This is used for
25277 switches like @option{-o}, @option{-D}, @option{-I}, etc.
25278 GCC considers @option{-o foo} as being
25279 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
25280 text, including the space. Thus two arguments are generated.
25281
25282 @item %@{@code{S}*&@code{T}*@}
25283 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
25284 (the order of @code{S} and @code{T} in the spec is not significant).
25285 There can be any number of ampersand-separated variables; for each the
25286 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
25287
25288 @item %@{@code{S}:@code{X}@}
25289 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
25290
25291 @item %@{!@code{S}:@code{X}@}
25292 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
25293
25294 @item %@{@code{S}*:@code{X}@}
25295 Substitutes @code{X} if one or more switches whose names start with
25296 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
25297 once, no matter how many such switches appeared. However, if @code{%*}
25298 appears somewhere in @code{X}, then @code{X} is substituted once
25299 for each matching switch, with the @code{%*} replaced by the part of
25300 that switch matching the @code{*}.
25301
25302 If @code{%*} appears as the last part of a spec sequence then a space
25303 is added after the end of the last substitution. If there is more
25304 text in the sequence, however, then a space is not generated. This
25305 allows the @code{%*} substitution to be used as part of a larger
25306 string. For example, a spec string like this:
25307
25308 @smallexample
25309 %@{mcu=*:--script=%*/memory.ld@}
25310 @end smallexample
25311
25312 @noindent
25313 when matching an option like @option{-mcu=newchip} produces:
25314
25315 @smallexample
25316 --script=newchip/memory.ld
25317 @end smallexample
25318
25319 @item %@{.@code{S}:@code{X}@}
25320 Substitutes @code{X}, if processing a file with suffix @code{S}.
25321
25322 @item %@{!.@code{S}:@code{X}@}
25323 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
25324
25325 @item %@{,@code{S}:@code{X}@}
25326 Substitutes @code{X}, if processing a file for language @code{S}.
25327
25328 @item %@{!,@code{S}:@code{X}@}
25329 Substitutes @code{X}, if not processing a file for language @code{S}.
25330
25331 @item %@{@code{S}|@code{P}:@code{X}@}
25332 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
25333 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
25334 @code{*} sequences as well, although they have a stronger binding than
25335 the @samp{|}. If @code{%*} appears in @code{X}, all of the
25336 alternatives must be starred, and only the first matching alternative
25337 is substituted.
25338
25339 For example, a spec string like this:
25340
25341 @smallexample
25342 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
25343 @end smallexample
25344
25345 @noindent
25346 outputs the following command-line options from the following input
25347 command-line options:
25348
25349 @smallexample
25350 fred.c -foo -baz
25351 jim.d -bar -boggle
25352 -d fred.c -foo -baz -boggle
25353 -d jim.d -bar -baz -boggle
25354 @end smallexample
25355
25356 @item %@{S:X; T:Y; :D@}
25357
25358 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
25359 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
25360 be as many clauses as you need. This may be combined with @code{.},
25361 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
25362
25363
25364 @end table
25365
25366 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
25367 construct may contain other nested @samp{%} constructs or spaces, or
25368 even newlines. They are processed as usual, as described above.
25369 Trailing white space in @code{X} is ignored. White space may also
25370 appear anywhere on the left side of the colon in these constructs,
25371 except between @code{.} or @code{*} and the corresponding word.
25372
25373 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
25374 handled specifically in these constructs. If another value of
25375 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
25376 @option{-W} switch is found later in the command line, the earlier
25377 switch value is ignored, except with @{@code{S}*@} where @code{S} is
25378 just one letter, which passes all matching options.
25379
25380 The character @samp{|} at the beginning of the predicate text is used to
25381 indicate that a command should be piped to the following command, but
25382 only if @option{-pipe} is specified.
25383
25384 It is built into GCC which switches take arguments and which do not.
25385 (You might think it would be useful to generalize this to allow each
25386 compiler's spec to say which switches take arguments. But this cannot
25387 be done in a consistent fashion. GCC cannot even decide which input
25388 files have been specified without knowing which switches take arguments,
25389 and it must know which input files to compile in order to tell which
25390 compilers to run).
25391
25392 GCC also knows implicitly that arguments starting in @option{-l} are to be
25393 treated as compiler output files, and passed to the linker in their
25394 proper position among the other output files.
25395
25396 @node Environment Variables
25397 @section Environment Variables Affecting GCC
25398 @cindex environment variables
25399
25400 @c man begin ENVIRONMENT
25401 This section describes several environment variables that affect how GCC
25402 operates. Some of them work by specifying directories or prefixes to use
25403 when searching for various kinds of files. Some are used to specify other
25404 aspects of the compilation environment.
25405
25406 Note that you can also specify places to search using options such as
25407 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
25408 take precedence over places specified using environment variables, which
25409 in turn take precedence over those specified by the configuration of GCC@.
25410 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
25411 GNU Compiler Collection (GCC) Internals}.
25412
25413 @table @env
25414 @item LANG
25415 @itemx LC_CTYPE
25416 @c @itemx LC_COLLATE
25417 @itemx LC_MESSAGES
25418 @c @itemx LC_MONETARY
25419 @c @itemx LC_NUMERIC
25420 @c @itemx LC_TIME
25421 @itemx LC_ALL
25422 @findex LANG
25423 @findex LC_CTYPE
25424 @c @findex LC_COLLATE
25425 @findex LC_MESSAGES
25426 @c @findex LC_MONETARY
25427 @c @findex LC_NUMERIC
25428 @c @findex LC_TIME
25429 @findex LC_ALL
25430 @cindex locale
25431 These environment variables control the way that GCC uses
25432 localization information which allows GCC to work with different
25433 national conventions. GCC inspects the locale categories
25434 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
25435 so. These locale categories can be set to any value supported by your
25436 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
25437 Kingdom encoded in UTF-8.
25438
25439 The @env{LC_CTYPE} environment variable specifies character
25440 classification. GCC uses it to determine the character boundaries in
25441 a string; this is needed for some multibyte encodings that contain quote
25442 and escape characters that are otherwise interpreted as a string
25443 end or escape.
25444
25445 The @env{LC_MESSAGES} environment variable specifies the language to
25446 use in diagnostic messages.
25447
25448 If the @env{LC_ALL} environment variable is set, it overrides the value
25449 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
25450 and @env{LC_MESSAGES} default to the value of the @env{LANG}
25451 environment variable. If none of these variables are set, GCC
25452 defaults to traditional C English behavior.
25453
25454 @item TMPDIR
25455 @findex TMPDIR
25456 If @env{TMPDIR} is set, it specifies the directory to use for temporary
25457 files. GCC uses temporary files to hold the output of one stage of
25458 compilation which is to be used as input to the next stage: for example,
25459 the output of the preprocessor, which is the input to the compiler
25460 proper.
25461
25462 @item GCC_COMPARE_DEBUG
25463 @findex GCC_COMPARE_DEBUG
25464 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
25465 @option{-fcompare-debug} to the compiler driver. See the documentation
25466 of this option for more details.
25467
25468 @item GCC_EXEC_PREFIX
25469 @findex GCC_EXEC_PREFIX
25470 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
25471 names of the subprograms executed by the compiler. No slash is added
25472 when this prefix is combined with the name of a subprogram, but you can
25473 specify a prefix that ends with a slash if you wish.
25474
25475 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
25476 an appropriate prefix to use based on the pathname it is invoked with.
25477
25478 If GCC cannot find the subprogram using the specified prefix, it
25479 tries looking in the usual places for the subprogram.
25480
25481 The default value of @env{GCC_EXEC_PREFIX} is
25482 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
25483 the installed compiler. In many cases @var{prefix} is the value
25484 of @code{prefix} when you ran the @file{configure} script.
25485
25486 Other prefixes specified with @option{-B} take precedence over this prefix.
25487
25488 This prefix is also used for finding files such as @file{crt0.o} that are
25489 used for linking.
25490
25491 In addition, the prefix is used in an unusual way in finding the
25492 directories to search for header files. For each of the standard
25493 directories whose name normally begins with @samp{/usr/local/lib/gcc}
25494 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
25495 replacing that beginning with the specified prefix to produce an
25496 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
25497 @file{foo/bar} just before it searches the standard directory
25498 @file{/usr/local/lib/bar}.
25499 If a standard directory begins with the configured
25500 @var{prefix} then the value of @var{prefix} is replaced by
25501 @env{GCC_EXEC_PREFIX} when looking for header files.
25502
25503 @item COMPILER_PATH
25504 @findex COMPILER_PATH
25505 The value of @env{COMPILER_PATH} is a colon-separated list of
25506 directories, much like @env{PATH}. GCC tries the directories thus
25507 specified when searching for subprograms, if it can't find the
25508 subprograms using @env{GCC_EXEC_PREFIX}.
25509
25510 @item LIBRARY_PATH
25511 @findex LIBRARY_PATH
25512 The value of @env{LIBRARY_PATH} is a colon-separated list of
25513 directories, much like @env{PATH}. When configured as a native compiler,
25514 GCC tries the directories thus specified when searching for special
25515 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
25516 using GCC also uses these directories when searching for ordinary
25517 libraries for the @option{-l} option (but directories specified with
25518 @option{-L} come first).
25519
25520 @item LANG
25521 @findex LANG
25522 @cindex locale definition
25523 This variable is used to pass locale information to the compiler. One way in
25524 which this information is used is to determine the character set to be used
25525 when character literals, string literals and comments are parsed in C and C++.
25526 When the compiler is configured to allow multibyte characters,
25527 the following values for @env{LANG} are recognized:
25528
25529 @table @samp
25530 @item C-JIS
25531 Recognize JIS characters.
25532 @item C-SJIS
25533 Recognize SJIS characters.
25534 @item C-EUCJP
25535 Recognize EUCJP characters.
25536 @end table
25537
25538 If @env{LANG} is not defined, or if it has some other value, then the
25539 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
25540 recognize and translate multibyte characters.
25541 @end table
25542
25543 @noindent
25544 Some additional environment variables affect the behavior of the
25545 preprocessor.
25546
25547 @include cppenv.texi
25548
25549 @c man end
25550
25551 @node Precompiled Headers
25552 @section Using Precompiled Headers
25553 @cindex precompiled headers
25554 @cindex speed of compilation
25555
25556 Often large projects have many header files that are included in every
25557 source file. The time the compiler takes to process these header files
25558 over and over again can account for nearly all of the time required to
25559 build the project. To make builds faster, GCC allows you to
25560 @dfn{precompile} a header file.
25561
25562 To create a precompiled header file, simply compile it as you would any
25563 other file, if necessary using the @option{-x} option to make the driver
25564 treat it as a C or C++ header file. You may want to use a
25565 tool like @command{make} to keep the precompiled header up-to-date when
25566 the headers it contains change.
25567
25568 A precompiled header file is searched for when @code{#include} is
25569 seen in the compilation. As it searches for the included file
25570 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
25571 compiler looks for a precompiled header in each directory just before it
25572 looks for the include file in that directory. The name searched for is
25573 the name specified in the @code{#include} with @samp{.gch} appended. If
25574 the precompiled header file can't be used, it is ignored.
25575
25576 For instance, if you have @code{#include "all.h"}, and you have
25577 @file{all.h.gch} in the same directory as @file{all.h}, then the
25578 precompiled header file is used if possible, and the original
25579 header is used otherwise.
25580
25581 Alternatively, you might decide to put the precompiled header file in a
25582 directory and use @option{-I} to ensure that directory is searched
25583 before (or instead of) the directory containing the original header.
25584 Then, if you want to check that the precompiled header file is always
25585 used, you can put a file of the same name as the original header in this
25586 directory containing an @code{#error} command.
25587
25588 This also works with @option{-include}. So yet another way to use
25589 precompiled headers, good for projects not designed with precompiled
25590 header files in mind, is to simply take most of the header files used by
25591 a project, include them from another header file, precompile that header
25592 file, and @option{-include} the precompiled header. If the header files
25593 have guards against multiple inclusion, they are skipped because
25594 they've already been included (in the precompiled header).
25595
25596 If you need to precompile the same header file for different
25597 languages, targets, or compiler options, you can instead make a
25598 @emph{directory} named like @file{all.h.gch}, and put each precompiled
25599 header in the directory, perhaps using @option{-o}. It doesn't matter
25600 what you call the files in the directory; every precompiled header in
25601 the directory is considered. The first precompiled header
25602 encountered in the directory that is valid for this compilation is
25603 used; they're searched in no particular order.
25604
25605 There are many other possibilities, limited only by your imagination,
25606 good sense, and the constraints of your build system.
25607
25608 A precompiled header file can be used only when these conditions apply:
25609
25610 @itemize
25611 @item
25612 Only one precompiled header can be used in a particular compilation.
25613
25614 @item
25615 A precompiled header can't be used once the first C token is seen. You
25616 can have preprocessor directives before a precompiled header; you cannot
25617 include a precompiled header from inside another header.
25618
25619 @item
25620 The precompiled header file must be produced for the same language as
25621 the current compilation. You can't use a C precompiled header for a C++
25622 compilation.
25623
25624 @item
25625 The precompiled header file must have been produced by the same compiler
25626 binary as the current compilation is using.
25627
25628 @item
25629 Any macros defined before the precompiled header is included must
25630 either be defined in the same way as when the precompiled header was
25631 generated, or must not affect the precompiled header, which usually
25632 means that they don't appear in the precompiled header at all.
25633
25634 The @option{-D} option is one way to define a macro before a
25635 precompiled header is included; using a @code{#define} can also do it.
25636 There are also some options that define macros implicitly, like
25637 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
25638 defined this way.
25639
25640 @item If debugging information is output when using the precompiled
25641 header, using @option{-g} or similar, the same kind of debugging information
25642 must have been output when building the precompiled header. However,
25643 a precompiled header built using @option{-g} can be used in a compilation
25644 when no debugging information is being output.
25645
25646 @item The same @option{-m} options must generally be used when building
25647 and using the precompiled header. @xref{Submodel Options},
25648 for any cases where this rule is relaxed.
25649
25650 @item Each of the following options must be the same when building and using
25651 the precompiled header:
25652
25653 @gccoptlist{-fexceptions}
25654
25655 @item
25656 Some other command-line options starting with @option{-f},
25657 @option{-p}, or @option{-O} must be defined in the same way as when
25658 the precompiled header was generated. At present, it's not clear
25659 which options are safe to change and which are not; the safest choice
25660 is to use exactly the same options when generating and using the
25661 precompiled header. The following are known to be safe:
25662
25663 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
25664 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
25665 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
25666 -pedantic-errors}
25667
25668 @end itemize
25669
25670 For all of these except the last, the compiler automatically
25671 ignores the precompiled header if the conditions aren't met. If you
25672 find an option combination that doesn't work and doesn't cause the
25673 precompiled header to be ignored, please consider filing a bug report,
25674 see @ref{Bugs}.
25675
25676 If you do use differing options when generating and using the
25677 precompiled header, the actual behavior is a mixture of the
25678 behavior for the options. For instance, if you use @option{-g} to
25679 generate the precompiled header but not when using it, you may or may
25680 not get debugging information for routines in the precompiled header.